home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.sources.misc
- From: cthuang@zerosan.canrem.COM (Chin Huang)
- Subject: v30i101: cproto - generate C function prototypes v3, Patch04
- Message-ID: <1992Jul6.160802.8188@sparky.imd.sterling.com>
- X-Md4-Signature: 98af0bf02f7c6597644168294cb41080
- Date: Mon, 6 Jul 1992 16:08:02 GMT
- Approved: kent@sparky.imd.sterling.com
-
- Submitted-by: cthuang@zerosan.canrem.COM (Chin Huang)
- Posting-number: Volume 30, Issue 101
- Archive-name: cproto/patch04
- Environment: UNIX, MS-DOS, getopt, lex, yacc
- Patch-To: cproto: Volume 29, Issue 61-62
-
- This patch brings cproto to version 3 patchlevel 4. It fixes a bug in
- which formal parameters specified with typedef's where incorrectly
- promoted. Read the CHANGES file for details. Thanks to the following
- people for their suggestions and bug reports:
-
- tony@ajfcal.cuc.ab.ca (Tony Field)
- DaviD W. Sanderson (dws@cs.wisc.edu)
-
- #! /bin/sh
- # This is a shell archive. Remove anything before this line, then unpack
- # it by saving it into a file and typing "sh file". To overwrite existing
- # files, type "sh file -c". You can also feed this as standard input via
- # unshar, or by typing "sh <file", e.g.. If this archive is complete, you
- # will see the following message at the end:
- # "End of shell archive."
- # Contents: patch4
- # Wrapped by cthuang@zerosan.UUCP on Fri Jul 03 16:10:53 1992
- PATH=/bin:/usr/bin:/usr/ucb ; export PATH
- if test -f patch4 -a "${1}" != "-c" ; then
- echo shar: Will not over-write existing file \"patch4\"
- else
- echo shar: Extracting \"patch4\" \(21100 characters\)
- sed "s/^X//" >patch4 <<'END_OF_patch4'
- Xdiff -c old/CHANGES new/CHANGES
- X*** old/CHANGES Fri Jul 03 13:42:00 1992
- X--- new/CHANGES Wed Jun 10 21:03:00 1992
- X***************
- X*** 1,5 ****
- X--- 1,29 ----
- X Version 3
- X
- X+ Patchlevel 4
- X+
- X+ - Fix: A typedef name defined as a pointer to char, short or float was
- X+ incorrectly promoted if it was used to specify a formal parameter.
- X+ For example, for the definition
- X+
- X+ typedef char *caddr_t;
- X+
- X+ int strlen (s)
- X+ caddr_t s;
- X+ {
- X+ }
- X+
- X+ cproto generated the incorrect prototype
- X+
- X+ int strlen(int s);
- X+
- X+ - Added implementation of the ANSI function tmpfile() for systems that
- X+ don't have it.
- X+ - If compiled with Microsoft C, cproto preprocesses its input by running
- X+ the command "cl /E". To eliminate the error messages when the file
- X+ <malloc.h> is included, the program now recognizes the specifier
- X+ _based(void).
- X+
- X Patchlevel 3
- X
- X - Fix: The program didn't generate prototypes for functions defined with
- Xdiff -c old/config.h new/config.h
- X*** old/config.h Fri Jul 03 13:41:48 1992
- X--- new/config.h Fri Jul 03 13:37:52 1992
- X***************
- X*** 1,8 ****
- X! /* $Id: config.h 3.3 92/04/04 13:59:06 cthuang Exp $
- X *
- X * cproto configuration and system dependencies
- X */
- X
- X /* maximum include file nesting */
- X #ifndef MAX_INC_DEPTH
- X #define MAX_INC_DEPTH 15
- X--- 1,32 ----
- X! /* $Id: config.h 3.4 92/07/03 13:37:48 cthuang Exp $
- X *
- X * cproto configuration and system dependencies
- X */
- X
- X+ /* Borland C predefines __MSDOS__ */
- X+ #ifdef __MSDOS__
- X+ #ifndef MSDOS
- X+ #define MSDOS
- X+ #endif
- X+ #endif
- X+
- X+ /* Turbo C preprocessor */
- X+ #ifdef TURBO_CPP
- X+ #define CPP "cpp -P-"
- X+ #endif
- X+
- X+ /* Microsoft C preprocessor */
- X+ #ifdef M_I86
- X+ #define CPP "cl /E /nologo"
- X+ #endif
- X+
- X+ /* Default C preprocessor on UNIX systems */
- X+ #ifndef MSDOS
- X+ #ifndef CPP
- X+ #define CPP "/lib/cpp"
- X+ #endif
- X+ #endif
- X+
- X /* maximum include file nesting */
- X #ifndef MAX_INC_DEPTH
- X #define MAX_INC_DEPTH 15
- X***************
- X*** 18,38 ****
- X #define MAX_TEXT_SIZE 256
- X #endif
- X
- X! /* Borland C predefines __MSDOS__ */
- X! #ifdef __MSDOS__
- X! #ifndef MSDOS
- X! #define MSDOS
- X! #endif
- X! #endif
- X!
- X! #ifdef MSDOS
- X! #include <malloc.h>
- X #include <stdlib.h>
- X #else
- X- extern char *malloc();
- X- extern char *getenv();
- X- #endif
- X-
- X #ifdef BSD
- X #include <strings.h>
- X #define strchr index
- X--- 42,51 ----
- X #define MAX_TEXT_SIZE 256
- X #endif
- X
- X! #if defined(__STDC__) || defined(MSDOS)
- X #include <stdlib.h>
- X+ #include <string.h>
- X #else
- X #ifdef BSD
- X #include <strings.h>
- X #define strchr index
- X***************
- X*** 40,57 ****
- X #else
- X #include <string.h>
- X #endif
- X!
- X! #ifndef MSDOS
- X! extern char *strstr();
- X! #endif
- X!
- X! /* C preprocessor */
- X! #ifdef TURBO_CPP
- X! #define CPP "cpp -P-"
- X! #endif
- X!
- X! #ifndef MSDOS
- X! #ifndef CPP
- X! #define CPP "/lib/cpp"
- X! #endif
- X #endif
- X--- 53,57 ----
- X #else
- X #include <string.h>
- X #endif
- X! extern char *getenv(), *malloc(), *strstr();
- X #endif
- Xdiff -c old/cproto.1 new/cproto.1
- X*** old/cproto.1 Fri Jul 03 13:42:02 1992
- X--- new/cproto.1 Wed Jun 10 21:03:02 1992
- X***************
- X*** 1,4 ****
- X! .\" $Id: cproto.1 3.5 92/04/11 19:27:07 cthuang Exp $
- X .\"
- X .de EX \"Begin example
- X .ne 5
- X--- 1,4 ----
- X! .\" $Id: cproto.1 3.6 92/06/10 20:55:39 cthuang Exp $
- X .\"
- X .de EX \"Begin example
- X .ne 5
- X***************
- X*** 58,64 ****
- X int argc; /* number of arguments */
- X char *argv[]; /* arguments */
- X {
- X- ...
- X }
- X .EE
- X then the converted function definition will have the form
- X--- 58,63 ----
- X***************
- X*** 65,75 ****
- X .EX
- X int
- X main (
- X! int argc; /* number of arguments */
- X! char *argv[]; /* arguments */
- X )
- X {
- X- ...
- X }
- X .EE
- X Otherwise, the converted function definition will look like
- X--- 64,73 ----
- X .EX
- X int
- X main (
- X! int argc, /* number of arguments */
- X! char *argv[] /* arguments */
- X )
- X {
- X }
- X .EE
- X Otherwise, the converted function definition will look like
- X***************
- X*** 77,83 ****
- X int
- X main (int argc, char *argv[])
- X {
- X- ...
- X }
- X .EE
- X .LP
- X--- 75,80 ----
- X***************
- X*** 108,114 ****
- X int argc;
- X char *argv[];
- X {
- X- ...
- X }
- X .EE
- X If the value is 0, then no prototypes are generated.
- X--- 105,110 ----
- X***************
- X*** 199,207 ****
- X will produce
- X .EX
- X int main(
- X! int argc,
- X! char *argv[]
- X! )
- X .EE
- X .TP
- X .BI \-D name\[=value\]
- X--- 195,203 ----
- X will produce
- X .EX
- X int main(
- X! int argc,
- X! char *argv[]
- X! )
- X .EE
- X .TP
- X .BI \-D name\[=value\]
- Xdiff -c old/cproto.c new/cproto.c
- X*** old/cproto.c Fri Jul 03 13:42:02 1992
- X--- new/cproto.c Wed Jun 10 21:03:08 1992
- X***************
- X*** 1,9 ****
- X! /* $Id: cproto.c 3.5 92/04/11 19:28:01 cthuang Exp $
- X *
- X * C function prototype generator and function definition converter
- X */
- X #ifndef lint
- X! static char rcsid[] = "$Id: cproto.c 3.5 92/04/11 19:28:01 cthuang Exp $";
- X #endif
- X #include <stdio.h>
- X #include <ctype.h>
- X--- 1,9 ----
- X! /* $Id: cproto.c 3.6 92/06/10 20:56:26 cthuang Exp $
- X *
- X * C function prototype generator and function definition converter
- X */
- X #ifndef lint
- X! static char rcsid[] = "$Id: cproto.c 3.6 92/06/10 20:56:26 cthuang Exp $";
- X #endif
- X #include <stdio.h>
- X #include <ctype.h>
- X***************
- X*** 238,246 ****
- X fputs(" -v Output variable declarations\n", stderr);
- X fputs(" -m name Set name of prototype macro\n", stderr);
- X fputs(" -d Omit prototype macro definition\n", stderr);
- X! fputs(" -P fmt Set prototype format template \"int main (a, b)\"\n",
- X stderr);
- X! fputs(" -F fmt Set function definition format template \"int main (a, b)\"\n",
- X stderr);
- X fputs(" -C fmt Set format for function definition with parameter comments\n",
- X stderr);
- X--- 238,246 ----
- X fputs(" -v Output variable declarations\n", stderr);
- X fputs(" -m name Set name of prototype macro\n", stderr);
- X fputs(" -d Omit prototype macro definition\n", stderr);
- X! fputs(" -P fmt Set prototype format template \" int main (a, b)\"\n",
- X stderr);
- X! fputs(" -F fmt Set function definition format template \" int main (a, b)\"\n",
- X stderr);
- X fputs(" -C fmt Set format for function definition with parameter comments\n",
- X stderr);
- X***************
- X*** 469,475 ****
- X #endif
- X process_file(inf, argv[i]);
- X #ifdef CPP
- X! if (func_style == FUNC_NONE) {
- X pclose(inf);
- X } else {
- X pop_file();
- X--- 469,475 ----
- X #endif
- X process_file(inf, argv[i]);
- X #ifdef CPP
- X! if (func_style == FUNC_NONE && cpp != NULL) {
- X pclose(inf);
- X } else {
- X pop_file();
- Xdiff -c old/grammar.y new/grammar.y
- X*** old/grammar.y Fri Jul 03 13:42:04 1992
- X--- new/grammar.y Wed Jun 10 21:03:02 1992
- X***************
- X*** 1,4 ****
- X! /* $Id: grammar.y 3.5 92/04/11 19:27:34 cthuang Exp $
- X *
- X * yacc grammar for C function prototype generator
- X * This was derived from the grammar in Appendix A of
- X--- 1,4 ----
- X! /* $Id: grammar.y 3.6 92/06/10 20:56:07 cthuang Exp $
- X *
- X * yacc grammar for C function prototype generator
- X * This was derived from the grammar in Appendix A of
- X***************
- X*** 6,13 ****
- X */
- X
- X %token <text> '(' '*'
- X-
- X- %token
- X /* identifiers that are not reserved words */
- X T_IDENTIFIER T_TYPEDEF_NAME
- X
- X--- 6,11 ----
- X***************
- X*** 24,37 ****
- X /* type qualifiers */
- X T_TYPE_QUALIFIER
- X
- X /* left brace */
- X T_LBRACE
- X /* all input to the matching right brace */
- X T_MATCHRBRACE
- X
- X- /* paired square brackets and everything between them: [ ... ] */
- X- T_BRACKETS
- X-
- X /* three periods */
- X T_ELLIPSIS
- X
- X--- 22,36 ----
- X /* type qualifiers */
- X T_TYPE_QUALIFIER
- X
- X+ /* paired square brackets and everything between them: [ ... ] */
- X+ T_BRACKETS
- X+
- X+ %token
- X /* left brace */
- X T_LBRACE
- X /* all input to the matching right brace */
- X T_MATCHRBRACE
- X
- X /* three periods */
- X T_ELLIPSIS
- X
- X***************
- X*** 55,69 ****
- X %type <param_list> parameter_type_list parameter_list
- X %type <parameter> parameter_declaration
- X %type <param_list> opt_identifier_list identifier_list
- X! %type <text>
- X! struct_or_union pointer opt_type_qualifiers type_qualifier_list any_id
- X! T_BRACKETS
- X! T_IDENTIFIER T_TYPEDEF_NAME
- X! T_AUTO T_EXTERN T_REGISTER T_STATIC T_TYPEDEF T_INLINE
- X! T_CHAR T_DOUBLE T_FLOAT T_INT T_VOID T_LONG T_SHORT T_SIGNED T_UNSIGNED
- X! T_ENUM T_STRUCT T_UNION
- X! T_TYPE_QUALIFIER
- X! '(' '*'
- X
- X %{
- X #include <stdio.h>
- X--- 54,61 ----
- X %type <param_list> parameter_type_list parameter_list
- X %type <parameter> parameter_declaration
- X %type <param_list> opt_identifier_list identifier_list
- X! %type <text> struct_or_union pointer opt_type_qualifiers type_qualifier_list
- X! any_id
- X
- X %{
- X #include <stdio.h>
- X***************
- X*** 112,118 ****
- X | linkage_specification
- X | T_ASM T_ASMARG ';'
- X | error ';'
- X! | error braces
- X ;
- X
- X braces
- X--- 104,116 ----
- X | linkage_specification
- X | T_ASM T_ASMARG ';'
- X | error ';'
- X! {
- X! yyerrok;
- X! }
- X! | error T_MATCHRBRACE
- X! {
- X! yyerrok;
- X! }
- X ;
- X
- X braces
- X***************
- X*** 156,167 ****
- X declarator_list
- X : declarator
- X {
- X! new_symbol(typedef_names, $1->name, cur_decl_spec_flags);
- X free_declarator($1);
- X }
- X | declarator_list ',' declarator
- X {
- X! new_symbol(typedef_names, $3->name, cur_decl_spec_flags);
- X free_declarator($3);
- X }
- X ;
- X--- 154,176 ----
- X declarator_list
- X : declarator
- X {
- X! int flags = cur_decl_spec_flags;
- X!
- X! /* If the typedef is a pointer type, then reset the short type
- X! * flags so it does not get promoted.
- X! */
- X! if (strcmp($1->text, $1->name) != 0)
- X! flags &= ~(DS_CHAR | DS_SHORT | DS_FLOAT);
- X! new_symbol(typedef_names, $1->name, flags);
- X free_declarator($1);
- X }
- X | declarator_list ',' declarator
- X {
- X! int flags = cur_decl_spec_flags;
- X!
- X! if (strcmp($3->text, $3->name) != 0)
- X! flags &= ~(DS_CHAR | DS_SHORT | DS_FLOAT);
- X! new_symbol(typedef_names, $3->name, flags);
- X free_declarator($3);
- X }
- X ;
- X***************
- X*** 474,486 ****
- X type_qualifier_list
- X : type_qualifier
- X {
- X! strcpy($$.text, $1.text);
- X $$.begin = $1.begin;
- X free($1.text);
- X }
- X | type_qualifier_list type_qualifier
- X {
- X! sprintf($$.text, "%s %s ", $1.text, $2.text);
- X $$.begin = $1.begin;
- X free($2.text);
- X }
- X--- 483,495 ----
- X type_qualifier_list
- X : type_qualifier
- X {
- X! sprintf($$.text, "%s ", $1.text);
- X $$.begin = $1.begin;
- X free($1.text);
- X }
- X | type_qualifier_list type_qualifier
- X {
- X! sprintf($$.text, "%s%s ", $1.text, $2.text);
- X $$.begin = $1.begin;
- X free($2.text);
- X }
- Xdiff -c old/lex.l new/lex.l
- X*** old/lex.l Fri Jul 03 13:42:04 1992
- X--- new/lex.l Wed Jun 10 21:03:02 1992
- X***************
- X*** 1,5 ****
- X %{
- X! /* $Id: lex.l 3.6 92/04/11 19:27:25 cthuang Exp $
- X *
- X * Lexical analyzer for C function prototype generator
- X */
- X--- 1,5 ----
- X %{
- X! /* $Id: lex.l 3.7 92/06/10 20:56:04 cthuang Exp $
- X *
- X * Lexical analyzer for C function prototype generator
- X */
- X***************
- X*** 83,92 ****
- X do_include(buf, TRUE);
- X }
- X
- X <CPP1>[0-9]+{WS}+\".*$ {
- X save_text();
- X sscanf(yytext, "%d \"%[^\"]\"", &cur_file->line_num,
- X! cur_file->file_name);
- X cur_file->line_num--;
- X BEGIN INITIAL;
- X }
- X--- 83,99 ----
- X do_include(buf, TRUE);
- X }
- X
- X+ <CPP1>line{WS}+[0-9]+{WS}+\".*$ {
- X+ save_text();
- X+ sscanf(yytext, "line %d \"%[^\"]\"",
- X+ &cur_file->line_num, cur_file->file_name);
- X+ cur_file->line_num--;
- X+ BEGIN INITIAL;
- X+ }
- X <CPP1>[0-9]+{WS}+\".*$ {
- X save_text();
- X sscanf(yytext, "%d \"%[^\"]\"", &cur_file->line_num,
- X! cur_file->file_name);
- X cur_file->line_num--;
- X BEGIN INITIAL;
- X }
- X***************
- X*** 124,129 ****
- X--- 131,138 ----
- X <ASM>")" { save_text(); BEGIN INITIAL; return T_ASMARG; }
- X <ASM>{QUOTED}|. save_text();
- X
- X+ <INITIAL>_based[^(]*\([^)]*\) { save_text_offset(); return T_TYPE_QUALIFIER; }
- X+
- X <INITIAL>auto { save_text_offset(); return T_AUTO; }
- X <INITIAL>extern { save_text_offset(); return T_EXTERN; }
- X <INITIAL>register { save_text_offset(); return T_REGISTER; }
- X***************
- X*** 333,338 ****
- X--- 342,385 ----
- X {
- X return cur_file->begin_comment;
- X }
- X+
- X+ #ifdef NEED_tmpfile
- X+ /*
- X+ * tmpfile() - return a FILE* for a temporary file that will be
- X+ * removed automatically when the program exits.
- X+ *
- X+ * Not all systems have the ANSI tmpfile() function yet...
- X+ *
- X+ * DaviD W. Sanderson (dws@cs.wisc.edu)
- X+ */
- X+ FILE *
- X+ tmpfile ()
- X+ {
- X+ char name[1024];
- X+ char *tmpdir;
- X+ FILE *f;
- X+
- X+ if ((tmpdir = getenv("TMPDIR")) == (char *)0)
- X+ {
- X+ tmpdir = "/tmp";
- X+ }
- X+ sprintf(name, "%s/TfXXXXXX", tmpdir);
- X+ mktemp(name);
- X+
- X+ if ((f = fopen(name, "w+")) == (FILE *)0)
- X+ {
- X+ return (FILE *)0;
- X+ }
- X+
- X+ if (unlink(name) == -1)
- X+ {
- X+ fclose(f);
- X+ return (FILE *)0;
- X+ }
- X+
- X+ return f;
- X+ }
- X+ #endif /* NEED_tmpfile */
- X
- X /* Push a file onto the include stack. The stream yyin must already
- X * point to the file.
- Xdiff -c old/Makefile.msc new/Makefile.msc
- X*** old/Makefile.msc Fri Jul 03 13:41:44 1992
- X--- new/Makefile.msc Wed Jun 10 21:03:02 1992
- X***************
- X*** 1,4 ****
- X! # $Id: makefile.msc 3.2 92/03/14 11:56:40 cthuang Exp $
- X #
- X # Microsoft C makefile for C prototype generator
- X
- X--- 1,4 ----
- X! # $Id: makefile.msc 3.3 92/06/10 20:55:56 cthuang Exp $
- X #
- X # Microsoft C makefile for C prototype generator
- X
- X***************
- X*** 18,29 ****
- X DIST3 = config.h cproto.h patchlev.h semantic.h symbol.h
- X DIST4 = cproto.c popen.c semantic.c strstr.c symbol.c
- X
- X! OBJECTS = cproto.obj getopt.obj semantic.obj symbol.obj y_tab.obj
- X
- X all: cproto.exe
- X
- X cproto.exe: $(OBJECTS)
- X! $(CC) $(CFLAGS) -Fe$*.exe $(OBJECTS) $(LIBS) $(LDFLAGS)
- X
- X y_tab.obj: y_tab.c lex_yy.c config.h cproto.h symbol.h semantic.h
- X $(CC) $(CFLAGS) -c $*.c
- X--- 18,29 ----
- X DIST3 = config.h cproto.h patchlev.h semantic.h symbol.h
- X DIST4 = cproto.c popen.c semantic.c strstr.c symbol.c
- X
- X! OBJECTS = cproto.obj getopt.obj semantic.obj symbol.obj y_tab.obj popen.obj
- X
- X all: cproto.exe
- X
- X cproto.exe: $(OBJECTS)
- X! $(CC) $(CFLAGS) $(OBJECTS) $(LIBS) $(LDFLAGS)
- X
- X y_tab.obj: y_tab.c lex_yy.c config.h cproto.h symbol.h semantic.h
- X $(CC) $(CFLAGS) -c $*.c
- Xdiff -c old/Makefile.uni new/Makefile.uni
- X*** old/Makefile.uni Fri Jul 03 13:42:04 1992
- X--- new/Makefile.uni Wed Jun 10 21:03:02 1992
- X***************
- X*** 1,8 ****
- X! # $Id: makefile.uni 3.4 92/04/11 19:27:21 cthuang Exp $
- X #
- X # UNIX makefile for C prototype generator
- X
- X # Define BSD for BSD, otherwise System V is assumed.
- X #DEFINES = -DBSD
- X
- X LEX = lex
- X--- 1,9 ----
- X! # $Id: makefile.uni 3.5 92/06/10 20:56:00 cthuang Exp $
- X #
- X # UNIX makefile for C prototype generator
- X
- X # Define BSD for BSD, otherwise System V is assumed.
- X+ # Define NEED_tmpfile if your system does not have the ANSI function tmpfile()
- X #DEFINES = -DBSD
- X
- X LEX = lex
- Xdiff -c old/patchlev.h new/patchlev.h
- X*** old/patchlev.h Fri Jul 03 13:42:04 1992
- X--- new/patchlev.h Wed Jun 10 21:03:08 1992
- X***************
- X*** 1,1 ****
- X! #define PATCHLEVEL 3
- X--- 1,1 ----
- X! #define PATCHLEVEL 4
- Xdiff -c old/popen.c new/popen.c
- X*** old/popen.c Fri Jul 03 13:41:48 1992
- X--- new/popen.c Wed Jun 10 21:03:08 1992
- X***************
- X*** 1,4 ****
- X! /* $Id: popen.c 3.2 92/03/14 11:58:07 cthuang Exp $
- X *
- X * Imitate a UNIX pipe in MS-DOS.
- X */
- X--- 1,4 ----
- X! /* $Id: popen.c 3.3 92/06/10 20:56:30 cthuang Exp $
- X *
- X * Imitate a UNIX pipe in MS-DOS.
- X */
- X***************
- X*** 34,53 ****
- X arg = argv;
- X s = strtok(cmdline, " ");
- X *arg++ = s;
- X! #ifdef M_I86
- X! sprintf(opt, "-o%s.", pipe_name);
- X! #else
- X sprintf(opt, "-o%s", pipe_name);
- X- #endif
- X *arg++ = opt;
- X while ((s = strtok(NULL, " ")) != NULL) {
- X *arg++ = s;
- X }
- X *arg = NULL;
- X
- X! /* Redirect the program's stdout to /dev/null. */
- X ostdout = dup(fileno(stdout));
- X freopen("nul", "w", stdout);
- X
- X /* Run the program. */
- X status = spawnvp(P_WAIT, argv[0], argv);
- X--- 34,55 ----
- X arg = argv;
- X s = strtok(cmdline, " ");
- X *arg++ = s;
- X! #ifdef TURBO_CPP
- X sprintf(opt, "-o%s", pipe_name);
- X *arg++ = opt;
- X+ #endif
- X while ((s = strtok(NULL, " ")) != NULL) {
- X *arg++ = s;
- X }
- X *arg = NULL;
- X
- X! /* Redirect the program's stdout. */
- X ostdout = dup(fileno(stdout));
- X+ #ifdef TURBO_CPP
- X freopen("nul", "w", stdout);
- X+ #else
- X+ freopen(pipe_name, "w", stdout);
- X+ #endif
- X
- X /* Run the program. */
- X status = spawnvp(P_WAIT, argv[0], argv);
- Xdiff -c old/semantic.c new/semantic.c
- X*** old/semantic.c Fri Jul 03 13:42:06 1992
- X--- new/semantic.c Wed Jun 10 21:03:08 1992
- X***************
- X*** 1,4 ****
- X! /* $Id: semantic.c 3.5 92/04/11 19:28:08 cthuang Exp $
- X *
- X * Semantic actions executed by the parser of the
- X * C function prototype generator.
- X--- 1,4 ----
- X! /* $Id: semantic.c 3.6 92/06/10 20:56:35 cthuang Exp $
- X *
- X * Semantic actions executed by the parser of the
- X * C function prototype generator.
- X***************
- X*** 197,208 ****
- X
- X /* Return TRUE if the parameter is void.
- X */
- X! boolean
- X is_void_parameter (p)
- X Parameter *p;
- X {
- X return p == NULL || (strcmp(p->decl_spec.text, "void") == 0 &&
- X! strlen(p->declarator->text) == 0);
- X }
- X
- X /* Initialize a list of function parameters.
- X--- 197,208 ----
- X
- X /* Return TRUE if the parameter is void.
- X */
- X! static boolean
- X is_void_parameter (p)
- X Parameter *p;
- X {
- X return p == NULL || (strcmp(p->decl_spec.text, "void") == 0 &&
- X! p->declarator->text[0] == '\0');
- X }
- X
- X /* Initialize a list of function parameters.
- X***************
- X*** 333,340 ****
- X
- X for (d = declarators->first; d != NULL; d = d->next) {
- X /* Search the parameter list for a matching name. */
- X! p = search_parameter_list(params, d->name);
- X! if (p == NULL) {
- X put_error();
- X fprintf(stderr, "declared argument \"%s\" is missing\n", d->name);
- X } else {
- X--- 333,339 ----
- X
- X for (d = declarators->first; d != NULL; d = d->next) {
- X /* Search the parameter list for a matching name. */
- X! if ((p = search_parameter_list(params, d->name)) == NULL) {
- X put_error();
- X fprintf(stderr, "declared argument \"%s\" is missing\n", d->name);
- X } else {
- X***************
- X*** 364,370 ****
- X Parameter *p;
- X {
- X fputs(p->decl_spec.text, outf);
- X! if (strlen(p->declarator->text) > 0) {
- X if (strcmp(p->declarator->text, "...") != 0) {
- X if (proto_style != PROTO_ABSTRACT || proto_comments ||
- X where != FUNC_PROTO ||
- X--- 363,369 ----
- X Parameter *p;
- X {
- X fputs(p->decl_spec.text, outf);
- X! if (p->declarator->text[0] != '\0') {
- X if (strcmp(p->declarator->text, "...") != 0) {
- X if (proto_style != PROTO_ABSTRACT || proto_comments ||
- X where != FUNC_PROTO ||
- X***************
- X*** 478,484 ****
- X if (declarator->func_stack->func_def == FUNC_NONE) {
- X
- X decl_text = declarator->func_stack->text;
- X! if (strlen(declarator->name) == 0) {
- X fputs(decl_text, outf);
- X } else {
- X
- X--- 477,483 ----
- X if (declarator->func_stack->func_def == FUNC_NONE) {
- X
- X decl_text = declarator->func_stack->text;
- X! if (declarator->name[0] == '\0') {
- X fputs(decl_text, outf);
- X } else {
- X
- X***************
- X*** 551,557 ****
- X
- X if (declarator->func_def == FUNC_NONE) {
- X if (where == FUNC_PROTO && proto_style == PROTO_ABSTRACT &&
- X! strlen(declarator->name) > 0) {
- X if ((s = strstr(declarator->text, declarator->name)) == NULL)
- X return;
- X *s = '\0';
- X--- 550,556 ----
- X
- X if (declarator->func_def == FUNC_NONE) {
- X if (where == FUNC_PROTO && proto_style == PROTO_ABSTRACT &&
- X! declarator->name[0] != '\0') {
- X if ((s = strstr(declarator->text, declarator->name)) == NULL)
- X return;
- X *s = '\0';
- X***************
- X*** 625,632 ****
- X Parameter *p;
- X
- X for (p = declarator->params.first; p != NULL; p = p->next) {
- X! if (strlen(p->decl_spec.text) == 0 &&
- X! strcmp(p->declarator->text, "...") != 0) {
- X free(p->decl_spec.text);
- X p->decl_spec.text = xstrdup("int");
- X }
- X--- 624,631 ----
- X Parameter *p;
- X
- X for (p = declarator->params.first; p != NULL; p = p->next) {
- X! if (p->decl_spec.text[0] == '\0' &&
- X! strcmp(p->declarator->text, "...") != 0) {
- X free(p->decl_spec.text);
- X p->decl_spec.text = xstrdup("int");
- X }
- Xdiff -c old/semantic.h new/semantic.h
- X*** old/semantic.h Fri Jul 03 13:41:48 1992
- X--- new/semantic.h Wed Jun 10 21:03:08 1992
- X***************
- X*** 1,4 ****
- X! /* $Id: semantic.h 3.2 92/03/06 00:54:38 cthuang Exp $
- X *
- X * Declarations of semantic action routines
- X */
- X--- 1,4 ----
- X! /* $Id: semantic.h 3.3 92/06/10 20:56:19 cthuang Exp $
- X *
- X * Declarations of semantic action routines
- X */
- X***************
- X*** 25,32 ****
- X Parameter *param, DeclSpec *decl_spec, Declarator *declarator*/);
- X extern void free_parameter(/*
- X Parameter *param*/);
- X- extern boolean is_void_parameter(/*
- X- Parameter *p*/);
- X extern void new_param_list(/*
- X ParameterList *param_list, Parameter *param*/);
- X extern void free_param_list(/*
- X--- 25,30 ----
- END_OF_patch4
- if test 21100 -ne `wc -c <patch4`; then
- echo shar: \"patch4\" unpacked with wrong size!
- fi
- # end of overwriting check
- fi
- echo shar: End of shell archive.
- exit 0
-
- --
- Chin Huang cthuang@zerosan.UUCP chin.huang@canrem.com
-
- exit 0 # Just in case...
-