home *** CD-ROM | disk | FTP | other *** search
- diff -c old/CHANGES ./CHANGES
- *** old/CHANGES Thu Mar 28 15:41:44 1991
- --- ./CHANGES Sat Mar 30 13:18:50 1991
- ***************
- *** 1,5 ****
- --- 1,14 ----
- Version 2
-
- + Patchlevel 1
- +
- + - Fix: Cproto incorrectly generated the parameter "int ..." in
- + prototypes of functions taking variable parameters.
- + - Fix: Function definitions can now be followed by an optional
- + semicolon. I found this feature in every C compiler I tried.
- +
- + Patchlevel 0
- +
- - Added formal parameter promotion.
- - Added prototype style that surrounds prototypes with a guard macro.
- - Handles C++ style comment //.
- diff -c old/cproto.1 ./cproto.1
- *** old/cproto.1 Thu Mar 28 15:41:44 1991
- --- ./cproto.1 Sat Mar 30 13:18:54 1991
- ***************
- *** 1,4 ****
- ! .\" $Id: cproto.1 2.1 91/03/25 10:13:30 cthuang Exp $
- .\"
- .de EX \"Begin example
- .ne 5
- --- 1,4 ----
- ! .\" $Id: cproto.1 2.2 91/03/30 13:18:50 cthuang Exp $
- .\"
- .de EX \"Begin example
- .ne 5
- ***************
- *** 140,149 ****
- .TP
- .B \-V
- Print version information.
- - .SH AUTHOR
- - Chin Huang
- - cthuang@contact.uucp
- - chin.huang@canrem.uucp
- .SH BUGS
- When cproto finds an error, it usually outputs the not very descriptive
- message "syntax error".
- --- 140,145 ----
- ***************
- *** 154,159 ****
- --- 150,161 ----
- \\n newline
- \\t tab
- .EE
- + .SH AUTHOR
- + .nf
- + Chin Huang
- + cthuang@contact.uucp
- + chin.huang@canrem.uucp
- + .fi
- .SH "SEE ALSO"
- cc(1),
- cpp(1)
- diff -c old/cproto.c ./cproto.c
- *** old/cproto.c Thu Mar 28 15:41:58 1991
- --- ./cproto.c Sat Mar 30 13:19:00 1991
- ***************
- *** 1,10 ****
- ! /* $Id: cproto.c 2.1 91/03/25 11:40:34 cthuang Exp $
- *
- * C prototype generator
- * Reads C source code and outputs ANSI C function prototypes.
- */
- #ifndef lint
- ! static char *rcsid = "$Id: cproto.c 2.1 91/03/25 11:40:34 cthuang Exp $";
- #endif
- #include <stdio.h>
- #include <ctype.h>
- --- 1,10 ----
- ! /* $Id: cproto.c 2.2 91/03/30 13:18:55 cthuang Exp $
- *
- * C prototype generator
- * Reads C source code and outputs ANSI C function prototypes.
- */
- #ifndef lint
- ! static char *rcsid = "$Id: cproto.c 2.2 91/03/30 13:18:55 cthuang Exp $";
- #endif
- #include <stdio.h>
- #include <ctype.h>
- ***************
- *** 149,156 ****
- static void
- usage ()
- {
- ! fprintf(stderr,
- ! "usage: %s [ option ... ] [ file ... ]\n", progname);
- fputs(" -e output \"extern\" keyword before global declarations\n",
- stderr);
- fputs(" -f n select function prototype style (0 to 4)\n", stderr);
- --- 149,155 ----
- static void
- usage ()
- {
- ! fprintf(stderr, "usage: %s [ option ... ] [ file ... ]\n", progname);
- fputs(" -e output \"extern\" keyword before global declarations\n",
- stderr);
- fputs(" -f n select function prototype style (0 to 4)\n", stderr);
- ***************
- *** 163,175 ****
- fputs(" -U name\n", stderr);
- fputs(" -I directory\n", stderr);
- fputs(" C preprocessor options\n", stderr);
- ! fputs(
- ! " -F fmt set prototype template in the form \"int main (a, b)\"\n",
- stderr);
- fputs(" -V print version information\n", stderr);
- exit(1);
- }
-
- main (argc, argv)
- int argc;
- char **argv;
- --- 162,174 ----
- fputs(" -U name\n", stderr);
- fputs(" -I directory\n", stderr);
- fputs(" C preprocessor options\n", stderr);
- ! fputs(" -F fmt set prototype template in the form \"int main (a, b)\"\n",
- stderr);
- fputs(" -V print version information\n", stderr);
- exit(1);
- }
-
- + int
- main (argc, argv)
- int argc;
- char **argv;
- ***************
- *** 288,294 ****
- }
-
- if (optind == argc) {
- ! printf("/* stdin */\n");
- parse_file();
- } else {
- for (i = optind; i < argc; ++i) {
- --- 287,293 ----
- }
-
- if (optind == argc) {
- ! strcpy(cur_file, "stdin");
- parse_file();
- } else {
- for (i = optind; i < argc; ++i) {
- ***************
- *** 305,312 ****
- }
- #endif
- strcpy(cur_file, argv[i]);
- - line_num = 1;
- - printf("/* %s */\n", cur_file);
- parse_file();
- #ifdef MSDOS
- fclose(yyin);
- --- 304,309 ----
- diff -c old/grammar.y ./grammar.y
- *** old/grammar.y Thu Mar 28 15:41:56 1991
- --- ./grammar.y Sat Mar 30 13:19:04 1991
- ***************
- *** 1,4 ****
- ! /* $Id: grammar.y 2.1 91/02/28 11:16:07 cthuang Exp $
- *
- * yacc grammar for C prototype generator
- * This was derived from the grammar given in Appendix A of
- --- 1,4 ----
- ! /* $Id: grammar.y 2.2 91/03/30 13:19:00 cthuang Exp $
- *
- * yacc grammar for C prototype generator
- * This was derived from the grammar given in Appendix A of
- ***************
- *** 88,93 ****
- --- 88,94 ----
- external_declaration
- : declaration
- | function_definition
- + | function_definition ';'
- | T_EXTERN T_QUOTEC T_BRACES
- | error
- ;
- ***************
- *** 564,569 ****
- --- 565,572 ----
- void
- parse_file ()
- {
- + printf("/* %s */\n", cur_file);
- + line_num = 1;
- typedef_names = create_symbol_table();
- yyparse();
- }
- diff -c old/Makefile ./Makefile
- *** old/Makefile Thu Mar 28 15:41:44 1991
- --- ./Makefile Sat Mar 30 13:19:08 1991
- ***************
- *** 1,4 ****
- ! # $Id: makefile 2.1 91/03/25 10:56:54 cthuang Exp $
- #
- # MSDOS makefile for C prototype generator
-
- --- 1,4 ----
- ! # $Id: Makefile 2.2 91/03/30 13:19:06 cthuang Exp $
- #
- # MSDOS makefile for C prototype generator
-
- ***************
- *** 9,24 ****
-
- DEFINES = -DMSDOS
-
- ! DIST1 = README CHANGES Makefile Makefile.uni cproto.1
- ! DIST2 = $(SOURCES)
- SOURCES = lex.l grammar.y \
- config.h cproto.h patchlev.h semantic.h symbol.h \
- cproto.c semantic.c string.c symbol.c
- CSOURCES = cproto.c semantic.c string.c symbol.c y_tab.c
- ! OBJECTS = cproto.obj semantic.obj getopt.obj symbol.obj \
- ! y_tab.obj
-
- ! all: cproto.exe
-
- cproto.exe: $(OBJECTS)
- $(CC) $(CFLAGS) $(OBJECTS)
- --- 9,25 ----
-
- DEFINES = -DMSDOS
-
- ! DIST1 = README CHANGES
- ! DIST2 = cproto.man
- ! DIST3 = cproto.1 Makefile Makefile.uni
- ! DIST4 = $(SOURCES)
- SOURCES = lex.l grammar.y \
- config.h cproto.h patchlev.h semantic.h symbol.h \
- cproto.c semantic.c string.c symbol.c
- CSOURCES = cproto.c semantic.c string.c symbol.c y_tab.c
- ! OBJECTS = cproto.obj semantic.obj getopt.obj symbol.obj y_tab.obj
-
- ! all: cproto.exe cproto.man
-
- cproto.exe: $(OBJECTS)
- $(CC) $(CFLAGS) $(OBJECTS)
- ***************
- *** 32,37 ****
- --- 33,41 ----
- lex_yy.c: lex.l
- $(LEX) lex.l
-
- + cproto.man: cproto.1
- + cawf -man $*.1 >$@
- +
- TAGS: $(SOURCES)
- etags -t $(SOURCES)
-
- ***************
- *** 41,47 ****
- erase *.log
- erase lex_yy.c
- erase y_tab.c
- ! erase cproto1.exe
-
- lint:
- lint -B $(DEFINES) $(CSOURCES)
- --- 45,51 ----
- erase *.log
- erase lex_yy.c
- erase y_tab.c
- ! erase cproto.exe
-
- lint:
- lint -B $(DEFINES) $(CSOURCES)
- ***************
- *** 50,68 ****
- cpr $(SOURCES) | lpr -J'cproto'
-
- shar:
- ! rmcr $(DIST1)
- ! rmcr $(DIST2)
- ! shar $(DIST1) >cproto.sh1
- ! rmcr cproto.sh1
- ! shar $(DIST2) >cproto.sh2
- ! rmcr cproto.sh2
-
- zip:
- pkzip -u cproto README CHANGES Makefile.* *.1 *.c *.h grammar.y lex.l
-
- ci:
- ! ci -r2 -u $(DIST1)
- ! ci -r2 -u $(DIST2)
-
- # DO NOT DELETE THIS LINE -- make depend depends on it.
-
- --- 54,71 ----
- cpr $(SOURCES) | lpr -J'cproto'
-
- shar:
- ! rmcr $(DIST1) $(DIST2) $(DIST3)
- ! rmcr $(DIST4)
- ! shar $(DIST1) $(DIST2) $(DIST3) >cproto.sh1
- ! shar $(DIST4) >cproto.sh2
- ! rmcr cproto.sh1 cproto.sh2
-
- zip:
- pkzip -u cproto README CHANGES Makefile.* *.1 *.c *.h grammar.y lex.l
-
- ci:
- ! ci -u2 $(DIST1) $(DIST3)
- ! ci -u2 $(DIST4)
-
- # DO NOT DELETE THIS LINE -- make depend depends on it.
-
- diff -c old/Makefile.uni ./Makefile.uni
- *** old/Makefile.uni Thu Mar 28 15:41:44 1991
- --- ./Makefile.uni Sat Mar 30 13:19:10 1991
- ***************
- *** 1,4 ****
- ! # $Id: Makefile.uni 2.1 91/02/28 11:15:54 cthuang Exp $
- #
- # UNIX makefile for C prototype generator
-
- --- 1,4 ----
- ! # $Id: Makefile.uni 2.2 91/03/30 13:19:09 cthuang Exp $
- #
- # UNIX makefile for C prototype generator
-
- ***************
- *** 9,16 ****
- # Define SYSV for System V, otherwise BSD is assumed.
- #DEFINES = -DSYSV
-
- ! DIST1 = README CHANGES Makefile Makefile.dos cproto.1
- ! DIST2 = $(SOURCES)
- SOURCES = lex.l grammar.y \
- config.h cproto.h patchlev.h semantic.h symbol.h \
- cproto.c semantic.c string.c symbol.c
- --- 9,18 ----
- # Define SYSV for System V, otherwise BSD is assumed.
- #DEFINES = -DSYSV
-
- ! DIST1 = README CHANGES
- ! DIST2 = cproto.man
- ! DIST3 = cproto.1 Makefile Makefile.dos
- ! DIST4 = $(SOURCES)
- SOURCES = lex.l grammar.y \
- config.h cproto.h patchlev.h semantic.h symbol.h \
- cproto.c semantic.c string.c symbol.c
- ***************
- *** 17,23 ****
- CSOURCES = cproto.c semantic.c string.c symbol.c y.tab.c
- OBJECTS = cproto.o semantic.o string.o symbol.o y.tab.o
-
- ! all: cproto
-
- cproto: $(OBJECTS)
- $(CC) $(CFLAGS) -o $@ $(OBJECTS)
- --- 19,25 ----
- CSOURCES = cproto.c semantic.c string.c symbol.c y.tab.c
- OBJECTS = cproto.o semantic.o string.o symbol.o y.tab.o
-
- ! all: cproto cproto.man
-
- cproto: $(OBJECTS)
- $(CC) $(CFLAGS) -o $@ $(OBJECTS)
- ***************
- *** 28,38 ****
- lex.yy.c: lex.l
- $(LEX) lex.l
-
- TAGS: $(SOURCES)
- etags -t $(SOURCES)
-
- clean:
- ! rm *.o *.bak *.log cproto1.exe
-
- lint:
- lint -B $(DEFINES) $(CSOURCES)
- --- 30,43 ----
- lex.yy.c: lex.l
- $(LEX) lex.l
-
- + cproto.man: cproto.1
- + nroff -man $*.1 >$@
- +
- TAGS: $(SOURCES)
- etags -t $(SOURCES)
-
- clean:
- ! rm *.o *.bak *.log cproto
-
- lint:
- lint -B $(DEFINES) $(CSOURCES)
- ***************
- *** 41,51 ****
- cpr $(SOURCES) | lpr -J'cproto'
-
- shar:
- ! shar $(DIST1) >cproto.sh1
- ! shar $(DIST2) >cproto.sh2
-
- ci:
- ! ci -u $(DIST1) $(DIST2)
-
- depend:
- makedepend $(CSOURCES)
- --- 46,56 ----
- cpr $(SOURCES) | lpr -J'cproto'
-
- shar:
- ! shar $(DIST1) $(DIST2) $(DIST3) >cproto.sh1
- ! shar $(DIST4) >cproto.sh2
-
- ci:
- ! ci -u2 $(DIST1) $(DIST3) $(DIST4)
-
- depend:
- makedepend $(CSOURCES)
- diff -c old/patchlev.h ./patchlev.h
- *** old/patchlev.h Thu Mar 28 15:41:58 1991
- --- ./patchlev.h Sat Mar 30 13:19:38 1991
- ***************
- *** 1,1 ****
- ! #define PATCHLEVEL 0
- --- 1,1 ----
- ! #define PATCHLEVEL 1
- diff -c old/semantic.c ./semantic.c
- *** old/semantic.c Thu Mar 28 15:42:00 1991
- --- ./semantic.c Sat Mar 30 13:19:44 1991
- ***************
- *** 1,4 ****
- ! /* $Id: semantic.c 2.1 91/03/25 11:40:31 cthuang Exp $
- *
- * C prototype generator
- * These routines implement the semantic actions executed by the yacc parser.
- --- 1,4 ----
- ! /* $Id: semantic.c 2.2 91/03/30 13:19:39 cthuang Exp $
- *
- * C prototype generator
- * These routines implement the semantic actions executed by the yacc parser.
- ***************
- *** 303,309 ****
- --- 303,311 ----
- output_error();
- fprintf(stderr, "declared argument \"%s\" is missing\n", d->name);
- } else {
- + free(p->declarator.text);
- p->declarator.text = strdup(d->text);
- +
- decl_spec_text = decl_spec->text;
- if (promote_param && strcmp(d->text, d->name) == 0) {
- s = rindex(decl_spec_text, ' ');
- ***************
- *** 313,318 ****
- --- 315,321 ----
- else if (strcmp(s, "float") == 0)
- decl_spec_text = "double";
- }
- + free(p->decl_spec.text);
- p->decl_spec.text = strdup(decl_spec_text);
- }
- }
- ***************
- *** 378,384 ****
- *s = *(p->declarator.name);
- } else {
- if (strlen(p->declarator.text) > 0) {
- ! putchar(' ');
- output_declarator(&(p->declarator));
- }
- }
- --- 381,388 ----
- *s = *(p->declarator.name);
- } else {
- if (strlen(p->declarator.text) > 0) {
- ! if (strcmp(p->declarator.text, "...") != 0)
- ! putchar(' ');
- output_declarator(&(p->declarator));
- }
- }
- ***************
- *** 464,470 ****
- * part. The default type in this cause is "int".
- */
- for (p = declarator->params.first; p != NULL; p = p->next) {
- ! if (strlen(p->decl_spec.text) == 0) {
- free(p->decl_spec.text);
- p->decl_spec.text = strdup("int");
- }
- --- 468,475 ----
- * part. The default type in this cause is "int".
- */
- for (p = declarator->params.first; p != NULL; p = p->next) {
- ! if (strlen(p->decl_spec.text) == 0 &&
- ! strcmp(p->declarator.text, "...") != 0) {
- free(p->decl_spec.text);
- p->decl_spec.text = strdup("int");
- }
- diff -c old/semantic.h ./semantic.h
- *** old/semantic.h Thu Mar 28 15:41:58 1991
- --- ./semantic.h Sat Mar 30 13:19:46 1991
- ***************
- *** 1,6 ****
- ! /* $Id: semantic.h 2.1 91/02/28 11:16:19 cthuang Exp $
- *
- ! * Declarations for semantics action routines
- */
-
- extern boolean is_typedef_name(/*
- --- 1,6 ----
- ! /* $Id: semantic.h 2.2 91/03/30 13:19:44 cthuang Exp $
- *
- ! * Declarations for semantic action routines
- */
-
- extern boolean is_typedef_name(/*
- ***************
- *** 9,15 ****
- extern void new_decl_spec(/*
- DeclSpec *decl_spec,
- char *text,
- ! unsigned short flags
- */);
- extern void join_decl_specs(/*
- DeclSpec *result,
- --- 9,15 ----
- extern void new_decl_spec(/*
- DeclSpec *decl_spec,
- char *text,
- ! int flags
- */);
- extern void join_decl_specs(/*
- DeclSpec *result,
-