home *** CD-ROM | disk | FTP | other *** search
/ Gold Fish 2 / goldfish_vol2_cd1.bin / files / dev / misc / p2c / src / notes < prev    next >
Text File  |  1993-12-21  |  33KB  |  759 lines

  1.  
  2. THE GRAND P2C NOTES FILE:
  3.  
  4. This file contains notes to myself recording bugs, flaws, and suggested
  5. improvements to p2c.  They have roughly been separated into "old", "older",
  6. and "oldest" groups.  I can't guarantee I'll do any of these.  If you do,
  7. please mail me the diffs so I can incorporate them into the next release.
  8. Thanks!
  9.                         -- Dave Gillespie
  10.                            daveg@csvax.caltech.edu
  11.  
  12. -----------------------------------------------------------------------------
  13.  
  14.    The Pascal declaration
  15.  
  16.       type foo = set of (one, two);
  17.  
  18.    does not ever write out an "enum { one, two }" declaration in C!
  19.  
  20. -----------------------------------------------------------------------------
  21.  
  22.    Handling of comments that trail the ELSE clause of an IF statement
  23.    could use some work.
  24.  
  25. -----------------------------------------------------------------------------
  26.  
  27.    Technically speaking, "for byte := min to max do" is legal even
  28.    if min > 255, i.e., the limits only need to be in range if the
  29.    body of the loop executes.  Thus, FOR loops should really use a
  30.    shadow parameter not just when max is the constant 255, but
  31.    whenever min or max are not provably in byte range.
  32.  
  33. -----------------------------------------------------------------------------
  34.  
  35.    Have a "-M"-like mode in which FREE is suppressed altogether, useful
  36.    in case p2c crashes because bugs have corrupted malloc's free list.
  37.  
  38. -----------------------------------------------------------------------------
  39.  
  40.    For expressions building small-sets whose maximum element is <= 15,
  41.    use "1 << x" instead of "1L << x".
  42.  
  43. -----------------------------------------------------------------------------
  44.  
  45.    Handle VAX Pascal VARYING OF CHARs used as the arguments of WITH
  46.    statements.
  47.  
  48. -----------------------------------------------------------------------------
  49.  
  50.    StringTruncLimit would be helped by expr.c:strmax() interpreting
  51.    sprintf control strings.  For %s, use strmax of the corresponding
  52.    argument.  For %d, use 11, etc.  For %.10s, use min(10, strmax(arg)).
  53.    For %.*s, just use strmax(arg), I guess.
  54.  
  55.    Have a mode in which such assignments are automatically truncated.
  56.  
  57.    Perform truncation testing for non-VAR procedure arguments, too.
  58.  
  59. -----------------------------------------------------------------------------
  60.  
  61.    In cref.p, the "strappend(buf,#0)" statement translates into
  62.    "strcpy(STR1,buf); strcpy(buf,STR1)" with a warning about a null
  63.    character in a sprintf control string!
  64.  
  65. -----------------------------------------------------------------------------
  66.  
  67.    Still having problems where the opening comment of an imported
  68.    module's interface text is copied into the program.
  69.  
  70. -----------------------------------------------------------------------------
  71.  
  72.    VAX Pascal features not yet handled:
  73.  
  74.       [UNSAFE] attribute is only implemented in a few situations.
  75.       [UNBOUND] attribute on a procedure says it doesn't need a static link.
  76.       [TRUNCATE] attribute on a parameter allows optional params w/no default.
  77.       [LIST] attribute on a parameter is like &rest in Lisp.
  78.       Support types like, e.g., [LONG] BOOLEAN.
  79.       Can assign "structurally compatible" but different record types.
  80.       File intrinsics need serious work, especially OPEN.
  81.       If a copy param is [READONLY], don't need to copy it.
  82.       If a procedure is [ASYNCHRONOUS], make all its variables volatile.
  83.       If a procedure is [NOOPTIMIZE], make all its variables volatile.
  84.       Provide a real implementation of BIN function and :BIN read format.
  85.       BIT_OFFSET and CARD intrinsics are not supported.
  86.  
  87. -----------------------------------------------------------------------------
  88.  
  89.    Modula-2 features not yet handled:
  90.  
  91.       Local modules are faked up in a pretty superficial way.
  92.       WORD is compatible with both pointers and CARDINALs.
  93.       WORD parameters are compatible with any word-sized object.
  94.       ARRAY OF WORD parameters are compatible with absolutely anything.
  95.       Improve treatment of character strings.
  96.       Find manuals for real implementations of Modula-2 and implement
  97.          any common language extensions.
  98.       Fix p2c to read system.m2 instead of system.imp automatically.
  99.  
  100. -----------------------------------------------------------------------------
  101.  
  102.    Oregon Software Pascal features not yet handled:
  103.  
  104.     procedure noioerror(var f:file);
  105.         Built-in.  Sets a flag on an already-open file so that
  106.         I/O errors record an error code rather than crashing.
  107.         Each file has its own error code.
  108.  
  109.     function ioerror(var f:file) : boolean;
  110.         True if an error has occurred in the file.
  111.  
  112.     function iostatus(var f:file) : integer;
  113.         The error code, when ioerror was true.
  114.  
  115.     reset and rewrite ignore the third parameter, and allow a fourth
  116.     param which is an integer variable that receives a status code.
  117.     Without this param, open errors are fatal.  An optional param
  118.     may be omitted as in reset(f,'foo',,v);
  119.  
  120. -----------------------------------------------------------------------------
  121.  
  122.    In p_search, if a file contains const/var/type/procedure/function
  123.    declarations without any module declaration, surround the entire
  124.    file with an implicit "module <generated-name>; {PERMANENT}" ... "end.".
  125.    This would help the Oregon Software dialect considerably.
  126.  
  127. -----------------------------------------------------------------------------
  128.  
  129.    Provide an explicit IncludeFrom syntax for "no include file".
  130.    E.g., "IncludeFrom dos 0".
  131.  
  132. -----------------------------------------------------------------------------
  133.  
  134.    In docast, smallsets are converted to large sets of the requested type.
  135.    Wouldn't it be better to convert to a set of 0..31 of the base type?
  136.    This would keep foo([]), where the argument is "set of char", from
  137.    allocating a full 256-bit array for the temporary.
  138.  
  139. -----------------------------------------------------------------------------
  140.  
  141.    When initializing a constant variant record or array of same in which
  142.    non-first variants are initialized, create a function to do the
  143.    initialization, plus, for modules w/o initializers, a note to call
  144.    this function.  Another possibility:  Initialize the array as well as
  145.    possible, but leave zeros in the variant parts.  Then the function
  146.    has only to fix up the non-first variant fields.
  147.  
  148. -----------------------------------------------------------------------------
  149.  
  150.    Figure out some way to initialize packed array constants, e.g., a short
  151.    macro PACK4(x,y)=(((x)<<4)+(y)) which is used inside the C initializer.
  152.    Alternatively, implement initializer functions as above and use those.
  153.  
  154. -----------------------------------------------------------------------------
  155.  
  156.    How about declaring Volatile any variables local to a function which
  157.    are used after the first RECOVER?  GNU also suggests writing the
  158.    statement:  "&foo;" which will have no side effect except to make
  159.    foo essentially volatile, without relying on ANSI features.
  160.  
  161. -----------------------------------------------------------------------------
  162.  
  163.    Test the macros for GET, PUT, etc.
  164.  
  165. -----------------------------------------------------------------------------
  166.  
  167.    Can the #if 0'd code for strinsert in funcs.c be changed to test
  168.    strcpyleft?
  169.  
  170. -----------------------------------------------------------------------------
  171.  
  172.    Even in Ansi mode, p2c seems to be casting Anyptrs into other pointer
  173.    types explicitly.  This is an automatic conversion in Ansi C.
  174.  
  175. -----------------------------------------------------------------------------
  176.  
  177.    A Turbo typed constant or VAX initialized variable with a VarMacro
  178.    loses its initializer!
  179.  
  180. -----------------------------------------------------------------------------
  181.  
  182.    Test the ability of the parser to recover from common problems such
  183.    as too many/few arguments to a procedure, missing/extra semicolon, etc.
  184.    One major problem has been with undeclared identifiers being used as
  185.    type names.
  186.  
  187. -----------------------------------------------------------------------------
  188.  
  189.    Line breaker still needs considerable tuning!
  190.  
  191. -----------------------------------------------------------------------------
  192.  
  193.    How about indenting trailing comments analogously to the code:
  194.    Try to indent to column C+(X-Y), where C=original column number,
  195.    X=output indentation, Y=original input indentation.
  196.  
  197.    Even fancier would be to study all the comment indentations in the
  198.    function or struct decl to discover if most comments are at the same
  199.    absolute indentation; if so, compute the average or minimum amount of
  200.    space preceding the comments and indent the C comments to an analogous
  201.    position.
  202.  
  203. -----------------------------------------------------------------------------
  204.  
  205.    After "type foo = bar;" variables declared as type foo are translated
  206.    as type bar.  Ought to assume the user has two names for a reason,
  207.    and copy the distinction into the C code.
  208.  
  209. -----------------------------------------------------------------------------
  210.  
  211.    Warn if address is taken of an arithmetic expression like "v1+1".
  212.    Allow user to declare certain bicalls as l-values, e.g., so that
  213.    LSC's topLeft and botRight macros won't generate complaints.
  214.  
  215. -----------------------------------------------------------------------------
  216.  
  217.    Consider changing the "language" modes into a set of p2crc files
  218.    which can be included to support the various modes.
  219.  
  220. -----------------------------------------------------------------------------
  221.  
  222.    If we exchange the THEN and ELSE parts of an IF statement, be sure
  223.    to exchange their comments as well!
  224.  
  225. -----------------------------------------------------------------------------
  226.  
  227.    How about checking for a ".p2crc" file in the user's home directory.
  228.  
  229. -----------------------------------------------------------------------------
  230.  
  231.    Store comments in the following situations:
  232.       On the first line of a record decl.
  233.       On the default clause of a CASE statement
  234.         (use same trick as for ELSE clauses).
  235.       On the "end" of a CASE statement.
  236.       On null statements.
  237.       Use stealcomments for, e.g., decl_comments and others.
  238.  
  239. -----------------------------------------------------------------------------
  240.  
  241.    Think of other formatting options for format_gen to support.
  242.  
  243. -----------------------------------------------------------------------------
  244.  
  245.    Consider converting gratuitous BEGIN/END pairs into gratuitous
  246.    { } pairs.
  247.  
  248. -----------------------------------------------------------------------------
  249.  
  250.    The construction "s := copy(s, 1, 3)" converts to a big mess that
  251.    could be simplified to "s[3] = 0".
  252.  
  253. -----------------------------------------------------------------------------
  254.  
  255.    Have a mode (and make it the default!) in which declarations are mixed
  256.    if and only if the original Pascal decls were mixed.  Simply store
  257.    a flag in each meaning to mark "mixed-with-preceding-meaning".
  258.  
  259. -----------------------------------------------------------------------------
  260.  
  261.    Have a column number at which to put names in variable and typedef
  262.    declarations.  Have another option to choose whether a '*' preceding
  263.    a name should be left- or right-justified within the skipped space:
  264.     int     *foo;     or
  265.         int *    foo;
  266.  
  267. -----------------------------------------------------------------------------
  268.  
  269.    Support the /*
  270.                 *
  271.                 */ form for multi-line comments.
  272.  
  273. -----------------------------------------------------------------------------
  274.  
  275.    Have an indentation parameter for the word "else" by itself on a line.
  276.  
  277. -----------------------------------------------------------------------------
  278.  
  279.    Have an option to use C++'s "//" comments when possible.
  280.    (0=never, 1=always, def=only for trailing comments.)
  281.  
  282. -----------------------------------------------------------------------------
  283.  
  284.    Allow real comments to come before top-of-file comments like {Language}.
  285.  
  286. -----------------------------------------------------------------------------
  287.  
  288.    Teach the line breaker to remove spaces around innermost operators
  289.    if in a crunch.
  290.  
  291. -----------------------------------------------------------------------------
  292.  
  293.    Is it possible that the line breaker is losing counts?  A line that
  294.    included lots of invisible parens converted to visible ones was
  295.    allowed to be suspiciously long.
  296.  
  297. -----------------------------------------------------------------------------
  298.  
  299.    The notation t^ where t is a text file should convert \n's to
  300.    spaces if necessary.
  301.  
  302. -----------------------------------------------------------------------------
  303.  
  304.    The assignment and type cast "f4 := tf4(i)" where type
  305.       "tf4 = function (i, j : integer) : str255"
  306.    generates something really weird.
  307.  
  308. -----------------------------------------------------------------------------
  309.  
  310.    The conditional expression  strsub(s,1,4) = 'Spam'
  311.    could be translated as      strncmp(s, "Spam", 4)
  312.  
  313. -----------------------------------------------------------------------------
  314.  
  315.    Consider an option which generates a "file.p2c" or "module.p2c"
  316.    file, that will in the future be read in by p2c as another p2crc
  317.    type of file, both when the module is re-translated later and when
  318.    it is imported.  This file would contain commands like "NoSideEffects"
  319.    for functions which are found to have this property, etc.
  320.  
  321. -----------------------------------------------------------------------------
  322.  
  323.    Extend the "file.log" or "module.log" file to contain a more detailed
  324.    account of the translation, including all notes and warnings which were
  325.    even considered.  For example, ALL calls to na_lsl with non-constant
  326.    shifts would be noted, even if regular notes in this case were not
  327.    requested.  Also, funny transformations along the lines of
  328.    "str[0] := chr(len)" and "ch >= #128" should be mentioned in the log.
  329.    How about a summary of non-default p2crc options and command-line args?
  330.  
  331. -----------------------------------------------------------------------------
  332.  
  333.    Create a TypeMacro analogous to FuncMacro, VarMacro, and ConstMacro.
  334.    Should the definition be expressed in C or Pascal notation?  (Yuck---not
  335.    a C type parser!)
  336.  
  337. -----------------------------------------------------------------------------
  338.  
  339.    In argument type promotions, should "unsigned char" be promoted to
  340.    "unsigned int"?
  341.  
  342. -----------------------------------------------------------------------------
  343.  
  344.    Turbo's FExpand translation is really weird.
  345.  
  346. -----------------------------------------------------------------------------
  347.  
  348.    Can we translate Erase(x) to unlink(x)?  (This could just be a FuncMacro.)
  349.  
  350. -----------------------------------------------------------------------------
  351.  
  352.    There should be an option that causes a type to be explicitly named,
  353.    even if it would not otherwise have had a typedef name.  Have a mode
  354.    that does this for all pointer types.
  355.  
  356. -----------------------------------------------------------------------------
  357.  
  358.    Make sure that the construction:  if blah then {comment} else other
  359.    does not rewrite to if (!blah) other; i.e., a comment in this situation
  360.    should generate an actual placeholder statement.  Or perhaps, a null
  361.    statement written explicitly by the Pascal programmer should always
  362.    produce a placeholder.
  363.  
  364. -----------------------------------------------------------------------------
  365.  
  366.    Allow the line breaker to treat a \003 as if it were a \010.  The penalty
  367.    should be enough less than SameIndentPenalty that same-indent cases will
  368.    cause the introduction of parentheses.
  369.  
  370. -----------------------------------------------------------------------------
  371.  
  372.    A comment of the form "{------}" where the whole comment is 78, 79 or 80
  373.    columns wide, should be reduced by two to take the larger C comment
  374.    brackets into account.  Also, "{*****}", etc.
  375.  
  376. -----------------------------------------------------------------------------
  377.  
  378.    There should be a mode that translates "halt" as "exit(0)", and another
  379.    that translates it as "exit(1)".
  380.  
  381. -----------------------------------------------------------------------------
  382.  
  383.    There should be a mode in which strread's "j" parameter is completely
  384.    ignored.  Also, in this mode, don't make a copy of the string being
  385.    read.
  386.  
  387. -----------------------------------------------------------------------------
  388.  
  389.    Is there an option that generates an fflush(stdout) after every write
  390.    (not writeln) statement?  It should be easy to do---the code is already
  391.    there to support the prompt statement.
  392.  
  393. -----------------------------------------------------------------------------
  394.  
  395.    Check out the Size_T_Long option; size_t appears to be int on most
  396.    machines, not long.
  397.  
  398. -----------------------------------------------------------------------------
  399.  
  400.    The type "size_t" should really be made into a separate type, with a
  401.    function to cast to type "size_t".  This function would always do
  402.    the cast unless sizeof(int) == sizeof(long), or unless the expression
  403.    only involves constants and objects or functions of type "size_t".
  404.  
  405. -----------------------------------------------------------------------------
  406.  
  407.    Finish the Turbo Pascal features (in the file turbo.imp).
  408.  
  409. -----------------------------------------------------------------------------
  410.  
  411.    Are there any ways to take advantage of "x ?: y" in GCC?
  412.    Is it worth using GCC constructor expressions for procedure variables?
  413.    How about generating "volatile" and "const" for suitable functions?
  414.       (doing this in the .h file would be very difficult...)
  415.    Use the "asm" notation of 5.17 to implement var x ['y'] declarations.
  416.  
  417. -----------------------------------------------------------------------------
  418.  
  419.    Recognize GCC extensions in pc_expr().  (By the way, remember
  420.    to implement += and friends in pc_expr(), too!)
  421.  
  422. -----------------------------------------------------------------------------
  423.  
  424.    Lightspeed C can't handle "typedef char foo[];" which arises from a
  425.    MAXINT-sized array type declaration.
  426.  
  427. -----------------------------------------------------------------------------
  428.  
  429.    "Return" and friends are only introduced once.  In code of the form:
  430.  
  431.       if (!done) { foo(); }  if (!done) { bar(); }
  432.  
  433.     p2c should, after patching up bar(), check if the foo() branch is
  434.     now also ripe for rearranging.
  435.  
  436. -----------------------------------------------------------------------------
  437.  
  438.    Have a global "paranoia" flag.  Default=use current defaults for other
  439.    options.  1=conservative defaults for other options.  0=sloppy defaults
  440.    for other options.
  441.  
  442. -----------------------------------------------------------------------------
  443.  
  444.    Rather than just generating a note, have writes of attribute characters
  445.    convert into calls to a "set attribute" procedure, such as nc_sethighlight.
  446.    Is there any way of generalizing this into something useful for
  447.    non-HP-Pascal-workstation users?
  448.  
  449. -----------------------------------------------------------------------------
  450.  
  451.    Warn when character constants which are control codes are produced.
  452.    (E.g., arrow keys, etc.)  Also, have an option which deletes all
  453.    highlighting codes from strings being output.
  454.  
  455. -----------------------------------------------------------------------------
  456.  
  457.    Think how nice things would be if the arithmetic routines actually
  458.    maintained the distinction between tp_int and tp_integer themselves,
  459.    so that makeexpr_longcast didn't have to second-guess them.
  460.  
  461. -----------------------------------------------------------------------------
  462.  
  463.    Importing FS *still* copies its "file support" comment into the importing
  464.    program!
  465.  
  466. -----------------------------------------------------------------------------
  467.  
  468.    Should parameterize those last few hard-wired names, such as "P_eoln",
  469.    "LONG_MAX", ... ?
  470.  
  471. -----------------------------------------------------------------------------
  472.  
  473.    Check if we need to cache away any more options' values, as we did for
  474.    VarStrings.  How about FoldConstants, SetBits, CopyStructs?
  475.  
  476.  
  477. =============================================================================
  478.  
  479.  
  480.    Support the "CSignif" option (by not generating C identifiers which
  481.    would not be unique if only that many characters were significant).
  482.  
  483. -----------------------------------------------------------------------------
  484.  
  485.    What if a procedure accesses strmax of a var-string parameter of a
  486.    parent procedure?  (Right now this generates a note.)
  487.  
  488. -----------------------------------------------------------------------------
  489.  
  490.    Handle full constructors for strings.
  491.    Handle small-array constants.
  492.  
  493. -----------------------------------------------------------------------------
  494.  
  495.    Have an option that causes ANYVAR's to be translated to void *'s.  In
  496.    this mode, all uses of ANYVAR variables will need to be cast to the
  497.    proper type, in the function body rather than in calls to the function.
  498.  
  499. -----------------------------------------------------------------------------
  500.  
  501.    Handle reading enums.  Add full error checking for reading booleans.
  502.    (And integer subranges?)
  503.  
  504. -----------------------------------------------------------------------------
  505.  
  506.    Support the "BigSetConst" option by creating constant arrays just as the
  507.    Pascal compiler does.
  508.  
  509. -----------------------------------------------------------------------------
  510.  
  511.    The 2^(N+1) - 2^M method for generating [M..N] is not safe if N is 31.
  512.    If the small-sets we are dealing with encompass the value 31 (== setbits-1)
  513.    then we must use the bitwise construction instead.  (Currently, the
  514.    translator just issues a note.)
  515.  
  516.    (If N is 31, 2^32 will most likely evaluate to 0 on most machines, which
  517.    is the correct value.  So this is only a minor problem.)
  518.  
  519. -----------------------------------------------------------------------------
  520.  
  521.    Big-set constants right now are always folded.  Provide a mechanism
  522.    for defined set constants, say by having a #define with an argument
  523.    which is the name of the temporary variable to use for the set.
  524.  
  525. -----------------------------------------------------------------------------
  526.  
  527.    Should we convert NA_LONGWORD-type variants into C casts?
  528.  
  529. -----------------------------------------------------------------------------
  530.  
  531.    Are there implementations of strcpy that do not return their first
  532.    argument?  If so, should have an option that says so.
  533.  
  534. -----------------------------------------------------------------------------
  535.  
  536.    Handle absolute-addressed variables better.  For  var a[12345]:integer,
  537.    create an initialized int *.  For  var a['foo']:integer, create an int *
  538.    which is initialized to NULL and accessed by a macro which locates the
  539.    symbol the first time the variable is used.
  540.  
  541. -----------------------------------------------------------------------------
  542.  
  543.    Handle the idiom, "reset(f, name); open(f);"
  544.  
  545. -----------------------------------------------------------------------------
  546.  
  547.    Should have an option that lowercases all file names used in "reset",
  548.    "fixfname", etc.  This should be on by default.
  549.  
  550. -----------------------------------------------------------------------------
  551.  
  552.    Add more complete support for conformant arrays.  Specifically, support
  553.    non-GNU compilers by converting variable-sized array declarations into
  554.    pointer declarations with calls to alloca or malloc/free (what if the
  555.    function uses free and contains return statements)?  Also convert
  556.    variable-array references into explicit index arithmetic.
  557.  
  558. -----------------------------------------------------------------------------
  559.  
  560.    Have a mode in which the body of a TRY-RECOVER is moved out into
  561.    a sub-procedure all its own, communicating with the parent through
  562.    varstructs as usual, so that the ANSI C warning about what longjmp
  563.    can do to the local variables is avoided.  Alternatively, have an
  564.    option in which all necessary locals are declared volatile when
  565.    setjmps are present.
  566.  
  567. -----------------------------------------------------------------------------
  568.  
  569.    If a sub-procedure refers to a parent's variable with the VAX Pascal
  570.    [STATIC] attribute, that variable is declared "static" inside the
  571.    varstruct!  Need to convert it into a varref to a static variable in
  572.    the parent.
  573.  
  574. -----------------------------------------------------------------------------
  575.  
  576.    When comparing records and arrays a la UCSD Pascal, should expand
  577.    into an "&&" expression comparing each field individually.  (What about
  578.    variants?  Maybe just compare the first variant, or the tagged
  579.    variant.)  Probably best to write a struct-comparison function the
  580.    first time a given type of struct is compared; that way, the function
  581.    can include a complete if tree or switch statement in the case of
  582.    tagged unions.
  583.  
  584. -----------------------------------------------------------------------------
  585.  
  586.    In the checkvarchanged code, take aliasing of VAR parameters into account.
  587.    For example, in "procedure p(s1 : string; var s2 : string)" p2c now avoids
  588.    copying s1 if s1 is not changed within p, but probably should also require
  589.    that s2 not change, or at least that s1 have been read and used before s2
  590.    is changed.
  591.  
  592. -----------------------------------------------------------------------------
  593.  
  594.    Provide an option that tells the code generator to provide helpful
  595.    comments of its own when generated code may be obscure.
  596.  
  597.  
  598. =============================================================================
  599.  
  600.  
  601.    Compact the various data structures.  In particular, typical runs
  602.    show the majority of memory is used by Meanings and Symbols for
  603.    global and imported objects.
  604.  
  605. -----------------------------------------------------------------------------
  606.  
  607.    The program wastes memory.  Find ways to reduce memory usage, and to
  608.    avoid leaving dead records on the heap.  (Garbage collection?  Yuck!)
  609.    (Maybe GC between each function declaration would be okay.)
  610.  
  611. -----------------------------------------------------------------------------
  612.  
  613.    Assign better names to temporaries.  Also, could avoid making redundant
  614.    temporaries by generating a unique temporary every time one is needed,
  615.    then crunching them down at the end just before the declarations are
  616.    written out.  Each temporary would maintain a list of all the other
  617.    temporaries (of the same type) with which it would conflict.  (This
  618.    would avoid the current method's waste when several temps are created,
  619.    then most are cancelled.)  Also, note that char STR1[10], STR2[20] can
  620.    be considered type-compatible and merged into STR[20].
  621.  
  622. -----------------------------------------------------------------------------
  623.  
  624.    Don't generate _STR_xxx structure names if they aren't forward-referenced.
  625.  
  626. -----------------------------------------------------------------------------
  627.  
  628.    Can optimize, e.g., "strpos(a,b) = 0" to a call to strstr() or strchr(),
  629.    even though these ANSI functions are not Pascal-like enough to use in 
  630.    the general case.
  631.  
  632. -----------------------------------------------------------------------------
  633.  
  634.    Complete the handling of "usecommas=0" mode.
  635.  
  636. -----------------------------------------------------------------------------
  637.  
  638.    Optimize "s := strltrim(s)", "s := strrtrim(s)", and both together.
  639.  
  640. -----------------------------------------------------------------------------
  641.  
  642.    Convert "(ch < 'a') or (ch > 'z')" to "!islower(ch)", and so on.
  643.    Also do "!islower(ch) && !isupper(ch)" => "!isalpha(ch)", etc.
  644.  
  645. -----------------------------------------------------------------------------
  646.  
  647.    Find other cases in which to call mixassignments().
  648.  
  649. -----------------------------------------------------------------------------
  650.  
  651.    The sequence:   sprintf(buf + strlen(buf), "...", ...);
  652.                    sprintf(buf + strlen(buf), "...", ...);
  653.    could be changed to a single sprintf.
  654.    Also, "sprintf(temp, "...%s", ..., buf); strcpy(buf, temp); (above);"
  655.    could be crunched down.  (This comes from strinsert, then strappend.)
  656.  
  657. -----------------------------------------------------------------------------
  658.  
  659.    If there is only one assignment to a structured function's return
  660.    variable, and that assignment is at the very end and assigns a local
  661.    variable to the return variable, then merge the variables.
  662.    (Example: name_list in netcmp's datastruct module.  RET_name_list
  663.    should be renamed to namestr.)
  664.  
  665. -----------------------------------------------------------------------------
  666.  
  667.    Have an option that causes if-then-else's to be replaced by ? :'s in
  668.    certain cases.  If the branches of the if are either both returns or
  669.    both assignments to the same variable, which has no side effects, and
  670.    if the whole conditional will be simple enough to fit on one line when
  671.    printed, then the ? : transformation is okay.
  672.  
  673. -----------------------------------------------------------------------------
  674.  
  675.    Have an option that makes limited use of variable initialization.
  676.    If the first statement of a function is an assignment of a constant
  677.    to a local variable, then the assignment is changed to an initialization.
  678.    (Non-constant initializers are probably too hard to check for safety.)
  679.    Should variables with initializers still be mixed?
  680.    (Example: valid_node_class in netcmp's datastructs module.)
  681.    File variable initialization is an especially good application for this.
  682.  
  683. -----------------------------------------------------------------------------
  684.  
  685.    Have an option that finds cases of multiple assignment.  For example:
  686.       a := x; b := x;   =>  a = b = x;
  687.       a := x; b := a;   =>  a = b = x;
  688.    (provided the objects in question have the same type).
  689.  
  690. -----------------------------------------------------------------------------
  691.  
  692.    Need an option that causes $if$'s to change to #if's, instead of being
  693.    evaluated at translation-time.  (This is *really hard* in general;
  694.    do it for some common cases, such as entire statements being commented
  695.    out, or fields being commented out of records.)
  696.  
  697. -----------------------------------------------------------------------------
  698.  
  699.    Have an option that prevents generation and inclusion of .h files for
  700.    modules; instead, each module would contain extern declarations for
  701.    the things it imports.  (Only declare names that are actually used---
  702.    this means the declarations will have to be emitted on a procedure-by-
  703.    procedure basis.)
  704.  
  705. -----------------------------------------------------------------------------
  706.  
  707.    Extend the ExpandIncludes option to compile include files as separate
  708.    stand-alone C modules.  The hard part is warning when the new module
  709.    uses a procedure which was declared static in an earlier C module.
  710.    Remember to re-emit all the proper #include's at the beginning.
  711.    Anything else?
  712.  
  713. -----------------------------------------------------------------------------
  714.  
  715.    Consider an option where the variables in a varStruct are made into
  716.    globals instead, or into parameters if there are few of them.
  717.  
  718. -----------------------------------------------------------------------------
  719.  
  720.    Perform a flow analysis after everything else is done; use this to
  721.    eliminate redundant checks, e.g., for nil pointers or non-open or
  722.    already-open files.  Also eliminate redundant "j" variables for
  723.    strwrite statements.
  724.  
  725. -----------------------------------------------------------------------------
  726.  
  727.    Need a method for simple pattern matching predicates in FuncMacros.
  728.    For example, allow special translations of functions where a given
  729.    argument is a known constant, or known to be positive, or two
  730.    arguments are the same, etc.
  731.  
  732. -----------------------------------------------------------------------------
  733.  
  734.    Have some way to provide run-time templates for fixblock/fixexpr-like
  735.    applications.  The user enters two C expressions A and B, possibly including
  736.    Prolog-like logical variables.  If fixexpr sees an expression matching A,
  737.    it rewrites it into the form of B.
  738.  
  739. -----------------------------------------------------------------------------
  740.  
  741.    Have an option to cause selected Pascal procedures or functions to be
  742.    expanded in-line.  Do this either by generating the keyword "inline",
  743.    or by doing the expansion in the translator.
  744.  
  745. -----------------------------------------------------------------------------
  746.  
  747.    Technically speaking, strcmp shouldn't be used to compute < and > for
  748.    strings on a machine with signed chars.  Should we care?
  749.  
  750. -----------------------------------------------------------------------------
  751.  
  752.    Have an option for creating a "display" of LINK pointers local to a
  753.    function.  Should only create such pointers for static levels which are
  754.    referred to in the function body.
  755.  
  756. -----------------------------------------------------------------------------
  757.  
  758.  
  759.