home *** CD-ROM | disk | FTP | other *** search
/ Source Code 1994 March / Source_Code_CD-ROM_Walnut_Creek_March_1994.iso / compsrcs / misc / volume37 / cproto / patch07 < prev    next >
Encoding:
Text File  |  1993-05-29  |  34.5 KB  |  1,234 lines

  1. Newsgroups: comp.sources.misc
  2. From: cthuang@zerosan.canrem.COM (Chin Huang)
  3. Subject: v37i087:  cproto - generate C function prototypes v3, Patch07
  4. Message-ID: <1993May29.171218.14144@sparky.imd.sterling.com>
  5. X-Md4-Signature: be5918f72f118f7f6951d2dd169dec61
  6. Sender: kent@sparky.imd.sterling.com (Kent Landfield)
  7. Reply-To: cthuang%zerosan@canrem.com
  8. Organization: Sterling Software
  9. Date: Sat, 29 May 1993 17:12:18 GMT
  10. Approved: kent@sparky.imd.sterling.com
  11.  
  12. Submitted-by: cthuang@zerosan.canrem.COM (Chin Huang)
  13. Posting-number: Volume 37, Issue 87
  14. Archive-name: cproto/patch07
  15. Environment: UNIX, MS-DOS, getopt, lex, yacc
  16. Patch-To: cproto: Volume 29, Issue 61-62
  17.  
  18. This patch brings cproto to version 3 patchlevel 7.  It fixes a bug that
  19. caused the program to incorrectly scan string literals in some cases.
  20. Some of the options have also been rearranged into a more orthogonal
  21. set.  Read the CHANGES file for details.  Thanks to the following people
  22. for their suggestions and bug reports:
  23.  
  24.     Steve Kunkee <kunkee@STLHP41>
  25.     "Ozan Yigit" <oz@sis.yorku.ca>
  26.     metcalf@catfish.LCS.MIT.EDU (Chris Metcalf)
  27.  
  28. #! /bin/sh
  29. # This is a shell archive.  Remove anything before this line, then unpack
  30. # it by saving it into a file and typing "sh file".  To overwrite existing
  31. # files, type "sh file -c".  You can also feed this as standard input via
  32. # unshar, or by typing "sh <file", e.g..  If this archive is complete, you
  33. # will see the following message at the end:
  34. #        "End of shell archive."
  35. # Contents:  patch7
  36. # Wrapped by cthuang@zerosan.UUCP on Tue May 25 22:14:31 1993
  37. PATH=/bin:/usr/bin:/usr/ucb ; export PATH
  38. if test -f patch7 -a "${1}" != "-c" ; then 
  39.   echo shar: Will not over-write existing file \"patch7\"
  40. else
  41. echo shar: Extracting \"patch7\" \(32109 characters\)
  42. sed "s/^X//" >patch7 <<'END_OF_patch7'
  43. Xdiff  -c2 old/CHANGES new/CHANGES
  44. X*** old/CHANGES    Tue Dec 01 21:03:42 1992
  45. X--- new/CHANGES    Tue May 25 21:11:18 1993
  46. X***************
  47. X*** 1,4 ****
  48. X--- 1,28 ----
  49. X  Version 3
  50. X  
  51. X+ Patchlevel 7
  52. X+ 
  53. X+ - Fix: The processing of string literals is now more robust.
  54. X+ 
  55. X+ - Removed the -f4 option which generated prototypes like
  56. X+ 
  57. X+     int main P_((int argc, char **argv));
  58. X+ 
  59. X+   Use the -m option now to put a guard macro around the prototype
  60. X+   parameter list.  Use the -m option together with -f3 (which is the
  61. X+   default) to produce the same output as the old -f4 option.  The option
  62. X+   to set the guard macro name is now -M.
  63. X+ 
  64. X+ - Comments in prototype parameter lists are now disabled by default.
  65. X+   Use the -c option now to output these comments.
  66. X+ 
  67. X+ - Can now process #include directives in which the file is specified with
  68. X+   a #define macro.
  69. X+ 
  70. X+ - Now does not convert function definitions that take the formal
  71. X+   parameter va_alist from <varargs.h>.
  72. X+ 
  73. X+ - Now recognizes the GNU C modifiers __const and __inline__.
  74. X+ 
  75. X  Patchlevel 6
  76. X  
  77. Xdiff  -c2 old/config.h new/config.h
  78. X*** old/config.h    Sat Nov 28 23:27:44 1992
  79. X--- new/config.h    Tue May 25 21:48:48 1993
  80. X***************
  81. X*** 1,3 ****
  82. X! /* $Id: config.h 3.5 1992/11/29 04:27:30 cthuang Exp $
  83. X   *
  84. X   * cproto configuration and system dependencies
  85. X--- 1,3 ----
  86. X! /* $Id: config.h 3.6 1993/05/26 01:48:42 cthuang Exp $
  87. X   *
  88. X   * cproto configuration and system dependencies
  89. X***************
  90. X*** 4,8 ****
  91. X   */
  92. X  
  93. X! /* Borland C predefines __MSDOS__ */
  94. X  #ifdef __MSDOS__
  95. X  #ifndef MSDOS
  96. X--- 4,8 ----
  97. X   */
  98. X  
  99. X! /* Borland C++ for MS-DOS predefines __MSDOS__ */
  100. X  #ifdef __MSDOS__
  101. X  #ifndef MSDOS
  102. X***************
  103. X*** 11,17 ****
  104. X--- 11,29 ----
  105. X  #endif
  106. X  
  107. X+ /* Borland C++ for OS/2 predefines __OS2__ */
  108. X+ #ifdef __OS2__
  109. X+ #ifndef OS2
  110. X+ #define OS2
  111. X+ #endif
  112. X+ #endif
  113. X+ 
  114. X  /* Turbo C preprocessor */
  115. X  #ifdef TURBO_CPP
  116. X  #define CPP "cpp -P-"
  117. X+ #else
  118. X+ #ifdef OS2
  119. X+ #define popen _popen
  120. X+ #define pclose _pclose
  121. X+ #endif
  122. X  #endif
  123. X  
  124. X***************
  125. X*** 43,47 ****
  126. X  #endif
  127. X  
  128. X! #if __STDC__ || defined(MSDOS)
  129. X  #include <stdlib.h>
  130. X  #include <string.h>
  131. X--- 55,59 ----
  132. X  #endif
  133. X  
  134. X! #if __STDC__ || defined(MSDOS) || defined(OS2)
  135. X  #include <stdlib.h>
  136. X  #include <string.h>
  137. Xdiff  -c2 old/cproto.1 new/cproto.1
  138. X*** old/cproto.1    Sat Nov 28 23:34:08 1992
  139. X--- new/cproto.1    Tue May 25 21:36:04 1993
  140. X***************
  141. X*** 1,3 ****
  142. X! .\" $Id: cproto.1 3.7 1992/11/29 04:34:05 cthuang Exp $
  143. X  .\"
  144. X  .de EX        \"Begin example
  145. X--- 1,3 ----
  146. X! .\" $Id: cproto.1 3.8 1993/05/26 01:34:15 cthuang Exp $
  147. X  .\"
  148. X  .de EX        \"Begin example
  149. X***************
  150. X*** 14,18 ****
  151. X  .if t .sp .5
  152. X  ..
  153. X! .TH CPROTO 1 "October 24, 1992"
  154. X  .SH NAME
  155. X  cproto \- generate C function prototypes and convert function definitions
  156. X--- 14,18 ----
  157. X  .if t .sp .5
  158. X  ..
  159. X! .TH CPROTO 1 "May 24, 1993"
  160. X  .SH NAME
  161. X  cproto \- generate C function prototypes and convert function definitions
  162. X***************
  163. X*** 96,100 ****
  164. X  Set the style of generated function prototypes where
  165. X  .I n
  166. X! is a number from 0 to 4.
  167. X  For example, consider the function definition
  168. X  .EX
  169. X--- 96,100 ----
  170. X  Set the style of generated function prototypes where
  171. X  .I n
  172. X! is a number from 0 to 3.
  173. X  For example, consider the function definition
  174. X  .EX
  175. X***************
  176. X*** 119,123 ****
  177. X  int main(int argc, char *argv[]);
  178. X  .EE
  179. X! A value of 4 produces prototypes guarded by a macro:
  180. X  .EX
  181. X  int main P_((int argc, char *argv[]));
  182. X--- 119,131 ----
  183. X  int main(int argc, char *argv[]);
  184. X  .EE
  185. X! .TP
  186. X! .B \-c
  187. X! The parameter comments in the prototypes generated by
  188. X! the \-f1 and \-f2 options are omitted by default.
  189. X! Use this option to enable the output of these comments.
  190. X! .TP
  191. X! .B \-m
  192. X! Put a macro around the parameter list of every generated prototype.
  193. X! For example:
  194. X  .EX
  195. X  int main P_((int argc, char *argv[]));
  196. X***************
  197. X*** 124,139 ****
  198. X  .EE
  199. X  .TP
  200. X! .B \-c
  201. X! Omit the parameter comments in the prototypes generated by
  202. X! the \-f1 and \-f2 options.
  203. X! This option also omits the comments naming the source files from which
  204. X! the prototypes were generated.
  205. X! .TP
  206. X! .BI \-m name
  207. X! Set the name of the macro used to guard prototypes when option \-f4 is selected.
  208. X  The default is "P_".
  209. X  .TP
  210. X  .B \-d
  211. X! Omit the definition of the prototype macro named by the \-m option.
  212. X  .TP
  213. X  .B \-p
  214. X--- 132,142 ----
  215. X  .EE
  216. X  .TP
  217. X! .BI \-M name
  218. X! Set the name of the macro used to surround prototype parameter lists
  219. X! when option \-m is selected.
  220. X  The default is "P_".
  221. X  .TP
  222. X  .B \-d
  223. X! Omit the definition of the prototype macro used by the \-m option.
  224. X  .TP
  225. X  .B \-p
  226. X***************
  227. X*** 256,259 ****
  228. X--- 259,264 ----
  229. X  The environment variable CPROTO is scanned for
  230. X  a list of options in the same format as the command line options.
  231. X+ Options given on the command line override any corresponding
  232. X+ environment option.
  233. X  .SH BUGS
  234. X  If an untagged struct, union or enum declaration appears in
  235. Xdiff  -c2 old/cproto.c new/cproto.c
  236. X*** old/cproto.c    Sat Nov 28 23:27:52 1992
  237. X--- new/cproto.c    Tue May 25 21:36:46 1993
  238. X***************
  239. X*** 1,3 ****
  240. X! /* $Id: cproto.c 3.7 1992/11/29 04:27:49 cthuang Exp $
  241. X   *
  242. X   * C function prototype generator and function definition converter
  243. X--- 1,3 ----
  244. X! /* $Id: cproto.c 3.8 1993/05/26 01:36:41 cthuang Exp $
  245. X   *
  246. X   * C function prototype generator and function definition converter
  247. X***************
  248. X*** 4,8 ****
  249. X   */
  250. X  #ifndef lint
  251. X! static char rcsid[] = "$Id: cproto.c 3.7 1992/11/29 04:27:49 cthuang Exp $";
  252. X  #endif
  253. X  #include <stdio.h>
  254. X--- 4,8 ----
  255. X   */
  256. X  #ifndef lint
  257. X! static char rcsid[] = "$Id: cproto.c 3.8 1993/05/26 01:36:41 cthuang Exp $";
  258. X  #endif
  259. X  #include <stdio.h>
  260. X***************
  261. X*** 39,42 ****
  262. X--- 39,45 ----
  263. X  FuncDefStyle func_style = FUNC_NONE;
  264. X  
  265. X+ /* If TRUE, put guard macro around prototype parameters */
  266. X+ boolean proto_macro = FALSE;
  267. X+ 
  268. X  /* Name of macro to guard prototypes */
  269. X  char *macro_name = "P_";
  270. X***************
  271. X*** 46,50 ****
  272. X  
  273. X  /* If TRUE, output comments in prototypes */
  274. X! boolean proto_comments = TRUE;
  275. X  
  276. X  /* Conditional compilation directive output in front of function definitions */
  277. X--- 49,56 ----
  278. X  
  279. X  /* If TRUE, output comments in prototypes */
  280. X! boolean proto_comments = FALSE;
  281. X! 
  282. X! /* If TRUE, output comments naming source files */
  283. X! boolean file_comments = TRUE;
  284. X  
  285. X  /* Conditional compilation directive output in front of function definitions */
  286. X***************
  287. X*** 231,237 ****
  288. X      fputs("  -a, -t           Convert function definitions to ANSI or traditional style\n", stderr);
  289. X      fputs("  -b               Rewrite function definitions in both styles\n", stderr);
  290. X!     fputs("  -c               Omit comments in generated prototypes\n", stderr);
  291. X      fputs("  -e               Output \"extern\" keyword before global declarations\n", stderr);
  292. X!     fputs("  -f n             Set function prototype style (0 to 4)\n", stderr);
  293. X      fputs("  -p               Disable formal parameter promotion\n", stderr);
  294. X      fputs("  -q               Disable include file read failure messages\n", stderr);
  295. X--- 237,243 ----
  296. X      fputs("  -a, -t           Convert function definitions to ANSI or traditional style\n", stderr);
  297. X      fputs("  -b               Rewrite function definitions in both styles\n", stderr);
  298. X!     fputs("  -c               Enable comments in prototype parameters\n", stderr);
  299. X      fputs("  -e               Output \"extern\" keyword before global declarations\n", stderr);
  300. X!     fputs("  -f n             Set function prototype style (0 to 3)\n", stderr);
  301. X      fputs("  -p               Disable formal parameter promotion\n", stderr);
  302. X      fputs("  -q               Disable include file read failure messages\n", stderr);
  303. X***************
  304. X*** 238,242 ****
  305. X      fputs("  -s               Output static declarations\n", stderr);
  306. X      fputs("  -v               Output variable declarations\n", stderr);
  307. X!     fputs("  -m name          Set name of prototype macro\n", stderr);
  308. X      fputs("  -d               Omit prototype macro definition\n", stderr);
  309. X      fputs("  -P template      Set prototype format template \" int f (a, b)\"\n", stderr);
  310. X--- 244,249 ----
  311. X      fputs("  -s               Output static declarations\n", stderr);
  312. X      fputs("  -v               Output variable declarations\n", stderr);
  313. X!     fputs("  -m               Put macro around prototype parameters\n", stderr);
  314. X!     fputs("  -M name          Set name of prototype macro\n", stderr);
  315. X      fputs("  -d               Omit prototype macro definition\n", stderr);
  316. X      fputs("  -P template      Set prototype format template \" int f (a, b)\"\n", stderr);
  317. X***************
  318. X*** 297,301 ****
  319. X  #endif
  320. X  
  321. X!     while ((c = getopt(argc, argv, "aB:bC:cD:dE:eF:f:I:m:P:pqstU:Vv")) != EOF) {
  322. X      switch (c) {
  323. X      case 'I':
  324. X--- 304,308 ----
  325. X  #endif
  326. X  
  327. X!     while ((c = getopt(argc, argv, "aB:bC:cD:dE:eF:f:I:mM:P:pqstU:Vv")) != EOF) {
  328. X      switch (c) {
  329. X      case 'I':
  330. X***************
  331. X*** 323,327 ****
  332. X          break;
  333. X      case 'c':
  334. X!         proto_comments = FALSE;
  335. X          break;
  336. X      case 'd':
  337. X--- 330,334 ----
  338. X          break;
  339. X      case 'c':
  340. X!         proto_comments = TRUE;
  341. X          break;
  342. X      case 'd':
  343. X***************
  344. X*** 387,394 ****
  345. X      case 'f':
  346. X          proto_style = atoi(optarg);
  347. X!         if (proto_style < 0 || proto_style > PROTO_MACRO)
  348. X          usage();
  349. X          break;
  350. X      case 'm':
  351. X          macro_name = optarg;
  352. X          break;
  353. X--- 394,404 ----
  354. X      case 'f':
  355. X          proto_style = atoi(optarg);
  356. X!         if (proto_style < 0 || proto_style > PROTO_ANSI)
  357. X          usage();
  358. X          break;
  359. X      case 'm':
  360. X+         proto_macro = TRUE;
  361. X+         break;
  362. X+     case 'M':
  363. X          macro_name = optarg;
  364. X          break;
  365. X***************
  366. X*** 431,435 ****
  367. X      process_options(&argc, &argv);
  368. X  
  369. X!     if (proto_style == PROTO_MACRO && define_macro) {
  370. X      printf("#if __STDC__ || defined(__cplusplus)\n");
  371. X      printf("#define %s(s) s\n", macro_name);
  372. X--- 441,445 ----
  373. X      process_options(&argc, &argv);
  374. X  
  375. X!     if (proto_macro && define_macro) {
  376. X      printf("#if __STDC__ || defined(__cplusplus)\n");
  377. X      printf("#define %s(s) s\n", macro_name);
  378. X***************
  379. X*** 444,448 ****
  380. X          proto_style = PROTO_NONE;
  381. X          variables_out = FALSE;
  382. X!         proto_comments = FALSE;
  383. X      }
  384. X      process_file(stdin, "stdin");
  385. X--- 454,458 ----
  386. X          proto_style = PROTO_NONE;
  387. X          variables_out = FALSE;
  388. X!         file_comments = FALSE;
  389. X      }
  390. X      process_file(stdin, "stdin");
  391. X***************
  392. X*** 484,488 ****
  393. X      }
  394. X  
  395. X!     if (proto_style == PROTO_MACRO && define_macro) {
  396. X      printf("\n#undef %s\n", macro_name);
  397. X      }
  398. X--- 494,498 ----
  399. X      }
  400. X  
  401. X!     if (proto_macro && define_macro) {
  402. X      printf("\n#undef %s\n", macro_name);
  403. X      }
  404. Xdiff  -c2 old/cproto.h new/cproto.h
  405. X*** old/cproto.h    Sat Nov 28 23:27:46 1992
  406. X--- new/cproto.h    Tue May 25 21:36:26 1993
  407. X***************
  408. X*** 1,3 ****
  409. X! /* $Id: cproto.h 3.6 1992/11/29 04:27:30 cthuang Exp $
  410. X   *
  411. X   * Declarations for C function prototype generator
  412. X--- 1,3 ----
  413. X! /* $Id: cproto.h 3.7 1993/05/26 01:36:04 cthuang Exp $
  414. X   *
  415. X   * Declarations for C function prototype generator
  416. X***************
  417. X*** 92,96 ****
  418. X  #define PROTO_ABSTRACT        2    /* comment out parameter names */
  419. X  #define PROTO_ANSI        3    /* ANSI C prototype */
  420. X- #define PROTO_MACRO        4    /* macro around parameters */
  421. X  typedef int PrototypeStyle;
  422. X  
  423. X--- 92,95 ----
  424. X***************
  425. X*** 125,131 ****
  426. X--- 124,132 ----
  427. X  extern PrototypeStyle proto_style;
  428. X  extern FuncDefStyle func_style;
  429. X+ extern boolean proto_macro;
  430. X  extern boolean define_macro;
  431. X  extern char *macro_name;
  432. X  extern boolean proto_comments;
  433. X+ extern boolean file_comments;
  434. X  extern boolean quiet;
  435. X  extern char *func_directive;
  436. Xdiff  -c2 old/grammar.y new/grammar.y
  437. X*** old/grammar.y    Sat Nov 28 23:27:42 1992
  438. X--- new/grammar.y    Tue May 25 21:48:44 1993
  439. X***************
  440. X*** 1,3 ****
  441. X! /* $Id: grammar.y 3.7 1992/11/29 04:27:30 cthuang Exp $
  442. X   *
  443. X   * yacc grammar for C function prototype generator
  444. X--- 1,3 ----
  445. X! /* $Id: grammar.y 3.8 1993/05/26 01:48:42 cthuang Exp $
  446. X   *
  447. X   * yacc grammar for C function prototype generator
  448. X***************
  449. X*** 8,12 ****
  450. X  %token <text> '(' '*'
  451. X      /* identifiers that are not reserved words */
  452. X!     T_IDENTIFIER T_TYPEDEF_NAME
  453. X  
  454. X      /* storage class */
  455. X--- 8,12 ----
  456. X  %token <text> '(' '*'
  457. X      /* identifiers that are not reserved words */
  458. X!     T_IDENTIFIER T_TYPEDEF_NAME T_DEFINE_NAME
  459. X  
  460. X      /* storage class */
  461. X***************
  462. X*** 92,95 ****
  463. X--- 92,98 ----
  464. X  static SymbolTable *typedef_names;
  465. X  
  466. X+ /* table of define names */
  467. X+ static SymbolTable *define_names;
  468. X+ 
  469. X  /* table of type qualifiers */
  470. X  static SymbolTable *type_qualifiers;
  471. X***************
  472. X*** 196,200 ****
  473. X          if (strcmp($1->text, $1->name) != 0)
  474. X          flags &= ~(DS_CHAR | DS_SHORT | DS_FLOAT);
  475. X!         new_symbol(typedef_names, $1->name, flags);
  476. X          free_declarator($1);
  477. X      }
  478. X--- 199,203 ----
  479. X          if (strcmp($1->text, $1->name) != 0)
  480. X          flags &= ~(DS_CHAR | DS_SHORT | DS_FLOAT);
  481. X!         new_symbol(typedef_names, $1->name, NULL, flags);
  482. X          free_declarator($1);
  483. X      }
  484. X***************
  485. X*** 205,209 ****
  486. X          if (strcmp($3->text, $3->name) != 0)
  487. X          flags &= ~(DS_CHAR | DS_SHORT | DS_FLOAT);
  488. X!         new_symbol(typedef_names, $3->name, flags);
  489. X          free_declarator($3);
  490. X      }
  491. X--- 208,212 ----
  492. X          if (strcmp($3->text, $3->name) != 0)
  493. X          flags &= ~(DS_CHAR | DS_SHORT | DS_FLOAT);
  494. X!         new_symbol(typedef_names, $3->name, NULL, flags);
  495. X          free_declarator($3);
  496. X      }
  497. X***************
  498. X*** 346,349 ****
  499. X--- 349,359 ----
  500. X          new_decl_spec(&$$, $1.text, $1.begin, DS_NONE);
  501. X      }
  502. X+     | T_TYPEDEF_NAME
  503. X+     {
  504. X+         Symbol *s;
  505. X+         s = find_symbol(typedef_names, $1.text);
  506. X+         if (s != NULL)
  507. X+         new_decl_spec(&$$, $1.text, $1.begin, s->flags);
  508. X+     }
  509. X      | struct_or_union_specifier
  510. X      | enum_specifier
  511. X***************
  512. X*** 355,367 ****
  513. X          new_decl_spec(&$$, $1.text, $1.begin, DS_NONE);
  514. X      }
  515. X!     | T_TYPEDEF_NAME
  516. X      {
  517. X!         /* A typedef name is actually a type specifier, but since the
  518. X!          * typedef symbol table also stores #define names, this production
  519. X!          * is here so the <pointer> nonterminal will scan #define names.
  520. X           */
  521. X          Symbol *s;
  522. X!         s = find_symbol(typedef_names, $1.text);
  523. X!         new_decl_spec(&$$, $1.text, $1.begin, s->flags);
  524. X      }
  525. X      ;
  526. X--- 365,377 ----
  527. X          new_decl_spec(&$$, $1.text, $1.begin, DS_NONE);
  528. X      }
  529. X!     | T_DEFINE_NAME
  530. X      {
  531. X!         /* This rule allows the <pointer> nonterminal to scan #define
  532. X!          * names as if they were type modifiers.
  533. X           */
  534. X          Symbol *s;
  535. X!         s = find_symbol(define_names, $1.text);
  536. X!         if (s != NULL)
  537. X!         new_decl_spec(&$$, $1.text, $1.begin, s->flags);
  538. X      }
  539. X      ;
  540. X***************
  541. X*** 665,669 ****
  542. X  %%
  543. X  
  544. X! #ifdef MSDOS
  545. X  #include "lex_yy.c"
  546. X  #else
  547. X--- 675,679 ----
  548. X  %%
  549. X  
  550. X! #if defined(MSDOS) || defined(OS2)
  551. X  #include "lex_yy.c"
  552. X  #else
  553. X***************
  554. X*** 688,692 ****
  555. X      static char *keywords[] = {
  556. X      "const", "volatile", "interrupt",
  557. X! #ifdef MSDOS
  558. X      "cdecl", "far", "huge", "near", "pascal",
  559. X      "_cdecl", "_export", "_far", "_fastcall", "_fortran", "_huge",
  560. X--- 698,702 ----
  561. X      static char *keywords[] = {
  562. X      "const", "volatile", "interrupt",
  563. X! #if defined(MSDOS) || defined(OS2)
  564. X      "cdecl", "far", "huge", "near", "pascal",
  565. X      "_cdecl", "_export", "_far", "_fastcall", "_fortran", "_huge",
  566. X***************
  567. X*** 696,700 ****
  568. X      "__inline", "__interrupt", "__loadds", "__near", "__pascal",
  569. X      "__saveregs", "__segment", "__stdcall", "__syscall",
  570. X!     "__cs", "__ds", "__es", "__ss", "__seg",
  571. X  #endif
  572. X      };
  573. X--- 706,714 ----
  574. X      "__inline", "__interrupt", "__loadds", "__near", "__pascal",
  575. X      "__saveregs", "__segment", "__stdcall", "__syscall",
  576. X! #ifdef OS2
  577. X!     "__far16",
  578. X! #endif
  579. X! #else
  580. X!     "__const", "__inline__",
  581. X  #endif
  582. X      };
  583. X***************
  584. X*** 704,708 ****
  585. X      type_qualifiers = new_symbol_table();
  586. X      for (i = 0; i < sizeof(keywords)/sizeof(keywords[0]); ++i) {
  587. X!     new_symbol(type_qualifiers, keywords[i], DS_NONE);
  588. X      }
  589. X  }
  590. X--- 718,722 ----
  591. X      type_qualifiers = new_symbol_table();
  592. X      for (i = 0; i < sizeof(keywords)/sizeof(keywords[0]); ++i) {
  593. X!     new_symbol(type_qualifiers, keywords[i], NULL, DS_NONE);
  594. X      }
  595. X  }
  596. X***************
  597. X*** 725,729 ****
  598. X          if (*s == 'l' || *s == 'y')
  599. X          BEGIN LEXYACC;
  600. X! #ifdef MSDOS
  601. X          if (*s == 'L' || *s == 'Y')
  602. X          BEGIN LEXYACC;
  603. X--- 739,743 ----
  604. X          if (*s == 'l' || *s == 'y')
  605. X          BEGIN LEXYACC;
  606. X! #if defined(MSDOS) || defined(OS2)
  607. X          if (*s == 'L' || *s == 'Y')
  608. X          BEGIN LEXYACC;
  609. X***************
  610. X*** 734,737 ****
  611. X--- 748,752 ----
  612. X      included_files = new_symbol_table();
  613. X      typedef_names = new_symbol_table();
  614. X+     define_names = new_symbol_table();
  615. X      inc_depth = -1;
  616. X      curly = 0;
  617. X***************
  618. X*** 740,746 ****
  619. X      yyin = infile;
  620. X      include_file(name, func_style != FUNC_NONE);
  621. X!     if (proto_comments)
  622. X      printf("/* %s */\n", cur_file_name());
  623. X      yyparse();
  624. X      free_symbol_table(typedef_names);
  625. X      free_symbol_table(included_files);
  626. X--- 755,762 ----
  627. X      yyin = infile;
  628. X      include_file(name, func_style != FUNC_NONE);
  629. X!     if (file_comments)
  630. X      printf("/* %s */\n", cur_file_name());
  631. X      yyparse();
  632. X+     free_symbol_table(define_names);
  633. X      free_symbol_table(typedef_names);
  634. X      free_symbol_table(included_files);
  635. Xdiff  -c2 old/lex.l new/lex.l
  636. X*** old/lex.l    Tue Dec 01 21:04:42 1992
  637. X--- new/lex.l    Tue May 25 21:36:16 1993
  638. X***************
  639. X*** 1,4 ****
  640. X  %{
  641. X! /* $Id: lex.l 3.9 1992/12/02 02:04:35 cthuang Exp $
  642. X   *
  643. X   * Lexical analyzer for C function prototype generator
  644. X--- 1,4 ----
  645. X  %{
  646. X! /* $Id: lex.l 3.10 1993/05/26 01:36:04 cthuang Exp $
  647. X   *
  648. X   * Lexical analyzer for C function prototype generator
  649. X***************
  650. X*** 34,38 ****
  651. X  DIGIT        [0-9]
  652. X  ID        {LETTER}({LETTER}|{DIGIT})*
  653. X! STRING        \"(\\\"|[^"])*\"
  654. X  QUOTED        ({STRING}|\'(\\\'|[^'\n])*\'|\\.)
  655. X  
  656. X--- 34,38 ----
  657. X  DIGIT        [0-9]
  658. X  ID        {LETTER}({LETTER}|{DIGIT})*
  659. X! STRING        \"(\\.|\\\n|[^"\\])*\"
  660. X  QUOTED        ({STRING}|\'(\\\'|[^'\n])*\'|\\.)
  661. X  
  662. X***************
  663. X*** 56,76 ****
  664. X  
  665. X  <CPP1>define{WS}+{ID}    {
  666. X!                 save_text();
  667. X!                 sscanf(yytext, "define %s", buf);
  668. X!                 get_cpp_directive();
  669. X!                 new_symbol(typedef_names, buf, DS_EXTERN);
  670. X!             }
  671. X  
  672. X- <CPP1>include{WS}*\"[^"]+\"     {
  673. X                  save_text();
  674. X!                 sscanf(yytext, "include \"%[^\"]\"", buf);
  675. X!                 get_cpp_directive();
  676. X!                 do_include(buf, FALSE);
  677. X              }
  678. X! <CPP1>include{WS}*\<[^>]+\>    {
  679. X                  save_text();
  680. X!                 sscanf(yytext, "include <%[^>]>", buf);
  681. X!                 get_cpp_directive();
  682. X!                 do_include(buf, TRUE);
  683. X              }
  684. X  
  685. X--- 56,81 ----
  686. X  
  687. X  <CPP1>define{WS}+{ID}    {
  688. X!                 char name[MAX_TEXT_SIZE], value[MAX_TEXT_SIZE];
  689. X  
  690. X                  save_text();
  691. X!                 sscanf(yytext, "define %s", name);
  692. X!                 get_cpp_directive(buf, sizeof(buf));
  693. X!                 sscanf(buf, "%s", value);
  694. X!                 new_symbol(define_names, name, value, DS_NONE);
  695. X              }
  696. X! 
  697. X! <CPP1>include{WS}*    {
  698. X                  save_text();
  699. X!                 get_cpp_directive(buf, sizeof(buf));
  700. X!                 if (buf[0] != '"' && buf[0] != '<') {
  701. X!                 Symbol *sym = find_symbol(define_names, buf);
  702. X!                 if (sym != NULL && sym->value != NULL) {
  703. X!                     strcpy(buf, sym->value);
  704. X!                 } else {
  705. X!                     buf[0] = '\0';
  706. X!                 }
  707. X!                 }
  708. X!                 if (buf[0] != '\0')
  709. X!                 do_include(buf);
  710. X              }
  711. X  
  712. X***************
  713. X*** 96,100 ****
  714. X              }
  715. X  
  716. X! <CPP1>.         { save_text(); get_cpp_directive(); }
  717. X  
  718. X  <INITIAL>"("        { save_text_offset(); return '('; }
  719. X--- 101,105 ----
  720. X              }
  721. X  
  722. X! <CPP1>.         { save_text(); get_cpp_directive(NULL, 0); }
  723. X  
  724. X  <INITIAL>"("        { save_text_offset(); return '('; }
  725. X***************
  726. X*** 156,159 ****
  727. X--- 161,166 ----
  728. X                  else if (find_symbol(typedef_names, yytext) != NULL)
  729. X                  return T_TYPEDEF_NAME;
  730. X+                 else if (find_symbol(define_names, yytext) != NULL)
  731. X+                 return T_DEFINE_NAME;
  732. X                  else
  733. X                  return T_IDENTIFIER;
  734. X***************
  735. X*** 290,302 ****
  736. X  }
  737. X  
  738. X! /* Scan rest of preprocessor directive.
  739. X   */
  740. X  static void
  741. X! get_cpp_directive ()
  742. X  {
  743. X-     static char cont_trigraph[] = { '?', '?', '/', '\0' };
  744. X      char c, lastc[4];
  745. X      
  746. X      lastc[0] = lastc[1] = lastc[2] = lastc[3] = '\0';
  747. X  
  748. X      while ((c = input()) != 0) {
  749. X--- 297,313 ----
  750. X  }
  751. X  
  752. X! /* Scan rest of preprocessor directive.  If <dest> is not NULL, then store
  753. X!  * the text in the buffer pointed to by <dest> having size <n>.
  754. X   */
  755. X  static void
  756. X! get_cpp_directive (dest, n)
  757. X! char *dest;        /* buffer to store directive text */
  758. X! unsigned n;        /* size of buffer to store directive text */
  759. X  {
  760. X      char c, lastc[4];
  761. X      
  762. X      lastc[0] = lastc[1] = lastc[2] = lastc[3] = '\0';
  763. X+     if (dest != NULL)
  764. X+     *dest = '\0';
  765. X  
  766. X      while ((c = input()) != 0) {
  767. X***************
  768. X*** 303,310 ****
  769. X      if (cur_file->convert)
  770. X          fputc(c, cur_file->tmp_file);
  771. X      switch (c) {
  772. X      case '\n':
  773. X          cur_file->line_num++;
  774. X!         if (lastc[2] != '\\' && strcmp(lastc, cont_trigraph) != 0) {
  775. X          BEGIN INITIAL;
  776. X          return;
  777. X--- 314,322 ----
  778. X      if (cur_file->convert)
  779. X          fputc(c, cur_file->tmp_file);
  780. X+ 
  781. X      switch (c) {
  782. X      case '\n':
  783. X          cur_file->line_num++;
  784. X!         if (lastc[2] != '\\' && strcmp(lastc, "?\?/") != 0) {
  785. X          BEGIN INITIAL;
  786. X          return;
  787. X***************
  788. X*** 319,322 ****
  789. X--- 331,340 ----
  790. X      lastc[1] = lastc[2];
  791. X      lastc[2] = c;
  792. X+ 
  793. X+     if (dest != NULL && n > 1) {
  794. X+         *dest++ = c;
  795. X+         *dest = '\0';
  796. X+         --n;
  797. X+     }
  798. X      }
  799. X  }
  800. X***************
  801. X*** 509,518 ****
  802. X   */
  803. X  static void
  804. X! do_include (filename, stdinc)
  805. X! char *filename;     /* file to include */
  806. X! boolean stdinc;     /* TRUE if file name specified with angle brackets */
  807. X  {
  808. X!     char path[MAX_TEXT_SIZE];
  809. X      int i;
  810. X      FILE *fp;
  811. X  
  812. X--- 527,538 ----
  813. X   */
  814. X  static void
  815. X! do_include (file_spec)
  816. X! char *file_spec;     /* path surrounded by "" or <> */
  817. X  {
  818. X!     int stdinc;     /* 1 = path surrounded by <> */
  819. X!     char file[MAX_TEXT_SIZE], path[MAX_TEXT_SIZE];
  820. X!     char match, *s;
  821. X      int i;
  822. X+     unsigned n;
  823. X      FILE *fp;
  824. X  
  825. X***************
  826. X*** 523,536 ****
  827. X      }
  828. X  
  829. X!     sprintf(path, stdinc ? "<%s>" : "\"%s\"", filename);
  830. X      if (find_symbol(included_files, path) != NULL)
  831. X      return;
  832. X!     new_symbol(included_files, path, 0);
  833. X  
  834. X      for (i = stdinc != 0; i < num_inc_dir; ++i) {
  835. X      if (strlen(inc_dir[i]) == 0) {
  836. X!         strcpy(path, filename);
  837. X      } else {
  838. X!         sprintf(path, "%s/%s", inc_dir[i], filename);
  839. X      }
  840. X      if ((fp = fopen(path, "r")) != NULL) {
  841. X--- 543,571 ----
  842. X      }
  843. X  
  844. X!     if (file_spec[0] == '"') {
  845. X!     match = '"';
  846. X!     stdinc = 0;
  847. X!     } else if (file_spec[0] == '<') {
  848. X!     match = '>';
  849. X!     stdinc = 1;
  850. X!     } else {
  851. X!     return;
  852. X!     }
  853. X!     s = strchr(file_spec+1, match);
  854. X!     n = (s != NULL) ? (unsigned)(s - file_spec - 1) : 0;
  855. X!     strncpy(file, file_spec+1, n);
  856. X!     file[n] = '\0';
  857. X! 
  858. X!     /* Do nothing if the file was already included. */
  859. X!     sprintf(path, stdinc ? "<%s>" : "\"%s\"", file);
  860. X      if (find_symbol(included_files, path) != NULL)
  861. X      return;
  862. X!     new_symbol(included_files, path, NULL, DS_NONE);
  863. X  
  864. X      for (i = stdinc != 0; i < num_inc_dir; ++i) {
  865. X      if (strlen(inc_dir[i]) == 0) {
  866. X!         strcpy(path, file);
  867. X      } else {
  868. X!         sprintf(path, "%s/%s", inc_dir[i], file);
  869. X      }
  870. X      if ((fp = fopen(path, "r")) != NULL) {
  871. X***************
  872. X*** 543,547 ****
  873. X      if (!quiet) {
  874. X      put_error();
  875. X!     fprintf(stderr, "cannot read file %s\n", filename);
  876. X      }
  877. X  }
  878. X--- 578,582 ----
  879. X      if (!quiet) {
  880. X      put_error();
  881. X!     fprintf(stderr, "cannot read file %s\n", file_spec);
  882. X      }
  883. X  }
  884. Xdiff  -c2 old/Makefile.bc new/Makefile.bc
  885. X*** old/Makefile.bc    Sat Nov 28 23:27:32 1992
  886. X--- new/Makefile.bc    Tue May 25 21:36:04 1993
  887. X***************
  888. X*** 1,3 ****
  889. X! # $Id: Makefile.bc 3.1 1992/03/03 10:45:53 cthuang Exp $
  890. X  #
  891. X  # Borland C++ makefile for C prototype generator
  892. X--- 1,3 ----
  893. X! # $Id: Makefile.bc 3.2 1993/05/26 01:34:15 cthuang Exp $
  894. X  #
  895. X  # Borland C++ makefile for C prototype generator
  896. X***************
  897. X*** 10,14 ****
  898. X  YACC = yacc
  899. X  CC = bcc
  900. X! CFLAGS = -mc $(DEFINES)
  901. X  LIBS = \bc\lib\wildargs.obj
  902. X  
  903. X--- 10,14 ----
  904. X  YACC = yacc
  905. X  CC = bcc
  906. X! CFLAGS = -mc $(DEFINES) -w-pin -w-pro
  907. X  LIBS = \bc\lib\wildargs.obj
  908. X  
  909. X***************
  910. X*** 50,65 ****
  911. X  
  912. X  shar:
  913. X-     rmcr $(DIST1) $(DIST2)
  914. X-     rmcr $(DIST3) $(DIST4)
  915. X      shar $(DIST1) $(DIST2) >cproto.sh1
  916. X      shar $(DIST3) $(DIST4) >cproto.sh2
  917. X  
  918. X- inscr:
  919. X-     inscr $(DIST1) $(DIST2)
  920. X-     inscr $(DIST3) $(DIST4)
  921. X- 
  922. X  # DO NOT DELETE THIS LINE -- make depend depends on it.
  923. X  
  924. X! cproto.obj: config.h cproto.h symbol.h
  925. X  popen.obj: config.h cproto.h
  926. X  semantic.obj: config.h cproto.h symbol.h semantic.h
  927. X--- 50,59 ----
  928. X  
  929. X  shar:
  930. X      shar $(DIST1) $(DIST2) >cproto.sh1
  931. X      shar $(DIST3) $(DIST4) >cproto.sh2
  932. X  
  933. X  # DO NOT DELETE THIS LINE -- make depend depends on it.
  934. X  
  935. X! cproto.obj: config.h cproto.h
  936. X  popen.obj: config.h cproto.h
  937. X  semantic.obj: config.h cproto.h symbol.h semantic.h
  938. Xdiff  -c2 old/Makefile.msc new/Makefile.msc
  939. X*** old/Makefile.msc    Sat Nov 28 23:27:36 1992
  940. X--- new/Makefile.msc    Tue May 25 21:36:12 1993
  941. X***************
  942. X*** 1,3 ****
  943. X! # $Id: Makefile.msc 3.4 1992/11/29 04:27:30 cthuang Exp $
  944. X  #
  945. X  # Microsoft C makefile for C prototype generator
  946. X--- 1,3 ----
  947. X! # $Id: Makefile.msc 3.5 1993/05/26 01:36:04 cthuang Exp $
  948. X  #
  949. X  # Microsoft C makefile for C prototype generator
  950. X***************
  951. X*** 51,66 ****
  952. X  
  953. X  shar:
  954. X-     rmcr $(DIST1) $(DIST2)
  955. X-     rmcr $(DIST3) $(DIST4)
  956. X      shar $(DIST1) $(DIST2) >cproto.sh1
  957. X      shar $(DIST3) $(DIST4) >cproto.sh2
  958. X  
  959. X- inscr:
  960. X-     inscr $(DIST1) $(DIST2)
  961. X-     inscr $(DIST3) $(DIST4)
  962. X- 
  963. X  # DO NOT DELETE THIS LINE -- make depend depends on it.
  964. X  
  965. X! cproto.obj: config.h cproto.h symbol.h
  966. X  popen.obj: config.h cproto.h
  967. X  semantic.obj: config.h cproto.h symbol.h semantic.h
  968. X--- 51,60 ----
  969. X  
  970. X  shar:
  971. X      shar $(DIST1) $(DIST2) >cproto.sh1
  972. X      shar $(DIST3) $(DIST4) >cproto.sh2
  973. X  
  974. X  # DO NOT DELETE THIS LINE -- make depend depends on it.
  975. X  
  976. X! cproto.obj: config.h cproto.h
  977. X  popen.obj: config.h cproto.h
  978. X  semantic.obj: config.h cproto.h symbol.h semantic.h
  979. Xdiff  -c2 old/Makefile.uni new/Makefile.uni
  980. X*** old/Makefile.uni    Sat Nov 28 23:27:36 1992
  981. X--- new/Makefile.uni    Tue May 25 21:36:12 1993
  982. X***************
  983. X*** 1,3 ****
  984. X! # $Id: Makefile.uni 3.5 1992/06/10 20:56:00 cthuang Exp $
  985. X  #
  986. X  # UNIX makefile for C prototype generator
  987. X--- 1,3 ----
  988. X! # $Id: Makefile.uni 3.6 1993/05/26 01:34:15 cthuang Exp $
  989. X  #
  990. X  # UNIX makefile for C prototype generator
  991. X***************
  992. X*** 47,51 ****
  993. X  # DO NOT DELETE THIS LINE -- make depend depends on it.
  994. X  
  995. X! cproto.o: config.h cproto.h symbol.h
  996. X  semantic.o: config.h cproto.h symbol.h semantic.h
  997. X  strstr.o: config.h
  998. X--- 47,51 ----
  999. X  # DO NOT DELETE THIS LINE -- make depend depends on it.
  1000. X  
  1001. X! cproto.o: config.h cproto.h
  1002. X  semantic.o: config.h cproto.h symbol.h semantic.h
  1003. X  strstr.o: config.h
  1004. Xdiff  -c2 old/patchlev.h new/patchlev.h
  1005. X*** old/patchlev.h    Tue Dec 01 09:52:28 1992
  1006. X--- new/patchlev.h    Wed Dec 02 21:16:22 1992
  1007. X***************
  1008. X*** 1 ****
  1009. X! #define PATCHLEVEL 6
  1010. X--- 1 ----
  1011. X! #define PATCHLEVEL 7
  1012. Xdiff  -c2 old/semantic.c new/semantic.c
  1013. X*** old/semantic.c    Sat Nov 28 23:27:56 1992
  1014. X--- new/semantic.c    Tue May 25 21:36:50 1993
  1015. X***************
  1016. X*** 1,3 ****
  1017. X! /* $Id: semantic.c 3.7 1992/11/29 04:27:49 cthuang Exp $
  1018. X   *
  1019. X   * Semantic actions executed by the parser of the
  1020. X--- 1,3 ----
  1021. X! /* $Id: semantic.c 3.8 1993/05/26 01:36:41 cthuang Exp $
  1022. X   *
  1023. X   * Semantic actions executed by the parser of the
  1024. X***************
  1025. X*** 519,524 ****
  1026. X      fputs(s, outf);
  1027. X  
  1028. X!     if (where == FUNC_PROTO && proto_style == PROTO_MACRO &&
  1029. X!      declarator == func_declarator) {
  1030. X      fprintf(outf, " %s(", macro_name);
  1031. X      }
  1032. X--- 519,523 ----
  1033. X      fputs(s, outf);
  1034. X  
  1035. X!     if (where == FUNC_PROTO && declarator == func_declarator && proto_macro) {
  1036. X      fprintf(outf, " %s(", macro_name);
  1037. X      }
  1038. X***************
  1039. X*** 529,534 ****
  1040. X      fputs(t, outf);
  1041. X  
  1042. X!     if (where == FUNC_PROTO && proto_style == PROTO_MACRO &&
  1043. X!      declarator == func_declarator) {
  1044. X      fputc(')', outf);
  1045. X      }
  1046. X--- 528,532 ----
  1047. X      fputs(t, outf);
  1048. X  
  1049. X!     if (where == FUNC_PROTO && declarator == func_declarator && proto_macro) {
  1050. X      fputc(')', outf);
  1051. X      }
  1052. X***************
  1053. X*** 608,616 ****
  1054. X  }
  1055. X  
  1056. X! /* Generate a prototype for a function that uses varargs by replacing the
  1057. X!  * "va_alist" parameter with an empty parameter list.
  1058. X   */
  1059. X! static void
  1060. X! check_varargs (declarator)
  1061. X  Declarator *declarator;
  1062. X  {
  1063. X--- 606,613 ----
  1064. X  }
  1065. X  
  1066. X! /* Return TRUE if the function uses varargs.
  1067. X   */
  1068. X! static int
  1069. X! uses_varargs (declarator)
  1070. X  Declarator *declarator;
  1071. X  {
  1072. X***************
  1073. X*** 617,626 ****
  1074. X      Parameter *p;
  1075. X  
  1076. X!     if ((p = declarator->params.first) != NULL && p->next == NULL &&
  1077. X!     strcmp(p->declarator->name, "va_alist") == 0)
  1078. X!     {
  1079. X!     free_param_list(&declarator->params);
  1080. X!     declarator->params.first = NULL;
  1081. X!     }
  1082. X  }
  1083. X  
  1084. X--- 614,619 ----
  1085. X      Parameter *p;
  1086. X  
  1087. X!     return (p = declarator->params.first) != NULL && p->next == NULL &&
  1088. X!     strcmp(p->declarator->name, "va_alist") == 0;
  1089. X  }
  1090. X  
  1091. X***************
  1092. X*** 673,678 ****
  1093. X  
  1094. X      func_declarator = declarator->head;
  1095. X      check_void_param(func_declarator);
  1096. X-     check_varargs(func_declarator);
  1097. X      set_param_decl_spec(func_declarator);
  1098. X  
  1099. X--- 666,678 ----
  1100. X  
  1101. X      func_declarator = declarator->head;
  1102. X+     if (uses_varargs(func_declarator)) {
  1103. X+     /* Generate a prototype for a function that uses varargs by replacing
  1104. X+      * the "va_alist" parameter with an empty parameter list.
  1105. X+      */
  1106. X+     free_param_list(&func_declarator->params);
  1107. X+     func_declarator->params.first = NULL;
  1108. X+     }
  1109. X+ 
  1110. X      check_void_param(func_declarator);
  1111. X      set_param_decl_spec(func_declarator);
  1112. X  
  1113. X***************
  1114. X*** 737,743 ****
  1115. X      int comment_len, n;
  1116. X  
  1117. X!     /* Do nothing if the function is already defined in the desired style. */
  1118. X      func_declarator = declarator->head;
  1119. X!     if (func_declarator->func_def == func_style)
  1120. X      return;
  1121. X  
  1122. X--- 737,746 ----
  1123. X      int comment_len, n;
  1124. X  
  1125. X!     /* Do nothing if the function is already defined in the desired style
  1126. X!      * or if the function uses varargs.
  1127. X!      */
  1128. X      func_declarator = declarator->head;
  1129. X!     if (func_declarator->func_def == func_style ||
  1130. X!     uses_varargs(func_declarator))
  1131. X      return;
  1132. X  
  1133. Xdiff  -c2 old/symbol.c new/symbol.c
  1134. X*** old/symbol.c    Sat Nov 28 23:28:00 1992
  1135. X--- new/symbol.c    Tue May 25 21:36:54 1993
  1136. X***************
  1137. X*** 1,3 ****
  1138. X! /* $Id: symbol.c 3.2 1992/11/29 04:27:49 cthuang Exp $
  1139. X   *
  1140. X   * Implements a symbol table abstract data type.
  1141. X--- 1,3 ----
  1142. X! /* $Id: symbol.c 3.3 1993/05/26 01:36:41 cthuang Exp $
  1143. X   *
  1144. X   * Implements a symbol table abstract data type.
  1145. X***************
  1146. X*** 39,42 ****
  1147. X--- 39,43 ----
  1148. X          next = sym->next;
  1149. X          free(sym->name);
  1150. X+         free(sym->value);
  1151. X          free(sym);
  1152. X          sym = next;
  1153. X***************
  1154. X*** 98,104 ****
  1155. X   */
  1156. X  Symbol *
  1157. X! new_symbol (symtab, name, flags)
  1158. X  SymbolTable *symtab;    /* symbol table */
  1159. X  char *name;        /* symbol name */
  1160. X  int flags;        /* symbol attributes */
  1161. X  {
  1162. X--- 99,106 ----
  1163. X   */
  1164. X  Symbol *
  1165. X! new_symbol (symtab, name, value, flags)
  1166. X  SymbolTable *symtab;    /* symbol table */
  1167. X  char *name;        /* symbol name */
  1168. X+ char *value;        /* symbol value */
  1169. X  int flags;        /* symbol attributes */
  1170. X  {
  1171. X***************
  1172. X*** 109,117 ****
  1173. X      sym = (Symbol *)xmalloc(sizeof(Symbol));
  1174. X      sym->name = xstrdup(name);
  1175. X-     sym->flags = flags;
  1176. X      i = hash(name);
  1177. X      sym->next = symtab->bucket[i];
  1178. X      symtab->bucket[i] = sym;
  1179. X      }
  1180. X      return sym;
  1181. X  }
  1182. X--- 111,122 ----
  1183. X      sym = (Symbol *)xmalloc(sizeof(Symbol));
  1184. X      sym->name = xstrdup(name);
  1185. X      i = hash(name);
  1186. X      sym->next = symtab->bucket[i];
  1187. X      symtab->bucket[i] = sym;
  1188. X+     } else {
  1189. X+     free(sym->value);
  1190. X      }
  1191. X+     sym->value = (value != NULL) ? xstrdup(value) : NULL;
  1192. X+     sym->flags = flags;
  1193. X      return sym;
  1194. X  }
  1195. Xdiff  -c2 old/symbol.h new/symbol.h
  1196. X*** old/symbol.h    Sat Nov 28 23:27:48 1992
  1197. X--- new/symbol.h    Tue May 25 21:36:40 1993
  1198. X***************
  1199. X*** 1,3 ****
  1200. X! /* $Id: symbol.h 3.3 1992/03/14 11:57:48 cthuang Exp $
  1201. X   *
  1202. X   * A symbol table is a collection of string identifiers stored in a
  1203. X--- 1,3 ----
  1204. X! /* $Id: symbol.h 3.4 1993/05/26 01:36:04 cthuang Exp $
  1205. X   *
  1206. X   * A symbol table is a collection of string identifiers stored in a
  1207. X***************
  1208. X*** 10,14 ****
  1209. X      struct symbol *next;    /* next symbol in list */
  1210. X      char *name;         /* name of symbol */
  1211. X!     unsigned short flags;    /* symbol attributes */
  1212. X  } Symbol;
  1213. X  
  1214. X--- 10,15 ----
  1215. X      struct symbol *next;    /* next symbol in list */
  1216. X      char *name;         /* name of symbol */
  1217. X!     char *value;        /* value of symbol (for defines) */
  1218. X!     short flags;        /* symbol attributes */
  1219. X  } Symbol;
  1220. X  
  1221. END_OF_patch7
  1222. if test 32109 -ne `wc -c <patch7`; then
  1223.     echo shar: \"patch7\" unpacked with wrong size!
  1224. fi
  1225. # end of overwriting check
  1226. fi
  1227. echo shar: End of shell archive.
  1228. exit 0
  1229.  
  1230. -- 
  1231. Chin Huang  cthuang%zerosan@canrem.com  chin.huang@canrem.com
  1232.  
  1233. exit 0 # Just in case...
  1234.