home *** CD-ROM | disk | FTP | other *** search
/ The C Users' Group Library 1994 August / wc-cdrom-cusersgrouplibrary-1994-08.iso / vol_300 / 345_01 / tlc.h < prev    next >
C/C++ Source or Header  |  1989-07-10  |  8KB  |  289 lines

  1. /* TLC.H - "The Last Cross-referencer" - Definition include file        */
  2. /*    Last Modified:    07/07/89                                            */
  3.  
  4. /*
  5. ---------------------------------------------------------------------
  6. Copyright (c) 1987-1989, Eduard Schwan Programs [esp] - All rights reserved
  7. TLC (The Last C-Cross-Referencer) and TLP (same, but for Pascal) are
  8. Cross-Reference Generators crafted and shot into the Public Domain by
  9. Eduard Schwan.  The source code and executable program may be freely
  10. distributed as long as the copyright/author notices remain intact, and
  11. it is not used in part or whole as the basis of a commercial product.
  12. Any comments, bug-fixes, or enhancements are welcome.
  13. Also, if you find TLC and it's source code useful, a contribution of
  14. $20 (check/money order) is encouraged!  Hopefully we will all see more
  15. source code distributed!
  16.     Eduard Schwan, 1112 Oceanic Drive, Encinitas, Calif. 92024
  17. ---------------------------------------------------------------------
  18. */
  19.  
  20. /*
  21. HEADER:        The Last Cross-Referencer;
  22. TITLE:        TLC/TLP - The Last Cross-Referencer;
  23. VERSION:    1.01;
  24.  
  25. DESCRIPTION: "TLC/TLP.
  26.             Definition include file";
  27.  
  28. KEYWORDS:    Utility, Cross-reference, C, Pascal, Apple, Macintosh, APW, Aztec;
  29. SYSTEM:        Macintosh MPW, v3.0;
  30. FILENAME:    TLC.H;
  31. WARNINGS:    "Has not yet been ported to MS-DOS.
  32.             Shareware, $20 Check/Money Order suggested.";
  33.  
  34. SEE-ALSO:    README.TLC,TLCHELP.DOC,TLPHELP.DOC;
  35. AUTHORS:    Eduard Schwan;
  36. COMPILERS:    AZTEC C65 v3.2b, APPLEIIGS APW C v1.0, APPLE MACINTOSH MPW C v3.0;
  37. */
  38.  
  39.  
  40. /*--- defining "do_dbg" at compile time activates all debug lines ---*/
  41. /*--- then the '-d' option forces display of them while TLC runs  ---*/
  42.  
  43. /*
  44. #define do_dbg */        /* comment this out for no debugs.. */
  45.  
  46. #ifdef do_dbg
  47. #define debug(x)    {if(enable_debugs){x;getchar();}}
  48. #else
  49. #define debug(x)
  50. #endif
  51.  
  52.  
  53. /*-------------- Compiler-dependent Definitions ---------*/
  54.  
  55. #ifdef AppleIIgs
  56. /* APW C */
  57. #define FILLCHAR(farea,fsize,fvalue)  memset(farea,fvalue,fsize)
  58. #define MOVEBYTE(msource,mdest,msize) memcpy(mdest,msource,msize)
  59. #else
  60. #ifdef macintosh
  61. /* MPW C */
  62. #define FILLCHAR(farea,fsize,fvalue)  memset(farea,fvalue,fsize)
  63. #define MOVEBYTE(msource,mdest,msize) memcpy(mdest,msource,msize)
  64. #else
  65. /* Aztec C */
  66. #define FILLCHAR(farea,fsize,fvalue)  setmem(farea,fsize,fvalue)
  67. #define MOVEBYTE(msource,mdest,msize) movmem(msource,mdest,msize)
  68. #endif
  69. #endif
  70.  
  71. /* comment this out if you cannot assign structures */
  72. #define STRUCT_ASSIGN    1
  73.  
  74. #define VOID    void    /* define VOID to int for non-void compilers */
  75.  
  76.  
  77. /*---------------------- definitions --------------------*/
  78.  
  79. #define     TLC_VERSION     "1.01 07/02/89"
  80. #define     LINE_SIZE        255
  81. #define     FNAME_SIZE        64
  82. #define     DATE_SIZE        30
  83. #define     MAX_SYM_SIZE    32    /* maximum symbol (id) size */
  84.  
  85. #define     TRUE            1    /* boolean types are set to these */
  86. #define     FALSE            0
  87.  
  88. #define     BAD_EXIT        99
  89. #define     GOOD_EXIT        0
  90.  
  91. #define     CH_FF            '\014'    /* printer form-feed character */
  92. #define     CH_COMMENT        '*'     /* comment char for file list file */
  93. #define     CH_SPACE        ' '     /* space character! */
  94.  
  95. #define     TOK_ID            1
  96. #define     TOK_NCONST        2
  97. #define     TOK_CCONST        3
  98. #define     TOK_SCONST        4
  99.  
  100. #define     TOK_EQUALS        '='
  101. #define     TOK_LBRACE        '{'
  102. #define     TOK_RBRACE        '}'
  103. #define     TOK_LPAREN        '('
  104. #define     TOK_RPAREN        ')'
  105.  
  106. #define     TERR_BAD_CHR    -1000 /* get_token() error values */
  107. #define     TERR_BAD_STR    -1001
  108. #define     TERR_EOLN        -1010
  109.  
  110. #define     REF_BLANK        0    /* reference tags on xref line numbers */
  111. #define     REF_FUNCHEAD    1
  112. #define     REF_DEFINE        2
  113. #define     REF_PROCHEAD    2
  114. #define     REF_UNITHEAD    3
  115. #define        MAX_REF_CHARS    4
  116.  
  117. #define     EMPH_NONE        0    /* Emphasis style values */
  118. #define     EMPH_ONE        1
  119. #define     EMPH_TWO        2
  120. #define     EMPH_THREE        3
  121. #define     EMPH_MAX        3    /* should be total # of emph values above */
  122.  
  123. #define     B_octal          8    /* Number bases used */
  124. #define     B_decimal        10
  125. #define     B_hex            16
  126.  
  127. #define        memdispFmt        "[%6lu] "    /* verbose FreeMem display */
  128.  
  129.  
  130. /*-------- globally external variables for everyone ---------*/
  131.  
  132.  
  133.  
  134. /*---------------- structure definitions -----------------*/
  135.  
  136. typedef unsigned char            boolean;
  137. typedef unsigned char            byte;
  138. typedef unsigned short int        pos_int;
  139.  
  140. typedef char                    date_str_type[DATE_SIZE];
  141. typedef char                    fname_type[FNAME_SIZE];
  142. typedef char                    line_type[LINE_SIZE];
  143.  
  144.  
  145. /*------------------ emphasize type record --------------*/
  146. struct    emph_r_type
  147.     {
  148.     char*                        emph_leadin;
  149.     char*                        emph_leadout;
  150.     };
  151. typedef struct emph_r_type         emph_rec_type;
  152.  
  153.  
  154. /*-------------------- file list record -----------------*/
  155. struct    file_l_type
  156.     {
  157.     pos_int                     file_num;
  158.     pos_int                        num_lines;
  159.     char*                        file_name;
  160.     struct file_l_type*            next;
  161.     };
  162. typedef struct file_l_type         file_list_type;
  163.  
  164.  
  165. struct    file_r_type
  166.     {
  167.     pos_int                     num_in_fnames;
  168.     file_list_type*             file_list;
  169.     file_list_type*             curr_file;
  170.     fname_type                    parm_fname;
  171.     fname_type                    resw_fname;
  172.     };
  173. typedef struct file_r_type         file_rec_type;
  174.  
  175.  
  176. /*-------------------- parameter record -----------------*/
  177. struct    parm_r_type
  178.     {
  179.             /* GENERAL */
  180.     boolean                     do_includes;
  181.     boolean                     do_listing;
  182.     boolean                     do_xref;
  183.     boolean                     do_stats;
  184.     char*                        out_fname;
  185.  
  186.             /* PRINTER */
  187.     pos_int                     page_lines;
  188.     pos_int                     page_columns;
  189.     pos_int                     top_line;
  190.     pos_int                     bot_line;
  191.     pos_int                     left_column;
  192.     pos_int                     right_column;
  193.     char*                        user_heading;
  194.     boolean                     do_single_shts;
  195.     char*                        printer_init;
  196.     boolean                     has_form_feed;
  197.     pos_int                     first_page;
  198.     pos_int                     last_page;
  199.  
  200.             /* LISTING */
  201.     pos_int                     tab_width;
  202.     byte                        emph_comments;
  203.     byte                        emph_heading;
  204.     byte                        emph_reserved;
  205.     byte                        emph_funcheads;
  206.     char*                        paging_string;
  207.  
  208.             /* XREF */
  209.     pos_int                     symbol_size;
  210.     boolean                     xref_nums;
  211.     boolean                     xref_strings;
  212.     boolean                     do_conditionals;
  213.     boolean                     do_case_sens;
  214.     boolean                     do_xcase_sens;
  215.     boolean                     do_underscores;
  216.     byte                        emph_symbols;
  217.  
  218.             /* STATS */
  219.     };
  220. typedef struct parm_r_type         parm_rec_type;
  221.  
  222.  
  223. /*------------------- reserved word record --------------*/
  224. struct    resw_l_type
  225.     {
  226.     struct resw_l_type*            left;
  227.     struct resw_l_type*            right;
  228.     char*                        resword;
  229.     byte                        tok_type;
  230.     unsigned long                occurrances;
  231.     };
  232. typedef struct resw_l_type         resw_list_type;
  233.  
  234. struct    resw_r_type
  235.     {
  236.     pos_int                     num_reswords;
  237.     resw_list_type*             resw_list;
  238.     };
  239. typedef struct resw_r_type     resw_rec_type;
  240.  
  241.  
  242. /*------------------ line list record -------------------*/
  243. struct    line_l_type
  244.     {
  245.     pos_int                     line_number;
  246.     file_list_type*             file_ptr;
  247.     byte                        reference_type;
  248.     struct line_l_type*            next;
  249.     };
  250. typedef struct line_l_type         line_list_type;
  251.  
  252.  
  253. /*------------------ symbol table records ---------------*/
  254. struct    sym_l_type
  255.     {
  256.     struct sym_l_type*             left;
  257.     struct sym_l_type*             right;
  258.     char*                        sym_name;
  259.     byte                        sym_type;
  260.     line_list_type*             line_list;
  261.     line_list_type*             line_tail;
  262.     };
  263. typedef struct sym_l_type        sym_list_type;
  264.  
  265. struct    sym_t_type
  266.     {
  267.     sym_list_type*                symbol_list;
  268.     };
  269. typedef struct sym_t_type        sym_table_type;
  270.  
  271.  
  272. /*---------------------- status record ------------------*/
  273. struct    stat_r_type
  274.     {
  275.     pos_int                     total_lines;
  276.     };
  277. typedef struct stat_r_type         stat_rec_type;
  278.  
  279.  
  280. /*-------------------- token record ---------------------*/
  281. struct    tok_r_type
  282.     {
  283.     pos_int                     tok_type;
  284.     line_type                    tok_string;
  285.     long                        tok_value;
  286.     pos_int                     tok_column;
  287.     };
  288. typedef struct tok_r_type        token_rec_type;
  289.