revision 1.9 from Bob Corbett
authorKeith Bostic <bostic@ucbvax.Berkeley.EDU>
Tue, 25 May 1993 12:29:46 +0000 (04:29 -0800)
committerKeith Bostic <bostic@ucbvax.Berkeley.EDU>
Tue, 25 May 1993 12:29:46 +0000 (04:29 -0800)
SCCS-vsn: usr.bin/yacc/README 5.4
SCCS-vsn: usr.bin/yacc/closure.c 5.3
SCCS-vsn: usr.bin/yacc/defs.h 5.6
SCCS-vsn: usr.bin/yacc/main.c 5.5
SCCS-vsn: usr.bin/yacc/output.c 5.7
SCCS-vsn: usr.bin/yacc/skeleton.c 5.7
SCCS-vsn: usr.bin/yacc/warshall.c 5.4
SCCS-vsn: usr.bin/yacc/yacc.1 5.8
SCCS-vsn: usr.bin/yacc/test/error.tab.c 5.3
SCCS-vsn: usr.bin/yacc/test/ftp.tab.c 5.3

usr/src/usr.bin/yacc/README
usr/src/usr.bin/yacc/closure.c
usr/src/usr.bin/yacc/defs.h
usr/src/usr.bin/yacc/main.c
usr/src/usr.bin/yacc/output.c
usr/src/usr.bin/yacc/skeleton.c
usr/src/usr.bin/yacc/test/error.tab.c
usr/src/usr.bin/yacc/test/ftp.tab.c
usr/src/usr.bin/yacc/warshall.c
usr/src/usr.bin/yacc/yacc.1

index 309c231..091f233 100644 (file)
@@ -1,24 +1,23 @@
-    Berkeley Yacc is an LALR(1) parser generator.  Berkeley Yacc has been
-made as compatible as possible with AT&T Yacc.  Berkeley Yacc can accept
-any input specification that conforms to the AT&T Yacc documentation.
-Specifications that take advantage of undocumented features of AT&T Yacc
-probably will be rejected.
+    Berkeley Yacc is an LALR(1) parser generator.  Berkeley Yacc has been made
+as compatible as possible with AT&T Yacc.  Berkeley Yacc can accept any input
+specification that conforms to the AT&T Yacc documentation.  Specifications
+that take advantage of undocumented features of AT&T Yacc will probably be
+rejected.
 
 
-    Berkeley Yacc is distributed with no warranty whatever.  Any program
-of this size is almost certain to contain errors.  Neither the author nor
-any contributor takes responsibility for any consequences of its use.
+    Berkeley Yacc is distributed with no warranty whatever.  The code is certain
+to contain errors.  Neither the author nor any contributor takes responsibility
+for any consequences of its use.
 
 
-    Berkeley Yacc is in the public domain.  The data structures and
-algorithms used in Berkeley Yacc were either taken from documents
-available to the general public or were inventions of the author.
-Anyone may freely distribute source or binary forms of Berkeley Yacc
-whether unchanged or modified.  Distributors may charge whatever fees
-they can obtain for Berkeley Yacc.  Programs generated by Berkeley Yacc
-may be distributed freely.
+    Berkeley Yacc is in the public domain.  The data structures and algorithms
+used in Berkeley Yacc are all either taken from documents available to the
+general public or are inventions of the author.  Anyone may freely distribute
+source or binary forms of Berkeley Yacc whether unchanged or modified.
+Distributers may charge whatever fees they can obtain for Berkeley Yacc.
+Programs generated by Berkeley Yacc may be distributed freely.
 
     Please report bugs to
 
 
     Please report bugs to
 
-                         corbett@berkeley.edu
+                       robert.corbett@eng.Sun.COM
 
 Include a small example if possible.  Please include the banner string from
 skeleton.c with the bug report.  Do not expect rapid responses.
 
 Include a small example if possible.  Please include the banner string from
 skeleton.c with the bug report.  Do not expect rapid responses.
index 64662cc..6d02ffb 100644 (file)
@@ -9,7 +9,7 @@
  */
 
 #ifndef lint
  */
 
 #ifndef lint
-static char sccsid[] = "@(#)closure.c  5.2 (Berkeley) %G%";
+static char sccsid[] = "@(#)closure.c  5.3 (Berkeley) %G%";
 #endif /* not lint */
 
 #include "defs.h"
 #endif /* not lint */
 
 #include "defs.h"
@@ -60,58 +60,56 @@ set_EFF()
 
 set_first_derives()
 {
 
 set_first_derives()
 {
-  register unsigned *rrow;
-  register unsigned *vrow;
-  register int j;
-  register unsigned mask;
-  register unsigned cword;
-  register short *rp;
-
-  int rule;
-  int i;
-  int rulesetsize;
-  int varsetsize;
-
-  rulesetsize = WORDSIZE(nrules);
-  varsetsize = WORDSIZE(nvars);
-  first_derives = NEW2(nvars * rulesetsize, unsigned) - ntokens * rulesetsize;
-
-  set_EFF();
-
-  rrow = first_derives + ntokens * rulesetsize;
-  for (i = start_symbol; i < nsyms; i++)
+    register unsigned *rrow;
+    register unsigned *vrow;
+    register int j;
+    register unsigned k;
+    register unsigned cword;
+    register short *rp;
+
+    int rule;
+    int i;
+    int rulesetsize;
+    int varsetsize;
+
+    rulesetsize = WORDSIZE(nrules);
+    varsetsize = WORDSIZE(nvars);
+    first_derives = NEW2(nvars * rulesetsize, unsigned) - ntokens * rulesetsize;
+
+    set_EFF();
+
+    rrow = first_derives + ntokens * rulesetsize;
+    for (i = start_symbol; i < nsyms; i++)
     {
     {
-      vrow = EFF + ((i - ntokens) * varsetsize);
-      cword = *vrow++;
-      mask = 1;
-      for (j = start_symbol; j < nsyms; j++)
+       vrow = EFF + ((i - ntokens) * varsetsize);
+       k = BITS_PER_WORD;
+       for (j = start_symbol; j < nsyms; k++, j++)
        {
        {
-         if (cword & mask)
+           if (k >= BITS_PER_WORD)
            {
            {
-             rp = derives[j];
-             while ((rule = *rp++) >= 0)
-               {
-                 SETBIT(rrow, rule);
-               }
+               cword = *vrow++;
+               k = 0;
            }
 
            }
 
-         mask <<= 1;
-         if (mask == 0)
+           if (cword & (1 << k))
            {
            {
-             cword = *vrow++;
-             mask = 1;
+               rp = derives[j];
+               while ((rule = *rp++) >= 0)
+               {
+                   SETBIT(rrow, rule);
+               }
            }
        }
 
            }
        }
 
-      vrow += varsetsize;
-      rrow += rulesetsize;
+       vrow += varsetsize;
+       rrow += rulesetsize;
     }
 
 #ifdef DEBUG
     }
 
 #ifdef DEBUG
-  print_first_derives();
+    print_first_derives();
 #endif
 
 #endif
 
-  FREE(EFF);
+    FREE(EFF);
 }
 
 
 }
 
 
@@ -121,7 +119,7 @@ int n;
 {
     register int ruleno;
     register unsigned word;
 {
     register int ruleno;
     register unsigned word;
-    register unsigned mask;
+    register unsigned i;
     register short *csp;
     register unsigned *dsp;
     register unsigned *rsp;
     register short *csp;
     register unsigned *dsp;
     register unsigned *rsp;
@@ -157,27 +155,22 @@ int n;
     for (rsp = ruleset; rsp < rsend; ++rsp)
     {
        word = *rsp;
     for (rsp = ruleset; rsp < rsend; ++rsp)
     {
        word = *rsp;
-       if (word == 0)
-           ruleno += BITS_PER_WORD;
-       else
+       if (word)
        {
        {
-           mask = 1;
-           while (mask)
+           for (i = 0; i < BITS_PER_WORD; ++i)
            {
            {
-               if (word & mask)
+               if (word & (1 << i))
                {
                {
-                   itemno = rrhs[ruleno];
+                   itemno = rrhs[ruleno+i];
                    while (csp < csend && *csp < itemno)
                        *itemsetend++ = *csp++;
                    *itemsetend++ = itemno;
                    while (csp < csend && *csp == itemno)
                        ++csp;
                }
                    while (csp < csend && *csp < itemno)
                        *itemsetend++ = *csp++;
                    *itemsetend++ = itemno;
                    while (csp < csend && *csp == itemno)
                        ++csp;
                }
-
-                   mask <<= 1;
-                   ++ruleno;
            }
        }
            }
        }
+       ruleno += BITS_PER_WORD;
     }
 
     while (csp < csend)
     }
 
     while (csp < csend)
@@ -213,10 +206,10 @@ int n;
 
 print_EFF()
 {
 
 print_EFF()
 {
-    register int i, j, k;
+    register int i, j;
     register unsigned *rowp;
     register unsigned word;
     register unsigned *rowp;
     register unsigned word;
-    register unsigned mask;
+    register unsigned k;
 
     printf("\n\nEpsilon Free Firsts\n");
 
 
     printf("\n\nEpsilon Free Firsts\n");
 
@@ -226,18 +219,17 @@ print_EFF()
        rowp = EFF + ((i - start_symbol) * WORDSIZE(nvars));
        word = *rowp++;
 
        rowp = EFF + ((i - start_symbol) * WORDSIZE(nvars));
        word = *rowp++;
 
-       mask = 1;
-       for (j = 0; j < nvars; j++)
+       k = BITS_PER_WORD;
+       for (j = 0; j < nvars; k++, j++)
        {
        {
-           if (word & mask)
-               printf("  %s", symbol_name[start_symbol + j]);
-
-           mask <<= 1;
-           if (mask == 0)
+           if (k >= BITS_PER_WORD)
            {
                word = *rowp++;
            {
                word = *rowp++;
-               mask = 1;
+               k = 0;
            }
            }
+
+           if (word & (1 << k))
+               printf("  %s", symbol_name[start_symbol + j]);
        }
     }
 }
        }
     }
 }
