[llvm-commits] CVS: llvm-test/MultiSource/Benchmarks/Prolangs-C/cdecl/Makefile cdecl.c cdgram.c.source cdgram.y.in cdlex.c.source cdlex.l.in testset
Chris Lattner
lattner at cs.uiuc.edu
Tue Oct 5 12:08:40 PDT 2004
Changes in directory llvm-test/MultiSource/Benchmarks/Prolangs-C/cdecl:
Makefile added (r1.1)
cdecl.c added (r1.1)
cdgram.c.source added (r1.1)
cdgram.y.in added (r1.1)
cdlex.c.source added (r1.1)
cdlex.l.in added (r1.1)
testset added (r1.1)
---
Log message:
New benchmark
---
Diffs of the changes: (+4888 -0)
Index: llvm-test/MultiSource/Benchmarks/Prolangs-C/cdecl/Makefile
diff -c /dev/null llvm-test/MultiSource/Benchmarks/Prolangs-C/cdecl/Makefile:1.1
*** /dev/null Tue Oct 5 14:08:36 2004
--- llvm-test/MultiSource/Benchmarks/Prolangs-C/cdecl/Makefile Tue Oct 5 14:08:26 2004
***************
*** 0 ****
--- 1,6 ----
+ LEVEL = ../../../..
+
+ PROG = cdecl
+ STDIN_FILENAME = $(SourceDir)/testset
+ include $(LEVEL)/MultiSource/Makefile.multisrc
+
Index: llvm-test/MultiSource/Benchmarks/Prolangs-C/cdecl/cdecl.c
diff -c /dev/null llvm-test/MultiSource/Benchmarks/Prolangs-C/cdecl/cdecl.c:1.1
*** /dev/null Tue Oct 5 14:08:39 2004
--- llvm-test/MultiSource/Benchmarks/Prolangs-C/cdecl/cdecl.c Tue Oct 5 14:08:26 2004
***************
*** 0 ****
--- 1,1022 ----
+ /*
+ * cdecl - ANSI C and C++ declaration composer & decoder
+ *
+ * originally written
+ * Graham Ross
+ * once at tektronix!tekmdp!grahamr
+ * now at Context, Inc.
+ *
+ * modified to provide hints for unsupported types
+ * added argument lists for functions
+ * added 'explain cast' grammar
+ * added #ifdef for 'create program' feature
+ * ???? (sorry, I lost your name and login)
+ *
+ * conversion to ANSI C
+ * David Wolverton
+ * ihnp4!houxs!daw
+ *
+ * merged D. Wolverton's ANSI C version w/ ????'s version
+ * added function prototypes
+ * added C++ declarations
+ * made type combination checking table driven
+ * added checks for void variable combinations
+ * made 'create program' feature a runtime option
+ * added file parsing as well as just stdin
+ * added help message at beginning
+ * added prompts when on a TTY or in interactive mode
+ * added getopt() usage
+ * added -a, -r, -p, -c, -d, -D, -V, -i and -+ options
+ * delinted
+ * added #defines for those without getopt or void
+ * added 'set options' command
+ * added 'quit/exit' command
+ * added synonyms
+ * Tony Hansen
+ * attmail!tony, ihnp4!pegasus!hansen
+ *
+ * added extern, register, static
+ * added links to explain, cast, declare
+ * separately developed ANSI C support
+ * Merlyn LeRoy
+ * merlyn at rose3.rosemount.com
+ *
+ * merged versions from LeRoy
+ * added tmpfile() support
+ * allow more parts to be missing during explanations
+ * Tony Hansen
+ * attmail!tony, ihnp4!pegasus!hansen
+ */
+
+ char cdeclsccsid[] = "@(#)cdecl.c 2.4 3/31/88";
+
+ #include <stdio.h>
+
+ #include <ctype.h>
+ #if __STDC__ || defined(DOS)
+ # include <stdlib.h>
+ # include <stddef.h>
+ # include <string.h>
+ # include <stdarg.h>
+ #else
+ # ifndef NOVARARGS
+ # include <varargs.h>
+ # endif /* ndef NOVARARGS */
+ char *malloc();
+ void free(), exit(), perror();
+ # ifdef BSD
+ # include <strings.h>
+ extern int errno;
+ # define strrchr rindex
+ # define NOTMPFILE
+ # else
+ # include <string.h>
+ # include <errno.h>
+ # endif /* BSD */
+ # ifdef NOVOID
+ # define void int
+ # endif /* NOVOID */
+ #endif /* __STDC__ || DOS */
+
+ #include <errno.h>
+
+ #define MB_SHORT 0001
+ #define MB_LONG 0002
+ #define MB_UNSIGNED 0004
+ #define MB_INT 0010
+ #define MB_CHAR 0020
+ #define MB_FLOAT 0040
+ #define MB_DOUBLE 0100
+ #define MB_VOID 0200
+ #define MB_SIGNED 0400
+
+ #define NullCP ((char*)NULL)
+ #ifdef dodebug
+ # define Debug(x) do { if (DebugFlag) (void) fprintf x; } while (0)
+ #else
+ # define Debug(x) /* nothing */
+ #endif
+
+ #if __STDC__
+ char *ds(char *), *cat(char *, ...), *visible(int);
+ int getopt(int,char **,char *);
+ int main(int, char **);
+ int yywrap_nasko(void);
+ int dostdin(void);
+ void mbcheck(void), dohelp(void), usage(void);
+ void prompt(void), doprompt(void), noprompt(void);
+ void unsupp(char *, char *);
+ void notsupported(char *, char *, char *);
+ void yyerror(char *);
+ void doset(char *);
+ void dodeclare(char*, char*, char*, char*, char*);
+ void docast(char*, char*, char*, char*);
+ void dodexplain(char*, char*, char*, char*);
+ void docexplain(char*, char*, char*, char*);
+ void setprogname(char *);
+ int dotmpfile(int, char**), dofileargs(int, char**);
+ #else
+ char *ds(), *cat(), *visible();
+ int getopt();
+ void mbcheck(), dohelp(), usage();
+ void prompt(), doprompt(), noprompt();
+ void unsupp(), notsupported();
+ void yyerror();
+ void doset(), dodeclare(), docast(), dodexplain(), docexplain();
+ void setprogname();
+ int dotmpfile(), dofileargs();
+ #endif /* __STDC__ */
+ FILE *tmpfile();
+
+ /* variables used during parsing */
+ unsigned modbits = 0;
+ int arbdims = 1;
+ char *savedname = 0;
+ char unknown_name[] = "unknown_name";
+ char prev = 0; /* the current type of the variable being examined */
+ /* values type */
+ /* p pointer */
+ /* r reference */
+ /* f function */
+ /* a array (of arbitrary dimensions) */
+ /* A array with dimensions */
+ /* n name */
+ /* v void */
+ /* s struct | class */
+ /* t simple type (int, long, etc.) */
+
+ /* options */
+ int RitchieFlag = 0; /* -r, assume Ritchie PDP C language */
+ int MkProgramFlag = 0; /* -c, output {} and ; after declarations */
+ int PreANSIFlag = 0; /* -p, assume pre-ANSI C language */
+ int CplusplusFlag = 0; /* -+, assume C++ language */
+ int OnATty = 0; /* stdin is coming from a terminal */
+ int Interactive = 0; /* -i, overrides OnATty */
+ int KeywordName = 0; /* $0 is a keyword (declare, explain, cast) */
+ char *progname = "cdecl"; /* $0 */
+
+ #if dodebug
+ int DebugFlag = 0; /* -d, output debugging trace info */
+ #endif
+
+ #ifdef doyydebug /* compile in yacc trace statements */
+ #define YYDEBUG 1
+ #endif /* doyydebug */
+
+ #include "cdgram.c.source"
+ #include "cdlex.c.source"
+
+ /* definitions (and abbreviations) for type combinations cross check table */
+ #define ALWAYS 0 /* combo always okay */
+ #define _ ALWAYS
+ #define NEVER 1 /* combo never allowed */
+ #define X NEVER
+ #define RITCHIE 2 /* combo not allowed in Ritchie compiler */
+ #define R RITCHIE
+ #define PREANSI 3 /* combo not allowed in Pre-ANSI compiler */
+ #define P PREANSI
+ #define ANSI 4 /* combo not allowed anymore in ANSI compiler */
+ #define A ANSI
+
+ /* This is an lower left triangular array. If we needed */
+ /* to save 9 bytes, the "long" row can be removed. */
+ char crosscheck[9][9] = {
+ /* L, I, S, C, V, U, S, F, D, */
+ /* long */ _, _, _, _, _, _, _, _, _,
+ /* int */ _, _, _, _, _, _, _, _, _,
+ /* short */ X, _, _, _, _, _, _, _, _,
+ /* char */ X, X, X, _, _, _, _, _, _,
+ /* void */ X, X, X, X, _, _, _, _, _,
+ /* unsigned */ R, _, R, R, X, _, _, _, _,
+ /* signed */ P, P, P, P, X, X, _, _, _,
+ /* float */ A, X, X, X, X, X, X, _, _,
+ /* double */ P, X, X, X, X, X, X, X, _
+ };
+
+ /* the names and bits checked for each row in the above array */
+ struct
+ {
+ char *name;
+ int bit;
+ } crosstypes[9] =
+ {
+ { "long", MB_LONG },
+ { "int", MB_INT },
+ { "short", MB_SHORT },
+ { "char", MB_CHAR },
+ { "void", MB_VOID },
+ { "unsigned", MB_UNSIGNED },
+ { "signed", MB_SIGNED },
+ { "float", MB_FLOAT },
+ { "double", MB_DOUBLE }
+ };
+
+ /* Run through the crosscheck array looking */
+ /* for unsupported combinations of types. */
+ void mbcheck()
+ {
+ register int i, j, restrict;
+ char *t1, *t2;
+
+ /* Loop through the types */
+ /* (skip the "long" row) */
+ for (i = 1; i < 9; i++)
+ {
+ /* if this type is in use */
+ if ((modbits & crosstypes[i].bit) != 0)
+ {
+ /* check for other types also in use */
+ for (j = 0; j < i; j++)
+ {
+ /* this type is not in use */
+ if (!(modbits & crosstypes[j].bit))
+ continue;
+ /* check the type of restriction */
+ restrict = crosscheck[i][j];
+ if (restrict == ALWAYS)
+ continue;
+ t1 = crosstypes[i].name;
+ t2 = crosstypes[j].name;
+ if (restrict == NEVER)
+ {
+ notsupported("", t1, t2);
+ }
+ else if (restrict == RITCHIE)
+ {
+ if (RitchieFlag)
+ notsupported(" (Ritchie Compiler)", t1, t2);
+ }
+ else if (restrict == PREANSI)
+ {
+ if (PreANSIFlag || RitchieFlag)
+ notsupported(" (Pre-ANSI Compiler)", t1, t2);
+ }
+ else if (restrict == ANSI)
+ {
+ if (!RitchieFlag && !PreANSIFlag)
+ notsupported(" (ANSI Compiler)", t1, t2);
+ }
+ else
+ {
+ (void) fprintf (stderr,
+ "%s: Internal error in crosscheck[%d,%d]=%d!\n",
+ progname, i, j, restrict);
+ exit(1); /* NOTREACHED */
+ }
+ }
+ }
+ }
+ }
+
+ /* undefine these as they are no longer needed */
+ #undef _
+ #undef ALWAYS
+ #undef X
+ #undef NEVER
+ #undef R
+ #undef RITCHIE
+ #undef P
+ #undef PREANSI
+ #undef A
+ #undef ANSI
+
+ /* Write out a message about something */
+ /* being unsupported, possibly with a hint. */
+ void unsupp(s,hint)
+ char *s,*hint;
+ {
+ notsupported("", s, NullCP);
+ if (hint)
+ (void) fprintf(stderr, "\t(maybe you mean \"%s\")\n", hint);
+ }
+
+ /* Write out a message about something */
+ /* being unsupported on a particular compiler. */
+ void notsupported(compiler, type1, type2)
+ char *compiler, *type1, *type2;
+ {
+ if (type2)
+ (void) fprintf(stderr,
+ "Warning: Unsupported in%s C%s -- '%s' with '%s'\n",
+ compiler, CplusplusFlag ? "++" : "", type1, type2);
+ else
+ (void) fprintf(stderr,
+ "Warning: Unsupported in%s C%s -- '%s'\n",
+ compiler, CplusplusFlag ? "++" : "", type1);
+ }
+
+ /* Called by the yacc grammar */
+ void yyerror(s)
+ char *s;
+ {
+ (void) printf("%s\n",s);
+ Debug((stdout, "yychar=%d\n", yychar));
+ }
+
+ /* Called by the yacc grammar */
+ int yywrap_nasko()
+ {
+ return 1;
+ }
+
+ /*
+ * Support for dynamic strings:
+ * cat() creates a string from the concatenation
+ * of a null terminated list of input strings.
+ * The input strings are free()'d by cat()
+ * (so they better have been malloc()'d).
+ *
+ * the different methods of <stdarg.h> and
+ * <vararg.h> are handled within these macros
+ */
+ #if __STDC__
+ # define VA_DCL(type,var) (type var,...)
+ # define VA_START(list,var,type) ((va_start(list,var)) , (var))
+ #else
+ #if defined(DOS)
+ # define VA_DCL(type,var) (var,...) type var;
+ # define VA_START(list,var,type) ((va_start(list,var)) , (var))
+ #else
+ #ifndef NOVARARGS
+ # define VA_DCL(type,var) (va_alist) va_dcl
+ # define VA_START(list,var,type) ((va_start(list)) , va_arg(list,type))
+ #else
+ /*
+ * it is assumed here that machines which don't have either
+ * <varargs.h> or <stdarg.h> will put its arguments on
+ * the stack in the "usual" way and consequently can grab
+ * the arguments using the "take the address of the first
+ * parameter and increment by sizeof" trick.
+ */
+ # define VA_DCL(type,var) (var) type var;
+ # define VA_START(list,var,type) (list = (va_list)&(var) , (var))
+ # define va_arg(list,type) ((type *)(list += sizeof(type)))[-1]
+ # define va_end(p) /* nothing */
+ typedef char *va_list;
+ #endif /* NOVARARGS */
+ #endif /* DOS */
+ #endif /* __STDC__ */
+
+ /* VARARGS */
+ char *cat
+ VA_DCL(char*, s1)
+ {
+ register char *newstr;
+ register unsigned len = 1;
+ char *str;
+ va_list args;
+
+ /* find the length which needs to be allocated */
+ str = VA_START(args, s1, char*);
+ for ( ; str; str = va_arg(args, char*))
+ len += strlen(str);
+ va_end(args);
+
+ /* allocate it */
+ newstr = malloc(len);
+ if (newstr == 0)
+ {
+ (void) fprintf (stderr, "%s: out of malloc space within cat()!\n",
+ progname);
+ exit(1);
+ }
+ newstr[0] = '\0';
+
+ /* copy in the strings */
+ str = VA_START(args, s1, char*);
+ for ( ; str; str = va_arg(args, char*))
+ {
+ (void) strcat(newstr,str);
+ free(str);
+ }
+ va_end(args);
+
+ Debug((stderr, "\tcat created '%s'\n", newstr));
+ return newstr;
+ }
+
+ /*
+ * ds() makes a malloc()'d string from one that's not.
+ */
+ char *ds(s)
+ char *s;
+ {
+ register char *p = malloc((unsigned)(strlen(s)+1));
+
+ if (p)
+ (void) strcpy(p,s);
+ else
+ {
+ (void) fprintf (stderr, "%s: malloc() failed!\n", progname);
+ exit(1);
+ }
+ return p;
+ }
+
+ /* return a visible representation of a character */
+ char *visible(c)
+ int c;
+ {
+ static char buf[5];
+
+ c &= 0377;
+ if (isprint(c))
+ {
+ buf[0] = c;
+ buf[1] = '\0';
+ }
+ else
+ (void) sprintf(buf,"\\%03o",c);
+ return buf;
+ }
+
+ #ifdef NOTMPFILE
+ /* provide a conservative version of tmpfile() */
+ /* for those systems without it. */
+ /* tmpfile() returns a FILE* of a file opened */
+ /* for read&write. It is supposed to be */
+ /* automatically removed when it gets closed, */
+ /* but here we provide a separate rmtmpfile() */
+ /* function to perform that function. */
+ /* Also provide several possible file names to */
+ /* try for opening. */
+ static char *file4tmpfile = 0;
+
+ FILE *tmpfile()
+ {
+ static char *listtmpfiles[] =
+ {
+ "/usr/tmp/cdeclXXXXXX",
+ "/tmp/cdeclXXXXXX",
+ "/cdeclXXXXXX",
+ "cdeclXXXXXX",
+ 0
+ };
+
+ char **listp = listtmpfiles;
+ for ( ; *listp; listp++)
+ {
+ FILE *retfp;
+ (void) mktemp(*listp);
+ retfp = fopen(*listp, "w+");
+ if (!retfp)
+ continue;
+ file4tmpfile = *listp;
+ return retfp;
+ }
+
+ return 0;
+ }
+
+ void rmtmpfile()
+ {
+ if (file4tmpfile)
+ (void) unlink(file4tmpfile);
+ }
+ #else
+ /* provide a mock rmtmpfile() for normal systems */
+ # define rmtmpfile() /* nothing */
+ #endif /* NOTMPFILE */
+
+ #ifndef NOGETOPT
+ extern int optind;
+ #else
+ /* This is a miniature version of getopt() which will */
+ /* do just barely enough for us to get by below. */
+ /* Options are not allowed to be bunched up together. */
+ /* Option arguments are not supported. */
+ int optind = 1;
+
+ int getopt(argc,argv,optstring)
+ char **argv;
+ char *optstring;
+ {
+ int ret;
+ char *p;
+
+ if ((argv[optind][0] != '-')
+ #ifdef DOS
+ && (argv[optind][0] != '/')
+ #endif /* DOS */
+ )
+ return EOF;
+
+ ret = argv[optind][1];
+ optind++;
+
+ for (p = optstring; *p; p++)
+ if (*p == ret)
+ return ret;
+
+ (void) fprintf (stderr, "%s: illegal option -- %s\n",
+ progname, visible(ret));
+
+ return '?';
+ }
+ #endif
+
+ /* the help messages */
+ struct helpstruct
+ {
+ char *text; /* generic text */
+ char *cpptext; /* C++ specific text */
+ } helptext[] =
+ { /* up-to 23 lines of help text so it fits on (24x80) screens */
+ /* 1 */{ "[] means optional; {} means 1 or more; <> means defined elsewhere", 0 },
+ /* 2 */{ " commands are separated by ';' and newlines", 0 },
+ /* 3 */{ "command:", 0 },
+ /* 4 */{ " declare <name> as <english>", 0 },
+ /* 5 */{ " cast <name> into <english>", 0 },
+ /* 6 */{ " explain <gibberish>", 0 },
+ /* 7 */{ " set or set options", 0 },
+ /* 8 */{ " help, ?", 0 },
+ /* 9 */{ " quit or exit", 0 },
+ /* 10 */{ "english:", 0 },
+ /* 11 */{ " function [( <decl-list> )] returning <english>", 0 },
+ /* 12 */{ " array [<number>] of <english>", 0 },
+ /* 13 */{ " [{ const | volatile | noalias }] pointer to <english>",
+ " [{const|volatile}] {pointer|reference} to [member of class <name>] <english>" },
+ /* 14 */{ " <type>", 0 },
+ /* 15 */{ "type:", 0 },
+ /* 16 */{ " {[<storage-class>] [{<modifier>}] [<C-type>]}", 0 },
+ /* 17 */{ " { struct | union | enum } <name>",
+ " {struct|class|union|enum} <name>" },
+ /* 18 */{ "decllist: a comma separated list of <name>, <english> or <name> as <english>", 0 },
+ /* 19 */{ "name: a C identifier", 0 },
+ /* 20 */{ "gibberish: a C declaration, like 'int *x', or cast, like '(int *)x'", 0 },
+ /* 21 */{ "storage-class: extern, static, auto, register", 0 },
+ /* 22 */{ "C-type: int, char, float, double, or void", 0 },
+ /* 23 */{ "modifier: short, long, signed, unsigned, const, volatile, or noalias",
+ "modifier: short, long, signed, unsigned, const, or volatile" },
+ { 0, 0 }
+ };
+
+ /* Print out the help text */
+ void dohelp()
+ {
+ register struct helpstruct *p;
+ register char *fmt = CplusplusFlag ? " %s\n" : "\t%s\n";
+
+ for (p = helptext; p->text; p++)
+ if (CplusplusFlag && p->cpptext)
+ (void) printf(fmt, p->cpptext);
+ else
+ (void) printf(fmt, p->text);
+ }
+
+ /* Tell how to invoke cdecl. */
+ void usage()
+ {
+ (void) fprintf (stderr, "Usage: %s [-r|-p|-a|-+] [-ci%s%s] [files...]\n",
+ progname,
+ #ifdef dodebug
+ "d",
+ #else
+ "",
+ #endif /* dodebug */
+ #ifdef doyydebug
+ "D"
+ #else
+ ""
+ #endif /* doyydebug */
+ );
+ (void) fprintf (stderr, "\t-r Check against Ritchie PDP C Compiler\n");
+ (void) fprintf (stderr, "\t-p Check against Pre-ANSI C Compiler\n");
+ (void) fprintf (stderr, "\t-a Check against ANSI C Compiler%s\n",
+ CplusplusFlag ? "" : " (the default)");
+ (void) fprintf (stderr, "\t-+ Check against C++ Compiler%s\n",
+ CplusplusFlag ? " (the default)" : "");
+ (void) fprintf (stderr, "\t-c Create compilable output (include ; and {})\n");
+ (void) fprintf (stderr, "\t-i Force interactive mode\n");
+ #ifdef dodebug
+ (void) fprintf (stderr, "\t-d Turn on debugging mode\n");
+ #endif /* dodebug */
+ #ifdef doyydebug
+ (void) fprintf (stderr, "\t-D Turn on YACC debugging mode\n");
+ #endif /* doyydebug */
+ exit(1);
+ /* NOTREACHED */
+ }
+
+ /* Manage the prompts. */
+ static int prompting = 1;
+
+ void doprompt() { prompting = 1; }
+ void noprompt() { prompting = 0; }
+
+ void prompt()
+ {
+ if ((OnATty || Interactive) && prompting) {
+ (void) printf("%s> ", progname);
+ (void) fflush(stdout);
+ }
+ }
+
+ /* Save away the name of the program from argv[0] */
+ void setprogname(argv0)
+ char *argv0;
+ {
+ #ifdef DOS
+ char *dot;
+ #endif /* DOS */
+
+ progname = strrchr(argv0, '/');
+
+ #ifdef DOS
+ if (!progname)
+ progname = strrchr(argv0, '\\');
+ #endif /* DOS */
+
+ if (progname)
+ progname++;
+ else
+ progname = argv0;
+
+ #ifdef DOS
+ dot = strchr(progname, '.');
+ if (dot)
+ *dot = '\0';
+ for (dot = progname; *dot; dot++)
+ *dot = tolower(*dot);
+ #endif /* DOS */
+ }
+
+ /* Run down the list of keywords to see if the */
+ /* program is being called named as one of them */
+ /* or the first argument is one of them. */
+ int namedkeyword(argn)
+ char *argn;
+ {
+ static char *cmdlist[] =
+ {
+ "explain", "declare", "cast", "help", "?", "set", 0
+ };
+
+ /* first check the program name */
+ char **cmdptr = cmdlist;
+ for ( ; *cmdptr; cmdptr++)
+ if (strcmp(*cmdptr, progname) == 0)
+ {
+ KeywordName = 1;
+ return 1;
+ }
+
+ /* now check $1 */
+ for (cmdptr = cmdlist; *cmdptr; cmdptr++)
+ if (strcmp(*cmdptr, argn) == 0)
+ return 1;
+
+ /* nope, must be file name arguments */
+ return 0;
+ }
+
+ /* Read from standard input, turning */
+ /* on prompting if necessary. */
+ int dostdin()
+ {
+ int ret;
+ OnATty = isatty(0);
+ if (OnATty || Interactive)
+ {
+ (void) printf("Type `help' or `?' for help\n");
+ prompt();
+ }
+
+ yyin = stdin;
+ ret = yyparse();
+ OnATty = 0;
+ return ret;
+ }
+
+ /* Write the arguments into a file */
+ /* and treat that file as the input. */
+ int dotmpfile(argc, argv)
+ int argc;
+ char **argv;
+ {
+ int ret = 0;
+ FILE *tmpfp = tmpfile();
+ if (!tmpfp)
+ {
+ int sverrno = errno;
+ (void) fprintf (stderr, "%s: cannot open temp file\n",
+ progname);
+ errno = sverrno;
+ perror(progname);
+ return 1;
+ }
+
+ if (KeywordName)
+ if (fputs(progname, tmpfp) == EOF)
+ {
+ int sverrno;
+ errwrite:
+ sverrno = errno;
+ (void) fprintf (stderr, "%s: error writing to temp file\n",
+ progname);
+ errno = sverrno;
+ perror(progname);
+ (void) fclose(tmpfp);
+ rmtmpfile();
+ return 1;
+ }
+
+ for ( ; optind < argc; optind++)
+ if (fprintf(tmpfp, " %s", argv[optind]) == EOF)
+ goto errwrite;
+
+ if (putc('\n', tmpfp) == EOF)
+ goto errwrite;
+
+ rewind(tmpfp);
+ yyin = tmpfp;
+ ret += yyparse();
+ (void) fclose(tmpfp);
+ rmtmpfile();
+
+ return ret;
+ }
+
+ /* Read each of the named files for input. */
+ int dofileargs(argc, argv)
+ int argc;
+ char **argv;
+ {
+ FILE *ifp;
+ int ret = 0;
+
+ for ( ; optind < argc; optind++)
+ if (strcmp(argv[optind], "-") == 0)
+ ret += dostdin();
+
+ else if ((ifp = fopen(argv[optind], "r")) == NULL)
+ {
+ int sverrno = errno;
+ (void) fprintf (stderr, "%s: cannot open %s\n",
+ progname, argv[optind]);
+ errno = sverrno;
+ perror(argv[optind]);
+ ret++;
+ }
+
+ else
+ {
+ yyin = ifp;
+ ret += yyparse();
+ }
+
+ return ret;
+ }
+
+ /* print out a cast */
+ void docast(name, left, right, type)
+ char *name, *left, *right, *type;
+ {
+ int lenl = strlen(left), lenr = strlen(right);
+
+ if (prev == 'f')
+ unsupp("Cast into function",
+ "cast into pointer to function");
+ else if (prev=='A' || prev=='a')
+ unsupp("Cast into array","cast into pointer");
+ (void) printf("(%s%*s%s)%s\n",
+ type, lenl+lenr?lenl+1:0,
+ left, right, name ? name : "expression");
+ free(left);
+ free(right);
+ free(type);
+ if (name)
+ free(name);
+ }
+
+ /* print out a declaration */
+ void dodeclare(name, storage, left, right, type)
+ char *name, *storage, *left, *right, *type;
+ {
+ if (prev == 'v')
+ unsupp("Variable of type void",
+ "variable of type pointer to void");
+
+ if (*storage == 'r')
+ switch (prev)
+ {
+ case 'f': unsupp("Register function", NullCP); break;
+ case 'A':
+ case 'a': unsupp("Register array", NullCP); break;
+ case 's': unsupp("Register struct/class", NullCP); break;
+ }
+
+ if (*storage)
+ (void) printf("%s ", storage);
+ (void) printf("%s %s%s%s",
+ type, left,
+ name ? name : (prev == 'f') ? "f" : "var", right);
+ if (MkProgramFlag) {
+ if ((prev == 'f') && (*storage != 'e'))
+ (void) printf(" { }\n");
+ else
+ (void) printf(";\n");
+ } else {
+ (void) printf("\n");
+ }
+ free(storage);
+ free(left);
+ free(right);
+ free(type);
+ if (name)
+ free(name);
+ }
+
+ void dodexplain(storage, constvol, type, decl)
+ char *storage, *constvol, *type, *decl;
+ {
+ if (type && (strcmp(type, "void") == 0))
+ if (prev == 'n')
+ unsupp("Variable of type void",
+ "variable of type pointer to void");
+ else if (prev == 'a')
+ unsupp("array of type void",
+ "array of type pointer to void");
+ else if (prev == 'r')
+ unsupp("reference to type void",
+ "pointer to void");
+
+ if (*storage == 'r')
+ switch (prev)
+ {
+ case 'f': unsupp("Register function", NullCP); break;
+ case 'A':
+ case 'a': unsupp("Register array", NullCP); break;
+ case 's': unsupp("Register struct/union/enum/class", NullCP); break;
+ }
+
+ (void) printf("declare %s as ", savedname);
+ if (*storage)
+ (void) printf("%s ", storage);
+ (void) printf("%s", decl);
+ if (*constvol)
+ (void) printf("%s ", constvol);
+ (void) printf("%s\n", type ? type : "int");
+ }
+
+ void docexplain(constvol, type, cast, name)
+ char *constvol, *type, *cast, *name;
+ {
+ if (strcmp(type, "void") == 0)
+ if (prev == 'a')
+ unsupp("array of type void",
+ "array of type pointer to void");
+ else if (prev == 'r')
+ unsupp("reference to type void",
+ "pointer to void");
+ (void) printf("cast %s into %s", name, cast);
+ if (strlen(constvol) > 0)
+ (void) printf("%s ", constvol);
+ (void) printf("%s\n",type);
+ }
+
+ /* Do the appropriate things for the "set" command. */
+ void doset(opt)
+ char *opt;
+ {
+ if (strcmp(opt, "create") == 0)
+ { MkProgramFlag = 1; }
+ else if (strcmp(opt, "nocreate") == 0)
+ { MkProgramFlag = 0; }
+ else if (strcmp(opt, "interactive") == 0)
+ { Interactive = 1; }
+ else if (strcmp(opt, "nointeractive") == 0)
+ { Interactive = 0; OnATty = 0; }
+ else if (strcmp(opt, "ritchie") == 0)
+ { CplusplusFlag=0; RitchieFlag=1; PreANSIFlag=0; }
+ else if (strcmp(opt, "preansi") == 0)
+ { CplusplusFlag=0; RitchieFlag=0; PreANSIFlag=1; }
+ else if (strcmp(opt, "ansi") == 0)
+ { CplusplusFlag=0; RitchieFlag=0; PreANSIFlag=0; }
+ else if (strcmp(opt, "cplusplus") == 0)
+ { CplusplusFlag=1; RitchieFlag=0; PreANSIFlag=0; }
+ #ifdef dodebug
+ else if (strcmp(opt, "debug") == 0)
+ { DebugFlag = 1; }
+ else if (strcmp(opt, "nodebug") == 0)
+ { DebugFlag = 0; }
+ #endif /* dodebug */
+ #ifdef doyydebug
+ else if (strcmp(opt, "yydebug") == 0)
+ { yydebug = 1; }
+ else if (strcmp(opt, "noyydebug") == 0)
+ { yydebug = 0; }
+ #endif /* doyydebug */
+ else
+ {
+ if ((strcmp(opt, unknown_name) != 0) &&
+ (strcmp(opt, "options") != 0))
+ (void) printf("Unknown set option: '%s'\n", opt);
+
+ (void) printf("Valid set options (and command line equivalents) are:\n");
+ (void) printf("\toptions\n");
+ (void) printf("\tcreate (-c), nocreate\n");
+ (void) printf("\tinteractive (-i), nointeractive\n");
+ (void) printf("\tritchie (-r), preansi (-p), ansi (-a) or cplusplus (-+)\n");
+ #ifdef dodebug
+ (void) printf("\tdebug (-d), nodebug\n");
+ #endif /* dodebug */
+ #ifdef doyydebug
+ (void) printf("\tyydebug (-D), noyydebug\n");
+ #endif /* doyydebug */
+
+ (void) printf("\nCurrent set values are:\n");
+ (void) printf("\t%screate\n", MkProgramFlag ? " " : " no");
+ (void) printf("\t%sinteractive\n",
+ (OnATty || Interactive) ? " " : " no");
+ if (RitchieFlag)
+ (void) printf("\t ritchie\n");
+ else
+ (void) printf("\t(noritchie)\n");
+ if (PreANSIFlag)
+ (void) printf("\t preansi\n");
+ else
+ (void) printf("\t(nopreansi)\n");
+ if (!RitchieFlag && !PreANSIFlag && !CplusplusFlag)
+ (void) printf("\t ansi\n");
+ else
+ (void) printf("\t(noansi)\n");
+ if (CplusplusFlag)
+ (void) printf("\t cplusplus\n");
+ else
+ (void) printf("\t(nocplusplus)\n");
+ #ifdef dodebug
+ (void) printf("\t%sdebug\n", DebugFlag ? " " : " no");
+ #endif /* dodebug */
+ #ifdef doyydebug
+ (void) printf("\t%syydebug\n", yydebug ? " " : " no");
+ #endif /* doyydebug */
+ }
+ }
+
+ void versions()
+ {
+ (void) printf("Version:\n\t%s\n\t%s\n\t%s\n",
+ cdeclsccsid, cdgramsccsid, cdlexsccsid);
+ exit(0);
+ }
+
+ int main(int argc, char **argv)
+ {
+ int c, ret = 0;
+
+ setprogname(argv[0]);
+ #ifdef DOS
+ if (strcmp(progname, "cppdecl") == 0)
+ #else
+ if (strcmp(progname, "c++decl") == 0)
+ #endif /* DOS */
+ CplusplusFlag = 1;
+
+ while ((c = getopt(argc, argv, "cirpa+dDV")) != EOF)
+ switch (c)
+ {
+ case 'c': MkProgramFlag=1; break;
+ case 'i': Interactive=1; break;
+
+ /* The following are mutually exclusive. */
+ /* Only the last one set prevails. */
+ case 'r': CplusplusFlag=0; RitchieFlag=1; PreANSIFlag=0; break;
+ case 'p': CplusplusFlag=0; RitchieFlag=0; PreANSIFlag=1; break;
+ case 'a': CplusplusFlag=0; RitchieFlag=0; PreANSIFlag=0; break;
+ case '+': CplusplusFlag=1; RitchieFlag=0; PreANSIFlag=0; break;
+
+ #ifdef dodebug
+ case 'd': DebugFlag=1; break;
+ #endif /* dodebug */
+ #ifdef doyydebug
+ case 'D': yydebug=1; break;
+ #endif /* doyydebug */
+ case 'V': versions(); break;
+ case '?': usage(); break;
+ }
+
+ /* Run down the list of arguments, parsing each one. */
+
+ /* Use standard input if no file names or "-" is found. */
+ if (optind == argc)
+ ret += dostdin();
+
+ /* If called as explain, declare or cast, or first */
+ /* argument is one of those, use the command line */
+ /* as the input. */
+ else if (namedkeyword(argv[optind]))
+ ret += dotmpfile(argc, argv);
+
+ else
+ ret += dofileargs(argc, argv);
+
+ return ret;
+ /* NOTREACHED */
+ }
+
+
+
+
+
+
Index: llvm-test/MultiSource/Benchmarks/Prolangs-C/cdecl/cdgram.c.source
diff -c /dev/null llvm-test/MultiSource/Benchmarks/Prolangs-C/cdecl/cdgram.c.source:1.1
*** /dev/null Tue Oct 5 14:08:39 2004
--- llvm-test/MultiSource/Benchmarks/Prolangs-C/cdecl/cdgram.c.source Tue Oct 5 14:08:26 2004
***************
*** 0 ****
--- 1,1157 ----
+ # line 2 "cdgram.y"
+ /* Yacc grammar for ANSI and C++ cdecl. */
+ /* The output of this file is included */
+ /* into the C file cdecl.c. */
+ char cdgramsccsid[] = "@(#)cdgram.y 2.2 3/30/88";
+
+ extern char prev;
+
+ # line 8 "cdgram.y"
+ typedef union {
+ char *dynstr;
+ struct {
+ char *left;
+ char *right;
+ char *type;
+ } halves;
+ } YYSTYPE;
+ # define ARRAY 257
+ # define AS 258
+ # define CAST 259
+ # define COMMA 260
+ # define DECLARE 261
+ # define DOUBLECOLON 262
+ # define EXPLAIN 263
+ # define FUNCTION 264
+ # define HELP 265
+ # define INTO 266
+ # define OF 267
+ # define MEMBER 268
+ # define POINTER 269
+ # define REFERENCE 270
+ # define RETURNING 271
+ # define SET 272
+ # define TO 273
+ # define CHAR 274
+ # define CLASS 275
+ # define CONSTVOLATILE 276
+ # define DOUBLE 277
+ # define ENUM 278
+ # define FLOAT 279
+ # define INT 280
+ # define LONG 281
+ # define NAME 282
+ # define NUMBER 283
+ # define SHORT 284
+ # define SIGNED 285
+ # define STRUCT 286
+ # define UNION 287
+ # define UNSIGNED 288
+ # define VOID 289
+ # define AUTO 290
+ # define EXTERN 291
+ # define REGISTER 292
+ # define STATIC 293
+ #define yyclearin yychar = -1
+ #define yyerrok yyerrflag = 0
+ extern int yychar;
+ extern short yyerrflag;
+ #ifndef YYMAXDEPTH
+ #define YYMAXDEPTH 150
+ #endif
+ YYSTYPE yylval, yyval;
+ # define YYERRCODE 256
+
+ # line 855 "cdgram.y"
+
+ short yyexca[] ={
+ -1, 1,
+ 0, -1,
+ -2, 0,
+ -1, 27,
+ 282, 81,
+ 40, 81,
+ 42, 81,
+ 38, 81,
+ -2, 87,
+ -1, 37,
+ 260, 31,
+ 41, 31,
+ -2, 81,
+ -1, 87,
+ 282, 82,
+ 40, 82,
+ 42, 82,
+ 38, 82,
+ -2, 80,
+ -1, 92,
+ 260, 31,
+ 41, 31,
+ -2, 81,
+ };
+ # define YYNPROD 89
+ # define YYLAST 322
+ short yyact[]={
+
+ 67, 79, 28, 69, 72, 68, 66, 76, 159, 13,
+ 77, 75, 78, 73, 74, 70, 79, 16, 17, 18,
+ 19, 16, 17, 18, 19, 67, 129, 78, 69, 103,
+ 68, 66, 125, 25, 76, 39, 23, 77, 75, 128,
+ 70, 74, 118, 22, 115, 137, 117, 118, 85, 115,
+ 86, 117, 83, 23, 152, 25, 30, 100, 23, 10,
+ 22, 56, 25, 23, 47, 22, 60, 59, 37, 97,
+ 22, 121, 25, 40, 41, 123, 58, 25, 20, 34,
+ 139, 110, 25, 161, 144, 93, 145, 92, 94, 32,
+ 24, 57, 147, 71, 126, 29, 81, 21, 42, 55,
+ 8, 136, 108, 150, 12, 135, 33, 106, 11, 114,
+ 31, 10, 62, 151, 132, 134, 44, 45, 48, 49,
+ 156, 43, 35, 2, 63, 15, 53, 1, 54, 14,
+ 50, 64, 27, 65, 52, 101, 26, 46, 87, 82,
+ 61, 38, 0, 90, 80, 88, 0, 0, 89, 0,
+ 95, 96, 98, 108, 91, 108, 0, 0, 108, 0,
+ 11, 0, 51, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 109, 0, 111, 104, 102, 0,
+ 0, 0, 105, 112, 107, 0, 122, 99, 0, 113,
+ 0, 119, 120, 0, 0, 0, 0, 127, 0, 0,
+ 0, 0, 0, 0, 0, 124, 131, 0, 133, 0,
+ 0, 0, 0, 142, 0, 0, 130, 143, 0, 0,
+ 0, 0, 0, 0, 0, 138, 146, 140, 141, 148,
+ 0, 149, 0, 0, 0, 0, 127, 0, 0, 0,
+ 153, 0, 0, 25, 158, 0, 0, 127, 0, 128,
+ 155, 160, 16, 17, 18, 19, 154, 0, 0, 0,
+ 0, 157, 0, 0, 0, 0, 0, 25, 0, 0,
+ 0, 0, 0, 128, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 116, 0, 0, 0,
+ 0, 116, 84, 0, 0, 0, 0, 0, 0, 36,
+ 0, 0, 145, 145, 92, 9, 0, 0, 5, 0,
+ 4, 0, 6, 0, 3, 0, 0, 0, 0, 0,
+ 0, 7 };
+ short yypact[]={
+
+ -1000, 49,-1000, 101,-273,-204, -38,-226,-1000, 101,
+ -1000,-1000,-1000,-169,-194,-1000,-1000,-1000,-1000,-1000,
+ -187, 101, 28,-248,-196,-214,-212,-214,-214, 101,
+ -1000,-1000,-269, 101,-194,-1000,-194,-221,-191,-1000,
+ -206,-207,-1000,-274,-1000,-1000, 10,-214, 10,-1000,
+ -1000,-194,-1000, 101,-1000, 44,-170,-1000,-194,-199,
+ -194,-1000,-249,-1000,-225,-247,-1000,-1000,-1000,-1000,
+ -1000,-1000,-1000,-1000,-1000,-1000,-1000,-1000,-1000,-1000,
+ 10, 101, 67,-214,-181,-214, 10,-1000, 101, 9,
+ 101,-1000,-221,-200,-194,-1000,-1000,-192,-1000,-1000,
+ -1000,-1000,-1000,-1000, 101,-1000, -9,-1000, -67, 10,
+ 72, 10, 74,-1000, 64, 4,-182, 9, 9,-1000,
+ -173,-194,-1000,-259,-1000,-1000, 43,-1000,-1000,-1000,
+ -1,-1000, 10,-1000,-1000,-226,-1000,-1000, 62, 71,
+ 11, 11,-1000,-228,-1000,-243, 9,-1000,-1000, 101,
+ 80, 9,-194,-174, 11,-1000, -33, 11,-1000,-1000,
+ 42,-1000 };
+ short yypgo[]={
+
+ 0, 99, 141, 140, 109, 94, 96, 139, 101, 137,
+ 93, 112, 135, 133, 90, 95, 129, 125, 131, 124,
+ 98, 91, 127, 123, 100, 121 };
+ short yyr1[]={
+
+ 0, 22, 22, 23, 23, 23, 23, 23, 23, 23,
+ 23, 23, 23, 23, 23, 24, 24, 15, 15, 6,
+ 6, 6, 6, 7, 7, 7, 7, 7, 5, 5,
+ 5, 1, 1, 1, 1, 1, 4, 4, 4, 4,
+ 4, 4, 4, 4, 4, 8, 8, 21, 21, 21,
+ 21, 21, 21, 21, 2, 2, 20, 25, 3, 3,
+ 3, 3, 18, 18, 18, 10, 10, 19, 19, 19,
+ 19, 19, 11, 11, 12, 12, 13, 13, 13, 13,
+ 14, 14, 9, 17, 17, 17, 17, 16, 16 };
+ short yyr2[]={
+
+ 0, 0, 2, 2, 6, 4, 5, 3, 6, 5,
+ 5, 8, 3, 1, 2, 1, 1, 1, 0, 1,
+ 3, 4, 3, 3, 4, 2, 3, 1, 3, 3,
+ 1, 0, 3, 1, 1, 3, 0, 2, 5, 6,
+ 3, 4, 2, 2, 2, 2, 3, 3, 6, 4,
+ 4, 8, 4, 2, 0, 1, 2, 0, 1, 1,
+ 2, 2, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 2, 1, 1, 1, 1, 1, 1, 1,
+ 2, 0, 2, 1, 1, 1, 1, 1, 0 };
+ short yychk[]={
+
+ -1000, -22, -23, 265, 261, 259, 263, 272, -24, 256,
+ 10, 59, -24, 282, -16, -17, 290, 291, 292, 293,
+ 282, -21, 264, 257, -14, 276, -16, -17, 40, -15,
+ 282, -24, 258, -21, 266, -24, 271, 40, -2, 283,
+ 269, 270, -20, -25, -14, -14, -9, 276, -14, -14,
+ -24, -16, -24, -21, -21, -1, 282, -21, 267, 273,
+ 273, -3, -11, -19, -18, -13, 280, 274, 279, 277,
+ 289, -10, 278, 287, 288, 285, 281, 284, 286, 275,
+ -20, -6, -7, 42, 282, 38, 40, -14, -6, -20,
+ -21, -24, 260, 41, 258, -21, -21, 268, -21, -19,
+ 282, -12, -11, 276, -6, -24, 40, -8, 91, -14,
+ 262, -14, -6, -24, -4, 40, 282, 42, 38, -24,
+ -1, 271, -21, 267, -24, 41, -5, -14, 282, 93,
+ 283, -6, 42, -6, 41, 41, -8, 41, -4, 262,
+ -4, -4, -21, -10, 41, 260, -20, 93, -6, -15,
+ 41, 42, 282, -5, -4, -24, 40, -4, -21, 41,
+ -5, 41 };
+ short yydef[]={
+
+ 1, -2, 2, 0, 88, 81, 88, 18, 13, 0,
+ 15, 16, 3, 0, 81, 87, 83, 84, 85, 86,
+ 0, 0, 0, 54, 57, 81, 81, -2, 81, 0,
+ 17, 14, 88, 0, 81, 7, 81, -2, 0, 55,
+ 0, 0, 53, 0, 80, 57, 0, 81, 0, 57,
+ 12, 81, 5, 0, 47, 0, 33, 34, 81, 81,
+ 81, 56, 58, 59, 0, 73, 67, 68, 69, 70,
+ 71, 62, 63, 64, 76, 77, 78, 79, 65, 66,
+ 0, 0, 19, 81, 27, 81, 0, -2, 0, 36,
+ 0, 6, -2, 0, 81, 49, 50, 0, 52, 60,
+ 61, 72, 74, 75, 0, 10, 81, 25, 0, 0,
+ 0, 0, 0, 9, 0, 36, 0, 36, 36, 4,
+ 32, 81, 35, 0, 8, 23, 0, 57, 30, 45,
+ 0, 20, 0, 22, 26, 18, 44, 37, 0, 0,
+ 42, 43, 48, 0, 24, 81, 36, 46, 21, 0,
+ 40, 36, 81, 28, 29, 11, 81, 41, 51, 38,
+ 0, 39 };
+ #ifndef lint
+ static char yaccpar_sccsid[] = "@(#)yaccpar 1.6 88/02/08 SMI"; /* from UCB 4.1 83/02/11 */
+ #endif
+
+ #
+ # define YYFLAG -1000
+ # define YYERROR goto yyerrlab
+ # define YYACCEPT return(0)
+ # define YYABORT return(1)
+
+ /* parser for yacc output */
+
+ #ifdef YYDEBUG
+ int yydebug = 0; /* 1 for debugging */
+ #endif
+ YYSTYPE yyv[YYMAXDEPTH]; /* where the values are stored */
+ int yychar = -1; /* current input token number */
+ int yynerrs = 0; /* number of errors */
+ short yyerrflag = 0; /* error recovery flag */
+
+ yyparse() {
+
+ short yys[YYMAXDEPTH];
+ short yyj, yym;
+ register YYSTYPE *yypvt;
+ register short yystate, *yyps, yyn;
+ register YYSTYPE *yypv;
+ register short *yyxi;
+
+ yystate = 0;
+ yychar = -1;
+ yynerrs = 0;
+ yyerrflag = 0;
+ yyps= &yys[-1];
+ yypv= &yyv[-1];
+
+ yystack: /* put a state and value onto the stack */
+
+ #ifdef YYDEBUG
+ if( yydebug ) printf( "state %d, char 0%o\n", yystate, yychar );
+ #endif
+ if( ++yyps>= &yys[YYMAXDEPTH] ) { yyerror( "yacc stack overflow" ); return(1); }
+ *yyps = yystate;
+ ++yypv;
+ *yypv = yyval;
+
+ yynewstate:
+
+ yyn = yypact[yystate];
+
+ if( yyn<= YYFLAG ) goto yydefault; /* simple state */
+
+ if( yychar<0 ) if( (yychar=yylex())<0 ) yychar=0;
+ if( (yyn += yychar)<0 || yyn >= YYLAST ) goto yydefault;
+
+ if( yychk[ yyn=yyact[ yyn ] ] == yychar ){ /* valid shift */
+ yychar = -1;
+ yyval = yylval;
+ yystate = yyn;
+ if( yyerrflag > 0 ) --yyerrflag;
+ goto yystack;
+ }
+
+ yydefault:
+ /* default state action */
+
+ if( (yyn=yydef[yystate]) == -2 ) {
+ if( yychar<0 ) if( (yychar=yylex())<0 ) yychar = 0;
+ /* look through exception table */
+
+ for( yyxi=yyexca; (*yyxi!= (-1)) || (yyxi[1]!=yystate) ; yyxi += 2 ) ; /* VOID */
+
+ while( *(yyxi+=2) >= 0 ){
+ if( *yyxi == yychar ) break;
+ }
+ if( (yyn = yyxi[1]) < 0 ) return(0); /* accept */
+ }
+
+ if( yyn == 0 ){ /* error */
+ /* error ... attempt to resume parsing */
+
+ switch( yyerrflag ){
+
+ case 0: /* brand new error */
+
+ yyerror( "syntax error" );
+ yyerrlab:
+ ++yynerrs;
+
+ case 1:
+ case 2: /* incompletely recovered error ... try again */
+
+ yyerrflag = 3;
+
+ /* find a state where "error" is a legal shift action */
+
+ while ( yyps >= yys ) {
+ yyn = yypact[*yyps] + YYERRCODE;
+ if( yyn>= 0 && yyn < YYLAST && yychk[yyact[yyn]] == YYERRCODE ){
+ yystate = yyact[yyn]; /* simulate a shift of "error" */
+ goto yystack;
+ }
+ yyn = yypact[*yyps];
+
+ /* the current yyps has no shift onn "error", pop stack */
+
+ #ifdef YYDEBUG
+ if( yydebug ) printf( "error recovery pops state %d, uncovers %d\n", *yyps, yyps[-1] );
+ #endif
+ --yyps;
+ --yypv;
+ }
+
+ /* there is no state on the stack with an error shift ... abort */
+
+ yyabort:
+ return(1);
+
+
+ case 3: /* no shift yet; clobber input char */
+
+ #ifdef YYDEBUG
+ if( yydebug ) printf( "error recovery discards char %d\n", yychar );
+ #endif
+
+ if( yychar == 0 ) goto yyabort; /* don't discard EOF, quit */
+ yychar = -1;
+ goto yynewstate; /* try again in the same state */
+
+ }
+
+ }
+
+ /* reduction by production yyn */
+
+ #ifdef YYDEBUG
+ if( yydebug ) printf("reduce %d\n",yyn);
+ #endif
+ yyps -= yyr2[yyn];
+ yypvt = yypv;
+ yypv -= yyr2[yyn];
+ yyval = yypv[1];
+ yym=yyn;
+ /* consult goto table to find next state */
+ yyn = yyr1[yyn];
+ yyj = yypgo[yyn] + *yyps + 1;
+ if( yyj>=YYLAST || yychk[ yystate = yyact[yyj] ] != -yyn ) yystate = yyact[yypgo[yyn]];
+ switch(yym){
+
+ case 2:
+ # line 33 "cdgram.y"
+ {
+ prompt();
+ prev = 0;
+ } break;
+ case 3:
+ # line 40 "cdgram.y"
+ {
+ Debug((stderr, "stmt: help\n"));
+ dohelp();
+ } break;
+ case 4:
+ # line 46 "cdgram.y"
+ {
+ Debug((stderr, "stmt: DECLARE NAME AS opt_storage adecl\n"));
+ Debug((stderr, "\tNAME='%s'\n", yypvt[-4].dynstr));
+ Debug((stderr, "\topt_storage='%s'\n", yypvt[-2].dynstr));
+ Debug((stderr, "\tacdecl.left='%s'\n", yypvt[-1].halves.left));
+ Debug((stderr, "\tacdecl.right='%s'\n", yypvt[-1].halves.right));
+ Debug((stderr, "\tacdecl.type='%s'\n", yypvt[-1].halves.type));
+ Debug((stderr, "\tprev = '%s'\n", visible(prev)));
+ dodeclare(yypvt[-4].dynstr, yypvt[-2].dynstr, yypvt[-1].halves.left, yypvt[-1].halves.right, yypvt[-1].halves.type);
+ } break;
+ case 5:
+ # line 58 "cdgram.y"
+ {
+ Debug((stderr, "stmt: DECLARE opt_storage adecl\n"));
+ Debug((stderr, "\topt_storage='%s'\n", yypvt[-2].dynstr));
+ Debug((stderr, "\tacdecl.left='%s'\n", yypvt[-1].halves.left));
+ Debug((stderr, "\tacdecl.right='%s'\n", yypvt[-1].halves.right));
+ Debug((stderr, "\tacdecl.type='%s'\n", yypvt[-1].halves.type));
+ Debug((stderr, "\tprev = '%s'\n", visible(prev)));
+ dodeclare(NullCP, yypvt[-2].dynstr, yypvt[-1].halves.left, yypvt[-1].halves.right, yypvt[-1].halves.type);
+ } break;
+ case 6:
+ # line 69 "cdgram.y"
+ {
+ Debug((stderr, "stmt: CAST NAME AS adecl\n"));
+ Debug((stderr, "\tNAME='%s'\n", yypvt[-3].dynstr));
+ Debug((stderr, "\tacdecl.left='%s'\n", yypvt[-1].halves.left));
+ Debug((stderr, "\tacdecl.right='%s'\n", yypvt[-1].halves.right));
+ Debug((stderr, "\tacdecl.type='%s'\n", yypvt[-1].halves.type));
+ docast(yypvt[-3].dynstr, yypvt[-1].halves.left, yypvt[-1].halves.right, yypvt[-1].halves.type);
+ } break;
+ case 7:
+ # line 79 "cdgram.y"
+ {
+ Debug((stderr, "stmt: CAST adecl\n"));
+ Debug((stderr, "\tacdecl.left='%s'\n", yypvt[-1].halves.left));
+ Debug((stderr, "\tacdecl.right='%s'\n", yypvt[-1].halves.right));
+ Debug((stderr, "\tacdecl.type='%s'\n", yypvt[-1].halves.type));
+ docast(NullCP, yypvt[-1].halves.left, yypvt[-1].halves.right, yypvt[-1].halves.type);
+ } break;
+ case 8:
+ # line 88 "cdgram.y"
+ {
+ Debug((stderr, "stmt: EXPLAIN opt_storage opt_constvol_list type cdecl\n"));
+ Debug((stderr, "\topt_storage='%s'\n", yypvt[-4].dynstr));
+ Debug((stderr, "\topt_constvol_list='%s'\n", yypvt[-3].dynstr));
+ Debug((stderr, "\ttype='%s'\n", yypvt[-2].dynstr));
+ Debug((stderr, "\tcdecl='%s'\n", yypvt[-1].dynstr));
+ Debug((stderr, "\tprev = '%s'\n", visible(prev)));
+ dodexplain(yypvt[-4].dynstr, yypvt[-3].dynstr, yypvt[-2].dynstr, yypvt[-1].dynstr);
+ } break;
+ case 9:
+ # line 99 "cdgram.y"
+ {
+ Debug((stderr, "stmt: EXPLAIN storage opt_constvol_list cdecl\n"));
+ Debug((stderr, "\tstorage='%s'\n", yypvt[-3].dynstr));
+ Debug((stderr, "\topt_constvol_list='%s'\n", yypvt[-2].dynstr));
+ Debug((stderr, "\tcdecl='%s'\n", yypvt[-1].dynstr));
+ Debug((stderr, "\tprev = '%s'\n", visible(prev)));
+ dodexplain(yypvt[-3].dynstr, yypvt[-2].dynstr, NullCP, yypvt[-1].dynstr);
+ } break;
+ case 10:
+ # line 109 "cdgram.y"
+ {
+ Debug((stderr, "stmt: EXPLAIN opt_storage constvol_list cdecl\n"));
+ Debug((stderr, "\topt_storage='%s'\n", yypvt[-3].dynstr));
+ Debug((stderr, "\tconstvol_list='%s'\n", yypvt[-2].dynstr));
+ Debug((stderr, "\tcdecl='%s'\n", yypvt[-1].dynstr));
+ Debug((stderr, "\tprev = '%s'\n", visible(prev)));
+ dodexplain(yypvt[-3].dynstr, yypvt[-2].dynstr, NullCP, yypvt[-1].dynstr);
+ } break;
+ case 11:
+ # line 119 "cdgram.y"
+ {
+ Debug((stderr, "stmt: EXPLAIN ( opt_constvol_list type cast ) optNAME\n"));
+ Debug((stderr, "\topt_constvol_list='%s'\n", yypvt[-5].dynstr));
+ Debug((stderr, "\ttype='%s'\n", yypvt[-4].dynstr));
+ Debug((stderr, "\tcast='%s'\n", yypvt[-3].dynstr));
+ Debug((stderr, "\tNAME='%s'\n", yypvt[-1].dynstr));
+ Debug((stderr, "\tprev = '%s'\n", visible(prev)));
+ docexplain(yypvt[-5].dynstr, yypvt[-4].dynstr, yypvt[-3].dynstr, yypvt[-1].dynstr);
+ } break;
+ case 12:
+ # line 130 "cdgram.y"
+ {
+ Debug((stderr, "stmt: SET optNAME\n"));
+ Debug((stderr, "\toptNAME='%s'\n", yypvt[-1].dynstr));
+ doset(yypvt[-1].dynstr);
+ } break;
+ case 14:
+ # line 138 "cdgram.y"
+ {
+ yyerrok;
+ } break;
+ case 15:
+ # line 144 "cdgram.y"
+ {
+ doprompt();
+ } break;
+ case 16:
+ # line 148 "cdgram.y"
+ {
+ noprompt();
+ } break;
+ case 17:
+ # line 154 "cdgram.y"
+ {
+ Debug((stderr, "optNAME: NAME\n"));
+ Debug((stderr, "\tNAME='%s'\n", yypvt[-0].dynstr));
+ yyval.dynstr = yypvt[-0].dynstr;
+ } break;
+ case 18:
+ # line 161 "cdgram.y"
+ {
+ Debug((stderr, "optNAME: EMPTY\n"));
+ yyval.dynstr = ds(unknown_name);
+ } break;
+ case 20:
+ # line 169 "cdgram.y"
+ {
+ Debug((stderr, "cdecl: * opt_constvol_list cdecl\n"));
+ Debug((stderr, "\topt_constvol_list='%s'\n", yypvt[-1].dynstr));
+ Debug((stderr, "\tcdecl='%s'\n", yypvt[-0].dynstr));
+ yyval.dynstr = cat(yypvt[-0].dynstr,yypvt[-1].dynstr,ds(strlen(yypvt[-1].dynstr)?" pointer to ":"pointer to "),NullCP);
+ prev = 'p';
+ Debug((stderr, "\tprev = '%s'\n", visible(prev)));
+ } break;
+ case 21:
+ # line 179 "cdgram.y"
+ {
+ Debug((stderr, "cdecl: NAME DOUBLECOLON '*' cdecl\n"));
+ Debug((stderr, "\tNAME='%s'\n", yypvt[-3].dynstr));
+ Debug((stderr, "\tcdecl='%s'\n", yypvt[-0].dynstr));
+ if (!CplusplusFlag)
+ unsupp("pointer to member of class", NullCP);
+ yyval.dynstr = cat(yypvt[-0].dynstr,ds("pointer to member of class "),yypvt[-3].dynstr,ds(" "),NullCP);
+ prev = 'p';
+ Debug((stderr, "\tprev = '%s'\n", visible(prev)));
+ } break;
+ case 22:
+ # line 191 "cdgram.y"
+ {
+ Debug((stderr, "cdecl: & opt_constvol_list cdecl\n"));
+ Debug((stderr, "\topt_constvol_list='%s'\n", yypvt[-1].dynstr));
+ Debug((stderr, "\tcdecl='%s'\n", yypvt[-0].dynstr));
+ if (!CplusplusFlag)
+ unsupp("reference", NullCP);
+ yyval.dynstr = cat(yypvt[-0].dynstr,yypvt[-1].dynstr,ds(strlen(yypvt[-1].dynstr)?" reference to ":"reference to "),NullCP);
+ prev = 'r';
+ Debug((stderr, "\tprev = '%s'\n", visible(prev)));
+ } break;
+ case 23:
+ # line 204 "cdgram.y"
+ {
+ Debug((stderr, "cdecl1: cdecl1()\n"));
+ Debug((stderr, "\tcdecl1='%s'\n", yypvt[-2].dynstr));
+ yyval.dynstr = cat(yypvt[-2].dynstr,ds("function returning "),NullCP);
+ prev = 'f';
+ Debug((stderr, "\tprev = '%s'\n", visible(prev)));
+ } break;
+ case 24:
+ # line 213 "cdgram.y"
+ {
+ Debug((stderr, "cdecl1: cdecl1(castlist)\n"));
+ Debug((stderr, "\tcdecl1='%s'\n", yypvt[-3].dynstr));
+ Debug((stderr, "\tcastlist='%s'\n", yypvt[-1].dynstr));
+ yyval.dynstr = cat(yypvt[-3].dynstr, ds("function ("),
+ yypvt[-1].dynstr, ds(") returning "), NullCP);
+ prev = 'f';
+ Debug((stderr, "\tprev = '%s'\n", visible(prev)));
+ } break;
+ case 25:
+ # line 224 "cdgram.y"
+ {
+ Debug((stderr, "cdecl1: cdecl1 cdims\n"));
+ Debug((stderr, "\tcdecl1='%s'\n", yypvt[-1].dynstr));
+ Debug((stderr, "\tcdims='%s'\n", yypvt[-0].dynstr));
+ yyval.dynstr = cat(yypvt[-1].dynstr,ds("array "),yypvt[-0].dynstr,NullCP);
+ prev = 'a';
+ Debug((stderr, "\tprev = '%s'\n", visible(prev)));
+ } break;
+ case 26:
+ # line 234 "cdgram.y"
+ {
+ Debug((stderr, "cdecl1: (cdecl)\n"));
+ Debug((stderr, "\tcdecl='%s'\n", yypvt[-1].dynstr));
+ yyval.dynstr = yypvt[-1].dynstr;
+ /* prev = prev; */
+ Debug((stderr, "\tprev = '%s'\n", visible(prev)));
+ } break;
+ case 27:
+ # line 243 "cdgram.y"
+ {
+ Debug((stderr, "cdecl1: NAME\n"));
+ Debug((stderr, "\tNAME='%s'\n", yypvt[-0].dynstr));
+ savedname = yypvt[-0].dynstr;
+ yyval.dynstr = ds("");
+ prev = 'n';
+ Debug((stderr, "\tprev = '%s'\n", visible(prev)));
+ } break;
+ case 28:
+ # line 254 "cdgram.y"
+ {
+ Debug((stderr, "castlist: castlist1, castlist2\n"));
+ Debug((stderr, "\tcastlist1='%s'\n", yypvt[-2].dynstr));
+ Debug((stderr, "\tcastlist2='%s'\n", yypvt[-0].dynstr));
+ yyval.dynstr = cat(yypvt[-2].dynstr, ds(", "), yypvt[-0].dynstr, NullCP);
+ } break;
+ case 29:
+ # line 262 "cdgram.y"
+ {
+ Debug((stderr, "castlist: opt_constvol_list type cast\n"));
+ Debug((stderr, "\topt_constvol_list='%s'\n", yypvt[-2].dynstr));
+ Debug((stderr, "\ttype='%s'\n", yypvt[-1].dynstr));
+ Debug((stderr, "\tcast='%s'\n", yypvt[-0].dynstr));
+ yyval.dynstr = cat(yypvt[-0].dynstr, yypvt[-2].dynstr, ds(strlen(yypvt[-2].dynstr) ? " " : ""), yypvt[-1].dynstr, NullCP);
+ } break;
+ case 30:
+ # line 271 "cdgram.y"
+ {
+ yyval.dynstr = yypvt[-0].dynstr;
+ } break;
+ case 31:
+ # line 277 "cdgram.y"
+ {
+ Debug((stderr, "adecllist: EMPTY\n"));
+ yyval.dynstr = ds("");
+ } break;
+ case 32:
+ # line 283 "cdgram.y"
+ {
+ Debug((stderr, "adecllist: adecllist1, adecllist2\n"));
+ Debug((stderr, "\tadecllist1='%s'\n", yypvt[-2].dynstr));
+ Debug((stderr, "\tadecllist2='%s'\n", yypvt[-0].dynstr));
+ yyval.dynstr = cat(yypvt[-2].dynstr, ds(", "), yypvt[-0].dynstr, NullCP);
+ } break;
+ case 33:
+ # line 291 "cdgram.y"
+ {
+ Debug((stderr, "adecllist: NAME\n"));
+ Debug((stderr, "\tNAME='%s'\n", yypvt[-0].dynstr));
+ yyval.dynstr = yypvt[-0].dynstr;
+ } break;
+ case 34:
+ # line 298 "cdgram.y"
+ {
+ Debug((stderr, "adecllist: adecl\n"));
+ Debug((stderr, "\tadecl.left='%s'\n", yypvt[-0].halves.left));
+ Debug((stderr, "\tadecl.right='%s'\n", yypvt[-0].halves.right));
+ Debug((stderr, "\tadecl.type='%s'\n", yypvt[-0].halves.type));
+ yyval.dynstr = cat(yypvt[-0].halves.type, ds(" "), yypvt[-0].halves.left, yypvt[-0].halves.right, NullCP);
+ } break;
+ case 35:
+ # line 307 "cdgram.y"
+ {
+ Debug((stderr, "adecllist: NAME AS adecl\n"));
+ Debug((stderr, "\tNAME='%s'\n", yypvt[-2].dynstr));
+ Debug((stderr, "\tadecl.left='%s'\n", yypvt[-0].halves.left));
+ Debug((stderr, "\tadecl.right='%s'\n", yypvt[-0].halves.right));
+ Debug((stderr, "\tadecl.type='%s'\n", yypvt[-0].halves.type));
+ yyval.dynstr = cat(yypvt[-0].halves.type, ds(" "), yypvt[-0].halves.left, yypvt[-2].dynstr, yypvt[-0].halves.right, NullCP);
+ } break;
+ case 36:
+ # line 318 "cdgram.y"
+ {
+ Debug((stderr, "cast: EMPTY\n"));
+ yyval.dynstr = ds("");
+ /* prev = prev; */
+ Debug((stderr, "\tprev = '%s'\n", visible(prev)));
+ } break;
+ case 37:
+ # line 326 "cdgram.y"
+ {
+ Debug((stderr, "cast: ()\n"));
+ yyval.dynstr = ds("function returning ");
+ prev = 'f';
+ Debug((stderr, "\tprev = '%s'\n", visible(prev)));
+ } break;
+ case 38:
+ # line 334 "cdgram.y"
+ {
+ Debug((stderr, "cast: (cast)()\n"));
+ Debug((stderr, "\tcast='%s'\n", yypvt[-3].dynstr));
+ yyval.dynstr = cat(yypvt[-3].dynstr,ds("function returning "),NullCP);
+ prev = 'f';
+ Debug((stderr, "\tprev = '%s'\n", visible(prev)));
+ } break;
+ case 39:
+ # line 343 "cdgram.y"
+ {
+ Debug((stderr, "cast: (cast)(castlist)\n"));
+ Debug((stderr, "\tcast='%s'\n", yypvt[-4].dynstr));
+ Debug((stderr, "\tcastlist='%s'\n", yypvt[-1].dynstr));
+ yyval.dynstr = cat(yypvt[-4].dynstr,ds("function ("),yypvt[-1].dynstr,ds(") returning "),NullCP);
+ prev = 'f';
+ Debug((stderr, "\tprev = '%s'\n", visible(prev)));
+ } break;
+ case 40:
+ # line 353 "cdgram.y"
+ {
+ Debug((stderr, "cast: (cast)\n"));
+ Debug((stderr, "\tcast='%s'\n", yypvt[-1].dynstr));
+ yyval.dynstr = yypvt[-1].dynstr;
+ /* prev = prev; */
+ Debug((stderr, "\tprev = '%s'\n", visible(prev)));
+ } break;
+ case 41:
+ # line 362 "cdgram.y"
+ {
+ Debug((stderr, "cast: NAME::*cast\n"));
+ Debug((stderr, "\tcast='%s'\n", yypvt[-0].dynstr));
+ if (!CplusplusFlag)
+ unsupp("pointer to member of class", NullCP);
+ yyval.dynstr = cat(yypvt[-0].dynstr,ds("pointer to member of class "),yypvt[-3].dynstr,ds(" "),NullCP);
+ prev = 'p';
+ Debug((stderr, "\tprev = '%s'\n", visible(prev)));
+ } break;
+ case 42:
+ # line 373 "cdgram.y"
+ {
+ Debug((stderr, "cast: *cast\n"));
+ Debug((stderr, "\tcast='%s'\n", yypvt[-0].dynstr));
+ yyval.dynstr = cat(yypvt[-0].dynstr,ds("pointer to "),NullCP);
+ prev = 'p';
+ Debug((stderr, "\tprev = '%s'\n", visible(prev)));
+ } break;
+ case 43:
+ # line 382 "cdgram.y"
+ {
+ Debug((stderr, "cast: &cast\n"));
+ Debug((stderr, "\tcast='%s'\n", yypvt[-0].dynstr));
+ if (!CplusplusFlag)
+ unsupp("reference", NullCP);
+ yyval.dynstr = cat(yypvt[-0].dynstr,ds("reference to "),NullCP);
+ prev = 'r';
+ Debug((stderr, "\tprev = '%s'\n", visible(prev)));
+ } break;
+ case 44:
+ # line 393 "cdgram.y"
+ {
+ Debug((stderr, "cast: cast cdims\n"));
+ Debug((stderr, "\tcast='%s'\n", yypvt[-1].dynstr));
+ Debug((stderr, "\tcdims='%s'\n", yypvt[-0].dynstr));
+ yyval.dynstr = cat(yypvt[-1].dynstr,ds("array "),yypvt[-0].dynstr,NullCP);
+ prev = 'a';
+ Debug((stderr, "\tprev = '%s'\n", visible(prev)));
+ } break;
+ case 45:
+ # line 404 "cdgram.y"
+ {
+ Debug((stderr, "cdims: []\n"));
+ yyval.dynstr = ds("of ");
+ } break;
+ case 46:
+ # line 410 "cdgram.y"
+ {
+ Debug((stderr, "cdims: [NUMBER]\n"));
+ Debug((stderr, "\tNUMBER='%s'\n", yypvt[-1].dynstr));
+ yyval.dynstr = cat(yypvt[-1].dynstr,ds(" of "),NullCP);
+ } break;
+ case 47:
+ # line 418 "cdgram.y"
+ {
+ Debug((stderr, "adecl: FUNCTION RETURNING adecl\n"));
+ Debug((stderr, "\tadecl.left='%s'\n", yypvt[-0].halves.left));
+ Debug((stderr, "\tadecl.right='%s'\n", yypvt[-0].halves.right));
+ Debug((stderr, "\tadecl.type='%s'\n", yypvt[-0].halves.type));
+ if (prev == 'f')
+ unsupp("Function returning function",
+ "function returning pointer to function");
+ else if (prev=='A' || prev=='a')
+ unsupp("Function returning array",
+ "function returning pointer");
+ yyval.halves.left = yypvt[-0].halves.left;
+ yyval.halves.right = cat(ds("()"),yypvt[-0].halves.right,NullCP);
+ yyval.halves.type = yypvt[-0].halves.type;
+ prev = 'f';
+ Debug((stderr, "\n\tadecl now =\n"));
+ Debug((stderr, "\t\tadecl.left='%s'\n", yyval.halves.left));
+ Debug((stderr, "\t\tadecl.right='%s'\n", yyval.halves.right));
+ Debug((stderr, "\t\tadecl.type='%s'\n", yyval.halves.type));
+ Debug((stderr, "\tprev = '%s'\n", visible(prev)));
+ } break;
+ case 48:
+ # line 441 "cdgram.y"
+ {
+ Debug((stderr, "adecl: FUNCTION (adecllist) RETURNING adecl\n"));
+ Debug((stderr, "\tadecllist='%s'\n", yypvt[-3].dynstr));
+ Debug((stderr, "\tadecl.left='%s'\n", yypvt[-0].halves.left));
+ Debug((stderr, "\tadecl.right='%s'\n", yypvt[-0].halves.right));
+ Debug((stderr, "\tadecl.type='%s'\n", yypvt[-0].halves.type));
+ if (prev == 'f')
+ unsupp("Function returning function",
+ "function returning pointer to function");
+ else if (prev=='A' || prev=='a')
+ unsupp("Function returning array",
+ "function returning pointer");
+ yyval.halves.left = yypvt[-0].halves.left;
+ yyval.halves.right = cat(ds("("),yypvt[-3].dynstr,ds(")"),yypvt[-0].halves.right,NullCP);
+ yyval.halves.type = yypvt[-0].halves.type;
+ prev = 'f';
+ Debug((stderr, "\n\tadecl now =\n"));
+ Debug((stderr, "\t\tadecl.left='%s'\n", yyval.halves.left));
+ Debug((stderr, "\t\tadecl.right='%s'\n", yyval.halves.right));
+ Debug((stderr, "\t\tadecl.type='%s'\n", yyval.halves.type));
+ Debug((stderr, "\tprev = '%s'\n", visible(prev)));
+ } break;
+ case 49:
+ # line 465 "cdgram.y"
+ {
+ Debug((stderr, "adecl: ARRAY adims OF adecl\n"));
+ Debug((stderr, "\tadims='%s'\n", yypvt[-2].dynstr));
+ Debug((stderr, "\tadecl.left='%s'\n", yypvt[-0].halves.left));
+ Debug((stderr, "\tadecl.right='%s'\n", yypvt[-0].halves.right));
+ Debug((stderr, "\tadecl.type='%s'\n", yypvt[-0].halves.type));
+ if (prev == 'f')
+ unsupp("Array of function",
+ "array of pointer to function");
+ else if (prev == 'a')
+ unsupp("Inner array of unspecified size",
+ "array of pointer");
+ else if (prev == 'v')
+ unsupp("Array of void",
+ "pointer to void");
+ if (arbdims)
+ prev = 'a';
+ else
+ prev = 'A';
+ yyval.halves.left = yypvt[-0].halves.left;
+ yyval.halves.right = cat(yypvt[-2].dynstr,yypvt[-0].halves.right,NullCP);
+ yyval.halves.type = yypvt[-0].halves.type;
+ Debug((stderr, "\n\tadecl now =\n"));
+ Debug((stderr, "\t\tadecl.left='%s'\n", yyval.halves.left));
+ Debug((stderr, "\t\tadecl.right='%s'\n", yyval.halves.right));
+ Debug((stderr, "\t\tadecl.type='%s'\n", yyval.halves.type));
+ Debug((stderr, "\tprev = '%s'\n", visible(prev)));
+ } break;
+ case 50:
+ # line 495 "cdgram.y"
+ {
+ char *op = "", *cp = "", *sp = "";
+
+ Debug((stderr, "adecl: opt_constvol_list POINTER TO adecl\n"));
+ Debug((stderr, "\topt_constvol_list='%s'\n", yypvt[-3].dynstr));
+ Debug((stderr, "\tadecl.left='%s'\n", yypvt[-0].halves.left));
+ Debug((stderr, "\tadecl.right='%s'\n", yypvt[-0].halves.right));
+ Debug((stderr, "\tadecl.type='%s'\n", yypvt[-0].halves.type));
+ if (prev == 'a')
+ unsupp("Pointer to array of unspecified dimension",
+ "pointer to object");
+ if (prev=='a' || prev=='A' || prev=='f') {
+ op = "(";
+ cp = ")";
+ }
+ if (strlen(yypvt[-3].dynstr) != 0)
+ sp = " ";
+ yyval.halves.left = cat(yypvt[-0].halves.left,ds(op),ds("*"),
+ ds(sp),yypvt[-3].dynstr,ds(sp),NullCP);
+ yyval.halves.right = cat(ds(cp),yypvt[-0].halves.right,NullCP);
+ yyval.halves.type = yypvt[-0].halves.type;
+ prev = 'p';
+ Debug((stderr, "\n\tadecl now =\n"));
+ Debug((stderr, "\t\tadecl.left='%s'\n", yyval.halves.left));
+ Debug((stderr, "\t\tadecl.right='%s'\n", yyval.halves.right));
+ Debug((stderr, "\t\tadecl.type='%s'\n", yyval.halves.type));
+ Debug((stderr, "\tprev = '%s'\n", visible(prev)));
+ } break;
+ case 51:
+ # line 525 "cdgram.y"
+ {
+ char *op = "", *cp = "", *sp = "";
+
+ Debug((stderr, "adecl: opt_constvol_list POINTER TO MEMBER OF ClassStruct NAME adecl\n"));
+ Debug((stderr, "\topt_constvol_list='%s'\n", yypvt[-7].dynstr));
+ Debug((stderr, "\tClassStruct='%s'\n", yypvt[-2].dynstr));
+ Debug((stderr, "\tNAME='%s'\n", yypvt[-1].dynstr));
+ Debug((stderr, "\tadecl.left='%s'\n", yypvt[-0].halves.left));
+ Debug((stderr, "\tadecl.right='%s'\n", yypvt[-0].halves.right));
+ Debug((stderr, "\tadecl.type='%s'\n", yypvt[-0].halves.type));
+ if (!CplusplusFlag)
+ unsupp("pointer to member of class", NullCP);
+ if (prev == 'a')
+ unsupp("Pointer to array of unspecified dimension",
+ "pointer to object");
+ if (prev=='a' || prev=='A' || prev=='f') {
+ op = "(";
+ cp = ")";
+ }
+ if (strlen(yypvt[-7].dynstr) != 0)
+ sp = " ";
+ yyval.halves.left = cat(yypvt[-0].halves.left,ds(op),yypvt[-1].dynstr,ds("::*"),
+ ds(sp),yypvt[-7].dynstr,ds(sp),NullCP);
+ yyval.halves.right = cat(ds(cp),yypvt[-0].halves.right,NullCP);
+ yyval.halves.type = yypvt[-0].halves.type;
+ prev = 'p';
+ Debug((stderr, "\n\tadecl now =\n"));
+ Debug((stderr, "\t\tadecl.left='%s'\n", yyval.halves.left));
+ Debug((stderr, "\t\tadecl.right='%s'\n", yyval.halves.right));
+ Debug((stderr, "\t\tadecl.type='%s'\n", yyval.halves.type));
+ Debug((stderr, "\tprev = '%s'\n", visible(prev)));
+ } break;
+ case 52:
+ # line 559 "cdgram.y"
+ {
+ char *op = "", *cp = "", *sp = "";
+
+ Debug((stderr, "adecl: opt_constvol_list REFERENCE TO adecl\n"));
+ Debug((stderr, "\topt_constvol_list='%s'\n", yypvt[-3].dynstr));
+ Debug((stderr, "\tadecl.left='%s'\n", yypvt[-0].halves.left));
+ Debug((stderr, "\tadecl.right='%s'\n", yypvt[-0].halves.right));
+ Debug((stderr, "\tadecl.type='%s'\n", yypvt[-0].halves.type));
+ if (!CplusplusFlag)
+ unsupp("reference", NullCP);
+ if (prev == 'v')
+ unsupp("Reference to void",
+ "pointer to void");
+ else if (prev == 'a')
+ unsupp("Reference to array of unspecified dimension",
+ "reference to object");
+ if (prev=='a' || prev=='A' || prev=='f') {
+ op = "(";
+ cp = ")";
+ }
+ if (strlen(yypvt[-3].dynstr) != 0)
+ sp = " ";
+ yyval.halves.left = cat(yypvt[-0].halves.left,ds(op),ds("&"),
+ ds(sp),yypvt[-3].dynstr,ds(sp),NullCP);
+ yyval.halves.right = cat(ds(cp),yypvt[-0].halves.right,NullCP);
+ yyval.halves.type = yypvt[-0].halves.type;
+ prev = 'r';
+ Debug((stderr, "\n\tadecl now =\n"));
+ Debug((stderr, "\t\tadecl.left='%s'\n", yyval.halves.left));
+ Debug((stderr, "\t\tadecl.right='%s'\n", yyval.halves.right));
+ Debug((stderr, "\t\tadecl.type='%s'\n", yyval.halves.type));
+ Debug((stderr, "\tprev = '%s'\n", visible(prev)));
+ } break;
+ case 53:
+ # line 594 "cdgram.y"
+ {
+ Debug((stderr, "adecl: opt_constvol_list type\n"));
+ Debug((stderr, "\topt_constvol_list='%s'\n", yypvt[-1].dynstr));
+ Debug((stderr, "\ttype='%s'\n", yypvt[-0].dynstr));
+ yyval.halves.left = ds("");
+ yyval.halves.right = ds("");
+ yyval.halves.type = cat(yypvt[-1].dynstr,ds(strlen(yypvt[-1].dynstr)?" ":""),yypvt[-0].dynstr,NullCP);
+ if (strcmp(yypvt[-0].dynstr, "void") == 0)
+ prev = 'v';
+ else if ((strncmp(yypvt[-0].dynstr, "struct", 6) == 0) ||
+ (strncmp(yypvt[-0].dynstr, "class", 5) == 0))
+ prev = 's';
+ else
+ prev = 't';
+ Debug((stderr, "\n\tadecl now =\n"));
+ Debug((stderr, "\t\tadecl.left='%s'\n", yyval.halves.left));
+ Debug((stderr, "\t\tadecl.right='%s'\n", yyval.halves.right));
+ Debug((stderr, "\t\tadecl.type='%s'\n", yyval.halves.type));
+ Debug((stderr, "\tprev = '%s'\n", visible(prev)));
+ } break;
+ case 54:
+ # line 617 "cdgram.y"
+ {
+ Debug((stderr, "adims: EMPTY\n"));
+ arbdims = 1;
+ yyval.dynstr = ds("[]");
+ } break;
+ case 55:
+ # line 624 "cdgram.y"
+ {
+ Debug((stderr, "adims: NUMBER\n"));
+ Debug((stderr, "\tNUMBER='%s'\n", yypvt[-0].dynstr));
+ arbdims = 0;
+ yyval.dynstr = cat(ds("["),yypvt[-0].dynstr,ds("]"),NullCP);
+ } break;
+ case 56:
+ # line 633 "cdgram.y"
+ {
+ Debug((stderr, "type: tinit c_type\n"));
+ Debug((stderr, "\ttinit=''\n"));
+ Debug((stderr, "\tc_type='%s'\n", yypvt[-0].dynstr));
+ mbcheck();
+ yyval.dynstr = yypvt[-0].dynstr;
+ } break;
+ case 57:
+ # line 643 "cdgram.y"
+ {
+ Debug((stderr, "tinit: EMPTY\n"));
+ modbits = 0;
+ } break;
+ case 58:
+ # line 650 "cdgram.y"
+ {
+ Debug((stderr, "c_type: mod_list\n"));
+ Debug((stderr, "\tmod_list='%s'\n", yypvt[-0].dynstr));
+ yyval.dynstr = yypvt[-0].dynstr;
+ } break;
+ case 59:
+ # line 657 "cdgram.y"
+ {
+ Debug((stderr, "c_type: tname\n"));
+ Debug((stderr, "\ttname='%s'\n", yypvt[-0].dynstr));
+ yyval.dynstr = yypvt[-0].dynstr;
+ } break;
+ case 60:
+ # line 664 "cdgram.y"
+ {
+ Debug((stderr, "c_type: mod_list tname\n"));
+ Debug((stderr, "\tmod_list='%s'\n", yypvt[-1].dynstr));
+ Debug((stderr, "\ttname='%s'\n", yypvt[-0].dynstr));
+ yyval.dynstr = cat(yypvt[-1].dynstr,ds(" "),yypvt[-0].dynstr,NullCP);
+ } break;
+ case 61:
+ # line 672 "cdgram.y"
+ {
+ Debug((stderr, "c_type: StrClaUniEnum NAME\n"));
+ Debug((stderr, "\tStrClaUniEnum='%s'\n", yypvt[-1].dynstr));
+ Debug((stderr, "\tNAME='%s'\n", yypvt[-0].dynstr));
+ yyval.dynstr = cat(yypvt[-1].dynstr,ds(" "),yypvt[-0].dynstr,NullCP);
+ } break;
+ case 64:
+ # line 683 "cdgram.y"
+ {
+ yyval.dynstr = yypvt[-0].dynstr;
+ } break;
+ case 66:
+ # line 690 "cdgram.y"
+ {
+ yyval.dynstr = yypvt[-0].dynstr;
+ } break;
+ case 67:
+ # line 696 "cdgram.y"
+ {
+ Debug((stderr, "tname: INT\n"));
+ Debug((stderr, "\tINT='%s'\n", yypvt[-0].dynstr));
+ modbits |= MB_INT; yyval.dynstr = yypvt[-0].dynstr;
+ } break;
+ case 68:
+ # line 703 "cdgram.y"
+ {
+ Debug((stderr, "tname: CHAR\n"));
+ Debug((stderr, "\tCHAR='%s'\n", yypvt[-0].dynstr));
+ modbits |= MB_CHAR; yyval.dynstr = yypvt[-0].dynstr;
+ } break;
+ case 69:
+ # line 710 "cdgram.y"
+ {
+ Debug((stderr, "tname: FLOAT\n"));
+ Debug((stderr, "\tFLOAT='%s'\n", yypvt[-0].dynstr));
+ modbits |= MB_FLOAT; yyval.dynstr = yypvt[-0].dynstr;
+ } break;
+ case 70:
+ # line 717 "cdgram.y"
+ {
+ Debug((stderr, "tname: DOUBLE\n"));
+ Debug((stderr, "\tDOUBLE='%s'\n", yypvt[-0].dynstr));
+ modbits |= MB_DOUBLE; yyval.dynstr = yypvt[-0].dynstr;
+ } break;
+ case 71:
+ # line 724 "cdgram.y"
+ {
+ Debug((stderr, "tname: VOID\n"));
+ Debug((stderr, "\tVOID='%s'\n", yypvt[-0].dynstr));
+ modbits |= MB_VOID; yyval.dynstr = yypvt[-0].dynstr;
+ } break;
+ case 72:
+ # line 732 "cdgram.y"
+ {
+ Debug((stderr, "mod_list: modifier mod_list1\n"));
+ Debug((stderr, "\tmodifier='%s'\n", yypvt[-1].dynstr));
+ Debug((stderr, "\tmod_list1='%s'\n", yypvt[-0].dynstr));
+ yyval.dynstr = cat(yypvt[-1].dynstr,ds(" "),yypvt[-0].dynstr,NullCP);
+ } break;
+ case 73:
+ # line 740 "cdgram.y"
+ {
+ Debug((stderr, "mod_list: modifier\n"));
+ Debug((stderr, "\tmodifier='%s'\n", yypvt[-0].dynstr));
+ yyval.dynstr = yypvt[-0].dynstr;
+ } break;
+ case 74:
+ # line 748 "cdgram.y"
+ {
+ Debug((stderr, "mod_list1: mod_list\n"));
+ Debug((stderr, "\tmod_list='%s'\n", yypvt[-0].dynstr));
+ yyval.dynstr = yypvt[-0].dynstr;
+ } break;
+ case 75:
+ # line 755 "cdgram.y"
+ {
+ Debug((stderr, "mod_list1: CONSTVOLATILE\n"));
+ Debug((stderr, "\tCONSTVOLATILE='%s'\n", yypvt[-0].dynstr));
+ if (PreANSIFlag)
+ notsupported(" (Pre-ANSI Compiler)", yypvt[-0].dynstr, NullCP);
+ else if (RitchieFlag)
+ notsupported(" (Ritchie Compiler)", yypvt[-0].dynstr, NullCP);
+ else if ((strcmp(yypvt[-0].dynstr, "noalias") == 0) && CplusplusFlag)
+ unsupp(yypvt[-0].dynstr, NullCP);
+ yyval.dynstr = yypvt[-0].dynstr;
+ } break;
+ case 76:
+ # line 769 "cdgram.y"
+ {
+ Debug((stderr, "modifier: UNSIGNED\n"));
+ Debug((stderr, "\tUNSIGNED='%s'\n", yypvt[-0].dynstr));
+ modbits |= MB_UNSIGNED; yyval.dynstr = yypvt[-0].dynstr;
+ } break;
+ case 77:
+ # line 776 "cdgram.y"
+ {
+ Debug((stderr, "modifier: SIGNED\n"));
+ Debug((stderr, "\tSIGNED='%s'\n", yypvt[-0].dynstr));
+ modbits |= MB_SIGNED; yyval.dynstr = yypvt[-0].dynstr;
+ } break;
+ case 78:
+ # line 783 "cdgram.y"
+ {
+ Debug((stderr, "modifier: LONG\n"));
+ Debug((stderr, "\tLONG='%s'\n", yypvt[-0].dynstr));
+ modbits |= MB_LONG; yyval.dynstr = yypvt[-0].dynstr;
+ } break;
+ case 79:
+ # line 790 "cdgram.y"
+ {
+ Debug((stderr, "modifier: SHORT\n"));
+ Debug((stderr, "\tSHORT='%s'\n", yypvt[-0].dynstr));
+ modbits |= MB_SHORT; yyval.dynstr = yypvt[-0].dynstr;
+ } break;
+ case 80:
+ # line 798 "cdgram.y"
+ {
+ Debug((stderr, "opt_constvol_list: CONSTVOLATILE opt_constvol_list\n"));
+ Debug((stderr, "\tCONSTVOLATILE='%s'\n", yypvt[-1].dynstr));
+ Debug((stderr, "\topt_constvol_list='%s'\n", yypvt[-0].dynstr));
+ if (PreANSIFlag)
+ notsupported(" (Pre-ANSI Compiler)", yypvt[-1].dynstr, NullCP);
+ else if (RitchieFlag)
+ notsupported(" (Ritchie Compiler)", yypvt[-1].dynstr, NullCP);
+ else if ((strcmp(yypvt[-1].dynstr, "noalias") == 0) && CplusplusFlag)
+ unsupp(yypvt[-1].dynstr, NullCP);
+ yyval.dynstr = cat(yypvt[-1].dynstr,ds(strlen(yypvt[-0].dynstr) ? " " : ""),yypvt[-0].dynstr,NullCP);
+ } break;
+ case 81:
+ # line 812 "cdgram.y"
+ {
+ Debug((stderr, "opt_constvol_list: EMPTY\n"));
+ yyval.dynstr = ds("");
+ } break;
+ case 82:
+ # line 819 "cdgram.y"
+ {
+ Debug((stderr, "constvol_list: CONSTVOLATILE opt_constvol_list\n"));
+ Debug((stderr, "\tCONSTVOLATILE='%s'\n", yypvt[-1].dynstr));
+ Debug((stderr, "\topt_constvol_list='%s'\n", yypvt[-0].dynstr));
+ if (PreANSIFlag)
+ notsupported(" (Pre-ANSI Compiler)", yypvt[-1].dynstr, NullCP);
+ else if (RitchieFlag)
+ notsupported(" (Ritchie Compiler)", yypvt[-1].dynstr, NullCP);
+ else if ((strcmp(yypvt[-1].dynstr, "noalias") == 0) && CplusplusFlag)
+ unsupp(yypvt[-1].dynstr, NullCP);
+ yyval.dynstr = cat(yypvt[-1].dynstr,ds(strlen(yypvt[-0].dynstr) ? " " : ""),yypvt[-0].dynstr,NullCP);
+ } break;
+ case 86:
+ # line 837 "cdgram.y"
+ {
+ Debug((stderr, "storage: AUTO,EXTERN,STATIC,REGISTER (%s)\n", yypvt[-0].dynstr));
+ yyval.dynstr = yypvt[-0].dynstr;
+ } break;
+ case 87:
+ # line 844 "cdgram.y"
+ {
+ Debug((stderr, "opt_storage: storage=%s\n", yypvt[-0].dynstr));
+ yyval.dynstr = yypvt[-0].dynstr;
+ } break;
+ case 88:
+ # line 850 "cdgram.y"
+ {
+ Debug((stderr, "opt_storage: EMPTY\n"));
+ yyval.dynstr = ds("");
+ } break;
+ }
+ goto yystack; /* stack new state and value */
+
+ }
Index: llvm-test/MultiSource/Benchmarks/Prolangs-C/cdecl/cdgram.y.in
diff -c /dev/null llvm-test/MultiSource/Benchmarks/Prolangs-C/cdecl/cdgram.y.in:1.1
*** /dev/null Tue Oct 5 14:08:39 2004
--- llvm-test/MultiSource/Benchmarks/Prolangs-C/cdecl/cdgram.y.in Tue Oct 5 14:08:26 2004
***************
*** 0 ****
--- 1,855 ----
+ %{
+ /* Yacc grammar for ANSI and C++ cdecl. */
+ /* The output of this file is included */
+ /* into the C file cdecl.c. */
+ char cdgramsccsid[] = "@(#)cdgram.y 2.2 3/30/88";
+ %}
+
+ %union {
+ char *dynstr;
+ struct {
+ char *left;
+ char *right;
+ char *type;
+ } halves;
+ }
+
+ %token ARRAY AS CAST COMMA DECLARE DOUBLECOLON EXPLAIN FUNCTION
+ %token HELP INTO OF MEMBER POINTER REFERENCE RETURNING SET TO
+ %token <dynstr> CHAR CLASS CONSTVOLATILE DOUBLE ENUM FLOAT INT LONG NAME
+ %token <dynstr> NUMBER SHORT SIGNED STRUCT UNION UNSIGNED VOID
+ %token <dynstr> AUTO EXTERN REGISTER STATIC
+ %type <dynstr> adecllist adims c_type cast castlist cdecl cdecl1 cdims
+ %type <dynstr> constvol_list ClassStruct mod_list mod_list1 modifier
+ %type <dynstr> opt_constvol_list optNAME opt_storage storage StrClaUniEnum
+ %type <dynstr> tname type
+ %type <halves> adecl
+
+ %start prog
+
+ %%
+ prog : /* empty */
+ | prog stmt
+ {
+ prompt();
+ prev = 0;
+ }
+ ;
+
+ stmt : HELP NL
+ {
+ Debug((stderr, "stmt: help\n"));
+ dohelp();
+ }
+
+ | DECLARE NAME AS opt_storage adecl NL
+ {
+ Debug((stderr, "stmt: DECLARE NAME AS opt_storage adecl\n"));
+ Debug((stderr, "\tNAME='%s'\n", $2));
+ Debug((stderr, "\topt_storage='%s'\n", $4));
+ Debug((stderr, "\tacdecl.left='%s'\n", $5.left));
+ Debug((stderr, "\tacdecl.right='%s'\n", $5.right));
+ Debug((stderr, "\tacdecl.type='%s'\n", $5.type));
+ Debug((stderr, "\tprev = '%s'\n", visible(prev)));
+ dodeclare($2, $4, $5.left, $5.right, $5.type);
+ }
+
+ | DECLARE opt_storage adecl NL
+ {
+ Debug((stderr, "stmt: DECLARE opt_storage adecl\n"));
+ Debug((stderr, "\topt_storage='%s'\n", $2));
+ Debug((stderr, "\tacdecl.left='%s'\n", $3.left));
+ Debug((stderr, "\tacdecl.right='%s'\n", $3.right));
+ Debug((stderr, "\tacdecl.type='%s'\n", $3.type));
+ Debug((stderr, "\tprev = '%s'\n", visible(prev)));
+ dodeclare(NullCP, $2, $3.left, $3.right, $3.type);
+ }
+
+ | CAST NAME INTO adecl NL
+ {
+ Debug((stderr, "stmt: CAST NAME AS adecl\n"));
+ Debug((stderr, "\tNAME='%s'\n", $2));
+ Debug((stderr, "\tacdecl.left='%s'\n", $4.left));
+ Debug((stderr, "\tacdecl.right='%s'\n", $4.right));
+ Debug((stderr, "\tacdecl.type='%s'\n", $4.type));
+ docast($2, $4.left, $4.right, $4.type);
+ }
+
+ | CAST adecl NL
+ {
+ Debug((stderr, "stmt: CAST adecl\n"));
+ Debug((stderr, "\tacdecl.left='%s'\n", $2.left));
+ Debug((stderr, "\tacdecl.right='%s'\n", $2.right));
+ Debug((stderr, "\tacdecl.type='%s'\n", $2.type));
+ docast(NullCP, $2.left, $2.right, $2.type);
+ }
+
+ | EXPLAIN opt_storage opt_constvol_list type cdecl NL
+ {
+ Debug((stderr, "stmt: EXPLAIN opt_storage opt_constvol_list type cdecl\n"));
+ Debug((stderr, "\topt_storage='%s'\n", $2));
+ Debug((stderr, "\topt_constvol_list='%s'\n", $3));
+ Debug((stderr, "\ttype='%s'\n", $4));
+ Debug((stderr, "\tcdecl='%s'\n", $5));
+ Debug((stderr, "\tprev = '%s'\n", visible(prev)));
+ dodexplain($2, $3, $4, $5);
+ }
+
+ | EXPLAIN storage opt_constvol_list cdecl NL
+ {
+ Debug((stderr, "stmt: EXPLAIN storage opt_constvol_list cdecl\n"));
+ Debug((stderr, "\tstorage='%s'\n", $2));
+ Debug((stderr, "\topt_constvol_list='%s'\n", $3));
+ Debug((stderr, "\tcdecl='%s'\n", $4));
+ Debug((stderr, "\tprev = '%s'\n", visible(prev)));
+ dodexplain($2, $3, NullCP, $4);
+ }
+
+ | EXPLAIN opt_storage constvol_list cdecl NL
+ {
+ Debug((stderr, "stmt: EXPLAIN opt_storage constvol_list cdecl\n"));
+ Debug((stderr, "\topt_storage='%s'\n", $2));
+ Debug((stderr, "\tconstvol_list='%s'\n", $3));
+ Debug((stderr, "\tcdecl='%s'\n", $4));
+ Debug((stderr, "\tprev = '%s'\n", visible(prev)));
+ dodexplain($2, $3, NullCP, $4);
+ }
+
+ | EXPLAIN '(' opt_constvol_list type cast ')' optNAME NL
+ {
+ Debug((stderr, "stmt: EXPLAIN ( opt_constvol_list type cast ) optNAME\n"));
+ Debug((stderr, "\topt_constvol_list='%s'\n", $3));
+ Debug((stderr, "\ttype='%s'\n", $4));
+ Debug((stderr, "\tcast='%s'\n", $5));
+ Debug((stderr, "\tNAME='%s'\n", $7));
+ Debug((stderr, "\tprev = '%s'\n", visible(prev)));
+ docexplain($3, $4, $5, $7);
+ }
+
+ | SET optNAME NL
+ {
+ Debug((stderr, "stmt: SET optNAME\n"));
+ Debug((stderr, "\toptNAME='%s'\n", $2));
+ doset($2);
+ }
+
+ | NL
+ | error NL
+ {
+ yyerrok;
+ }
+ ;
+
+ NL : '\n'
+ {
+ doprompt();
+ }
+ | ';'
+ {
+ noprompt();
+ }
+ ;
+
+ optNAME : NAME
+ {
+ Debug((stderr, "optNAME: NAME\n"));
+ Debug((stderr, "\tNAME='%s'\n", $1));
+ $$ = $1;
+ }
+
+ | /* empty */
+ {
+ Debug((stderr, "optNAME: EMPTY\n"));
+ $$ = ds(unknown_name);
+ }
+ ;
+
+ cdecl : cdecl1
+ | '*' opt_constvol_list cdecl
+ {
+ Debug((stderr, "cdecl: * opt_constvol_list cdecl\n"));
+ Debug((stderr, "\topt_constvol_list='%s'\n", $2));
+ Debug((stderr, "\tcdecl='%s'\n", $3));
+ $$ = cat($3,$2,ds(strlen($2)?" pointer to ":"pointer to "),NullCP);
+ prev = 'p';
+ Debug((stderr, "\tprev = '%s'\n", visible(prev)));
+ }
+
+ | NAME DOUBLECOLON '*' cdecl
+ {
+ Debug((stderr, "cdecl: NAME DOUBLECOLON '*' cdecl\n"));
+ Debug((stderr, "\tNAME='%s'\n", $1));
+ Debug((stderr, "\tcdecl='%s'\n", $4));
+ if (!CplusplusFlag)
+ unsupp("pointer to member of class", NullCP);
+ $$ = cat($4,ds("pointer to member of class "),$1,ds(" "),NullCP);
+ prev = 'p';
+ Debug((stderr, "\tprev = '%s'\n", visible(prev)));
+ }
+
+ | '&' opt_constvol_list cdecl
+ {
+ Debug((stderr, "cdecl: & opt_constvol_list cdecl\n"));
+ Debug((stderr, "\topt_constvol_list='%s'\n", $2));
+ Debug((stderr, "\tcdecl='%s'\n", $3));
+ if (!CplusplusFlag)
+ unsupp("reference", NullCP);
+ $$ = cat($3,$2,ds(strlen($2)?" reference to ":"reference to "),NullCP);
+ prev = 'r';
+ Debug((stderr, "\tprev = '%s'\n", visible(prev)));
+ }
+ ;
+
+ cdecl1 : cdecl1 '(' ')'
+ {
+ Debug((stderr, "cdecl1: cdecl1()\n"));
+ Debug((stderr, "\tcdecl1='%s'\n", $1));
+ $$ = cat($1,ds("function returning "),NullCP);
+ prev = 'f';
+ Debug((stderr, "\tprev = '%s'\n", visible(prev)));
+ }
+
+ | cdecl1 '(' castlist ')'
+ {
+ Debug((stderr, "cdecl1: cdecl1(castlist)\n"));
+ Debug((stderr, "\tcdecl1='%s'\n", $1));
+ Debug((stderr, "\tcastlist='%s'\n", $3));
+ $$ = cat($1, ds("function ("),
+ $3, ds(") returning "), NullCP);
+ prev = 'f';
+ Debug((stderr, "\tprev = '%s'\n", visible(prev)));
+ }
+
+ | cdecl1 cdims
+ {
+ Debug((stderr, "cdecl1: cdecl1 cdims\n"));
+ Debug((stderr, "\tcdecl1='%s'\n", $1));
+ Debug((stderr, "\tcdims='%s'\n", $2));
+ $$ = cat($1,ds("array "),$2,NullCP);
+ prev = 'a';
+ Debug((stderr, "\tprev = '%s'\n", visible(prev)));
+ }
+
+ | '(' cdecl ')'
+ {
+ Debug((stderr, "cdecl1: (cdecl)\n"));
+ Debug((stderr, "\tcdecl='%s'\n", $2));
+ $$ = $2;
+ /* prev = prev; */
+ Debug((stderr, "\tprev = '%s'\n", visible(prev)));
+ }
+
+ | NAME
+ {
+ Debug((stderr, "cdecl1: NAME\n"));
+ Debug((stderr, "\tNAME='%s'\n", $1));
+ savedname = $1;
+ $$ = ds("");
+ prev = 'n';
+ Debug((stderr, "\tprev = '%s'\n", visible(prev)));
+ }
+ ;
+
+ castlist : castlist COMMA castlist
+ {
+ Debug((stderr, "castlist: castlist1, castlist2\n"));
+ Debug((stderr, "\tcastlist1='%s'\n", $1));
+ Debug((stderr, "\tcastlist2='%s'\n", $3));
+ $$ = cat($1, ds(", "), $3, NullCP);
+ }
+
+ | opt_constvol_list type cast
+ {
+ Debug((stderr, "castlist: opt_constvol_list type cast\n"));
+ Debug((stderr, "\topt_constvol_list='%s'\n", $1));
+ Debug((stderr, "\ttype='%s'\n", $2));
+ Debug((stderr, "\tcast='%s'\n", $3));
+ $$ = cat($3, $1, ds(strlen($1) ? " " : ""), $2, NullCP);
+ }
+
+ | NAME
+ {
+ $$ = $1;
+ }
+ ;
+
+ adecllist : /* empty */
+ {
+ Debug((stderr, "adecllist: EMPTY\n"));
+ $$ = ds("");
+ }
+
+ | adecllist COMMA adecllist
+ {
+ Debug((stderr, "adecllist: adecllist1, adecllist2\n"));
+ Debug((stderr, "\tadecllist1='%s'\n", $1));
+ Debug((stderr, "\tadecllist2='%s'\n", $3));
+ $$ = cat($1, ds(", "), $3, NullCP);
+ }
+
+ | NAME
+ {
+ Debug((stderr, "adecllist: NAME\n"));
+ Debug((stderr, "\tNAME='%s'\n", $1));
+ $$ = $1;
+ }
+
+ | adecl
+ {
+ Debug((stderr, "adecllist: adecl\n"));
+ Debug((stderr, "\tadecl.left='%s'\n", $1.left));
+ Debug((stderr, "\tadecl.right='%s'\n", $1.right));
+ Debug((stderr, "\tadecl.type='%s'\n", $1.type));
+ $$ = cat($1.type, ds(" "), $1.left, $1.right, NullCP);
+ }
+
+ | NAME AS adecl
+ {
+ Debug((stderr, "adecllist: NAME AS adecl\n"));
+ Debug((stderr, "\tNAME='%s'\n", $1));
+ Debug((stderr, "\tadecl.left='%s'\n", $3.left));
+ Debug((stderr, "\tadecl.right='%s'\n", $3.right));
+ Debug((stderr, "\tadecl.type='%s'\n", $3.type));
+ $$ = cat($3.type, ds(" "), $3.left, $1, $3.right, NullCP);
+ }
+ ;
+
+ cast : /* empty */
+ {
+ Debug((stderr, "cast: EMPTY\n"));
+ $$ = ds("");
+ /* prev = prev; */
+ Debug((stderr, "\tprev = '%s'\n", visible(prev)));
+ }
+
+ | '(' ')'
+ {
+ Debug((stderr, "cast: ()\n"));
+ $$ = ds("function returning ");
+ prev = 'f';
+ Debug((stderr, "\tprev = '%s'\n", visible(prev)));
+ }
+
+ | '(' cast ')' '(' ')'
+ {
+ Debug((stderr, "cast: (cast)()\n"));
+ Debug((stderr, "\tcast='%s'\n", $2));
+ $$ = cat($2,ds("function returning "),NullCP);
+ prev = 'f';
+ Debug((stderr, "\tprev = '%s'\n", visible(prev)));
+ }
+
+ | '(' cast ')' '(' castlist ')'
+ {
+ Debug((stderr, "cast: (cast)(castlist)\n"));
+ Debug((stderr, "\tcast='%s'\n", $2));
+ Debug((stderr, "\tcastlist='%s'\n", $5));
+ $$ = cat($2,ds("function ("),$5,ds(") returning "),NullCP);
+ prev = 'f';
+ Debug((stderr, "\tprev = '%s'\n", visible(prev)));
+ }
+
+ | '(' cast ')'
+ {
+ Debug((stderr, "cast: (cast)\n"));
+ Debug((stderr, "\tcast='%s'\n", $2));
+ $$ = $2;
+ /* prev = prev; */
+ Debug((stderr, "\tprev = '%s'\n", visible(prev)));
+ }
+
+ | NAME DOUBLECOLON '*' cast
+ {
+ Debug((stderr, "cast: NAME::*cast\n"));
+ Debug((stderr, "\tcast='%s'\n", $4));
+ if (!CplusplusFlag)
+ unsupp("pointer to member of class", NullCP);
+ $$ = cat($4,ds("pointer to member of class "),$1,ds(" "),NullCP);
+ prev = 'p';
+ Debug((stderr, "\tprev = '%s'\n", visible(prev)));
+ }
+
+ | '*' cast
+ {
+ Debug((stderr, "cast: *cast\n"));
+ Debug((stderr, "\tcast='%s'\n", $2));
+ $$ = cat($2,ds("pointer to "),NullCP);
+ prev = 'p';
+ Debug((stderr, "\tprev = '%s'\n", visible(prev)));
+ }
+
+ | '&' cast
+ {
+ Debug((stderr, "cast: &cast\n"));
+ Debug((stderr, "\tcast='%s'\n", $2));
+ if (!CplusplusFlag)
+ unsupp("reference", NullCP);
+ $$ = cat($2,ds("reference to "),NullCP);
+ prev = 'r';
+ Debug((stderr, "\tprev = '%s'\n", visible(prev)));
+ }
+
+ | cast cdims
+ {
+ Debug((stderr, "cast: cast cdims\n"));
+ Debug((stderr, "\tcast='%s'\n", $1));
+ Debug((stderr, "\tcdims='%s'\n", $2));
+ $$ = cat($1,ds("array "),$2,NullCP);
+ prev = 'a';
+ Debug((stderr, "\tprev = '%s'\n", visible(prev)));
+ }
+ ;
+
+ cdims : '[' ']'
+ {
+ Debug((stderr, "cdims: []\n"));
+ $$ = ds("of ");
+ }
+
+ | '[' NUMBER ']'
+ {
+ Debug((stderr, "cdims: [NUMBER]\n"));
+ Debug((stderr, "\tNUMBER='%s'\n", $2));
+ $$ = cat($2,ds(" of "),NullCP);
+ }
+ ;
+
+ adecl : FUNCTION RETURNING adecl
+ {
+ Debug((stderr, "adecl: FUNCTION RETURNING adecl\n"));
+ Debug((stderr, "\tadecl.left='%s'\n", $3.left));
+ Debug((stderr, "\tadecl.right='%s'\n", $3.right));
+ Debug((stderr, "\tadecl.type='%s'\n", $3.type));
+ if (prev == 'f')
+ unsupp("Function returning function",
+ "function returning pointer to function");
+ else if (prev=='A' || prev=='a')
+ unsupp("Function returning array",
+ "function returning pointer");
+ $$.left = $3.left;
+ $$.right = cat(ds("()"),$3.right,NullCP);
+ $$.type = $3.type;
+ prev = 'f';
+ Debug((stderr, "\n\tadecl now =\n"));
+ Debug((stderr, "\t\tadecl.left='%s'\n", $$.left));
+ Debug((stderr, "\t\tadecl.right='%s'\n", $$.right));
+ Debug((stderr, "\t\tadecl.type='%s'\n", $$.type));
+ Debug((stderr, "\tprev = '%s'\n", visible(prev)));
+ }
+
+ | FUNCTION '(' adecllist ')' RETURNING adecl
+ {
+ Debug((stderr, "adecl: FUNCTION (adecllist) RETURNING adecl\n"));
+ Debug((stderr, "\tadecllist='%s'\n", $3));
+ Debug((stderr, "\tadecl.left='%s'\n", $6.left));
+ Debug((stderr, "\tadecl.right='%s'\n", $6.right));
+ Debug((stderr, "\tadecl.type='%s'\n", $6.type));
+ if (prev == 'f')
+ unsupp("Function returning function",
+ "function returning pointer to function");
+ else if (prev=='A' || prev=='a')
+ unsupp("Function returning array",
+ "function returning pointer");
+ $$.left = $6.left;
+ $$.right = cat(ds("("),$3,ds(")"),$6.right,NullCP);
+ $$.type = $6.type;
+ prev = 'f';
+ Debug((stderr, "\n\tadecl now =\n"));
+ Debug((stderr, "\t\tadecl.left='%s'\n", $$.left));
+ Debug((stderr, "\t\tadecl.right='%s'\n", $$.right));
+ Debug((stderr, "\t\tadecl.type='%s'\n", $$.type));
+ Debug((stderr, "\tprev = '%s'\n", visible(prev)));
+ }
+
+ | ARRAY adims OF adecl
+ {
+ Debug((stderr, "adecl: ARRAY adims OF adecl\n"));
+ Debug((stderr, "\tadims='%s'\n", $2));
+ Debug((stderr, "\tadecl.left='%s'\n", $4.left));
+ Debug((stderr, "\tadecl.right='%s'\n", $4.right));
+ Debug((stderr, "\tadecl.type='%s'\n", $4.type));
+ if (prev == 'f')
+ unsupp("Array of function",
+ "array of pointer to function");
+ else if (prev == 'a')
+ unsupp("Inner array of unspecified size",
+ "array of pointer");
+ else if (prev == 'v')
+ unsupp("Array of void",
+ "pointer to void");
+ if (arbdims)
+ prev = 'a';
+ else
+ prev = 'A';
+ $$.left = $4.left;
+ $$.right = cat($2,$4.right,NullCP);
+ $$.type = $4.type;
+ Debug((stderr, "\n\tadecl now =\n"));
+ Debug((stderr, "\t\tadecl.left='%s'\n", $$.left));
+ Debug((stderr, "\t\tadecl.right='%s'\n", $$.right));
+ Debug((stderr, "\t\tadecl.type='%s'\n", $$.type));
+ Debug((stderr, "\tprev = '%s'\n", visible(prev)));
+ }
+
+ | opt_constvol_list POINTER TO adecl
+ {
+ char *op = "", *cp = "", *sp = "";
+
+ Debug((stderr, "adecl: opt_constvol_list POINTER TO adecl\n"));
+ Debug((stderr, "\topt_constvol_list='%s'\n", $1));
+ Debug((stderr, "\tadecl.left='%s'\n", $4.left));
+ Debug((stderr, "\tadecl.right='%s'\n", $4.right));
+ Debug((stderr, "\tadecl.type='%s'\n", $4.type));
+ if (prev == 'a')
+ unsupp("Pointer to array of unspecified dimension",
+ "pointer to object");
+ if (prev=='a' || prev=='A' || prev=='f') {
+ op = "(";
+ cp = ")";
+ }
+ if (strlen($1) != 0)
+ sp = " ";
+ $$.left = cat($4.left,ds(op),ds("*"),
+ ds(sp),$1,ds(sp),NullCP);
+ $$.right = cat(ds(cp),$4.right,NullCP);
+ $$.type = $4.type;
+ prev = 'p';
+ Debug((stderr, "\n\tadecl now =\n"));
+ Debug((stderr, "\t\tadecl.left='%s'\n", $$.left));
+ Debug((stderr, "\t\tadecl.right='%s'\n", $$.right));
+ Debug((stderr, "\t\tadecl.type='%s'\n", $$.type));
+ Debug((stderr, "\tprev = '%s'\n", visible(prev)));
+ }
+
+ | opt_constvol_list POINTER TO MEMBER OF ClassStruct NAME adecl
+ {
+ char *op = "", *cp = "", *sp = "";
+
+ Debug((stderr, "adecl: opt_constvol_list POINTER TO MEMBER OF ClassStruct NAME adecl\n"));
+ Debug((stderr, "\topt_constvol_list='%s'\n", $1));
+ Debug((stderr, "\tClassStruct='%s'\n", $6));
+ Debug((stderr, "\tNAME='%s'\n", $7));
+ Debug((stderr, "\tadecl.left='%s'\n", $8.left));
+ Debug((stderr, "\tadecl.right='%s'\n", $8.right));
+ Debug((stderr, "\tadecl.type='%s'\n", $8.type));
+ if (!CplusplusFlag)
+ unsupp("pointer to member of class", NullCP);
+ if (prev == 'a')
+ unsupp("Pointer to array of unspecified dimension",
+ "pointer to object");
+ if (prev=='a' || prev=='A' || prev=='f') {
+ op = "(";
+ cp = ")";
+ }
+ if (strlen($1) != 0)
+ sp = " ";
+ $$.left = cat($8.left,ds(op),$7,ds("::*"),
+ ds(sp),$1,ds(sp),NullCP);
+ $$.right = cat(ds(cp),$8.right,NullCP);
+ $$.type = $8.type;
+ prev = 'p';
+ Debug((stderr, "\n\tadecl now =\n"));
+ Debug((stderr, "\t\tadecl.left='%s'\n", $$.left));
+ Debug((stderr, "\t\tadecl.right='%s'\n", $$.right));
+ Debug((stderr, "\t\tadecl.type='%s'\n", $$.type));
+ Debug((stderr, "\tprev = '%s'\n", visible(prev)));
+ }
+
+ | opt_constvol_list REFERENCE TO adecl
+ {
+ char *op = "", *cp = "", *sp = "";
+
+ Debug((stderr, "adecl: opt_constvol_list REFERENCE TO adecl\n"));
+ Debug((stderr, "\topt_constvol_list='%s'\n", $1));
+ Debug((stderr, "\tadecl.left='%s'\n", $4.left));
+ Debug((stderr, "\tadecl.right='%s'\n", $4.right));
+ Debug((stderr, "\tadecl.type='%s'\n", $4.type));
+ if (!CplusplusFlag)
+ unsupp("reference", NullCP);
+ if (prev == 'v')
+ unsupp("Reference to void",
+ "pointer to void");
+ else if (prev == 'a')
+ unsupp("Reference to array of unspecified dimension",
+ "reference to object");
+ if (prev=='a' || prev=='A' || prev=='f') {
+ op = "(";
+ cp = ")";
+ }
+ if (strlen($1) != 0)
+ sp = " ";
+ $$.left = cat($4.left,ds(op),ds("&"),
+ ds(sp),$1,ds(sp),NullCP);
+ $$.right = cat(ds(cp),$4.right,NullCP);
+ $$.type = $4.type;
+ prev = 'r';
+ Debug((stderr, "\n\tadecl now =\n"));
+ Debug((stderr, "\t\tadecl.left='%s'\n", $$.left));
+ Debug((stderr, "\t\tadecl.right='%s'\n", $$.right));
+ Debug((stderr, "\t\tadecl.type='%s'\n", $$.type));
+ Debug((stderr, "\tprev = '%s'\n", visible(prev)));
+ }
+
+ | opt_constvol_list type
+ {
+ Debug((stderr, "adecl: opt_constvol_list type\n"));
+ Debug((stderr, "\topt_constvol_list='%s'\n", $1));
+ Debug((stderr, "\ttype='%s'\n", $2));
+ $$.left = ds("");
+ $$.right = ds("");
+ $$.type = cat($1,ds(strlen($1)?" ":""),$2,NullCP);
+ if (strcmp($2, "void") == 0)
+ prev = 'v';
+ else if ((strncmp($2, "struct", 6) == 0) ||
+ (strncmp($2, "class", 5) == 0))
+ prev = 's';
+ else
+ prev = 't';
+ Debug((stderr, "\n\tadecl now =\n"));
+ Debug((stderr, "\t\tadecl.left='%s'\n", $$.left));
+ Debug((stderr, "\t\tadecl.right='%s'\n", $$.right));
+ Debug((stderr, "\t\tadecl.type='%s'\n", $$.type));
+ Debug((stderr, "\tprev = '%s'\n", visible(prev)));
+ }
+ ;
+
+ adims : /* empty */
+ {
+ Debug((stderr, "adims: EMPTY\n"));
+ arbdims = 1;
+ $$ = ds("[]");
+ }
+
+ | NUMBER
+ {
+ Debug((stderr, "adims: NUMBER\n"));
+ Debug((stderr, "\tNUMBER='%s'\n", $1));
+ arbdims = 0;
+ $$ = cat(ds("["),$1,ds("]"),NullCP);
+ }
+ ;
+
+ type : tinit c_type
+ {
+ Debug((stderr, "type: tinit c_type\n"));
+ Debug((stderr, "\ttinit=''\n"));
+ Debug((stderr, "\tc_type='%s'\n", $2));
+ mbcheck();
+ $$ = $2;
+ }
+ ;
+
+ tinit : /* empty */
+ {
+ Debug((stderr, "tinit: EMPTY\n"));
+ modbits = 0;
+ }
+ ;
+
+ c_type : mod_list
+ {
+ Debug((stderr, "c_type: mod_list\n"));
+ Debug((stderr, "\tmod_list='%s'\n", $1));
+ $$ = $1;
+ }
+
+ | tname
+ {
+ Debug((stderr, "c_type: tname\n"));
+ Debug((stderr, "\ttname='%s'\n", $1));
+ $$ = $1;
+ }
+
+ | mod_list tname
+ {
+ Debug((stderr, "c_type: mod_list tname\n"));
+ Debug((stderr, "\tmod_list='%s'\n", $1));
+ Debug((stderr, "\ttname='%s'\n", $2));
+ $$ = cat($1,ds(" "),$2,NullCP);
+ }
+
+ | StrClaUniEnum NAME
+ {
+ Debug((stderr, "c_type: StrClaUniEnum NAME\n"));
+ Debug((stderr, "\tStrClaUniEnum='%s'\n", $1));
+ Debug((stderr, "\tNAME='%s'\n", $2));
+ $$ = cat($1,ds(" "),$2,NullCP);
+ }
+ ;
+
+ StrClaUniEnum : ClassStruct
+ | ENUM
+ | UNION
+ {
+ $$ = $1;
+ }
+ ;
+
+ ClassStruct : STRUCT
+ | CLASS
+ {
+ $$ = $1;
+ }
+ ;
+
+ tname : INT
+ {
+ Debug((stderr, "tname: INT\n"));
+ Debug((stderr, "\tINT='%s'\n", $1));
+ modbits |= MB_INT; $$ = $1;
+ }
+
+ | CHAR
+ {
+ Debug((stderr, "tname: CHAR\n"));
+ Debug((stderr, "\tCHAR='%s'\n", $1));
+ modbits |= MB_CHAR; $$ = $1;
+ }
+
+ | FLOAT
+ {
+ Debug((stderr, "tname: FLOAT\n"));
+ Debug((stderr, "\tFLOAT='%s'\n", $1));
+ modbits |= MB_FLOAT; $$ = $1;
+ }
+
+ | DOUBLE
+ {
+ Debug((stderr, "tname: DOUBLE\n"));
+ Debug((stderr, "\tDOUBLE='%s'\n", $1));
+ modbits |= MB_DOUBLE; $$ = $1;
+ }
+
+ | VOID
+ {
+ Debug((stderr, "tname: VOID\n"));
+ Debug((stderr, "\tVOID='%s'\n", $1));
+ modbits |= MB_VOID; $$ = $1;
+ }
+ ;
+
+ mod_list : modifier mod_list1
+ {
+ Debug((stderr, "mod_list: modifier mod_list1\n"));
+ Debug((stderr, "\tmodifier='%s'\n", $1));
+ Debug((stderr, "\tmod_list1='%s'\n", $2));
+ $$ = cat($1,ds(" "),$2,NullCP);
+ }
+
+ | modifier
+ {
+ Debug((stderr, "mod_list: modifier\n"));
+ Debug((stderr, "\tmodifier='%s'\n", $1));
+ $$ = $1;
+ }
+ ;
+
+ mod_list1 : mod_list
+ {
+ Debug((stderr, "mod_list1: mod_list\n"));
+ Debug((stderr, "\tmod_list='%s'\n", $1));
+ $$ = $1;
+ }
+
+ | CONSTVOLATILE
+ {
+ Debug((stderr, "mod_list1: CONSTVOLATILE\n"));
+ Debug((stderr, "\tCONSTVOLATILE='%s'\n", $1));
+ if (PreANSIFlag)
+ notsupported(" (Pre-ANSI Compiler)", $1, NullCP);
+ else if (RitchieFlag)
+ notsupported(" (Ritchie Compiler)", $1, NullCP);
+ else if ((strcmp($1, "noalias") == 0) && CplusplusFlag)
+ unsupp($1, NullCP);
+ $$ = $1;
+ }
+ ;
+
+ modifier : UNSIGNED
+ {
+ Debug((stderr, "modifier: UNSIGNED\n"));
+ Debug((stderr, "\tUNSIGNED='%s'\n", $1));
+ modbits |= MB_UNSIGNED; $$ = $1;
+ }
+
+ | SIGNED
+ {
+ Debug((stderr, "modifier: SIGNED\n"));
+ Debug((stderr, "\tSIGNED='%s'\n", $1));
+ modbits |= MB_SIGNED; $$ = $1;
+ }
+
+ | LONG
+ {
+ Debug((stderr, "modifier: LONG\n"));
+ Debug((stderr, "\tLONG='%s'\n", $1));
+ modbits |= MB_LONG; $$ = $1;
+ }
+
+ | SHORT
+ {
+ Debug((stderr, "modifier: SHORT\n"));
+ Debug((stderr, "\tSHORT='%s'\n", $1));
+ modbits |= MB_SHORT; $$ = $1;
+ }
+ ;
+
+ opt_constvol_list: CONSTVOLATILE opt_constvol_list
+ {
+ Debug((stderr, "opt_constvol_list: CONSTVOLATILE opt_constvol_list\n"));
+ Debug((stderr, "\tCONSTVOLATILE='%s'\n", $1));
+ Debug((stderr, "\topt_constvol_list='%s'\n", $2));
+ if (PreANSIFlag)
+ notsupported(" (Pre-ANSI Compiler)", $1, NullCP);
+ else if (RitchieFlag)
+ notsupported(" (Ritchie Compiler)", $1, NullCP);
+ else if ((strcmp($1, "noalias") == 0) && CplusplusFlag)
+ unsupp($1, NullCP);
+ $$ = cat($1,ds(strlen($2) ? " " : ""),$2,NullCP);
+ }
+
+ | /* empty */
+ {
+ Debug((stderr, "opt_constvol_list: EMPTY\n"));
+ $$ = ds("");
+ }
+ ;
+
+ constvol_list: CONSTVOLATILE opt_constvol_list
+ {
+ Debug((stderr, "constvol_list: CONSTVOLATILE opt_constvol_list\n"));
+ Debug((stderr, "\tCONSTVOLATILE='%s'\n", $1));
+ Debug((stderr, "\topt_constvol_list='%s'\n", $2));
+ if (PreANSIFlag)
+ notsupported(" (Pre-ANSI Compiler)", $1, NullCP);
+ else if (RitchieFlag)
+ notsupported(" (Ritchie Compiler)", $1, NullCP);
+ else if ((strcmp($1, "noalias") == 0) && CplusplusFlag)
+ unsupp($1, NullCP);
+ $$ = cat($1,ds(strlen($2) ? " " : ""),$2,NullCP);
+ }
+ ;
+
+ storage : AUTO
+ | EXTERN
+ | REGISTER
+ | STATIC
+ {
+ Debug((stderr, "storage: AUTO,EXTERN,STATIC,REGISTER (%s)\n", $1));
+ $$ = $1;
+ }
+ ;
+
+ opt_storage : storage
+ {
+ Debug((stderr, "opt_storage: storage=%s\n", $1));
+ $$ = $1;
+ }
+
+ | /* empty */
+ {
+ Debug((stderr, "opt_storage: EMPTY\n"));
+ $$ = ds("");
+ }
+ ;
+ %%
Index: llvm-test/MultiSource/Benchmarks/Prolangs-C/cdecl/cdlex.c.source
diff -c /dev/null llvm-test/MultiSource/Benchmarks/Prolangs-C/cdecl/cdlex.c.source:1.1
*** /dev/null Tue Oct 5 14:08:40 2004
--- llvm-test/MultiSource/Benchmarks/Prolangs-C/cdecl/cdlex.c.source Tue Oct 5 14:08:26 2004
***************
*** 0 ****
--- 1,1702 ----
+ #include <stdio.h>
+ # define U(x) x
+ # define NLSTATE yyprevious=YYNEWLINE
+ # define BEGIN yybgin = yysvec + 1 +
+ # define INITIAL 0
+ # define YYLERR yysvec
+ # define YYSTATE (yyestate-yysvec-1)
+ # define YYOPTIM 1
+ # define YYLMAX BUFSIZ
+ #ifndef __cplusplus
+ # define output(c) (void)putc(c,yyout)
+ #else
+ # define lex_output(c) (void)putc(c,yyout)
+ #endif
+
+ #if defined(__cplusplus) || defined(__STDC__)
+
+ #if defined(__cplusplus) && defined(__EXTERN_C__)
+ extern "C" {
+ #endif
+ int yyback(int *, int);
+ int yyinput(void);
+ int yylook(void);
+ void yyoutput(int);
+ int yyracc(int);
+ int yyreject(void);
+ void yyunput(int);
+ int yylex(void);
+ #ifdef YYLEX_E
+ void yywoutput(wchar_t);
+ wchar_t yywinput(void);
+ #endif
+ #ifndef yyless
+ int yyless(int);
+ #endif
+ #ifndef yywrap
+ int yywrap_nasko(void);
+ #endif
+ #ifdef LEXDEBUG
+ void allprint(char);
+ void sprint(char *);
+ #endif
+ #if defined(__cplusplus) && defined(__EXTERN_C__)
+ }
+ #endif
+
+ #ifdef __cplusplus
+ extern "C" {
+ #endif
+ void exit(int);
+ #ifdef __cplusplus
+ }
+ #endif
+
+ #endif
+ # define unput(c) {yytchar= (c);if(yytchar=='\n')yylineno--;*yysptr++=yytchar;}
+ # define yymore() (yymorfg=1)
+ #ifndef __cplusplus
+ # define input() (((yytchar=yysptr>yysbuf?U(*--yysptr):getc(yyin))==10?(yylineno++,yytchar):yytchar)==EOF?0:yytchar)
+ #else
+ # define lex_input() (((yytchar=yysptr>yysbuf?U(*--yysptr):getc(yyin))==10?(yylineno++,yytchar):yytchar)==EOF?0:yytchar)
+ #endif
+ #define ECHO fprintf(yyout, "%s",yytext)
+ # define REJECT { nstr = yyreject(); goto yyfussy;}
+ int yyleng;
+ char yytext[YYLMAX];
+ int yymorfg;
+ extern char *yysptr, yysbuf[];
+ int yytchar;
+ FILE *yyin = 0, *yyout = 0;
+ extern int yylineno;
+ struct yysvf {
+ struct yywork *yystoff;
+ struct yysvf *yyother;
+ int *yystops;};
+ struct yysvf *yyestate;
+ extern struct yysvf yysvec[], *yybgin;
+
+ # line 3 "cdlex.l"
+ /* Lexical analyzer description for ANSI and C++ cdecl. */
+
+ # line 4 "cdlex.l"
+ /* The output of this file is included */
+
+ # line 5 "cdlex.l"
+ /* into the C file cdecl.c. */
+ char cdlexsccsid[] = "@(#)cdlex.l 2.2 3/30/88";
+ # define YYNEWLINE 10
+ yylex(){
+ if (yyin == 0) { yyin = stdin; yyin = stdout; }
+ int nstr; extern int yyprevious;
+ #ifdef __cplusplus
+ /* to avoid CC and lint complaining yyfussy not being used ...*/
+ static int __lex_hack = 0;
+ if (__lex_hack) goto yyfussy;
+ #endif
+ while((nstr = yylook()) >= 0)
+ yyfussy: switch(nstr){
+ case 0:
+ if(yywrap_nasko()) return(0); break;
+ case 1:
+
+ # line 13 "cdlex.l"
+ return ARRAY;
+ break;
+ case 2:
+
+ # line 14 "cdlex.l"
+ return AS;
+ break;
+ case 3:
+
+ # line 15 "cdlex.l"
+ return CAST;
+ break;
+ case 4:
+
+ # line 16 "cdlex.l"
+ return DECLARE;
+ break;
+ case 5:
+
+ # line 17 "cdlex.l"
+ return 0;
+ break;
+ case 6:
+
+ # line 18 "cdlex.l"
+ return EXPLAIN;
+ break;
+ case 7:
+
+ # line 19 "cdlex.l"
+ return FUNCTION;
+ break;
+ case 8:
+
+ # line 20 "cdlex.l"
+ return FUNCTION;
+ break;
+ case 9:
+
+ # line 21 "cdlex.l"
+ return HELP;
+ break;
+ case 10:
+
+ # line 22 "cdlex.l"
+ return INTO;
+ break;
+ case 11:
+
+ # line 23 "cdlex.l"
+ return MEMBER;
+ break;
+ case 12:
+
+ # line 24 "cdlex.l"
+ return OF;
+ break;
+ case 13:
+
+ # line 25 "cdlex.l"
+ return POINTER;
+ break;
+ case 14:
+
+ # line 26 "cdlex.l"
+ return POINTER;
+ break;
+ case 15:
+
+ # line 27 "cdlex.l"
+ return 0;
+ break;
+ case 16:
+
+ # line 28 "cdlex.l"
+ return REFERENCE;
+ break;
+ case 17:
+
+ # line 29 "cdlex.l"
+ return REFERENCE;
+ break;
+ case 18:
+
+ # line 30 "cdlex.l"
+ return RETURNING;
+ break;
+ case 19:
+
+ # line 31 "cdlex.l"
+ return RETURNING;
+ break;
+ case 20:
+
+ # line 32 "cdlex.l"
+ return SET;
+ break;
+ case 21:
+
+ # line 33 "cdlex.l"
+ return TO;
+ break;
+ case 22:
+
+ # line 34 "cdlex.l"
+ return ARRAY;
+ break;
+ case 23:
+
+ # line 35 "cdlex.l"
+ return DOUBLECOLON;
+ break;
+ case 24:
+
+ # line 36 "cdlex.l"
+ return HELP;
+ break;
+ case 25:
+
+ # line 37 "cdlex.l"
+ return COMMA;
+ break;
+ case 26:
+
+ # line 39 "cdlex.l"
+ { yylval.dynstr = ds(yytext); return AUTO; }
+ break;
+ case 27:
+
+ # line 40 "cdlex.l"
+ { yylval.dynstr = ds("char"); return CHAR; }
+ break;
+ case 28:
+
+ # line 41 "cdlex.l"
+ { yylval.dynstr = ds(yytext); return CHAR; }
+ break;
+ case 29:
+
+ # line 42 "cdlex.l"
+ { yylval.dynstr = ds(yytext); return CLASS; }
+ break;
+ case 30:
+
+ # line 43 "cdlex.l"
+ { yylval.dynstr = ds("const"); return CONSTVOLATILE; }
+ break;
+ case 31:
+
+ # line 44 "cdlex.l"
+ { yylval.dynstr = ds(yytext); return CONSTVOLATILE; }
+ break;
+ case 32:
+
+ # line 45 "cdlex.l"
+ { yylval.dynstr = ds(yytext); return DOUBLE; }
+ break;
+ case 33:
+
+ # line 46 "cdlex.l"
+ { yylval.dynstr = ds("enum"); return ENUM; }
+ break;
+ case 34:
+
+ # line 47 "cdlex.l"
+ { yylval.dynstr = ds(yytext); return ENUM; }
+ break;
+ case 35:
+
+ # line 48 "cdlex.l"
+ { yylval.dynstr = ds(yytext); return EXTERN; }
+ break;
+ case 36:
+
+ # line 49 "cdlex.l"
+ { yylval.dynstr = ds(yytext); return FLOAT; }
+ break;
+ case 37:
+
+ # line 50 "cdlex.l"
+ { yylval.dynstr = ds("int"); return INT; }
+ break;
+ case 38:
+
+ # line 51 "cdlex.l"
+ { yylval.dynstr = ds(yytext); return INT; }
+ break;
+ case 39:
+
+ # line 52 "cdlex.l"
+ { yylval.dynstr = ds(yytext); return LONG; }
+ break;
+ case 40:
+
+ # line 53 "cdlex.l"
+ { yylval.dynstr = ds(yytext); return CONSTVOLATILE; }
+ break;
+ case 41:
+
+ # line 54 "cdlex.l"
+ { yylval.dynstr = ds(yytext); return REGISTER; }
+ break;
+ case 42:
+
+ # line 55 "cdlex.l"
+ { yylval.dynstr = ds(yytext); return SHORT; }
+ break;
+ case 43:
+
+ # line 56 "cdlex.l"
+ { yylval.dynstr = ds(yytext); return SIGNED; }
+ break;
+ case 44:
+
+ # line 57 "cdlex.l"
+ { yylval.dynstr = ds(yytext); return STATIC; }
+ break;
+ case 45:
+
+ # line 58 "cdlex.l"
+ { yylval.dynstr = ds("struct"); return STRUCT; }
+ break;
+ case 46:
+
+ # line 59 "cdlex.l"
+ { yylval.dynstr = ds(yytext); return STRUCT; }
+ break;
+ case 47:
+
+ # line 60 "cdlex.l"
+ { yylval.dynstr = ds(yytext); return UNION; }
+ break;
+ case 48:
+
+ # line 61 "cdlex.l"
+ { yylval.dynstr = ds(yytext); return UNSIGNED; }
+ break;
+ case 49:
+
+ # line 62 "cdlex.l"
+ { yylval.dynstr = ds(yytext); return VOID; }
+ break;
+ case 50:
+
+ # line 63 "cdlex.l"
+ { yylval.dynstr = ds(yytext); return CONSTVOLATILE; }
+ break;
+ case 51:
+
+ # line 65 "cdlex.l"
+ { yylval.dynstr = ds(yytext); return NAME; }
+ break;
+ case 52:
+
+ # line 66 "cdlex.l"
+ { yylval.dynstr = ds(yytext); return NUMBER; }
+ break;
+ case 53:
+
+ # line 68 "cdlex.l"
+ ;
+ break;
+ case 54:
+
+ # line 69 "cdlex.l"
+ ;
+ break;
+ case 55:
+
+ # line 70 "cdlex.l"
+ return *yytext;
+ break;
+ case 56:
+
+ # line 71 "cdlex.l"
+ {
+ (void) printf("bad character '%s'\n",visible(*yytext));
+ return *yytext;
+ }
+ break;
+ case -1:
+ break;
+ default:
+ (void)fprintf(yyout,"bad switch yylook %d",nstr);
+ } return(0); }
+ /* end of yylex */
+ int yyvstop[] = {
+ 0,
+
+ 56,
+ 0,
+
+ 54,
+ 56,
+ 0,
+
+ 55,
+ 0,
+
+ 53,
+ 56,
+ 0,
+
+ 55,
+ 56,
+ 0,
+
+ 25,
+ 56,
+ 0,
+
+ 52,
+ 56,
+ 0,
+
+ 56,
+ 0,
+
+ 24,
+ 56,
+ 0,
+
+ 51,
+ 56,
+ 0,
+
+ 51,
+ 56,
+ 0,
+
+ 51,
+ 56,
+ 0,
+
+ 51,
+ 56,
+ 0,
+
+ 51,
+ 56,
+ 0,
+
+ 51,
+ 56,
+ 0,
+
+ 51,
+ 56,
+ 0,
+
+ 51,
+ 56,
+ 0,
+
+ 51,
+ 56,
+ 0,
+
+ 51,
+ 56,
+ 0,
+
+ 51,
+ 56,
+ 0,
+
+ 51,
+ 56,
+ 0,
+
+ 51,
+ 56,
+ 0,
+
+ 51,
+ 56,
+ 0,
+
+ 51,
+ 56,
+ 0,
+
+ 51,
+ 56,
+ 0,
+
+ 51,
+ 56,
+ 0,
+
+ 51,
+ 56,
+ 0,
+
+ 51,
+ 56,
+ 0,
+
+ 53,
+ 0,
+
+ 52,
+ 0,
+
+ 23,
+ 0,
+
+ 51,
+ 0,
+
+ 51,
+ 0,
+
+ 2,
+ 51,
+ 0,
+
+ 51,
+ 0,
+
+ 51,
+ 0,
+
+ 51,
+ 0,
+
+ 51,
+ 0,
+
+ 51,
+ 0,
+
+ 51,
+ 0,
+
+ 51,
+ 0,
+
+ 51,
+ 0,
+
+ 51,
+ 0,
+
+ 51,
+ 0,
+
+ 51,
+ 0,
+
+ 51,
+ 0,
+
+ 51,
+ 0,
+
+ 51,
+ 0,
+
+ 51,
+ 0,
+
+ 51,
+ 0,
+
+ 12,
+ 51,
+ 0,
+
+ 51,
+ 0,
+
+ 51,
+ 0,
+
+ 51,
+ 0,
+
+ 51,
+ 0,
+
+ 51,
+ 0,
+
+ 51,
+ 0,
+
+ 51,
+ 0,
+
+ 51,
+ 0,
+
+ 21,
+ 51,
+ 0,
+
+ 51,
+ 0,
+
+ 51,
+ 0,
+
+ 51,
+ 0,
+
+ 51,
+ 0,
+
+ 51,
+ 0,
+
+ 51,
+ 0,
+
+ 51,
+ 0,
+
+ 51,
+ 0,
+
+ 51,
+ 0,
+
+ 51,
+ 0,
+
+ 51,
+ 0,
+
+ 51,
+ 0,
+
+ 51,
+ 0,
+
+ 51,
+ 0,
+
+ 51,
+ 0,
+
+ 51,
+ 0,
+
+ 51,
+ 0,
+
+ 51,
+ 0,
+
+ 38,
+ 51,
+ 0,
+
+ 51,
+ 0,
+
+ 51,
+ 0,
+
+ 51,
+ 0,
+
+ 51,
+ 0,
+
+ 14,
+ 51,
+ 0,
+
+ 51,
+ 0,
+
+ 17,
+ 51,
+ 0,
+
+ 51,
+ 0,
+
+ 19,
+ 51,
+ 0,
+
+ 20,
+ 51,
+ 0,
+
+ 51,
+ 0,
+
+ 51,
+ 0,
+
+ 51,
+ 0,
+
+ 51,
+ 0,
+
+ 51,
+ 0,
+
+ 51,
+ 0,
+
+ 51,
+ 0,
+
+ 51,
+ 0,
+
+ 51,
+ 0,
+
+ 51,
+ 0,
+
+ 26,
+ 51,
+ 0,
+
+ 3,
+ 51,
+ 0,
+
+ 28,
+ 51,
+ 0,
+
+ 51,
+ 0,
+
+ 51,
+ 0,
+
+ 51,
+ 0,
+
+ 51,
+ 0,
+
+ 34,
+ 51,
+ 0,
+
+ 5,
+ 51,
+ 0,
+
+ 51,
+ 0,
+
+ 51,
+ 0,
+
+ 51,
+ 0,
+
+ 8,
+ 51,
+ 0,
+
+ 9,
+ 51,
+ 0,
+
+ 51,
+ 0,
+
+ 10,
+ 51,
+ 0,
+
+ 39,
+ 51,
+ 0,
+
+ 51,
+ 0,
+
+ 51,
+ 0,
+
+ 51,
+ 0,
+
+ 15,
+ 51,
+ 0,
+
+ 51,
+ 0,
+
+ 51,
+ 0,
+
+ 51,
+ 0,
+
+ 51,
+ 0,
+
+ 51,
+ 0,
+
+ 51,
+ 0,
+
+ 51,
+ 0,
+
+ 51,
+ 0,
+
+ 51,
+ 0,
+
+ 51,
+ 0,
+
+ 49,
+ 51,
+ 0,
+
+ 51,
+ 0,
+
+ 1,
+ 51,
+ 0,
+
+ 51,
+ 0,
+
+ 29,
+ 51,
+ 0,
+
+ 31,
+ 51,
+ 0,
+
+ 51,
+ 0,
+
+ 51,
+ 0,
+
+ 51,
+ 0,
+
+ 51,
+ 0,
+
+ 51,
+ 0,
+
+ 36,
+ 51,
+ 0,
+
+ 51,
+ 0,
+
+ 51,
+ 0,
+
+ 51,
+ 0,
+
+ 51,
+ 0,
+
+ 51,
+ 0,
+
+ 51,
+ 0,
+
+ 51,
+ 0,
+
+ 51,
+ 0,
+
+ 42,
+ 51,
+ 0,
+
+ 51,
+ 0,
+
+ 51,
+ 0,
+
+ 51,
+ 0,
+
+ 47,
+ 51,
+ 0,
+
+ 51,
+ 0,
+
+ 51,
+ 0,
+
+ 51,
+ 0,
+
+ 51,
+ 0,
+
+ 51,
+ 0,
+
+ 51,
+ 0,
+
+ 32,
+ 51,
+ 0,
+
+ 51,
+ 0,
+
+ 51,
+ 0,
+
+ 35,
+ 51,
+ 0,
+
+ 51,
+ 0,
+
+ 51,
+ 0,
+
+ 11,
+ 51,
+ 0,
+
+ 51,
+ 0,
+
+ 51,
+ 0,
+
+ 51,
+ 0,
+
+ 51,
+ 0,
+
+ 51,
+ 0,
+
+ 43,
+ 51,
+ 0,
+
+ 44,
+ 51,
+ 0,
+
+ 46,
+ 51,
+ 0,
+
+ 51,
+ 0,
+
+ 22,
+ 51,
+ 0,
+
+ 51,
+ 0,
+
+ 51,
+ 0,
+
+ 51,
+ 0,
+
+ 4,
+ 51,
+ 0,
+
+ 51,
+ 0,
+
+ 6,
+ 51,
+ 0,
+
+ 51,
+ 0,
+
+ 37,
+ 51,
+ 0,
+
+ 40,
+ 51,
+ 0,
+
+ 13,
+ 51,
+ 0,
+
+ 51,
+ 0,
+
+ 51,
+ 0,
+
+ 51,
+ 0,
+
+ 51,
+ 0,
+
+ 51,
+ 0,
+
+ 51,
+ 0,
+
+ 51,
+ 0,
+
+ 30,
+ 51,
+ 0,
+
+ 51,
+ 0,
+
+ 7,
+ 51,
+ 0,
+
+ 51,
+ 0,
+
+ 41,
+ 51,
+ 0,
+
+ 51,
+ 0,
+
+ 51,
+ 0,
+
+ 48,
+ 51,
+ 0,
+
+ 50,
+ 51,
+ 0,
+
+ 27,
+ 51,
+ 0,
+
+ 51,
+ 0,
+
+ 16,
+ 51,
+ 0,
+
+ 18,
+ 51,
+ 0,
+
+ 45,
+ 51,
+ 0,
+
+ 51,
+ 0,
+
+ 33,
+ 51,
+ 0,
+ 0};
+ # define YYTYPE unsigned char
+ struct yywork { YYTYPE verify, advance; } yycrank[] = {
+ 0,0, 0,0, 1,3, 0,0,
+ 0,0, 0,0, 0,0, 6,31,
+ 0,0, 0,0, 1,4, 1,5,
+ 31,0, 0,0, 0,0, 6,31,
+ 6,0, 0,0, 0,0, 0,0,
+ 0,0, 0,0, 0,0, 0,0,
+ 0,0, 0,0, 0,0, 0,0,
+ 0,0, 0,0, 0,0, 0,0,
+ 0,0, 0,0, 0,0, 0,0,
+ 1,6, 0,0, 0,0, 1,7,
+ 0,0, 6,31, 0,0, 0,0,
+ 6,31, 1,8, 0,0, 0,0,
+ 0,0, 1,9, 6,31, 0,0,
+ 0,0, 0,0, 6,31, 0,0,
+ 0,0, 0,0, 0,0, 1,10,
+ 10,33, 0,0, 0,0, 0,0,
+ 1,11, 0,0, 1,12, 0,0,
+ 0,0, 6,31, 0,0, 6,31,
+ 0,0, 0,0, 0,0, 0,0,
+ 0,0, 0,0, 0,0, 0,0,
+ 0,0, 2,10, 9,32, 9,32,
+ 9,32, 9,32, 9,32, 9,32,
+ 9,32, 9,32, 9,32, 9,32,
+ 0,0, 0,0, 0,0, 0,0,
+ 0,0, 0,0, 1,13, 39,69,
+ 1,14, 1,15, 1,16, 1,17,
+ 18,48, 1,18, 1,19, 21,51,
+ 23,53, 1,20, 1,21, 1,22,
+ 1,23, 1,24, 1,25, 1,26,
+ 1,27, 1,28, 1,29, 1,30,
+ 2,13, 17,46, 2,14, 2,15,
+ 2,16, 2,17, 19,49, 2,18,
+ 2,19, 20,50, 17,47, 2,20,
+ 2,21, 2,22, 2,23, 2,24,
+ 2,25, 2,26, 2,27, 2,28,
+ 2,29, 2,30, 12,34, 12,34,
+ 12,34, 12,34, 12,34, 12,34,
+ 12,34, 12,34, 12,34, 12,34,
+ 13,35, 13,36, 22,52, 13,37,
+ 25,56, 26,57, 28,62, 12,34,
+ 12,34, 12,34, 12,34, 12,34,
+ 12,34, 12,34, 12,34, 12,34,
+ 12,34, 12,34, 12,34, 12,34,
+ 12,34, 12,34, 12,34, 12,34,
+ 12,34, 12,34, 12,34, 12,34,
+ 12,34, 12,34, 12,34, 12,34,
+ 12,34, 24,54, 29,63, 35,66,
+ 37,67, 12,34, 24,55, 12,34,
+ 12,34, 12,34, 12,34, 12,34,
+ 12,34, 12,34, 12,34, 12,34,
+ 12,34, 12,34, 12,34, 12,34,
+ 12,34, 12,34, 12,34, 12,34,
+ 12,34, 12,34, 12,34, 12,34,
+ 12,34, 12,34, 12,34, 12,34,
+ 12,34, 14,38, 27,58, 15,42,
+ 16,44, 27,59, 27,60, 38,68,
+ 14,39, 30,64, 40,70, 41,71,
+ 14,40, 15,43, 16,45, 14,41,
+ 42,72, 27,61, 43,73, 30,65,
+ 44,74, 45,75, 46,78, 47,79,
+ 48,80, 49,81, 50,82, 51,83,
+ 45,76, 52,84, 54,85, 55,86,
+ 45,77, 56,87, 57,88, 57,89,
+ 58,91, 59,92, 60,93, 61,94,
+ 63,96, 64,98, 65,99, 66,101,
+ 67,102, 65,100, 68,103, 69,104,
+ 57,90, 70,105, 63,97, 71,106,
+ 72,107, 73,108, 74,109, 75,110,
+ 61,95, 76,111, 77,112, 78,113,
+ 79,114, 80,115, 81,116, 82,118,
+ 83,119, 84,120, 85,121, 87,122,
+ 88,123, 89,124, 90,125, 92,126,
+ 81,117, 93,127, 94,128, 95,129,
+ 96,130, 97,131, 98,132, 99,133,
+ 100,134, 101,135, 104,136, 105,137,
+ 106,138, 107,139, 108,140, 109,141,
+ 111,142, 112,143, 113,144, 114,145,
+ 116,146, 119,147, 120,148, 121,149,
+ 123,150, 124,151, 125,152, 126,153,
+ 127,154, 128,155, 129,156, 130,157,
+ 131,158, 132,159, 134,160, 136,161,
+ 138,162, 139,163, 140,164, 141,165,
+ 142,166, 143,167, 145,168, 146,169,
+ 147,170, 148,171, 149,172, 150,173,
+ 151,174, 152,175, 154,176, 155,177,
+ 156,178, 158,179, 159,180, 160,181,
+ 161,182, 162,183, 163,184, 165,185,
+ 166,186, 168,187, 169,188, 171,189,
+ 172,190, 173,191, 174,192, 175,193,
+ 178,194, 179,195, 181,196, 182,197,
+ 183,198, 185,199, 187,200, 191,201,
+ 192,202, 193,203, 194,204, 195,205,
+ 196,206, 197,207, 199,208, 201,209,
+ 203,210, 204,211, 208,212, 212,213,
+ 0,0};
+ struct yysvf yysvec[] = {
+ 0, 0, 0,
+ yycrank+-1, 0, 0,
+ yycrank+-23, yysvec+1, 0,
+ yycrank+0, 0, yyvstop+1,
+ yycrank+0, 0, yyvstop+3,
+ yycrank+0, 0, yyvstop+6,
+ yycrank+-6, 0, yyvstop+8,
+ yycrank+0, 0, yyvstop+11,
+ yycrank+0, 0, yyvstop+14,
+ yycrank+34, 0, yyvstop+17,
+ yycrank+2, 0, yyvstop+20,
+ yycrank+0, 0, yyvstop+22,
+ yycrank+94, 0, yyvstop+25,
+ yycrank+38, yysvec+12, yyvstop+28,
+ yycrank+120, yysvec+12, yyvstop+31,
+ yycrank+118, yysvec+12, yyvstop+34,
+ yycrank+110, yysvec+12, yyvstop+37,
+ yycrank+13, yysvec+12, yyvstop+40,
+ yycrank+3, yysvec+12, yyvstop+43,
+ yycrank+16, yysvec+12, yyvstop+46,
+ yycrank+18, yysvec+12, yyvstop+49,
+ yycrank+6, yysvec+12, yyvstop+52,
+ yycrank+43, yysvec+12, yyvstop+55,
+ yycrank+6, yysvec+12, yyvstop+58,
+ yycrank+74, yysvec+12, yyvstop+61,
+ yycrank+39, yysvec+12, yyvstop+64,
+ yycrank+56, yysvec+12, yyvstop+67,
+ yycrank+117, yysvec+12, yyvstop+70,
+ yycrank+47, yysvec+12, yyvstop+73,
+ yycrank+76, yysvec+12, yyvstop+76,
+ yycrank+124, yysvec+12, yyvstop+79,
+ yycrank+-2, yysvec+6, yyvstop+82,
+ yycrank+0, yysvec+9, yyvstop+84,
+ yycrank+0, 0, yyvstop+86,
+ yycrank+0, yysvec+12, yyvstop+88,
+ yycrank+73, yysvec+12, yyvstop+90,
+ yycrank+0, yysvec+12, yyvstop+92,
+ yycrank+72, yysvec+12, yyvstop+95,
+ yycrank+108, yysvec+12, yyvstop+97,
+ yycrank+2, yysvec+12, yyvstop+99,
+ yycrank+129, yysvec+12, yyvstop+101,
+ yycrank+117, yysvec+12, yyvstop+103,
+ yycrank+133, yysvec+12, yyvstop+105,
+ yycrank+117, yysvec+12, yyvstop+107,
+ yycrank+119, yysvec+12, yyvstop+109,
+ yycrank+132, yysvec+12, yyvstop+111,
+ yycrank+127, yysvec+12, yyvstop+113,
+ yycrank+129, yysvec+12, yyvstop+115,
+ yycrank+132, yysvec+12, yyvstop+117,
+ yycrank+125, yysvec+12, yyvstop+119,
+ yycrank+132, yysvec+12, yyvstop+121,
+ yycrank+134, yysvec+12, yyvstop+123,
+ yycrank+148, yysvec+12, yyvstop+125,
+ yycrank+0, yysvec+12, yyvstop+127,
+ yycrank+141, yysvec+12, yyvstop+130,
+ yycrank+133, yysvec+12, yyvstop+132,
+ yycrank+144, yysvec+12, yyvstop+134,
+ yycrank+148, yysvec+12, yyvstop+136,
+ yycrank+136, yysvec+12, yyvstop+138,
+ yycrank+142, yysvec+12, yyvstop+140,
+ yycrank+151, yysvec+12, yyvstop+142,
+ yycrank+158, yysvec+12, yyvstop+144,
+ yycrank+0, yysvec+12, yyvstop+146,
+ yycrank+151, yysvec+12, yyvstop+149,
+ yycrank+158, yysvec+12, yyvstop+151,
+ yycrank+153, yysvec+12, yyvstop+153,
+ yycrank+162, yysvec+12, yyvstop+155,
+ yycrank+149, yysvec+12, yyvstop+157,
+ yycrank+146, yysvec+12, yyvstop+159,
+ yycrank+149, yysvec+12, yyvstop+161,
+ yycrank+150, yysvec+12, yyvstop+163,
+ yycrank+152, yysvec+12, yyvstop+165,
+ yycrank+160, yysvec+12, yyvstop+167,
+ yycrank+171, yysvec+12, yyvstop+169,
+ yycrank+161, yysvec+12, yyvstop+171,
+ yycrank+155, yysvec+12, yyvstop+173,
+ yycrank+165, yysvec+12, yyvstop+175,
+ yycrank+173, yysvec+12, yyvstop+177,
+ yycrank+178, yysvec+12, yyvstop+179,
+ yycrank+177, yysvec+12, yyvstop+181,
+ yycrank+165, yysvec+12, yyvstop+183,
+ yycrank+177, yysvec+12, yyvstop+185,
+ yycrank+176, yysvec+12, yyvstop+188,
+ yycrank+182, yysvec+12, yyvstop+190,
+ yycrank+173, yysvec+12, yyvstop+192,
+ yycrank+172, yysvec+12, yyvstop+194,
+ yycrank+0, yysvec+12, yyvstop+196,
+ yycrank+167, yysvec+12, yyvstop+199,
+ yycrank+183, yysvec+12, yyvstop+201,
+ yycrank+180, yysvec+12, yyvstop+204,
+ yycrank+169, yysvec+12, yyvstop+206,
+ yycrank+0, yysvec+12, yyvstop+209,
+ yycrank+173, yysvec+12, yyvstop+212,
+ yycrank+179, yysvec+12, yyvstop+214,
+ yycrank+174, yysvec+12, yyvstop+216,
+ yycrank+174, yysvec+12, yyvstop+218,
+ yycrank+181, yysvec+12, yyvstop+220,
+ yycrank+188, yysvec+12, yyvstop+222,
+ yycrank+178, yysvec+12, yyvstop+224,
+ yycrank+195, yysvec+12, yyvstop+226,
+ yycrank+199, yysvec+12, yyvstop+228,
+ yycrank+176, yysvec+12, yyvstop+230,
+ yycrank+0, yysvec+12, yyvstop+232,
+ yycrank+0, yysvec+12, yyvstop+235,
+ yycrank+201, yysvec+12, yyvstop+238,
+ yycrank+184, yysvec+12, yyvstop+241,
+ yycrank+184, yysvec+12, yyvstop+243,
+ yycrank+204, yysvec+12, yyvstop+245,
+ yycrank+194, yysvec+12, yyvstop+247,
+ yycrank+202, yysvec+12, yyvstop+249,
+ yycrank+0, yysvec+12, yyvstop+252,
+ yycrank+207, yysvec+12, yyvstop+255,
+ yycrank+191, yysvec+12, yyvstop+257,
+ yycrank+190, yysvec+12, yyvstop+259,
+ yycrank+191, yysvec+12, yyvstop+261,
+ yycrank+0, yysvec+12, yyvstop+264,
+ yycrank+205, yysvec+12, yyvstop+267,
+ yycrank+0, yysvec+12, yyvstop+269,
+ yycrank+0, yysvec+12, yyvstop+272,
+ yycrank+208, yysvec+12, yyvstop+275,
+ yycrank+205, yysvec+12, yyvstop+277,
+ yycrank+195, yysvec+12, yyvstop+279,
+ yycrank+0, yysvec+12, yyvstop+281,
+ yycrank+198, yysvec+12, yyvstop+284,
+ yycrank+198, yysvec+12, yyvstop+286,
+ yycrank+200, yysvec+12, yyvstop+288,
+ yycrank+199, yysvec+12, yyvstop+290,
+ yycrank+215, yysvec+12, yyvstop+292,
+ yycrank+212, yysvec+12, yyvstop+294,
+ yycrank+219, yysvec+12, yyvstop+296,
+ yycrank+209, yysvec+12, yyvstop+298,
+ yycrank+217, yysvec+12, yyvstop+300,
+ yycrank+210, yysvec+12, yyvstop+302,
+ yycrank+0, yysvec+12, yyvstop+304,
+ yycrank+206, yysvec+12, yyvstop+307,
+ yycrank+0, yysvec+12, yyvstop+309,
+ yycrank+224, yysvec+12, yyvstop+312,
+ yycrank+0, yysvec+12, yyvstop+314,
+ yycrank+227, yysvec+12, yyvstop+317,
+ yycrank+211, yysvec+12, yyvstop+320,
+ yycrank+225, yysvec+12, yyvstop+322,
+ yycrank+213, yysvec+12, yyvstop+324,
+ yycrank+223, yysvec+12, yyvstop+326,
+ yycrank+219, yysvec+12, yyvstop+328,
+ yycrank+0, yysvec+12, yyvstop+330,
+ yycrank+225, yysvec+12, yyvstop+333,
+ yycrank+230, yysvec+12, yyvstop+335,
+ yycrank+218, yysvec+12, yyvstop+337,
+ yycrank+236, yysvec+12, yyvstop+339,
+ yycrank+233, yysvec+12, yyvstop+341,
+ yycrank+234, yysvec+12, yyvstop+343,
+ yycrank+220, yysvec+12, yyvstop+345,
+ yycrank+227, yysvec+12, yyvstop+347,
+ yycrank+0, yysvec+12, yyvstop+349,
+ yycrank+238, yysvec+12, yyvstop+352,
+ yycrank+240, yysvec+12, yyvstop+354,
+ yycrank+224, yysvec+12, yyvstop+356,
+ yycrank+0, yysvec+12, yyvstop+358,
+ yycrank+231, yysvec+12, yyvstop+361,
+ yycrank+228, yysvec+12, yyvstop+363,
+ yycrank+238, yysvec+12, yyvstop+365,
+ yycrank+228, yysvec+12, yyvstop+367,
+ yycrank+235, yysvec+12, yyvstop+369,
+ yycrank+245, yysvec+12, yyvstop+371,
+ yycrank+0, yysvec+12, yyvstop+373,
+ yycrank+250, yysvec+12, yyvstop+376,
+ yycrank+238, yysvec+12, yyvstop+378,
+ yycrank+0, yysvec+12, yyvstop+380,
+ yycrank+238, yysvec+12, yyvstop+383,
+ yycrank+236, yysvec+12, yyvstop+385,
+ yycrank+0, yysvec+12, yyvstop+387,
+ yycrank+236, yysvec+12, yyvstop+390,
+ yycrank+238, yysvec+12, yyvstop+392,
+ yycrank+243, yysvec+12, yyvstop+394,
+ yycrank+253, yysvec+12, yyvstop+396,
+ yycrank+250, yysvec+12, yyvstop+398,
+ yycrank+0, yysvec+12, yyvstop+400,
+ yycrank+0, yysvec+12, yyvstop+403,
+ yycrank+239, yysvec+12, yyvstop+406,
+ yycrank+256, yysvec+12, yyvstop+409,
+ yycrank+0, yysvec+12, yyvstop+411,
+ yycrank+250, yysvec+12, yyvstop+414,
+ yycrank+258, yysvec+12, yyvstop+416,
+ yycrank+244, yysvec+12, yyvstop+418,
+ yycrank+0, yysvec+12, yyvstop+420,
+ yycrank+245, yysvec+12, yyvstop+423,
+ yycrank+0, yysvec+12, yyvstop+425,
+ yycrank+252, yysvec+12, yyvstop+428,
+ yycrank+0, yysvec+12, yyvstop+430,
+ yycrank+0, yysvec+12, yyvstop+433,
+ yycrank+0, yysvec+12, yyvstop+436,
+ yycrank+264, yysvec+12, yyvstop+439,
+ yycrank+250, yysvec+12, yyvstop+441,
+ yycrank+255, yysvec+12, yyvstop+443,
+ yycrank+252, yysvec+12, yyvstop+445,
+ yycrank+267, yysvec+12, yyvstop+447,
+ yycrank+267, yysvec+12, yyvstop+449,
+ yycrank+255, yysvec+12, yyvstop+451,
+ yycrank+0, yysvec+12, yyvstop+453,
+ yycrank+265, yysvec+12, yyvstop+456,
+ yycrank+0, yysvec+12, yyvstop+458,
+ yycrank+270, yysvec+12, yyvstop+461,
+ yycrank+0, yysvec+12, yyvstop+463,
+ yycrank+269, yysvec+12, yyvstop+466,
+ yycrank+272, yysvec+12, yyvstop+468,
+ yycrank+0, yysvec+12, yyvstop+470,
+ yycrank+0, yysvec+12, yyvstop+473,
+ yycrank+0, yysvec+12, yyvstop+476,
+ yycrank+263, yysvec+12, yyvstop+479,
+ yycrank+0, yysvec+12, yyvstop+481,
+ yycrank+0, yysvec+12, yyvstop+484,
+ yycrank+0, yysvec+12, yyvstop+487,
+ yycrank+265, yysvec+12, yyvstop+490,
+ yycrank+0, yysvec+12, yyvstop+492,
+ 0, 0, 0};
+ struct yywork *yytop = yycrank+375;
+ struct yysvf *yybgin = yysvec+1;
+ char yymatch[] = {
+ 0, 1, 1, 1, 1, 1, 1, 1,
+ 1, 9, 10, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1,
+ 9, 1, 1, 35, 1, 1, 38, 1,
+ 38, 38, 38, 1, 44, 1, 1, 1,
+ 48, 48, 48, 48, 48, 48, 48, 48,
+ 48, 48, 1, 38, 1, 1, 1, 63,
+ 1, 65, 65, 65, 65, 65, 65, 65,
+ 65, 65, 65, 65, 65, 65, 65, 65,
+ 65, 65, 65, 65, 65, 65, 65, 65,
+ 65, 65, 65, 38, 1, 38, 1, 65,
+ 1, 65, 65, 65, 65, 65, 65, 65,
+ 65, 65, 65, 65, 65, 65, 65, 65,
+ 65, 65, 65, 65, 65, 65, 65, 65,
+ 65, 65, 65, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1,
+ 0};
+ char yyextra[] = {
+ 0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,
+ 0};
+ /* Copyright (c) 1989 AT&T */
+ /* All Rights Reserved */
+
+ /* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */
+ /* The copyright notice above does not evidence any */
+ /* actual or intended publication of such source code. */
+
+ #pragma ident "@(#)ncform 6.8 95/02/11 SMI"
+
+ int yylineno =1;
+ # define YYU(x) x
+ # define NLSTATE yyprevious=YYNEWLINE
+ struct yysvf *yylstate [YYLMAX], **yylsp, **yyolsp;
+ char yysbuf[YYLMAX];
+ char *yysptr = yysbuf;
+ int *yyfnd;
+ extern struct yysvf *yyestate;
+ int yyprevious = YYNEWLINE;
+ #if defined(__cplusplus) || defined(__STDC__)
+ int yylook(void)
+ #else
+ yylook()
+ #endif
+ {
+ register struct yysvf *yystate, **lsp;
+ register struct yywork *yyt;
+ struct yysvf *yyz;
+ int yych, yyfirst;
+ struct yywork *yyr;
+ # ifdef LEXDEBUG
+ int debug;
+ # endif
+ char *yylastch;
+ /* start off machines */
+ # ifdef LEXDEBUG
+ debug = 0;
+ # endif
+ yyfirst=1;
+ if (!yymorfg)
+ yylastch = yytext;
+ else {
+ yymorfg=0;
+ yylastch = yytext+yyleng;
+ }
+ for(;;){
+ lsp = yylstate;
+ yyestate = yystate = yybgin;
+ if (yyprevious==YYNEWLINE) yystate++;
+ for (;;){
+ # ifdef LEXDEBUG
+ if(debug)fprintf(yyout,"state %d\n",yystate-yysvec-1);
+ # endif
+ yyt = yystate->yystoff;
+ if(yyt == yycrank && !yyfirst){ /* may not be any transitions */
+ yyz = yystate->yyother;
+ if(yyz == 0)break;
+ if(yyz->yystoff == yycrank)break;
+ }
+ #ifndef __cplusplus
+ *yylastch++ = yych = input();
+ #else
+ *yylastch++ = yych = lex_input();
+ #endif
+ if(yylastch > &yytext[YYLMAX]) {
+ fprintf(yyout,"Input string too long, limit %d\n",YYLMAX);
+ exit(1);
+ }
+ yyfirst=0;
+ tryagain:
+ # ifdef LEXDEBUG
+ if(debug){
+ fprintf(yyout,"char ");
+ allprint(yych);
+ putchar('\n');
+ }
+ # endif
+ yyr = yyt;
+ if ( (int)yyt > (int)yycrank){
+ yyt = yyr + yych;
+ if (yyt <= yytop && yyt->verify+yysvec == yystate){
+ if(yyt->advance+yysvec == YYLERR) /* error transitions */
+ {unput(*--yylastch);break;}
+ *lsp++ = yystate = yyt->advance+yysvec;
+ if(lsp > &yylstate[YYLMAX]) {
+ fprintf(yyout,"Input string too long, limit %d\n",YYLMAX);
+ exit(1);
+ }
+ goto contin;
+ }
+ }
+ # ifdef YYOPTIM
+ else if((int)yyt < (int)yycrank) { /* r < yycrank */
+ yyt = yyr = yycrank+(yycrank-yyt);
+ # ifdef LEXDEBUG
+ if(debug)fprintf(yyout,"compressed state\n");
+ # endif
+ yyt = yyt + yych;
+ if(yyt <= yytop && yyt->verify+yysvec == yystate){
+ if(yyt->advance+yysvec == YYLERR) /* error transitions */
+ {unput(*--yylastch);break;}
+ *lsp++ = yystate = yyt->advance+yysvec;
+ if(lsp > &yylstate[YYLMAX]) {
+ fprintf(yyout,"Input string too long, limit %d\n",YYLMAX);
+ exit(1);
+ }
+ goto contin;
+ }
+ yyt = yyr + YYU(yymatch[yych]);
+ # ifdef LEXDEBUG
+ if(debug){
+ fprintf(yyout,"try fall back character ");
+ allprint(YYU(yymatch[yych]));
+ putchar('\n');
+ }
+ # endif
+ if(yyt <= yytop && yyt->verify+yysvec == yystate){
+ if(yyt->advance+yysvec == YYLERR) /* error transition */
+ {unput(*--yylastch);break;}
+ *lsp++ = yystate = yyt->advance+yysvec;
+ if(lsp > &yylstate[YYLMAX]) {
+ fprintf(yyout,"Input string too long, limit %d\n",YYLMAX);
+ exit(1);
+ }
+ goto contin;
+ }
+ }
+ if ((yystate = yystate->yyother) && (yyt= yystate->yystoff) != yycrank){
+ # ifdef LEXDEBUG
+ if(debug)fprintf(yyout,"fall back to state %d\n",yystate-yysvec-1);
+ # endif
+ goto tryagain;
+ }
+ # endif
+ else
+ {unput(*--yylastch);break;}
+ contin:
+ # ifdef LEXDEBUG
+ if(debug){
+ fprintf(yyout,"state %d char ",yystate-yysvec-1);
+ allprint(yych);
+ putchar('\n');
+ }
+ # endif
+ ;
+ }
+ # ifdef LEXDEBUG
+ if(debug){
+ fprintf(yyout,"stopped at %d with ",*(lsp-1)-yysvec-1);
+ allprint(yych);
+ putchar('\n');
+ }
+ # endif
+ while (lsp-- > yylstate){
+ *yylastch-- = 0;
+ if (*lsp != 0 && (yyfnd= (*lsp)->yystops) && *yyfnd > 0){
+ yyolsp = lsp;
+ if(yyextra[*yyfnd]){ /* must backup */
+ while(yyback((*lsp)->yystops,-*yyfnd) != 1 && lsp > yylstate){
+ lsp--;
+ unput(*yylastch--);
+ }
+ }
+ yyprevious = YYU(*yylastch);
+ yylsp = lsp;
+ yyleng = yylastch-yytext+1;
+ yytext[yyleng] = 0;
+ # ifdef LEXDEBUG
+ if(debug){
+ fprintf(yyout,"\nmatch ");
+ sprint(yytext);
+ fprintf(yyout," action %d\n",*yyfnd);
+ }
+ # endif
+ return(*yyfnd++);
+ }
+ unput(*yylastch);
+ }
+ if (yytext[0] == 0 /* && feof(yyin) */)
+ {
+ yysptr=yysbuf;
+ return(0);
+ }
+ #ifndef __cplusplus
+ yyprevious = yytext[0] = input();
+ if (yyprevious>0)
+ output(yyprevious);
+ #else
+ yyprevious = yytext[0] = lex_input();
+ if (yyprevious>0)
+ lex_output(yyprevious);
+ #endif
+ yylastch=yytext;
+ # ifdef LEXDEBUG
+ if(debug)putchar('\n');
+ # endif
+ }
+ }
+ #if defined(__cplusplus) || defined(__STDC__)
+ int yyback(int *p, int m)
+ #else
+ yyback(p, m)
+ int *p;
+ #endif
+ {
+ if (p==0) return(0);
+ while (*p) {
+ if (*p++ == m)
+ return(1);
+ }
+ return(0);
+ }
+ /* the following are only used in the lex library */
+ #if defined(__cplusplus) || defined(__STDC__)
+ int yyinput(void)
+ #else
+ yyinput()
+ #endif
+ {
+ #ifndef __cplusplus
+ return(input());
+ #else
+ return(lex_input());
+ #endif
+ }
+ #if defined(__cplusplus) || defined(__STDC__)
+ void yyoutput(int c)
+ #else
+ yyoutput(c)
+ int c;
+ #endif
+ {
+ #ifndef __cplusplus
+ output(c);
+ #else
+ lex_output(c);
+ #endif
+ }
+ #if defined(__cplusplus) || defined(__STDC__)
+ void yyunput(int c)
+ #else
+ yyunput(c)
+ int c;
+ #endif
+ {
+ unput(c);
+ }
Index: llvm-test/MultiSource/Benchmarks/Prolangs-C/cdecl/cdlex.l.in
diff -c /dev/null llvm-test/MultiSource/Benchmarks/Prolangs-C/cdecl/cdlex.l.in:1.1
*** /dev/null Tue Oct 5 14:08:40 2004
--- llvm-test/MultiSource/Benchmarks/Prolangs-C/cdecl/cdlex.l.in Tue Oct 5 14:08:26 2004
***************
*** 0 ****
--- 1,75 ----
+ %{
+ /* Lexical analyzer description for ANSI and C++ cdecl. */
+ /* The output of this file is included */
+ /* into the C file cdecl.c. */
+ char cdlexsccsid[] = "@(#)cdlex.l 2.2 3/30/88";
+ %}
+
+ N [0-9]
+ A [A-Z_a-z]
+ AN [0-9A-Z_a-z]
+
+ %%
+ array return ARRAY;
+ as return AS;
+ cast return CAST;
+ declare return DECLARE;
+ exit return 0;
+ explain return EXPLAIN;
+ function return FUNCTION;
+ func return FUNCTION;
+ help return HELP;
+ into return INTO;
+ member return MEMBER;
+ of return OF;
+ pointer return POINTER;
+ ptr return POINTER;
+ quit return 0;
+ reference return REFERENCE;
+ ref return REFERENCE;
+ returning return RETURNING;
+ ret return RETURNING;
+ set return SET;
+ to return TO;
+ vector return ARRAY;
+ :: return DOUBLECOLON;
+ [?] return HELP;
+ [,] return COMMA;
+
+ auto { yylval.dynstr = ds(yytext); return AUTO; }
+ character { yylval.dynstr = ds("char"); return CHAR; }
+ char { yylval.dynstr = ds(yytext); return CHAR; }
+ class { yylval.dynstr = ds(yytext); return CLASS; }
+ constant { yylval.dynstr = ds("const"); return CONSTVOLATILE; }
+ const { yylval.dynstr = ds(yytext); return CONSTVOLATILE; }
+ double { yylval.dynstr = ds(yytext); return DOUBLE; }
+ enumeration { yylval.dynstr = ds("enum"); return ENUM; }
+ enum { yylval.dynstr = ds(yytext); return ENUM; }
+ extern { yylval.dynstr = ds(yytext); return EXTERN; }
+ float { yylval.dynstr = ds(yytext); return FLOAT; }
+ integer { yylval.dynstr = ds("int"); return INT; }
+ int { yylval.dynstr = ds(yytext); return INT; }
+ long { yylval.dynstr = ds(yytext); return LONG; }
+ noalias { yylval.dynstr = ds(yytext); return CONSTVOLATILE; }
+ register { yylval.dynstr = ds(yytext); return REGISTER; }
+ short { yylval.dynstr = ds(yytext); return SHORT; }
+ signed { yylval.dynstr = ds(yytext); return SIGNED; }
+ static { yylval.dynstr = ds(yytext); return STATIC; }
+ structure { yylval.dynstr = ds("struct"); return STRUCT; }
+ struct { yylval.dynstr = ds(yytext); return STRUCT; }
+ union { yylval.dynstr = ds(yytext); return UNION; }
+ unsigned { yylval.dynstr = ds(yytext); return UNSIGNED; }
+ void { yylval.dynstr = ds(yytext); return VOID; }
+ volatile { yylval.dynstr = ds(yytext); return CONSTVOLATILE; }
+
+ {A}{AN}* { yylval.dynstr = ds(yytext); return NAME; }
+ {N}+ { yylval.dynstr = ds(yytext); return NUMBER; }
+
+ [#].* ;
+ [\t ] ;
+ [&*[\]();\n] return *yytext;
+ . {
+ (void) printf("bad character '%s'\n",visible(*yytext));
+ return *yytext;
+ }
+ %%
Index: llvm-test/MultiSource/Benchmarks/Prolangs-C/cdecl/testset
diff -c /dev/null llvm-test/MultiSource/Benchmarks/Prolangs-C/cdecl/testset:1.1
*** /dev/null Tue Oct 5 14:08:40 2004
--- llvm-test/MultiSource/Benchmarks/Prolangs-C/cdecl/testset Tue Oct 5 14:08:26 2004
***************
*** 0 ****
--- 1,71 ----
+ help
+ set options
+ # test some declarations
+ declare x as ptr to character
+ declare x as func(w as ptr to char, y as int) ret ptr to int
+ declare x as func(ptr to char) ret ptr to int
+ declare x as func(int) ret ptr to int
+ declare x as func(ptr to char, int) ret ptr to int
+ declare x as function (args) returning pointer to int
+ # test some explain functions
+ explain char *x
+ explain int *x()
+ explain int *x(args)
+ explain int *x(char *)
+ explain int *x(char *, int )
+ explain int *x(char *, int, float)
+ explain int *x(int )
+ # test some casts
+ cast x into ptr to char
+ cast x into ptr to func ret int
+ cast x into ptr to func() ret int
+ cast x into ptr to func(args) ret int
+ cast x into ptr to func(x as ptr to char, y as int) ret int
+ cast x into ptr to func(ptr to char) ret int
+ cast x into ptr to func(ptr to char, int) ret int
+ cast x into ptr to func(ptr to char, int, float) ret int
+ # test explaining some casts
+ explain (char *)x
+ explain (int (*)())x
+ explain (int (*)(char *))x
+ explain (int (*)(char *, int))x
+ explain (int (*)(char *, int, float))x
+ help
+ set options
+ # test some declarations
+ declare x as ptr to character
+ declare x as reference to character
+ declare foo as pointer to member of class X int
+ declare foo as pointer to member of class X function (arg1, arg2) returning pointer to class Y
+ declare x as func(w as ptr to char, y as int) ret ptr to int
+ declare x as func(ptr to char) ret ptr to int
+ declare x as func(int) ret ptr to int
+ declare x as func(ptr to char, int) ret ptr to int
+ declare x as function (args) returning pointer to int
+ # test some explain functions
+ explain char *x
+ explain int X::*foo
+ explain class Y *(X::*foo)(arg1, arg2)
+ explain int *x()
+ explain int *x(args)
+ explain int *x(char *)
+ explain int *x(char *, int )
+ explain int *x(char *, int, float)
+ explain int *x(int )
+ # test some casts
+ cast x into ptr to char
+ cast x into ptr to member of class X int
+ cast x into ptr to func ret int
+ cast x into ptr to func() ret int
+ cast x into ptr to func(args) ret int
+ cast x into ptr to func(x as ptr to char, y as int) ret int
+ cast x into ptr to func(ptr to char) ret int
+ cast x into ptr to func(ptr to char, int) ret int
+ cast x into ptr to func(ptr to char, int, float) ret int
+ # test explaining some casts
+ explain (char *)x
+ explain (int X::*)x
+ explain (int (*)())x
+ explain (int (*)(char *))x
+ explain (int (*)(char *, int))x
+ explain (int (*)(char *, int, float))x
More information about the llvm-commits
mailing list