home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: alt.sources.patches
- Path: sparky!uunet!munnari.oz.au!metro!mama!greyham
- From: greyham@research.canon.oz.au (Graham Stoney)
- Subject: c2man: generate man pages from C comments; patch v1.9 -> v1.10
- Message-ID: <By08zp.6M4@research.canon.oz.au>
- Followup-To: alt.sources.d
- Summary: A program to help document C functions with minimal extra effort.
- Keywords: c2man, Unix, man, ANSI-C, documentation generator
- Sender: news@research.canon.oz.au
- Organization: Canon Information Systems Research Australia
- Date: Fri, 20 Nov 1992 08:02:13 GMT
- Lines: 279
-
- Archive-name: c2man/patch.1.9-1.10
- Submitted-by: greyham@research.canon.oz.au
-
- This official patch brings c2man v1.9 up to v1.10.
-
- I wait around and collect a few bug-fixes into the one patch before posting; but
- somehow I always get a bug report immediately after every posting!
-
- See the CHANGES file for more details.
-
- As before, any feedback, comments or tips are greatly appreciated.
-
- Graham
-
- *** 1.11 1992/11/03 06:17:28
- --- CHANGES 1992/11/06 03:25:08
- ***************
- *** 104,106 ****
- --- 104,112 ----
- Don't error on "typedef int NewType; NewType a;"
-
- -Ssection option added by jerry@kesa24.kesa.com (Jerry E. Dunmire).
- +
- + Version 1.10:
- + Accept comments around a final ellipsis parameter.
- +
- + Make parameter declarations in the prototype and the PARAMETERS section
- + identical.
- *** 1.13 1992/10/15 07:53:08
- --- Makefile 1992/11/20 07:55:02
- ***************
- *** 1,4 ****
- ! # $Id: Makefile,v 1.13 1992/10/15 07:53:08 greyham Exp $
- #
- # UNIX makefile for manual page generator
- #
- --- 1,4 ----
- ! # $Id: Makefile,v 1.14 1992/11/20 07:54:48 greyham Exp $
- #
- # UNIX makefile for manual page generator
- #
- ***************
- *** 100,106 ****
- $(CC) $(CFLAGS) -o $@ $(OBJECTS) $(LIBS)
-
- y.tab.c: grammar.y
- ! @echo Expect 33 shift/reduce conflicts.
- $(YACC) grammar.y
-
- # don't compile y.tab.c with all warnings; yacc/bison are not up to it.
- --- 100,106 ----
- $(CC) $(CFLAGS) -o $@ $(OBJECTS) $(LIBS)
-
- y.tab.c: grammar.y
- ! @echo Expect 34 shift/reduce conflicts.
- $(YACC) grammar.y
-
- # don't compile y.tab.c with all warnings; yacc/bison are not up to it.
- *** 1.10 1992/11/03 06:17:28
- --- README 1992/11/06 03:29:16
- ***************
- *** 1,4 ****
- ! This is c2man (Version 1.9), a program for generating Unix style manual pages
- in nroff/troff -man format directly from ordinary comments embedded in C source
- code. It owes a huge debt to the public domain program cproto, by Chin Huang,
- from which much of the code is derived.
- --- 1,4 ----
- ! This is c2man (Version 1.10), a program for generating Unix style manual pages
- in nroff/troff -man format directly from ordinary comments embedded in C source
- code. It owes a huge debt to the public domain program cproto, by Chin Huang,
- from which much of the code is derived.
- *** 1.9 1992/11/03 06:17:28
- --- c2man.c 1992/11/20 07:56:13
- ***************
- *** 1,10 ****
- ! /* $Id: c2man.c,v 1.9 1992/11/03 06:17:28 greyham Exp $
- *
- * C Manual page generator.
- * Reads C source code and outputs manual pages.
- */
- #ifndef lint
- ! static char *rcsid = "$Id: c2man.c,v 1.9 1992/11/03 06:17:28 greyham Exp $";
- #endif
- #include <stdio.h>
- #include <ctype.h>
- --- 1,10 ----
- ! /* $Id: c2man.c,v 1.10 1992/11/20 07:56:01 greyham Exp $
- *
- * C Manual page generator.
- * Reads C source code and outputs manual pages.
- */
- #ifndef lint
- ! static char *rcsid = "$Id: c2man.c,v 1.10 1992/11/20 07:56:01 greyham Exp $";
- #endif
- #include <stdio.h>
- #include <ctype.h>
- *** 1.8 1992/11/03 06:17:28
- --- grammar.y 1992/11/20 07:55:14
- ***************
- *** 1,4 ****
- ! /* $Id: grammar.y,v 1.8 1992/11/03 06:17:28 greyham Exp $
- *
- * yacc grammar for C manual page generator
- * This was derived from the grammar given in Appendix A of
- --- 1,4 ----
- ! /* $Id: grammar.y,v 1.9 1992/11/20 07:54:48 greyham Exp $
- *
- * yacc grammar for C manual page generator
- * This was derived from the grammar given in Appendix A of
- ***************
- *** 534,542 ****
- $$ = $1;
- if ($2) comment_last_parameter(&$1, $2);
- }
- ! | parameter_list ',' T_ELLIPSIS
- {
- add_ident_list(&$$, &$1, strdup("..."));
- }
- ;
-
- --- 534,553 ----
- $$ = $1;
- if ($2) comment_last_parameter(&$1, $2);
- }
- ! | parameter_list ',' opt_eolcomment
- ! opt_comment T_ELLIPSIS opt_comment opt_eolcomment
- {
- + if ($3) comment_last_parameter(&$1, $3);
- add_ident_list(&$$, &$1, strdup("..."));
- +
- + switch (($4 != NULL) + ($6 != NULL) + ($7 != NULL))
- + {
- + case 0: break;
- + case 1: comment_last_parameter(&$$, $4 ? $4 : $6 ? $6 : $7);
- + break;
- + default: yyerror("ellipsis parameter has multiple comments");
- + break;
- + }
- }
- ;
-
- *** 1.12 1992/11/03 06:17:28
- --- manpage.c 1992/11/20 07:55:42
- ***************
- *** 1,4 ****
- ! /* $Id: manpage.c,v 1.12 1992/11/03 06:17:28 greyham Exp $
- * stuff to do with manual page outputing
- */
-
- --- 1,4 ----
- ! /* $Id: manpage.c,v 1.13 1992/11/20 07:54:48 greyham Exp $
- * stuff to do with manual page outputing
- */
-
- ***************
- *** 179,197 ****
- {
- Parameter *p;
-
- - /* Check for parameter names with no declaration specifiers. This
- - * happens when a parameter name appears in the identifier list of a
- - * function definition but does not appear in the parameter declaration
- - * part. The default type in this cause is "int".
- - */
- - for (p = 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");
- - }
- - }
- -
- for (p = params->first; p != NULL; p = p->next)
- {
- /* use the declarator comment if we can */
- --- 179,184 ----
- ***************
- *** 200,213 ****
- if (p->suppress) continue;
-
- put_string(".TP\n.BR \"");
- ! output_decl_spec(&p->decl_spec);
- !
- ! /* not all parameters must have declarators: might be a prototype */
- ! if (p->declarator.text)
- ! {
- ! putchar(' ');
- ! output_declarator(&p->declarator, FALSE); /* all on one line */
- ! }
-
- /* include function name if it's a duplicate */
- if (p->duplicate)
- --- 187,193 ----
- if (p->suppress) continue;
-
- put_string(".TP\n.BR \"");
- ! output_parameter(p);
-
- /* include function name if it's a duplicate */
- if (p->duplicate)
- *** 1.6 1992/08/25 06:41:02
- --- semantic.c 1992/11/20 07:55:39
- ***************
- *** 1,4 ****
- ! /* $Id: semantic.c,v 1.6 1992/08/25 06:41:02 greyham Exp $
- *
- * C manual page generator
- * These routines implement the semantic actions executed by the yacc parser.
- --- 1,4 ----
- ! /* $Id: semantic.c,v 1.7 1992/11/20 07:54:48 greyham Exp $
- *
- * C manual page generator
- * These routines implement the semantic actions executed by the yacc parser.
- ***************
- *** 468,480 ****
-
- /* Output a function parameter.
- */
- ! static void
- output_parameter (p)
- Parameter *p;
- {
- ! put_string(p->decl_spec.text);
- if (p->declarator.text) {
- ! if (strcmp(p->declarator.text, "...") != 0)
- putchar(' ');
- /* don't format parameters; keep it all on one line */
- output_declarator(&(p->declarator), FALSE);
- --- 468,491 ----
-
- /* Output a function parameter.
- */
- ! void
- output_parameter (p)
- Parameter *p;
- {
- ! if (p->decl_spec.text)
- ! put_string(p->decl_spec.text);
- ! else
- ! /* Check for parameter names with no declaration specifiers. This
- ! * happens when a parameter name appears in the identifier list of a
- ! * function definition but does not appear in the parameter declaration
- ! * part. The default type in this cause is "int".
- ! */
- ! if (p->declarator.text && strcmp(p->declarator.text, "...") != 0)
- ! put_string("int ");
- !
- ! /* not all parameters must have declarators: might be a prototype */
- if (p->declarator.text) {
- ! if (p->decl_spec.text)
- putchar(' ');
- /* don't format parameters; keep it all on one line */
- output_declarator(&(p->declarator), FALSE);
- *** 1.4 1992/08/25 06:41:02
- --- semantic.h 1992/11/20 07:55:19
- ***************
- *** 1,4 ****
- ! /* $Id: semantic.h,v 1.4 1992/08/25 06:41:02 greyham Exp $
- *
- * Declarations for semantic action routines
- */
- --- 1,4 ----
- ! /* $Id: semantic.h,v 1.5 1992/11/20 07:54:48 greyham Exp $
- *
- * Declarations for semantic action routines
- */
- ***************
- *** 96,101 ****
- --- 96,105 ----
- DeclSpec *decl_spec,
- Declarator *declarator
- );
- +
- + /* Output a function parameter.*/
- + void output_parameter (Parameter *p);
- +
- int
- remember_declarations (
- char *comment, /* comment associated */
-