home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 October / usenetsourcesnewsgroupsinfomagicoctober1994disk2.iso / misc / volume29 / cproto / patch03 / patch3
Encoding:
Text File  |  1992-04-25  |  23.2 KB  |  933 lines

  1. diff -c old/CHANGES new/CHANGES
  2. *** old/CHANGES    Sat Apr 11 19:11:26 1992
  3. --- new/CHANGES    Sat Apr 11 19:23:02 1992
  4. ***************
  5. *** 1,5 ****
  6. --- 1,17 ----
  7.   Version 3
  8.   
  9. + Patchlevel 3
  10. + - Fix: The program didn't generate prototypes for functions defined with
  11. +   the extern specifier.
  12. + - Fix: The -c option didn't output a space before parameter names in
  13. +   generated prototypes.
  14. + - Added the -E option to specify a particular C preprocessor to run or
  15. +   to stop the program from running the C preprocessor.
  16. + - Added the -q option to stop the program from outputting error messages
  17. +   when it cannot read the file specified in an #include directive.
  18. + - Made the yacc specification compatible with UNIX SYSVR4 yacc.
  19. +   
  20.   Patchlevel 2
  21.   
  22.   - Fix: The function definition conversion may produce a mangled function
  23. diff -c old/cproto.1 new/cproto.1
  24. *** old/cproto.1    Sat Apr 11 19:11:26 1992
  25. --- new/cproto.1    Sat Apr 11 19:27:16 1992
  26. ***************
  27. *** 1,4 ****
  28. ! .\" $Id: cproto.1 3.4 92/04/04 14:01:52 cthuang Exp $
  29.   .\"
  30.   .de EX        \"Begin example
  31.   .ne 5
  32. --- 1,4 ----
  33. ! .\" $Id: cproto.1 3.5 92/04/11 19:27:07 cthuang Exp $
  34.   .\"
  35.   .de EX        \"Begin example
  36.   .ne 5
  37. ***************
  38. *** 13,19 ****
  39.   .if n .sp 1
  40.   .if t .sp .5
  41.   ..
  42. ! .TH CPROTO 1 "April 3, 1992"
  43.   .SH NAME
  44.   cproto \- generate C function prototypes and convert function definitions
  45.   .SH SYNOPSIS
  46. --- 13,19 ----
  47.   .if n .sp 1
  48.   .if t .sp .5
  49.   ..
  50. ! .TH CPROTO 1 "April 7, 1992"
  51.   .SH NAME
  52.   cproto \- generate C function prototypes and convert function definitions
  53.   .SH SYNOPSIS
  54. ***************
  55. *** 55,62 ****
  56.   such as in the example,
  57.   .EX
  58.   main (argc, argv)
  59. ! int argc;    /* number of arguments */
  60. ! char *argv[];    /* arguments */
  61.   {
  62.    ...
  63.   }
  64. --- 55,62 ----
  65.   such as in the example,
  66.   .EX
  67.   main (argc, argv)
  68. ! int argc;       /* number of arguments */
  69. ! char *argv[];   /* arguments */
  70.   {
  71.    ...
  72.   }
  73. ***************
  74. *** 65,71 ****
  75.   .EX
  76.   int
  77.   main (
  78. !     int argc;        /* number of arguments */
  79.       char *argv[];   /* arguments */
  80.   )
  81.   {
  82. --- 65,71 ----
  83.   .EX
  84.   int
  85.   main (
  86. !     int argc;       /* number of arguments */
  87.       char *argv[];   /* arguments */
  88.   )
  89.   {
  90. ***************
  91. *** 132,147 ****
  92.   .TP
  93.   .B \-c
  94.   Omit the parameter comments in the prototypes generated by
  95. ! the -f1 and -f2 options.
  96.   This option also omits the comments naming the source files from which
  97.   the prototypes were generated.
  98.   .TP
  99.   .BI \-m name
  100. ! Set the name of the macro used to guard prototypes when option -f4 is selected.
  101.   The default is "P_".
  102.   .TP
  103.   .B \-d
  104. ! Omit the definition of the prototype macro named by the -m option.
  105.   .TP
  106.   .B \-p
  107.   Disable promotion of formal parameters in old style function definitions.
  108. --- 132,147 ----
  109.   .TP
  110.   .B \-c
  111.   Omit the parameter comments in the prototypes generated by
  112. ! the \-f1 and \-f2 options.
  113.   This option also omits the comments naming the source files from which
  114.   the prototypes were generated.
  115.   .TP
  116.   .BI \-m name
  117. ! Set the name of the macro used to guard prototypes when option \-f4 is selected.
  118.   The default is "P_".
  119.   .TP
  120.   .B \-d
  121. ! Omit the definition of the prototype macro named by the \-m option.
  122.   .TP
  123.   .B \-p
  124.   Disable promotion of formal parameters in old style function definitions.
  125. ***************
  126. *** 158,163 ****
  127. --- 158,169 ----
  128.   .B double
  129.   as well.
  130.   .TP
  131. + .B \-q
  132. + Do not output any error messages when the program cannot read the
  133. + file specified in an
  134. + .I #include
  135. + directive.
  136. + .TP
  137.   .B \-s
  138.   By default,
  139.   .B cproto
  140. ***************
  141. *** 212,217 ****
  142. --- 218,231 ----
  143.   a directory to search for files that are referenced with 
  144.   .I #include.
  145.   .TP
  146. + .BI \-E cpp
  147. + Pipe the input files through the specified C preprocessor command
  148. + when generating prototypes.
  149. + By default, the program uses /lib/cpp.
  150. + .TP
  151. + .BI \-E 0
  152. + Do not run the C preprocessor.
  153. + .TP
  154.   .B \-V
  155.   Print version information.
  156.   .SH ENVIRONMENT
  157. ***************
  158. *** 229,235 ****
  159.   The conversion also discards some comments in the function definition
  160.   head.
  161.   .LP
  162. ! The -v option does not generate declarations for variables defined with the
  163.   .B extern
  164.   specifier.
  165.   This doesn't strictly conform to the C language standard but this rule
  166. --- 243,249 ----
  167.   The conversion also discards some comments in the function definition
  168.   head.
  169.   .LP
  170. ! The \-v option does not generate declarations for variables defined with the
  171.   .B extern
  172.   specifier.
  173.   This doesn't strictly conform to the C language standard but this rule
  174. diff -c old/cproto.c new/cproto.c
  175. *** old/cproto.c    Sat Apr 11 19:11:38 1992
  176. --- new/cproto.c    Sat Apr 11 19:28:06 1992
  177. ***************
  178. *** 1,9 ****
  179. ! /* $Id: cproto.c 3.4 92/04/04 13:59:22 cthuang Exp $
  180.    *
  181.    * C function prototype generator and function definition converter
  182.    */
  183.   #ifndef lint
  184. ! static char rcsid[] = "$Id: cproto.c 3.4 92/04/04 13:59:22 cthuang Exp $";
  185.   #endif
  186.   #include <stdio.h>
  187.   #include <ctype.h>
  188. --- 1,9 ----
  189. ! /* $Id: cproto.c 3.5 92/04/11 19:28:01 cthuang Exp $
  190.    *
  191.    * C function prototype generator and function definition converter
  192.    */
  193.   #ifndef lint
  194. ! static char rcsid[] = "$Id: cproto.c 3.5 92/04/11 19:28:01 cthuang Exp $";
  195.   #endif
  196.   #include <stdio.h>
  197.   #include <ctype.h>
  198. ***************
  199. *** 59,64 ****
  200. --- 59,67 ----
  201.       { "", "\n", " ", "\n    ", "\n    ", "\n" },
  202.   };
  203.   
  204. + /* If TRUE, don't output message if unable to read an include file */
  205. + boolean quiet = FALSE;
  206.   /* Include file directories */
  207.   #ifdef MSDOS
  208.   int num_inc_dir = 1;
  209. ***************
  210. *** 72,78 ****
  211.   #ifdef CPP
  212.   extern FILE *popen();
  213.   extern int pclose();
  214. ! static char *cpp_cmd, *cmd;
  215.   #endif
  216.   
  217.   
  218. --- 75,81 ----
  219.   #ifdef CPP
  220.   extern FILE *popen();
  221.   extern int pclose();
  222. ! static char *cpp = CPP, *cpp_opt, *cpp_cmd;
  223.   #endif
  224.   
  225.   
  226. ***************
  227. *** 228,233 ****
  228. --- 231,237 ----
  229.       stderr);
  230.       fputs("  -f n     Set function prototype style (0 to 4)\n", stderr);
  231.       fputs("  -p       Disable formal parameter promotion\n", stderr);
  232. +     fputs("  -q       Disable include file read failure messages\n", stderr);
  233.       fputs("  -s       Output static declarations\n", stderr);
  234.       fputs("  -t       Convert function definitions to traditional style\n",
  235.       stderr);
  236. ***************
  237. *** 240,250 ****
  238.       stderr);
  239.       fputs("  -C fmt   Set format for function definition with parameter comments\n",
  240.       stderr);
  241. -     fputs("  -V       Print version information\n", stderr);
  242.       fputs("  -D name[=value]\n", stderr);
  243.       fputs("  -U name\n", stderr);
  244.       fputs("  -I directory\n", stderr);
  245.       fputs("           Set C preprocessor options\n", stderr);
  246.       exit(1);
  247.   }
  248.   
  249. --- 244,256 ----
  250.       stderr);
  251.       fputs("  -C fmt   Set format for function definition with parameter comments\n",
  252.       stderr);
  253.       fputs("  -D name[=value]\n", stderr);
  254.       fputs("  -U name\n", stderr);
  255.       fputs("  -I directory\n", stderr);
  256.       fputs("           Set C preprocessor options\n", stderr);
  257. +     fputs("  -E cpp   Run specified C preprocessor command\n", stderr);
  258. +     fputs("  -E 0     Do not run any C preprocessor\n", stderr);
  259. +     fputs("  -V       Print version information\n", stderr);
  260.       exit(1);
  261.   }
  262.   
  263. ***************
  264. *** 288,299 ****
  265.       for (i = 0; i < argc; ++i) {
  266.       n += strlen(argv[i]) + 1;
  267.       }
  268.       cpp_cmd = xmalloc(n);
  269. -     strcpy(cpp_cmd, CPP);
  270. -     cmd = xmalloc(n);
  271.   #endif
  272.   
  273. !     while ((c = getopt(argc, argv, "aC:cD:deF:f:I:m:P:pstU:Vv")) != EOF) {
  274.       switch (c) {
  275.       case 'I':
  276.           if (num_inc_dir < MAX_INC_DIR) {
  277. --- 294,305 ----
  278.       for (i = 0; i < argc; ++i) {
  279.       n += strlen(argv[i]) + 1;
  280.       }
  281. +     cpp_opt = xmalloc(n);
  282. +     *cpp_opt = '\0';
  283.       cpp_cmd = xmalloc(n);
  284.   #endif
  285.   
  286. !     while ((c = getopt(argc, argv, "aC:cD:dE:eF:f:I:m:P:pqstU:Vv")) != EOF) {
  287.       switch (c) {
  288.       case 'I':
  289.           if (num_inc_dir < MAX_INC_DIR) {
  290. ***************
  291. *** 306,312 ****
  292.       case 'U':
  293.   #ifdef CPP
  294.           sprintf(tmp, " -%c%s", c, optarg);
  295. !         strcat(cpp_cmd, tmp);
  296.   #endif
  297.           break;
  298.       case 'a':
  299. --- 312,318 ----
  300.       case 'U':
  301.   #ifdef CPP
  302.           sprintf(tmp, " -%c%s", c, optarg);
  303. !         strcat(cpp_opt, tmp);
  304.   #endif
  305.           break;
  306.       case 'a':
  307. ***************
  308. *** 318,323 ****
  309. --- 324,338 ----
  310.       case 'd':
  311.           define_macro = FALSE;
  312.           break;
  313. +     case 'E':
  314. + #ifdef CPP
  315. +         if (strcmp(optarg, "0") == 0) {
  316. +         cpp = NULL;
  317. +         } else {
  318. +         cpp = optarg;
  319. +         }
  320. + #endif
  321. +         break;
  322.       case 'e':
  323.           extern_out = TRUE;
  324.           break;
  325. ***************
  326. *** 377,382 ****
  327. --- 392,400 ----
  328.       case 'p':
  329.           promote_param = FALSE;
  330.           break;
  331. +     case 'q':
  332. +         quiet = TRUE;
  333. +         break;
  334.       case 's':
  335.           static_out = TRUE;
  336.           break;
  337. ***************
  338. *** 385,390 ****
  339. --- 403,409 ----
  340.           break;
  341.       case 'V':
  342.           fprintf(stderr, "%s patchlevel %d\n", rcsid, PATCHLEVEL);
  343. +         exit(1);
  344.           break;
  345.       case 'v':
  346.           variables_out = TRUE;
  347. ***************
  348. *** 428,443 ****
  349.       } else {
  350.       for (i = optind; i < argc; ++i) {
  351.   #ifdef CPP
  352. !         if (func_style == FUNC_NONE) {
  353. !         sprintf(cmd, "%s %s", cpp_cmd, argv[i]);
  354. !         if ((inf = popen(cmd, "r")) == NULL) {
  355. !             fprintf(stderr, "%s: error running cpp\n", progname);
  356.               continue;
  357.           }
  358.           } else {
  359.           if ((inf = fopen(argv[i], "r")) == NULL) {
  360.               fprintf(stderr, "%s: cannot read file %s\n", progname,
  361. !             argv[i]);
  362.               continue;
  363.           }
  364.           }
  365. --- 447,463 ----
  366.       } else {
  367.       for (i = optind; i < argc; ++i) {
  368.   #ifdef CPP
  369. !         if (func_style == FUNC_NONE && cpp != NULL) {
  370. !         sprintf(cpp_cmd, "%s%s %s", cpp, cpp_opt, argv[i]);
  371. !         if ((inf = popen(cpp_cmd, "r")) == NULL) {
  372. !             fprintf(stderr, "%s: error running %s\n", progname,
  373. !              cpp_cmd);
  374.               continue;
  375.           }
  376.           } else {
  377.           if ((inf = fopen(argv[i], "r")) == NULL) {
  378.               fprintf(stderr, "%s: cannot read file %s\n", progname,
  379. !              argv[i]);
  380.               continue;
  381.           }
  382.           }
  383. diff -c old/cproto.h new/cproto.h
  384. *** old/cproto.h    Sat Apr 11 19:11:36 1992
  385. --- new/cproto.h    Sat Apr 11 19:27:48 1992
  386. ***************
  387. *** 1,4 ****
  388. ! /* $Id: cproto.h 3.4 92/04/04 13:59:08 cthuang Exp $
  389.    *
  390.    * Declarations for C function prototype generator
  391.    */
  392. --- 1,4 ----
  393. ! /* $Id: cproto.h 3.5 92/04/11 19:27:44 cthuang Exp $
  394.    *
  395.    * Declarations for C function prototype generator
  396.    */
  397. ***************
  398. *** 25,36 ****
  399.   } ParameterList;
  400.   
  401.   /* Declaration specifier flags */
  402. ! #define DS_EXTERN    0    /* default: external declaration */
  403. ! #define DS_STATIC    1    /* visible only in current file */
  404. ! #define DS_CHAR     2    /* "char" type specifier in declaration */
  405. ! #define DS_SHORT    4    /* "short" type specifier in declaration */
  406. ! #define DS_FLOAT    8    /* "float" type specifier in declaration */
  407. ! #define DS_JUNK     16    /* we're not interested in this declaration */
  408.   
  409.   /* This structure stores information about a declaration specifier. */
  410.   typedef struct decl_spec {
  411. --- 25,37 ----
  412.   } ParameterList;
  413.   
  414.   /* Declaration specifier flags */
  415. ! #define DS_NONE     0    /* default */
  416. ! #define DS_EXTERN    1    /* contains "extern" specifier */
  417. ! #define DS_STATIC    2    /* contains "static" specifier */
  418. ! #define DS_CHAR     4    /* contains "char" type specifier */
  419. ! #define DS_SHORT    8    /* contains "short" type specifier */
  420. ! #define DS_FLOAT    16    /* contains "float" type specifier */
  421. ! #define DS_JUNK     32    /* we're not interested in this declaration */
  422.   
  423.   /* This structure stores information about a declaration specifier. */
  424.   typedef struct decl_spec {
  425. ***************
  426. *** 105,111 ****
  427.   typedef int FuncFormatType;
  428.   
  429.   /* Prototype/function definition output format */
  430. ! typedef struct {
  431.       char *decl_spec_prefix;    /* output before declaration specifier */
  432.       char *declarator_prefix;    /* output before declarator name */
  433.       char *declarator_suffix;    /* output before '(' of parameter list */
  434. --- 106,112 ----
  435.   typedef int FuncFormatType;
  436.   
  437.   /* Prototype/function definition output format */
  438. ! typedef struct func_format {
  439.       char *decl_spec_prefix;    /* output before declaration specifier */
  440.       char *declarator_prefix;    /* output before declarator name */
  441.       char *declarator_suffix;    /* output before '(' of parameter list */
  442. ***************
  443. *** 124,129 ****
  444. --- 125,131 ----
  445.   extern boolean define_macro;
  446.   extern char *macro_name;
  447.   extern boolean proto_comments;
  448. + extern boolean quiet;
  449.   extern int num_inc_dir;
  450.   extern char *inc_dir[];
  451.   extern FuncFormat fmt[4];
  452. diff -c old/grammar.y new/grammar.y
  453. *** old/grammar.y    Sat Apr 11 19:11:28 1992
  454. --- new/grammar.y    Sat Apr 11 19:27:38 1992
  455. ***************
  456. *** 1,4 ****
  457. ! /* $Id: grammar.y 3.4 92/04/04 13:58:58 cthuang Exp $
  458.    *
  459.    * yacc grammar for C function prototype generator
  460.    * This was derived from the grammar in Appendix A of
  461. --- 1,4 ----
  462. ! /* $Id: grammar.y 3.5 92/04/11 19:27:34 cthuang Exp $
  463.    *
  464.    * yacc grammar for C function prototype generator
  465.    * This was derived from the grammar in Appendix A of
  466. ***************
  467. *** 5,10 ****
  468. --- 5,12 ----
  469.    * "The C Programming Language" by Kernighan and Ritchie.
  470.    */
  471.   
  472. + %token <text> '(' '*'
  473.   %token
  474.       /* identifiers that are not reserved words */
  475.       T_IDENTIFIER T_TYPEDEF_NAME
  476. ***************
  477. *** 203,209 ****
  478.   
  479.           func_params = NULL;
  480.   
  481. !         new_decl_spec(&decl_spec, "int", $1->begin, DS_EXTERN);
  482.           if (cur_file->convert)
  483.           gen_func_definition(&decl_spec, $1);
  484.           gen_prototype(&decl_spec, $1);
  485. --- 205,211 ----
  486.   
  487.           func_params = NULL;
  488.   
  489. !         new_decl_spec(&decl_spec, "int", $1->begin, DS_NONE);
  490.           if (cur_file->convert)
  491.           gen_func_definition(&decl_spec, $1);
  492.           gen_prototype(&decl_spec, $1);
  493. ***************
  494. *** 242,256 ****
  495.   storage_class
  496.       : T_AUTO
  497.       {
  498. !         new_decl_spec(&$$, $1.text, $1.begin, DS_EXTERN);
  499.       }
  500.       | T_EXTERN
  501.       {
  502. !         new_decl_spec(&$$, $1.text, $1.begin, DS_JUNK);
  503.       }
  504.       | T_REGISTER
  505.       {
  506. !         new_decl_spec(&$$, $1.text, $1.begin, DS_EXTERN);
  507.       }
  508.       | T_STATIC
  509.       {
  510. --- 244,258 ----
  511.   storage_class
  512.       : T_AUTO
  513.       {
  514. !         new_decl_spec(&$$, $1.text, $1.begin, DS_NONE);
  515.       }
  516.       | T_EXTERN
  517.       {
  518. !         new_decl_spec(&$$, $1.text, $1.begin, DS_EXTERN);
  519.       }
  520.       | T_REGISTER
  521.       {
  522. !         new_decl_spec(&$$, $1.text, $1.begin, DS_NONE);
  523.       }
  524.       | T_STATIC
  525.       {
  526. ***************
  527. *** 265,303 ****
  528.   type_specifier
  529.       : T_CHAR
  530.       {
  531. !         new_decl_spec(&$$, $1.text, $1.begin, DS_EXTERN | DS_CHAR);
  532.       }
  533.       | T_DOUBLE
  534.       {
  535. !         new_decl_spec(&$$, $1.text, $1.begin, DS_EXTERN);
  536.       }
  537.       | T_FLOAT
  538.       {
  539. !         new_decl_spec(&$$, $1.text, $1.begin, DS_EXTERN | DS_FLOAT);
  540.       }
  541.       | T_INT
  542.       {
  543. !         new_decl_spec(&$$, $1.text, $1.begin, DS_EXTERN);
  544.       }
  545.       | T_LONG
  546.       {
  547. !         new_decl_spec(&$$, $1.text, $1.begin, DS_EXTERN);
  548.       }
  549.       | T_SHORT
  550.       {
  551. !         new_decl_spec(&$$, $1.text, $1.begin, DS_EXTERN | DS_SHORT);
  552.       }
  553.       | T_SIGNED
  554.       {
  555. !         new_decl_spec(&$$, $1.text, $1.begin, DS_EXTERN);
  556.       }
  557.       | T_UNSIGNED
  558.       {
  559. !         new_decl_spec(&$$, $1.text, $1.begin, DS_EXTERN);
  560.       }
  561.       | T_VOID
  562.       {
  563. !         new_decl_spec(&$$, $1.text, $1.begin, DS_EXTERN);
  564.       }
  565.       | struct_or_union_specifier
  566.       | enum_specifier
  567. --- 267,305 ----
  568.   type_specifier
  569.       : T_CHAR
  570.       {
  571. !         new_decl_spec(&$$, $1.text, $1.begin, DS_CHAR);
  572.       }
  573.       | T_DOUBLE
  574.       {
  575. !         new_decl_spec(&$$, $1.text, $1.begin, DS_NONE);
  576.       }
  577.       | T_FLOAT
  578.       {
  579. !         new_decl_spec(&$$, $1.text, $1.begin, DS_FLOAT);
  580.       }
  581.       | T_INT
  582.       {
  583. !         new_decl_spec(&$$, $1.text, $1.begin, DS_NONE);
  584.       }
  585.       | T_LONG
  586.       {
  587. !         new_decl_spec(&$$, $1.text, $1.begin, DS_NONE);
  588.       }
  589.       | T_SHORT
  590.       {
  591. !         new_decl_spec(&$$, $1.text, $1.begin, DS_SHORT);
  592.       }
  593.       | T_SIGNED
  594.       {
  595. !         new_decl_spec(&$$, $1.text, $1.begin, DS_NONE);
  596.       }
  597.       | T_UNSIGNED
  598.       {
  599. !         new_decl_spec(&$$, $1.text, $1.begin, DS_NONE);
  600.       }
  601.       | T_VOID
  602.       {
  603. !         new_decl_spec(&$$, $1.text, $1.begin, DS_NONE);
  604.       }
  605.       | struct_or_union_specifier
  606.       | enum_specifier
  607. ***************
  608. *** 306,312 ****
  609.   type_qualifier
  610.       : T_TYPE_QUALIFIER
  611.       {
  612. !         new_decl_spec(&$$, $1.text, $1.begin, DS_EXTERN);
  613.       }
  614.       | T_TYPEDEF_NAME
  615.       {
  616. --- 308,314 ----
  617.   type_qualifier
  618.       : T_TYPE_QUALIFIER
  619.       {
  620. !         new_decl_spec(&$$, $1.text, $1.begin, DS_NONE);
  621.       }
  622.       | T_TYPEDEF_NAME
  623.       {
  624. ***************
  625. *** 324,340 ****
  626.       : struct_or_union any_id braces
  627.       {
  628.           sprintf(buf, "%s %s", $1.text, $2.text);
  629. !         new_decl_spec(&$$, buf, $1.begin, DS_EXTERN);
  630.       }
  631.       | struct_or_union braces
  632.       {
  633.           sprintf(buf, "%s {}", $1.text);
  634. !         new_decl_spec(&$$, buf, $1.begin, DS_EXTERN);
  635.       }
  636.       | struct_or_union any_id
  637.       {
  638.           sprintf(buf, "%s %s", $1.text, $2.text);
  639. !         new_decl_spec(&$$, buf, $1.begin, DS_EXTERN);
  640.       }
  641.       ;
  642.   
  643. --- 326,342 ----
  644.       : struct_or_union any_id braces
  645.       {
  646.           sprintf(buf, "%s %s", $1.text, $2.text);
  647. !         new_decl_spec(&$$, buf, $1.begin, DS_NONE);
  648.       }
  649.       | struct_or_union braces
  650.       {
  651.           sprintf(buf, "%s {}", $1.text);
  652. !         new_decl_spec(&$$, buf, $1.begin, DS_NONE);
  653.       }
  654.       | struct_or_union any_id
  655.       {
  656.           sprintf(buf, "%s %s", $1.text, $2.text);
  657. !         new_decl_spec(&$$, buf, $1.begin, DS_NONE);
  658.       }
  659.       ;
  660.   
  661. ***************
  662. *** 379,394 ****
  663.       : T_ENUM any_id braces
  664.       {
  665.           sprintf(buf, "enum %s", $2.text);
  666. !         new_decl_spec(&$$, buf, $1.begin, DS_EXTERN);
  667.       }
  668.       | T_ENUM braces
  669.       {
  670. !         new_decl_spec(&$$, "enum {}", $1.begin, DS_EXTERN);
  671.       }
  672.       | T_ENUM any_id
  673.       {
  674.           sprintf(buf, "enum %s", $2.text);
  675. !         new_decl_spec(&$$, buf, $1.begin, DS_EXTERN);
  676.       }
  677.       ;
  678.   
  679. --- 381,396 ----
  680.       : T_ENUM any_id braces
  681.       {
  682.           sprintf(buf, "enum %s", $2.text);
  683. !         new_decl_spec(&$$, buf, $1.begin, DS_NONE);
  684.       }
  685.       | T_ENUM braces
  686.       {
  687. !         new_decl_spec(&$$, "enum {}", $1.begin, DS_NONE);
  688.       }
  689.       | T_ENUM any_id
  690.       {
  691.           sprintf(buf, "enum %s", $2.text);
  692. !         new_decl_spec(&$$, buf, $1.begin, DS_NONE);
  693.       }
  694.       ;
  695.   
  696. ***************
  697. *** 651,657 ****
  698.       /* Initialize type qualifier table. */
  699.       type_qualifiers = new_symbol_table();
  700.       for (i = 0; i < sizeof(keywords)/sizeof(keywords[0]); ++i) {
  701. !     new_symbol(type_qualifiers, keywords[i], DS_EXTERN);
  702.       }
  703.   }
  704.   
  705. --- 653,659 ----
  706.       /* Initialize type qualifier table. */
  707.       type_qualifiers = new_symbol_table();
  708.       for (i = 0; i < sizeof(keywords)/sizeof(keywords[0]); ++i) {
  709. !     new_symbol(type_qualifiers, keywords[i], DS_NONE);
  710.       }
  711.   }
  712.   
  713. diff -c old/lex.l new/lex.l
  714. *** old/lex.l    Sat Apr 11 19:11:28 1992
  715. --- new/lex.l    Sat Apr 11 19:27:34 1992
  716. ***************
  717. *** 1,5 ****
  718.   %{
  719. ! /* $Id: lex.l 3.5 92/04/04 13:58:53 cthuang Exp $
  720.    *
  721.    * Lexical analyzer for C function prototype generator
  722.    */
  723. --- 1,5 ----
  724.   %{
  725. ! /* $Id: lex.l 3.6 92/04/11 19:27:25 cthuang Exp $
  726.    *
  727.    * Lexical analyzer for C function prototype generator
  728.    */
  729. ***************
  730. *** 9,15 ****
  731.   
  732.   /* information about the current input file */
  733.   typedef struct {
  734. !     char *file_name;        /* input file name */
  735.       FILE *file;         /* input file */
  736.       unsigned line_num;        /* current line number in input file */
  737.       FILE *tmp_file;        /* temporary file */
  738. --- 9,16 ----
  739.   
  740.   /* information about the current input file */
  741.   typedef struct {
  742. !     char *base_name;        /* base input file name */
  743. !     char *file_name;        /* current file name */
  744.       FILE *file;         /* input file */
  745.       unsigned line_num;        /* current line number in input file */
  746.       FILE *tmp_file;        /* temporary file */
  747. ***************
  748. *** 344,349 ****
  749. --- 345,351 ----
  750.       ++inc_depth;
  751.       cur_file = inc_stack + inc_depth;
  752.       cur_file->file = yyin;
  753. +     cur_file->base_name = xstrdup(name);
  754.       cur_file->file_name = strcpy(xmalloc(MAX_TEXT_SIZE), name);
  755.       cur_file->line_num = 1;
  756.       cur_file->convert = convert;
  757. ***************
  758. *** 402,418 ****
  759.       if (cur_file->changed) {
  760.           if (yyin == stdin) {
  761.           put_file(stdout);
  762. !         } else if ((outf = fopen(cur_file->file_name, "w")) != NULL) {
  763.           put_file(outf);
  764.           fclose(outf);
  765.           } else {
  766.           fprintf(stderr, "%s: cannot create file %s\n", progname,
  767. !             cur_file->file_name);
  768.           }
  769.       }
  770.   
  771.       fclose(cur_file->tmp_file);
  772.       }
  773.       free(cur_file->file_name);
  774.   
  775.   #ifdef FLEX_SCANNER
  776. --- 404,421 ----
  777.       if (cur_file->changed) {
  778.           if (yyin == stdin) {
  779.           put_file(stdout);
  780. !         } else if ((outf = fopen(cur_file->base_name, "w")) != NULL) {
  781.           put_file(outf);
  782.           fclose(outf);
  783.           } else {
  784.           fprintf(stderr, "%s: cannot create file %s\n", progname,
  785. !             cur_file->base_name);
  786.           }
  787.       }
  788.   
  789.       fclose(cur_file->tmp_file);
  790.       }
  791. +     free(cur_file->base_name);
  792.       free(cur_file->file_name);
  793.   
  794.   #ifdef FLEX_SCANNER
  795. ***************
  796. *** 464,471 ****
  797.       }
  798.       }
  799.   
  800. !     put_error();
  801. !     fprintf(stderr, "cannot read file %s\n", filename);
  802.   }
  803.   
  804.   /* When the end of the current input file is reached, pop a
  805. --- 467,476 ----
  806.       }
  807.       }
  808.   
  809. !     if (!quiet) {
  810. !     put_error();
  811. !     fprintf(stderr, "cannot read file %s\n", filename);
  812. !     }
  813.   }
  814.   
  815.   /* When the end of the current input file is reached, pop a
  816. Only in new: makefile
  817. diff -c old/Makefile.uni new/Makefile.uni
  818. *** old/Makefile.uni    Sat Apr 11 19:11:26 1992
  819. --- new/Makefile.uni    Sat Apr 11 19:27:24 1992
  820. ***************
  821. *** 1,4 ****
  822. ! # $Id: makefile.uni 3.3 92/04/04 13:58:48 cthuang Exp $
  823.   #
  824.   # UNIX makefile for C prototype generator
  825.   
  826. --- 1,4 ----
  827. ! # $Id: makefile.uni 3.4 92/04/11 19:27:21 cthuang Exp $
  828.   #
  829.   # UNIX makefile for C prototype generator
  830.   
  831. ***************
  832. *** 31,37 ****
  833.       nroff -man cproto.1 >$@
  834.   
  835.   clean:
  836. !     rm *.o *.bak *.log cproto
  837.   
  838.   ci:
  839.       ci -u3 $(DIST2) $(DIST3) $(DIST4)
  840. --- 31,37 ----
  841.       nroff -man cproto.1 >$@
  842.   
  843.   clean:
  844. !     rm -f *.o *.bak *.log cproto lex.yy.c y.tab.c
  845.   
  846.   ci:
  847.       ci -u3 $(DIST2) $(DIST3) $(DIST4)
  848. diff -c old/patchlev.h new/patchlev.h
  849. *** old/patchlev.h    Sat Apr 11 19:11:36 1992
  850. --- new/patchlev.h    Sat Apr 11 19:28:34 1992
  851. ***************
  852. *** 1,1 ****
  853. ! #define PATCHLEVEL 2
  854. --- 1,1 ----
  855. ! #define PATCHLEVEL 3
  856. diff -c old/semantic.c new/semantic.c
  857. *** old/semantic.c    Sat Apr 11 19:11:38 1992
  858. --- new/semantic.c    Sat Apr 11 19:28:14 1992
  859. ***************
  860. *** 1,4 ****
  861. ! /* $Id: semantic.c 3.4 92/04/04 13:59:28 cthuang Exp $
  862.    *
  863.    * Semantic actions executed by the parser of the
  864.    * C function prototype generator.
  865. --- 1,4 ----
  866. ! /* $Id: semantic.c 3.5 92/04/11 19:28:08 cthuang Exp $
  867.    *
  868.    * Semantic actions executed by the parser of the
  869.    * C function prototype generator.
  870. ***************
  871. *** 365,373 ****
  872.   {
  873.       fputs(p->decl_spec.text, outf);
  874.       if (strlen(p->declarator->text) > 0) {
  875. !     if (strcmp(p->declarator->text, "...") != 0)
  876. !         if (where != FUNC_PROTO || proto_comments)
  877.           fputc(' ', outf);
  878.       put_declarator(outf, p->declarator);
  879.       }
  880.   }
  881. --- 365,376 ----
  882.   {
  883.       fputs(p->decl_spec.text, outf);
  884.       if (strlen(p->declarator->text) > 0) {
  885. !     if (strcmp(p->declarator->text, "...") != 0) {
  886. !         if (proto_style != PROTO_ABSTRACT || proto_comments ||
  887. !          where != FUNC_PROTO ||
  888. !          strcmp(p->declarator->text, p->declarator->name) != 0)
  889.           fputc(' ', outf);
  890. +     }
  891.       put_declarator(outf, p->declarator);
  892.       }
  893.   }
  894. ***************
  895. *** 593,599 ****
  896.   {
  897.       Declarator *d;
  898.   
  899. !     if (!variables_out || (decl_spec->flags & DS_JUNK))
  900.       return;
  901.       if (!static_out && (decl_spec->flags & DS_STATIC))
  902.       return;
  903. --- 596,602 ----
  904.   {
  905.       Declarator *d;
  906.   
  907. !     if (!variables_out || (decl_spec->flags & (DS_EXTERN|DS_JUNK)))
  908.       return;
  909.       if (!static_out && (decl_spec->flags & DS_STATIC))
  910.       return;
  911. ***************
  912. *** 637,645 ****
  913.   DeclSpec *decl_spec;
  914.   Declarator *declarator;
  915.   {
  916. !     if (proto_style == PROTO_NONE)
  917. !     return;
  918. !     if (decl_spec->flags & DS_JUNK)
  919.       return;
  920.       if (!static_out && (decl_spec->flags & DS_STATIC))
  921.       return;
  922. --- 640,646 ----
  923.   DeclSpec *decl_spec;
  924.   Declarator *declarator;
  925.   {
  926. !     if (proto_style == PROTO_NONE || (decl_spec->flags & DS_JUNK))
  927.       return;
  928.       if (!static_out && (decl_spec->flags & DS_STATIC))
  929.       return;
  930.