@@ -245,31 +237,29 @@ print_EFF()
 
 print_first_derives()
 {
 
 print_first_derives()
 {
-  register int i;
-  register int j;
-  register unsigned *rp;
-  register unsigned cword;
-  register unsigned mask;
+    register int i;
+    register int j;
+    register unsigned *rp;
+    register unsigned cword;
+    register unsigned k;
 
 
-  printf("\n\n\nFirst Derives\n");
+    printf("\n\n\nFirst Derives\n");
 
 
-  for (i = start_symbol; i < nsyms; i++)
+    for (i = start_symbol; i < nsyms; i++)
     {
     {
-      printf("\n%s derives\n", symbol_name[i]);
-      rp = first_derives + i * WORDSIZE(nrules);
-      cword = *rp++;
-      mask = 1;
-      for (j = 0; j <= nrules; j++)
+       printf("\n%s derives\n", symbol_name[i]);
+       rp = first_derives + i * WORDSIZE(nrules);
+       k = BITS_PER_WORD;
+       for (j = 0; j <= nrules; k++, j++)
         {
         {
-         if (cword & mask)
-           printf("   %d\n", j);
-
-         mask <<= 1;
-         if (mask == 0)
-           {
+         if (k >= BITS_PER_WORD)
+         {
              cword = *rp++;
              cword = *rp++;
-             mask = 1;
-           }
+             k = 0;
+         }
+
+         if (cword & (1 << k))
+           printf("   %d\n", j);
        }
     }
 
        }
     }
 
index 3b7d43a..af498b5 100644 (file)
@@ -7,7 +7,7 @@
  *
  * %sccs.include.redist.c%
  *
  *
  * %sccs.include.redist.c%
  *
- *     @(#)defs.h      5.5 (Berkeley) %G%
+ *     @(#)defs.h      5.6 (Berkeley) %G%
  */
 
 #include <assert.h>
  */
 
 #include <assert.h>
@@ -195,6 +195,7 @@ extern char lflag;
 extern char rflag;
 extern char tflag;
 extern char vflag;
 extern char rflag;
 extern char tflag;
 extern char vflag;
+extern char *symbol_prefix;
 
 extern char *myname;
 extern char *cptr;
 
 extern char *myname;
 extern char *cptr;
index 26e754d..b805846 100644 (file)
@@ -15,7 +15,7 @@ char copyright[] =
 #endif /* not lint */
 
 #ifndef lint
 #endif /* not lint */
 
 #ifndef lint
-static char sccsid[] = "@(#)main.c     5.4 (Berkeley) %G%";
+static char sccsid[] = "@(#)main.c     5.5 (Berkeley) %G%";
 #endif /* not lint */
 
 #include <signal.h>
 #endif /* not lint */
 
 #include <signal.h>
@@ -27,6 +27,7 @@ char rflag;
 char tflag;
 char vflag;
 
 char tflag;
 char vflag;
 
+char *symbol_prefix;
 char *file_prefix = "y";
 char *myname = "yacc";
 char *temp_form = "yacc.XXXXXXX";
 char *file_prefix = "y";
 char *myname = "yacc";
 char *temp_form = "yacc.XXXXXXX";
@@ -91,7 +92,8 @@ int k;
 
 
 void
 
 
 void
-onintr()
+onintr(signo)
+       int signo;
 {
     done(1);
 }
 {
     done(1);
 }
@@ -116,7 +118,7 @@ set_signals()
 
 usage()
 {
 
 usage()
 {
-    fprintf(stderr, "usage: %s [-dlrtv] [-b file_prefix] filename\n", myname);
+    fprintf(stderr, "usage: %s [-dlrtv] [-b file_prefix] [-p symbol_prefix] filename\n", myname);
     exit(1);
 }
 
     exit(1);
 }
 
@@ -161,6 +163,15 @@ char *argv[];
            lflag = 1;
            break;
 
            lflag = 1;
            break;
 
+       case 'p':
+           if (*++s)
+               symbol_prefix = s;
+           else if (++i < argc)
+               symbol_prefix = argv[i];
+           else
+               usage();
+           continue;
+
        case 'r':
            rflag = 1;
            break;
        case 'r':
            rflag = 1;
            break;
index 39cbcab..1686753 100644 (file)
@@ -9,7 +9,7 @@
  */
 
 #ifndef lint
  */
 
 #ifndef lint
-static char sccsid[] = "@(#)output.c   5.6 (Berkeley) %G%";
+static char sccsid[] = "@(#)output.c   5.7 (Berkeley) %G%";
 #endif /* not lint */
 
 #include "defs.h"
 #endif /* not lint */
 
 #include "defs.h"
@@ -36,6 +36,7 @@ output()
     free_itemsets();
     free_shifts();
     free_reductions();
     free_itemsets();
     free_shifts();
     free_reductions();
+    output_prefix();
     output_stored_text();
     output_defines();
     output_rule_data();
     output_stored_text();
     output_defines();
     output_rule_data();
@@ -53,13 +54,73 @@ output()
 }
 
 
 }
 
 
+output_prefix()
+{
+    if (symbol_prefix == NULL)
+       symbol_prefix = "yy";
+    else
+    {
+       ++outline;
+       fprintf(code_file, "#define yyparse %sparse\n", symbol_prefix);
+       ++outline;
+       fprintf(code_file, "#define yylex %slex\n", symbol_prefix);
+       ++outline;
+       fprintf(code_file, "#define yyerror %serror\n", symbol_prefix);
+       ++outline;
+       fprintf(code_file, "#define yychar %schar\n", symbol_prefix);
+       ++outline;
+       fprintf(code_file, "#define yyval %sval\n", symbol_prefix);
+       ++outline;
+       fprintf(code_file, "#define yylval %slval\n", symbol_prefix);
+       ++outline;
+       fprintf(code_file, "#define yydebug %sdebug\n", symbol_prefix);
+       ++outline;
+       fprintf(code_file, "#define yynerrs %snerrs\n", symbol_prefix);
+       ++outline;
+       fprintf(code_file, "#define yyerrflag %serrflag\n", symbol_prefix);
+       ++outline;
+       fprintf(code_file, "#define yyss %sss\n", symbol_prefix);
+       ++outline;
+       fprintf(code_file, "#define yyssp %sssp\n", symbol_prefix);
+       ++outline;
+       fprintf(code_file, "#define yyvs %svs\n", symbol_prefix);
+       ++outline;
+       fprintf(code_file, "#define yyvsp %svsp\n", symbol_prefix);
+       ++outline;
+       fprintf(code_file, "#define yylhs %slhs\n", symbol_prefix);
+       ++outline;
+       fprintf(code_file, "#define yylen %slen\n", symbol_prefix);
+       ++outline;
+       fprintf(code_file, "#define yydefred %sdefred\n", symbol_prefix);
+       ++outline;
+       fprintf(code_file, "#define yydgoto %sdgoto\n", symbol_prefix);
+       ++outline;
+       fprintf(code_file, "#define yysindex %ssindex\n", symbol_prefix);
+       ++outline;
+       fprintf(code_file, "#define yyrindex %srindex\n", symbol_prefix);
+       ++outline;
+       fprintf(code_file, "#define yygindex %sgindex\n", symbol_prefix);
+       ++outline;
+       fprintf(code_file, "#define yytable %stable\n", symbol_prefix);
+       ++outline;
+       fprintf(code_file, "#define yycheck %scheck\n", symbol_prefix);
+       ++outline;
+       fprintf(code_file, "#define yyname %sname\n", symbol_prefix);
+       ++outline;
+       fprintf(code_file, "#define yyrule %srule\n", symbol_prefix);
+    }
+    ++outline;
+    fprintf(code_file, "#define YYPREFIX \"%s\"\n", symbol_prefix);
+}
+
+
 output_rule_data()
 {
     register int i;
     register int j;
 
   
 output_rule_data()
 {
     register int i;
     register int j;
 
   
-    fprintf(output_file, "short yylhs[] = {%42d,",
+    fprintf(output_file, "short %slhs[] = {%42d,", symbol_prefix,
            symbol_value[start_symbol]);
 
     j = 10;
            symbol_value[start_symbol]);
 
     j = 10;
@@ -79,7 +140,7 @@ output_rule_data()
     if (!rflag) outline += 2;
     fprintf(output_file, "\n};\n");
 
     if (!rflag) outline += 2;
     fprintf(output_file, "\n};\n");
 
-    fprintf(output_file, "short yylen[] = {%42d,", 2);
+    fprintf(output_file, "short %slen[] = {%42d,", symbol_prefix, 2);
 
     j = 10;
     for (i = 3; i < nrules; i++)
 
     j = 10;
     for (i = 3; i < nrules; i++)
@@ -104,7 +165,7 @@ output_yydefred()
 {
     register int i, j;
 
 {
     register int i, j;
 
-    fprintf(output_file, "short yydefred[] = {%39d,",
+    fprintf(output_file, "short %sdefred[] = {%39d,", symbol_prefix,
            (defred[0] ? defred[0] - 2 : 0));
 
     j = 10;
            (defred[0] ? defred[0] - 2 : 0));
 
     j = 10;
@@ -246,7 +307,7 @@ goto_actions()
     state_count = NEW2(nstates, short);
 
     k = default_goto(start_symbol + 1);
     state_count = NEW2(nstates, short);
 
     k = default_goto(start_symbol + 1);
-    fprintf(output_file, "short yydgoto[] = {%40d,", k);
+    fprintf(output_file, "short %sdgoto[] = {%40d,", symbol_prefix, k);
     save_column(start_symbol + 1, k);
 
     j = 10;
     save_column(start_symbol + 1, k);
 
     j = 10;
@@ -570,7 +631,7 @@ output_base()
 {
     register int i, j;
 
 {
     register int i, j;
 
-    fprintf(output_file, "short yysindex[] = {%39d,", base[0]);
+    fprintf(output_file, "short %ssindex[] = {%39d,", symbol_prefix, base[0]);
 
     j = 10;
     for (i = 1; i < nstates; i++)
 
     j = 10;
     for (i = 1; i < nstates; i++)
@@ -588,7 +649,7 @@ output_base()
     }
 
     if (!rflag) outline += 2;
     }
 
     if (!rflag) outline += 2;
-    fprintf(output_file, "\n};\nshort yyrindex[] = {%39d,",
+    fprintf(output_file, "\n};\nshort %srindex[] = {%39d,", symbol_prefix,
            base[nstates]);
 
     j = 10;
            base[nstates]);
 
     j = 10;
@@ -607,7 +668,7 @@ output_base()
     }
 
     if (!rflag) outline += 2;
     }
 
     if (!rflag) outline += 2;
-    fprintf(output_file, "\n};\nshort yygindex[] = {%39d,",
+    fprintf(output_file, "\n};\nshort %sgindex[] = {%39d,", symbol_prefix,
            base[2*nstates]);
 
     j = 10;
            base[2*nstates]);
 
     j = 10;
@@ -639,7 +700,8 @@ output_table()
 
     ++outline;
     fprintf(code_file, "#define YYTABLESIZE %d\n", high);
 
     ++outline;
     fprintf(code_file, "#define YYTABLESIZE %d\n", high);
-    fprintf(output_file, "short yytable[] = {%40d,", table[0]);
+    fprintf(output_file, "short %stable[] = {%40d,", symbol_prefix,
+           table[0]);
 
     j = 10;
     for (i = 1; i <= high; i++)
 
     j = 10;
     for (i = 1; i <= high; i++)
@@ -668,7 +730,8 @@ output_check()
     register int i;
     register int j;
 
     register int i;
     register int j;
 
-    fprintf(output_file, "short yycheck[] = {%40d,", check[0]);
+    fprintf(output_file, "short %scheck[] = {%40d,", symbol_prefix,
+           check[0]);
 
     j = 10;
     for (i = 1; i <= high; i++)
 
     j = 10;
     for (i = 1; i <= high; i++)
@@ -770,7 +833,8 @@ output_defines()
        if (union_file == NULL) open_error(union_file_name);
        while ((c = getc(union_file)) != EOF)
            putc(c, defines_file);
        if (union_file == NULL) open_error(union_file_name);
        while ((c = getc(union_file)) != EOF)
            putc(c, defines_file);
-       fprintf(defines_file, " YYSTYPE;\nextern YYSTYPE yylval;\n");
+       fprintf(defines_file, " YYSTYPE;\nextern YYSTYPE %slval;\n",
+               symbol_prefix);
     }
 }
 
     }
 }
 
