home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD1.mdf / magazine / drdobbs / c_spec / poole_cp / cpbuild.c < prev    next >
Text File  |  1989-11-21  |  22KB  |  767 lines

  1. /************************************************************************
  2.                    cpbuild.c
  3. static void near mark_as_static( function_type *, char*, int );
  4. static int near  test_and_add( function_type *, char *, int );
  5. static void near unget_chars( char );
  6. static char near get_chars( FILE * );
  7. static char near get_to_next_possible_token( FILE * );
  8. static int near  is_legal_identifier_character( char );
  9.        int near  build_the_data_base( char *, char * );
  10. ************************************************************************/
  11.  
  12. #define  MAIN  0
  13. #include "cpheader.h"
  14.  
  15. #if VMS
  16.        int  build_the_data_base( char *, char * );
  17. static char get_chars( FILE * );
  18. static char get_to_next_possible_token( FILE * );
  19. static int  is_legal_identifier_character( char );
  20. static void mark_as_static( function_type *, char*, int );
  21. static int  test_and_add( function_type *, char *, int );
  22. static void unget_chars( char );
  23. #endif
  24.  
  25. #if MSDOS
  26.        int near  build_the_data_base( char *, char * );
  27. static char near get_chars( FILE * );
  28. static char near get_to_next_possible_token( FILE * );
  29. static int near  is_legal_identifier_character( char );
  30. static void near mark_as_static( function_type *, char*, int );
  31. static int near  test_and_add( function_type *, char *, int );
  32. static void near unget_chars( char );
  33. #endif
  34.  
  35. /***********************************************************************/
  36.  
  37. #if MSDOS
  38. static void near mark_as_static( ptr_to_function_list, 
  39.                  name_of_static_function, count
  40.                    )
  41. #else
  42. static void mark_as_static( ptr_to_function_list, 
  43.                 name_of_static_function, count
  44.               )
  45. #endif
  46. char *name_of_static_function;
  47. function_type *ptr_to_function_list;
  48. int count;
  49. {
  50. int i;
  51.  
  52. for( i = 0; i < count; ++i )
  53.    {
  54.    if(
  55.      !strcmp( name_of_static_function, ptr_to_function_list->functions_name )
  56.      )
  57.       ptr_to_function_list->static_function = true;
  58.    ++ptr_to_function_list;
  59.    }
  60. }
  61. /************************************************************************/
  62. #define KEYS   7
  63.  
  64. #if MSDOS
  65. static int near test_and_add( ptr_to_function_list, string, count )
  66. #else
  67. static int test_and_add( ptr_to_function_list, string, count )
  68. #endif
  69. function_type *ptr_to_function_list;
  70. char *string;
  71. int count;
  72. {
  73. int i, is_a_new_function_name;
  74. static char *keywords[ KEYS ] =
  75.    {  /* must catch do (void)printf, while(), else (void)... etc. ***/
  76.    "do", "while", "if", "else", "for", "switch", "return"
  77.    };
  78.  
  79. for( i = 0; ( i < KEYS ) && ( strcmp( string, keywords[ i ] ) != 0 ); ++i )
  80.    ;
  81. if( i < KEYS )
  82.    is_a_new_function_name = false;     /* ie a reserved word match */
  83. else                       /* is a function name */
  84.    {
  85.    for( i = 0; i < count; ++i )
  86.       {
  87.       if( !strcmp( string, ptr_to_function_list->functions_name ) )
  88.      {             /* function name matches */
  89.      if( !ptr_to_function_list->static_function )
  90.         break;         /* and isn't static */
  91.      else
  92.         {
  93.         if( !strcmp( ptr_to_function_list->its_filename,
  94.              file_record_array_ptr->source_filename
  95.               )
  96.           )
  97.            break;         /* only statics in same file match */
  98.         }
  99.      }
  100.       ++ptr_to_function_list;
  101.       }
  102.    if( i == count )
  103.      {                      /* new function name */
  104.      is_a_new_function_name = true;   /* add function name to list */
  105.      if( ( function_list_ptr->functions_name = strdup( string ) ) == NULL )
  106.      {
  107.      (void)fprintf( stderr, "Ran out of memory.\n" );
  108.      exit( 1 );
  109.      }
  110.      function_list_ptr->static_function = false;
  111.      function_list_ptr->its_filename =
  112.     file_record_array_ptr->source_filename;
  113.      function_list_ptr->is_referenced = 1;
  114.  
  115.      ++function_list_ptr;          /* point to next empty cell */
  116.      ++count_of_functions;          /* increase current size */
  117.      if( count_of_functions > Max_functions )
  118.      {
  119.      (void)fprintf( stderr, "Too many functions.\n" );
  120.      exit( 1 );
  121.      }
  122.      }
  123.    else               /* string already in function list */
  124.       {
  125.       is_a_new_function_name = false;
  126.       ptr_to_function_list->is_referenced++;
  127.       }
  128.    }
  129. return is_a_new_function_name;
  130. }
  131. /************************************************************************/
  132. #if MSDOS
  133. static void near unget_chars( c )
  134. #else
  135. static void unget_chars( c )
  136. #endif
  137. char c;
  138. {
  139. if( ( push_buffer_ptr - push_buffer ) < Max_unget_buffer )
  140.    *push_buffer_ptr++ = c;
  141. else
  142.    {
  143.    (void)fprintf( stderr, "\nProgram syntax error:" );
  144.    (void)fprintf( stderr, " Too many pushed characters.\n" );
  145.    exit( 1 );
  146.    }
  147. }
  148. /***********************************************************************/
  149. #if MSDOS
  150. static char near get_chars( stream )
  151. #else
  152. static char get_chars( stream )
  153. #endif
  154. FILE * stream;
  155. {
  156. register char c;
  157.  
  158. if( push_buffer_ptr != push_buffer )
  159.    c = *--push_buffer_ptr;
  160. else
  161.    {
  162.    c = (char)fgetc( stream );
  163.    if( c == EOF )
  164.       c = Control_z;
  165.    if( c == 0x0a )
  166.       {
  167.       file_record_array_ptr->line_count++;
  168.       file_record_array_ptr->size++;        /* count the unseen <cr> */
  169.       }
  170.    file_record_array_ptr->size++;
  171.    }
  172. return c;
  173. }
  174. /***********************************************************************/
  175. #if MSDOS
  176. static char near get_to_next_possible_token( stream )
  177. #else
  178. static char get_to_next_possible_token( stream )
  179. #endif
  180. FILE *stream;
  181. {
  182. register char
  183.    c;
  184. char
  185.    next_char_peek;
  186. int
  187.    done;
  188.  
  189. static int     /* the only apparent reason these are static is for speed */
  190.    quotes_flag =       false,
  191.    comment_flag =       false,
  192.    escape_sequence_flag =  false,
  193.    pound_sign_flag =       false,
  194.    ascii_quote_flag =       false;
  195. static int
  196.    fp = 0;   /*****<<<<< */
  197. static char *cp;
  198.  
  199. done = false;
  200. do {
  201.    c = get_chars( stream );
  202.    if( c != Control_z )
  203.       {   
  204.       if( comment_flag )
  205.      {
  206.  
  207. /**************************
  208.    process /* comment sequence of characters
  209. ***************************/
  210.      if( first_comment == true )
  211.         {
  212.         if( fp < ( Max_general_buffers - 2 ) )
  213.            {
  214.            if(
  215.           ( c != '\n' ) &&
  216.           ( strlen( cp ) < effective_width )
  217.          )
  218.           {
  219.           file_comment_buffer[ fp++ ] = c;
  220.           file_comment_buffer[ fp ] = '\0';
  221.           }
  222.            else       /* c == \n or length >= width */
  223.           {
  224.           file_comment_buffer[ fp++ ] = '\n';
  225.           file_comment_buffer[ fp ] = '\0';
  226.           cp = (char *)&file_comment_buffer[ fp ];
  227.           if( c != '\n' )
  228.              {
  229.              file_comment_buffer[ fp++ ] = c;
  230.              file_comment_buffer[ fp ] = '\0';
  231.              }
  232.           }
  233.            }
  234. /*        else     /* 1st comment exceeds buffer */
  235.         }         /* end of if first_comment == true */
  236.      if( c == '*' )
  237.         {
  238.         next_char_peek = get_chars( stream );
  239.         if( next_char_peek == '/' )      /* close comment */
  240.            {
  241.            comment_flag = false;
  242.            unget_chars( ' ' );  /* comments are white space in 'c' */
  243.            if( first_comment == true )
  244.           {
  245.           first_comment = completed;
  246.           fp = 0;
  247.           cp = (char *)&file_comment_buffer[ fp ];
  248.           }
  249.            }
  250.         else    /* next_char_peek != '/' ie close comment */
  251.            unget_chars( (char)next_char_peek );
  252.         }  /* end of if c == '*' */
  253.      }
  254.       else     /* not /* */
  255.      {
  256.  
  257. /**************************
  258.    process \sequence character, hoping \" \' \\ etc inside " or '
  259. ***************************/
  260.      if( escape_sequence_flag )
  261.         escape_sequence_flag = false;
  262.      else      /* not /*, not \ */
  263.         {
  264. /**************************
  265.    process " string sequence of characters
  266. ***************************/
  267.         if( quotes_flag )
  268.            {
  269.            if( c == '\\' )            /* check for \'\n' */
  270.           {
  271.           next_char_peek = get_chars( stream );
  272.           if( next_char_peek != '\n' )    /* so not \'\n' */
  273.              {
  274.              escape_sequence_flag = true;
  275.              unget_chars( (char)next_char_peek );
  276.              }
  277. /*******      else                /* \'\n' continuation */
  278.           }
  279.            else                /* not \ */
  280.           if( c == '\"' )
  281.              quotes_flag = false;
  282.            }
  283.         else     /* not ", not /*, not \ */
  284.            {
  285. /**************************
  286.    process ' ascii character sequence
  287. ***************************/
  288.            if( ascii_quote_flag )
  289.           {
  290.           if( c == '\\' )
  291.              escape_sequence_flag = true;
  292.           else
  293.              if( c == '\'' )
  294.             ascii_quote_flag = false;
  295.           }
  296.            else  /* not ', not ", not /*, not \ */
  297.           {
  298. /**************************
  299.    process # sequence of characters, ie #if, #define, etc.
  300.    define causes code sequencing problems it would seem!
  301. ***************************/
  302.           if( pound_sign_flag )
  303.              {
  304.              if( c == '/' )   /* comments override #defines etc */
  305.             {
  306.             next_char_peek = get_chars( stream );
  307.             if( next_char_peek == '*' )
  308.                comment_flag = true;
  309.             else
  310.                unget_chars( (char)next_char_peek );
  311.             }
  312.              else
  313.             {
  314.             if( c == '\n' )
  315.                pound_sign_flag = false;
  316.             else                  /* c != \n */
  317.                {
  318.                if( c == '\\' )  /* check \'\n' continuation */
  319.                   {   
  320.                   next_char_peek = get_chars( stream );
  321.                   if( next_char_peek != '\n' ) /* not \'\n' */
  322.                  unget_chars( (char)next_char_peek );
  323. /*                else          /* \'\n' means continue # */
  324.                   }
  325.                }
  326.             }
  327.              }
  328.           else       /* not ', not #, not ", not /*, not \ */
  329.              {
  330. /**************************
  331.    process anything else
  332. ***************************/
  333.              done = false;     /* assume a ' or " or # or /* */
  334.              switch( c )
  335.             {
  336.             case '\"':
  337.                quotes_flag = true;
  338.                break;
  339.             case '\'':
  340.                ascii_quote_flag = true;
  341.                break;
  342.             case '#':
  343.                pound_sign_flag = true;
  344.                break;
  345.             case '/':
  346.                next_char_peek = get_chars( stream );
  347.                if( next_char_peek == '*' )
  348.                   {
  349.                   comment_flag = true;
  350.                   if( first_comment == false )
  351.                  {     /* the 1st comment of the file */
  352.                  first_comment = true;
  353.                  fp = 0;
  354.                  cp = (char *)&file_comment_buffer[ fp ];
  355.                  }
  356.                   }
  357.                else
  358.                   {
  359.                   unget_chars( (char)next_char_peek );
  360.                   done = true;   
  361.                   }
  362.                break;
  363.             default:       /* a worthy character to return */
  364.                done = true;   
  365.             }
  366.              }       /* end of else not ascii */
  367.           }       /* end of else not # */
  368.            }       /* end of else not " */
  369.         }           /* end of else not /* */
  370.      }           /* end of else not \ */
  371.       }            /* end of if c != Control_z */
  372.    }
  373. while( !done && ( c != Control_z ) );
  374. if( c == Control_z )
  375.    {
  376.    ascii_quote_flag = false;
  377.    pound_sign_flag = false;
  378.    quotes_flag = false;
  379.    escape_sequence_flag = false;
  380.    comment_flag = false;
  381.    fp = 0;
  382.    }
  383. return c;
  384. }
  385. /***********************************************************************/
  386. #if MSDOS
  387. static int near is_legal_identifier_character( c )
  388. #else
  389. static int is_legal_identifier_character( c )
  390. #endif
  391. char c;
  392. {
  393. if(
  394.    ( ( 'A' <= c ) && ( c <= 'Z' ) ) ||
  395.    ( ( 'a' <= c ) && ( c <= 'z' ) ) ||
  396.    ( ( '0' <= c ) && ( c <= '9' ) ) ||
  397.    ( c == '_')
  398.   )
  399.    return true;
  400. else
  401.    return false;
  402. }
  403. /***********************************************************************/
  404. #define  C_line_length    2048     /* was 512, JH has BIG definitions!! */
  405. #define  C_identifier_length  80
  406.  
  407. #if MSDOS
  408. int near build_the_data_base( the_filename, ov_string )
  409. #else
  410. int build_the_data_base( the_filename, ov_string )
  411. #endif
  412. char * the_filename, * ov_string;
  413. {
  414. static char fake_comment[ ] = "no room!";
  415. int found_a_possible_function;
  416. int brace_count, body_found;
  417. int open_parenthesis, parenthesis_count;
  418. int at_end_of_source_file;
  419. int dummy_index, total_called_count;
  420. int function_definition_flag, static_flag;
  421. int analyze_buffer_flag = false;
  422. int ov_num = 0;
  423. char c;
  424. char *function_name_buffer_ptr;
  425. char function_name_buffer[ C_identifier_length ];
  426. char look_ahead_buffer[ C_line_length + 1 ];
  427. FILE *stream;
  428. data_base_record_type *data_base_ptr, *starting_data_base_ptr;
  429. function_type *starting_called_function_ptr;
  430.  
  431. if( !g_quiet_flag )
  432.    {
  433.    (void)printf( "Processing file: %-12s\n", the_filename );
  434.    }
  435. if( !( stream = fopen( the_filename, "r" ) ) )    /***** rt <<<<<<<<<< */
  436.    {
  437.    (void)printf( "Cant open %s\n", the_filename );
  438.    return -1;
  439.    }
  440. ov_num = atoi( ov_string );
  441. push_buffer_ptr = push_buffer;           /* reset input character stack */
  442.                        /* add file name to data base */
  443. if( !( file_record_array_ptr->source_filename = strdup( the_filename ) ) )
  444.    {
  445.    (void)printf( "Ran out of memory.\n" );
  446.    exit( 1 );
  447.    }
  448.  
  449. starting_called_function_ptr = function_list_ptr;
  450. starting_data_base_ptr = data_base_array_ptr; /* mark start of list */
  451.  
  452. look_ahead_buffer[ 0 ] = '\0';
  453.  
  454. first_comment = false;
  455. file_comment_buffer[ 0 ] = '\0';
  456.  
  457. file_record_array_ptr->line_count = 0;    /* clear it's variables */
  458. file_record_array_ptr->size = 0l;
  459.  
  460. function_name_buffer_ptr = function_name_buffer;
  461. function_name_buffer[ 0 ] = '\0';
  462.  
  463. static_flag = false;
  464. found_a_possible_function = false;
  465. open_parenthesis = false;
  466. body_found = false;
  467.  
  468. brace_count = 0;
  469. parenthesis_count = 0;
  470.  
  471. at_end_of_source_file = false;
  472. while( !at_end_of_source_file )
  473.    {
  474.    c = get_to_next_possible_token( stream );
  475.    switch( c )
  476.       {
  477.       case '{':
  478.      ++brace_count;
  479.      break;
  480.       case '}':
  481.      --brace_count;
  482.      break;
  483.       case Control_z:
  484.      at_end_of_source_file = true;
  485.      analyze_buffer_flag = true;
  486.      break;
  487.       case '(':
  488.      if( !open_parenthesis )
  489.         ++open_parenthesis;
  490.      analyze_buffer_flag = true;
  491.      break;
  492.       case ' ':          /* this is where we eat white space */
  493.       case '\v':
  494.       case '\b':
  495.       case '\f':
  496.       case '\t':
  497.       case '\r':
  498.       case '\n':
  499.      do {
  500.         c = get_to_next_possible_token( stream );
  501.         }
  502.      while(
  503.            ( c == '\f' ) || ( c == ' ' ) || ( c == '\v' ) ||
  504.            ( c == '\b' ) || ( c == '\t' ) || ( c == '\r' ) ||
  505.            ( c == '\n' )
  506.           );
  507.      unget_chars( c ); /* put next non white character back */
  508.  
  509.      if( c != '(' )
  510.         analyze_buffer_flag = true;
  511. /***     else  /* c == '(' and next pass will find it */
  512.      break;
  513.       default:
  514.      if( is_legal_identifier_character( c ) )
  515.         {       /* it's a good identifier character */
  516.         *function_name_buffer_ptr++ = c;
  517.         *function_name_buffer_ptr = '\0';
  518.         }
  519.      else       /* it isn't, so toss it */
  520.         {
  521.         if( static_flag && ( c == ';' ) )
  522.            static_flag = false;
  523. /*        if( c != '*' ) */
  524.         analyze_buffer_flag = true;
  525.         }
  526.      break;
  527.       }            /* end of preliminary character parse */
  528. /*****************
  529.    start checking characters accumulated in function_name_buffer[]
  530. ******************/
  531.    if( analyze_buffer_flag )
  532.       {
  533.       analyze_buffer_flag = false;
  534.       if(
  535.      function_name_buffer[ 0 ] &&         /* ie not null string */
  536.      (                     /* & not number */
  537.       ( function_name_buffer[ 0 ] < '0' ) ||
  538.       ( function_name_buffer[ 0 ] > '9' )
  539.      )
  540.     )
  541.      found_a_possible_function = true;
  542.       else                     /* it aint an identifier */
  543.      {                     /* so erase buffer */
  544.      function_name_buffer_ptr = function_name_buffer;
  545.      function_name_buffer[ 0 ] = '\0';
  546.      if( static_flag && ( c == ';' ) )
  547.         static_flag = false;
  548.      open_parenthesis = false;
  549.      }
  550.       }               /* end of analyze_buffer_flag */
  551. /*****************
  552.    if function_name_buffer[] has legal function name, scan ahead
  553. ******************/
  554.    if( found_a_possible_function )
  555.       {
  556.       found_a_possible_function = false;
  557.       *function_name_buffer_ptr = '\0';   /* append nul char to end */
  558.       if( !static_flag )          /* don't retest if true */
  559.      if( !strcmp( function_name_buffer, "static" ) )
  560.         static_flag = true;
  561.       if( open_parenthesis )
  562.      {
  563.      open_parenthesis = false;
  564.      if( !brace_count )
  565.         {                  /* ie outside any function body */
  566.         parenthesis_count = 1;
  567.         for( dummy_index = 0;
  568.          ( dummy_index < C_line_length ) && parenthesis_count;
  569.          ++dummy_index
  570.            )
  571.            {              /* scan ahead for function() */
  572.            c = get_to_next_possible_token( stream );
  573.            if( c == Control_z )
  574.           break;        /* dummy_index not bumped */
  575.            look_ahead_buffer[ dummy_index ] = c;
  576.            look_ahead_buffer[ dummy_index + 1 ] = '\0';
  577.            switch( c )
  578.           {
  579.           case '(':
  580.              ++parenthesis_count;
  581.              break;
  582.           case ')':
  583.              --parenthesis_count;
  584.              break;
  585.           }          /* dummy_index is bumped */
  586.            }          /* end of for loop scanning for (...) */
  587.         if( ( c == Control_z ) || ( !parenthesis_count ) )
  588.            --dummy_index;
  589.         function_definition_flag = false;
  590.         for( ++dummy_index;
  591.            ( dummy_index < C_line_length ) && !function_definition_flag;
  592.         ++dummy_index
  593.            )
  594.            {         /* what happens past (..) */
  595.            c = get_to_next_possible_token( stream );
  596.            if( c == Control_z )
  597.           break;     /* w/ function_definition_flag == false */
  598.            look_ahead_buffer[ dummy_index ] = c;
  599.            look_ahead_buffer[ dummy_index + 1 ] = '\0';
  600.            switch( c )
  601.           {
  602.           case ' ':        /* this is where we eat white space */
  603.           case '\v':
  604.           case '\b':
  605.           case '\f':
  606.           case '\t':
  607.           case '\n':
  608.           case '\r':
  609.              break;
  610.           case '{':
  611.              ++body_found;
  612.              break;
  613.           case ';':
  614.           case ',':
  615.           case '(':           /* at (*)() type declaration */
  616.              if( !body_found )
  617.             {
  618.             function_definition_flag = true; /* declaration */
  619.             if( !g_quiet_flag )
  620.                {
  621.                if( g_dec_def_flag )
  622.                   {
  623.                   if( static_flag )
  624.                  (void)printf( " static" );
  625.                   else
  626.                  (void)printf( "       " );
  627.                   (void)printf( " declaration " );
  628.                   (void)printf( "%s(%s\n",
  629.                         function_name_buffer,
  630.                         look_ahead_buffer );
  631.                   }
  632.                }
  633.             }
  634.              break;
  635.           default:     /* any other non white character means */
  636.              function_definition_flag = completed;
  637.              if( !g_quiet_flag )
  638.             {
  639.             if( g_dec_def_flag )
  640.                {
  641.                if( static_flag )
  642.                   (void)printf( "static " );
  643.                else
  644.                   (void)printf( "       " );
  645.                (void)printf( "define " );
  646.                }   
  647.             }
  648.              break;
  649.           }     /* dummy_index is bumped */
  650.            }     /* end of for loop parsing character after ) */
  651.         body_found = false;
  652.         if( function_definition_flag == false )
  653.            {
  654.            (void)printf( "\nSyntax error: " );
  655.            (void)printf( "Function description.\n" );
  656.            look_ahead_buffer[ dummy_index ] = '\0';
  657.            (void)printf( "\n%s\n", look_ahead_buffer );
  658.            exit( 1 );
  659.            }
  660.         while( dummy_index )
  661.            {          /* put all characters after ( back */
  662.            unget_chars( look_ahead_buffer[ dummy_index - 1 ] );
  663.            --dummy_index;
  664.            }
  665.         if( function_definition_flag == completed )
  666.            {
  667.            if( !g_quiet_flag )
  668.           {
  669.           if( g_dec_def_flag )
  670.              (void)printf( "%-40s\n", function_name_buffer );
  671.           }
  672. /*******************
  673.    this element can distinguish static functions
  674.    in different files with the same name
  675.  *******************/
  676.        data_base_array_ptr->file_record_ptr = file_record_array_ptr;
  677.        data_base_array_ptr->number_of_function_calls = 0;
  678.        data_base_array_ptr->ptr_to_function_table = function_list_ptr;
  679.        data_base_array_ptr->static_definition = static_flag;
  680.        data_base_array_ptr->overlay_number = ov_num;
  681.  
  682.        static_flag = false;
  683.  
  684.        if(
  685.           !( data_base_array_ptr->defined_function =
  686.              strdup( function_name_buffer )
  687.            )
  688.          )
  689.           {
  690.           (void)printf( "\nRan out of memory( for strdup() )." );
  691.           exit( 1 );
  692.           }
  693.        data_base_array_ptr->number_of_references = 0;
  694.        data_base_array_ptr->ptr_to_page_list = NULL;
  695.  
  696.        data_base_ptr = data_base_array_ptr; /* save current pointer */
  697.        ++data_base_array_ptr;          /* next entry */
  698.        ++count_of_valid_records;
  699.        if( count_of_valid_records > Max_defined_functions )
  700.           {
  701.           (void)printf( "\nToo many new functions\n" );
  702.           exit( 1 );
  703.           }
  704.            }    /* end of function definition */
  705.         static_flag = false;
  706.         }
  707.      else             /* brace_count is not zero */
  708.         {             /* so inside a function */
  709.         data_base_ptr->number_of_function_calls +=
  710.            test_and_add( data_base_ptr->ptr_to_function_table,
  711.                  function_name_buffer,
  712.                  data_base_ptr->number_of_function_calls
  713.                );
  714.         }
  715.      look_ahead_buffer[ 0 ] = '\0';   /* reset tail buffer */
  716.      static_flag = false;
  717.      }             /* end of parenthesis */
  718.       function_name_buffer_ptr = function_name_buffer;     /* reset buffer */
  719.       *function_name_buffer_ptr = '\0';
  720.       }            /* end of found_a_possible_function */
  721.    }               /* end of while !at_end_of_source_file */
  722. (void)fclose( stream );
  723. if( !g_quiet_flag )
  724.    {
  725.    (void)printf( "\n" );
  726.    }
  727.  
  728. if(
  729.    !( file_record_array_ptr->source_file_comment =
  730.       strdup( file_comment_buffer )
  731.     )
  732.   )
  733.     file_record_array_ptr->source_file_comment = fake_comment;
  734.  
  735. /***** mark called functions in list as static if in defined list *******/
  736. total_called_count = 0;
  737. data_base_ptr = starting_data_base_ptr;
  738. while( data_base_ptr != data_base_array_ptr )
  739.    {
  740.    total_called_count += data_base_ptr->number_of_function_calls;
  741.    ++data_base_ptr;
  742.    }
  743. data_base_ptr = starting_data_base_ptr;
  744. while( data_base_ptr < data_base_array_ptr )
  745.    {
  746.    if( data_base_ptr->static_definition )
  747.       mark_as_static( starting_called_function_ptr,
  748.               data_base_ptr->defined_function,
  749.               total_called_count
  750.             );
  751.    ++data_base_ptr;
  752.    }
  753. ++file_record_array_ptr;      /* next file name entry */
  754. ++count_of_source_files;
  755. if( count_of_source_files >= Max_files )
  756.    {
  757.    (void)printf( "\nError: too many files to process.\n" );
  758.    exit( 1 );
  759.    }
  760. return at_end_of_source_file;
  761. }
  762. /***********************************************************************/
  763. xit( 1 );
  764.    }
  765. return at_end_of_source_file;
  766. }
  767. /***************************************