home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Fresh Fish 2
/
FFMCD02.bin
/
new
/
dev
/
misc
/
p2c
/
notes
< prev
next >
Wrap
Text File
|
1993-12-21
|
33KB
|
759 lines
THE GRAND P2C NOTES FILE:
This file contains notes to myself recording bugs, flaws, and suggested
improvements to p2c. They have roughly been separated into "old", "older",
and "oldest" groups. I can't guarantee I'll do any of these. If you do,
please mail me the diffs so I can incorporate them into the next release.
Thanks!
-- Dave Gillespie
daveg@csvax.caltech.edu
-----------------------------------------------------------------------------
The Pascal declaration
type foo = set of (one, two);
does not ever write out an "enum { one, two }" declaration in C!
-----------------------------------------------------------------------------
Handling of comments that trail the ELSE clause of an IF statement
could use some work.
-----------------------------------------------------------------------------
Technically speaking, "for byte := min to max do" is legal even
if min > 255, i.e., the limits only need to be in range if the
body of the loop executes. Thus, FOR loops should really use a
shadow parameter not just when max is the constant 255, but
whenever min or max are not provably in byte range.
-----------------------------------------------------------------------------
Have a "-M"-like mode in which FREE is suppressed altogether, useful
in case p2c crashes because bugs have corrupted malloc's free list.
-----------------------------------------------------------------------------
For expressions building small-sets whose maximum element is <= 15,
use "1 << x" instead of "1L << x".
-----------------------------------------------------------------------------
Handle VAX Pascal VARYING OF CHARs used as the arguments of WITH
statements.
-----------------------------------------------------------------------------
StringTruncLimit would be helped by expr.c:strmax() interpreting
sprintf control strings. For %s, use strmax of the corresponding
argument. For %d, use 11, etc. For %.10s, use min(10, strmax(arg)).
For %.*s, just use strmax(arg), I guess.
Have a mode in which such assignments are automatically truncated.
Perform truncation testing for non-VAR procedure arguments, too.
-----------------------------------------------------------------------------
In cref.p, the "strappend(buf,#0)" statement translates into
"strcpy(STR1,buf); strcpy(buf,STR1)" with a warning about a null
character in a sprintf control string!
-----------------------------------------------------------------------------
Still having problems where the opening comment of an imported
module's interface text is copied into the program.
-----------------------------------------------------------------------------
VAX Pascal features not yet handled:
[UNSAFE] attribute is only implemented in a few situations.
[UNBOUND] attribute on a procedure says it doesn't need a static link.
[TRUNCATE] attribute on a parameter allows optional params w/no default.
[LIST] attribute on a parameter is like &rest in Lisp.
Support types like, e.g., [LONG] BOOLEAN.
Can assign "structurally compatible" but different record types.
File intrinsics need serious work, especially OPEN.
If a copy param is [READONLY], don't need to copy it.
If a procedure is [ASYNCHRONOUS], make all its variables volatile.
If a procedure is [NOOPTIMIZE], make all its variables volatile.
Provide a real implementation of BIN function and :BIN read format.
BIT_OFFSET and CARD intrinsics are not supported.
-----------------------------------------------------------------------------
Modula-2 features not yet handled:
Local modules are faked up in a pretty superficial way.
WORD is compatible with both pointers and CARDINALs.
WORD parameters are compatible with any word-sized object.
ARRAY OF WORD parameters are compatible with absolutely anything.
Improve treatment of character strings.
Find manuals for real implementations of Modula-2 and implement
any common language extensions.
Fix p2c to read system.m2 instead of system.imp automatically.
-----------------------------------------------------------------------------
Oregon Software Pascal features not yet handled:
procedure noioerror(var f:file);
Built-in. Sets a flag on an already-open file so that
I/O errors record an error code rather than crashing.
Each file has its own error code.
function ioerror(var f:file) : boolean;
True if an error has occurred in the file.
function iostatus(var f:file) : integer;
The error code, when ioerror was true.
reset and rewrite ignore the third parameter, and allow a fourth
param which is an integer variable that receives a status code.
Without this param, open errors are fatal. An optional param
may be omitted as in reset(f,'foo',,v);
-----------------------------------------------------------------------------
In p_search, if a file contains const/var/type/procedure/function
declarations without any module declaration, surround the entire
file with an implicit "module <generated-name>; {PERMANENT}" ... "end.".
This would help the Oregon Software dialect considerably.
-----------------------------------------------------------------------------
Provide an explicit IncludeFrom syntax for "no include file".
E.g., "IncludeFrom dos 0".
-----------------------------------------------------------------------------
In docast, smallsets are converted to large sets of the requested type.
Wouldn't it be better to convert to a set of 0..31 of the base type?
This would keep foo([]), where the argument is "set of char", from
allocating a full 256-bit array for the temporary.
-----------------------------------------------------------------------------
When initializing a constant variant record or array of same in which
non-first variants are initialized, create a function to do the
initialization, plus, for modules w/o initializers, a note to call
this function. Another possibility: Initialize the array as well as
possible, but leave zeros in the variant parts. Then the function
has only to fix up the non-first variant fields.
-----------------------------------------------------------------------------
Figure out some way to initialize packed array constants, e.g., a short
macro PACK4(x,y)=(((x)<<4)+(y)) which is used inside the C initializer.
Alternatively, implement initializer functions as above and use those.
-----------------------------------------------------------------------------
How about declaring Volatile any variables local to a function which
are used after the first RECOVER? GNU also suggests writing the
statement: "&foo;" which will have no side effect except to make
foo essentially volatile, without relying on ANSI features.
-----------------------------------------------------------------------------
Test the macros for GET, PUT, etc.
-----------------------------------------------------------------------------
Can the #if 0'd code for strinsert in funcs.c be changed to test
strcpyleft?
-----------------------------------------------------------------------------
Even in Ansi mode, p2c seems to be casting Anyptrs into other pointer
types explicitly. This is an automatic conversion in Ansi C.
-----------------------------------------------------------------------------
A Turbo typed constant or VAX initialized variable with a VarMacro
loses its initializer!
-----------------------------------------------------------------------------
Test the ability of the parser to recover from common problems such
as too many/few arguments to a procedure, missing/extra semicolon, etc.
One major problem has been with undeclared identifiers being used as
type names.
-----------------------------------------------------------------------------
Line breaker still needs considerable tuning!
-----------------------------------------------------------------------------
How about indenting trailing comments analogously to