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

  1. /* TLCPROCF.C - "The Last Cross-referencer" - C Process Files routines    */
  2. /*    Last Modified:    07/02/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.             C Process Files routines";
  27.  
  28. KEYWORDS:    Utility, Cross-reference, C, Pascal, Apple, Macintosh, APW, Aztec;
  29. SYSTEM:        Macintosh MPW, v3.0;
  30. FILENAME:    TLCPROCF.C;
  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. /*------------------------ include files -------------------------*/
  41.  
  42. #include    <stdio.h>
  43. #include    <errno.h>
  44. #include    "tlc.h"
  45.  
  46.  
  47. /*------------------------- definitions -------------------------*/
  48.  
  49. #define     PAGE_TITLE        "List"
  50.  
  51.  
  52. /*--------------------- external declarations --------------------*/
  53.  
  54. #include    "tlc.ext"
  55.  
  56. extern FILE *    open_text_file();
  57. extern VOID     close_text_file(),
  58.                 do_emphasis(),
  59.                 undo_emphasis(),
  60.                 do_form_feed(),
  61.                 indent(),
  62.                 check_user_abort(),
  63.                 new_page();
  64. extern boolean    is_resword();
  65. extern long        get_freemem();
  66.  
  67.  
  68. /*------------------------ static variables -----------------------*/
  69.  
  70. static    pos_int            out_line_number;
  71. static    pos_int            block_level;
  72. static    boolean         saw_id;
  73. static    line_list_type    * prev_id_line_ptr;
  74. static    char            prev_tok_string[80];
  75.  
  76.  
  77. /*===============[ setup_listing_stuff ]================*/
  78.  
  79. static VOID setup_listing_stuff()
  80.  
  81.     { /* setup_listing_stuff() */
  82. /*debug(puts("setup_listing_stuff:");)*/
  83.     } /* setup_listing_stuff() */
  84.  
  85.  
  86.  
  87. /*===============[ print_listing_line ]================*/
  88.  
  89. static VOID print_listing_line()
  90.  
  91.     { /* print_listing_line() */
  92.     if (out_line_number >= parm_rec.bot_line || out_line_number == 0)
  93.         new_page(parm_rec.do_listing, PAGE_TITLE, &out_page_number,
  94.                 &out_line_number,
  95.                 file_rec.curr_file->file_name);
  96.     if (ok_to_print() && parm_rec.do_listing)
  97.         {
  98. debug(printf("prntLstLn():outLn#=%d botLn=%d pg#=%d\n",\
  99. out_line_number,parm_rec.bot_line, out_page_number);)
  100.         indent();
  101.         fprintf(out_file,"%4d | %s", file_rec.curr_file->num_lines, curr_line);
  102.         fputc('\n', out_file);
  103.         }
  104.     out_line_number++;
  105.     } /* print_listing_line() */
  106.  
  107.  
  108.  
  109. /*===============[ finish_listing_stuff ]================*/
  110.  
  111. static VOID finish_listing_stuff()
  112.  
  113.     { /* finish_listing_stuff() */
  114.     if (ok_to_print() && !parm_rec.do_xref)
  115.         {
  116.         do_form_feed(out_file, out_line_number);
  117.         }
  118.     } /* finish_listing_stuff() */
  119.  
  120.  
  121.  
  122. /*==================[ expand_tabs ]=====================*/
  123.  
  124. static VOID expand_tabs()
  125.  
  126.     { /* expand_tabs() */
  127.     short         count;
  128.     short         index,
  129.                 tab_fill;
  130.     char *        line_ptr;
  131.  
  132. debug(puts("expand_tabs:");)
  133.  
  134.     index = 0;
  135.     line_ptr = curr_line;
  136.     while (*line_ptr)
  137.         {
  138.         if (*line_ptr == '\t')    /* horizontal tab (HT)? */
  139.             {
  140.             /* calc. # of spaces to replace tab with */
  141.             tab_fill = parm_rec.tab_width - (index % parm_rec.tab_width);
  142.  
  143.             /* if more than 1 space needed for tab, move the string */
  144.             /* and trailing null (\0) over                            */
  145.             if (tab_fill > 1)
  146.                 {
  147. /****************MOVE(line_ptr+tab_fill-1, line, strlen(line_ptr)+1); -- below is less risky */
  148.                 for (count=strlen(line_ptr); count>=0; count--)
  149.                     line_ptr[count-1+tab_fill] = line_ptr[count];
  150.                 }
  151.  
  152.             /* pad with spaces (& cover up tab as last char) */
  153. /***********FILL(line_ptr, tab_fill, ' '); -- below is less risky */
  154.             for (count=0; count<tab_fill; count++)
  155.                 line_ptr[count] = ' ';
  156.  
  157.             /* point to next char. after tab expansion */
  158.             line_ptr    += tab_fill;
  159.             index        += tab_fill;
  160.             }
  161.         else
  162.             {
  163.             /* no conversion, skip this character */
  164.             line_ptr++;
  165.             index++;
  166.             }
  167.         } /* while */
  168.     } /* expand_tabs() */
  169.  
  170.  
  171.  
  172. /*=================[ do_directives ]====================*/
  173.  
  174. static boolean do_directives()
  175.  
  176.     { /* do_directives() */
  177. /*
  178. debug(puts("do_directives:");)
  179. */
  180. return(FALSE); /* DEBUG..*/
  181.     } /* do_directives() */
  182.  
  183.  
  184.  
  185. /*==================[ fill_ref_recs ]===================*/
  186.  
  187. static VOID fill_ref_recs(sym_ptr, line_ptr, ref_kind)
  188. sym_list_type*    sym_ptr;
  189. line_list_type* line_ptr;
  190. pos_int         ref_kind;
  191.  
  192.     { /* fill_ref_recs() */
  193.  
  194. /*debug(puts("fill_ref_recs:");)*/
  195.  
  196.     /* fill symbol record */
  197.  
  198.     /* NOTE: the symbol's name is VERY temporarily stored in token.tok_string*/
  199.     /* and is "malloc'ed" & copied into heap later by add_sym_rec() if needed*/
  200.     sym_ptr->sym_name        = token.tok_string;
  201.     sym_ptr->sym_type        = token.tok_type;
  202.  
  203.     /* fill line record */
  204.  
  205.     line_ptr->line_number    = file_rec.curr_file->num_lines;
  206.     line_ptr->file_ptr        = file_rec.curr_file;
  207.     line_ptr->reference_type= ref_kind;
  208.  
  209.     } /* fill_ref_recs() */
  210.  
  211.  
  212.  
  213. /*===================[ add_sym_rec ]====================*/
  214.  
  215. static sym_list_type* add_sym_rec(sym_ptr)
  216. sym_list_type*    sym_ptr;
  217.  
  218.     { /* add_sym_rec() */
  219.     sym_list_type*    new_sym_ptr;
  220.     char*            new_sym_name;
  221.  
  222. debug(puts("add_sym_rec:");)
  223.  
  224.     /* create a new symbol record & move info into it */
  225.     new_sym_ptr = (sym_list_type*)malloc(sizeof(sym_list_type));
  226.  
  227. debug(printf("add_sym_rec:malloc(new_sym_ptr)-$%06lx[$%x]\n",\
  228. (long)new_sym_ptr,sizeof(sym_list_type));)
  229.  
  230.     if (new_sym_ptr==NULL)
  231.         {
  232.         fprintf(stderr,"Error! out of memory on line #%u in file '%s'\n",
  233.                 file_rec.curr_file->num_lines+1, file_rec.curr_file->file_name);
  234.         }
  235.     else
  236.         {
  237. #ifdef STRUCT_ASSIGN
  238.         *new_sym_ptr = *sym_ptr;
  239. #else
  240.         MOVEBYTE(sym_ptr, new_sym_ptr, sizeof(sym_list_type));
  241. #endif
  242.         new_sym_ptr->line_list    = NULL;
  243.         new_sym_ptr->line_tail    = NULL;
  244.         new_sym_ptr->left        = NULL;
  245.         new_sym_ptr->right        = NULL;
  246.         }
  247.  
  248.     /* create a place for the symbol name & move from temp area */
  249.  
  250.     if (new_sym_ptr!=NULL)
  251.         {
  252.         new_sym_name = malloc(strlen(new_sym_ptr->sym_name)+1);
  253.  
  254. debug(printf("add_line_rec:malloc(new_sym_name)-$%06lx[$%x]\n",\
  255. (long)new_sym_name,strlen(new_sym_ptr->sym_name)+1);)
  256.  
  257.         if (new_sym_name==NULL)
  258.             {
  259.             fprintf(stderr,"Error! out of memory on line #%u in file '%s'\n",
  260.                     file_rec.curr_file->num_lines+1, file_rec.curr_file->file_name);
  261.             }
  262.         else
  263.             {
  264.             strcpy(new_sym_name, sym_ptr->sym_name);
  265.             new_sym_ptr->sym_name = new_sym_name;
  266.             }
  267.         }
  268.  
  269.     /* return the pointer to the new record, or NULL if out of mem */
  270.  
  271.     return(new_sym_ptr);
  272.  
  273.     } /* add_sym_rec() */
  274.  
  275.  
  276. /*==================[ add_line_rec ]====================*/
  277.  
  278. static int add_line_rec(sym_ptr, line_ptr)
  279. sym_list_type*    sym_ptr;
  280. line_list_type* line_ptr;
  281.  
  282.     { /* add_line_rec() */
  283.     line_list_type* new_line_ptr;
  284.  
  285. debug(puts("add_line_rec:");)
  286.  
  287.     /* create new line ref. record on heap */
  288.     new_line_ptr = (line_list_type*)malloc(sizeof(line_list_type));
  289.  
  290. debug(printf("add_line_rec:malloc(new_line_ptr)-$%06lx[$%x]\n",\
  291. (long)new_line_ptr,sizeof(line_list_type));)
  292.  
  293.     if (new_line_ptr==NULL)
  294.         {
  295.         fprintf(stderr,"Error! out of memory on line #%u in file '%s'\n",
  296.                 file_rec.curr_file->num_lines+1, file_rec.curr_file->file_name);
  297.         return(BAD_EXIT);
  298.         }
  299. #ifdef STRUCT_ASSIGN
  300.     *new_line_ptr = *line_ptr;
  301. #else
  302.     MOVEBYTE(line_ptr, new_line_ptr, sizeof(line_list_type));
  303. #endif
  304.  
  305.     /* add line ref. record to symbol's list */
  306.     new_line_ptr->next = NULL;
  307.     if (sym_ptr->line_list == NULL)
  308.         { /* first on list */
  309. debug(puts("  1st linerec on list");)
  310.         sym_ptr->line_list = new_line_ptr;
  311.         sym_ptr->line_tail = new_line_ptr;
  312.         }
  313.     else
  314.         {
  315. debug(puts("  next linerec on list");)
  316.         sym_ptr->line_tail->next = new_line_ptr;
  317.         sym_ptr->line_tail = new_line_ptr;
  318.         }
  319.  
  320.     /* FIFO(1) - save previous line reference, for reftype update of FUNCHEAD */
  321.     prev_id_line_ptr = new_line_ptr;
  322.  
  323.     /* all ok */
  324.     return(GOOD_EXIT);
  325.  
  326.     } /* add_line_rec() */
  327.  
  328.  
  329.  
  330. /*==================[ add_reference ]===================*/
  331.  
  332. static int add_reference(sym_ptr, line_ptr)
  333. sym_list_type*    sym_ptr;
  334. line_list_type* line_ptr;
  335.  
  336.     { /* add_reference() */
  337.     boolean         found;
  338.     int                direction;
  339.     sym_list_type*    search_ptr;
  340.     sym_list_type*    trail_ptr;
  341.  
  342.     /* search for symbol or place to add symbol in symbol table */
  343.  
  344. debug(puts("add_ref:");)
  345.  
  346.     search_ptr = symbol_table.symbol_list;
  347.     found = FALSE;
  348.     trail_ptr = NULL; /* this will always point one above search_ptr(parent)*/
  349.     while (!found && search_ptr!=NULL)
  350.         {
  351.         trail_ptr = search_ptr;
  352.         direction = strncmp(search_ptr->sym_name, sym_ptr->sym_name,
  353.                             parm_rec.symbol_size);
  354.         if (direction < 0)
  355.             direction = -1;
  356.         else if (direction > 0)
  357.             direction = 1;
  358. /*
  359. debug(printf("add_ref:strncmp'%s'<%d>'%s'\n",\
  360. search_ptr->sym_name,direction,sym_ptr->sym_name);)
  361. */
  362.         switch (direction)
  363.             {
  364.             case  1: /* too big, descend left */
  365.                     search_ptr = search_ptr->left;
  366.                     break;
  367.             case  0: /* equal! got it. */
  368.                     found = TRUE;
  369.                     break;
  370.             case -1: /* too small, descend right */
  371.             default:
  372.                     search_ptr = search_ptr->right;
  373.                     break;
  374.             } /*switch*/
  375.         } /*while*/
  376.  
  377.     /* if not found, add new symbol record at trail_ptr */
  378.  
  379.     if (!found)
  380.         {
  381.         search_ptr = add_sym_rec(sym_ptr);
  382.         if (search_ptr==NULL)
  383.             return(BAD_EXIT); /* out of memory */
  384.         if (trail_ptr==NULL)
  385.             { /* first on the list */
  386. debug(puts(" 1st symrec on list");)
  387.             symbol_table.symbol_list = search_ptr;
  388.             }
  389.         else
  390.             { /* add to existing list */
  391. debug(puts(" next symrec on list");)
  392.             if (direction==1)
  393.                 trail_ptr->left = search_ptr; /* add as left node */
  394.             else
  395.                 trail_ptr->right= search_ptr; /* add as left node */
  396.             }
  397.         }
  398.  
  399.     /* now add line ref record to this symbol record */
  400.  
  401.     return( add_line_rec(search_ptr, line_ptr) );
  402.  
  403.     } /* add_reference() */
  404.  
  405.  
  406.  
  407. /*====================[ parse_line ]====================*/
  408.  
  409. static VOID parse_line(found_include)
  410. boolean * found_include;
  411.  
  412.     { /* parse_line */
  413.     int             error;
  414.     pos_int            ref_kind;
  415.     sym_list_type    temp_sym_rec;
  416.     line_list_type    temp_line_rec;
  417.  
  418.     do    {
  419.         token.tok_string[79] = 0;
  420.         strcpy(prev_tok_string, token.tok_string);
  421.         error = get_token();
  422.         if (error)
  423.             { /* handle bad token or Eoln */
  424.             if (error != TERR_EOLN)
  425.                 { /* bad stuff in text file.. */
  426. debug(puts("UNKNOWN TOKEN");)
  427.                 }
  428.             }
  429.         else
  430.             { /* handle next valid token */
  431. /*
  432. debug(printf("parseLine():blklvl=%d token=%d'%s'\n",\
  433. block_level,token.tok_type,token.tok_string);)
  434. */
  435.             if (token.tok_type=='#' && token.tok_column==1)
  436.                 {
  437.                 *found_include = do_directives();
  438.                 saw_id = FALSE;
  439.                 }
  440.             else
  441.                 { /* parse anything else normally */
  442.                 switch (token.tok_type)
  443.                     {
  444.                     case TOK_ID:
  445.                             saw_id = FALSE;
  446.                             if (is_resword(token.tok_string))
  447.                                 { /* handle reserved words.. */
  448.                                 }
  449.                             else
  450.                                 { /* not reserved, add ref. to sym. table */
  451.                                 saw_id = TRUE;
  452. /*debug(puts("  SAW_ID=TRUE!");)*/
  453.                                 if (block_level==0 &&
  454.                                     strcmp(prev_tok_string,"define")==0)
  455.                                     {
  456. /*debug(printf(" prev=DEFINE\n");)*/
  457.                                     ref_kind = REF_DEFINE;
  458.                                     }
  459.                                 else
  460.                                     ref_kind = REF_BLANK;
  461.                                 fill_ref_recs(&temp_sym_rec,
  462.                                               &temp_line_rec,
  463.                                               ref_kind);
  464.                                 error = add_reference(&temp_sym_rec,
  465.                                                      &temp_line_rec);
  466.                                 }
  467.                             break;
  468.     
  469.                     case TOK_NCONST:
  470.                             saw_id = FALSE;
  471.                             if (parm_rec.xref_nums)
  472.                                 {
  473.                                 ref_kind = REF_BLANK;
  474.                                 fill_ref_recs(&temp_sym_rec,
  475.                                               &temp_line_rec,
  476.                                               ref_kind);
  477.                                 error = add_reference(&temp_sym_rec,
  478.                                                      &temp_line_rec);
  479.                                 }
  480.                             break;
  481.  
  482.                     case TOK_CCONST:
  483.                     case TOK_SCONST:
  484.                             saw_id = FALSE;
  485.                             if (parm_rec.xref_strings)
  486.                                 {
  487.                                 ref_kind = REF_BLANK;
  488.                                 fill_ref_recs(&temp_sym_rec,
  489.                                               &temp_line_rec,
  490.                                               ref_kind);
  491.                                 error = add_reference(&temp_sym_rec,
  492.                                                      &temp_line_rec);
  493.                                 }
  494.                             break;
  495.     
  496.                     case TOK_LBRACE:
  497.                             saw_id = FALSE;
  498.                             block_level++;
  499.                             break;
  500.  
  501.                     case TOK_RBRACE:
  502.                             saw_id = FALSE;
  503.                             if (block_level > 0)
  504.                                 block_level--;
  505.                             break;
  506.  
  507.                     case TOK_LPAREN:
  508.                         if (block_level==0 && prev_id_line_ptr!=NULL && saw_id)
  509.                             {
  510. /*
  511. debug(printf(" prev=FUNCHEAD linerecptr=%06lx\n",prev_id_line_ptr);)
  512. */
  513.                             /* just came upon "id(", if not DEFINE, its a fn() */
  514.                             if (prev_id_line_ptr->reference_type == REF_BLANK)
  515.                                 prev_id_line_ptr->reference_type = REF_FUNCHEAD;
  516.                             }
  517.                         saw_id = FALSE;
  518.                         break;
  519.  
  520.                     default: /* ignore anything else.. */
  521.                         saw_id = FALSE;
  522.                         break;
  523.  
  524.                     } /*switch*/
  525.                 } /*else not directive*/
  526.             } /*else valid token*/
  527.         } while (token.tok_type != TERR_EOLN && !error);
  528.     } /* parse_line */
  529.  
  530.  
  531.  
  532. /*=================[ process_a_file ]===================*/
  533.  
  534. static boolean process_a_file()
  535.  
  536.     { /* process_a_file() */
  537.     int     error;
  538.     boolean found_include;
  539.     FILE *    fp;
  540.  
  541.     if (verbose)
  542.         {
  543.         putc('\n', stderr);
  544.         fprintf(stderr, memdispFmt, get_freemem());
  545.         fprintf(stderr, "Processing file '%s'\n", file_rec.curr_file->file_name);
  546.         fflush(stderr);
  547.         }
  548.  
  549.     block_level      = 0;
  550.     saw_id             = FALSE;
  551.     prev_id_line_ptr = NULL;
  552.  
  553.     fp = open_text_file(file_rec.curr_file->file_name, "r", &error);
  554.     if (error)
  555.         {
  556.         fprintf(out_file, "Error %d/$%x opening file '%s'\n",
  557.                 error, error, file_rec.curr_file->file_name);
  558.         fprintf(stderr, "Error %d/$%x opening file '%s'\n",
  559.                 error, error, file_rec.curr_file->file_name);
  560.         fflush(stderr);
  561.         return(TRUE);
  562.         }
  563.     else
  564.         { /*opened ok*/
  565.         file_rec.curr_file->num_lines = 0;
  566.         found_include = FALSE;
  567.         while (!feof(fp) && !error)
  568.             {
  569.             /* check for user abort.. */
  570.             check_user_abort();
  571.  
  572.             /* read next line in file */
  573.             errno = 0;
  574.             if (fgets(curr_line, LINE_SIZE, fp) != NULL)
  575.                 {
  576.                 if (curr_line[strlen(curr_line)-1] == '\n')
  577.                     curr_line[strlen(curr_line)-1] = 0; /* remove trailing \n */
  578.                 file_rec.curr_file->num_lines++;
  579.                 expand_tabs();
  580. debug(printf("process_a_file:<%d>'%s'\n",file_rec.curr_file->num_lines,curr_line););
  581.  
  582.                 /* if noisy, list file's current line number to screen */
  583.                 if (verbose > 1)
  584.                     {
  585.                     if (file_rec.curr_file->num_lines % 10 == 1)
  586.                         {
  587.                         if (file_rec.curr_file->num_lines % 100 == 1)
  588.                             {
  589.                             putc('\n', stderr);
  590.                             fprintf(stderr, memdispFmt, get_freemem());
  591.                             }
  592.                         fprintf(stderr,"%5d",file_rec.curr_file->num_lines-1);
  593.                         fflush(stderr);
  594.                         }
  595.                     }
  596.  
  597.                 /* don't parse if just listing (but need to later!) */
  598.                 if (parm_rec.do_xref)
  599.                     parse_line(&found_include);
  600.  
  601.                 /* if we are listing, print this line */
  602. debug(printf("process_a_file:if(%d) then print'%s'\n",parm_rec.do_listing,curr_line););
  603.                 if (parm_rec.do_listing)
  604.                     print_listing_line();
  605.  
  606.                 /* see if this line contains a NewPage command string */
  607.                 if (parm_rec.paging_string != NULL)
  608.                     if (strcmp(parm_rec.paging_string, curr_line)==0)
  609.                         new_page(parm_rec.do_listing,
  610.                                 PAGE_TITLE,
  611.                                 &out_page_number,
  612.                                 &out_line_number,
  613.                                 file_rec.curr_file->file_name);
  614.  
  615.                 /* handle include file */
  616.                 if (found_include && parm_rec.do_includes)
  617.                     { /* push current file & enter include file */
  618. /*----------------- later ---------------
  619.                     found_include = FALSE;
  620.                     push-current-file()
  621.                     open-include-file()
  622.                     include-level++
  623.                     init file stuff
  624.                     if (!top-of-page)
  625.                         new-page()
  626. ----------------------------------------*/
  627.                     }
  628.                 } /*if fgets()*/
  629.             else
  630.                 { /* error or eof */
  631.                 if (!feof(fp))
  632.                     {
  633.                     error = errno;
  634.                     fprintf(out_file,
  635.                             "Error %d/$%x reading line #%u in file '%s'\n",
  636.                             error, error, file_rec.curr_file->num_lines+1,
  637.                             file_rec.curr_file->file_name);
  638.                     fprintf(stderr,
  639.                             "Error %d/$%x reading line #%u in file '%s'\n",
  640.                             error, error, file_rec.curr_file->num_lines+1,
  641.                             file_rec.curr_file->file_name);
  642.                     fflush(stderr);
  643.                     return(TRUE);
  644.                     }
  645.                 } /* else error or eof */
  646. /*----------------- later ---------------
  647.             if (eof(fp) && !error)
  648.                 {
  649.                 if include-level > 0
  650.                     {
  651.                     pop-previous-file()
  652.                     seek back to it's next line
  653.                     }
  654.                 }
  655. ----------------------------------------*/
  656.             } /*while*/
  657.         close_text_file(fp, file_rec.curr_file->file_name);
  658.         } /*opened ok*/
  659.         
  660.         if (verbose)
  661.             putc('\n', stderr);
  662.             
  663.     return(FALSE); /* no abort */
  664.     } /* process_a_file() */
  665.  
  666.  
  667.  
  668. /*=================[ process_files ]===================*/
  669. VOID process_files()
  670.  
  671.     { /* process_files() */
  672.     boolean abort;
  673.  
  674. debug(puts("process_files:");)
  675.  
  676.     file_rec.curr_file = file_rec.file_list;
  677.     abort             = FALSE;
  678.     out_page_number  = 0;
  679.     if (parm_rec.do_listing)
  680.         setup_listing_stuff();
  681.     while (file_rec.curr_file!=NULL && !abort)
  682.         {
  683.  
  684. /* NOTE: This should be called outside the loop eventually.. but resetting
  685.     the scanner after every file clears up any trailing commente-out chunks */
  686.         init_scanner(parm_rec.do_case_sens, parm_rec.do_underscores, FALSE);
  687.  
  688.         out_line_number = 0;
  689.         abort = process_a_file();
  690.  
  691. /*IGNORE MISSING FILES FOR NOW..DEBUG*/ abort=FALSE;
  692.         file_rec.curr_file = file_rec.curr_file->next;
  693.         }
  694.         
  695.     if (parm_rec.do_listing)
  696.         finish_listing_stuff();
  697.         
  698.     } /* process_files() */
  699.