home *** CD-ROM | disk | FTP | other *** search
/ Source Code 1994 March / Source_Code_CD-ROM_Walnut_Creek_March_1994.iso / compsrcs / misc / volume29 / cproto / patch03 < prev    next >
Encoding:
Text File  |  1992-04-25  |  25.9 KB  |  984 lines

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