@@ -835,7 +899,7 @@ output_debug()
     symnam[0] = "end-of-file";
 
     if (!rflag) ++outline;
     symnam[0] = "end-of-file";
 
     if (!rflag) ++outline;
-    fprintf(output_file, "#if YYDEBUG\nchar *yyname[] = {");
+    fprintf(output_file, "#if YYDEBUG\nchar *%sname[] = {", symbol_prefix);
     j = 80;
     for (i = 0; i <= max; ++i)
     {
     j = 80;
     for (i = 0; i <= max; ++i)
     {
@@ -961,7 +1025,7 @@ output_debug()
     FREE(symnam);
 
     if (!rflag) ++outline;
     FREE(symnam);
 
     if (!rflag) ++outline;
-    fprintf(output_file, "char *yyrule[] = {\n");
+    fprintf(output_file, "char *%srule[] = {\n", symbol_prefix);
     for (i = 2; i < nrules; ++i)
     {
        fprintf(output_file, "\"%s :", symbol_name[rlhs[i]]);
     for (i = 2; i < nrules; ++i)
     {
        fprintf(output_file, "\"%s :", symbol_name[rlhs[i]]);
index 3d6ca10..4d41b55 100644 (file)
@@ -9,23 +9,34 @@
  */
 
 #ifndef lint
  */
 
 #ifndef lint
-static char sccsid[] = "@(#)skeleton.c 5.6 (Berkeley) %G%";
+static char sccsid[] = "@(#)skeleton.c 5.7 (Berkeley) %G%";
 #endif /* not lint */
 
 #include "defs.h"
 
 #endif /* not lint */
 
 #include "defs.h"
 
-/*  The banner used here should be replaced with an #ident directive   */
-/*  if the target C compiler supports #ident directives.               */
+/*  The definition of yysccsid in the banner should be replaced with   */
+/*  a #pragma ident directive if the target C compiler supports                */
+/*  #pragma ident directives.                                          */
 /*                                                                     */
 /*  If the skeleton is changed, the banner should be changed so that   */
 /*                                                                     */
 /*  If the skeleton is changed, the banner should be changed so that   */
-/*  the altered version can easily be distinguished from the original. */
+/*  the altered version can be easily distinguished from the original. */
+/*                                                                     */
+/*  The #defines included with the banner are there because they are   */
+/*  useful in subsequent code.  The macros #defined in the header or   */
+/*  the body either are not useful outside of semantic actions or      */
+/*  are conditional.                                                   */
 
 char *banner[] =
 {
     "#ifndef lint",
 
 char *banner[] =
 {
     "#ifndef lint",
-    "static char yysccsid[] = \"@(#)yaccpar    1.8 (Berkeley) 01/20/90\";",
+    "static char yysccsid[] = \"@(#)yaccpar    1.9 (Berkeley) 02/21/93\";",
     "#endif",
     "#define YYBYACC 1",
     "#endif",
     "#define YYBYACC 1",
+    "#define YYMAJOR 1",
+    "#define YYMINOR 9",
+    "#define yyclearin (yychar=(-1))",
+    "#define yyerrok (yyerrflag=0)",
+    "#define YYRECOVERING (yyerrflag!=0)",
     0
 };
 
     0
 };
 
@@ -51,12 +62,9 @@ char *tables[] =
 
 char *header[] =
 {
 
 char *header[] =
 {
-    "#define yyclearin (yychar=(-1))",
-    "#define yyerrok (yyerrflag=0)",
     "#ifdef YYSTACKSIZE",
     "#ifdef YYSTACKSIZE",
-    "#ifndef YYMAXDEPTH",
+    "#undef YYMAXDEPTH",
     "#define YYMAXDEPTH YYSTACKSIZE",
     "#define YYMAXDEPTH YYSTACKSIZE",
-    "#endif",
     "#else",
     "#ifdef YYMAXDEPTH",
     "#define YYSTACKSIZE YYMAXDEPTH",
     "#else",
     "#ifdef YYMAXDEPTH",
     "#define YYSTACKSIZE YYMAXDEPTH",
@@ -83,6 +91,7 @@ char *header[] =
 char *body[] =
 {
     "#define YYABORT goto yyabort",
 char *body[] =
 {
     "#define YYABORT goto yyabort",
+    "#define YYREJECT goto yyabort",
     "#define YYACCEPT goto yyaccept",
     "#define YYERROR goto yyerrlab",
     "int",
     "#define YYACCEPT goto yyaccept",
     "#define YYERROR goto yyerrlab",
     "int",
@@ -120,8 +129,8 @@ char *body[] =
     "            yys = 0;",
     "            if (yychar <= YYMAXTOKEN) yys = yyname[yychar];",
     "            if (!yys) yys = \"illegal-symbol\";",
     "            yys = 0;",
     "            if (yychar <= YYMAXTOKEN) yys = yyname[yychar];",
     "            if (!yys) yys = \"illegal-symbol\";",
-    "            printf(\"yydebug: state %d, reading %d (%s)\\n\", yystate,",
-    "                    yychar, yys);",
+    "            printf(\"%sdebug: state %d, reading %d (%s)\\n\",",
+    "                    YYPREFIX, yystate, yychar, yys);",
     "        }",
     "#endif",
     "    }",
     "        }",
     "#endif",
     "    }",
@@ -130,8 +139,8 @@ char *body[] =
     "    {",
     "#if YYDEBUG",
     "        if (yydebug)",
     "    {",
     "#if YYDEBUG",
     "        if (yydebug)",
-    "            printf(\"yydebug: state %d, shifting to state %d\\n\",",
-    "                    yystate, yytable[yyn]);",
+    "            printf(\"%sdebug: state %d, shifting to state %d\\n\",",
+    "                    YYPREFIX, yystate, yytable[yyn]);",
     "#endif",
     "        if (yyssp >= yyss + yystacksize - 1)",
     "        {",
     "#endif",
     "        if (yyssp >= yyss + yystacksize - 1)",
     "        {",
@@ -171,8 +180,8 @@ char *body[] =
     "            {",
     "#if YYDEBUG",
     "                if (yydebug)",
     "            {",
     "#if YYDEBUG",
     "                if (yydebug)",
-    "                    printf(\"yydebug: state %d, error recovery shifting\\",
-    " to state %d\\n\", *yyssp, yytable[yyn]);",
+    "                    printf(\"%sdebug: state %d, error recovery shifting\\",
+    " to state %d\\n\", YYPREFIX, *yyssp, yytable[yyn]);",
     "#endif",
     "                if (yyssp >= yyss + yystacksize - 1)",
     "                {",
     "#endif",
     "                if (yyssp >= yyss + yystacksize - 1)",
     "                {",
@@ -186,9 +195,9 @@ char *body[] =
     "            {",
     "#if YYDEBUG",
     "                if (yydebug)",
     "            {",
     "#if YYDEBUG",
     "                if (yydebug)",
-    "                    printf(\"yydebug: error recovery discarding state %d\
+    "                    printf(\"%sdebug: error recovery discarding state %d\
 \\n\",",
 \\n\",",
-    "                            *yyssp);",
+    "                            YYPREFIX, *yyssp);",
     "#endif",
     "                if (yyssp <= yyss) goto yyabort;",
     "                --yyssp;",
     "#endif",
     "                if (yyssp <= yyss) goto yyabort;",
     "                --yyssp;",
@@ -205,9 +214,9 @@ char *body[] =
     "            yys = 0;",
     "            if (yychar <= YYMAXTOKEN) yys = yyname[yychar];",
     "            if (!yys) yys = \"illegal-symbol\";",
     "            yys = 0;",
     "            if (yychar <= YYMAXTOKEN) yys = yyname[yychar];",
     "            if (!yys) yys = \"illegal-symbol\";",
-    "            printf(\"yydebug: state %d, error recovery discards token %d\
+    "            printf(\"%sdebug: state %d, error recovery discards token %d\
  (%s)\\n\",",
  (%s)\\n\",",
-    "                    yystate, yychar, yys);",
+    "                    YYPREFIX, yystate, yychar, yys);",
     "        }",
     "#endif",
     "        yychar = (-1);",
     "        }",
     "#endif",
     "        yychar = (-1);",
@@ -216,8 +225,8 @@ char *body[] =
     "yyreduce:",
     "#if YYDEBUG",
     "    if (yydebug)",
     "yyreduce:",
     "#if YYDEBUG",
     "    if (yydebug)",
-    "        printf(\"yydebug: state %d, reducing by rule %d (%s)\\n\",",
-    "                yystate, yyn, yyrule[yyn]);",
+    "        printf(\"%sdebug: state %d, reducing by rule %d (%s)\\n\",",
+    "                YYPREFIX, yystate, yyn, yyrule[yyn]);",
     "#endif",
     "    yym = yylen[yyn];",
     "    yyval = yyvsp[1-yym];",
     "#endif",
     "    yym = yylen[yyn];",
     "    yyval = yyvsp[1-yym];",
@@ -238,8 +247,8 @@ char *trailer[] =
     "    {",
     "#if YYDEBUG",
     "        if (yydebug)",
     "    {",
     "#if YYDEBUG",
     "        if (yydebug)",
-    "            printf(\"yydebug: after reduction, shifting from state 0 to\\",
-    " state %d\\n\", YYFINAL);",
+    "            printf(\"%sdebug: after reduction, shifting from state 0 to\\",
+    " state %d\\n\", YYPREFIX, YYFINAL);",
     "#endif",
     "        yystate = YYFINAL;",
     "        *++yyssp = YYFINAL;",
     "#endif",
     "        yystate = YYFINAL;",
     "        *++yyssp = YYFINAL;",
@@ -253,8 +262,8 @@ char *trailer[] =
     "                yys = 0;",
     "                if (yychar <= YYMAXTOKEN) yys = yyname[yychar];",
     "                if (!yys) yys = \"illegal-symbol\";",
     "                yys = 0;",
     "                if (yychar <= YYMAXTOKEN) yys = yyname[yychar];",
     "                if (!yys) yys = \"illegal-symbol\";",
-    "                printf(\"yydebug: state %d, reading %d (%s)\\n\",",
-    "                        YYFINAL, yychar, yys);",
+    "                printf(\"%sdebug: state %d, reading %d (%s)\\n\",",
+    "                        YYPREFIX, YYFINAL, yychar, yys);",
     "            }",
     "#endif",
     "        }",
     "            }",
     "#endif",
     "        }",
@@ -268,8 +277,8 @@ char *trailer[] =
     "        yystate = yydgoto[yym];",
     "#if YYDEBUG",
     "    if (yydebug)",
     "        yystate = yydgoto[yym];",
     "#if YYDEBUG",
     "    if (yydebug)",
-    "        printf(\"yydebug: after reduction, shifting from state %d \\",
-    "to state %d\\n\", *yyssp, yystate);",
+    "        printf(\"%sdebug: after reduction, shifting from state %d \\",
+    "to state %d\\n\", YYPREFIX, *yyssp, yystate);",
     "#endif",
     "    if (yyssp >= yyss + yystacksize - 1)",
     "    {",
     "#endif",
     "    if (yyssp >= yyss + yystacksize - 1)",
     "    {",
@@ -292,13 +301,20 @@ char *trailer[] =
 write_section(section)
 char *section[];
 {
 write_section(section)
 char *section[];
 {
+    register int c;
     register int i;
     register int i;
-    register FILE *fp;
+    register char *s;
+    register FILE *f;
 
 
-    fp = code_file;
-    for (i = 0; section[i]; ++i)
+    f = code_file;
+    for (i = 0; s = section[i]; ++i)
     {
        ++outline;
     {
        ++outline;
-       fprintf(fp, "%s\n", section[i]);
+       while (c = *s)
+       {
+           putc(c, f);
+           ++s;
+       }
+       putc('\n', f);
     }
 }
     }
 }
index c339417..ffc6e37 100644 (file)
@@ -1,6 +1,13 @@
 #ifndef lint
 #ifndef lint
-char yysccsid[] = "@(#)yaccpar 1.3 (Berkeley) 01/21/90";
+static char yysccsid[] = "@(#)yaccpar  1.9 (Berkeley) 02/21/93";
 #endif
 #endif
+#define YYBYACC 1
+#define YYMAJOR 1
+#define YYMINOR 9
+#define yyclearin (yychar=(-1))
+#define yyerrok (yyerrflag=0)
+#define YYRECOVERING (yyerrflag!=0)
+#define YYPREFIX "yy"
 #define YYERRCODE 256
 short yylhs[] = {                                        -1,
     0,
 #define YYERRCODE 256
 short yylhs[] = {                                        -1,
     0,
@@ -43,13 +50,15 @@ char *yyrule[] = {
 #ifndef YYSTYPE
 typedef int YYSTYPE;
 #endif
 #ifndef YYSTYPE
 typedef int YYSTYPE;
 #endif
-#define yyclearin (yychar=(-1))
-#define yyerrok (yyerrflag=0)
-#ifndef YYSTACKSIZE
+#ifdef YYSTACKSIZE
+#undef YYMAXDEPTH
+#define YYMAXDEPTH YYSTACKSIZE
+#else
 #ifdef YYMAXDEPTH
 #define YYSTACKSIZE YYMAXDEPTH
 #else
 #ifdef YYMAXDEPTH
 #define YYSTACKSIZE YYMAXDEPTH
 #else
-#define YYSTACKSIZE 300
+#define YYSTACKSIZE 500
+#define YYMAXDEPTH 500
 #endif
 #endif
 int yydebug;
 #endif
 #endif
 int yydebug;
@@ -60,15 +69,16 @@ short *yyssp;
 YYSTYPE *yyvsp;
 YYSTYPE yyval;
 YYSTYPE yylval;
 YYSTYPE *yyvsp;
 YYSTYPE yyval;
 YYSTYPE yylval;
-#define yystacksize YYSTACKSIZE
 short yyss[YYSTACKSIZE];
 YYSTYPE yyvs[YYSTACKSIZE];
 short yyss[YYSTACKSIZE];
 YYSTYPE yyvs[YYSTACKSIZE];
+#define yystacksize YYSTACKSIZE
 #line 4 "error.y"
 main(){printf("yyparse() = %d\n",yyparse());}
 yylex(){return-1;}
 yyerror(s)char*s;{printf("%s\n",s);}
 #line 4 "error.y"
 main(){printf("yyparse() = %d\n",yyparse());}
 yylex(){return-1;}
 yyerror(s)char*s;{printf("%s\n",s);}
-#line 70 "error.tab.c"
+#line 80 "error.tab.c"
 #define YYABORT goto yyabort
 #define YYABORT goto yyabort
+#define YYREJECT goto yyabort
 #define YYACCEPT goto yyaccept
 #define YYERROR goto yyerrlab
 int
 #define YYACCEPT goto yyaccept
 #define YYERROR goto yyerrlab
 int
@@ -82,9 +92,7 @@ yyparse()
     if (yys = getenv("YYDEBUG"))
     {
         yyn = *yys;
     if (yys = getenv("YYDEBUG"))
     {
         yyn = *yys;
-        if (yyn == '0')
-            yydebug = 0;
-        else if (yyn >= '1' && yyn <= '9')
+        if (yyn >= '0' && yyn <= '9')
             yydebug = yyn - '0';
     }
 #endif
             yydebug = yyn - '0';
     }
 #endif
@@ -108,8 +116,8 @@ yyloop:
             yys = 0;
             if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
             if (!yys) yys = "illegal-symbol";
             yys = 0;
             if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
             if (!yys) yys = "illegal-symbol";
-            printf("yydebug: state %d, reading %d (%s)\n", yystate,
-                    yychar, yys);
+            printf("%sdebug: state %d, reading %d (%s)\n",
+                    YYPREFIX, yystate, yychar, yys);
         }
 #endif
     }
         }
 #endif
     }
@@ -118,8 +126,8 @@ yyloop:
     {
 #if YYDEBUG
         if (yydebug)
     {
 #if YYDEBUG
         if (yydebug)
-            printf("yydebug: state %d, shifting to state %d\n",
-                    yystate, yytable[yyn]);
+            printf("%sdebug: state %d, shifting to state %d\n",
+                    YYPREFIX, yystate, yytable[yyn]);
 #endif
         if (yyssp >= yyss + yystacksize - 1)
         {
 #endif
         if (yyssp >= yyss + yystacksize - 1)
         {
@@ -159,8 +167,8 @@ yyinrecovery:
             {
 #if YYDEBUG
                 if (yydebug)
             {
 #if YYDEBUG
                 if (yydebug)
-                    printf("yydebug: state %d, error recovery shifting\
- to state %d\n", *yyssp, yytable[yyn]);
+                    printf("%sdebug: state %d, error recovery shifting\
+ to state %d\n", YYPREFIX, *yyssp, yytable[yyn]);
 #endif
                 if (yyssp >= yyss + yystacksize - 1)
                 {
 #endif
                 if (yyssp >= yyss + yystacksize - 1)
                 {
@@ -174,8 +182,8 @@ yyinrecovery:
             {
 #if YYDEBUG
                 if (yydebug)
             {
 #if YYDEBUG
                 if (yydebug)
-                    printf("yydebug: error recovery discarding state %d\n",
-                            *yyssp);
+                    printf("%sdebug: error recovery discarding state %d\n",
+                            YYPREFIX, *yyssp);
 #endif
                 if (yyssp <= yyss) goto yyabort;
                 --yyssp;
 #endif
                 if (yyssp <= yyss) goto yyabort;
                 --yyssp;
@@ -192,8 +200,8 @@ yyinrecovery:
             yys = 0;
             if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
             if (!yys) yys = "illegal-symbol";
             yys = 0;
             if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
             if (!yys) yys = "illegal-symbol";
-            printf("yydebug: state %d, error recovery discards token %d (%s)\n",
-                    yystate, yychar, yys);
+            printf("%sdebug: state %d, error recovery discards token %d (%s)\n",
+                    YYPREFIX, yystate, yychar, yys);
         }
 #endif
         yychar = (-1);
         }
 #endif
         yychar = (-1);
@@ -202,8 +210,8 @@ yyinrecovery:
 yyreduce:
 #if YYDEBUG
     if (yydebug)
 yyreduce:
 #if YYDEBUG
     if (yydebug)
-        printf("yydebug: state %d, reducing by rule %d (%s)\n",
-                yystate, yyn, yyrule[yyn]);
+        printf("%sdebug: state %d, reducing by rule %d (%s)\n",
+                YYPREFIX, yystate, yyn, yyrule[yyn]);
 #endif
     yym = yylen[yyn];
     yyval = yyvsp[1-yym];
 #endif
     yym = yylen[yyn];
     yyval = yyvsp[1-yym];
@@ -216,10 +224,10 @@ yyreduce:
     yym = yylhs[yyn];
     if (yystate == 0 && yym == 0)
     {
     yym = yylhs[yyn];
     if (yystate == 0 && yym == 0)
     {
-#ifdef YYDEBUG
+#if YYDEBUG
         if (yydebug)
         if (yydebug)
-            printf("yydebug: after reduction, shifting from state 0 to\
- state %d\n", YYFINAL);
+            printf("%sdebug: after reduction, shifting from state 0 to\
+ state %d\n", YYPREFIX, YYFINAL);
 #endif
         yystate = YYFINAL;
         *++yyssp = YYFINAL;
 #endif
         yystate = YYFINAL;
         *++yyssp = YYFINAL;
@@ -233,8 +241,8 @@ yyreduce:
                 yys = 0;
                 if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
                 if (!yys) yys = "illegal-symbol";
                 yys = 0;
                 if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
                 if (!yys) yys = "illegal-symbol";
-                printf("yydebug: state %d, reading %d (%s)\n",
-                        YYFINAL, yychar, yys);
+                printf("%sdebug: state %d, reading %d (%s)\n",
+                        YYPREFIX, YYFINAL, yychar, yys);
             }
 #endif
         }
             }
 #endif
         }
@@ -246,10 +254,10 @@ yyreduce:
         yystate = yytable[yyn];
     else
         yystate = yydgoto[yym];
         yystate = yytable[yyn];
     else
         yystate = yydgoto[yym];
-#ifdef YYDEBUG
+#if YYDEBUG
     if (yydebug)
     if (yydebug)
-        printf("yydebug: after reduction, shifting from state %d \
-to state %d\n", *yyssp, yystate);
+        printf("%sdebug: after reduction, shifting from state %d \
+to state %d\n", YYPREFIX, *yyssp, yystate);
 #endif
     if (yyssp >= yyss + yystacksize - 1)
     {
 #endif
     if (yyssp >= yyss + yystacksize - 1)
     {
index 5f2d8c0..c9794ed 100644 (file)
@@ -1,6 +1,62 @@
 #ifndef lint
 #ifndef lint
-char yysccsid[] = "@(#)yaccpar 1.3 (Berkeley) 01/21/90";
+static char yysccsid[] = "@(#)yaccpar  1.9 (Berkeley) 02/21/93";
 #endif
 #endif
+#define YYBYACC 1
+#define YYMAJOR 1
+#define YYMINOR 9
+#define yyclearin (yychar=(-1))
+#define yyerrok (yyerrflag=0)
+#define YYRECOVERING (yyerrflag!=0)
+#define YYPREFIX "yy"
+#line 26 "ftp.y"
+
+#ifndef lint
+static char sccsid[] = "@(#)ftpcmd.y   5.20.1.1 (Berkeley) 3/2/89";
+#endif /* not lint */
+
+#include <sys/param.h>
+#include <sys/socket.h>
+
+#include <netinet/in.h>
+
+#include <arpa/ftp.h>
+
+#include <stdio.h>
+#include <signal.h>
+#include <ctype.h>
+#include <pwd.h>
+#include <setjmp.h>
+#include <syslog.h>
+#include <sys/stat.h>
+#include <time.h>
+
+extern struct sockaddr_in data_dest;
+extern int logged_in;
+extern struct passwd *pw;
+extern int guest;
+extern int logging;
+extern int type;
+extern int form;
+extern int debug;
+extern int timeout;
+extern int maxtimeout;
+extern  int pdata;
+extern char hostname[], remotehost[];
+extern char proctitle[];
+extern char *globerr;
+extern int usedefault;
+extern  int transflag;
+extern  char tmpline[];
+char   **glob();
+
+static int cmd_type;
+static int cmd_form;
+static int cmd_bytesz;
+char   cbuf[512];
+char   *fromname;
+
+char   *index();
+#line 60 "ftp.tab.c"
 #define A 257
 #define B 258
 #define C 259
 #define A 257
 #define B 258
 #define C 259
@@ -65,55 +121,6 @@ char yysccsid[] = "@(#)yaccpar      1.3 (Berkeley) 01/21/90";
 #define CHMOD 318
 #define LEXERR 319
 #define YYERRCODE 256
 #define CHMOD 318
 #define LEXERR 319
 #define YYERRCODE 256
-#line 26 "ftp.y"
-
-#ifndef lint
-static char sccsid[] = "@(#)ftpcmd.y   5.20.1.1 (Berkeley) 3/2/89";
-#endif /* not lint */
-
-#include <sys//param.h>
-#include <sys//socket.h>
-
-#include <netinet//in.h>
-
-#include <arpa//ftp.h>
-
-#include <stdio.h>
-#include <signal.h>
-#include <ctype.h>
-#include <pwd.h>
-#include <setjmp.h>
-#include <syslog.h>
-#include <sys//stat.h>
-#include <time.h>
-
-extern struct sockaddr_in data_dest;
-extern int logged_in;
-extern struct passwd *pw;
-extern int guest;
-extern int logging;
-extern int type;
-extern int form;
-extern int debug;
-extern int timeout;
-extern int maxtimeout;
-extern  int pdata;
-extern char hostname[], remotehost[];
-extern char proctitle[];
-extern char *globerr;
-extern int usedefault;
-extern  int transflag;
-extern  char tmpline[];
-char   **glob();
-
-static int cmd_type;
-static int cmd_form;
-static int cmd_bytesz;
-char   cbuf[512];
-char   *fromname;
-
-char   *index();
-#line 116 "ftp.tab.c"
 short yylhs[] = {                                        -1,
     0,    0,    0,    1,    1,    1,    1,    1,    1,    1,
     1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
 short yylhs[] = {                                        -1,
     0,    0,    0,    1,    1,    1,    1,    1,    1,    1,
     1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
@@ -351,13 +358,15 @@ char *yyrule[] = {
 #ifndef YYSTYPE
 typedef int YYSTYPE;
 #endif
 #ifndef YYSTYPE
 typedef int YYSTYPE;
 #endif
-#define yyclearin (yychar=(-1))
-#define yyerrok (yyerrflag=0)
-#ifndef YYSTACKSIZE
+#ifdef YYSTACKSIZE
+#undef YYMAXDEPTH
+#define YYMAXDEPTH YYSTACKSIZE
+#else
 #ifdef YYMAXDEPTH
 #define YYSTACKSIZE YYMAXDEPTH
 #else
 #ifdef YYMAXDEPTH
 #define YYSTACKSIZE YYMAXDEPTH
 #else
-#define YYSTACKSIZE 300
+#define YYSTACKSIZE 500
+#define YYMAXDEPTH 500
 #endif
 #endif
 int yydebug;
 #endif
 #endif
 int yydebug;
@@ -368,9 +377,9 @@ short *yyssp;
 YYSTYPE *yyvsp;
 YYSTYPE yyval;
 YYSTYPE yylval;
 YYSTYPE *yyvsp;
 YYSTYPE yyval;
 YYSTYPE yylval;
-#define yystacksize YYSTACKSIZE
 short yyss[YYSTACKSIZE];
 YYSTYPE yyvs[YYSTACKSIZE];
 short yyss[YYSTACKSIZE];
 YYSTYPE yyvs[YYSTACKSIZE];
+#define yystacksize YYSTACKSIZE
 #line 658 "ftp.y"
 
 extern jmp_buf errcatch;
 #line 658 "ftp.y"
 
 extern jmp_buf errcatch;
@@ -895,8 +904,9 @@ char *filename;
                reply(504, "SIZE not implemented for Type %c.", "?AEIL"[type]);
        }
 }
                reply(504, "SIZE not implemented for Type %c.", "?AEIL"[type]);
        }
 }
-#line 898 "ftp.tab.c"
+#line 908 "ftp.tab.c"
 #define YYABORT goto yyabort
 #define YYABORT goto yyabort
+#define YYREJECT goto yyabort
 #define YYACCEPT goto yyaccept
 #define YYERROR goto yyerrlab
 int
 #define YYACCEPT goto yyaccept
 #define YYERROR goto yyerrlab
 int
@@ -910,9 +920,7 @@ yyparse()
     if (yys = getenv("YYDEBUG"))
     {
         yyn = *yys;
     if (yys = getenv("YYDEBUG"))
     {
         yyn = *yys;
-        if (yyn == '0')
-            yydebug = 0;
-        else if (yyn >= '1' && yyn <= '9')
+        if (yyn >= '0' && yyn <= '9')
             yydebug = yyn - '0';
     }
 #endif
             yydebug = yyn - '0';
     }
 #endif
@@ -936,8 +944,8 @@ yyloop:
             yys = 0;
             if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
             if (!yys) yys = "illegal-symbol";
             yys = 0;
             if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
             if (!yys) yys = "illegal-symbol";
-            printf("yydebug: state %d, reading %d (%s)\n", yystate,
-                    yychar, yys);
+            printf("%sdebug: state %d, reading %d (%s)\n",
+                    YYPREFIX, yystate, yychar, yys);
         }
 #endif
     }
         }
 #endif
     }
@@ -946,8 +954,8 @@ yyloop:
     {
 #if YYDEBUG
         if (yydebug)
     {
 #if YYDEBUG
         if (yydebug)
-            printf("yydebug: state %d, shifting to state %d\n",
-                    yystate, yytable[yyn]);
+            printf("%sdebug: state %d, shifting to state %d\n",
+                    YYPREFIX, yystate, yytable[yyn]);
 #endif
         if (yyssp >= yyss + yystacksize - 1)
         {
 #endif
         if (yyssp >= yyss + yystacksize - 1)
         {
@@ -987,8 +995,8 @@ yyinrecovery:
             {
 #if YYDEBUG
                 if (yydebug)
             {
 #if YYDEBUG
                 if (yydebug)
-                    printf("yydebug: state %d, error recovery shifting\
- to state %d\n", *yyssp, yytable[yyn]);
+                    printf("%sdebug: state %d, error recovery shifting\
+ to state %d\n", YYPREFIX, *yyssp, yytable[yyn]);
 #endif
                 if (yyssp >= yyss + yystacksize - 1)
                 {
 #endif
                 if (yyssp >= yyss + yystacksize - 1)
                 {
@@ -1002,8 +1010,8 @@ yyinrecovery:
             {
 #if YYDEBUG
                 if (yydebug)
             {
 #if YYDEBUG
                 if (yydebug)
-                    printf("yydebug: error recovery discarding state %d\n",
-                            *yyssp);
+                    printf("%sdebug: error recovery discarding state %d\n",
+                            YYPREFIX, *yyssp);
 #endif
                 if (yyssp <= yyss) goto yyabort;
                 --yyssp;
 #endif
                 if (yyssp <= yyss) goto yyabort;
                 --yyssp;
@@ -1020,8 +1028,8 @@ yyinrecovery:
             yys = 0;
             if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
             if (!yys) yys = "illegal-symbol";
             yys = 0;
             if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
             if (!yys) yys = "illegal-symbol";
-            printf("yydebug: state %d, error recovery discards token %d (%s)\n",
-                    yystate, yychar, yys);
+            printf("%sdebug: state %d, error recovery discards token %d (%s)\n",
+                    YYPREFIX, yystate, yychar, yys);
         }
 #endif
         yychar = (-1);
         }
 #endif
         yychar = (-1);
@@ -1030,8 +1038,8 @@ yyinrecovery:
 yyreduce:
 #if YYDEBUG
     if (yydebug)
 yyreduce:
 #if YYDEBUG
     if (yydebug)
-        printf("yydebug: state %d, reducing by rule %d (%s)\n",
-                yystate, yyn, yyrule[yyn]);
+        printf("%sdebug: state %d, reducing by rule %d (%s)\n",
+                YYPREFIX, yystate, yyn, yyrule[yyn]);
 #endif
     yym = yylen[yyn];
     yyval = yyvsp[1-yym];
 #endif
     yym = yylen[yyn];
     yyval = yyvsp[1-yym];
@@ -1497,7 +1505,7 @@ break;
 case 49:
 #line 493 "ftp.y"
  {
 case 49:
 #line 493 "ftp.y"
  {
-                       *(char **)&(yyval ) = "";
+                       *(char **)&(yyval) = "";
                }
 break;
 case 52:
                }
 break;
 case 52:
@@ -1515,19 +1523,19 @@ break;
 case 53:
 #line 516 "ftp.y"
  {
 case 53:
 #line 516 "ftp.y"
  {
-               yyval  = FORM_N;
+               yyval = FORM_N;
        }
 break;
 case 54:
 #line 520 "ftp.y"
  {
        }
 break;
 case 54:
 #line 520 "ftp.y"
  {
-               yyval  = FORM_T;
+               yyval = FORM_T;
        }
 break;
 case 55:
 #line 524 "ftp.y"
  {
        }
 break;
 case 55:
 #line 524 "ftp.y"
  {
-               yyval  = FORM_C;
+               yyval = FORM_C;
        }
 break;
 case 56:
        }
 break;
 case 56:
@@ -1588,37 +1596,37 @@ break;
 case 64:
 #line 572 "ftp.y"
  {
 case 64:
 #line 572 "ftp.y"
  {
-               yyval  = STRU_F;
+               yyval = STRU_F;
        }
 break;
 case 65:
 #line 576 "ftp.y"
  {
        }
 break;
 case 65:
 #line 576 "ftp.y"
  {
-               yyval  = STRU_R;
+               yyval = STRU_R;
        }
 break;
 case 66:
 #line 580 "ftp.y"
  {
        }
 break;
 case 66:
 #line 580 "ftp.y"
  {
-               yyval  = STRU_P;
+               yyval = STRU_P;
        }
 break;
 case 67:
 #line 586 "ftp.y"
  {
        }
 break;
 case 67:
 #line 586 "ftp.y"
  {
-               yyval  = MODE_S;
+               yyval = MODE_S;
        }
 break;
 case 68:
 #line 590 "ftp.y"
  {
        }
 break;
 case 68:
 #line 590 "ftp.y"
  {
-               yyval  = MODE_B;
+               yyval = MODE_B;
        }
 break;
 case 69:
 #line 594 "ftp.y"
  {
        }
 break;
 case 69:
 #line 594 "ftp.y"
  {
-               yyval  = MODE_C;
+               yyval = MODE_C;
        }
 break;
 case 70:
        }
 break;
 case 70:
@@ -1630,14 +1638,14 @@ case 70:
                 * This is a valid reply in some cases but not in others.
                 */
                if (logged_in && yyvsp[0] && strncmp((char *) yyvsp[0], "~", 1) == 0) {
                 * This is a valid reply in some cases but not in others.
                 */
                if (logged_in && yyvsp[0] && strncmp((char *) yyvsp[0], "~", 1) == 0) {
-                       *(char **)&(yyval ) = *glob((char *) yyvsp[0]);
+                       *(char **)&(yyval) = *glob((char *) yyvsp[0]);
                        if (globerr != NULL) {
                                reply(550, globerr);
                        if (globerr != NULL) {
                                reply(550, globerr);
-                               yyval  = NULL;
+                               yyval = NULL;
                        }
                        free((char *) yyvsp[0]);
                } else
                        }
                        free((char *) yyvsp[0]);
                } else
-                       yyval  = yyvsp[0];
+                       yyval = yyvsp[0];
        }
 break;
 case 72:
        }
 break;
 case 72:
@@ -1662,21 +1670,21 @@ case 72:
                        multby *= 8;
                        dec /= 10;
                }
                        multby *= 8;
                        dec /= 10;
                }
-               yyval  = ret;
+               yyval = ret;
        }
 break;
 case 73:
 #line 647 "ftp.y"
  {
                if (logged_in)
        }
 break;
 case 73:
 #line 647 "ftp.y"
  {
                if (logged_in)
-                       yyval  = 1;
+                       yyval = 1;
                else {
                        reply(530, "Please login with USER and PASS.");
                else {
                        reply(530, "Please login with USER and PASS.");
-                       yyval  = 0;
+                       yyval = 0;
                }
        }
 break;
                }
        }
 break;
-#line 1679 "ftp.tab.c"
+#line 1688 "ftp.tab.c"
     }
     yyssp -= yym;
     yystate = *yyssp;
     }
     yyssp -= yym;
     yystate = *yyssp;
@@ -1684,10 +1692,10 @@ break;
     yym = yylhs[yyn];
     if (yystate == 0 && yym == 0)
     {
     yym = yylhs[yyn];
     if (yystate == 0 && yym == 0)
     {
-#ifdef YYDEBUG
+#if YYDEBUG
         if (yydebug)
         if (yydebug)
-            printf("yydebug: after reduction, shifting from state 0 to\
- state %d\n", YYFINAL);
+            printf("%sdebug: after reduction, shifting from state 0 to\
+ state %d\n", YYPREFIX, YYFINAL);
 #endif
         yystate = YYFINAL;
         *++yyssp = YYFINAL;
 #endif
         yystate = YYFINAL;
         *++yyssp = YYFINAL;
@@ -1701,8 +1709,8 @@ break;
                 yys = 0;
                 if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
                 if (!yys) yys = "illegal-symbol";
                 yys = 0;
                 if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
                 if (!yys) yys = "illegal-symbol";
-                printf("yydebug: state %d, reading %d (%s)\n",
-                        YYFINAL, yychar, yys);
+                printf("%sdebug: state %d, reading %d (%s)\n",
+                        YYPREFIX, YYFINAL, yychar, yys);
             }
 #endif
         }
             }
 #endif
         }
@@ -1714,10 +1722,10 @@ break;
         yystate = yytable[yyn];
     else
         yystate = yydgoto[yym];
         yystate = yytable[yyn];
     else
         yystate = yydgoto[yym];
-#ifdef YYDEBUG
+#if YYDEBUG
     if (yydebug)
     if (yydebug)
-        printf("yydebug: after reduction, shifting from state %d \
-to state %d\n", *yyssp, yystate);
+        printf("%sdebug: after reduction, shifting from state %d \
+to state %d\n", YYPREFIX, *yyssp, yystate);
 #endif
     if (yyssp >= yyss + yystacksize - 1)
     {
 #endif
     if (yyssp >= yyss + yystacksize - 1)
     {
index 4dddfe9..f946004 100644 (file)
@@ -9,7 +9,7 @@
  */
 
 #ifndef lint
  */
 
 #ifndef lint
-static char sccsid[] = "@(#)warshall.c 5.3 (Berkeley) %G%";
+static char sccsid[] = "@(#)warshall.c 5.4 (Berkeley) %G%";
 #endif /* not lint */
 
 #include "defs.h"
 #endif /* not lint */
 
 #include "defs.h"
@@ -19,7 +19,7 @@ unsigned *R;
 int n;
 {
     register int rowsize;
 int n;
 {
     register int rowsize;
-    register unsigned mask;
+    register unsigned i;
     register unsigned *rowj;
     register unsigned *rp;
     register unsigned *rend;
     register unsigned *rowj;
     register unsigned *rp;
     register unsigned *rend;
@@ -32,7 +32,7 @@ int n;
     relend = R + n*rowsize;
 
     cword = R;
     relend = R + n*rowsize;
 
     cword = R;
-    mask = 1;
+    i = 0;
     rowi = R;
     while (rowi < relend)
     {
     rowi = R;
     while (rowi < relend)
     {
@@ -41,7 +41,7 @@ int n;
 
        while (rowj < relend)
        {
 
        while (rowj < relend)
        {
-           if (*ccol & mask)
+           if (*ccol & (1 << i))
            {
                rp = rowi;
                rend = rowj + rowsize;
            {
                rp = rowi;
                rend = rowj + rowsize;
@@ -56,10 +56,9 @@ int n;
            ccol += rowsize;
        }
 
            ccol += rowsize;
        }
 
-       mask <<= 1;
-       if (mask == 0)
+       if (++i >= BITS_PER_WORD)
        {
        {
-           mask = 1;
+           i = 0;
            cword++;
        }
 
            cword++;
        }
 
@@ -72,7 +71,7 @@ unsigned *R;
 int n;
 {
     register int rowsize;
 int n;
 {
     register int rowsize;
-    register unsigned mask;
+    register unsigned i;
     register unsigned *rp;
     register unsigned *relend;
 
     register unsigned *rp;
     register unsigned *relend;
 
@@ -81,15 +80,14 @@ int n;
     rowsize = WORDSIZE(n);
     relend = R + n*rowsize;
 
     rowsize = WORDSIZE(n);
     relend = R + n*rowsize;
 
-    mask = 1;
+    i = 0;
     rp = R;
     while (rp < relend)
     {
     rp = R;
     while (rp < relend)
     {
-       *rp |= mask;
-       mask <<= 1;
-       if (mask == 0)
+       *rp |= (1 << i);
+       if (++i >= BITS_PER_WORD)
        {
        {
-           mask = 1;
+           i = 0;
            rp++;
        }
 
            rp++;
        }
 
index 28d77ff..b9abd19 100644 (file)
 .\"
 .\" %sccs.include.redist.roff%
 .\"
 .\"
 .\" %sccs.include.redist.roff%
 .\"
-.\"     @(#)yacc.1     5.7 (Berkeley) %G%
+.\"     @(#)yacc.1     5.8 (Berkeley) %G%
 .\"
 .\"
-.Dd 
-.Dt YACC 1
-.Os
-.Sh NAME
-.Nm yacc
-.Nd an
-.Tn LALR(1)
-parser generator
-.Sh SYNOPSIS
-.Nm yacc
-.Op Fl dlrtv
-.Op Fl b Ar prefix
-.Ar filename
-.Sh DESCRIPTION
-.Nm Yacc
+.TH YACC 1 ""
+.UC 6
+.SH NAME
+yacc \- an LALR(1) parser generator
+.SH SYNOPSIS
+.B yacc [ -dlrtv ] [ -b
+.I file_prefix
+.B ] [ -p
+.I symbol_prefix
+.B ]
+.I filename
+.SH DESCRIPTION
+.I Yacc
 reads the grammar specification in the file
 reads the grammar specification in the file
-.Ar filename
-and generates an
-.Tn LR(1)
-parser for it.
-The parsers consist of a set of
-.Tn LALR(1)
-parsing tables and a driver routine
+.I filename
+and generates an LR(1) parser for it.
+The parsers consist of a set of LALR(1) parsing tables and a driver routine
 written in the C programming language.
 written in the C programming language.
-.Nm Yacc
+.I Yacc
 normally writes the parse tables and the driver routine to the file
 normally writes the parse tables and the driver routine to the file
-.Pa y.tab.c .
-.Pp
+.IR y.tab.c.
+.PP
 The following options are available:
 The following options are available:
-.Bl -tag -width Ar
-.It Fl b Ar prefix
+.RS
+.TP
+\fB-b \fIfile_prefix\fR
 The
 The
-.Fl b
+.B -b
 option changes the prefix prepended to the output file names to
 the string denoted by
 option changes the prefix prepended to the output file names to
 the string denoted by
-.Ar prefix .
+.IR file_prefix.
 The default prefix is the character
 The default prefix is the character
-.Ar y .
-.It Fl d
-The
-.Fl d
-option causes the header file
-.Pa y.tab.h
+.IR y.
+.TP
+.B -d
+The \fB-d\fR option causes the header file
+.IR y.tab.h
 to be written.
 to be written.
-.It Fl l
+.TP
+.B -l
 If the
 If the
-.Fl l
+.B -l
 option is not specified,
 option is not specified,
-.Nm yacc
-will insert \#line directives in the generated code.
-The \#line directives let the C compiler relate errors in the
+.I yacc
+will insert #line directives in the generated code.
+The #line directives let the C compiler relate errors in the
 generated code to the user's original code.
 generated code to the user's original code.
-If the
-.Fl l
-option is specified,
-.Nm yacc
-will not insert the \#line directives.
-\&\#line directives specified by the user will be retained.
-.It Fl r
+If the \fB-l\fR option is specified,
+.I yacc
+will not insert the #line directives.
+Any #line directives specified by the user will be retained.
+.TP
+\fB-p \fIsymbol_prefix\fR
 The
 The
-.Fl r
+.B -p
+option changes the prefix prepended to yacc-generated symbols to
+the string denoted by
+.IR symbol_prefix.
+The default prefix is the string
+.IR yy.
+.TP
+.B -r
+The
+.B -r
 option causes
 option causes
-.Nm yacc
-to produce separate files for code and tables.
-The code file is named
-.Pa y.code.c ,
+.I yacc
+to produce separate files for code and tables.  The code file
+is named
+.IR y.code.c,
 and the tables file is named
 and the tables file is named
-.Pa y.tab.c .
-.It Fl t
+.IR y.tab.c.
+.TP
+.B -t
 The
 The
-.Fl t
+.B -t
 option changes the preprocessor directives generated by
 option changes the preprocessor directives generated by
-.Nm yacc
+.I yacc
 so that debugging statements will be incorporated in the compiled code.
 so that debugging statements will be incorporated in the compiled code.
-.It Fl v
+.TP
+.B -v
 The
 The
-.Fl v
+.B -v
 option causes a human-readable description of the generated parser to
 be written to the file
 option causes a human-readable description of the generated parser to
 be written to the file
-.Pa y.output .
-.Pp
-.Sh ENVIRONMENT
-The following environment variable is referenced by
-.Nm yacc :
-.Bl -tag -width TMPDIR
-.It Ev TMPDIR
-If the environment variable
-.Ev TMPDIR
-is set, the string denoted by
-.Ev TMPDIR
-will be used as the name of the directory where the temporary
+.IR y.output.
+.RE
+.PP
+If the environment variable TMPDIR is set, the string denoted by
+TMPDIR will be used as the name of the directory where the temporary
 files are created.
 files are created.
-.El
-.Sh TABLES
-The names of the tables generated by this version of
-.Nm yacc
-are
-.Dq yylhs ,
-.Dq yylen ,
-.Dq yydefred ,
-.Dq yydgoto ,
-.Dq yysindex ,
-.Dq yyrindex ,
-.Dq yygindex ,
-.Dq yytable ,
-and
-.Dq yycheck .
-Two additional tables,
-.Dq yyname
-and
-.Dq yyrule ,
-are created if
-.Dv YYDEBUG
-is defined and non-zero.
-.Sh FILES
-.Bl -tag -width /tmp/yacc.uXXXXXXXX -compact
-.It Pa y.code.c
-.It Pa y.tab.c
-.It Pa y.tab.h
-.It Pa y.output
-.It Pa /tmp/yacc.aXXXXXX
-.It Pa /tmp/yacc.tXXXXXX
-.It Pa /tmp/yacc.uXXXXXX
-.El
-.Sh DIAGNOSTICS
+.SH FILES
+.IR y.code.c
+.br
+.IR y.tab.c
+.br
+.IR y.tab.h
+.br
+.IR y.output
+.br
+.IR /tmp/yacc.aXXXXXX
+.br
+.IR /tmp/yacc.tXXXXXX
+.br
+.IR /tmp/yacc.uXXXXXX
+.SH DIAGNOSTICS
 If there are rules that are never reduced, the number of such rules is
 If there are rules that are never reduced, the number of such rules is
-written to the standard error.
-If there are any
-.Tn LALR(1)
-conflicts, the number of conflicts is also written
-to the standard error.
-.Sh SEE ALSO
-.Xr yyfix 1
-.Sh STANDARDS
-The
-.Nm yacc
-utility conforms to
-.St -p1003.2 .
+reported on standard error.
+If there are any LALR(1) conflicts, the number of conflicts is reported
+on standard error.