home *** CD-ROM | disk | FTP | other *** search
/ Source Code 1994 March / Source_Code_CD-ROM_Walnut_Creek_March_1994.iso / compsrcs / misc / volume34 / cproto / patch05 < prev    next >
Encoding:
Text File  |  1992-11-28  |  52.5 KB  |  1,905 lines

  1. Newsgroups: comp.sources.misc
  2. From: cthuang@zerosan.canrem.COM (Chin Huang)
  3. Subject:  v34i003:  cproto - generate C function prototypes v3, Patch05
  4. Message-ID: <1992Nov29.220352.6783@sparky.imd.sterling.com>
  5. X-Md4-Signature: 13e7608c99344dc6040f0a256459f5ed
  6. Date: Sun, 29 Nov 1992 22:03:52 GMT
  7. Approved: kent@sparky.imd.sterling.com
  8.  
  9. Submitted-by: cthuang@zerosan.canrem.COM (Chin Huang)
  10. Posting-number: Volume 34, Issue 3
  11. Archive-name: cproto/patch05
  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 5.  This release
  16. includes further bug fixes and enhancements.  Read the CHANGES file for
  17. details.  Thanks to the following people for their suggestions and bug
  18. reports:
  19.  
  20.     schellen@mprgate.mpr.ca (Neil Schellenberger)
  21.     Phil Kernick <phil@adam.adelaide.edu.au>
  22.     Chris Moran <cjm@trillian.mincom.oz.au>
  23.     jerry@Synopsys.COM (Jerry Huth)
  24.     "Nelson H. F. Beebe" <beebe@math.utah.edu>
  25.     hargen@sybus.com (Bill Hargen)
  26.     lew@gsg.GSG.COM (Paul Lew)
  27.     Masaki Kondo <ms-kondo@nsis.cl.nec.co.jp>
  28.  
  29. #! /bin/sh
  30. # This is a shell archive.  Remove anything before this line, then unpack
  31. # it by saving it into a file and typing "sh file".  To overwrite existing
  32. # files, type "sh file -c".  You can also feed this as standard input via
  33. # unshar, or by typing "sh <file", e.g..  If this archive is complete, you
  34. # will see the following message at the end:
  35. #        "End of shell archive."
  36. # Contents:  patch5
  37. # Wrapped by cthuang@zerosan.UUCP on Sat Nov 28 23:58:06 1992
  38. PATH=/bin:/usr/bin:/usr/ucb ; export PATH
  39. if test -f patch5 -a "${1}" != "-c" ; then 
  40.   echo shar: Will not over-write existing file \"patch5\"
  41. else
  42. echo shar: Extracting \"patch5\" \(49845 characters\)
  43. sed "s/^X//" >patch5 <<'END_OF_patch5'
  44. Xdiff  -c2 old/CHANGES new/CHANGES
  45. X*** old/CHANGES    Wed Jun 10 21:03:00 1992
  46. X--- new/CHANGES    Sat Nov 28 23:18:24 1992
  47. X***************
  48. X*** 1,4 ****
  49. X--- 1,46 ----
  50. X  Version 3
  51. X  
  52. X+ Patchlevel 5
  53. X+ 
  54. X+ - Fix: The -v option did not output declarations for function pointers.
  55. X+ - Fix: String literals continued over more than one line messed up the
  56. X+   line number count.
  57. X+ - Fix: The program generated incorrect prototypes for functions that take
  58. X+   a variable argument list using <varargs.h>.
  59. X+ - Fix: When converting functions from the standard input, cproto generated
  60. X+   no output if no functions needed to be converted.
  61. X+ - Fix: Now does not output a warning if an untagged struct is found in a
  62. X+   typedef declaration.
  63. X+ - Added the -b option which rewrites function definition heads to
  64. X+   include both old style and new style declarations separated by a
  65. X+   conditional compilation directive.  For example, the program can
  66. X+   generate
  67. X+ 
  68. X+     #ifdef ANSI_FUNC
  69. X+ 
  70. X+     int
  71. X+     main (int argc, char *argv[])
  72. X+     #else
  73. X+ 
  74. X+     int
  75. X+     main (argc, argv)
  76. X+     int argc;
  77. X+     char *argv[]
  78. X+     #endif
  79. X+     {
  80. X+     }
  81. X+ 
  82. X+   Added the -B option to set the preprocessor directive that appears
  83. X+   at the beginning of such definitions.
  84. X+ - Added the keyword "interrupt" to the set of type qualifiers when compiled
  85. X+   on a UNIX system.
  86. X+ - The MS-DOS version now recognizes the type modifiers introduced by
  87. X+   Microsoft C/C++ 7.00.
  88. X+ - Now recognizes ANSI C trigraphs (yuck!).
  89. X+ - Now use "#if __STDC__" instead of "#if defined(__STDC__)".
  90. X+ - GNU bison orders the y.tab.c sections differently than yacc, which
  91. X+   resulted in references to variables before they were declared.  The
  92. X+   grammar specification was modified to also be compatible with bison.
  93. X+ 
  94. X  Patchlevel 4
  95. X  
  96. X***************
  97. X*** 7,11 ****
  98. X    For example, for the definition
  99. X  
  100. X!       typedef char *caddr_t;
  101. X  
  102. X      int strlen (s)
  103. X--- 49,53 ----
  104. X    For example, for the definition
  105. X  
  106. X!     typedef char *caddr_t;
  107. X  
  108. X      int strlen (s)
  109. X***************
  110. X*** 16,20 ****
  111. X    cproto generated the incorrect prototype
  112. X  
  113. X!       int strlen(int s);
  114. X  
  115. X  - Added implementation of the ANSI function tmpfile() for systems that
  116. X--- 58,62 ----
  117. X    cproto generated the incorrect prototype
  118. X  
  119. X!     int strlen(int s);
  120. X  
  121. X  - Added implementation of the ANSI function tmpfile() for systems that
  122. X***************
  123. X*** 64,68 ****
  124. X    For example, for the definition
  125. X  
  126. X!       typedef unsigned short ushort;
  127. X  
  128. X      void test (x)
  129. X--- 106,110 ----
  130. X    For example, for the definition
  131. X  
  132. X!     typedef unsigned short ushort;
  133. X  
  134. X      void test (x)
  135. X***************
  136. X*** 73,81 ****
  137. X    cproto generated the incorrect prototype
  138. X  
  139. X!       void test(ushort x);
  140. X  
  141. X    while the correct one is
  142. X  
  143. X!       void test(int x);
  144. X  
  145. X  - Fix: Incorrect prototypes were generated for functions that returned
  146. X--- 115,123 ----
  147. X    cproto generated the incorrect prototype
  148. X  
  149. X!     void test(ushort x);
  150. X  
  151. X    while the correct one is
  152. X  
  153. X!     void test(int x);
  154. X  
  155. X  - Fix: Incorrect prototypes were generated for functions that returned
  156. Xdiff  -c2 old/config.h new/config.h
  157. X*** old/config.h    Fri Jul 03 13:37:52 1992
  158. X--- new/config.h    Sat Nov 28 23:27:44 1992
  159. X***************
  160. X*** 1,3 ****
  161. X! /* $Id: config.h 3.4 92/07/03 13:37:48 cthuang Exp $
  162. X   *
  163. X   * cproto configuration and system dependencies
  164. X--- 1,3 ----
  165. X! /* $Id: config.h 3.5 1992/11/29 04:27:30 cthuang Exp $
  166. X   *
  167. X   * cproto configuration and system dependencies
  168. X***************
  169. X*** 43,47 ****
  170. X  #endif
  171. X  
  172. X! #if defined(__STDC__) || defined(MSDOS)
  173. X  #include <stdlib.h>
  174. X  #include <string.h>
  175. X--- 43,47 ----
  176. X  #endif
  177. X  
  178. X! #if __STDC__ || defined(MSDOS)
  179. X  #include <stdlib.h>
  180. X  #include <string.h>
  181. Xdiff  -c2 old/cproto.1 new/cproto.1
  182. X*** old/cproto.1    Wed Jun 10 21:03:02 1992
  183. X--- new/cproto.1    Sat Nov 28 23:34:08 1992
  184. X***************
  185. X*** 1,3 ****
  186. X! .\" $Id: cproto.1 3.6 92/06/10 20:55:39 cthuang Exp $
  187. X  .\"
  188. X  .de EX        \"Begin example
  189. X--- 1,3 ----
  190. X! .\" $Id: cproto.1 3.7 1992/11/29 04:34:05 cthuang Exp $
  191. X  .\"
  192. X  .de EX        \"Begin example
  193. X***************
  194. X*** 14,18 ****
  195. X  .if t .sp .5
  196. X  ..
  197. X! .TH CPROTO 1 "April 7, 1992"
  198. X  .SH NAME
  199. X  cproto \- generate C function prototypes and convert function definitions
  200. X--- 14,18 ----
  201. X  .if t .sp .5
  202. X  ..
  203. X! .TH CPROTO 1 "October 24, 1992"
  204. X  .SH NAME
  205. X  cproto \- generate C function prototypes and convert function definitions
  206. X***************
  207. X*** 31,35 ****
  208. X  Optionally,
  209. X  .B cproto
  210. X! also outputs declarations for any variables defined in the file.
  211. X  If no
  212. X  .I file
  213. X--- 31,35 ----
  214. X  Optionally,
  215. X  .B cproto
  216. X! also outputs declarations for variables defined in the files.
  217. X  If no
  218. X  .I file
  219. X***************
  220. X*** 88,98 ****
  221. X  .SH OPTIONS
  222. X  .TP
  223. X- .B \-a
  224. X- Convert function definitions from the old style to the ANSI C style.
  225. X- .TP
  226. X  .B \-e
  227. X  Output the keyword
  228. X  .B extern
  229. X! in front of every declaration having global scope.
  230. X  .TP
  231. X  .BI \-f n
  232. X--- 88,95 ----
  233. X  .SH OPTIONS
  234. X  .TP
  235. X  .B \-e
  236. X  Output the keyword
  237. X  .B extern
  238. X! in front of every generated prototype or declaration that has global scope.
  239. X  .TP
  240. X  .BI \-f n
  241. X***************
  242. X*** 169,177 ****
  243. X  declarations as well.
  244. X  .TP
  245. X  .B \-t
  246. X  Convert function definitions from the ANSI C style to the traditional style.
  247. X  .TP
  248. X! .B \-v
  249. X! Also output declarations for variables defined in the source.
  250. X  .LP
  251. X  .nf
  252. X--- 166,205 ----
  253. X  declarations as well.
  254. X  .TP
  255. X+ .B \-v
  256. X+ Also output declarations for variables defined in the source.
  257. X+ .TP
  258. X+ .B \-a
  259. X+ Convert function definitions from the old style to the ANSI C style.
  260. X+ .TP
  261. X  .B \-t
  262. X  Convert function definitions from the ANSI C style to the traditional style.
  263. X  .TP
  264. X! .B \-b
  265. X! Rewrite function definition heads to include both old style and new style
  266. X! declarations separated by a conditional compilation directive.
  267. X! For example, the program can generate this function definition:
  268. X! .EX
  269. X! #ifdef ANSI_FUNC
  270. X! 
  271. X! int
  272. X! main (int argc, char *argv[])
  273. X! #else
  274. X! 
  275. X! int
  276. X! main (argc, argv)
  277. X! int argc;
  278. X! char *argv[]
  279. X! #endif
  280. X! {
  281. X! }
  282. X! .EE
  283. X! .TP
  284. X! .BI \-B directive
  285. X! Set the conditional compilation directive to output at the beginning of
  286. X! function definitions generated by the \-b option.
  287. X! The default is
  288. X! .EX
  289. X! #ifdef ANSI_FUNC
  290. X! .EE 
  291. X  .LP
  292. X  .nf
  293. X***************
  294. X*** 185,189 ****
  295. X  The format is specified by a template in the form
  296. X  .EX
  297. X! " int main ( a, b )"
  298. X  .EE
  299. X  but you may replace each space in this string with any number of
  300. X--- 213,217 ----
  301. X  The format is specified by a template in the form
  302. X  .EX
  303. X! " int f ( a, b )"
  304. X  .EE
  305. X  but you may replace each space in this string with any number of
  306. X***************
  307. X*** 191,195 ****
  308. X  For example, the option
  309. X  .EX
  310. X! -F"int main(\\n\\ta,\\n\\tb\\n\\t)"
  311. X  .EE
  312. X  will produce
  313. X--- 219,223 ----
  314. X  For example, the option
  315. X  .EX
  316. X! -F"int f(\\n\\ta,\\n\\tb\\n\\t)"
  317. X  .EE
  318. X  will produce
  319. X***************
  320. X*** 201,205 ****
  321. X  .EE
  322. X  .TP
  323. X! .BI \-D name\[=value\]
  324. X  This option is passed through to the preprocessor and is used to define 
  325. X  symbols for use with conditionals such as
  326. X--- 229,233 ----
  327. X  .EE
  328. X  .TP
  329. X! .BI \-D name[=value]
  330. X  This option is passed through to the preprocessor and is used to define 
  331. X  symbols for use with conditionals such as
  332. Xdiff  -c2 old/cproto.c new/cproto.c
  333. X*** old/cproto.c    Wed Jun 10 21:03:08 1992
  334. X--- new/cproto.c    Sat Nov 28 23:27:52 1992
  335. X***************
  336. X*** 1,3 ****
  337. X! /* $Id: cproto.c 3.6 92/06/10 20:56:26 cthuang Exp $
  338. X   *
  339. X   * C function prototype generator and function definition converter
  340. X--- 1,3 ----
  341. X! /* $Id: cproto.c 3.7 1992/11/29 04:27:49 cthuang Exp $
  342. X   *
  343. X   * C function prototype generator and function definition converter
  344. X***************
  345. X*** 4,8 ****
  346. X   */
  347. X  #ifndef lint
  348. X! static char rcsid[] = "$Id: cproto.c 3.6 92/06/10 20:56:26 cthuang Exp $";
  349. X  #endif
  350. X  #include <stdio.h>
  351. X--- 4,8 ----
  352. X   */
  353. X  #ifndef lint
  354. X! static char rcsid[] = "$Id: cproto.c 3.7 1992/11/29 04:27:49 cthuang Exp $";
  355. X  #endif
  356. X  #include <stdio.h>
  357. X***************
  358. X*** 48,51 ****
  359. X--- 48,54 ----
  360. X  boolean proto_comments = TRUE;
  361. X  
  362. X+ /* Conditional compilation directive output in front of function definitions */
  363. X+ char *func_directive = "#ifdef ANSI_FUNC";
  364. X+ 
  365. X  /* Output formats for function declarators */
  366. X  FuncFormat fmt[] = {
  367. X***************
  368. X*** 111,115 ****
  369. X  put_error ()
  370. X  {
  371. X!     fprintf(stderr, "\"%s\", line %d: ", cur_file_name(), cur_line_num());
  372. X  }
  373. X  
  374. X--- 114,118 ----
  375. X  put_error ()
  376. X  {
  377. X!     fprintf(stderr, "\"%s\", line %u: ", cur_file_name(), cur_line_num());
  378. X  }
  379. X  
  380. X***************
  381. X*** 226,255 ****
  382. X      fprintf(stderr, "usage: %s [ option ... ] [ file ... ]\n", progname);
  383. X      fputs("Options:\n", stderr);
  384. X!     fputs("  -a       Convert function definitions to ANSI style\n", stderr);
  385. X!     fputs("  -c       Omit comments in generated prototypes\n", stderr);
  386. X!     fputs("  -e       Output \"extern\" keyword before global declarations\n",
  387. X!     stderr);
  388. X!     fputs("  -f n     Set function prototype style (0 to 4)\n", stderr);
  389. X!     fputs("  -p       Disable formal parameter promotion\n", stderr);
  390. X!     fputs("  -q       Disable include file read failure messages\n", stderr);
  391. X!     fputs("  -s       Output static declarations\n", stderr);
  392. X!     fputs("  -t       Convert function definitions to traditional style\n",
  393. X!     stderr);
  394. X!     fputs("  -v       Output variable declarations\n", stderr);
  395. X!     fputs("  -m name  Set name of prototype macro\n", stderr);
  396. X!     fputs("  -d       Omit prototype macro definition\n", stderr);
  397. X!     fputs("  -P fmt   Set prototype format template \" int main (a, b)\"\n",
  398. X!     stderr);
  399. X!     fputs("  -F fmt   Set function definition format template \" int main (a, b)\"\n",
  400. X!     stderr);
  401. X!     fputs("  -C fmt   Set format for function definition with parameter comments\n",
  402. X!     stderr);
  403. X!     fputs("  -D name[=value]\n", stderr);
  404. X!     fputs("  -U name\n", stderr);
  405. X!     fputs("  -I directory\n", stderr);
  406. X!     fputs("           Set C preprocessor options\n", stderr);
  407. X!     fputs("  -E cpp   Run specified C preprocessor command\n", stderr);
  408. X!     fputs("  -E 0     Do not run any C preprocessor\n", stderr);
  409. X!     fputs("  -V       Print version information\n", stderr);
  410. X      exit(1);
  411. X  }
  412. X--- 229,252 ----
  413. X      fprintf(stderr, "usage: %s [ option ... ] [ file ... ]\n", progname);
  414. X      fputs("Options:\n", stderr);
  415. X!     fputs("  -a, -t           Convert function definitions to ANSI or traditional style\n", stderr);
  416. X!     fputs("  -b               Rewrite function definitions in both styles\n", stderr);
  417. X!     fputs("  -c               Omit comments in generated prototypes\n", stderr);
  418. X!     fputs("  -e               Output \"extern\" keyword before global declarations\n", stderr);
  419. X!     fputs("  -f n             Set function prototype style (0 to 4)\n", stderr);
  420. X!     fputs("  -p               Disable formal parameter promotion\n", stderr);
  421. X!     fputs("  -q               Disable include file read failure messages\n", stderr);
  422. X!     fputs("  -s               Output static declarations\n", stderr);
  423. X!     fputs("  -v               Output variable declarations\n", stderr);
  424. X!     fputs("  -m name          Set name of prototype macro\n", stderr);
  425. X!     fputs("  -d               Omit prototype macro definition\n", stderr);
  426. X!     fputs("  -P template      Set prototype format template \" int f (a, b)\"\n", stderr);
  427. X!     fputs("  -F template      Set function definition format template \" int f (a, b)\"\n", stderr);
  428. X!     fputs("  -C template      Set format for function definition with parameter comments\n", stderr);
  429. X!     fputs("  -D name[=value]  Define C preprocessor symbol\n", stderr);
  430. X!     fputs("  -U name          Undefine C preprocessor symbol\n", stderr);
  431. X!     fputs("  -I directory     Add #include search directory\n", stderr);
  432. X!     fputs("  -E command       Run specified C preprocessor command\n", stderr);
  433. X!     fputs("  -E 0             Do not run any C preprocessor\n", stderr);
  434. X!     fputs("  -V               Print version information\n", stderr);
  435. X      exit(1);
  436. X  }
  437. X***************
  438. X*** 291,295 ****
  439. X  #ifdef CPP
  440. X      /* Allocate buffer for C preprocessor command line. */
  441. X!     n = strlen(CPP) + 1;
  442. X      for (i = 0; i < argc; ++i) {
  443. X      n += strlen(argv[i]) + 1;
  444. X--- 288,292 ----
  445. X  #ifdef CPP
  446. X      /* Allocate buffer for C preprocessor command line. */
  447. X!     n = strlen(cpp) + 1;
  448. X      for (i = 0; i < argc; ++i) {
  449. X      n += strlen(argv[i]) + 1;
  450. X***************
  451. X*** 300,304 ****
  452. X  #endif
  453. X  
  454. X!     while ((c = getopt(argc, argv, "aC:cD:dE:eF:f:I:m:P:pqstU:Vv")) != EOF) {
  455. X      switch (c) {
  456. X      case 'I':
  457. X--- 297,301 ----
  458. X  #endif
  459. X  
  460. X!     while ((c = getopt(argc, argv, "aB:bC:cD:dE:eF:f:I:m:P:pqstU:Vv")) != EOF) {
  461. X      switch (c) {
  462. X      case 'I':
  463. X***************
  464. X*** 319,322 ****
  465. X--- 316,325 ----
  466. X          func_style = FUNC_ANSI;
  467. X          break;
  468. X+     case 'B':
  469. X+         func_directive = optarg;
  470. X+         break;
  471. X+     case 'b':
  472. X+         func_style = FUNC_BOTH;
  473. X+         break;
  474. X      case 'c':
  475. X          proto_comments = FALSE;
  476. X***************
  477. X*** 429,433 ****
  478. X  
  479. X      if (proto_style == PROTO_MACRO && define_macro) {
  480. X!     printf("#if defined(__STDC__) || defined(__cplusplus)\n");
  481. X      printf("#define %s(s) s\n", macro_name);
  482. X      printf("#else\n");
  483. X--- 432,436 ----
  484. X  
  485. X      if (proto_style == PROTO_MACRO && define_macro) {
  486. X!     printf("#if __STDC__ || defined(__cplusplus)\n");
  487. X      printf("#define %s(s) s\n", macro_name);
  488. X      printf("#else\n");
  489. Xdiff  -c2 old/cproto.h new/cproto.h
  490. X*** old/cproto.h    Wed Jun 10 21:03:08 1992
  491. X--- new/cproto.h    Sat Nov 28 23:27:46 1992
  492. X***************
  493. X*** 1,3 ****
  494. X! /* $Id: cproto.h 3.5 92/04/11 19:27:44 cthuang Exp $
  495. X   *
  496. X   * Declarations for C function prototype generator
  497. X--- 1,3 ----
  498. X! /* $Id: cproto.h 3.6 1992/11/29 04:27:30 cthuang Exp $
  499. X   *
  500. X   * Declarations for C function prototype generator
  501. X***************
  502. X*** 45,48 ****
  503. X--- 45,49 ----
  504. X  #define FUNC_TRADITIONAL    1    /* traditional style */
  505. X  #define FUNC_ANSI        2    /* ANSI style */
  506. X+ #define FUNC_BOTH        3    /* both styles */
  507. X  typedef int FuncDefStyle;
  508. X  
  509. X***************
  510. X*** 56,59 ****
  511. X--- 57,61 ----
  512. X      FuncDefStyle func_def;        /* style of function definition */
  513. X      ParameterList params;        /* function parameters */
  514. X+     boolean pointer;            /* TRUE if it declares a pointer */
  515. X      struct declarator *head;        /* head function declarator */
  516. X      struct declarator *func_stack;    /* stack of function declarators */
  517. X***************
  518. X*** 79,83 ****
  519. X      Text text;
  520. X      DeclSpec decl_spec;
  521. X!     Parameter parameter;
  522. X      ParameterList param_list;
  523. X      Declarator *declarator;
  524. X--- 81,85 ----
  525. X      Text text;
  526. X      DeclSpec decl_spec;
  527. X!     Parameter *parameter;
  528. X      ParameterList param_list;
  529. X      Declarator *declarator;
  530. X***************
  531. X*** 127,130 ****
  532. X--- 129,133 ----
  533. X  extern boolean proto_comments;
  534. X  extern boolean quiet;
  535. X+ extern char *func_directive;
  536. X  extern int num_inc_dir;
  537. X  extern char *inc_dir[];
  538. X***************
  539. X*** 137,141 ****
  540. X  extern void put_error();
  541. X  extern void init_parser(), process_file(), pop_file();
  542. X! extern char *cur_file_name();
  543. X  extern unsigned cur_line_num();
  544. X  extern FILE *cur_tmp_file();
  545. X--- 140,144 ----
  546. X  extern void put_error();
  547. X  extern void init_parser(), process_file(), pop_file();
  548. X! extern char *cur_file_name(), *cur_text();
  549. X  extern unsigned cur_line_num();
  550. X  extern FILE *cur_tmp_file();
  551. Xdiff  -c2 old/grammar.y new/grammar.y
  552. X*** old/grammar.y    Wed Jun 10 21:03:02 1992
  553. X--- new/grammar.y    Sat Nov 28 23:27:42 1992
  554. X***************
  555. X*** 1,3 ****
  556. X! /* $Id: grammar.y 3.6 92/06/10 20:56:07 cthuang Exp $
  557. X   *
  558. X   * yacc grammar for C function prototype generator
  559. X--- 1,3 ----
  560. X! /* $Id: grammar.y 3.7 1992/11/29 04:27:30 cthuang Exp $
  561. X   *
  562. X   * yacc grammar for C function prototype generator
  563. X***************
  564. X*** 46,49 ****
  565. X--- 46,52 ----
  566. X      T_ASMARG
  567. X  
  568. X+     /* va_dcl from <varargs.h> */
  569. X+     T_VA_DCL
  570. X+ 
  571. X  %type <decl_spec> decl_specifiers decl_specifier
  572. X  %type <decl_spec> storage_class type_specifier type_qualifier
  573. X***************
  574. X*** 66,78 ****
  575. X  #define YYMAXDEPTH 150
  576. X  
  577. X! /* Declaration specifier attributes for the typedef statement currently being
  578. X!  * scanned.
  579. X   */
  580. X  static int cur_decl_spec_flags;
  581. X  
  582. X! /* Pointer to parameter list for the current function definition. */
  583. X  static ParameterList *func_params;
  584. X  
  585. X! /* Pointer to current declarator in function parameter declaration. */
  586. X  static Declarator *cur_declarator;
  587. X  
  588. X--- 69,87 ----
  589. X  #define YYMAXDEPTH 150
  590. X  
  591. X! /* declaration specifier attributes for the typedef statement currently being
  592. X!  * scanned
  593. X   */
  594. X  static int cur_decl_spec_flags;
  595. X  
  596. X! /* pointer to parameter list for the current function definition */
  597. X  static ParameterList *func_params;
  598. X  
  599. X! /* A parser semantic action sets this pointer to the current declarator in
  600. X!  * a function parameter declaration in order to catch any comments following
  601. X!  * the parameter declaration on the same line.  If the lexer scans a comment
  602. X!  * and <cur_declarator> is not NULL, then the comment is attached to the
  603. X!  * declarator.  To ignore subsequent comments, the lexer sets this to NULL
  604. X!  * after scanning a comment or end of line.
  605. X!  */
  606. X  static Declarator *cur_declarator;
  607. X  
  608. X***************
  609. X*** 80,88 ****
  610. X  static char buf[MAX_TEXT_SIZE];
  611. X  
  612. X! /* Table of typedef names */
  613. X  static SymbolTable *typedef_names;
  614. X  
  615. X! /* Table of type qualifiers */
  616. X  static SymbolTable *type_qualifiers;
  617. X  %}
  618. X  %%
  619. X--- 89,114 ----
  620. X  static char buf[MAX_TEXT_SIZE];
  621. X  
  622. X! /* table of typedef names */
  623. X  static SymbolTable *typedef_names;
  624. X  
  625. X! /* table of type qualifiers */
  626. X  static SymbolTable *type_qualifiers;
  627. X+ 
  628. X+ /* information about the current input file */
  629. X+ typedef struct {
  630. X+     char *base_name;        /* base input file name */
  631. X+     char *file_name;        /* current file name */
  632. X+     FILE *file;         /* input file */
  633. X+     unsigned line_num;        /* current line number in input file */
  634. X+     FILE *tmp_file;        /* temporary file */
  635. X+     long begin_comment;     /* tmp file offset after last written ) or ; */
  636. X+     long end_comment;        /* tmp file offset after last comment */
  637. X+     boolean convert;        /* if TRUE, convert function definitions */
  638. X+     boolean changed;        /* TRUE if conversion done in this file */
  639. X+ } IncludeStack;
  640. X+ 
  641. X+ static IncludeStack *cur_file;    /* current input file */
  642. X+ 
  643. X+ extern void yyerror();
  644. X  %}
  645. X  %%
  646. X***************
  647. X*** 120,124 ****
  648. X--- 146,159 ----
  649. X  linkage_specification
  650. X      : T_EXTERN T_STRING_LITERAL braces
  651. X+     {
  652. X+         /* Provide an empty action here so bison will not complain about
  653. X+          * incompatible types in the default action it normally would
  654. X+          * have generated.
  655. X+          */
  656. X+     }
  657. X      | T_EXTERN T_STRING_LITERAL declaration
  658. X+     {
  659. X+         /* empty */
  660. X+     }
  661. X      ;
  662. X  
  663. X***************
  664. X*** 130,134 ****
  665. X      | decl_specifiers init_declarator_list ';'
  666. X      {
  667. X-         check_untagged(&$1);
  668. X          if (func_params != NULL) {
  669. X          set_param_types(func_params, &$1, &$2);
  670. X--- 165,168 ----
  671. X***************
  672. X*** 227,230 ****
  673. X--- 261,265 ----
  674. X  opt_declaration_list
  675. X      : /* empty */
  676. X+     | T_VA_DCL
  677. X      | declaration_list
  678. X      ;
  679. X***************
  680. X*** 372,376 ****
  681. X          func_style == FUNC_TRADITIONAL && cur_file->convert) {
  682. X          gen_func_declarator($1);
  683. X!         fputs(yytext, cur_file->tmp_file);
  684. X          }
  685. X          cur_declarator = $$;
  686. X--- 407,411 ----
  687. X          func_style == FUNC_TRADITIONAL && cur_file->convert) {
  688. X          gen_func_declarator($1);
  689. X!         fputs(cur_text(), cur_file->tmp_file);
  690. X          }
  691. X          cur_declarator = $$;
  692. X***************
  693. X*** 417,420 ****
  694. X--- 452,456 ----
  695. X          $$->text = xstrdup(buf);
  696. X          $$->begin = $1.begin;
  697. X+         $$->pointer = TRUE;
  698. X      }
  699. X      | direct_declarator
  700. X***************
  701. X*** 507,515 ****
  702. X      : parameter_declaration
  703. X      {
  704. X!         new_param_list(&$$, &$1);
  705. X      }
  706. X      | parameter_list ',' parameter_declaration
  707. X      {
  708. X!         add_param_list(&$$, &$1, &$3);
  709. X      }
  710. X      ;
  711. X--- 543,551 ----
  712. X      : parameter_declaration
  713. X      {
  714. X!         new_param_list(&$$, $1);
  715. X      }
  716. X      | parameter_list ',' parameter_declaration
  717. X      {
  718. X!         add_param_list(&$$, &$1, $3);
  719. X      }
  720. X      ;
  721. X***************
  722. X*** 519,523 ****
  723. X      {
  724. X          check_untagged(&$1);
  725. X!         new_parameter(&$$, &$1, $2);
  726. X      }
  727. X      | decl_specifiers abs_declarator
  728. X--- 555,559 ----
  729. X      {
  730. X          check_untagged(&$1);
  731. X!         $$ = new_parameter(&$1, $2);
  732. X      }
  733. X      | decl_specifiers abs_declarator
  734. X***************
  735. X*** 524,528 ****
  736. X      {
  737. X          check_untagged(&$1);
  738. X!         new_parameter(&$$, &$1, $2);
  739. X      }
  740. X      | decl_specifiers
  741. X--- 560,564 ----
  742. X      {
  743. X          check_untagged(&$1);
  744. X!         $$ = new_parameter(&$1, $2);
  745. X      }
  746. X      | decl_specifiers
  747. X***************
  748. X*** 529,533 ****
  749. X      {
  750. X          check_untagged(&$1);
  751. X!         new_parameter(&$$, &$1, NULL);
  752. X      }
  753. X      ;
  754. X--- 565,569 ----
  755. X      {
  756. X          check_untagged(&$1);
  757. X!         $$ = new_parameter(&$1, NULL);
  758. X      }
  759. X      ;
  760. X***************
  761. X*** 628,631 ****
  762. X--- 664,668 ----
  763. X  
  764. X  %%
  765. X+ 
  766. X  #ifdef MSDOS
  767. X  #include "lex_yy.c"
  768. X***************
  769. X*** 650,659 ****
  770. X  {
  771. X      static char *keywords[] = {
  772. X!     "const", "volatile",
  773. X  #ifdef MSDOS
  774. X      "_cdecl", "_export", "_far", "_fastcall", "_fortran", "_huge",
  775. X      "_interrupt", "_loadds", "_near", "_pascal", "_saveregs", "_segment",
  776. X      "_cs", "_ds", "_es", "_ss", "_seg",
  777. X!     "cdecl", "far", "huge", "interrupt", "near", "pascal",
  778. X  #endif
  779. X      };
  780. X--- 687,700 ----
  781. X  {
  782. X      static char *keywords[] = {
  783. X!     "const", "volatile", "interrupt",
  784. X  #ifdef MSDOS
  785. X+     "cdecl", "far", "huge", "near", "pascal",
  786. X      "_cdecl", "_export", "_far", "_fastcall", "_fortran", "_huge",
  787. X      "_interrupt", "_loadds", "_near", "_pascal", "_saveregs", "_segment",
  788. X      "_cs", "_ds", "_es", "_ss", "_seg",
  789. X!     "__cdecl", "__export", "__far", "__fastcall", "__fortran", "__huge",
  790. X!     "__inline", "__interrupt", "__loadds", "__near", "__pascal",
  791. X!     "__saveregs", "__segment", "__stdcall", "__syscall",
  792. X!     "__cs", "__ds", "__es", "__ss", "__seg",
  793. X  #endif
  794. X      };
  795. Xdiff  -c2 old/lex.l new/lex.l
  796. X*** old/lex.l    Wed Jun 10 21:03:02 1992
  797. X--- new/lex.l    Sat Nov 28 23:54:16 1992
  798. X***************
  799. X*** 1,4 ****
  800. X  %{
  801. X! /* $Id: lex.l 3.7 92/06/10 20:56:04 cthuang Exp $
  802. X   *
  803. X   * Lexical analyzer for C function prototype generator
  804. X--- 1,4 ----
  805. X  %{
  806. X! /* $Id: lex.l 3.8 1992/11/29 04:54:14 cthuang Exp $
  807. X   *
  808. X   * Lexical analyzer for C function prototype generator
  809. X***************
  810. X*** 8,32 ****
  811. X  static int ly_count;    /* number of occurances of %% */
  812. X  
  813. X- /* information about the current input file */
  814. X- typedef struct {
  815. X-     char *base_name;        /* base input file name */
  816. X-     char *file_name;        /* current file name */
  817. X-     FILE *file;         /* input file */
  818. X-     unsigned line_num;        /* current line number in input file */
  819. X-     FILE *tmp_file;        /* temporary file */
  820. X-     long begin_comment;     /* tmp file offset after last written ) or ; */
  821. X-     long end_comment;        /* tmp file offset after last comment */
  822. X-     boolean convert;        /* if TRUE, convert function definitions */
  823. X-     boolean changed;        /* TRUE if conversion done in this file */
  824. X  #ifdef FLEX_SCANNER
  825. X!     YY_BUFFER_STATE buffer;    /* flex scanner state */
  826. X  #endif
  827. X- } IncludeStack;
  828. X  
  829. X  static int inc_depth;                /* include nesting level */
  830. X  static IncludeStack inc_stack[MAX_INC_DEPTH];    /* stack of included files */
  831. X- static IncludeStack *cur_file;            /* current file */
  832. X  static SymbolTable *included_files;        /* files already included */
  833. X  
  834. X  static void save_text();
  835. X  static void save_text_offset();
  836. X--- 8,21 ----
  837. X  static int ly_count;    /* number of occurances of %% */
  838. X  
  839. X  #ifdef FLEX_SCANNER
  840. X! /* flex scanner state */
  841. X! static YY_BUFFER_STATE buffer_stack[MAX_INC_DEPTH];
  842. X  #endif
  843. X  
  844. X  static int inc_depth;                /* include nesting level */
  845. X  static IncludeStack inc_stack[MAX_INC_DEPTH];    /* stack of included files */
  846. X  static SymbolTable *included_files;        /* files already included */
  847. X  
  848. X+ static void update_line_num();
  849. X  static void save_text();
  850. X  static void save_text_offset();
  851. X***************
  852. X*** 35,42 ****
  853. X  static void do_include();
  854. X  
  855. X  #ifdef yywrap
  856. X  #undef yywrap
  857. X  #endif
  858. X- static int yywrap();
  859. X  %}
  860. X  
  861. X--- 24,31 ----
  862. X  static void do_include();
  863. X  
  864. X+ extern void yyerror();
  865. X  #ifdef yywrap
  866. X  #undef yywrap
  867. X  #endif
  868. X  %}
  869. X  
  870. X***************
  871. X*** 45,49 ****
  872. X  DIGIT        [0-9]
  873. X  ID        {LETTER}({LETTER}|{DIGIT})*
  874. X! STRING        \"(\\\"|[^"\n])*\"
  875. X  QUOTED        ({STRING}|\'(\\\'|[^'\n])*\'|\\.)
  876. X  
  877. X--- 34,38 ----
  878. X  DIGIT        [0-9]
  879. X  ID        {LETTER}({LETTER}|{DIGIT})*
  880. X! STRING        \"(\\\"|[^"])*\"
  881. X  QUOTED        ({STRING}|\'(\\\'|[^'\n])*\'|\\.)
  882. X  
  883. X***************
  884. X*** 59,66 ****
  885. X  <LEXYACC>^"%%"        { save_text(); if (++ly_count >= 2) BEGIN INITIAL; }
  886. X  <LEXYACC>^"%{"        { save_text(); BEGIN INITIAL; }
  887. X! <LEXYACC>{QUOTED}|.    save_text();
  888. X  <INITIAL>^"%}"        { save_text(); BEGIN LEXYACC; }
  889. X  
  890. X  <INITIAL>#{WS}*     { save_text(); BEGIN CPP1; }
  891. X  
  892. X  <CPP1>define{WS}+{ID}    {
  893. X--- 48,57 ----
  894. X  <LEXYACC>^"%%"        { save_text(); if (++ly_count >= 2) BEGIN INITIAL; }
  895. X  <LEXYACC>^"%{"        { save_text(); BEGIN INITIAL; }
  896. X! <LEXYACC>{QUOTED}    { save_text(); update_line_num(); }
  897. X! <LEXYACC>.        save_text();
  898. X  <INITIAL>^"%}"        { save_text(); BEGIN LEXYACC; }
  899. X  
  900. X  <INITIAL>#{WS}*     { save_text(); BEGIN CPP1; }
  901. X+ <INITIAL>"??="{WS}*     { save_text(); BEGIN CPP1; }
  902. X  
  903. X  <CPP1>define{WS}+{ID}    {
  904. X***************
  905. X*** 125,129 ****
  906. X              }
  907. X  <INITIAL>"..."        { save_text(); return T_ELLIPSIS; }
  908. X! <INITIAL>{STRING}    { save_text(); return T_STRING_LITERAL; }
  909. X  
  910. X  <INITIAL>asm        { save_text(); BEGIN ASM; return T_ASM; }
  911. X--- 116,124 ----
  912. X              }
  913. X  <INITIAL>"..."        { save_text(); return T_ELLIPSIS; }
  914. X! <INITIAL>{STRING}    {
  915. X!                 save_text();
  916. X!                 update_line_num();
  917. X!                 return T_STRING_LITERAL;
  918. X!             }
  919. X  
  920. X  <INITIAL>asm        { save_text(); BEGIN ASM; return T_ASM; }
  921. X***************
  922. X*** 130,136 ****
  923. X  <ASM>"("        save_text();
  924. X  <ASM>")"        { save_text(); BEGIN INITIAL; return T_ASMARG; }
  925. X! <ASM>{QUOTED}|.     save_text();
  926. X  
  927. X! <INITIAL>_based[^(]*\([^)]*\)    { save_text_offset(); return T_TYPE_QUALIFIER; }
  928. X  
  929. X  <INITIAL>auto        { save_text_offset(); return T_AUTO; }
  930. X--- 125,132 ----
  931. X  <ASM>"("        save_text();
  932. X  <ASM>")"        { save_text(); BEGIN INITIAL; return T_ASMARG; }
  933. X! <ASM>{QUOTED}         { save_text(); update_line_num(); }
  934. X! <ASM>.             save_text();
  935. X  
  936. X! <INITIAL>__?based[^(]*\([^)]*\)    { save_text_offset(); return T_TYPE_QUALIFIER; }
  937. X  
  938. X  <INITIAL>auto        { save_text_offset(); return T_AUTO; }
  939. X***************
  940. X*** 152,155 ****
  941. X--- 148,152 ----
  942. X  <INITIAL>struct     { save_text_offset(); return T_STRUCT; }
  943. X  <INITIAL>union        { save_text_offset(); return T_UNION; }
  944. X+ <INITIAL>va_dcl        { save_text_offset(); return T_VA_DCL; }
  945. X  
  946. X  <INITIAL>{ID}        {
  947. X***************
  948. X*** 167,177 ****
  949. X                   * containing a ] appears between the brackets.
  950. X                   */
  951. X-                 int i;
  952. X- 
  953. X                  save_text_offset();
  954. X!                 for (i = 0; i < yyleng; ++i) {
  955. X!                 if (yytext[i] == '\n')
  956. X!                     cur_file->line_num++;
  957. X!                 }
  958. X                  return T_BRACKETS;
  959. X              }
  960. X--- 164,174 ----
  961. X                   * containing a ] appears between the brackets.
  962. X                   */
  963. X                  save_text_offset();
  964. X!                 update_line_num();
  965. X!                 return T_BRACKETS;
  966. X!             }
  967. X! <INITIAL>"??("[^?]*"??)"    {
  968. X!                 save_text_offset();
  969. X!                 update_line_num();
  970. X                  return T_BRACKETS;
  971. X              }
  972. X***************
  973. X*** 184,188 ****
  974. X                  return T_INITIALIZER;
  975. X              }
  976. X! <INIT1>{QUOTED}|.    save_text();
  977. X  
  978. X  <INIT2>"{"        { save_text(); ++curly; }
  979. X--- 181,186 ----
  980. X                  return T_INITIALIZER;
  981. X              }
  982. X! <INIT1>{QUOTED}        { save_text(); update_line_num(); }
  983. X! <INIT1>.        save_text();
  984. X  
  985. X  <INIT2>"{"        { save_text(); ++curly; }
  986. X***************
  987. X*** 194,198 ****
  988. X                  }
  989. X              }
  990. X! <INIT2>{QUOTED}|.    save_text();
  991. X  
  992. X  <INITIAL>"{"        {
  993. X--- 192,197 ----
  994. X                  }
  995. X              }
  996. X! <INIT2>{QUOTED}        { save_text(); update_line_num(); }
  997. X! <INIT2>.        save_text();
  998. X  
  999. X  <INITIAL>"{"        {
  1000. X***************
  1001. X*** 210,214 ****
  1002. X                  }
  1003. X              }
  1004. X! <CURLY>{QUOTED}|.    save_text();
  1005. X  
  1006. X  [ \t\f]+        save_text();
  1007. X--- 209,214 ----
  1008. X                  }
  1009. X              }
  1010. X! <CURLY>{QUOTED}        { save_text(); update_line_num(); }
  1011. X! <CURLY>.        save_text();
  1012. X  
  1013. X  [ \t\f]+        save_text();
  1014. X***************
  1015. X*** 220,223 ****
  1016. X--- 220,236 ----
  1017. X  %%
  1018. X  
  1019. X+ /* If the matched text contains any new line characters, then update the
  1020. X+  * current line number.
  1021. X+  */
  1022. X+ static void
  1023. X+ update_line_num ()
  1024. X+ {
  1025. X+     char *p = yytext;
  1026. X+     while (*p != '\0') {
  1027. X+     if (*p++ == '\n')
  1028. X+         cur_file->line_num++;
  1029. X+     }
  1030. X+ }
  1031. X+ 
  1032. X  /* Save the matched text in the temporary file.
  1033. X   */
  1034. X***************
  1035. X*** 277,281 ****
  1036. X  }
  1037. X  
  1038. X! /* Scan rest of preprocessor statement.
  1039. X   */
  1040. X  static void
  1041. X--- 290,294 ----
  1042. X  }
  1043. X  
  1044. X! /* Scan rest of preprocessor directive.
  1045. X   */
  1046. X  static void
  1047. X***************
  1048. X*** 282,286 ****
  1049. X  get_cpp_directive ()
  1050. X  {
  1051. X!     int c, lastc = '\0';
  1052. X  
  1053. X      while ((c = input()) != 0) {
  1054. X--- 295,301 ----
  1055. X  get_cpp_directive ()
  1056. X  {
  1057. X!     char c, lastc[4];
  1058. X!     
  1059. X!     lastc[0] = lastc[1] = lastc[2] = lastc[3] = '\0';
  1060. X  
  1061. X      while ((c = input()) != 0) {
  1062. X***************
  1063. X*** 290,294 ****
  1064. X      case '\n':
  1065. X          cur_file->line_num++;
  1066. X!         if (lastc != '\\') {
  1067. X          BEGIN INITIAL;
  1068. X          return;
  1069. X--- 305,309 ----
  1070. X      case '\n':
  1071. X          cur_file->line_num++;
  1072. X!         if (lastc[2] != '\\' && strcmp(lastc, "??""/") != 0) {
  1073. X          BEGIN INITIAL;
  1074. X          return;
  1075. X***************
  1076. X*** 296,304 ****
  1077. X          break;
  1078. X      case '*':
  1079. X!         if (lastc == '/')
  1080. X          get_comment();
  1081. X          break;
  1082. X      }
  1083. X!     lastc = c;
  1084. X      }
  1085. X  }
  1086. X--- 311,321 ----
  1087. X          break;
  1088. X      case '*':
  1089. X!         if (lastc[2] == '/')
  1090. X          get_comment();
  1091. X          break;
  1092. X      }
  1093. X!     lastc[0] = lastc[1];
  1094. X!     lastc[1] = lastc[2];
  1095. X!     lastc[2] = c;
  1096. X      }
  1097. X  }
  1098. X***************
  1099. X*** 344,347 ****
  1100. X--- 361,372 ----
  1101. X  }
  1102. X  
  1103. X+ /* Return the text of the current lexical token.
  1104. X+  */
  1105. X+ char *
  1106. X+ cur_text ()
  1107. X+ {
  1108. X+     return yytext;
  1109. X+ }
  1110. X+ 
  1111. X  #ifdef NEED_tmpfile
  1112. X  /*
  1113. X***************
  1114. X*** 356,360 ****
  1115. X  tmpfile ()
  1116. X  {
  1117. X!     char name[1024];
  1118. X      char *tmpdir;
  1119. X      FILE *f;
  1120. X--- 381,385 ----
  1121. X  tmpfile ()
  1122. X  {
  1123. X!     char name[MAX_TEXT_SIZE];
  1124. X      char *tmpdir;
  1125. X      FILE *f;
  1126. X***************
  1127. X*** 400,405 ****
  1128. X  
  1129. X  #ifdef FLEX_SCANNER
  1130. X!     cur_file->buffer = yy_create_buffer(yyin, YY_BUF_SIZE);
  1131. X!     yy_switch_to_buffer(cur_file->buffer);
  1132. X  #endif
  1133. X  
  1134. X--- 425,430 ----
  1135. X  
  1136. X  #ifdef FLEX_SCANNER
  1137. X!     buffer_stack[inc_depth] = yy_create_buffer(yyin, YY_BUF_SIZE);
  1138. X!     yy_switch_to_buffer(buffer_stack[inc_depth]);
  1139. X  #endif
  1140. X  
  1141. X***************
  1142. X*** 408,412 ****
  1143. X      cur_file->tmp_file = tmpfile();
  1144. X      if (cur_file->tmp_file == NULL) {
  1145. X!         fprintf(stderr, "%s: cannot create temporary file %s\n", progname);
  1146. X          cur_file->convert = FALSE;
  1147. X      }
  1148. X--- 433,437 ----
  1149. X      cur_file->tmp_file = tmpfile();
  1150. X      if (cur_file->tmp_file == NULL) {
  1151. X!         fprintf(stderr, "%s: cannot create temporary file\n", progname);
  1152. X          cur_file->convert = FALSE;
  1153. X      }
  1154. X***************
  1155. X*** 449,456 ****
  1156. X  
  1157. X      if (cur_file->convert) {
  1158. X!     if (cur_file->changed) {
  1159. X!         if (yyin == stdin) {
  1160. X!         put_file(stdout);
  1161. X!         } else if ((outf = fopen(cur_file->base_name, "w")) != NULL) {
  1162. X          put_file(outf);
  1163. X          fclose(outf);
  1164. X--- 474,481 ----
  1165. X  
  1166. X      if (cur_file->convert) {
  1167. X!     if (yyin == stdin) {
  1168. X!         put_file(stdout);
  1169. X!     } else if (cur_file->changed) {
  1170. X!         if ((outf = fopen(cur_file->base_name, "w")) != NULL) {
  1171. X          put_file(outf);
  1172. X          fclose(outf);
  1173. X***************
  1174. X*** 457,461 ****
  1175. X          } else {
  1176. X          fprintf(stderr, "%s: cannot create file %s\n", progname,
  1177. X!             cur_file->base_name);
  1178. X          }
  1179. X      }
  1180. X--- 482,486 ----
  1181. X          } else {
  1182. X          fprintf(stderr, "%s: cannot create file %s\n", progname,
  1183. X!          cur_file->base_name);
  1184. X          }
  1185. X      }
  1186. X***************
  1187. X*** 475,479 ****
  1188. X  
  1189. X  #ifdef FLEX_SCANNER
  1190. X!     yy_switch_to_buffer(cur_file->buffer);
  1191. X  #endif
  1192. X      }
  1193. X--- 500,504 ----
  1194. X  
  1195. X  #ifdef FLEX_SCANNER
  1196. X!     yy_switch_to_buffer(buffer_stack[inc_depth]);
  1197. X  #endif
  1198. X      }
  1199. X***************
  1200. X*** 524,528 ****
  1201. X   * nested include file.
  1202. X   */
  1203. X! static int
  1204. X  yywrap ()
  1205. X  {
  1206. X--- 549,553 ----
  1207. X   * nested include file.
  1208. X   */
  1209. X! int
  1210. X  yywrap ()
  1211. X  {
  1212. Xdiff  -c2 old/Makefile.bc new/Makefile.bc
  1213. X*** old/Makefile.bc    Wed Jun 10 21:03:02 1992
  1214. X--- new/Makefile.bc    Sat Nov 28 23:27:32 1992
  1215. X***************
  1216. X*** 1,3 ****
  1217. X! # $Id: makefile.bc 3.1 92/03/03 10:45:53 cthuang Exp $
  1218. X  #
  1219. X  # Borland C++ makefile for C prototype generator
  1220. X--- 1,3 ----
  1221. X! # $Id: Makefile.bc 3.1 1992/03/03 10:45:53 cthuang Exp $
  1222. X  #
  1223. X  # Borland C++ makefile for C prototype generator
  1224. Xdiff  -c2 old/Makefile.msc new/Makefile.msc
  1225. X*** old/Makefile.msc    Wed Jun 10 21:03:02 1992
  1226. X--- new/Makefile.msc    Sat Nov 28 23:27:36 1992
  1227. X***************
  1228. X*** 1,3 ****
  1229. X! # $Id: makefile.msc 3.3 92/06/10 20:55:56 cthuang Exp $
  1230. X  #
  1231. X  # Microsoft C makefile for C prototype generator
  1232. X--- 1,3 ----
  1233. X! # $Id: Makefile.msc 3.4 1992/11/29 04:27:30 cthuang Exp $
  1234. X  #
  1235. X  # Microsoft C makefile for C prototype generator
  1236. X***************
  1237. X*** 11,16 ****
  1238. X  CC = cl
  1239. X  CFLAGS = -AC $(DEFINES)
  1240. X! LIBS = \c6\lib\setargv.obj
  1241. X! LDFLAGS = /link /noe /stack:4096
  1242. X  
  1243. X  DIST1 = README CHANGES cproto.man
  1244. X--- 11,16 ----
  1245. X  CC = cl
  1246. X  CFLAGS = -AC $(DEFINES)
  1247. X! LIBS = \c7\lib\setargv.obj
  1248. X! LDFLAGS = /F 1000
  1249. X  
  1250. X  DIST1 = README CHANGES cproto.man
  1251. Xdiff  -c2 old/Makefile.uni new/Makefile.uni
  1252. X*** old/Makefile.uni    Wed Jun 10 21:03:02 1992
  1253. X--- new/Makefile.uni    Sat Nov 28 23:27:36 1992
  1254. X***************
  1255. X*** 1,3 ****
  1256. X! # $Id: makefile.uni 3.5 92/06/10 20:56:00 cthuang Exp $
  1257. X  #
  1258. X  # UNIX makefile for C prototype generator
  1259. X--- 1,3 ----
  1260. X! # $Id: Makefile.uni 3.5 1992/06/10 20:56:00 cthuang Exp $
  1261. X  #
  1262. X  # UNIX makefile for C prototype generator
  1263. Xdiff  -c2 old/patchlev.h new/patchlev.h
  1264. X*** old/patchlev.h    Wed Jun 10 21:03:08 1992
  1265. X--- new/patchlev.h    Fri Jun 26 08:27:12 1992
  1266. X***************
  1267. X*** 1 ****
  1268. X! #define PATCHLEVEL 4
  1269. X--- 1 ----
  1270. X! #define PATCHLEVEL 5
  1271. Xdiff  -c2 old/popen.c new/popen.c
  1272. X*** old/popen.c    Wed Jun 10 21:03:08 1992
  1273. X--- new/popen.c    Sat Nov 28 23:27:52 1992
  1274. X***************
  1275. X*** 1,3 ****
  1276. X! /* $Id: popen.c 3.3 92/06/10 20:56:30 cthuang Exp $
  1277. X   *
  1278. X   * Imitate a UNIX pipe in MS-DOS.
  1279. X--- 1,3 ----
  1280. X! /* $Id: popen.c 3.3 1992/06/10 20:56:30 cthuang Exp $
  1281. X   *
  1282. X   * Imitate a UNIX pipe in MS-DOS.
  1283. Xdiff  -c2 old/semantic.c new/semantic.c
  1284. X*** old/semantic.c    Wed Jun 10 21:03:08 1992
  1285. X--- new/semantic.c    Sat Nov 28 23:27:56 1992
  1286. X***************
  1287. X*** 1,3 ****
  1288. X! /* $Id: semantic.c 3.6 92/06/10 20:56:35 cthuang Exp $
  1289. X   *
  1290. X   * Semantic actions executed by the parser of the
  1291. X--- 1,3 ----
  1292. X! /* $Id: semantic.c 3.7 1992/11/29 04:27:49 cthuang Exp $
  1293. X   *
  1294. X   * Semantic actions executed by the parser of the
  1295. X***************
  1296. X*** 11,15 ****
  1297. X  static Declarator *func_declarator;
  1298. X  
  1299. X! /* Where the declarator appears */
  1300. X  static int where;
  1301. X  
  1302. X--- 11,18 ----
  1303. X  static Declarator *func_declarator;
  1304. X  
  1305. X! /* Role of the function declarator
  1306. X!  * FUNC_PROTO if it is the declarator in a function prototype.
  1307. X!  * FUNC_DEF if it is the declarator in a function definition.
  1308. X!  */
  1309. X  static int where;
  1310. X  
  1311. X***************
  1312. X*** 105,108 ****
  1313. X--- 108,112 ----
  1314. X      d->head = d;
  1315. X      d->func_stack = NULL;
  1316. X+     d->pointer = FALSE;
  1317. X      return d;
  1318. X  }
  1319. X***************
  1320. X*** 116,120 ****
  1321. X      free(d->text);
  1322. X      free(d->name);
  1323. X!     free_param_list(&(d->params));
  1324. X      if (d->func_stack != NULL)
  1325. X      free_declarator(d->func_stack);
  1326. X--- 120,124 ----
  1327. X      free(d->text);
  1328. X      free(d->name);
  1329. X!     free_param_list(&d->params);
  1330. X      if (d->func_stack != NULL)
  1331. X      free_declarator(d->func_stack);
  1332. X***************
  1333. X*** 162,175 ****
  1334. X  }
  1335. X  
  1336. X! /* Initialize the parameter structure.
  1337. X   */
  1338. X! void
  1339. X! new_parameter (param, decl_spec, declarator)
  1340. X! Parameter *param;        /* parameter to be initialized */
  1341. X  DeclSpec *decl_spec;
  1342. X  Declarator *declarator;
  1343. X  {
  1344. X      if (decl_spec == NULL) {
  1345. X!     new_decl_spec(&(param->decl_spec), "", 0L, DS_JUNK);
  1346. X      } else {
  1347. X      param->decl_spec = *decl_spec;
  1348. X--- 166,181 ----
  1349. X  }
  1350. X  
  1351. X! /* Create a new parameter structure.
  1352. X   */
  1353. X! Parameter *
  1354. X! new_parameter (decl_spec, declarator)
  1355. X  DeclSpec *decl_spec;
  1356. X  Declarator *declarator;
  1357. X  {
  1358. X+     Parameter *param;
  1359. X+     param = (Parameter *)xmalloc(sizeof(Parameter));
  1360. X+ 
  1361. X      if (decl_spec == NULL) {
  1362. X!     new_decl_spec(¶m->decl_spec, "", 0L, DS_NONE);
  1363. X      } else {
  1364. X      param->decl_spec = *decl_spec;
  1365. X***************
  1366. X*** 182,185 ****
  1367. X--- 188,192 ----
  1368. X  
  1369. X      param->comment = NULL;
  1370. X+     return param;
  1371. X  }
  1372. X  
  1373. X***************
  1374. X*** 190,197 ****
  1375. X  Parameter *param;
  1376. X  {
  1377. X!     free_decl_spec(&(param->decl_spec));
  1378. X      free_declarator(param->declarator);
  1379. X      if (param->comment != NULL)
  1380. X      free(param->comment);
  1381. X  }
  1382. X  
  1383. X--- 197,205 ----
  1384. X  Parameter *param;
  1385. X  {
  1386. X!     free_decl_spec(¶m->decl_spec);
  1387. X      free_declarator(param->declarator);
  1388. X      if (param->comment != NULL)
  1389. X      free(param->comment);
  1390. X+     free(param);
  1391. X  }
  1392. X  
  1393. X***************
  1394. X*** 213,223 ****
  1395. X  Parameter *param;
  1396. X  {
  1397. X!     Parameter *p;
  1398. X! 
  1399. X!     p = (Parameter *)xmalloc(sizeof(Parameter));
  1400. X!     *p = *param;
  1401. X!     
  1402. X!     param_list->first = param_list->last = p;
  1403. X!     p->next = NULL;
  1404. X  
  1405. X      param_list->begin_comment = param_list->end_comment = 0;
  1406. X--- 221,226 ----
  1407. X  Parameter *param;
  1408. X  {
  1409. X!     param_list->first = param_list->last = param;
  1410. X!     param->next = NULL;
  1411. X  
  1412. X      param_list->begin_comment = param_list->end_comment = 0;
  1413. X***************
  1414. X*** 237,241 ****
  1415. X      next = p->next;
  1416. X      free_parameter(p);
  1417. X-     free(p);
  1418. X      p = next;
  1419. X      }
  1420. X--- 240,243 ----
  1421. X***************
  1422. X*** 245,249 ****
  1423. X  }
  1424. X  
  1425. X! /* Add the function parameter declaration to the list.
  1426. X   */
  1427. X  void
  1428. X--- 247,251 ----
  1429. X  }
  1430. X  
  1431. X! /* Add the parameter to the function parameter list.
  1432. X   */
  1433. X  void
  1434. X***************
  1435. X*** 252,264 ****
  1436. X  Parameter *param;
  1437. X  {
  1438. X-     Parameter *p;
  1439. X- 
  1440. X-     p = (Parameter *)xmalloc(sizeof(Parameter));
  1441. X-     *p = *param;
  1442. X- 
  1443. X      to->first = from->first;
  1444. X!     from->last->next = p;
  1445. X!     to->last = p;
  1446. X!     p->next = NULL;
  1447. X  }
  1448. X  
  1449. X--- 254,261 ----
  1450. X  Parameter *param;
  1451. X  {
  1452. X      to->first = from->first;
  1453. X!     from->last->next = param;
  1454. X!     to->last = param;
  1455. X!     param->next = NULL;
  1456. X  }
  1457. X  
  1458. X***************
  1459. X*** 285,291 ****
  1460. X      Declarator *declarator;
  1461. X  
  1462. X-     p = (Parameter *)xmalloc(sizeof(Parameter));
  1463. X      declarator = new_declarator(name, name, 0L);
  1464. X!     new_parameter(p, NULL, declarator);
  1465. X  
  1466. X      to->first = from->first;
  1467. X--- 282,287 ----
  1468. X      Declarator *declarator;
  1469. X  
  1470. X      declarator = new_declarator(name, name, 0L);
  1471. X!     p = new_parameter(NULL, declarator);
  1472. X  
  1473. X      to->first = from->first;
  1474. X***************
  1475. X*** 387,392 ****
  1476. X      p = declarator->params.first;
  1477. X      if (is_void_parameter(p)) {
  1478. X!     if (p != NULL || ((where == FUNC_PROTO || where == FUNC_DEF) &&
  1479. X!      declarator == func_declarator))
  1480. X          fputs("void", outf);
  1481. X      } else {
  1482. X--- 383,387 ----
  1483. X      p = declarator->params.first;
  1484. X      if (is_void_parameter(p)) {
  1485. X!     if (p != NULL)
  1486. X          fputs("void", outf);
  1487. X      } else {
  1488. X***************
  1489. X*** 578,586 ****
  1490. X  DeclSpec *decl_spec;
  1491. X  {
  1492. X!     if (extern_out && (decl_spec->flags & DS_STATIC) == 0) {
  1493. X!     if (strstr(decl_spec->text, "extern") == NULL) {
  1494. X!         fputs("extern ", outf);
  1495. X!     }
  1496. X!     }
  1497. X      fputs(decl_spec->text, outf);
  1498. X      fputc(' ', outf);
  1499. X--- 573,579 ----
  1500. X  DeclSpec *decl_spec;
  1501. X  {
  1502. X!     if (extern_out && !(decl_spec->flags & DS_STATIC) &&
  1503. X!      strstr(decl_spec->text, "extern") == NULL)
  1504. X!     fputs("extern ", outf);
  1505. X      fputs(decl_spec->text, outf);
  1506. X      fputc(' ', outf);
  1507. X***************
  1508. X*** 601,604 ****
  1509. X--- 594,598 ----
  1510. X      return;
  1511. X  
  1512. X+     check_untagged(decl_spec);
  1513. X      func_declarator = NULL;
  1514. X      where = FUNC_OTHER;
  1515. X***************
  1516. X*** 605,609 ****
  1517. X      format = FMT_OTHER;
  1518. X      for (d = decl_list->first; d != NULL; d = d->next) {
  1519. X!     if (d->func_def == FUNC_NONE) {
  1520. X          fputs(fmt[FMT_PROTO].decl_spec_prefix, stdout);
  1521. X          put_decl_spec(stdout, decl_spec);
  1522. X--- 599,603 ----
  1523. X      format = FMT_OTHER;
  1524. X      for (d = decl_list->first; d != NULL; d = d->next) {
  1525. X!     if (d->func_def == FUNC_NONE || d->head->func_stack->pointer) {
  1526. X          fputs(fmt[FMT_PROTO].decl_spec_prefix, stdout);
  1527. X          put_decl_spec(stdout, decl_spec);
  1528. X***************
  1529. X*** 614,617 ****
  1530. X--- 608,644 ----
  1531. X  }
  1532. X  
  1533. X+ /* Generate a prototype for a function that uses varargs by replacing the
  1534. X+  * "va_alist" parameter with an empty parameter list.
  1535. X+  */
  1536. X+ static void
  1537. X+ check_varargs (declarator)
  1538. X+ Declarator *declarator;
  1539. X+ {
  1540. X+     Parameter *p;
  1541. X+ 
  1542. X+     if ((p = declarator->params.first) != NULL && p->next == NULL &&
  1543. X+     strcmp(p->declarator->name, "va_alist") == 0)
  1544. X+     {
  1545. X+     free_param_list(&declarator->params);
  1546. X+     declarator->params.first = NULL;
  1547. X+     }
  1548. X+ }
  1549. X+ 
  1550. X+ /* If the parameter list is empty, then replace it with "void".
  1551. X+  */
  1552. X+ static void
  1553. X+ check_void_param (declarator)
  1554. X+ Declarator *declarator;
  1555. X+ {
  1556. X+     DeclSpec decl_spec;
  1557. X+     Parameter *p;
  1558. X+ 
  1559. X+     if (declarator->params.first == NULL) {
  1560. X+     new_decl_spec(&decl_spec, "void", 0L, DS_NONE);
  1561. X+     p = new_parameter(&decl_spec, NULL);
  1562. X+     new_param_list(&declarator->params, p);
  1563. X+     }
  1564. X+ }
  1565. X+ 
  1566. X  /* If a parameter name appears in the parameter list of a traditional style
  1567. X   * function definition but is not declared in the parameter declarations,
  1568. X***************
  1569. X*** 646,649 ****
  1570. X--- 673,678 ----
  1571. X  
  1572. X      func_declarator = declarator->head;
  1573. X+     check_void_param(func_declarator);
  1574. X+     check_varargs(func_declarator);
  1575. X      set_param_decl_spec(func_declarator);
  1576. X  
  1577. X***************
  1578. X*** 673,676 ****
  1579. X--- 702,728 ----
  1580. X  }
  1581. X  
  1582. X+ /* Output parameter declarations for old style function definition.
  1583. X+  */
  1584. X+ static void
  1585. X+ put_param_decl (declarator)
  1586. X+ Declarator *declarator;
  1587. X+ {
  1588. X+     Parameter *p;
  1589. X+ 
  1590. X+     p = declarator->params.first;
  1591. X+     if (!is_void_parameter(p)) {
  1592. X+     fputc('\n', cur_tmp_file());
  1593. X+     put_parameter(cur_tmp_file(), p);
  1594. X+     fputc(';', cur_tmp_file());
  1595. X+     p = p->next;
  1596. X+     while (p != NULL && strcmp(p->declarator->text, "...") != 0) {
  1597. X+         fputc('\n', cur_tmp_file());
  1598. X+         put_parameter(cur_tmp_file(), p);
  1599. X+         fputc(';', cur_tmp_file());
  1600. X+         p = p->next;
  1601. X+     }
  1602. X+     }
  1603. X+ }
  1604. X+ 
  1605. X  /* Generate a function definition head.
  1606. X   */
  1607. X***************
  1608. X*** 685,690 ****
  1609. X      int comment_len, n;
  1610. X  
  1611. X!     /* Return if the function is already defined in the desired style. */
  1612. X!     if (declarator->func_def == func_style)
  1613. X      return;
  1614. X  
  1615. X--- 737,743 ----
  1616. X      int comment_len, n;
  1617. X  
  1618. X!     /* Do nothing if the function is already defined in the desired style. */
  1619. X!     func_declarator = declarator->head;
  1620. X!     if (func_declarator->func_def == func_style)
  1621. X      return;
  1622. X  
  1623. X***************
  1624. X*** 698,706 ****
  1625. X      fread(comment, sizeof(char), comment_len, cur_tmp_file());
  1626. X  
  1627. X-     func_declarator = declarator->head;
  1628. X      format = FMT_FUNC;
  1629. X! 
  1630. X!     /* Save the text before the parameter declarations. */
  1631. X!     if (func_style == FUNC_ANSI) {
  1632. X      params = &func_declarator->params;
  1633. X      n = (int)(params->end_comment - params->begin_comment);
  1634. X--- 751,757 ----
  1635. X      fread(comment, sizeof(char), comment_len, cur_tmp_file());
  1636. X  
  1637. X      format = FMT_FUNC;
  1638. X!     if (func_declarator->func_def == FUNC_TRADITIONAL) {
  1639. X!     /* Save the text before the parameter declarations. */
  1640. X      params = &func_declarator->params;
  1641. X      n = (int)(params->end_comment - params->begin_comment);
  1642. X***************
  1643. X*** 712,729 ****
  1644. X          format = FMT_FUNC_COMMENT;
  1645. X      }
  1646. X-     }
  1647. X  
  1648. X!     /* Get the parameter comments. */
  1649. X!     for (p = func_declarator->params.first; p != NULL; p = p->next) {
  1650. X!     n = (int)(p->declarator->end_comment - p->declarator->begin_comment);
  1651. X!     if (n > 0) {
  1652. X!         p->comment = xmalloc(n+1);
  1653. X!         fseek(cur_tmp_file(), p->declarator->begin_comment, 0);
  1654. X!         fread(p->comment, sizeof(char), n, cur_tmp_file());
  1655. X!         p->comment[n] = '\0';
  1656. X!         format = FMT_FUNC_COMMENT;
  1657. X      }
  1658. X      }
  1659. X  
  1660. X      set_param_decl_spec(func_declarator);
  1661. X  
  1662. X--- 763,781 ----
  1663. X          format = FMT_FUNC_COMMENT;
  1664. X      }
  1665. X  
  1666. X!     /* Get the parameter comments. */
  1667. X!     for (p = func_declarator->params.first; p != NULL; p = p->next) {
  1668. X!         n = (int)(p->declarator->end_comment - p->declarator->begin_comment);
  1669. X!         if (n > 0) {
  1670. X!             p->comment = xmalloc(n+1);
  1671. X!             fseek(cur_tmp_file(), p->declarator->begin_comment, 0);
  1672. X!             fread(p->comment, sizeof(char), n, cur_tmp_file());
  1673. X!             p->comment[n] = '\0';
  1674. X!             format = FMT_FUNC_COMMENT;
  1675. X!         }
  1676. X      }
  1677. X      }
  1678. X  
  1679. X+     check_void_param(func_declarator);
  1680. X      set_param_decl_spec(func_declarator);
  1681. X  
  1682. X***************
  1683. X*** 731,760 ****
  1684. X       * and overwrite it with the converted function head.
  1685. X       */
  1686. X      fseek(cur_tmp_file(), decl_spec->begin, 0);
  1687. X  
  1688. X!     /* Output declarator specifiers. */
  1689. X!     fputs(fmt[format].decl_spec_prefix, cur_tmp_file());
  1690. X!     fputs(decl_spec->text, cur_tmp_file());
  1691. X!     fputc(' ', cur_tmp_file());
  1692. X! 
  1693. X!     /* Output function declarator. */
  1694. X!     where = FUNC_DEF;
  1695. X!     put_func_declarator(cur_tmp_file(), declarator);
  1696. X  
  1697. X!     if (func_style == FUNC_TRADITIONAL) {
  1698. X!     /* Output traditional style parameter declarations. */
  1699. X!     p = func_declarator->params.first;
  1700. X!     if (!is_void_parameter(p)) {
  1701. X          fputc('\n', cur_tmp_file());
  1702. X!         put_parameter(cur_tmp_file(), p);
  1703. X!         fputc(';', cur_tmp_file());
  1704. X!         p = p->next;
  1705. X!         while (p != NULL && strcmp(p->declarator->text, "...") != 0) {
  1706. X!         fputc('\n', cur_tmp_file());
  1707. X!         put_parameter(cur_tmp_file(), p);
  1708. X!         fputc(';', cur_tmp_file());
  1709. X!         p = p->next;
  1710. X!         }
  1711. X!     }
  1712. X      }
  1713. X  
  1714. X--- 783,844 ----
  1715. X       * and overwrite it with the converted function head.
  1716. X       */
  1717. X+     where = FUNC_DEF;
  1718. X      fseek(cur_tmp_file(), decl_spec->begin, 0);
  1719. X  
  1720. X!     if (func_style == FUNC_BOTH) {
  1721. X!     char *cur_func;
  1722. X!     int func_len;
  1723. X! 
  1724. X!     /* Save the current function definition head. */
  1725. X!     func_len = (int)(cur_begin_comment() - decl_spec->begin);
  1726. X!     cur_func = xmalloc(func_len);
  1727. X!     fread(cur_func, sizeof(char), func_len, cur_tmp_file());
  1728. X! 
  1729. X!     fseek(cur_tmp_file(), decl_spec->begin, 0);
  1730. X!     fprintf(cur_tmp_file(), "%s\n\n", func_directive);
  1731. X! 
  1732. X!     /* Output new style function definition head. */
  1733. X!     if (func_declarator->func_def == FUNC_ANSI) {
  1734. X!         fwrite(cur_func, sizeof(char), func_len, cur_tmp_file());
  1735. X!     } else {
  1736. X!         fputs(fmt[format].decl_spec_prefix, cur_tmp_file());
  1737. X!         fputs(decl_spec->text, cur_tmp_file());
  1738. X!         fputc(' ', cur_tmp_file());
  1739. X! 
  1740. X!         func_style = FUNC_ANSI;
  1741. X!         put_func_declarator(cur_tmp_file(), declarator);
  1742. X!     }
  1743. X!     fputs("\n#else\n\n", cur_tmp_file());
  1744. X! 
  1745. X!     /* Output old style function definition head. */
  1746. X!     if (func_declarator->func_def == FUNC_TRADITIONAL) {
  1747. X!         fwrite(cur_func, sizeof(char), func_len, cur_tmp_file());
  1748. X!     } else {
  1749. X!         fputs(fmt[format].decl_spec_prefix, cur_tmp_file());
  1750. X!         fputs(decl_spec->text, cur_tmp_file());
  1751. X!         fputc(' ', cur_tmp_file());
  1752. X! 
  1753. X!          format = FMT_FUNC;
  1754. X!         func_style = FUNC_TRADITIONAL;
  1755. X!         put_func_declarator(cur_tmp_file(), declarator);
  1756. X!         put_param_decl(func_declarator);
  1757. X!     }
  1758. X  
  1759. X!     fputs("\n#endif", cur_tmp_file());
  1760. X!     if (*comment != '\n')
  1761. X          fputc('\n', cur_tmp_file());
  1762. X!     func_style = FUNC_BOTH;
  1763. X!     free(cur_func);
  1764. X! 
  1765. X!     } else {
  1766. X!     /* Output declarator specifiers. */
  1767. X!     fputs(fmt[format].decl_spec_prefix, cur_tmp_file());
  1768. X!     fputs(decl_spec->text, cur_tmp_file());
  1769. X!     fputc(' ', cur_tmp_file());
  1770. X! 
  1771. X!     /* Output function declarator. */
  1772. X!     put_func_declarator(cur_tmp_file(), declarator);
  1773. X!     if (func_style == FUNC_TRADITIONAL)
  1774. X!         put_param_decl(func_declarator);
  1775. X      }
  1776. X  
  1777. Xdiff  -c2 old/semantic.h new/semantic.h
  1778. X*** old/semantic.h    Wed Jun 10 21:03:08 1992
  1779. X--- new/semantic.h    Sat Nov 28 23:27:48 1992
  1780. X***************
  1781. X*** 1,3 ****
  1782. X! /* $Id: semantic.h 3.3 92/06/10 20:56:19 cthuang Exp $
  1783. X   *
  1784. X   * Declarations of semantic action routines
  1785. X--- 1,3 ----
  1786. X! /* $Id: semantic.h 3.4 1992/11/29 04:27:30 cthuang Exp $
  1787. X   *
  1788. X   * Declarations of semantic action routines
  1789. X***************
  1790. X*** 22,27 ****
  1791. X  extern void add_decl_list(/*
  1792. X      DeclaratorList *to, DeclaratorList *from, Declarator *declarator*/);
  1793. X! extern void new_parameter(/*
  1794. X!     Parameter *param, DeclSpec *decl_spec, Declarator *declarator*/);
  1795. X  extern void free_parameter(/*
  1796. X      Parameter *param*/);
  1797. X--- 22,27 ----
  1798. X  extern void add_decl_list(/*
  1799. X      DeclaratorList *to, DeclaratorList *from, Declarator *declarator*/);
  1800. X! extern Parameter *new_parameter(/*
  1801. X!     DeclSpec *decl_spec, Declarator *declarator*/);
  1802. X  extern void free_parameter(/*
  1803. X      Parameter *param*/);
  1804. Xdiff  -c2 old/strstr.c new/strstr.c
  1805. X*** old/strstr.c    Wed Jun 10 21:03:08 1992
  1806. X--- new/strstr.c    Sat Nov 28 23:27:58 1992
  1807. X***************
  1808. X*** 1,3 ****
  1809. X! /* $Id: strstr.c 3.2 92/03/06 00:51:10 cthuang Exp $
  1810. X   *
  1811. X   * Simple implementation of the ANSI strstr() function
  1812. X--- 1,3 ----
  1813. X! /* $Id: strstr.c 3.3 1992/11/29 04:27:49 cthuang Exp $
  1814. X   *
  1815. X   * Simple implementation of the ANSI strstr() function
  1816. X***************
  1817. X*** 17,21 ****
  1818. X      int keylen;
  1819. X  
  1820. X!     keylen = strlen(key);
  1821. X      s = strchr(src, *key);
  1822. X      while (s != NULL) {
  1823. X--- 17,23 ----
  1824. X      int keylen;
  1825. X  
  1826. X!     if ((keylen = strlen(key)) == 0)
  1827. X!     return src;
  1828. X! 
  1829. X      s = strchr(src, *key);
  1830. X      while (s != NULL) {
  1831. Xdiff  -c2 old/symbol.c new/symbol.c
  1832. X*** old/symbol.c    Wed Jun 10 21:03:08 1992
  1833. X--- new/symbol.c    Sat Nov 28 23:28:00 1992
  1834. X***************
  1835. X*** 1,3 ****
  1836. X! /* $Id: symbol.c 3.1 92/03/03 10:43:52 cthuang Exp $
  1837. X   *
  1838. X   * Implements a symbol table abstract data type.
  1839. X--- 1,3 ----
  1840. X! /* $Id: symbol.c 3.2 1992/11/29 04:27:49 cthuang Exp $
  1841. X   *
  1842. X   * Implements a symbol table abstract data type.
  1843. X***************
  1844. X*** 95,99 ****
  1845. X  /* If the symbol <name> does not already exist in symbol table <symtab>,
  1846. X   * then add the symbol to the symbol table.
  1847. X!  * Return a pointer to the symbol or NULL on an error.
  1848. X   */
  1849. X  Symbol *
  1850. X--- 95,99 ----
  1851. X  /* If the symbol <name> does not already exist in symbol table <symtab>,
  1852. X   * then add the symbol to the symbol table.
  1853. X!  * Return a pointer to the symbol.
  1854. X   */
  1855. X  Symbol *
  1856. X***************
  1857. X*** 107,117 ****
  1858. X  
  1859. X      if ((sym = find_symbol(symtab, name)) == NULL) {
  1860. X!     if ((sym = (Symbol *)xmalloc(sizeof(Symbol))) != NULL) {
  1861. X!         sym->name = xstrdup(name);
  1862. X!         sym->flags = flags;
  1863. X!         i = hash(name);
  1864. X!         sym->next = symtab->bucket[i];
  1865. X!         symtab->bucket[i] = sym;
  1866. X!     }
  1867. X      }
  1868. X      return sym;
  1869. X--- 107,116 ----
  1870. X  
  1871. X      if ((sym = find_symbol(symtab, name)) == NULL) {
  1872. X!     sym = (Symbol *)xmalloc(sizeof(Symbol));
  1873. X!     sym->name = xstrdup(name);
  1874. X!     sym->flags = flags;
  1875. X!     i = hash(name);
  1876. X!     sym->next = symtab->bucket[i];
  1877. X!     symtab->bucket[i] = sym;
  1878. X      }
  1879. X      return sym;
  1880. Xdiff  -c2 old/symbol.h new/symbol.h
  1881. X*** old/symbol.h    Wed Jun 10 21:03:08 1992
  1882. X--- new/symbol.h    Sat Nov 28 23:27:48 1992
  1883. X***************
  1884. X*** 1,3 ****
  1885. X! /* $Id: symbol.h 3.3 92/03/14 11:57:48 cthuang Exp $
  1886. X   *
  1887. X   * A symbol table is a collection of string identifiers stored in a
  1888. X--- 1,3 ----
  1889. X! /* $Id: symbol.h 3.3 1992/03/14 11:57:48 cthuang Exp $
  1890. X   *
  1891. X   * A symbol table is a collection of string identifiers stored in a
  1892. END_OF_patch5
  1893. if test 49845 -ne `wc -c <patch5`; then
  1894.     echo shar: \"patch5\" unpacked with wrong size!
  1895. fi
  1896. # end of overwriting check
  1897. fi
  1898. echo shar: End of shell archive.
  1899. exit 0
  1900.  
  1901. -- 
  1902. Chin Huang  cthuang%zerosan@canrem.com  chin.huang@canrem.com
  1903.  
  1904. exit 0 # Just in case...
  1905.