home *** CD-ROM | disk | FTP | other *** search
/ Source Code 1994 March / Source_Code_CD-ROM_Walnut_Creek_March_1994.iso / compsrcs / misc / volume30 / cproto / patch04 < prev    next >
Encoding:
Text File  |  1992-07-05  |  23.2 KB  |  905 lines

  1. Newsgroups: comp.sources.misc
  2. From: cthuang@zerosan.canrem.COM (Chin Huang)
  3. Subject:  v30i101:  cproto - generate C function prototypes v3, Patch04
  4. Message-ID: <1992Jul6.160802.8188@sparky.imd.sterling.com>
  5. X-Md4-Signature: 98af0bf02f7c6597644168294cb41080
  6. Date: Mon, 6 Jul 1992 16:08:02 GMT
  7. Approved: kent@sparky.imd.sterling.com
  8.  
  9. Submitted-by: cthuang@zerosan.canrem.COM (Chin Huang)
  10. Posting-number: Volume 30, Issue 101
  11. Archive-name: cproto/patch04
  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 4.  It fixes a bug in
  16. which formal parameters specified with typedef's where incorrectly
  17. promoted.  Read the CHANGES file for details.  Thanks to the following
  18. people for their suggestions and bug reports:
  19.  
  20. tony@ajfcal.cuc.ab.ca (Tony Field)
  21. DaviD W. Sanderson (dws@cs.wisc.edu)
  22.  
  23. #! /bin/sh
  24. # This is a shell archive.  Remove anything before this line, then unpack
  25. # it by saving it into a file and typing "sh file".  To overwrite existing
  26. # files, type "sh file -c".  You can also feed this as standard input via
  27. # unshar, or by typing "sh <file", e.g..  If this archive is complete, you
  28. # will see the following message at the end:
  29. #        "End of shell archive."
  30. # Contents:  patch4
  31. # Wrapped by cthuang@zerosan.UUCP on Fri Jul 03 16:10:53 1992
  32. PATH=/bin:/usr/bin:/usr/ucb ; export PATH
  33. if test -f patch4 -a "${1}" != "-c" ; then 
  34.   echo shar: Will not over-write existing file \"patch4\"
  35. else
  36. echo shar: Extracting \"patch4\" \(21100 characters\)
  37. sed "s/^X//" >patch4 <<'END_OF_patch4'
  38. Xdiff -c old/CHANGES new/CHANGES
  39. X*** old/CHANGES    Fri Jul 03 13:42:00 1992
  40. X--- new/CHANGES    Wed Jun 10 21:03:00 1992
  41. X***************
  42. X*** 1,5 ****
  43. X--- 1,29 ----
  44. X  Version 3
  45. X  
  46. X+ Patchlevel 4
  47. X+ 
  48. X+ - Fix: A typedef name defined as a pointer to char, short or float was
  49. X+   incorrectly promoted if it was used to specify a formal parameter.
  50. X+   For example, for the definition
  51. X+ 
  52. X+       typedef char *caddr_t;
  53. X+ 
  54. X+     int strlen (s)
  55. X+     caddr_t s;
  56. X+     {
  57. X+     }
  58. X+ 
  59. X+   cproto generated the incorrect prototype
  60. X+ 
  61. X+       int strlen(int s);
  62. X+ 
  63. X+ - Added implementation of the ANSI function tmpfile() for systems that
  64. X+   don't have it.
  65. X+ - If compiled with Microsoft C, cproto preprocesses its input by running
  66. X+   the command "cl /E".  To eliminate the error messages when the file
  67. X+   <malloc.h> is included, the program now recognizes the specifier
  68. X+   _based(void).
  69. X+ 
  70. X  Patchlevel 3
  71. X  
  72. X  - Fix: The program didn't generate prototypes for functions defined with
  73. Xdiff -c old/config.h new/config.h
  74. X*** old/config.h    Fri Jul 03 13:41:48 1992
  75. X--- new/config.h    Fri Jul 03 13:37:52 1992
  76. X***************
  77. X*** 1,8 ****
  78. X! /* $Id: config.h 3.3 92/04/04 13:59:06 cthuang Exp $
  79. X   *
  80. X   * cproto configuration and system dependencies
  81. X   */
  82. X  
  83. X  /* maximum include file nesting */
  84. X  #ifndef MAX_INC_DEPTH
  85. X  #define MAX_INC_DEPTH 15
  86. X--- 1,32 ----
  87. X! /* $Id: config.h 3.4 92/07/03 13:37:48 cthuang Exp $
  88. X   *
  89. X   * cproto configuration and system dependencies
  90. X   */
  91. X  
  92. X+ /* Borland C predefines __MSDOS__ */
  93. X+ #ifdef __MSDOS__
  94. X+ #ifndef MSDOS
  95. X+ #define MSDOS
  96. X+ #endif
  97. X+ #endif
  98. X+ 
  99. X+ /* Turbo C preprocessor */
  100. X+ #ifdef TURBO_CPP
  101. X+ #define CPP "cpp -P-"
  102. X+ #endif
  103. X+ 
  104. X+ /* Microsoft C preprocessor */
  105. X+ #ifdef M_I86
  106. X+ #define CPP "cl /E /nologo"
  107. X+ #endif
  108. X+ 
  109. X+ /* Default C preprocessor on UNIX systems */
  110. X+ #ifndef MSDOS
  111. X+ #ifndef CPP
  112. X+ #define CPP "/lib/cpp"
  113. X+ #endif
  114. X+ #endif
  115. X+ 
  116. X  /* maximum include file nesting */
  117. X  #ifndef MAX_INC_DEPTH
  118. X  #define MAX_INC_DEPTH 15
  119. X***************
  120. X*** 18,38 ****
  121. X  #define MAX_TEXT_SIZE 256
  122. X  #endif
  123. X  
  124. X! /* Borland C predefines __MSDOS__ */
  125. X! #ifdef __MSDOS__
  126. X! #ifndef MSDOS
  127. X! #define MSDOS
  128. X! #endif
  129. X! #endif
  130. X! 
  131. X! #ifdef MSDOS
  132. X! #include <malloc.h>
  133. X  #include <stdlib.h>
  134. X  #else
  135. X- extern char *malloc();
  136. X- extern char *getenv();
  137. X- #endif
  138. X- 
  139. X  #ifdef BSD
  140. X  #include <strings.h>
  141. X  #define strchr index
  142. X--- 42,51 ----
  143. X  #define MAX_TEXT_SIZE 256
  144. X  #endif
  145. X  
  146. X! #if defined(__STDC__) || defined(MSDOS)
  147. X  #include <stdlib.h>
  148. X+ #include <string.h>
  149. X  #else
  150. X  #ifdef BSD
  151. X  #include <strings.h>
  152. X  #define strchr index
  153. X***************
  154. X*** 40,57 ****
  155. X  #else
  156. X  #include <string.h>
  157. X  #endif
  158. X! 
  159. X! #ifndef MSDOS
  160. X! extern char *strstr();
  161. X! #endif
  162. X! 
  163. X! /* C preprocessor */
  164. X! #ifdef TURBO_CPP
  165. X! #define CPP "cpp -P-"
  166. X! #endif
  167. X! 
  168. X! #ifndef MSDOS
  169. X! #ifndef CPP
  170. X! #define CPP "/lib/cpp"
  171. X! #endif
  172. X  #endif
  173. X--- 53,57 ----
  174. X  #else
  175. X  #include <string.h>
  176. X  #endif
  177. X! extern char *getenv(), *malloc(), *strstr();
  178. X  #endif
  179. Xdiff -c old/cproto.1 new/cproto.1
  180. X*** old/cproto.1    Fri Jul 03 13:42:02 1992
  181. X--- new/cproto.1    Wed Jun 10 21:03:02 1992
  182. X***************
  183. X*** 1,4 ****
  184. X! .\" $Id: cproto.1 3.5 92/04/11 19:27:07 cthuang Exp $
  185. X  .\"
  186. X  .de EX        \"Begin example
  187. X  .ne 5
  188. X--- 1,4 ----
  189. X! .\" $Id: cproto.1 3.6 92/06/10 20:55:39 cthuang Exp $
  190. X  .\"
  191. X  .de EX        \"Begin example
  192. X  .ne 5
  193. X***************
  194. X*** 58,64 ****
  195. X  int argc;       /* number of arguments */
  196. X  char *argv[];   /* arguments */
  197. X  {
  198. X-  ...
  199. X  }
  200. X  .EE
  201. X  then the converted function definition will have the form
  202. X--- 58,63 ----
  203. X***************
  204. X*** 65,75 ****
  205. X  .EX
  206. X  int
  207. X  main (
  208. X!     int argc;       /* number of arguments */
  209. X!     char *argv[];   /* arguments */
  210. X  )
  211. X  {
  212. X-  ...
  213. X  }
  214. X  .EE
  215. X  Otherwise, the converted function definition will look like
  216. X--- 64,73 ----
  217. X  .EX
  218. X  int
  219. X  main (
  220. X!     int argc,       /* number of arguments */
  221. X!     char *argv[]   /* arguments */
  222. X  )
  223. X  {
  224. X  }
  225. X  .EE
  226. X  Otherwise, the converted function definition will look like
  227. X***************
  228. X*** 77,83 ****
  229. X  int
  230. X  main (int argc, char *argv[])
  231. X  {
  232. X-  ...
  233. X  }
  234. X  .EE
  235. X  .LP
  236. X--- 75,80 ----
  237. X***************
  238. X*** 108,114 ****
  239. X  int argc;
  240. X  char *argv[];
  241. X  {
  242. X-  ...
  243. X  }
  244. X  .EE
  245. X  If the value is 0, then no prototypes are generated.
  246. X--- 105,110 ----
  247. X***************
  248. X*** 199,207 ****
  249. X  will produce
  250. X  .EX
  251. X  int main(
  252. X!     int argc,
  253. X!     char *argv[]
  254. X!     )
  255. X  .EE
  256. X  .TP
  257. X  .BI \-D name\[=value\]
  258. X--- 195,203 ----
  259. X  will produce
  260. X  .EX
  261. X  int main(
  262. X!         int argc,
  263. X!         char *argv[]
  264. X!         )
  265. X  .EE
  266. X  .TP
  267. X  .BI \-D name\[=value\]
  268. Xdiff -c old/cproto.c new/cproto.c
  269. X*** old/cproto.c    Fri Jul 03 13:42:02 1992
  270. X--- new/cproto.c    Wed Jun 10 21:03:08 1992
  271. X***************
  272. X*** 1,9 ****
  273. X! /* $Id: cproto.c 3.5 92/04/11 19:28:01 cthuang Exp $
  274. X   *
  275. X   * C function prototype generator and function definition converter
  276. X   */
  277. X  #ifndef lint
  278. X! static char rcsid[] = "$Id: cproto.c 3.5 92/04/11 19:28:01 cthuang Exp $";
  279. X  #endif
  280. X  #include <stdio.h>
  281. X  #include <ctype.h>
  282. X--- 1,9 ----
  283. X! /* $Id: cproto.c 3.6 92/06/10 20:56:26 cthuang Exp $
  284. X   *
  285. X   * C function prototype generator and function definition converter
  286. X   */
  287. X  #ifndef lint
  288. X! static char rcsid[] = "$Id: cproto.c 3.6 92/06/10 20:56:26 cthuang Exp $";
  289. X  #endif
  290. X  #include <stdio.h>
  291. X  #include <ctype.h>
  292. X***************
  293. X*** 238,246 ****
  294. X      fputs("  -v       Output variable declarations\n", stderr);
  295. X      fputs("  -m name  Set name of prototype macro\n", stderr);
  296. X      fputs("  -d       Omit prototype macro definition\n", stderr);
  297. X!     fputs("  -P fmt   Set prototype format template \"int main (a, b)\"\n",
  298. X      stderr);
  299. X!     fputs("  -F fmt   Set function definition format template \"int main (a, b)\"\n",
  300. X      stderr);
  301. X      fputs("  -C fmt   Set format for function definition with parameter comments\n",
  302. X      stderr);
  303. X--- 238,246 ----
  304. X      fputs("  -v       Output variable declarations\n", stderr);
  305. X      fputs("  -m name  Set name of prototype macro\n", stderr);
  306. X      fputs("  -d       Omit prototype macro definition\n", stderr);
  307. X!     fputs("  -P fmt   Set prototype format template \" int main (a, b)\"\n",
  308. X      stderr);
  309. X!     fputs("  -F fmt   Set function definition format template \" int main (a, b)\"\n",
  310. X      stderr);
  311. X      fputs("  -C fmt   Set format for function definition with parameter comments\n",
  312. X      stderr);
  313. X***************
  314. X*** 469,475 ****
  315. X  #endif
  316. X          process_file(inf, argv[i]);
  317. X  #ifdef CPP
  318. X!         if (func_style == FUNC_NONE) {
  319. X          pclose(inf);
  320. X          } else {
  321. X          pop_file();
  322. X--- 469,475 ----
  323. X  #endif
  324. X          process_file(inf, argv[i]);
  325. X  #ifdef CPP
  326. X!         if (func_style == FUNC_NONE && cpp != NULL) {
  327. X          pclose(inf);
  328. X          } else {
  329. X          pop_file();
  330. Xdiff -c old/grammar.y new/grammar.y
  331. X*** old/grammar.y    Fri Jul 03 13:42:04 1992
  332. X--- new/grammar.y    Wed Jun 10 21:03:02 1992
  333. X***************
  334. X*** 1,4 ****
  335. X! /* $Id: grammar.y 3.5 92/04/11 19:27:34 cthuang Exp $
  336. X   *
  337. X   * yacc grammar for C function prototype generator
  338. X   * This was derived from the grammar in Appendix A of
  339. X--- 1,4 ----
  340. X! /* $Id: grammar.y 3.6 92/06/10 20:56:07 cthuang Exp $
  341. X   *
  342. X   * yacc grammar for C function prototype generator
  343. X   * This was derived from the grammar in Appendix A of
  344. X***************
  345. X*** 6,13 ****
  346. X   */
  347. X  
  348. X  %token <text> '(' '*'
  349. X- 
  350. X- %token
  351. X      /* identifiers that are not reserved words */
  352. X      T_IDENTIFIER T_TYPEDEF_NAME
  353. X  
  354. X--- 6,11 ----
  355. X***************
  356. X*** 24,37 ****
  357. X      /* type qualifiers */
  358. X      T_TYPE_QUALIFIER
  359. X  
  360. X      /* left brace */
  361. X      T_LBRACE
  362. X      /* all input to the matching right brace */
  363. X      T_MATCHRBRACE
  364. X  
  365. X-     /* paired square brackets and everything between them: [ ... ] */
  366. X-     T_BRACKETS
  367. X- 
  368. X      /* three periods */
  369. X      T_ELLIPSIS
  370. X  
  371. X--- 22,36 ----
  372. X      /* type qualifiers */
  373. X      T_TYPE_QUALIFIER
  374. X  
  375. X+     /* paired square brackets and everything between them: [ ... ] */
  376. X+     T_BRACKETS
  377. X+ 
  378. X+ %token
  379. X      /* left brace */
  380. X      T_LBRACE
  381. X      /* all input to the matching right brace */
  382. X      T_MATCHRBRACE
  383. X  
  384. X      /* three periods */
  385. X      T_ELLIPSIS
  386. X  
  387. X***************
  388. X*** 55,69 ****
  389. X  %type <param_list> parameter_type_list parameter_list
  390. X  %type <parameter> parameter_declaration
  391. X  %type <param_list> opt_identifier_list identifier_list
  392. X! %type <text>
  393. X!     struct_or_union pointer opt_type_qualifiers type_qualifier_list any_id
  394. X!     T_BRACKETS
  395. X!     T_IDENTIFIER T_TYPEDEF_NAME
  396. X!     T_AUTO T_EXTERN T_REGISTER T_STATIC T_TYPEDEF T_INLINE
  397. X!     T_CHAR T_DOUBLE T_FLOAT T_INT T_VOID T_LONG T_SHORT T_SIGNED T_UNSIGNED
  398. X!     T_ENUM T_STRUCT T_UNION
  399. X!     T_TYPE_QUALIFIER
  400. X!     '(' '*'
  401. X  
  402. X  %{
  403. X  #include <stdio.h>
  404. X--- 54,61 ----
  405. X  %type <param_list> parameter_type_list parameter_list
  406. X  %type <parameter> parameter_declaration
  407. X  %type <param_list> opt_identifier_list identifier_list
  408. X! %type <text> struct_or_union pointer opt_type_qualifiers type_qualifier_list
  409. X!     any_id
  410. X  
  411. X  %{
  412. X  #include <stdio.h>
  413. X***************
  414. X*** 112,118 ****
  415. X      | linkage_specification
  416. X      | T_ASM T_ASMARG ';'
  417. X      | error ';'
  418. X!     | error braces
  419. X      ;
  420. X  
  421. X  braces
  422. X--- 104,116 ----
  423. X      | linkage_specification
  424. X      | T_ASM T_ASMARG ';'
  425. X      | error ';'
  426. X!     {
  427. X!         yyerrok;
  428. X!     }
  429. X!     | error T_MATCHRBRACE
  430. X!     {
  431. X!         yyerrok;
  432. X!     }
  433. X      ;
  434. X  
  435. X  braces
  436. X***************
  437. X*** 156,167 ****
  438. X  declarator_list
  439. X      : declarator
  440. X      {
  441. X!         new_symbol(typedef_names, $1->name, cur_decl_spec_flags);
  442. X          free_declarator($1);
  443. X      }
  444. X      | declarator_list ',' declarator
  445. X      {
  446. X!         new_symbol(typedef_names, $3->name, cur_decl_spec_flags);
  447. X          free_declarator($3);
  448. X      }
  449. X      ;
  450. X--- 154,176 ----
  451. X  declarator_list
  452. X      : declarator
  453. X      {
  454. X!         int flags = cur_decl_spec_flags;
  455. X! 
  456. X!         /* If the typedef is a pointer type, then reset the short type
  457. X!          * flags so it does not get promoted.
  458. X!          */
  459. X!         if (strcmp($1->text, $1->name) != 0)
  460. X!         flags &= ~(DS_CHAR | DS_SHORT | DS_FLOAT);
  461. X!         new_symbol(typedef_names, $1->name, flags);
  462. X          free_declarator($1);
  463. X      }
  464. X      | declarator_list ',' declarator
  465. X      {
  466. X!         int flags = cur_decl_spec_flags;
  467. X! 
  468. X!         if (strcmp($3->text, $3->name) != 0)
  469. X!         flags &= ~(DS_CHAR | DS_SHORT | DS_FLOAT);
  470. X!         new_symbol(typedef_names, $3->name, flags);
  471. X          free_declarator($3);
  472. X      }
  473. X      ;
  474. X***************
  475. X*** 474,486 ****
  476. X  type_qualifier_list
  477. X      : type_qualifier
  478. X      {
  479. X!         strcpy($$.text, $1.text);
  480. X          $$.begin = $1.begin;
  481. X          free($1.text);
  482. X      }
  483. X      | type_qualifier_list type_qualifier
  484. X      {
  485. X!         sprintf($$.text, "%s %s ", $1.text, $2.text);
  486. X          $$.begin = $1.begin;
  487. X          free($2.text);
  488. X      }
  489. X--- 483,495 ----
  490. X  type_qualifier_list
  491. X      : type_qualifier
  492. X      {
  493. X!         sprintf($$.text, "%s ", $1.text);
  494. X          $$.begin = $1.begin;
  495. X          free($1.text);
  496. X      }
  497. X      | type_qualifier_list type_qualifier
  498. X      {
  499. X!         sprintf($$.text, "%s%s ", $1.text, $2.text);
  500. X          $$.begin = $1.begin;
  501. X          free($2.text);
  502. X      }
  503. Xdiff -c old/lex.l new/lex.l
  504. X*** old/lex.l    Fri Jul 03 13:42:04 1992
  505. X--- new/lex.l    Wed Jun 10 21:03:02 1992
  506. X***************
  507. X*** 1,5 ****
  508. X  %{
  509. X! /* $Id: lex.l 3.6 92/04/11 19:27:25 cthuang Exp $
  510. X   *
  511. X   * Lexical analyzer for C function prototype generator
  512. X   */
  513. X--- 1,5 ----
  514. X  %{
  515. X! /* $Id: lex.l 3.7 92/06/10 20:56:04 cthuang Exp $
  516. X   *
  517. X   * Lexical analyzer for C function prototype generator
  518. X   */
  519. X***************
  520. X*** 83,92 ****
  521. X                  do_include(buf, TRUE);
  522. X              }
  523. X  
  524. X  <CPP1>[0-9]+{WS}+\".*$  {
  525. X                  save_text();
  526. X                  sscanf(yytext, "%d \"%[^\"]\"", &cur_file->line_num,
  527. X!                 cur_file->file_name);
  528. X                  cur_file->line_num--;
  529. X                  BEGIN INITIAL;
  530. X              }
  531. X--- 83,99 ----
  532. X                  do_include(buf, TRUE);
  533. X              }
  534. X  
  535. X+ <CPP1>line{WS}+[0-9]+{WS}+\".*$  {
  536. X+                 save_text();
  537. X+                 sscanf(yytext, "line %d \"%[^\"]\"",
  538. X+                  &cur_file->line_num, cur_file->file_name);
  539. X+                 cur_file->line_num--;
  540. X+                 BEGIN INITIAL;
  541. X+             }
  542. X  <CPP1>[0-9]+{WS}+\".*$  {
  543. X                  save_text();
  544. X                  sscanf(yytext, "%d \"%[^\"]\"", &cur_file->line_num,
  545. X!                  cur_file->file_name);
  546. X                  cur_file->line_num--;
  547. X                  BEGIN INITIAL;
  548. X              }
  549. X***************
  550. X*** 124,129 ****
  551. X--- 131,138 ----
  552. X  <ASM>")"        { save_text(); BEGIN INITIAL; return T_ASMARG; }
  553. X  <ASM>{QUOTED}|.     save_text();
  554. X  
  555. X+ <INITIAL>_based[^(]*\([^)]*\)    { save_text_offset(); return T_TYPE_QUALIFIER; }
  556. X+ 
  557. X  <INITIAL>auto        { save_text_offset(); return T_AUTO; }
  558. X  <INITIAL>extern     { save_text_offset(); return T_EXTERN; }
  559. X  <INITIAL>register    { save_text_offset(); return T_REGISTER; }
  560. X***************
  561. X*** 333,338 ****
  562. X--- 342,385 ----
  563. X  {
  564. X      return cur_file->begin_comment;
  565. X  }
  566. X+ 
  567. X+ #ifdef NEED_tmpfile
  568. X+ /*
  569. X+  * tmpfile() - return a FILE* for a temporary file that will be
  570. X+  * removed automatically when the program exits.
  571. X+  * 
  572. X+  * Not all systems have the ANSI tmpfile() function yet...
  573. X+  *
  574. X+  * DaviD W. Sanderson (dws@cs.wisc.edu)
  575. X+  */
  576. X+ FILE *
  577. X+ tmpfile ()
  578. X+ {
  579. X+     char name[1024];
  580. X+     char *tmpdir;
  581. X+     FILE *f;
  582. X+ 
  583. X+     if ((tmpdir = getenv("TMPDIR")) == (char *)0)
  584. X+     {
  585. X+     tmpdir = "/tmp";
  586. X+     }
  587. X+     sprintf(name, "%s/TfXXXXXX", tmpdir);
  588. X+     mktemp(name);
  589. X+ 
  590. X+     if ((f = fopen(name, "w+")) == (FILE *)0)
  591. X+     {
  592. X+     return (FILE *)0;
  593. X+     }
  594. X+ 
  595. X+     if (unlink(name) == -1)
  596. X+     {
  597. X+     fclose(f);
  598. X+     return (FILE *)0;
  599. X+     }
  600. X+ 
  601. X+     return f;
  602. X+ }
  603. X+ #endif /* NEED_tmpfile */
  604. X  
  605. X  /* Push a file onto the include stack.    The stream yyin must already
  606. X   * point to the file.
  607. Xdiff -c old/Makefile.msc new/Makefile.msc
  608. X*** old/Makefile.msc    Fri Jul 03 13:41:44 1992
  609. X--- new/Makefile.msc    Wed Jun 10 21:03:02 1992
  610. X***************
  611. X*** 1,4 ****
  612. X! # $Id: makefile.msc 3.2 92/03/14 11:56:40 cthuang Exp $
  613. X  #
  614. X  # Microsoft C makefile for C prototype generator
  615. X  
  616. X--- 1,4 ----
  617. X! # $Id: makefile.msc 3.3 92/06/10 20:55:56 cthuang Exp $
  618. X  #
  619. X  # Microsoft C makefile for C prototype generator
  620. X  
  621. X***************
  622. X*** 18,29 ****
  623. X  DIST3 = config.h cproto.h patchlev.h semantic.h symbol.h
  624. X  DIST4 = cproto.c popen.c semantic.c strstr.c symbol.c
  625. X  
  626. X! OBJECTS = cproto.obj getopt.obj semantic.obj symbol.obj y_tab.obj
  627. X  
  628. X  all: cproto.exe
  629. X  
  630. X  cproto.exe: $(OBJECTS)
  631. X!     $(CC) $(CFLAGS) -Fe$*.exe $(OBJECTS) $(LIBS) $(LDFLAGS)
  632. X  
  633. X  y_tab.obj: y_tab.c lex_yy.c config.h cproto.h symbol.h semantic.h
  634. X      $(CC) $(CFLAGS) -c $*.c
  635. X--- 18,29 ----
  636. X  DIST3 = config.h cproto.h patchlev.h semantic.h symbol.h
  637. X  DIST4 = cproto.c popen.c semantic.c strstr.c symbol.c
  638. X  
  639. X! OBJECTS = cproto.obj getopt.obj semantic.obj symbol.obj y_tab.obj popen.obj
  640. X  
  641. X  all: cproto.exe
  642. X  
  643. X  cproto.exe: $(OBJECTS)
  644. X!     $(CC) $(CFLAGS) $(OBJECTS) $(LIBS) $(LDFLAGS)
  645. X  
  646. X  y_tab.obj: y_tab.c lex_yy.c config.h cproto.h symbol.h semantic.h
  647. X      $(CC) $(CFLAGS) -c $*.c
  648. Xdiff -c old/Makefile.uni new/Makefile.uni
  649. X*** old/Makefile.uni    Fri Jul 03 13:42:04 1992
  650. X--- new/Makefile.uni    Wed Jun 10 21:03:02 1992
  651. X***************
  652. X*** 1,8 ****
  653. X! # $Id: makefile.uni 3.4 92/04/11 19:27:21 cthuang Exp $
  654. X  #
  655. X  # UNIX makefile for C prototype generator
  656. X  
  657. X  # Define BSD for BSD, otherwise System V is assumed.
  658. X  #DEFINES = -DBSD
  659. X  
  660. X  LEX = lex
  661. X--- 1,9 ----
  662. X! # $Id: makefile.uni 3.5 92/06/10 20:56:00 cthuang Exp $
  663. X  #
  664. X  # UNIX makefile for C prototype generator
  665. X  
  666. X  # Define BSD for BSD, otherwise System V is assumed.
  667. X+ # Define NEED_tmpfile if your system does not have the ANSI function tmpfile()
  668. X  #DEFINES = -DBSD
  669. X  
  670. X  LEX = lex
  671. Xdiff -c old/patchlev.h new/patchlev.h
  672. X*** old/patchlev.h    Fri Jul 03 13:42:04 1992
  673. X--- new/patchlev.h    Wed Jun 10 21:03:08 1992
  674. X***************
  675. X*** 1,1 ****
  676. X! #define PATCHLEVEL 3
  677. X--- 1,1 ----
  678. X! #define PATCHLEVEL 4
  679. Xdiff -c old/popen.c new/popen.c
  680. X*** old/popen.c    Fri Jul 03 13:41:48 1992
  681. X--- new/popen.c    Wed Jun 10 21:03:08 1992
  682. X***************
  683. X*** 1,4 ****
  684. X! /* $Id: popen.c 3.2 92/03/14 11:58:07 cthuang Exp $
  685. X   *
  686. X   * Imitate a UNIX pipe in MS-DOS.
  687. X   */
  688. X--- 1,4 ----
  689. X! /* $Id: popen.c 3.3 92/06/10 20:56:30 cthuang Exp $
  690. X   *
  691. X   * Imitate a UNIX pipe in MS-DOS.
  692. X   */
  693. X***************
  694. X*** 34,53 ****
  695. X      arg = argv;
  696. X      s = strtok(cmdline, " ");
  697. X      *arg++ = s;
  698. X! #ifdef M_I86
  699. X!     sprintf(opt, "-o%s.", pipe_name);
  700. X! #else
  701. X      sprintf(opt, "-o%s", pipe_name);
  702. X- #endif
  703. X      *arg++ = opt;
  704. X      while ((s = strtok(NULL, " ")) != NULL) {
  705. X      *arg++ = s;
  706. X      }
  707. X      *arg = NULL;
  708. X   
  709. X!     /* Redirect the program's stdout to /dev/null. */
  710. X      ostdout = dup(fileno(stdout));
  711. X      freopen("nul", "w", stdout);
  712. X   
  713. X      /* Run the program. */
  714. X      status = spawnvp(P_WAIT, argv[0], argv);
  715. X--- 34,55 ----
  716. X      arg = argv;
  717. X      s = strtok(cmdline, " ");
  718. X      *arg++ = s;
  719. X! #ifdef TURBO_CPP
  720. X      sprintf(opt, "-o%s", pipe_name);
  721. X      *arg++ = opt;
  722. X+ #endif
  723. X      while ((s = strtok(NULL, " ")) != NULL) {
  724. X      *arg++ = s;
  725. X      }
  726. X      *arg = NULL;
  727. X   
  728. X!     /* Redirect the program's stdout. */
  729. X      ostdout = dup(fileno(stdout));
  730. X+ #ifdef TURBO_CPP
  731. X      freopen("nul", "w", stdout);
  732. X+ #else
  733. X+     freopen(pipe_name, "w", stdout);
  734. X+ #endif
  735. X   
  736. X      /* Run the program. */
  737. X      status = spawnvp(P_WAIT, argv[0], argv);
  738. Xdiff -c old/semantic.c new/semantic.c
  739. X*** old/semantic.c    Fri Jul 03 13:42:06 1992
  740. X--- new/semantic.c    Wed Jun 10 21:03:08 1992
  741. X***************
  742. X*** 1,4 ****
  743. X! /* $Id: semantic.c 3.5 92/04/11 19:28:08 cthuang Exp $
  744. X   *
  745. X   * Semantic actions executed by the parser of the
  746. X   * C function prototype generator.
  747. X--- 1,4 ----
  748. X! /* $Id: semantic.c 3.6 92/06/10 20:56:35 cthuang Exp $
  749. X   *
  750. X   * Semantic actions executed by the parser of the
  751. X   * C function prototype generator.
  752. X***************
  753. X*** 197,208 ****
  754. X  
  755. X  /* Return TRUE if the parameter is void.
  756. X   */
  757. X! boolean
  758. X  is_void_parameter (p)
  759. X  Parameter *p;
  760. X  {
  761. X      return p == NULL || (strcmp(p->decl_spec.text, "void") == 0 &&
  762. X!     strlen(p->declarator->text) == 0);
  763. X  }
  764. X  
  765. X  /* Initialize a list of function parameters.
  766. X--- 197,208 ----
  767. X  
  768. X  /* Return TRUE if the parameter is void.
  769. X   */
  770. X! static boolean
  771. X  is_void_parameter (p)
  772. X  Parameter *p;
  773. X  {
  774. X      return p == NULL || (strcmp(p->decl_spec.text, "void") == 0 &&
  775. X!      p->declarator->text[0] == '\0');
  776. X  }
  777. X  
  778. X  /* Initialize a list of function parameters.
  779. X***************
  780. X*** 333,340 ****
  781. X  
  782. X      for (d = declarators->first; d != NULL; d = d->next) {
  783. X      /* Search the parameter list for a matching name. */
  784. X!     p = search_parameter_list(params, d->name);
  785. X!     if (p == NULL) {
  786. X          put_error();
  787. X          fprintf(stderr, "declared argument \"%s\" is missing\n", d->name);
  788. X      } else {
  789. X--- 333,339 ----
  790. X  
  791. X      for (d = declarators->first; d != NULL; d = d->next) {
  792. X      /* Search the parameter list for a matching name. */
  793. X!     if ((p = search_parameter_list(params, d->name)) == NULL) {
  794. X          put_error();
  795. X          fprintf(stderr, "declared argument \"%s\" is missing\n", d->name);
  796. X      } else {
  797. X***************
  798. X*** 364,370 ****
  799. X  Parameter *p;
  800. X  {
  801. X      fputs(p->decl_spec.text, outf);
  802. X!     if (strlen(p->declarator->text) > 0) {
  803. X      if (strcmp(p->declarator->text, "...") != 0) {
  804. X          if (proto_style != PROTO_ABSTRACT || proto_comments ||
  805. X           where != FUNC_PROTO ||
  806. X--- 363,369 ----
  807. X  Parameter *p;
  808. X  {
  809. X      fputs(p->decl_spec.text, outf);
  810. X!     if (p->declarator->text[0] != '\0') {
  811. X      if (strcmp(p->declarator->text, "...") != 0) {
  812. X          if (proto_style != PROTO_ABSTRACT || proto_comments ||
  813. X           where != FUNC_PROTO ||
  814. X***************
  815. X*** 478,484 ****
  816. X      if (declarator->func_stack->func_def == FUNC_NONE) {
  817. X  
  818. X      decl_text = declarator->func_stack->text;
  819. X!     if (strlen(declarator->name) == 0) {
  820. X          fputs(decl_text, outf);
  821. X      } else {
  822. X  
  823. X--- 477,483 ----
  824. X      if (declarator->func_stack->func_def == FUNC_NONE) {
  825. X  
  826. X      decl_text = declarator->func_stack->text;
  827. X!     if (declarator->name[0] == '\0') {
  828. X          fputs(decl_text, outf);
  829. X      } else {
  830. X  
  831. X***************
  832. X*** 551,557 ****
  833. X  
  834. X      if (declarator->func_def == FUNC_NONE) {
  835. X      if (where == FUNC_PROTO && proto_style == PROTO_ABSTRACT &&
  836. X!      strlen(declarator->name) > 0) {
  837. X          if ((s = strstr(declarator->text, declarator->name)) == NULL)
  838. X          return;
  839. X          *s = '\0';
  840. X--- 550,556 ----
  841. X  
  842. X      if (declarator->func_def == FUNC_NONE) {
  843. X      if (where == FUNC_PROTO && proto_style == PROTO_ABSTRACT &&
  844. X!      declarator->name[0] != '\0') {
  845. X          if ((s = strstr(declarator->text, declarator->name)) == NULL)
  846. X          return;
  847. X          *s = '\0';
  848. X***************
  849. X*** 625,632 ****
  850. X      Parameter *p;
  851. X  
  852. X      for (p = declarator->params.first; p != NULL; p = p->next) {
  853. X!     if (strlen(p->decl_spec.text) == 0 &&
  854. X!         strcmp(p->declarator->text, "...") != 0) {
  855. X          free(p->decl_spec.text);
  856. X          p->decl_spec.text = xstrdup("int");
  857. X      }
  858. X--- 624,631 ----
  859. X      Parameter *p;
  860. X  
  861. X      for (p = declarator->params.first; p != NULL; p = p->next) {
  862. X!     if (p->decl_spec.text[0] == '\0' &&
  863. X!      strcmp(p->declarator->text, "...") != 0) {
  864. X          free(p->decl_spec.text);
  865. X          p->decl_spec.text = xstrdup("int");
  866. X      }
  867. Xdiff -c old/semantic.h new/semantic.h
  868. X*** old/semantic.h    Fri Jul 03 13:41:48 1992
  869. X--- new/semantic.h    Wed Jun 10 21:03:08 1992
  870. X***************
  871. X*** 1,4 ****
  872. X! /* $Id: semantic.h 3.2 92/03/06 00:54:38 cthuang Exp $
  873. X   *
  874. X   * Declarations of semantic action routines
  875. X   */
  876. X--- 1,4 ----
  877. X! /* $Id: semantic.h 3.3 92/06/10 20:56:19 cthuang Exp $
  878. X   *
  879. X   * Declarations of semantic action routines
  880. X   */
  881. X***************
  882. X*** 25,32 ****
  883. X      Parameter *param, DeclSpec *decl_spec, Declarator *declarator*/);
  884. X  extern void free_parameter(/*
  885. X      Parameter *param*/);
  886. X- extern boolean is_void_parameter(/*
  887. X-     Parameter *p*/);
  888. X  extern void new_param_list(/*
  889. X      ParameterList *param_list, Parameter *param*/);
  890. X  extern void free_param_list(/*
  891. X--- 25,30 ----
  892. END_OF_patch4
  893. if test 21100 -ne `wc -c <patch4`; then
  894.     echo shar: \"patch4\" unpacked with wrong size!
  895. fi
  896. # end of overwriting check
  897. fi
  898. echo shar: End of shell archive.
  899. exit 0
  900.  
  901. -- 
  902. Chin Huang  cthuang@zerosan.UUCP  chin.huang@canrem.com
  903.  
  904. exit 0 # Just in case...
  905.