home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / f2csrc.zip / f2csrc / src / p1defs.h < prev    next >
Text File  |  1994-02-22  |  6KB  |  159 lines

  1. #define P1_UNKNOWN 0
  2. #define P1_COMMENT 1        /* Fortan comment string */
  3. #define P1_EOF 2        /* End of file dummy token */
  4. #define P1_SET_LINE 3        /* Reset the line counter */
  5. #define P1_FILENAME 4        /* Name of current input file */
  6. #define P1_NAME_POINTER 5    /* Pointer to hash table entry */
  7. #define P1_CONST 6        /* Some constant value */
  8. #define P1_EXPR 7        /* Followed by opcode */
  9.  
  10. /* The next two tokens could be grouped together, since they always come
  11.    from an Addr structure */
  12.  
  13. #define P1_IDENT 8        /* Char string identifier in addrp->user
  14.                    field */
  15. #define P1_EXTERN 9        /* Pointer to external symbol entry */
  16.  
  17. #define P1_HEAD 10        /* Function header info */
  18. #define P1_LIST 11        /* A list of data (e.g. arguments) will
  19.                    follow the tag, type, and count */
  20. #define P1_LITERAL 12        /* Hold the index into the literal pool */
  21. #define P1_LABEL 13        /* label value */
  22. #define P1_ASGOTO 14        /* Store the hash table pointer of
  23.                    variable used in assigned goto */
  24. #define P1_GOTO 15        /* Store the statement number */
  25. #define P1_IF 16        /* store the condition as an expression */
  26. #define P1_ELSE 17        /* No data */
  27. #define P1_ELIF 18        /* store the condition as an expression */
  28. #define P1_ENDIF 19        /* Marks the end of a block IF */
  29. #define P1_ENDELSE 20        /* Marks the end of a block ELSE */
  30. #define P1_ADDR 21        /* Addr data; used for arrays, common and
  31.                    equiv addressing, NOT for names, idents
  32.                    or externs */
  33. #define P1_SUBR_RET 22        /* Subroutine return; the return expression
  34.                    follows */
  35. #define P1_COMP_GOTO 23        /* Computed goto; has expr, label list */
  36. #define P1_FOR 24        /* C FOR loop; three expressions follow */
  37. #define P1_ENDFOR 25        /* End of C FOR loop */
  38. #define P1_FORTRAN 26        /* original Fortran source */
  39. #define P1_CHARP 27        /* user.Charp field -- for long names */
  40. #define P1_WHILE1START 28    /* start of DO WHILE */
  41. #define P1_WHILE2START 29    /* rest of DO WHILE */
  42. #define P1_PROCODE 30        /* invoke procode() -- to adjust params */
  43. #define P1_ELSEIFSTART 31    /* handle extra code for abs, min, max
  44.                    in else if() */
  45.  
  46. #define P1_FILENAME_MAX    256    /* max filename length to retain (for -g) */
  47. #define P1_STMTBUFSIZE 1400
  48.  
  49.  
  50.  
  51. #define COMMENT_BUFFER_SIZE 255    /* max number of chars in each comment */
  52. #define CONSTANT_STR_MAX 1000    /* max number of chars in string constant */
  53.  
  54. void    p1_asgoto Argdcl((Addrp));
  55. void    p1_comment Argdcl((char*));
  56. void    p1_elif Argdcl((tagptr));
  57. void    p1_else Argdcl((void));
  58. void    p1_endif Argdcl((void));
  59. void    p1_expr Argdcl((tagptr));
  60. void    p1_for Argdcl((tagptr, tagptr, tagptr));
  61. void    p1_goto Argdcl((long int));
  62. void    p1_head Argdcl((int, char*));
  63. void    p1_if Argdcl((tagptr));
  64. void    p1_label Argdcl((long int));
  65. void    p1_line_number Argdcl((long int));
  66. void    p1_subr_ret Argdcl((tagptr));
  67. void    p1comp_goto Argdcl((tagptr, int, struct Labelblock**));
  68. void    p1else_end Argdcl((void));
  69. void    p1for_end Argdcl((void));
  70. void    p1put Argdcl((int));
  71. void    p1puts Argdcl((int, char*));
  72.  
  73. /* The pass 1 intermediate file has the following format:
  74.  
  75.     <ascii-integer-rep> [ : [ <sp> [ <data> ]]] \n
  76.  
  77.    e.g.   1: This is a comment
  78.  
  79.    This format is destined to change in the future, but for now a readable
  80.    form is more desirable than a compact form.
  81.  
  82.    NOTES ABOUT THE P1 FORMAT
  83.    ----------------------------------------------------------------------
  84.  
  85.     P1_COMMENT:  The comment string (in   <data>)   may be at most
  86.         COMMENT_BUFFER_SIZE bytes long.  It must contain no newlines
  87.         or null characters.  A side effect of the way comments are
  88.         read in   lex.c   is that no '\377' chars may be in a
  89.         comment either.
  90.  
  91.     P1_SET_LINE:  <data>  holds the line number in the current source file.
  92.  
  93.     P1_INC_LINE:  Increment the source line number;   <data>   is empty.
  94.  
  95.     P1_NAME_POINTER:  <data>   holds the integer representation of a
  96.               pointer into a hash table entry.
  97.  
  98.     P1_CONST:  the first field in   <data>   is a type tag (one of the
  99.            TYxxxx   macros), the next field holds the constant
  100.            value
  101.  
  102.     P1_EXPR:  <data>   holds the opcode number of the expression,
  103.           followed by the type of the expression (required for
  104.           OPCONV).  Next is the value of   vleng.
  105.           The type of operation represented by the
  106.           opcode determines how many of the following data items
  107.           are part of this expression.
  108.  
  109.     P1_IDENT:  <data>   holds the type, then storage, then the
  110.            char string identifier in the   addrp->user   field.
  111.  
  112.     P1_EXTERN:  <data>   holds an offset into the external symbol
  113.             table entry
  114.  
  115.     P1_HEAD:  the first field in   <data>  is the procedure class, the
  116.           second is the name of the procedure
  117.  
  118.     P1_LIST:  the first field in   <data>   is the tag, the second the
  119.           type of the list, the third the number of elements in
  120.           the list
  121.  
  122.     P1_LITERAL:  <data>   holds the   litnum   of a value in the
  123.              literal pool.
  124.  
  125.     P1_LABEL:  <data>   holds the statement number of the current
  126.            line
  127.  
  128.     P1_ASGOTO:  <data>   holds the hash table pointer of the variable
  129.  
  130.     P1_GOTO:  <data>   holds the statement number to jump to
  131.  
  132.     P1_IF:  <data>   is empty, the following expression is the IF
  133.             condition.
  134.  
  135.     P1_ELSE:  <data>   is empty.
  136.  
  137.     P1_ELIF:  <data>   is empty, the following expression is the IF
  138.           condition.
  139.  
  140.     P1_ENDIF:  <data>   is empty.
  141.  
  142.     P1_ENDELSE:  <data>   is empty.
  143.  
  144.     P1_ADDR:   <data>   holds a direct copy of the structure.  The
  145.           next expression is a copy of    vleng,   and the next a
  146.           copy of    memoffset.
  147.  
  148.     P1_SUBR_RET:  The next token is an expression for the return value.
  149.  
  150.     P1_COMP_GOTO:  The next token is an integer expression, the
  151.                following one a list of labels.
  152.  
  153.     P1_FOR:  The next three expressions are the Init, Test, and
  154.              Increment expressions of a C FOR loop.
  155.  
  156.     P1_ENDFOR:  Marks the end of the body of a FOR loop
  157.  
  158. */
  159.