tkeden1.41/004075500025250000164000000000000747346161700126445ustar00ashleyem00003510000005tkeden1.41/.gdb_history010060000025250000164000000007020745661117400151420ustar00ashleyem00003510000005break Define run n print expr1 print *expr1 print expr2 print *expr2 n n delete run run break Define cont n n print *expr2 quit break count_expr run n n cont cont cont delete help disable help disable break run break count_expr cont n n print Ltype print expr->left print expr->left->type print expr->right print expr->right->type n quit run break semantic_2 cont print expr print *expr print expr->left->type print expr->right->type bt n quity quit tkeden1.41/bison/004070000025250000164000000000000743723741400137405ustar00ashleyem00003510000005tkeden1.41/bison/bison.simple010060000025250000164000000535500733204607300162650ustar00ashleyem00003510000005/* -*-C-*- Note some compilers choke on comments on `#line' lines. */ /* MODIFICATION 1: fix all #line directives as they have the wrong * filename and line numbers. Note #line no = actual number + 1 * #line 3 "/usr/local/share/bison.simple" */ #line 7 "bison/bison.simple" /* END MODIFICATION 1 */ /* This file comes from bison-1.28. */ /* This is a MODIFIED version of bison's Skeleton output parser The change is such that the parser only process one token at each call to yyparse(). The token is the argument to yyparse(). This means that this parser is token driven. Example use: while (token = yylex()) { yyparse(token); } Additionally: error handling patched to show expected when there are > 5 expected during an error. [Ash, May 2001]. There are 13 patches of MODIFICATION in the Skeleton (not including this comment) */ /* Skeleton output parser for bison, Copyright (C) 1984, 1989, 1990 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /* As a special exception, when this file is copied by Bison into a Bison output file, you may use that output file without restriction. This special exception was added by the Free Software Foundation in version 1.24 of Bison. */ /* This is the parser code that is written into each bison parser when the %semantic_parser declaration is not specified in the grammar. It was written by Richard Stallman by simplifying the hairy parser used when %semantic_parser is specified. */ #ifndef YYSTACK_USE_ALLOCA #ifdef alloca #define YYSTACK_USE_ALLOCA #else /* alloca not defined */ #ifdef __GNUC__ #define YYSTACK_USE_ALLOCA #define alloca __builtin_alloca #else /* not GNU C. */ #if (!defined (__STDC__) && defined (sparc)) || defined (__sparc__) || defined (__sparc) || defined (__sgi) || (defined (__sun) && defined (__i386)) #define YYSTACK_USE_ALLOCA #include #else /* not sparc */ /* We think this test detects Watcom and Microsoft C. */ /* This used to test MSDOS, but that is a bad idea since that symbol is in the user namespace. */ #if (defined (_MSDOS) || defined (_MSDOS_)) && !defined (__TURBOC__) #if 0 /* No need for malloc.h, which pollutes the namespace; instead, just don't use alloca. */ #include #endif #else /* not MSDOS, or __TURBOC__ */ #if defined(_AIX) /* I don't know what this was needed for, but it pollutes the namespace. So I turned it off. rms, 2 May 1997. */ /* #include */ #pragma alloca #define YYSTACK_USE_ALLOCA #else /* not MSDOS, or __TURBOC__, or _AIX */ #if 0 #ifdef __hpux /* haible@ilog.fr says this works for HPUX 9.05 and up, and on HPUX 10. Eventually we can turn this on. */ #define YYSTACK_USE_ALLOCA #define alloca __builtin_alloca #endif /* __hpux */ #endif #endif /* not _AIX */ #endif /* not MSDOS, or __TURBOC__ */ #endif /* not sparc */ #endif /* not GNU C */ #endif /* alloca not defined */ #endif /* YYSTACK_USE_ALLOCA not defined */ #ifdef YYSTACK_USE_ALLOCA #define YYSTACK_ALLOC alloca #else #define YYSTACK_ALLOC malloc #endif /* Note: there must be only one dollar sign in this file. It is replaced by the list of actions, each action as one case of the switch. */ #define yyerrok (yyerrstatus = 0) #define yyclearin (yychar = YYEMPTY) #define YYEMPTY -2 #define YYEOF 0 #define YYACCEPT goto yyacceptlab #define YYABORT goto yyabortlab #define YYERROR goto yyerrlab1 /* Like YYERROR except do call yyerror. This remains here temporarily to ease the transition to the new meaning of YYERROR, for GCC. Once GCC version 2 has supplanted version 1, this can go. */ #define YYFAIL goto yyerrlab #define YYRECOVERING() (!!yyerrstatus) #define YYBACKUP(token, value) \ do \ if (yychar == YYEMPTY && yylen == 1) \ { yychar = (token), yylval = (value); \ yychar1 = YYTRANSLATE (yychar); \ YYPOPSTACK; \ goto yybackup; \ } \ else \ { yyerror ("syntax error: cannot back up"); YYERROR; } \ while (0) #define YYTERROR 1 #define YYERRCODE 256 #ifndef YYPURE #define YYLEX yylex() #endif #ifdef YYPURE #ifdef YYLSP_NEEDED #ifdef YYLEX_PARAM #define YYLEX yylex(&yylval, &yylloc, YYLEX_PARAM) #else #define YYLEX yylex(&yylval, &yylloc) #endif #else /* not YYLSP_NEEDED */ #ifdef YYLEX_PARAM #define YYLEX yylex(&yylval, YYLEX_PARAM) #else #define YYLEX yylex(&yylval) #endif #endif /* not YYLSP_NEEDED */ #endif /* If nonreentrant, generate the variables here */ #ifndef YYPURE int yychar; /* the lookahead symbol */ YYSTYPE yylval; /* the semantic value of the */ /* lookahead symbol */ #ifdef YYLSP_NEEDED YYLTYPE yylloc; /* location data for the lookahead */ /* symbol */ #endif int yynerrs; /* number of parse errors so far */ #endif /* not YYPURE */ #if YYDEBUG != 0 int yydebug; /* nonzero means print parse trace */ /* Since this is uninitialized, it does not stop multiple parsers from coexisting. */ #endif /* YYINITDEPTH indicates the initial size of the parser's stacks */ #ifndef YYINITDEPTH #define YYINITDEPTH 200 #endif /* YYMAXDEPTH is the maximum size the stacks can grow to (effective only if the built-in stack extension method is used). */ #if YYMAXDEPTH == 0 #undef YYMAXDEPTH #endif #ifndef YYMAXDEPTH #define YYMAXDEPTH 10000 #endif /* Define __yy_memcpy. Note that the size argument should be passed with type unsigned int, because that is what the non-GCC definitions require. With GCC, __builtin_memcpy takes an arg of type size_t, but it can handle unsigned int. */ #if __GNUC__ > 1 /* GNU C and GNU C++ define this. */ #define __yy_memcpy(TO,FROM,COUNT) __builtin_memcpy(TO,FROM,COUNT) #else /* not GNU C or C++ */ #ifndef __cplusplus /* This is the most reliable way to avoid incompatibilities in available built-in functions on various systems. */ static void __yy_memcpy (to, from, count) char *to; char *from; unsigned int count; { register char *f = from; register char *t = to; register int i = count; while (i-- > 0) *t++ = *f++; } #else /* __cplusplus */ /* This is the most reliable way to avoid incompatibilities in available built-in functions on various systems. */ static void __yy_memcpy (char *to, char *from, unsigned int count) { register char *t = to; register char *f = from; register int i = count; while (i-- > 0) *t++ = *f++; } #endif #endif /* MODIFICATION 2: same as MODIFICATION 1 * #line 217 "/usr/local/share/bison.simple" */ #line 241 "bison/bison.simple" /* END MODIFICATION 2 */ /* The user can define YYPARSE_PARAM as the name of an argument to be passed into yyparse. The argument should have type void *. It should actually point to an object. Grammar actions can access the variable by casting it to the proper pointer type. */ #ifdef YYPARSE_PARAM #ifdef __cplusplus #define YYPARSE_PARAM_ARG void *YYPARSE_PARAM #define YYPARSE_PARAM_DECL #else /* not __cplusplus */ #define YYPARSE_PARAM_ARG YYPARSE_PARAM #define YYPARSE_PARAM_DECL void *YYPARSE_PARAM; #endif /* not __cplusplus */ #else /* not YYPARSE_PARAM */ #define YYPARSE_PARAM_ARG #define YYPARSE_PARAM_DECL #endif /* not YYPARSE_PARAM */ /* Prevent warning if -Wstrict-prototypes. */ #ifdef __GNUC__ /* MODIFICATION 3: yyparse() takes an argument that is the lex token * #ifdef YYPARSE_PARAM * int yyparse (void *); * #else * int yyparse (void); * #endif */ int yyparse(int); /* END MODIFICATION 3 */ #endif /* MODIFICATION 4: add a variable yy_parse_init to control the initialisation of the parser and an accessor function */ static int yy_parse_init = 1; #ifdef WANT_SETYYPARSEINIT /* Added this function to allow Eden to use this bison.simple. Needs conditional compilation as we can only have one function with this name otherwise the linker moans (can't compile this into Donald, Scout etc). The name here doesn't get automatically translated by the sed or bison -p. [Ash] */ void setyyparseinit(int setto) { yy_parse_init = setto; } #endif /* END MODIFICATION 4 */ /* MODIFICATION 5: turning the local variables of yyparse() into static, global variables so that the parser can be reentered */ static int yystate; static int yyn; static short *yyssp; static YYSTYPE *yyvsp; static int yyerrstatus; /* number of tokens to shift before error messages enabled */ static int yychar1 = 0; /* lookahead token as an internal (translated) token number */ static short yyssa[YYINITDEPTH]; /* the state stack */ static YYSTYPE yyvsa[YYINITDEPTH]; /* the semantic value stack */ static short *yyss = yyssa; /* refer to the stacks thru separate pointers */ static YYSTYPE *yyvs = yyvsa; /* to allow yyoverflow to reallocate them elsewhere */ #ifdef YYLSP_NEEDED static YYLTYPE yylsa[YYINITDEPTH]; /* the location stack */ static YYLTYPE *yyls = yylsa; static YYLTYPE *yylsp; #define YYPOPSTACK (yyvsp--, yyssp--, yylsp--) #else #define YYPOPSTACK (yyvsp--, yyssp--) #endif static int yystacksize = YYINITDEPTH; static int yyfree_stacks = 0; #ifdef YYPURE static int yychar; static YYSTYPE yylval; static int yynerrs; #ifdef YYLSP_NEEDED static YYLTYPE yylloc; #endif #endif static YYSTYPE yyval; /* the variable used to return */ /* semantic values from the action */ /* routines */ static int yylen; /* END MODIFICATION 5 */ /* MODIFICATION 6: yyparse() takes an argument that is the lex token * int * yyparse(YYPARSE_PARAM_ARG) * YYPARSE_PARAM_DECL * { */ int yyparse(token) int token; { /* END MODIFICATION 6 */ /* MODIFICATION 7: deal with initialisation */ int yy_token_read = 0; if (!yy_parse_init) goto lex; yy_parse_init = 0; /* END MODIFICATION 7 */ #if YYDEBUG != 0 if (yydebug) fprintf(stderr, "Starting parse\n"); #endif yystate = 0; yyerrstatus = 0; yynerrs = 0; yychar = YYEMPTY; /* Cause a token to be read. */ /* Initialize stack pointers. Waste one element of value and location stack so that they stay on the same level as the state stack. The wasted elements are never initialized. */ yyssp = yyss - 1; yyvsp = yyvs; #ifdef YYLSP_NEEDED yylsp = yyls; #endif /* Push a new state, which is found in yystate . */ /* In all cases, when you get here, the value and location stacks have just been pushed. so pushing a state here evens the stacks. */ yynewstate: *++yyssp = yystate; if (yyssp >= yyss + yystacksize - 1) { /* Give user a chance to reallocate the stack */ /* Use copies of these so that the &'s don't force the real ones into memory. */ YYSTYPE *yyvs1 = yyvs; short *yyss1 = yyss; #ifdef YYLSP_NEEDED YYLTYPE *yyls1 = yyls; #endif /* Get the current used size of the three stacks, in elements. */ int size = yyssp - yyss + 1; #ifdef yyoverflow /* Each stack pointer address is followed by the size of the data in use in that stack, in bytes. */ #ifdef YYLSP_NEEDED /* This used to be a conditional around just the two extra args, but that might be undefined if yyoverflow is a macro. */ yyoverflow("parser stack overflow", &yyss1, size * sizeof (*yyssp), &yyvs1, size * sizeof (*yyvsp), &yyls1, size * sizeof (*yylsp), &yystacksize); #else yyoverflow("parser stack overflow", &yyss1, size * sizeof (*yyssp), &yyvs1, size * sizeof (*yyvsp), &yystacksize); #endif yyss = yyss1; yyvs = yyvs1; #ifdef YYLSP_NEEDED yyls = yyls1; #endif #else /* no yyoverflow */ /* Extend the stack our own way. */ if (yystacksize >= YYMAXDEPTH) { yyerror("parser stack overflow"); if (yyfree_stacks) { free (yyss); free (yyvs); #ifdef YYLSP_NEEDED free (yyls); #endif } return 2; } yystacksize *= 2; if (yystacksize > YYMAXDEPTH) yystacksize = YYMAXDEPTH; #ifndef YYSTACK_USE_ALLOCA yyfree_stacks = 1; #endif yyss = (short *) YYSTACK_ALLOC (yystacksize * sizeof (*yyssp)); __yy_memcpy ((char *)yyss, (char *)yyss1, size * (unsigned int) sizeof (*yyssp)); yyvs = (YYSTYPE *) YYSTACK_ALLOC (yystacksize * sizeof (*yyvsp)); __yy_memcpy ((char *)yyvs, (char *)yyvs1, size * (unsigned int) sizeof (*yyvsp)); #ifdef YYLSP_NEEDED yyls = (YYLTYPE *) YYSTACK_ALLOC (yystacksize * sizeof (*yylsp)); __yy_memcpy ((char *)yyls, (char *)yyls1, size * (unsigned int) sizeof (*yylsp)); #endif #endif /* no yyoverflow */ yyssp = yyss + size - 1; yyvsp = yyvs + size - 1; #ifdef YYLSP_NEEDED yylsp = yyls + size - 1; #endif #if YYDEBUG != 0 if (yydebug) fprintf(stderr, "Stack size increased to %d\n", yystacksize); #endif if (yyssp >= yyss + yystacksize - 1) YYABORT; } #if YYDEBUG != 0 if (yydebug) fprintf(stderr, "Entering state %d\n", yystate); #endif goto yybackup; yybackup: /* Do appropriate processing given the current state. */ /* Read a lookahead token if we need one and don't already have one. */ /* yyresume: */ /* First try to decide what to do without reference to lookahead token. */ yyn = yypact[yystate]; if (yyn == YYFLAG) goto yydefault; /* Not known => get a lookahead token if don't already have one. */ /* yychar is either YYEMPTY or YYEOF or a valid token in external form. */ if (yychar == YYEMPTY) { #if YYDEBUG != 0 if (yydebug) fprintf(stderr, "Reading a token: "); #endif /* MODIFICATION 8: consume the argument token * yychar = YYLEX; */ lex: if (yy_token_read) return -1; /* token consumed */ yy_token_read = 1; yychar = token; /* END MODIFICATION 8 */ } /* Convert token to internal form (in yychar1) for indexing tables with */ if (yychar <= 0) /* This means end of input. */ { yychar1 = 0; yychar = YYEOF; /* Don't call YYLEX any more */ #if YYDEBUG != 0 if (yydebug) fprintf(stderr, "Now at end of input.\n"); #endif } else { yychar1 = YYTRANSLATE(yychar); #if YYDEBUG != 0 if (yydebug) { fprintf (stderr, "Next token is %d (%s", yychar, yytname[yychar1]); /* Give the individual parser a way to print the precise meaning of a token, for further debugging info. */ #ifdef YYPRINT YYPRINT (stderr, yychar, yylval); #endif fprintf (stderr, ")\n"); } #endif } yyn += yychar1; if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != yychar1) goto yydefault; yyn = yytable[yyn]; /* yyn is what to do for this token type in this state. Negative => reduce, -yyn is rule number. Positive => shift, yyn is new state. New state is final state => don't bother to shift, just return success. 0, or most negative number => error. */ if (yyn < 0) { if (yyn == YYFLAG) goto yyerrlab; yyn = -yyn; goto yyreduce; } else if (yyn == 0) goto yyerrlab; if (yyn == YYFINAL) YYACCEPT; /* Shift the lookahead token. */ #if YYDEBUG != 0 if (yydebug) fprintf(stderr, "Shifting token %d (%s), ", yychar, yytname[yychar1]); #endif /* Discard the token being shifted unless it is eof. */ if (yychar != YYEOF) yychar = YYEMPTY; *++yyvsp = yylval; #ifdef YYLSP_NEEDED *++yylsp = yylloc; #endif /* count tokens shifted since error; after three, turn off error status. */ if (yyerrstatus) yyerrstatus--; yystate = yyn; goto yynewstate; /* Do the default action for the current state. */ yydefault: yyn = yydefact[yystate]; if (yyn == 0) goto yyerrlab; /* Do a reduction. yyn is the number of a rule to reduce with. */ yyreduce: yylen = yyr2[yyn]; if (yylen > 0) yyval = yyvsp[1-yylen]; /* implement default value of the action */ #if YYDEBUG != 0 if (yydebug) { int i; fprintf (stderr, "Reducing via rule %d (line %d), ", yyn, yyrline[yyn]); /* Print the symbols being reduced, and their result. */ for (i = yyprhs[yyn]; yyrhs[i] > 0; i++) fprintf (stderr, "%s ", yytname[yyrhs[i]]); fprintf (stderr, " -> %s\n", yytname[yyr1[yyn]]); } #endif $ /* the action file gets copied in in place of this dollarsign */ /* MODIFICATION 9: same as MODIFICATION 1 * #line 543 "/usr/local/share/bison.simple" */ #line 617 "bison/bison.simple" /* END MODIFICATION 9 */ yyvsp -= yylen; yyssp -= yylen; #ifdef YYLSP_NEEDED yylsp -= yylen; #endif #if YYDEBUG != 0 if (yydebug) { short *ssp1 = yyss - 1; fprintf (stderr, "state stack now"); while (ssp1 != yyssp) fprintf (stderr, " %d", *++ssp1); fprintf (stderr, "\n"); } #endif *++yyvsp = yyval; #ifdef YYLSP_NEEDED yylsp++; if (yylen == 0) { yylsp->first_line = yylloc.first_line; yylsp->first_column = yylloc.first_column; yylsp->last_line = (yylsp-1)->last_line; yylsp->last_column = (yylsp-1)->last_column; yylsp->text = 0; } else { yylsp->last_line = (yylsp+yylen-1)->last_line; yylsp->last_column = (yylsp+yylen-1)->last_column; } #endif /* Now "shift" the result of the reduction. Determine what state that goes to, based on the state we popped back to and the rule number reduced by. */ yyn = yyr1[yyn]; yystate = yypgoto[yyn - YYNTBASE] + *yyssp; if (yystate >= 0 && yystate <= YYLAST && yycheck[yystate] == *yyssp) yystate = yytable[yystate]; else yystate = yydefgoto[yyn - YYNTBASE]; goto yynewstate; yyerrlab: /* here on detecting error */ if (! yyerrstatus) /* If not already recovering from an error, report this error. */ { ++yynerrs; #ifdef YYERROR_VERBOSE yyn = yypact[yystate]; if (yyn > YYFLAG && yyn < YYLAST) { int size = 0; char *msg; int x, count; count = 0; /* Start X at -yyn if nec to avoid negative indexes in yycheck. */ for (x = (yyn < 0 ? -yyn : 0); x < (sizeof(yytname) / sizeof(char *)); x++) if (yycheck[x + yyn] == x) size += strlen(yytname[x]) + 15, count++; /* MODIFICATION 10: increase space for error message * msg = (char *) malloc(size + 15); */ msg = (char *) malloc(size + 100); /* END MODIFICATION 10 */ if (msg != 0) { strcpy(msg, "parse error"); /* MODIFICATION 11: print expected even when there are > 5 expected, * and print what was encountered * if (count < 5) */ sprintf(msg + strlen(msg), ", encountered `%s'", yytname[yychar1]); if (1) /* END MODIFICATION 11 */ { count = 0; for (x = (yyn < 0 ? -yyn : 0); x < (sizeof(yytname) / sizeof(char *)); x++) if (yycheck[x + yyn] == x) { /* MODIFICATION 12: indicate when there are > 5 expected but not printed */ if (count > 5) count++; else { /* END MODIFICATION 12 */ strcat(msg, count == 0 ? ", expecting `" : " or `"); strcat(msg, yytname[x]); strcat(msg, "'"); count++; /* MODIFICATION 13: indicate when there are > 5 expected but not printed * } */ } } if (count > 5) { sprintf(msg + strlen(msg), " or... (%d other possibilities)", count - 6); } /* END MODIFICATION 13 */ } yyerror(msg); free(msg); } else yyerror ("parse error; also virtual memory exceeded"); } else #endif /* YYERROR_VERBOSE */ yyerror("parse error"); } goto yyerrlab1; yyerrlab1: /* here on error raised explicitly by an action */ if (yyerrstatus == 3) { /* if just tried and failed to reuse lookahead token after an error, discard it. */ /* return failure if at end of input */ if (yychar == YYEOF) YYABORT; #if YYDEBUG != 0 if (yydebug) fprintf(stderr, "Discarding token %d (%s).\n", yychar, yytname[yychar1]); #endif yychar = YYEMPTY; } /* Else will try to reuse lookahead token after shifting the error token. */ yyerrstatus = 3; /* Each real token shifted decrements this */ goto yyerrhandle; yyerrdefault: /* current state does not do anything special for the error token. */ #if 0 /* This is wrong; only states that explicitly want error tokens should shift them. */ yyn = yydefact[yystate]; /* If its default is to accept any token, ok. Otherwise pop it.*/ if (yyn) goto yydefault; #endif yyerrpop: /* pop the current state because it cannot handle the error token */ if (yyssp == yyss) YYABORT; yyvsp--; yystate = *--yyssp; #ifdef YYLSP_NEEDED yylsp--; #endif #if YYDEBUG != 0 if (yydebug) { short *ssp1 = yyss - 1; fprintf (stderr, "Error: state stack now"); while (ssp1 != yyssp) fprintf (stderr, " %d", *++ssp1); fprintf (stderr, "\n"); } #endif yyerrhandle: yyn = yypact[yystate]; if (yyn == YYFLAG) goto yyerrdefault; yyn += YYTERROR; if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != YYTERROR) goto yyerrdefault; yyn = yytable[yyn]; if (yyn < 0) { if (yyn == YYFLAG) goto yyerrpop; yyn = -yyn; goto yyreduce; } else if (yyn == 0) goto yyerrpop; if (yyn == YYFINAL) YYACCEPT; #if YYDEBUG != 0 if (yydebug) fprintf(stderr, "Shifting error token, "); #endif *++yyvsp = yylval; #ifdef YYLSP_NEEDED *++yylsp = yylloc; #endif yystate = yyn; goto yynewstate; yyacceptlab: /* YYACCEPT comes here. */ if (yyfree_stacks) { free (yyss); free (yyvs); #ifdef YYLSP_NEEDED free (yyls); #endif } return 0; yyabortlab: /* YYABORT comes here. */ if (yyfree_stacks) { free (yyss); free (yyvs); #ifdef YYLSP_NEEDED free (yyls); #endif } return 1; } yss = yyss1; yyvs = yyvs1; #ifdef YYLSP_NEEDED yyls = yyls1; #endif #else /* no yyoverflow */ /* Extend the stack our own way. */ if tkeden1.41/bison/CVS/004070000025250000164000000000000743723741400143735ustar00ashleyem00003510000005tkeden1.41/bison/CVS/Entries010060000025250000164000000000570743723741400157300ustar00ashleyem00003510000005/bison.simple/1.4/Wed Aug 1 18:36:43 2001// D tkeden1.41/bison/CVS/Repository010060000025250000164000000000150743723741400164700ustar00ashleyem00003510000005tkeden/bison tkeden1.41/bison/CVS/Root010060000025250000164000000000550743723741400152400ustar00ashleyem00003510000005cssbz@cvs.eden.sourceforge.net:/cvsroot/eden tkeden1.41/config.guess010070000025250000164000001126530740376752600151600ustar00ashleyem00003510000005#! /bin/sh # Attempt to guess a canonical system name. # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 # Free Software Foundation, Inc. timestamp='2001-11-08' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # Originally written by Per Bothner . # Please send patches to . Submit a context # diff and a properly formatted ChangeLog entry. # # This script attempts to guess a canonical system name similar to # config.sub. If it succeeds, it prints the system name on stdout, and # exits with 0. Otherwise, it exits with 1. # # The plan is that this can be called by configure scripts if you # don't specify an explicit build system type. me=`echo "$0" | sed -e 's,.*/,,'` usage="\ Usage: $0 [OPTION] Output the configuration name of the system \`$me' is run on. Operation modes: -h, --help print this help, then exit -t, --time-stamp print date of last modification, then exit -v, --version print version number, then exit Report bugs and patches to ." version="\ GNU config.guess ($timestamp) Originally written by Per Bothner. Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." help=" Try \`$me --help' for more information." # Parse command line while test $# -gt 0 ; do case $1 in --time-stamp | --time* | -t ) echo "$timestamp" ; exit 0 ;; --version | -v ) echo "$version" ; exit 0 ;; --help | --h* | -h ) echo "$usage"; exit 0 ;; -- ) # Stop option processing shift; break ;; - ) # Use stdin as input. break ;; -* ) echo "$me: invalid option $1$help" >&2 exit 1 ;; * ) break ;; esac done if test $# != 0; then echo "$me: too many arguments$help" >&2 exit 1 fi dummy=dummy-$$ trap 'rm -f $dummy.c $dummy.o $dummy.rel $dummy; exit 1' 1 2 15 # CC_FOR_BUILD -- compiler used by this script. # Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still # use `HOST_CC' if defined, but it is deprecated. set_cc_for_build='case $CC_FOR_BUILD,$HOST_CC,$CC in ,,) echo "int dummy(){}" > $dummy.c ; for c in cc gcc c89 ; do ($c $dummy.c -c -o $dummy.o) >/dev/null 2>&1 ; if test $? = 0 ; then CC_FOR_BUILD="$c"; break ; fi ; done ; rm -f $dummy.c $dummy.o $dummy.rel ; if test x"$CC_FOR_BUILD" = x ; then CC_FOR_BUILD=no_compiler_found ; fi ;; ,,*) CC_FOR_BUILD=$CC ;; ,*,*) CC_FOR_BUILD=$HOST_CC ;; esac' # This is needed to find uname on a Pyramid OSx when run in the BSD universe. # (ghazi@noc.rutgers.edu 1994-08-24) if (test -f /.attbin/uname) >/dev/null 2>&1 ; then PATH=$PATH:/.attbin ; export PATH fi UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown # Note: order is significant - the case branches are not exclusive. case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in *:NetBSD:*:*) # NetBSD (nbsd) targets should (where applicable) match one or # more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*, # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently # switched to ELF, *-*-netbsd* would select the old # object file format. This provides both forward # compatibility and a consistent mechanism for selecting the # object file format. # Determine the machine/vendor (is the vendor relevant). case "${UNAME_MACHINE}" in amiga) machine=m68k-unknown ;; arm32) machine=arm-unknown ;; atari*) machine=m68k-atari ;; sun3*) machine=m68k-sun ;; mac68k) machine=m68k-apple ;; macppc) machine=powerpc-apple ;; hp3[0-9][05]) machine=m68k-hp ;; ibmrt|romp-ibm) machine=romp-ibm ;; sparc*) machine=`uname -p`-unknown ;; *) machine=${UNAME_MACHINE}-unknown ;; esac # The Operating System including object format, if it has switched # to ELF recently, or will in the future. case "${UNAME_MACHINE}" in i386|sparc|amiga|arm*|hp300|mvme68k|vax|atari|luna68k|mac68k|news68k|next68k|pc532|sun3*|x68k) eval $set_cc_for_build if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ | grep __ELF__ >/dev/null then # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout). # Return netbsd for either. FIX? os=netbsd else os=netbsdelf fi ;; *) os=netbsd ;; esac # The OS release release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM: # contains redundant information, the shorter form: # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. echo "${machine}-${os}${release}" exit 0 ;; amiga:OpenBSD:*:*) echo m68k-unknown-openbsd${UNAME_RELEASE} exit 0 ;; arc:OpenBSD:*:*) echo mipsel-unknown-openbsd${UNAME_RELEASE} exit 0 ;; hp300:OpenBSD:*:*) echo m68k-unknown-openbsd${UNAME_RELEASE} exit 0 ;; mac68k:OpenBSD:*:*) echo m68k-unknown-openbsd${UNAME_RELEASE} exit 0 ;; macppc:OpenBSD:*:*) echo powerpc-unknown-openbsd${UNAME_RELEASE} exit 0 ;; mvme68k:OpenBSD:*:*) echo m68k-unknown-openbsd${UNAME_RELEASE} exit 0 ;; mvme88k:OpenBSD:*:*) echo m88k-unknown-openbsd${UNAME_RELEASE} exit 0 ;; mvmeppc:OpenBSD:*:*) echo powerpc-unknown-openbsd${UNAME_RELEASE} exit 0 ;; pmax:OpenBSD:*:*) echo mipsel-unknown-openbsd${UNAME_RELEASE} exit 0 ;; sgi:OpenBSD:*:*) echo mipseb-unknown-openbsd${UNAME_RELEASE} exit 0 ;; sun3:OpenBSD:*:*) echo m68k-unknown-openbsd${UNAME_RELEASE} exit 0 ;; wgrisc:OpenBSD:*:*) echo mipsel-unknown-openbsd${UNAME_RELEASE} exit 0 ;; *:OpenBSD:*:*) echo ${UNAME_MACHINE}-unknown-openbsd${UNAME_RELEASE} exit 0 ;; alpha:OSF1:*:*) if test $UNAME_RELEASE = "V4.0"; then UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` fi # A Vn.n version is a released version. # A Tn.n version is a released field test version. # A Xn.n version is an unreleased experimental baselevel. # 1.2 uses "1.2" for uname -r. cat <$dummy.s .data \$Lformat: .byte 37,100,45,37,120,10,0 # "%d-%x\n" .text .globl main .align 4 .ent main main: .frame \$30,16,\$26,0 ldgp \$29,0(\$27) .prologue 1 .long 0x47e03d80 # implver \$0 lda \$2,-1 .long 0x47e20c21 # amask \$2,\$1 lda \$16,\$Lformat mov \$0,\$17 not \$1,\$18 jsr \$26,printf ldgp \$29,0(\$26) mov 0,\$16 jsr \$26,exit .end main EOF eval $set_cc_for_build $CC_FOR_BUILD $dummy.s -o $dummy 2>/dev/null if test "$?" = 0 ; then case `./$dummy` in 0-0) UNAME_MACHINE="alpha" ;; 1-0) UNAME_MACHINE="alphaev5" ;; 1-1) UNAME_MACHINE="alphaev56" ;; 1-101) UNAME_MACHINE="alphapca56" ;; 2-303) UNAME_MACHINE="alphaev6" ;; 2-307) UNAME_MACHINE="alphaev67" ;; 2-1307) UNAME_MACHINE="alphaev68" ;; esac fi rm -f $dummy.s $dummy echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[VTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` exit 0 ;; Alpha\ *:Windows_NT*:*) # How do we know it's Interix rather than the generic POSIX subsystem? # Should we change UNAME_MACHINE based on the output of uname instead # of the specific Alpha model? echo alpha-pc-interix exit 0 ;; 21064:Windows_NT:50:3) echo alpha-dec-winnt3.5 exit 0 ;; Amiga*:UNIX_System_V:4.0:*) echo m68k-unknown-sysv4 exit 0;; *:[Aa]miga[Oo][Ss]:*:*) echo ${UNAME_MACHINE}-unknown-amigaos exit 0 ;; *:OS/390:*:*) echo i370-ibm-openedition exit 0 ;; arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) echo arm-acorn-riscix${UNAME_RELEASE} exit 0;; SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) echo hppa1.1-hitachi-hiuxmpp exit 0;; Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*) # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE. if test "`(/bin/universe) 2>/dev/null`" = att ; then echo pyramid-pyramid-sysv3 else echo pyramid-pyramid-bsd fi exit 0 ;; NILE*:*:*:dcosx) echo pyramid-pyramid-svr4 exit 0 ;; sun4H:SunOS:5.*:*) echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit 0 ;; sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit 0 ;; i86pc:SunOS:5.*:*) echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit 0 ;; sun4*:SunOS:6*:*) # According to config.sub, this is the proper way to canonicalize # SunOS6. Hard to guess exactly what SunOS6 will be like, but # it's likely to be more like Solaris than SunOS4. echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit 0 ;; sun4*:SunOS:*:*) case "`/usr/bin/arch -k`" in Series*|S4*) UNAME_RELEASE=`uname -v` ;; esac # Japanese Language versions have a version number like `4.1.3-JL'. echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'` exit 0 ;; sun3*:SunOS:*:*) echo m68k-sun-sunos${UNAME_RELEASE} exit 0 ;; sun*:*:4.2BSD:*) UNAME_RELEASE=`(head -1 /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3 case "`/bin/arch`" in sun3) echo m68k-sun-sunos${UNAME_RELEASE} ;; sun4) echo sparc-sun-sunos${UNAME_RELEASE} ;; esac exit 0 ;; aushp:SunOS:*:*) echo sparc-auspex-sunos${UNAME_RELEASE} exit 0 ;; # The situation for MiNT is a little confusing. The machine name # can be virtually everything (everything which is not # "atarist" or "atariste" at least should have a processor # > m68000). The system name ranges from "MiNT" over "FreeMiNT" # to the lowercase version "mint" (or "freemint"). Finally # the system name "TOS" denotes a system which is actually not # MiNT. But MiNT is downward compatible to TOS, so this should # be no problem. atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} exit 0 ;; atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} exit 0 ;; *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} exit 0 ;; milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) echo m68k-milan-mint${UNAME_RELEASE} exit 0 ;; hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) echo m68k-hades-mint${UNAME_RELEASE} exit 0 ;; *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) echo m68k-unknown-mint${UNAME_RELEASE} exit 0 ;; powerpc:machten:*:*) echo powerpc-apple-machten${UNAME_RELEASE} exit 0 ;; RISC*:Mach:*:*) echo mips-dec-mach_bsd4.3 exit 0 ;; RISC*:ULTRIX:*:*) echo mips-dec-ultrix${UNAME_RELEASE} exit 0 ;; VAX*:ULTRIX*:*:*) echo vax-dec-ultrix${UNAME_RELEASE} exit 0 ;; 2020:CLIX:*:* | 2430:CLIX:*:*) echo clipper-intergraph-clix${UNAME_RELEASE} exit 0 ;; mips:*:*:UMIPS | mips:*:*:RISCos) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #ifdef __cplusplus #include /* for printf() prototype */ int main (int argc, char *argv[]) { #else int main (argc, argv) int argc; char *argv[]; { #endif #if defined (host_mips) && defined (MIPSEB) #if defined (SYSTYPE_SYSV) printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0); #endif #if defined (SYSTYPE_SVR4) printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0); #endif #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD) printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0); #endif #endif exit (-1); } EOF $CC_FOR_BUILD $dummy.c -o $dummy \ && ./$dummy `echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` \ && rm -f $dummy.c $dummy && exit 0 rm -f $dummy.c $dummy echo mips-mips-riscos${UNAME_RELEASE} exit 0 ;; Motorola:PowerMAX_OS:*:*) echo powerpc-motorola-powermax exit 0 ;; Night_Hawk:Power_UNIX:*:*) echo powerpc-harris-powerunix exit 0 ;; m88k:CX/UX:7*:*) echo m88k-harris-cxux7 exit 0 ;; m88k:*:4*:R4*) echo m88k-motorola-sysv4 exit 0 ;; m88k:*:3*:R3*) echo m88k-motorola-sysv3 exit 0 ;; AViiON:dgux:*:*) # DG/UX returns AViiON for all architectures UNAME_PROCESSOR=`/usr/bin/uname -p` if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ] then if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \ [ ${TARGET_BINARY_INTERFACE}x = x ] then echo m88k-dg-dgux${UNAME_RELEASE} else echo m88k-dg-dguxbcs${UNAME_RELEASE} fi else echo i586-dg-dgux${UNAME_RELEASE} fi exit 0 ;; M88*:DolphinOS:*:*) # DolphinOS (SVR3) echo m88k-dolphin-sysv3 exit 0 ;; M88*:*:R3*:*) # Delta 88k system running SVR3 echo m88k-motorola-sysv3 exit 0 ;; XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3) echo m88k-tektronix-sysv3 exit 0 ;; Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD) echo m68k-tektronix-bsd exit 0 ;; *:IRIX*:*:*) echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'` exit 0 ;; ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX. echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id exit 0 ;; # Note that: echo "'`uname -s`'" gives 'AIX ' i*86:AIX:*:*) echo i386-ibm-aix exit 0 ;; ia64:AIX:*:*) if [ -x /usr/bin/oslevel ] ; then IBM_REV=`/usr/bin/oslevel` else IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} fi echo ${UNAME_MACHINE}-ibm-aix${IBM_REV} exit 0 ;; *:AIX:2:3) if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #include main() { if (!__power_pc()) exit(1); puts("powerpc-ibm-aix3.2.5"); exit(0); } EOF $CC_FOR_BUILD $dummy.c -o $dummy && ./$dummy && rm -f $dummy.c $dummy && exit 0 rm -f $dummy.c $dummy echo rs6000-ibm-aix3.2.5 elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then echo rs6000-ibm-aix3.2.4 else echo rs6000-ibm-aix3.2 fi exit 0 ;; *:AIX:*:[45]) IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | head -1 | awk '{ print $1 }'` if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then IBM_ARCH=rs6000 else IBM_ARCH=powerpc fi if [ -x /usr/bin/oslevel ] ; then IBM_REV=`/usr/bin/oslevel` else IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} fi echo ${IBM_ARCH}-ibm-aix${IBM_REV} exit 0 ;; *:AIX:*:*) echo rs6000-ibm-aix exit 0 ;; ibmrt:4.4BSD:*|romp-ibm:BSD:*) echo romp-ibm-bsd4.4 exit 0 ;; ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to exit 0 ;; # report: romp-ibm BSD 4.3 *:BOSX:*:*) echo rs6000-bull-bosx exit 0 ;; DPX/2?00:B.O.S.:*:*) echo m68k-bull-sysv3 exit 0 ;; 9000/[34]??:4.3bsd:1.*:*) echo m68k-hp-bsd exit 0 ;; hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*) echo m68k-hp-bsd4.4 exit 0 ;; 9000/[34678]??:HP-UX:*:*) HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` case "${UNAME_MACHINE}" in 9000/31? ) HP_ARCH=m68000 ;; 9000/[34]?? ) HP_ARCH=m68k ;; 9000/[678][0-9][0-9]) if [ -x /usr/bin/getconf ]; then sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null` sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` case "${sc_cpu_version}" in 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1 532) # CPU_PA_RISC2_0 case "${sc_kernel_bits}" in 32) HP_ARCH="hppa2.0n" ;; 64) HP_ARCH="hppa2.0w" ;; '') HP_ARCH="hppa2.0" ;; # HP-UX 10.20 esac ;; esac fi if [ "${HP_ARCH}" = "" ]; then eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #define _HPUX_SOURCE #include #include int main () { #if defined(_SC_KERNEL_BITS) long bits = sysconf(_SC_KERNEL_BITS); #endif long cpu = sysconf (_SC_CPU_VERSION); switch (cpu) { case CPU_PA_RISC1_0: puts ("hppa1.0"); break; case CPU_PA_RISC1_1: puts ("hppa1.1"); break; case CPU_PA_RISC2_0: #if defined(_SC_KERNEL_BITS) switch (bits) { case 64: puts ("hppa2.0w"); break; case 32: puts ("hppa2.0n"); break; default: puts ("hppa2.0"); break; } break; #else /* !defined(_SC_KERNEL_BITS) */ puts ("hppa2.0"); break; #endif default: puts ("hppa1.0"); break; } exit (0); } EOF (CCOPTS= $CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null) && HP_ARCH=`./$dummy` if test -z "$HP_ARCH"; then HP_ARCH=hppa; fi rm -f $dummy.c $dummy fi ;; esac echo ${HP_ARCH}-hp-hpux${HPUX_REV} exit 0 ;; ia64:HP-UX:*:*) HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` echo ia64-hp-hpux${HPUX_REV} exit 0 ;; 3050*:HI-UX:*:*) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #include int main () { long cpu = sysconf (_SC_CPU_VERSION); /* The order matters, because CPU_IS_HP_MC68K erroneously returns true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct results, however. */ if (CPU_IS_PA_RISC (cpu)) { switch (cpu) { case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break; case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break; case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break; default: puts ("hppa-hitachi-hiuxwe2"); break; } } else if (CPU_IS_HP_MC68K (cpu)) puts ("m68k-hitachi-hiuxwe2"); else puts ("unknown-hitachi-hiuxwe2"); exit (0); } EOF $CC_FOR_BUILD $dummy.c -o $dummy && ./$dummy && rm -f $dummy.c $dummy && exit 0 rm -f $dummy.c $dummy echo unknown-hitachi-hiuxwe2 exit 0 ;; 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* ) echo hppa1.1-hp-bsd exit 0 ;; 9000/8??:4.3bsd:*:*) echo hppa1.0-hp-bsd exit 0 ;; *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*) echo hppa1.0-hp-mpeix exit 0 ;; hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* ) echo hppa1.1-hp-osf exit 0 ;; hp8??:OSF1:*:*) echo hppa1.0-hp-osf exit 0 ;; i*86:OSF1:*:*) if [ -x /usr/sbin/sysversion ] ; then echo ${UNAME_MACHINE}-unknown-osf1mk else echo ${UNAME_MACHINE}-unknown-osf1 fi exit 0 ;; parisc*:Lites*:*:*) echo hppa1.1-hp-lites exit 0 ;; C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) echo c1-convex-bsd exit 0 ;; C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) if getsysinfo -f scalar_acc then echo c32-convex-bsd else echo c2-convex-bsd fi exit 0 ;; C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) echo c34-convex-bsd exit 0 ;; C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) echo c38-convex-bsd exit 0 ;; C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) echo c4-convex-bsd exit 0 ;; CRAY*X-MP:*:*:*) echo xmp-cray-unicos exit 0 ;; CRAY*Y-MP:*:*:*) echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit 0 ;; CRAY*[A-Z]90:*:*:*) echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \ | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \ -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \ -e 's/\.[^.]*$/.X/' exit 0 ;; CRAY*TS:*:*:*) echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit 0 ;; CRAY*T3D:*:*:*) echo alpha-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit 0 ;; CRAY*T3E:*:*:*) echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit 0 ;; CRAY*SV1:*:*:*) echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit 0 ;; CRAY-2:*:*:*) echo cray2-cray-unicos exit 0 ;; F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" exit 0 ;; i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE} exit 0 ;; sparc*:BSD/OS:*:*) echo sparc-unknown-bsdi${UNAME_RELEASE} exit 0 ;; *:BSD/OS:*:*) echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE} exit 0 ;; *:FreeBSD:*:*) echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` exit 0 ;; i*:CYGWIN*:*) echo ${UNAME_MACHINE}-pc-cygwin exit 0 ;; i*:MINGW*:*) echo ${UNAME_MACHINE}-pc-mingw32 exit 0 ;; i*:PW*:*) echo ${UNAME_MACHINE}-pc-pw32 exit 0 ;; i*:Windows_NT*:* | Pentium*:Windows_NT*:*) # How do we know it's Interix rather than the generic POSIX subsystem? # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we # UNAME_MACHINE based on the output of uname instead of i386? echo i386-pc-interix exit 0 ;; i*:UWIN*:*) echo ${UNAME_MACHINE}-pc-uwin exit 0 ;; p*:CYGWIN*:*) echo powerpcle-unknown-cygwin exit 0 ;; prep*:SunOS:5.*:*) echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit 0 ;; *:GNU:*:*) echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` exit 0 ;; i*86:Minix:*:*) echo ${UNAME_MACHINE}-pc-minix exit 0 ;; arm*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit 0 ;; ia64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux exit 0 ;; m68*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit 0 ;; mips:Linux:*:*) case `sed -n '/^byte/s/^.*: \(.*\) endian/\1/p' < /proc/cpuinfo` in big) echo mips-unknown-linux-gnu && exit 0 ;; little) echo mipsel-unknown-linux-gnu && exit 0 ;; esac ;; ppc:Linux:*:*) echo powerpc-unknown-linux-gnu exit 0 ;; ppc64:Linux:*:*) echo powerpc64-unknown-linux-gnu exit 0 ;; alpha:Linux:*:*) case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in EV5) UNAME_MACHINE=alphaev5 ;; EV56) UNAME_MACHINE=alphaev56 ;; PCA56) UNAME_MACHINE=alphapca56 ;; PCA57) UNAME_MACHINE=alphapca56 ;; EV6) UNAME_MACHINE=alphaev6 ;; EV67) UNAME_MACHINE=alphaev67 ;; EV68*) UNAME_MACHINE=alphaev68 ;; esac objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} exit 0 ;; parisc:Linux:*:* | hppa:Linux:*:*) # Look for CPU level case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in PA7*) echo hppa1.1-unknown-linux-gnu ;; PA8*) echo hppa2.0-unknown-linux-gnu ;; *) echo hppa-unknown-linux-gnu ;; esac exit 0 ;; parisc64:Linux:*:* | hppa64:Linux:*:*) echo hppa64-unknown-linux-gnu exit 0 ;; s390:Linux:*:* | s390x:Linux:*:*) echo ${UNAME_MACHINE}-ibm-linux exit 0 ;; sh*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit 0 ;; sparc:Linux:*:* | sparc64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit 0 ;; x86_64:Linux:*:*) echo x86_64-unknown-linux-gnu exit 0 ;; i*86:Linux:*:*) # The BFD linker knows what the default object file format is, so # first see if it will tell us. cd to the root directory to prevent # problems with other programs or directories called `ld' in the path. ld_supported_targets=`cd /; ld --help 2>&1 \ | sed -ne '/supported targets:/!d s/[ ][ ]*/ /g s/.*supported targets: *// s/ .*// p'` case "$ld_supported_targets" in elf32-i386) TENTATIVE="${UNAME_MACHINE}-pc-linux-gnu" ;; a.out-i386-linux) echo "${UNAME_MACHINE}-pc-linux-gnuaout" exit 0 ;; coff-i386) echo "${UNAME_MACHINE}-pc-linux-gnucoff" exit 0 ;; "") # Either a pre-BFD a.out linker (linux-gnuoldld) or # one that does not give us useful --help. echo "${UNAME_MACHINE}-pc-linux-gnuoldld" exit 0 ;; esac # Determine whether the default compiler is a.out or elf eval $set_cc_for_build cat >$dummy.c < #ifdef __cplusplus #include /* for printf() prototype */ int main (int argc, char *argv[]) { #else int main (argc, argv) int argc; char *argv[]; { #endif #ifdef __ELF__ # ifdef __GLIBC__ # if __GLIBC__ >= 2 printf ("%s-pc-linux-gnu\n", argv[1]); # else printf ("%s-pc-linux-gnulibc1\n", argv[1]); # endif # else printf ("%s-pc-linux-gnulibc1\n", argv[1]); # endif #else printf ("%s-pc-linux-gnuaout\n", argv[1]); #endif return 0; } EOF $CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null && ./$dummy "${UNAME_MACHINE}" && rm -f $dummy.c $dummy && exit 0 rm -f $dummy.c $dummy test x"${TENTATIVE}" != x && echo "${TENTATIVE}" && exit 0 ;; i*86:DYNIX/ptx:4*:*) # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. # earlier versions are messed up and put the nodename in both # sysname and nodename. echo i386-sequent-sysv4 exit 0 ;; i*86:UNIX_SV:4.2MP:2.*) # Unixware is an offshoot of SVR4, but it has its own version # number series starting with 2... # I am not positive that other SVR4 systems won't match this, # I just have to hope. -- rms. # Use sysv4.2uw... so that sysv4* matches it. echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION} exit 0 ;; i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*) UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'` if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL} else echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL} fi exit 0 ;; i*86:*:5:[78]*) case `/bin/uname -X | grep "^Machine"` in *486*) UNAME_MACHINE=i486 ;; *Pentium) UNAME_MACHINE=i586 ;; *Pent*|*Celeron) UNAME_MACHINE=i686 ;; esac echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION} exit 0 ;; i*86:*:3.2:*) if test -f /usr/options/cb.name; then UNAME_REL=`sed -n 's/.*Version //p' /dev/null >/dev/null ; then UNAME_REL=`(/bin/uname -X|egrep Release|sed -e 's/.*= //')` (/bin/uname -X|egrep i80486 >/dev/null) && UNAME_MACHINE=i486 (/bin/uname -X|egrep '^Machine.*Pentium' >/dev/null) \ && UNAME_MACHINE=i586 (/bin/uname -X|egrep '^Machine.*Pent ?II' >/dev/null) \ && UNAME_MACHINE=i686 (/bin/uname -X|egrep '^Machine.*Pentium Pro' >/dev/null) \ && UNAME_MACHINE=i686 echo ${UNAME_MACHINE}-pc-sco$UNAME_REL else echo ${UNAME_MACHINE}-pc-sysv32 fi exit 0 ;; i*86:*DOS:*:*) echo ${UNAME_MACHINE}-pc-msdosdjgpp exit 0 ;; pc:*:*:*) # Left here for compatibility: # uname -m prints for DJGPP always 'pc', but it prints nothing about # the processor, so we play safe by assuming i386. echo i386-pc-msdosdjgpp exit 0 ;; Intel:Mach:3*:*) echo i386-pc-mach3 exit 0 ;; paragon:*:*:*) echo i860-intel-osf1 exit 0 ;; i860:*:4.*:*) # i860-SVR4 if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4 else # Add other i860-SVR4 vendors below as they are discovered. echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4 fi exit 0 ;; mini*:CTIX:SYS*5:*) # "miniframe" echo m68010-convergent-sysv exit 0 ;; M68*:*:R3V[567]*:*) test -r /sysV68 && echo 'm68k-motorola-sysv' && exit 0 ;; 3[34]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0) OS_REL='' test -r /etc/.relid \ && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && echo i486-ncr-sysv4.3${OS_REL} && exit 0 /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ && echo i586-ncr-sysv4.3${OS_REL} && exit 0 ;; 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && echo i486-ncr-sysv4 && exit 0 ;; m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*) echo m68k-unknown-lynxos${UNAME_RELEASE} exit 0 ;; mc68030:UNIX_System_V:4.*:*) echo m68k-atari-sysv4 exit 0 ;; i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*) echo i386-unknown-lynxos${UNAME_RELEASE} exit 0 ;; TSUNAMI:LynxOS:2.*:*) echo sparc-unknown-lynxos${UNAME_RELEASE} exit 0 ;; rs6000:LynxOS:2.*:*) echo rs6000-unknown-lynxos${UNAME_RELEASE} exit 0 ;; PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.0*:*) echo powerpc-unknown-lynxos${UNAME_RELEASE} exit 0 ;; SM[BE]S:UNIX_SV:*:*) echo mips-dde-sysv${UNAME_RELEASE} exit 0 ;; RM*:ReliantUNIX-*:*:*) echo mips-sni-sysv4 exit 0 ;; RM*:SINIX-*:*:*) echo mips-sni-sysv4 exit 0 ;; *:SINIX-*:*:*) if uname -p 2>/dev/null >/dev/null ; then UNAME_MACHINE=`(uname -p) 2>/dev/null` echo ${UNAME_MACHINE}-sni-sysv4 else echo ns32k-sni-sysv fi exit 0 ;; PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort # says echo i586-unisys-sysv4 exit 0 ;; *:UNIX_System_V:4*:FTX*) # From Gerald Hewes . # How about differentiating between stratus architectures? -djm echo hppa1.1-stratus-sysv4 exit 0 ;; *:*:*:FTX*) # From seanf@swdc.stratus.com. echo i860-stratus-sysv4 exit 0 ;; *:VOS:*:*) # From Paul.Green@stratus.com. echo hppa1.1-stratus-vos exit 0 ;; mc68*:A/UX:*:*) echo m68k-apple-aux${UNAME_RELEASE} exit 0 ;; news*:NEWS-OS:6*:*) echo mips-sony-newsos6 exit 0 ;; R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*) if [ -d /usr/nec ]; then echo mips-nec-sysv${UNAME_RELEASE} else echo mips-unknown-sysv${UNAME_RELEASE} fi exit 0 ;; BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. echo powerpc-be-beos exit 0 ;; BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only. echo powerpc-apple-beos exit 0 ;; BePC:BeOS:*:*) # BeOS running on Intel PC compatible. echo i586-pc-beos exit 0 ;; SX-4:SUPER-UX:*:*) echo sx4-nec-superux${UNAME_RELEASE} exit 0 ;; SX-5:SUPER-UX:*:*) echo sx5-nec-superux${UNAME_RELEASE} exit 0 ;; Power*:Rhapsody:*:*) echo powerpc-apple-rhapsody${UNAME_RELEASE} exit 0 ;; *:Rhapsody:*:*) echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE} exit 0 ;; *:Darwin:*:*) echo `uname -p`-apple-darwin${UNAME_RELEASE} exit 0 ;; *:procnto*:*:* | *:QNX:[0123456789]*:*) if test "${UNAME_MACHINE}" = "x86pc"; then UNAME_MACHINE=pc fi echo `uname -p`-${UNAME_MACHINE}-nto-qnx exit 0 ;; *:QNX:*:4*) echo i386-pc-qnx exit 0 ;; NSR-[KW]:NONSTOP_KERNEL:*:*) echo nsr-tandem-nsk${UNAME_RELEASE} exit 0 ;; *:NonStop-UX:*:*) echo mips-compaq-nonstopux exit 0 ;; BS2000:POSIX*:*:*) echo bs2000-siemens-sysv exit 0 ;; DS/*:UNIX_System_V:*:*) echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE} exit 0 ;; *:Plan9:*:*) # "uname -m" is not consistent, so use $cputype instead. 386 # is converted to i386 for consistency with other x86 # operating systems. if test "$cputype" = "386"; then UNAME_MACHINE=i386 else UNAME_MACHINE="$cputype" fi echo ${UNAME_MACHINE}-unknown-plan9 exit 0 ;; i*86:OS/2:*:*) # If we were able to find `uname', then EMX Unix compatibility # is probably installed. echo ${UNAME_MACHINE}-pc-os2-emx exit 0 ;; *:TOPS-10:*:*) echo pdp10-unknown-tops10 exit 0 ;; *:TENEX:*:*) echo pdp10-unknown-tenex exit 0 ;; KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*) echo pdp10-dec-tops20 exit 0 ;; XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*) echo pdp10-xkl-tops20 exit 0 ;; *:TOPS-20:*:*) echo pdp10-unknown-tops20 exit 0 ;; *:ITS:*:*) echo pdp10-unknown-its exit 0 ;; i*86:XTS-300:*:STOP) echo ${UNAME_MACHINE}-unknown-stop exit 0 ;; i*86:atheos:*:*) echo ${UNAME_MACHINE}-unknown-atheos exit 0 ;; esac #echo '(No uname command or uname output not recognized.)' 1>&2 #echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2 eval $set_cc_for_build cat >$dummy.c < # include #endif main () { #if defined (sony) #if defined (MIPSEB) /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed, I don't know.... */ printf ("mips-sony-bsd\n"); exit (0); #else #include printf ("m68k-sony-newsos%s\n", #ifdef NEWSOS4 "4" #else "" #endif ); exit (0); #endif #endif #if defined (__arm) && defined (__acorn) && defined (__unix) printf ("arm-acorn-riscix"); exit (0); #endif #if defined (hp300) && !defined (hpux) printf ("m68k-hp-bsd\n"); exit (0); #endif #if defined (NeXT) #if !defined (__ARCHITECTURE__) #define __ARCHITECTURE__ "m68k" #endif int version; version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`; if (version < 4) printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version); else printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version); exit (0); #endif #if defined (MULTIMAX) || defined (n16) #if defined (UMAXV) printf ("ns32k-encore-sysv\n"); exit (0); #else #if defined (CMU) printf ("ns32k-encore-mach\n"); exit (0); #else printf ("ns32k-encore-bsd\n"); exit (0); #endif #endif #endif #if defined (__386BSD__) printf ("i386-pc-bsd\n"); exit (0); #endif #if defined (sequent) #if defined (i386) printf ("i386-sequent-dynix\n"); exit (0); #endif #if defined (ns32000) printf ("ns32k-sequent-dynix\n"); exit (0); #endif #endif #if defined (_SEQUENT_) struct utsname un; uname(&un); if (strncmp(un.version, "V2", 2) == 0) { printf ("i386-sequent-ptx2\n"); exit (0); } if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */ printf ("i386-sequent-ptx1\n"); exit (0); } printf ("i386-sequent-ptx\n"); exit (0); #endif #if defined (vax) # if !defined (ultrix) # include # if defined (BSD) # if BSD == 43 printf ("vax-dec-bsd4.3\n"); exit (0); # else # if BSD == 199006 printf ("vax-dec-bsd4.3reno\n"); exit (0); # else printf ("vax-dec-bsd\n"); exit (0); # endif # endif # else printf ("vax-dec-bsd\n"); exit (0); # endif # else printf ("vax-dec-ultrix\n"); exit (0); # endif #endif #if defined (alliant) && defined (i860) printf ("i860-alliant-bsd\n"); exit (0); #endif exit (1); } EOF $CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null && ./$dummy && rm -f $dummy.c $dummy && exit 0 rm -f $dummy.c $dummy # Apollos put the system type in the environment. test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit 0; } # Convex versions that predate uname can use getsysinfo(1) if [ -x /usr/convex/getsysinfo ] then case `getsysinfo -f cpu_type` in c1*) echo c1-convex-bsd exit 0 ;; c2*) if getsysinfo -f scalar_acc then echo c32-convex-bsd else echo c2-convex-bsd fi exit 0 ;; c34*) echo c34-convex-bsd exit 0 ;; c38*) echo c38-convex-bsd exit 0 ;; c4*) echo c4-convex-bsd exit 0 ;; esac fi cat >&2 < in order to provide the needed information to handle your system. config.guess timestamp = $timestamp uname -m = `(uname -m) 2>/dev/null || echo unknown` uname -r = `(uname -r) 2>/dev/null || echo unknown` uname -s = `(uname -s) 2>/dev/null || echo unknown` uname -v = `(uname -v) 2>/dev/null || echo unknown` /usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null` /bin/uname -X = `(/bin/uname -X) 2>/dev/null` hostinfo = `(hostinfo) 2>/dev/null` /bin/universe = `(/bin/universe) 2>/dev/null` /usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null` /bin/arch = `(/bin/arch) 2>/dev/null` /usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null` /usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null` UNAME_MACHINE = ${UNAME_MACHINE} UNAME_RELEASE = ${UNAME_RELEASE} UNAME_SYSTEM = ${UNAME_SYSTEM} UNAME_VERSION = ${UNAME_VERSION} EOF exit 1 # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "timestamp='" # time-stamp-format: "%:y-%02m-%02d" # time-stamp-end: "'" # End: ro' >/dev/null) \ && UNAME_MACHINE=i686 echo ${UNAME_MACHINE}-pc-sco$UNAME_REL tkeden1.41/config.h.in010060000025250000164000000050570740376756700146710ustar00ashleyem00003510000005/* * $Id: config.h.in,v 1.6 2001/12/06 22:21:43 cssbz Exp $ */ /* Define if using alloca.c. */ #undef C_ALLOCA /* Define to empty if the keyword does not work. */ #undef const /* Define to one of _getb67, GETB67, getb67 for Cray-2 and Cray-YMP systems. This function is required for alloca.c support on those systems. */ #undef CRAY_STACKSEG_END /* Define if you have alloca, as a function or macro. */ #undef HAVE_ALLOCA /* Define if you have and it should be used (not on Ultrix). */ #undef HAVE_ALLOCA_H /* Define as the return type of signal handlers (int or void). */ #undef RETSIGTYPE /* If using the C implementation of alloca, define if you know the direction of stack growth for your system; otherwise it will be automatically deduced at run-time. STACK_DIRECTION > 0 => grows toward higher addresses STACK_DIRECTION < 0 => grows toward lower addresses STACK_DIRECTION = 0 => direction of growth unknown */ #undef STACK_DIRECTION /* Define if you can safely include both and . */ #undef TIME_WITH_SYS_TIME /* Define if your declares struct tm. */ #undef TM_IN_SYS_TIME /* Define if the X Window System is missing or not being used. */ #undef X_DISPLAY_MISSING /* Define if you have the dl library (-ldl). */ #undef HAVE_LIBDL /* Define if you have the m library (-lm). */ #undef HAVE_LIBM /* Define if your C compiler has protos */ #undef CC_HAS_PROTOS /* Define if you want to enable debugging */ #undef DEBUG /* Define to be (in bytes) to what boundary doubles should be aligned */ #undef DOUBLE_ALIGNMENT /* Define if you have the curses library */ #undef HAVE_CURSES /* Define if you have the ncurses library */ #undef HAVE_NCURSES /* Define if you want to use the dcc function for disabling circular checking */ #undef NO_CHECK_CIRCULAR /* Define to be something resembling the type of the system to enable configure to stop cached results being used on the wrong system */ #undef SYSTEM_NAME /* Define if you want to enable eden parser debugging */ #undef YYDEBUG /* Define if you have the dmalloc library (-ldmalloc) */ #undef HAVE_DMALLOC /* Define if you have the GNU readline library (-lreadline) */ #undef HAVE_READLINE /* Define if you want the Sasami facilities (a notation using OpenGL graphics) to be included */ #undef WANT_SASAMI /* Define if your version of Tcl has Tcl_EvalEX */ #undef HAVE_TCL_EVALEX /* Define if you want to use Eden's IPC functions (send_msg...) */ #undef ipc /* Define if you have the libgen.h header (for dirname and basename) */ #undef HAVE_LIBGEN_H tkeden1.41/config.sub010070000025250000164000000466110720653554100146120ustar00ashleyem00003510000005#! /bin/sh # Configuration validation subroutine script, version 1.1. # Copyright (C) 1991, 92-97, 1998 Free Software Foundation, Inc. # This file is (in principle) common to ALL GNU software. # The presence of a machine in this file suggests that SOME GNU software # can handle that machine. It does not imply ALL GNU software can. # # This file is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, # Boston, MA 02111-1307, USA. # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # Configuration subroutine to validate and canonicalize a configuration type. # Supply the specified configuration type as an argument. # If it is invalid, we print an error message on stderr and exit with code 1. # Otherwise, we print the canonical config type on stdout and succeed. # This file is supposed to be the same for all GNU packages # and recognize all the CPU types, system types and aliases # that are meaningful with *any* GNU software. # Each package is responsible for reporting which valid configurations # it does not support. The user should be able to distinguish # a failure to support a valid configuration from a meaningless # configuration. # The goal of this file is to map all the various variations of a given # machine specification into a single specification in the form: # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM # or in some cases, the newer four-part form: # CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM # It is wrong to echo any other type of specification. if [ x$1 = x ] then echo Configuration name missing. 1>&2 echo "Usage: $0 CPU-MFR-OPSYS" 1>&2 echo "or $0 ALIAS" 1>&2 echo where ALIAS is a recognized configuration type. 1>&2 exit 1 fi # First pass through any local machine types. case $1 in *local*) echo $1 exit 0 ;; *) ;; esac # Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any). # Here we must recognize all the valid KERNEL-OS combinations. maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` case $maybe_os in linux-gnu*) os=-$maybe_os basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` ;; *) basic_machine=`echo $1 | sed 's/-[^-]*$//'` if [ $basic_machine != $1 ] then os=`echo $1 | sed 's/.*-/-/'` else os=; fi ;; esac ### Let's recognize common machines as not being operating systems so ### that things like config.sub decstation-3100 work. We also ### recognize some manufacturers as not being operating systems, so we ### can provide default operating systems below. case $os in -sun*os*) # Prevent following clause from handling this invalid input. ;; -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \ -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \ -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \ -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\ -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \ -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \ -apple) os= basic_machine=$1 ;; -hiux*) os=-hiuxwe2 ;; -sco5) os=sco3.2v5 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco4) os=-sco3.2v4 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco3.2.[4-9]*) os=`echo $os | sed -e 's/sco3.2./sco3.2v/'` basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco3.2v[4-9]*) # Don't forget version if it is 3.2v4 or newer. basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco*) os=-sco3.2v2 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -isc) os=-isc2.2 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -clix*) basic_machine=clipper-intergraph ;; -isc*) basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -lynx*) os=-lynxos ;; -ptx*) basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'` ;; -windowsnt*) os=`echo $os | sed -e 's/windowsnt/winnt/'` ;; -psos*) os=-psos ;; esac # Decode aliases for certain CPU-COMPANY combinations. case $basic_machine in # Recognize the basic CPU types without company name. # Some are omitted here because they have special meanings below. tahoe | i860 | m32r | m68k | m68000 | m88k | ns32k | arc | arm \ | arme[lb] | pyramid | mn10200 | mn10300 | tron | a29k \ | 580 | i960 | h8300 | hppa | hppa1.0 | hppa1.1 | hppa2.0 \ | alpha | alphaev5 | alphaev56 |alphaev6 | we32k | ns16k | clipper \ | i370 | sh | powerpc | powerpcle | 1750a | dsp16xx | pdp11 \ | mips64 | mipsel | mips64el | mips64orion | mips64orionel \ | mipstx39 | mipstx39el \ | sparc | sparclet | sparclite | sparc64 | v850) basic_machine=$basic_machine-unknown ;; # We use `pc' rather than `unknown' # because (1) that's what they normally are, and # (2) the word "unknown" tends to confuse beginning users. i[34567]86) basic_machine=$basic_machine-pc ;; # Object if more than one company name word. *-*-*) echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 exit 1 ;; # Recognize the basic CPU types with company name. vax-* | tahoe-* | i[34567]86-* | i860-* | m32r-* | m68k-* | m68000-* \ | m88k-* | sparc-* | ns32k-* | fx80-* | arc-* | arm-* | c[123]* \ | mips-* | pyramid-* | tron-* | a29k-* | romp-* | rs6000-* \ | power-* | none-* | 580-* | cray2-* | h8300-* | i960-* \ | xmp-* | ymp-* | hppa-* | hppa1.0-* | hppa1.1-* | hppa2.0-* \ | alpha-* | alphaev5-* | alphaev56-* |alpha-ev6-* |alphaev6-* | we32k-* | cydra-* \ | ns16k-* | pn-* | np1-* | xps100-* | clipper-* | orion-* \ | sparclite-* | pdp11-* | sh-* | powerpc-* | powerpcle-* \ | sparc64-* | mips64-* | mipsel-* \ | mips64el-* | mips64orion-* | mips64orionel-* \ | mipstx39-* | mipstx39el-* \ | f301-*) ;; # Recognize the various machine names and aliases which stand # for a CPU type and a company and sometimes even an OS. 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc) basic_machine=m68000-att ;; 3b*) basic_machine=we32k-att ;; alliant | fx80) basic_machine=fx80-alliant ;; altos | altos3068) basic_machine=m68k-altos ;; am29k) basic_machine=a29k-none os=-bsd ;; amdahl) basic_machine=580-amdahl os=-sysv ;; amiga | amiga-*) basic_machine=m68k-cbm ;; amigaos | amigados) basic_machine=m68k-cbm os=-amigaos ;; amigaunix | amix) basic_machine=m68k-cbm os=-sysv4 ;; apollo68) basic_machine=m68k-apollo os=-sysv ;; aux) basic_machine=m68k-apple os=-aux ;; balance) basic_machine=ns32k-sequent os=-dynix ;; convex-c1) basic_machine=c1-convex os=-bsd ;; convex-c2) basic_machine=c2-convex os=-bsd ;; convex-c32) basic_machine=c32-convex os=-bsd ;; convex-c34) basic_machine=c34-convex os=-bsd ;; convex-c38) basic_machine=c38-convex os=-bsd ;; cray | ymp) basic_machine=ymp-cray os=-unicos ;; cray2) basic_machine=cray2-cray os=-unicos ;; [ctj]90-cray) basic_machine=c90-cray os=-unicos ;; crds | unos) basic_machine=m68k-crds ;; da30 | da30-*) basic_machine=m68k-da30 ;; decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn) basic_machine=mips-dec ;; delta | 3300 | motorola-3300 | motorola-delta \ | 3300-motorola | delta-motorola) basic_machine=m68k-motorola ;; delta88) basic_machine=m88k-motorola os=-sysv3 ;; dpx20 | dpx20-*) basic_machine=rs6000-bull os=-bosx ;; dpx2* | dpx2*-bull) basic_machine=m68k-bull os=-sysv3 ;; ebmon29k) basic_machine=a29k-amd os=-ebmon ;; elxsi) basic_machine=elxsi-elxsi os=-bsd ;; encore | umax | mmax) basic_machine=ns32k-encore ;; fx2800) basic_machine=i860-alliant ;; genix) basic_machine=ns32k-ns ;; gmicro) basic_machine=tron-gmicro os=-sysv ;; h3050r* | hiux*) basic_machine=hppa1.1-hitachi os=-hiuxwe2 ;; h8300hms) basic_machine=h8300-hitachi os=-hms ;; harris) basic_machine=m88k-harris os=-sysv3 ;; hp300-*) basic_machine=m68k-hp ;; hp300bsd) basic_machine=m68k-hp os=-bsd ;; hp300hpux) basic_machine=m68k-hp os=-hpux ;; hp9k2[0-9][0-9] | hp9k31[0-9]) basic_machine=m68000-hp ;; hp9k3[2-9][0-9]) basic_machine=m68k-hp ;; hp9k7[0-9][0-9] | hp7[0-9][0-9] | hp9k8[0-9]7 | hp8[0-9]7) basic_machine=hppa1.1-hp ;; hp9k8[0-9][0-9] | hp8[0-9][0-9]) basic_machine=hppa1.0-hp ;; hppa-next) os=-nextstep3 ;; i370-ibm* | ibm*) basic_machine=i370-ibm os=-mvs ;; # I'm not sure what "Sysv32" means. Should this be sysv3.2? i[34567]86v32) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv32 ;; i[34567]86v4*) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv4 ;; i[34567]86v) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv ;; i[34567]86sol2) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-solaris2 ;; iris | iris4d) basic_machine=mips-sgi case $os in -irix*) ;; *) os=-irix4 ;; esac ;; isi68 | isi) basic_machine=m68k-isi os=-sysv ;; m88k-omron*) basic_machine=m88k-omron ;; magnum | m3230) basic_machine=mips-mips os=-sysv ;; merlin) basic_machine=ns32k-utek os=-sysv ;; miniframe) basic_machine=m68000-convergent ;; mipsel*-linux*) basic_machine=mipsel-unknown os=-linux-gnu ;; mips*-linux*) basic_machine=mips-unknown os=-linux-gnu ;; mips3*-*) basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'` ;; mips3*) basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown ;; ncr3000) basic_machine=i486-ncr os=-sysv4 ;; news | news700 | news800 | news900) basic_machine=m68k-sony os=-newsos ;; news1000) basic_machine=m68030-sony os=-newsos ;; news-3600 | risc-news) basic_machine=mips-sony os=-newsos ;; next | m*-next ) basic_machine=m68k-next case $os in -nextstep* ) ;; -ns2*) os=-nextstep2 ;; *) os=-nextstep3 ;; esac ;; nh3000) basic_machine=m68k-harris os=-cxux ;; nh[45]000) basic_machine=m88k-harris os=-cxux ;; nindy960) basic_machine=i960-intel os=-nindy ;; np1) basic_machine=np1-gould ;; pa-hitachi) basic_machine=hppa1.1-hitachi os=-hiuxwe2 ;; paragon) basic_machine=i860-intel os=-osf ;; pbd) basic_machine=sparc-tti ;; pbb) basic_machine=m68k-tti ;; pc532 | pc532-*) basic_machine=ns32k-pc532 ;; pentium | p5 | k5 | nexen) basic_machine=i586-pc ;; pentiumpro | p6 | k6 | 6x86) basic_machine=i686-pc ;; pentiumii | pentium2) basic_machine=i786-pc ;; pentium-* | p5-* | k5-* | nexen-*) basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentiumpro-* | p6-* | k6-* | 6x86-*) basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentiumii-* | pentium2-*) basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pn) basic_machine=pn-gould ;; power) basic_machine=rs6000-ibm ;; ppc) basic_machine=powerpc-unknown ;; ppc-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppcle | powerpclittle | ppc-le | powerpc-little) basic_machine=powerpcle-unknown ;; ppcle-* | powerpclittle-*) basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ps2) basic_machine=i386-ibm ;; rm[46]00) basic_machine=mips-siemens ;; rtpc | rtpc-*) basic_machine=romp-ibm ;; sequent) basic_machine=i386-sequent ;; sh) basic_machine=sh-hitachi os=-hms ;; sps7) basic_machine=m68k-bull os=-sysv2 ;; spur) basic_machine=spur-unknown ;; sun2) basic_machine=m68000-sun ;; sun2os3) basic_machine=m68000-sun os=-sunos3 ;; sun2os4) basic_machine=m68000-sun os=-sunos4 ;; sun3os3) basic_machine=m68k-sun os=-sunos3 ;; sun3os4) basic_machine=m68k-sun os=-sunos4 ;; sun4os3) basic_machine=sparc-sun os=-sunos3 ;; sun4os4) basic_machine=sparc-sun os=-sunos4 ;; sun4sol2) basic_machine=sparc-sun os=-solaris2 ;; sun3 | sun3-*) basic_machine=m68k-sun ;; sun4) basic_machine=sparc-sun ;; sun386 | sun386i | roadrunner) basic_machine=i386-sun ;; symmetry) basic_machine=i386-sequent os=-dynix ;; tx39) basic_machine=mipstx39-unknown ;; tx39el) basic_machine=mipstx39el-unknown ;; tower | tower-32) basic_machine=m68k-ncr ;; udi29k) basic_machine=a29k-amd os=-udi ;; ultra3) basic_machine=a29k-nyu os=-sym1 ;; vaxv) basic_machine=vax-dec os=-sysv ;; vms) basic_machine=vax-dec os=-vms ;; vpp*|vx|vx-*) basic_machine=f301-fujitsu ;; vxworks960) basic_machine=i960-wrs os=-vxworks ;; vxworks68) basic_machine=m68k-wrs os=-vxworks ;; vxworks29k) basic_machine=a29k-wrs os=-vxworks ;; xmp) basic_machine=xmp-cray os=-unicos ;; xps | xps100) basic_machine=xps100-honeywell ;; none) basic_machine=none-none os=-none ;; # Here we handle the default manufacturer of certain CPU types. It is in # some cases the only manufacturer, in others, it is the most popular. mips) if [ x$os = x-linux-gnu ]; then basic_machine=mips-unknown else basic_machine=mips-mips fi ;; romp) basic_machine=romp-ibm ;; rs6000) basic_machine=rs6000-ibm ;; vax) basic_machine=vax-dec ;; pdp11) basic_machine=pdp11-dec ;; we32k) basic_machine=we32k-att ;; sparc) basic_machine=sparc-sun ;; cydra) basic_machine=cydra-cydrome ;; orion) basic_machine=orion-highlevel ;; orion105) basic_machine=clipper-highlevel ;; *) echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 exit 1 ;; esac # Here we canonicalize certain aliases for manufacturers. case $basic_machine in *-digital*) basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'` ;; *-commodore*) basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'` ;; *) ;; esac # Decode manufacturer-specific aliases for certain operating systems. if [ x"$os" != x"" ] then case $os in # First match some system type aliases # that might get confused with valid system types. # -solaris* is a basic system type, with this one exception. -solaris1 | -solaris1.*) os=`echo $os | sed -e 's|solaris1|sunos4|'` ;; -solaris) os=-solaris2 ;; -svr4*) os=-sysv4 ;; -unixware*) os=-sysv4.2uw ;; -gnu/linux*) os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'` ;; # First accept the basic system types. # The portable systems comes first. # Each alternative MUST END IN A *, to match a version number. # -sysv* is not here because it comes later, after sysvr4. -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \ | -*vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[34]*\ | -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \ | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ | -aos* \ | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ | -hiux* | -386bsd* | -netbsd* | -openbsd* | -freebsd* | -riscix* \ | -lynxos* | -bosx* | -nextstep* | -cxux* | -aout* | -elf* \ | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ | -mingw32* | -linux-gnu* | -uxpv* | -beos*) # Remember, each alternative MUST END IN *, to match a version number. ;; -linux*) os=`echo $os | sed -e 's|linux|linux-gnu|'` ;; -sunos5*) os=`echo $os | sed -e 's|sunos5|solaris2|'` ;; -sunos6*) os=`echo $os | sed -e 's|sunos6|solaris3|'` ;; -osfrose*) os=-osfrose ;; -osf*) os=-osf ;; -utek*) os=-bsd ;; -dynix*) os=-bsd ;; -acis*) os=-aos ;; -ctix* | -uts*) os=-sysv ;; -ns2 ) os=-nextstep2 ;; # Preserve the version number of sinix5. -sinix5.*) os=`echo $os | sed -e 's|sinix|sysv|'` ;; -sinix*) os=-sysv4 ;; -triton*) os=-sysv3 ;; -oss*) os=-sysv3 ;; -svr4) os=-sysv4 ;; -svr3) os=-sysv3 ;; -sysvr4) os=-sysv4 ;; # This must come after -sysvr4. -sysv*) ;; -xenix) os=-xenix ;; -none) ;; *) # Get rid of the `-' at the beginning of $os. os=`echo $os | sed 's/[^-]*-//'` echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2 exit 1 ;; esac else # Here we handle the default operating systems that come with various machines. # The value should be what the vendor currently ships out the door with their # machine or put another way, the most popular os provided with the machine. # Note that if you're going to try to match "-MANUFACTURER" here (say, # "-sun"), then you have to tell the case statement up towards the top # that MANUFACTURER isn't an operating system. Otherwise, code above # will signal an error saying that MANUFACTURER isn't an operating # system, and we'll never get to this point. case $basic_machine in *-acorn) os=-riscix1.2 ;; arm*-semi) os=-aout ;; pdp11-*) os=-none ;; *-dec | vax-*) os=-ultrix4.2 ;; m68*-apollo) os=-domain ;; i386-sun) os=-sunos4.0.2 ;; m68000-sun) os=-sunos3 # This also exists in the configure program, but was not the # default. # os=-sunos4 ;; *-tti) # must be before sparc entry or we get the wrong os. os=-sysv3 ;; sparc-* | *-sun) os=-sunos4.1.1 ;; *-be) os=-beos ;; *-ibm) os=-aix ;; *-hp) os=-hpux ;; *-hitachi) os=-hiux ;; i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent) os=-sysv ;; *-cbm) os=-amigaos ;; *-dg) os=-dgux ;; *-dolphin) os=-sysv3 ;; m68k-ccur) os=-rtu ;; m88k-omron*) os=-luna ;; *-next ) os=-nextstep ;; *-sequent) os=-ptx ;; *-crds) os=-unos ;; *-ns) os=-genix ;; i370-*) os=-mvs ;; *-next) os=-nextstep3 ;; *-gould) os=-sysv ;; *-highlevel) os=-bsd ;; *-encore) os=-bsd ;; *-sgi) os=-irix ;; *-siemens) os=-sysv4 ;; *-masscomp) os=-rtu ;; f301-fujitsu) os=-uxpv ;; *) os=-none ;; esac fi # Here we handle the case where we know the os, and the CPU type, but not the # manufacturer. We pick the logical manufacturer. vendor=unknown case $basic_machine in *-unknown) case $os in -riscix*) vendor=acorn ;; -sunos*) vendor=sun ;; -aix*) vendor=ibm ;; -hpux*) vendor=hp ;; -hiux*) vendor=hitachi ;; -unos*) vendor=crds ;; -dgux*) vendor=dg ;; -luna*) vendor=omron ;; -genix*) vendor=ns ;; -mvs*) vendor=ibm ;; -ptx*) vendor=sequent ;; -vxsim* | -vxworks*) vendor=wrs ;; -aux*) vendor=apple ;; esac basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"` ;; esac echo $basic_machine$os 86.*/86-pc/'` os=-sysv ;; i[34567]86sol2) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-solaris2 ;; tkeden1.41/configure010070000025250000164000006021240743723756200145430ustar00ashleyem00003510000005#! /bin/sh # From configure.in Revision: 1.22 # Check this file exists to make sure we are in the correct directory # Guess values for system-dependent variables and create Makefiles. # Generated automatically using autoconf version 2.13 # Copyright (C) 1992, 93, 94, 95, 96 Free Software Foundation, Inc. # # This configure script is free software; the Free Software Foundation # gives unlimited permission to copy, distribute and modify it. # Defaults: ac_help= ac_default_prefix=/usr/local # Any additions from configure.in: ac_help="$ac_help --enable-debug enable debugging" ac_help="$ac_help --enable-dcc enable dcc function for disabling circular checking" ac_help="$ac_help --enable-depend enable Makefile source dependency checking" ac_help="$ac_help --enable-disable-sasami don't try to build the Sasami OpenGL notation" ac_help="$ac_help --enable-ipc enable support for Eden IPC functions (send_msg...)" ac_help="$ac_help --with-x use the X Window System" ac_help="$ac_help --with-curses-include=DIR (n)curses include files are in DIR" ac_help="$ac_help --with-curses-lib=DIR (n)curses library files are in DIR" ac_help="$ac_help --with-tcl-include=compiler options to enable location of tcl.h eg \"-I/usr/local/include\"" ac_help="$ac_help --with-tcl-lib=linker options to enable location of the tcl library eg \"-L/usr/local/lib -R/usr/local/lib -ltcl\"" ac_help="$ac_help --with-tk-include=compiler options to enable location of tk.h eg \"-I/usr/local/include\"" ac_help="$ac_help --with-tk-lib=linker options to enable location of the tk library eg \"-L/usr/local/lib -R/usr/local/lib -ltk\"" ac_help="$ac_help --with-readline-include=compiler options to enable location of GNU readline header files eg \"-I/gnu/include/readline\"" ac_help="$ac_help --with-readline-lib=linker options to enable location of the GNU readline library eg \"-L/gnu/lib -R/gnu/lib -lreadline\"" ac_help="$ac_help --with-gl-include=compiler options to enable location of GL header files eg \"-I/usr/openwin/include\"" ac_help="$ac_help --with-gl-lib=linker options to enable location of the GL library eg \"-L/usr/openwin/lib -R/usr/openwin/lib -lGL\"" ac_help="$ac_help --with-png-include=compiler options to enable location of PNG header files eg \"-I/usr/local/include\"" ac_help="$ac_help --with-png-lib=linker options to enable location of the PNG library eg \"-L/usr/local/lib -R/usr/local/lib -lpng\"" ac_help="$ac_help --with-dmalloc-include=DIR dmalloc include file is in DIR" ac_help="$ac_help --with-dmalloc-lib=DIR dmalloc lib file is in DIR" # Initialize some variables set by options. # The variables have the same names as the options, with # dashes changed to underlines. build=NONE cache_file=./config.cache exec_prefix=NONE host=NONE no_create= nonopt=NONE no_recursion= prefix=NONE program_prefix=NONE program_suffix=NONE program_transform_name=s,x,x, silent= site= srcdir= target=NONE verbose= x_includes=NONE x_libraries=NONE bindir='${exec_prefix}/bin' sbindir='${exec_prefix}/sbin' libexecdir='${exec_prefix}/libexec' datadir='${prefix}/share' sysconfdir='${prefix}/etc' sharedstatedir='${prefix}/com' localstatedir='${prefix}/var' libdir='${exec_prefix}/lib' includedir='${prefix}/include' oldincludedir='/usr/include' infodir='${prefix}/info' mandir='${prefix}/man' # Initialize some other variables. subdirs= MFLAGS= MAKEFLAGS= SHELL=${CONFIG_SHELL-/bin/sh} # Maximum number of lines to put in a shell here document. ac_max_here_lines=12 ac_prev= for ac_option do # If the previous option needs an argument, assign it. if test -n "$ac_prev"; then eval "$ac_prev=\$ac_option" ac_prev= continue fi case "$ac_option" in -*=*) ac_optarg=`echo "$ac_option" | sed 's/[-_a-zA-Z0-9]*=//'` ;; *) ac_optarg= ;; esac # Accept the important Cygnus configure options, so we can diagnose typos. case "$ac_option" in -bindir | --bindir | --bindi | --bind | --bin | --bi) ac_prev=bindir ;; -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) bindir="$ac_optarg" ;; -build | --build | --buil | --bui | --bu) ac_prev=build ;; -build=* | --build=* | --buil=* | --bui=* | --bu=*) build="$ac_optarg" ;; -cache-file | --cache-file | --cache-fil | --cache-fi \ | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) ac_prev=cache_file ;; -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) cache_file="$ac_optarg" ;; -datadir | --datadir | --datadi | --datad | --data | --dat | --da) ac_prev=datadir ;; -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \ | --da=*) datadir="$ac_optarg" ;; -disable-* | --disable-*) ac_feature=`echo $ac_option|sed -e 's/-*disable-//'` # Reject names that are not valid shell variable names. if test -n "`echo $ac_feature| sed 's/[-a-zA-Z0-9_]//g'`"; then { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; } fi ac_feature=`echo $ac_feature| sed 's/-/_/g'` eval "enable_${ac_feature}=no" ;; -enable-* | --enable-*) ac_feature=`echo $ac_option|sed -e 's/-*enable-//' -e 's/=.*//'` # Reject names that are not valid shell variable names. if test -n "`echo $ac_feature| sed 's/[-_a-zA-Z0-9]//g'`"; then { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; } fi ac_feature=`echo $ac_feature| sed 's/-/_/g'` case "$ac_option" in *=*) ;; *) ac_optarg=yes ;; esac eval "enable_${ac_feature}='$ac_optarg'" ;; -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ | --exec | --exe | --ex) ac_prev=exec_prefix ;; -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ | --exec=* | --exe=* | --ex=*) exec_prefix="$ac_optarg" ;; -gas | --gas | --ga | --g) # Obsolete; use --with-gas. with_gas=yes ;; -help | --help | --hel | --he) # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat << EOF Usage: configure [options] [host] Options: [defaults in brackets after descriptions] Configuration: --cache-file=FILE cache test results in FILE --help print this message --no-create do not create output files --quiet, --silent do not print \`checking...' messages --version print the version of autoconf that created configure Directory and file names: --prefix=PREFIX install architecture-independent files in PREFIX [$ac_default_prefix] --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX [same as prefix] --bindir=DIR user executables in DIR [EPREFIX/bin] --sbindir=DIR system admin executables in DIR [EPREFIX/sbin] --libexecdir=DIR program executables in DIR [EPREFIX/libexec] --datadir=DIR read-only architecture-independent data in DIR [PREFIX/share] --sysconfdir=DIR read-only single-machine data in DIR [PREFIX/etc] --sharedstatedir=DIR modifiable architecture-independent data in DIR [PREFIX/com] --localstatedir=DIR modifiable single-machine data in DIR [PREFIX/var] --libdir=DIR object code libraries in DIR [EPREFIX/lib] --includedir=DIR C header files in DIR [PREFIX/include] --oldincludedir=DIR C header files for non-gcc in DIR [/usr/include] --infodir=DIR info documentation in DIR [PREFIX/info] --mandir=DIR man documentation in DIR [PREFIX/man] --srcdir=DIR find the sources in DIR [configure dir or ..] --program-prefix=PREFIX prepend PREFIX to installed program names --program-suffix=SUFFIX append SUFFIX to installed program names --program-transform-name=PROGRAM run sed PROGRAM on installed program names EOF cat << EOF Host type: --build=BUILD configure for building on BUILD [BUILD=HOST] --host=HOST configure for HOST [guessed] --target=TARGET configure for TARGET [TARGET=HOST] Features and packages: --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) --enable-FEATURE[=ARG] include FEATURE [ARG=yes] --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) --x-includes=DIR X include files are in DIR --x-libraries=DIR X library files are in DIR EOF if test -n "$ac_help"; then echo "--enable and --with options recognized:$ac_help" fi exit 0 ;; -host | --host | --hos | --ho) ac_prev=host ;; -host=* | --host=* | --hos=* | --ho=*) host="$ac_optarg" ;; -includedir | --includedir | --includedi | --included | --include \ | --includ | --inclu | --incl | --inc) ac_prev=includedir ;; -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ | --includ=* | --inclu=* | --incl=* | --inc=*) includedir="$ac_optarg" ;; -infodir | --infodir | --infodi | --infod | --info | --inf) ac_prev=infodir ;; -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) infodir="$ac_optarg" ;; -libdir | --libdir | --libdi | --libd) ac_prev=libdir ;; -libdir=* | --libdir=* | --libdi=* | --libd=*) libdir="$ac_optarg" ;; -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ | --libexe | --libex | --libe) ac_prev=libexecdir ;; -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ | --libexe=* | --libex=* | --libe=*) libexecdir="$ac_optarg" ;; -localstatedir | --localstatedir | --localstatedi | --localstated \ | --localstate | --localstat | --localsta | --localst \ | --locals | --local | --loca | --loc | --lo) ac_prev=localstatedir ;; -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ | --localstate=* | --localstat=* | --localsta=* | --localst=* \ | --locals=* | --local=* | --loca=* | --loc=* | --lo=*) localstatedir="$ac_optarg" ;; -mandir | --mandir | --mandi | --mand | --man | --ma | --m) ac_prev=mandir ;; -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) mandir="$ac_optarg" ;; -nfp | --nfp | --nf) # Obsolete; use --without-fp. with_fp=no ;; -no-create | --no-create | --no-creat | --no-crea | --no-cre \ | --no-cr | --no-c) no_create=yes ;; -no-recursion | --no-recursion | --no-recursio | --no-recursi \ | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) no_recursion=yes ;; -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ | --oldin | --oldi | --old | --ol | --o) ac_prev=oldincludedir ;; -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) oldincludedir="$ac_optarg" ;; -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) ac_prev=prefix ;; -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) prefix="$ac_optarg" ;; -program-prefix | --program-prefix | --program-prefi | --program-pref \ | --program-pre | --program-pr | --program-p) ac_prev=program_prefix ;; -program-prefix=* | --program-prefix=* | --program-prefi=* \ | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) program_prefix="$ac_optarg" ;; -program-suffix | --program-suffix | --program-suffi | --program-suff \ | --program-suf | --program-su | --program-s) ac_prev=program_suffix ;; -program-suffix=* | --program-suffix=* | --program-suffi=* \ | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) program_suffix="$ac_optarg" ;; -program-transform-name | --program-transform-name \ | --program-transform-nam | --program-transform-na \ | --program-transform-n | --program-transform- \ | --program-transform | --program-transfor \ | --program-transfo | --program-transf \ | --program-trans | --program-tran \ | --progr-tra | --program-tr | --program-t) ac_prev=program_transform_name ;; -program-transform-name=* | --program-transform-name=* \ | --program-transform-nam=* | --program-transform-na=* \ | --program-transform-n=* | --program-transform-=* \ | --program-transform=* | --program-transfor=* \ | --program-transfo=* | --program-transf=* \ | --program-trans=* | --program-tran=* \ | --progr-tra=* | --program-tr=* | --program-t=*) program_transform_name="$ac_optarg" ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) silent=yes ;; -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) ac_prev=sbindir ;; -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ | --sbi=* | --sb=*) sbindir="$ac_optarg" ;; -sharedstatedir | --sharedstatedir | --sharedstatedi \ | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ | --sharedst | --shareds | --shared | --share | --shar \ | --sha | --sh) ac_prev=sharedstatedir ;; -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ | --sha=* | --sh=*) sharedstatedir="$ac_optarg" ;; -site | --site | --sit) ac_prev=site ;; -site=* | --site=* | --sit=*) site="$ac_optarg" ;; -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) ac_prev=srcdir ;; -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) srcdir="$ac_optarg" ;; -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ | --syscon | --sysco | --sysc | --sys | --sy) ac_prev=sysconfdir ;; -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) sysconfdir="$ac_optarg" ;; -target | --target | --targe | --targ | --tar | --ta | --t) ac_prev=target ;; -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) target="$ac_optarg" ;; -v | -verbose | --verbose | --verbos | --verbo | --verb) verbose=yes ;; -version | --version | --versio | --versi | --vers) echo "configure generated by autoconf version 2.13" exit 0 ;; -with-* | --with-*) ac_package=`echo $ac_option|sed -e 's/-*with-//' -e 's/=.*//'` # Reject names that are not valid shell variable names. if test -n "`echo $ac_package| sed 's/[-_a-zA-Z0-9]//g'`"; then { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; } fi ac_package=`echo $ac_package| sed 's/-/_/g'` case "$ac_option" in *=*) ;; *) ac_optarg=yes ;; esac eval "with_${ac_package}='$ac_optarg'" ;; -without-* | --without-*) ac_package=`echo $ac_option|sed -e 's/-*without-//'` # Reject names that are not valid shell variable names. if test -n "`echo $ac_package| sed 's/[-a-zA-Z0-9_]//g'`"; then { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; } fi ac_package=`echo $ac_package| sed 's/-/_/g'` eval "with_${ac_package}=no" ;; --x) # Obsolete; use --with-x. with_x=yes ;; -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ | --x-incl | --x-inc | --x-in | --x-i) ac_prev=x_includes ;; -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) x_includes="$ac_optarg" ;; -x-libraries | --x-libraries | --x-librarie | --x-librari \ | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) ac_prev=x_libraries ;; -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) x_libraries="$ac_optarg" ;; -*) { echo "configure: error: $ac_option: invalid option; use --help to show usage" 1>&2; exit 1; } ;; *) if test -n "`echo $ac_option| sed 's/[-a-z0-9.]//g'`"; then echo "configure: warning: $ac_option: invalid host type" 1>&2 fi if test "x$nonopt" != xNONE; then { echo "configure: error: can only configure for one host and one target at a time" 1>&2; exit 1; } fi nonopt="$ac_option" ;; esac done if test -n "$ac_prev"; then { echo "configure: error: missing argument to --`echo $ac_prev | sed 's/_/-/g'`" 1>&2; exit 1; } fi trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15 # File descriptor usage: # 0 standard input # 1 file creation # 2 errors and warnings # 3 some systems may open it to /dev/tty # 4 used on the Kubota Titan # 6 checking for... messages and results # 5 compiler messages saved in config.log if test "$silent" = yes; then exec 6>/dev/null else exec 6>&1 fi exec 5>./config.log echo "\ This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. " 1>&5 # Strip out --no-create and --no-recursion so they do not pile up. # Also quote any args containing shell metacharacters. ac_configure_args= for ac_arg do case "$ac_arg" in -no-create | --no-create | --no-creat | --no-crea | --no-cre \ | --no-cr | --no-c) ;; -no-recursion | --no-recursion | --no-recursio | --no-recursi \ | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) ;; *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?]*) ac_configure_args="$ac_configure_args '$ac_arg'" ;; *) ac_configure_args="$ac_configure_args $ac_arg" ;; esac done # NLS nuisances. # Only set these to C if already set. These must not be set unconditionally # because not all systems understand e.g. LANG=C (notably SCO). # Fixing LC_MESSAGES prevents Solaris sh from translating var values in `set'! # Non-C LC_CTYPE values break the ctype check. if test "${LANG+set}" = set; then LANG=C; export LANG; fi if test "${LC_ALL+set}" = set; then LC_ALL=C; export LC_ALL; fi if test "${LC_MESSAGES+set}" = set; then LC_MESSAGES=C; export LC_MESSAGES; fi if test "${LC_CTYPE+set}" = set; then LC_CTYPE=C; export LC_CTYPE; fi # confdefs.h avoids OS command line length limits that DEFS can exceed. rm -rf conftest* confdefs.h # AIX cpp loses on an empty file, so make sure it contains at least a newline. echo > confdefs.h # A filename unique to this package, relative to the directory that # configure is in, which we can look for to find out if srcdir is correct. ac_unique_file=Eden/main.c # Find the source files, if location was not specified. if test -z "$srcdir"; then ac_srcdir_defaulted=yes # Try the directory containing this script, then its parent. ac_prog=$0 ac_confdir=`echo $ac_prog|sed 's%/[^/][^/]*$%%'` test "x$ac_confdir" = "x$ac_prog" && ac_confdir=. srcdir=$ac_confdir if test ! -r $srcdir/$ac_unique_file; then srcdir=.. fi else ac_srcdir_defaulted=no fi if test ! -r $srcdir/$ac_unique_file; then if test "$ac_srcdir_defaulted" = yes; then { echo "configure: error: can not find sources in $ac_confdir or .." 1>&2; exit 1; } else { echo "configure: error: can not find sources in $srcdir" 1>&2; exit 1; } fi fi srcdir=`echo "${srcdir}" | sed 's%\([^/]\)/*$%\1%'` # Prefer explicitly selected file to automatically selected ones. if test -z "$CONFIG_SITE"; then if test "x$prefix" != xNONE; then CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site" else CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site" fi fi for ac_site_file in $CONFIG_SITE; do if test -r "$ac_site_file"; then echo "loading site script $ac_site_file" . "$ac_site_file" fi done if test -r "$cache_file"; then echo "loading cache $cache_file" . $cache_file else echo "creating cache $cache_file" > $cache_file fi ac_ext=c # CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. ac_cpp='$CPP $CPPFLAGS' ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' cross_compiling=$ac_cv_prog_cc_cross ac_exeext= ac_objext=o if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then # Stardent Vistra SVR4 grep lacks -e, says ghazi@caip.rutgers.edu. if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then ac_n= ac_c=' ' ac_t=' ' else ac_n=-n ac_c= ac_t= fi else ac_n= ac_c='\c' ac_t= fi # Sanity check ac_aux_dir= for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do if test -f $ac_dir/install-sh; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/install-sh -c" break elif test -f $ac_dir/install.sh; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/install.sh -c" break fi done if test -z "$ac_aux_dir"; then { echo "configure: error: can not find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." 1>&2; exit 1; } fi ac_config_guess=$ac_aux_dir/config.guess ac_config_sub=$ac_aux_dir/config.sub ac_configure=$ac_aux_dir/configure # This should be Cygnus configure. # # Check if we're accidentally using a cache from a different machine. # Derive the system name, as a check for reusing the autoconf cache. # # If we've packaged config.guess and config.sub, run that (since it does a # better job than uname). # if test -f $srcdir/config.guess ; then # Make sure we can run config.sub. if ${CONFIG_SHELL-/bin/sh} $ac_config_sub sun4 >/dev/null 2>&1; then : else { echo "configure: error: can not run $ac_config_sub" 1>&2; exit 1; } fi echo $ac_n "checking host system type""... $ac_c" 1>&6 echo "configure:627: checking host system type" >&5 host_alias=$host case "$host_alias" in NONE) case $nonopt in NONE) if host_alias=`${CONFIG_SHELL-/bin/sh} $ac_config_guess`; then : else { echo "configure: error: can not guess host type; you must specify one" 1>&2; exit 1; } fi ;; *) host_alias=$nonopt ;; esac ;; esac host=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $host_alias` host_cpu=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` host_vendor=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` host_os=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` echo "$ac_t""$host" 1>&6 system_name="$host_os" else system_name="`(uname -s -r) 2>/dev/null`" if test -z "$system_name" ; then system_name="`(hostname) 2>/dev/null`" fi fi test -n "$system_name" && cat >> confdefs.h <&6 else cf_cv_system_name="$system_name" fi test -z "$system_name" && system_name="$cf_cv_system_name" test -n "$cf_cv_system_name" && echo "$ac_t"""Configuring for $cf_cv_system_name"" 1>&6 if test ".$system_name" != ".$cf_cv_system_name" ; then echo "$ac_t"""Cached system name does not agree with actual"" 1>&6 { echo "configure: error: "Please remove config.cache and try again."" 1>&2; exit 1; } fi # !@!@ Not sure if all of these are required # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 echo "configure:678: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" ac_dummy="$PATH" for ac_dir in $ac_dummy; do test -z "$ac_dir" && ac_dir=. if test -f $ac_dir/$ac_word; then ac_cv_prog_CC="gcc" break fi done IFS="$ac_save_ifs" fi fi CC="$ac_cv_prog_CC" if test -n "$CC"; then echo "$ac_t""$CC" 1>&6 else echo "$ac_t""no" 1>&6 fi if test -z "$CC"; then # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 echo "configure:708: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" ac_prog_rejected=no ac_dummy="$PATH" for ac_dir in $ac_dummy; do test -z "$ac_dir" && ac_dir=. if test -f $ac_dir/$ac_word; then if test "$ac_dir/$ac_word" = "/usr/ucb/cc"; then ac_prog_rejected=yes continue fi ac_cv_prog_CC="cc" break fi done IFS="$ac_save_ifs" if test $ac_prog_rejected = yes; then # We found a bogon in the path, so make sure we never use it. set dummy $ac_cv_prog_CC shift if test $# -gt 0; then # We chose a different compiler from the bogus one. # However, it has the same basename, so the bogon will be chosen # first if we set CC to just the basename; use the full file name. shift set dummy "$ac_dir/$ac_word" "$@" shift ac_cv_prog_CC="$@" fi fi fi fi CC="$ac_cv_prog_CC" if test -n "$CC"; then echo "$ac_t""$CC" 1>&6 else echo "$ac_t""no" 1>&6 fi if test -z "$CC"; then case "`uname -s`" in *win32* | *WIN32*) # Extract the first word of "cl", so it can be a program name with args. set dummy cl; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 echo "configure:759: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" ac_dummy="$PATH" for ac_dir in $ac_dummy; do test -z "$ac_dir" && ac_dir=. if test -f $ac_dir/$ac_word; then ac_cv_prog_CC="cl" break fi done IFS="$ac_save_ifs" fi fi CC="$ac_cv_prog_CC" if test -n "$CC"; then echo "$ac_t""$CC" 1>&6 else echo "$ac_t""no" 1>&6 fi ;; esac fi test -z "$CC" && { echo "configure: error: no acceptable cc found in \$PATH" 1>&2; exit 1; } fi echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6 echo "configure:791: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 ac_ext=c # CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. ac_cpp='$CPP $CPPFLAGS' ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' cross_compiling=$ac_cv_prog_cc_cross cat > conftest.$ac_ext << EOF #line 802 "configure" #include "confdefs.h" main(){return(0);} EOF if { (eval echo configure:807: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then ac_cv_prog_cc_works=yes # If we can't run a trivial program, we are probably using a cross compiler. if (./conftest; exit) 2>/dev/null; then ac_cv_prog_cc_cross=no else ac_cv_prog_cc_cross=yes fi else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 ac_cv_prog_cc_works=no fi rm -fr conftest* ac_ext=c # CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. ac_cpp='$CPP $CPPFLAGS' ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' cross_compiling=$ac_cv_prog_cc_cross echo "$ac_t""$ac_cv_prog_cc_works" 1>&6 if test $ac_cv_prog_cc_works = no; then { echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; } fi echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6 echo "configure:833: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6 cross_compiling=$ac_cv_prog_cc_cross echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6 echo "configure:838: checking whether we are using GNU C" >&5 if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.c <&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then ac_cv_prog_gcc=yes else ac_cv_prog_gcc=no fi fi echo "$ac_t""$ac_cv_prog_gcc" 1>&6 if test $ac_cv_prog_gcc = yes; then GCC=yes else GCC= fi ac_test_CFLAGS="${CFLAGS+set}" ac_save_CFLAGS="$CFLAGS" CFLAGS= echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6 echo "configure:866: checking whether ${CC-cc} accepts -g" >&5 if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else echo 'void f(){}' > conftest.c if test -z "`${CC-cc} -g -c conftest.c 2>&1`"; then ac_cv_prog_cc_g=yes else ac_cv_prog_cc_g=no fi rm -f conftest* fi echo "$ac_t""$ac_cv_prog_cc_g" 1>&6 if test "$ac_test_CFLAGS" = set; then CFLAGS="$ac_save_CFLAGS" elif test $ac_cv_prog_cc_g = yes; then if test "$GCC" = yes; then CFLAGS="-g -O2" else CFLAGS="-g" fi else if test "$GCC" = yes; then CFLAGS="-O2" else CFLAGS= fi fi echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6 echo "configure:898: checking how to run the C preprocessor" >&5 # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then CPP= fi if test -z "$CPP"; then if eval "test \"`echo '$''{'ac_cv_prog_CPP'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else # This must be in double quotes, not single quotes, because CPP may get # substituted into the Makefile and "${CC-cc}" will confuse make. CPP="${CC-cc} -E" # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. cat > conftest.$ac_ext < Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" { (eval echo configure:919: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then : else echo "$ac_err" >&5 echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* CPP="${CC-cc} -E -traditional-cpp" cat > conftest.$ac_ext < Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" { (eval echo configure:936: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then : else echo "$ac_err" >&5 echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* CPP="${CC-cc} -nologo -E" cat > conftest.$ac_ext < Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" { (eval echo configure:953: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then : else echo "$ac_err" >&5 echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* CPP=/lib/cpp fi rm -f conftest* fi rm -f conftest* fi rm -f conftest* ac_cv_prog_CPP="$CPP" fi CPP="$ac_cv_prog_CPP" else ac_cv_prog_CPP="$CPP" fi echo "$ac_t""$CPP" 1>&6 # Find a good install program. We prefer a C program (faster), # so one script is as good as another. But avoid the broken or # incompatible versions: # SysV /etc/install, /usr/sbin/install # SunOS /usr/etc/install # IRIX /sbin/install # AIX /bin/install # AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag # AFS /usr/afsws/bin/install, which mishandles nonexistent args # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" # ./install, which can be erroneously created by make from ./install.sh. echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6 echo "configure:989: checking for a BSD compatible install" >&5 if test -z "$INSTALL"; then if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else IFS="${IFS= }"; ac_save_IFS="$IFS"; IFS=":" for ac_dir in $PATH; do # Account for people who put trailing slashes in PATH elements. case "$ac_dir/" in /|./|.//|/etc/*|/usr/sbin/*|/usr/etc/*|/sbin/*|/usr/afsws/bin/*|/usr/ucb/*) ;; *) # OSF1 and SCO ODT 3.0 have their own names for install. # Don't use installbsd from OSF since it installs stuff as root # by default. for ac_prog in ginstall scoinst install; do if test -f $ac_dir/$ac_prog; then if test $ac_prog = install && grep dspmsg $ac_dir/$ac_prog >/dev/null 2>&1; then # AIX install. It has an incompatible calling convention. : else ac_cv_path_install="$ac_dir/$ac_prog -c" break 2 fi fi done ;; esac done IFS="$ac_save_IFS" fi if test "${ac_cv_path_install+set}" = set; then INSTALL="$ac_cv_path_install" else # As a last resort, use the slow shell script. We don't cache a # path for INSTALL within a source directory, because that will # break other packages using the cache if that directory is # removed, or if the path is relative. INSTALL="$ac_install_sh" fi fi echo "$ac_t""$INSTALL" 1>&6 # Use test -z because SunOS4 sh mishandles braces in ${var-val}. # It thinks the first close brace ends the variable substitution. test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL_PROGRAM}' test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' # Extract the first word of "flex", so it can be a program name with args. set dummy flex; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 echo "configure:1044: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_LEX'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else if test -n "$LEX"; then ac_cv_prog_LEX="$LEX" # Let the user override the test. else IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" ac_dummy="$PATH" for ac_dir in $ac_dummy; do test -z "$ac_dir" && ac_dir=. if test -f $ac_dir/$ac_word; then ac_cv_prog_LEX="flex" break fi done IFS="$ac_save_ifs" test -z "$ac_cv_prog_LEX" && ac_cv_prog_LEX="lex" fi fi LEX="$ac_cv_prog_LEX" if test -n "$LEX"; then echo "$ac_t""$LEX" 1>&6 else echo "$ac_t""no" 1>&6 fi if test -z "$LEXLIB" then case "$LEX" in flex*) ac_lib=fl ;; *) ac_lib=l ;; esac echo $ac_n "checking for yywrap in -l$ac_lib""... $ac_c" 1>&6 echo "configure:1078: checking for yywrap in -l$ac_lib" >&5 ac_lib_var=`echo $ac_lib'_'yywrap | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else ac_save_LIBS="$LIBS" LIBS="-l$ac_lib $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=no" fi rm -f conftest* LIBS="$ac_save_LIBS" fi if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then echo "$ac_t""yes" 1>&6 LEXLIB="-l$ac_lib" else echo "$ac_t""no" 1>&6 fi fi echo $ac_n "checking whether ${MAKE-make} sets \${MAKE}""... $ac_c" 1>&6 echo "configure:1120: checking whether ${MAKE-make} sets \${MAKE}" >&5 set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_prog_make_${ac_make}_set'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftestmake <<\EOF all: @echo 'ac_maketemp="${MAKE}"' EOF # GNU make sometimes prints "make[1]: Entering...", which would confuse us. eval `${MAKE-make} -f conftestmake 2>/dev/null | grep temp=` if test -n "$ac_maketemp"; then eval ac_cv_prog_make_${ac_make}_set=yes else eval ac_cv_prog_make_${ac_make}_set=no fi rm -f conftestmake fi if eval "test \"`echo '$ac_cv_prog_make_'${ac_make}_set`\" = yes"; then echo "$ac_t""yes" 1>&6 SET_MAKE= else echo "$ac_t""no" 1>&6 SET_MAKE="MAKE=${MAKE-make}" fi # Extract the first word of "ranlib", so it can be a program name with args. set dummy ranlib; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 echo "configure:1149: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else if test -n "$RANLIB"; then ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. else IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" ac_dummy="$PATH" for ac_dir in $ac_dummy; do test -z "$ac_dir" && ac_dir=. if test -f $ac_dir/$ac_word; then ac_cv_prog_RANLIB="ranlib" break fi done IFS="$ac_save_ifs" test -z "$ac_cv_prog_RANLIB" && ac_cv_prog_RANLIB=":" fi fi RANLIB="$ac_cv_prog_RANLIB" if test -n "$RANLIB"; then echo "$ac_t""$RANLIB" 1>&6 else echo "$ac_t""no" 1>&6 fi # Find options to use ANSI C echo $ac_n "checking for ${CC-cc} option to accept ANSI C""... $ac_c" 1>&6 echo "configure:1180: checking for ${CC-cc} option to accept ANSI C" >&5 if eval "test \"`echo '$''{'cf_cv_ansi_cc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cf_cv_ansi_cc=no cf_save_CFLAGS="$CFLAGS" # Don't try gcc -ansi; that turns off useful extensions and # breaks some systems' header files. # AIX -qlanglvl=ansi # Ultrix and OSF/1 -std1 # HP-UX -Aa -D_HPUX_SOURCE # SVR4 -Xc # UnixWare 1.2 (cannot use -Xc, since ANSI/POSIX clashes) for cf_arg in "-DCC_HAS_PROTOS" "" -qlanglvl=ansi -std1 "-Aa -D_HPUX_SOURCE" -Xc do CFLAGS="$cf_save_CFLAGS $cf_arg" cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* cf_cv_ansi_cc="$cf_arg"; break else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 fi rm -f conftest* done CFLAGS="$cf_save_CFLAGS" fi echo "$ac_t""$cf_cv_ansi_cc" 1>&6 if test "$cf_cv_ansi_cc" != "no"; then if test ".$cf_cv_ansi_cc" != ".-DCC_HAS_PROTOS"; then CFLAGS="$CFLAGS $cf_cv_ansi_cc" else cat >> confdefs.h <<\EOF #define CC_HAS_PROTOS 1 EOF fi fi # Is the math library OK? echo $ac_n "checking for tan in -lm""... $ac_c" 1>&6 echo "configure:1243: checking for tan in -lm" >&5 ac_lib_var=`echo m'_'tan | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else ac_save_LIBS="$LIBS" LIBS="-lm $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=no" fi rm -f conftest* LIBS="$ac_save_LIBS" fi if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then echo "$ac_t""yes" 1>&6 ac_tr_lib=HAVE_LIB`echo m | sed -e 's/[^a-zA-Z0-9_]/_/g' \ -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'` cat >> confdefs.h <&6 { echo "configure: error: can't find math functions" 1>&2; exit 1; } fi # Tcl on Linux on PC seems to require -ldl echo $ac_n "checking for dlerror in -ldl""... $ac_c" 1>&6 echo "configure:1293: checking for dlerror in -ldl" >&5 ac_lib_var=`echo dl'_'dlerror | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else ac_save_LIBS="$LIBS" LIBS="-ldl $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=no" fi rm -f conftest* LIBS="$ac_save_LIBS" fi if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then echo "$ac_t""yes" 1>&6 ac_tr_lib=HAVE_LIB`echo dl | sed -e 's/[^a-zA-Z0-9_]/_/g' \ -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'` cat >> confdefs.h <&6 fi ######################################################################### # Compile time switches ######################################################################### # Check whether --enable-debug or --disable-debug was given. if test "${enable_debug+set}" = set; then enableval="$enable_debug" cat >> confdefs.h <<\EOF #define DEBUG 1 EOF cat >> confdefs.h <<\EOF #define YYDEBUG 1 EOF # parser debugging wrapped into general debug now fi # Check whether --enable-dcc or --disable-dcc was given. if test "${enable_dcc+set}" = set; then enableval="$enable_dcc" cat >> confdefs.h <<\EOF #define NO_CHECK_CIRCULAR 1 EOF fi # Check whether --enable-depend or --disable-depend was given. if test "${enable_depend+set}" = set; then enableval="$enable_depend" DEPEND_MAKEDEFS="include ../depend.mk" else DEPEND_MAKEDEFS="#include ../depend.mk" fi # Check whether --enable-disable-sasami or --disable-disable-sasami was given. if test "${enable_disable_sasami+set}" = set; then enableval="$enable_disable_sasami" echo "configure: warning: Disabling Sasami" 1>&2 aw_want_sasami="no" else aw_want_sasami="yes" cat >> confdefs.h <<\EOF #define WANT_SASAMI 1 EOF fi # Check whether --enable-ipc or --disable-ipc was given. if test "${enable_ipc+set}" = set; then enableval="$enable_ipc" cat >> confdefs.h <<\EOF #define ipc 1 EOF fi ######################################################################### # X ######################################################################### # If we find X, set shell vars x_includes and x_libraries to the # paths, otherwise set no_x=yes. # Uses ac_ vars as temps to allow command line to override cache and checks. # --without-x overrides everything else, but does not touch the cache. echo $ac_n "checking for X""... $ac_c" 1>&6 echo "configure:1424: checking for X" >&5 # Check whether --with-x or --without-x was given. if test "${with_x+set}" = set; then withval="$with_x" : fi # $have_x is `yes', `no', `disabled', or empty when we do not yet know. if test "x$with_x" = xno; then # The user explicitly disabled X. have_x=disabled else if test "x$x_includes" != xNONE && test "x$x_libraries" != xNONE; then # Both variables are already set. have_x=yes else if eval "test \"`echo '$''{'ac_cv_have_x'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else # One or both of the vars are not set, and there is no cached value. ac_x_includes=NO ac_x_libraries=NO rm -fr conftestdir if mkdir conftestdir; then cd conftestdir # Make sure to not put "make" in the Imakefile rules, since we grep it out. cat > Imakefile <<'EOF' acfindx: @echo 'ac_im_incroot="${INCROOT}"; ac_im_usrlibdir="${USRLIBDIR}"; ac_im_libdir="${LIBDIR}"' EOF if (xmkmf) >/dev/null 2>/dev/null && test -f Makefile; then # GNU make sometimes prints "make[1]: Entering...", which would confuse us. eval `${MAKE-make} acfindx 2>/dev/null | grep -v make` # Open Windows xmkmf reportedly sets LIBDIR instead of USRLIBDIR. for ac_extension in a so sl; do if test ! -f $ac_im_usrlibdir/libX11.$ac_extension && test -f $ac_im_libdir/libX11.$ac_extension; then ac_im_usrlibdir=$ac_im_libdir; break fi done # Screen out bogus values from the imake configuration. They are # bogus both because they are the default anyway, and because # using them would break gcc on systems where it needs fixed includes. case "$ac_im_incroot" in /usr/include) ;; *) test -f "$ac_im_incroot/X11/Xos.h" && ac_x_includes="$ac_im_incroot" ;; esac case "$ac_im_usrlibdir" in /usr/lib | /lib) ;; *) test -d "$ac_im_usrlibdir" && ac_x_libraries="$ac_im_usrlibdir" ;; esac fi cd .. rm -fr conftestdir fi if test "$ac_x_includes" = NO; then # Guess where to find include files, by looking for this one X11 .h file. test -z "$x_direct_test_include" && x_direct_test_include=X11/Intrinsic.h # First, try using that file with no special directory specified. cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" { (eval echo configure:1491: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* # We can compile using X headers with no special include directory. ac_x_includes= else echo "$ac_err" >&5 echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* # Look for the header file in a standard set of common directories. # Check X11 before X11Rn because it is often a symlink to the current release. for ac_dir in \ /usr/X11/include \ /usr/X11R6/include \ /usr/X11R5/include \ /usr/X11R4/include \ \ /usr/include/X11 \ /usr/include/X11R6 \ /usr/include/X11R5 \ /usr/include/X11R4 \ \ /usr/local/X11/include \ /usr/local/X11R6/include \ /usr/local/X11R5/include \ /usr/local/X11R4/include \ \ /usr/local/include/X11 \ /usr/local/include/X11R6 \ /usr/local/include/X11R5 \ /usr/local/include/X11R4 \ \ /usr/X386/include \ /usr/x386/include \ /usr/XFree86/include/X11 \ \ /usr/include \ /usr/local/include \ /usr/unsupported/include \ /usr/athena/include \ /usr/local/x11r5/include \ /usr/lpp/Xamples/include \ \ /usr/openwin/include \ /usr/openwin/share/include \ ; \ do if test -r "$ac_dir/$x_direct_test_include"; then ac_x_includes=$ac_dir break fi done fi rm -f conftest* fi # $ac_x_includes = NO if test "$ac_x_libraries" = NO; then # Check for the libraries. test -z "$x_direct_test_library" && x_direct_test_library=Xt test -z "$x_direct_test_function" && x_direct_test_function=XtMalloc # See if we find them without any special options. # Don't add to $LIBS permanently. ac_save_LIBS="$LIBS" LIBS="-l$x_direct_test_library $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* LIBS="$ac_save_LIBS" # We can link X programs with no special library path. ac_x_libraries= else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* LIBS="$ac_save_LIBS" # First see if replacing the include by lib works. # Check X11 before X11Rn because it is often a symlink to the current release. for ac_dir in `echo "$ac_x_includes" | sed s/include/lib/` \ /usr/X11/lib \ /usr/X11R6/lib \ /usr/X11R5/lib \ /usr/X11R4/lib \ \ /usr/lib/X11 \ /usr/lib/X11R6 \ /usr/lib/X11R5 \ /usr/lib/X11R4 \ \ /usr/local/X11/lib \ /usr/local/X11R6/lib \ /usr/local/X11R5/lib \ /usr/local/X11R4/lib \ \ /usr/local/lib/X11 \ /usr/local/lib/X11R6 \ /usr/local/lib/X11R5 \ /usr/local/lib/X11R4 \ \ /usr/X386/lib \ /usr/x386/lib \ /usr/XFree86/lib/X11 \ \ /usr/lib \ /usr/local/lib \ /usr/unsupported/lib \ /usr/athena/lib \ /usr/local/x11r5/lib \ /usr/lpp/Xamples/lib \ /lib/usr/lib/X11 \ \ /usr/openwin/lib \ /usr/openwin/share/lib \ ; \ do for ac_extension in a so sl; do if test -r $ac_dir/lib${x_direct_test_library}.$ac_extension; then ac_x_libraries=$ac_dir break 2 fi done done fi rm -f conftest* fi # $ac_x_libraries = NO if test "$ac_x_includes" = NO || test "$ac_x_libraries" = NO; then # Didn't find X anywhere. Cache the known absence of X. ac_cv_have_x="have_x=no" else # Record where we found X for the cache. ac_cv_have_x="have_x=yes \ ac_x_includes=$ac_x_includes ac_x_libraries=$ac_x_libraries" fi fi fi eval "$ac_cv_have_x" fi # $with_x != no if test "$have_x" != yes; then echo "$ac_t""$have_x" 1>&6 no_x=yes else # If each of the values was on the command line, it overrides each guess. test "x$x_includes" = xNONE && x_includes=$ac_x_includes test "x$x_libraries" = xNONE && x_libraries=$ac_x_libraries # Update the cache value to reflect the command line values. ac_cv_have_x="have_x=yes \ ac_x_includes=$x_includes ac_x_libraries=$x_libraries" echo "$ac_t""libraries $x_libraries, headers $x_includes" 1>&6 fi if test "$no_x" = yes; then # Not all programs may use this symbol, but it does not hurt to define it. cat >> confdefs.h <<\EOF #define X_DISPLAY_MISSING 1 EOF X_CFLAGS= X_PRE_LIBS= X_LIBS= X_EXTRA_LIBS= else if test -n "$x_includes"; then X_CFLAGS="$X_CFLAGS -I$x_includes" fi # It would also be nice to do this for all -L options, not just this one. if test -n "$x_libraries"; then X_LIBS="$X_LIBS -L$x_libraries" # For Solaris; some versions of Sun CC require a space after -R and # others require no space. Words are not sufficient . . . . case "`(uname -sr) 2>/dev/null`" in "SunOS 5"*) echo $ac_n "checking whether -R must be followed by a space""... $ac_c" 1>&6 echo "configure:1673: checking whether -R must be followed by a space" >&5 ac_xsave_LIBS="$LIBS"; LIBS="$LIBS -R$x_libraries" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* ac_R_nospace=yes else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* ac_R_nospace=no fi rm -f conftest* if test $ac_R_nospace = yes; then echo "$ac_t""no" 1>&6 X_LIBS="$X_LIBS -R$x_libraries" else LIBS="$ac_xsave_LIBS -R $x_libraries" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* ac_R_space=yes else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* ac_R_space=no fi rm -f conftest* if test $ac_R_space = yes; then echo "$ac_t""yes" 1>&6 X_LIBS="$X_LIBS -R $x_libraries" else echo "$ac_t""neither works" 1>&6 fi fi LIBS="$ac_xsave_LIBS" esac fi # Check for system-dependent libraries X programs must link with. # Do this before checking for the system-independent R6 libraries # (-lICE), since we may need -lsocket or whatever for X linking. if test "$ISC" = yes; then X_EXTRA_LIBS="$X_EXTRA_LIBS -lnsl_s -linet" else # Martyn.Johnson@cl.cam.ac.uk says this is needed for Ultrix, if the X # libraries were built with DECnet support. And karl@cs.umb.edu says # the Alpha needs dnet_stub (dnet does not exist). echo $ac_n "checking for dnet_ntoa in -ldnet""... $ac_c" 1>&6 echo "configure:1738: checking for dnet_ntoa in -ldnet" >&5 ac_lib_var=`echo dnet'_'dnet_ntoa | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else ac_save_LIBS="$LIBS" LIBS="-ldnet $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=no" fi rm -f conftest* LIBS="$ac_save_LIBS" fi if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then echo "$ac_t""yes" 1>&6 X_EXTRA_LIBS="$X_EXTRA_LIBS -ldnet" else echo "$ac_t""no" 1>&6 fi if test $ac_cv_lib_dnet_dnet_ntoa = no; then echo $ac_n "checking for dnet_ntoa in -ldnet_stub""... $ac_c" 1>&6 echo "configure:1779: checking for dnet_ntoa in -ldnet_stub" >&5 ac_lib_var=`echo dnet_stub'_'dnet_ntoa | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else ac_save_LIBS="$LIBS" LIBS="-ldnet_stub $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=no" fi rm -f conftest* LIBS="$ac_save_LIBS" fi if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then echo "$ac_t""yes" 1>&6 X_EXTRA_LIBS="$X_EXTRA_LIBS -ldnet_stub" else echo "$ac_t""no" 1>&6 fi fi # msh@cis.ufl.edu says -lnsl (and -lsocket) are needed for his 386/AT, # to get the SysV transport functions. # chad@anasazi.com says the Pyramis MIS-ES running DC/OSx (SVR4) # needs -lnsl. # The nsl library prevents programs from opening the X display # on Irix 5.2, according to dickey@clark.net. echo $ac_n "checking for gethostbyname""... $ac_c" 1>&6 echo "configure:1827: checking for gethostbyname" >&5 if eval "test \"`echo '$''{'ac_cv_func_gethostbyname'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char gethostbyname(); int main() { /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined (__stub_gethostbyname) || defined (__stub___gethostbyname) choke me #else gethostbyname(); #endif ; return 0; } EOF if { (eval echo configure:1855: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_gethostbyname=yes" else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* eval "ac_cv_func_gethostbyname=no" fi rm -f conftest* fi if eval "test \"`echo '$ac_cv_func_'gethostbyname`\" = yes"; then echo "$ac_t""yes" 1>&6 : else echo "$ac_t""no" 1>&6 fi if test $ac_cv_func_gethostbyname = no; then echo $ac_n "checking for gethostbyname in -lnsl""... $ac_c" 1>&6 echo "configure:1876: checking for gethostbyname in -lnsl" >&5 ac_lib_var=`echo nsl'_'gethostbyname | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else ac_save_LIBS="$LIBS" LIBS="-lnsl $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=no" fi rm -f conftest* LIBS="$ac_save_LIBS" fi if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then echo "$ac_t""yes" 1>&6 X_EXTRA_LIBS="$X_EXTRA_LIBS -lnsl" else echo "$ac_t""no" 1>&6 fi fi # lieder@skyler.mavd.honeywell.com says without -lsocket, # socket/setsockopt and other routines are undefined under SCO ODT # 2.0. But -lsocket is broken on IRIX 5.2 (and is not necessary # on later versions), says simon@lia.di.epfl.ch: it contains # gethostby* variants that don't use the nameserver (or something). # -lsocket must be given before -lnsl if both are needed. # We assume that if connect needs -lnsl, so does gethostbyname. echo $ac_n "checking for connect""... $ac_c" 1>&6 echo "configure:1925: checking for connect" >&5 if eval "test \"`echo '$''{'ac_cv_func_connect'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char connect(); int main() { /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined (__stub_connect) || defined (__stub___connect) choke me #else connect(); #endif ; return 0; } EOF if { (eval echo configure:1953: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_connect=yes" else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* eval "ac_cv_func_connect=no" fi rm -f conftest* fi if eval "test \"`echo '$ac_cv_func_'connect`\" = yes"; then echo "$ac_t""yes" 1>&6 : else echo "$ac_t""no" 1>&6 fi if test $ac_cv_func_connect = no; then echo $ac_n "checking for connect in -lsocket""... $ac_c" 1>&6 echo "configure:1974: checking for connect in -lsocket" >&5 ac_lib_var=`echo socket'_'connect | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else ac_save_LIBS="$LIBS" LIBS="-lsocket $X_EXTRA_LIBS $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=no" fi rm -f conftest* LIBS="$ac_save_LIBS" fi if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then echo "$ac_t""yes" 1>&6 X_EXTRA_LIBS="-lsocket $X_EXTRA_LIBS" else echo "$ac_t""no" 1>&6 fi fi # gomez@mi.uni-erlangen.de says -lposix is necessary on A/UX. echo $ac_n "checking for remove""... $ac_c" 1>&6 echo "configure:2017: checking for remove" >&5 if eval "test \"`echo '$''{'ac_cv_func_remove'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char remove(); int main() { /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined (__stub_remove) || defined (__stub___remove) choke me #else remove(); #endif ; return 0; } EOF if { (eval echo configure:2045: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_remove=yes" else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* eval "ac_cv_func_remove=no" fi rm -f conftest* fi if eval "test \"`echo '$ac_cv_func_'remove`\" = yes"; then echo "$ac_t""yes" 1>&6 : else echo "$ac_t""no" 1>&6 fi if test $ac_cv_func_remove = no; then echo $ac_n "checking for remove in -lposix""... $ac_c" 1>&6 echo "configure:2066: checking for remove in -lposix" >&5 ac_lib_var=`echo posix'_'remove | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else ac_save_LIBS="$LIBS" LIBS="-lposix $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=no" fi rm -f conftest* LIBS="$ac_save_LIBS" fi if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then echo "$ac_t""yes" 1>&6 X_EXTRA_LIBS="$X_EXTRA_LIBS -lposix" else echo "$ac_t""no" 1>&6 fi fi # BSDI BSD/OS 2.1 needs -lipc for XOpenDisplay. echo $ac_n "checking for shmat""... $ac_c" 1>&6 echo "configure:2109: checking for shmat" >&5 if eval "test \"`echo '$''{'ac_cv_func_shmat'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char shmat(); int main() { /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined (__stub_shmat) || defined (__stub___shmat) choke me #else shmat(); #endif ; return 0; } EOF if { (eval echo configure:2137: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_shmat=yes" else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* eval "ac_cv_func_shmat=no" fi rm -f conftest* fi if eval "test \"`echo '$ac_cv_func_'shmat`\" = yes"; then echo "$ac_t""yes" 1>&6 : else echo "$ac_t""no" 1>&6 fi if test $ac_cv_func_shmat = no; then echo $ac_n "checking for shmat in -lipc""... $ac_c" 1>&6 echo "configure:2158: checking for shmat in -lipc" >&5 ac_lib_var=`echo ipc'_'shmat | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else ac_save_LIBS="$LIBS" LIBS="-lipc $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=no" fi rm -f conftest* LIBS="$ac_save_LIBS" fi if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then echo "$ac_t""yes" 1>&6 X_EXTRA_LIBS="$X_EXTRA_LIBS -lipc" else echo "$ac_t""no" 1>&6 fi fi fi # Check for libraries that X11R6 Xt/Xaw programs need. ac_save_LDFLAGS="$LDFLAGS" test -n "$x_libraries" && LDFLAGS="$LDFLAGS -L$x_libraries" # SM needs ICE to (dynamically) link under SunOS 4.x (so we have to # check for ICE first), but we must link in the order -lSM -lICE or # we get undefined symbols. So assume we have SM if we have ICE. # These have to be linked with before -lX11, unlike the other # libraries we check for below, so use a different variable. # --interran@uluru.Stanford.EDU, kb@cs.umb.edu. echo $ac_n "checking for IceConnectionNumber in -lICE""... $ac_c" 1>&6 echo "configure:2210: checking for IceConnectionNumber in -lICE" >&5 ac_lib_var=`echo ICE'_'IceConnectionNumber | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else ac_save_LIBS="$LIBS" LIBS="-lICE $X_EXTRA_LIBS $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=no" fi rm -f conftest* LIBS="$ac_save_LIBS" fi if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then echo "$ac_t""yes" 1>&6 X_PRE_LIBS="$X_PRE_LIBS -lSM -lICE" else echo "$ac_t""no" 1>&6 fi LDFLAGS="$ac_save_LDFLAGS" fi # Bit of a bodge but I can't think of a better way of detecting Windoz if test "$no_x" = "yes"; then # Probably Windoz AW_X_LIBS="-lGDI32 -lUSER32 -lCOMDLG32 -lKERNEL32" else AW_X_LIBS="-lXt -lX11" if test "$aw_want_sasami" = "yes"; then AW_X_LIBS="$AW_X_LIBS -lXmu -lXext" fi fi ######################################################################### # Run time linker ######################################################################### # The Solaris implementation of dynamic linking means that the run-time # linker needs to know where to locate the (dynamically linked) libraries. # This means when we are linking, for each -L option, we need to pass a # similar -R option. # Apparently some versions of Sun CC require a space after the -R, and # some no space, which seems incredibly dumb. I haven't bothered to check # for this yet though. echo $ac_n "checking whether we need -R""... $ac_c" 1>&6 echo "configure:2281: checking whether we need -R" >&5 case "`(uname -sr) 2>/dev/null`" in "SunOS 5"*) aw_need_r=yes echo "$ac_t""yes" 1>&6 ;; *) aw_need_r=no echo "$ac_t""no" 1>&6 ;; esac ######################################################################### # curses ######################################################################### # # Prefer "new" curses: ncurses. # # Examples: # bax and holst: /usr/include/ncurses/curses.h: # -I/usr/include/ncurses -L/usr/lib -L/usr/lib/ncurses -lncurses # gem: /gnu/include/ncurses.h: # -I/gnu/include -L/gnu/lib -lncurses # gem: /usr/include/curses.h: # -lcurses # # Possible include directories: /usr/include /gnu/include /usr/local/include # # One of these directories might include # ncurses/curses.h: -Iinc_dir/ncurses -Llib_dir -Llib_dir/ncurses -lncurses # ncurses.h: -Iinc_dir -Llib_dir -lcurses # curses.h: -Iinc_dir -Llib_dir -lcurses # # Everything set up already (eg in LIBS) is not an option as we want # this to apply only to ttyeden. # # Sets Example # CURSES_TYPE curses # CURSES_INCLUDE -I/usr/local/include # CURSES_LIB -lcurses # CURSES_LIB_PATH -L/usr/local/lib # HAVE_CURSES "" # # See if the user supplied some arguments # Check whether --with-curses-include or --without-curses-include was given. if test "${with_curses_include+set}" = set; then withval="$with_curses_include" aw_user_supplied_curses_include=$withval # Try and find this with the lib variable unset - the user # should really provide --with-curses-lib as well. # Three possible cases # ncurses/curses.h: -Iinc_dir/ncurses -Llib_dir -Llib_dir/ncurses -lncurses # ncurses.h: -Iinc_dir -Llib_dir -lcurses # curses.h: -Iinc_dir -Llib_dir -lcurses if test "$aw_need_r" = "yes"; then # We need the -R for runtime linking # Note this code is repeated below with -R taken away aw_curses_include_dir=$aw_user_supplied_curses_include aw_curses_header_look=ncurses/curses.h aw_curses_type=ncurses aw_curses_include=-I$aw_user_supplied_curses_include/ncurses aw_curses_lib_path="-L -L/ncurses -R -R/ncurses" if test -z "$aw_finished_curses"; then echo $ac_n "checking for ${aw_curses_include_dir}/${aw_curses_header_look}""... $ac_c" 1>&6 echo "configure:2354: checking for ${aw_curses_include_dir}/${aw_curses_header_look}" >&5 if test -f ${aw_curses_include_dir}/${aw_curses_header_look}; then echo "$ac_t""yes" 1>&6 # Temporarily add blurb to LIBS aw_save_libs=$LIBS LIBS="$aw_curses_include $aw_curses_lib_path -l${aw_curses_type} $LIBS" echo $ac_n "checking whether we can link curses using $LIBS""... $ac_c" 1>&6 echo "configure:2361: checking whether we can link curses using $LIBS" >&5 cat > conftest.$ac_ext < int main() { initscr() ; return 0; } EOF if { (eval echo configure:2370: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* # Link succeeded LIBS=$aw_save_libs echo "$ac_t""yes" 1>&6 aw_finished_curses="yes" CURSES_TYPE=$aw_curses_type CURSES_INCLUDE=$aw_curses_include CURSES_LIB_PATH=$aw_curses_lib_path CURSES_LIB=-l$aw_curses_type else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* # Link failed. Do nothing (the search process will # just continue to another possible location). LIBS=$aw_save_libs echo "$ac_t""no" 1>&6 fi rm -f conftest* else echo "$ac_t""no" 1>&6 fi fi aw_curses_include_dir=$aw_user_supplied_curses_include aw_curses_header_look=ncurses.h aw_curses_type=ncurses aw_curses_include=-I$aw_user_supplied_curses_include aw_curses_lib_path="-L -R" if test -z "$aw_finished_curses"; then echo $ac_n "checking for ${aw_curses_include_dir}/${aw_curses_header_look}""... $ac_c" 1>&6 echo "configure:2408: checking for ${aw_curses_include_dir}/${aw_curses_header_look}" >&5 if test -f ${aw_curses_include_dir}/${aw_curses_header_look}; then echo "$ac_t""yes" 1>&6 # Temporarily add blurb to LIBS aw_save_libs=$LIBS LIBS="$aw_curses_include $aw_curses_lib_path -l${aw_curses_type} $LIBS" echo $ac_n "checking whether we can link curses using $LIBS""... $ac_c" 1>&6 echo "configure:2415: checking whether we can link curses using $LIBS" >&5 cat > conftest.$ac_ext < int main() { initscr() ; return 0; } EOF if { (eval echo configure:2424: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* # Link succeeded LIBS=$aw_save_libs echo "$ac_t""yes" 1>&6 aw_finished_curses="yes" CURSES_TYPE=$aw_curses_type CURSES_INCLUDE=$aw_curses_include CURSES_LIB_PATH=$aw_curses_lib_path CURSES_LIB=-l$aw_curses_type else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* # Link failed. Do nothing (the search process will # just continue to another possible location). LIBS=$aw_save_libs echo "$ac_t""no" 1>&6 fi rm -f conftest* else echo "$ac_t""no" 1>&6 fi fi aw_curses_include_dir=$aw_user_supplied_curses_include aw_curses_header_look=curses.h aw_curses_type=curses aw_curses_include=-I$aw_user_supplied_curses_include aw_curses_lib_path="-L -R" if test -z "$aw_finished_curses"; then echo $ac_n "checking for ${aw_curses_include_dir}/${aw_curses_header_look}""... $ac_c" 1>&6 echo "configure:2462: checking for ${aw_curses_include_dir}/${aw_curses_header_look}" >&5 if test -f ${aw_curses_include_dir}/${aw_curses_header_look}; then echo "$ac_t""yes" 1>&6 # Temporarily add blurb to LIBS aw_save_libs=$LIBS LIBS="$aw_curses_include $aw_curses_lib_path -l${aw_curses_type} $LIBS" echo $ac_n "checking whether we can link curses using $LIBS""... $ac_c" 1>&6 echo "configure:2469: checking whether we can link curses using $LIBS" >&5 cat > conftest.$ac_ext < int main() { initscr() ; return 0; } EOF if { (eval echo configure:2478: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* # Link succeeded LIBS=$aw_save_libs echo "$ac_t""yes" 1>&6 aw_finished_curses="yes" CURSES_TYPE=$aw_curses_type CURSES_INCLUDE=$aw_curses_include CURSES_LIB_PATH=$aw_curses_lib_path CURSES_LIB=-l$aw_curses_type else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* # Link failed. Do nothing (the search process will # just continue to another possible location). LIBS=$aw_save_libs echo "$ac_t""no" 1>&6 fi rm -f conftest* else echo "$ac_t""no" 1>&6 fi fi else # We don't need the -R option # Note this code is repeated above with -R added aw_curses_include_dir=$aw_user_supplied_curses_include aw_curses_header_look=ncurses/curses.h aw_curses_type=ncurses aw_curses_include=-I$aw_user_supplied_curses_include/ncurses aw_curses_lib_path="-L -L/ncurses" if test -z "$aw_finished_curses"; then echo $ac_n "checking for ${aw_curses_include_dir}/${aw_curses_header_look}""... $ac_c" 1>&6 echo "configure:2519: checking for ${aw_curses_include_dir}/${aw_curses_header_look}" >&5 if test -f ${aw_curses_include_dir}/${aw_curses_header_look}; then echo "$ac_t""yes" 1>&6 # Temporarily add blurb to LIBS aw_save_libs=$LIBS LIBS="$aw_curses_include $aw_curses_lib_path -l${aw_curses_type} $LIBS" echo $ac_n "checking whether we can link curses using $LIBS""... $ac_c" 1>&6 echo "configure:2526: checking whether we can link curses using $LIBS" >&5 cat > conftest.$ac_ext < int main() { initscr() ; return 0; } EOF if { (eval echo configure:2535: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* # Link succeeded LIBS=$aw_save_libs echo "$ac_t""yes" 1>&6 aw_finished_curses="yes" CURSES_TYPE=$aw_curses_type CURSES_INCLUDE=$aw_curses_include CURSES_LIB_PATH=$aw_curses_lib_path CURSES_LIB=-l$aw_curses_type else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* # Link failed. Do nothing (the search process will # just continue to another possible location). LIBS=$aw_save_libs echo "$ac_t""no" 1>&6 fi rm -f conftest* else echo "$ac_t""no" 1>&6 fi fi aw_curses_include_dir=$aw_user_supplied_curses_include aw_curses_header_look=ncurses.h aw_curses_type=ncurses aw_curses_include=-I$aw_user_supplied_curses_include aw_curses_lib_path=-L if test -z "$aw_finished_curses"; then echo $ac_n "checking for ${aw_curses_include_dir}/${aw_curses_header_look}""... $ac_c" 1>&6 echo "configure:2573: checking for ${aw_curses_include_dir}/${aw_curses_header_look}" >&5 if test -f ${aw_curses_include_dir}/${aw_curses_header_look}; then echo "$ac_t""yes" 1>&6 # Temporarily add blurb to LIBS aw_save_libs=$LIBS LIBS="$aw_curses_include $aw_curses_lib_path -l${aw_curses_type} $LIBS" echo $ac_n "checking whether we can link curses using $LIBS""... $ac_c" 1>&6 echo "configure:2580: checking whether we can link curses using $LIBS" >&5 cat > conftest.$ac_ext < int main() { initscr() ; return 0; } EOF if { (eval echo configure:2589: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* # Link succeeded LIBS=$aw_save_libs echo "$ac_t""yes" 1>&6 aw_finished_curses="yes" CURSES_TYPE=$aw_curses_type CURSES_INCLUDE=$aw_curses_include CURSES_LIB_PATH=$aw_curses_lib_path CURSES_LIB=-l$aw_curses_type else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* # Link failed. Do nothing (the search process will # just continue to another possible location). LIBS=$aw_save_libs echo "$ac_t""no" 1>&6 fi rm -f conftest* else echo "$ac_t""no" 1>&6 fi fi aw_curses_include_dir=$aw_user_supplied_curses_include aw_curses_header_look=curses.h aw_curses_type=curses aw_curses_include=-I$aw_user_supplied_curses_include aw_curses_lib_path=-L if test -z "$aw_finished_curses"; then echo $ac_n "checking for ${aw_curses_include_dir}/${aw_curses_header_look}""... $ac_c" 1>&6 echo "configure:2627: checking for ${aw_curses_include_dir}/${aw_curses_header_look}" >&5 if test -f ${aw_curses_include_dir}/${aw_curses_header_look}; then echo "$ac_t""yes" 1>&6 # Temporarily add blurb to LIBS aw_save_libs=$LIBS LIBS="$aw_curses_include $aw_curses_lib_path -l${aw_curses_type} $LIBS" echo $ac_n "checking whether we can link curses using $LIBS""... $ac_c" 1>&6 echo "configure:2634: checking whether we can link curses using $LIBS" >&5 cat > conftest.$ac_ext < int main() { initscr() ; return 0; } EOF if { (eval echo configure:2643: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* # Link succeeded LIBS=$aw_save_libs echo "$ac_t""yes" 1>&6 aw_finished_curses="yes" CURSES_TYPE=$aw_curses_type CURSES_INCLUDE=$aw_curses_include CURSES_LIB_PATH=$aw_curses_lib_path CURSES_LIB=-l$aw_curses_type else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* # Link failed. Do nothing (the search process will # just continue to another possible location). LIBS=$aw_save_libs echo "$ac_t""no" 1>&6 fi rm -f conftest* else echo "$ac_t""no" 1>&6 fi fi fi fi # Check whether --with-curses-lib or --without-curses-lib was given. if test "${with_curses_lib+set}" = set; then withval="$with_curses_lib" aw_user_supplied_curses_lib_dir=$withval # Three possible cases # ncurses/curses.h: -Iinc_dir/ncurses -Llib_dir -Llib_dir/ncurses -lncurses # ncurses.h: -Iinc_dir -Llib_dir -lcurses # curses.h: -Iinc_dir -Llib_dir -lcurses if test "$aw_need_r" = "yes"; then # We need the -R for runtime linking # Note this code is repeated below with -R taken away aw_curses_include_dir=$aw_user_supplied_curses_include aw_curses_header_look=ncurses/curses.h aw_curses_type=ncurses aw_curses_include=-I$aw_user_supplied_curses_include/ncurses aw_curses_lib_path="-L$aw_user_supplied_curses_lib_dir -L$aw_user_supplied_curses_lib_dir/ncurses -R$aw_user_supplied_curses_lib_dir -R$aw_user_supplied_curses_lib_dir/ncurses" if test -z "$aw_finished_curses"; then echo $ac_n "checking for ${aw_curses_include_dir}/${aw_curses_header_look}""... $ac_c" 1>&6 echo "configure:2700: checking for ${aw_curses_include_dir}/${aw_curses_header_look}" >&5 if test -f ${aw_curses_include_dir}/${aw_curses_header_look}; then echo "$ac_t""yes" 1>&6 # Temporarily add blurb to LIBS aw_save_libs=$LIBS LIBS="$aw_curses_include $aw_curses_lib_path -l${aw_curses_type} $LIBS" echo $ac_n "checking whether we can link curses using $LIBS""... $ac_c" 1>&6 echo "configure:2707: checking whether we can link curses using $LIBS" >&5 cat > conftest.$ac_ext < int main() { initscr() ; return 0; } EOF if { (eval echo configure:2716: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* # Link succeeded LIBS=$aw_save_libs echo "$ac_t""yes" 1>&6 aw_finished_curses="yes" CURSES_TYPE=$aw_curses_type CURSES_INCLUDE=$aw_curses_include CURSES_LIB_PATH=$aw_curses_lib_path CURSES_LIB=-l$aw_curses_type else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* # Link failed. Do nothing (the search process will # just continue to another possible location). LIBS=$aw_save_libs echo "$ac_t""no" 1>&6 fi rm -f conftest* else echo "$ac_t""no" 1>&6 fi fi aw_curses_include_dir=$aw_user_supplied_curses_include aw_curses_header_look=ncurses.h aw_curses_type=ncurses aw_curses_include=-I$aw_user_supplied_curses_include aw_curses_lib_path="-L$aw_user_supplied_curses_lib_dir -R$aw_user_supplied_curses_lib_dir" if test -z "$aw_finished_curses"; then echo $ac_n "checking for ${aw_curses_include_dir}/${aw_curses_header_look}""... $ac_c" 1>&6 echo "configure:2754: checking for ${aw_curses_include_dir}/${aw_curses_header_look}" >&5 if test -f ${aw_curses_include_dir}/${aw_curses_header_look}; then echo "$ac_t""yes" 1>&6 # Temporarily add blurb to LIBS aw_save_libs=$LIBS LIBS="$aw_curses_include $aw_curses_lib_path -l${aw_curses_type} $LIBS" echo $ac_n "checking whether we can link curses using $LIBS""... $ac_c" 1>&6 echo "configure:2761: checking whether we can link curses using $LIBS" >&5 cat > conftest.$ac_ext < int main() { initscr() ; return 0; } EOF if { (eval echo configure:2770: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* # Link succeeded LIBS=$aw_save_libs echo "$ac_t""yes" 1>&6 aw_finished_curses="yes" CURSES_TYPE=$aw_curses_type CURSES_INCLUDE=$aw_curses_include CURSES_LIB_PATH=$aw_curses_lib_path CURSES_LIB=-l$aw_curses_type else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* # Link failed. Do nothing (the search process will # just continue to another possible location). LIBS=$aw_save_libs echo "$ac_t""no" 1>&6 fi rm -f conftest* else echo "$ac_t""no" 1>&6 fi fi aw_curses_include_dir=$aw_user_supplied_curses_include aw_curses_header_look=curses.h aw_curses_type=curses aw_curses_include=-I$aw_user_supplied_curses_include aw_curses_lib_path="-L$aw_user_supplied_curses_lib_dir -R$aw_user_supplied_curses_lib_dir" if test -z "$aw_finished_curses"; then echo $ac_n "checking for ${aw_curses_include_dir}/${aw_curses_header_look}""... $ac_c" 1>&6 echo "configure:2808: checking for ${aw_curses_include_dir}/${aw_curses_header_look}" >&5 if test -f ${aw_curses_include_dir}/${aw_curses_header_look}; then echo "$ac_t""yes" 1>&6 # Temporarily add blurb to LIBS aw_save_libs=$LIBS LIBS="$aw_curses_include $aw_curses_lib_path -l${aw_curses_type} $LIBS" echo $ac_n "checking whether we can link curses using $LIBS""... $ac_c" 1>&6 echo "configure:2815: checking whether we can link curses using $LIBS" >&5 cat > conftest.$ac_ext < int main() { initscr() ; return 0; } EOF if { (eval echo configure:2824: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* # Link succeeded LIBS=$aw_save_libs echo "$ac_t""yes" 1>&6 aw_finished_curses="yes" CURSES_TYPE=$aw_curses_type CURSES_INCLUDE=$aw_curses_include CURSES_LIB_PATH=$aw_curses_lib_path CURSES_LIB=-l$aw_curses_type else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* # Link failed. Do nothing (the search process will # just continue to another possible location). LIBS=$aw_save_libs echo "$ac_t""no" 1>&6 fi rm -f conftest* else echo "$ac_t""no" 1>&6 fi fi else # We don't need the -R option # Note this code is repeated above with -R added aw_curses_include_dir=$aw_user_supplied_curses_include aw_curses_header_look=ncurses/curses.h aw_curses_type=ncurses aw_curses_include=-I$aw_user_supplied_curses_include/ncurses aw_curses_lib_path="-L$aw_user_supplied_curses_lib_dir -L$aw_user_supplied_curses_lib_dir/ncurses" if test -z "$aw_finished_curses"; then echo $ac_n "checking for ${aw_curses_include_dir}/${aw_curses_header_look}""... $ac_c" 1>&6 echo "configure:2865: checking for ${aw_curses_include_dir}/${aw_curses_header_look}" >&5 if test -f ${aw_curses_include_dir}/${aw_curses_header_look}; then echo "$ac_t""yes" 1>&6 # Temporarily add blurb to LIBS aw_save_libs=$LIBS LIBS="$aw_curses_include $aw_curses_lib_path -l${aw_curses_type} $LIBS" echo $ac_n "checking whether we can link curses using $LIBS""... $ac_c" 1>&6 echo "configure:2872: checking whether we can link curses using $LIBS" >&5 cat > conftest.$ac_ext < int main() { initscr() ; return 0; } EOF if { (eval echo configure:2881: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* # Link succeeded LIBS=$aw_save_libs echo "$ac_t""yes" 1>&6 aw_finished_curses="yes" CURSES_TYPE=$aw_curses_type CURSES_INCLUDE=$aw_curses_include CURSES_LIB_PATH=$aw_curses_lib_path CURSES_LIB=-l$aw_curses_type else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* # Link failed. Do nothing (the search process will # just continue to another possible location). LIBS=$aw_save_libs echo "$ac_t""no" 1>&6 fi rm -f conftest* else echo "$ac_t""no" 1>&6 fi fi aw_curses_include_dir=$aw_user_supplied_curses_include aw_curses_header_look=ncurses.h aw_curses_type=ncurses aw_curses_include=-I$aw_user_supplied_curses_include aw_curses_lib_path=-L$aw_user_supplied_curses_lib_dir if test -z "$aw_finished_curses"; then echo $ac_n "checking for ${aw_curses_include_dir}/${aw_curses_header_look}""... $ac_c" 1>&6 echo "configure:2919: checking for ${aw_curses_include_dir}/${aw_curses_header_look}" >&5 if test -f ${aw_curses_include_dir}/${aw_curses_header_look}; then echo "$ac_t""yes" 1>&6 # Temporarily add blurb to LIBS aw_save_libs=$LIBS LIBS="$aw_curses_include $aw_curses_lib_path -l${aw_curses_type} $LIBS" echo $ac_n "checking whether we can link curses using $LIBS""... $ac_c" 1>&6 echo "configure:2926: checking whether we can link curses using $LIBS" >&5 cat > conftest.$ac_ext < int main() { initscr() ; return 0; } EOF if { (eval echo configure:2935: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* # Link succeeded LIBS=$aw_save_libs echo "$ac_t""yes" 1>&6 aw_finished_curses="yes" CURSES_TYPE=$aw_curses_type CURSES_INCLUDE=$aw_curses_include CURSES_LIB_PATH=$aw_curses_lib_path CURSES_LIB=-l$aw_curses_type else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* # Link failed. Do nothing (the search process will # just continue to another possible location). LIBS=$aw_save_libs echo "$ac_t""no" 1>&6 fi rm -f conftest* else echo "$ac_t""no" 1>&6 fi fi aw_curses_include_dir=$aw_user_supplied_curses_include aw_curses_header_look=curses.h aw_curses_type=curses aw_curses_include=-I$aw_user_supplied_curses_include aw_curses_lib_path=-L$aw_user_supplied_curses_lib_dir if test -z "$aw_finished_curses"; then echo $ac_n "checking for ${aw_curses_include_dir}/${aw_curses_header_look}""... $ac_c" 1>&6 echo "configure:2973: checking for ${aw_curses_include_dir}/${aw_curses_header_look}" >&5 if test -f ${aw_curses_include_dir}/${aw_curses_header_look}; then echo "$ac_t""yes" 1>&6 # Temporarily add blurb to LIBS aw_save_libs=$LIBS LIBS="$aw_curses_include $aw_curses_lib_path -l${aw_curses_type} $LIBS" echo $ac_n "checking whether we can link curses using $LIBS""... $ac_c" 1>&6 echo "configure:2980: checking whether we can link curses using $LIBS" >&5 cat > conftest.$ac_ext < int main() { initscr() ; return 0; } EOF if { (eval echo configure:2989: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* # Link succeeded LIBS=$aw_save_libs echo "$ac_t""yes" 1>&6 aw_finished_curses="yes" CURSES_TYPE=$aw_curses_type CURSES_INCLUDE=$aw_curses_include CURSES_LIB_PATH=$aw_curses_lib_path CURSES_LIB=-l$aw_curses_type else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* # Link failed. Do nothing (the search process will # just continue to another possible location). LIBS=$aw_save_libs echo "$ac_t""no" 1>&6 fi rm -f conftest* else echo "$ac_t""no" 1>&6 fi fi fi fi # Attempt to guess where it might be # Three possible cases # ncurses/curses.h: -Iinc_dir/ncurses -Llib_dir -Llib_dir/ncurses -lncurses # ncurses.h: -Iinc_dir -Llib_dir -lcurses # curses.h: -Iinc_dir -Llib_dir -lcurses if test "$aw_need_r" = "yes"; then # We need the -R for runtime linking # Note this code is repeated below with -R taken away aw_curses_include_dir=/usr/local/include aw_curses_header_look=ncurses/curses.h aw_curses_type=ncurses aw_curses_include=-I/usr/local/include/ncurses aw_curses_lib_path="-L/usr/local/lib -L/usr/local/lib/ncurses -R/usr/local/lib -R/usr/local/lib/ncurses" if test -z "$aw_finished_curses"; then echo $ac_n "checking for ${aw_curses_include_dir}/${aw_curses_header_look}""... $ac_c" 1>&6 echo "configure:3043: checking for ${aw_curses_include_dir}/${aw_curses_header_look}" >&5 if test -f ${aw_curses_include_dir}/${aw_curses_header_look}; then echo "$ac_t""yes" 1>&6 # Temporarily add blurb to LIBS aw_save_libs=$LIBS LIBS="$aw_curses_include $aw_curses_lib_path -l${aw_curses_type} $LIBS" echo $ac_n "checking whether we can link curses using $LIBS""... $ac_c" 1>&6 echo "configure:3050: checking whether we can link curses using $LIBS" >&5 cat > conftest.$ac_ext < int main() { initscr() ; return 0; } EOF if { (eval echo configure:3059: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* # Link succeeded LIBS=$aw_save_libs echo "$ac_t""yes" 1>&6 aw_finished_curses="yes" CURSES_TYPE=$aw_curses_type CURSES_INCLUDE=$aw_curses_include CURSES_LIB_PATH=$aw_curses_lib_path CURSES_LIB=-l$aw_curses_type else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* # Link failed. Do nothing (the search process will # just continue to another possible location). LIBS=$aw_save_libs echo "$ac_t""no" 1>&6 fi rm -f conftest* else echo "$ac_t""no" 1>&6 fi fi aw_curses_include_dir=/usr/local/include aw_curses_header_look=ncurses.h aw_curses_type=ncurses aw_curses_include=-I/usr/local/include aw_curses_lib_path="-L/usr/local/lib -R/usr/local/lib" if test -z "$aw_finished_curses"; then echo $ac_n "checking for ${aw_curses_include_dir}/${aw_curses_header_look}""... $ac_c" 1>&6 echo "configure:3097: checking for ${aw_curses_include_dir}/${aw_curses_header_look}" >&5 if test -f ${aw_curses_include_dir}/${aw_curses_header_look}; then echo "$ac_t""yes" 1>&6 # Temporarily add blurb to LIBS aw_save_libs=$LIBS LIBS="$aw_curses_include $aw_curses_lib_path -l${aw_curses_type} $LIBS" echo $ac_n "checking whether we can link curses using $LIBS""... $ac_c" 1>&6 echo "configure:3104: checking whether we can link curses using $LIBS" >&5 cat > conftest.$ac_ext < int main() { initscr() ; return 0; } EOF if { (eval echo configure:3113: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* # Link succeeded LIBS=$aw_save_libs echo "$ac_t""yes" 1>&6 aw_finished_curses="yes" CURSES_TYPE=$aw_curses_type CURSES_INCLUDE=$aw_curses_include CURSES_LIB_PATH=$aw_curses_lib_path CURSES_LIB=-l$aw_curses_type else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* # Link failed. Do nothing (the search process will # just continue to another possible location). LIBS=$aw_save_libs echo "$ac_t""no" 1>&6 fi rm -f conftest* else echo "$ac_t""no" 1>&6 fi fi aw_curses_include_dir=/usr/local/include aw_curses_header_look=curses.h aw_curses_type=curses aw_curses_include=-I/usr/local/include aw_curses_lib_path="-L/usr/local/lib -R/usr/local/lib" if test -z "$aw_finished_curses"; then echo $ac_n "checking for ${aw_curses_include_dir}/${aw_curses_header_look}""... $ac_c" 1>&6 echo "configure:3151: checking for ${aw_curses_include_dir}/${aw_curses_header_look}" >&5 if test -f ${aw_curses_include_dir}/${aw_curses_header_look}; then echo "$ac_t""yes" 1>&6 # Temporarily add blurb to LIBS aw_save_libs=$LIBS LIBS="$aw_curses_include $aw_curses_lib_path -l${aw_curses_type} $LIBS" echo $ac_n "checking whether we can link curses using $LIBS""... $ac_c" 1>&6 echo "configure:3158: checking whether we can link curses using $LIBS" >&5 cat > conftest.$ac_ext < int main() { initscr() ; return 0; } EOF if { (eval echo configure:3167: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* # Link succeeded LIBS=$aw_save_libs echo "$ac_t""yes" 1>&6 aw_finished_curses="yes" CURSES_TYPE=$aw_curses_type CURSES_INCLUDE=$aw_curses_include CURSES_LIB_PATH=$aw_curses_lib_path CURSES_LIB=-l$aw_curses_type else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* # Link failed. Do nothing (the search process will # just continue to another possible location). LIBS=$aw_save_libs echo "$ac_t""no" 1>&6 fi rm -f conftest* else echo "$ac_t""no" 1>&6 fi fi else # We don't need the -R option # Note this code is repeated above with -R added aw_curses_include_dir=/usr/local/include aw_curses_header_look=ncurses/curses.h aw_curses_type=ncurses aw_curses_include=-I/usr/local/include/ncurses aw_curses_lib_path="-L/usr/local/lib -L/usr/local/lib/ncurses" if test -z "$aw_finished_curses"; then echo $ac_n "checking for ${aw_curses_include_dir}/${aw_curses_header_look}""... $ac_c" 1>&6 echo "configure:3208: checking for ${aw_curses_include_dir}/${aw_curses_header_look}" >&5 if test -f ${aw_curses_include_dir}/${aw_curses_header_look}; then echo "$ac_t""yes" 1>&6 # Temporarily add blurb to LIBS aw_save_libs=$LIBS LIBS="$aw_curses_include $aw_curses_lib_path -l${aw_curses_type} $LIBS" echo $ac_n "checking whether we can link curses using $LIBS""... $ac_c" 1>&6 echo "configure:3215: checking whether we can link curses using $LIBS" >&5 cat > conftest.$ac_ext < int main() { initscr() ; return 0; } EOF if { (eval echo configure:3224: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* # Link succeeded LIBS=$aw_save_libs echo "$ac_t""yes" 1>&6 aw_finished_curses="yes" CURSES_TYPE=$aw_curses_type CURSES_INCLUDE=$aw_curses_include CURSES_LIB_PATH=$aw_curses_lib_path CURSES_LIB=-l$aw_curses_type else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* # Link failed. Do nothing (the search process will # just continue to another possible location). LIBS=$aw_save_libs echo "$ac_t""no" 1>&6 fi rm -f conftest* else echo "$ac_t""no" 1>&6 fi fi aw_curses_include_dir=/usr/local/include aw_curses_header_look=ncurses.h aw_curses_type=ncurses aw_curses_include=-I/usr/local/include aw_curses_lib_path=-L/usr/local/lib if test -z "$aw_finished_curses"; then echo $ac_n "checking for ${aw_curses_include_dir}/${aw_curses_header_look}""... $ac_c" 1>&6 echo "configure:3262: checking for ${aw_curses_include_dir}/${aw_curses_header_look}" >&5 if test -f ${aw_curses_include_dir}/${aw_curses_header_look}; then echo "$ac_t""yes" 1>&6 # Temporarily add blurb to LIBS aw_save_libs=$LIBS LIBS="$aw_curses_include $aw_curses_lib_path -l${aw_curses_type} $LIBS" echo $ac_n "checking whether we can link curses using $LIBS""... $ac_c" 1>&6 echo "configure:3269: checking whether we can link curses using $LIBS" >&5 cat > conftest.$ac_ext < int main() { initscr() ; return 0; } EOF if { (eval echo configure:3278: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* # Link succeeded LIBS=$aw_save_libs echo "$ac_t""yes" 1>&6 aw_finished_curses="yes" CURSES_TYPE=$aw_curses_type CURSES_INCLUDE=$aw_curses_include CURSES_LIB_PATH=$aw_curses_lib_path CURSES_LIB=-l$aw_curses_type else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* # Link failed. Do nothing (the search process will # just continue to another possible location). LIBS=$aw_save_libs echo "$ac_t""no" 1>&6 fi rm -f conftest* else echo "$ac_t""no" 1>&6 fi fi aw_curses_include_dir=/usr/local/include aw_curses_header_look=curses.h aw_curses_type=curses aw_curses_include=-I/usr/local/include aw_curses_lib_path=-L/usr/local/lib if test -z "$aw_finished_curses"; then echo $ac_n "checking for ${aw_curses_include_dir}/${aw_curses_header_look}""... $ac_c" 1>&6 echo "configure:3316: checking for ${aw_curses_include_dir}/${aw_curses_header_look}" >&5 if test -f ${aw_curses_include_dir}/${aw_curses_header_look}; then echo "$ac_t""yes" 1>&6 # Temporarily add blurb to LIBS aw_save_libs=$LIBS LIBS="$aw_curses_include $aw_curses_lib_path -l${aw_curses_type} $LIBS" echo $ac_n "checking whether we can link curses using $LIBS""... $ac_c" 1>&6 echo "configure:3323: checking whether we can link curses using $LIBS" >&5 cat > conftest.$ac_ext < int main() { initscr() ; return 0; } EOF if { (eval echo configure:3332: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* # Link succeeded LIBS=$aw_save_libs echo "$ac_t""yes" 1>&6 aw_finished_curses="yes" CURSES_TYPE=$aw_curses_type CURSES_INCLUDE=$aw_curses_include CURSES_LIB_PATH=$aw_curses_lib_path CURSES_LIB=-l$aw_curses_type else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* # Link failed. Do nothing (the search process will # just continue to another possible location). LIBS=$aw_save_libs echo "$ac_t""no" 1>&6 fi rm -f conftest* else echo "$ac_t""no" 1>&6 fi fi fi # Three possible cases # ncurses/curses.h: -Iinc_dir/ncurses -Llib_dir -Llib_dir/ncurses -lncurses # ncurses.h: -Iinc_dir -Llib_dir -lcurses # curses.h: -Iinc_dir -Llib_dir -lcurses if test "$aw_need_r" = "yes"; then # We need the -R for runtime linking # Note this code is repeated below with -R taken away aw_curses_include_dir=/gnu/include aw_curses_header_look=ncurses/curses.h aw_curses_type=ncurses aw_curses_include=-I/gnu/include/ncurses aw_curses_lib_path="-L/gnu/lib -L/gnu/lib/ncurses -R/gnu/lib -R/gnu/lib/ncurses" if test -z "$aw_finished_curses"; then echo $ac_n "checking for ${aw_curses_include_dir}/${aw_curses_header_look}""... $ac_c" 1>&6 echo "configure:3380: checking for ${aw_curses_include_dir}/${aw_curses_header_look}" >&5 if test -f ${aw_curses_include_dir}/${aw_curses_header_look}; then echo "$ac_t""yes" 1>&6 # Temporarily add blurb to LIBS aw_save_libs=$LIBS LIBS="$aw_curses_include $aw_curses_lib_path -l${aw_curses_type} $LIBS" echo $ac_n "checking whether we can link curses using $LIBS""... $ac_c" 1>&6 echo "configure:3387: checking whether we can link curses using $LIBS" >&5 cat > conftest.$ac_ext < int main() { initscr() ; return 0; } EOF if { (eval echo configure:3396: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* # Link succeeded LIBS=$aw_save_libs echo "$ac_t""yes" 1>&6 aw_finished_curses="yes" CURSES_TYPE=$aw_curses_type CURSES_INCLUDE=$aw_curses_include CURSES_LIB_PATH=$aw_curses_lib_path CURSES_LIB=-l$aw_curses_type else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* # Link failed. Do nothing (the search process will # just continue to another possible location). LIBS=$aw_save_libs echo "$ac_t""no" 1>&6 fi rm -f conftest* else echo "$ac_t""no" 1>&6 fi fi aw_curses_include_dir=/gnu/include aw_curses_header_look=ncurses.h aw_curses_type=ncurses aw_curses_include=-I/gnu/include aw_curses_lib_path="-L/gnu/lib -R/gnu/lib" if test -z "$aw_finished_curses"; then echo $ac_n "checking for ${aw_curses_include_dir}/${aw_curses_header_look}""... $ac_c" 1>&6 echo "configure:3434: checking for ${aw_curses_include_dir}/${aw_curses_header_look}" >&5 if test -f ${aw_curses_include_dir}/${aw_curses_header_look}; then echo "$ac_t""yes" 1>&6 # Temporarily add blurb to LIBS aw_save_libs=$LIBS LIBS="$aw_curses_include $aw_curses_lib_path -l${aw_curses_type} $LIBS" echo $ac_n "checking whether we can link curses using $LIBS""... $ac_c" 1>&6 echo "configure:3441: checking whether we can link curses using $LIBS" >&5 cat > conftest.$ac_ext < int main() { initscr() ; return 0; } EOF if { (eval echo configure:3450: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* # Link succeeded LIBS=$aw_save_libs echo "$ac_t""yes" 1>&6 aw_finished_curses="yes" CURSES_TYPE=$aw_curses_type CURSES_INCLUDE=$aw_curses_include CURSES_LIB_PATH=$aw_curses_lib_path CURSES_LIB=-l$aw_curses_type else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* # Link failed. Do nothing (the search process will # just continue to another possible location). LIBS=$aw_save_libs echo "$ac_t""no" 1>&6 fi rm -f conftest* else echo "$ac_t""no" 1>&6 fi fi aw_curses_include_dir=/gnu/include aw_curses_header_look=curses.h aw_curses_type=curses aw_curses_include=-I/gnu/include aw_curses_lib_path="-L/gnu/lib -R/gnu/lib" if test -z "$aw_finished_curses"; then echo $ac_n "checking for ${aw_curses_include_dir}/${aw_curses_header_look}""... $ac_c" 1>&6 echo "configure:3488: checking for ${aw_curses_include_dir}/${aw_curses_header_look}" >&5 if test -f ${aw_curses_include_dir}/${aw_curses_header_look}; then echo "$ac_t""yes" 1>&6 # Temporarily add blurb to LIBS aw_save_libs=$LIBS LIBS="$aw_curses_include $aw_curses_lib_path -l${aw_curses_type} $LIBS" echo $ac_n "checking whether we can link curses using $LIBS""... $ac_c" 1>&6 echo "configure:3495: checking whether we can link curses using $LIBS" >&5 cat > conftest.$ac_ext < int main() { initscr() ; return 0; } EOF if { (eval echo configure:3504: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* # Link succeeded LIBS=$aw_save_libs echo "$ac_t""yes" 1>&6 aw_finished_curses="yes" CURSES_TYPE=$aw_curses_type CURSES_INCLUDE=$aw_curses_include CURSES_LIB_PATH=$aw_curses_lib_path CURSES_LIB=-l$aw_curses_type else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* # Link failed. Do nothing (the search process will # just continue to another possible location). LIBS=$aw_save_libs echo "$ac_t""no" 1>&6 fi rm -f conftest* else echo "$ac_t""no" 1>&6 fi fi else # We don't need the -R option # Note this code is repeated above with -R added aw_curses_include_dir=/gnu/include aw_curses_header_look=ncurses/curses.h aw_curses_type=ncurses aw_curses_include=-I/gnu/include/ncurses aw_curses_lib_path="-L/gnu/lib -L/gnu/lib/ncurses" if test -z "$aw_finished_curses"; then echo $ac_n "checking for ${aw_curses_include_dir}/${aw_curses_header_look}""... $ac_c" 1>&6 echo "configure:3545: checking for ${aw_curses_include_dir}/${aw_curses_header_look}" >&5 if test -f ${aw_curses_include_dir}/${aw_curses_header_look}; then echo "$ac_t""yes" 1>&6 # Temporarily add blurb to LIBS aw_save_libs=$LIBS LIBS="$aw_curses_include $aw_curses_lib_path -l${aw_curses_type} $LIBS" echo $ac_n "checking whether we can link curses using $LIBS""... $ac_c" 1>&6 echo "configure:3552: checking whether we can link curses using $LIBS" >&5 cat > conftest.$ac_ext < int main() { initscr() ; return 0; } EOF if { (eval echo configure:3561: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* # Link succeeded LIBS=$aw_save_libs echo "$ac_t""yes" 1>&6 aw_finished_curses="yes" CURSES_TYPE=$aw_curses_type CURSES_INCLUDE=$aw_curses_include CURSES_LIB_PATH=$aw_curses_lib_path CURSES_LIB=-l$aw_curses_type else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* # Link failed. Do nothing (the search process will # just continue to another possible location). LIBS=$aw_save_libs echo "$ac_t""no" 1>&6 fi rm -f conftest* else echo "$ac_t""no" 1>&6 fi fi aw_curses_include_dir=/gnu/include aw_curses_header_look=ncurses.h aw_curses_type=ncurses aw_curses_include=-I/gnu/include aw_curses_lib_path=-L/gnu/lib if test -z "$aw_finished_curses"; then echo $ac_n "checking for ${aw_curses_include_dir}/${aw_curses_header_look}""... $ac_c" 1>&6 echo "configure:3599: checking for ${aw_curses_include_dir}/${aw_curses_header_look}" >&5 if test -f ${aw_curses_include_dir}/${aw_curses_header_look}; then echo "$ac_t""yes" 1>&6 # Temporarily add blurb to LIBS aw_save_libs=$LIBS LIBS="$aw_curses_include $aw_curses_lib_path -l${aw_curses_type} $LIBS" echo $ac_n "checking whether we can link curses using $LIBS""... $ac_c" 1>&6 echo "configure:3606: checking whether we can link curses using $LIBS" >&5 cat > conftest.$ac_ext < int main() { initscr() ; return 0; } EOF if { (eval echo configure:3615: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* # Link succeeded LIBS=$aw_save_libs echo "$ac_t""yes" 1>&6 aw_finished_curses="yes" CURSES_TYPE=$aw_curses_type CURSES_INCLUDE=$aw_curses_include CURSES_LIB_PATH=$aw_curses_lib_path CURSES_LIB=-l$aw_curses_type else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* # Link failed. Do nothing (the search process will # just continue to another possible location). LIBS=$aw_save_libs echo "$ac_t""no" 1>&6 fi rm -f conftest* else echo "$ac_t""no" 1>&6 fi fi aw_curses_include_dir=/gnu/include aw_curses_header_look=curses.h aw_curses_type=curses aw_curses_include=-I/gnu/include aw_curses_lib_path=-L/gnu/lib if test -z "$aw_finished_curses"; then echo $ac_n "checking for ${aw_curses_include_dir}/${aw_curses_header_look}""... $ac_c" 1>&6 echo "configure:3653: checking for ${aw_curses_include_dir}/${aw_curses_header_look}" >&5 if test -f ${aw_curses_include_dir}/${aw_curses_header_look}; then echo "$ac_t""yes" 1>&6 # Temporarily add blurb to LIBS aw_save_libs=$LIBS LIBS="$aw_curses_include $aw_curses_lib_path -l${aw_curses_type} $LIBS" echo $ac_n "checking whether we can link curses using $LIBS""... $ac_c" 1>&6 echo "configure:3660: checking whether we can link curses using $LIBS" >&5 cat > conftest.$ac_ext < int main() { initscr() ; return 0; } EOF if { (eval echo configure:3669: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* # Link succeeded LIBS=$aw_save_libs echo "$ac_t""yes" 1>&6 aw_finished_curses="yes" CURSES_TYPE=$aw_curses_type CURSES_INCLUDE=$aw_curses_include CURSES_LIB_PATH=$aw_curses_lib_path CURSES_LIB=-l$aw_curses_type else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* # Link failed. Do nothing (the search process will # just continue to another possible location). LIBS=$aw_save_libs echo "$ac_t""no" 1>&6 fi rm -f conftest* else echo "$ac_t""no" 1>&6 fi fi fi # Three possible cases # ncurses/curses.h: -Iinc_dir/ncurses -Llib_dir -Llib_dir/ncurses -lncurses # ncurses.h: -Iinc_dir -Llib_dir -lcurses # curses.h: -Iinc_dir -Llib_dir -lcurses if test "$aw_need_r" = "yes"; then # We need the -R for runtime linking # Note this code is repeated below with -R taken away aw_curses_include_dir=/usr/include aw_curses_header_look=ncurses/curses.h aw_curses_type=ncurses aw_curses_include=-I/usr/include/ncurses aw_curses_lib_path="-L/usr/lib -L/usr/lib/ncurses -R/usr/lib -R/usr/lib/ncurses" if test -z "$aw_finished_curses"; then echo $ac_n "checking for ${aw_curses_include_dir}/${aw_curses_header_look}""... $ac_c" 1>&6 echo "configure:3717: checking for ${aw_curses_include_dir}/${aw_curses_header_look}" >&5 if test -f ${aw_curses_include_dir}/${aw_curses_header_look}; then echo "$ac_t""yes" 1>&6 # Temporarily add blurb to LIBS aw_save_libs=$LIBS LIBS="$aw_curses_include $aw_curses_lib_path -l${aw_curses_type} $LIBS" echo $ac_n "checking whether we can link curses using $LIBS""... $ac_c" 1>&6 echo "configure:3724: checking whether we can link curses using $LIBS" >&5 cat > conftest.$ac_ext < int main() { initscr() ; return 0; } EOF if { (eval echo configure:3733: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* # Link succeeded LIBS=$aw_save_libs echo "$ac_t""yes" 1>&6 aw_finished_curses="yes" CURSES_TYPE=$aw_curses_type CURSES_INCLUDE=$aw_curses_include CURSES_LIB_PATH=$aw_curses_lib_path CURSES_LIB=-l$aw_curses_type else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* # Link failed. Do nothing (the search process will # just continue to another possible location). LIBS=$aw_save_libs echo "$ac_t""no" 1>&6 fi rm -f conftest* else echo "$ac_t""no" 1>&6 fi fi aw_curses_include_dir=/usr/include aw_curses_header_look=ncurses.h aw_curses_type=ncurses aw_curses_include=-I/usr/include aw_curses_lib_path="-L/usr/lib -R/usr/lib" if test -z "$aw_finished_curses"; then echo $ac_n "checking for ${aw_curses_include_dir}/${aw_curses_header_look}""... $ac_c" 1>&6 echo "configure:3771: checking for ${aw_curses_include_dir}/${aw_curses_header_look}" >&5 if test -f ${aw_curses_include_dir}/${aw_curses_header_look}; then echo "$ac_t""yes" 1>&6 # Temporarily add blurb to LIBS aw_save_libs=$LIBS LIBS="$aw_curses_include $aw_curses_lib_path -l${aw_curses_type} $LIBS" echo $ac_n "checking whether we can link curses using $LIBS""... $ac_c" 1>&6 echo "configure:3778: checking whether we can link curses using $LIBS" >&5 cat > conftest.$ac_ext < int main() { initscr() ; return 0; } EOF if { (eval echo configure:3787: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* # Link succeeded LIBS=$aw_save_libs echo "$ac_t""yes" 1>&6 aw_finished_curses="yes" CURSES_TYPE=$aw_curses_type CURSES_INCLUDE=$aw_curses_include CURSES_LIB_PATH=$aw_curses_lib_path CURSES_LIB=-l$aw_curses_type else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* # Link failed. Do nothing (the search process will # just continue to another possible location). LIBS=$aw_save_libs echo "$ac_t""no" 1>&6 fi rm -f conftest* else echo "$ac_t""no" 1>&6 fi fi aw_curses_include_dir=/usr/include aw_curses_header_look=curses.h aw_curses_type=curses aw_curses_include=-I/usr/include aw_curses_lib_path="-L/usr/lib -R/usr/lib" if test -z "$aw_finished_curses"; then echo $ac_n "checking for ${aw_curses_include_dir}/${aw_curses_header_look}""... $ac_c" 1>&6 echo "configure:3825: checking for ${aw_curses_include_dir}/${aw_curses_header_look}" >&5 if test -f ${aw_curses_include_dir}/${aw_curses_header_look}; then echo "$ac_t""yes" 1>&6 # Temporarily add blurb to LIBS aw_save_libs=$LIBS LIBS="$aw_curses_include $aw_curses_lib_path -l${aw_curses_type} $LIBS" echo $ac_n "checking whether we can link curses using $LIBS""... $ac_c" 1>&6 echo "configure:3832: checking whether we can link curses using $LIBS" >&5 cat > conftest.$ac_ext < int main() { initscr() ; return 0; } EOF if { (eval echo configure:3841: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* # Link succeeded LIBS=$aw_save_libs echo "$ac_t""yes" 1>&6 aw_finished_curses="yes" CURSES_TYPE=$aw_curses_type CURSES_INCLUDE=$aw_curses_include CURSES_LIB_PATH=$aw_curses_lib_path CURSES_LIB=-l$aw_curses_type else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* # Link failed. Do nothing (the search process will # just continue to another possible location). LIBS=$aw_save_libs echo "$ac_t""no" 1>&6 fi rm -f conftest* else echo "$ac_t""no" 1>&6 fi fi else # We don't need the -R option # Note this code is repeated above with -R added aw_curses_include_dir=/usr/include aw_curses_header_look=ncurses/curses.h aw_curses_type=ncurses aw_curses_include=-I/usr/include/ncurses aw_curses_lib_path="-L/usr/lib -L/usr/lib/ncurses" if test -z "$aw_finished_curses"; then echo $ac_n "checking for ${aw_curses_include_dir}/${aw_curses_header_look}""... $ac_c" 1>&6 echo "configure:3882: checking for ${aw_curses_include_dir}/${aw_curses_header_look}" >&5 if test -f ${aw_curses_include_dir}/${aw_curses_header_look}; then echo "$ac_t""yes" 1>&6 # Temporarily add blurb to LIBS aw_save_libs=$LIBS LIBS="$aw_curses_include $aw_curses_lib_path -l${aw_curses_type} $LIBS" echo $ac_n "checking whether we can link curses using $LIBS""... $ac_c" 1>&6 echo "configure:3889: checking whether we can link curses using $LIBS" >&5 cat > conftest.$ac_ext < int main() { initscr() ; return 0; } EOF if { (eval echo configure:3898: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* # Link succeeded LIBS=$aw_save_libs echo "$ac_t""yes" 1>&6 aw_finished_curses="yes" CURSES_TYPE=$aw_curses_type CURSES_INCLUDE=$aw_curses_include CURSES_LIB_PATH=$aw_curses_lib_path CURSES_LIB=-l$aw_curses_type else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* # Link failed. Do nothing (the search process will # just continue to another possible location). LIBS=$aw_save_libs echo "$ac_t""no" 1>&6 fi rm -f conftest* else echo "$ac_t""no" 1>&6 fi fi aw_curses_include_dir=/usr/include aw_curses_header_look=ncurses.h aw_curses_type=ncurses aw_curses_include=-I/usr/include aw_curses_lib_path=-L/usr/lib if test -z "$aw_finished_curses"; then echo $ac_n "checking for ${aw_curses_include_dir}/${aw_curses_header_look}""... $ac_c" 1>&6 echo "configure:3936: checking for ${aw_curses_include_dir}/${aw_curses_header_look}" >&5 if test -f ${aw_curses_include_dir}/${aw_curses_header_look}; then echo "$ac_t""yes" 1>&6 # Temporarily add blurb to LIBS aw_save_libs=$LIBS LIBS="$aw_curses_include $aw_curses_lib_path -l${aw_curses_type} $LIBS" echo $ac_n "checking whether we can link curses using $LIBS""... $ac_c" 1>&6 echo "configure:3943: checking whether we can link curses using $LIBS" >&5 cat > conftest.$ac_ext < int main() { initscr() ; return 0; } EOF if { (eval echo configure:3952: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* # Link succeeded LIBS=$aw_save_libs echo "$ac_t""yes" 1>&6 aw_finished_curses="yes" CURSES_TYPE=$aw_curses_type CURSES_INCLUDE=$aw_curses_include CURSES_LIB_PATH=$aw_curses_lib_path CURSES_LIB=-l$aw_curses_type else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* # Link failed. Do nothing (the search process will # just continue to another possible location). LIBS=$aw_save_libs echo "$ac_t""no" 1>&6 fi rm -f conftest* else echo "$ac_t""no" 1>&6 fi fi aw_curses_include_dir=/usr/include aw_curses_header_look=curses.h aw_curses_type=curses aw_curses_include=-I/usr/include aw_curses_lib_path=-L/usr/lib if test -z "$aw_finished_curses"; then echo $ac_n "checking for ${aw_curses_include_dir}/${aw_curses_header_look}""... $ac_c" 1>&6 echo "configure:3990: checking for ${aw_curses_include_dir}/${aw_curses_header_look}" >&5 if test -f ${aw_curses_include_dir}/${aw_curses_header_look}; then echo "$ac_t""yes" 1>&6 # Temporarily add blurb to LIBS aw_save_libs=$LIBS LIBS="$aw_curses_include $aw_curses_lib_path -l${aw_curses_type} $LIBS" echo $ac_n "checking whether we can link curses using $LIBS""... $ac_c" 1>&6 echo "configure:3997: checking whether we can link curses using $LIBS" >&5 cat > conftest.$ac_ext < int main() { initscr() ; return 0; } EOF if { (eval echo configure:4006: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* # Link succeeded LIBS=$aw_save_libs echo "$ac_t""yes" 1>&6 aw_finished_curses="yes" CURSES_TYPE=$aw_curses_type CURSES_INCLUDE=$aw_curses_include CURSES_LIB_PATH=$aw_curses_lib_path CURSES_LIB=-l$aw_curses_type else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* # Link failed. Do nothing (the search process will # just continue to another possible location). LIBS=$aw_save_libs echo "$ac_t""no" 1>&6 fi rm -f conftest* else echo "$ac_t""no" 1>&6 fi fi fi # Declare the type of curses found so that we can include the # appropriate header file, and include the curses object in the list # of objects to be built in the appropriate Makefiles if test "$CURSES_TYPE" = "ncurses"; then cat >> confdefs.h <<\EOF #define HAVE_NCURSES 1 EOF HAVE_CURSES="ncurses" elif test "$CURSES_TYPE" = "curses"; then cat >> confdefs.h <<\EOF #define HAVE_CURSES 1 EOF HAVE_CURSES="curses" else HAVE_CURSES="" fi # Print results echo $ac_n "checking for curses""... $ac_c" 1>&6 echo "configure:4060: checking for curses" >&5 echo "$ac_t""$CURSES_TYPE $CURSES_INCLUDE $CURSES_LIB $CURSES_LIB_PATH $CURSES_IF_ENABLED" 1>&6 ######################################################################### # tcl ######################################################################### # # Sets Example # TCL_INCLUDE -I/usr/local/include # TCL_LIB -L/usr/local/lib -ltcl # # Check whether --with-tcl-include or --without-tcl-include was given. if test "${with_tcl_include+set}" = set; then withval="$with_tcl_include" aw_user_tcl_include=$withval fi # Check whether --with-tcl-lib or --without-tcl-lib was given. if test "${with_tcl_lib+set}" = set; then withval="$with_tcl_lib" aw_user_tcl_lib=$withval fi # If the user provided both or either option, then try it first if test -n "$aw_user_tcl_include" -o -n "$aw_user_tcl_lib"; then aw_tcl_include=$aw_user_tcl_include aw_tcl_lib=$aw_user_tcl_lib if test "$aw_need_r" = "yes"; then # !@!@ This bit should really be an AC function # Note I need m4 [] quotes around this so that the brackets in the # sed expression do not get eaten aw_tcl_lib=`echo $aw_tcl_lib | sed 's/-L\([^ ]*\)/-L\1 -R\1/'` fi # If we haven't already found an answer... if test -z "$aw_finished_tcl"; then aw_save_libs=$LIBS LIBS="$aw_tcl_include $aw_tcl_lib $LIBS" echo $ac_n "checking whether we can link tcl using $LIBS""... $ac_c" 1>&6 echo "configure:4109: checking whether we can link tcl using $LIBS" >&5 cat > conftest.$ac_ext < int main() { Tcl_AsyncReady() ; return 0; } EOF if { (eval echo configure:4119: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* # Link succeeded echo "$ac_t""yes" 1>&6 # Don't do any more tests - we have the answer aw_finished_tcl="yes" TCL_INCLUDE=$aw_tcl_include TCL_LIB=$aw_tcl_lib echo $ac_n "checking whether tcl has Tcl_EvalEx""... $ac_c" 1>&6 echo "configure:4129: checking whether tcl has Tcl_EvalEx" >&5 cat > conftest.$ac_ext < int main() { Tcl_Interp *interp; Tcl_EvalEx(interp, "", -1, 0) ; return 0; } EOF if { (eval echo configure:4141: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* echo "$ac_t""yes" 1>&6 cat >> confdefs.h <<\EOF #define HAVE_TCL_EVALEX 1 EOF else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* echo "$ac_t""no" 1>&6 fi rm -f conftest* LIBS=$aw_save_libs else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* # Link failed - do nothing. LIBS=$aw_save_libs echo "$ac_t""no" 1>&6 fi rm -f conftest* fi fi # Else can we use tcl with just -ltcl? aw_tcl_include= aw_tcl_lib="-ltcl" if test "$aw_need_r" = "yes"; then # !@!@ This bit should really be an AC function # Note I need m4 [] quotes around this so that the brackets in the # sed expression do not get eaten aw_tcl_lib=`echo $aw_tcl_lib | sed 's/-L\([^ ]*\)/-L\1 -R\1/'` fi # If we haven't already found an answer... if test -z "$aw_finished_tcl"; then aw_save_libs=$LIBS LIBS="$aw_tcl_include $aw_tcl_lib $LIBS" echo $ac_n "checking whether we can link tcl using $LIBS""... $ac_c" 1>&6 echo "configure:4195: checking whether we can link tcl using $LIBS" >&5 cat > conftest.$ac_ext < int main() { Tcl_AsyncReady() ; return 0; } EOF if { (eval echo configure:4205: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* # Link succeeded echo "$ac_t""yes" 1>&6 # Don't do any more tests - we have the answer aw_finished_tcl="yes" TCL_INCLUDE=$aw_tcl_include TCL_LIB=$aw_tcl_lib echo $ac_n "checking whether tcl has Tcl_EvalEx""... $ac_c" 1>&6 echo "configure:4215: checking whether tcl has Tcl_EvalEx" >&5 cat > conftest.$ac_ext < int main() { Tcl_Interp *interp; Tcl_EvalEx(interp, "", -1, 0) ; return 0; } EOF if { (eval echo configure:4227: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* echo "$ac_t""yes" 1>&6 cat >> confdefs.h <<\EOF #define HAVE_TCL_EVALEX 1 EOF else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* echo "$ac_t""no" 1>&6 fi rm -f conftest* LIBS=$aw_save_libs else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* # Link failed - do nothing. LIBS=$aw_save_libs echo "$ac_t""no" 1>&6 fi rm -f conftest* fi # Now we're guessing... :) # This works at DCS, University of TV aw_tcl_include="-I/usr/local/include" aw_tcl_lib="-L/usr/local/lib -ltcl" if test "$aw_need_r" = "yes"; then # !@!@ This bit should really be an AC function # Note I need m4 [] quotes around this so that the brackets in the # sed expression do not get eaten aw_tcl_lib=`echo $aw_tcl_lib | sed 's/-L\([^ ]*\)/-L\1 -R\1/'` fi # If we haven't already found an answer... if test -z "$aw_finished_tcl"; then aw_save_libs=$LIBS LIBS="$aw_tcl_include $aw_tcl_lib $LIBS" echo $ac_n "checking whether we can link tcl using $LIBS""... $ac_c" 1>&6 echo "configure:4282: checking whether we can link tcl using $LIBS" >&5 cat > conftest.$ac_ext < int main() { Tcl_AsyncReady() ; return 0; } EOF if { (eval echo configure:4292: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* # Link succeeded echo "$ac_t""yes" 1>&6 # Don't do any more tests - we have the answer aw_finished_tcl="yes" TCL_INCLUDE=$aw_tcl_include TCL_LIB=$aw_tcl_lib echo $ac_n "checking whether tcl has Tcl_EvalEx""... $ac_c" 1>&6 echo "configure:4302: checking whether tcl has Tcl_EvalEx" >&5 cat > conftest.$ac_ext < int main() { Tcl_Interp *interp; Tcl_EvalEx(interp, "", -1, 0) ; return 0; } EOF if { (eval echo configure:4314: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* echo "$ac_t""yes" 1>&6 cat >> confdefs.h <<\EOF #define HAVE_TCL_EVALEX 1 EOF else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* echo "$ac_t""no" 1>&6 fi rm -f conftest* LIBS=$aw_save_libs else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* # Link failed - do nothing. LIBS=$aw_save_libs echo "$ac_t""no" 1>&6 fi rm -f conftest* fi # This works at ITS, University of TV aw_tcl_include= aw_tcl_lib="-L/usr/local/lib -ltcl8.0" if test "$aw_need_r" = "yes"; then # !@!@ This bit should really be an AC function # Note I need m4 [] quotes around this so that the brackets in the # sed expression do not get eaten aw_tcl_lib=`echo $aw_tcl_lib | sed 's/-L\([^ ]*\)/-L\1 -R\1/'` fi # If we haven't already found an answer... if test -z "$aw_finished_tcl"; then aw_save_libs=$LIBS LIBS="$aw_tcl_include $aw_tcl_lib $LIBS" echo $ac_n "checking whether we can link tcl using $LIBS""... $ac_c" 1>&6 echo "configure:4367: checking whether we can link tcl using $LIBS" >&5 cat > conftest.$ac_ext < int main() { Tcl_AsyncReady() ; return 0; } EOF if { (eval echo configure:4377: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* # Link succeeded echo "$ac_t""yes" 1>&6 # Don't do any more tests - we have the answer aw_finished_tcl="yes" TCL_INCLUDE=$aw_tcl_include TCL_LIB=$aw_tcl_lib echo $ac_n "checking whether tcl has Tcl_EvalEx""... $ac_c" 1>&6 echo "configure:4387: checking whether tcl has Tcl_EvalEx" >&5 cat > conftest.$ac_ext < int main() { Tcl_Interp *interp; Tcl_EvalEx(interp, "", -1, 0) ; return 0; } EOF if { (eval echo configure:4399: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* echo "$ac_t""yes" 1>&6 cat >> confdefs.h <<\EOF #define HAVE_TCL_EVALEX 1 EOF else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* echo "$ac_t""no" 1>&6 fi rm -f conftest* LIBS=$aw_save_libs else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* # Link failed - do nothing. LIBS=$aw_save_libs echo "$ac_t""no" 1>&6 fi rm -f conftest* fi # This works on ride, a Sparc Solaris 7 machine with packages # from sunfreeware.com aw_tcl_include= aw_tcl_lib="-L/usr/local/lib -ltcl" if test "$aw_need_r" = "yes"; then # !@!@ This bit should really be an AC function # Note I need m4 [] quotes around this so that the brackets in the # sed expression do not get eaten aw_tcl_lib=`echo $aw_tcl_lib | sed 's/-L\([^ ]*\)/-L\1 -R\1/'` fi # If we haven't already found an answer... if test -z "$aw_finished_tcl"; then aw_save_libs=$LIBS LIBS="$aw_tcl_include $aw_tcl_lib $LIBS" echo $ac_n "checking whether we can link tcl using $LIBS""... $ac_c" 1>&6 echo "configure:4453: checking whether we can link tcl using $LIBS" >&5 cat > conftest.$ac_ext < int main() { Tcl_AsyncReady() ; return 0; } EOF if { (eval echo configure:4463: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* # Link succeeded echo "$ac_t""yes" 1>&6 # Don't do any more tests - we have the answer aw_finished_tcl="yes" TCL_INCLUDE=$aw_tcl_include TCL_LIB=$aw_tcl_lib echo $ac_n "checking whether tcl has Tcl_EvalEx""... $ac_c" 1>&6 echo "configure:4473: checking whether tcl has Tcl_EvalEx" >&5 cat > conftest.$ac_ext < int main() { Tcl_Interp *interp; Tcl_EvalEx(interp, "", -1, 0) ; return 0; } EOF if { (eval echo configure:4485: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* echo "$ac_t""yes" 1>&6 cat >> confdefs.h <<\EOF #define HAVE_TCL_EVALEX 1 EOF else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* echo "$ac_t""no" 1>&6 fi rm -f conftest* LIBS=$aw_save_libs else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* # Link failed - do nothing. LIBS=$aw_save_libs echo "$ac_t""no" 1>&6 fi rm -f conftest* fi # I give a warning if tcl is not found at the end of the script ######################################################################### # tk ######################################################################### # # Sets Example # TK_INCLUDE -I/usr/local/include # TK_LIB -L/usr/local/lib -ltk # # Check whether --with-tk-include or --without-tk-include was given. if test "${with_tk_include+set}" = set; then withval="$with_tk_include" aw_user_tk_include=$withval fi # Check whether --with-tk-lib or --without-tk-lib was given. if test "${with_tk_lib+set}" = set; then withval="$with_tk_lib" aw_user_tk_lib=$withval fi # If the user provided both or either option, then try it first if test -n "$aw_user_tk_include" -o -n "$aw_user_tk_lib"; then aw_tk_include=$aw_user_tk_include aw_tk_lib=$aw_user_tk_lib if test "$aw_need_r" = "yes"; then # Note I need m4 [] quotes around this so that the brackets in the # sed expression do not get eaten aw_tk_lib=`echo $aw_tk_lib | sed 's/-L\([^ ]*\)/-L\1 -R\1/'` fi # If we haven't already found an answer... if test -z "$aw_finished_tk"; then aw_save_libs=$LIBS # Also add X stuff and tcl stuff. Existing LIBS must go at the # end: -lm must come after -ltk for example. # NB don't seem to need $AW_X_LIBS and -lglPNG may cause an error LIBS="$aw_tk_include $aw_tk_lib $X_CFLAGS $X_PRE_LIBS $X_LIBS $X_EXTRA_LIBS $TCL_INCLUDE $TCL_LIB $LIBS" echo $ac_n "checking whether we can link tk using $LIBS""... $ac_c" 1>&6 echo "configure:4571: checking whether we can link tk using $LIBS" >&5 cat > conftest.$ac_ext < int main() { Tk_GetNumMainWindows(); ; return 0; } EOF if { (eval echo configure:4581: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* # Link succeeded LIBS=$aw_save_libs echo "$ac_t""yes" 1>&6 # Don't do any more tests - we have the answer aw_finished_tk="yes" TK_INCLUDE=$aw_tk_include TK_LIB=$aw_tk_lib else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* # Link failed - do nothing. LIBS=$aw_save_libs echo "$ac_t""no" 1>&6 fi rm -f conftest* fi fi # Else can we use tk with just -ltk? aw_tk_include= aw_tk_lib="-ltk" if test "$aw_need_r" = "yes"; then # Note I need m4 [] quotes around this so that the brackets in the # sed expression do not get eaten aw_tk_lib=`echo $aw_tk_lib | sed 's/-L\([^ ]*\)/-L\1 -R\1/'` fi # If we haven't already found an answer... if test -z "$aw_finished_tk"; then aw_save_libs=$LIBS # Also add X stuff and tcl stuff. Existing LIBS must go at the # end: -lm must come after -ltk for example. # NB don't seem to need $AW_X_LIBS and -lglPNG may cause an error LIBS="$aw_tk_include $aw_tk_lib $X_CFLAGS $X_PRE_LIBS $X_LIBS $X_EXTRA_LIBS $TCL_INCLUDE $TCL_LIB $LIBS" echo $ac_n "checking whether we can link tk using $LIBS""... $ac_c" 1>&6 echo "configure:4627: checking whether we can link tk using $LIBS" >&5 cat > conftest.$ac_ext < int main() { Tk_GetNumMainWindows(); ; return 0; } EOF if { (eval echo configure:4637: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* # Link succeeded LIBS=$aw_save_libs echo "$ac_t""yes" 1>&6 # Don't do any more tests - we have the answer aw_finished_tk="yes" TK_INCLUDE=$aw_tk_include TK_LIB=$aw_tk_lib else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* # Link failed - do nothing. LIBS=$aw_save_libs echo "$ac_t""no" 1>&6 fi rm -f conftest* fi # Now we're guessing... :) # This works at DCS, University of TV aw_tk_include="-I/usr/local/include" aw_tk_lib="-L/usr/local/lib -ltk" if test "$aw_need_r" = "yes"; then # Note I need m4 [] quotes around this so that the brackets in the # sed expression do not get eaten aw_tk_lib=`echo $aw_tk_lib | sed 's/-L\([^ ]*\)/-L\1 -R\1/'` fi # If we haven't already found an answer... if test -z "$aw_finished_tk"; then aw_save_libs=$LIBS # Also add X stuff and tcl stuff. Existing LIBS must go at the # end: -lm must come after -ltk for example. # NB don't seem to need $AW_X_LIBS and -lglPNG may cause an error LIBS="$aw_tk_include $aw_tk_lib $X_CFLAGS $X_PRE_LIBS $X_LIBS $X_EXTRA_LIBS $TCL_INCLUDE $TCL_LIB $LIBS" echo $ac_n "checking whether we can link tk using $LIBS""... $ac_c" 1>&6 echo "configure:4684: checking whether we can link tk using $LIBS" >&5 cat > conftest.$ac_ext < int main() { Tk_GetNumMainWindows(); ; return 0; } EOF if { (eval echo configure:4694: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* # Link succeeded LIBS=$aw_save_libs echo "$ac_t""yes" 1>&6 # Don't do any more tests - we have the answer aw_finished_tk="yes" TK_INCLUDE=$aw_tk_include TK_LIB=$aw_tk_lib else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* # Link failed - do nothing. LIBS=$aw_save_libs echo "$ac_t""no" 1>&6 fi rm -f conftest* fi # This works at ITS, University of TV aw_tk_include= aw_tk_lib="-L/usr/local/lib -ltk8.0" if test "$aw_need_r" = "yes"; then # Note I need m4 [] quotes around this so that the brackets in the # sed expression do not get eaten aw_tk_lib=`echo $aw_tk_lib | sed 's/-L\([^ ]*\)/-L\1 -R\1/'` fi # If we haven't already found an answer... if test -z "$aw_finished_tk"; then aw_save_libs=$LIBS # Also add X stuff and tcl stuff. Existing LIBS must go at the # end: -lm must come after -ltk for example. # NB don't seem to need $AW_X_LIBS and -lglPNG may cause an error LIBS="$aw_tk_include $aw_tk_lib $X_CFLAGS $X_PRE_LIBS $X_LIBS $X_EXTRA_LIBS $TCL_INCLUDE $TCL_LIB $LIBS" echo $ac_n "checking whether we can link tk using $LIBS""... $ac_c" 1>&6 echo "configure:4739: checking whether we can link tk using $LIBS" >&5 cat > conftest.$ac_ext < int main() { Tk_GetNumMainWindows(); ; return 0; } EOF if { (eval echo configure:4749: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* # Link succeeded LIBS=$aw_save_libs echo "$ac_t""yes" 1>&6 # Don't do any more tests - we have the answer aw_finished_tk="yes" TK_INCLUDE=$aw_tk_include TK_LIB=$aw_tk_lib else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* # Link failed - do nothing. LIBS=$aw_save_libs echo "$ac_t""no" 1>&6 fi rm -f conftest* fi # This works on ride, a Sparc Solaris 7 machine with packages from # sunfreeware.com aw_tk_include= aw_tk_lib="-L/usr/local/lib -ltk8.2" if test "$aw_need_r" = "yes"; then # Note I need m4 [] quotes around this so that the brackets in the # sed expression do not get eaten aw_tk_lib=`echo $aw_tk_lib | sed 's/-L\([^ ]*\)/-L\1 -R\1/'` fi # If we haven't already found an answer... if test -z "$aw_finished_tk"; then aw_save_libs=$LIBS # Also add X stuff and tcl stuff. Existing LIBS must go at the # end: -lm must come after -ltk for example. # NB don't seem to need $AW_X_LIBS and -lglPNG may cause an error LIBS="$aw_tk_include $aw_tk_lib $X_CFLAGS $X_PRE_LIBS $X_LIBS $X_EXTRA_LIBS $TCL_INCLUDE $TCL_LIB $LIBS" echo $ac_n "checking whether we can link tk using $LIBS""... $ac_c" 1>&6 echo "configure:4795: checking whether we can link tk using $LIBS" >&5 cat > conftest.$ac_ext < int main() { Tk_GetNumMainWindows(); ; return 0; } EOF if { (eval echo configure:4805: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* # Link succeeded LIBS=$aw_save_libs echo "$ac_t""yes" 1>&6 # Don't do any more tests - we have the answer aw_finished_tk="yes" TK_INCLUDE=$aw_tk_include TK_LIB=$aw_tk_lib else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* # Link failed - do nothing. LIBS=$aw_save_libs echo "$ac_t""no" 1>&6 fi rm -f conftest* fi # I give a warning if tk is not found at the end of the script ######################################################################### # Readline ######################################################################### # # Sets Example # READLINE_INCLUDE -I/gnu/include/readline # READLINE_LIB -L/gnu/lib -R/gnu/lib -lreadline # # Check whether --with-readline-include or --without-readline-include was given. if test "${with_readline_include+set}" = set; then withval="$with_readline_include" aw_user_readline_include=$withval fi # Check whether --with-readline-lib or --without-readline-lib was given. if test "${with_readline_lib+set}" = set; then withval="$with_readline_lib" aw_user_readline_lib=$withval fi # If the user provided both or either option, then try it first if test -n "$aw_user_readline_include" -o -n "$aw_user_readline_lib"; then aw_readline_include=$aw_user_readline_include aw_readline_lib=$aw_user_readline_lib if test "$aw_need_r" = "yes"; then # Note I need m4 [] quotes around this so that the brackets in the # sed expression do not get eaten aw_readline_lib=`echo $aw_readline_lib | sed 's/-L\([^ ]*\)/-L\1 -R\1/'` fi # If we haven't already found an answer... if test -z "$aw_finished_readline"; then aw_save_libs=$LIBS # Need curses as well as the supplied settings LIBS="$aw_readline_include $aw_readline_lib $CURSES_INCLUDE $CURSES_LIB_PATH $CURSES_LIB $LIBS" echo $ac_n "checking whether we can link readline using $LIBS""... $ac_c" 1>&6 echo "configure:4879: checking whether we can link readline using $LIBS" >&5 cat > conftest.$ac_ext < #include #include int main() { readline("test"); ; return 0; } EOF if { (eval echo configure:4893: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* # Link succeeded LIBS=$aw_save_libs echo "$ac_t""yes" 1>&6 # Don't do any more tests - we have the answer aw_finished_readline="yes" READLINE_INCLUDE=$aw_readline_include READLINE_LIB=$aw_readline_lib else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* # Link failed - do nothing. LIBS=$aw_save_libs echo "$ac_t""no" 1>&6 fi rm -f conftest* fi fi # Else can we use readline with just -lreadline? aw_readline_include= aw_readline_lib="-lreadline" if test "$aw_need_r" = "yes"; then # Note I need m4 [] quotes around this so that the brackets in the # sed expression do not get eaten aw_readline_lib=`echo $aw_readline_lib | sed 's/-L\([^ ]*\)/-L\1 -R\1/'` fi # If we haven't already found an answer... if test -z "$aw_finished_readline"; then aw_save_libs=$LIBS # Need curses as well as the supplied settings LIBS="$aw_readline_include $aw_readline_lib $CURSES_INCLUDE $CURSES_LIB_PATH $CURSES_LIB $LIBS" echo $ac_n "checking whether we can link readline using $LIBS""... $ac_c" 1>&6 echo "configure:4938: checking whether we can link readline using $LIBS" >&5 cat > conftest.$ac_ext < #include #include int main() { readline("test"); ; return 0; } EOF if { (eval echo configure:4952: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* # Link succeeded LIBS=$aw_save_libs echo "$ac_t""yes" 1>&6 # Don't do any more tests - we have the answer aw_finished_readline="yes" READLINE_INCLUDE=$aw_readline_include READLINE_LIB=$aw_readline_lib else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* # Link failed - do nothing. LIBS=$aw_save_libs echo "$ac_t""no" 1>&6 fi rm -f conftest* fi # Now we're guessing... :) # This works on cygwin aw_readline_include="-I/usr/include/readline" aw_readline_lib="-L/usr/lib -lreadline" if test "$aw_need_r" = "yes"; then # Note I need m4 [] quotes around this so that the brackets in the # sed expression do not get eaten aw_readline_lib=`echo $aw_readline_lib | sed 's/-L\([^ ]*\)/-L\1 -R\1/'` fi # If we haven't already found an answer... if test -z "$aw_finished_readline"; then aw_save_libs=$LIBS # Need curses as well as the supplied settings LIBS="$aw_readline_include $aw_readline_lib $CURSES_INCLUDE $CURSES_LIB_PATH $CURSES_LIB $LIBS" echo $ac_n "checking whether we can link readline using $LIBS""... $ac_c" 1>&6 echo "configure:4998: checking whether we can link readline using $LIBS" >&5 cat > conftest.$ac_ext < #include #include int main() { readline("test"); ; return 0; } EOF if { (eval echo configure:5012: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* # Link succeeded LIBS=$aw_save_libs echo "$ac_t""yes" 1>&6 # Don't do any more tests - we have the answer aw_finished_readline="yes" READLINE_INCLUDE=$aw_readline_include READLINE_LIB=$aw_readline_lib else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* # Link failed - do nothing. LIBS=$aw_save_libs echo "$ac_t""no" 1>&6 fi rm -f conftest* fi # This works at DCS, University of TV aw_readline_include="-I/gnu/include/readline -I/gnu/include" aw_readline_lib="-L/gnu/lib -R/gnu/lib -lreadline" if test "$aw_need_r" = "yes"; then # Note I need m4 [] quotes around this so that the brackets in the # sed expression do not get eaten aw_readline_lib=`echo $aw_readline_lib | sed 's/-L\([^ ]*\)/-L\1 -R\1/'` fi # If we haven't already found an answer... if test -z "$aw_finished_readline"; then aw_save_libs=$LIBS # Need curses as well as the supplied settings LIBS="$aw_readline_include $aw_readline_lib $CURSES_INCLUDE $CURSES_LIB_PATH $CURSES_LIB $LIBS" echo $ac_n "checking whether we can link readline using $LIBS""... $ac_c" 1>&6 echo "configure:5056: checking whether we can link readline using $LIBS" >&5 cat > conftest.$ac_ext < #include #include int main() { readline("test"); ; return 0; } EOF if { (eval echo configure:5070: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* # Link succeeded LIBS=$aw_save_libs echo "$ac_t""yes" 1>&6 # Don't do any more tests - we have the answer aw_finished_readline="yes" READLINE_INCLUDE=$aw_readline_include READLINE_LIB=$aw_readline_lib else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* # Link failed - do nothing. LIBS=$aw_save_libs echo "$ac_t""no" 1>&6 fi rm -f conftest* fi # This works on a newly installed Solaris 7 machine with standard GNU install aw_readline_include="-I/usr/local/include/readline" aw_readline_lib="-L/usr/local/lib -R/usr/local/lib -lreadline" if test "$aw_need_r" = "yes"; then # Note I need m4 [] quotes around this so that the brackets in the # sed expression do not get eaten aw_readline_lib=`echo $aw_readline_lib | sed 's/-L\([^ ]*\)/-L\1 -R\1/'` fi # If we haven't already found an answer... if test -z "$aw_finished_readline"; then aw_save_libs=$LIBS # Need curses as well as the supplied settings LIBS="$aw_readline_include $aw_readline_lib $CURSES_INCLUDE $CURSES_LIB_PATH $CURSES_LIB $LIBS" echo $ac_n "checking whether we can link readline using $LIBS""... $ac_c" 1>&6 echo "configure:5114: checking whether we can link readline using $LIBS" >&5 cat > conftest.$ac_ext < #include #include int main() { readline("test"); ; return 0; } EOF if { (eval echo configure:5128: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* # Link succeeded LIBS=$aw_save_libs echo "$ac_t""yes" 1>&6 # Don't do any more tests - we have the answer aw_finished_readline="yes" READLINE_INCLUDE=$aw_readline_include READLINE_LIB=$aw_readline_lib else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* # Link failed - do nothing. LIBS=$aw_save_libs echo "$ac_t""no" 1>&6 fi rm -f conftest* fi # If we found an answer, then we HAVE_READLINE if test -n "$aw_finished_readline"; then cat >> confdefs.h <<\EOF #define HAVE_READLINE 1 EOF fi ######################################################################### # OpenGL ######################################################################### # # Sets Example # OPENGL_INCLUDE -I/usr/openwin/include # OPENGL_LIB -L/usr/openwin/lib -R/usr/openwin/lib -lGL # Check whether --with-gl-include or --without-gl-include was given. if test "${with_gl_include+set}" = set; then withval="$with_gl_include" aw_user_gl_include=$withval fi # Check whether --with-gl-lib or --without-gl-lib was given. if test "${with_gl_lib+set}" = set; then withval="$with_gl_lib" aw_user_gl_lib=$withval fi if test "$aw_want_sasami" = "yes"; then # We want to build Sasami - so figure out OpenGL # If the user provided both or either option, then try it first if test -n "$aw_user_gl_include" -o -n "$aw_user_gl_lib"; then aw_gl_include=$aw_user_gl_include aw_gl_lib=$aw_user_gl_lib if test "$aw_need_r" = "yes"; then # Note I need m4 [] quotes around this so that the brackets in the # sed expression do not get eaten aw_gl_lib=`echo $aw_gl_lib | sed 's/-L\([^ ]*\)/-L\1 -R\1/'` fi # If we haven't already found an answer... if test -z "$aw_finished_gl"; then aw_save_libs=$LIBS # Debian seems to require -lm... LIBS="$aw_gl_include $aw_gl_lib -lm" echo $ac_n "checking whether we can link GL using $LIBS""... $ac_c" 1>&6 echo "configure:5212: checking whether we can link GL using $LIBS" >&5 # !@!@ should put a test for the Solaris GL implementation in here, # because I can't get it to use the correct colormap on 8-bit GFX # hardware: the workaround is to use Mesa instead cat > conftest.$ac_ext < int main() { glLoadIdentity(); ; return 0; } EOF if { (eval echo configure:5227: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* # Link succeeded LIBS=$aw_save_libs echo "$ac_t""yes" 1>&6 # Don't do any more tests - we have the answer aw_finished_gl="yes" OPENGL_INCLUDE=$aw_gl_include OPENGL_LIB=$aw_gl_lib else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* # Link failed - do nothing. LIBS=$aw_save_libs echo "$ac_t""no" 1>&6 fi rm -f conftest* fi fi # Else can we use GL with just -lGL? aw_gl_include= aw_gl_lib="-lGL" if test "$aw_need_r" = "yes"; then # Note I need m4 [] quotes around this so that the brackets in the # sed expression do not get eaten aw_gl_lib=`echo $aw_gl_lib | sed 's/-L\([^ ]*\)/-L\1 -R\1/'` fi # If we haven't already found an answer... if test -z "$aw_finished_gl"; then aw_save_libs=$LIBS # Debian seems to require -lm... LIBS="$aw_gl_include $aw_gl_lib -lm" echo $ac_n "checking whether we can link GL using $LIBS""... $ac_c" 1>&6 echo "configure:5272: checking whether we can link GL using $LIBS" >&5 # !@!@ should put a test for the Solaris GL implementation in here, # because I can't get it to use the correct colormap on 8-bit GFX # hardware: the workaround is to use Mesa instead cat > conftest.$ac_ext < int main() { glLoadIdentity(); ; return 0; } EOF if { (eval echo configure:5287: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* # Link succeeded LIBS=$aw_save_libs echo "$ac_t""yes" 1>&6 # Don't do any more tests - we have the answer aw_finished_gl="yes" OPENGL_INCLUDE=$aw_gl_include OPENGL_LIB=$aw_gl_lib else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* # Link failed - do nothing. LIBS=$aw_save_libs echo "$ac_t""no" 1>&6 fi rm -f conftest* fi else OPENGL_INCLUDE="" OPENGL_LIB="" fi ######################################################################### # PNG library ######################################################################### # # Sets Example # PNG_INCLUDE -I/usr/local/include # PNG_LIB -L/usr/local/lib -R/usr/local/lib -lpng # Check whether --with-png-include or --without-png-include was given. if test "${with_png_include+set}" = set; then withval="$with_png_include" aw_user_png_include=$withval fi # Check whether --with-png-lib or --without-png-lib was given. if test "${with_png_lib+set}" = set; then withval="$with_png_lib" aw_user_png_lib=$withval fi if test "$aw_want_sasami" = "yes"; then # We want to build Sasami - so figure out PNG # If the user provided both or either option, then try it first if test -n "$aw_user_png_include" -o -n "$aw_user_png_lib"; then aw_png_include=$aw_user_png_include aw_png_lib=$aw_user_png_lib if test "$aw_need_r" = "yes"; then # Note I need m4 [] quotes around this so that the brackets in the # sed expression do not get eaten aw_png_lib=`echo $aw_png_lib | sed 's/-L\([^ ]*\)/-L\1 -R\1/'` fi # If we haven't already found an answer... if test -z "$aw_finished_png"; then aw_save_libs=$LIBS # -lpng needs -lm LIBS="$aw_png_include $aw_png_lib -lm" echo $ac_n "checking whether we can link png using $LIBS""... $ac_c" 1>&6 echo "configure:5367: checking whether we can link png using $LIBS" >&5 cat > conftest.$ac_ext < int main() { png_structp png; png = png_create_read_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL); ; return 0; } EOF if { (eval echo configure:5382: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* # Link succeeded LIBS=$aw_save_libs echo "$ac_t""yes" 1>&6 # Don't do any more tests - we have the answer aw_finished_png="yes" PNG_INCLUDE=$aw_png_include PNG_LIB=$aw_png_lib else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* # Link failed - do nothing. LIBS=$aw_save_libs echo "$ac_t""no" 1>&6 fi rm -f conftest* fi fi # Else can we use PNG with just -lpng? aw_png_include= aw_png_lib="-lpng" if test "$aw_need_r" = "yes"; then # Note I need m4 [] quotes around this so that the brackets in the # sed expression do not get eaten aw_png_lib=`echo $aw_png_lib | sed 's/-L\([^ ]*\)/-L\1 -R\1/'` fi # If we haven't already found an answer... if test -z "$aw_finished_png"; then aw_save_libs=$LIBS # -lpng needs -lm LIBS="$aw_png_include $aw_png_lib -lm" echo $ac_n "checking whether we can link png using $LIBS""... $ac_c" 1>&6 echo "configure:5427: checking whether we can link png using $LIBS" >&5 cat > conftest.$ac_ext < int main() { png_structp png; png = png_create_read_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL); ; return 0; } EOF if { (eval echo configure:5442: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* # Link succeeded LIBS=$aw_save_libs echo "$ac_t""yes" 1>&6 # Don't do any more tests - we have the answer aw_finished_png="yes" PNG_INCLUDE=$aw_png_include PNG_LIB=$aw_png_lib else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* # Link failed - do nothing. LIBS=$aw_save_libs echo "$ac_t""no" 1>&6 fi rm -f conftest* fi # Try this... aw_png_include="-I/usr/local/include" aw_png_lib="-L/usr/local/lib -lpng" if test "$aw_need_r" = "yes"; then # Note I need m4 [] quotes around this so that the brackets in the # sed expression do not get eaten aw_png_lib=`echo $aw_png_lib | sed 's/-L\([^ ]*\)/-L\1 -R\1/'` fi # If we haven't already found an answer... if test -z "$aw_finished_png"; then aw_save_libs=$LIBS # -lpng needs -lm LIBS="$aw_png_include $aw_png_lib -lm" echo $ac_n "checking whether we can link png using $LIBS""... $ac_c" 1>&6 echo "configure:5486: checking whether we can link png using $LIBS" >&5 cat > conftest.$ac_ext < int main() { png_structp png; png = png_create_read_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL); ; return 0; } EOF if { (eval echo configure:5501: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* # Link succeeded LIBS=$aw_save_libs echo "$ac_t""yes" 1>&6 # Don't do any more tests - we have the answer aw_finished_png="yes" PNG_INCLUDE=$aw_png_include PNG_LIB=$aw_png_lib else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* # Link failed - do nothing. LIBS=$aw_save_libs echo "$ac_t""no" 1>&6 fi rm -f conftest* fi else PNG_INCLUDE="" PNG_LIB="" fi ######################################################################### # Memory alignment ######################################################################### # I could use the gcc __alignof__ function, but then this would # restrict us to using gcc only. So we attempt to detect the alignment # required instead. echo $ac_n "checking how doubles should be aligned""... $ac_c" 1>&6 echo "configure:5543: checking how doubles should be aligned" >&5 if test "$cross_compiling" = yes; then # We are cross compiling so can't run the test, so we # assume the worst. cat >> confdefs.h <<\EOF #define DOUBLE_ALIGNMENT sizeof(double) EOF echo "$ac_t""sizeof(double) byte boundaries" 1>&6 else cat > conftest.$ac_ext < struct foo { union align { double d; long l; void *p; } u; char c; }; int main() { struct foo f[2]; FILE *fp; int n; if ((fp = fopen("conftestalignoutput", "w")) == NULL) exit(1); if( 2*sizeof(union align) != sizeof(f) ) { n = fprintf(fp, "%ld\n", (long)(sizeof(struct foo) - sizeof(union align))); } else { n = fprintf(fp, "%ld\n", (long)sizeof(union align)); } /* If fprintf didn't complete successfully, exit code 1 */ if (n < 0) exit(1); if (fclose(fp) != 0) exit(1); /* All OK - exit code 0 */ exit(0); } EOF if { (eval echo configure:5595: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then # The code compiled, linked, executed and had exit code 0, # so we can read the alignment value written to the temporary # file. aw_alignment=`cat conftestalignoutput` cat >> confdefs.h <&6 else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -fr conftest* # The test failed in some way, so assume the worst. cat >> confdefs.h <<\EOF #define DOUBLE_ALIGNMENT sizeof(double) EOF echo "$ac_t""sizeof(double) byte boundaries" 1>&6 fi rm -fr conftest* fi ######################################################################### # dmalloc (tool for checking for memory leaks etc) ######################################################################### # I'm trusting the user to get this right, so no checks are done to see # if the arguments provided are correct. If they want to run it with a # memory debugger, they should know what they are doing... I hope. DMALLOC_INCLUDE= DMALLOC_LIB= # Check whether --with-dmalloc-include or --without-dmalloc-include was given. if test "${with_dmalloc_include+set}" = set; then withval="$with_dmalloc_include" cat >> confdefs.h <<\EOF #define HAVE_DMALLOC 1 EOF DMALLOC_INCLUDE=-I$withval fi # Check whether --with-dmalloc-lib or --without-dmalloc-lib was given. if test "${with_dmalloc_lib+set}" = set; then withval="$with_dmalloc_lib" cat >> confdefs.h <<\EOF #define HAVE_DMALLOC 1 EOF DMALLOC_LIB="-L$withval -ldmalloc" fi ######################################################################### # Pascal strings ######################################################################### # Need to try with -fpascal-strings first as \p only results in a # warning if the option is not given aw_save_cflags=$CFLAGS CFLAGS="$CFLAGS -fpascal-strings" cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* # Compiled successfully else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* # Had a problem: all we can do is to omit the option again CFLAGS="$aw_save_cflags" fi rm -f conftest* ######################################################################### # Other bits ######################################################################### # Do we have ANSI C header files? Declares STDC_HEADERS if we do. Also # (undocumented) sets $ac_cv_header_stdc to "yes". # Check other headers and stop if we can't find them # Might define HAVE_SYS_TIME_H ac_safe=`echo "sys/time.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for sys/time.h""... $ac_c" 1>&6 echo "configure:5711: checking for sys/time.h" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" { (eval echo configure:5721: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* eval "ac_cv_header_$ac_safe=yes" else echo "$ac_err" >&5 echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* eval "ac_cv_header_$ac_safe=no" fi rm -f conftest* fi if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then echo "$ac_t""yes" 1>&6 : else echo "$ac_t""no" 1>&6 { echo "configure: error: can't find sys/time.h" 1>&2; exit 1; } fi # This defines HAVE_LIBGEN_H if it is found for ac_hdr in libgen.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 echo "configure:5748: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" { (eval echo configure:5758: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* eval "ac_cv_header_$ac_safe=yes" else echo "$ac_err" >&5 echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* eval "ac_cv_header_$ac_safe=no" fi rm -f conftest* fi if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then echo "$ac_t""yes" 1>&6 ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'` cat >> confdefs.h <&6 fi done # Define const to be empty if the compiler does not support it echo $ac_n "checking for working const""... $ac_c" 1>&6 echo "configure:5787: checking for working const" >&5 if eval "test \"`echo '$''{'ac_cv_c_const'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <j = 5; } { /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */ const int foo = 10; } ; return 0; } EOF if { (eval echo configure:5841: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_c_const=yes else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* ac_cv_c_const=no fi rm -f conftest* fi echo "$ac_t""$ac_cv_c_const" 1>&6 if test $ac_cv_c_const = no; then cat >> confdefs.h <<\EOF #define const EOF fi # Deal with problems due to two header files time.h and sys/time.h # Might define TIME_WITH_SYS_TIME echo $ac_n "checking whether time.h and sys/time.h may both be included""... $ac_c" 1>&6 echo "configure:5865: checking whether time.h and sys/time.h may both be included" >&5 if eval "test \"`echo '$''{'ac_cv_header_time'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include #include int main() { struct tm *tp; ; return 0; } EOF if { (eval echo configure:5879: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_header_time=yes else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* ac_cv_header_time=no fi rm -f conftest* fi echo "$ac_t""$ac_cv_header_time" 1>&6 if test $ac_cv_header_time = yes; then cat >> confdefs.h <<\EOF #define TIME_WITH_SYS_TIME 1 EOF fi # Might define TM_IN_SYS_TIME, "which means that including sys/time.h # had better define struct tm." (from Autoconf manual - huh?). echo $ac_n "checking whether struct tm is in sys/time.h or time.h""... $ac_c" 1>&6 echo "configure:5903: checking whether struct tm is in sys/time.h or time.h" >&5 if eval "test \"`echo '$''{'ac_cv_struct_tm'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include int main() { struct tm *tp; tp->tm_sec; ; return 0; } EOF if { (eval echo configure:5916: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_struct_tm=time.h else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* ac_cv_struct_tm=sys/time.h fi rm -f conftest* fi echo "$ac_t""$ac_cv_struct_tm" 1>&6 if test $ac_cv_struct_tm = sys/time.h; then cat >> confdefs.h <<\EOF #define TM_IN_SYS_TIME 1 EOF fi # Check for how to get alloca. Might defined HAVE_ALLOCA_H, HAVE_ALLOCA, # ALLOCA, C_ALLOCA... # The Ultrix 4.2 mips builtin alloca declared by alloca.h only works # for constant arguments. Useless! echo $ac_n "checking for working alloca.h""... $ac_c" 1>&6 echo "configure:5942: checking for working alloca.h" >&5 if eval "test \"`echo '$''{'ac_cv_header_alloca_h'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < int main() { char *p = alloca(2 * sizeof(int)); ; return 0; } EOF if { (eval echo configure:5954: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* ac_cv_header_alloca_h=yes else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* ac_cv_header_alloca_h=no fi rm -f conftest* fi echo "$ac_t""$ac_cv_header_alloca_h" 1>&6 if test $ac_cv_header_alloca_h = yes; then cat >> confdefs.h <<\EOF #define HAVE_ALLOCA_H 1 EOF fi echo $ac_n "checking for alloca""... $ac_c" 1>&6 echo "configure:5975: checking for alloca" >&5 if eval "test \"`echo '$''{'ac_cv_func_alloca_works'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < # define alloca _alloca # else # if HAVE_ALLOCA_H # include # else # ifdef _AIX #pragma alloca # else # ifndef alloca /* predefined by HP cc +Olibcalls */ char *alloca (); # endif # endif # endif # endif #endif int main() { char *p = (char *) alloca(1); ; return 0; } EOF if { (eval echo configure:6008: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* ac_cv_func_alloca_works=yes else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* ac_cv_func_alloca_works=no fi rm -f conftest* fi echo "$ac_t""$ac_cv_func_alloca_works" 1>&6 if test $ac_cv_func_alloca_works = yes; then cat >> confdefs.h <<\EOF #define HAVE_ALLOCA 1 EOF fi if test $ac_cv_func_alloca_works = no; then # The SVR3 libPW and SVR4 libucb both contain incompatible functions # that cause trouble. Some versions do not even contain alloca or # contain a buggy version. If you still want to use their alloca, # use ar to extract alloca.o from them instead of compiling alloca.c. ALLOCA=alloca.${ac_objext} cat >> confdefs.h <<\EOF #define C_ALLOCA 1 EOF echo $ac_n "checking whether alloca needs Cray hooks""... $ac_c" 1>&6 echo "configure:6040: checking whether alloca needs Cray hooks" >&5 if eval "test \"`echo '$''{'ac_cv_os_cray'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5 | egrep "webecray" >/dev/null 2>&1; then rm -rf conftest* ac_cv_os_cray=yes else rm -rf conftest* ac_cv_os_cray=no fi rm -f conftest* fi echo "$ac_t""$ac_cv_os_cray" 1>&6 if test $ac_cv_os_cray = yes; then for ac_func in _getb67 GETB67 getb67; do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 echo "configure:6070: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char $ac_func(); int main() { /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined (__stub_$ac_func) || defined (__stub___$ac_func) choke me #else $ac_func(); #endif ; return 0; } EOF if { (eval echo configure:6098: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* eval "ac_cv_func_$ac_func=no" fi rm -f conftest* fi if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then echo "$ac_t""yes" 1>&6 cat >> confdefs.h <&6 fi done fi echo $ac_n "checking stack direction for C alloca""... $ac_c" 1>&6 echo "configure:6125: checking stack direction for C alloca" >&5 if eval "test \"`echo '$''{'ac_cv_c_stack_direction'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else if test "$cross_compiling" = yes; then ac_cv_c_stack_direction=0 else cat > conftest.$ac_ext < addr) ? 1 : -1; } main () { exit (find_stack_direction() < 0); } EOF if { (eval echo configure:6152: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then ac_cv_c_stack_direction=1 else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -fr conftest* ac_cv_c_stack_direction=-1 fi rm -fr conftest* fi fi echo "$ac_t""$ac_cv_c_stack_direction" 1>&6 cat >> confdefs.h <&6 echo "configure:6176: checking return type of signal handlers" >&5 if eval "test \"`echo '$''{'ac_cv_type_signal'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include #ifdef signal #undef signal #endif #ifdef __cplusplus extern "C" void (*signal (int, void (*)(int)))(int); #else void (*signal ()) (); #endif int main() { int i; ; return 0; } EOF if { (eval echo configure:6198: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_type_signal=void else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* ac_cv_type_signal=int fi rm -f conftest* fi echo "$ac_t""$ac_cv_type_signal" 1>&6 cat >> confdefs.h <&6 echo "configure:6219: checking for gettimeofday" >&5 if eval "test \"`echo '$''{'ac_cv_func_gettimeofday'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char gettimeofday(); int main() { /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined (__stub_gettimeofday) || defined (__stub___gettimeofday) choke me #else gettimeofday(); #endif ; return 0; } EOF if { (eval echo configure:6247: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_gettimeofday=yes" else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* eval "ac_cv_func_gettimeofday=no" fi rm -f conftest* fi if eval "test \"`echo '$ac_cv_func_'gettimeofday`\" = yes"; then echo "$ac_t""yes" 1>&6 : else echo "$ac_t""no" 1>&6 { echo "configure: error: don't have gettimeofday" 1>&2; exit 1; } fi echo $ac_n "checking for putenv""... $ac_c" 1>&6 echo "configure:6268: checking for putenv" >&5 if eval "test \"`echo '$''{'ac_cv_func_putenv'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char putenv(); int main() { /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined (__stub_putenv) || defined (__stub___putenv) choke me #else putenv(); #endif ; return 0; } EOF if { (eval echo configure:6296: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_putenv=yes" else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* eval "ac_cv_func_putenv=no" fi rm -f conftest* fi if eval "test \"`echo '$ac_cv_func_'putenv`\" = yes"; then echo "$ac_t""yes" 1>&6 : else echo "$ac_t""no" 1>&6 { echo "configure: error: don't have putenv" 1>&2; exit 1; } fi echo $ac_n "checking for select""... $ac_c" 1>&6 echo "configure:6317: checking for select" >&5 if eval "test \"`echo '$''{'ac_cv_func_select'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char select(); int main() { /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined (__stub_select) || defined (__stub___select) choke me #else select(); #endif ; return 0; } EOF if { (eval echo configure:6345: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_select=yes" else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* eval "ac_cv_func_select=no" fi rm -f conftest* fi if eval "test \"`echo '$ac_cv_func_'select`\" = yes"; then echo "$ac_t""yes" 1>&6 : else echo "$ac_t""no" 1>&6 { echo "configure: error: don't have select" 1>&2; exit 1; } fi echo $ac_n "checking for strdup""... $ac_c" 1>&6 echo "configure:6366: checking for strdup" >&5 if eval "test \"`echo '$''{'ac_cv_func_strdup'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char strdup(); int main() { /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined (__stub_strdup) || defined (__stub___strdup) choke me #else strdup(); #endif ; return 0; } EOF if { (eval echo configure:6394: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_strdup=yes" else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* eval "ac_cv_func_strdup=no" fi rm -f conftest* fi if eval "test \"`echo '$ac_cv_func_'strdup`\" = yes"; then echo "$ac_t""yes" 1>&6 : else echo "$ac_t""no" 1>&6 { echo "configure: error: don't have strdup" 1>&2; exit 1; } fi ######################################################################### # Create the Makefiles ######################################################################### # Substitute the following variables in the Makefiles # Done - write the output Makefiles trap '' 1 2 15 cat > confcache <<\EOF # This file is a shell script that caches the results of configure # tests run on this system so they can be shared between configure # scripts and configure runs. It is not useful on other systems. # If it contains results you don't want to keep, you may remove or edit it. # # By default, configure uses ./config.cache as the cache file, # creating it if it does not exist already. You can give configure # the --cache-file=FILE option to use a different cache file; that is # what configure does when it calls configure scripts in # subdirectories, so they share the cache. # Giving --cache-file=/dev/null disables caching, for debugging configure. # config.status only pays attention to the cache file if you give it the # --recheck option to rerun configure. # EOF # The following way of writing the cache mishandles newlines in values, # but we know of no workaround that is simple, portable, and efficient. # So, don't put newlines in cache variables' values. # Ultrix sh set writes to stderr and can't be redirected directly, # and sets the high bit in the cache file unless we assign to the vars. (set) 2>&1 | case `(ac_space=' '; set | grep ac_space) 2>&1` in *ac_space=\ *) # `set' does not quote correctly, so add quotes (double-quote substitution # turns \\\\ into \\, and sed turns \\ into \). sed -n \ -e "s/'/'\\\\''/g" \ -e "s/^\\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\\)=\\(.*\\)/\\1=\${\\1='\\2'}/p" ;; *) # `set' quotes correctly as required by POSIX, so do not add quotes. sed -n -e 's/^\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\)=\(.*\)/\1=${\1=\2}/p' ;; esac >> confcache if cmp -s $cache_file confcache; then : else if test -w $cache_file; then echo "updating cache $cache_file" cat confcache > $cache_file else echo "not updating unwritable cache $cache_file" fi fi rm -f confcache trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15 test "x$prefix" = xNONE && prefix=$ac_default_prefix # Let make expand exec_prefix. test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' # Any assignment to VPATH causes Sun make to only execute # the first set of double-colon rules, so remove it if not needed. # If there is a colon in the path, we need to keep it. if test "x$srcdir" = x.; then ac_vpsub='/^[ ]*VPATH[ ]*=[^:]*$/d' fi trap 'rm -f $CONFIG_STATUS conftest*; exit 1' 1 2 15 DEFS=-DHAVE_CONFIG_H # Without the "./", some shells look in PATH for config.status. : ${CONFIG_STATUS=./config.status} echo creating $CONFIG_STATUS rm -f $CONFIG_STATUS cat > $CONFIG_STATUS </dev/null | sed 1q`: # # $0 $ac_configure_args # # Compiler output produced by configure, useful for debugging # configure, is in ./config.log if it exists. ac_cs_usage="Usage: $CONFIG_STATUS [--recheck] [--version] [--help]" for ac_option do case "\$ac_option" in -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) echo "running \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion" exec \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion ;; -version | --version | --versio | --versi | --vers | --ver | --ve | --v) echo "$CONFIG_STATUS generated by autoconf version 2.13" exit 0 ;; -help | --help | --hel | --he | --h) echo "\$ac_cs_usage"; exit 0 ;; *) echo "\$ac_cs_usage"; exit 1 ;; esac done ac_given_srcdir=$srcdir ac_given_INSTALL="$INSTALL" trap 'rm -fr `echo "generic.mk Misc/Makefile Eden/Makefile EX/Makefile Scout/Makefile Makefile Donald/Makefile LSD/Makefile Sasami/Makefile config.h" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15 EOF cat >> $CONFIG_STATUS < conftest.subs <<\\CEOF $ac_vpsub $extrasub s%@SHELL@%$SHELL%g s%@CFLAGS@%$CFLAGS%g s%@CPPFLAGS@%$CPPFLAGS%g s%@CXXFLAGS@%$CXXFLAGS%g s%@FFLAGS@%$FFLAGS%g s%@DEFS@%$DEFS%g s%@LDFLAGS@%$LDFLAGS%g s%@LIBS@%$LIBS%g s%@exec_prefix@%$exec_prefix%g s%@prefix@%$prefix%g s%@program_transform_name@%$program_transform_name%g s%@bindir@%$bindir%g s%@sbindir@%$sbindir%g s%@libexecdir@%$libexecdir%g s%@datadir@%$datadir%g s%@sysconfdir@%$sysconfdir%g s%@sharedstatedir@%$sharedstatedir%g s%@localstatedir@%$localstatedir%g s%@libdir@%$libdir%g s%@includedir@%$includedir%g s%@oldincludedir@%$oldincludedir%g s%@infodir@%$infodir%g s%@mandir@%$mandir%g s%@host@%$host%g s%@host_alias@%$host_alias%g s%@host_cpu@%$host_cpu%g s%@host_vendor@%$host_vendor%g s%@host_os@%$host_os%g s%@CC@%$CC%g s%@CPP@%$CPP%g s%@INSTALL_PROGRAM@%$INSTALL_PROGRAM%g s%@INSTALL_SCRIPT@%$INSTALL_SCRIPT%g s%@INSTALL_DATA@%$INSTALL_DATA%g s%@LEX@%$LEX%g s%@LEXLIB@%$LEXLIB%g s%@SET_MAKE@%$SET_MAKE%g s%@RANLIB@%$RANLIB%g s%@X_CFLAGS@%$X_CFLAGS%g s%@X_PRE_LIBS@%$X_PRE_LIBS%g s%@X_LIBS@%$X_LIBS%g s%@X_EXTRA_LIBS@%$X_EXTRA_LIBS%g s%@ALLOCA@%$ALLOCA%g s%@AW_X_LIBS@%$AW_X_LIBS%g s%@CURSES_TYPE@%$CURSES_TYPE%g s%@CURSES_INCLUDE@%$CURSES_INCLUDE%g s%@CURSES_LIB@%$CURSES_LIB%g s%@CURSES_LIB_PATH@%$CURSES_LIB_PATH%g s%@TCL_INCLUDE@%$TCL_INCLUDE%g s%@TCL_LIB@%$TCL_LIB%g s%@TK_INCLUDE@%$TK_INCLUDE%g s%@TK_LIB@%$TK_LIB%g s%@DMALLOC_INCLUDE@%$DMALLOC_INCLUDE%g s%@DMALLOC_LIB@%$DMALLOC_LIB%g s%@READLINE_INCLUDE@%$READLINE_INCLUDE%g s%@READLINE_LIB@%$READLINE_LIB%g s%@OPENGL_INCLUDE@%$OPENGL_INCLUDE%g s%@OPENGL_LIB@%$OPENGL_LIB%g s%@PNG_INCLUDE@%$PNG_INCLUDE%g s%@PNG_LIB@%$PNG_LIB%g s%@DEPEND_MAKEDEFS@%$DEPEND_MAKEDEFS%g CEOF EOF cat >> $CONFIG_STATUS <<\EOF # Split the substitutions into bite-sized pieces for seds with # small command number limits, like on Digital OSF/1 and HP-UX. ac_max_sed_cmds=90 # Maximum number of lines to put in a sed script. ac_file=1 # Number of current file. ac_beg=1 # First line for current file. ac_end=$ac_max_sed_cmds # Line after last line for current file. ac_more_lines=: ac_sed_cmds="" while $ac_more_lines; do if test $ac_beg -gt 1; then sed "1,${ac_beg}d; ${ac_end}q" conftest.subs > conftest.s$ac_file else sed "${ac_end}q" conftest.subs > conftest.s$ac_file fi if test ! -s conftest.s$ac_file; then ac_more_lines=false rm -f conftest.s$ac_file else if test -z "$ac_sed_cmds"; then ac_sed_cmds="sed -f conftest.s$ac_file" else ac_sed_cmds="$ac_sed_cmds | sed -f conftest.s$ac_file" fi ac_file=`expr $ac_file + 1` ac_beg=$ac_end ac_end=`expr $ac_end + $ac_max_sed_cmds` fi done if test -z "$ac_sed_cmds"; then ac_sed_cmds=cat fi EOF cat >> $CONFIG_STATUS <> $CONFIG_STATUS <<\EOF for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". case "$ac_file" in *:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'` ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;; *) ac_file_in="${ac_file}.in" ;; esac # Adjust a relative srcdir, top_srcdir, and INSTALL for subdirectories. # Remove last slash and all that follows it. Not all systems have dirname. ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'` if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then # The file is in a subdirectory. test ! -d "$ac_dir" && mkdir "$ac_dir" ac_dir_suffix="/`echo $ac_dir|sed 's%^\./%%'`" # A "../" for each directory in $ac_dir_suffix. ac_dots=`echo $ac_dir_suffix|sed 's%/[^/]*%../%g'` else ac_dir_suffix= ac_dots= fi case "$ac_given_srcdir" in .) srcdir=. if test -z "$ac_dots"; then top_srcdir=. else top_srcdir=`echo $ac_dots|sed 's%/$%%'`; fi ;; /*) srcdir="$ac_given_srcdir$ac_dir_suffix"; top_srcdir="$ac_given_srcdir" ;; *) # Relative path. srcdir="$ac_dots$ac_given_srcdir$ac_dir_suffix" top_srcdir="$ac_dots$ac_given_srcdir" ;; esac case "$ac_given_INSTALL" in [/$]*) INSTALL="$ac_given_INSTALL" ;; *) INSTALL="$ac_dots$ac_given_INSTALL" ;; esac echo creating "$ac_file" rm -f "$ac_file" configure_input="Generated automatically from `echo $ac_file_in|sed 's%.*/%%'` by configure." case "$ac_file" in *Makefile*) ac_comsub="1i\\ # $configure_input" ;; *) ac_comsub= ;; esac ac_file_inputs=`echo $ac_file_in|sed -e "s%^%$ac_given_srcdir/%" -e "s%:% $ac_given_srcdir/%g"` sed -e "$ac_comsub s%@configure_input@%$configure_input%g s%@srcdir@%$srcdir%g s%@top_srcdir@%$top_srcdir%g s%@INSTALL@%$INSTALL%g " $ac_file_inputs | (eval "$ac_sed_cmds") > $ac_file fi; done rm -f conftest.s* # These sed commands are passed to sed as "A NAME B NAME C VALUE D", where # NAME is the cpp macro being defined and VALUE is the value it is being given. # # ac_d sets the value in "#define NAME VALUE" lines. ac_dA='s%^\([ ]*\)#\([ ]*define[ ][ ]*\)' ac_dB='\([ ][ ]*\)[^ ]*%\1#\2' ac_dC='\3' ac_dD='%g' # ac_u turns "#undef NAME" with trailing blanks into "#define NAME VALUE". ac_uA='s%^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)' ac_uB='\([ ]\)%\1#\2define\3' ac_uC=' ' ac_uD='\4%g' # ac_e turns "#undef NAME" without trailing blanks into "#define NAME VALUE". ac_eA='s%^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)' ac_eB='$%\1#\2define\3' ac_eC=' ' ac_eD='%g' if test "${CONFIG_HEADERS+set}" != set; then EOF cat >> $CONFIG_STATUS <> $CONFIG_STATUS <<\EOF fi for ac_file in .. $CONFIG_HEADERS; do if test "x$ac_file" != x..; then # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". case "$ac_file" in *:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'` ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;; *) ac_file_in="${ac_file}.in" ;; esac echo creating $ac_file rm -f conftest.frag conftest.in conftest.out ac_file_inputs=`echo $ac_file_in|sed -e "s%^%$ac_given_srcdir/%" -e "s%:% $ac_given_srcdir/%g"` cat $ac_file_inputs > conftest.in EOF # Transform confdefs.h into a sed script conftest.vals that substitutes # the proper values into config.h.in to produce config.h. And first: # Protect against being on the right side of a sed subst in config.status. # Protect against being in an unquoted here document in config.status. rm -f conftest.vals cat > conftest.hdr <<\EOF s/[\\&%]/\\&/g s%[\\$`]%\\&%g s%#define \([A-Za-z_][A-Za-z0-9_]*\) *\(.*\)%${ac_dA}\1${ac_dB}\1${ac_dC}\2${ac_dD}%gp s%ac_d%ac_u%gp s%ac_u%ac_e%gp EOF sed -n -f conftest.hdr confdefs.h > conftest.vals rm -f conftest.hdr # This sed command replaces #undef with comments. This is necessary, for # example, in the case of _POSIX_SOURCE, which is predefined and required # on some systems where configure will not decide to define it. cat >> conftest.vals <<\EOF s%^[ ]*#[ ]*undef[ ][ ]*[a-zA-Z_][a-zA-Z_0-9]*%/* & */% EOF # Break up conftest.vals because some shells have a limit on # the size of here documents, and old seds have small limits too. rm -f conftest.tail while : do ac_lines=`grep -c . conftest.vals` # grep -c gives empty output for an empty file on some AIX systems. if test -z "$ac_lines" || test "$ac_lines" -eq 0; then break; fi # Write a limited-size here document to conftest.frag. echo ' cat > conftest.frag <> $CONFIG_STATUS sed ${ac_max_here_lines}q conftest.vals >> $CONFIG_STATUS echo 'CEOF sed -f conftest.frag conftest.in > conftest.out rm -f conftest.in mv conftest.out conftest.in ' >> $CONFIG_STATUS sed 1,${ac_max_here_lines}d conftest.vals > conftest.tail rm -f conftest.vals mv conftest.tail conftest.vals done rm -f conftest.vals cat >> $CONFIG_STATUS <<\EOF rm -f conftest.frag conftest.h echo "/* $ac_file. Generated automatically by configure. */" > conftest.h cat conftest.in >> conftest.h rm -f conftest.in if cmp -s $ac_file conftest.h 2>/dev/null; then echo "$ac_file is unchanged" rm -f conftest.h else # Remove last slash and all that follows it. Not all systems have dirname. ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'` if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then # The file is in a subdirectory. test ! -d "$ac_dir" && mkdir "$ac_dir" fi rm -f $ac_file mv conftest.h $ac_file fi fi; done EOF cat >> $CONFIG_STATUS <> $CONFIG_STATUS <<\EOF exit 0 EOF chmod +x $CONFIG_STATUS rm -fr confdefs* $ac_clean_files test "$no_create" = yes || ${CONFIG_SHELL-/bin/sh} $CONFIG_STATUS || exit 1 # Give warnings if test -z "$aw_want_sasami"; then echo "configure: warning: Cannot build Sasami - only possible on Windoz presently" 1>&2 fi if test -z "$aw_finished_tcl"; then echo "configure: warning: Could not locate tcl - can probably only build ttyeden" 1>&2 fi if test -z "$aw_finished_tk"; then echo "configure: warning: Could not locate tk - can probably only build ttyeden" 1>&2 fi if test -z "$aw_finished_readline"; then echo "configure: warning: Could not locate readline - ttyeden will not have line editing" 1>&2 fi if test -z "$HAVE_CURSES"; then echo "configure: warning: Could not locate curses - probably cannot build ttyeden" 1>&2 fi if test -z "$aw_finished_gl"; then echo "configure: warning: Could not locate GL - probably cannot build Sasami" 1>&2 fi if test -z "$aw_finished_png"; then echo "configure: warning: Could not locate PNG - probably cannot build Sasami" 1>&2 fi echo "configure: warning: Type 'make' for further instructions" 1>&2 utoconf version 2.13" exit 0 ;; -help | --help | --hel | --he | --h) echo "\$ac_cs_usage"; exit 0 ;; *) echo "\$ac_cs_usage"; exit 1 ;; esac done ac_given_srcdir=$srcdir ac_given_INSTALL="$INSTALL" trap 'rm -fr `echo "generic.mk Misc/Makefile Eden/Makefile EX/Makefile Scout/Makefile Makefile Donald/Makefile LSD/Makefile Sasami/Makefile config.h" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15 EOF cat >> $CONFItkeden1.41/configure.in010060000025250000164000000672140743446035100151430ustar00ashleyem00003510000005dnl dnl Process this file with autoconf to produce a configure script. dnl dnl Autoconf setup for {tk|tty|dtk}eden dnl dnl Ashley Ward (ashley@dcs.warwick.ac.uk) June 1999 dnl dnl $Id: configure.in,v 1.22 2002/02/19 14:27:53 cssbz Exp $ dnl dnl ##################################################################### dnl Initial setup dnl ##################################################################### dnl Write this revision information to the created configure script AC_REVISION($Revision: 1.22 $) # Check this file exists to make sure we are in the correct directory AC_INIT(Eden/main.c) dnl C preprocessor symbols get written to this file AC_CONFIG_HEADER(config.h) dnl ##################################################################### dnl Functions for use later on dnl ##################################################################### AC_DEFUN([CF_CHECK_CACHE], [ # # Check if we're accidentally using a cache from a different machine. # Derive the system name, as a check for reusing the autoconf cache. # # If we've packaged config.guess and config.sub, run that (since it does a # better job than uname). # if test -f $srcdir/config.guess ; then AC_CANONICAL_HOST system_name="$host_os" else system_name="`(uname -s -r) 2>/dev/null`" if test -z "$system_name" ; then system_name="`(hostname) 2>/dev/null`" fi fi test -n "$system_name" && AC_DEFINE_UNQUOTED(SYSTEM_NAME,"$system_name") AC_CACHE_VAL(cf_cv_system_name,[cf_cv_system_name="$system_name"]) test -z "$system_name" && system_name="$cf_cv_system_name" test -n "$cf_cv_system_name" && AC_MSG_RESULT("Configuring for $cf_cv_system_name") if test ".$system_name" != ".$cf_cv_system_name" ; then AC_MSG_RESULT("Cached system name does not agree with actual") AC_ERROR("Please remove config.cache and try again.") fi ])dnl AC_DEFUN([CF_ANSI_CC_CHECK], [ AC_MSG_CHECKING(for ${CC-cc} option to accept ANSI C) AC_CACHE_VAL(cf_cv_ansi_cc,[ cf_cv_ansi_cc=no cf_save_CFLAGS="$CFLAGS" # Don't try gcc -ansi; that turns off useful extensions and # breaks some systems' header files. # AIX -qlanglvl=ansi # Ultrix and OSF/1 -std1 # HP-UX -Aa -D_HPUX_SOURCE # SVR4 -Xc # UnixWare 1.2 (cannot use -Xc, since ANSI/POSIX clashes) for cf_arg in "-DCC_HAS_PROTOS" "" -qlanglvl=ansi -std1 "-Aa -D_HPUX_SOURCE" -Xc do CFLAGS="$cf_save_CFLAGS $cf_arg" AC_TRY_COMPILE( [ #ifndef CC_HAS_PROTOS #if !defined(__STDC__) || __STDC__ != 1 choke me #endif #endif ],[ int test (int i, double x); struct s1 {int (*f) (int a);}; struct s2 {int (*f) (double a);};], [cf_cv_ansi_cc="$cf_arg"; break]) done CFLAGS="$cf_save_CFLAGS" ]) AC_MSG_RESULT($cf_cv_ansi_cc) if test "$cf_cv_ansi_cc" != "no"; then if test ".$cf_cv_ansi_cc" != ".-DCC_HAS_PROTOS"; then CFLAGS="$CFLAGS $cf_cv_ansi_cc" else AC_DEFINE(CC_HAS_PROTOS) fi fi ])dnl dnl ##################################################################### dnl End functions - carry on with the work dnl ##################################################################### # Sanity check CF_CHECK_CACHE # !@!@ Not sure if all of these are required AC_PROG_CC AC_PROG_CPP AC_PROG_INSTALL dnl Sets LEX and LEXLIB, to, eg flex and -lfl AC_PROG_LEX dnl Does make set ${MAKE}? Defines @SET_MAKE@ AC_PROG_MAKE_SET dnl Sets RANLIB output variable to 'ranlib' or ':' if it is not found AC_PROG_RANLIB # Find options to use ANSI C CF_ANSI_CC_CHECK # Is the math library OK? AC_CHECK_LIB(m, tan,, AC_MSG_ERROR(can't find math functions)) # Tcl on Linux on PC seems to require -ldl AC_CHECK_LIB(dl, dlerror) ######################################################################### # Compile time switches ######################################################################### AC_ARG_ENABLE(debug, [ --enable-debug enable debugging], [ AC_DEFINE(DEBUG) AC_DEFINE(YYDEBUG) # parser debugging wrapped into general debug now ]) AC_ARG_ENABLE(dcc, [ --enable-dcc enable dcc function for disabling circular checking], [ AC_DEFINE(NO_CHECK_CIRCULAR) ]) AC_ARG_ENABLE(depend, [ --enable-depend enable Makefile source dependency checking], [ DEPEND_MAKEDEFS="include ../depend.mk" ], [ DEPEND_MAKEDEFS="#include ../depend.mk" ]) AC_ARG_ENABLE(disable-sasami, [ --enable-disable-sasami don't try to build the Sasami OpenGL notation], [ AC_MSG_WARN(Disabling Sasami) aw_want_sasami="no" ], [ aw_want_sasami="yes" AC_DEFINE(WANT_SASAMI) ]) AC_ARG_ENABLE(ipc, [ --enable-ipc enable support for Eden IPC functions (send_msg...)], [ AC_DEFINE(ipc) ]) ######################################################################### # X ######################################################################### dnl Sets $X_CFLAGS, $X_LIBS, $X_EXTRA_LIBS, $X_PRE_LIBS AC_PATH_XTRA # Bit of a bodge but I can't think of a better way of detecting Windoz if test "$no_x" = "yes"; then # Probably Windoz AW_X_LIBS="-lGDI32 -lUSER32 -lCOMDLG32 -lKERNEL32" else AW_X_LIBS="-lXt -lX11" if test "$aw_want_sasami" = "yes"; then AW_X_LIBS="$AW_X_LIBS -lXmu -lXext" fi fi ######################################################################### # Run time linker ######################################################################### # The Solaris implementation of dynamic linking means that the run-time # linker needs to know where to locate the (dynamically linked) libraries. # This means when we are linking, for each -L option, we need to pass a # similar -R option. # Apparently some versions of Sun CC require a space after the -R, and # some no space, which seems incredibly dumb. I haven't bothered to check # for this yet though. dnl See the stuff in the AC_PATH_XTRA macro for how to implement a test dnl for this. I can't be bothered at the moment because in order to do it dnl properly it looks like I need to choose a functioning library to test. dnl (And possibly even *run* the test, not just link it to test completely dnl that -R works: note that -R on linux is for something else! Duh!). dnl See /gnu/share/autoconf/acspecific.m4 for AC_PATH_XTRA. AC_MSG_CHECKING(whether we need -R) case "`(uname -sr) 2>/dev/null`" in "SunOS 5"*) aw_need_r=yes AC_MSG_RESULT(yes) ;; *) aw_need_r=no AC_MSG_RESULT(no) ;; esac ######################################################################### # curses ######################################################################### # # Prefer "new" curses: ncurses. # # Examples: # bax and holst: /usr/include/ncurses/curses.h: # -I/usr/include/ncurses -L/usr/lib -L/usr/lib/ncurses -lncurses # gem: /gnu/include/ncurses.h: # -I/gnu/include -L/gnu/lib -lncurses # gem: /usr/include/curses.h: # -lcurses # # Possible include directories: /usr/include /gnu/include /usr/local/include # # One of these directories might include # ncurses/curses.h: -Iinc_dir/ncurses -Llib_dir -Llib_dir/ncurses -lncurses # ncurses.h: -Iinc_dir -Llib_dir -lcurses # curses.h: -Iinc_dir -Llib_dir -lcurses # # Everything set up already (eg in LIBS) is not an option as we want # this to apply only to ttyeden. # # Sets Example # CURSES_TYPE curses # CURSES_INCLUDE -I/usr/local/include # CURSES_LIB -lcurses # CURSES_LIB_PATH -L/usr/local/lib # HAVE_CURSES "" # dnl AW_LIB_CURSES2 dnl Don't call this directly - use AW_LIB_CURSES dnl Parameters: dnl $1 include directory to try dnl $2 header filename to look for dnl $3 CURSES_TYPE: curses or ncurses, used for the header file to include dnl $4 CURSES_INCLUDE if it works dnl $5 CURSES_LIB_PATH if it works AC_DEFUN([AW_LIB_CURSES2], [ aw_curses_include_dir=$1 aw_curses_header_look=$2 aw_curses_type=$3 aw_curses_include=$4 aw_curses_lib_path=$5 if test -z "$aw_finished_curses"; then AC_MSG_CHECKING(for ${aw_curses_include_dir}/${aw_curses_header_look}) if test -f ${aw_curses_include_dir}/${aw_curses_header_look}; then AC_MSG_RESULT(yes) # Temporarily add blurb to LIBS aw_save_libs=$LIBS LIBS="$aw_curses_include $aw_curses_lib_path -l${aw_curses_type} $LIBS" AC_MSG_CHECKING(whether we can link curses using $LIBS) AC_TRY_LINK( [#include ], [initscr()], [ # Link succeeded LIBS=$aw_save_libs AC_MSG_RESULT(yes) aw_finished_curses="yes" CURSES_TYPE=$aw_curses_type CURSES_INCLUDE=$aw_curses_include CURSES_LIB_PATH=$aw_curses_lib_path CURSES_LIB=-l$aw_curses_type ], [ # Link failed. Do nothing (the search process will # just continue to another possible location). LIBS=$aw_save_libs AC_MSG_RESULT(no) ] ) else AC_MSG_RESULT(no) fi fi ]) dnl AW_LIB_CURSES dnl $1 include directory to try dnl $2 corresponding lib directory AC_DEFUN([AW_LIB_CURSES], [ # Three possible cases # ncurses/curses.h: -Iinc_dir/ncurses -Llib_dir -Llib_dir/ncurses -lncurses # ncurses.h: -Iinc_dir -Llib_dir -lcurses # curses.h: -Iinc_dir -Llib_dir -lcurses if test "$aw_need_r" = "yes"; then # We need the -R for runtime linking # Note this code is repeated below with -R taken away AW_LIB_CURSES2($1, ncurses/curses.h, ncurses, -I$1/ncurses, "-L$2 -L$2/ncurses -R$2 -R$2/ncurses") AW_LIB_CURSES2($1, ncurses.h, ncurses, -I$1, "-L$2 -R$2") AW_LIB_CURSES2($1, curses.h, curses, -I$1, "-L$2 -R$2") else # We don't need the -R option # Note this code is repeated above with -R added AW_LIB_CURSES2($1, ncurses/curses.h, ncurses, -I$1/ncurses, "-L$2 -L$2/ncurses") AW_LIB_CURSES2($1, ncurses.h, ncurses, -I$1, -L$2) AW_LIB_CURSES2($1, curses.h, curses, -I$1, -L$2) fi ]) # See if the user supplied some arguments AC_ARG_WITH(curses-include, [ --with-curses-include=DIR (n)curses include files are in DIR], [ aw_user_supplied_curses_include=$withval # Try and find this with the lib variable unset - the user # should really provide --with-curses-lib as well. AW_LIB_CURSES($aw_user_supplied_curses_include,) ] ) AC_ARG_WITH(curses-lib, [ --with-curses-lib=DIR (n)curses library files are in DIR], [ aw_user_supplied_curses_lib_dir=$withval AW_LIB_CURSES($aw_user_supplied_curses_include, $aw_user_supplied_curses_lib_dir) ] ) # Attempt to guess where it might be AW_LIB_CURSES(/usr/local/include, /usr/local/lib) AW_LIB_CURSES(/gnu/include, /gnu/lib) AW_LIB_CURSES(/usr/include, /usr/lib) # Declare the type of curses found so that we can include the # appropriate header file, and include the curses object in the list # of objects to be built in the appropriate Makefiles if test "$CURSES_TYPE" = "ncurses"; then AC_DEFINE(HAVE_NCURSES) HAVE_CURSES="ncurses" elif test "$CURSES_TYPE" = "curses"; then AC_DEFINE(HAVE_CURSES) HAVE_CURSES="curses" else HAVE_CURSES="" fi # Print results AC_MSG_CHECKING(for curses) AC_MSG_RESULT([$CURSES_TYPE $CURSES_INCLUDE $CURSES_LIB $CURSES_LIB_PATH $CURSES_IF_ENABLED]) ######################################################################### # tcl ######################################################################### # # Sets Example # TCL_INCLUDE -I/usr/local/include # TCL_LIB -L/usr/local/lib -ltcl # AC_DEFUN([AW_CHECK_TCL], [ aw_tcl_include=$1 aw_tcl_lib=$2 if test "$aw_need_r" = "yes"; then # !@!@ This bit should really be an AC function # Note I need m4 [] quotes around this so that the brackets in the # sed expression do not get eaten aw_tcl_lib=[`echo $aw_tcl_lib | sed 's/-L\([^ ]*\)/-L\1 -R\1/'`] fi # If we haven't already found an answer... if test -z "$aw_finished_tcl"; then aw_save_libs=$LIBS LIBS="$aw_tcl_include $aw_tcl_lib $LIBS" AC_MSG_CHECKING(whether we can link tcl using $LIBS) AC_TRY_LINK( [#include ], [Tcl_AsyncReady()], [ # Link succeeded AC_MSG_RESULT(yes) # Don't do any more tests - we have the answer aw_finished_tcl="yes" TCL_INCLUDE=$aw_tcl_include TCL_LIB=$aw_tcl_lib AC_MSG_CHECKING(whether tcl has Tcl_EvalEx) AC_TRY_LINK( [#include ], [ Tcl_Interp *interp; Tcl_EvalEx(interp, "", -1, 0) ], [ AC_MSG_RESULT(yes) AC_DEFINE(HAVE_TCL_EVALEX) ], [ AC_MSG_RESULT(no) ] ) LIBS=$aw_save_libs ], [ # Link failed - do nothing. LIBS=$aw_save_libs AC_MSG_RESULT(no) ] ) fi ]) AC_ARG_WITH(tcl-include, [ --with-tcl-include=compiler options to enable location of tcl.h eg \"-I/usr/local/include\"], [aw_user_tcl_include=$withval] ) AC_ARG_WITH(tcl-lib, [ --with-tcl-lib=linker options to enable location of the tcl library eg \"-L/usr/local/lib -R/usr/local/lib -ltcl\"], [aw_user_tcl_lib=$withval] ) # If the user provided both or either option, then try it first if test -n "$aw_user_tcl_include" -o -n "$aw_user_tcl_lib"; then AW_CHECK_TCL($aw_user_tcl_include, $aw_user_tcl_lib) fi # Else can we use tcl with just -ltcl? AW_CHECK_TCL(, "-ltcl") # Now we're guessing... :) # This works at DCS, University of TV AW_CHECK_TCL("-I/usr/local/include", "-L/usr/local/lib -ltcl") # This works at ITS, University of TV AW_CHECK_TCL(, "-L/usr/local/lib -ltcl8.0") # This works on ride, a Sparc Solaris 7 machine with packages # from sunfreeware.com AW_CHECK_TCL(, "-L/usr/local/lib -ltcl") # I give a warning if tcl is not found at the end of the script ######################################################################### # tk ######################################################################### # # Sets Example # TK_INCLUDE -I/usr/local/include # TK_LIB -L/usr/local/lib -ltk # AC_DEFUN([AW_CHECK_TK], [ aw_tk_include=$1 aw_tk_lib=$2 if test "$aw_need_r" = "yes"; then # Note I need m4 [] quotes around this so that the brackets in the # sed expression do not get eaten aw_tk_lib=[`echo $aw_tk_lib | sed 's/-L\([^ ]*\)/-L\1 -R\1/'`] fi # If we haven't already found an answer... if test -z "$aw_finished_tk"; then aw_save_libs=$LIBS # Also add X stuff and tcl stuff. Existing LIBS must go at the # end: -lm must come after -ltk for example. # NB don't seem to need $AW_X_LIBS and -lglPNG may cause an error LIBS="$aw_tk_include $aw_tk_lib $X_CFLAGS $X_PRE_LIBS $X_LIBS $X_EXTRA_LIBS $TCL_INCLUDE $TCL_LIB $LIBS" AC_MSG_CHECKING(whether we can link tk using $LIBS) AC_TRY_LINK( [#include ], [Tk_GetNumMainWindows();], [ # Link succeeded LIBS=$aw_save_libs AC_MSG_RESULT(yes) # Don't do any more tests - we have the answer aw_finished_tk="yes" TK_INCLUDE=$aw_tk_include TK_LIB=$aw_tk_lib ], [ # Link failed - do nothing. LIBS=$aw_save_libs AC_MSG_RESULT(no) ] ) fi ]) AC_ARG_WITH(tk-include, [ --with-tk-include=compiler options to enable location of tk.h eg \"-I/usr/local/include\"], [aw_user_tk_include=$withval] ) AC_ARG_WITH(tk-lib, [ --with-tk-lib=linker options to enable location of the tk library eg \"-L/usr/local/lib -R/usr/local/lib -ltk\"], [aw_user_tk_lib=$withval] ) # If the user provided both or either option, then try it first if test -n "$aw_user_tk_include" -o -n "$aw_user_tk_lib"; then AW_CHECK_TK($aw_user_tk_include, $aw_user_tk_lib) fi # Else can we use tk with just -ltk? AW_CHECK_TK(, "-ltk") # Now we're guessing... :) # This works at DCS, University of TV AW_CHECK_TK("-I/usr/local/include", "-L/usr/local/lib -ltk") # This works at ITS, University of TV AW_CHECK_TK(, "-L/usr/local/lib -ltk8.0") # This works on ride, a Sparc Solaris 7 machine with packages from # sunfreeware.com AW_CHECK_TK(, "-L/usr/local/lib -ltk8.2") # I give a warning if tk is not found at the end of the script ######################################################################### # Readline ######################################################################### # # Sets Example # READLINE_INCLUDE -I/gnu/include/readline # READLINE_LIB -L/gnu/lib -R/gnu/lib -lreadline # AC_DEFUN([AW_CHECK_READLINE], [ aw_readline_include=$1 aw_readline_lib=$2 if test "$aw_need_r" = "yes"; then # Note I need m4 [] quotes around this so that the brackets in the # sed expression do not get eaten aw_readline_lib=[`echo $aw_readline_lib | sed 's/-L\([^ ]*\)/-L\1 -R\1/'`] fi # If we haven't already found an answer... if test -z "$aw_finished_readline"; then aw_save_libs=$LIBS # Need curses as well as the supplied settings LIBS="$aw_readline_include $aw_readline_lib $CURSES_INCLUDE $CURSES_LIB_PATH $CURSES_LIB $LIBS" AC_MSG_CHECKING(whether we can link readline using $LIBS) AC_TRY_LINK( [ #include #include #include ], [readline("test");], [ # Link succeeded LIBS=$aw_save_libs AC_MSG_RESULT(yes) # Don't do any more tests - we have the answer aw_finished_readline="yes" READLINE_INCLUDE=$aw_readline_include READLINE_LIB=$aw_readline_lib ], [ # Link failed - do nothing. LIBS=$aw_save_libs AC_MSG_RESULT(no) ] ) fi ] ) AC_ARG_WITH(readline-include, [ --with-readline-include=compiler options to enable location of GNU readline header files eg \"-I/gnu/include/readline\"], [aw_user_readline_include=$withval] ) AC_ARG_WITH(readline-lib, [ --with-readline-lib=linker options to enable location of the GNU readline library eg \"-L/gnu/lib -R/gnu/lib -lreadline\"], [aw_user_readline_lib=$withval] ) # If the user provided both or either option, then try it first if test -n "$aw_user_readline_include" -o -n "$aw_user_readline_lib"; then AW_CHECK_READLINE($aw_user_readline_include, $aw_user_readline_lib) fi # Else can we use readline with just -lreadline? AW_CHECK_READLINE(, "-lreadline") # Now we're guessing... :) # This works on cygwin AW_CHECK_READLINE("-I/usr/include/readline", "-L/usr/lib -lreadline") # This works at DCS, University of TV AW_CHECK_READLINE("-I/gnu/include/readline -I/gnu/include", "-L/gnu/lib -R/gnu/lib -lreadline") # This works on a newly installed Solaris 7 machine with standard GNU install AW_CHECK_READLINE("-I/usr/local/include/readline", "-L/usr/local/lib -R/usr/local/lib -lreadline") # If we found an answer, then we HAVE_READLINE if test -n "$aw_finished_readline"; then AC_DEFINE(HAVE_READLINE) fi ######################################################################### # OpenGL ######################################################################### # # Sets Example # OPENGL_INCLUDE -I/usr/openwin/include # OPENGL_LIB -L/usr/openwin/lib -R/usr/openwin/lib -lGL AC_DEFUN([AW_CHECK_GL], [ aw_gl_include=$1 aw_gl_lib=$2 if test "$aw_need_r" = "yes"; then # Note I need m4 [] quotes around this so that the brackets in the # sed expression do not get eaten aw_gl_lib=[`echo $aw_gl_lib | sed 's/-L\([^ ]*\)/-L\1 -R\1/'`] fi # If we haven't already found an answer... if test -z "$aw_finished_gl"; then aw_save_libs=$LIBS # Debian seems to require -lm... LIBS="$aw_gl_include $aw_gl_lib -lm" AC_MSG_CHECKING(whether we can link GL using $LIBS) # !@!@ should put a test for the Solaris GL implementation in here, # because I can't get it to use the correct colormap on 8-bit GFX # hardware: the workaround is to use Mesa instead AC_TRY_LINK( [ #include ], [glLoadIdentity();], [ # Link succeeded LIBS=$aw_save_libs AC_MSG_RESULT(yes) # Don't do any more tests - we have the answer aw_finished_gl="yes" OPENGL_INCLUDE=$aw_gl_include OPENGL_LIB=$aw_gl_lib ], [ # Link failed - do nothing. LIBS=$aw_save_libs AC_MSG_RESULT(no) ] ) fi ] ) AC_ARG_WITH(gl-include, [ --with-gl-include=compiler options to enable location of GL header files eg \"-I/usr/openwin/include\"], [aw_user_gl_include=$withval] ) AC_ARG_WITH(gl-lib, [ --with-gl-lib=linker options to enable location of the GL library eg \"-L/usr/openwin/lib -R/usr/openwin/lib -lGL\"], [aw_user_gl_lib=$withval] ) if test "$aw_want_sasami" = "yes"; then # We want to build Sasami - so figure out OpenGL # If the user provided both or either option, then try it first if test -n "$aw_user_gl_include" -o -n "$aw_user_gl_lib"; then AW_CHECK_GL($aw_user_gl_include, $aw_user_gl_lib) fi # Else can we use GL with just -lGL? AW_CHECK_GL(, "-lGL") else OPENGL_INCLUDE="" OPENGL_LIB="" fi ######################################################################### # PNG library ######################################################################### # # Sets Example # PNG_INCLUDE -I/usr/local/include # PNG_LIB -L/usr/local/lib -R/usr/local/lib -lpng AC_DEFUN([AW_CHECK_PNG], [ aw_png_include=$1 aw_png_lib=$2 if test "$aw_need_r" = "yes"; then # Note I need m4 [] quotes around this so that the brackets in the # sed expression do not get eaten aw_png_lib=[`echo $aw_png_lib | sed 's/-L\([^ ]*\)/-L\1 -R\1/'`] fi # If we haven't already found an answer... if test -z "$aw_finished_png"; then aw_save_libs=$LIBS # -lpng needs -lm LIBS="$aw_png_include $aw_png_lib -lm" AC_MSG_CHECKING(whether we can link png using $LIBS) AC_TRY_LINK( [ #include ], [ png_structp png; png = png_create_read_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL); ], [ # Link succeeded LIBS=$aw_save_libs AC_MSG_RESULT(yes) # Don't do any more tests - we have the answer aw_finished_png="yes" PNG_INCLUDE=$aw_png_include PNG_LIB=$aw_png_lib ], [ # Link failed - do nothing. LIBS=$aw_save_libs AC_MSG_RESULT(no) ] ) fi ] ) AC_ARG_WITH(png-include, [ --with-png-include=compiler options to enable location of PNG header files eg \"-I/usr/local/include\"], [aw_user_png_include=$withval] ) AC_ARG_WITH(png-lib, [ --with-png-lib=linker options to enable location of the PNG library eg \"-L/usr/local/lib -R/usr/local/lib -lpng\"], [aw_user_png_lib=$withval] ) if test "$aw_want_sasami" = "yes"; then # We want to build Sasami - so figure out PNG # If the user provided both or either option, then try it first if test -n "$aw_user_png_include" -o -n "$aw_user_png_lib"; then AW_CHECK_PNG($aw_user_png_include, $aw_user_png_lib) fi # Else can we use PNG with just -lpng? AW_CHECK_PNG(, "-lpng") # Try this... AW_CHECK_PNG("-I/usr/local/include", "-L/usr/local/lib -lpng") else PNG_INCLUDE="" PNG_LIB="" fi ######################################################################### # Memory alignment ######################################################################### # I could use the gcc __alignof__ function, but then this would # restrict us to using gcc only. So we attempt to detect the alignment # required instead. AC_MSG_CHECKING(how doubles should be aligned) AC_TRY_RUN( [ #include struct foo { union align { double d; long l; void *p; } u; char c; }; int main() { struct foo f[2]; FILE *fp; int n; if ((fp = fopen("conftestalignoutput", "w")) == NULL) exit(1); if( 2*sizeof(union align) != sizeof(f) ) { n = fprintf(fp, "%ld\n", (long)(sizeof(struct foo) - sizeof(union align))); } else { n = fprintf(fp, "%ld\n", (long)sizeof(union align)); } /* If fprintf didn't complete successfully, exit code 1 */ if (n < 0) exit(1); if (fclose(fp) != 0) exit(1); /* All OK - exit code 0 */ exit(0); } ], [ # The code compiled, linked, executed and had exit code 0, # so we can read the alignment value written to the temporary # file. aw_alignment=`cat conftestalignoutput` AC_DEFINE_UNQUOTED(DOUBLE_ALIGNMENT, $aw_alignment) AC_MSG_RESULT($aw_alignment byte boundaries) ], [ # The test failed in some way, so assume the worst. AC_DEFINE(DOUBLE_ALIGNMENT, sizeof(double)) AC_MSG_RESULT([sizeof(double) byte boundaries]) ], [ # We are cross compiling so can't run the test, so we # assume the worst. AC_DEFINE(DOUBLE_ALIGNMENT, sizeof(double)) AC_MSG_RESULT([sizeof(double) byte boundaries]) ] ) ######################################################################### # dmalloc (tool for checking for memory leaks etc) ######################################################################### # I'm trusting the user to get this right, so no checks are done to see # if the arguments provided are correct. If they want to run it with a # memory debugger, they should know what they are doing... I hope. DMALLOC_INCLUDE= DMALLOC_LIB= AC_ARG_WITH(dmalloc-include, [ --with-dmalloc-include=DIR dmalloc include file is in DIR], [ AC_DEFINE(HAVE_DMALLOC) DMALLOC_INCLUDE=-I$withval ] ) AC_ARG_WITH(dmalloc-lib, [ --with-dmalloc-lib=DIR dmalloc lib file is in DIR], [ AC_DEFINE(HAVE_DMALLOC) DMALLOC_LIB="-L$withval -ldmalloc" ] ) ######################################################################### # Pascal strings ######################################################################### # Need to try with -fpascal-strings first as \p only results in a # warning if the option is not given aw_save_cflags=$CFLAGS CFLAGS="$CFLAGS -fpascal-strings" AC_TRY_COMPILE( [], [ char *pascal = "\pHello world"; ], [ # Compiled successfully ], [ # Had a problem: all we can do is to omit the option again CFLAGS="$aw_save_cflags" ] ) ######################################################################### # Other bits ######################################################################### # Do we have ANSI C header files? Declares STDC_HEADERS if we do. Also # (undocumented) sets $ac_cv_header_stdc to "yes". dnl AC_HEADER_STDC dnl if test "$ac_cv_header_stdc" != "yes"; then dnl AC_MSG_ERROR(we don't have ANSI C header files) dnl fi # Check other headers and stop if we can't find them # Might define HAVE_SYS_TIME_H AC_CHECK_HEADER(sys/time.h,, AC_MSG_ERROR(can't find sys/time.h)) # This defines HAVE_LIBGEN_H if it is found AC_CHECK_HEADERS(libgen.h) # Define const to be empty if the compiler does not support it AC_C_CONST # Deal with problems due to two header files time.h and sys/time.h # Might define TIME_WITH_SYS_TIME AC_HEADER_TIME # Might define TM_IN_SYS_TIME, "which means that including sys/time.h # had better define struct tm." (from Autoconf manual - huh?). AC_STRUCT_TM # Check for how to get alloca. Might defined HAVE_ALLOCA_H, HAVE_ALLOCA, # ALLOCA, C_ALLOCA... AC_FUNC_ALLOCA # Find out what a signal handler should return AC_TYPE_SIGNAL # Check other functions and stop if we can't find them AC_CHECK_FUNC(gettimeofday,, AC_MSG_ERROR(don't have gettimeofday)) AC_CHECK_FUNC(putenv,, AC_MSG_ERROR(don't have putenv)) AC_CHECK_FUNC(select,, AC_MSG_ERROR(don't have select)) AC_CHECK_FUNC(strdup,, AC_MSG_ERROR(don't have strdup)) ######################################################################### # Create the Makefiles ######################################################################### # Substitute the following variables in the Makefiles AC_SUBST(AW_X_LIBS) AC_SUBST(CURSES_TYPE) AC_SUBST(CURSES_INCLUDE) AC_SUBST(CURSES_LIB) AC_SUBST(CURSES_LIB_PATH) AC_SUBST(TCL_INCLUDE) AC_SUBST(TCL_LIB) AC_SUBST(TK_INCLUDE) AC_SUBST(TK_LIB) AC_SUBST(DMALLOC_INCLUDE) AC_SUBST(DMALLOC_LIB) AC_SUBST(READLINE_INCLUDE) AC_SUBST(READLINE_LIB) AC_SUBST(OPENGL_INCLUDE) AC_SUBST(OPENGL_LIB) AC_SUBST(PNG_INCLUDE) AC_SUBST(PNG_LIB) AC_SUBST(DEPEND_MAKEDEFS) # Done - write the output Makefiles AC_OUTPUT(generic.mk Misc/Makefile Eden/Makefile EX/Makefile Scout/Makefile Makefile Donald/Makefile LSD/Makefile Sasami/Makefile) # Give warnings if test -z "$aw_want_sasami"; then AC_MSG_WARN(Cannot build Sasami - only possible on Windoz presently) fi if test -z "$aw_finished_tcl"; then AC_MSG_WARN(Could not locate tcl - can probably only build ttyeden) fi if test -z "$aw_finished_tk"; then AC_MSG_WARN(Could not locate tk - can probably only build ttyeden) fi if test -z "$aw_finished_readline"; then AC_MSG_WARN(Could not locate readline - ttyeden will not have line editing) fi if test -z "$HAVE_CURSES"; then AC_MSG_WARN(Could not locate curses - probably cannot build ttyeden) fi if test -z "$aw_finished_gl"; then AC_MSG_WARN(Could not locate GL - probably cannot build Sasami) fi if test -z "$aw_finished_png"; then AC_MSG_WARN(Could not locate PNG - probably cannot build Sasami) fi AC_MSG_WARN(Type 'make' for further instructions) local/include/readline", "-L/usr/local/lib -R/usr/local/lib -lreadline") # If we found an answer, then we HAVE_READLINE if test -n "$aw_finished_readline"; then AC_DEFINE(HAVE_READLINE) fi ######################################################################### # OpenGL ######################################################################### # # Sets Example # tkeden1.41/cscope010070000025250000164000000026740735441324000140250ustar00ashleyem00003510000005#!/bin/sh # # cscope # # $Id: cscope,v 1.7 2001/09/26 17:55:44 cssbz Exp $ # # Ashley Ward, April 1999 # # Call cscope (a program by Sun - sort of an intelligent front end to # grep) with the right sort of settings for tkeden. # # This is of course, only of some use on a Sun platform which has the cscope # tool installed :) # # Name of temporary file to use - uses the PID of this shell to make the # name unique. TEMPFILE=/var/tmp/cscope.ash.$$ # Create the temporary file. Actually a little bit of shell so we can call # emacsclient with the correct arguments (can't set EDITOR to # 'emacsclient someargs' unfortunately). Note need to escape the $* # (which means all arguments passed to this shell). The sleep is so that # we have time to see any error messages. cat > $TEMPFILE < main.o main.d : main.c defs.h. %.d: %.c set -e; $(CC) -M $(CPPFLAGS) $(ALLCFLAGS) $< \ | sed 's/\($*\)\.o[ :]*/\1.o $@ : /g' > $@; \ [ -s $@ ] || rm -f $@ # Make all the .d files depend: $(DEPENDS) # Include all the .d files here to give make knowledge of source dependencies # but not if the macro INHIBIT_DEPEND is set to something (set this in the # call to make using something like make INHIBIT_DEPEND=y generate) ifeq (,$(INHIBIT_DEPEND)) include $(DEPENDS) endif tkeden1.41/Docs/004070000025250000164000000000000747345744100135225ustar00ashleyem00003510000005tkeden1.41/Docs/CHANGE.LOG010060000025250000164000000001050733204552300147710ustar00ashleyem00003510000005 Eden CHANGE.LOG =============== See the file lib-tkeden/change.log tkeden1.41/Docs/COPYING.TXT010060000025250000164000000002420733031157100152110ustar00ashleyem00003510000005Eden: the Evaluator of DEfinitive Notations Copyright (c) 1995-2001 The University of TV. All rights reserved. Please see the file lib-tkeden/credits.txt tkeden1.41/Docs/CVS/004070000025250000164000000000000744001225000141305ustar00ashleyem00003510000005tkeden1.41/Docs/CVS/Entries010060000025250000164000000006220744001225000154630ustar00ashleyem00003510000005/CHANGE.LOG/1.7/Wed Aug 1 18:32:51 2001// /COPYING.TXT/1.5/Fri Jul 27 16:14:49 2001// /GPL.TXT/1.1/Fri Mar 9 16:11:08 2001// /INSTALL.TXT/1.2/Fri Jul 27 16:20:41 2001// /LICENSE_GLPNG.TXT/1.1/Fri Jul 27 16:10:35 2001// /LICENSE_TOGL.TXT/1.1/Fri Jul 27 16:10:35 2001// /MAKING.A.RELEASE/1.7/Thu Dec 6 22:24:08 2001// /README.TXT/1.2/Fri Jul 27 16:12:53 2001// /TODO/1.10/Fri Mar 1 23:30:24 2002// D tkeden1.41/Docs/CVS/Repository010060000025250000164000000000140743723740400162440ustar00ashleyem00003510000005tkeden/Docs tkeden1.41/Docs/CVS/Root010060000025250000164000000000550743723740400150150ustar00ashleyem00003510000005cssbz@cvs.eden.sourceforge.net:/cvsroot/eden tkeden1.41/Docs/GPL.TXT010060000025250000164000000431310725220023400145230ustar00ashleyem00003510000005 GNU GENERAL PUBLIC LICENSE Version 2, June 1991 Copyright (C) 1989, 1991 Free Software Foundation, Inc. 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by the GNU Library General Public License instead.) You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things. To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it. For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software. Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations. Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all. The precise terms and conditions for copying, distribution and modification follow. GNU GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language. (Hereinafter, translation is included without limitation in the term "modification".) Each licensee is addressed as "you". Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does. 1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change. b) You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License. c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the most ordinary way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program. In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following: a) Accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, b) Accompany it with a written offer, valid for at least three years, to give any third party, for a charge no more than your cost of physically performing source distribution, a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, c) Accompany it with the information you received as to the offer to distribute corresponding source code. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form with such an offer, in accord with Subsection b above.) The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code. 4. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 5. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Program (or any work based on the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Program or works based on it. 6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License. 7. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all. For example, if a patent license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 8. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 9. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of this License, you may choose any version ever published by the Free Software Foundation. 10. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Also add information on how to contact you by electronic and paper mail. If the program is interactive, make it output a short notice like this when it starts in an interactive mode: Gnomovision version 69, Copyright (C) year name of author Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, the commands you use may be called something other than `show w' and `show c'; they could even be mouse-clicks or menu items--whatever suits your program. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if necessary. Here is a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision' (which makes passes at compilers) written by James Hacker. , 1 April 1989 Ty Coon, President of Vice This General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Library General Public License instead of this License. s it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that compontkeden1.41/Docs/INSTALL.TXT010060000025250000164000000214460733031233100152130ustar00ashleyem00003510000005-*-text-*- REQUIREMENTS ============ Eden depends upon other pieces of software for some of its functionality. Build requirements ------------------ To be able to build Eden, you might need some of these open-source packages. The version numbers are for your rough guidance only: these versions seemed to work for me, and earlier versions may as well. ncurses 4.2: if you want ttyeden to be able to move the cursor around the screen etc - say you want to run the text editor model. If the configure script can't find a version of curses ("new" curses - ncurses - is preferred but most systems will probably have a suitable version already), then ttyeden /should/ still build (ie it might not but that is a bug!). readline 4.1: if you want line editing facilities in ttyeden. If it can't, it /should/ still build. gzip 1.3: to decompress the package in the first place. make 3.78.1: but your system probably has a make already, which will probably do (although you may need GNU make if you plan to do some development with Eden - see below). tk 8.2.1 and tcl 8.2.1: if you want tkeden. Tk Img package 1.2.4 (from http://members1.chello.nl/~j.nijtmans/img.html): if you want Scout to be able to display images from files formats other than just the Tk default PPM/PGM and GIF. libpng 1.0.12 (which itself requires zlib 1.1.3): if you want the Sasami OpenGL notation. Mesa 3.4.2: if you want Sasami OpenGL to use the correct colours on a Solaris machine with a cheap graphics card. There is a bug somewhere (Sasami, Togl, Tk, X, OpenGL?) which causes Eden to use the wrong visual and colormap when running using Solaris 8 X and OpenGL on a machine with an 8-bit (old, low end) graphics card. The easiest way to solve this problem currently seems to be to link Eden using Mesa (which is most simply described as an open-source OpenGL). gcc 2.8.1: to compile it - duh. I /think/ it compiles OK with the Sun cc as well. The usual UNIX system things: sed, ar, install (mentioned in the Makefiles but not yet used), grep and awk (if running the more obscure distribution tasks). Development tools ----------------- If you want to change or debug Eden code, these might be useful. The version numbers are for your rough guidance only: these versions seemed to work for me, and earlier versions may as well. autoconf 2.13: if you want to make a change to configure.in and rebuild the configure script. autoconf needs m4 to be installed - I used m4 1.4. bison 1.28: (the GNU parser generator - a yacc replacement). Needed if you want to make changes to the notations Eden, Donald etc. If the distribution package has been built correctly, the generated files should be there already, so you should only need bison if you are developing. If you are using a different version of bison, you /may/ need to re-do bison/bison.simple from the bison.simple supplied with your bison (although I'm not sure how important this is - I've been using the wrong version for a while with no apparent ill effects). The modifications are marked and are quite simple. dmalloc: if you want to debug nasty memory problems cvs: if you want to check in or out changes to the central SourceForge code repository. Development notes: - If you are making substantial changes to the code, I'd suggest that you use the automatic Makefile source code dependency checking to make sure that the necessary source is recompiled when things are changed. Follow this process to set up the dependency information: ./configure --enable-debug --enable-depend gmake generate gmake depend I've specified gmake here as GNU make is probably required for this (Solaris make gives "Unexpected end of line seen" after encountering the ifeq GNU extension I've used, and it doesn't seem to interpret the source.c source.d: deps rule appropriately). - If you want to compile non-optimised (for easy single-stepping using a debugger), I'd recommend that you set the environment variable CFLAGS to "-g -O0" and then re-make everything. Windows ------- The port to the Windows platform uses cygwin. Run-time requirements --------------------- tkeden uses various pnm image utilities (eg 'pnmscale') to do image manipulation for Scout. tkeden expects to find these utilities in the PATH. They are not required if your model does not use image scaling etc. BUILDING EDEN ============= These instructions describe how to build an Eden variant on a UNIX-flavour machine (eg Solaris, Linux...). Cygwin (which provides some UNIX-like facilities for Windows) is used to build Eden on Windows, and so the procedure there is similar, but different in some aspects. Hopefully some documentation for the Windows build will be written at some point. Gunzip and untar your distribution, using something like: gunzip tkeden.1.11.tar.gz tar xvf tkeden.1.11.tar Change directory to within the tkeden directory you just untarred: cd tkeden Hopefully your distribution will have a `configure' shell script. If you've downloaded the source straight from CVS, however, you probably won't have one. If you don't, generate `configure' and the Makefiles from the various `.in' (`configure.in', `Makefile.in'...) files by running: autoconf Automatically probe your setup for the information we need to compile `tkeden' by running: ./configure At the end of the probing, if you see errors such as configure: warning: Could not locate tk - can probably only build ttyeden then examine `config.log' to see the tests that were run and the errors that were encountered. The `configure' script should figure out all that we need. Unfortunately, even though this may sound simple, it is actually a rather nasty and complex job, as machine configurations can vary widely. Depending upon your setup, you may need to tell the `configure' script how to use other pieces of software. If `configure' still moans, you might need to solve the problem with something like: ./configure --with-tk-include="-I/usr/local/include" \ --with-tk-lib="-L/usr/local/lib -R/usr/local/lib -ltk8.2" (I've broken the line for readability). See the available options by using ./configure --help If you figure out what needs to be done to compile the software on your particular platform, if you are able, please modify configure.in and change the master copy of the source with CVS, or email me at ashley@dcs.warwick.ac.uk, giving me the details of what you needed to do, and I'll attempt to fix things so that you and others will not need to do this in the future. Choose the sort of Eden you wish to build: - `ttyeden' is the terminal based, non-graphical version, - `tkeden' is the `standard' version and - `dtkeden' is the one with distributed modelling facilities. I expect most people will choose to build `tkeden'. The following instructions show how to build `tkeden': simply substitute one of the other target names if you want to build another variant. To compile tkeden, type make tkeden Hopefully you will now have a tkeden binary in your directory. I'd recommend trying this simple test to see if the binary will print out the usage information: ./tkeden -u If that worked OK, try and run it normally with ./tkeden -l ./lib-tkeden (the -l argument tells tkeden where to find some start-up files --- some older documentation may refer to the `$PUBLIC' environment variable, which used to be used to provide this information). After you've started `tkeden', I'd suggest checking the `Help -> About tkeden' menu to check that you are running the right version (and not a `tkeden' elsewhere on your PATH). Careful: you must (unfortunately) use make clean before compiling a different variant (eg compiling dtkeden after having just done tkeden). This is due to the extensive use of the C preprocessor in merging the different sources together - if you can figure out a better scheme, please implement it! :) Installing: with `tkeden' and `dtkeden', you can put the binary anywhere as long as it is provided with the -l argument when it is invoked to tell it where the start-up library files are. I'd suggest writing a wrapper shell script if you want to install it `properly'. There is no requirement to do this, of course --- you can just leave the binary where you found it after compilation. `ttyeden' doesn't require the -l argument, so you should be able to put it anywhere on your PATH with no problems. If you want to save some disc space, you can strip the binaries (eg `strip tkeden'), but I'd only recommend doing this if you anticipate never using a debugger on the code. If you want Scout to be able to display images from files formats other than just the Tk default PPM/PGM and GIF, follow the instructions provided with the Tk Img package to install it, and tkeden should detect and load it automatically at runtime. If it all works fine for you --- congratulations, and have fun. Ash, March 2001 tkeden1.41/Docs/LICENSE_GLPNG.TXT010070000025250000164000000025670733031117300161250ustar00ashleyem00003510000005-*-text-*- PNG loader library for OpenGL v1.45 (10/7/2000) By Ben Wyatt: ben@wyatt100.freeserve.co.uk Note: this is a cut-down (by Ashley Ward) version of GLpng to fit it neatly into the Eden distribution. The original, with more documentation and examples etc can be downloaded from http://www.wyatt100.freeserve.co.uk/download.htm. This is a library for OpenGL to load PNG graphics files as an OpenGL texture as easily as possible. It also has a number of options for generating the alpha channel and mipmaps. It is implemented using modified versions of the LibPNG 1.0.2 and ZLib 1.1.3 libraries. This software is provided 'as-is', without any express or implied warranty. In no event will the author be held liable for any damages arising from the use of this software. Permission is hereby granted to use, copy, modify, and distribute this source code, or portions hereof, for any purpose, without fee, subject to the following restrictions: o The origin of this source code must not be misrepresented. You must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. o Altered versions must be plainly marked as such and must not be misrepresented as being the original source. o This notice must not be removed or altered from any source distribution. tkeden1.41/Docs/LICENSE_TOGL.TXT010070000025250000164000000027050733031117300160150ustar00ashleyem00003510000005This software is copyrighted by Brian Paul (brian@mesa3d.org) and Benjamin Bederson (bederson@cs.umd.edu). The following terms apply to all files associated with the software unless explicitly disclaimed in individual files. The authors hereby grant permission to use, copy, modify, distribute, and license this software and its documentation for any purpose, provided that existing copyright notices are retained in all copies and that this notice is included verbatim in any distributions. No written agreement, license, or royalty fee is required for any of the authorized uses. Modifications to this software may be copyrighted by their authors and need not follow the licensing terms described here, provided that the new terms are clearly indicated on the first page of each file where they apply. IN NO EVENT SHALL THE AUTHORS OR DISTRIBUTORS BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OF THIS SOFTWARE, ITS DOCUMENTATION, OR ANY DERIVATIVES THEREOF, EVEN IF THE AUTHORS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. THE AUTHORS AND DISTRIBUTORS SPECIFICALLY DISCLAIM ANY WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT. THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, AND THE AUTHORS AND DISTRIBUTORS HAVE NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. tkeden1.41/Docs/MAKING.A.RELEASE010060000025250000164000000024260740377001000156330ustar00ashleyem00003510000005 MAKING A RELEASE - CHECKLIST: ============================= o Increment the version number in version.h if necessary (every time a release is given to a third party -- thus allowing us to identify which source code was used in any given installation). Perhaps: o autoconf o make reallyclean o lsrw; lsrw */* (ensure no temporary output files are left, and everything is checked in) o ./configure o make dtkeden (to ensure the generated sources exist) o chgrp -R em * o make maintainerclean o Update lib-tkeden/change.log o cd ..; tar cvf tkeden.1.3.tar tkeden gzip tkeden.1.3.tar (update the version number, of course!) o various cvs stuff... o make setcvstag o If installing a version, you have linked without a debugging memory library? o chmod 755 tkeden ttyeden lib-tkeden o rm -rf lib-tkeden/CVS o chmod 644 lib-tkeden/* Platform notes: - solaris-sparc - windows-intel: make windist - linux-intel (for DCS labs): careful with dcs.configure: make sure last three lines are not enabled - linux-intel, debian (EM laptop, for binary release). Need to use this platform so we link with /usr/lib/libtk8.3.so etc (seems to work on more platforms). Put into directory called tkeden1.20: contents tkeden, ttyeden, lib-tkeden (remove CVS files). Make a gzipped tarball. tkeden1.41/Docs/README.TXT010060000025250000164000000034310733031140500150350ustar00ashleyem00003510000005 README.TXT This is the Eden Empirical Modelling tool distribution. For more information, see http://www.dcs.warwick.ac.uk/modelling/. WARRANTY Note this software is supplied with NO FORM OF WARRANTY whatsoever: you /will/ discover problems, and unfortunately the students and staff at TV University will probably not have the time to help you. Sorry. Having said that, we hope it works for you and you find it interesting - best of luck! EDEN VARIANTS This source code can currently build three variants of Eden: tkeden (this has a graphical user interface provided by Tcl/Tk, hence the name, and is the variant most people usually use), dtkeden (tkeden plus some distributed features which are only of use if you intend to run multiple communicating tkedens) and ttyeden (a version with only a command line interface which provides only the Eden notation). NOTATIONS tkeden and dtkeden provide multiple notations. Eden is a definitive notation with a C-like syntax, which is used to implement the other, more domain-specific notations. Donald is a definitive notation for line drawing. Scout is a definitive notation for window layout. Sasami is a definitive notation for 3D graphics (which currently only works under Windows). LSD is a notation for specifying access to Eden observables in dtkeden. "DOCUMENTATION" README.TXT is this file INSTALL.TXT gives instructions on compiling and installing the software COPYING.TXT and GPL.TXT are the license agreement TODO is a long list of bugs to fix and improvements to make CHANGE.LOG is the history of changes to the software MAKING.A.RELEASE is an (out of date) checklist for the maintainer LICENSE_GLPNG.TXT describes the copyright on the GLpng source included here LICENSE_TOGL.TXT describes the copyright on the Togl source included here tkeden1.41/Docs/TODO010060000025250000164000001054300747345744100142140ustar00ashleyem00003510000005-*-text-*- ============== EDEN TODO LIST ============== BUG details are now held in the SourceForge database: see http://sf.net/projects/eden IMPROVEMENTS ============ o Exactly how inefficient is the list implementation in tkeden? Does it scan from the end each time? How would we go about storing an entire dictionary in Eden for example, for Hangman? o Find original Donald lexer lex.l - see what changes were made for the (handwritten?) lex.c in tkeden o Check out hash function used in Eden/symbol.c. Will the hash index ever be > 0xFF: constantly EORing with a char...??? o Profile tkeden and improve most called regions, especially for Chris' Data Explorer... o Another notation, like Scout, to handle whole windowing system? Carters says hard because X assumes user has control of windows, not the program. o Sort out inconsistencies between notations. o Think about JVM and relation to the Eden VM - what possibility of cross fertilization? o "add layers to donald through scout" (from TODO) o "Wrap standard I/O in a tk window" (from TODO) o Port to Mac?! gcc available on the Mac? On the Arch (schools?) o Remove reliance on PATH (eg ImageScale uses 'pnmscale'). Either write a wrapper or set variables with the complete path for each utility used. o A single step facility to enable modeller to monitor each redefinition? o dtkeden in heterogenous environments? o Vastly improve the textual script viewer: hyperlinked definitions, fast rebuild... link to a web browser? Write an Eden script to communicate with Netscape (or any browser) and send the text of the script. Eg netscape -remote 'openURL(http://www.dcs.warwick.ac.uk/modelling)' o Higher order definitions somehow? Multiple similar definitions cannot be done particularly neatly at the moment. Or can they? See the speedo eg. o Link Javabeans with dependencies in Eden. Use, or at least look at jacl? o Get rid of alloca? See http://www.eskimo.com/~scs/C-faq/q7.32.html o Automatically generate dependencies for non-local variables used in functions - recall note from the back of the Eden manual. Don't retrigger actions though. o Maybe Misc should be a subdirectory (or maybe just in the directory of?) Eden o Make lint happy with the code. Haven't got it to run the second stage yet. o Use an enum for the type inside Datum - would this show up in debuggers, making it easier to see? o New feature, perhaps built in: generate increments to a clock integer at a given real time frequency o Look at BLT and integrate some features? o Store definitions on disc rather than in memory - like VM? Need a better file format. WMB said would be good to be able to bring in and take out whole sections of script as appropriate. o "combination observables" (eg distances between billiard balls) that can be defined, but don't take up space until you query them. Or perhaps these are just functions. o Link the Eden library to Java using JNI?! o Perhaps the symbol table should be a /list/ with special (associative) indexing. Then items could be removed easily. o Re-do the user interface in Scout? o Operators += etc only work on integers o Make append, insert work on strings o An emacs highlighting setup for Eden code? See /gnu/share/emacs/20.3/lisp/font-lock.el. o symbols() only takes one argument? Should give an error message if given more than one. o Link with emacs as an editor. Use elisp. Colours to represent bits that have been changed, and need sending to tkeden - send them with a key press. o Finish mouse dragging facility - can we get COG to work with the current setup? o Get around sensible CWD problem on Windoz by adding a cd primitive to Eden, and call this from Run.e files o More obscure information in About tkeden should appear only when you press a "more information" button o Edit menu with Cut and Paste? o Make it possible for users to link in other translators for notations at runtime. o Some way to see /values/ of Donald things without having to representation on the screen - view values in the View window...? Or implement the ? operator in Donald properly (seems to be partially implemented at the mo... or am I being confused by the ? Donald operator for "this is a line of Eden?") o Access Eden lists from Donald: %eden func f { writeln("f ", $); return $1 + 1; } %donald int f1 f1 = f!(1) works, but the equivalent for lists does not. o List indexing is not implemented in back-ticks: 1:> s="l[2]"; 2:> l=[1,3]; 3:> writeln(`s`); @ o One undefined item should not stop the entire screen from being updated. o symboltable()# fails when the table gets large - error running out of heap? Could make heap a dynamic array, I suppose... o Fix undefined problems: need more eager operators. o Get rid of "program too big" error: make prog a more dynamic array that is realloc'd when this error would have occurred o Donald 'pi' token - is it used? Meurig was trying to '%donald; real pi'. o Port Sasami to Unix o A 'warnings' window instead of the error messages appearing in the history. Visual warning to the user when something has appeared there. Warnings for "you have declared a symbol with a name similar to another", "this is now @" etc along with error messages (which would prob. be in a different colour). Sometimes it is appropriate to warn a user that they are creating a new symbol (eg when /using/ a model), when building - probably not. o a minor version number to represent changes to the Tcl / Eden library stuff? o change each sprintf to snprintf and include the buffer size to attempt to stop all these buffer overruns. o Radio button for the notation in the input window? o Make long variable names possible (apparently >20 chars fails, especially in Scout) o ttyeden readline: get it to complete from the symbol table and built-ins. o "Freeze" the state function - want the equivalent of SQLs COMMIT or ROLLBACK. o A "save script" function for ttyeden: could rapidly prototype using the new readline interface, but cannot save. o guessLibLocation should read search a predetermined path to find a configuration file which determines the lib files location. o 'find' symbols facility should be better: need to be able to find definitions and usages separately. Need to be able to find 'is' separately from values. o Navigation around the view definitions interface is awful. o A function to 'forget' a set of definitions in the correct order? Perhaps by redefining all to @, then removing. Perhaps it should interactively prompt to make sure that we don't accidently remove definitions we would like to keep: a kind of 'rm -i' prompt. Perhaps it could print some information about whether it managed it or not. Perhaps we need an argument to tell it to be interactive or not. o Redesign into a one-window interface? Then have multiple input windows, one for each notation? o Inconsistency: textbox and text windows in scout with the same number of vertical lines are different sizes. o Inconsistency: use outlinecolor for circles outline, color for lines outline. o Inconsistency: use div in donald, / in eden. o Inconsistency: use semicolons in eden, not in donald o Inconsistency: don't declare in eden, declare in donald. o Inconsistency: last element of a scout window doesn't have a comma, the others do. o Inconsistency: PI in eden, pi in donald o Inconsistency: scout references its windows from the top left and donald from the bottom left o If any element in the screen is @, the whole screen is not displayed (apparently). Improve this to give a warning if something in the screen is @. o '?insert', '?append' fails. This is because the parser expects '?', lvalue and keywords such as insert and append are not lvalues. Need to figure out how to get the parser to accept these types. o Test new Eden bison.simple with eden < file, read file, piped input (via a translator)... o Link translators (eg eddi) to tkeden via pipes (tkeden pipe function?) and multiple Tcl windows o wouldBlock: change to getcWouldBlock and put in rl_getc_wouldblock logic o Check "additional possibilities" sum in bison.simple - does it give the right answer? o View -> Eden definitions: an option to sort and indent according to definition level? (This could be used to quickly find the basic model parameters). o Make a documentation package: cron job to nightly tar and gzip the HTML Eden, Scout, Donald documentation (post-SSI processing: wget? need version numbers or stamp package with the date: make the package each night and see if it has changed). o Change colour of interrupt button when it might be necessary to press it (when a RunSet is being processed?) o Make it possible to extend the stack when overflow occurs by implementing a non-contiguous stack. Need to ensure that nothing attempts to walk the stack to be able to do this tho'. o Make it possible to extend the heap when overflow occurs. (Example problem: see OASYSPermutations/gen_table.e). Perhaps allocate memory with malloc when heap overflows. o Highlight Eden / Donald / Scout keywords in the input window as they are entered using the Tcl text tag facility? o Extend debug() to take combinations of categories to filter debugging output, now that I've introduced CALSTK etc. o In the View Definitions window, use tags to highlight references to other variables - click and they are displayed. Add a back and forward button as per web browser. Or perhaps write an export to HTML feature and link with a web browser? (Perhaps use EMHTTP - press Reload on the web browser and it'll reload the page of definitions). o An incremental search facility on Ctrl-S, like emacs? o Use a more decent File -> Include widget: try FileSelectBox from Tix (but these widgets are megawidgets which probably required [incr Tcl] and [incr Tk] - the OO extensions to Tcl/Tk). o Take a look at TkTable - a spreadsheet / table widget: could we improve the View Definition windows with this? o Change the mouse cursor when tkeden is busy (see example from Tk FAQ #4.3 How do I change the Tk cursor?). o A +/- button in View Eden Definitions to expand / contract display of agents (eg AGENT system should probably be contracted most of the time). o Put an error message pane underneath the input window (+ make it possible to resize it?) o Separate error stream into another Tcl window. o configure.in: can we cache more? o Option to update "View Eden Definitions" continuously (actually, on every RunSet switch). o Link Prev, Next Tcl history (in tkeden and ttyeden) with the history as stored on file (a bit like the shell). o Wrap Sasami window in Scout o Feed mouse placement in Sasami window to Eden (perhaps in terms of a list of polygons that the mouse is currently over - Benjohn describes a technique involving turning the OpenGL renderer into a special mode, and rendering a window one pixel in size). o " %scout" - make ex.c ignore leading spaces / tabs o Inp_Dev_Save might be an unnecessary hack: perhaps Inp_Dev should be volatile? o When opening the Scout window, if there is any content outside, make it bigger. o Get Scout/print.c printdef to use the constants array etc o Fix Scout so that on View Scout or Scout ? query, the correct value of sensitive is shown o Input window: an Undo function (particularly wrt paste / insert) o Improve Scout / Donald unhelpful "parse error" o Fix tcl("reinit"); o Un-hack the dashed line stuff using the Dash patch in Tcl / Tk 8.3.3... o Add a File->cd o "a=1; while (1) { a++; }" causes tkeden to hang: not even the Interrupt button works (but Ctrl-C does) - is it possible to make the event from the Interrupt button be processed straight away (despite Tcl update not having been called - perhaps via some sort of error mechanism?) but leave the other events until Eden is ready, as before? o Sasami: remove the globTogl hack o Recode all references to interp->result (see Tcl_SetResult(3)) o Add some syntax to allow removal of triggers: ~>![] ? (if ![] is valid syntax elsewhere)... o Resize viewport: if viewport size has not changed, don't do anything. o A View Sasami Definitions window for completeness o Can we rework Sasami's numeric IDs into symbolic ones for ease of tracing...? o Replace the multiple Save options with Save and Save As options, with radio buttons to turn off saving of various notations in the dialogue box. o Don't create required windows (eg History) until it is actually required to speed initial startup? o Windows: Try and get the executable to use the Scriptics-provided DLLs (so can use Tcl 8.3 with the dash patch etc)? Perhaps look at using the tcl-stub stuff...? o Sasami: [Ben] Smooth vertex normals based on face normals and face adjacency o [Ben] Speed controller example shows some display corruption o [Ben] Note : Enormous (40 units+) polygons screw up lighting. OpenGL driver bug? (Addition) Not necessarily bug. Maybe something to do with oblique specular angles on large polys looking wrong (despite being "right" in a mathematical sense). Imagine a poly large enough that the vertices on both sides had specular hilights and then interpolate across... o Install a non-debugging version for DCS for performance?? o Rework Misc functions in the style of random if they are declared in system header files o Change Scout int_tree assertion to a more helpful error, or modify the Scout parser to only allow integer values. o Find should beep when search proceeds beyond the end or beginning of the document. o Finish Help -> About Donald, Scout, Sasami o Help -> About LSD o Remember the state of file type selection between File -> Opens etc o File -> Restart ! o Find in the Quick Reference Guide windows... o Can we get the OK button in the Quick Reference Guide windows to take up less space? o DFfont is read by Donald at Donald startup, but Donald lacks dependency in this area and it's difficult to convince it to re-render the statechart with a new font (for example), whereas Scout seems to be better implemented here. o Un-hack the Scout integer / real implementation (give Scout true integers and true reals). o Remove "VB-like" features completely. o Query ? operator now shows sp->master, but this pretty much always seems to say "input". Can we change sp->master or get information from elsewhere that would make this more useful? Need to look at the calls to pushMasterStack() and what that actually does. Perhaps push the stack trace so far: "input window:proc p:action q"? o Do 'Previous' after error & move cursor to position of error (making interaction with tkeden somewhat like interaction with a debugger) o Save definitions should not save the ones belonging to 'system'. o %scout causes a few system definitions to be entered under agent 'input' o ON should actually be MOUSEBUT + KEYS or something, so can narrow down the sensitivity even further (ignore keys, for example). o "%scout\nscreen &= ;" doesn't work - I presume the parser needs correcting to allow display literals after &= o An eden_allow_proc_redefine variable (at the moment, redefining a proc to a value is not allowed so as to avoid accidental overwriting - but sometimes this can be useful). o An eden_allow_builtin_redefine variable? o Sometimes the error message needs to read from further back than just the current line (eg when the line before is missing a semi-colon in Scout). o Can we make it unnecessary to declare Eden variables to Scout? o On an error condition, should make sure that the line containing the error (which was hence ignored) does not appear in history. This is complicated by the fact that the contents of the input window is currently put into history in its entirety. Perhaps Eden itself should push things into history as it executes. o one-line escape into Scout, Donald... whatever... from Eden. Perhaps a notation change with characters on the same line (eg '%scout int i') would be a change for that line only? o Add __PRETTY_FUNCTION__ to DEBUGPRINT output? (See gcc.info...) o Which way up are the coordinate systems in Donald, Scout and Sasami? Document in the quick references. o Add a way of stating literal strings without needing to escape characters to Eden - perhaps like the shell << operator (usage eg: cat <> has the same problem, replace autocalc=0; with autocalc--; etc... o dtkeden: command line option for automatically logging in as a certain agent. o A solution for running large-area models on small screens (how to redefine the font size... and all geometry?) o Changing nSegments in cruise speedo apparently causes a freeze. o Lack of a scrollbar in the DOS window causes problems on Windows. Need a solution: perhaps wrap stdout in a tk window... or can we redefine the Eden 'stdout' variable? Nope -- the value changes, but doesn't affect writeln etc.... Can we copy cmd.exe (not command.exe) from an NT machine and see if that gives us a scroll bar? o "ash"[1] is a syntax error o s='s'; writeln(s[1]) fails. Not possible unless I can figure a way of getting the address of a char. Aha... try ctos()... o "index out of range" errors don't give information about which type of command produced the error o ImageScale still has problems. It may work OK with .ppm input files on UNIX, if pnmscale is in your path (at DCS it is /usr/local/bin/pbm/pnmscale). o Find... dialogs should not be modal (ie should not stop rest of application working...) o Rework View Scout, Donald... window menus to have an Edit menu, as per View Eden... o Print information from the entire Inp_Dev stack when printing error messages (this should provide a kind of stack trace) o Does beep counter reset on every beep? Ie if we have a continuous beeping situation (eg interpreting a bunch of Eden in EDDI by mistake), it should not beep at all instead of beeping every three seconds. o Make notation change in ttyeden persist across EOF (including -e). o Page down in View Eden Definitions seems to work on Windows but not UNIX? o Test Sasami with a model which calls eager() in a tight loop - Ben had a note about this in the original render.c source (should be OK as eager forces a Tcl update, and togl will then call the r_render callback). Tim tested this -- there is a bug. o installeddi() should do a NOP the second time it is called. Actually... unnecessary as it doesn't seem to do any harm? Actually need to fix notation() so that a second call will replace the info gathered from the first (I suspect it actually ends up with multiple copies on the list currently). o eden_allow_redefine_builtins -- a new variable to turn this option on so that we could redefine writeln for example to get EDDI query results into a string instead of stdout... o Notation change requires exact match -- good. But it needs to ignore white space at the end of the line ("\n%eddi \n" fails). o Windoz: after accepting a file from File -> Open by pressing return, the input window then appears to have focus but alt-a does not work o Split change.log file? It's getting a bit long to view via the Help menu now... o An 'sqleddi' command to start up tkeden with all Meurig's stuff? o Add SQLEDDI questions to Eden FAQ. Eg stuff must be in upper case, lack of # character... o SQLEDDI error messages... they should not come out on stdout, they should show the context, they seem to be very confusing when you feed it rubbish. o Notation radio buttons should be packed more sensibly if tkeden window is small o A debugging mode which prints out the name of the currently executing function and the line that it is in... kind of language level debugging, as debug(1) is too low-level to be useful mostly. o Debugging is strange in Eden due to definitive machine: we want to know /why/ something happened. In procedural languages a stack trace will do but definition update and triggered actions confuse this picture in a definitive system. o Observation-oriented database optimisations on EDDI relational algebra (eg move selections inside joins) o EDDI: access Eden functions in 'is' views. Perhaps like Donald '!'?. Eg MARKSPERCENT is mul!((MARKS % q1), div!(100,8)) o tkeden quits when this redefinition is made: (load this file) %eden _tkeden_showxoutput = 1; %scout image source = ImageFile("png", "/dcs/emp/ashley/EMProjects/Scans/10c1.png"); window firstImage = { type: IMAGE box: [{10,10}, {490,240}] pict: "source" border: 5 relief: "raise" }; screen = ; (give this input) %scout image source = ImageFile("png", "/dcs/emp/ashley/EMProjects/Scans/11c1.png"); window firstImage = { type: IMAGE box: [{10,10}, {490,240}] pict: "source" border: 5 relief: "raise" }; screen = ; o Remove X related stuff from link line on Mac OS X... and seems we don't need -lm as well... o Create a Tk console window if required, using Tk_CreateConsoleWindow as per Tcl_AppInit in tkMacOSXAppInit.c? (Will this improve the console facilities on Windows?) o Could use CFBundleGetMainBundle etc on MacOS X to find library files within a bundled application: see main() in tkMacOSXAppInit.c. o Document cost of the various list operations: init ([sdf, sdfsd, dsaf]) ll handle (from count?!) listsize (l#): O(1) ll oracle sel (retrieve / set l[n]): O(1) ll oracle shift: O(n) ll oracle handle (ll--) append: O(1) ll oracle handle (ll++) insert: O(no items after insertion point) ll oracle handle (ll++) delete: O(no items after deletion point) ll oracle handle (ll--) concat: ?? eg lr is l1 // l2 ll1 oracle ll2 oracle llr handle (ll1+ll2) o Abhir would like a "repeat last command" key shortcut (ie previous, accept). o Need to correct the Eden manual: eval() isn't a real function: a=1; proc p { writeln(eval(a)); } p(); /* prints 1 */ a=4; p(); /* prints 1 -- whoops */ eval() doesn't exist in ttyeden-jun201996 (which you need to run on gem). Or tkeden-sep261997 Or tkeden-dec151997 Or tkeden.S-dec151997 But it does, with this problem, in dtkeden-sep31999 o It isn't possible to write an assert function in Eden. eval requires an unquoted expression as input (so the exact expression cannot be passed in as a parameter) and it evals at parse time, not when the containing procedure is called. execute cannot be used as it returns the error status from parsing + invoking the string, not the value of the result. Duh! o ttyeden-jun201996 says "Killed" when run directly on cottage. The wrapper shell script conceals this error. o On Mac OS X: TK/TCL PROBLEMS - Down scroll buttons not visible [the same in Wish] - Window close / minimise / max buttons don't show indicators on mouse over [the same in Wish] - Paste from elsewhere in OS doesn't work [the same in Wish] - Dragging windows requires click to make active first [the same in Wish] - Maximise button doesn't work [the same in Wish] - Hide tkeden doesn't work [Wish dies unexpectedly] - Menu tear-offs a bit naff [a Tk problem] VERSIONING Y- About... menu in application menu (move from Help menu?) Y- Correct version number into bundle info Y- Build bundle via a shell command in Makefile? (ie don't use PB) COSMETIC N- Sort application menu: capitalise Tkeden Y- Background colours of Input Window a bit naff (use Apple horizontal lines?) - View menu to Window? Y- An icon! - Accept button background should be grey, not white (a Tk problem?) INTERFACE - Can't select text in Eden Definitions (or Scout definitions...) - Key shortcuts? Use Apple key? - Default buttons (eg Help -> About tkeden -> OK) should glow and respond to press on Return. - Most of Eden Definitions menu doesn't appear (Save, Find, Rebuild, Update, Close?) - Get About Tcl/Tk in Eden Definitions menu... - ... reimplement Eden Definitions menu as a bunch of buttons? - Apple-W (for close window) doesn't work anywhere - Implement a console window (tkConsole isn't quite right...) BUGS - Link with own compiled Tcl/Tk [AHB suggests a cc run time linking option] - Need to look up @executable_path in ProjectBuilder mail archives - File -> Open / Execute... cancel... NavGetReply failed, -128 - Need three ctrl-c's to quit?? - Apple-Q gives Bus error -- but tkeden->Quit does not. Looks like Quit is not registered in the commandTable hash (commandEntryPtr == NULL) - Need dirname: find source from Darwin? - "tkwin == NULL, 224" errors when navigating Open dialogue with right arrow - How do we get to the right and middle buttons? IMPROVEMENTS Y- Copy lib-tkeden into Resources in bundle and locate them there by default: should then be able to double-click to load - Stuff it, put it up for download Y- Use my applied-for file type for app - Use my applied-for file type for created files - Sasami! Togl on Mac OS X... people seem to be moaning about 'main' being null presently (April 2002) MODEL TESTS Y- cruise: graphics are a bit odd... get a division by zero error... Y - gradient does not seem to affect vehicle display Y - conceptCar/vp11 is wrongly positioned (end of window)... or actually, vl11 - or perhaps it is the rotation making a mess: probably, as vp11 is used by vl11 and vl10 and only seems to be "wrong" in vl11. Y - speedo is a mess, as is the hill Y- beetles: possibly OK, but get some "NaN"-related errors Y- racing: graphics a bit odd (is it Donald curves?), car goes off track? - racing: background colours? - OXO tk: seems OK (but can't use non-left mouse buttons!) - roadsys: pretty good - roomviewer seems OK - jugs: seems OK o Parser documentation o Help -> About EDDI o Refactor the libLocation guessing stuff for the various platforms. Take it all out of main.c! o change.log file accessible from the website somehow (link to ~empublic/lib?) o emprojects in ~empublic/bin to start up a projects database with persistence. (Need to fix commas bug first :<) o Improved Eden lists... then create a %eden2 notation which does this transparently. o Figure how to rework existing models to cope with removal of _mouseClick in 1.17 (railway accident messes up, for example) o Add an Eden log command, which specifies a file to start logging stdout (and stderr?) to. dup stdout, open it again (see man dup), then read this every so often (after every RunSet?), and write this to the log file. Nope -- this doesn't work. Perhaps you can't read from stdout. Another way might be to define my own fprintf function and link Eden with this? Or can we redefine stdout once the process has started? Don't really understand the difference between fds and streams :( I'm sure this has been done in other tools (shells, mysql, tee...) Java System class seems to be able to reassign out, err etc Is this one fixed? o Saving multiple history files by moving them causes problems when logged in on multiple machines as the same user and running tkeden on them all: get "stale remote file handle" from flush $histFile in edenio.tcl o mv arca.lib arcalib.eden (once Arca translator is fixed) o query output should limit value display to one or two lines? o eden_backticks_dependency_hack: what does this do? Perhaps make it a standard part. o Input window should take note of the indentation level when return is pressed and create the same number of tabs as the line above. o fopen("thing"); quits Eden: need fopen("thing", "r"); o Link with regular expressions library and use that instead of CB's split etc? o Expose eden_notice_undef_reference, _tkeden_showxoutput etc in a Scout window as standard to give a more visibility to these settings and make them easier to change. o EDDI join * operator appears to be right-associative. Probably should be left associative so that Q*A*P still works in sensible time even if A and P are very large. In fact, probably want most operators to be left-associative: right-associative is more the special case, required for function application, exponent etc. The left-associativity probably occurs due to splitting the string from the left. o Get a heap overflow error when doing a massive join in EDDI. Seems to come possibly from the 'return tlist;' in njoin()? Does a return value go via the heap? Presumably we need to make all those things in njoin auto variables... but that didn't seem to make much difference. o How about some confirmation from EDDI when making massive joins... "about to start calculating 8000000 rows: OK?". Should be able to turn this prompt off too. o Some way of querying whether it is /possible/ to forget a symbol (without actually forgetting it yet). [Tim's idea] o sasamiexamplesCarter1999... load test.s, view eden definitions with all translations on, then select just "initialisation"... nothing appears. Select all or "system" works OK. o An Eden timer(proc, time) function. This should set up an OS callback for that amount of time delay. The Eden process should block otherwise, if it has an empty Runset. Then could use this for examining the filesystem on a regular basis without doing a busy loop. o Can we access a persistent EDDI database from a web server? Eg to serve the EMpress database. Perhaps use a named pipe for textual communication (not much good for multiple clients though). o Lots of stuff in the symbol table seems to cause View Eden Definitions to mess up. See 3doxo in ~croe/PhD/PRACTICAL/3doxo/Run.e o Benjohn wants an integrated system for writing small graphical programs. Could we write a BASIC CB parser (BASIC syntax is good for beginners) and provide some PLOT functions, and even access to OpenGL Sasami stuff? It should run in full screen mode (so the user obviously has control over the entire machine and is not distracted). The editor is also critical... in BASIC, we can simply edit by rewriting lines: "30 PLOT x,y" rewrites the current definition of line 10. The user only has to know that and the LIST command to create simple programs (cf Bonnie Nardi novice spreadsheet users get by with using only a small number of functions). When the program gets large, they have to figure out how to control the LIST output so that it doesn't scroll off the screen, but by then they are more advanced as they've written a program larger than one screen (and can learn about pausing output with a key modifier, or parameters for the LIST command). Strikes me that we are recreating a similar kind of interface in tkeden. How about a BASIC, but with definitive features? o Setting attributes of Donald geometry by using an escape to Eden is a total hack. Eg need to say A_p_q, but Donald is already within p {} so could be unnecessary within Donald. Donald has a string type so can we pull this within Donald? o Write a Donald reflection mechanism in Eden. COG could use this to save drawings created. Replace execute("%donald\nline l1=... in COG with saveAndExecuteDonald("line l1 =... and maintain a list in Eden which is the Donald symbol table (ie l1 can be later redefined). Then we can just write that list out to disk to save the Donald. For COG, we'd need to distinguish between "system" and "user" geometry, not saving "system" stuff (eg the red selector dots). Having done this, we could work on an agent-oriented parser using these Eden primitives we have constructed, and build a %donald2 notation, working out the inconsistencies with other notations as we go. o Rewrite the Quick Reference Guides in Scout o COMMIT / ROLLBACK... saving symbol table state to disk on COMMIT, and reverting to that on ROLLBACK. ? o Get pow to return an int if both arguments are ints. This requires changing it from a simple c-library mapping to a C function. o bounceCarter1999: a Sasami bug -- when the sasami viewport, open_display etc code is at the start of bounce.s, the Sasami viewport does not open. o Add stuff for Allan's Dependency Modelling Tool: - Storage of info list within symbols. Worried about memory allocation: but perhaps just freedatum in forget(). - Func / procs to manipulate list - Make it a list of lists, each index being a defined user: dmt being 1. - Figure out how to remote control a dtkeden server using a socket - resetSymbolIterator, getNextSymbol functions to access symboltable() data one at a time val requires an unquoted expression as input (so the exact expression cannot be passed in as a parameter) and it evals at parse time, not when the containing procedure is called. execute cannot be used as it returns the error statutkeden1.41/Donald/004070000025250000164000000000000747346161700140335ustar00ashleyem00003510000005tkeden1.41/Donald/check.c010060000025250000164000000320320745661116700152510ustar00ashleyem00003510000005/* * $Id: check.c,v 1.10 2001/12/06 22:25:33 cssbz Exp $ */ static char rcsid[] = "$Id: check.c,v 1.10 2001/12/06 22:25:33 cssbz Exp $"; #include "../config.h" #include "error.h" #include "oper.h" #include "tree.h" #include "symbol.h" #include "parser.h" #define ERROR -1 extern void change_context(symbol *); extern void resume_context(void); extern int reset_context(void); extern void backup_context(void); extern void restore_context(void); extern int nary(int); /*function prototypes */ int count_id(tree); int count_expr(tree); static void TypeClash(void); static void check_id(tree); static void check_children_type(tree); static int semantic_1(tree, int, int); static int semantic_2(tree, int, int, int); static int semantic_3(tree, int, int, int, int); static int semantic_4(tree, int, int, int, int, int); static void TypeClash(void) { don_err(TypeMismatch, 0); } /*--------------------------------------------------+----------+ | check_id | +----------*/ static void check_id(tree expr) { /* Is variable declared ? */ /* id-expr is assumed */ char *id; symbol *sym; symbol *look_up(char *); char *donald_full_name(char *); switch (expr->op) { case OP_ID: id = (char *) Lexpr; if (id == 0) don_err(Unclassified, "illegal use of `~'"); if ((sym = look_up(id)) == SymEnd) don_err(UndeclareID, donald_full_name(id)); Etype = sym->type; break; case OP_SLASH: id = (char *) Lexpr->left; if (id) { if ((sym = look_up(id)) == SymEnd) don_err(UndeclareID, donald_full_name(id)); if (sym->type != OPENSHAPE && sym->type != GRAPH) don_err(NotOpenshapeOrGraph, donald_full_name(id)); change_context(sym); } else { /* id == ~ */ change_context(SymEnd); } check_id(Rexpr); Etype = Rtype; resume_context(); break; case OP_GLOBAL: backup_context(); reset_context(); check_id(Lexpr); Etype = Ltype; restore_context(); break; case OP_EDEN: Etype = ANY; break; default: don_err(Impossible, "check.c"); break; } } /*--------------------------------------------------+----------+ | count_id | +----------*/ int count_id(tree expr) { /* return no. of id in an id-list */ int lcount, rcount; if (expr == EMPTYTREE) return 0; switch (expr->op) { case OP_ID: case OP_SLASH: case OP_GLOBAL: check_id(expr); case OP_EDEN: return 1; case OP_COMMA: lcount = count_id(Lexpr); rcount = count_id(Rexpr); return (lcount == ERROR) || (rcount == ERROR) ? ERROR : lcount + rcount; default: return ERROR; } } /*------------+------------------------------------------------+ | semantic_1, semantic_2, semantic_3, semantic_4 | +------------------------------------------------*/ /* check expression types: ** E = result data type (if ok) ** L = left expr data type expected ** M = middle expr data type expected ** R = right expr data type expected ** X = extra expr data type expected ** return 0 if ok ** 1 if not match ** ** and also set expr->type [Ash] to E ** */ static int semantic_1(tree expr, int E, int L) { return (Ltype != L && Ltype != ANY) || ((Etype = E), 0); } static int semantic_2(tree expr, int E, int L, int R) { return (Ltype != L && Ltype != ANY) || (Rtype != R && Rtype != ANY) || ((Etype = E), 0); } static int semantic_3(tree expr, int E, int L, int M, int R) { return (Ltype != L && Ltype != ANY) || (Mtype != M && Mtype != ANY) || (Rtype != R && Rtype != ANY) || ((Etype = E), 0); } static int semantic_4(tree expr, int E, int L, int M, int R, int X) { return (Ltype != L && Ltype != ANY) || (Mtype != M && Mtype != ANY) || (Rtype != R && Rtype != ANY) || (Xtype != X && Xtype != ANY) || ((Etype = E), 0); } /*------------------------------------------------+------------+ | count_expr | +------------*/ int count_expr(tree expr) { /* return no. of expr in an expr-list */ if (expr == EMPTYTREE) return 0; check_children_type(expr); switch (expr->op) { case OP_COMMA: return count_expr(Lexpr) + count_expr(Rexpr); case OP_INF: Etype = INT; break; case OP_PLUS: case OP_MINUS: if (semantic_2(expr, Ltype, Ltype, Ltype) && semantic_2(expr, REAL, REAL, INT) && semantic_2(expr, REAL, INT, REAL)) TypeClash(); else if (Etype == POINT) { switch (expr->op) { case OP_PLUS: expr->op = OP_VECT_ADD; break; case OP_MINUS: expr->op = OP_VECT_SUB; break; } } break; case OP_MULT: case OP_DIV: if (semantic_2(expr, INT, INT, INT) && semantic_2(expr, REAL, INT, REAL) && semantic_2(expr, REAL, REAL, INT) && semantic_2(expr, REAL, REAL, REAL) && semantic_2(expr, POINT, POINT, INT) && semantic_2(expr, POINT, POINT, REAL)) TypeClash(); else { if (Ltype == POINT) { Etype = POINT; } else if (Ltype == REAL || Rtype == REAL) { Etype = REAL; } if (Etype == POINT) { switch (expr->op) { case OP_MULT: expr->op = OP_SCALAR_MULT; break; case OP_DIV: expr->op = OP_SCALAR_DIV; break; } } } break; case OP_MOD: if (semantic_2(expr, Ltype, Ltype, INT)) TypeClash(); else if (Etype == POINT) expr->op = OP_SCALAR_MOD; else if (Etype != INT) TypeClash(); break; case OP_UMINUS: case OP_RANDOM: if (semantic_1(expr, INT, INT) && semantic_1(expr, REAL, REAL)) TypeClash(); break; case OP_TRUNC: if (semantic_1(expr, INT, REAL)) TypeClash(); break; case OP_FLOAT: if (semantic_1(expr, REAL, INT)) TypeClash(); break; case OP_SQRT: case OP_SIN: case OP_COS: case OP_TAN: case OP_ASIN: case OP_ACOS: case OP_ATAN: case OP_LOG: case OP_EXP: if (semantic_1(expr, REAL, INT)) { if (semantic_1(expr, REAL, REAL)) TypeClash(); } else /* cast the argument to floating point */ expr->left = dtree1(OP_FLOAT, expr->left); break; case OP_DOTX: case OP_DOTY: if (semantic_1(expr, POINT, POINT)) TypeClash(); break; case OP_DOTRAD: case OP_DOTARG: if (semantic_1(expr, REAL, POINT) && /* can be INT */ semantic_1(expr, REAL, ARC)) TypeClash(); break; case OP_DOT1: case OP_DOT2: if (semantic_1(expr, REAL, POINT) && /* can be INT */ semantic_1(expr, POINT, LINE) && semantic_1(expr, POINT, ARC)) TypeClash(); break; case OP_CART: case OP_POLAR: if (semantic_2(expr, POINT, INT, INT) && semantic_2(expr, POINT, REAL, REAL) && semantic_2(expr, POINT, INT, REAL) && semantic_2(expr, POINT, REAL, INT)) TypeClash(); break; case OP_LINE: if (semantic_2(expr, LINE, POINT, POINT)) TypeClash(); break; case OP_ARC: if (semantic_3(expr, ARC, POINT, POINT, REAL) && semantic_3(expr, ARC, POINT, POINT, INT)) TypeClash(); break; case OP_CIRCLE: if (semantic_2(expr, CIRCLE, POINT, REAL) && semantic_2(expr, CIRCLE, POINT, INT)) TypeClash(); break; case OP_ELLIPSE: if (semantic_3(expr, ELLIPSE, POINT, POINT, POINT) && semantic_3(expr, ELLIPSE, POINT, POINT, POINT)) TypeClash(); break; case OP_RECTANGLE: if (semantic_2(expr, RECTANGLE, POINT, POINT)) TypeClash(); break; case OP_LABEL: if (semantic_2(expr, LABEL, MYCHAR, POINT) && semantic_2(expr, LABEL, IMAGE, POINT)) TypeClash(); break; case OP_IF: if (semantic_3(expr, Ltype, Ltype, BOOLEAN, Ltype)) TypeClash(); break; case OP_SLASH_SLASH: if (semantic_2(expr, MYCHAR, MYCHAR, MYCHAR)) TypeClash(); break; case OP_ITOS: if (semantic_1(expr, MYCHAR, INT)) TypeClash(); break; case OP_RTOS: if (semantic_2(expr, MYCHAR, REAL, MYCHAR)) TypeClash(); break; /* case OP_MONITOR: if (semantic_3(expr, MONITOR, MYCHAR, BOOLEAN, MYCHAR)) TypeClash(); break; case OP_IMPOSE: if (semantic_1(expr, IMPOSE, BOOLEAN)) TypeClash(); break; */ case OP_INTERSECT: if (semantic_2(expr, POINT, LINE, LINE)) TypeClash(); break; case OP_PARALLEL: if (semantic_4(expr, LINE, LINE, POINT, INT, INT) && semantic_4(expr, LINE, LINE, POINT, REAL, REAL) && semantic_4(expr, LINE, LINE, POINT, INT, REAL) && semantic_4(expr, LINE, LINE, POINT, REAL, INT)) TypeClash(); break; case OP_PERPEND: if (semantic_2(expr, LINE, POINT, LINE)) TypeClash(); break; case OP_DISTANCE: if (semantic_2(expr, REAL, POINT, POINT) && semantic_2(expr, REAL, LINE, LINE)) TypeClash(); break; case OP_MIDPOINT: if (semantic_1(expr, POINT, LINE)) TypeClash(); break; case OP_TRANS: switch (Ltype) { case SHAPE: case OPENSHAPE: if (semantic_3(expr, SHAPE, Ltype, INT, INT) && semantic_3(expr, SHAPE, Ltype, INT, REAL) && semantic_3(expr, SHAPE, Ltype, REAL, INT) && semantic_3(expr, SHAPE, Ltype, REAL, REAL)) TypeClash(); break; case INT: case REAL: TypeClash(); break; default: if (semantic_3(expr, Ltype, Ltype, INT, INT) && semantic_3(expr, Ltype, Ltype, INT, REAL) && semantic_3(expr, Ltype, Ltype, REAL, INT) && semantic_3(expr, Ltype, Ltype, REAL, REAL)) TypeClash(); break; } break; case OP_ROT: switch (Ltype) { case SHAPE: case OPENSHAPE: if (semantic_3(expr, SHAPE, Ltype, POINT, INT) && semantic_3(expr, SHAPE, Ltype, POINT, REAL)) TypeClash(); break; case INT: case REAL: TypeClash(); break; default: if (semantic_3(expr, Ltype, Ltype, POINT, INT) && semantic_3(expr, Ltype, Ltype, POINT, REAL)) TypeClash(); break; } break; case OP_SCALE: switch (Ltype) { case SHAPE: case OPENSHAPE: if (semantic_2(expr, SHAPE, Ltype, INT) && semantic_2(expr, SHAPE, Ltype, REAL)) TypeClash(); break; default: if (semantic_2(expr, Ltype, Ltype, INT) && semantic_2(expr, Ltype, Ltype, REAL)) TypeClash(); break; } break; /* Reflect takes an entity and a line and returns an entity. Parameters to semantic_2 are expr, the resulting type in this case, the first and second parameters. [Ash] */ case OP_REFLECT: switch (Ltype) { case SHAPE: case OPENSHAPE: if (semantic_2(expr, SHAPE, Ltype, LINE)) TypeClash(); break; case INT: case REAL: TypeClash(); break; default: if (semantic_2(expr, Ltype, Ltype, LINE)) TypeClash(); break; } break; case OP_PAREN: Etype = Ltype; break; case OP_ID: case OP_SLASH: case OP_GLOBAL: check_id(expr); break; case OP_AND: case OP_OR: if (semantic_2(expr, BOOLEAN, BOOLEAN, BOOLEAN)) TypeClash(); break; case OP_NOT: if (semantic_1(expr, BOOLEAN, BOOLEAN)) TypeClash(); break; case OP_EQ_EQ: case OP_NOT_EQ: case OP_LT: case OP_LT_EQ: case OP_GT: case OP_GT_EQ: if (semantic_2(expr, BOOLEAN, INT, INT) && semantic_2(expr, BOOLEAN, REAL, REAL) && semantic_2(expr, BOOLEAN, INT, REAL) && semantic_2(expr, BOOLEAN, REAL, INT)) TypeClash(); break; case OP_COLINEAR: case OP_PT_BETWN_PTS: if (semantic_3(expr, BOOLEAN, POINT, POINT, POINT)) TypeClash(); break; case OP_INTERSECTS: if (semantic_2(expr, BOOLEAN, LINE, LINE)) TypeClash(); break; case OP_SEPARATES: if (semantic_3(expr, BOOLEAN, LINE, POINT, POINT)) TypeClash(); break; case OP_INCLUDES: if (semantic_2(expr, BOOLEAN, CIRCLE, POINT)) TypeClash(); break; case OP_INCIDENT: if (semantic_2(expr, BOOLEAN, LINE, POINT) && semantic_2(expr, BOOLEAN, CIRCLE, POINT)) TypeClash(); break; case OP_DISTLARGER: case OP_DISTSMALLER: if (semantic_3(expr, BOOLEAN, POINT, POINT, INT) && semantic_3(expr, BOOLEAN, POINT, POINT, REAL) && semantic_3(expr, BOOLEAN, LINE, POINT, INT) && semantic_3(expr, BOOLEAN, LINE, POINT, REAL)) TypeClash(); break; case OP_I: Etype = INT; break; case OP_XI: Etype = REAL; break; case OP_FI: Etype = REAL; break; case OP_I_1: Etype = INT; break; case OP_XI_1: Etype = REAL; break; case OP_FI_1: Etype = REAL; break; case OP_GSPECLIST: if (Lexpr == 0) Etype = GSPEC; else if (semantic_2(expr, GSPEC, GSPEC, GSPEC)) TypeClash(); break; case OP_GSPEC: if (Lexpr == 0) Etype = GSPEC; else if ((Ltype != (int) Rexpr) || ((Etype = GSPEC), 0)) TypeClash(); break; case OP_IMGFUNC: count_expr(Rexpr); Etype = IMAGE; break; case OP_FUNC: count_expr(Rexpr); case OP_EDEN: Etype = ANY; break; } return 1; /* default */ } static void check_children_type(tree expr) { if (expr->type != UNDEFINED)/* already checked */ return; switch (nary(expr->op)) { case 4: count_expr(expr->extra); case 3: count_expr(expr->mid); case 2: count_expr(expr->right); case 1: count_expr(expr->left); } } case OP_EXP: if (semantic_1(expr, REAL, INT)) { if (semantic_1(expr, REAL, REAL)) TypeClash(); } else /* cast the argument to floating point */ expr->left = dtree1(OP_FLOAT, expr->left); break; case OP_DOTX: case OP_DOTY: if (semantic_1(expr, POINT, POINT)) TypeClash(); break; case OP_DOTRAD: case OP_DOTARG: if (semantic_1(expr, REAL, POINT) && /* can be INT */ semantic_1(expr, REAL, ARC)) TypeClash(); break; case OP_Dtkeden1.41/Donald/CVS/004070000025250000164000000000000744001032500144425ustar00ashleyem00003510000005tkeden1.41/Donald/CVS/Entries010060000025250000164000000007040744001032500157760ustar00ashleyem00003510000005/Makefile.in/1.13/Fri Jul 27 16:22:10 2001// /check.c/1.10/Thu Dec 6 22:25:33 2001// /error.h/1.6/Tue Nov 16 21:20:40 1999// /oper.h/1.7/Thu Dec 6 22:26:23 2001// /parser.y/1.16/Thu Dec 6 22:27:37 2001// /symbol.c/1.14/Thu Aug 2 16:26:11 2001// /symbol.h/1.4/Tue Nov 16 21:20:40 1999// /tree.c/1.12/Thu Aug 2 16:26:11 2001// /tree.h/1.4/Tue Nov 16 21:20:40 1999// /utility.c/1.8/Fri Jul 27 16:34:39 2001// /lex.c/1.21/Fri Mar 1 23:37:56 2002// D tkeden1.41/Donald/CVS/Repository010060000025250000164000000000160743723740500165600ustar00ashleyem00003510000005tkeden/Donald tkeden1.41/Donald/CVS/Root010060000025250000164000000000550743723740500153270ustar00ashleyem00003510000005cssbz@cvs.eden.sourceforge.net:/cvsroot/eden tkeden1.41/Donald/dd_lex.c010060000025250000164000000377310744001274400154330ustar00ashleyem00003510000005/* * $Id: lex.c,v 1.21 2002/03/01 23:37:56 cssbz Exp $ */ static char rcsid[] = "$Id: lex.c,v 1.21 2002/03/01 23:37:56 cssbz Exp $"; #include #include #include #include #include "../config.h" #include "tree.h" #include "parser.h" #include "../Eden/eden.h" #include "../Eden/emalloc.h" #ifdef HAVE_DMALLOC #include #endif extern void dd_parse(int); extern char agentName[128]; /* for distributed tkEden --sun */ extern int appAgentName; extern int append_NoAgentName; extern char *libLocation; char *dd_prompt; enum { _S_, _A_, _D_, _DDOT_, _DE_, _DED_, _DES_, _DESD_, _DOT_, _DOT1_, _DOT2_, _DA_, _DAR_, _DR_, _DRA_, _QUOTE_, _QUERY_, _BSLASH_, _HASH_, _AND_, _OR_, _EQ_, _NOT_, _LT_, _GT_, _SLASH_, _B_, _BI_, _BISP_, _BI__, _BI_1_, _BI_1SP_, _I_, _X_, _F_, _II_, _IN_, _INA_, _TILDE_, _IGNORENL_ }; static char *dd_text = 0; static bufsize = 256; static dd_leng = 0; static state = _S_; /* start state */ static gtarget; /* which graph token seeking? */ static int isOpenshape=0; /* for distributed --sun */ static int curlyCount=0; int dd_appAgentName=1; static int DonaldAppAgentName=1; /* function prototypes */ int map_name_to_token(char *); void dd_restart(void); char * map_token_to_name(int); void dd_lex(int); void init_donald(void); static void save(int); static void action_A(void); static int tokenize(int); #define clearbuf() dd_text[dd_leng=0] = '\0' void dd_restart(void) { clearbuf(); state = _S_; } #define NUMTOKEN 63 struct { char *name; int token; } translation[NUMTOKEN] = { { "acos" , ACOS }, /* { "alias" , ALIAS }, */ { "and" , AND }, { "arc" , ARC }, /* { "as" , AS }, */ { "asin" , ASIN }, { "atan" , ATAN }, { "boolean" , BOOLEAN }, { "char" , MYCHAR }, { "circle" , CIRCLE }, { "colinear" , COLINEAR }, { "cos" , COS }, { "delete" , DELETE }, { "dist" , DISTANCE }, { "distlarger" , DISTLARGER }, { "distsmaller" , DISTSMALLER }, { "div" , DIV }, /* { "draw" , DRAW }, */ { "ellipse" , ELLIPSE }, { "else" , ELSE }, { "exp" , EXP }, { "false" , BOOL }, { "float" , FLOAT }, /* { "for" , FOR }, */ { "graph" , GRAPH }, { "if" , IF }, { "image" , IMAGE }, /* { "impose" , IMPOSE }, */ /* { "in" , IN }, */ { "incident" , INCIDENT }, { "includes" , INCLUDES }, { "inf" , INF }, { "int" , INT }, { "intersect" , INTERSECT }, { "intersects" , INTERSECTS }, { "itos" , ITOS }, { "label" , LABEL }, { "line" , LINE }, { "log" , LOG }, { "midpoint" , MIDPOINT }, { "mod" , MOD }, /* { "monitor" , MONITOR }, */ { "not" , NOT }, { "of" , OF }, { "openshape" , OPENSHAPE }, { "or" , OR }, { "parallel" , PARALLEL }, { "perpend" , PERPEND }, { "pi" , PI }, { "point" , POINT }, { "pt_betwn_pts", PT_BETWN_PTS }, { "rand" , RANDOM }, /* { "range" , RANGE }, */ { "real" , REAL }, { "rectangle" , RECTANGLE }, { "reflect" , REFLECT }, /* Ash November 2001 */ { "rot" , ROT }, { "rtos" , RTOS }, { "scale" , SCALE }, { "separates" , SEPARATES }, { "shape" , SHAPE }, { "sin" , SIN }, { "sqrt" , SQRT }, { "tan" , TAN }, { "then" , THEN }, { "trans" , TRANS }, { "true" , BOOL }, { "trunc" , TRUNC }, { "viewport" , VIEWPORT }, { "within" , WITHIN }, { 0, 0 } }; int map_name_to_token(char *name) { int i, start, end, cmp; start = 0; end = NUMTOKEN - 1; for (i = (NUMTOKEN - 1) >> 1; start <= i && i <= end; i = (start + end) >> 1) { if (translation[i].name == 0) return 0; cmp = strcmp(name, translation[i].name); if (cmp == 0) return translation[i].token; else if (cmp > 0) start = i + 1; else /* cmp < 0 */ end = i - 1; } return 0; } char * map_token_to_name(int token) { int i; for (i = 0; i < NUMTOKEN; i++) if (translation[i].token == token) return translation[i].name; return 0; } static void save(int c) { if (dd_leng == bufsize - 1) { bufsize *= 2; dd_text = (char *) erealloc(dd_text, bufsize * sizeof(int)); } dd_text[dd_leng++] = c; dd_text[dd_leng] = '\0'; } static void action_A(void) { int token; char new_dd_text[256]; /* for distributed tkEden --sun */ extern int inPrefix; if ((token = map_name_to_token(dd_text)) == 0) { /* Virtual agents */ if (*agentName != 0 && dd_appAgentName >0 && appAgentName > 0 && append_NoAgentName >0 && DonaldAppAgentName >0 ) { new_dd_text[0] = '\0'; if (inPrefix) strcpy(new_dd_text, agentName); else strcpy(new_dd_text, dd_text); strcat(new_dd_text, "_"); if (inPrefix) strcat(new_dd_text, dd_text); else strcat(new_dd_text, agentName); strcpy(dd_text, new_dd_text); /* printf("new_dd_text = %s\n", new_dd_text); */ } dd_lval.s = strdup(dd_text); dd_parse(ID); } else { /* it is a token */ if (token == BOOL) dd_lval.i = (strcmp(dd_text, "true") == 0); if (token == WITHIN && *agentName != 0 && append_NoAgentName > 0) { /* printf("within \n"); */ isOpenshape = 1; curlyCount = 0; } dd_parse(token); } DonaldAppAgentName = 1; } static int tokenize(int c) { switch (c) { case '!': return NOT; case ',': return COMMA; case '+': return PLUS; case '-': return MINUS; case '*': return STAR; case '/': return SLASH; case '%': return PERCENT; case '=': return EQUALS; case '&': return AMPERSAND; case '|': return VERTBAR; case ':': return COLON; case ';': return SEMICOLON; case '~': DonaldAppAgentName = 0; return TILDE; case '@': return ATSIGN; case '(': return LPAREN; case ')': return RPAREN; case '<': return LT; case '>': return GT; case '[': return LBRACK; case ']': return RBRACK; case '{': return LCURLY; case '}': return RCURLY; default: return c; } } void dd_lex(int c) { switch (state) { case _S_: switch (c) { case ' ': case '\t': state = _S_; break; case '\n': dd_parse(NEWLINE); state = _S_; break; case '\r': dd_parse(NEWLINE); state = _IGNORENL_; break; case '.': save(c); state = _DOT_; break; case '?': state = _QUERY_; break; case '"': save(c); state = _QUOTE_; break; case '\\': state = _BSLASH_; break; case '#': state = _HASH_; break; case '&': state = _AND_; break; case '|': state = _OR_; break; case '=': state = _EQ_; break; case '!': state = _NOT_; break; case '<': gtarget = _I_; state = _B_; break; case '>': state = _GT_; break; case '/': state = _SLASH_; break; case 'f': gtarget = _F_; state = _F_; save(c); break; case 'x': gtarget = _X_; state = _X_; save(c); break; case 'I': state = _II_; break; case '~': state = _TILDE_; break; default: if (isalpha(c) || c == '_') { save(c); state = _A_; } else if (isdigit(c)) { save(c); state = _D_; } else { dd_parse(tokenize(c)); state = _S_; } break; } break; case _A_: if (isalnum(c) || c == '_') { save(c); state = _A_; } else { action_A(); clearbuf(); state = _S_; dd_lex(c); } break; case _D_: if (isdigit(c)) { save(c); state = _D_; } else if (c == '.') { save(c); state = _DDOT_; } else if (c == 'E' || c == 'e') { save(c); state = _DE_; } else { dd_lval.i = atoi(dd_text); dd_parse(INUMBER); clearbuf(); state = _S_; dd_lex(c); } break; case _DDOT_: if (isdigit(c)) { save(c); state = _DDOT_; } else if (c == '.') { dd_lval.r = atof(dd_text); dd_parse(RNUMBER); clearbuf(); state = _S_; dd_lex(c); } else if (c == 'E' || c == 'e') { save(c); state = _DE_; } else { dd_lval.r = atof(dd_text); dd_parse(RNUMBER); clearbuf(); state = _S_; dd_lex(c); } break; case _DE_: if (isdigit(c)) { save(c); state = _DED_; } else if (c == '+' || c == '-') { save(c); state = _DES_; } else { dd_lval.r = atof(dd_text); dd_parse(RNUMBER); clearbuf(); state = _S_; dd_lex(c); } break; case _DED_: case _DESD_: if (isdigit(c)) { save(c); state = _DED_; } else { dd_lval.r = atof(dd_text); dd_parse(RNUMBER); clearbuf(); state = _S_; dd_lex(c); } break; case _DES_: if (isdigit(c)) { save(c); state = _DESD_; } else { int E, S; dd_lval.r = atof(dd_text); dd_parse(RNUMBER); E = dd_text[dd_leng-2]; S = dd_text[dd_leng-1]; clearbuf(); state = _S_; dd_lex(E); dd_lex(S); dd_lex(c); } break; case _DOT_: if (c == 'x') { dd_parse(DOTX); clearbuf(); state = _S_; } else if (c == 'y') { dd_parse(DOTY); clearbuf(); state = _S_; } else if (c == '1') { save(c); state = _DOT1_; } else if (c == '2') { save(c); state = _DOT2_; } else if (c == 'a') { save(c); state = _DA_; } else if (c == 'r') { save(c); state = _DR_; } else if (isdigit(c)) { save(c); state = _DDOT_; } else { dd_parse('.'); clearbuf(); state = _S_; dd_lex(c); } break; case _DOT1_: if (isdigit(c)) { state = _DDOT_; dd_lex(c); } else { dd_parse(DOT1); clearbuf(); state = _S_; dd_lex(c); } break; case _DOT2_: if (isdigit(c)) { state = _DDOT_; dd_lex(c); } else { dd_parse(DOT2); clearbuf(); state = _S_; dd_lex(c); } break; case _DA_: if (c == 'r') { save(c); state = _DAR_; } else { dd_parse('.'); clearbuf(); state = _S_; dd_lex('a'); dd_lex(c); } break; case _DAR_: if (c == 'g') { dd_parse(DOTARG); clearbuf(); state = _S_; } else { dd_parse('.'); clearbuf(); state = _S_; dd_lex('a'); dd_lex('r'); dd_lex(c); } break; case _DR_: if (c == 'a') { save(c); state = _DRA_; } else { dd_parse('.'); clearbuf(); state = _S_; dd_lex('r'); dd_lex(c); } break; case _DRA_: if (c == 'd') { dd_parse(DOTRAD); clearbuf(); state = _S_; } else { dd_parse('.'); clearbuf(); state = _S_; dd_lex('r'); dd_lex('a'); dd_lex(c); } break; case _QUOTE_: if (c == '"') { save(c); dd_lval.s = strdup(dd_text); dd_parse(CSTRING); clearbuf(); state = _S_; } else if (c == '\n' || c == '\r') { save('"'); dd_lval.s = strdup(dd_text); dd_parse(CSTRING); clearbuf(); state = _S_; } else { save(c); state = _QUOTE_; } break; case _QUERY_: if (c == '\n' || c == '\r') { dd_lval.s = strdup(dd_text); dd_parse(QUERY); dd_parse(NEWLINE); clearbuf(); state = _S_; } else { save(c); state = _QUERY_; } break; case _BSLASH_: if (c == '\n' || c == '\r') { state = _S_; } else { dd_parse('\\'); state = _S_; dd_lex(c); } break; case _HASH_: if (c == '\n' || c == '\r') { dd_parse(NEWLINE); state = _S_; } else { state = _HASH_; } break; case _AND_: if (c == '&') { dd_parse(AND); state = _S_; } else { dd_parse(AMPERSAND); state = _S_; dd_lex(c); } break; case _OR_: if (c == '|') { dd_parse(OR); state = _S_; } else { dd_parse(VERTBAR); state = _S_; dd_lex(c); } break; case _EQ_: if (c == '=') { dd_parse(EQ_EQ); state = _S_; } else { dd_parse(EQUALS); state = _S_; dd_lex(c); } break; case _NOT_: if (c == '=') { dd_parse(NOT_EQ); state = _S_; } else { dd_parse(NOT); state = _S_; dd_lex(c); } break; case _LT_: if (c == '=') { dd_parse(LT_EQ); state = _S_; } else { dd_parse(LT); state = _S_; dd_lex(c); } break; case _GT_: if (c == '=') { dd_parse(GT_EQ); state = _S_; } else { dd_parse(GT); state = _S_; dd_lex(c); } break; case _SLASH_: if (c == '/') { dd_parse(SLASH_SLASH); state = _S_; } else { dd_parse(SLASH); state = _S_; DonaldAppAgentName = 0; dd_lex(c); } break; case _TILDE_: if (c == '/') { DonaldAppAgentName = 1; dd_appAgentName++; dd_parse(TILDE_SLASH); state = _S_; } else { DonaldAppAgentName = 0; state = _S_; dd_lex(c); } break; case _F_: if (c == ' ' || c == '\t') { state = _F_; } else if (c == '<') { state = _B_; } else { state = _A_; dd_lex(c); } break; case _X_: if (c == ' ' || c == '\t') { state = _X_; } else if (c == '<') { state = _B_; } else { state = _A_; dd_lex(c); } break; case _B_: if (c == ' ' || c == '\t') { state = _B_; } else if (c == 'i') { state = _BI_; } else { switch (gtarget) { case _F_: case _X_: state = _A_; dd_lex('<'); dd_lex(c); break; default: state = _LT_; dd_lex(c); break; } } break; case _BI_: case _BISP_: if (c == ' ' || c == '\t') { state = _BISP_; } else if (c == '-') { state = _BI__; } else if (c == '>') { switch (gtarget) { case _F_: dd_parse(FI); break; case _X_: dd_parse(XI); break; case _I_: dd_parse(I); break; } clearbuf(); state = _S_; } else { switch (gtarget) { case _F_: case _X_: state = _A_; dd_lex('<'); dd_lex('i'); if (state == _BISP_) dd_lex(' '); dd_lex(c); break; default: state = _LT_; dd_lex('i'); if (state == _BISP_) dd_lex(' '); dd_lex(c); break; } } break; case _BI__: if (c == ' ' || c == '\t') { state = _BI__; } else if (c == '1') { state = _BI_1_; } else { switch (gtarget) { case _F_: case _X_: state = _A_; dd_lex('<'); dd_lex('i'); dd_lex('-'); dd_lex(c); break; default: state = _LT_; dd_lex('i'); dd_lex('-'); dd_lex(c); break; } } break; case _BI_1_: case _BI_1SP_: if (c == ' ' || c == '\t') { state = _BI_1SP_; } else if (c == '>') { switch (gtarget) { case _F_: dd_parse(FI_1); break; case _X_: dd_parse(XI_1); break; case _I_: dd_parse(I_1); break; } clearbuf(); state = _S_; } else { switch (gtarget) { case _F_: case _X_: state = _A_; dd_lex('<'); dd_lex('i'); dd_lex('-'); dd_lex('1'); if (state == _BI_1SP_) dd_lex(' '); dd_lex(c); break; default: state = _LT_; dd_lex('i'); dd_lex('-'); dd_lex('1'); if (state == _BI_1SP_) dd_lex(' '); dd_lex(c); break; } } break; case _II_: if (c == '!') { state = _IN_; } else { state = _A_; dd_lex('I'); dd_lex(c); } break; case _IN_: if (isalpha(c)) { save(c); state = _INA_; } else { state = _S_; dd_lex('I'); dd_lex('!'); dd_lex(c); } break; case _INA_: if (isalpha(c)) { save(c); state = _INA_; } else { dd_lval.s = strdup(dd_text); dd_parse(IMGFUNC); clearbuf(); state = _S_; dd_lex(c); } break; case _IGNORENL_: if (c == '\n') { state = _S_; /* discard \n after \r */ } else { state = _S_; dd_lex(c); } break; } } #define FILE_DEV 1 void init_donald(void) { char *name = "/donald.eden"; char fullname[255]; FILE *initFile; extern char *progname; extern char viewport_name[]; extern int run(short, void *, char *); char *envcontents; if (dd_text == 0) { dd_text = (char *) emalloc(bufsize * sizeof(int)); }; *viewport_name = '\0'; dd_prompt = (char *)malloc(4); strcpy(dd_prompt, "[/]"); strcpy(fullname, libLocation); strcat(fullname, name); if ((initFile = fopen(fullname, "r")) == 0) { fprintf(stderr, "%s: can't open %s\n", progname, fullname); exit(1); } run(FILE_DEV, initFile, name); } ak; case '!': state = _NOT_; tkeden1.41/Donald/error.h010060000025250000164000000023510701434525000153160ustar00ashleyem00003510000005/* * $Id: error.h,v 1.6 1999/11/16 21:20:40 ashley Rel1.10 $ */ /*----- error code definitions -----*/ enum errorcodes { Unclassified , Impossible , SyntaxError , OutOfMemory , UndefinedID , IdListExpect , IdExprUnmatch , RedeclareID , UndeclareID , StackOverflow , StackUnderflow , NotOpenshapeOrGraph , TypeMismatch , FuncExpect } ; #define ERRORSTRINGS \ "%s" ,\ "impossible error occurs in %s" ,\ "syntax error" ,\ "out of memory" ,\ "undefined id: %s" ,\ "id list expected" ,\ "id list and expr list unmatched" ,\ "redeclared identifier: %s" ,\ "undeclared identifier: %s" ,\ "%sstack overflow" ,\ "%sstack underflow" ,\ "not openshape or graph: %s" ,\ "type mismatched" ,\ "%s is not declared as a function" extern void don_err(enum errorcodes, char *); tkeden1.41/Donald/lex.c010060000025250000164000000374450744001032400147560ustar00ashleyem00003510000005/* * $Id: lex.c,v 1.21 2002/03/01 23:37:56 cssbz Exp $ */ static char rcsid[] = "$Id: lex.c,v 1.21 2002/03/01 23:37:56 cssbz Exp $"; #include #include #include #include #include "../config.h" #include "tree.h" #include "parser.h" #include "../Eden/eden.h" #include "../Eden/emalloc.h" #ifdef HAVE_DMALLOC #include #endif extern void yyparse(int); extern char agentName[128]; /* for distributed tkEden --sun */ extern int appAgentName; extern int append_NoAgentName; extern char *libLocation; char *dd_prompt; enum { _S_, _A_, _D_, _DDOT_, _DE_, _DED_, _DES_, _DESD_, _DOT_, _DOT1_, _DOT2_, _DA_, _DAR_, _DR_, _DRA_, _QUOTE_, _QUERY_, _BSLASH_, _HASH_, _AND_, _OR_, _EQ_, _NOT_, _LT_, _GT_, _SLASH_, _B_, _BI_, _BISP_, _BI__, _BI_1_, _BI_1SP_, _I_, _X_, _F_, _II_, _IN_, _INA_, _TILDE_, _IGNORENL_ }; static char *yytext = 0; static bufsize = 256; static yyleng = 0; static state = _S_; /* start state */ static gtarget; /* which graph token seeking? */ static int isOpenshape=0; /* for distributed --sun */ static int curlyCount=0; int dd_appAgentName=1; static int DonaldAppAgentName=1; /* function prototypes */ int map_name_to_token(char *); void yyrestart(void); char * map_token_to_name(int); void yylex(int); void init_donald(void); static void save(int); static void action_A(void); static int tokenize(int); #define clearbuf() yytext[yyleng=0] = '\0' void yyrestart(void) { clearbuf(); state = _S_; } #define NUMTOKEN 63 struct { char *name; int token; } translation[NUMTOKEN] = { { "acos" , ACOS }, /* { "alias" , ALIAS }, */ { "and" , AND }, { "arc" , ARC }, /* { "as" , AS }, */ { "asin" , ASIN }, { "atan" , ATAN }, { "boolean" , BOOLEAN }, { "char" , MYCHAR }, { "circle" , CIRCLE }, { "colinear" , COLINEAR }, { "cos" , COS }, { "delete" , DELETE }, { "dist" , DISTANCE }, { "distlarger" , DISTLARGER }, { "distsmaller" , DISTSMALLER }, { "div" , DIV }, /* { "draw" , DRAW }, */ { "ellipse" , ELLIPSE }, { "else" , ELSE }, { "exp" , EXP }, { "false" , BOOL }, { "float" , FLOAT }, /* { "for" , FOR }, */ { "graph" , GRAPH }, { "if" , IF }, { "image" , IMAGE }, /* { "impose" , IMPOSE }, */ /* { "in" , IN }, */ { "incident" , INCIDENT }, { "includes" , INCLUDES }, { "inf" , INF }, { "int" , INT }, { "intersect" , INTERSECT }, { "intersects" , INTERSECTS }, { "itos" , ITOS }, { "label" , LABEL }, { "line" , LINE }, { "log" , LOG }, { "midpoint" , MIDPOINT }, { "mod" , MOD }, /* { "monitor" , MONITOR }, */ { "not" , NOT }, { "of" , OF }, { "openshape" , OPENSHAPE }, { "or" , OR }, { "parallel" , PARALLEL }, { "perpend" , PERPEND }, { "pi" , PI }, { "point" , POINT }, { "pt_betwn_pts", PT_BETWN_PTS }, { "rand" , RANDOM }, /* { "range" , RANGE }, */ { "real" , REAL }, { "rectangle" , RECTANGLE }, { "reflect" , REFLECT }, /* Ash November 2001 */ { "rot" , ROT }, { "rtos" , RTOS }, { "scale" , SCALE }, { "separates" , SEPARATES }, { "shape" , SHAPE }, { "sin" , SIN }, { "sqrt" , SQRT }, { "tan" , TAN }, { "then" , THEN }, { "trans" , TRANS }, { "true" , BOOL }, { "trunc" , TRUNC }, { "viewport" , VIEWPORT }, { "within" , WITHIN }, { 0, 0 } }; int map_name_to_token(char *name) { int i, start, end, cmp; start = 0; end = NUMTOKEN - 1; for (i = (NUMTOKEN - 1) >> 1; start <= i && i <= end; i = (start + end) >> 1) { if (translation[i].name == 0) return 0; cmp = strcmp(name, translation[i].name); if (cmp == 0) return translation[i].token; else if (cmp > 0) start = i + 1; else /* cmp < 0 */ end = i - 1; } return 0; } char * map_token_to_name(int token) { int i; for (i = 0; i < NUMTOKEN; i++) if (translation[i].token == token) return translation[i].name; return 0; } static void save(int c) { if (yyleng == bufsize - 1) { bufsize *= 2; yytext = (char *) erealloc(yytext, bufsize * sizeof(int)); } yytext[yyleng++] = c; yytext[yyleng] = '\0'; } static void action_A(void) { int token; char new_yytext[256]; /* for distributed tkEden --sun */ extern int inPrefix; if ((token = map_name_to_token(yytext)) == 0) { /* Virtual agents */ if (*agentName != 0 && dd_appAgentName >0 && appAgentName > 0 && append_NoAgentName >0 && DonaldAppAgentName >0 ) { new_yytext[0] = '\0'; if (inPrefix) strcpy(new_yytext, agentName); else strcpy(new_yytext, yytext); strcat(new_yytext, "_"); if (inPrefix) strcat(new_yytext, yytext); else strcat(new_yytext, agentName); strcpy(yytext, new_yytext); /* printf("new_yytext = %s\n", new_yytext); */ } yylval.s = strdup(yytext); yyparse(ID); } else { /* it is a token */ if (token == BOOL) yylval.i = (strcmp(yytext, "true") == 0); if (token == WITHIN && *agentName != 0 && append_NoAgentName > 0) { /* printf("within \n"); */ isOpenshape = 1; curlyCount = 0; } yyparse(token); } DonaldAppAgentName = 1; } static int tokenize(int c) { switch (c) { case '!': return NOT; case ',': return COMMA; case '+': return PLUS; case '-': return MINUS; case '*': return STAR; case '/': return SLASH; case '%': return PERCENT; case '=': return EQUALS; case '&': return AMPERSAND; case '|': return VERTBAR; case ':': return COLON; case ';': return SEMICOLON; case '~': DonaldAppAgentName = 0; return TILDE; case '@': return ATSIGN; case '(': return LPAREN; case ')': return RPAREN; case '<': return LT; case '>': return GT; case '[': return LBRACK; case ']': return RBRACK; case '{': return LCURLY; case '}': return RCURLY; default: return c; } } void yylex(int c) { switch (state) { case _S_: switch (c) { case ' ': case '\t': state = _S_; break; case '\n': yyparse(NEWLINE); state = _S_; break; case '\r': yyparse(NEWLINE); state = _IGNORENL_; break; case '.': save(c); state = _DOT_; break; case '?': state = _QUERY_; break; case '"': save(c); state = _QUOTE_; break; case '\\': state = _BSLASH_; break; case '#': state = _HASH_; break; case '&': state = _AND_; break; case '|': state = _OR_; break; case '=': state = _EQ_; break; case '!': state = _NOT_; break; case '<': gtarget = _I_; state = _B_; break; case '>': state = _GT_; break; case '/': state = _SLASH_; break; case 'f': gtarget = _F_; state = _F_; save(c); break; case 'x': gtarget = _X_; state = _X_; save(c); break; case 'I': state = _II_; break; case '~': state = _TILDE_; break; default: if (isalpha(c) || c == '_') { save(c); state = _A_; } else if (isdigit(c)) { save(c); state = _D_; } else { yyparse(tokenize(c)); state = _S_; } break; } break; case _A_: if (isalnum(c) || c == '_') { save(c); state = _A_; } else { action_A(); clearbuf(); state = _S_; yylex(c); } break; case _D_: if (isdigit(c)) { save(c); state = _D_; } else if (c == '.') { save(c); state = _DDOT_; } else if (c == 'E' || c == 'e') { save(c); state = _DE_; } else { yylval.i = atoi(yytext); yyparse(INUMBER); clearbuf(); state = _S_; yylex(c); } break; case _DDOT_: if (isdigit(c)) { save(c); state = _DDOT_; } else if (c == '.') { yylval.r = atof(yytext); yyparse(RNUMBER); clearbuf(); state = _S_; yylex(c); } else if (c == 'E' || c == 'e') { save(c); state = _DE_; } else { yylval.r = atof(yytext); yyparse(RNUMBER); clearbuf(); state = _S_; yylex(c); } break; case _DE_: if (isdigit(c)) { save(c); state = _DED_; } else if (c == '+' || c == '-') { save(c); state = _DES_; } else { yylval.r = atof(yytext); yyparse(RNUMBER); clearbuf(); state = _S_; yylex(c); } break; case _DED_: case _DESD_: if (isdigit(c)) { save(c); state = _DED_; } else { yylval.r = atof(yytext); yyparse(RNUMBER); clearbuf(); state = _S_; yylex(c); } break; case _DES_: if (isdigit(c)) { save(c); state = _DESD_; } else { int E, S; yylval.r = atof(yytext); yyparse(RNUMBER); E = yytext[yyleng-2]; S = yytext[yyleng-1]; clearbuf(); state = _S_; yylex(E); yylex(S); yylex(c); } break; case _DOT_: if (c == 'x') { yyparse(DOTX); clearbuf(); state = _S_; } else if (c == 'y') { yyparse(DOTY); clearbuf(); state = _S_; } else if (c == '1') { save(c); state = _DOT1_; } else if (c == '2') { save(c); state = _DOT2_; } else if (c == 'a') { save(c); state = _DA_; } else if (c == 'r') { save(c); state = _DR_; } else if (isdigit(c)) { save(c); state = _DDOT_; } else { yyparse('.'); clearbuf(); state = _S_; yylex(c); } break; case _DOT1_: if (isdigit(c)) { state = _DDOT_; yylex(c); } else { yyparse(DOT1); clearbuf(); state = _S_; yylex(c); } break; case _DOT2_: if (isdigit(c)) { state = _DDOT_; yylex(c); } else { yyparse(DOT2); clearbuf(); state = _S_; yylex(c); } break; case _DA_: if (c == 'r') { save(c); state = _DAR_; } else { yyparse('.'); clearbuf(); state = _S_; yylex('a'); yylex(c); } break; case _DAR_: if (c == 'g') { yyparse(DOTARG); clearbuf(); state = _S_; } else { yyparse('.'); clearbuf(); state = _S_; yylex('a'); yylex('r'); yylex(c); } break; case _DR_: if (c == 'a') { save(c); state = _DRA_; } else { yyparse('.'); clearbuf(); state = _S_; yylex('r'); yylex(c); } break; case _DRA_: if (c == 'd') { yyparse(DOTRAD); clearbuf(); state = _S_; } else { yyparse('.'); clearbuf(); state = _S_; yylex('r'); yylex('a'); yylex(c); } break; case _QUOTE_: if (c == '"') { save(c); yylval.s = strdup(yytext); yyparse(CSTRING); clearbuf(); state = _S_; } else if (c == '\n' || c == '\r') { save('"'); yylval.s = strdup(yytext); yyparse(CSTRING); clearbuf(); state = _S_; } else { save(c); state = _QUOTE_; } break; case _QUERY_: if (c == '\n' || c == '\r') { yylval.s = strdup(yytext); yyparse(QUERY); yyparse(NEWLINE); clearbuf(); state = _S_; } else { save(c); state = _QUERY_; } break; case _BSLASH_: if (c == '\n' || c == '\r') { state = _S_; } else { yyparse('\\'); state = _S_; yylex(c); } break; case _HASH_: if (c == '\n' || c == '\r') { yyparse(NEWLINE); state = _S_; } else { state = _HASH_; } break; case _AND_: if (c == '&') { yyparse(AND); state = _S_; } else { yyparse(AMPERSAND); state = _S_; yylex(c); } break; case _OR_: if (c == '|') { yyparse(OR); state = _S_; } else { yyparse(VERTBAR); state = _S_; yylex(c); } break; case _EQ_: if (c == '=') { yyparse(EQ_EQ); state = _S_; } else { yyparse(EQUALS); state = _S_; yylex(c); } break; case _NOT_: if (c == '=') { yyparse(NOT_EQ); state = _S_; } else { yyparse(NOT); state = _S_; yylex(c); } break; case _LT_: if (c == '=') { yyparse(LT_EQ); state = _S_; } else { yyparse(LT); state = _S_; yylex(c); } break; case _GT_: if (c == '=') { yyparse(GT_EQ); state = _S_; } else { yyparse(GT); state = _S_; yylex(c); } break; case _SLASH_: if (c == '/') { yyparse(SLASH_SLASH); state = _S_; } else { yyparse(SLASH); state = _S_; DonaldAppAgentName = 0; yylex(c); } break; case _TILDE_: if (c == '/') { DonaldAppAgentName = 1; dd_appAgentName++; yyparse(TILDE_SLASH); state = _S_; } else { DonaldAppAgentName = 0; state = _S_; yylex(c); } break; case _F_: if (c == ' ' || c == '\t') { state = _F_; } else if (c == '<') { state = _B_; } else { state = _A_; yylex(c); } break; case _X_: if (c == ' ' || c == '\t') { state = _X_; } else if (c == '<') { state = _B_; } else { state = _A_; yylex(c); } break; case _B_: if (c == ' ' || c == '\t') { state = _B_; } else if (c == 'i') { state = _BI_; } else { switch (gtarget) { case _F_: case _X_: state = _A_; yylex('<'); yylex(c); break; default: state = _LT_; yylex(c); break; } } break; case _BI_: case _BISP_: if (c == ' ' || c == '\t') { state = _BISP_; } else if (c == '-') { state = _BI__; } else if (c == '>') { switch (gtarget) { case _F_: yyparse(FI); break; case _X_: yyparse(XI); break; case _I_: yyparse(I); break; } clearbuf(); state = _S_; } else { switch (gtarget) { case _F_: case _X_: state = _A_; yylex('<'); yylex('i'); if (state == _BISP_) yylex(' '); yylex(c); break; default: state = _LT_; yylex('i'); if (state == _BISP_) yylex(' '); yylex(c); break; } } break; case _BI__: if (c == ' ' || c == '\t') { state = _BI__; } else if (c == '1') { state = _BI_1_; } else { switch (gtarget) { case _F_: case _X_: state = _A_; yylex('<'); yylex('i'); yylex('-'); yylex(c); break; default: state = _LT_; yylex('i'); yylex('-'); yylex(c); break; } } break; case _BI_1_: case _BI_1SP_: if (c == ' ' || c == '\t') { state = _BI_1SP_; } else if (c == '>') { switch (gtarget) { case _F_: yyparse(FI_1); break; case _X_: yyparse(XI_1); break; case _I_: yyparse(I_1); break; } clearbuf(); state = _S_; } else { switch (gtarget) { case _F_: case _X_: state = _A_; yylex('<'); yylex('i'); yylex('-'); yylex('1'); if (state == _BI_1SP_) yylex(' '); yylex(c); break; default: state = _LT_; yylex('i'); yylex('-'); yylex('1'); if (state == _BI_1SP_) yylex(' '); yylex(c); break; } } break; case _II_: if (c == '!') { state = _IN_; } else { state = _A_; yylex('I'); yylex(c); } break; case _IN_: if (isalpha(c)) { save(c); state = _INA_; } else { state = _S_; yylex('I'); yylex('!'); yylex(c); } break; case _INA_: if (isalpha(c)) { save(c); state = _INA_; } else { yylval.s = strdup(yytext); yyparse(IMGFUNC); clearbuf(); state = _S_; yylex(c); } break; case _IGNORENL_: if (c == '\n') { state = _S_; /* discard \n after \r */ } else { state = _S_; yylex(c); } break; } } #define FILE_DEV 1 void init_donald(void) { char *name = "/donald.eden"; char fullname[255]; FILE *initFile; extern char *progname; extern char viewport_name[]; extern int run(short, void *, char *); char *envcontents; if (yytext == 0) { yytext = (char *) emalloc(bufsize * sizeof(int)); }; *viewport_name = '\0'; dd_prompt = (char *)malloc(4); strcpy(dd_prompt, "[/]"); strcpy(fullname, libLocation); strcat(fullname, name); if ((initFile = fopen(fullname, "r")) == 0) { fprintf(stderr, "%s: can't open %s\n", progname, fullname); exit(1); } run(FILE_DEV, initFile, name); } return c; } } void yylex(int c) { switch (state) { case _S_: switch (c) { case ' ': case '\t': state = _S_; break; case '\n': yyparse(NEWLINE); state = _S_; break; case '\r': tkeden1.41/Donald/Makefile.in010060000025250000164000000005140733031246200160600ustar00ashleyem00003510000005# # $Id: Makefile.in,v 1.13 2001/07/27 16:22:10 cssbz Exp $ # # Need to find the original lexer source... where oh where? LEXER_SOURCE = lex.c NOTATION_PREFIX = dd_ PARSER_SOURCE = parser.y PARSER_OUT = parser.c PARSER_HEADERS_OUT = parser.h SOURCES = check.c symbol.c tree.c utility.c LIB = libdonald.a include ../generic.mk tkeden1.41/Donald/oper.h010060000025250000164000000311560740377021700151460ustar00ashleyem00003510000005/* * $Id: oper.h,v 1.7 2001/12/06 22:26:23 cssbz Exp $ */ /*----- operator code -----*/ #define OP_INF 0 #define OP_ASSIGN 1 #define OP_PLUS 2 #define OP_MINUS 3 #define OP_MULT 4 #define OP_MOD 5 #define OP_DIV 6 #define OP_UMINUS 7 #define OP_TILDE 8 #define OP_DOTX 9 #define OP_DOTY 10 #define OP_DOT1 11 #define OP_DOT2 12 #define OP_DOTRAD 13 #define OP_DOTARG 14 #define OP_CART 15 #define OP_POLAR 16 #define OP_LINE 17 #define OP_ROT 18 #define OP_SCALE 19 #define OP_SLASH 20 #define OP_ID 21 #define OP_INUMBER 22 #define OP_COMMA 23 #define OP_PAREN 24 #define OP_IF 25 #define OP_VECT_ADD 26 #define OP_VECT_SUB 27 #define OP_SCALAR_MULT 28 #define OP_SCALAR_DIV 29 #define OP_SCALAR_MOD 30 #define OP_COS 31 #define OP_SIN 32 #define OP_RNUMBER 33 #define OP_INTERSECT 34 #define OP_PARALLEL 35 #define OP_PERPEND 36 #define OP_CIRCLE 37 #define OP_AND 38 #define OP_OR 39 #define OP_NOT 40 #define OP_BOOL 41 #define OP_PT_BETWN_PTS 42 #define OP_COLINEAR 43 #define OP_INTERSECTS 44 #define OP_SEPARATES 45 #define OP_INCLUDES 46 #define OP_DISTLARGER 47 #define OP_DISTSMALLER 48 #define OP_LABEL 49 #define OP_MONITOR 50 #define OP_IMPOSE 51 #define OP_CSTRING 52 #define OP_DISTANCE 53 #define OP_MIDPOINT 54 #define OP_EQ_EQ 55 #define OP_NOT_EQ 56 #define OP_GT 57 #define OP_GT_EQ 58 #define OP_LT 59 #define OP_LT_EQ 60 #define OP_SQRT 61 #define OP_TAN 62 #define OP_ASIN 63 #define OP_ACOS 64 #define OP_ATAN 65 #define OP_LOG 66 #define OP_EXP 67 #define OP_TRUNC 68 #define OP_FLOAT 69 #define OP_INCIDENT 70 #define OP_TRANS 71 #define OP_ELLIPSE 72 #define OP_RANDOM 73 #define OP_ARC 74 #define OP_PI 75 #define OP_SLASH_SLASH 76 #define OP_ITOS 77 #define OP_RTOS 78 #define OP_I 79 #define OP_XI 80 #define OP_FI 81 #define OP_I_1 82 #define OP_XI_1 83 #define OP_FI_1 84 #define OP_GSPECLIST 85 #define OP_GSPEC 86 #define OP_GLOBAL 87 #define OP_FUNC 88 #define OP_EDEN 89 #define OP_IMGFUNC 90 #define OP_RECTANGLE 91 #define OP_REFLECT 92 #define UNARY -1 #define BINARY -2 #define TRIARY -3 #define QUADARY -4 #define INFIX -5 #define POSTFIX -6 #define CONSTANT -7 struct trans { int order; char *op_str; } ; #define TRANSLAT \ { \ /* OP_INF */ { CONSTANT, "[ INF ]" }, \ /* OP_ASSIGN */ { INFIX, " = " }, \ /* OP_PLUS */ { INFIX, " + " }, \ /* OP_MINUS */ { INFIX, " - " }, \ /* OP_MULT */ { INFIX, " * " }, \ /* OP_MOD */ { INFIX, " % " }, \ /* OP_DIV */ { INFIX, " / " }, \ /* OP_UMINUS */ { UNARY, "- " }, \ /* OP_TILDE */ { UNARY, 0 }, \ /* OP_DOTX */ { UNARY, "dotx(" }, \ /* OP_DOTY */ { UNARY, "doty(" }, \ /* OP_DOT1 */ { UNARY, "dot1(" }, \ /* OP_DOT2 */ { UNARY, "dot2(" }, \ /* OP_DOTRAD */ { UNARY, "dotrad(" }, \ /* OP_DOTARG */ { UNARY, "dotarg(" }, \ /* OP_CART */ { BINARY, "cart(" }, \ /* OP_POLAR */ { BINARY, "polar(" }, \ /* OP_LINE */ { BINARY, "line(" }, \ /* OP_ROT */ { TRIARY, "rot(" }, \ /* OP_SCALE */ { BINARY, "scale(" }, \ /* OP_SLASH */ { OP_SLASH, "" }, \ /* OP_ID */ { OP_ID, 0 }, \ /* OP_INUMBER*/ { OP_INUMBER , 0 }, \ /* OP_COMMA */ { INFIX, ", " }, \ /* OP_PAREN */ { UNARY, "(" }, \ /* OP_IF */ { OP_IF, 0 }, \ /* OP_VECT_ADD */ { BINARY, "vector_add(" }, \ /* OP_VECT_SUB */ { BINARY, "vector_sub(" }, \ /* OP_SCALAR_MULT */ { BINARY, "scalar_mult(" }, \ /* OP_SCALAR_DIV */ { BINARY, "scalar_div(" }, \ /* OP_SCALAR_MOD */ { BINARY, "scalar_mod(" }, \ /* OP_COSINE */ { UNARY, "cos(" }, \ /* OP_SINE */ { UNARY, "sin(" }, \ /* OP_RNUMBER */ { OP_RNUMBER, 0 }, \ /* OP_INTERSECT */ { BINARY, "intersect(" }, \ /* OP_PARALLEL */ { QUADARY, "parallel(" }, \ /* OP_PERPEND */ { BINARY, "perpend(" }, \ /* OP_CIRCLE */ { BINARY, "circle(" }, \ /* OP_AND */ { INFIX, " && " }, \ /* OP_OR */ { INFIX, " || " }, \ /* OP_NOT */ { UNARY, "! " }, \ /* OP_BOOL */ { OP_BOOL, 0 }, \ /* OP_PT_BETWN_PTS */ { TRIARY, "between(" }, \ /* OP_COLINEAR */ { TRIARY, "colinear(" }, \ /* OP_INTERSECTS */ { BINARY, "intersects(" }, \ /* OP_SEPARATES */ { TRIARY, "separates(" }, \ /* OP_INCLUDES */ { BINARY, "includes(" }, \ /* OP_DISTLARGER */ { TRIARY, "distlarger(" }, \ /* OP_DISTSMALLER */ { TRIARY, "distsmaller(" }, \ /* OP_LABEL */ { BINARY, "label(" }, \ /* OP_MONITOR */ { OP_MONITOR, 0 }, \ /* OP_IMPOSE */ { OP_IMPOSE, 0 }, \ /* OP_CSTRING */ { OP_CSTRING, 0 }, \ /*OP_DISTANCE */ { BINARY, "dist(" }, \ /* OP_MIDPOINT */ { UNARY, "midpoint(" }, \ /* OP_EQ_EQ */ { INFIX, " == " }, \ /* OP_NOT_EQ */ { INFIX, " != " }, \ /* OP_GT */ { INFIX, " > " }, \ /* OP_GT_EQ */ { INFIX, " >= " }, \ /* OP_LT */ { INFIX, " < " }, \ /* OP_LT_EQ */ { INFIX, " <= " }, \ /* OP_SQRT */ { UNARY, "sqrt(" }, \ /* OP_TAN */ { UNARY, "tan(" }, \ /* OP_ASIN */ { UNARY, "asin(" }, \ /* OP_ACOS */ { UNARY, "acos(" }, \ /* OP_ATAN */ { UNARY, "atan(" }, \ /* OP_LOG */ { UNARY, "log(" }, \ /* OP_EXP */ { UNARY, "exp(" }, \ /* OP_TRUNC */ { UNARY, "int(" }, \ /* OP_FLOAT */ { UNARY, "float(" }, \ /* OP_INCIDENT */ { BINARY, "incident(" }, \ /* OP_TRANS */ { TRIARY, "trans(" }, \ /* OP_ELLIPSE */ { TRIARY, "ellipse(" }, \ /* OP_RANDOM */ { UNARY, "DD_random(" }, \ /* OP_ARC */ { TRIARY, "arc(" }, \ /* OP_PI */ { CONSTANT, "PI" }, \ /* OP_SLASH_SLASH */ { INFIX, " // " }, \ /* OP_ITOS */ { UNARY, "str(" }, \ /* OP_RTOS */ { BINARY, "rtos(" }, \ /* OP_I */ { CONSTANT, "?1" }, \ /* OP_XI */ { CONSTANT, "?2" }, \ /* OP_FI */ { CONSTANT, "?3" }, \ /* OP_I_1 */ { CONSTANT, "?4" }, \ /* OP_XI_1 */ { CONSTANT, "?5" }, \ /* OP_FI_1 */ { CONSTANT, "?6" }, \ /* OP_GSPECLIST */{ OP_GSPECLIST, 0 }, \ /* OP_GSPEC */ { OP_GSPEC, 0 }, \ /* OP_GLOBAL */ { OP_GLOBAL, "" }, \ /* OP_FUNC */ { OP_FUNC, 0 }, \ /* OP_EDEN */ { OP_EDEN, 0 }, \ /* OP_IMGFUNC */ { OP_IMGFUNC, 0 }, \ /* OP_RECTANGLE */ { BINARY, "rectangle(" }, \ /* OP_REFLECT */ { BINARY, "reflect(" } \ } #define ORIGINAL \ { \ /* OP_INF */ { OP_INF, "inf" }, \ /* OP_ASSIGN */ { INFIX, " = " }, \ /* OP_PLUS */ { INFIX, " + " }, \ /* OP_MINUS */ { INFIX, " - " }, \ /* OP_MULT */ { INFIX, " * " }, \ /* OP_MOD */ { INFIX, " mod " }, \ /* OP_DIV */ { INFIX, " div " }, \ /* OP_UMINUS */ { UNARY, "-" }, \ /* OP_TILDE */ { UNARY, "~" }, \ /* OP_DOTX */ { POSTFIX, ".x" }, \ /* OP_DOTY */ { POSTFIX, ".y" }, \ /* OP_DOT1 */ { POSTFIX, ".1" }, \ /* OP_DOT2 */ { POSTFIX, ".2" }, \ /* OP_DOTRAD */ { POSTFIX, ".rad" }, \ /* OP_DOTARG */ { POSTFIX, ".arg" }, \ /* OP_CART */ { OP_CART, 0 }, \ /* OP_POLAR */ { OP_POLAR, 0 }, \ /* OP_LINE */ { OP_LINE, 0 }, \ /* OP_ROT */ { TRIARY, "rot(" }, \ /* OP_SCALE */ { BINARY, "scale(" }, \ /* OP_SLASH */ { OP_SLASH, "/" }, \ /* OP_ID */ { OP_ID, 0 }, \ /* OP_INUMBER*/ { OP_INUMBER , 0 }, \ /* OP_COMMA */ { INFIX, ", " }, \ /* OP_PAREN */ { UNARY, "(" }, \ /* OP_IF */ { OP_IF, 0 }, \ /* OP_VECT_ADD */ { INFIX, " + " }, \ /* OP_VECT_SUB */ { INFIX, " - " }, \ /* OP_SCALAR_MULT */ { INFIX, " * " }, \ /* OP_SCALAR_DIV */ { INFIX, " div " }, \ /* OP_SCALAR_MOD */ { BINARY, " mod " }, \ /* OP_COSINE */ { UNARY, "cos(" }, \ /* OP_SINE */ { UNARY, "sin(" }, \ /* OP_RNUMBER */ { OP_RNUMBER, 0 }, \ /* OP_INTERSECT */ { BINARY, "intersect(" }, \ /* OP_PARALLEL */ { QUADARY, "parallel(" }, \ /* OP_PERPEND */ { BINARY, "perpend(" }, \ /* OP_CIRCLE */ { BINARY, "circle(" }, \ /* OP_AND */ { INFIX, " && " }, \ /* OP_OR */ { INFIX, " || " }, \ /* OP_NOT */ { UNARY, "!" }, \ /* OP_BOOL */ { OP_BOOL, 0 }, \ /* OP_PT_BETWN_PTS */ { TRIARY, "pt_betwn_pts(" }, \ /* OP_COLINEAR */ { TRIARY, "colinear(" }, \ /* OP_INTERSECTS */ { BINARY, "intersects(" }, \ /* OP_SEPARATES */ { TRIARY, "separates(" }, \ /* OP_INCLUDES */ { BINARY, "includes(" }, \ /* OP_DISTLARGER */ { TRIARY, "distlarger(" }, \ /* OP_DISTSMALLER */ { TRIARY, "distsmaller(" }, \ /* OP_LABEL */ { BINARY, "label(" }, \ /* OP_MONITOR */ { OP_MONITOR, 0 }, \ /* OP_IMPOSE */ { OP_IMPOSE, 0 }, \ /* OP_CSTRING */ { OP_CSTRING, 0 }, \ /*OP_DISTANCE */ { BINARY, "dist(" }, \ /* OP_MIDPOINT */ { UNARY, "midpoint(" }, \ /* OP_EQ_EQ */ { INFIX, " == " }, \ /* OP_NOT_EQ */ { INFIX, " != " }, \ /* OP_GT */ { INFIX, " > " }, \ /* OP_GT_EQ */ { INFIX, " >= " }, \ /* OP_LT */ { INFIX, " < " }, \ /* OP_LT_EQ */ { INFIX, " <= " }, \ /* OP_SQRT */ { UNARY, "sqrt(" }, \ /* OP_TAN */ { UNARY, "tan(" }, \ /* OP_ASIN */ { UNARY, "asin(" }, \ /* OP_ACOS */ { UNARY, "acos(" }, \ /* OP_ATAN */ { UNARY, "atan(" }, \ /* OP_LOG */ { UNARY, "log(" }, \ /* OP_EXP */ { UNARY, "exp(" }, \ /* OP_TRUNC */ { UNARY, "trunc(" }, \ /* OP_FLOAT */ { UNARY, "float(" }, \ /* OP_INCIDENT */ { BINARY, "incident(" }, \ /* OP_TRANS */ { TRIARY, "trans(" }, \ /* OP_ELLIPSE */ { TRIARY, "ellipse(" }, \ /* OP_RANDOM */ { UNARY, "rand(" }, \ /* OP_ARC */ { OP_ARC, 0 }, \ /* OP_PI */ { CONSTANT, "pi" }, \ /* OP_SLASH_SLASH */ { INFIX, " // " }, \ /* OP_ITOS */ { UNARY, "itos(" }, \ /* OP_RTOS */ { BINARY, "rtos(" }, \ /* OP_I */ { CONSTANT, "" }, \ /* OP_XI */ { CONSTANT, "x" }, \ /* OP_FI */ { CONSTANT, "f" }, \ /* OP_I_1 */ { CONSTANT, "" }, \ /* OP_XI_1 */ { CONSTANT, "x" }, \ /* OP_FI_1 */ { CONSTANT, "f" }, \ /* OP_GSPECLIST */{ OP_GSPECLIST, ";\n\t" }, \ /* OP_GSPEC */ { OP_GSPEC, " : " }, \ /* OP_GLOBAL */ { OP_GLOBAL, "" }, \ /* OP_FUNC */ { OP_FUNC, 0 }, \ /* OP_EDEN */ { OP_EDEN, 0 }, \ /* OP_IMGFUNC */ { OP_IMGFUNC, 0 }, \ /* OP_RECTANGLE */ { BINARY, "rectangle(" }, \ /* OP_REFLECT */ { BINARY, "reflect(" } \ } tkeden1.41/Donald/parser.c010060000025250000164000002654000743724013500154670ustar00ashleyem00003510000005 /* A Bison parser, made from parser.y by GNU Bison version 1.27 */ #define YYBISON 1 /* Identify Bison output. */ #define yyparse dd_parse #define yylex dd_lex #define yyerror dd_error #define yylval dd_lval #define yychar dd_char #define yydebug dd_debug #define yynerrs dd_nerrs #define INF 257 #define PI 258 #define I 259 #define XI 260 #define FI 261 #define I_1 262 #define XI_1 263 #define FI_1 264 #define IMAGE 265 #define MYCHAR 266 #define REAL 267 #define INT 268 #define BOOLEAN 269 #define POINT 270 #define LABEL 271 #define GSPEC 272 #define GSPECLIST 273 #define ANY 274 #define LINE 275 #define CIRCLE 276 #define ELLIPSE 277 #define SHAPE 278 #define OPENSHAPE 279 #define ARC 280 #define RECTANGLE 281 #define GRAPH 282 #define OF 283 #define VIEWPORT 284 #define DELETE 285 #define WITHIN 286 #define IF 287 #define THEN 288 #define ELSE 289 #define ID 290 #define IMGFUNC 291 #define CSTRING 292 #define BOOL 293 #define INUMBER 294 #define RNUMBER 295 #define ITOS 296 #define RTOS 297 #define TRUNC 298 #define FLOAT 299 #define SQRT 300 #define SIN 301 #define COS 302 #define TAN 303 #define ASIN 304 #define ACOS 305 #define ATAN 306 #define LOG 307 #define EXP 308 #define RANDOM 309 #define ROT 310 #define SCALE 311 #define TRANS 312 #define REFLECT 313 #define INTERSECT 314 #define PARALLEL 315 #define PERPEND 316 #define DISTANCE 317 #define MIDPOINT 318 #define PT_BETWN_PTS 319 #define COLINEAR 320 #define INTERSECTS 321 #define SEPARATES 322 #define INCLUDES 323 #define INCIDENT 324 #define DISTLARGER 325 #define DISTSMALLER 326 #define QUERY 327 #define SEMICOLON 328 #define COLON 329 #define EQUALS 330 #define COMMA 331 #define OR 332 #define AND 333 #define NOT 334 #define EQ_EQ 335 #define NOT_EQ 336 #define GT 337 #define GT_EQ 338 #define LT 339 #define LT_EQ 340 #define SLASH_SLASH 341 #define ATSIGN 342 #define PLUS 343 #define MINUS 344 #define STAR 345 #define PERCENT 346 #define DIV 347 #define MOD 348 #define TILDE 349 #define TILDE_SLASH 350 #define DOTX 351 #define DOTY 352 #define DOTARG 353 #define DOTRAD 354 #define DOT1 355 #define DOT2 356 #define UMINUS 357 #define SLASH 358 #define LID 359 #define AMPERSAND 360 #define HASH 361 #define VERTBAR 362 #define NEWLINE 363 #define LPAREN 364 #define RPAREN 365 #define LBRACK 366 #define RBRACK 367 #define LCURLY 368 #define RCURLY 369 #define LANGLE 370 #define RANGLE 371 #line 1 "parser.y" /* * $Id: parser.y,v 1.16 2001/12/06 22:27:37 cssbz Exp $ */ /* This is from the Autoconf manual. Note the pragma directive is indented so that pre-ANSI C compilers will ignore it. [Ash] */ /* AIX requires this to be the first thing in the file */ #ifdef __GNUC__ # define alloca __builtin_alloca #else # if HAVE_ALLOCA_H # include # else # ifdef _AIX #pragma alloca # else # ifndef alloca /* predefined by HP cc +Olibcalls */ char *alloca (); # endif # endif # endif #endif static char rcsid[] = "$Id: parser.y,v 1.16 2001/12/06 22:27:37 cssbz Exp $"; #include "../config.h" #include #include #include #include "tree.h" #include "symbol.h" #include "error.h" #include "../Eden/error.h" #include "oper.h" #include "../EX/script.h" #include "../Eden/emalloc.h" #ifdef HAVE_DMALLOC #include #endif #define YYERROR_VERBOSE 1 #ifdef DEBUG extern int Debug; #define display(a) if (Debug & 16) fprintf(stderr, a) #define display2(a,i) if (Debug & 16) fprintf(stderr, a, i) #endif #ifndef DEBUG #define display(a) /* nothing */ #define display2(a,i) /* nothing */ #endif #define ERROR -1 extern Script *dd_script; extern int _changed; extern void eden_declare(char *, int, char *); extern void declare_openshape(void); extern void Declare(int, tree); extern void DeclareGraph(tree); extern void Define(tree, tree); extern void DefineFunc(int, tree); extern void Delete(tree); extern int reset_context(void); extern void change_scope(tree); extern void resume_scope(void); extern int count_id(tree); extern int count_expr(tree); extern void freeTree(tree); extern void yyerror(char *); extern char *expr_to_donald_name(tree); extern char *expr_to_eden_name(tree); extern char *eden_full_name(char *); static char *withinName; static char temp[256]; extern int dd_appAgentName; #ifdef DISTRIB extern void propagateDonaldDef(char *, char *); /* for agency --sun */ extern int handle_check1(char *); int withinHandle=1; #endif /* DISTRIB */ #line 89 "parser.y" typedef union { char *s; /* identifier, etc */ int i; /* integer value */ double r; /* floating point value */ tree t; /* expression tree */ } YYSTYPE; #include #ifndef __cplusplus #ifndef __STDC__ #define const #endif #endif #define YYFINAL 277 #define YYFLAG -32768 #define YYNTBASE 118 #define YYTRANSLATE(x) ((unsigned)(x) <= 371 ? yytranslate[x] : 140) static const char yytranslate[] = { 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117 }; #if YYDEBUG != 0 static const short yyprhs[] = { 0, 0, 1, 4, 7, 10, 12, 14, 15, 18, 20, 22, 24, 28, 31, 34, 40, 45, 47, 50, 54, 57, 59, 61, 63, 65, 67, 69, 71, 73, 75, 77, 79, 81, 83, 85, 90, 95, 100, 103, 107, 109, 113, 115, 117, 119, 121, 123, 125, 127, 129, 131, 133, 135, 137, 141, 146, 148, 151, 155, 161, 167, 173, 181, 188, 195, 204, 211, 215, 219, 223, 227, 231, 234, 237, 241, 245, 249, 253, 257, 261, 265, 269, 273, 278, 285, 288, 291, 294, 297, 300, 303, 308, 314, 318, 323, 328, 335, 344, 355, 362, 364, 366, 368, 370, 372, 374, 376, 378, 380, 382, 384, 386, 388, 390, 392, 394, 396, 398, 400, 402, 404, 406, 408, 410, 412, 414, 416, 418, 420, 423, 427, 430, 432, 434, 436, 437, 439, 443, 448, 451, 455, 459 }; static const short yyrhs[] = { -1, 118, 119, 0, 118, 1, 0, 30, 36, 0, 125, 0, 127, 0, 0, 120, 128, 0, 123, 0, 121, 0, 109, 0, 31, 129, 109, 0, 32, 134, 0, 122, 119, 0, 122, 109, 114, 124, 115, 0, 122, 114, 124, 115, 0, 119, 0, 124, 119, 0, 126, 129, 109, 0, 28, 129, 0, 14, 0, 13, 0, 12, 0, 15, 0, 16, 0, 21, 0, 26, 0, 22, 0, 23, 0, 17, 0, 24, 0, 25, 0, 11, 0, 27, 0, 129, 76, 129, 109, 0, 6, 76, 130, 109, 0, 7, 76, 130, 109, 0, 73, 109, 0, 128, 73, 109, 0, 130, 0, 129, 77, 130, 0, 3, 0, 4, 0, 40, 0, 41, 0, 38, 0, 39, 0, 5, 0, 6, 0, 7, 0, 8, 0, 9, 0, 10, 0, 112, 138, 113, 0, 112, 109, 138, 113, 0, 134, 0, 36, 80, 0, 110, 130, 111, 0, 114, 130, 77, 130, 115, 0, 114, 130, 88, 130, 115, 0, 112, 130, 77, 130, 113, 0, 112, 130, 77, 130, 77, 130, 113, 0, 22, 110, 130, 77, 130, 111, 0, 27, 110, 130, 77, 130, 111, 0, 23, 110, 130, 77, 130, 77, 130, 111, 0, 17, 110, 130, 77, 130, 111, 0, 130, 89, 130, 0, 130, 90, 130, 0, 130, 91, 130, 0, 130, 94, 130, 0, 130, 93, 130, 0, 90, 130, 0, 80, 130, 0, 130, 79, 130, 0, 130, 78, 130, 0, 130, 81, 130, 0, 130, 82, 130, 0, 130, 85, 130, 0, 130, 86, 130, 0, 130, 83, 130, 0, 130, 84, 130, 0, 130, 87, 130, 0, 42, 110, 130, 111, 0, 43, 110, 130, 77, 130, 111, 0, 130, 97, 0, 130, 98, 0, 130, 101, 0, 130, 102, 0, 130, 100, 0, 130, 99, 0, 36, 80, 110, 111, 0, 36, 80, 110, 129, 111, 0, 37, 110, 111, 0, 37, 110, 129, 111, 0, 131, 110, 130, 111, 0, 132, 110, 130, 77, 130, 111, 0, 133, 110, 130, 77, 130, 77, 130, 111, 0, 61, 110, 130, 77, 130, 77, 130, 77, 130, 111, 0, 33, 130, 34, 130, 35, 130, 0, 46, 0, 47, 0, 48, 0, 49, 0, 50, 0, 51, 0, 52, 0, 53, 0, 54, 0, 44, 0, 45, 0, 64, 0, 55, 0, 60, 0, 62, 0, 63, 0, 57, 0, 67, 0, 69, 0, 70, 0, 59, 0, 56, 0, 58, 0, 65, 0, 66, 0, 68, 0, 71, 0, 72, 0, 135, 0, 104, 135, 0, 136, 104, 135, 0, 96, 135, 0, 136, 0, 137, 0, 36, 0, 0, 139, 0, 138, 74, 139, 0, 138, 74, 109, 139, 0, 126, 75, 0, 126, 75, 130, 0, 126, 75, 109, 0, 126, 75, 130, 109, 0 }; #endif #if YYDEBUG != 0 static const short yyrline[] = { 0, 168, 170, 171, 174, 176, 185, 186, 187, 188, 193, 199, 219, 231, 259, 274, 288, 303, 305, 308, 320, 368, 370, 371, 372, 373, 374, 375, 376, 377, 378, 379, 380, 381, 382, 385, 415, 421, 429, 435, 442, 444, 482, 485, 489, 494, 500, 506, 511, 512, 513, 514, 515, 516, 518, 520, 523, 525, 527, 529, 531, 533, 535, 537, 539, 541, 543, 546, 547, 548, 549, 550, 551, 557, 558, 559, 560, 561, 562, 563, 564, 565, 567, 568, 570, 573, 574, 575, 576, 577, 578, 580, 582, 584, 586, 588, 590, 592, 594, 598, 605, 607, 608, 609, 610, 611, 612, 613, 614, 615, 616, 617, 618, 621, 623, 624, 625, 626, 627, 628, 629, 632, 634, 635, 636, 637, 638, 639, 642, 644, 648, 651, 656, 659, 663, 666, 668, 669, 671, 675, 677, 678, 679 }; #endif #if YYDEBUG != 0 || defined (YYERROR_VERBOSE) static const char * const yytname[] = { "$","error","$undefined.","INF","PI", "I","XI","FI","I_1","XI_1","FI_1","IMAGE","MYCHAR","REAL","INT","BOOLEAN","POINT", "LABEL","GSPEC","GSPECLIST","ANY","LINE","CIRCLE","ELLIPSE","SHAPE","OPENSHAPE", "ARC","RECTANGLE","GRAPH","OF","VIEWPORT","DELETE","WITHIN","IF","THEN","ELSE", "ID","IMGFUNC","CSTRING","BOOL","INUMBER","RNUMBER","ITOS","RTOS","TRUNC","FLOAT", "SQRT","SIN","COS","TAN","ASIN","ACOS","ATAN","LOG","EXP","RANDOM","ROT","SCALE", "TRANS","REFLECT","INTERSECT","PARALLEL","PERPEND","DISTANCE","MIDPOINT","PT_BETWN_PTS", "COLINEAR","INTERSECTS","SEPARATES","INCLUDES","INCIDENT","DISTLARGER","DISTSMALLER", "QUERY","SEMICOLON","COLON","EQUALS","COMMA","OR","AND","NOT","EQ_EQ","NOT_EQ", "GT","GT_EQ","LT","LT_EQ","SLASH_SLASH","ATSIGN","PLUS","MINUS","STAR","PERCENT", "DIV","MOD","TILDE","TILDE_SLASH","DOTX","DOTY","DOTARG","DOTRAD","DOT1","DOT2", "UMINUS","SLASH","LID","AMPERSAND","HASH","VERTBAR","NEWLINE","LPAREN","RPAREN", "LBRACK","RBRACK","LCURLY","RCURLY","LANGLE","RANGLE","program_list","stmt", "@1","delete","within_id","within_clause","stmt_list","declaration","type_name", "definition","evaluation","expr_list","expr","func1","func2","func3","identifier", "local_identifier","local_id","id","graph_spec_list","graph_spec", NULL }; #endif static const short yyr1[] = { 0, 118, 118, 118, 119, 119, 119, 120, 119, 119, 119, 119, 121, 122, 123, 123, 123, 124, 124, 125, 125, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 127, 127, 127, 128, 128, 129, 129, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 132, 132, 132, 132, 132, 132, 132, 132, 133, 133, 133, 133, 133, 133, 133, 134, 134, 135, 135, 135, 136, 137, 138, 138, 138, 138, 139, 139, 139, 139 }; static const short yyr2[] = { 0, 0, 2, 2, 2, 1, 1, 0, 2, 1, 1, 1, 3, 2, 2, 5, 4, 1, 2, 3, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 4, 4, 4, 2, 3, 1, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3, 4, 1, 2, 3, 5, 5, 5, 7, 6, 6, 8, 6, 3, 3, 3, 3, 3, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 4, 6, 2, 2, 2, 2, 2, 2, 4, 5, 3, 4, 4, 6, 8, 10, 6, 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, 2, 3, 2, 1, 1, 1, 0, 1, 3, 4, 2, 3, 3, 4 }; static const short yydefact[] = { 1, 0, 3, 42, 43, 48, 49, 50, 51, 52, 53, 33, 23, 22, 21, 24, 25, 30, 26, 28, 29, 31, 32, 27, 34, 0, 0, 0, 0, 0, 134, 0, 46, 47, 44, 45, 0, 0, 109, 110, 100, 101, 102, 103, 104, 105, 106, 107, 108, 112, 121, 116, 122, 120, 113, 0, 114, 115, 111, 123, 124, 117, 125, 118, 119, 126, 127, 0, 0, 0, 0, 11, 0, 135, 0, 2, 0, 10, 7, 9, 5, 0, 6, 0, 40, 0, 0, 0, 56, 128, 132, 133, 0, 0, 0, 0, 0, 0, 49, 50, 0, 0, 0, 0, 20, 4, 0, 134, 13, 0, 57, 0, 0, 0, 0, 73, 72, 131, 129, 0, 135, 0, 0, 0, 136, 0, 0, 8, 11, 7, 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 85, 86, 90, 89, 87, 88, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 12, 0, 0, 93, 0, 0, 0, 0, 58, 30, 28, 29, 34, 0, 139, 0, 0, 54, 0, 0, 38, 0, 7, 17, 7, 40, 19, 0, 41, 75, 74, 76, 77, 80, 81, 78, 79, 82, 67, 68, 69, 71, 70, 0, 0, 0, 130, 36, 37, 0, 0, 0, 0, 0, 91, 0, 94, 83, 0, 0, 55, 141, 140, 0, 0, 137, 0, 0, 39, 7, 16, 18, 35, 95, 0, 0, 0, 0, 0, 0, 0, 92, 0, 0, 142, 0, 61, 138, 59, 60, 15, 0, 0, 66, 63, 0, 64, 99, 84, 0, 0, 96, 0, 0, 0, 62, 0, 65, 0, 97, 0, 98, 0, 0 }; static const short yydefgoto[] = { 1, 187, 76, 77, 78, 79, 188, 80, 81, 82, 127, 83, 84, 85, 86, 87, 88, 89, 90, 91, 123, 124 }; static const short yypact[] = {-32768, 241,-32768,-32768,-32768,-32768, -62, -60,-32768,-32768,-32768, -32768,-32768,-32768,-32768,-32768,-32768, -97,-32768, -92, -90, -32768,-32768,-32768, -87, 1251, -2, 1251, -27, 1251, -45, -74,-32768,-32768,-32768,-32768, -68, -64,-32768,-32768,-32768, -32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, -32768,-32768,-32768,-32768, -55,-32768,-32768,-32768,-32768,-32768, -32768,-32768,-32768,-32768,-32768,-32768, 1251, 1251, -26, -26, -32768, 1251, 803, 1251,-32768, -25,-32768, 579,-32768,-32768, 1251,-32768, -50, 2210, -54, -53, -52,-32768,-32768, -44, -32768, 1251, 1251, 1251, 1251, 1251, 1251,-32768,-32768, -97, -92, -90, -87, -28,-32768, -72,-32768,-32768, 1290, -49, 915, 1251, 1251, 1251, 2256,-32768,-32768,-32768, 1419, 415, -21, 1873, -66,-32768, 1847, -47, -1, -41, 691,-32768, -58, 1251, 1251, 1251, 1251, 1251, 1251, 1251, 1251, 1251, 1251, 1251, 1251, 1251, 1251, 1251, 1251,-32768,-32768,-32768, -32768,-32768,-32768, 1251, 1251, 1251, -26, 1760, 1789, 1899, 1925, 1951, 1977,-32768, 1251, 1027,-32768, -71, 1450, 2003, 2029,-32768,-32768,-32768,-32768,-32768, -63, 1139, 1251, 117, -32768, 1251, 1251,-32768, -35, 691,-32768, 353, 1847,-32768, -56, 2210, 2234, 2256, 2276, 2276, 2292, 2292, 2292, 2292, 106, -69, -69, -6, -6, -6, 1481, 2055, 2081,-32768, -32768,-32768, 1251, 1251, 1251, 1251, 1315,-32768, -70,-32768, -32768, 1251, 1251,-32768,-32768, 1818, 1394, 415,-32768, 1340, 1367,-32768, 466,-32768,-32768,-32768,-32768, 1251, 1251, 1512, 1543, 2107, 1574, 1251,-32768, 1605, 2133,-32768, 1251,-32768, -32768,-32768,-32768,-32768, 1636, 2159,-32768,-32768, 1251,-32768, 2210,-32768, 1251, 79,-32768, 1251, 1667, 2185,-32768, 1698, -32768, 1251,-32768, 1729,-32768, 75,-32768 }; static const short yypgoto[] = {-32768, 0,-32768,-32768,-32768,-32768, -110,-32768, -61,-32768,-32768, -10, -29,-32768,-32768,-32768, 51, -67,-32768,-32768, -40, -176 }; #define YYLAST 2394 static const short yytable[] = { 109, 75, 117, 118, 229, 133, 133, 133, 180, 107, 107, 180, 121, 94, 92, 104, 93, 106, 95, 133, 96, 133, 145, 97, 146, 147, 132, 133, 148, 149, 150, 151, 152, 153, 105, 110, 111, 164, 115, 116, 220, 245, 112, 119, 122, 125, 113, 181, 126, 133, 224, 190, 251, 236, 178, 114, 154, 155, 156, 121, 157, 166, 184, 158, 159, 160, 161, 162, 163, 69, 69, 131, 185, 186, 232, 277, 233, 70, 130, 108, 177, 0, 0, 169, 170, 171, 0, 0, 0, 0, 210, 148, 149, 150, 151, 152, 153, 0, 0, 0, 189, 168, 0, 0, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 121, 0, 0, 191, 0, 0, 207, 208, 209, 11, 12, 13, 14, 15, 16, 173, 0, 217, 0, 18, 174, 175, 21, 22, 23, 176, 0, 0, 0, 0, 226, 227, 0, 0, 230, 231, 0, 219, 134, 135, 0, 136, 137, 138, 139, 140, 141, 142, 121, 143, 144, 145, 0, 146, 147, 0, 0, 148, 149, 150, 151, 152, 153, 0, 0, 240, 241, 242, 243, 235, 0, 0, 0, 269, 246, 247, 143, 144, 145, 0, 146, 147, 0, 0, 148, 149, 150, 151, 152, 153, 255, 256, 0, 0, 0, 0, 261, 0, 0, 0, 0, 264, 0, 0, 0, 0, 0, 228, 0, 0, 0, 267, 0, 0, 235, 268, 0, 0, 270, 0, 0, 0, 276, 2, 274, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 0, 0, 0, 18, 19, 20, 21, 22, 23, 24, 25, 0, 26, 27, 28, 29, 0, 0, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, -7, 0, 0, 0, 0, 0, 0, 67, 0, 0, 0, 0, 0, 0, 0, 0, 0, 68, 0, 0, 0, 0, 0, 69, 0, 0, 0, 0, 0, 0, 0, 70, 0, 0, 0, 0, 71, 72, 0, 73, 0, 74, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 0, 0, 0, 18, 19, 20, 21, 22, 23, 24, 25, 0, 26, 27, 28, 29, 0, 0, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 11, 12, 13, 14, 15, 16, 173, 67, 0, 0, 18, 174, 175, 21, 22, 23, 176, 68, 0, 0, 0, 0, 0, 69, 0, 0, 0, 0, 0, 0, 0, 70, 0, 0, 0, 0, 71, 72, 0, 73, 0, 74, 234, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 0, 0, 0, 18, 19, 20, 21, 22, 23, 24, 25, 0, 26, 27, 28, 29, 0, 0, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 0, 0, 0, 0, 0, 0, 0, 67, 0, 0, 0, 0, 0, 0, 0, 0, 0, 68, 0, 0, 0, 0, 0, 69, 0, 0, 0, 0, 0, 0, 0, 70, 0, 0, 0, 0, 71, 72, 0, 73, 0, 74, 254, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 0, 0, 0, 18, 19, 20, 21, 22, 23, 24, 25, 0, 26, 27, 28, 29, 0, 0, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 0, 0, 0, 0, 0, 0, 0, 67, 0, 0, 0, 0, 0, 0, 0, 0, 0, 68, 0, 0, 0, 0, 0, 69, 0, 0, 0, 0, 0, 0, 0, 70, 0, 0, 0, 0, 128, 72, 0, 73, 0, 129, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 0, 0, 0, 18, 19, 20, 21, 22, 23, 24, 25, 0, 26, 27, 28, 29, 0, 0, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 0, 0, 0, 0, 0, 0, 0, 67, 0, 0, 0, 0, 0, 0, 0, 0, 0, 68, 0, 0, 0, 0, 0, 69, 0, 0, 0, 0, 0, 0, 0, 70, 0, 0, 0, 0, 71, 72, 0, 73, 0, 74, 3, 4, 5, 98, 99, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 0, 0, 0, 18, 19, 20, 21, 22, 23, 24, 0, 0, 0, 0, 0, 29, 0, 0, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 0, 0, 0, 0, 0, 0, 0, 67, 0, 0, 0, 0, 0, 0, 0, 0, 0, 68, 0, 0, 0, 0, 0, 69, 0, 0, 0, 0, 0, 0, 0, 70, 0, 0, 0, 0, 120, 72, 0, 73, 0, 74, 3, 4, 5, 98, 99, 8, 9, 10, 0, 0, 0, 0, 0, 0, 100, 0, 0, 0, 0, 101, 102, 0, 0, 0, 103, 0, 0, 0, 0, 0, 29, 0, 0, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 0, 0, 0, 0, 0, 0, 0, 67, 0, 0, 0, 0, 0, 0, 0, 0, 0, 68, 0, 0, 0, 0, 0, 69, 0, 0, 0, 0, 0, 0, 0, 70, 0, 0, 0, 0, 0, 72, 167, 73, 0, 74, 3, 4, 5, 98, 99, 8, 9, 10, 0, 0, 0, 0, 0, 0, 100, 0, 0, 0, 0, 101, 102, 0, 0, 0, 103, 0, 0, 0, 0, 0, 29, 0, 0, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 0, 0, 0, 0, 0, 0, 0, 67, 0, 0, 0, 0, 0, 0, 0, 0, 0, 68, 0, 0, 0, 0, 0, 69, 0, 0, 0, 0, 0, 0, 0, 70, 0, 0, 0, 0, 0, 72, 218, 73, 0, 74, 3, 4, 5, 98, 99, 8, 9, 10, 0, 0, 0, 0, 0, 0, 100, 0, 0, 0, 0, 101, 102, 0, 0, 0, 103, 0, 0, 0, 0, 0, 29, 0, 0, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 0, 0, 0, 0, 0, 0, 0, 67, 0, 0, 0, 0, 0, 0, 0, 0, 0, 68, 0, 0, 0, 0, 0, 69, 0, 0, 0, 0, 0, 0, 0, 70, 0, 0, 0, 0, 225, 72, 0, 73, 0, 74, 3, 4, 5, 98, 99, 8, 9, 10, 0, 0, 0, 0, 0, 0, 100, 0, 0, 0, 0, 101, 102, 0, 0, 0, 103, 0, 0, 0, 0, 0, 29, 0, 0, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 165, 0, 0, 0, 0, 0, 0, 67, 0, 0, 0, 0, 0, 0, 0, 0, 0, 68, 0, 0, 0, 0, 0, 69, 0, 0, 244, 0, 0, 0, 0, 70, 0, 0, 0, 0, 0, 72, 0, 73, 0, 74, 0, 0, 134, 135, 0, 136, 137, 138, 139, 140, 141, 142, 0, 143, 144, 145, 0, 146, 147, 0, 0, 148, 149, 150, 151, 152, 153, 134, 135, 0, 136, 137, 138, 139, 140, 141, 142, 0, 143, 144, 145, 0, 146, 147, 0, 0, 148, 149, 150, 151, 152, 153, 134, 135, 0, 136, 137, 138, 139, 140, 141, 142, 0, 143, 144, 145, 0, 146, 147, 0, 0, 148, 149, 150, 151, 152, 153, 0, 0, 134, 135, 0, 136, 137, 138, 139, 140, 141, 142, 252, 143, 144, 145, 0, 146, 147, 0, 0, 148, 149, 150, 151, 152, 153, 0, 249, 134, 135, 0, 136, 137, 138, 139, 140, 141, 142, 253, 143, 144, 145, 0, 146, 147, 0, 0, 148, 149, 150, 151, 152, 153, 134, 135, 0, 136, 137, 138, 139, 140, 141, 142, 250, 143, 144, 145, 0, 146, 147, 0, 0, 148, 149, 150, 151, 152, 153, 0, 0, 0, 0, 0, 0, 134, 135, 172, 136, 137, 138, 139, 140, 141, 142, 0, 143, 144, 145, 0, 146, 147, 0, 0, 148, 149, 150, 151, 152, 153, 0, 0, 0, 0, 0, 0, 134, 135, 221, 136, 137, 138, 139, 140, 141, 142, 0, 143, 144, 145, 0, 146, 147, 0, 0, 148, 149, 150, 151, 152, 153, 0, 0, 0, 0, 0, 0, 134, 135, 237, 136, 137, 138, 139, 140, 141, 142, 0, 143, 144, 145, 0, 146, 147, 0, 0, 148, 149, 150, 151, 152, 153, 0, 0, 0, 0, 0, 0, 134, 135, 257, 136, 137, 138, 139, 140, 141, 142, 0, 143, 144, 145, 0, 146, 147, 0, 0, 148, 149, 150, 151, 152, 153, 0, 0, 0, 0, 0, 0, 134, 135, 258, 136, 137, 138, 139, 140, 141, 142, 0, 143, 144, 145, 0, 146, 147, 0, 0, 148, 149, 150, 151, 152, 153, 0, 0, 0, 0, 0, 0, 134, 135, 260, 136, 137, 138, 139, 140, 141, 142, 0, 143, 144, 145, 0, 146, 147, 0, 0, 148, 149, 150, 151, 152, 153, 0, 0, 0, 0, 0, 0, 134, 135, 262, 136, 137, 138, 139, 140, 141, 142, 0, 143, 144, 145, 0, 146, 147, 0, 0, 148, 149, 150, 151, 152, 153, 0, 0, 0, 0, 0, 0, 134, 135, 265, 136, 137, 138, 139, 140, 141, 142, 0, 143, 144, 145, 0, 146, 147, 0, 0, 148, 149, 150, 151, 152, 153, 0, 0, 0, 0, 0, 0, 134, 135, 271, 136, 137, 138, 139, 140, 141, 142, 0, 143, 144, 145, 0, 146, 147, 0, 0, 148, 149, 150, 151, 152, 153, 0, 0, 0, 0, 0, 0, 134, 135, 273, 136, 137, 138, 139, 140, 141, 142, 0, 143, 144, 145, 0, 146, 147, 0, 0, 148, 149, 150, 151, 152, 153, 0, 0, 0, 0, 0, 0, 134, 135, 275, 136, 137, 138, 139, 140, 141, 142, 0, 143, 144, 145, 0, 146, 147, 0, 0, 148, 149, 150, 151, 152, 153, 0, 0, 0, 0, 134, 135, 211, 136, 137, 138, 139, 140, 141, 142, 0, 143, 144, 145, 0, 146, 147, 0, 0, 148, 149, 150, 151, 152, 153, 0, 0, 0, 0, 134, 135, 212, 136, 137, 138, 139, 140, 141, 142, 0, 143, 144, 145, 0, 146, 147, 0, 0, 148, 149, 150, 151, 152, 153, 0, 0, 0, 182, 134, 135, 248, 136, 137, 138, 139, 140, 141, 142, 183, 143, 144, 145, 0, 146, 147, 0, 0, 148, 149, 150, 151, 152, 153, 179, 134, 135, 0, 136, 137, 138, 139, 140, 141, 142, 0, 143, 144, 145, 0, 146, 147, 0, 0, 148, 149, 150, 151, 152, 153, 213, 134, 135, 0, 136, 137, 138, 139, 140, 141, 142, 0, 143, 144, 145, 0, 146, 147, 0, 0, 148, 149, 150, 151, 152, 153, 214, 134, 135, 0, 136, 137, 138, 139, 140, 141, 142, 0, 143, 144, 145, 0, 146, 147, 0, 0, 148, 149, 150, 151, 152, 153, 215, 134, 135, 0, 136, 137, 138, 139, 140, 141, 142, 0, 143, 144, 145, 0, 146, 147, 0, 0, 148, 149, 150, 151, 152, 153, 216, 134, 135, 0, 136, 137, 138, 139, 140, 141, 142, 0, 143, 144, 145, 0, 146, 147, 0, 0, 148, 149, 150, 151, 152, 153, 222, 134, 135, 0, 136, 137, 138, 139, 140, 141, 142, 0, 143, 144, 145, 0, 146, 147, 0, 0, 148, 149, 150, 151, 152, 153, 223, 134, 135, 0, 136, 137, 138, 139, 140, 141, 142, 0, 143, 144, 145, 0, 146, 147, 0, 0, 148, 149, 150, 151, 152, 153, 238, 134, 135, 0, 136, 137, 138, 139, 140, 141, 142, 0, 143, 144, 145, 0, 146, 147, 0, 0, 148, 149, 150, 151, 152, 153, 239, 134, 135, 0, 136, 137, 138, 139, 140, 141, 142, 0, 143, 144, 145, 0, 146, 147, 0, 0, 148, 149, 150, 151, 152, 153, 259, 134, 135, 0, 136, 137, 138, 139, 140, 141, 142, 0, 143, 144, 145, 0, 146, 147, 0, 0, 148, 149, 150, 151, 152, 153, 263, 134, 135, 0, 136, 137, 138, 139, 140, 141, 142, 0, 143, 144, 145, 0, 146, 147, 0, 0, 148, 149, 150, 151, 152, 153, 266, 134, 135, 0, 136, 137, 138, 139, 140, 141, 142, 0, 143, 144, 145, 0, 146, 147, 0, 0, 148, 149, 150, 151, 152, 153, 272, 134, 135, 0, 136, 137, 138, 139, 140, 141, 142, 0, 143, 144, 145, 0, 146, 147, 0, 0, 148, 149, 150, 151, 152, 153, 134, 135, 0, 136, 137, 138, 139, 140, 141, 142, 0, 143, 144, 145, 0, 146, 147, 0, 0, 148, 149, 150, 151, 152, 153, 135, 0, 136, 137, 138, 139, 140, 141, 142, 0, 143, 144, 145, 0, 146, 147, 0, 0, 148, 149, 150, 151, 152, 153, 136, 137, 138, 139, 140, 141, 142, 0, 143, 144, 145, 0, 146, 147, 0, 0, 148, 149, 150, 151, 152, 153, 138, 139, 140, 141, 142, 0, 143, 144, 145, 0, 146, 147, 0, 0, 148, 149, 150, 151, 152, 153, 142, 0, 143, 144, 145, 0, 146, 147, 0, 0, 148, 149, 150, 151, 152, 153 }; static const short yycheck[] = { 29, 1, 69, 70, 180, 77, 77, 77, 74, 36, 36, 74, 73, 110, 76, 25, 76, 27, 110, 77, 110, 77, 91, 110, 93, 94, 76, 77, 97, 98, 99, 100, 101, 102, 36, 80, 110, 109, 67, 68, 111, 111, 110, 72, 73, 74, 110, 113, 73, 77, 113, 109, 228, 109, 75, 110, 110, 110, 110, 120, 104, 110, 109, 92, 93, 94, 95, 96, 97, 96, 96, 81, 73, 114, 109, 0, 186, 104, 78, 28, 120, -1, -1, 112, 113, 114, -1, -1, -1, -1, 157, 97, 98, 99, 100, 101, 102, -1, -1, -1, 129, 111, -1, -1, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 180, -1, -1, 132, -1, -1, 154, 155, 156, 11, 12, 13, 14, 15, 16, 17, -1, 165, -1, 21, 22, 23, 24, 25, 26, 27, -1, -1, -1, -1, 178, 179, -1, -1, 182, 183, -1, 166, 78, 79, -1, 81, 82, 83, 84, 85, 86, 87, 228, 89, 90, 91, -1, 93, 94, -1, -1, 97, 98, 99, 100, 101, 102, -1, -1, 213, 214, 215, 216, 188, -1, -1, -1, 113, 222, 223, 89, 90, 91, -1, 93, 94, -1, -1, 97, 98, 99, 100, 101, 102, 238, 239, -1, -1, -1, -1, 244, -1, -1, -1, -1, 249, -1, -1, -1, -1, -1, 109, -1, -1, -1, 259, -1, -1, 233, 263, -1, -1, 266, -1, -1, -1, 0, 1, 272, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, -1, -1, -1, 21, 22, 23, 24, 25, 26, 27, 28, -1, 30, 31, 32, 33, -1, -1, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, -1, -1, -1, -1, -1, -1, 80, -1, -1, -1, -1, -1, -1, -1, -1, -1, 90, -1, -1, -1, -1, -1, 96, -1, -1, -1, -1, -1, -1, -1, 104, -1, -1, -1, -1, 109, 110, -1, 112, -1, 114, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, -1, -1, -1, 21, 22, 23, 24, 25, 26, 27, 28, -1, 30, 31, 32, 33, -1, -1, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 11, 12, 13, 14, 15, 16, 17, 80, -1, -1, 21, 22, 23, 24, 25, 26, 27, 90, -1, -1, -1, -1, -1, 96, -1, -1, -1, -1, -1, -1, -1, 104, -1, -1, -1, -1, 109, 110, -1, 112, -1, 114, 115, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, -1, -1, -1, 21, 22, 23, 24, 25, 26, 27, 28, -1, 30, 31, 32, 33, -1, -1, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, -1, -1, -1, -1, -1, -1, -1, 80, -1, -1, -1, -1, -1, -1, -1, -1, -1, 90, -1, -1, -1, -1, -1, 96, -1, -1, -1, -1, -1, -1, -1, 104, -1, -1, -1, -1, 109, 110, -1, 112, -1, 114, 115, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, -1, -1, -1, 21, 22, 23, 24, 25, 26, 27, 28, -1, 30, 31, 32, 33, -1, -1, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, -1, -1, -1, -1, -1, -1, -1, 80, -1, -1, -1, -1, -1, -1, -1, -1, -1, 90, -1, -1, -1, -1, -1, 96, -1, -1, -1, -1, -1, -1, -1, 104, -1, -1, -1, -1, 109, 110, -1, 112, -1, 114, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, -1, -1, -1, 21, 22, 23, 24, 25, 26, 27, 28, -1, 30, 31, 32, 33, -1, -1, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, -1, -1, -1, -1, -1, -1, -1, 80, -1, -1, -1, -1, -1, -1, -1, -1, -1, 90, -1, -1, -1, -1, -1, 96, -1, -1, -1, -1, -1, -1, -1, 104, -1, -1, -1, -1, 109, 110, -1, 112, -1, 114, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, -1, -1, -1, 21, 22, 23, 24, 25, 26, 27, -1, -1, -1, -1, -1, 33, -1, -1, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, -1, -1, -1, -1, -1, -1, -1, 80, -1, -1, -1, -1, -1, -1, -1, -1, -1, 90, -1, -1, -1, -1, -1, 96, -1, -1, -1, -1, -1, -1, -1, 104, -1, -1, -1, -1, 109, 110, -1, 112, -1, 114, 3, 4, 5, 6, 7, 8, 9, 10, -1, -1, -1, -1, -1, -1, 17, -1, -1, -1, -1, 22, 23, -1, -1, -1, 27, -1, -1, -1, -1, -1, 33, -1, -1, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, -1, -1, -1, -1, -1, -1, -1, 80, -1, -1, -1, -1, -1, -1, -1, -1, -1, 90, -1, -1, -1, -1, -1, 96, -1, -1, -1, -1, -1, -1, -1, 104, -1, -1, -1, -1, -1, 110, 111, 112, -1, 114, 3, 4, 5, 6, 7, 8, 9, 10, -1, -1, -1, -1, -1, -1, 17, -1, -1, -1, -1, 22, 23, -1, -1, -1, 27, -1, -1, -1, -1, -1, 33, -1, -1, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, -1, -1, -1, -1, -1, -1, -1, 80, -1, -1, -1, -1, -1, -1, -1, -1, -1, 90, -1, -1, -1, -1, -1, 96, -1, -1, -1, -1, -1, -1, -1, 104, -1, -1, -1, -1, -1, 110, 111, 112, -1, 114, 3, 4, 5, 6, 7, 8, 9, 10, -1, -1, -1, -1, -1, -1, 17, -1, -1, -1, -1, 22, 23, -1, -1, -1, 27, -1, -1, -1, -1, -1, 33, -1, -1, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, -1, -1, -1, -1, -1, -1, -1, 80, -1, -1, -1, -1, -1, -1, -1, -1, -1, 90, -1, -1, -1, -1, -1, 96, -1, -1, -1, -1, -1, -1, -1, 104, -1, -1, -1, -1, 109, 110, -1, 112, -1, 114, 3, 4, 5, 6, 7, 8, 9, 10, -1, -1, -1, -1, -1, -1, 17, -1, -1, -1, -1, 22, 23, -1, -1, -1, 27, -1, -1, -1, -1, -1, 33, -1, -1, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 34, -1, -1, -1, -1, -1, -1, 80, -1, -1, -1, -1, -1, -1, -1, -1, -1, 90, -1, -1, -1, -1, -1, 96, -1, -1, 35, -1, -1, -1, -1, 104, -1, -1, -1, -1, -1, 110, -1, 112, -1, 114, -1, -1, 78, 79, -1, 81, 82, 83, 84, 85, 86, 87, -1, 89, 90, 91, -1, 93, 94, -1, -1, 97, 98, 99, 100, 101, 102, 78, 79, -1, 81, 82, 83, 84, 85, 86, 87, -1, 89, 90, 91, -1, 93, 94, -1, -1, 97, 98, 99, 100, 101, 102, 78, 79, -1, 81, 82, 83, 84, 85, 86, 87, -1, 89, 90, 91, -1, 93, 94, -1, -1, 97, 98, 99, 100, 101, 102, -1, -1, 78, 79, -1, 81, 82, 83, 84, 85, 86, 87, 115, 89, 90, 91, -1, 93, 94, -1, -1, 97, 98, 99, 100, 101, 102, -1, 77, 78, 79, -1, 81, 82, 83, 84, 85, 86, 87, 115, 89, 90, 91, -1, 93, 94, -1, -1, 97, 98, 99, 100, 101, 102, 78, 79, -1, 81, 82, 83, 84, 85, 86, 87, 113, 89, 90, 91, -1, 93, 94, -1, -1, 97, 98, 99, 100, 101, 102, -1, -1, -1, -1, -1, -1, 78, 79, 111, 81, 82, 83, 84, 85, 86, 87, -1, 89, 90, 91, -1, 93, 94, -1, -1, 97, 98, 99, 100, 101, 102, -1, -1, -1, -1, -1, -1, 78, 79, 111, 81, 82, 83, 84, 85, 86, 87, -1, 89, 90, 91, -1, 93, 94, -1, -1, 97, 98, 99, 100, 101, 102, -1, -1, -1, -1, -1, -1, 78, 79, 111, 81, 82, 83, 84, 85, 86, 87, -1, 89, 90, 91, -1, 93, 94, -1, -1, 97, 98, 99, 100, 101, 102, -1, -1, -1, -1, -1, -1, 78, 79, 111, 81, 82, 83, 84, 85, 86, 87, -1, 89, 90, 91, -1, 93, 94, -1, -1, 97, 98, 99, 100, 101, 102, -1, -1, -1, -1, -1, -1, 78, 79, 111, 81, 82, 83, 84, 85, 86, 87, -1, 89, 90, 91, -1, 93, 94, -1, -1, 97, 98, 99, 100, 101, 102, -1, -1, -1, -1, -1, -1, 78, 79, 111, 81, 82, 83, 84, 85, 86, 87, -1, 89, 90, 91, -1, 93, 94, -1, -1, 97, 98, 99, 100, 101, 102, -1, -1, -1, -1, -1, -1, 78, 79, 111, 81, 82, 83, 84, 85, 86, 87, -1, 89, 90, 91, -1, 93, 94, -1, -1, 97, 98, 99, 100, 101, 102, -1, -1, -1, -1, -1, -1, 78, 79, 111, 81, 82, 83, 84, 85, 86, 87, -1, 89, 90, 91, -1, 93, 94, -1, -1, 97, 98, 99, 100, 101, 102, -1, -1, -1, -1, -1, -1, 78, 79, 111, 81, 82, 83, 84, 85, 86, 87, -1, 89, 90, 91, -1, 93, 94, -1, -1, 97, 98, 99, 100, 101, 102, -1, -1, -1, -1, -1, -1, 78, 79, 111, 81, 82, 83, 84, 85, 86, 87, -1, 89, 90, 91, -1, 93, 94, -1, -1, 97, 98, 99, 100, 101, 102, -1, -1, -1, -1, -1, -1, 78, 79, 111, 81, 82, 83, 84, 85, 86, 87, -1, 89, 90, 91, -1, 93, 94, -1, -1, 97, 98, 99, 100, 101, 102, -1, -1, -1, -1, 78, 79, 109, 81, 82, 83, 84, 85, 86, 87, -1, 89, 90, 91, -1, 93, 94, -1, -1, 97, 98, 99, 100, 101, 102, -1, -1, -1, -1, 78, 79, 109, 81, 82, 83, 84, 85, 86, 87, -1, 89, 90, 91, -1, 93, 94, -1, -1, 97, 98, 99, 100, 101, 102, -1, -1, -1, 77, 78, 79, 109, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, -1, 93, 94, -1, -1, 97, 98, 99, 100, 101, 102, 77, 78, 79, -1, 81, 82, 83, 84, 85, 86, 87, -1, 89, 90, 91, -1, 93, 94, -1, -1, 97, 98, 99, 100, 101, 102, 77, 78, 79, -1, 81, 82, 83, 84, 85, 86, 87, -1, 89, 90, 91, -1, 93, 94, -1, -1, 97, 98, 99, 100, 101, 102, 77, 78, 79, -1, 81, 82, 83, 84, 85, 86, 87, -1, 89, 90, 91, -1, 93, 94, -1, -1, 97, 98, 99, 100, 101, 102, 77, 78, 79, -1, 81, 82, 83, 84, 85, 86, 87, -1, 89, 90, 91, -1, 93, 94, -1, -1, 97, 98, 99, 100, 101, 102, 77, 78, 79, -1, 81, 82, 83, 84, 85, 86, 87, -1, 89, 90, 91, -1, 93, 94, -1, -1, 97, 98, 99, 100, 101, 102, 77, 78, 79, -1, 81, 82, 83, 84, 85, 86, 87, -1, 89, 90, 91, -1, 93, 94, -1, -1, 97, 98, 99, 100, 101, 102, 77, 78, 79, -1, 81, 82, 83, 84, 85, 86, 87, -1, 89, 90, 91, -1, 93, 94, -1, -1, 97, 98, 99, 100, 101, 102, 77, 78, 79, -1, 81, 82, 83, 84, 85, 86, 87, -1, 89, 90, 91, -1, 93, 94, -1, -1, 97, 98, 99, 100, 101, 102, 77, 78, 79, -1, 81, 82, 83, 84, 85, 86, 87, -1, 89, 90, 91, -1, 93, 94, -1, -1, 97, 98, 99, 100, 101, 102, 77, 78, 79, -1, 81, 82, 83, 84, 85, 86, 87, -1, 89, 90, 91, -1, 93, 94, -1, -1, 97, 98, 99, 100, 101, 102, 77, 78, 79, -1, 81, 82, 83, 84, 85, 86, 87, -1, 89, 90, 91, -1, 93, 94, -1, -1, 97, 98, 99, 100, 101, 102, 77, 78, 79, -1, 81, 82, 83, 84, 85, 86, 87, -1, 89, 90, 91, -1, 93, 94, -1, -1, 97, 98, 99, 100, 101, 102, 77, 78, 79, -1, 81, 82, 83, 84, 85, 86, 87, -1, 89, 90, 91, -1, 93, 94, -1, -1, 97, 98, 99, 100, 101, 102, 78, 79, -1, 81, 82, 83, 84, 85, 86, 87, -1, 89, 90, 91, -1, 93, 94, -1, -1, 97, 98, 99, 100, 101, 102, 79, -1, 81, 82, 83, 84, 85, 86, 87, -1, 89, 90, 91, -1, 93, 94, -1, -1, 97, 98, 99, 100, 101, 102, 81, 82, 83, 84, 85, 86, 87, -1, 89, 90, 91, -1, 93, 94, -1, -1, 97, 98, 99, 100, 101, 102, 83, 84, 85, 86, 87, -1, 89, 90, 91, -1, 93, 94, -1, -1, 97, 98, 99, 100, 101, 102, 87, -1, 89, 90, 91, -1, 93, 94, -1, -1, 97, 98, 99, 100, 101, 102 }; /* -*-C-*- Note some compilers choke on comments on `#line' lines. */ /* MODIFICATION 1: fix all #line directives as they have the wrong * filename and line numbers. Note #line no = actual number + 1 * #line 3 "/usr/local/share/bison.simple" */ #line 7 "bison/bison.simple" /* END MODIFICATION 1 */ /* This file comes from bison-1.28. */ /* This is a MODIFIED version of bison's Skeleton output parser The change is such that the parser only process one token at each call to yyparse(). The token is the argument to yyparse(). This means that this parser is token driven. Example use: while (token = yylex()) { yyparse(token); } Additionally: error handling patched to show expected when there are > 5 expected during an error. [Ash, May 2001]. There are 13 patches of MODIFICATION in the Skeleton (not including this comment) */ /* Skeleton output parser for bison, Copyright (C) 1984, 1989, 1990 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /* As a special exception, when this file is copied by Bison into a Bison output file, you may use that output file without restriction. This special exception was added by the Free Software Foundation in version 1.24 of Bison. */ /* This is the parser code that is written into each bison parser when the %semantic_parser declaration is not specified in the grammar. It was written by Richard Stallman by simplifying the hairy parser used when %semantic_parser is specified. */ #ifndef YYSTACK_USE_ALLOCA #ifdef alloca #define YYSTACK_USE_ALLOCA #else /* alloca not defined */ #ifdef __GNUC__ #define YYSTACK_USE_ALLOCA #define alloca __builtin_alloca #else /* not GNU C. */ #if (!defined (__STDC__) && defined (sparc)) || defined (__sparc__) || defined (__sparc) || defined (__sgi) || (defined (__sun) && defined (__i386)) #define YYSTACK_USE_ALLOCA #include #else /* not sparc */ /* We think this test detects Watcom and Microsoft C. */ /* This used to test MSDOS, but that is a bad idea since that symbol is in the user namespace. */ #if (defined (_MSDOS) || defined (_MSDOS_)) && !defined (__TURBOC__) #if 0 /* No need for malloc.h, which pollutes the namespace; instead, just don't use alloca. */ #include #endif #else /* not MSDOS, or __TURBOC__ */ #if defined(_AIX) /* I don't know what this was needed for, but it pollutes the namespace. So I turned it off. rms, 2 May 1997. */ /* #include */ #pragma alloca #define YYSTACK_USE_ALLOCA #else /* not MSDOS, or __TURBOC__, or _AIX */ #if 0 #ifdef __hpux /* haible@ilog.fr says this works for HPUX 9.05 and up, and on HPUX 10. Eventually we can turn this on. */ #define YYSTACK_USE_ALLOCA #define alloca __builtin_alloca #endif /* __hpux */ #endif #endif /* not _AIX */ #endif /* not MSDOS, or __TURBOC__ */ #endif /* not sparc */ #endif /* not GNU C */ #endif /* alloca not defined */ #endif /* YYSTACK_USE_ALLOCA not defined */ #ifdef YYSTACK_USE_ALLOCA #define YYSTACK_ALLOC alloca #else #define YYSTACK_ALLOC malloc #endif /* Note: there must be only one dollar sign in this file. It is replaced by the list of actions, each action as one case of the switch. */ #define yyerrok (yyerrstatus = 0) #define yyclearin (yychar = YYEMPTY) #define YYEMPTY -2 #define YYEOF 0 #define YYACCEPT goto yyacceptlab #define YYABORT goto yyabortlab #define YYERROR goto yyerrlab1 /* Like YYERROR except do call yyerror. This remains here temporarily to ease the transition to the new meaning of YYERROR, for GCC. Once GCC version 2 has supplanted version 1, this can go. */ #define YYFAIL goto yyerrlab #define YYRECOVERING() (!!yyerrstatus) #define YYBACKUP(token, value) \ do \ if (yychar == YYEMPTY && yylen == 1) \ { yychar = (token), yylval = (value); \ yychar1 = YYTRANSLATE (yychar); \ YYPOPSTACK; \ goto yybackup; \ } \ else \ { yyerror ("syntax error: cannot back up"); YYERROR; } \ while (0) #define YYTERROR 1 #define YYERRCODE 256 #ifndef YYPURE #define YYLEX yylex() #endif #ifdef YYPURE #ifdef YYLSP_NEEDED #ifdef YYLEX_PARAM #define YYLEX yylex(&yylval, &yylloc, YYLEX_PARAM) #else #define YYLEX yylex(&yylval, &yylloc) #endif #else /* not YYLSP_NEEDED */ #ifdef YYLEX_PARAM #define YYLEX yylex(&yylval, YYLEX_PARAM) #else #define YYLEX yylex(&yylval) #endif #endif /* not YYLSP_NEEDED */ #endif /* If nonreentrant, generate the variables here */ #ifndef YYPURE int yychar; /* the lookahead symbol */ YYSTYPE yylval; /* the semantic value of the */ /* lookahead symbol */ #ifdef YYLSP_NEEDED YYLTYPE yylloc; /* location data for the lookahead */ /* symbol */ #endif int yynerrs; /* number of parse errors so far */ #endif /* not YYPURE */ #if YYDEBUG != 0 int yydebug; /* nonzero means print parse trace */ /* Since this is uninitialized, it does not stop multiple parsers from coexisting. */ #endif /* YYINITDEPTH indicates the initial size of the parser's stacks */ #ifndef YYINITDEPTH #define YYINITDEPTH 200 #endif /* YYMAXDEPTH is the maximum size the stacks can grow to (effective only if the built-in stack extension method is used). */ #if YYMAXDEPTH == 0 #undef YYMAXDEPTH #endif #ifndef YYMAXDEPTH #define YYMAXDEPTH 10000 #endif /* Define __yy_memcpy. Note that the size argument should be passed with type unsigned int, because that is what the non-GCC definitions require. With GCC, __builtin_memcpy takes an arg of type size_t, but it can handle unsigned int. */ #if __GNUC__ > 1 /* GNU C and GNU C++ define this. */ #define __yy_memcpy(TO,FROM,COUNT) __builtin_memcpy(TO,FROM,COUNT) #else /* not GNU C or C++ */ #ifndef __cplusplus /* This is the most reliable way to avoid incompatibilities in available built-in functions on various systems. */ static void __yy_memcpy (to, from, count) char *to; char *from; unsigned int count; { register char *f = from; register char *t = to; register int i = count; while (i-- > 0) *t++ = *f++; } #else /* __cplusplus */ /* This is the most reliable way to avoid incompatibilities in available built-in functions on various systems. */ static void __yy_memcpy (char *to, char *from, unsigned int count) { register char *t = to; register char *f = from; register int i = count; while (i-- > 0) *t++ = *f++; } #endif #endif /* MODIFICATION 2: same as MODIFICATION 1 * #line 217 "/usr/local/share/bison.simple" */ #line 241 "bison/bison.simple" /* END MODIFICATION 2 */ /* The user can define YYPARSE_PARAM as the name of an argument to be passed into yyparse. The argument should have type void *. It should actually point to an object. Grammar actions can access the variable by casting it to the proper pointer type. */ #ifdef YYPARSE_PARAM #ifdef __cplusplus #define YYPARSE_PARAM_ARG void *YYPARSE_PARAM #define YYPARSE_PARAM_DECL #else /* not __cplusplus */ #define YYPARSE_PARAM_ARG YYPARSE_PARAM #define YYPARSE_PARAM_DECL void *YYPARSE_PARAM; #endif /* not __cplusplus */ #else /* not YYPARSE_PARAM */ #define YYPARSE_PARAM_ARG #define YYPARSE_PARAM_DECL #endif /* not YYPARSE_PARAM */ /* Prevent warning if -Wstrict-prototypes. */ #ifdef __GNUC__ /* MODIFICATION 3: yyparse() takes an argument that is the lex token * #ifdef YYPARSE_PARAM * int yyparse (void *); * #else * int yyparse (void); * #endif */ int yyparse(int); /* END MODIFICATION 3 */ #endif /* MODIFICATION 4: add a variable yy_parse_init to control the initialisation of the parser and an accessor function */ static int yy_parse_init = 1; #ifdef WANT_SETYYPARSEINIT /* Added this function to allow Eden to use this bison.simple. Needs conditional compilation as we can only have one function with this name otherwise the linker moans (can't compile this into Donald, Scout etc). The name here doesn't get automatically translated by the sed or bison -p. [Ash] */ void setyyparseinit(int setto) { yy_parse_init = setto; } #endif /* END MODIFICATION 4 */ /* MODIFICATION 5: turning the local variables of yyparse() into static, global variables so that the parser can be reentered */ static int yystate; static int yyn; static short *yyssp; static YYSTYPE *yyvsp; static int yyerrstatus; /* number of tokens to shift before error messages enabled */ static int yychar1 = 0; /* lookahead token as an internal (translated) token number */ static short yyssa[YYINITDEPTH]; /* the state stack */ static YYSTYPE yyvsa[YYINITDEPTH]; /* the semantic value stack */ static short *yyss = yyssa; /* refer to the stacks thru separate pointers */ static YYSTYPE *yyvs = yyvsa; /* to allow yyoverflow to reallocate them elsewhere */ #ifdef YYLSP_NEEDED static YYLTYPE yylsa[YYINITDEPTH]; /* the location stack */ static YYLTYPE *yyls = yylsa; static YYLTYPE *yylsp; #define YYPOPSTACK (yyvsp--, yyssp--, yylsp--) #else #define YYPOPSTACK (yyvsp--, yyssp--) #endif static int yystacksize = YYINITDEPTH; static int yyfree_stacks = 0; #ifdef YYPURE static int yychar; static YYSTYPE yylval; static int yynerrs; #ifdef YYLSP_NEEDED static YYLTYPE yylloc; #endif #endif static YYSTYPE yyval; /* the variable used to return */ /* semantic values from the action */ /* routines */ static int yylen; /* END MODIFICATION 5 */ /* MODIFICATION 6: yyparse() takes an argument that is the lex token * int * yyparse(YYPARSE_PARAM_ARG) * YYPARSE_PARAM_DECL * { */ int yyparse(token) int token; { /* END MODIFICATION 6 */ /* MODIFICATION 7: deal with initialisation */ int yy_token_read = 0; if (!yy_parse_init) goto lex; yy_parse_init = 0; /* END MODIFICATION 7 */ #if YYDEBUG != 0 if (yydebug) fprintf(stderr, "Starting parse\n"); #endif yystate = 0; yyerrstatus = 0; yynerrs = 0; yychar = YYEMPTY; /* Cause a token to be read. */ /* Initialize stack pointers. Waste one element of value and location stack so that they stay on the same level as the state stack. The wasted elements are never initialized. */ yyssp = yyss - 1; yyvsp = yyvs; #ifdef YYLSP_NEEDED yylsp = yyls; #endif /* Push a new state, which is found in yystate . */ /* In all cases, when you get here, the value and location stacks have just been pushed. so pushing a state here evens the stacks. */ yynewstate: *++yyssp = yystate; if (yyssp >= yyss + yystacksize - 1) { /* Give user a chance to reallocate the stack */ /* Use copies of these so that the &'s don't force the real ones into memory. */ YYSTYPE *yyvs1 = yyvs; short *yyss1 = yyss; #ifdef YYLSP_NEEDED YYLTYPE *yyls1 = yyls; #endif /* Get the current used size of the three stacks, in elements. */ int size = yyssp - yyss + 1; #ifdef yyoverflow /* Each stack pointer address is followed by the size of the data in use in that stack, in bytes. */ #ifdef YYLSP_NEEDED /* This used to be a conditional around just the two extra args, but that might be undefined if yyoverflow is a macro. */ yyoverflow("parser stack overflow", &yyss1, size * sizeof (*yyssp), &yyvs1, size * sizeof (*yyvsp), &yyls1, size * sizeof (*yylsp), &yystacksize); #else yyoverflow("parser stack overflow", &yyss1, size * sizeof (*yyssp), &yyvs1, size * sizeof (*yyvsp), &yystacksize); #endif yyss = yyss1; yyvs = yyvs1; #ifdef YYLSP_NEEDED yyls = yyls1; #endif #else /* no yyoverflow */ /* Extend the stack our own way. */ if (yystacksize >= YYMAXDEPTH) { yyerror("parser stack overflow"); if (yyfree_stacks) { free (yyss); free (yyvs); #ifdef YYLSP_NEEDED free (yyls); #endif } return 2; } yystacksize *= 2; if (yystacksize > YYMAXDEPTH) yystacksize = YYMAXDEPTH; #ifndef YYSTACK_USE_ALLOCA yyfree_stacks = 1; #endif yyss = (short *) YYSTACK_ALLOC (yystacksize * sizeof (*yyssp)); __yy_memcpy ((char *)yyss, (char *)yyss1, size * (unsigned int) sizeof (*yyssp)); yyvs = (YYSTYPE *) YYSTACK_ALLOC (yystacksize * sizeof (*yyvsp)); __yy_memcpy ((char *)yyvs, (char *)yyvs1, size * (unsigned int) sizeof (*yyvsp)); #ifdef YYLSP_NEEDED yyls = (YYLTYPE *) YYSTACK_ALLOC (yystacksize * sizeof (*yylsp)); __yy_memcpy ((char *)yyls, (char *)yyls1, size * (unsigned int) sizeof (*yylsp)); #endif #endif /* no yyoverflow */ yyssp = yyss + size - 1; yyvsp = yyvs + size - 1; #ifdef YYLSP_NEEDED yylsp = yyls + size - 1; #endif #if YYDEBUG != 0 if (yydebug) fprintf(stderr, "Stack size increased to %d\n", yystacksize); #endif if (yyssp >= yyss + yystacksize - 1) YYABORT; } #if YYDEBUG != 0 if (yydebug) fprintf(stderr, "Entering state %d\n", yystate); #endif goto yybackup; yybackup: /* Do appropriate processing given the current state. */ /* Read a lookahead token if we need one and don't already have one. */ /* yyresume: */ /* First try to decide what to do without reference to lookahead token. */ yyn = yypact[yystate]; if (yyn == YYFLAG) goto yydefault; /* Not known => get a lookahead token if don't already have one. */ /* yychar is either YYEMPTY or YYEOF or a valid token in external form. */ if (yychar == YYEMPTY) { #if YYDEBUG != 0 if (yydebug) fprintf(stderr, "Reading a token: "); #endif /* MODIFICATION 8: consume the argument token * yychar = YYLEX; */ lex: if (yy_token_read) return -1; /* token consumed */ yy_token_read = 1; yychar = token; /* END MODIFICATION 8 */ } /* Convert token to internal form (in yychar1) for indexing tables with */ if (yychar <= 0) /* This means end of input. */ { yychar1 = 0; yychar = YYEOF; /* Don't call YYLEX any more */ #if YYDEBUG != 0 if (yydebug) fprintf(stderr, "Now at end of input.\n"); #endif } else { yychar1 = YYTRANSLATE(yychar); #if YYDEBUG != 0 if (yydebug) { fprintf (stderr, "Next token is %d (%s", yychar, yytname[yychar1]); /* Give the individual parser a way to print the precise meaning of a token, for further debugging info. */ #ifdef YYPRINT YYPRINT (stderr, yychar, yylval); #endif fprintf (stderr, ")\n"); } #endif } yyn += yychar1; if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != yychar1) goto yydefault; yyn = yytable[yyn]; /* yyn is what to do for this token type in this state. Negative => reduce, -yyn is rule number. Positive => shift, yyn is new state. New state is final state => don't bother to shift, just return success. 0, or most negative number => error. */ if (yyn < 0) { if (yyn == YYFLAG) goto yyerrlab; yyn = -yyn; goto yyreduce; } else if (yyn == 0) goto yyerrlab; if (yyn == YYFINAL) YYACCEPT; /* Shift the lookahead token. */ #if YYDEBUG != 0 if (yydebug) fprintf(stderr, "Shifting token %d (%s), ", yychar, yytname[yychar1]); #endif /* Discard the token being shifted unless it is eof. */ if (yychar != YYEOF) yychar = YYEMPTY; *++yyvsp = yylval; #ifdef YYLSP_NEEDED *++yylsp = yylloc; #endif /* count tokens shifted since error; after three, turn off error status. */ if (yyerrstatus) yyerrstatus--; yystate = yyn; goto yynewstate; /* Do the default action for the current state. */ yydefault: yyn = yydefact[yystate]; if (yyn == 0) goto yyerrlab; /* Do a reduction. yyn is the number of a rule to reduce with. */ yyreduce: yylen = yyr2[yyn]; if (yylen > 0) yyval = yyvsp[1-yylen]; /* implement default value of the action */ #if YYDEBUG != 0 if (yydebug) { int i; fprintf (stderr, "Reducing via rule %d (line %d), ", yyn, yyrline[yyn]); /* Print the symbols being reduced, and their result. */ for (i = yyprhs[yyn]; yyrhs[i] > 0; i++) fprintf (stderr, "%s ", yytname[yyrhs[i]]); fprintf (stderr, " -> %s\n", yytname[yyr1[yyn]]); } #endif switch (yyn) { case 2: #line 170 "parser.y" { dd_script->ready = 1; ; break;} case 3: #line 171 "parser.y" { yyerrok; ; break;} case 4: #line 175 "parser.y" { eden_declare(yyvsp[0].s, VIEWPORT, yyvsp[0].s); ; break;} case 5: #line 176 "parser.y" { if (_changed) { declare_openshape(); _changed = 0; } #ifdef DEBUG if (Debug & 16) print_all_symbols(); #endif ; break;} case 7: #line 186 "parser.y" { appendEden("%+eden\n", dd_script); ; break;} case 8: #line 187 "parser.y" { appendEden("%-eden\n", dd_script); ; break;} case 9: #line 188 "parser.y" { #ifdef DISTRIB withinHandle = 1; #endif /* DISTRIB */ ; break;} case 10: #line 193 "parser.y" { if (_changed) { declare_openshape(); _changed = 0; } ; break;} case 12: #line 220 "parser.y" { Delete(yyvsp[-1].t); ; break;} case 13: #line 233 "parser.y" { #ifdef DISTRIB withinName = strdup(expr_to_eden_name(yyvsp[0].t)); /* within door {} - this finds 'door' */ if (handle_check1(withinName)) { /* The current agent is allowed to change the contents of the variable 'withinName' */ dd_appAgentName--; /* we don't need to prepend the agent name any more */ withinHandle = 1; sprintf(temp, "%%donald\nwithin %s {\n%%eden\n", expr_to_donald_name(yyvsp[0].t)); propagateDonaldDef(withinName, temp); change_scope(yyvsp[0].t); freeTree(yyvsp[0].t); /* propagateAgency1(withinName, temp); */ } else { withinHandle = 0; } #else dd_appAgentName--; change_scope(yyvsp[0].t); freeTree(yyvsp[0].t); #endif /* DISTRIB */ ; break;} case 14: #line 260 "parser.y" { #ifdef DISTRIB if (withinHandle) { resume_scope(); propagateDonaldDef(withinName, "%donald\n}\n%eden\n"); }; withinHandle = 1; dd_appAgentName++; #else dd_appAgentName++; resume_scope(); #endif ; break;} case 15: #line 274 "parser.y" { #ifdef DISTRIB if (withinHandle) { resume_scope(); propagateDonaldDef(withinName, "%donald\n}\n%eden\n"); }; withinHandle = 1; dd_appAgentName++; #else dd_appAgentName++; resume_scope(); #endif ; break;} case 16: #line 288 "parser.y" { #ifdef DISTRIB if (withinHandle) { resume_scope(); propagateDonaldDef(withinName, "%donald\n}\n%eden\n"); } withinHandle = 1; dd_appAgentName++; #else dd_appAgentName++; resume_scope(); #endif ; break;} case 17: #line 304 "parser.y" { dd_script->ready = 1; ; break;} case 18: #line 305 "parser.y" { dd_script->ready = 1; ; break;} case 19: #line 309 "parser.y" { #ifdef DISTRIB if (withinHandle) { Declare(yyvsp[-2].i, yyvsp[-1].t); } else { freeTree(yyvsp[-1].t); } #else Declare(yyvsp[-2].i, yyvsp[-1].t); #endif /* DISTRIB */ ; break;} case 20: #line 320 "parser.y" { DeclareGraph(yyvsp[0].t); ; break;} case 21: #line 369 "parser.y" { yyval.i = INT; ; break;} case 22: #line 370 "parser.y" { yyval.i = REAL; ; break;} case 23: #line 371 "parser.y" { yyval.i = MYCHAR; ; break;} case 24: #line 372 "parser.y" { yyval.i = BOOLEAN; ; break;} case 25: #line 373 "parser.y" { yyval.i = POINT; ; break;} case 26: #line 374 "parser.y" { yyval.i = LINE; ; break;} case 27: #line 375 "parser.y" { yyval.i = ARC; ; break;} case 28: #line 376 "parser.y" { yyval.i = CIRCLE; ; break;} case 29: #line 377 "parser.y" { yyval.i = ELLIPSE; ; break;} case 30: #line 378 "parser.y" { yyval.i = LABEL; ; break;} case 31: #line 379 "parser.y" { yyval.i = SHAPE; ; break;} case 32: #line 380 "parser.y" { yyval.i = OPENSHAPE; ; break;} case 33: #line 381 "parser.y" { yyval.i = IMAGE; ; break;} case 34: #line 382 "parser.y" { yyval.i = RECTANGLE; ; break;} case 35: #line 387 "parser.y" { #ifdef DISTRIB if (withinHandle) { #endif /* DISTRIB */ int no_id; tree t1 = yyvsp[-3].t; tree t3 = yyvsp[-1].t; if ((no_id = count_id(t1)) == ERROR) don_err(IdListExpect, 0); if (no_id != count_expr(t3)) don_err(IdExprUnmatch, 0); if (no_id > 1) appendEden("autocalc = OFF;\n", dd_script); if (t3->type == ANY) t3->type = t1->type; Define(t1, t3); freeTree(t1); freeTree(t3); if (no_id > 1) appendEden("autocalc = ON;\n", dd_script); #ifdef DISTRIB } else { freeTree(yyvsp[-3].t); freeTree(yyvsp[-1].t); } #endif /* DISTRIB */ ; break;} case 36: #line 416 "parser.y" { count_expr(yyvsp[-1].t); DefineFunc(XI, yyvsp[-1].t); freeTree(yyvsp[-1].t); ; break;} case 37: #line 422 "parser.y" { count_expr(yyvsp[-1].t); DefineFunc(FI, yyvsp[-1].t); freeTree(yyvsp[-1].t); ; break;} case 38: #line 430 "parser.y" { appendEden(yyvsp[-1].s, dd_script); appendEden("\n", dd_script); free(yyvsp[-1].s); ; break;} case 39: #line 435 "parser.y" { appendEden(yyvsp[-1].s, dd_script); appendEden("\n", dd_script); free(yyvsp[-1].s); ; break;} case 41: #line 444 "parser.y" { yyval.t = dtree2(OP_COMMA, yyvsp[-2].t, yyvsp[0].t); ; break;} case 42: #line 484 "parser.y" { yyval.t = dtree0(OP_INF); ; break;} case 43: #line 485 "parser.y" { yyval.t = dtree0(OP_PI); yyval.t->type = REAL; Rvalue(yyval.t) = 3.141593; ; break;} case 44: #line 489 "parser.y" { yyval.t = dtree0(OP_INUMBER); yyval.t->type = INT; Ivalue(yyval.t) = yyvsp[0].i; ; break;} case 45: #line 494 "parser.y" { yyval.t = dtree0(OP_RNUMBER); yyval.t->type = REAL; Rvalue(yyval.t) = yyvsp[0].r; display2("rnumber(%lf) ", yyvsp[0].r); ; break;} case 46: #line 500 "parser.y" { yyval.t = dtree0(OP_CSTRING); yyval.t->type = MYCHAR; Cvalue(yyval.t) = yyvsp[0].s; display2("cstring(%s) ", yyvsp[0].s); ; break;} case 47: #line 506 "parser.y" { yyval.t = dtree0(OP_BOOL); yyval.t->type = BOOLEAN; Bvalue(yyval.t) = yyvsp[0].i; ; break;} case 48: #line 511 "parser.y" { yyval.t = dtree0(OP_I); yyval.t->type = INT; ; break;} case 49: #line 512 "parser.y" { yyval.t = dtree0(OP_XI); yyval.t->type = REAL; ; break;} case 50: #line 513 "parser.y" { yyval.t = dtree0(OP_FI); yyval.t->type = REAL; ; break;} case 51: #line 514 "parser.y" { yyval.t = dtree0(OP_I_1); yyval.t->type = INT; ; break;} case 52: #line 515 "parser.y" { yyval.t = dtree0(OP_XI_1); yyval.t->type = REAL; ; break;} case 53: #line 516 "parser.y" { yyval.t = dtree0(OP_FI_1); yyval.t->type = REAL; ; break;} case 54: #line 519 "parser.y" { yyval.t = yyvsp[-1].t; ; break;} case 55: #line 521 "parser.y" { yyval.t = yyvsp[-1].t; ; break;} case 57: #line 525 "parser.y" { yyval.t = dtree2(OP_EDEN, yyvsp[-1].s); ; break;} case 58: #line 527 "parser.y" { yyval.t = dtree1(OP_PAREN, yyvsp[-1].t); ; break;} case 59: #line 530 "parser.y" { yyval.t = dtree2(OP_CART, yyvsp[-3].t, yyvsp[-1].t); ; break;} case 60: #line 532 "parser.y" { yyval.t = dtree2(OP_POLAR, yyvsp[-3].t, yyvsp[-1].t); ; break;} case 61: #line 534 "parser.y" { yyval.t = dtree2(OP_LINE, yyvsp[-3].t, yyvsp[-1].t); ; break;} case 62: #line 536 "parser.y" { yyval.t = dtree3(OP_ARC, yyvsp[-5].t, yyvsp[-3].t, yyvsp[-1].t); ; break;} case 63: #line 538 "parser.y" { yyval.t = dtree2(OP_CIRCLE, yyvsp[-3].t, yyvsp[-1].t); ; break;} case 64: #line 540 "parser.y" { yyval.t = dtree2(OP_RECTANGLE, yyvsp[-3].t, yyvsp[-1].t); ; break;} case 65: #line 542 "parser.y" { yyval.t = dtree3(OP_ELLIPSE, yyvsp[-5].t, yyvsp[-3].t, yyvsp[-1].t); ; break;} case 66: #line 544 "parser.y" { yyval.t = dtree2(OP_LABEL, yyvsp[-3].t, yyvsp[-1].t); ; break;} case 67: #line 546 "parser.y" { yyval.t = dtree2(OP_PLUS, yyvsp[-2].t, yyvsp[0].t); ; break;} case 68: #line 547 "parser.y" { yyval.t = dtree2(OP_MINUS, yyvsp[-2].t, yyvsp[0].t); ; break;} case 69: #line 548 "parser.y" { yyval.t = dtree2(OP_MULT, yyvsp[-2].t, yyvsp[0].t); ; break;} case 70: #line 549 "parser.y" { yyval.t = dtree2(OP_MOD, yyvsp[-2].t, yyvsp[0].t); ; break;} case 71: #line 550 "parser.y" { yyval.t = dtree2(OP_DIV, yyvsp[-2].t, yyvsp[0].t); ; break;} case 72: #line 552 "parser.y" { yyval.t = dtree1(OP_UMINUS, yyvsp[0].t); ; break;} case 73: #line 557 "parser.y" { yyval.t = dtree1(OP_NOT, yyvsp[0].t); ; break;} case 74: #line 558 "parser.y" { yyval.t = dtree2(OP_AND, yyvsp[-2].t, yyvsp[0].t); ; break;} case 75: #line 559 "parser.y" { yyval.t = dtree2(OP_OR, yyvsp[-2].t, yyvsp[0].t); ; break;} case 76: #line 560 "parser.y" { yyval.t = dtree2(OP_EQ_EQ, yyvsp[-2].t, yyvsp[0].t); ; break;} case 77: #line 561 "parser.y" { yyval.t = dtree2(OP_NOT_EQ, yyvsp[-2].t, yyvsp[0].t); ; break;} case 78: #line 562 "parser.y" { yyval.t = dtree2(OP_LT, yyvsp[-2].t, yyvsp[0].t); ; break;} case 79: #line 563 "parser.y" { yyval.t = dtree2(OP_LT_EQ, yyvsp[-2].t, yyvsp[0].t); ; break;} case 80: #line 564 "parser.y" { yyval.t = dtree2(OP_GT, yyvsp[-2].t, yyvsp[0].t); ; break;} case 81: #line 565 "parser.y" { yyval.t = dtree2(OP_GT_EQ, yyvsp[-2].t, yyvsp[0].t); ; break;} case 82: #line 567 "parser.y" { yyval.t = dtree2(OP_SLASH_SLASH, yyvsp[-2].t, yyvsp[0].t); ; break;} case 83: #line 569 "parser.y" { yyval.t = dtree1(OP_ITOS, yyvsp[-1].t); ; break;} case 84: #line 571 "parser.y" { yyval.t = dtree2(OP_RTOS, yyvsp[-3].t, yyvsp[-1].t); ; break;} case 85: #line 573 "parser.y" { yyval.t = dtree1(OP_DOTX, yyvsp[-1].t); ; break;} case 86: #line 574 "parser.y" { yyval.t = dtree1(OP_DOTY, yyvsp[-1].t); ; break;} case 87: #line 575 "parser.y" { yyval.t = dtree1(OP_DOT1, yyvsp[-1].t); ; break;} case 88: #line 576 "parser.y" { yyval.t = dtree1(OP_DOT2, yyvsp[-1].t); ; break;} case 89: #line 577 "parser.y" { yyval.t = dtree1(OP_DOTRAD, yyvsp[-1].t); ; break;} case 90: #line 578 "parser.y" { yyval.t = dtree1(OP_DOTARG, yyvsp[-1].t); ; break;} case 91: #line 581 "parser.y" { yyval.t = dtree2(OP_FUNC, yyvsp[-3].s, 0); ; break;} case 92: #line 583 "parser.y" { yyval.t = dtree2(OP_FUNC, yyvsp[-4].s, yyvsp[-1].t); ; break;} case 93: #line 585 "parser.y" { yyval.t = dtree2(OP_IMGFUNC, yyvsp[-2].s, 0); ; break;} case 94: #line 587 "parser.y" { yyval.t = dtree2(OP_IMGFUNC, yyvsp[-3].s, yyvsp[-1].t); ; break;} case 95: #line 589 "parser.y" { yyval.t = dtree1(yyvsp[-3].i, yyvsp[-1].t); ; break;} case 96: #line 591 "parser.y" { yyval.t = dtree2(yyvsp[-5].i, yyvsp[-3].t, yyvsp[-1].t); ; break;} case 97: #line 593 "parser.y" { yyval.t = dtree3(yyvsp[-7].i, yyvsp[-5].t, yyvsp[-3].t, yyvsp[-1].t); ; break;} case 98: #line 596 "parser.y" { yyval.t = dtree4(OP_PARALLEL, yyvsp[-7].t, yyvsp[-5].t, yyvsp[-3].t, yyvsp[-1].t); ; break;} case 99: #line 599 "parser.y" { yyval.t = dtree3(OP_IF, yyvsp[-2].t, yyvsp[-4].t, yyvsp[0].t); ; break;} case 100: #line 606 "parser.y" { yyval.i = OP_SQRT; ; break;} case 101: #line 607 "parser.y" { yyval.i = OP_SIN; ; break;} case 102: #line 608 "parser.y" { yyval.i = OP_COS; ; break;} case 103: #line 609 "parser.y" { yyval.i = OP_TAN; ; break;} case 104: #line 610 "parser.y" { yyval.i = OP_ASIN; ; break;} case 105: #line 611 "parser.y" { yyval.i = OP_ACOS; ; break;} case 106: #line 612 "parser.y" { yyval.i = OP_ATAN; ; break;} case 107: #line 613 "parser.y" { yyval.i = OP_LOG; ; break;} case 108: #line 614 "parser.y" { yyval.i = OP_EXP; ; break;} case 109: #line 615 "parser.y" { yyval.i = OP_TRUNC; ; break;} case 110: #line 616 "parser.y" { yyval.i = OP_FLOAT; ; break;} case 111: #line 617 "parser.y" { yyval.i = OP_MIDPOINT; ; break;} case 112: #line 618 "parser.y" { yyval.i = OP_RANDOM; ; break;} case 113: #line 622 "parser.y" { yyval.i = OP_INTERSECT; ; break;} case 114: #line 623 "parser.y" { yyval.i = OP_PERPEND; ; break;} case 115: #line 624 "parser.y" { yyval.i = OP_DISTANCE; ; break;} case 116: #line 625 "parser.y" { yyval.i = OP_SCALE; ; break;} case 117: #line 626 "parser.y" { yyval.i = OP_INTERSECTS; ; break;} case 118: #line 627 "parser.y" { yyval.i = OP_INCLUDES; ; break;} case 119: #line 628 "parser.y" { yyval.i = OP_INCIDENT; ; break;} case 120: #line 629 "parser.y" { yyval.i = OP_REFLECT; ; break;} case 121: #line 633 "parser.y" { yyval.i = OP_ROT; ; break;} case 122: #line 634 "parser.y" { yyval.i = OP_TRANS; ; break;} case 123: #line 635 "parser.y" { yyval.i = OP_PT_BETWN_PTS; ; break;} case 124: #line 636 "parser.y" { yyval.i = OP_COLINEAR; ; break;} case 125: #line 637 "parser.y" { yyval.i = OP_SEPARATES; ; break;} case 126: #line 638 "parser.y" { yyval.i = OP_DISTLARGER; ; break;} case 127: #line 639 "parser.y" { yyval.i = OP_DISTSMALLER; ; break;} case 129: #line 645 "parser.y" { yyval.t = dtree2(OP_GLOBAL, yyvsp[0].t); ; break;} case 130: #line 650 "parser.y" { yyval.t = dtree2(OP_SLASH, yyvsp[-2].t, yyvsp[0].t); ; break;} case 131: #line 652 "parser.y" { yyval.t = dtree2(OP_SLASH, dtree1(OP_ID, 0), yyvsp[0].t); dd_appAgentName--; ; break;} case 134: #line 663 "parser.y" { yyval.t = dtree1(OP_ID, yyvsp[0].s); ; break;} case 135: #line 667 "parser.y" { yyval.t = dtree2(OP_GSPECLIST, 0, 0); ; break;} case 137: #line 670 "parser.y" { yyval.t = dtree2(OP_GSPECLIST, yyvsp[-2].t, yyvsp[0].t); ; break;} case 138: #line 672 "parser.y" { yyval.t = dtree2(OP_GSPECLIST, yyvsp[-3].t, yyvsp[0].t); ; break;} case 139: #line 676 "parser.y" { yyval.t = dtree2(OP_GSPEC, 0, (tree)yyvsp[-1].i); ; break;} case 140: #line 677 "parser.y" { yyval.t = dtree2(OP_GSPEC, yyvsp[0].t, (tree)yyvsp[-2].i); ; break;} case 141: #line 678 "parser.y" { yyval.t = dtree2(OP_GSPEC, 0, (tree)yyvsp[-2].i); ; break;} case 142: #line 679 "parser.y" { yyval.t = dtree2(OP_GSPEC, yyvsp[-1].t, (tree)yyvsp[-3].i); ; break;} } /* the action file gets copied in in place of this dollarsign */ /* MODIFICATION 9: same as MODIFICATION 1 * #line 543 "/usr/local/share/bison.simple" */ #line 617 "bison/bison.simple" /* END MODIFICATION 9 */ yyvsp -= yylen; yyssp -= yylen; #ifdef YYLSP_NEEDED yylsp -= yylen; #endif #if YYDEBUG != 0 if (yydebug) { short *ssp1 = yyss - 1; fprintf (stderr, "state stack now"); while (ssp1 != yyssp) fprintf (stderr, " %d", *++ssp1); fprintf (stderr, "\n"); } #endif *++yyvsp = yyval; #ifdef YYLSP_NEEDED yylsp++; if (yylen == 0) { yylsp->first_line = yylloc.first_line; yylsp->first_column = yylloc.first_column; yylsp->last_line = (yylsp-1)->last_line; yylsp->last_column = (yylsp-1)->last_column; yylsp->text = 0; } else { yylsp->last_line = (yylsp+yylen-1)->last_line; yylsp->last_column = (yylsp+yylen-1)->last_column; } #endif /* Now "shift" the result of the reduction. Determine what state that goes to, based on the state we popped back to and the rule number reduced by. */ yyn = yyr1[yyn]; yystate = yypgoto[yyn - YYNTBASE] + *yyssp; if (yystate >= 0 && yystate <= YYLAST && yycheck[yystate] == *yyssp) yystate = yytable[yystate]; else yystate = yydefgoto[yyn - YYNTBASE]; goto yynewstate; yyerrlab: /* here on detecting error */ if (! yyerrstatus) /* If not already recovering from an error, report this error. */ { ++yynerrs; #ifdef YYERROR_VERBOSE yyn = yypact[yystate]; if (yyn > YYFLAG && yyn < YYLAST) { int size = 0; char *msg; int x, count; count = 0; /* Start X at -yyn if nec to avoid negative indexes in yycheck. */ for (x = (yyn < 0 ? -yyn : 0); x < (sizeof(yytname) / sizeof(char *)); x++) if (yycheck[x + yyn] == x) size += strlen(yytname[x]) + 15, count++; /* MODIFICATION 10: increase space for error message * msg = (char *) malloc(size + 15); */ msg = (char *) malloc(size + 100); /* END MODIFICATION 10 */ if (msg != 0) { strcpy(msg, "parse error"); /* MODIFICATION 11: print expected even when there are > 5 expected, * and print what was encountered * if (count < 5) */ sprintf(msg + strlen(msg), ", encountered `%s'", yytname[yychar1]); if (1) /* END MODIFICATION 11 */ { count = 0; for (x = (yyn < 0 ? -yyn : 0); x < (sizeof(yytname) / sizeof(char *)); x++) if (yycheck[x + yyn] == x) { /* MODIFICATION 12: indicate when there are > 5 expected but not printed */ if (count > 5) count++; else { /* END MODIFICATION 12 */ strcat(msg, count == 0 ? ", expecting `" : " or `"); strcat(msg, yytname[x]); strcat(msg, "'"); count++; /* MODIFICATION 13: indicate when there are > 5 expected but not printed * } */ } } if (count > 5) { sprintf(msg + strlen(msg), " or... (%d other possibilities)", count - 6); } /* END MODIFICATION 13 */ } yyerror(msg); free(msg); } else yyerror ("parse error; also virtual memory exceeded"); } else #endif /* YYERROR_VERBOSE */ yyerror("parse error"); } goto yyerrlab1; yyerrlab1: /* here on error raised explicitly by an action */ if (yyerrstatus == 3) { /* if just tried and failed to reuse lookahead token after an error, discard it. */ /* return failure if at end of input */ if (yychar == YYEOF) YYABORT; #if YYDEBUG != 0 if (yydebug) fprintf(stderr, "Discarding token %d (%s).\n", yychar, yytname[yychar1]); #endif yychar = YYEMPTY; } /* Else will try to reuse lookahead token after shifting the error token. */ yyerrstatus = 3; /* Each real token shifted decrements this */ goto yyerrhandle; yyerrdefault: /* current state does not do anything special for the error token. */ #if 0 /* This is wrong; only states that explicitly want error tokens should shift them. */ yyn = yydefact[yystate]; /* If its default is to accept any token, ok. Otherwise pop it.*/ if (yyn) goto yydefault; #endif yyerrpop: /* pop the current state because it cannot handle the error token */ if (yyssp == yyss) YYABORT; yyvsp--; yystate = *--yyssp; #ifdef YYLSP_NEEDED yylsp--; #endif #if YYDEBUG != 0 if (yydebug) { short *ssp1 = yyss - 1; fprintf (stderr, "Error: state stack now"); while (ssp1 != yyssp) fprintf (stderr, " %d", *++ssp1); fprintf (stderr, "\n"); } #endif yyerrhandle: yyn = yypact[yystate]; if (yyn == YYFLAG) goto yyerrdefault; yyn += YYTERROR; if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != YYTERROR) goto yyerrdefault; yyn = yytable[yyn]; if (yyn < 0) { if (yyn == YYFLAG) goto yyerrpop; yyn = -yyn; goto yyreduce; } else if (yyn == 0) goto yyerrpop; if (yyn == YYFINAL) YYACCEPT; #if YYDEBUG != 0 if (yydebug) fprintf(stderr, "Shifting error token, "); #endif *++yyvsp = yylval; #ifdef YYLSP_NEEDED *++yylsp = yylloc; #endif yystate = yyn; goto yynewstate; yyacceptlab: /* YYACCEPT comes here. */ if (yyfree_stacks) { free (yyss); free (yyvs); #ifdef YYLSP_NEEDED free (yyls); #endif } return 0; yyabortlab: /* YYABORT comes here. */ if (yyfree_stacks) { free (yyss); free (yyvs); #ifdef YYLSP_NEEDED free (yyls); #endif } return 1; } #line 681 "parser.y" void yyerror(char *s) { don_err(Unclassified, s); } static char *errorstring[] = {ERRORSTRINGS}; /*---------------------------------------------------+---------+ | don_err | +---------*/ #include extern Tcl_Interp *interp; void don_err(enum errorcodes error_code, char *s) { extern void yyrestart(void); extern int yy_parse_init; char errStr[120]; Tcl_DString err, message; yyrestart(); /* reset lexical analyzer */ yy_parse_init = 1; /* reset bison */ deleteScript(dd_script); sprintf(errStr, errorstring[(int) error_code], s); if (reset_context() > 0) { strcat(errStr, " (context was reset)"); } errorf("DoNaLD: %s", errStr); } #ifdef DISTRIB /* This is a sort of drop-in replacement for appendEden, but with distribution [Ash, with Sun] */ void propagateDonaldDef(char *name, char *s) { extern void appendEden(char *, Script *); appendEden("propagate(\"", dd_script); appendEden(name, dd_script); appendEden("\", \"", dd_script); appendEden(s, dd_script); appendEden("\");\n", dd_script); } #endif /* DISTRIB */ -1].t); ; break;} case 96: #line 591 "parser.y" { yyval.t = dtree2(yyvsp[-5].i, yyvsp[-3].t, yyvsp[-1].t); ; break;} case 97: #line 593 "parser.y" { yyval.t = dtree3(yyvsp[-7].i, yyvsp[-5].t, yyvsp[-3].t, yyvsp[-1].t); ; break;} case 98: #line tkeden1.41/Donald/parser.h010060000025250000164000000044260743724013500154730ustar00ashleyem00003510000005typedef union { char *s; /* identifier, etc */ int i; /* integer value */ double r; /* floating point value */ tree t; /* expression tree */ } YYSTYPE; #define INF 257 #define PI 258 #define I 259 #define XI 260 #define FI 261 #define I_1 262 #define XI_1 263 #define FI_1 264 #define IMAGE 265 #define MYCHAR 266 #define REAL 267 #define INT 268 #define BOOLEAN 269 #define POINT 270 #define LABEL 271 #define GSPEC 272 #define GSPECLIST 273 #define ANY 274 #define LINE 275 #define CIRCLE 276 #define ELLIPSE 277 #define SHAPE 278 #define OPENSHAPE 279 #define ARC 280 #define RECTANGLE 281 #define GRAPH 282 #define OF 283 #define VIEWPORT 284 #define DELETE 285 #define WITHIN 286 #define IF 287 #define THEN 288 #define ELSE 289 #define ID 290 #define IMGFUNC 291 #define CSTRING 292 #define BOOL 293 #define INUMBER 294 #define RNUMBER 295 #define ITOS 296 #define RTOS 297 #define TRUNC 298 #define FLOAT 299 #define SQRT 300 #define SIN 301 #define COS 302 #define TAN 303 #define ASIN 304 #define ACOS 305 #define ATAN 306 #define LOG 307 #define EXP 308 #define RANDOM 309 #define ROT 310 #define SCALE 311 #define TRANS 312 #define REFLECT 313 #define INTERSECT 314 #define PARALLEL 315 #define PERPEND 316 #define DISTANCE 317 #define MIDPOINT 318 #define PT_BETWN_PTS 319 #define COLINEAR 320 #define INTERSECTS 321 #define SEPARATES 322 #define INCLUDES 323 #define INCIDENT 324 #define DISTLARGER 325 #define DISTSMALLER 326 #define QUERY 327 #define SEMICOLON 328 #define COLON 329 #define EQUALS 330 #define COMMA 331 #define OR 332 #define AND 333 #define NOT 334 #define EQ_EQ 335 #define NOT_EQ 336 #define GT 337 #define GT_EQ 338 #define LT 339 #define LT_EQ 340 #define SLASH_SLASH 341 #define ATSIGN 342 #define PLUS 343 #define MINUS 344 #define STAR 345 #define PERCENT 346 #define DIV 347 #define MOD 348 #define TILDE 349 #define TILDE_SLASH 350 #define DOTX 351 #define DOTY 352 #define DOTARG 353 #define DOTRAD 354 #define DOT1 355 #define DOT2 356 #define UMINUS 357 #define SLASH 358 #define LID 359 #define AMPERSAND 360 #define HASH 361 #define VERTBAR 362 #define NEWLINE 363 #define LPAREN 364 #define RPAREN 365 #define LBRACK 366 #define RBRACK 367 #define LCURLY 368 #define RCURLY 369 #define LANGLE 370 #define RANGLE 371 extern YYSTYPE dd_lval; tkeden1.41/Donald/parser.output010060000025250000164000011216130743724013500166030ustar00ashleyem00003510000005 Terminals which are not used: GSPEC GSPECLIST ANY OF PERCENT TILDE AMPERSAND HASH VERTBAR LANGLE RANGLE Conflict in state 110 between rule 57 and token LPAREN resolved as shift. Conflict in state 115 between rule 73 and token OR resolved as reduce. Conflict in state 115 between rule 73 and token AND resolved as reduce. Conflict in state 115 between rule 73 and token EQ_EQ resolved as shift. Conflict in state 115 between rule 73 and token NOT_EQ resolved as shift. Conflict in state 115 between rule 73 and token GT resolved as shift. Conflict in state 115 between rule 73 and token GT_EQ resolved as shift. Conflict in state 115 between rule 73 and token LT resolved as shift. Conflict in state 115 between rule 73 and token LT_EQ resolved as shift. Conflict in state 115 between rule 73 and token SLASH_SLASH resolved as shift. Conflict in state 115 between rule 73 and token PLUS resolved as shift. Conflict in state 115 between rule 73 and token MINUS resolved as shift. Conflict in state 115 between rule 73 and token STAR resolved as shift. Conflict in state 115 between rule 73 and token DIV resolved as shift. Conflict in state 115 between rule 73 and token MOD resolved as shift. Conflict in state 115 between rule 73 and token DOTX resolved as shift. Conflict in state 115 between rule 73 and token DOTY resolved as shift. Conflict in state 115 between rule 73 and token DOTARG resolved as shift. Conflict in state 115 between rule 73 and token DOTRAD resolved as shift. Conflict in state 115 between rule 73 and token DOT1 resolved as shift. Conflict in state 115 between rule 73 and token DOT2 resolved as shift. Conflict in state 116 between rule 72 and token OR resolved as reduce. Conflict in state 116 between rule 72 and token AND resolved as reduce. Conflict in state 116 between rule 72 and token EQ_EQ resolved as reduce. Conflict in state 116 between rule 72 and token NOT_EQ resolved as reduce. Conflict in state 116 between rule 72 and token GT resolved as reduce. Conflict in state 116 between rule 72 and token GT_EQ resolved as reduce. Conflict in state 116 between rule 72 and token LT resolved as reduce. Conflict in state 116 between rule 72 and token LT_EQ resolved as reduce. Conflict in state 116 between rule 72 and token SLASH_SLASH resolved as reduce. Conflict in state 116 between rule 72 and token PLUS resolved as reduce. Conflict in state 116 between rule 72 and token MINUS resolved as reduce. Conflict in state 116 between rule 72 and token STAR resolved as reduce. Conflict in state 116 between rule 72 and token DIV resolved as reduce. Conflict in state 116 between rule 72 and token MOD resolved as reduce. Conflict in state 116 between rule 72 and token DOTX resolved as reduce. Conflict in state 116 between rule 72 and token DOTY resolved as reduce. Conflict in state 116 between rule 72 and token DOTARG resolved as reduce. Conflict in state 116 between rule 72 and token DOTRAD resolved as reduce. Conflict in state 116 between rule 72 and token DOT1 resolved as reduce. Conflict in state 116 between rule 72 and token DOT2 resolved as reduce. Conflict in state 128 between rule 11 and token LCURLY resolved as shift. Conflict in state 192 between rule 41 and token MINUS resolved as shift. Conflict in state 193 between rule 75 and token OR resolved as reduce. Conflict in state 193 between rule 75 and token AND resolved as shift. Conflict in state 193 between rule 75 and token EQ_EQ resolved as shift. Conflict in state 193 between rule 75 and token NOT_EQ resolved as shift. Conflict in state 193 between rule 75 and token GT resolved as shift. Conflict in state 193 between rule 75 and token GT_EQ resolved as shift. Conflict in state 193 between rule 75 and token LT resolved as shift. Conflict in state 193 between rule 75 and token LT_EQ resolved as shift. Conflict in state 193 between rule 75 and token SLASH_SLASH resolved as shift. Conflict in state 193 between rule 75 and token PLUS resolved as shift. Conflict in state 193 between rule 75 and token MINUS resolved as shift. Conflict in state 193 between rule 75 and token STAR resolved as shift. Conflict in state 193 between rule 75 and token DIV resolved as shift. Conflict in state 193 between rule 75 and token MOD resolved as shift. Conflict in state 193 between rule 75 and token DOTX resolved as shift. Conflict in state 193 between rule 75 and token DOTY resolved as shift. Conflict in state 193 between rule 75 and token DOTARG resolved as shift. Conflict in state 193 between rule 75 and token DOTRAD resolved as shift. Conflict in state 193 between rule 75 and token DOT1 resolved as shift. Conflict in state 193 between rule 75 and token DOT2 resolved as shift. Conflict in state 194 between rule 74 and token OR resolved as reduce. Conflict in state 194 between rule 74 and token AND resolved as reduce. Conflict in state 194 between rule 74 and token EQ_EQ resolved as shift. Conflict in state 194 between rule 74 and token NOT_EQ resolved as shift. Conflict in state 194 between rule 74 and token GT resolved as shift. Conflict in state 194 between rule 74 and token GT_EQ resolved as shift. Conflict in state 194 between rule 74 and token LT resolved as shift. Conflict in state 194 between rule 74 and token LT_EQ resolved as shift. Conflict in state 194 between rule 74 and token SLASH_SLASH resolved as shift. Conflict in state 194 between rule 74 and token PLUS resolved as shift. Conflict in state 194 between rule 74 and token MINUS resolved as shift. Conflict in state 194 between rule 74 and token STAR resolved as shift. Conflict in state 194 between rule 74 and token DIV resolved as shift. Conflict in state 194 between rule 74 and token MOD resolved as shift. Conflict in state 194 between rule 74 and token DOTX resolved as shift. Conflict in state 194 between rule 74 and token DOTY resolved as shift. Conflict in state 194 between rule 74 and token DOTARG resolved as shift. Conflict in state 194 between rule 74 and token DOTRAD resolved as shift. Conflict in state 194 between rule 74 and token DOT1 resolved as shift. Conflict in state 194 between rule 74 and token DOT2 resolved as shift. Conflict in state 195 between rule 76 and token OR resolved as reduce. Conflict in state 195 between rule 76 and token AND resolved as reduce. Conflict in state 195 between rule 76 and token EQ_EQ resolved as reduce. Conflict in state 195 between rule 76 and token NOT_EQ resolved as reduce. Conflict in state 195 between rule 76 and token GT resolved as shift. Conflict in state 195 between rule 76 and token GT_EQ resolved as shift. Conflict in state 195 between rule 76 and token LT resolved as shift. Conflict in state 195 between rule 76 and token LT_EQ resolved as shift. Conflict in state 195 between rule 76 and token SLASH_SLASH resolved as shift. Conflict in state 195 between rule 76 and token PLUS resolved as shift. Conflict in state 195 between rule 76 and token MINUS resolved as shift. Conflict in state 195 between rule 76 and token STAR resolved as shift. Conflict in state 195 between rule 76 and token DIV resolved as shift. Conflict in state 195 between rule 76 and token MOD resolved as shift. Conflict in state 195 between rule 76 and token DOTX resolved as shift. Conflict in state 195 between rule 76 and token DOTY resolved as shift. Conflict in state 195 between rule 76 and token DOTARG resolved as shift. Conflict in state 195 between rule 76 and token DOTRAD resolved as shift. Conflict in state 195 between rule 76 and token DOT1 resolved as shift. Conflict in state 195 between rule 76 and token DOT2 resolved as shift. Conflict in state 196 between rule 77 and token OR resolved as reduce. Conflict in state 196 between rule 77 and token AND resolved as reduce. Conflict in state 196 between rule 77 and token EQ_EQ resolved as reduce. Conflict in state 196 between rule 77 and token NOT_EQ resolved as reduce. Conflict in state 196 between rule 77 and token GT resolved as shift. Conflict in state 196 between rule 77 and token GT_EQ resolved as shift. Conflict in state 196 between rule 77 and token LT resolved as shift. Conflict in state 196 between rule 77 and token LT_EQ resolved as shift. Conflict in state 196 between rule 77 and token SLASH_SLASH resolved as shift. Conflict in state 196 between rule 77 and token PLUS resolved as shift. Conflict in state 196 between rule 77 and token MINUS resolved as shift. Conflict in state 196 between rule 77 and token STAR resolved as shift. Conflict in state 196 between rule 77 and token DIV resolved as shift. Conflict in state 196 between rule 77 and token MOD resolved as shift. Conflict in state 196 between rule 77 and token DOTX resolved as shift. Conflict in state 196 between rule 77 and token DOTY resolved as shift. Conflict in state 196 between rule 77 and token DOTARG resolved as shift. Conflict in state 196 between rule 77 and token DOTRAD resolved as shift. Conflict in state 196 between rule 77 and token DOT1 resolved as shift. Conflict in state 196 between rule 77 and token DOT2 resolved as shift. Conflict in state 197 between rule 80 and token OR resolved as reduce. Conflict in state 197 between rule 80 and token AND resolved as reduce. Conflict in state 197 between rule 80 and token EQ_EQ resolved as reduce. Conflict in state 197 between rule 80 and token NOT_EQ resolved as reduce. Conflict in state 197 between rule 80 and token GT resolved as reduce. Conflict in state 197 between rule 80 and token GT_EQ resolved as reduce. Conflict in state 197 between rule 80 and token LT resolved as reduce. Conflict in state 197 between rule 80 and token LT_EQ resolved as reduce. Conflict in state 197 between rule 80 and token SLASH_SLASH resolved as shift. Conflict in state 197 between rule 80 and token PLUS resolved as shift. Conflict in state 197 between rule 80 and token MINUS resolved as shift. Conflict in state 197 between rule 80 and token STAR resolved as shift. Conflict in state 197 between rule 80 and token DIV resolved as shift. Conflict in state 197 between rule 80 and token MOD resolved as shift. Conflict in state 197 between rule 80 and token DOTX resolved as shift. Conflict in state 197 between rule 80 and token DOTY resolved as shift. Conflict in state 197 between rule 80 and token DOTARG resolved as shift. Conflict in state 197 between rule 80 and token DOTRAD resolved as shift. Conflict in state 197 between rule 80 and token DOT1 resolved as shift. Conflict in state 197 between rule 80 and token DOT2 resolved as shift. Conflict in state 198 between rule 81 and token OR resolved as reduce. Conflict in state 198 between rule 81 and token AND resolved as reduce. Conflict in state 198 between rule 81 and token EQ_EQ resolved as reduce. Conflict in state 198 between rule 81 and token NOT_EQ resolved as reduce. Conflict in state 198 between rule 81 and token GT resolved as reduce. Conflict in state 198 between rule 81 and token GT_EQ resolved as reduce. Conflict in state 198 between rule 81 and token LT resolved as reduce. Conflict in state 198 between rule 81 and token LT_EQ resolved as reduce. Conflict in state 198 between rule 81 and token SLASH_SLASH resolved as shift. Conflict in state 198 between rule 81 and token PLUS resolved as shift. Conflict in state 198 between rule 81 and token MINUS resolved as shift. Conflict in state 198 between rule 81 and token STAR resolved as shift. Conflict in state 198 between rule 81 and token DIV resolved as shift. Conflict in state 198 between rule 81 and token MOD resolved as shift. Conflict in state 198 between rule 81 and token DOTX resolved as shift. Conflict in state 198 between rule 81 and token DOTY resolved as shift. Conflict in state 198 between rule 81 and token DOTARG resolved as shift. Conflict in state 198 between rule 81 and token DOTRAD resolved as shift. Conflict in state 198 between rule 81 and token DOT1 resolved as shift. Conflict in state 198 between rule 81 and token DOT2 resolved as shift. Conflict in state 199 between rule 78 and token OR resolved as reduce. Conflict in state 199 between rule 78 and token AND resolved as reduce. Conflict in state 199 between rule 78 and token EQ_EQ resolved as reduce. Conflict in state 199 between rule 78 and token NOT_EQ resolved as reduce. Conflict in state 199 between rule 78 and token GT resolved as reduce. Conflict in state 199 between rule 78 and token GT_EQ resolved as reduce. Conflict in state 199 between rule 78 and token LT resolved as reduce. Conflict in state 199 between rule 78 and token LT_EQ resolved as reduce. Conflict in state 199 between rule 78 and token SLASH_SLASH resolved as shift. Conflict in state 199 between rule 78 and token PLUS resolved as shift. Conflict in state 199 between rule 78 and token MINUS resolved as shift. Conflict in state 199 between rule 78 and token STAR resolved as shift. Conflict in state 199 between rule 78 and token DIV resolved as shift. Conflict in state 199 between rule 78 and token MOD resolved as shift. Conflict in state 199 between rule 78 and token DOTX resolved as shift. Conflict in state 199 between rule 78 and token DOTY resolved as shift. Conflict in state 199 between rule 78 and token DOTARG resolved as shift. Conflict in state 199 between rule 78 and token DOTRAD resolved as shift. Conflict in state 199 between rule 78 and token DOT1 resolved as shift. Conflict in state 199 between rule 78 and token DOT2 resolved as shift. Conflict in state 200 between rule 79 and token OR resolved as reduce. Conflict in state 200 between rule 79 and token AND resolved as reduce. Conflict in state 200 between rule 79 and token EQ_EQ resolved as reduce. Conflict in state 200 between rule 79 and token NOT_EQ resolved as reduce. Conflict in state 200 between rule 79 and token GT resolved as reduce. Conflict in state 200 between rule 79 and token GT_EQ resolved as reduce. Conflict in state 200 between rule 79 and token LT resolved as reduce. Conflict in state 200 between rule 79 and token LT_EQ resolved as reduce. Conflict in state 200 between rule 79 and token SLASH_SLASH resolved as shift. Conflict in state 200 between rule 79 and token PLUS resolved as shift. Conflict in state 200 between rule 79 and token MINUS resolved as shift. Conflict in state 200 between rule 79 and token STAR resolved as shift. Conflict in state 200 between rule 79 and token DIV resolved as shift. Conflict in state 200 between rule 79 and token MOD resolved as shift. Conflict in state 200 between rule 79 and token DOTX resolved as shift. Conflict in state 200 between rule 79 and token DOTY resolved as shift. Conflict in state 200 between rule 79 and token DOTARG resolved as shift. Conflict in state 200 between rule 79 and token DOTRAD resolved as shift. Conflict in state 200 between rule 79 and token DOT1 resolved as shift. Conflict in state 200 between rule 79 and token DOT2 resolved as shift. Conflict in state 201 between rule 82 and token OR resolved as reduce. Conflict in state 201 between rule 82 and token AND resolved as reduce. Conflict in state 201 between rule 82 and token EQ_EQ resolved as reduce. Conflict in state 201 between rule 82 and token NOT_EQ resolved as reduce. Conflict in state 201 between rule 82 and token GT resolved as reduce. Conflict in state 201 between rule 82 and token GT_EQ resolved as reduce. Conflict in state 201 between rule 82 and token LT resolved as reduce. Conflict in state 201 between rule 82 and token LT_EQ resolved as reduce. Conflict in state 201 between rule 82 and token SLASH_SLASH resolved as reduce. Conflict in state 201 between rule 82 and token PLUS resolved as shift. Conflict in state 201 between rule 82 and token MINUS resolved as shift. Conflict in state 201 between rule 82 and token STAR resolved as shift. Conflict in state 201 between rule 82 and token DIV resolved as shift. Conflict in state 201 between rule 82 and token MOD resolved as shift. Conflict in state 201 between rule 82 and token DOTX resolved as shift. Conflict in state 201 between rule 82 and token DOTY resolved as shift. Conflict in state 201 between rule 82 and token DOTARG resolved as shift. Conflict in state 201 between rule 82 and token DOTRAD resolved as shift. Conflict in state 201 between rule 82 and token DOT1 resolved as shift. Conflict in state 201 between rule 82 and token DOT2 resolved as shift. Conflict in state 202 between rule 67 and token OR resolved as reduce. Conflict in state 202 between rule 67 and token AND resolved as reduce. Conflict in state 202 between rule 67 and token EQ_EQ resolved as reduce. Conflict in state 202 between rule 67 and token NOT_EQ resolved as reduce. Conflict in state 202 between rule 67 and token GT resolved as reduce. Conflict in state 202 between rule 67 and token GT_EQ resolved as reduce. Conflict in state 202 between rule 67 and token LT resolved as reduce. Conflict in state 202 between rule 67 and token LT_EQ resolved as reduce. Conflict in state 202 between rule 67 and token SLASH_SLASH resolved as reduce. Conflict in state 202 between rule 67 and token PLUS resolved as reduce. Conflict in state 202 between rule 67 and token MINUS resolved as reduce. Conflict in state 202 between rule 67 and token STAR resolved as shift. Conflict in state 202 between rule 67 and token DIV resolved as shift. Conflict in state 202 between rule 67 and token MOD resolved as shift. Conflict in state 202 between rule 67 and token DOTX resolved as shift. Conflict in state 202 between rule 67 and token DOTY resolved as shift. Conflict in state 202 between rule 67 and token DOTARG resolved as shift. Conflict in state 202 between rule 67 and token DOTRAD resolved as shift. Conflict in state 202 between rule 67 and token DOT1 resolved as shift. Conflict in state 202 between rule 67 and token DOT2 resolved as shift. Conflict in state 203 between rule 68 and token OR resolved as reduce. Conflict in state 203 between rule 68 and token AND resolved as reduce. Conflict in state 203 between rule 68 and token EQ_EQ resolved as reduce. Conflict in state 203 between rule 68 and token NOT_EQ resolved as reduce. Conflict in state 203 between rule 68 and token GT resolved as reduce. Conflict in state 203 between rule 68 and token GT_EQ resolved as reduce. Conflict in state 203 between rule 68 and token LT resolved as reduce. Conflict in state 203 between rule 68 and token LT_EQ resolved as reduce. Conflict in state 203 between rule 68 and token SLASH_SLASH resolved as reduce. Conflict in state 203 between rule 68 and token PLUS resolved as reduce. Conflict in state 203 between rule 68 and token MINUS resolved as reduce. Conflict in state 203 between rule 68 and token STAR resolved as shift. Conflict in state 203 between rule 68 and token DIV resolved as shift. Conflict in state 203 between rule 68 and token MOD resolved as shift. Conflict in state 203 between rule 68 and token DOTX resolved as shift. Conflict in state 203 between rule 68 and token DOTY resolved as shift. Conflict in state 203 between rule 68 and token DOTARG resolved as shift. Conflict in state 203 between rule 68 and token DOTRAD resolved as shift. Conflict in state 203 between rule 68 and token DOT1 resolved as shift. Conflict in state 203 between rule 68 and token DOT2 resolved as shift. Conflict in state 204 between rule 69 and token OR resolved as reduce. Conflict in state 204 between rule 69 and token AND resolved as reduce. Conflict in state 204 between rule 69 and token EQ_EQ resolved as reduce. Conflict in state 204 between rule 69 and token NOT_EQ resolved as reduce. Conflict in state 204 between rule 69 and token GT resolved as reduce. Conflict in state 204 between rule 69 and token GT_EQ resolved as reduce. Conflict in state 204 between rule 69 and token LT resolved as reduce. Conflict in state 204 between rule 69 and token LT_EQ resolved as reduce. Conflict in state 204 between rule 69 and token SLASH_SLASH resolved as reduce. Conflict in state 204 between rule 69 and token PLUS resolved as reduce. Conflict in state 204 between rule 69 and token MINUS resolved as reduce. Conflict in state 204 between rule 69 and token STAR resolved as reduce. Conflict in state 204 between rule 69 and token DIV resolved as reduce. Conflict in state 204 between rule 69 and token MOD resolved as reduce. Conflict in state 204 between rule 69 and token DOTX resolved as shift. Conflict in state 204 between rule 69 and token DOTY resolved as shift. Conflict in state 204 between rule 69 and token DOTARG resolved as shift. Conflict in state 204 between rule 69 and token DOTRAD resolved as shift. Conflict in state 204 between rule 69 and token DOT1 resolved as shift. Conflict in state 204 between rule 69 and token DOT2 resolved as shift. Conflict in state 205 between rule 71 and token OR resolved as reduce. Conflict in state 205 between rule 71 and token AND resolved as reduce. Conflict in state 205 between rule 71 and token EQ_EQ resolved as reduce. Conflict in state 205 between rule 71 and token NOT_EQ resolved as reduce. Conflict in state 205 between rule 71 and token GT resolved as reduce. Conflict in state 205 between rule 71 and token GT_EQ resolved as reduce. Conflict in state 205 between rule 71 and token LT resolved as reduce. Conflict in state 205 between rule 71 and token LT_EQ resolved as reduce. Conflict in state 205 between rule 71 and token SLASH_SLASH resolved as reduce. Conflict in state 205 between rule 71 and token PLUS resolved as reduce. Conflict in state 205 between rule 71 and token MINUS resolved as reduce. Conflict in state 205 between rule 71 and token STAR resolved as reduce. Conflict in state 205 between rule 71 and token DIV resolved as reduce. Conflict in state 205 between rule 71 and token MOD resolved as reduce. Conflict in state 205 between rule 71 and token DOTX resolved as shift. Conflict in state 205 between rule 71 and token DOTY resolved as shift. Conflict in state 205 between rule 71 and token DOTARG resolved as shift. Conflict in state 205 between rule 71 and token DOTRAD resolved as shift. Conflict in state 205 between rule 71 and token DOT1 resolved as shift. Conflict in state 205 between rule 71 and token DOT2 resolved as shift. Conflict in state 206 between rule 70 and token OR resolved as reduce. Conflict in state 206 between rule 70 and token AND resolved as reduce. Conflict in state 206 between rule 70 and token EQ_EQ resolved as reduce. Conflict in state 206 between rule 70 and token NOT_EQ resolved as reduce. Conflict in state 206 between rule 70 and token GT resolved as reduce. Conflict in state 206 between rule 70 and token GT_EQ resolved as reduce. Conflict in state 206 between rule 70 and token LT resolved as reduce. Conflict in state 206 between rule 70 and token LT_EQ resolved as reduce. Conflict in state 206 between rule 70 and token SLASH_SLASH resolved as reduce. Conflict in state 206 between rule 70 and token PLUS resolved as reduce. Conflict in state 206 between rule 70 and token MINUS resolved as reduce. Conflict in state 206 between rule 70 and token STAR resolved as reduce. Conflict in state 206 between rule 70 and token DIV resolved as reduce. Conflict in state 206 between rule 70 and token MOD resolved as reduce. Conflict in state 206 between rule 70 and token DOTX resolved as shift. Conflict in state 206 between rule 70 and token DOTY resolved as shift. Conflict in state 206 between rule 70 and token DOTARG resolved as shift. Conflict in state 206 between rule 70 and token DOTRAD resolved as shift. Conflict in state 206 between rule 70 and token DOT1 resolved as shift. Conflict in state 206 between rule 70 and token DOT2 resolved as shift. Conflict in state 261 between rule 99 and token OR resolved as shift. Conflict in state 261 between rule 99 and token AND resolved as shift. Conflict in state 261 between rule 99 and token EQ_EQ resolved as shift. Conflict in state 261 between rule 99 and token NOT_EQ resolved as shift. Conflict in state 261 between rule 99 and token GT resolved as shift. Conflict in state 261 between rule 99 and token GT_EQ resolved as shift. Conflict in state 261 between rule 99 and token LT resolved as shift. Conflict in state 261 between rule 99 and token LT_EQ resolved as shift. Conflict in state 261 between rule 99 and token SLASH_SLASH resolved as shift. Conflict in state 261 between rule 99 and token PLUS resolved as shift. Conflict in state 261 between rule 99 and token MINUS resolved as shift. Conflict in state 261 between rule 99 and token STAR resolved as shift. Conflict in state 261 between rule 99 and token DIV resolved as shift. Conflict in state 261 between rule 99 and token MOD resolved as shift. Conflict in state 261 between rule 99 and token DOTX resolved as shift. Conflict in state 261 between rule 99 and token DOTY resolved as shift. Conflict in state 261 between rule 99 and token DOTARG resolved as shift. Conflict in state 261 between rule 99 and token DOTRAD resolved as shift. Conflict in state 261 between rule 99 and token DOT1 resolved as shift. Conflict in state 261 between rule 99 and token DOT2 resolved as shift. State 6 contains 1 shift/reduce conflict. State 7 contains 1 shift/reduce conflict. State 17 contains 1 shift/reduce conflict. State 19 contains 1 shift/reduce conflict. State 20 contains 1 shift/reduce conflict. State 24 contains 1 shift/reduce conflict. State 30 contains 1 shift/reduce conflict. State 84 contains 1 shift/reduce conflict. State 90 contains 1 shift/reduce conflict. State 127 contains 1 shift/reduce conflict. State 189 contains 1 shift/reduce conflict. Grammar rule 1 program_list -> /* empty */ rule 2 program_list -> program_list stmt rule 3 program_list -> program_list error rule 4 stmt -> VIEWPORT ID rule 5 stmt -> declaration rule 6 stmt -> definition rule 7 @1 -> /* empty */ rule 8 stmt -> @1 evaluation rule 9 stmt -> within_clause rule 10 stmt -> delete rule 11 stmt -> NEWLINE rule 12 delete -> DELETE expr_list NEWLINE rule 13 within_id -> WITHIN identifier rule 14 within_clause -> within_id stmt rule 15 within_clause -> within_id NEWLINE LCURLY stmt_list RCURLY rule 16 within_clause -> within_id LCURLY stmt_list RCURLY rule 17 stmt_list -> stmt rule 18 stmt_list -> stmt_list stmt rule 19 declaration -> type_name expr_list NEWLINE rule 20 declaration -> GRAPH expr_list rule 21 type_name -> INT rule 22 type_name -> REAL rule 23 type_name -> MYCHAR rule 24 type_name -> BOOLEAN rule 25 type_name -> POINT rule 26 type_name -> LINE rule 27 type_name -> ARC rule 28 type_name -> CIRCLE rule 29 type_name -> ELLIPSE rule 30 type_name -> LABEL rule 31 type_name -> SHAPE rule 32 type_name -> OPENSHAPE rule 33 type_name -> IMAGE rule 34 type_name -> RECTANGLE rule 35 definition -> expr_list EQUALS expr_list NEWLINE rule 36 definition -> XI EQUALS expr NEWLINE rule 37 definition -> FI EQUALS expr NEWLINE rule 38 evaluation -> QUERY NEWLINE rule 39 evaluation -> evaluation QUERY NEWLINE rule 40 expr_list -> expr rule 41 expr_list -> expr_list COMMA expr rule 42 expr -> INF rule 43 expr -> PI rule 44 expr -> INUMBER rule 45 expr -> RNUMBER rule 46 expr -> CSTRING rule 47 expr -> BOOL rule 48 expr -> I rule 49 expr -> XI rule 50 expr -> FI rule 51 expr -> I_1 rule 52 expr -> XI_1 rule 53 expr -> FI_1 rule 54 expr -> LBRACK graph_spec_list RBRACK rule 55 expr -> LBRACK NEWLINE graph_spec_list RBRACK rule 56 expr -> identifier rule 57 expr -> ID NOT rule 58 expr -> LPAREN expr RPAREN rule 59 expr -> LCURLY expr COMMA expr RCURLY rule 60 expr -> LCURLY expr ATSIGN expr RCURLY rule 61 expr -> LBRACK expr COMMA expr RBRACK rule 62 expr -> LBRACK expr COMMA expr COMMA expr RBRACK rule 63 expr -> CIRCLE LPAREN expr COMMA expr RPAREN rule 64 expr -> RECTANGLE LPAREN expr COMMA expr RPAREN rule 65 expr -> ELLIPSE LPAREN expr COMMA expr COMMA expr RPAREN rule 66 expr -> LABEL LPAREN expr COMMA expr RPAREN rule 67 expr -> expr PLUS expr rule 68 expr -> expr MINUS expr rule 69 expr -> expr STAR expr rule 70 expr -> expr MOD expr rule 71 expr -> expr DIV expr rule 72 expr -> MINUS expr rule 73 expr -> NOT expr rule 74 expr -> expr AND expr rule 75 expr -> expr OR expr rule 76 expr -> expr EQ_EQ expr rule 77 expr -> expr NOT_EQ expr rule 78 expr -> expr LT expr rule 79 expr -> expr LT_EQ expr rule 80 expr -> expr GT expr rule 81 expr -> expr GT_EQ expr rule 82 expr -> expr SLASH_SLASH expr rule 83 expr -> ITOS LPAREN expr RPAREN rule 84 expr -> RTOS LPAREN expr COMMA expr RPAREN rule 85 expr -> expr DOTX rule 86 expr -> expr DOTY rule 87 expr -> expr DOT1 rule 88 expr -> expr DOT2 rule 89 expr -> expr DOTRAD rule 90 expr -> expr DOTARG rule 91 expr -> ID NOT LPAREN RPAREN rule 92 expr -> ID NOT LPAREN expr_list RPAREN rule 93 expr -> IMGFUNC LPAREN RPAREN rule 94 expr -> IMGFUNC LPAREN expr_list RPAREN rule 95 expr -> func1 LPAREN expr RPAREN rule 96 expr -> func2 LPAREN expr COMMA expr RPAREN rule 97 expr -> func3 LPAREN expr COMMA expr COMMA expr RPAREN rule 98 expr -> PARALLEL LPAREN expr COMMA expr COMMA expr COMMA expr RPAREN rule 99 expr -> IF expr THEN expr ELSE expr rule 100 func1 -> SQRT rule 101 func1 -> SIN rule 102 func1 -> COS rule 103 func1 -> TAN rule 104 func1 -> ASIN rule 105 func1 -> ACOS rule 106 func1 -> ATAN rule 107 func1 -> LOG rule 108 func1 -> EXP rule 109 func1 -> TRUNC rule 110 func1 -> FLOAT rule 111 func1 -> MIDPOINT rule 112 func1 -> RANDOM rule 113 func2 -> INTERSECT rule 114 func2 -> PERPEND rule 115 func2 -> DISTANCE rule 116 func2 -> SCALE rule 117 func2 -> INTERSECTS rule 118 func2 -> INCLUDES rule 119 func2 -> INCIDENT rule 120 func2 -> REFLECT rule 121 func3 -> ROT rule 122 func3 -> TRANS rule 123 func3 -> PT_BETWN_PTS rule 124 func3 -> COLINEAR rule 125 func3 -> SEPARATES rule 126 func3 -> DISTLARGER rule 127 func3 -> DISTSMALLER rule 128 identifier -> local_identifier rule 129 identifier -> SLASH local_identifier rule 130 local_identifier -> local_id SLASH local_identifier rule 131 local_identifier -> TILDE_SLASH local_identifier rule 132 local_identifier -> local_id rule 133 local_id -> id rule 134 id -> ID rule 135 graph_spec_list -> /* empty */ rule 136 graph_spec_list -> graph_spec rule 137 graph_spec_list -> graph_spec_list SEMICOLON graph_spec rule 138 graph_spec_list -> graph_spec_list SEMICOLON NEWLINE graph_spec rule 139 graph_spec -> type_name COLON rule 140 graph_spec -> type_name COLON expr rule 141 graph_spec -> type_name COLON NEWLINE rule 142 graph_spec -> type_name COLON expr NEWLINE Terminals, with rules where they appear $ (-1) error (256) 3 INF (257) 42 PI (258) 43 I (259) 48 XI (260) 36 49 FI (261) 37 50 I_1 (262) 51 XI_1 (263) 52 FI_1 (264) 53 IMAGE (265) 33 MYCHAR (266) 23 REAL (267) 22 INT (268) 21 BOOLEAN (269) 24 POINT (270) 25 LABEL (271) 30 66 GSPEC (272) GSPECLIST (273) ANY (274) LINE (275) 26 CIRCLE (276) 28 63 ELLIPSE (277) 29 65 SHAPE (278) 31 OPENSHAPE (279) 32 ARC (280) 27 RECTANGLE (281) 34 64 GRAPH (282) 20 OF (283) VIEWPORT (284) 4 DELETE (285) 12 WITHIN (286) 13 IF (287) 99 THEN (288) 99 ELSE (289) 99 ID (290) 4 57 91 92 134 IMGFUNC (291) 93 94 CSTRING (292) 46 BOOL (293) 47 INUMBER (294) 44 RNUMBER (295) 45 ITOS (296) 83 RTOS (297) 84 TRUNC (298) 109 FLOAT (299) 110 SQRT (300) 100 SIN (301) 101 COS (302) 102 TAN (303) 103 ASIN (304) 104 ACOS (305) 105 ATAN (306) 106 LOG (307) 107 EXP (308) 108 RANDOM (309) 112 ROT (310) 121 SCALE (311) 116 TRANS (312) 122 REFLECT (313) 120 INTERSECT (314) 113 PARALLEL (315) 98 PERPEND (316) 114 DISTANCE (317) 115 MIDPOINT (318) 111 PT_BETWN_PTS (319) 123 COLINEAR (320) 124 INTERSECTS (321) 117 SEPARATES (322) 125 INCLUDES (323) 118 INCIDENT (324) 119 DISTLARGER (325) 126 DISTSMALLER (326) 127 QUERY (327) 38 39 SEMICOLON (328) 137 138 COLON (329) 139 140 141 142 EQUALS (330) 35 36 37 COMMA (331) 41 59 61 62 63 64 65 66 84 96 97 98 OR (332) 75 AND (333) 74 NOT (334) 57 73 91 92 EQ_EQ (335) 76 NOT_EQ (336) 77 GT (337) 80 GT_EQ (338) 81 LT (339) 78 LT_EQ (340) 79 SLASH_SLASH (341) 82 ATSIGN (342) 60 PLUS (343) 67 MINUS (344) 68 72 STAR (345) 69 PERCENT (346) DIV (347) 71 MOD (348) 70 TILDE (349) TILDE_SLASH (350) 131 DOTX (351) 85 DOTY (352) 86 DOTARG (353) 90 DOTRAD (354) 89 DOT1 (355) 87 DOT2 (356) 88 UMINUS (357) SLASH (358) 129 130 LID (359) AMPERSAND (360) HASH (361) VERTBAR (362) NEWLINE (363) 11 12 15 19 35 36 37 38 39 55 138 141 142 LPAREN (364) 58 63 64 65 66 83 84 91 92 93 94 95 96 97 98 RPAREN (365) 58 63 64 65 66 83 84 91 92 93 94 95 96 97 98 LBRACK (366) 54 55 61 62 RBRACK (367) 54 55 61 62 LCURLY (368) 15 16 59 60 RCURLY (369) 15 16 59 60 LANGLE (370) RANGLE (371) Nonterminals, with rules where they appear program_list (118) on left: 1 2 3, on right: 2 3 stmt (119) on left: 4 5 6 8 9 10 11, on right: 2 14 17 18 @1 (120) on left: 7, on right: 8 delete (121) on left: 12, on right: 10 within_id (122) on left: 13, on right: 14 15 16 within_clause (123) on left: 14 15 16, on right: 9 stmt_list (124) on left: 17 18, on right: 15 16 18 declaration (125) on left: 19 20, on right: 5 type_name (126) on left: 21 22 23 24 25 26 27 28 29 30 31 32 33 34, on right: 19 139 140 141 142 definition (127) on left: 35 36 37, on right: 6 evaluation (128) on left: 38 39, on right: 8 39 expr_list (129) on left: 40 41, on right: 12 19 20 35 41 92 94 expr (130) on left: 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99, on right: 36 37 40 41 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 95 96 97 98 99 140 142 func1 (131) on left: 100 101 102 103 104 105 106 107 108 109 110 111 112, on right: 95 func2 (132) on left: 113 114 115 116 117 118 119 120, on right: 96 func3 (133) on left: 121 122 123 124 125 126 127, on right: 97 identifier (134) on left: 128 129, on right: 13 56 local_identifier (135) on left: 130 131 132, on right: 128 129 130 131 local_id (136) on left: 133, on right: 130 132 id (137) on left: 134, on right: 133 graph_spec_list (138) on left: 135 136 137 138, on right: 54 55 137 138 graph_spec (139) on left: 139 140 141 142, on right: 136 137 138 state 0 $default reduce using rule 1 (program_list) program_list go to state 1 state 1 program_list -> program_list . stmt (rule 2) program_list -> program_list . error (rule 3) $ go to state 276 error shift, and go to state 2 INF shift, and go to state 3 PI shift, and go to state 4 I shift, and go to state 5 XI shift, and go to state 6 FI shift, and go to state 7 I_1 shift, and go to state 8 XI_1 shift, and go to state 9 FI_1 shift, and go to state 10 IMAGE shift, and go to state 11 MYCHAR shift, and go to state 12 REAL shift, and go to state 13 INT shift, and go to state 14 BOOLEAN shift, and go to state 15 POINT shift, and go to state 16 LABEL shift, and go to state 17 LINE shift, and go to state 18 CIRCLE shift, and go to state 19 ELLIPSE shift, and go to state 20 SHAPE shift, and go to state 21 OPENSHAPE shift, and go to state 22 ARC shift, and go to state 23 RECTANGLE shift, and go to state 24 GRAPH shift, and go to state 25 VIEWPORT shift, and go to state 26 DELETE shift, and go to state 27 WITHIN shift, and go to state 28 IF shift, and go to state 29 ID shift, and go to state 30 IMGFUNC shift, and go to state 31 CSTRING shift, and go to state 32 BOOL shift, and go to state 33 INUMBER shift, and go to state 34 RNUMBER shift, and go to state 35 ITOS shift, and go to state 36 RTOS shift, and go to state 37 TRUNC shift, and go to state 38 FLOAT shift, and go to state 39 SQRT shift, and go to state 40 SIN shift, and go to state 41 COS shift, and go to state 42 TAN shift, and go to state 43 ASIN shift, and go to state 44 ACOS shift, and go to state 45 ATAN shift, and go to state 46 LOG shift, and go to state 47 EXP shift, and go to state 48 RANDOM shift, and go to state 49 ROT shift, and go to state 50 SCALE shift, and go to state 51 TRANS shift, and go to state 52 REFLECT shift, and go to state 53 INTERSECT shift, and go to state 54 PARALLEL shift, and go to state 55 PERPEND shift, and go to state 56 DISTANCE shift, and go to state 57 MIDPOINT shift, and go to state 58 PT_BETWN_PTS shift, and go to state 59 COLINEAR shift, and go to state 60 INTERSECTS shift, and go to state 61 SEPARATES shift, and go to state 62 INCLUDES shift, and go to state 63 INCIDENT shift, and go to state 64 DISTLARGER shift, and go to state 65 DISTSMALLER shift, and go to state 66 NOT shift, and go to state 67 MINUS shift, and go to state 68 TILDE_SLASH shift, and go to state 69 SLASH shift, and go to state 70 NEWLINE shift, and go to state 71 LPAREN shift, and go to state 72 LBRACK shift, and go to state 73 LCURLY shift, and go to state 74 QUERY reduce using rule 7 (@1) stmt go to state 75 @1 go to state 76 delete go to state 77 within_id go to state 78 within_clause go to state 79 declaration go to state 80 type_name go to state 81 definition go to state 82 expr_list go to state 83 expr go to state 84 func1 go to state 85 func2 go to state 86 func3 go to state 87 identifier go to state 88 local_identifier go to state 89 local_id go to state 90 id go to state 91 state 2 program_list -> program_list error . (rule 3) $default reduce using rule 3 (program_list) state 3 expr -> INF . (rule 42) $default reduce using rule 42 (expr) state 4 expr -> PI . (rule 43) $default reduce using rule 43 (expr) state 5 expr -> I . (rule 48) $default reduce using rule 48 (expr) state 6 definition -> XI . EQUALS expr NEWLINE (rule 36) expr -> XI . (rule 49) EQUALS shift, and go to state 92 EQUALS [reduce using rule 49 (expr)] $default reduce using rule 49 (expr) state 7 definition -> FI . EQUALS expr NEWLINE (rule 37) expr -> FI . (rule 50) EQUALS shift, and go to state 93 EQUALS [reduce using rule 50 (expr)] $default reduce using rule 50 (expr) state 8 expr -> I_1 . (rule 51) $default reduce using rule 51 (expr) state 9 expr -> XI_1 . (rule 52) $default reduce using rule 52 (expr) state 10 expr -> FI_1 . (rule 53) $default reduce using rule 53 (expr) state 11 type_name -> IMAGE . (rule 33) $default reduce using rule 33 (type_name) state 12 type_name -> MYCHAR . (rule 23) $default reduce using rule 23 (type_name) state 13 type_name -> REAL . (rule 22) $default reduce using rule 22 (type_name) state 14 type_name -> INT . (rule 21) $default reduce using rule 21 (type_name) state 15 type_name -> BOOLEAN . (rule 24) $default reduce using rule 24 (type_name) state 16 type_name -> POINT . (rule 25) $default reduce using rule 25 (type_name) state 17 type_name -> LABEL . (rule 30) expr -> LABEL . LPAREN expr COMMA expr RPAREN (rule 66) LPAREN shift, and go to state 94 LPAREN [reduce using rule 30 (type_name)] $default reduce using rule 30 (type_name) state 18 type_name -> LINE . (rule 26) $default reduce using rule 26 (type_name) state 19 type_name -> CIRCLE . (rule 28) expr -> CIRCLE . LPAREN expr COMMA expr RPAREN (rule 63) LPAREN shift, and go to state 95 LPAREN [reduce using rule 28 (type_name)] $default reduce using rule 28 (type_name) state 20 type_name -> ELLIPSE . (rule 29) expr -> ELLIPSE . LPAREN expr COMMA expr COMMA expr RPAREN (rule 65) LPAREN shift, and go to state 96 LPAREN [reduce using rule 29 (type_name)] $default reduce using rule 29 (type_name) state 21 type_name -> SHAPE . (rule 31) $default reduce using rule 31 (type_name) state 22 type_name -> OPENSHAPE . (rule 32) $default reduce using rule 32 (type_name) state 23 type_name -> ARC . (rule 27) $default reduce using rule 27 (type_name) state 24 type_name -> RECTANGLE . (rule 34) expr -> RECTANGLE . LPAREN expr COMMA expr RPAREN (rule 64) LPAREN shift, and go to state 97 LPAREN [reduce using rule 34 (type_name)] $default reduce using rule 34 (type_name) state 25 declaration -> GRAPH . expr_list (rule 20) INF shift, and go to state 3 PI shift, and go to state 4 I shift, and go to state 5 XI shift, and go to state 98 FI shift, and go to state 99 I_1 shift, and go to state 8 XI_1 shift, and go to state 9 FI_1 shift, and go to state 10 LABEL shift, and go to state 100 CIRCLE shift, and go to state 101 ELLIPSE shift, and go to state 102 RECTANGLE shift, and go to state 103 IF shift, and go to state 29 ID shift, and go to state 30 IMGFUNC shift, and go to state 31 CSTRING shift, and go to state 32 BOOL shift, and go to state 33 INUMBER shift, and go to state 34 RNUMBER shift, and go to state 35 ITOS shift, and go to state 36 RTOS shift, and go to state 37 TRUNC shift, and go to state 38 FLOAT shift, and go to state 39 SQRT shift, and go to state 40 SIN shift, and go to state 41 COS shift, and go to state 42 TAN shift, and go to state 43 ASIN shift, and go to state 44 ACOS shift, and go to state 45 ATAN shift, and go to state 46 LOG shift, and go to state 47 EXP shift, and go to state 48 RANDOM shift, and go to state 49 ROT shift, and go to state 50 SCALE shift, and go to state 51 TRANS shift, and go to state 52 REFLECT shift, and go to state 53 INTERSECT shift, and go to state 54 PARALLEL shift, and go to state 55 PERPEND shift, and go to state 56 DISTANCE shift, and go to state 57 MIDPOINT shift, and go to state 58 PT_BETWN_PTS shift, and go to state 59 COLINEAR shift, and go to state 60 INTERSECTS shift, and go to state 61 SEPARATES shift, and go to state 62 INCLUDES shift, and go to state 63 INCIDENT shift, and go to state 64 DISTLARGER shift, and go to state 65 DISTSMALLER shift, and go to state 66 NOT shift, and go to state 67 MINUS shift, and go to state 68 TILDE_SLASH shift, and go to state 69 SLASH shift, and go to state 70 LPAREN shift, and go to state 72 LBRACK shift, and go to state 73 LCURLY shift, and go to state 74 expr_list go to state 104 expr go to state 84 func1 go to state 85 func2 go to state 86 func3 go to state 87 identifier go to state 88 local_identifier go to state 89 local_id go to state 90 id go to state 91 state 26 stmt -> VIEWPORT . ID (rule 4) ID shift, and go to state 105 state 27 delete -> DELETE . expr_list NEWLINE (rule 12) INF shift, and go to state 3 PI shift, and go to state 4 I shift, and go to state 5 XI shift, and go to state 98 FI shift, and go to state 99 I_1 shift, and go to state 8 XI_1 shift, and go to state 9 FI_1 shift, and go to state 10 LABEL shift, and go to state 100 CIRCLE shift, and go to state 101 ELLIPSE shift, and go to state 102 RECTANGLE shift, and go to state 103 IF shift, and go to state 29 ID shift, and go to state 30 IMGFUNC shift, and go to state 31 CSTRING shift, and go to state 32 BOOL shift, and go to state 33 INUMBER shift, and go to state 34 RNUMBER shift, and go to state 35 ITOS shift, and go to state 36 RTOS shift, and go to state 37 TRUNC shift, and go to state 38 FLOAT shift, and go to state 39 SQRT shift, and go to state 40 SIN shift, and go to state 41 COS shift, and go to state 42 TAN shift, and go to state 43 ASIN shift, and go to state 44 ACOS shift, and go to state 45 ATAN shift, and go to state 46 LOG shift, and go to state 47 EXP shift, and go to state 48 RANDOM shift, and go to state 49 ROT shift, and go to state 50 SCALE shift, and go to state 51 TRANS shift, and go to state 52 REFLECT shift, and go to state 53 INTERSECT shift, and go to state 54 PARALLEL shift, and go to state 55 PERPEND shift, and go to state 56 DISTANCE shift, and go to state 57 MIDPOINT shift, and go to state 58 PT_BETWN_PTS shift, and go to state 59 COLINEAR shift, and go to state 60 INTERSECTS shift, and go to state 61 SEPARATES shift, and go to state 62 INCLUDES shift, and go to state 63 INCIDENT shift, and go to state 64 DISTLARGER shift, and go to state 65 DISTSMALLER shift, and go to state 66 NOT shift, and go to state 67 MINUS shift, and go to state 68 TILDE_SLASH shift, and go to state 69 SLASH shift, and go to state 70 LPAREN shift, and go to state 72 LBRACK shift, and go to state 73 LCURLY shift, and go to state 74 expr_list go to state 106 expr go to state 84 func1 go to state 85 func2 go to state 86 func3 go to state 87 identifier go to state 88 local_identifier go to state 89 local_id go to state 90 id go to state 91 state 28 within_id -> WITHIN . identifier (rule 13) ID shift, and go to state 107 TILDE_SLASH shift, and go to state 69 SLASH shift, and go to state 70 identifier go to state 108 local_identifier go to state 89 local_id go to state 90 id go to state 91 state 29 expr -> IF . expr THEN expr ELSE expr (rule 99) INF shift, and go to state 3 PI shift, and go to state 4 I shift, and go to state 5 XI shift, and go to state 98 FI shift, and go to state 99 I_1 shift, and go to state 8 XI_1 shift, and go to state 9 FI_1 shift, and go to state 10 LABEL shift, and go to state 100 CIRCLE shift, and go to state 101 ELLIPSE shift, and go to state 102 RECTANGLE shift, and go to state 103 IF shift, and go to state 29 ID shift, and go to state 30 IMGFUNC shift, and go to state 31 CSTRING shift, and go to state 32 BOOL shift, and go to state 33 INUMBER shift, and go to state 34 RNUMBER shift, and go to state 35 ITOS shift, and go to state 36 RTOS shift, and go to state 37 TRUNC shift, and go to state 38 FLOAT shift, and go to state 39 SQRT shift, and go to state 40 SIN shift, and go to state 41 COS shift, and go to state 42 TAN shift, and go to state 43 ASIN shift, and go to state 44 ACOS shift, and go to state 45 ATAN shift, and go to state 46 LOG shift, and go to state 47 EXP shift, and go to state 48 RANDOM shift, and go to state 49 ROT shift, and go to state 50 SCALE shift, and go to state 51 TRANS shift, and go to state 52 REFLECT shift, and go to state 53 INTERSECT shift, and go to state 54 PARALLEL shift, and go to state 55 PERPEND shift, and go to state 56 DISTANCE shift, and go to state 57 MIDPOINT shift, and go to state 58 PT_BETWN_PTS shift, and go to state 59 COLINEAR shift, and go to state 60 INTERSECTS shift, and go to state 61 SEPARATES shift, and go to state 62 INCLUDES shift, and go to state 63 INCIDENT shift, and go to state 64 DISTLARGER shift, and go to state 65 DISTSMALLER shift, and go to state 66 NOT shift, and go to state 67 MINUS shift, and go to state 68 TILDE_SLASH shift, and go to state 69 SLASH shift, and go to state 70 LPAREN shift, and go to state 72 LBRACK shift, and go to state 73 LCURLY shift, and go to state 74 expr go to state 109 func1 go to state 85 func2 go to state 86 func3 go to state 87 identifier go to state 88 local_identifier go to state 89 local_id go to state 90 id go to state 91 state 30 expr -> ID . NOT (rule 57) expr -> ID . NOT LPAREN RPAREN (rule 91) expr -> ID . NOT LPAREN expr_list RPAREN (rule 92) id -> ID . (rule 134) NOT shift, and go to state 110 NOT [reduce using rule 134 (id)] $default reduce using rule 134 (id) state 31 expr -> IMGFUNC . LPAREN RPAREN (rule 93) expr -> IMGFUNC . LPAREN expr_list RPAREN (rule 94) LPAREN shift, and go to state 111 state 32 expr -> CSTRING . (rule 46) $default reduce using rule 46 (expr) state 33 expr -> BOOL . (rule 47) $default reduce using rule 47 (expr) state 34 expr -> INUMBER . (rule 44) $default reduce using rule 44 (expr) state 35 expr -> RNUMBER . (rule 45) $default reduce using rule 45 (expr) state 36 expr -> ITOS . LPAREN expr RPAREN (rule 83) LPAREN shift, and go to state 112 state 37 expr -> RTOS . LPAREN expr COMMA expr RPAREN (rule 84) LPAREN shift, and go to state 113 state 38 func1 -> TRUNC . (rule 109) $default reduce using rule 109 (func1) state 39 func1 -> FLOAT . (rule 110) $default reduce using rule 110 (func1) state 40 func1 -> SQRT . (rule 100) $default reduce using rule 100 (func1) state 41 func1 -> SIN . (rule 101) $default reduce using rule 101 (func1) state 42 func1 -> COS . (rule 102) $default reduce using rule 102 (func1) state 43 func1 -> TAN . (rule 103) $default reduce using rule 103 (func1) state 44 func1 -> ASIN . (rule 104) $default reduce using rule 104 (func1) state 45 func1 -> ACOS . (rule 105) $default reduce using rule 105 (func1) state 46 func1 -> ATAN . (rule 106) $default reduce using rule 106 (func1) state 47 func1 -> LOG . (rule 107) $default reduce using rule 107 (func1) state 48 func1 -> EXP . (rule 108) $default reduce using rule 108 (func1) state 49 func1 -> RANDOM . (rule 112) $default reduce using rule 112 (func1) state 50 func3 -> ROT . (rule 121) $default reduce using rule 121 (func3) state 51 func2 -> SCALE . (rule 116) $default reduce using rule 116 (func2) state 52 func3 -> TRANS . (rule 122) $default reduce using rule 122 (func3) state 53 func2 -> REFLECT . (rule 120) $default reduce using rule 120 (func2) state 54 func2 -> INTERSECT . (rule 113) $default reduce using rule 113 (func2) state 55 expr -> PARALLEL . LPAREN expr COMMA expr COMMA expr COMMA expr RPAREN (rule 98) LPAREN shift, and go to state 114 state 56 func2 -> PERPEND . (rule 114) $default reduce using rule 114 (func2) state 57 func2 -> DISTANCE . (rule 115) $default reduce using rule 115 (func2) state 58 func1 -> MIDPOINT . (rule 111) $default reduce using rule 111 (func1) state 59 func3 -> PT_BETWN_PTS . (rule 123) $default reduce using rule 123 (func3) state 60 func3 -> COLINEAR . (rule 124) $default reduce using rule 124 (func3) state 61 func2 -> INTERSECTS . (rule 117) $default reduce using rule 117 (func2) state 62 func3 -> SEPARATES . (rule 125) $default reduce using rule 125 (func3) state 63 func2 -> INCLUDES . (rule 118) $default reduce using rule 118 (func2) state 64 func2 -> INCIDENT . (rule 119) $default reduce using rule 119 (func2) state 65 func3 -> DISTLARGER . (rule 126) $default reduce using rule 126 (func3) state 66 func3 -> DISTSMALLER . (rule 127) $default reduce using rule 127 (func3) state 67 expr -> NOT . expr (rule 73) INF shift, and go to state 3 PI shift, and go to state 4 I shift, and go to state 5 XI shift, and go to state 98 FI shift, and go to state 99 I_1 shift, and go to state 8 XI_1 shift, and go to state 9 FI_1 shift, and go to state 10 LABEL shift, and go to state 100 CIRCLE shift, and go to state 101 ELLIPSE shift, and go to state 102 RECTANGLE shift, and go to state 103 IF shift, and go to state 29 ID shift, and go to state 30 IMGFUNC shift, and go to state 31 CSTRING shift, and go to state 32 BOOL shift, and go to state 33 INUMBER shift, and go to state 34 RNUMBER shift, and go to state 35 ITOS shift, and go to state 36 RTOS shift, and go to state 37 TRUNC shift, and go to state 38 FLOAT shift, and go to state 39 SQRT shift, and go to state 40 SIN shift, and go to state 41 COS shift, and go to state 42 TAN shift, and go to state 43 ASIN shift, and go to state 44 ACOS shift, and go to state 45 ATAN shift, and go to state 46 LOG shift, and go to state 47 EXP shift, and go to state 48 RANDOM shift, and go to state 49 ROT shift, and go to state 50 SCALE shift, and go to state 51 TRANS shift, and go to state 52 REFLECT shift, and go to state 53 INTERSECT shift, and go to state 54 PARALLEL shift, and go to state 55 PERPEND shift, and go to state 56 DISTANCE shift, and go to state 57 MIDPOINT shift, and go to state 58 PT_BETWN_PTS shift, and go to state 59 COLINEAR shift, and go to state 60 INTERSECTS shift, and go to state 61 SEPARATES shift, and go to state 62 INCLUDES shift, and go to state 63 INCIDENT shift, and go to state 64 DISTLARGER shift, and go to state 65 DISTSMALLER shift, and go to state 66 NOT shift, and go to state 67 MINUS shift, and go to state 68 TILDE_SLASH shift, and go to state 69 SLASH shift, and go to state 70 LPAREN shift, and go to state 72 LBRACK shift, and go to state 73 LCURLY shift, and go to state 74 expr go to state 115 func1 go to state 85 func2 go to state 86 func3 go to state 87 identifier go to state 88 local_identifier go to state 89 local_id go to state 90 id go to state 91 state 68 expr -> MINUS . expr (rule 72) INF shift, and go to state 3 PI shift, and go to state 4 I shift, and go to state 5 XI shift, and go to state 98 FI shift, and go to state 99 I_1 shift, and go to state 8 XI_1 shift, and go to state 9 FI_1 shift, and go to state 10 LABEL shift, and go to state 100 CIRCLE shift, and go to state 101 ELLIPSE shift, and go to state 102 RECTANGLE shift, and go to state 103 IF shift, and go to state 29 ID shift, and go to state 30 IMGFUNC shift, and go to state 31 CSTRING shift, and go to state 32 BOOL shift, and go to state 33 INUMBER shift, and go to state 34 RNUMBER shift, and go to state 35 ITOS shift, and go to state 36 RTOS shift, and go to state 37 TRUNC shift, and go to state 38 FLOAT shift, and go to state 39 SQRT shift, and go to state 40 SIN shift, and go to state 41 COS shift, and go to state 42 TAN shift, and go to state 43 ASIN shift, and go to state 44 ACOS shift, and go to state 45 ATAN shift, and go to state 46 LOG shift, and go to state 47 EXP shift, and go to state 48 RANDOM shift, and go to state 49 ROT shift, and go to state 50 SCALE shift, and go to state 51 TRANS shift, and go to state 52 REFLECT shift, and go to state 53 INTERSECT shift, and go to state 54 PARALLEL shift, and go to state 55 PERPEND shift, and go to state 56 DISTANCE shift, and go to state 57 MIDPOINT shift, and go to state 58 PT_BETWN_PTS shift, and go to state 59 COLINEAR shift, and go to state 60 INTERSECTS shift, and go to state 61 SEPARATES shift, and go to state 62 INCLUDES shift, and go to state 63 INCIDENT shift, and go to state 64 DISTLARGER shift, and go to state 65 DISTSMALLER shift, and go to state 66 NOT shift, and go to state 67 MINUS shift, and go to state 68 TILDE_SLASH shift, and go to state 69 SLASH shift, and go to state 70 LPAREN shift, and go to state 72 LBRACK shift, and go to state 73 LCURLY shift, and go to state 74 expr go to state 116 func1 go to state 85 func2 go to state 86 func3 go to state 87 identifier go to state 88 local_identifier go to state 89 local_id go to state 90 id go to state 91 state 69 local_identifier -> TILDE_SLASH . local_identifier (rule 131) ID shift, and go to state 107 TILDE_SLASH shift, and go to state 69 local_identifier go to state 117 local_id go to state 90 id go to state 91 state 70 identifier -> SLASH . local_identifier (rule 129) ID shift, and go to state 107 TILDE_SLASH shift, and go to state 69 local_identifier go to state 118 local_id go to state 90 id go to state 91 state 71 stmt -> NEWLINE . (rule 11) $default reduce using rule 11 (stmt) state 72 expr -> LPAREN . expr RPAREN (rule 58) INF shift, and go to state 3 PI shift, and go to state 4 I shift, and go to state 5 XI shift, and go to state 98 FI shift, and go to state 99 I_1 shift, and go to state 8 XI_1 shift, and go to state 9 FI_1 shift, and go to state 10 LABEL shift, and go to state 100 CIRCLE shift, and go to state 101 ELLIPSE shift, and go to state 102 RECTANGLE shift, and go to state 103 IF shift, and go to state 29 ID shift, and go to state 30 IMGFUNC shift, and go to state 31 CSTRING shift, and go to state 32 BOOL shift, and go to state 33 INUMBER shift, and go to state 34 RNUMBER shift, and go to state 35 ITOS shift, and go to state 36 RTOS shift, and go to state 37 TRUNC shift, and go to state 38 FLOAT shift, and go to state 39 SQRT shift, and go to state 40 SIN shift, and go to state 41 COS shift, and go to state 42 TAN shift, and go to state 43 ASIN shift, and go to state 44 ACOS shift, and go to state 45 ATAN shift, and go to state 46 LOG shift, and go to state 47 EXP shift, and go to state 48 RANDOM shift, and go to state 49 ROT shift, and go to state 50 SCALE shift, and go to state 51 TRANS shift, and go to state 52 REFLECT shift, and go to state 53 INTERSECT shift, and go to state 54 PARALLEL shift, and go to state 55 PERPEND shift, and go to state 56 DISTANCE shift, and go to state 57 MIDPOINT shift, and go to state 58 PT_BETWN_PTS shift, and go to state 59 COLINEAR shift, and go to state 60 INTERSECTS shift, and go to state 61 SEPARATES shift, and go to state 62 INCLUDES shift, and go to state 63 INCIDENT shift, and go to state 64 DISTLARGER shift, and go to state 65 DISTSMALLER shift, and go to state 66 NOT shift, and go to state 67 MINUS shift, and go to state 68 TILDE_SLASH shift, and go to state 69 SLASH shift, and go to state 70 LPAREN shift, and go to state 72 LBRACK shift, and go to state 73 LCURLY shift, and go to state 74 expr go to state 119 func1 go to state 85 func2 go to state 86 func3 go to state 87 identifier go to state 88 local_identifier go to state 89 local_id go to state 90 id go to state 91 state 73 expr -> LBRACK . graph_spec_list RBRACK (rule 54) expr -> LBRACK . NEWLINE graph_spec_list RBRACK (rule 55) expr -> LBRACK . expr COMMA expr RBRACK (rule 61) expr -> LBRACK . expr COMMA expr COMMA expr RBRACK (rule 62) INF shift, and go to state 3 PI shift, and go to state 4 I shift, and go to state 5 XI shift, and go to state 98 FI shift, and go to state 99 I_1 shift, and go to state 8 XI_1 shift, and go to state 9 FI_1 shift, and go to state 10 IMAGE shift, and go to state 11 MYCHAR shift, and go to state 12 REAL shift, and go to state 13 INT shift, and go to state 14 BOOLEAN shift, and go to state 15 POINT shift, and go to state 16 LABEL shift, and go to state 17 LINE shift, and go to state 18 CIRCLE shift, and go to state 19 ELLIPSE shift, and go to state 20 SHAPE shift, and go to state 21 OPENSHAPE shift, and go to state 22 ARC shift, and go to state 23 RECTANGLE shift, and go to state 24 IF shift, and go to state 29 ID shift, and go to state 30 IMGFUNC shift, and go to state 31 CSTRING shift, and go to state 32 BOOL shift, and go to state 33 INUMBER shift, and go to state 34 RNUMBER shift, and go to state 35 ITOS shift, and go to state 36 RTOS shift, and go to state 37 TRUNC shift, and go to state 38 FLOAT shift, and go to state 39 SQRT shift, and go to state 40 SIN shift, and go to state 41 COS shift, and go to state 42 TAN shift, and go to state 43 ASIN shift, and go to state 44 ACOS shift, and go to state 45 ATAN shift, and go to state 46 LOG shift, and go to state 47 EXP shift, and go to state 48 RANDOM shift, and go to state 49 ROT shift, and go to state 50 SCALE shift, and go to state 51 TRANS shift, and go to state 52 REFLECT shift, and go to state 53 INTERSECT shift, and go to state 54 PARALLEL shift, and go to state 55 PERPEND shift, and go to state 56 DISTANCE shift, and go to state 57 MIDPOINT shift, and go to state 58 PT_BETWN_PTS shift, and go to state 59 COLINEAR shift, and go to state 60 INTERSECTS shift, and go to state 61 SEPARATES shift, and go to state 62 INCLUDES shift, and go to state 63 INCIDENT shift, and go to state 64 DISTLARGER shift, and go to state 65 DISTSMALLER shift, and go to state 66 NOT shift, and go to state 67 MINUS shift, and go to state 68 TILDE_SLASH shift, and go to state 69 SLASH shift, and go to state 70 NEWLINE shift, and go to state 120 LPAREN shift, and go to state 72 LBRACK shift, and go to state 73 LCURLY shift, and go to state 74 $default reduce using rule 135 (graph_spec_list) type_name go to state 121 expr go to state 122 func1 go to state 85 func2 go to state 86 func3 go to state 87 identifier go to state 88 local_identifier go to state 89 local_id go to state 90 id go to state 91 graph_spec_list go to state 123 graph_spec go to state 124 state 74 expr -> LCURLY . expr COMMA expr RCURLY (rule 59) expr -> LCURLY . expr ATSIGN expr RCURLY (rule 60) INF shift, and go to state 3 PI shift, and go to state 4 I shift, and go to state 5 XI shift, and go to state 98 FI shift, and go to state 99 I_1 shift, and go to state 8 XI_1 shift, and go to state 9 FI_1 shift, and go to state 10 LABEL shift, and go to state 100 CIRCLE shift, and go to state 101 ELLIPSE shift, and go to state 102 RECTANGLE shift, and go to state 103 IF shift, and go to state 29 ID shift, and go to state 30 IMGFUNC shift, and go to state 31 CSTRING shift, and go to state 32 BOOL shift, and go to state 33 INUMBER shift, and go to state 34 RNUMBER shift, and go to state 35 ITOS shift, and go to state 36 RTOS shift, and go to state 37 TRUNC shift, and go to state 38 FLOAT shift, and go to state 39 SQRT shift, and go to state 40 SIN shift, and go to state 41 COS shift, and go to state 42 TAN shift, and go to state 43 ASIN shift, and go to state 44 ACOS shift, and go to state 45 ATAN shift, and go to state 46 LOG shift, and go to state 47 EXP shift, and go to state 48 RANDOM shift, and go to state 49 ROT shift, and go to state 50 SCALE shift, and go to state 51 TRANS shift, and go to state 52 REFLECT shift, and go to state 53 INTERSECT shift, and go to state 54 PARALLEL shift, and go to state 55 PERPEND shift, and go to state 56 DISTANCE shift, and go to state 57 MIDPOINT shift, and go to state 58 PT_BETWN_PTS shift, and go to state 59 COLINEAR shift, and go to state 60 INTERSECTS shift, and go to state 61 SEPARATES shift, and go to state 62 INCLUDES shift, and go to state 63 INCIDENT shift, and go to state 64 DISTLARGER shift, and go to state 65 DISTSMALLER shift, and go to state 66 NOT shift, and go to state 67 MINUS shift, and go to state 68 TILDE_SLASH shift, and go to state 69 SLASH shift, and go to state 70 LPAREN shift, and go to state 72 LBRACK shift, and go to state 73 LCURLY shift, and go to state 74 expr go to state 125 func1 go to state 85 func2 go to state 86 func3 go to state 87 identifier go to state 88 local_identifier go to state 89 local_id go to state 90 id go to state 91 state 75 program_list -> program_list stmt . (rule 2) $default reduce using rule 2 (program_list) state 76 stmt -> @1 . evaluation (rule 8) QUERY shift, and go to state 126 evaluation go to state 127 state 77 stmt -> delete . (rule 10) $default reduce using rule 10 (stmt) state 78 within_clause -> within_id . stmt (rule 14) within_clause -> within_id . NEWLINE LCURLY stmt_list RCURLY (rule 15) within_clause -> within_id . LCURLY stmt_list RCURLY (rule 16) INF shift, and go to state 3 PI shift, and go to state 4 I shift, and go to state 5 XI shift, and go to state 6 FI shift, and go to state 7 I_1 shift, and go to state 8 XI_1 shift, and go to state 9 FI_1 shift, and go to state 10 IMAGE shift, and go to state 11 MYCHAR shift, and go to state 12 REAL shift, and go to state 13 INT shift, and go to state 14 BOOLEAN shift, and go to state 15 POINT shift, and go to state 16 LABEL shift, and go to state 17 LINE shift, and go to state 18 CIRCLE shift, and go to state 19 ELLIPSE shift, and go to state 20 SHAPE shift, and go to state 21 OPENSHAPE shift, and go to state 22 ARC shift, and go to state 23 RECTANGLE shift, and go to state 24 GRAPH shift, and go to state 25 VIEWPORT shift, and go to state 26 DELETE shift, and go to state 27 WITHIN shift, and go to state 28 IF shift, and go to state 29 ID shift, and go to state 30 IMGFUNC shift, and go to state 31 CSTRING shift, and go to state 32 BOOL shift, and go to state 33 INUMBER shift, and go to state 34 RNUMBER shift, and go to state 35 ITOS shift, and go to state 36 RTOS shift, and go to state 37 TRUNC shift, and go to state 38 FLOAT shift, and go to state 39 SQRT shift, and go to state 40 SIN shift, and go to state 41 COS shift, and go to state 42 TAN shift, and go to state 43 ASIN shift, and go to state 44 ACOS shift, and go to state 45 ATAN shift, and go to state 46 LOG shift, and go to state 47 EXP shift, and go to state 48 RANDOM shift, and go to state 49 ROT shift, and go to state 50 SCALE shift, and go to state 51 TRANS shift, and go to state 52 REFLECT shift, and go to state 53 INTERSECT shift, and go to state 54 PARALLEL shift, and go to state 55 PERPEND shift, and go to state 56 DISTANCE shift, and go to state 57 MIDPOINT shift, and go to state 58 PT_BETWN_PTS shift, and go to state 59 COLINEAR shift, and go to state 60 INTERSECTS shift, and go to state 61 SEPARATES shift, and go to state 62 INCLUDES shift, and go to state 63 INCIDENT shift, and go to state 64 DISTLARGER shift, and go to state 65 DISTSMALLER shift, and go to state 66 NOT shift, and go to state 67 MINUS shift, and go to state 68 TILDE_SLASH shift, and go to state 69 SLASH shift, and go to state 70 NEWLINE shift, and go to state 128 LPAREN shift, and go to state 72 LBRACK shift, and go to state 73 LCURLY shift, and go to state 129 $default reduce using rule 7 (@1) stmt go to state 130 @1 go to state 76 delete go to state 77 within_id go to state 78 within_clause go to state 79 declaration go to state 80 type_name go to state 81 definition go to state 82 expr_list go to state 83 expr go to state 84 func1 go to state 85 func2 go to state 86 func3 go to state 87 identifier go to state 88 local_identifier go to state 89 local_id go to state 90 id go to state 91 state 79 stmt -> within_clause . (rule 9) $default reduce using rule 9 (stmt) state 80 stmt -> declaration . (rule 5) $default reduce using rule 5 (stmt) state 81 declaration -> type_name . expr_list NEWLINE (rule 19) INF shift, and go to state 3 PI shift, and go to state 4 I shift, and go to state 5 XI shift, and go to state 98 FI shift, and go to state 99 I_1 shift, and go to state 8 XI_1 shift, and go to state 9 FI_1 shift, and go to state 10 LABEL shift, and go to state 100 CIRCLE shift, and go to state 101 ELLIPSE shift, and go to state 102 RECTANGLE shift, and go to state 103 IF shift, and go to state 29 ID shift, and go to state 30 IMGFUNC shift, and go to state 31 CSTRING shift, and go to state 32 BOOL shift, and go to state 33 INUMBER shift, and go to state 34 RNUMBER shift, and go to state 35 ITOS shift, and go to state 36 RTOS shift, and go to state 37 TRUNC shift, and go to state 38 FLOAT shift, and go to state 39 SQRT shift, and go to state 40 SIN shift, and go to state 41 COS shift, and go to state 42 TAN shift, and go to state 43 ASIN shift, and go to state 44 ACOS shift, and go to state 45 ATAN shift, and go to state 46 LOG shift, and go to state 47 EXP shift, and go to state 48 RANDOM shift, and go to state 49 ROT shift, and go to state 50 SCALE shift, and go to state 51 TRANS shift, and go to state 52 REFLECT shift, and go to state 53 INTERSECT shift, and go to state 54 PARALLEL shift, and go to state 55 PERPEND shift, and go to state 56 DISTANCE shift, and go to state 57 MIDPOINT shift, and go to state 58 PT_BETWN_PTS shift, and go to state 59 COLINEAR shift, and go to state 60 INTERSECTS shift, and go to state 61 SEPARATES shift, and go to state 62 INCLUDES shift, and go to state 63 INCIDENT shift, and go to state 64 DISTLARGER shift, and go to state 65 DISTSMALLER shift, and go to state 66 NOT shift, and go to state 67 MINUS shift, and go to state 68 TILDE_SLASH shift, and go to state 69 SLASH shift, and go to state 70 LPAREN shift, and go to state 72 LBRACK shift, and go to state 73 LCURLY shift, and go to state 74 expr_list go to state 131 expr go to state 84 func1 go to state 85 func2 go to state 86 func3 go to state 87 identifier go to state 88 local_identifier go to state 89 local_id go to state 90 id go to state 91 state 82 stmt -> definition . (rule 6) $default reduce using rule 6 (stmt) state 83 definition -> expr_list . EQUALS expr_list NEWLINE (rule 35) expr_list -> expr_list . COMMA expr (rule 41) EQUALS shift, and go to state 132 COMMA shift, and go to state 133 state 84 expr_list -> expr . (rule 40) expr -> expr . PLUS expr (rule 67) expr -> expr . MINUS expr (rule 68) expr -> expr . STAR expr (rule 69) expr -> expr . MOD expr (rule 70) expr -> expr . DIV expr (rule 71) expr -> expr . AND expr (rule 74) expr -> expr . OR expr (rule 75) expr -> expr . EQ_EQ expr (rule 76) expr -> expr . NOT_EQ expr (rule 77) expr -> expr . LT expr (rule 78) expr -> expr . LT_EQ expr (rule 79) expr -> expr . GT expr (rule 80) expr -> expr . GT_EQ expr (rule 81) expr -> expr . SLASH_SLASH expr (rule 82) expr -> expr . DOTX (rule 85) expr -> expr . DOTY (rule 86) expr -> expr . DOT1 (rule 87) expr -> expr . DOT2 (rule 88) expr -> expr . DOTRAD (rule 89) expr -> expr . DOTARG (rule 90) OR shift, and go to state 134 AND shift, and go to state 135 EQ_EQ shift, and go to state 136 NOT_EQ shift, and go to state 137 GT shift, and go to state 138 GT_EQ shift, and go to state 139 LT shift, and go to state 140 LT_EQ shift, and go to state 141 SLASH_SLASH shift, and go to state 142 PLUS shift, and go to state 143 MINUS shift, and go to state 144 STAR shift, and go to state 145 DIV shift, and go to state 146 MOD shift, and go to state 147 DOTX shift, and go to state 148 DOTY shift, and go to state 149 DOTARG shift, and go to state 150 DOTRAD shift, and go to state 151 DOT1 shift, and go to state 152 DOT2 shift, and go to state 153 MINUS [reduce using rule 40 (expr_list)] $default reduce using rule 40 (expr_list) state 85 expr -> func1 . LPAREN expr RPAREN (rule 95) LPAREN shift, and go to state 154 state 86 expr -> func2 . LPAREN expr COMMA expr RPAREN (rule 96) LPAREN shift, and go to state 155 state 87 expr -> func3 . LPAREN expr COMMA expr COMMA expr RPAREN (rule 97) LPAREN shift, and go to state 156 state 88 expr -> identifier . (rule 56) $default reduce using rule 56 (expr) state 89 identifier -> local_identifier . (rule 128) $default reduce using rule 128 (identifier) state 90 local_identifier -> local_id . SLASH local_identifier (rule 130) local_identifier -> local_id . (rule 132) SLASH shift, and go to state 157 SLASH [reduce using rule 132 (local_identifier)] $default reduce using rule 132 (local_identifier) state 91 local_id -> id . (rule 133) $default reduce using rule 133 (local_id) state 92 definition -> XI EQUALS . expr NEWLINE (rule 36) INF shift, and go to state 3 PI shift, and go to state 4 I shift, and go to state 5 XI shift, and go to state 98 FI shift, and go to state 99 I_1 shift, and go to state 8 XI_1 shift, and go to state 9 FI_1 shift, and go to state 10 LABEL shift, and go to state 100 CIRCLE shift, and go to state 101 ELLIPSE shift, and go to state 102 RECTANGLE shift, and go to state 103 IF shift, and go to state 29 ID shift, and go to state 30 IMGFUNC shift, and go to state 31 CSTRING shift, and go to state 32 BOOL shift, and go to state 33 INUMBER shift, and go to state 34 RNUMBER shift, and go to state 35 ITOS shift, and go to state 36 RTOS shift, and go to state 37 TRUNC shift, and go to state 38 FLOAT shift, and go to state 39 SQRT shift, and go to state 40 SIN shift, and go to state 41 COS shift, and go to state 42 TAN shift, and go to state 43 ASIN shift, and go to state 44 ACOS shift, and go to state 45 ATAN shift, and go to state 46 LOG shift, and go to state 47 EXP shift, and go to state 48 RANDOM shift, and go to state 49 ROT shift, and go to state 50 SCALE shift, and go to state 51 TRANS shift, and go to state 52 REFLECT shift, and go to state 53 INTERSECT shift, and go to state 54 PARALLEL shift, and go to state 55 PERPEND shift, and go to state 56 DISTANCE shift, and go to state 57 MIDPOINT shift, and go to state 58 PT_BETWN_PTS shift, and go to state 59 COLINEAR shift, and go to state 60 INTERSECTS shift, and go to state 61 SEPARATES shift, and go to state 62 INCLUDES shift, and go to state 63 INCIDENT shift, and go to state 64 DISTLARGER shift, and go to state 65 DISTSMALLER shift, and go to state 66 NOT shift, and go to state 67 MINUS shift, and go to state 68 TILDE_SLASH shift, and go to state 69 SLASH shift, and go to state 70 LPAREN shift, and go to state 72 LBRACK shift, and go to state 73 LCURLY shift, and go to state 74 expr go to state 158 func1 go to state 85 func2 go to state 86 func3 go to state 87 identifier go to state 88 local_identifier go to state 89 local_id go to state 90 id go to state 91 state 93 definition -> FI EQUALS . expr NEWLINE (rule 37) INF shift, and go to state 3 PI shift, and go to state 4 I shift, and go to state 5 XI shift, and go to state 98 FI shift, and go to state 99 I_1 shift, and go to state 8 XI_1 shift, and go to state 9 FI_1 shift, and go to state 10 LABEL shift, and go to state 100 CIRCLE shift, and go to state 101 ELLIPSE shift, and go to state 102 RECTANGLE shift, and go to state 103 IF shift, and go to state 29 ID shift, and go to state 30 IMGFUNC shift, and go to state 31 CSTRING shift, and go to state 32 BOOL shift, and go to state 33 INUMBER shift, and go to state 34 RNUMBER shift, and go to state 35 ITOS shift, and go to state 36 RTOS shift, and go to state 37 TRUNC shift, and go to state 38 FLOAT shift, and go to state 39 SQRT shift, and go to state 40 SIN shift, and go to state 41 COS shift, and go to state 42 TAN shift, and go to state 43 ASIN shift, and go to state 44 ACOS shift, and go to state 45 ATAN shift, and go to state 46 LOG shift, and go to state 47 EXP shift, and go to state 48 RANDOM shift, and go to state 49 ROT shift, and go to state 50 SCALE shift, and go to state 51 TRANS shift, and go to state 52 REFLECT shift, and go to state 53 INTERSECT shift, and go to state 54 PARALLEL shift, and go to state 55 PERPEND shift, and go to state 56 DISTANCE shift, and go to state 57 MIDPOINT shift, and go to state 58 PT_BETWN_PTS shift, and go to state 59 COLINEAR shift, and go to state 60 INTERSECTS shift, and go to state 61 SEPARATES shift, and go to state 62 INCLUDES shift, and go to state 63 INCIDENT shift, and go to state 64 DISTLARGER shift, and go to state 65 DISTSMALLER shift, and go to state 66 NOT shift, and go to state 67 MINUS shift, and go to state 68 TILDE_SLASH shift, and go to state 69 SLASH shift, and go to state 70 LPAREN shift, and go to state 72 LBRACK shift, and go to state 73 LCURLY shift, and go to state 74 expr go to state 159 func1 go to state 85 func2 go to state 86 func3 go to state 87 identifier go to state 88 local_identifier go to state 89 local_id go to state 90 id go to state 91 state 94 expr -> LABEL LPAREN . expr COMMA expr RPAREN (rule 66) INF shift, and go to state 3 PI shift, and go to state 4 I shift, and go to state 5 XI shift, and go to state 98 FI shift, and go to state 99 I_1 shift, and go to state 8 XI_1 shift, and go to state 9 FI_1 shift, and go to state 10 LABEL shift, and go to state 100 CIRCLE shift, and go to state 101 ELLIPSE shift, and go to state 102 RECTANGLE shift, and go to state 103 IF shift, and go to state 29 ID shift, and go to state 30 IMGFUNC shift, and go to state 31 CSTRING shift, and go to state 32 BOOL shift, and go to state 33 INUMBER shift, and go to state 34 RNUMBER shift, and go to state 35 ITOS shift, and go to state 36 RTOS shift, and go to state 37 TRUNC shift, and go to state 38 FLOAT shift, and go to state 39 SQRT shift, and go to state 40 SIN shift, and go to state 41 COS shift, and go to state 42 TAN shift, and go to state 43 ASIN shift, and go to state 44 ACOS shift, and go to state 45 ATAN shift, and go to state 46 LOG shift, and go to state 47 EXP shift, and go to state 48 RANDOM shift, and go to state 49 ROT shift, and go to state 50 SCALE shift, and go to state 51 TRANS shift, and go to state 52 REFLECT shift, and go to state 53 INTERSECT shift, and go to state 54 PARALLEL shift, and go to state 55 PERPEND shift, and go to state 56 DISTANCE shift, and go to state 57 MIDPOINT shift, and go to state 58 PT_BETWN_PTS shift, and go to state 59 COLINEAR shift, and go to state 60 INTERSECTS shift, and go to state 61 SEPARATES shift, and go to state 62 INCLUDES shift, and go to state 63 INCIDENT shift, and go to state 64 DISTLARGER shift, and go to state 65 DISTSMALLER shift, and go to state 66 NOT shift, and go to state 67 MINUS shift, and go to state 68 TILDE_SLASH shift, and go to state 69 SLASH shift, and go to state 70 LPAREN shift, and go to state 72 LBRACK shift, and go to state 73 LCURLY shift, and go to state 74 expr go to state 160 func1 go to state 85 func2 go to state 86 func3 go to state 87 identifier go to state 88 local_identifier go to state 89 local_id go to state 90 id go to state 91 state 95 expr -> CIRCLE LPAREN . expr COMMA expr RPAREN (rule 63) INF shift, and go to state 3 PI shift, and go to state 4 I shift, and go to state 5 XI shift, and go to state 98 FI shift, and go to state 99 I_1 shift, and go to state 8 XI_1 shift, and go to state 9 FI_1 shift, and go to state 10 LABEL shift, and go to state 100 CIRCLE shift, and go to state 101 ELLIPSE shift, and go to state 102 RECTANGLE shift, and go to state 103 IF shift, and go to state 29 ID shift, and go to state 30 IMGFUNC shift, and go to state 31 CSTRING shift, and go to state 32 BOOL shift, and go to state 33 INUMBER shift, and go to state 34 RNUMBER shift, and go to state 35 ITOS shift, and go to state 36 RTOS shift, and go to state 37 TRUNC shift, and go to state 38 FLOAT shift, and go to state 39 SQRT shift, and go to state 40 SIN shift, and go to state 41 COS shift, and go to state 42 TAN shift, and go to state 43 ASIN shift, and go to state 44 ACOS shift, and go to state 45 ATAN shift, and go to state 46 LOG shift, and go to state 47 EXP shift, and go to state 48 RANDOM shift, and go to state 49 ROT shift, and go to state 50 SCALE shift, and go to state 51 TRANS shift, and go to state 52 REFLECT shift, and go to state 53 INTERSECT shift, and go to state 54 PARALLEL shift, and go to state 55 PERPEND shift, and go to state 56 DISTANCE shift, and go to state 57 MIDPOINT shift, and go to state 58 PT_BETWN_PTS shift, and go to state 59 COLINEAR shift, and go to state 60 INTERSECTS shift, and go to state 61 SEPARATES shift, and go to state 62 INCLUDES shift, and go to state 63 INCIDENT shift, and go to state 64 DISTLARGER shift, and go to state 65 DISTSMALLER shift, and go to state 66 NOT shift, and go to state 67 MINUS shift, and go to state 68 TILDE_SLASH shift, and go to state 69 SLASH shift, and go to state 70 LPAREN shift, and go to state 72 LBRACK shift, and go to state 73 LCURLY shift, and go to state 74 expr go to state 161 func1 go to state 85 func2 go to state 86 func3 go to state 87 identifier go to state 88 local_identifier go to state 89 local_id go to state 90 id go to state 91 state 96 expr -> ELLIPSE LPAREN . expr COMMA expr COMMA expr RPAREN (rule 65) INF shift, and go to state 3 PI shift, and go to state 4 I shift, and go to state 5 XI shift, and go to state 98 FI shift, and go to state 99 I_1 shift, and go to state 8 XI_1 shift, and go to state 9 FI_1 shift, and go to state 10 LABEL shift, and go to state 100 CIRCLE shift, and go to state 101 ELLIPSE shift, and go to state 102 RECTANGLE shift, and go to state 103 IF shift, and go to state 29 ID shift, and go to state 30 IMGFUNC shift, and go to state 31 CSTRING shift, and go to state 32 BOOL shift, and go to state 33 INUMBER shift, and go to state 34 RNUMBER shift, and go to state 35 ITOS shift, and go to state 36 RTOS shift, and go to state 37 TRUNC shift, and go to state 38 FLOAT shift, and go to state 39 SQRT shift, and go to state 40 SIN shift, and go to state 41 COS shift, and go to state 42 TAN shift, and go to state 43 ASIN shift, and go to state 44 ACOS shift, and go to state 45 ATAN shift, and go to state 46 LOG shift, and go to state 47 EXP shift, and go to state 48 RANDOM shift, and go to state 49 ROT shift, and go to state 50 SCALE shift, and go to state 51 TRANS shift, and go to state 52 REFLECT shift, and go to state 53 INTERSECT shift, and go to state 54 PARALLEL shift, and go to state 55 PERPEND shift, and go to state 56 DISTANCE shift, and go to state 57 MIDPOINT shift, and go to state 58 PT_BETWN_PTS shift, and go to state 59 COLINEAR shift, and go to state 60 INTERSECTS shift, and go to state 61 SEPARATES shift, and go to state 62 INCLUDES shift, and go to state 63 INCIDENT shift, and go to state 64 DISTLARGER shift, and go to state 65 DISTSMALLER shift, and go to state 66 NOT shift, and go to state 67 MINUS shift, and go to state 68 TILDE_SLASH shift, and go to state 69 SLASH shift, and go to state 70 LPAREN shift, and go to state 72 LBRACK shift, and go to state 73 LCURLY shift, and go to state 74 expr go to state 162 func1 go to state 85 func2 go to state 86 func3 go to state 87 identifier go to state 88 local_identifier go to state 89 local_id go to state 90 id go to state 91 state 97 expr -> RECTANGLE LPAREN . expr COMMA expr RPAREN (rule 64) INF shift, and go to state 3 PI shift, and go to state 4 I shift, and go to state 5 XI shift, and go to state 98 FI shift, and go to state 99 I_1 shift, and go to state 8 XI_1 shift, and go to state 9 FI_1 shift, and go to state 10 LABEL shift, and go to state 100 CIRCLE shift, and go to state 101 ELLIPSE shift, and go to state 102 RECTANGLE shift, and go to state 103 IF shift, and go to state 29 ID shift, and go to state 30 IMGFUNC shift, and go to state 31 CSTRING shift, and go to state 32 BOOL shift, and go to state 33 INUMBER shift, and go to state 34 RNUMBER shift, and go to state 35 ITOS shift, and go to state 36 RTOS shift, and go to state 37 TRUNC shift, and go to state 38 FLOAT shift, and go to state 39 SQRT shift, and go to state 40 SIN shift, and go to state 41 COS shift, and go to state 42 TAN shift, and go to state 43 ASIN shift, and go to state 44 ACOS shift, and go to state 45 ATAN shift, and go to state 46 LOG shift, and go to state 47 EXP shift, and go to state 48 RANDOM shift, and go to state 49 ROT shift, and go to state 50 SCALE shift, and go to state 51 TRANS shift, and go to state 52 REFLECT shift, and go to state 53 INTERSECT shift, and go to state 54 PARALLEL shift, and go to state 55 PERPEND shift, and go to state 56 DISTANCE shift, and go to state 57 MIDPOINT shift, and go to state 58 PT_BETWN_PTS shift, and go to state 59 COLINEAR shift, and go to state 60 INTERSECTS shift, and go to state 61 SEPARATES shift, and go to state 62 INCLUDES shift, and go to state 63 INCIDENT shift, and go to state 64 DISTLARGER shift, and go to state 65 DISTSMALLER shift, and go to state 66 NOT shift, and go to state 67 MINUS shift, and go to state 68 TILDE_SLASH shift, and go to state 69 SLASH shift, and go to state 70 LPAREN shift, and go to state 72 LBRACK shift, and go to state 73 LCURLY shift, and go to state 74 expr go to state 163 func1 go to state 85 func2 go to state 86 func3 go to state 87 identifier go to state 88 local_identifier go to state 89 local_id go to state 90 id go to state 91 state 98 expr -> XI . (rule 49) $default reduce using rule 49 (expr) state 99 expr -> FI . (rule 50) $default reduce using rule 50 (expr) state 100 expr -> LABEL . LPAREN expr COMMA expr RPAREN (rule 66) LPAREN shift, and go to state 94 state 101 expr -> CIRCLE . LPAREN expr COMMA expr RPAREN (rule 63) LPAREN shift, and go to state 95 state 102 expr -> ELLIPSE . LPAREN expr COMMA expr COMMA expr RPAREN (rule 65) LPAREN shift, and go to state 96 state 103 expr -> RECTANGLE . LPAREN expr COMMA expr RPAREN (rule 64) LPAREN shift, and go to state 97 state 104 declaration -> GRAPH expr_list . (rule 20) expr_list -> expr_list . COMMA expr (rule 41) COMMA shift, and go to state 133 $default reduce using rule 20 (declaration) state 105 stmt -> VIEWPORT ID . (rule 4) $default reduce using rule 4 (stmt) state 106 delete -> DELETE expr_list . NEWLINE (rule 12) expr_list -> expr_list . COMMA expr (rule 41) COMMA shift, and go to state 133 NEWLINE shift, and go to state 164 state 107 id -> ID . (rule 134) $default reduce using rule 134 (id) state 108 within_id -> WITHIN identifier . (rule 13) $default reduce using rule 13 (within_id) state 109 expr -> expr . PLUS expr (rule 67) expr -> expr . MINUS expr (rule 68) expr -> expr . STAR expr (rule 69) expr -> expr . MOD expr (rule 70) expr -> expr . DIV expr (rule 71) expr -> expr . AND expr (rule 74) expr -> expr . OR expr (rule 75) expr -> expr . EQ_EQ expr (rule 76) expr -> expr . NOT_EQ expr (rule 77) expr -> expr . LT expr (rule 78) expr -> expr . LT_EQ expr (rule 79) expr -> expr . GT expr (rule 80) expr -> expr . GT_EQ expr (rule 81) expr -> expr . SLASH_SLASH expr (rule 82) expr -> expr . DOTX (rule 85) expr -> expr . DOTY (rule 86) expr -> expr . DOT1 (rule 87) expr -> expr . DOT2 (rule 88) expr -> expr . DOTRAD (rule 89) expr -> expr . DOTARG (rule 90) expr -> IF expr . THEN expr ELSE expr (rule 99) THEN shift, and go to state 165 OR shift, and go to state 134 AND shift, and go to state 135 EQ_EQ shift, and go to state 136 NOT_EQ shift, and go to state 137 GT shift, and go to state 138 GT_EQ shift, and go to state 139 LT shift, and go to state 140 LT_EQ shift, and go to state 141 SLASH_SLASH shift, and go to state 142 PLUS shift, and go to state 143 MINUS shift, and go to state 144 STAR shift, and go to state 145 DIV shift, and go to state 146 MOD shift, and go to state 147 DOTX shift, and go to state 148 DOTY shift, and go to state 149 DOTARG shift, and go to state 150 DOTRAD shift, and go to state 151 DOT1 shift, and go to state 152 DOT2 shift, and go to state 153 state 110 expr -> ID NOT . (rule 57) expr -> ID NOT . LPAREN RPAREN (rule 91) expr -> ID NOT . LPAREN expr_list RPAREN (rule 92) LPAREN shift, and go to state 166 $default reduce using rule 57 (expr) state 111 expr -> IMGFUNC LPAREN . RPAREN (rule 93) expr -> IMGFUNC LPAREN . expr_list RPAREN (rule 94) INF shift, and go to state 3 PI shift, and go to state 4 I shift, and go to state 5 XI shift, and go to state 98 FI shift, and go to state 99 I_1 shift, and go to state 8 XI_1 shift, and go to state 9 FI_1 shift, and go to state 10 LABEL shift, and go to state 100 CIRCLE shift, and go to state 101 ELLIPSE shift, and go to state 102 RECTANGLE shift, and go to state 103 IF shift, and go to state 29 ID shift, and go to state 30 IMGFUNC shift, and go to state 31 CSTRING shift, and go to state 32 BOOL shift, and go to state 33 INUMBER shift, and go to state 34 RNUMBER shift, and go to state 35 ITOS shift, and go to state 36 RTOS shift, and go to state 37 TRUNC shift, and go to state 38 FLOAT shift, and go to state 39 SQRT shift, and go to state 40 SIN shift, and go to state 41 COS shift, and go to state 42 TAN shift, and go to state 43 ASIN shift, and go to state 44 ACOS shift, and go to state 45 ATAN shift, and go to state 46 LOG shift, and go to state 47 EXP shift, and go to state 48 RANDOM shift, and go to state 49 ROT shift, and go to state 50 SCALE shift, and go to state 51 TRANS shift, and go to state 52 REFLECT shift, and go to state 53 INTERSECT shift, and go to state 54 PARALLEL shift, and go to state 55 PERPEND shift, and go to state 56 DISTANCE shift, and go to state 57 MIDPOINT shift, and go to state 58 PT_BETWN_PTS shift, and go to state 59 COLINEAR shift, and go to state 60 INTERSECTS shift, and go to state 61 SEPARATES shift, and go to state 62 INCLUDES shift, and go to state 63 INCIDENT shift, and go to state 64 DISTLARGER shift, and go to state 65 DISTSMALLER shift, and go to state 66 NOT shift, and go to state 67 MINUS shift, and go to state 68 TILDE_SLASH shift, and go to state 69 SLASH shift, and go to state 70 LPAREN shift, and go to state 72 RPAREN shift, and go to state 167 LBRACK shift, and go to state 73 LCURLY shift, and go to state 74 expr_list go to state 168 expr go to state 84 func1 go to state 85 func2 go to state 86 func3 go to state 87 identifier go to state 88 local_identifier go to state 89 local_id go to state 90 id go to state 91 state 112 expr -> ITOS LPAREN . expr RPAREN (rule 83) INF shift, and go to state 3 PI shift, and go to state 4 I shift, and go to state 5 XI shift, and go to state 98 FI shift, and go to state 99 I_1 shift, and go to state 8 XI_1 shift, and go to state 9 FI_1 shift, and go to state 10 LABEL shift, and go to state 100 CIRCLE shift, and go to state 101 ELLIPSE shift, and go to state 102 RECTANGLE shift, and go to state 103 IF shift, and go to state 29 ID shift, and go to state 30 IMGFUNC shift, and go to state 31 CSTRING shift, and go to state 32 BOOL shift, and go to state 33 INUMBER shift, and go to state 34 RNUMBER shift, and go to state 35 ITOS shift, and go to state 36 RTOS shift, and go to state 37 TRUNC shift, and go to state 38 FLOAT shift, and go to state 39 SQRT shift, and go to state 40 SIN shift, and go to state 41 COS shift, and go to state 42 TAN shift, and go to state 43 ASIN shift, and go to state 44 ACOS shift, and go to state 45 ATAN shift, and go to state 46 LOG shift, and go to state 47 EXP shift, and go to state 48 RANDOM shift, and go to state 49 ROT shift, and go to state 50 SCALE shift, and go to state 51 TRANS shift, and go to state 52 REFLECT shift, and go to state 53 INTERSECT shift, and go to state 54 PARALLEL shift, and go to state 55 PERPEND shift, and go to state 56 DISTANCE shift, and go to state 57 MIDPOINT shift, and go to state 58 PT_BETWN_PTS shift, and go to state 59 COLINEAR shift, and go to state 60 INTERSECTS shift, and go to state 61 SEPARATES shift, and go to state 62 INCLUDES shift, and go to state 63 INCIDENT shift, and go to state 64 DISTLARGER shift, and go to state 65 DISTSMALLER shift, and go to state 66 NOT shift, and go to state 67 MINUS shift, and go to state 68 TILDE_SLASH shift, and go to state 69 SLASH shift, and go to state 70 LPAREN shift, and go to state 72 LBRACK shift, and go to state 73 LCURLY shift, and go to state 74 expr go to state 169 func1 go to state 85 func2 go to state 86 func3 go to state 87 identifier go to state 88 local_identifier go to state 89 local_id go to state 90 id go to state 91 state 113 expr -> RTOS LPAREN . expr COMMA expr RPAREN (rule 84) INF shift, and go to state 3 PI shift, and go to state 4 I shift, and go to state 5 XI shift, and go to state 98 FI shift, and go to state 99 I_1 shift, and go to state 8 XI_1 shift, and go to state 9 FI_1 shift, and go to state 10 LABEL shift, and go to state 100 CIRCLE shift, and go to state 101 ELLIPSE shift, and go to state 102 RECTANGLE shift, and go to state 103 IF shift, and go to state 29 ID shift, and go to state 30 IMGFUNC shift, and go to state 31 CSTRING shift, and go to state 32 BOOL shift, and go to state 33 INUMBER shift, and go to state 34 RNUMBER shift, and go to state 35 ITOS shift, and go to state 36 RTOS shift, and go to state 37 TRUNC shift, and go to state 38 FLOAT shift, and go to state 39 SQRT shift, and go to state 40 SIN shift, and go to state 41 COS shift, and go to state 42 TAN shift, and go to state 43 ASIN shift, and go to state 44 ACOS shift, and go to state 45 ATAN shift, and go to state 46 LOG shift, and go to state 47 EXP shift, and go to state 48 RANDOM shift, and go to state 49 ROT shift, and go to state 50 SCALE shift, and go to state 51 TRANS shift, and go to state 52 REFLECT shift, and go to state 53 INTERSECT shift, and go to state 54 PARALLEL shift, and go to state 55 PERPEND shift, and go to state 56 DISTANCE shift, and go to state 57 MIDPOINT shift, and go to state 58 PT_BETWN_PTS shift, and go to state 59 COLINEAR shift, and go to state 60 INTERSECTS shift, and go to state 61 SEPARATES shift, and go to state 62 INCLUDES shift, and go to state 63 INCIDENT shift, and go to state 64 DISTLARGER shift, and go to state 65 DISTSMALLER shift, and go to state 66 NOT shift, and go to state 67 MINUS shift, and go to state 68 TILDE_SLASH shift, and go to state 69 SLASH shift, and go to state 70 LPAREN shift, and go to state 72 LBRACK shift, and go to state 73 LCURLY shift, and go to state 74 expr go to state 170 func1 go to state 85 func2 go to state 86 func3 go to state 87 identifier go to state 88 local_identifier go to state 89 local_id go to state 90 id go to state 91 state 114 expr -> PARALLEL LPAREN . expr COMMA expr COMMA expr COMMA expr RPAREN (rule 98) INF shift, and go to state 3 PI shift, and go to state 4 I shift, and go to state 5 XI shift, and go to state 98 FI shift, and go to state 99 I_1 shift, and go to state 8 XI_1 shift, and go to state 9 FI_1 shift, and go to state 10 LABEL shift, and go to state 100 CIRCLE shift, and go to state 101 ELLIPSE shift, and go to state 102 RECTANGLE shift, and go to state 103 IF shift, and go to state 29 ID shift, and go to state 30 IMGFUNC shift, and go to state 31 CSTRING shift, and go to state 32 BOOL shift, and go to state 33 INUMBER shift, and go to state 34 RNUMBER shift, and go to state 35 ITOS shift, and go to state 36 RTOS shift, and go to state 37 TRUNC shift, and go to state 38 FLOAT shift, and go to state 39 SQRT shift, and go to state 40 SIN shift, and go to state 41 COS shift, and go to state 42 TAN shift, and go to state 43 ASIN shift, and go to state 44 ACOS shift, and go to state 45 ATAN shift, and go to state 46 LOG shift, and go to state 47 EXP shift, and go to state 48 RANDOM shift, and go to state 49 ROT shift, and go to state 50 SCALE shift, and go to state 51 TRANS shift, and go to state 52 REFLECT shift, and go to state 53 INTERSECT shift, and go to state 54 PARALLEL shift, and go to state 55 PERPEND shift, and go to state 56 DISTANCE shift, and go to state 57 MIDPOINT shift, and go to state 58 PT_BETWN_PTS shift, and go to state 59 COLINEAR shift, and go to state 60 INTERSECTS shift, and go to state 61 SEPARATES shift, and go to state 62 INCLUDES shift, and go to state 63 INCIDENT shift, and go to state 64 DISTLARGER shift, and go to state 65 DISTSMALLER shift, and go to state 66 NOT shift, and go to state 67 MINUS shift, and go to state 68 TILDE_SLASH shift, and go to state 69 SLASH shift, and go to state 70 LPAREN shift, and go to state 72 LBRACK shift, and go to state 73 LCURLY shift, and go to state 74 expr go to state 171 func1 go to state 85 func2 go to state 86 func3 go to state 87 identifier go to state 88 local_identifier go to state 89 local_id go to state 90 id go to state 91 state 115 expr -> expr . PLUS expr (rule 67) expr -> expr . MINUS expr (rule 68) expr -> expr . STAR expr (rule 69) expr -> expr . MOD expr (rule 70) expr -> expr . DIV expr (rule 71) expr -> NOT expr . (rule 73) expr -> expr . AND expr (rule 74) expr -> expr . OR expr (rule 75) expr -> expr . EQ_EQ expr (rule 76) expr -> expr . NOT_EQ expr (rule 77) expr -> expr . LT expr (rule 78) expr -> expr . LT_EQ expr (rule 79) expr -> expr . GT expr (rule 80) expr -> expr . GT_EQ expr (rule 81) expr -> expr . SLASH_SLASH expr (rule 82) expr -> expr . DOTX (rule 85) expr -> expr . DOTY (rule 86) expr -> expr . DOT1 (rule 87) expr -> expr . DOT2 (rule 88) expr -> expr . DOTRAD (rule 89) expr -> expr . DOTARG (rule 90) EQ_EQ shift, and go to state 136 NOT_EQ shift, and go to state 137 GT shift, and go to state 138 GT_EQ shift, and go to state 139 LT shift, and go to state 140 LT_EQ shift, and go to state 141 SLASH_SLASH shift, and go to state 142 PLUS shift, and go to state 143 MINUS shift, and go to state 144 STAR shift, and go to state 145 DIV shift, and go to state 146 MOD shift, and go to state 147 DOTX shift, and go to state 148 DOTY shift, and go to state 149 DOTARG shift, and go to state 150 DOTRAD shift, and go to state 151 DOT1 shift, and go to state 152 DOT2 shift, and go to state 153 $default reduce using rule 73 (expr) state 116 expr -> expr . PLUS expr (rule 67) expr -> expr . MINUS expr (rule 68) expr -> expr . STAR expr (rule 69) expr -> expr . MOD expr (rule 70) expr -> expr . DIV expr (rule 71) expr -> MINUS expr . (rule 72) expr -> expr . AND expr (rule 74) expr -> expr . OR expr (rule 75) expr -> expr . EQ_EQ expr (rule 76) expr -> expr . NOT_EQ expr (rule 77) expr -> expr . LT expr (rule 78) expr -> expr . LT_EQ expr (rule 79) expr -> expr . GT expr (rule 80) expr -> expr . GT_EQ expr (rule 81) expr -> expr . SLASH_SLASH expr (rule 82) expr -> expr . DOTX (rule 85) expr -> expr . DOTY (rule 86) expr -> expr . DOT1 (rule 87) expr -> expr . DOT2 (rule 88) expr -> expr . DOTRAD (rule 89) expr -> expr . DOTARG (rule 90) $default reduce using rule 72 (expr) state 117 local_identifier -> TILDE_SLASH local_identifier . (rule 131) $default reduce using rule 131 (local_identifier) state 118 identifier -> SLASH local_identifier . (rule 129) $default reduce using rule 129 (identifier) state 119 expr -> LPAREN expr . RPAREN (rule 58) expr -> expr . PLUS expr (rule 67) expr -> expr . MINUS expr (rule 68) expr -> expr . STAR expr (rule 69) expr -> expr . MOD expr (rule 70) expr -> expr . DIV expr (rule 71) expr -> expr . AND expr (rule 74) expr -> expr . OR expr (rule 75) expr -> expr . EQ_EQ expr (rule 76) expr -> expr . NOT_EQ expr (rule 77) expr -> expr . LT expr (rule 78) expr -> expr . LT_EQ expr (rule 79) expr -> expr . GT expr (rule 80) expr -> expr . GT_EQ expr (rule 81) expr -> expr . SLASH_SLASH expr (rule 82) expr -> expr . DOTX (rule 85) expr -> expr . DOTY (rule 86) expr -> expr . DOT1 (rule 87) expr -> expr . DOT2 (rule 88) expr -> expr . DOTRAD (rule 89) expr -> expr . DOTARG (rule 90) OR shift, and go to state 134 AND shift, and go to state 135 EQ_EQ shift, and go to state 136 NOT_EQ shift, and go to state 137 GT shift, and go to state 138 GT_EQ shift, and go to state 139 LT shift, and go to state 140 LT_EQ shift, and go to state 141 SLASH_SLASH shift, and go to state 142 PLUS shift, and go to state 143 MINUS shift, and go to state 144 STAR shift, and go to state 145 DIV shift, and go to state 146 MOD shift, and go to state 147 DOTX shift, and go to state 148 DOTY shift, and go to state 149 DOTARG shift, and go to state 150 DOTRAD shift, and go to state 151 DOT1 shift, and go to state 152 DOT2 shift, and go to state 153 RPAREN shift, and go to state 172 state 120 expr -> LBRACK NEWLINE . graph_spec_list RBRACK (rule 55) IMAGE shift, and go to state 11 MYCHAR shift, and go to state 12 REAL shift, and go to state 13 INT shift, and go to state 14 BOOLEAN shift, and go to state 15 POINT shift, and go to state 16 LABEL shift, and go to state 173 LINE shift, and go to state 18 CIRCLE shift, and go to state 174 ELLIPSE shift, and go to state 175 SHAPE shift, and go to state 21 OPENSHAPE shift, and go to state 22 ARC shift, and go to state 23 RECTANGLE shift, and go to state 176 $default reduce using rule 135 (graph_spec_list) type_name go to state 121 graph_spec_list go to state 177 graph_spec go to state 124 state 121 graph_spec -> type_name . COLON (rule 139) graph_spec -> type_name . COLON expr (rule 140) graph_spec -> type_name . COLON NEWLINE (rule 141) graph_spec -> type_name . COLON expr NEWLINE (rule 142) COLON shift, and go to state 178 state 122 expr -> LBRACK expr . COMMA expr RBRACK (rule 61) expr -> LBRACK expr . COMMA expr COMMA expr RBRACK (rule 62) expr -> expr . PLUS expr (rule 67) expr -> expr . MINUS expr (rule 68) expr -> expr . STAR expr (rule 69) expr -> expr . MOD expr (rule 70) expr -> expr . DIV expr (rule 71) expr -> expr . AND expr (rule 74) expr -> expr . OR expr (rule 75) expr -> expr . EQ_EQ expr (rule 76) expr -> expr . NOT_EQ expr (rule 77) expr -> expr . LT expr (rule 78) expr -> expr . LT_EQ expr (rule 79) expr -> expr . GT expr (rule 80) expr -> expr . GT_EQ expr (rule 81) expr -> expr . SLASH_SLASH expr (rule 82) expr -> expr . DOTX (rule 85) expr -> expr . DOTY (rule 86) expr -> expr . DOT1 (rule 87) expr -> expr . DOT2 (rule 88) expr -> expr . DOTRAD (rule 89) expr -> expr . DOTARG (rule 90) COMMA shift, and go to state 179 OR shift, and go to state 134 AND shift, and go to state 135 EQ_EQ shift, and go to state 136 NOT_EQ shift, and go to state 137 GT shift, and go to state 138 GT_EQ shift, and go to state 139 LT shift, and go to state 140 LT_EQ shift, and go to state 141 SLASH_SLASH shift, and go to state 142 PLUS shift, and go to state 143 MINUS shift, and go to state 144 STAR shift, and go to state 145 DIV shift, and go to state 146 MOD shift, and go to state 147 DOTX shift, and go to state 148 DOTY shift, and go to state 149 DOTARG shift, and go to state 150 DOTRAD shift, and go to state 151 DOT1 shift, and go to state 152 DOT2 shift, and go to state 153 state 123 expr -> LBRACK graph_spec_list . RBRACK (rule 54) graph_spec_list -> graph_spec_list . SEMICOLON graph_spec (rule 137) graph_spec_list -> graph_spec_list . SEMICOLON NEWLINE graph_spec (rule 138) SEMICOLON shift, and go to state 180 RBRACK shift, and go to state 181 state 124 graph_spec_list -> graph_spec . (rule 136) $default reduce using rule 136 (graph_spec_list) state 125 expr -> LCURLY expr . COMMA expr RCURLY (rule 59) expr -> LCURLY expr . ATSIGN expr RCURLY (rule 60) expr -> expr . PLUS expr (rule 67) expr -> expr . MINUS expr (rule 68) expr -> expr . STAR expr (rule 69) expr -> expr . MOD expr (rule 70) expr -> expr . DIV expr (rule 71) expr -> expr . AND expr (rule 74) expr -> expr . OR expr (rule 75) expr -> expr . EQ_EQ expr (rule 76) expr -> expr . NOT_EQ expr (rule 77) expr -> expr . LT expr (rule 78) expr -> expr . LT_EQ expr (rule 79) expr -> expr . GT expr (rule 80) expr -> expr . GT_EQ expr (rule 81) expr -> expr . SLASH_SLASH expr (rule 82) expr -> expr . DOTX (rule 85) expr -> expr . DOTY (rule 86) expr -> expr . DOT1 (rule 87) expr -> expr . DOT2 (rule 88) expr -> expr . DOTRAD (rule 89) expr -> expr . DOTARG (rule 90) COMMA shift, and go to state 182 OR shift, and go to state 134 AND shift, and go to state 135 EQ_EQ shift, and go to state 136 NOT_EQ shift, and go to state 137 GT shift, and go to state 138 GT_EQ shift, and go to state 139 LT shift, and go to state 140 LT_EQ shift, and go to state 141 SLASH_SLASH shift, and go to state 142 ATSIGN shift, and go to state 183 PLUS shift, and go to state 143 MINUS shift, and go to state 144 STAR shift, and go to state 145 DIV shift, and go to state 146 MOD shift, and go to state 147 DOTX shift, and go to state 148 DOTY shift, and go to state 149 DOTARG shift, and go to state 150 DOTRAD shift, and go to state 151 DOT1 shift, and go to state 152 DOT2 shift, and go to state 153 state 126 evaluation -> QUERY . NEWLINE (rule 38) NEWLINE shift, and go to state 184 state 127 stmt -> @1 evaluation . (rule 8) evaluation -> evaluation . QUERY NEWLINE (rule 39) QUERY shift, and go to state 185 QUERY [reduce using rule 8 (stmt)] $default reduce using rule 8 (stmt) state 128 stmt -> NEWLINE . (rule 11) within_clause -> within_id NEWLINE . LCURLY stmt_list RCURLY (rule 15) LCURLY shift, and go to state 186 $default reduce using rule 11 (stmt) state 129 within_clause -> within_id LCURLY . stmt_list RCURLY (rule 16) expr -> LCURLY . expr COMMA expr RCURLY (rule 59) expr -> LCURLY . expr ATSIGN expr RCURLY (rule 60) INF shift, and go to state 3 PI shift, and go to state 4 I shift, and go to state 5 XI shift, and go to state 6 FI shift, and go to state 7 I_1 shift, and go to state 8 XI_1 shift, and go to state 9 FI_1 shift, and go to state 10 IMAGE shift, and go to state 11 MYCHAR shift, and go to state 12 REAL shift, and go to state 13 INT shift, and go to state 14 BOOLEAN shift, and go to state 15 POINT shift, and go to state 16 LABEL shift, and go to state 17 LINE shift, and go to state 18 CIRCLE shift, and go to state 19 ELLIPSE shift, and go to state 20 SHAPE shift, and go to state 21 OPENSHAPE shift, and go to state 22 ARC shift, and go to state 23 RECTANGLE shift, and go to state 24 GRAPH shift, and go to state 25 VIEWPORT shift, and go to state 26 DELETE shift, and go to state 27 WITHIN shift, and go to state 28 IF shift, and go to state 29 ID shift, and go to state 30 IMGFUNC shift, and go to state 31 CSTRING shift, and go to state 32 BOOL shift, and go to state 33 INUMBER shift, and go to state 34 RNUMBER shift, and go to state 35 ITOS shift, and go to state 36 RTOS shift, and go to state 37 TRUNC shift, and go to state 38 FLOAT shift, and go to state 39 SQRT shift, and go to state 40 SIN shift, and go to state 41 COS shift, and go to state 42 TAN shift, and go to state 43 ASIN shift, and go to state 44 ACOS shift, and go to state 45 ATAN shift, and go to state 46 LOG shift, and go to state 47 EXP shift, and go to state 48 RANDOM shift, and go to state 49 ROT shift, and go to state 50 SCALE shift, and go to state 51 TRANS shift, and go to state 52 REFLECT shift, and go to state 53 INTERSECT shift, and go to state 54 PARALLEL shift, and go to state 55 PERPEND shift, and go to state 56 DISTANCE shift, and go to state 57 MIDPOINT shift, and go to state 58 PT_BETWN_PTS shift, and go to state 59 COLINEAR shift, and go to state 60 INTERSECTS shift, and go to state 61 SEPARATES shift, and go to state 62 INCLUDES shift, and go to state 63 INCIDENT shift, and go to state 64 DISTLARGER shift, and go to state 65 DISTSMALLER shift, and go to state 66 NOT shift, and go to state 67 MINUS shift, and go to state 68 TILDE_SLASH shift, and go to state 69 SLASH shift, and go to state 70 NEWLINE shift, and go to state 71 LPAREN shift, and go to state 72 LBRACK shift, and go to state 73 LCURLY shift, and go to state 74 $default reduce using rule 7 (@1) stmt go to state 187 @1 go to state 76 delete go to state 77 within_id go to state 78 within_clause go to state 79 stmt_list go to state 188 declaration go to state 80 type_name go to state 81 definition go to state 82 expr_list go to state 83 expr go to state 189 func1 go to state 85 func2 go to state 86 func3 go to state 87 identifier go to state 88 local_identifier go to state 89 local_id go to state 90 id go to state 91 state 130 within_clause -> within_id stmt . (rule 14) $default reduce using rule 14 (within_clause) state 131 declaration -> type_name expr_list . NEWLINE (rule 19) expr_list -> expr_list . COMMA expr (rule 41) COMMA shift, and go to state 133 NEWLINE shift, and go to state 190 state 132 definition -> expr_list EQUALS . expr_list NEWLINE (rule 35) INF shift, and go to state 3 PI shift, and go to state 4 I shift, and go to state 5 XI shift, and go to state 98 FI shift, and go to state 99 I_1 shift, and go to state 8 XI_1 shift, and go to state 9 FI_1 shift, and go to state 10 LABEL shift, and go to state 100 CIRCLE shift, and go to state 101 ELLIPSE shift, and go to state 102 RECTANGLE shift, and go to state 103 IF shift, and go to state 29 ID shift, and go to state 30 IMGFUNC shift, and go to state 31 CSTRING shift, and go to state 32 BOOL shift, and go to state 33 INUMBER shift, and go to state 34 RNUMBER shift, and go to state 35 ITOS shift, and go to state 36 RTOS shift, and go to state 37 TRUNC shift, and go to state 38 FLOAT shift, and go to state 39 SQRT shift, and go to state 40 SIN shift, and go to state 41 COS shift, and go to state 42 TAN shift, and go to state 43 ASIN shift, and go to state 44 ACOS shift, and go to state 45 ATAN shift, and go to state 46 LOG shift, and go to state 47 EXP shift, and go to state 48 RANDOM shift, and go to state 49 ROT shift, and go to state 50 SCALE shift, and go to state 51 TRANS shift, and go to state 52 REFLECT shift, and go to state 53 INTERSECT shift, and go to state 54 PARALLEL shift, and go to state 55 PERPEND shift, and go to state 56 DISTANCE shift, and go to state 57 MIDPOINT shift, and go to state 58 PT_BETWN_PTS shift, and go to state 59 COLINEAR shift, and go to state 60 INTERSECTS shift, and go to state 61 SEPARATES shift, and go to state 62 INCLUDES shift, and go to state 63 INCIDENT shift, and go to state 64 DISTLARGER shift, and go to state 65 DISTSMALLER shift, and go to state 66 NOT shift, and go to state 67 MINUS shift, and go to state 68 TILDE_SLASH shift, and go to state 69 SLASH shift, and go to state 70 LPAREN shift, and go to state 72 LBRACK shift, and go to state 73 LCURLY shift, and go to state 74 expr_list go to state 191 expr go to state 84 func1 go to state 85 func2 go to state 86 func3 go to state 87 identifier go to state 88 local_identifier go to state 89 local_id go to state 90 id go to state 91 state 133 expr_list -> expr_list COMMA . expr (rule 41) INF shift, and go to state 3 PI shift, and go to state 4 I shift, and go to state 5 XI shift, and go to state 98 FI shift, and go to state 99 I_1 shift, and go to state 8 XI_1 shift, and go to state 9 FI_1 shift, and go to state 10 LABEL shift, and go to state 100 CIRCLE shift, and go to state 101 ELLIPSE shift, and go to state 102 RECTANGLE shift, and go to state 103 IF shift, and go to state 29 ID shift, and go to state 30 IMGFUNC shift, and go to state 31 CSTRING shift, and go to state 32 BOOL shift, and go to state 33 INUMBER shift, and go to state 34 RNUMBER shift, and go to state 35 ITOS shift, and go to state 36 RTOS shift, and go to state 37 TRUNC shift, and go to state 38 FLOAT shift, and go to state 39 SQRT shift, and go to state 40 SIN shift, and go to state 41 COS shift, and go to state 42 TAN shift, and go to state 43 ASIN shift, and go to state 44 ACOS shift, and go to state 45 ATAN shift, and go to state 46 LOG shift, and go to state 47 EXP shift, and go to state 48 RANDOM shift, and go to state 49 ROT shift, and go to state 50 SCALE shift, and go to state 51 TRANS shift, and go to state 52 REFLECT shift, and go to state 53 INTERSECT shift, and go to state 54 PARALLEL shift, and go to state 55 PERPEND shift, and go to state 56 DISTANCE shift, and go to state 57 MIDPOINT shift, and go to state 58 PT_BETWN_PTS shift, and go to state 59 COLINEAR shift, and go to state 60 INTERSECTS shift, and go to state 61 SEPARATES shift, and go to state 62 INCLUDES shift, and go to state 63 INCIDENT shift, and go to state 64 DISTLARGER shift, and go to state 65 DISTSMALLER shift, and go to state 66 NOT shift, and go to state 67 MINUS shift, and go to state 68 TILDE_SLASH shift, and go to state 69 SLASH shift, and go to state 70 LPAREN shift, and go to state 72 LBRACK shift, and go to state 73 LCURLY shift, and go to state 74 expr go to state 192 func1 go to state 85 func2 go to state 86 func3 go to state 87 identifier go to state 88 local_identifier go to state 89 local_id go to state 90 id go to state 91 state 134 expr -> expr OR . expr (rule 75) INF shift, and go to state 3 PI shift, and go to state 4 I shift, and go to state 5 XI shift, and go to state 98 FI shift, and go to state 99 I_1 shift, and go to state 8 XI_1 shift, and go to state 9 FI_1 shift, and go to state 10 LABEL shift, and go to state 100 CIRCLE shift, and go to state 101 ELLIPSE shift, and go to state 102 RECTANGLE shift, and go to state 103 IF shift, and go to state 29 ID shift, and go to state 30 IMGFUNC shift, and go to state 31 CSTRING shift, and go to state 32 BOOL shift, and go to state 33 INUMBER shift, and go to state 34 RNUMBER shift, and go to state 35 ITOS shift, and go to state 36 RTOS shift, and go to state 37 TRUNC shift, and go to state 38 FLOAT shift, and go to state 39 SQRT shift, and go to state 40 SIN shift, and go to state 41 COS shift, and go to state 42 TAN shift, and go to state 43 ASIN shift, and go to state 44 ACOS shift, and go to state 45 ATAN shift, and go to state 46 LOG shift, and go to state 47 EXP shift, and go to state 48 RANDOM shift, and go to state 49 ROT shift, and go to state 50 SCALE shift, and go to state 51 TRANS shift, and go to state 52 REFLECT shift, and go to state 53 INTERSECT shift, and go to state 54 PARALLEL shift, and go to state 55 PERPEND shift, and go to state 56 DISTANCE shift, and go to state 57 MIDPOINT shift, and go to state 58 PT_BETWN_PTS shift, and go to state 59 COLINEAR shift, and go to state 60 INTERSECTS shift, and go to state 61 SEPARATES shift, and go to state 62 INCLUDES shift, and go to state 63 INCIDENT shift, and go to state 64 DISTLARGER shift, and go to state 65 DISTSMALLER shift, and go to state 66 NOT shift, and go to state 67 MINUS shift, and go to state 68 TILDE_SLASH shift, and go to state 69 SLASH shift, and go to state 70 LPAREN shift, and go to state 72 LBRACK shift, and go to state 73 LCURLY shift, and go to state 74 expr go to state 193 func1 go to state 85 func2 go to state 86 func3 go to state 87 identifier go to state 88 local_identifier go to state 89 local_id go to state 90 id go to state 91 state 135 expr -> expr AND . expr (rule 74) INF shift, and go to state 3 PI shift, and go to state 4 I shift, and go to state 5 XI shift, and go to state 98 FI shift, and go to state 99 I_1 shift, and go to state 8 XI_1 shift, and go to state 9 FI_1 shift, and go to state 10 LABEL shift, and go to state 100 CIRCLE shift, and go to state 101 ELLIPSE shift, and go to state 102 RECTANGLE shift, and go to state 103 IF shift, and go to state 29 ID shift, and go to state 30 IMGFUNC shift, and go to state 31 CSTRING shift, and go to state 32 BOOL shift, and go to state 33 INUMBER shift, and go to state 34 RNUMBER shift, and go to state 35 ITOS shift, and go to state 36 RTOS shift, and go to state 37 TRUNC shift, and go to state 38 FLOAT shift, and go to state 39 SQRT shift, and go to state 40 SIN shift, and go to state 41 COS shift, and go to state 42 TAN shift, and go to state 43 ASIN shift, and go to state 44 ACOS shift, and go to state 45 ATAN shift, and go to state 46 LOG shift, and go to state 47 EXP shift, and go to state 48 RANDOM shift, and go to state 49 ROT shift, and go to state 50 SCALE shift, and go to state 51 TRANS shift, and go to state 52 REFLECT shift, and go to state 53 INTERSECT shift, and go to state 54 PARALLEL shift, and go to state 55 PERPEND shift, and go to state 56 DISTANCE shift, and go to state 57 MIDPOINT shift, and go to state 58 PT_BETWN_PTS shift, and go to state 59 COLINEAR shift, and go to state 60 INTERSECTS shift, and go to state 61 SEPARATES shift, and go to state 62 INCLUDES shift, and go to state 63 INCIDENT shift, and go to state 64 DISTLARGER shift, and go to state 65 DISTSMALLER shift, and go to state 66 NOT shift, and go to state 67 MINUS shift, and go to state 68 TILDE_SLASH shift, and go to state 69 SLASH shift, and go to state 70 LPAREN shift, and go to state 72 LBRACK shift, and go to state 73 LCURLY shift, and go to state 74 expr go to state 194 func1 go to state 85 func2 go to state 86 func3 go to state 87 identifier go to state 88 local_identifier go to state 89 local_id go to state 90 id go to state 91 state 136 expr -> expr EQ_EQ . expr (rule 76) INF shift, and go to state 3 PI shift, and go to state 4 I shift, and go to state 5 XI shift, and go to state 98 FI shift, and go to state 99 I_1 shift, and go to state 8 XI_1 shift, and go to state 9 FI_1 shift, and go to state 10 LABEL shift, and go to state 100 CIRCLE shift, and go to state 101 ELLIPSE shift, and go to state 102 RECTANGLE shift, and go to state 103 IF shift, and go to state 29 ID shift, and go to state 30 IMGFUNC shift, and go to state 31 CSTRING shift, and go to state 32 BOOL shift, and go to state 33 INUMBER shift, and go to state 34 RNUMBER shift, and go to state 35 ITOS shift, and go to state 36 RTOS shift, and go to state 37 TRUNC shift, and go to state 38 FLOAT shift, and go to state 39 SQRT shift, and go to state 40 SIN shift, and go to state 41 COS shift, and go to state 42 TAN shift, and go to state 43 ASIN shift, and go to state 44 ACOS shift, and go to state 45 ATAN shift, and go to state 46 LOG shift, and go to state 47 EXP shift, and go to state 48 RANDOM shift, and go to state 49 ROT shift, and go to state 50 SCALE shift, and go to state 51 TRANS shift, and go to state 52 REFLECT shift, and go to state 53 INTERSECT shift, and go to state 54 PARALLEL shift, and go to state 55 PERPEND shift, and go to state 56 DISTANCE shift, and go to state 57 MIDPOINT shift, and go to state 58 PT_BETWN_PTS shift, and go to state 59 COLINEAR shift, and go to state 60 INTERSECTS shift, and go to state 61 SEPARATES shift, and go to state 62 INCLUDES shift, and go to state 63 INCIDENT shift, and go to state 64 DISTLARGER shift, and go to state 65 DISTSMALLER shift, and go to state 66 NOT shift, and go to state 67 MINUS shift, and go to state 68 TILDE_SLASH shift, and go to state 69 SLASH shift, and go to state 70 LPAREN shift, and go to state 72 LBRACK shift, and go to state 73 LCURLY shift, and go to state 74 expr go to state 195 func1 go to state 85 func2 go to state 86 func3 go to state 87 identifier go to state 88 local_identifier go to state 89 local_id go to state 90 id go to state 91 state 137 expr -> expr NOT_EQ . expr (rule 77) INF shift, and go to state 3 PI shift, and go to state 4 I shift, and go to state 5 XI shift, and go to state 98 FI shift, and go to state 99 I_1 shift, and go to state 8 XI_1 shift, and go to state 9 FI_1 shift, and go to state 10 LABEL shift, and go to state 100 CIRCLE shift, and go to state 101 ELLIPSE shift, and go to state 102 RECTANGLE shift, and go to state 103 IF shift, and go to state 29 ID shift, and go to state 30 IMGFUNC shift, and go to state 31 CSTRING shift, and go to state 32 BOOL shift, and go to state 33 INUMBER shift, and go to state 34 RNUMBER shift, and go to state 35 ITOS shift, and go to state 36 RTOS shift, and go to state 37 TRUNC shift, and go to state 38 FLOAT shift, and go to state 39 SQRT shift, and go to state 40 SIN shift, and go to state 41 COS shift, and go to state 42 TAN shift, and go to state 43 ASIN shift, and go to state 44 ACOS shift, and go to state 45 ATAN shift, and go to state 46 LOG shift, and go to state 47 EXP shift, and go to state 48 RANDOM shift, and go to state 49 ROT shift, and go to state 50 SCALE shift, and go to state 51 TRANS shift, and go to state 52 REFLECT shift, and go to state 53 INTERSECT shift, and go to state 54 PARALLEL shift, and go to state 55 PERPEND shift, and go to state 56 DISTANCE shift, and go to state 57 MIDPOINT shift, and go to state 58 PT_BETWN_PTS shift, and go to state 59 COLINEAR shift, and go to state 60 INTERSECTS shift, and go to state 61 SEPARATES shift, and go to state 62 INCLUDES shift, and go to state 63 INCIDENT shift, and go to state 64 DISTLARGER shift, and go to state 65 DISTSMALLER shift, and go to state 66 NOT shift, and go to state 67 MINUS shift, and go to state 68 TILDE_SLASH shift, and go to state 69 SLASH shift, and go to state 70 LPAREN shift, and go to state 72 LBRACK shift, and go to state 73 LCURLY shift, and go to state 74 expr go to state 196 func1 go to state 85 func2 go to state 86 func3 go to state 87 identifier go to state 88 local_identifier go to state 89 local_id go to state 90 id go to state 91 state 138 expr -> expr GT . expr (rule 80) INF shift, and go to state 3 PI shift, and go to state 4 I shift, and go to state 5 XI shift, and go to state 98 FI shift, and go to state 99 I_1 shift, and go to state 8 XI_1 shift, and go to state 9 FI_1 shift, and go to state 10 LABEL shift, and go to state 100 CIRCLE shift, and go to state 101 ELLIPSE shift, and go to state 102 RECTANGLE shift, and go to state 103 IF shift, and go to state 29 ID shift, and go to state 30 IMGFUNC shift, and go to state 31 CSTRING shift, and go to state 32 BOOL shift, and go to state 33 INUMBER shift, and go to state 34 RNUMBER shift, and go to state 35 ITOS shift, and go to state 36 RTOS shift, and go to state 37 TRUNC shift, and go to state 38 FLOAT shift, and go to state 39 SQRT shift, and go to state 40 SIN shift, and go to state 41 COS shift, and go to state 42 TAN shift, and go to state 43 ASIN shift, and go to state 44 ACOS shift, and go to state 45 ATAN shift, and go to state 46 LOG shift, and go to state 47 EXP shift, and go to state 48 RANDOM shift, and go to state 49 ROT shift, and go to state 50 SCALE shift, and go to state 51 TRANS shift, and go to state 52 REFLECT shift, and go to state 53 INTERSECT shift, and go to state 54 PARALLEL shift, and go to state 55 PERPEND shift, and go to state 56 DISTANCE shift, and go to state 57 MIDPOINT shift, and go to state 58 PT_BETWN_PTS shift, and go to state 59 COLINEAR shift, and go to state 60 INTERSECTS shift, and go to state 61 SEPARATES shift, and go to state 62 INCLUDES shift, and go to state 63 INCIDENT shift, and go to state 64 DISTLARGER shift, and go to state 65 DISTSMALLER shift, and go to state 66 NOT shift, and go to state 67 MINUS shift, and go to state 68 TILDE_SLASH shift, and go to state 69 SLASH shift, and go to state 70 LPAREN shift, and go to state 72 LBRACK shift, and go to state 73 LCURLY shift, and go to state 74 expr go to state 197 func1 go to state 85 func2 go to state 86 func3 go to state 87 identifier go to state 88 local_identifier go to state 89 local_id go to state 90 id go to state 91 state 139 expr -> expr GT_EQ . expr (rule 81) INF shift, and go to state 3 PI shift, and go to state 4 I shift, and go to state 5 XI shift, and go to state 98 FI shift, and go to state 99 I_1 shift, and go to state 8 XI_1 shift, and go to state 9 FI_1 shift, and go to state 10 LABEL shift, and go to state 100 CIRCLE shift, and go to state 101 ELLIPSE shift, and go to state 102 RECTANGLE shift, and go to state 103 IF shift, and go to state 29 ID shift, and go to state 30 IMGFUNC shift, and go to state 31 CSTRING shift, and go to state 32 BOOL shift, and go to state 33 INUMBER shift, and go to state 34 RNUMBER shift, and go to state 35 ITOS shift, and go to state 36 RTOS shift, and go to state 37 TRUNC shift, and go to state 38 FLOAT shift, and go to state 39 SQRT shift, and go to state 40 SIN shift, and go to state 41 COS shift, and go to state 42 TAN shift, and go to state 43 ASIN shift, and go to state 44 ACOS shift, and go to state 45 ATAN shift, and go to state 46 LOG shift, and go to state 47 EXP shift, and go to state 48 RANDOM shift, and go to state 49 ROT shift, and go to state 50 SCALE shift, and go to state 51 TRANS shift, and go to state 52 REFLECT shift, and go to state 53 INTERSECT shift, and go to state 54 PARALLEL shift, and go to state 55 PERPEND shift, and go to state 56 DISTANCE shift, and go to state 57 MIDPOINT shift, and go to state 58 PT_BETWN_PTS shift, and go to state 59 COLINEAR shift, and go to state 60 INTERSECTS shift, and go to state 61 SEPARATES shift, and go to state 62 INCLUDES shift, and go to state 63 INCIDENT shift, and go to state 64 DISTLARGER shift, and go to state 65 DISTSMALLER shift, and go to state 66 NOT shift, and go to state 67 MINUS shift, and go to state 68 TILDE_SLASH shift, and go to state 69 SLASH shift, and go to state 70 LPAREN shift, and go to state 72 LBRACK shift, and go to state 73 LCURLY shift, and go to state 74 expr go to state 198 func1 go to state 85 func2 go to state 86 func3 go to state 87 identifier go to state 88 local_identifier go to state 89 local_id go to state 90 id go to state 91 state 140 expr -> expr LT . expr (rule 78) INF shift, and go to state 3 PI shift, and go to state 4 I shift, and go to state 5 XI shift, and go to state 98 FI shift, and go to state 99 I_1 shift, and go to state 8 XI_1 shift, and go to state 9 FI_1 shift, and go to state 10 LABEL shift, and go to state 100 CIRCLE shift, and go to state 101 ELLIPSE shift, and go to state 102 RECTANGLE shift, and go to state 103 IF shift, and go to state 29 ID shift, and go to state 30 IMGFUNC shift, and go to state 31 CSTRING shift, and go to state 32 BOOL shift, and go to state 33 INUMBER shift, and go to state 34 RNUMBER shift, and go to state 35 ITOS shift, and go to state 36 RTOS shift, and go to state 37 TRUNC shift, and go to state 38 FLOAT shift, and go to state 39 SQRT shift, and go to state 40 SIN shift, and go to state 41 COS shift, and go to state 42 TAN shift, and go to state 43 ASIN shift, and go to state 44 ACOS shift, and go to state 45 ATAN shift, and go to state 46 LOG shift, and go to state 47 EXP shift, and go to state 48 RANDOM shift, and go to state 49 ROT shift, and go to state 50 SCALE shift, and go to state 51 TRANS shift, and go to state 52 REFLECT shift, and go to state 53 INTERSECT shift, and go to state 54 PARALLEL shift, and go to state 55 PERPEND shift, and go to state 56 DISTANCE shift, and go to state 57 MIDPOINT shift, and go to state 58 PT_BETWN_PTS shift, and go to state 59 COLINEAR shift, and go to state 60 INTERSECTS shift, and go to state 61 SEPARATES shift, and go to state 62 INCLUDES shift, and go to state 63 INCIDENT shift, and go to state 64 DISTLARGER shift, and go to state 65 DISTSMALLER shift, and go to state 66 NOT shift, and go to state 67 MINUS shift, and go to state 68 TILDE_SLASH shift, and go to state 69 SLASH shift, and go to state 70 LPAREN shift, and go to state 72 LBRACK shift, and go to state 73 LCURLY shift, and go to state 74 expr go to state 199 func1 go to state 85 func2 go to state 86 func3 go to state 87 identifier go to state 88 local_identifier go to state 89 local_id go to state 90 id go to state 91 state 141 expr -> expr LT_EQ . expr (rule 79) INF shift, and go to state 3 PI shift, and go to state 4 I shift, and go to state 5 XI shift, and go to state 98 FI shift, and go to state 99 I_1 shift, and go to state 8 XI_1 shift, and go to state 9 FI_1 shift, and go to state 10 LABEL shift, and go to state 100 CIRCLE shift, and go to state 101 ELLIPSE shift, and go to state 102 RECTANGLE shift, and go to state 103 IF shift, and go to state 29 ID shift, and go to state 30 IMGFUNC shift, and go to state 31 CSTRING shift, and go to state 32 BOOL shift, and go to state 33 INUMBER shift, and go to state 34 RNUMBER shift, and go to state 35 ITOS shift, and go to state 36 RTOS shift, and go to state 37 TRUNC shift, and go to state 38 FLOAT shift, and go to state 39 SQRT shift, and go to state 40 SIN shift, and go to state 41 COS shift, and go to state 42 TAN shift, and go to state 43 ASIN shift, and go to state 44 ACOS shift, and go to state 45 ATAN shift, and go to state 46 LOG shift, and go to state 47 EXP shift, and go to state 48 RANDOM shift, and go to state 49 ROT shift, and go to state 50 SCALE shift, and go to state 51 TRANS shift, and go to state 52 REFLECT shift, and go to state 53 INTERSECT shift, and go to state 54 PARALLEL shift, and go to state 55 PERPEND shift, and go to state 56 DISTANCE shift, and go to state 57 MIDPOINT shift, and go to state 58 PT_BETWN_PTS shift, and go to state 59 COLINEAR shift, and go to state 60 INTERSECTS shift, and go to state 61 SEPARATES shift, and go to state 62 INCLUDES shift, and go to state 63 INCIDENT shift, and go to state 64 DISTLARGER shift, and go to state 65 DISTSMALLER shift, and go to state 66 NOT shift, and go to state 67 MINUS shift, and go to state 68 TILDE_SLASH shift, and go to state 69 SLASH shift, and go to state 70 LPAREN shift, and go to state 72 LBRACK shift, and go to state 73 LCURLY shift, and go to state 74 expr go to state 200 func1 go to state 85 func2 go to state 86 func3 go to state 87 identifier go to state 88 local_identifier go to state 89 local_id go to state 90 id go to state 91 state 142 expr -> expr SLASH_SLASH . expr (rule 82) INF shift, and go to state 3 PI shift, and go to state 4 I shift, and go to state 5 XI shift, and go to state 98 FI shift, and go to state 99 I_1 shift, and go to state 8 XI_1 shift, and go to state 9 FI_1 shift, and go to state 10 LABEL shift, and go to state 100 CIRCLE shift, and go to state 101 ELLIPSE shift, and go to state 102 RECTANGLE shift, and go to state 103 IF shift, and go to state 29 ID shift, and go to state 30 IMGFUNC shift, and go to state 31 CSTRING shift, and go to state 32 BOOL shift, and go to state 33 INUMBER shift, and go to state 34 RNUMBER shift, and go to state 35 ITOS shift, and go to state 36 RTOS shift, and go to state 37 TRUNC shift, and go to state 38 FLOAT shift, and go to state 39 SQRT shift, and go to state 40 SIN shift, and go to state 41 COS shift, and go to state 42 TAN shift, and go to state 43 ASIN shift, and go to state 44 ACOS shift, and go to state 45 ATAN shift, and go to state 46 LOG shift, and go to state 47 EXP shift, and go to state 48 RANDOM shift, and go to state 49 ROT shift, and go to state 50 SCALE shift, and go to state 51 TRANS shift, and go to state 52 REFLECT shift, and go to state 53 INTERSECT shift, and go to state 54 PARALLEL shift, and go to state 55 PERPEND shift, and go to state 56 DISTANCE shift, and go to state 57 MIDPOINT shift, and go to state 58 PT_BETWN_PTS shift, and go to state 59 COLINEAR shift, and go to state 60 INTERSECTS shift, and go to state 61 SEPARATES shift, and go to state 62 INCLUDES shift, and go to state 63 INCIDENT shift, and go to state 64 DISTLARGER shift, and go to state 65 DISTSMALLER shift, and go to state 66 NOT shift, and go to state 67 MINUS shift, and go to state 68 TILDE_SLASH shift, and go to state 69 SLASH shift, and go to state 70 LPAREN shift, and go to state 72 LBRACK shift, and go to state 73 LCURLY shift, and go to state 74 expr go to state 201 func1 go to state 85 func2 go to state 86 func3 go to state 87 identifier go to state 88 local_identifier go to state 89 local_id go to state 90 id go to state 91 state 143 expr -> expr PLUS . expr (rule 67) INF shift, and go to state 3 PI shift, and go to state 4 I shift, and go to state 5 XI shift, and go to state 98 FI shift, and go to state 99 I_1 shift, and go to state 8 XI_1 shift, and go to state 9 FI_1 shift, and go to state 10 LABEL shift, and go to state 100 CIRCLE shift, and go to state 101 ELLIPSE shift, and go to state 102 RECTANGLE shift, and go to state 103 IF shift, and go to state 29 ID shift, and go to state 30 IMGFUNC shift, and go to state 31 CSTRING shift, and go to state 32 BOOL shift, and go to state 33 INUMBER shift, and go to state 34 RNUMBER shift, and go to state 35 ITOS shift, and go to state 36 RTOS shift, and go to state 37 TRUNC shift, and go to state 38 FLOAT shift, and go to state 39 SQRT shift, and go to state 40 SIN shift, and go to state 41 COS shift, and go to state 42 TAN shift, and go to state 43 ASIN shift, and go to state 44 ACOS shift, and go to state 45 ATAN shift, and go to state 46 LOG shift, and go to state 47 EXP shift, and go to state 48 RANDOM shift, and go to state 49 ROT shift, and go to state 50 SCALE shift, and go to state 51 TRANS shift, and go to state 52 REFLECT shift, and go to state 53 INTERSECT shift, and go to state 54 PARALLEL shift, and go to state 55 PERPEND shift, and go to state 56 DISTANCE shift, and go to state 57 MIDPOINT shift, and go to state 58 PT_BETWN_PTS shift, and go to state 59 COLINEAR shift, and go to state 60 INTERSECTS shift, and go to state 61 SEPARATES shift, and go to state 62 INCLUDES shift, and go to state 63 INCIDENT shift, and go to state 64 DISTLARGER shift, and go to state 65 DISTSMALLER shift, and go to state 66 NOT shift, and go to state 67 MINUS shift, and go to state 68 TILDE_SLASH shift, and go to state 69 SLASH shift, and go to state 70 LPAREN shift, and go to state 72 LBRACK shift, and go to state 73 LCURLY shift, and go to state 74 expr go to state 202 func1 go to state 85 func2 go to state 86 func3 go to state 87 identifier go to state 88 local_identifier go to state 89 local_id go to state 90 id go to state 91 state 144 expr -> expr MINUS . expr (rule 68) INF shift, and go to state 3 PI shift, and go to state 4 I shift, and go to state 5 XI shift, and go to state 98 FI shift, and go to state 99 I_1 shift, and go to state 8 XI_1 shift, and go to state 9 FI_1 shift, and go to state 10 LABEL shift, and go to state 100 CIRCLE shift, and go to state 101 ELLIPSE shift, and go to state 102 RECTANGLE shift, and go to state 103 IF shift, and go to state 29 ID shift, and go to state 30 IMGFUNC shift, and go to state 31 CSTRING shift, and go to state 32 BOOL shift, and go to state 33 INUMBER shift, and go to state 34 RNUMBER shift, and go to state 35 ITOS shift, and go to state 36 RTOS shift, and go to state 37 TRUNC shift, and go to state 38 FLOAT shift, and go to state 39 SQRT shift, and go to state 40 SIN shift, and go to state 41 COS shift, and go to state 42 TAN shift, and go to state 43 ASIN shift, and go to state 44 ACOS shift, and go to state 45 ATAN shift, and go to state 46 LOG shift, and go to state 47 EXP shift, and go to state 48 RANDOM shift, and go to state 49 ROT shift, and go to state 50 SCALE shift, and go to state 51 TRANS shift, and go to state 52 REFLECT shift, and go to state 53 INTERSECT shift, and go to state 54 PARALLEL shift, and go to state 55 PERPEND shift, and go to state 56 DISTANCE shift, and go to state 57 MIDPOINT shift, and go to state 58 PT_BETWN_PTS shift, and go to state 59 COLINEAR shift, and go to state 60 INTERSECTS shift, and go to state 61 SEPARATES shift, and go to state 62 INCLUDES shift, and go to state 63 INCIDENT shift, and go to state 64 DISTLARGER shift, and go to state 65 DISTSMALLER shift, and go to state 66 NOT shift, and go to state 67 MINUS shift, and go to state 68 TILDE_SLASH shift, and go to state 69 SLASH shift, and go to state 70 LPAREN shift, and go to state 72 LBRACK shift, and go to state 73 LCURLY shift, and go to state 74 expr go to state 203 func1 go to state 85 func2 go to state 86 func3 go to state 87 identifier go to state 88 local_identifier go to state 89 local_id go to state 90 id go to state 91 state 145 expr -> expr STAR . expr (rule 69) INF shift, and go to state 3 PI shift, and go to state 4 I shift, and go to state 5 XI shift, and go to state 98 FI shift, and go to state 99 I_1 shift, and go to state 8 XI_1 shift, and go to state 9 FI_1 shift, and go to state 10 LABEL shift, and go to state 100 CIRCLE shift, and go to state 101 ELLIPSE shift, and go to state 102 RECTANGLE shift, and go to state 103 IF shift, and go to state 29 ID shift, and go to state 30 IMGFUNC shift, and go to state 31 CSTRING shift, and go to state 32 BOOL shift, and go to state 33 INUMBER shift, and go to state 34 RNUMBER shift, and go to state 35 ITOS shift, and go to state 36 RTOS shift, and go to state 37 TRUNC shift, and go to state 38 FLOAT shift, and go to state 39 SQRT shift, and go to state 40 SIN shift, and go to state 41 COS shift, and go to state 42 TAN shift, and go to state 43 ASIN shift, and go to state 44 ACOS shift, and go to state 45 ATAN shift, and go to state 46 LOG shift, and go to state 47 EXP shift, and go to state 48 RANDOM shift, and go to state 49 ROT shift, and go to state 50 SCALE shift, and go to state 51 TRANS shift, and go to state 52 REFLECT shift, and go to state 53 INTERSECT shift, and go to state 54 PARALLEL shift, and go to state 55 PERPEND shift, and go to state 56 DISTANCE shift, and go to state 57 MIDPOINT shift, and go to state 58 PT_BETWN_PTS shift, and go to state 59 COLINEAR shift, and go to state 60 INTERSECTS shift, and go to state 61 SEPARATES shift, and go to state 62 INCLUDES shift, and go to state 63 INCIDENT shift, and go to state 64 DISTLARGER shift, and go to state 65 DISTSMALLER shift, and go to state 66 NOT shift, and go to state 67 MINUS shift, and go to state 68 TILDE_SLASH shift, and go to state 69 SLASH shift, and go to state 70 LPAREN shift, and go to state 72 LBRACK shift, and go to state 73 LCURLY shift, and go to state 74 expr go to state 204 func1 go to state 85 func2 go to state 86 func3 go to state 87 identifier go to state 88 local_identifier go to state 89 local_id go to state 90 id go to state 91 state 146 expr -> expr DIV . expr (rule 71) INF shift, and go to state 3 PI shift, and go to state 4 I shift, and go to state 5 XI shift, and go to state 98 FI shift, and go to state 99 I_1 shift, and go to state 8 XI_1 shift, and go to state 9 FI_1 shift, and go to state 10 LABEL shift, and go to state 100 CIRCLE shift, and go to state 101 ELLIPSE shift, and go to state 102 RECTANGLE shift, and go to state 103 IF shift, and go to state 29 ID shift, and go to state 30 IMGFUNC shift, and go to state 31 CSTRING shift, and go to state 32 BOOL shift, and go to state 33 INUMBER shift, and go to state 34 RNUMBER shift, and go to state 35 ITOS shift, and go to state 36 RTOS shift, and go to state 37 TRUNC shift, and go to state 38 FLOAT shift, and go to state 39 SQRT shift, and go to state 40 SIN shift, and go to state 41 COS shift, and go to state 42 TAN shift, and go to state 43 ASIN shift, and go to state 44 ACOS shift, and go to state 45 ATAN shift, and go to state 46 LOG shift, and go to state 47 EXP shift, and go to state 48 RANDOM shift, and go to state 49 ROT shift, and go to state 50 SCALE shift, and go to state 51 TRANS shift, and go to state 52 REFLECT shift, and go to state 53 INTERSECT shift, and go to state 54 PARALLEL shift, and go to state 55 PERPEND shift, and go to state 56 DISTANCE shift, and go to state 57 MIDPOINT shift, and go to state 58 PT_BETWN_PTS shift, and go to state 59 COLINEAR shift, and go to state 60 INTERSECTS shift, and go to state 61 SEPARATES shift, and go to state 62 INCLUDES shift, and go to state 63 INCIDENT shift, and go to state 64 DISTLARGER shift, and go to state 65 DISTSMALLER shift, and go to state 66 NOT shift, and go to state 67 MINUS shift, and go to state 68 TILDE_SLASH shift, and go to state 69 SLASH shift, and go to state 70 LPAREN shift, and go to state 72 LBRACK shift, and go to state 73 LCURLY shift, and go to state 74 expr go to state 205 func1 go to state 85 func2 go to state 86 func3 go to state 87 identifier go to state 88 local_identifier go to state 89 local_id go to state 90 id go to state 91 state 147 expr -> expr MOD . expr (rule 70) INF shift, and go to state 3 PI shift, and go to state 4 I shift, and go to state 5 XI shift, and go to state 98 FI shift, and go to state 99 I_1 shift, and go to state 8 XI_1 shift, and go to state 9 FI_1 shift, and go to state 10 LABEL shift, and go to state 100 CIRCLE shift, and go to state 101 ELLIPSE shift, and go to state 102 RECTANGLE shift, and go to state 103 IF shift, and go to state 29 ID shift, and go to state 30 IMGFUNC shift, and go to state 31 CSTRING shift, and go to state 32 BOOL shift, and go to state 33 INUMBER shift, and go to state 34 RNUMBER shift, and go to state 35 ITOS shift, and go to state 36 RTOS shift, and go to state 37 TRUNC shift, and go to state 38 FLOAT shift, and go to state 39 SQRT shift, and go to state 40 SIN shift, and go to state 41 COS shift, and go to state 42 TAN shift, and go to state 43 ASIN shift, and go to state 44 ACOS shift, and go to state 45 ATAN shift, and go to state 46 LOG shift, and go to state 47 EXP shift, and go to state 48 RANDOM shift, and go to state 49 ROT shift, and go to state 50 SCALE shift, and go to state 51 TRANS shift, and go to state 52 REFLECT shift, and go to state 53 INTERSECT shift, and go to state 54 PARALLEL shift, and go to state 55 PERPEND shift, and go to state 56 DISTANCE shift, and go to state 57 MIDPOINT shift, and go to state 58 PT_BETWN_PTS shift, and go to state 59 COLINEAR shift, and go to state 60 INTERSECTS shift, and go to state 61 SEPARATES shift, and go to state 62 INCLUDES shift, and go to state 63 INCIDENT shift, and go to state 64 DISTLARGER shift, and go to state 65 DISTSMALLER shift, and go to state 66 NOT shift, and go to state 67 MINUS shift, and go to state 68 TILDE_SLASH shift, and go to state 69 SLASH shift, and go to state 70 LPAREN shift, and go to state 72 LBRACK shift, and go to state 73 LCURLY shift, and go to state 74 expr go to state 206 func1 go to state 85 func2 go to state 86 func3 go to state 87 identifier go to state 88 local_identifier go to state 89 local_id go to state 90 id go to state 91 state 148 expr -> expr DOTX . (rule 85) $default reduce using rule 85 (expr) state 149 expr -> expr DOTY . (rule 86) $default reduce using rule 86 (expr) state 150 expr -> expr DOTARG . (rule 90) $default reduce using rule 90 (expr) state 151 expr -> expr DOTRAD . (rule 89) $default reduce using rule 89 (expr) state 152 expr -> expr DOT1 . (rule 87) $default reduce using rule 87 (expr) state 153 expr -> expr DOT2 . (rule 88) $default reduce using rule 88 (expr) state 154 expr -> func1 LPAREN . expr RPAREN (rule 95) INF shift, and go to state 3 PI shift, and go to state 4 I shift, and go to state 5 XI shift, and go to state 98 FI shift, and go to state 99 I_1 shift, and go to state 8 XI_1 shift, and go to state 9 FI_1 shift, and go to state 10 LABEL shift, and go to state 100 CIRCLE shift, and go to state 101 ELLIPSE shift, and go to state 102 RECTANGLE shift, and go to state 103 IF shift, and go to state 29 ID shift, and go to state 30 IMGFUNC shift, and go to state 31 CSTRING shift, and go to state 32 BOOL shift, and go to state 33 INUMBER shift, and go to state 34 RNUMBER shift, and go to state 35 ITOS shift, and go to state 36 RTOS shift, and go to state 37 TRUNC shift, and go to state 38 FLOAT shift, and go to state 39 SQRT shift, and go to state 40 SIN shift, and go to state 41 COS shift, and go to state 42 TAN shift, and go to state 43 ASIN shift, and go to state 44 ACOS shift, and go to state 45 ATAN shift, and go to state 46 LOG shift, and go to state 47 EXP shift, and go to state 48 RANDOM shift, and go to state 49 ROT shift, and go to state 50 SCALE shift, and go to state 51 TRANS shift, and go to state 52 REFLECT shift, and go to state 53 INTERSECT shift, and go to state 54 PARALLEL shift, and go to state 55 PERPEND shift, and go to state 56 DISTANCE shift, and go to state 57 MIDPOINT shift, and go to state 58 PT_BETWN_PTS shift, and go to state 59 COLINEAR shift, and go to state 60 INTERSECTS shift, and go to state 61 SEPARATES shift, and go to state 62 INCLUDES shift, and go to state 63 INCIDENT shift, and go to state 64 DISTLARGER shift, and go to state 65 DISTSMALLER shift, and go to state 66 NOT shift, and go to state 67 MINUS shift, and go to state 68 TILDE_SLASH shift, and go to state 69 SLASH shift, and go to state 70 LPAREN shift, and go to state 72 LBRACK shift, and go to state 73 LCURLY shift, and go to state 74 expr go to state 207 func1 go to state 85 func2 go to state 86 func3 go to state 87 identifier go to state 88 local_identifier go to state 89 local_id go to state 90 id go to state 91 state 155 expr -> func2 LPAREN . expr COMMA expr RPAREN (rule 96) INF shift, and go to state 3 PI shift, and go to state 4 I shift, and go to state 5 XI shift, and go to state 98 FI shift, and go to state 99 I_1 shift, and go to state 8 XI_1 shift, and go to state 9 FI_1 shift, and go to state 10 LABEL shift, and go to state 100 CIRCLE shift, and go to state 101 ELLIPSE shift, and go to state 102 RECTANGLE shift, and go to state 103 IF shift, and go to state 29 ID shift, and go to state 30 IMGFUNC shift, and go to state 31 CSTRING shift, and go to state 32 BOOL shift, and go to state 33 INUMBER shift, and go to state 34 RNUMBER shift, and go to state 35 ITOS shift, and go to state 36 RTOS shift, and go to state 37 TRUNC shift, and go to state 38 FLOAT shift, and go to state 39 SQRT shift, and go to state 40 SIN shift, and go to state 41 COS shift, and go to state 42 TAN shift, and go to state 43 ASIN shift, and go to state 44 ACOS shift, and go to state 45 ATAN shift, and go to state 46 LOG shift, and go to state 47 EXP shift, and go to state 48 RANDOM shift, and go to state 49 ROT shift, and go to state 50 SCALE shift, and go to state 51 TRANS shift, and go to state 52 REFLECT shift, and go to state 53 INTERSECT shift, and go to state 54 PARALLEL shift, and go to state 55 PERPEND shift, and go to state 56 DISTANCE shift, and go to state 57 MIDPOINT shift, and go to state 58 PT_BETWN_PTS shift, and go to state 59 COLINEAR shift, and go to state 60 INTERSECTS shift, and go to state 61 SEPARATES shift, and go to state 62 INCLUDES shift, and go to state 63 INCIDENT shift, and go to state 64 DISTLARGER shift, and go to state 65 DISTSMALLER shift, and go to state 66 NOT shift, and go to state 67 MINUS shift, and go to state 68 TILDE_SLASH shift, and go to state 69 SLASH shift, and go to state 70 LPAREN shift, and go to state 72 LBRACK shift, and go to state 73 LCURLY shift, and go to state 74 expr go to state 208 func1 go to state 85 func2 go to state 86 func3 go to state 87 identifier go to state 88 local_identifier go to state 89 local_id go to state 90 id go to state 91 state 156 expr -> func3 LPAREN . expr COMMA expr COMMA expr RPAREN (rule 97) INF shift, and go to state 3 PI shift, and go to state 4 I shift, and go to state 5 XI shift, and go to state 98 FI shift, and go to state 99 I_1 shift, and go to state 8 XI_1 shift, and go to state 9 FI_1 shift, and go to state 10 LABEL shift, and go to state 100 CIRCLE shift, and go to state 101 ELLIPSE shift, and go to state 102 RECTANGLE shift, and go to state 103 IF shift, and go to state 29 ID shift, and go to state 30 IMGFUNC shift, and go to state 31 CSTRING shift, and go to state 32 BOOL shift, and go to state 33 INUMBER shift, and go to state 34 RNUMBER shift, and go to state 35 ITOS shift, and go to state 36 RTOS shift, and go to state 37 TRUNC shift, and go to state 38 FLOAT shift, and go to state 39 SQRT shift, and go to state 40 SIN shift, and go to state 41 COS shift, and go to state 42 TAN shift, and go to state 43 ASIN shift, and go to state 44 ACOS shift, and go to state 45 ATAN shift, and go to state 46 LOG shift, and go to state 47 EXP shift, and go to state 48 RANDOM shift, and go to state 49 ROT shift, and go to state 50 SCALE shift, and go to state 51 TRANS shift, and go to state 52 REFLECT shift, and go to state 53 INTERSECT shift, and go to state 54 PARALLEL shift, and go to state 55 PERPEND shift, and go to state 56 DISTANCE shift, and go to state 57 MIDPOINT shift, and go to state 58 PT_BETWN_PTS shift, and go to state 59 COLINEAR shift, and go to state 60 INTERSECTS shift, and go to state 61 SEPARATES shift, and go to state 62 INCLUDES shift, and go to state 63 INCIDENT shift, and go to state 64 DISTLARGER shift, and go to state 65 DISTSMALLER shift, and go to state 66 NOT shift, and go to state 67 MINUS shift, and go to state 68 TILDE_SLASH shift, and go to state 69 SLASH shift, and go to state 70 LPAREN shift, and go to state 72 LBRACK shift, and go to state 73 LCURLY shift, and go to state 74 expr go to state 209 func1 go to state 85 func2 go to state 86 func3 go to state 87 identifier go to state 88 local_identifier go to state 89 local_id go to state 90 id go to state 91 state 157 local_identifier -> local_id SLASH . local_identifier (rule 130) ID shift, and go to state 107 TILDE_SLASH shift, and go to state 69 local_identifier go to state 210 local_id go to state 90 id go to state 91 state 158 definition -> XI EQUALS expr . NEWLINE (rule 36) expr -> expr . PLUS expr (rule 67) expr -> expr . MINUS expr (rule 68) expr -> expr . STAR expr (rule 69) expr -> expr . MOD expr (rule 70) expr -> expr . DIV expr (rule 71) expr -> expr . AND expr (rule 74) expr -> expr . OR expr (rule 75) expr -> expr . EQ_EQ expr (rule 76) expr -> expr . NOT_EQ expr (rule 77) expr -> expr . LT expr (rule 78) expr -> expr . LT_EQ expr (rule 79) expr -> expr . GT expr (rule 80) expr -> expr . GT_EQ expr (rule 81) expr -> expr . SLASH_SLASH expr (rule 82) expr -> expr . DOTX (rule 85) expr -> expr . DOTY (rule 86) expr -> expr . DOT1 (rule 87) expr -> expr . DOT2 (rule 88) expr -> expr . DOTRAD (rule 89) expr -> expr . DOTARG (rule 90) OR shift, and go to state 134 AND shift, and go to state 135 EQ_EQ shift, and go to state 136 NOT_EQ shift, and go to state 137 GT shift, and go to state 138 GT_EQ shift, and go to state 139 LT shift, and go to state 140 LT_EQ shift, and go to state 141 SLASH_SLASH shift, and go to state 142 PLUS shift, and go to state 143 MINUS shift, and go to state 144 STAR shift, and go to state 145 DIV shift, and go to state 146 MOD shift, and go to state 147 DOTX shift, and go to state 148 DOTY shift, and go to state 149 DOTARG shift, and go to state 150 DOTRAD shift, and go to state 151 DOT1 shift, and go to state 152 DOT2 shift, and go to state 153 NEWLINE shift, and go to state 211 state 159 definition -> FI EQUALS expr . NEWLINE (rule 37) expr -> expr . PLUS expr (rule 67) expr -> expr . MINUS expr (rule 68) expr -> expr . STAR expr (rule 69) expr -> expr . MOD expr (rule 70) expr -> expr . DIV expr (rule 71) expr -> expr . AND expr (rule 74) expr -> expr . OR expr (rule 75) expr -> expr . EQ_EQ expr (rule 76) expr -> expr . NOT_EQ expr (rule 77) expr -> expr . LT expr (rule 78) expr -> expr . LT_EQ expr (rule 79) expr -> expr . GT expr (rule 80) expr -> expr . GT_EQ expr (rule 81) expr -> expr . SLASH_SLASH expr (rule 82) expr -> expr . DOTX (rule 85) expr -> expr . DOTY (rule 86) expr -> expr . DOT1 (rule 87) expr -> expr . DOT2 (rule 88) expr -> expr . DOTRAD (rule 89) expr -> expr . DOTARG (rule 90) OR shift, and go to state 134 AND shift, and go to state 135 EQ_EQ shift, and go to state 136 NOT_EQ shift, and go to state 137 GT shift, and go to state 138 GT_EQ shift, and go to state 139 LT shift, and go to state 140 LT_EQ shift, and go to state 141 SLASH_SLASH shift, and go to state 142 PLUS shift, and go to state 143 MINUS shift, and go to state 144 STAR shift, and go to state 145 DIV shift, and go to state 146 MOD shift, and go to state 147 DOTX shift, and go to state 148 DOTY shift, and go to state 149 DOTARG shift, and go to state 150 DOTRAD shift, and go to state 151 DOT1 shift, and go to state 152 DOT2 shift, and go to state 153 NEWLINE shift, and go to state 212 state 160 expr -> LABEL LPAREN expr . COMMA expr RPAREN (rule 66) expr -> expr . PLUS expr (rule 67) expr -> expr . MINUS expr (rule 68) expr -> expr . STAR expr (rule 69) expr -> expr . MOD expr (rule 70) expr -> expr . DIV expr (rule 71) expr -> expr . AND expr (rule 74) expr -> expr . OR expr (rule 75) expr -> expr . EQ_EQ expr (rule 76) expr -> expr . NOT_EQ expr (rule 77) expr -> expr . LT expr (rule 78) expr -> expr . LT_EQ expr (rule 79) expr -> expr . GT expr (rule 80) expr -> expr . GT_EQ expr (rule 81) expr -> expr . SLASH_SLASH expr (rule 82) expr -> expr . DOTX (rule 85) expr -> expr . DOTY (rule 86) expr -> expr . DOT1 (rule 87) expr -> expr . DOT2 (rule 88) expr -> expr . DOTRAD (rule 89) expr -> expr . DOTARG (rule 90) COMMA shift, and go to state 213 OR shift, and go to state 134 AND shift, and go to state 135 EQ_EQ shift, and go to state 136 NOT_EQ shift, and go to state 137 GT shift, and go to state 138 GT_EQ shift, and go to state 139 LT shift, and go to state 140 LT_EQ shift, and go to state 141 SLASH_SLASH shift, and go to state 142 PLUS shift, and go to state 143 MINUS shift, and go to state 144 STAR shift, and go to state 145 DIV shift, and go to state 146 MOD shift, and go to state 147 DOTX shift, and go to state 148 DOTY shift, and go to state 149 DOTARG shift, and go to state 150 DOTRAD shift, and go to state 151 DOT1 shift, and go to state 152 DOT2 shift, and go to state 153 state 161 expr -> CIRCLE LPAREN expr . COMMA expr RPAREN (rule 63) expr -> expr . PLUS expr (rule 67) expr -> expr . MINUS expr (rule 68) expr -> expr . STAR expr (rule 69) expr -> expr . MOD expr (rule 70) expr -> expr . DIV expr (rule 71) expr -> expr . AND expr (rule 74) expr -> expr . OR expr (rule 75) expr -> expr . EQ_EQ expr (rule 76) expr -> expr . NOT_EQ expr (rule 77) expr -> expr . LT expr (rule 78) expr -> expr . LT_EQ expr (rule 79) expr -> expr . GT expr (rule 80) expr -> expr . GT_EQ expr (rule 81) expr -> expr . SLASH_SLASH expr (rule 82) expr -> expr . DOTX (rule 85) expr -> expr . DOTY (rule 86) expr -> expr . DOT1 (rule 87) expr -> expr . DOT2 (rule 88) expr -> expr . DOTRAD (rule 89) expr -> expr . DOTARG (rule 90) COMMA shift, and go to state 214 OR shift, and go to state 134 AND shift, and go to state 135 EQ_EQ shift, and go to state 136 NOT_EQ shift, and go to state 137 GT shift, and go to state 138 GT_EQ shift, and go to state 139 LT shift, and go to state 140 LT_EQ shift, and go to state 141 SLASH_SLASH shift, and go to state 142 PLUS shift, and go to state 143 MINUS shift, and go to state 144 STAR shift, and go to state 145 DIV shift, and go to state 146 MOD shift, and go to state 147 DOTX shift, and go to state 148 DOTY shift, and go to state 149 DOTARG shift, and go to state 150 DOTRAD shift, and go to state 151 DOT1 shift, and go to state 152 DOT2 shift, and go to state 153 state 162 expr -> ELLIPSE LPAREN expr . COMMA expr COMMA expr RPAREN (rule 65) expr -> expr . PLUS expr (rule 67) expr -> expr . MINUS expr (rule 68) expr -> expr . STAR expr (rule 69) expr -> expr . MOD expr (rule 70) expr -> expr . DIV expr (rule 71) expr -> expr . AND expr (rule 74) expr -> expr . OR expr (rule 75) expr -> expr . EQ_EQ expr (rule 76) expr -> expr . NOT_EQ expr (rule 77) expr -> expr . LT expr (rule 78) expr -> expr . LT_EQ expr (rule 79) expr -> expr . GT expr (rule 80) expr -> expr . GT_EQ expr (rule 81) expr -> expr . SLASH_SLASH expr (rule 82) expr -> expr . DOTX (rule 85) expr -> expr . DOTY (rule 86) expr -> expr . DOT1 (rule 87) expr -> expr . DOT2 (rule 88) expr -> expr . DOTRAD (rule 89) expr -> expr . DOTARG (rule 90) COMMA shift, and go to state 215 OR shift, and go to state 134 AND shift, and go to state 135 EQ_EQ shift, and go to state 136 NOT_EQ shift, and go to state 137 GT shift, and go to state 138 GT_EQ shift, and go to state 139 LT shift, and go to state 140 LT_EQ shift, and go to state 141 SLASH_SLASH shift, and go to state 142 PLUS shift, and go to state 143 MINUS shift, and go to state 144 STAR shift, and go to state 145 DIV shift, and go to state 146 MOD shift, and go to state 147 DOTX shift, and go to state 148 DOTY shift, and go to state 149 DOTARG shift, and go to state 150 DOTRAD shift, and go to state 151 DOT1 shift, and go to state 152 DOT2 shift, and go to state 153 state 163 expr -> RECTANGLE LPAREN expr . COMMA expr RPAREN (rule 64) expr -> expr . PLUS expr (rule 67) expr -> expr . MINUS expr (rule 68) expr -> expr . STAR expr (rule 69) expr -> expr . MOD expr (rule 70) expr -> expr . DIV expr (rule 71) expr -> expr . AND expr (rule 74) expr -> expr . OR expr (rule 75) expr -> expr . EQ_EQ expr (rule 76) expr -> expr . NOT_EQ expr (rule 77) expr -> expr . LT expr (rule 78) expr -> expr . LT_EQ expr (rule 79) expr -> expr . GT expr (rule 80) expr -> expr . GT_EQ expr (rule 81) expr -> expr . SLASH_SLASH expr (rule 82) expr -> expr . DOTX (rule 85) expr -> expr . DOTY (rule 86) expr -> expr . DOT1 (rule 87) expr -> expr . DOT2 (rule 88) expr -> expr . DOTRAD (rule 89) expr -> expr . DOTARG (rule 90) COMMA shift, and go to state 216 OR shift, and go to state 134 AND shift, and go to state 135 EQ_EQ shift, and go to state 136 NOT_EQ shift, and go to state 137 GT shift, and go to state 138 GT_EQ shift, and go to state 139 LT shift, and go to state 140 LT_EQ shift, and go to state 141 SLASH_SLASH shift, and go to state 142 PLUS shift, and go to state 143 MINUS shift, and go to state 144 STAR shift, and go to state 145 DIV shift, and go to state 146 MOD shift, and go to state 147 DOTX shift, and go to state 148 DOTY shift, and go to state 149 DOTARG shift, and go to state 150 DOTRAD shift, and go to state 151 DOT1 shift, and go to state 152 DOT2 shift, and go to state 153 state 164 delete -> DELETE expr_list NEWLINE . (rule 12) $default reduce using rule 12 (delete) state 165 expr -> IF expr THEN . expr ELSE expr (rule 99) INF shift, and go to state 3 PI shift, and go to state 4 I shift, and go to state 5 XI shift, and go to state 98 FI shift, and go to state 99 I_1 shift, and go to state 8 XI_1 shift, and go to state 9 FI_1 shift, and go to state 10 LABEL shift, and go to state 100 CIRCLE shift, and go to state 101 ELLIPSE shift, and go to state 102 RECTANGLE shift, and go to state 103 IF shift, and go to state 29 ID shift, and go to state 30 IMGFUNC shift, and go to state 31 CSTRING shift, and go to state 32 BOOL shift, and go to state 33 INUMBER shift, and go to state 34 RNUMBER shift, and go to state 35 ITOS shift, and go to state 36 RTOS shift, and go to state 37 TRUNC shift, and go to state 38 FLOAT shift, and go to state 39 SQRT shift, and go to state 40 SIN shift, and go to state 41 COS shift, and go to state 42 TAN shift, and go to state 43 ASIN shift, and go to state 44 ACOS shift, and go to state 45 ATAN shift, and go to state 46 LOG shift, and go to state 47 EXP shift, and go to state 48 RANDOM shift, and go to state 49 ROT shift, and go to state 50 SCALE shift, and go to state 51 TRANS shift, and go to state 52 REFLECT shift, and go to state 53 INTERSECT shift, and go to state 54 PARALLEL shift, and go to state 55 PERPEND shift, and go to state 56 DISTANCE shift, and go to state 57 MIDPOINT shift, and go to state 58 PT_BETWN_PTS shift, and go to state 59 COLINEAR shift, and go to state 60 INTERSECTS shift, and go to state 61 SEPARATES shift, and go to state 62 INCLUDES shift, and go to state 63 INCIDENT shift, and go to state 64 DISTLARGER shift, and go to state 65 DISTSMALLER shift, and go to state 66 NOT shift, and go to state 67 MINUS shift, and go to state 68 TILDE_SLASH shift, and go to state 69 SLASH shift, and go to state 70 LPAREN shift, and go to state 72 LBRACK shift, and go to state 73 LCURLY shift, and go to state 74 expr go to state 217 func1 go to state 85 func2 go to state 86 func3 go to state 87 identifier go to state 88 local_identifier go to state 89 local_id go to state 90 id go to state 91 state 166 expr -> ID NOT LPAREN . RPAREN (rule 91) expr -> ID NOT LPAREN . expr_list RPAREN (rule 92) INF shift, and go to state 3 PI shift, and go to state 4 I shift, and go to state 5 XI shift, and go to state 98 FI shift, and go to state 99 I_1 shift, and go to state 8 XI_1 shift, and go to state 9 FI_1 shift, and go to state 10 LABEL shift, and go to state 100 CIRCLE shift, and go to state 101 ELLIPSE shift, and go to state 102 RECTANGLE shift, and go to state 103 IF shift, and go to state 29 ID shift, and go to state 30 IMGFUNC shift, and go to state 31 CSTRING shift, and go to state 32 BOOL shift, and go to state 33 INUMBER shift, and go to state 34 RNUMBER shift, and go to state 35 ITOS shift, and go to state 36 RTOS shift, and go to state 37 TRUNC shift, and go to state 38 FLOAT shift, and go to state 39 SQRT shift, and go to state 40 SIN shift, and go to state 41 COS shift, and go to state 42 TAN shift, and go to state 43 ASIN shift, and go to state 44 ACOS shift, and go to state 45 ATAN shift, and go to state 46 LOG shift, and go to state 47 EXP shift, and go to state 48 RANDOM shift, and go to state 49 ROT shift, and go to state 50 SCALE shift, and go to state 51 TRANS shift, and go to state 52 REFLECT shift, and go to state 53 INTERSECT shift, and go to state 54 PARALLEL shift, and go to state 55 PERPEND shift, and go to state 56 DISTANCE shift, and go to state 57 MIDPOINT shift, and go to state 58 PT_BETWN_PTS shift, and go to state 59 COLINEAR shift, and go to state 60 INTERSECTS shift, and go to state 61 SEPARATES shift, and go to state 62 INCLUDES shift, and go to state 63 INCIDENT shift, and go to state 64 DISTLARGER shift, and go to state 65 DISTSMALLER shift, and go to state 66 NOT shift, and go to state 67 MINUS shift, and go to state 68 TILDE_SLASH shift, and go to state 69 SLASH shift, and go to state 70 LPAREN shift, and go to state 72 RPAREN shift, and go to state 218 LBRACK shift, and go to state 73 LCURLY shift, and go to state 74 expr_list go to state 219 expr go to state 84 func1 go to state 85 func2 go to state 86 func3 go to state 87 identifier go to state 88 local_identifier go to state 89 local_id go to state 90 id go to state 91 state 167 expr -> IMGFUNC LPAREN RPAREN . (rule 93) $default reduce using rule 93 (expr) state 168 expr_list -> expr_list . COMMA expr (rule 41) expr -> IMGFUNC LPAREN expr_list . RPAREN (rule 94) COMMA shift, and go to state 133 RPAREN shift, and go to state 220 state 169 expr -> expr . PLUS expr (rule 67) expr -> expr . MINUS expr (rule 68) expr -> expr . STAR expr (rule 69) expr -> expr . MOD expr (rule 70) expr -> expr . DIV expr (rule 71) expr -> expr . AND expr (rule 74) expr -> expr . OR expr (rule 75) expr -> expr . EQ_EQ expr (rule 76) expr -> expr . NOT_EQ expr (rule 77) expr -> expr . LT expr (rule 78) expr -> expr . LT_EQ expr (rule 79) expr -> expr . GT expr (rule 80) expr -> expr . GT_EQ expr (rule 81) expr -> expr . SLASH_SLASH expr (rule 82) expr -> ITOS LPAREN expr . RPAREN (rule 83) expr -> expr . DOTX (rule 85) expr -> expr . DOTY (rule 86) expr -> expr . DOT1 (rule 87) expr -> expr . DOT2 (rule 88) expr -> expr . DOTRAD (rule 89) expr -> expr . DOTARG (rule 90) OR shift, and go to state 134 AND shift, and go to state 135 EQ_EQ shift, and go to state 136 NOT_EQ shift, and go to state 137 GT shift, and go to state 138 GT_EQ shift, and go to state 139 LT shift, and go to state 140 LT_EQ shift, and go to state 141 SLASH_SLASH shift, and go to state 142 PLUS shift, and go to state 143 MINUS shift, and go to state 144 STAR shift, and go to state 145 DIV shift, and go to state 146 MOD shift, and go to state 147 DOTX shift, and go to state 148 DOTY shift, and go to state 149 DOTARG shift, and go to state 150 DOTRAD shift, and go to state 151 DOT1 shift, and go to state 152 DOT2 shift, and go to state 153 RPAREN shift, and go to state 221 state 170 expr -> expr . PLUS expr (rule 67) expr -> expr . MINUS expr (rule 68) expr -> expr . STAR expr (rule 69) expr -> expr . MOD expr (rule 70) expr -> expr . DIV expr (rule 71) expr -> expr . AND expr (rule 74) expr -> expr . OR expr (rule 75) expr -> expr . EQ_EQ expr (rule 76) expr -> expr . NOT_EQ expr (rule 77) expr -> expr . LT expr (rule 78) expr -> expr . LT_EQ expr (rule 79) expr -> expr . GT expr (rule 80) expr -> expr . GT_EQ expr (rule 81) expr -> expr . SLASH_SLASH expr (rule 82) expr -> RTOS LPAREN expr . COMMA expr RPAREN (rule 84) expr -> expr . DOTX (rule 85) expr -> expr . DOTY (rule 86) expr -> expr . DOT1 (rule 87) expr -> expr . DOT2 (rule 88) expr -> expr . DOTRAD (rule 89) expr -> expr . DOTARG (rule 90) COMMA shift, and go to state 222 OR shift, and go to state 134 AND shift, and go to state 135 EQ_EQ shift, and go to state 136 NOT_EQ shift, and go to state 137 GT shift, and go to state 138 GT_EQ shift, and go to state 139 LT shift, and go to state 140 LT_EQ shift, and go to state 141 SLASH_SLASH shift, and go to state 142 PLUS shift, and go to state 143 MINUS shift, and go to state 144 STAR shift, and go to state 145 DIV shift, and go to state 146 MOD shift, and go to state 147 DOTX shift, and go to state 148 DOTY shift, and go to state 149 DOTARG shift, and go to state 150 DOTRAD shift, and go to state 151 DOT1 shift, and go to state 152 DOT2 shift, and go to state 153 state 171 expr -> expr . PLUS expr (rule 67) expr -> expr . MINUS expr (rule 68) expr -> expr . STAR expr (rule 69) expr -> expr . MOD expr (rule 70) expr -> expr . DIV expr (rule 71) expr -> expr . AND expr (rule 74) expr -> expr . OR expr (rule 75) expr -> expr . EQ_EQ expr (rule 76) expr -> expr . NOT_EQ expr (rule 77) expr -> expr . LT expr (rule 78) expr -> expr . LT_EQ expr (rule 79) expr -> expr . GT expr (rule 80) expr -> expr . GT_EQ expr (rule 81) expr -> expr . SLASH_SLASH expr (rule 82) expr -> expr . DOTX (rule 85) expr -> expr . DOTY (rule 86) expr -> expr . DOT1 (rule 87) expr -> expr . DOT2 (rule 88) expr -> expr . DOTRAD (rule 89) expr -> expr . DOTARG (rule 90) expr -> PARALLEL LPAREN expr . COMMA expr COMMA expr COMMA expr RPAREN (rule 98) COMMA shift, and go to state 223 OR shift, and go to state 134 AND shift, and go to state 135 EQ_EQ shift, and go to state 136 NOT_EQ shift, and go to state 137 GT shift, and go to state 138 GT_EQ shift, and go to state 139 LT shift, and go to state 140 LT_EQ shift, and go to state 141 SLASH_SLASH shift, and go to state 142 PLUS shift, and go to state 143 MINUS shift, and go to state 144 STAR shift, and go to state 145 DIV shift, and go to state 146 MOD shift, and go to state 147 DOTX shift, and go to state 148 DOTY shift, and go to state 149 DOTARG shift, and go to state 150 DOTRAD shift, and go to state 151 DOT1 shift, and go to state 152 DOT2 shift, and go to state 153 state 172 expr -> LPAREN expr RPAREN . (rule 58) $default reduce using rule 58 (expr) state 173 type_name -> LABEL . (rule 30) $default reduce using rule 30 (type_name) state 174 type_name -> CIRCLE . (rule 28) $default reduce using rule 28 (type_name) state 175 type_name -> ELLIPSE . (rule 29) $default reduce using rule 29 (type_name) state 176 type_name -> RECTANGLE . (rule 34) $default reduce using rule 34 (type_name) state 177 expr -> LBRACK NEWLINE graph_spec_list . RBRACK (rule 55) graph_spec_list -> graph_spec_list . SEMICOLON graph_spec (rule 137) graph_spec_list -> graph_spec_list . SEMICOLON NEWLINE graph_spec (rule 138) SEMICOLON shift, and go to state 180 RBRACK shift, and go to state 224 state 178 graph_spec -> type_name COLON . (rule 139) graph_spec -> type_name COLON . expr (rule 140) graph_spec -> type_name COLON . NEWLINE (rule 141) graph_spec -> type_name COLON . expr NEWLINE (rule 142) INF shift, and go to state 3 PI shift, and go to state 4 I shift, and go to state 5 XI shift, and go to state 98 FI shift, and go to state 99 I_1 shift, and go to state 8 XI_1 shift, and go to state 9 FI_1 shift, and go to state 10 LABEL shift, and go to state 100 CIRCLE shift, and go to state 101 ELLIPSE shift, and go to state 102 RECTANGLE shift, and go to state 103 IF shift, and go to state 29 ID shift, and go to state 30 IMGFUNC shift, and go to state 31 CSTRING shift, and go to state 32 BOOL shift, and go to state 33 INUMBER shift, and go to state 34 RNUMBER shift, and go to state 35 ITOS shift, and go to state 36 RTOS shift, and go to state 37 TRUNC shift, and go to state 38 FLOAT shift, and go to state 39 SQRT shift, and go to state 40 SIN shift, and go to state 41 COS shift, and go to state 42 TAN shift, and go to state 43 ASIN shift, and go to state 44 ACOS shift, and go to state 45 ATAN shift, and go to state 46 LOG shift, and go to state 47 EXP shift, and go to state 48 RANDOM shift, and go to state 49 ROT shift, and go to state 50 SCALE shift, and go to state 51 TRANS shift, and go to state 52 REFLECT shift, and go to state 53 INTERSECT shift, and go to state 54 PARALLEL shift, and go to state 55 PERPEND shift, and go to state 56 DISTANCE shift, and go to state 57 MIDPOINT shift, and go to state 58 PT_BETWN_PTS shift, and go to state 59 COLINEAR shift, and go to state 60 INTERSECTS shift, and go to state 61 SEPARATES shift, and go to state 62 INCLUDES shift, and go to state 63 INCIDENT shift, and go to state 64 DISTLARGER shift, and go to state 65 DISTSMALLER shift, and go to state 66 NOT shift, and go to state 67 MINUS shift, and go to state 68 TILDE_SLASH shift, and go to state 69 SLASH shift, and go to state 70 NEWLINE shift, and go to state 225 LPAREN shift, and go to state 72 LBRACK shift, and go to state 73 LCURLY shift, and go to state 74 $default reduce using rule 139 (graph_spec) expr go to state 226 func1 go to state 85 func2 go to state 86 func3 go to state 87 identifier go to state 88 local_identifier go to state 89 local_id go to state 90 id go to state 91 state 179 expr -> LBRACK expr COMMA . expr RBRACK (rule 61) expr -> LBRACK expr COMMA . expr COMMA expr RBRACK (rule 62) INF shift, and go to state 3 PI shift, and go to state 4 I shift, and go to state 5 XI shift, and go to state 98 FI shift, and go to state 99 I_1 shift, and go to state 8 XI_1 shift, and go to state 9 FI_1 shift, and go to state 10 LABEL shift, and go to state 100 CIRCLE shift, and go to state 101 ELLIPSE shift, and go to state 102 RECTANGLE shift, and go to state 103 IF shift, and go to state 29 ID shift, and go to state 30 IMGFUNC shift, and go to state 31 CSTRING shift, and go to state 32 BOOL shift, and go to state 33 INUMBER shift, and go to state 34 RNUMBER shift, and go to state 35 ITOS shift, and go to state 36 RTOS shift, and go to state 37 TRUNC shift, and go to state 38 FLOAT shift, and go to state 39 SQRT shift, and go to state 40 SIN shift, and go to state 41 COS shift, and go to state 42 TAN shift, and go to state 43 ASIN shift, and go to state 44 ACOS shift, and go to state 45 ATAN shift, and go to state 46 LOG shift, and go to state 47 EXP shift, and go to state 48 RANDOM shift, and go to state 49 ROT shift, and go to state 50 SCALE shift, and go to state 51 TRANS shift, and go to state 52 REFLECT shift, and go to state 53 INTERSECT shift, and go to state 54 PARALLEL shift, and go to state 55 PERPEND shift, and go to state 56 DISTANCE shift, and go to state 57 MIDPOINT shift, and go to state 58 PT_BETWN_PTS shift, and go to state 59 COLINEAR shift, and go to state 60 INTERSECTS shift, and go to state 61 SEPARATES shift, and go to state 62 INCLUDES shift, and go to state 63 INCIDENT shift, and go to state 64 DISTLARGER shift, and go to state 65 DISTSMALLER shift, and go to state 66 NOT shift, and go to state 67 MINUS shift, and go to state 68 TILDE_SLASH shift, and go to state 69 SLASH shift, and go to state 70 LPAREN shift, and go to state 72 LBRACK shift, and go to state 73 LCURLY shift, and go to state 74 expr go to state 227 func1 go to state 85 func2 go to state 86 func3 go to state 87 identifier go to state 88 local_identifier go to state 89 local_id go to state 90 id go to state 91 state 180 graph_spec_list -> graph_spec_list SEMICOLON . graph_spec (rule 137) graph_spec_list -> graph_spec_list SEMICOLON . NEWLINE graph_spec (rule 138) IMAGE shift, and go to state 11 MYCHAR shift, and go to state 12 REAL shift, and go to state 13 INT shift, and go to state 14 BOOLEAN shift, and go to state 15 POINT shift, and go to state 16 LABEL shift, and go to state 173 LINE shift, and go to state 18 CIRCLE shift, and go to state 174 ELLIPSE shift, and go to state 175 SHAPE shift, and go to state 21 OPENSHAPE shift, and go to state 22 ARC shift, and go to state 23 RECTANGLE shift, and go to state 176 NEWLINE shift, and go to state 228 type_name go to state 121 graph_spec go to state 229 state 181 expr -> LBRACK graph_spec_list RBRACK . (rule 54) $default reduce using rule 54 (expr) state 182 expr -> LCURLY expr COMMA . expr RCURLY (rule 59) INF shift, and go to state 3 PI shift, and go to state 4 I shift, and go to state 5 XI shift, and go to state 98 FI shift, and go to state 99 I_1 shift, and go to state 8 XI_1 shift, and go to state 9 FI_1 shift, and go to state 10 LABEL shift, and go to state 100 CIRCLE shift, and go to state 101 ELLIPSE shift, and go to state 102 RECTANGLE shift, and go to state 103 IF shift, and go to state 29 ID shift, and go to state 30 IMGFUNC shift, and go to state 31 CSTRING shift, and go to state 32 BOOL shift, and go to state 33 INUMBER shift, and go to state 34 RNUMBER shift, and go to state 35 ITOS shift, and go to state 36 RTOS shift, and go to state 37 TRUNC shift, and go to state 38 FLOAT shift, and go to state 39 SQRT shift, and go to state 40 SIN shift, and go to state 41 COS shift, and go to state 42 TAN shift, and go to state 43 ASIN shift, and go to state 44 ACOS shift, and go to state 45 ATAN shift, and go to state 46 LOG shift, and go to state 47 EXP shift, and go to state 48 RANDOM shift, and go to state 49 ROT shift, and go to state 50 SCALE shift, and go to state 51 TRANS shift, and go to state 52 REFLECT shift, and go to state 53 INTERSECT shift, and go to state 54 PARALLEL shift, and go to state 55 PERPEND shift, and go to state 56 DISTANCE shift, and go to state 57 MIDPOINT shift, and go to state 58 PT_BETWN_PTS shift, and go to state 59 COLINEAR shift, and go to state 60 INTERSECTS shift, and go to state 61 SEPARATES shift, and go to state 62 INCLUDES shift, and go to state 63 INCIDENT shift, and go to state 64 DISTLARGER shift, and go to state 65 DISTSMALLER shift, and go to state 66 NOT shift, and go to state 67 MINUS shift, and go to state 68 TILDE_SLASH shift, and go to state 69 SLASH shift, and go to state 70 LPAREN shift, and go to state 72 LBRACK shift, and go to state 73 LCURLY shift, and go to state 74 expr go to state 230 func1 go to state 85 func2 go to state 86 func3 go to state 87 identifier go to state 88 local_identifier go to state 89 local_id go to state 90 id go to state 91 state 183 expr -> LCURLY expr ATSIGN . expr RCURLY (rule 60) INF shift, and go to state 3 PI shift, and go to state 4 I shift, and go to state 5 XI shift, and go to state 98 FI shift, and go to state 99 I_1 shift, and go to state 8 XI_1 shift, and go to state 9 FI_1 shift, and go to state 10 LABEL shift, and go to state 100 CIRCLE shift, and go to state 101 ELLIPSE shift, and go to state 102 RECTANGLE shift, and go to state 103 IF shift, and go to state 29 ID shift, and go to state 30 IMGFUNC shift, and go to state 31 CSTRING shift, and go to state 32 BOOL shift, and go to state 33 INUMBER shift, and go to state 34 RNUMBER shift, and go to state 35 ITOS shift, and go to state 36 RTOS shift, and go to state 37 TRUNC shift, and go to state 38 FLOAT shift, and go to state 39 SQRT shift, and go to state 40 SIN shift, and go to state 41 COS shift, and go to state 42 TAN shift, and go to state 43 ASIN shift, and go to state 44 ACOS shift, and go to state 45 ATAN shift, and go to state 46 LOG shift, and go to state 47 EXP shift, and go to state 48 RANDOM shift, and go to state 49 ROT shift, and go to state 50 SCALE shift, and go to state 51 TRANS shift, and go to state 52 REFLECT shift, and go to state 53 INTERSECT shift, and go to state 54 PARALLEL shift, and go to state 55 PERPEND shift, and go to state 56 DISTANCE shift, and go to state 57 MIDPOINT shift, and go to state 58 PT_BETWN_PTS shift, and go to state 59 COLINEAR shift, and go to state 60 INTERSECTS shift, and go to state 61 SEPARATES shift, and go to state 62 INCLUDES shift, and go to state 63 INCIDENT shift, and go to state 64 DISTLARGER shift, and go to state 65 DISTSMALLER shift, and go to state 66 NOT shift, and go to state 67 MINUS shift, and go to state 68 TILDE_SLASH shift, and go to state 69 SLASH shift, and go to state 70 LPAREN shift, and go to state 72 LBRACK shift, and go to state 73 LCURLY shift, and go to state 74 expr go to state 231 func1 go to state 85 func2 go to state 86 func3 go to state 87 identifier go to state 88 local_identifier go to state 89 local_id go to state 90 id go to state 91 state 184 evaluation -> QUERY NEWLINE . (rule 38) $default reduce using rule 38 (evaluation) state 185 evaluation -> evaluation QUERY . NEWLINE (rule 39) NEWLINE shift, and go to state 232 state 186 within_clause -> within_id NEWLINE LCURLY . stmt_list RCURLY (rule 15) INF shift, and go to state 3 PI shift, and go to state 4 I shift, and go to state 5 XI shift, and go to state 6 FI shift, and go to state 7 I_1 shift, and go to state 8 XI_1 shift, and go to state 9 FI_1 shift, and go to state 10 IMAGE shift, and go to state 11 MYCHAR shift, and go to state 12 REAL shift, and go to state 13 INT shift, and go to state 14 BOOLEAN shift, and go to state 15 POINT shift, and go to state 16 LABEL shift, and go to state 17 LINE shift, and go to state 18 CIRCLE shift, and go to state 19 ELLIPSE shift, and go to state 20 SHAPE shift, and go to state 21 OPENSHAPE shift, and go to state 22 ARC shift, and go to state 23 RECTANGLE shift, and go to state 24 GRAPH shift, and go to state 25 VIEWPORT shift, and go to state 26 DELETE shift, and go to state 27 WITHIN shift, and go to state 28 IF shift, and go to state 29 ID shift, and go to state 30 IMGFUNC shift, and go to state 31 CSTRING shift, and go to state 32 BOOL shift, and go to state 33 INUMBER shift, and go to state 34 RNUMBER shift, and go to state 35 ITOS shift, and go to state 36 RTOS shift, and go to state 37 TRUNC shift, and go to state 38 FLOAT shift, and go to state 39 SQRT shift, and go to state 40 SIN shift, and go to state 41 COS shift, and go to state 42 TAN shift, and go to state 43 ASIN shift, and go to state 44 ACOS shift, and go to state 45 ATAN shift, and go to state 46 LOG shift, and go to state 47 EXP shift, and go to state 48 RANDOM shift, and go to state 49 ROT shift, and go to state 50 SCALE shift, and go to state 51 TRANS shift, and go to state 52 REFLECT shift, and go to state 53 INTERSECT shift, and go to state 54 PARALLEL shift, and go to state 55 PERPEND shift, and go to state 56 DISTANCE shift, and go to state 57 MIDPOINT shift, and go to state 58 PT_BETWN_PTS shift, and go to state 59 COLINEAR shift, and go to state 60 INTERSECTS shift, and go to state 61 SEPARATES shift, and go to state 62 INCLUDES shift, and go to state 63 INCIDENT shift, and go to state 64 DISTLARGER shift, and go to state 65 DISTSMALLER shift, and go to state 66 NOT shift, and go to state 67 MINUS shift, and go to state 68 TILDE_SLASH shift, and go to state 69 SLASH shift, and go to state 70 NEWLINE shift, and go to state 71 LPAREN shift, and go to state 72 LBRACK shift, and go to state 73 LCURLY shift, and go to state 74 $default reduce using rule 7 (@1) stmt go to state 187 @1 go to state 76 delete go to state 77 within_id go to state 78 within_clause go to state 79 stmt_list go to state 233 declaration go to state 80 type_name go to state 81 definition go to state 82 expr_list go to state 83 expr go to state 84 func1 go to state 85 func2 go to state 86 func3 go to state 87 identifier go to state 88 local_identifier go to state 89 local_id go to state 90 id go to state 91 state 187 stmt_list -> stmt . (rule 17) $default reduce using rule 17 (stmt_list) state 188 within_clause -> within_id LCURLY stmt_list . RCURLY (rule 16) stmt_list -> stmt_list . stmt (rule 18) INF shift, and go to state 3 PI shift, and go to state 4 I shift, and go to state 5 XI shift, and go to state 6 FI shift, and go to state 7 I_1 shift, and go to state 8 XI_1 shift, and go to state 9 FI_1 shift, and go to state 10 IMAGE shift, and go to state 11 MYCHAR shift, and go to state 12 REAL shift, and go to state 13 INT shift, and go to state 14 BOOLEAN shift, and go to state 15 POINT shift, and go to state 16 LABEL shift, and go to state 17 LINE shift, and go to state 18 CIRCLE shift, and go to state 19 ELLIPSE shift, and go to state 20 SHAPE shift, and go to state 21 OPENSHAPE shift, and go to state 22 ARC shift, and go to state 23 RECTANGLE shift, and go to state 24 GRAPH shift, and go to state 25 VIEWPORT shift, and go to state 26 DELETE shift, and go to state 27 WITHIN shift, and go to state 28 IF shift, and go to state 29 ID shift, and go to state 30 IMGFUNC shift, and go to state 31 CSTRING shift, and go to state 32 BOOL shift, and go to state 33 INUMBER shift, and go to state 34 RNUMBER shift, and go to state 35 ITOS shift, and go to state 36 RTOS shift, and go to state 37 TRUNC shift, and go to state 38 FLOAT shift, and go to state 39 SQRT shift, and go to state 40 SIN shift, and go to state 41 COS shift, and go to state 42 TAN shift, and go to state 43 ASIN shift, and go to state 44 ACOS shift, and go to state 45 ATAN shift, and go to state 46 LOG shift, and go to state 47 EXP shift, and go to state 48 RANDOM shift, and go to state 49 ROT shift, and go to state 50 SCALE shift, and go to state 51 TRANS shift, and go to state 52 REFLECT shift, and go to state 53 INTERSECT shift, and go to state 54 PARALLEL shift, and go to state 55 PERPEND shift, and go to state 56 DISTANCE shift, and go to state 57 MIDPOINT shift, and go to state 58 PT_BETWN_PTS shift, and go to state 59 COLINEAR shift, and go to state 60 INTERSECTS shift, and go to state 61 SEPARATES shift, and go to state 62 INCLUDES shift, and go to state 63 INCIDENT shift, and go to state 64 DISTLARGER shift, and go to state 65 DISTSMALLER shift, and go to state 66 NOT shift, and go to state 67 MINUS shift, and go to state 68 TILDE_SLASH shift, and go to state 69 SLASH shift, and go to state 70 NEWLINE shift, and go to state 71 LPAREN shift, and go to state 72 LBRACK shift, and go to state 73 LCURLY shift, and go to state 74 RCURLY shift, and go to state 234 $default reduce using rule 7 (@1) stmt go to state 235 @1 go to state 76 delete go to state 77 within_id go to state 78 within_clause go to state 79 declaration go to state 80 type_name go to state 81 definition go to state 82 expr_list go to state 83 expr go to state 84 func1 go to state 85 func2 go to state 86 func3 go to state 87 identifier go to state 88 local_identifier go to state 89 local_id go to state 90 id go to state 91 state 189 expr_list -> expr . (rule 40) expr -> LCURLY expr . COMMA expr RCURLY (rule 59) expr -> LCURLY expr . ATSIGN expr RCURLY (rule 60) expr -> expr . PLUS expr (rule 67) expr -> expr . MINUS expr (rule 68) expr -> expr . STAR expr (rule 69) expr -> expr . MOD expr (rule 70) expr -> expr . DIV expr (rule 71) expr -> expr . AND expr (rule 74) expr -> expr . OR expr (rule 75) expr -> expr . EQ_EQ expr (rule 76) expr -> expr . NOT_EQ expr (rule 77) expr -> expr . LT expr (rule 78) expr -> expr . LT_EQ expr (rule 79) expr -> expr . GT expr (rule 80) expr -> expr . GT_EQ expr (rule 81) expr -> expr . SLASH_SLASH expr (rule 82) expr -> expr . DOTX (rule 85) expr -> expr . DOTY (rule 86) expr -> expr . DOT1 (rule 87) expr -> expr . DOT2 (rule 88) expr -> expr . DOTRAD (rule 89) expr -> expr . DOTARG (rule 90) COMMA shift, and go to state 182 OR shift, and go to state 134 AND shift, and go to state 135 EQ_EQ shift, and go to state 136 NOT_EQ shift, and go to state 137 GT shift, and go to state 138 GT_EQ shift, and go to state 139 LT shift, and go to state 140 LT_EQ shift, and go to state 141 SLASH_SLASH shift, and go to state 142 ATSIGN shift, and go to state 183 PLUS shift, and go to state 143 MINUS shift, and go to state 144 STAR shift, and go to state 145 DIV shift, and go to state 146 MOD shift, and go to state 147 DOTX shift, and go to state 148 DOTY shift, and go to state 149 DOTARG shift, and go to state 150 DOTRAD shift, and go to state 151 DOT1 shift, and go to state 152 DOT2 shift, and go to state 153 COMMA [reduce using rule 40 (expr_list)] $default reduce using rule 40 (expr_list) state 190 declaration -> type_name expr_list NEWLINE . (rule 19) $default reduce using rule 19 (declaration) state 191 definition -> expr_list EQUALS expr_list . NEWLINE (rule 35) expr_list -> expr_list . COMMA expr (rule 41) COMMA shift, and go to state 133 NEWLINE shift, and go to state 236 state 192 expr_list -> expr_list COMMA expr . (rule 41) expr -> expr . PLUS expr (rule 67) expr -> expr . MINUS expr (rule 68) expr -> expr . STAR expr (rule 69) expr -> expr . MOD expr (rule 70) expr -> expr . DIV expr (rule 71) expr -> expr . AND expr (rule 74) expr -> expr . OR expr (rule 75) expr -> expr . EQ_EQ expr (rule 76) expr -> expr . NOT_EQ expr (rule 77) expr -> expr . LT expr (rule 78) expr -> expr . LT_EQ expr (rule 79) expr -> expr . GT expr (rule 80) expr -> expr . GT_EQ expr (rule 81) expr -> expr . SLASH_SLASH expr (rule 82) expr -> expr . DOTX (rule 85) expr -> expr . DOTY (rule 86) expr -> expr . DOT1 (rule 87) expr -> expr . DOT2 (rule 88) expr -> expr . DOTRAD (rule 89) expr -> expr . DOTARG (rule 90) OR shift, and go to state 134 AND shift, and go to state 135 EQ_EQ shift, and go to state 136 NOT_EQ shift, and go to state 137 GT shift, and go to state 138 GT_EQ shift, and go to state 139 LT shift, and go to state 140 LT_EQ shift, and go to state 141 SLASH_SLASH shift, and go to state 142 PLUS shift, and go to state 143 MINUS shift, and go to state 144 STAR shift, and go to state 145 DIV shift, and go to state 146 MOD shift, and go to state 147 DOTX shift, and go to state 148 DOTY shift, and go to state 149 DOTARG shift, and go to state 150 DOTRAD shift, and go to state 151 DOT1 shift, and go to state 152 DOT2 shift, and go to state 153 $default reduce using rule 41 (expr_list) state 193 expr -> expr . PLUS expr (rule 67) expr -> expr . MINUS expr (rule 68) expr -> expr . STAR expr (rule 69) expr -> expr . MOD expr (rule 70) expr -> expr . DIV expr (rule 71) expr -> expr . AND expr (rule 74) expr -> expr . OR expr (rule 75) expr -> expr OR expr . (rule 75) expr -> expr . EQ_EQ expr (rule 76) expr -> expr . NOT_EQ expr (rule 77) expr -> expr . LT expr (rule 78) expr -> expr . LT_EQ expr (rule 79) expr -> expr . GT expr (rule 80) expr -> expr . GT_EQ expr (rule 81) expr -> expr . SLASH_SLASH expr (rule 82) expr -> expr . DOTX (rule 85) expr -> expr . DOTY (rule 86) expr -> expr . DOT1 (rule 87) expr -> expr . DOT2 (rule 88) expr -> expr . DOTRAD (rule 89) expr -> expr . DOTARG (rule 90) AND shift, and go to state 135 EQ_EQ shift, and go to state 136 NOT_EQ shift, and go to state 137 GT shift, and go to state 138 GT_EQ shift, and go to state 139 LT shift, and go to state 140 LT_EQ shift, and go to state 141 SLASH_SLASH shift, and go to state 142 PLUS shift, and go to state 143 MINUS shift, and go to state 144 STAR shift, and go to state 145 DIV shift, and go to state 146 MOD shift, and go to state 147 DOTX shift, and go to state 148 DOTY shift, and go to state 149 DOTARG shift, and go to state 150 DOTRAD shift, and go to state 151 DOT1 shift, and go to state 152 DOT2 shift, and go to state 153 $default reduce using rule 75 (expr) state 194 expr -> expr . PLUS expr (rule 67) expr -> expr . MINUS expr (rule 68) expr -> expr . STAR expr (rule 69) expr -> expr . MOD expr (rule 70) expr -> expr . DIV expr (rule 71) expr -> expr . AND expr (rule 74) expr -> expr AND expr . (rule 74) expr -> expr . OR expr (rule 75) expr -> expr . EQ_EQ expr (rule 76) expr -> expr . NOT_EQ expr (rule 77) expr -> expr . LT expr (rule 78) expr -> expr . LT_EQ expr (rule 79) expr -> expr . GT expr (rule 80) expr -> expr . GT_EQ expr (rule 81) expr -> expr . SLASH_SLASH expr (rule 82) expr -> expr . DOTX (rule 85) expr -> expr . DOTY (rule 86) expr -> expr . DOT1 (rule 87) expr -> expr . DOT2 (rule 88) expr -> expr . DOTRAD (rule 89) expr -> expr . DOTARG (rule 90) EQ_EQ shift, and go to state 136 NOT_EQ shift, and go to state 137 GT shift, and go to state 138 GT_EQ shift, and go to state 139 LT shift, and go to state 140 LT_EQ shift, and go to state 141 SLASH_SLASH shift, and go to state 142 PLUS shift, and go to state 143 MINUS shift, and go to state 144 STAR shift, and go to state 145 DIV shift, and go to state 146 MOD shift, and go to state 147 DOTX shift, and go to state 148 DOTY shift, and go to state 149 DOTARG shift, and go to state 150 DOTRAD shift, and go to state 151 DOT1 shift, and go to state 152 DOT2 shift, and go to state 153 $default reduce using rule 74 (expr) state 195 expr -> expr . PLUS expr (rule 67) expr -> expr . MINUS expr (rule 68) expr -> expr . STAR expr (rule 69) expr -> expr . MOD expr (rule 70) expr -> expr . DIV expr (rule 71) expr -> expr . AND expr (rule 74) expr -> expr . OR expr (rule 75) expr -> expr . EQ_EQ expr (rule 76) expr -> expr EQ_EQ expr . (rule 76) expr -> expr . NOT_EQ expr (rule 77) expr -> expr . LT expr (rule 78) expr -> expr . LT_EQ expr (rule 79) expr -> expr . GT expr (rule 80) expr -> expr . GT_EQ expr (rule 81) expr -> expr . SLASH_SLASH expr (rule 82) expr -> expr . DOTX (rule 85) expr -> expr . DOTY (rule 86) expr -> expr . DOT1 (rule 87) expr -> expr . DOT2 (rule 88) expr -> expr . DOTRAD (rule 89) expr -> expr . DOTARG (rule 90) GT shift, and go to state 138 GT_EQ shift, and go to state 139 LT shift, and go to state 140 LT_EQ shift, and go to state 141 SLASH_SLASH shift, and go to state 142 PLUS shift, and go to state 143 MINUS shift, and go to state 144 STAR shift, and go to state 145 DIV shift, and go to state 146 MOD shift, and go to state 147 DOTX shift, and go to state 148 DOTY shift, and go to state 149 DOTARG shift, and go to state 150 DOTRAD shift, and go to state 151 DOT1 shift, and go to state 152 DOT2 shift, and go to state 153 $default reduce using rule 76 (expr) state 196 expr -> expr . PLUS expr (rule 67) expr -> expr . MINUS expr (rule 68) expr -> expr . STAR expr (rule 69) expr -> expr . MOD expr (rule 70) expr -> expr . DIV expr (rule 71) expr -> expr . AND expr (rule 74) expr -> expr . OR expr (rule 75) expr -> expr . EQ_EQ expr (rule 76) expr -> expr . NOT_EQ expr (rule 77) expr -> expr NOT_EQ expr . (rule 77) expr -> expr . LT expr (rule 78) expr -> expr . LT_EQ expr (rule 79) expr -> expr . GT expr (rule 80) expr -> expr . GT_EQ expr (rule 81) expr -> expr . SLASH_SLASH expr (rule 82) expr -> expr . DOTX (rule 85) expr -> expr . DOTY (rule 86) expr -> expr . DOT1 (rule 87) expr -> expr . DOT2 (rule 88) expr -> expr . DOTRAD (rule 89) expr -> expr . DOTARG (rule 90) GT shift, and go to state 138 GT_EQ shift, and go to state 139 LT shift, and go to state 140 LT_EQ shift, and go to state 141 SLASH_SLASH shift, and go to state 142 PLUS shift, and go to state 143 MINUS shift, and go to state 144 STAR shift, and go to state 145 DIV shift, and go to state 146 MOD shift, and go to state 147 DOTX shift, and go to state 148 DOTY shift, and go to state 149 DOTARG shift, and go to state 150 DOTRAD shift, and go to state 151 DOT1 shift, and go to state 152 DOT2 shift, and go to state 153 $default reduce using rule 77 (expr) state 197 expr -> expr . PLUS expr (rule 67) expr -> expr . MINUS expr (rule 68) expr -> expr . STAR expr (rule 69) expr -> expr . MOD expr (rule 70) expr -> expr . DIV expr (rule 71) expr -> expr . AND expr (rule 74) expr -> expr . OR expr (rule 75) expr -> expr . EQ_EQ expr (rule 76) expr -> expr . NOT_EQ expr (rule 77) expr -> expr . LT expr (rule 78) expr -> expr . LT_EQ expr (rule 79) expr -> expr . GT expr (rule 80) expr -> expr GT expr . (rule 80) expr -> expr . GT_EQ expr (rule 81) expr -> expr . SLASH_SLASH expr (rule 82) expr -> expr . DOTX (rule 85) expr -> expr . DOTY (rule 86) expr -> expr . DOT1 (rule 87) expr -> expr . DOT2 (rule 88) expr -> expr . DOTRAD (rule 89) expr -> expr . DOTARG (rule 90) SLASH_SLASH shift, and go to state 142 PLUS shift, and go to state 143 MINUS shift, and go to state 144 STAR shift, and go to state 145 DIV shift, and go to state 146 MOD shift, and go to state 147 DOTX shift, and go to state 148 DOTY shift, and go to state 149 DOTARG shift, and go to state 150 DOTRAD shift, and go to state 151 DOT1 shift, and go to state 152 DOT2 shift, and go to state 153 $default reduce using rule 80 (expr) state 198 expr -> expr . PLUS expr (rule 67) expr -> expr . MINUS expr (rule 68) expr -> expr . STAR expr (rule 69) expr -> expr . MOD expr (rule 70) expr -> expr . DIV expr (rule 71) expr -> expr . AND expr (rule 74) expr -> expr . OR expr (rule 75) expr -> expr . EQ_EQ expr (rule 76) expr -> expr . NOT_EQ expr (rule 77) expr -> expr . LT expr (rule 78) expr -> expr . LT_EQ expr (rule 79) expr -> expr . GT expr (rule 80) expr -> expr . GT_EQ expr (rule 81) expr -> expr GT_EQ expr . (rule 81) expr -> expr . SLASH_SLASH expr (rule 82) expr -> expr . DOTX (rule 85) expr -> expr . DOTY (rule 86) expr -> expr . DOT1 (rule 87) expr -> expr . DOT2 (rule 88) expr -> expr . DOTRAD (rule 89) expr -> expr . DOTARG (rule 90) SLASH_SLASH shift, and go to state 142 PLUS shift, and go to state 143 MINUS shift, and go to state 144 STAR shift, and go to state 145 DIV shift, and go to state 146 MOD shift, and go to state 147 DOTX shift, and go to state 148 DOTY shift, and go to state 149 DOTARG shift, and go to state 150 DOTRAD shift, and go to state 151 DOT1 shift, and go to state 152 DOT2 shift, and go to state 153 $default reduce using rule 81 (expr) state 199 expr -> expr . PLUS expr (rule 67) expr -> expr . MINUS expr (rule 68) expr -> expr . STAR expr (rule 69) expr -> expr . MOD expr (rule 70) expr -> expr . DIV expr (rule 71) expr -> expr . AND expr (rule 74) expr -> expr . OR expr (rule 75) expr -> expr . EQ_EQ expr (rule 76) expr -> expr . NOT_EQ expr (rule 77) expr -> expr . LT expr (rule 78) expr -> expr LT expr . (rule 78) expr -> expr . LT_EQ expr (rule 79) expr -> expr . GT expr (rule 80) expr -> expr . GT_EQ expr (rule 81) expr -> expr . SLASH_SLASH expr (rule 82) expr -> expr . DOTX (rule 85) expr -> expr . DOTY (rule 86) expr -> expr . DOT1 (rule 87) expr -> expr . DOT2 (rule 88) expr -> expr . DOTRAD (rule 89) expr -> expr . DOTARG (rule 90) SLASH_SLASH shift, and go to state 142 PLUS shift, and go to state 143 MINUS shift, and go to state 144 STAR shift, and go to state 145 DIV shift, and go to state 146 MOD shift, and go to state 147 DOTX shift, and go to state 148 DOTY shift, and go to state 149 DOTARG shift, and go to state 150 DOTRAD shift, and go to state 151 DOT1 shift, and go to state 152 DOT2 shift, and go to state 153 $default reduce using rule 78 (expr) state 200 expr -> expr . PLUS expr (rule 67) expr -> expr . MINUS expr (rule 68) expr -> expr . STAR expr (rule 69) expr -> expr . MOD expr (rule 70) expr -> expr . DIV expr (rule 71) expr -> expr . AND expr (rule 74) expr -> expr . OR expr (rule 75) expr -> expr . EQ_EQ expr (rule 76) expr -> expr . NOT_EQ expr (rule 77) expr -> expr . LT expr (rule 78) expr -> expr . LT_EQ expr (rule 79) expr -> expr LT_EQ expr . (rule 79) expr -> expr . GT expr (rule 80) expr -> expr . GT_EQ expr (rule 81) expr -> expr . SLASH_SLASH expr (rule 82) expr -> expr . DOTX (rule 85) expr -> expr . DOTY (rule 86) expr -> expr . DOT1 (rule 87) expr -> expr . DOT2 (rule 88) expr -> expr . DOTRAD (rule 89) expr -> expr . DOTARG (rule 90) SLASH_SLASH shift, and go to state 142 PLUS shift, and go to state 143 MINUS shift, and go to state 144 STAR shift, and go to state 145 DIV shift, and go to state 146 MOD shift, and go to state 147 DOTX shift, and go to state 148 DOTY shift, and go to state 149 DOTARG shift, and go to state 150 DOTRAD shift, and go to state 151 DOT1 shift, and go to state 152 DOT2 shift, and go to state 153 $default reduce using rule 79 (expr) state 201 expr -> expr . PLUS expr (rule 67) expr -> expr . MINUS expr (rule 68) expr -> expr . STAR expr (rule 69) expr -> expr . MOD expr (rule 70) expr -> expr . DIV expr (rule 71) expr -> expr . AND expr (rule 74) expr -> expr . OR expr (rule 75) expr -> expr . EQ_EQ expr (rule 76) expr -> expr . NOT_EQ expr (rule 77) expr -> expr . LT expr (rule 78) expr -> expr . LT_EQ expr (rule 79) expr -> expr . GT expr (rule 80) expr -> expr . GT_EQ expr (rule 81) expr -> expr . SLASH_SLASH expr (rule 82) expr -> expr SLASH_SLASH expr . (rule 82) expr -> expr . DOTX (rule 85) expr -> expr . DOTY (rule 86) expr -> expr . DOT1 (rule 87) expr -> expr . DOT2 (rule 88) expr -> expr . DOTRAD (rule 89) expr -> expr . DOTARG (rule 90) PLUS shift, and go to state 143 MINUS shift, and go to state 144 STAR shift, and go to state 145 DIV shift, and go to state 146 MOD shift, and go to state 147 DOTX shift, and go to state 148 DOTY shift, and go to state 149 DOTARG shift, and go to state 150 DOTRAD shift, and go to state 151 DOT1 shift, and go to state 152 DOT2 shift, and go to state 153 $default reduce using rule 82 (expr) state 202 expr -> expr . PLUS expr (rule 67) expr -> expr PLUS expr . (rule 67) expr -> expr . MINUS expr (rule 68) expr -> expr . STAR expr (rule 69) expr -> expr . MOD expr (rule 70) expr -> expr . DIV expr (rule 71) expr -> expr . AND expr (rule 74) expr -> expr . OR expr (rule 75) expr -> expr . EQ_EQ expr (rule 76) expr -> expr . NOT_EQ expr (rule 77) expr -> expr . LT expr (rule 78) expr -> expr . LT_EQ expr (rule 79) expr -> expr . GT expr (rule 80) expr -> expr . GT_EQ expr (rule 81) expr -> expr . SLASH_SLASH expr (rule 82) expr -> expr . DOTX (rule 85) expr -> expr . DOTY (rule 86) expr -> expr . DOT1 (rule 87) expr -> expr . DOT2 (rule 88) expr -> expr . DOTRAD (rule 89) expr -> expr . DOTARG (rule 90) STAR shift, and go to state 145 DIV shift, and go to state 146 MOD shift, and go to state 147 DOTX shift, and go to state 148 DOTY shift, and go to state 149 DOTARG shift, and go to state 150 DOTRAD shift, and go to state 151 DOT1 shift, and go to state 152 DOT2 shift, and go to state 153 $default reduce using rule 67 (expr) state 203 expr -> expr . PLUS expr (rule 67) expr -> expr . MINUS expr (rule 68) expr -> expr MINUS expr . (rule 68) expr -> expr . STAR expr (rule 69) expr -> expr . MOD expr (rule 70) expr -> expr . DIV expr (rule 71) expr -> expr . AND expr (rule 74) expr -> expr . OR expr (rule 75) expr -> expr . EQ_EQ expr (rule 76) expr -> expr . NOT_EQ expr (rule 77) expr -> expr . LT expr (rule 78) expr -> expr . LT_EQ expr (rule 79) expr -> expr . GT expr (rule 80) expr -> expr . GT_EQ expr (rule 81) expr -> expr . SLASH_SLASH expr (rule 82) expr -> expr . DOTX (rule 85) expr -> expr . DOTY (rule 86) expr -> expr . DOT1 (rule 87) expr -> expr . DOT2 (rule 88) expr -> expr . DOTRAD (rule 89) expr -> expr . DOTARG (rule 90) STAR shift, and go to state 145 DIV shift, and go to state 146 MOD shift, and go to state 147 DOTX shift, and go to state 148 DOTY shift, and go to state 149 DOTARG shift, and go to state 150 DOTRAD shift, and go to state 151 DOT1 shift, and go to state 152 DOT2 shift, and go to state 153 $default reduce using rule 68 (expr) state 204 expr -> expr . PLUS expr (rule 67) expr -> expr . MINUS expr (rule 68) expr -> expr . STAR expr (rule 69) expr -> expr STAR expr . (rule 69) expr -> expr . MOD expr (rule 70) expr -> expr . DIV expr (rule 71) expr -> expr . AND expr (rule 74) expr -> expr . OR expr (rule 75) expr -> expr . EQ_EQ expr (rule 76) expr -> expr . NOT_EQ expr (rule 77) expr -> expr . LT expr (rule 78) expr -> expr . LT_EQ expr (rule 79) expr -> expr . GT expr (rule 80) expr -> expr . GT_EQ expr (rule 81) expr -> expr . SLASH_SLASH expr (rule 82) expr -> expr . DOTX (rule 85) expr -> expr . DOTY (rule 86) expr -> expr . DOT1 (rule 87) expr -> expr . DOT2 (rule 88) expr -> expr . DOTRAD (rule 89) expr -> expr . DOTARG (rule 90) DOTX shift, and go to state 148 DOTY shift, and go to state 149 DOTARG shift, and go to state 150 DOTRAD shift, and go to state 151 DOT1 shift, and go to state 152 DOT2 shift, and go to state 153 $default reduce using rule 69 (expr) state 205 expr -> expr . PLUS expr (rule 67) expr -> expr . MINUS expr (rule 68) expr -> expr . STAR expr (rule 69) expr -> expr . MOD expr (rule 70) expr -> expr . DIV expr (rule 71) expr -> expr DIV expr . (rule 71) expr -> expr . AND expr (rule 74) expr -> expr . OR expr (rule 75) expr -> expr . EQ_EQ expr (rule 76) expr -> expr . NOT_EQ expr (rule 77) expr -> expr . LT expr (rule 78) expr -> expr . LT_EQ expr (rule 79) expr -> expr . GT expr (rule 80) expr -> expr . GT_EQ expr (rule 81) expr -> expr . SLASH_SLASH expr (rule 82) expr -> expr . DOTX (rule 85) expr -> expr . DOTY (rule 86) expr -> expr . DOT1 (rule 87) expr -> expr . DOT2 (rule 88) expr -> expr . DOTRAD (rule 89) expr -> expr . DOTARG (rule 90) DOTX shift, and go to state 148 DOTY shift, and go to state 149 DOTARG shift, and go to state 150 DOTRAD shift, and go to state 151 DOT1 shift, and go to state 152 DOT2 shift, and go to state 153 $default reduce using rule 71 (expr) state 206 expr -> expr . PLUS expr (rule 67) expr -> expr . MINUS expr (rule 68) expr -> expr . STAR expr (rule 69) expr -> expr . MOD expr (rule 70) expr -> expr MOD expr . (rule 70) expr -> expr . DIV expr (rule 71) expr -> expr . AND expr (rule 74) expr -> expr . OR expr (rule 75) expr -> expr . EQ_EQ expr (rule 76) expr -> expr . NOT_EQ expr (rule 77) expr -> expr . LT expr (rule 78) expr -> expr . LT_EQ expr (rule 79) expr -> expr . GT expr (rule 80) expr -> expr . GT_EQ expr (rule 81) expr -> expr . SLASH_SLASH expr (rule 82) expr -> expr . DOTX (rule 85) expr -> expr . DOTY (rule 86) expr -> expr . DOT1 (rule 87) expr -> expr . DOT2 (rule 88) expr -> expr . DOTRAD (rule 89) expr -> expr . DOTARG (rule 90) DOTX shift, and go to state 148 DOTY shift, and go to state 149 DOTARG shift, and go to state 150 DOTRAD shift, and go to state 151 DOT1 shift, and go to state 152 DOT2 shift, and go to state 153 $default reduce using rule 70 (expr) state 207 expr -> expr . PLUS expr (rule 67) expr -> expr . MINUS expr (rule 68) expr -> expr . STAR expr (rule 69) expr -> expr . MOD expr (rule 70) expr -> expr . DIV expr (rule 71) expr -> expr . AND expr (rule 74) expr -> expr . OR expr (rule 75) expr -> expr . EQ_EQ expr (rule 76) expr -> expr . NOT_EQ expr (rule 77) expr -> expr . LT expr (rule 78) expr -> expr . LT_EQ expr (rule 79) expr -> expr . GT expr (rule 80) expr -> expr . GT_EQ expr (rule 81) expr -> expr . SLASH_SLASH expr (rule 82) expr -> expr . DOTX (rule 85) expr -> expr . DOTY (rule 86) expr -> expr . DOT1 (rule 87) expr -> expr . DOT2 (rule 88) expr -> expr . DOTRAD (rule 89) expr -> expr . DOTARG (rule 90) expr -> func1 LPAREN expr . RPAREN (rule 95) OR shift, and go to state 134 AND shift, and go to state 135 EQ_EQ shift, and go to state 136 NOT_EQ shift, and go to state 137 GT shift, and go to state 138 GT_EQ shift, and go to state 139 LT shift, and go to state 140 LT_EQ shift, and go to state 141 SLASH_SLASH shift, and go to state 142 PLUS shift, and go to state 143 MINUS shift, and go to state 144 STAR shift, and go to state 145 DIV shift, and go to state 146 MOD shift, and go to state 147 DOTX shift, and go to state 148 DOTY shift, and go to state 149 DOTARG shift, and go to state 150 DOTRAD shift, and go to state 151 DOT1 shift, and go to state 152 DOT2 shift, and go to state 153 RPAREN shift, and go to state 237 state 208 expr -> expr . PLUS expr (rule 67) expr -> expr . MINUS expr (rule 68) expr -> expr . STAR expr (rule 69) expr -> expr . MOD expr (rule 70) expr -> expr . DIV expr (rule 71) expr -> expr . AND expr (rule 74) expr -> expr . OR expr (rule 75) expr -> expr . EQ_EQ expr (rule 76) expr -> expr . NOT_EQ expr (rule 77) expr -> expr . LT expr (rule 78) expr -> expr . LT_EQ expr (rule 79) expr -> expr . GT expr (rule 80) expr -> expr . GT_EQ expr (rule 81) expr -> expr . SLASH_SLASH expr (rule 82) expr -> expr . DOTX (rule 85) expr -> expr . DOTY (rule 86) expr -> expr . DOT1 (rule 87) expr -> expr . DOT2 (rule 88) expr -> expr . DOTRAD (rule 89) expr -> expr . DOTARG (rule 90) expr -> func2 LPAREN expr . COMMA expr RPAREN (rule 96) COMMA shift, and go to state 238 OR shift, and go to state 134 AND shift, and go to state 135 EQ_EQ shift, and go to state 136 NOT_EQ shift, and go to state 137 GT shift, and go to state 138 GT_EQ shift, and go to state 139 LT shift, and go to state 140 LT_EQ shift, and go to state 141 SLASH_SLASH shift, and go to state 142 PLUS shift, and go to state 143 MINUS shift, and go to state 144 STAR shift, and go to state 145 DIV shift, and go to state 146 MOD shift, and go to state 147 DOTX shift, and go to state 148 DOTY shift, and go to state 149 DOTARG shift, and go to state 150 DOTRAD shift, and go to state 151 DOT1 shift, and go to state 152 DOT2 shift, and go to state 153 state 209 expr -> expr . PLUS expr (rule 67) expr -> expr . MINUS expr (rule 68) expr -> expr . STAR expr (rule 69) expr -> expr . MOD expr (rule 70) expr -> expr . DIV expr (rule 71) expr -> expr . AND expr (rule 74) expr -> expr . OR expr (rule 75) expr -> expr . EQ_EQ expr (rule 76) expr -> expr . NOT_EQ expr (rule 77) expr -> expr . LT expr (rule 78) expr -> expr . LT_EQ expr (rule 79) expr -> expr . GT expr (rule 80) expr -> expr . GT_EQ expr (rule 81) expr -> expr . SLASH_SLASH expr (rule 82) expr -> expr . DOTX (rule 85) expr -> expr . DOTY (rule 86) expr -> expr . DOT1 (rule 87) expr -> expr . DOT2 (rule 88) expr -> expr . DOTRAD (rule 89) expr -> expr . DOTARG (rule 90) expr -> func3 LPAREN expr . COMMA expr COMMA expr RPAREN (rule 97) COMMA shift, and go to state 239 OR shift, and go to state 134 AND shift, and go to state 135 EQ_EQ shift, and go to state 136 NOT_EQ shift, and go to state 137 GT shift, and go to state 138 GT_EQ shift, and go to state 139 LT shift, and go to state 140 LT_EQ shift, and go to state 141 SLASH_SLASH shift, and go to state 142 PLUS shift, and go to state 143 MINUS shift, and go to state 144 STAR shift, and go to state 145 DIV shift, and go to state 146 MOD shift, and go to state 147 DOTX shift, and go to state 148 DOTY shift, and go to state 149 DOTARG shift, and go to state 150 DOTRAD shift, and go to state 151 DOT1 shift, and go to state 152 DOT2 shift, and go to state 153 state 210 local_identifier -> local_id SLASH local_identifier . (rule 130) $default reduce using rule 130 (local_identifier) state 211 definition -> XI EQUALS expr NEWLINE . (rule 36) $default reduce using rule 36 (definition) state 212 definition -> FI EQUALS expr NEWLINE . (rule 37) $default reduce using rule 37 (definition) state 213 expr -> LABEL LPAREN expr COMMA . expr RPAREN (rule 66) INF shift, and go to state 3 PI shift, and go to state 4 I shift, and go to state 5 XI shift, and go to state 98 FI shift, and go to state 99 I_1 shift, and go to state 8 XI_1 shift, and go to state 9 FI_1 shift, and go to state 10 LABEL shift, and go to state 100 CIRCLE shift, and go to state 101 ELLIPSE shift, and go to state 102 RECTANGLE shift, and go to state 103 IF shift, and go to state 29 ID shift, and go to state 30 IMGFUNC shift, and go to state 31 CSTRING shift, and go to state 32 BOOL shift, and go to state 33 INUMBER shift, and go to state 34 RNUMBER shift, and go to state 35 ITOS shift, and go to state 36 RTOS shift, and go to state 37 TRUNC shift, and go to state 38 FLOAT shift, and go to state 39 SQRT shift, and go to state 40 SIN shift, and go to state 41 COS shift, and go to state 42 TAN shift, and go to state 43 ASIN shift, and go to state 44 ACOS shift, and go to state 45 ATAN shift, and go to state 46 LOG shift, and go to state 47 EXP shift, and go to state 48 RANDOM shift, and go to state 49 ROT shift, and go to state 50 SCALE shift, and go to state 51 TRANS shift, and go to state 52 REFLECT shift, and go to state 53 INTERSECT shift, and go to state 54 PARALLEL shift, and go to state 55 PERPEND shift, and go to state 56 DISTANCE shift, and go to state 57 MIDPOINT shift, and go to state 58 PT_BETWN_PTS shift, and go to state 59 COLINEAR shift, and go to state 60 INTERSECTS shift, and go to state 61 SEPARATES shift, and go to state 62 INCLUDES shift, and go to state 63 INCIDENT shift, and go to state 64 DISTLARGER shift, and go to state 65 DISTSMALLER shift, and go to state 66 NOT shift, and go to state 67 MINUS shift, and go to state 68 TILDE_SLASH shift, and go to state 69 SLASH shift, and go to state 70 LPAREN shift, and go to state 72 LBRACK shift, and go to state 73 LCURLY shift, and go to state 74 expr go to state 240 func1 go to state 85 func2 go to state 86 func3 go to state 87 identifier go to state 88 local_identifier go to state 89 local_id go to state 90 id go to state 91 state 214 expr -> CIRCLE LPAREN expr COMMA . expr RPAREN (rule 63) INF shift, and go to state 3 PI shift, and go to state 4 I shift, and go to state 5 XI shift, and go to state 98 FI shift, and go to state 99 I_1 shift, and go to state 8 XI_1 shift, and go to state 9 FI_1 shift, and go to state 10 LABEL shift, and go to state 100 CIRCLE shift, and go to state 101 ELLIPSE shift, and go to state 102 RECTANGLE shift, and go to state 103 IF shift, and go to state 29 ID shift, and go to state 30 IMGFUNC shift, and go to state 31 CSTRING shift, and go to state 32 BOOL shift, and go to state 33 INUMBER shift, and go to state 34 RNUMBER shift, and go to state 35 ITOS shift, and go to state 36 RTOS shift, and go to state 37 TRUNC shift, and go to state 38 FLOAT shift, and go to state 39 SQRT shift, and go to state 40 SIN shift, and go to state 41 COS shift, and go to state 42 TAN shift, and go to state 43 ASIN shift, and go to state 44 ACOS shift, and go to state 45 ATAN shift, and go to state 46 LOG shift, and go to state 47 EXP shift, and go to state 48 RANDOM shift, and go to state 49 ROT shift, and go to state 50 SCALE shift, and go to state 51 TRANS shift, and go to state 52 REFLECT shift, and go to state 53 INTERSECT shift, and go to state 54 PARALLEL shift, and go to state 55 PERPEND shift, and go to state 56 DISTANCE shift, and go to state 57 MIDPOINT shift, and go to state 58 PT_BETWN_PTS shift, and go to state 59 COLINEAR shift, and go to state 60 INTERSECTS shift, and go to state 61 SEPARATES shift, and go to state 62 INCLUDES shift, and go to state 63 INCIDENT shift, and go to state 64 DISTLARGER shift, and go to state 65 DISTSMALLER shift, and go to state 66 NOT shift, and go to state 67 MINUS shift, and go to state 68 TILDE_SLASH shift, and go to state 69 SLASH shift, and go to state 70 LPAREN shift, and go to state 72 LBRACK shift, and go to state 73 LCURLY shift, and go to state 74 expr go to state 241 func1 go to state 85 func2 go to state 86 func3 go to state 87 identifier go to state 88 local_identifier go to state 89 local_id go to state 90 id go to state 91 state 215 expr -> ELLIPSE LPAREN expr COMMA . expr COMMA expr RPAREN (rule 65) INF shift, and go to state 3 PI shift, and go to state 4 I shift, and go to state 5 XI shift, and go to state 98 FI shift, and go to state 99 I_1 shift, and go to state 8 XI_1 shift, and go to state 9 FI_1 shift, and go to state 10 LABEL shift, and go to state 100 CIRCLE shift, and go to state 101 ELLIPSE shift, and go to state 102 RECTANGLE shift, and go to state 103 IF shift, and go to state 29 ID shift, and go to state 30 IMGFUNC shift, and go to state 31 CSTRING shift, and go to state 32 BOOL shift, and go to state 33 INUMBER shift, and go to state 34 RNUMBER shift, and go to state 35 ITOS shift, and go to state 36 RTOS shift, and go to state 37 TRUNC shift, and go to state 38 FLOAT shift, and go to state 39 SQRT shift, and go to state 40 SIN shift, and go to state 41 COS shift, and go to state 42 TAN shift, and go to state 43 ASIN shift, and go to state 44 ACOS shift, and go to state 45 ATAN shift, and go to state 46 LOG shift, and go to state 47 EXP shift, and go to state 48 RANDOM shift, and go to state 49 ROT shift, and go to state 50 SCALE shift, and go to state 51 TRANS shift, and go to state 52 REFLECT shift, and go to state 53 INTERSECT shift, and go to state 54 PARALLEL shift, and go to state 55 PERPEND shift, and go to state 56 DISTANCE shift, and go to state 57 MIDPOINT shift, and go to state 58 PT_BETWN_PTS shift, and go to state 59 COLINEAR shift, and go to state 60 INTERSECTS shift, and go to state 61 SEPARATES shift, and go to state 62 INCLUDES shift, and go to state 63 INCIDENT shift, and go to state 64 DISTLARGER shift, and go to state 65 DISTSMALLER shift, and go to state 66 NOT shift, and go to state 67 MINUS shift, and go to state 68 TILDE_SLASH shift, and go to state 69 SLASH shift, and go to state 70 LPAREN shift, and go to state 72 LBRACK shift, and go to state 73 LCURLY shift, and go to state 74 expr go to state 242 func1 go to state 85 func2 go to state 86 func3 go to state 87 identifier go to state 88 local_identifier go to state 89 local_id go to state 90 id go to state 91 state 216 expr -> RECTANGLE LPAREN expr COMMA . expr RPAREN (rule 64) INF shift, and go to state 3 PI shift, and go to state 4 I shift, and go to state 5 XI shift, and go to state 98 FI shift, and go to state 99 I_1 shift, and go to state 8 XI_1 shift, and go to state 9 FI_1 shift, and go to state 10 LABEL shift, and go to state 100 CIRCLE shift, and go to state 101 ELLIPSE shift, and go to state 102 RECTANGLE shift, and go to state 103 IF shift, and go to state 29 ID shift, and go to state 30 IMGFUNC shift, and go to state 31 CSTRING shift, and go to state 32 BOOL shift, and go to state 33 INUMBER shift, and go to state 34 RNUMBER shift, and go to state 35 ITOS shift, and go to state 36 RTOS shift, and go to state 37 TRUNC shift, and go to state 38 FLOAT shift, and go to state 39 SQRT shift, and go to state 40 SIN shift, and go to state 41 COS shift, and go to state 42 TAN shift, and go to state 43 ASIN shift, and go to state 44 ACOS shift, and go to state 45 ATAN shift, and go to state 46 LOG shift, and go to state 47 EXP shift, and go to state 48 RANDOM shift, and go to state 49 ROT shift, and go to state 50 SCALE shift, and go to state 51 TRANS shift, and go to state 52 REFLECT shift, and go to state 53 INTERSECT shift, and go to state 54 PARALLEL shift, and go to state 55 PERPEND shift, and go to state 56 DISTANCE shift, and go to state 57 MIDPOINT shift, and go to state 58 PT_BETWN_PTS shift, and go to state 59 COLINEAR shift, and go to state 60 INTERSECTS shift, and go to state 61 SEPARATES shift, and go to state 62 INCLUDES shift, and go to state 63 INCIDENT shift, and go to state 64 DISTLARGER shift, and go to state 65 DISTSMALLER shift, and go to state 66 NOT shift, and go to state 67 MINUS shift, and go to state 68 TILDE_SLASH shift, and go to state 69 SLASH shift, and go to state 70 LPAREN shift, and go to state 72 LBRACK shift, and go to state 73 LCURLY shift, and go to state 74 expr go to state 243 func1 go to state 85 func2 go to state 86 func3 go to state 87 identifier go to state 88 local_identifier go to state 89 local_id go to state 90 id go to state 91 state 217 expr -> expr . PLUS expr (rule 67) expr -> expr . MINUS expr (rule 68) expr -> expr . STAR expr (rule 69) expr -> expr . MOD expr (rule 70) expr -> expr . DIV expr (rule 71) expr -> expr . AND expr (rule 74) expr -> expr . OR expr (rule 75) expr -> expr . EQ_EQ expr (rule 76) expr -> expr . NOT_EQ expr (rule 77) expr -> expr . LT expr (rule 78) expr -> expr . LT_EQ expr (rule 79) expr -> expr . GT expr (rule 80) expr -> expr . GT_EQ expr (rule 81) expr -> expr . SLASH_SLASH expr (rule 82) expr -> expr . DOTX (rule 85) expr -> expr . DOTY (rule 86) expr -> expr . DOT1 (rule 87) expr -> expr . DOT2 (rule 88) expr -> expr . DOTRAD (rule 89) expr -> expr . DOTARG (rule 90) expr -> IF expr THEN expr . ELSE expr (rule 99) ELSE shift, and go to state 244 OR shift, and go to state 134 AND shift, and go to state 135 EQ_EQ shift, and go to state 136 NOT_EQ shift, and go to state 137 GT shift, and go to state 138 GT_EQ shift, and go to state 139 LT shift, and go to state 140 LT_EQ shift, and go to state 141 SLASH_SLASH shift, and go to state 142 PLUS shift, and go to state 143 MINUS shift, and go to state 144 STAR shift, and go to state 145 DIV shift, and go to state 146 MOD shift, and go to state 147 DOTX shift, and go to state 148 DOTY shift, and go to state 149 DOTARG shift, and go to state 150 DOTRAD shift, and go to state 151 DOT1 shift, and go to state 152 DOT2 shift, and go to state 153 state 218 expr -> ID NOT LPAREN RPAREN . (rule 91) $default reduce using rule 91 (expr) state 219 expr_list -> expr_list . COMMA expr (rule 41) expr -> ID NOT LPAREN expr_list . RPAREN (rule 92) COMMA shift, and go to state 133 RPAREN shift, and go to state 245 state 220 expr -> IMGFUNC LPAREN expr_list RPAREN . (rule 94) $default reduce using rule 94 (expr) state 221 expr -> ITOS LPAREN expr RPAREN . (rule 83) $default reduce using rule 83 (expr) state 222 expr -> RTOS LPAREN expr COMMA . expr RPAREN (rule 84) INF shift, and go to state 3 PI shift, and go to state 4 I shift, and go to state 5 XI shift, and go to state 98 FI shift, and go to state 99 I_1 shift, and go to state 8 XI_1 shift, and go to state 9 FI_1 shift, and go to state 10 LABEL shift, and go to state 100 CIRCLE shift, and go to state 101 ELLIPSE shift, and go to state 102 RECTANGLE shift, and go to state 103 IF shift, and go to state 29 ID shift, and go to state 30 IMGFUNC shift, and go to state 31 CSTRING shift, and go to state 32 BOOL shift, and go to state 33 INUMBER shift, and go to state 34 RNUMBER shift, and go to state 35 ITOS shift, and go to state 36 RTOS shift, and go to state 37 TRUNC shift, and go to state 38 FLOAT shift, and go to state 39 SQRT shift, and go to state 40 SIN shift, and go to state 41 COS shift, and go to state 42 TAN shift, and go to state 43 ASIN shift, and go to state 44 ACOS shift, and go to state 45 ATAN shift, and go to state 46 LOG shift, and go to state 47 EXP shift, and go to state 48 RANDOM shift, and go to state 49 ROT shift, and go to state 50 SCALE shift, and go to state 51 TRANS shift, and go to state 52 REFLECT shift, and go to state 53 INTERSECT shift, and go to state 54 PARALLEL shift, and go to state 55 PERPEND shift, and go to state 56 DISTANCE shift, and go to state 57 MIDPOINT shift, and go to state 58 PT_BETWN_PTS shift, and go to state 59 COLINEAR shift, and go to state 60 INTERSECTS shift, and go to state 61 SEPARATES shift, and go to state 62 INCLUDES shift, and go to state 63 INCIDENT shift, and go to state 64 DISTLARGER shift, and go to state 65 DISTSMALLER shift, and go to state 66 NOT shift, and go to state 67 MINUS shift, and go to state 68 TILDE_SLASH shift, and go to state 69 SLASH shift, and go to state 70 LPAREN shift, and go to state 72 LBRACK shift, and go to state 73 LCURLY shift, and go to state 74 expr go to state 246 func1 go to state 85 func2 go to state 86 func3 go to state 87 identifier go to state 88 local_identifier go to state 89 local_id go to state 90 id go to state 91 state 223 expr -> PARALLEL LPAREN expr COMMA . expr COMMA expr COMMA expr RPAREN (rule 98) INF shift, and go to state 3 PI shift, and go to state 4 I shift, and go to state 5 XI shift, and go to state 98 FI shift, and go to state 99 I_1 shift, and go to state 8 XI_1 shift, and go to state 9 FI_1 shift, and go to state 10 LABEL shift, and go to state 100 CIRCLE shift, and go to state 101 ELLIPSE shift, and go to state 102 RECTANGLE shift, and go to state 103 IF shift, and go to state 29 ID shift, and go to state 30 IMGFUNC shift, and go to state 31 CSTRING shift, and go to state 32 BOOL shift, and go to state 33 INUMBER shift, and go to state 34 RNUMBER shift, and go to state 35 ITOS shift, and go to state 36 RTOS shift, and go to state 37 TRUNC shift, and go to state 38 FLOAT shift, and go to state 39 SQRT shift, and go to state 40 SIN shift, and go to state 41 COS shift, and go to state 42 TAN shift, and go to state 43 ASIN shift, and go to state 44 ACOS shift, and go to state 45 ATAN shift, and go to state 46 LOG shift, and go to state 47 EXP shift, and go to state 48 RANDOM shift, and go to state 49 ROT shift, and go to state 50 SCALE shift, and go to state 51 TRANS shift, and go to state 52 REFLECT shift, and go to state 53 INTERSECT shift, and go to state 54 PARALLEL shift, and go to state 55 PERPEND shift, and go to state 56 DISTANCE shift, and go to state 57 MIDPOINT shift, and go to state 58 PT_BETWN_PTS shift, and go to state 59 COLINEAR shift, and go to state 60 INTERSECTS shift, and go to state 61 SEPARATES shift, and go to state 62 INCLUDES shift, and go to state 63 INCIDENT shift, and go to state 64 DISTLARGER shift, and go to state 65 DISTSMALLER shift, and go to state 66 NOT shift, and go to state 67 MINUS shift, and go to state 68 TILDE_SLASH shift, and go to state 69 SLASH shift, and go to state 70 LPAREN shift, and go to state 72 LBRACK shift, and go to state 73 LCURLY shift, and go to state 74 expr go to state 247 func1 go to state 85 func2 go to state 86 func3 go to state 87 identifier go to state 88 local_identifier go to state 89 local_id go to state 90 id go to state 91 state 224 expr -> LBRACK NEWLINE graph_spec_list RBRACK . (rule 55) $default reduce using rule 55 (expr) state 225 graph_spec -> type_name COLON NEWLINE . (rule 141) $default reduce using rule 141 (graph_spec) state 226 expr -> expr . PLUS expr (rule 67) expr -> expr . MINUS expr (rule 68) expr -> expr . STAR expr (rule 69) expr -> expr . MOD expr (rule 70) expr -> expr . DIV expr (rule 71) expr -> expr . AND expr (rule 74) expr -> expr . OR expr (rule 75) expr -> expr . EQ_EQ expr (rule 76) expr -> expr . NOT_EQ expr (rule 77) expr -> expr . LT expr (rule 78) expr -> expr . LT_EQ expr (rule 79) expr -> expr . GT expr (rule 80) expr -> expr . GT_EQ expr (rule 81) expr -> expr . SLASH_SLASH expr (rule 82) expr -> expr . DOTX (rule 85) expr -> expr . DOTY (rule 86) expr -> expr . DOT1 (rule 87) expr -> expr . DOT2 (rule 88) expr -> expr . DOTRAD (rule 89) expr -> expr . DOTARG (rule 90) graph_spec -> type_name COLON expr . (rule 140) graph_spec -> type_name COLON expr . NEWLINE (rule 142) OR shift, and go to state 134 AND shift, and go to state 135 EQ_EQ shift, and go to state 136 NOT_EQ shift, and go to state 137 GT shift, and go to state 138 GT_EQ shift, and go to state 139 LT shift, and go to state 140 LT_EQ shift, and go to state 141 SLASH_SLASH shift, and go to state 142 PLUS shift, and go to state 143 MINUS shift, and go to state 144 STAR shift, and go to state 145 DIV shift, and go to state 146 MOD shift, and go to state 147 DOTX shift, and go to state 148 DOTY shift, and go to state 149 DOTARG shift, and go to state 150 DOTRAD shift, and go to state 151 DOT1 shift, and go to state 152 DOT2 shift, and go to state 153 NEWLINE shift, and go to state 248 $default reduce using rule 140 (graph_spec) state 227 expr -> LBRACK expr COMMA expr . RBRACK (rule 61) expr -> LBRACK expr COMMA expr . COMMA expr RBRACK (rule 62) expr -> expr . PLUS expr (rule 67) expr -> expr . MINUS expr (rule 68) expr -> expr . STAR expr (rule 69) expr -> expr . MOD expr (rule 70) expr -> expr . DIV expr (rule 71) expr -> expr . AND expr (rule 74) expr -> expr . OR expr (rule 75) expr -> expr . EQ_EQ expr (rule 76) expr -> expr . NOT_EQ expr (rule 77) expr -> expr . LT expr (rule 78) expr -> expr . LT_EQ expr (rule 79) expr -> expr . GT expr (rule 80) expr -> expr . GT_EQ expr (rule 81) expr -> expr . SLASH_SLASH expr (rule 82) expr -> expr . DOTX (rule 85) expr -> expr . DOTY (rule 86) expr -> expr . DOT1 (rule 87) expr -> expr . DOT2 (rule 88) expr -> expr . DOTRAD (rule 89) expr -> expr . DOTARG (rule 90) COMMA shift, and go to state 249 OR shift, and go to state 134 AND shift, and go to state 135 EQ_EQ shift, and go to state 136 NOT_EQ shift, and go to state 137 GT shift, and go to state 138 GT_EQ shift, and go to state 139 LT shift, and go to state 140 LT_EQ shift, and go to state 141 SLASH_SLASH shift, and go to state 142 PLUS shift, and go to state 143 MINUS shift, and go to state 144 STAR shift, and go to state 145 DIV shift, and go to state 146 MOD shift, and go to state 147 DOTX shift, and go to state 148 DOTY shift, and go to state 149 DOTARG shift, and go to state 150 DOTRAD shift, and go to state 151 DOT1 shift, and go to state 152 DOT2 shift, and go to state 153 RBRACK shift, and go to state 250 state 228 graph_spec_list -> graph_spec_list SEMICOLON NEWLINE . graph_spec (rule 138) IMAGE shift, and go to state 11 MYCHAR shift, and go to state 12 REAL shift, and go to state 13 INT shift, and go to state 14 BOOLEAN shift, and go to state 15 POINT shift, and go to state 16 LABEL shift, and go to state 173 LINE shift, and go to state 18 CIRCLE shift, and go to state 174 ELLIPSE shift, and go to state 175 SHAPE shift, and go to state 21 OPENSHAPE shift, and go to state 22 ARC shift, and go to state 23 RECTANGLE shift, and go to state 176 type_name go to state 121 graph_spec go to state 251 state 229 graph_spec_list -> graph_spec_list SEMICOLON graph_spec . (rule 137) $default reduce using rule 137 (graph_spec_list) state 230 expr -> LCURLY expr COMMA expr . RCURLY (rule 59) expr -> expr . PLUS expr (rule 67) expr -> expr . MINUS expr (rule 68) expr -> expr . STAR expr (rule 69) expr -> expr . MOD expr (rule 70) expr -> expr . DIV expr (rule 71) expr -> expr . AND expr (rule 74) expr -> expr . OR expr (rule 75) expr -> expr . EQ_EQ expr (rule 76) expr -> expr . NOT_EQ expr (rule 77) expr -> expr . LT expr (rule 78) expr -> expr . LT_EQ expr (rule 79) expr -> expr . GT expr (rule 80) expr -> expr . GT_EQ expr (rule 81) expr -> expr . SLASH_SLASH expr (rule 82) expr -> expr . DOTX (rule 85) expr -> expr . DOTY (rule 86) expr -> expr . DOT1 (rule 87) expr -> expr . DOT2 (rule 88) expr -> expr . DOTRAD (rule 89) expr -> expr . DOTARG (rule 90) OR shift, and go to state 134 AND shift, and go to state 135 EQ_EQ shift, and go to state 136 NOT_EQ shift, and go to state 137 GT shift, and go to state 138 GT_EQ shift, and go to state 139 LT shift, and go to state 140 LT_EQ shift, and go to state 141 SLASH_SLASH shift, and go to state 142 PLUS shift, and go to state 143 MINUS shift, and go to state 144 STAR shift, and go to state 145 DIV shift, and go to state 146 MOD shift, and go to state 147 DOTX shift, and go to state 148 DOTY shift, and go to state 149 DOTARG shift, and go to state 150 DOTRAD shift, and go to state 151 DOT1 shift, and go to state 152 DOT2 shift, and go to state 153 RCURLY shift, and go to state 252 state 231 expr -> LCURLY expr ATSIGN expr . RCURLY (rule 60) expr -> expr . PLUS expr (rule 67) expr -> expr . MINUS expr (rule 68) expr -> expr . STAR expr (rule 69) expr -> expr . MOD expr (rule 70) expr -> expr . DIV expr (rule 71) expr -> expr . AND expr (rule 74) expr -> expr . OR expr (rule 75) expr -> expr . EQ_EQ expr (rule 76) expr -> expr . NOT_EQ expr (rule 77) expr -> expr . LT expr (rule 78) expr -> expr . LT_EQ expr (rule 79) expr -> expr . GT expr (rule 80) expr -> expr . GT_EQ expr (rule 81) expr -> expr . SLASH_SLASH expr (rule 82) expr -> expr . DOTX (rule 85) expr -> expr . DOTY (rule 86) expr -> expr . DOT1 (rule 87) expr -> expr . DOT2 (rule 88) expr -> expr . DOTRAD (rule 89) expr -> expr . DOTARG (rule 90) OR shift, and go to state 134 AND shift, and go to state 135 EQ_EQ shift, and go to state 136 NOT_EQ shift, and go to state 137 GT shift, and go to state 138 GT_EQ shift, and go to state 139 LT shift, and go to state 140 LT_EQ shift, and go to state 141 SLASH_SLASH shift, and go to state 142 PLUS shift, and go to state 143 MINUS shift, and go to state 144 STAR shift, and go to state 145 DIV shift, and go to state 146 MOD shift, and go to state 147 DOTX shift, and go to state 148 DOTY shift, and go to state 149 DOTARG shift, and go to state 150 DOTRAD shift, and go to state 151 DOT1 shift, and go to state 152 DOT2 shift, and go to state 153 RCURLY shift, and go to state 253 state 232 evaluation -> evaluation QUERY NEWLINE . (rule 39) $default reduce using rule 39 (evaluation) state 233 within_clause -> within_id NEWLINE LCURLY stmt_list . RCURLY (rule 15) stmt_list -> stmt_list . stmt (rule 18) INF shift, and go to state 3 PI shift, and go to state 4 I shift, and go to state 5 XI shift, and go to state 6 FI shift, and go to state 7 I_1 shift, and go to state 8 XI_1 shift, and go to state 9 FI_1 shift, and go to state 10 IMAGE shift, and go to state 11 MYCHAR shift, and go to state 12 REAL shift, and go to state 13 INT shift, and go to state 14 BOOLEAN shift, and go to state 15 POINT shift, and go to state 16 LABEL shift, and go to state 17 LINE shift, and go to state 18 CIRCLE shift, and go to state 19 ELLIPSE shift, and go to state 20 SHAPE shift, and go to state 21 OPENSHAPE shift, and go to state 22 ARC shift, and go to state 23 RECTANGLE shift, and go to state 24 GRAPH shift, and go to state 25 VIEWPORT shift, and go to state 26 DELETE shift, and go to state 27 WITHIN shift, and go to state 28 IF shift, and go to state 29 ID shift, and go to state 30 IMGFUNC shift, and go to state 31 CSTRING shift, and go to state 32 BOOL shift, and go to state 33 INUMBER shift, and go to state 34 RNUMBER shift, and go to state 35 ITOS shift, and go to state 36 RTOS shift, and go to state 37 TRUNC shift, and go to state 38 FLOAT shift, and go to state 39 SQRT shift, and go to state 40 SIN shift, and go to state 41 COS shift, and go to state 42 TAN shift, and go to state 43 ASIN shift, and go to state 44 ACOS shift, and go to state 45 ATAN shift, and go to state 46 LOG shift, and go to state 47 EXP shift, and go to state 48 RANDOM shift, and go to state 49 ROT shift, and go to state 50 SCALE shift, and go to state 51 TRANS shift, and go to state 52 REFLECT shift, and go to state 53 INTERSECT shift, and go to state 54 PARALLEL shift, and go to state 55 PERPEND shift, and go to state 56 DISTANCE shift, and go to state 57 MIDPOINT shift, and go to state 58 PT_BETWN_PTS shift, and go to state 59 COLINEAR shift, and go to state 60 INTERSECTS shift, and go to state 61 SEPARATES shift, and go to state 62 INCLUDES shift, and go to state 63 INCIDENT shift, and go to state 64 DISTLARGER shift, and go to state 65 DISTSMALLER shift, and go to state 66 NOT shift, and go to state 67 MINUS shift, and go to state 68 TILDE_SLASH shift, and go to state 69 SLASH shift, and go to state 70 NEWLINE shift, and go to state 71 LPAREN shift, and go to state 72 LBRACK shift, and go to state 73 LCURLY shift, and go to state 74 RCURLY shift, and go to state 254 $default reduce using rule 7 (@1) stmt go to state 235 @1 go to state 76 delete go to state 77 within_id go to state 78 within_clause go to state 79 declaration go to state 80 type_name go to state 81 definition go to state 82 expr_list go to state 83 expr go to state 84 func1 go to state 85 func2 go to state 86 func3 go to state 87 identifier go to state 88 local_identifier go to state 89 local_id go to state 90 id go to state 91 state 234 within_clause -> within_id LCURLY stmt_list RCURLY . (rule 16) $default reduce using rule 16 (within_clause) state 235 stmt_list -> stmt_list stmt . (rule 18) $default reduce using rule 18 (stmt_list) state 236 definition -> expr_list EQUALS expr_list NEWLINE . (rule 35) $default reduce using rule 35 (definition) state 237 expr -> func1 LPAREN expr RPAREN . (rule 95) $default reduce using rule 95 (expr) state 238 expr -> func2 LPAREN expr COMMA . expr RPAREN (rule 96) INF shift, and go to state 3 PI shift, and go to state 4 I shift, and go to state 5 XI shift, and go to state 98 FI shift, and go to state 99 I_1 shift, and go to state 8 XI_1 shift, and go to state 9 FI_1 shift, and go to state 10 LABEL shift, and go to state 100 CIRCLE shift, and go to state 101 ELLIPSE shift, and go to state 102 RECTANGLE shift, and go to state 103 IF shift, and go to state 29 ID shift, and go to state 30 IMGFUNC shift, and go to state 31 CSTRING shift, and go to state 32 BOOL shift, and go to state 33 INUMBER shift, and go to state 34 RNUMBER shift, and go to state 35 ITOS shift, and go to state 36 RTOS shift, and go to state 37 TRUNC shift, and go to state 38 FLOAT shift, and go to state 39 SQRT shift, and go to state 40 SIN shift, and go to state 41 COS shift, and go to state 42 TAN shift, and go to state 43 ASIN shift, and go to state 44 ACOS shift, and go to state 45 ATAN shift, and go to state 46 LOG shift, and go to state 47 EXP shift, and go to state 48 RANDOM shift, and go to state 49 ROT shift, and go to state 50 SCALE shift, and go to state 51 TRANS shift, and go to state 52 REFLECT shift, and go to state 53 INTERSECT shift, and go to state 54 PARALLEL shift, and go to state 55 PERPEND shift, and go to state 56 DISTANCE shift, and go to state 57 MIDPOINT shift, and go to state 58 PT_BETWN_PTS shift, and go to state 59 COLINEAR shift, and go to state 60 INTERSECTS shift, and go to state 61 SEPARATES shift, and go to state 62 INCLUDES shift, and go to state 63 INCIDENT shift, and go to state 64 DISTLARGER shift, and go to state 65 DISTSMALLER shift, and go to state 66 NOT shift, and go to state 67 MINUS shift, and go to state 68 TILDE_SLASH shift, and go to state 69 SLASH shift, and go to state 70 LPAREN shift, and go to state 72 LBRACK shift, and go to state 73 LCURLY shift, and go to state 74 expr go to state 255 func1 go to state 85 func2 go to state 86 func3 go to state 87 identifier go to state 88 local_identifier go to state 89 local_id go to state 90 id go to state 91 state 239 expr -> func3 LPAREN expr COMMA . expr COMMA expr RPAREN (rule 97) INF shift, and go to state 3 PI shift, and go to state 4 I shift, and go to state 5 XI shift, and go to state 98 FI shift, and go to state 99 I_1 shift, and go to state 8 XI_1 shift, and go to state 9 FI_1 shift, and go to state 10 LABEL shift, and go to state 100 CIRCLE shift, and go to state 101 ELLIPSE shift, and go to state 102 RECTANGLE shift, and go to state 103 IF shift, and go to state 29 ID shift, and go to state 30 IMGFUNC shift, and go to state 31 CSTRING shift, and go to state 32 BOOL shift, and go to state 33 INUMBER shift, and go to state 34 RNUMBER shift, and go to state 35 ITOS shift, and go to state 36 RTOS shift, and go to state 37 TRUNC shift, and go to state 38 FLOAT shift, and go to state 39 SQRT shift, and go to state 40 SIN shift, and go to state 41 COS shift, and go to state 42 TAN shift, and go to state 43 ASIN shift, and go to state 44 ACOS shift, and go to state 45 ATAN shift, and go to state 46 LOG shift, and go to state 47 EXP shift, and go to state 48 RANDOM shift, and go to state 49 ROT shift, and go to state 50 SCALE shift, and go to state 51 TRANS shift, and go to state 52 REFLECT shift, and go to state 53 INTERSECT shift, and go to state 54 PARALLEL shift, and go to state 55 PERPEND shift, and go to state 56 DISTANCE shift, and go to state 57 MIDPOINT shift, and go to state 58 PT_BETWN_PTS shift, and go to state 59 COLINEAR shift, and go to state 60 INTERSECTS shift, and go to state 61 SEPARATES shift, and go to state 62 INCLUDES shift, and go to state 63 INCIDENT shift, and go to state 64 DISTLARGER shift, and go to state 65 DISTSMALLER shift, and go to state 66 NOT shift, and go to state 67 MINUS shift, and go to state 68 TILDE_SLASH shift, and go to state 69 SLASH shift, and go to state 70 LPAREN shift, and go to state 72 LBRACK shift, and go to state 73 LCURLY shift, and go to state 74 expr go to state 256 func1 go to state 85 func2 go to state 86 func3 go to state 87 identifier go to state 88 local_identifier go to state 89 local_id go to state 90 id go to state 91 state 240 expr -> LABEL LPAREN expr COMMA expr . RPAREN (rule 66) expr -> expr . PLUS expr (rule 67) expr -> expr . MINUS expr (rule 68) expr -> expr . STAR expr (rule 69) expr -> expr . MOD expr (rule 70) expr -> expr . DIV expr (rule 71) expr -> expr . AND expr (rule 74) expr -> expr . OR expr (rule 75) expr -> expr . EQ_EQ expr (rule 76) expr -> expr . NOT_EQ expr (rule 77) expr -> expr . LT expr (rule 78) expr -> expr . LT_EQ expr (rule 79) expr -> expr . GT expr (rule 80) expr -> expr . GT_EQ expr (rule 81) expr -> expr . SLASH_SLASH expr (rule 82) expr -> expr . DOTX (rule 85) expr -> expr . DOTY (rule 86) expr -> expr . DOT1 (rule 87) expr -> expr . DOT2 (rule 88) expr -> expr . DOTRAD (rule 89) expr -> expr . DOTARG (rule 90) OR shift, and go to state 134 AND shift, and go to state 135 EQ_EQ shift, and go to state 136 NOT_EQ shift, and go to state 137 GT shift, and go to state 138 GT_EQ shift, and go to state 139 LT shift, and go to state 140 LT_EQ shift, and go to state 141 SLASH_SLASH shift, and go to state 142 PLUS shift, and go to state 143 MINUS shift, and go to state 144 STAR shift, and go to state 145 DIV shift, and go to state 146 MOD shift, and go to state 147 DOTX shift, and go to state 148 DOTY shift, and go to state 149 DOTARG shift, and go to state 150 DOTRAD shift, and go to state 151 DOT1 shift, and go to state 152 DOT2 shift, and go to state 153 RPAREN shift, and go to state 257 state 241 expr -> CIRCLE LPAREN expr COMMA expr . RPAREN (rule 63) expr -> expr . PLUS expr (rule 67) expr -> expr . MINUS expr (rule 68) expr -> expr . STAR expr (rule 69) expr -> expr . MOD expr (rule 70) expr -> expr . DIV expr (rule 71) expr -> expr . AND expr (rule 74) expr -> expr . OR expr (rule 75) expr -> expr . EQ_EQ expr (rule 76) expr -> expr . NOT_EQ expr (rule 77) expr -> expr . LT expr (rule 78) expr -> expr . LT_EQ expr (rule 79) expr -> expr . GT expr (rule 80) expr -> expr . GT_EQ expr (rule 81) expr -> expr . SLASH_SLASH expr (rule 82) expr -> expr . DOTX (rule 85) expr -> expr . DOTY (rule 86) expr -> expr . DOT1 (rule 87) expr -> expr . DOT2 (rule 88) expr -> expr . DOTRAD (rule 89) expr -> expr . DOTARG (rule 90) OR shift, and go to state 134 AND shift, and go to state 135 EQ_EQ shift, and go to state 136 NOT_EQ shift, and go to state 137 GT shift, and go to state 138 GT_EQ shift, and go to state 139 LT shift, and go to state 140 LT_EQ shift, and go to state 141 SLASH_SLASH shift, and go to state 142 PLUS shift, and go to state 143 MINUS shift, and go to state 144 STAR shift, and go to state 145 DIV shift, and go to state 146 MOD shift, and go to state 147 DOTX shift, and go to state 148 DOTY shift, and go to state 149 DOTARG shift, and go to state 150 DOTRAD shift, and go to state 151 DOT1 shift, and go to state 152 DOT2 shift, and go to state 153 RPAREN shift, and go to state 258 state 242 expr -> ELLIPSE LPAREN expr COMMA expr . COMMA expr RPAREN (rule 65) expr -> expr . PLUS expr (rule 67) expr -> expr . MINUS expr (rule 68) expr -> expr . STAR expr (rule 69) expr -> expr . MOD expr (rule 70) expr -> expr . DIV expr (rule 71) expr -> expr . AND expr (rule 74) expr -> expr . OR expr (rule 75) expr -> expr . EQ_EQ expr (rule 76) expr -> expr . NOT_EQ expr (rule 77) expr -> expr . LT expr (rule 78) expr -> expr . LT_EQ expr (rule 79) expr -> expr . GT expr (rule 80) expr -> expr . GT_EQ expr (rule 81) expr -> expr . SLASH_SLASH expr (rule 82) expr -> expr . DOTX (rule 85) expr -> expr . DOTY (rule 86) expr -> expr . DOT1 (rule 87) expr -> expr . DOT2 (rule 88) expr -> expr . DOTRAD (rule 89) expr -> expr . DOTARG (rule 90) COMMA shift, and go to state 259 OR shift, and go to state 134 AND shift, and go to state 135 EQ_EQ shift, and go to state 136 NOT_EQ shift, and go to state 137 GT shift, and go to state 138 GT_EQ shift, and go to state 139 LT shift, and go to state 140 LT_EQ shift, and go to state 141 SLASH_SLASH shift, and go to state 142 PLUS shift, and go to state 143 MINUS shift, and go to state 144 STAR shift, and go to state 145 DIV shift, and go to state 146 MOD shift, and go to state 147 DOTX shift, and go to state 148 DOTY shift, and go to state 149 DOTARG shift, and go to state 150 DOTRAD shift, and go to state 151 DOT1 shift, and go to state 152 DOT2 shift, and go to state 153 state 243 expr -> RECTANGLE LPAREN expr COMMA expr . RPAREN (rule 64) expr -> expr . PLUS expr (rule 67) expr -> expr . MINUS expr (rule 68) expr -> expr . STAR expr (rule 69) expr -> expr . MOD expr (rule 70) expr -> expr . DIV expr (rule 71) expr -> expr . AND expr (rule 74) expr -> expr . OR expr (rule 75) expr -> expr . EQ_EQ expr (rule 76) expr -> expr . NOT_EQ expr (rule 77) expr -> expr . LT expr (rule 78) expr -> expr . LT_EQ expr (rule 79) expr -> expr . GT expr (rule 80) expr -> expr . GT_EQ expr (rule 81) expr -> expr . SLASH_SLASH expr (rule 82) expr -> expr . DOTX (rule 85) expr -> expr . DOTY (rule 86) expr -> expr . DOT1 (rule 87) expr -> expr . DOT2 (rule 88) expr -> expr . DOTRAD (rule 89) expr -> expr . DOTARG (rule 90) OR shift, and go to state 134 AND shift, and go to state 135 EQ_EQ shift, and go to state 136 NOT_EQ shift, and go to state 137 GT shift, and go to state 138 GT_EQ shift, and go to state 139 LT shift, and go to state 140 LT_EQ shift, and go to state 141 SLASH_SLASH shift, and go to state 142 PLUS shift, and go to state 143 MINUS shift, and go to state 144 STAR shift, and go to state 145 DIV shift, and go to state 146 MOD shift, and go to state 147 DOTX shift, and go to state 148 DOTY shift, and go to state 149 DOTARG shift, and go to state 150 DOTRAD shift, and go to state 151 DOT1 shift, and go to state 152 DOT2 shift, and go to state 153 RPAREN shift, and go to state 260 state 244 expr -> IF expr THEN expr ELSE . expr (rule 99) INF shift, and go to state 3 PI shift, and go to state 4 I shift, and go to state 5 XI shift, and go to state 98 FI shift, and go to state 99 I_1 shift, and go to state 8 XI_1 shift, and go to state 9 FI_1 shift, and go to state 10 LABEL shift, and go to state 100 CIRCLE shift, and go to state 101 ELLIPSE shift, and go to state 102 RECTANGLE shift, and go to state 103 IF shift, and go to state 29 ID shift, and go to state 30 IMGFUNC shift, and go to state 31 CSTRING shift, and go to state 32 BOOL shift, and go to state 33 INUMBER shift, and go to state 34 RNUMBER shift, and go to state 35 ITOS shift, and go to state 36 RTOS shift, and go to state 37 TRUNC shift, and go to state 38 FLOAT shift, and go to state 39 SQRT shift, and go to state 40 SIN shift, and go to state 41 COS shift, and go to state 42 TAN shift, and go to state 43 ASIN shift, and go to state 44 ACOS shift, and go to state 45 ATAN shift, and go to state 46 LOG shift, and go to state 47 EXP shift, and go to state 48 RANDOM shift, and go to state 49 ROT shift, and go to state 50 SCALE shift, and go to state 51 TRANS shift, and go to state 52 REFLECT shift, and go to state 53 INTERSECT shift, and go to state 54 PARALLEL shift, and go to state 55 PERPEND shift, and go to state 56 DISTANCE shift, and go to state 57 MIDPOINT shift, and go to state 58 PT_BETWN_PTS shift, and go to state 59 COLINEAR shift, and go to state 60 INTERSECTS shift, and go to state 61 SEPARATES shift, and go to state 62 INCLUDES shift, and go to state 63 INCIDENT shift, and go to state 64 DISTLARGER shift, and go to state 65 DISTSMALLER shift, and go to state 66 NOT shift, and go to state 67 MINUS shift, and go to state 68 TILDE_SLASH shift, and go to state 69 SLASH shift, and go to state 70 LPAREN shift, and go to state 72 LBRACK shift, and go to state 73 LCURLY shift, and go to state 74 expr go to state 261 func1 go to state 85 func2 go to state 86 func3 go to state 87 identifier go to state 88 local_identifier go to state 89 local_id go to state 90 id go to state 91 state 245 expr -> ID NOT LPAREN expr_list RPAREN . (rule 92) $default reduce using rule 92 (expr) state 246 expr -> expr . PLUS expr (rule 67) expr -> expr . MINUS expr (rule 68) expr -> expr . STAR expr (rule 69) expr -> expr . MOD expr (rule 70) expr -> expr . DIV expr (rule 71) expr -> expr . AND expr (rule 74) expr -> expr . OR expr (rule 75) expr -> expr . EQ_EQ expr (rule 76) expr -> expr . NOT_EQ expr (rule 77) expr -> expr . LT expr (rule 78) expr -> expr . LT_EQ expr (rule 79) expr -> expr . GT expr (rule 80) expr -> expr . GT_EQ expr (rule 81) expr -> expr . SLASH_SLASH expr (rule 82) expr -> RTOS LPAREN expr COMMA expr . RPAREN (rule 84) expr -> expr . DOTX (rule 85) expr -> expr . DOTY (rule 86) expr -> expr . DOT1 (rule 87) expr -> expr . DOT2 (rule 88) expr -> expr . DOTRAD (rule 89) expr -> expr . DOTARG (rule 90) OR shift, and go to state 134 AND shift, and go to state 135 EQ_EQ shift, and go to state 136 NOT_EQ shift, and go to state 137 GT shift, and go to state 138 GT_EQ shift, and go to state 139 LT shift, and go to state 140 LT_EQ shift, and go to state 141 SLASH_SLASH shift, and go to state 142 PLUS shift, and go to state 143 MINUS shift, and go to state 144 STAR shift, and go to state 145 DIV shift, and go to state 146 MOD shift, and go to state 147 DOTX shift, and go to state 148 DOTY shift, and go to state 149 DOTARG shift, and go to state 150 DOTRAD shift, and go to state 151 DOT1 shift, and go to state 152 DOT2 shift, and go to state 153 RPAREN shift, and go to state 262 state 247 expr -> expr . PLUS expr (rule 67) expr -> expr . MINUS expr (rule 68) expr -> expr . STAR expr (rule 69) expr -> expr . MOD expr (rule 70) expr -> expr . DIV expr (rule 71) expr -> expr . AND expr (rule 74) expr -> expr . OR expr (rule 75) expr -> expr . EQ_EQ expr (rule 76) expr -> expr . NOT_EQ expr (rule 77) expr -> expr . LT expr (rule 78) expr -> expr . LT_EQ expr (rule 79) expr -> expr . GT expr (rule 80) expr -> expr . GT_EQ expr (rule 81) expr -> expr . SLASH_SLASH expr (rule 82) expr -> expr . DOTX (rule 85) expr -> expr . DOTY (rule 86) expr -> expr . DOT1 (rule 87) expr -> expr . DOT2 (rule 88) expr -> expr . DOTRAD (rule 89) expr -> expr . DOTARG (rule 90) expr -> PARALLEL LPAREN expr COMMA expr . COMMA expr COMMA expr RPAREN (rule 98) COMMA shift, and go to state 263 OR shift, and go to state 134 AND shift, and go to state 135 EQ_EQ shift, and go to state 136 NOT_EQ shift, and go to state 137 GT shift, and go to state 138 GT_EQ shift, and go to state 139 LT shift, and go to state 140 LT_EQ shift, and go to state 141 SLASH_SLASH shift, and go to state 142 PLUS shift, and go to state 143 MINUS shift, and go to state 144 STAR shift, and go to state 145 DIV shift, and go to state 146 MOD shift, and go to state 147 DOTX shift, and go to state 148 DOTY shift, and go to state 149 DOTARG shift, and go to state 150 DOTRAD shift, and go to state 151 DOT1 shift, and go to state 152 DOT2 shift, and go to state 153 state 248 graph_spec -> type_name COLON expr NEWLINE . (rule 142) $default reduce using rule 142 (graph_spec) state 249 expr -> LBRACK expr COMMA expr COMMA . expr RBRACK (rule 62) INF shift, and go to state 3 PI shift, and go to state 4 I shift, and go to state 5 XI shift, and go to state 98 FI shift, and go to state 99 I_1 shift, and go to state 8 XI_1 shift, and go to state 9 FI_1 shift, and go to state 10 LABEL shift, and go to state 100 CIRCLE shift, and go to state 101 ELLIPSE shift, and go to state 102 RECTANGLE shift, and go to state 103 IF shift, and go to state 29 ID shift, and go to state 30 IMGFUNC shift, and go to state 31 CSTRING shift, and go to state 32 BOOL shift, and go to state 33 INUMBER shift, and go to state 34 RNUMBER shift, and go to state 35 ITOS shift, and go to state 36 RTOS shift, and go to state 37 TRUNC shift, and go to state 38 FLOAT shift, and go to state 39 SQRT shift, and go to state 40 SIN shift, and go to state 41 COS shift, and go to state 42 TAN shift, and go to state 43 ASIN shift, and go to state 44 ACOS shift, and go to state 45 ATAN shift, and go to state 46 LOG shift, and go to state 47 EXP shift, and go to state 48 RANDOM shift, and go to state 49 ROT shift, and go to state 50 SCALE shift, and go to state 51 TRANS shift, and go to state 52 REFLECT shift, and go to state 53 INTERSECT shift, and go to state 54 PARALLEL shift, and go to state 55 PERPEND shift, and go to state 56 DISTANCE shift, and go to state 57 MIDPOINT shift, and go to state 58 PT_BETWN_PTS shift, and go to state 59 COLINEAR shift, and go to state 60 INTERSECTS shift, and go to state 61 SEPARATES shift, and go to state 62 INCLUDES shift, and go to state 63 INCIDENT shift, and go to state 64 DISTLARGER shift, and go to state 65 DISTSMALLER shift, and go to state 66 NOT shift, and go to state 67 MINUS shift, and go to state 68 TILDE_SLASH shift, and go to state 69 SLASH shift, and go to state 70 LPAREN shift, and go to state 72 LBRACK shift, and go to state 73 LCURLY shift, and go to state 74 expr go to state 264 func1 go to state 85 func2 go to state 86 func3 go to state 87 identifier go to state 88 local_identifier go to state 89 local_id go to state 90 id go to state 91 state 250 expr -> LBRACK expr COMMA expr RBRACK . (rule 61) $default reduce using rule 61 (expr) state 251 graph_spec_list -> graph_spec_list SEMICOLON NEWLINE graph_spec . (rule 138) $default reduce using rule 138 (graph_spec_list) state 252 expr -> LCURLY expr COMMA expr RCURLY . (rule 59) $default reduce using rule 59 (expr) state 253 expr -> LCURLY expr ATSIGN expr RCURLY . (rule 60) $default reduce using rule 60 (expr) state 254 within_clause -> within_id NEWLINE LCURLY stmt_list RCURLY . (rule 15) $default reduce using rule 15 (within_clause) state 255 expr -> expr . PLUS expr (rule 67) expr -> expr . MINUS expr (rule 68) expr -> expr . STAR expr (rule 69) expr -> expr . MOD expr (rule 70) expr -> expr . DIV expr (rule 71) expr -> expr . AND expr (rule 74) expr -> expr . OR expr (rule 75) expr -> expr . EQ_EQ expr (rule 76) expr -> expr . NOT_EQ expr (rule 77) expr -> expr . LT expr (rule 78) expr -> expr . LT_EQ expr (rule 79) expr -> expr . GT expr (rule 80) expr -> expr . GT_EQ expr (rule 81) expr -> expr . SLASH_SLASH expr (rule 82) expr -> expr . DOTX (rule 85) expr -> expr . DOTY (rule 86) expr -> expr . DOT1 (rule 87) expr -> expr . DOT2 (rule 88) expr -> expr . DOTRAD (rule 89) expr -> expr . DOTARG (rule 90) expr -> func2 LPAREN expr COMMA expr . RPAREN (rule 96) OR shift, and go to state 134 AND shift, and go to state 135 EQ_EQ shift, and go to state 136 NOT_EQ shift, and go to state 137 GT shift, and go to state 138 GT_EQ shift, and go to state 139 LT shift, and go to state 140 LT_EQ shift, and go to state 141 SLASH_SLASH shift, and go to state 142 PLUS shift, and go to state 143 MINUS shift, and go to state 144 STAR shift, and go to state 145 DIV shift, and go to state 146 MOD shift, and go to state 147 DOTX shift, and go to state 148 DOTY shift, and go to state 149 DOTARG shift, and go to state 150 DOTRAD shift, and go to state 151 DOT1 shift, and go to state 152 DOT2 shift, and go to state 153 RPAREN shift, and go to state 265 state 256 expr -> expr . PLUS expr (rule 67) expr -> expr . MINUS expr (rule 68) expr -> expr . STAR expr (rule 69) expr -> expr . MOD expr (rule 70) expr -> expr . DIV expr (rule 71) expr -> expr . AND expr (rule 74) expr -> expr . OR expr (rule 75) expr -> expr . EQ_EQ expr (rule 76) expr -> expr . NOT_EQ expr (rule 77) expr -> expr . LT expr (rule 78) expr -> expr . LT_EQ expr (rule 79) expr -> expr . GT expr (rule 80) expr -> expr . GT_EQ expr (rule 81) expr -> expr . SLASH_SLASH expr (rule 82) expr -> expr . DOTX (rule 85) expr -> expr . DOTY (rule 86) expr -> expr . DOT1 (rule 87) expr -> expr . DOT2 (rule 88) expr -> expr . DOTRAD (rule 89) expr -> expr . DOTARG (rule 90) expr -> func3 LPAREN expr COMMA expr . COMMA expr RPAREN (rule 97) COMMA shift, and go to state 266 OR shift, and go to state 134 AND shift, and go to state 135 EQ_EQ shift, and go to state 136 NOT_EQ shift, and go to state 137 GT shift, and go to state 138 GT_EQ shift, and go to state 139 LT shift, and go to state 140 LT_EQ shift, and go to state 141 SLASH_SLASH shift, and go to state 142 PLUS shift, and go to state 143 MINUS shift, and go to state 144 STAR shift, and go to state 145 DIV shift, and go to state 146 MOD shift, and go to state 147 DOTX shift, and go to state 148 DOTY shift, and go to state 149 DOTARG shift, and go to state 150 DOTRAD shift, and go to state 151 DOT1 shift, and go to state 152 DOT2 shift, and go to state 153 state 257 expr -> LABEL LPAREN expr COMMA expr RPAREN . (rule 66) $default reduce using rule 66 (expr) state 258 expr -> CIRCLE LPAREN expr COMMA expr RPAREN . (rule 63) $default reduce using rule 63 (expr) state 259 expr -> ELLIPSE LPAREN expr COMMA expr COMMA . expr RPAREN (rule 65) INF shift, and go to state 3 PI shift, and go to state 4 I shift, and go to state 5 XI shift, and go to state 98 FI shift, and go to state 99 I_1 shift, and go to state 8 XI_1 shift, and go to state 9 FI_1 shift, and go to state 10 LABEL shift, and go to state 100 CIRCLE shift, and go to state 101 ELLIPSE shift, and go to state 102 RECTANGLE shift, and go to state 103 IF shift, and go to state 29 ID shift, and go to state 30 IMGFUNC shift, and go to state 31 CSTRING shift, and go to state 32 BOOL shift, and go to state 33 INUMBER shift, and go to state 34 RNUMBER shift, and go to state 35 ITOS shift, and go to state 36 RTOS shift, and go to state 37 TRUNC shift, and go to state 38 FLOAT shift, and go to state 39 SQRT shift, and go to state 40 SIN shift, and go to state 41 COS shift, and go to state 42 TAN shift, and go to state 43 ASIN shift, and go to state 44 ACOS shift, and go to state 45 ATAN shift, and go to state 46 LOG shift, and go to state 47 EXP shift, and go to state 48 RANDOM shift, and go to state 49 ROT shift, and go to state 50 SCALE shift, and go to state 51 TRANS shift, and go to state 52 REFLECT shift, and go to state 53 INTERSECT shift, and go to state 54 PARALLEL shift, and go to state 55 PERPEND shift, and go to state 56 DISTANCE shift, and go to state 57 MIDPOINT shift, and go to state 58 PT_BETWN_PTS shift, and go to state 59 COLINEAR shift, and go to state 60 INTERSECTS shift, and go to state 61 SEPARATES shift, and go to state 62 INCLUDES shift, and go to state 63 INCIDENT shift, and go to state 64 DISTLARGER shift, and go to state 65 DISTSMALLER shift, and go to state 66 NOT shift, and go to state 67 MINUS shift, and go to state 68 TILDE_SLASH shift, and go to state 69 SLASH shift, and go to state 70 LPAREN shift, and go to state 72 LBRACK shift, and go to state 73 LCURLY shift, and go to state 74 expr go to state 267 func1 go to state 85 func2 go to state 86 func3 go to state 87 identifier go to state 88 local_identifier go to state 89 local_id go to state 90 id go to state 91 state 260 expr -> RECTANGLE LPAREN expr COMMA expr RPAREN . (rule 64) $default reduce using rule 64 (expr) state 261 expr -> expr . PLUS expr (rule 67) expr -> expr . MINUS expr (rule 68) expr -> expr . STAR expr (rule 69) expr -> expr . MOD expr (rule 70) expr -> expr . DIV expr (rule 71) expr -> expr . AND expr (rule 74) expr -> expr . OR expr (rule 75) expr -> expr . EQ_EQ expr (rule 76) expr -> expr . NOT_EQ expr (rule 77) expr -> expr . LT expr (rule 78) expr -> expr . LT_EQ expr (rule 79) expr -> expr . GT expr (rule 80) expr -> expr . GT_EQ expr (rule 81) expr -> expr . SLASH_SLASH expr (rule 82) expr -> expr . DOTX (rule 85) expr -> expr . DOTY (rule 86) expr -> expr . DOT1 (rule 87) expr -> expr . DOT2 (rule 88) expr -> expr . DOTRAD (rule 89) expr -> expr . DOTARG (rule 90) expr -> IF expr THEN expr ELSE expr . (rule 99) OR shift, and go to state 134 AND shift, and go to state 135 EQ_EQ shift, and go to state 136 NOT_EQ shift, and go to state 137 GT shift, and go to state 138 GT_EQ shift, and go to state 139 LT shift, and go to state 140 LT_EQ shift, and go to state 141 SLASH_SLASH shift, and go to state 142 PLUS shift, and go to state 143 MINUS shift, and go to state 144 STAR shift, and go to state 145 DIV shift, and go to state 146 MOD shift, and go to state 147 DOTX shift, and go to state 148 DOTY shift, and go to state 149 DOTARG shift, and go to state 150 DOTRAD shift, and go to state 151 DOT1 shift, and go to state 152 DOT2 shift, and go to state 153 $default reduce using rule 99 (expr) state 262 expr -> RTOS LPAREN expr COMMA expr RPAREN . (rule 84) $default reduce using rule 84 (expr) state 263 expr -> PARALLEL LPAREN expr COMMA expr COMMA . expr COMMA expr RPAREN (rule 98) INF shift, and go to state 3 PI shift, and go to state 4 I shift, and go to state 5 XI shift, and go to state 98 FI shift, and go to state 99 I_1 shift, and go to state 8 XI_1 shift, and go to state 9 FI_1 shift, and go to state 10 LABEL shift, and go to state 100 CIRCLE shift, and go to state 101 ELLIPSE shift, and go to state 102 RECTANGLE shift, and go to state 103 IF shift, and go to state 29 ID shift, and go to state 30 IMGFUNC shift, and go to state 31 CSTRING shift, and go to state 32 BOOL shift, and go to state 33 INUMBER shift, and go to state 34 RNUMBER shift, and go to state 35 ITOS shift, and go to state 36 RTOS shift, and go to state 37 TRUNC shift, and go to state 38 FLOAT shift, and go to state 39 SQRT shift, and go to state 40 SIN shift, and go to state 41 COS shift, and go to state 42 TAN shift, and go to state 43 ASIN shift, and go to state 44 ACOS shift, and go to state 45 ATAN shift, and go to state 46 LOG shift, and go to state 47 EXP shift, and go to state 48 RANDOM shift, and go to state 49 ROT shift, and go to state 50 SCALE shift, and go to state 51 TRANS shift, and go to state 52 REFLECT shift, and go to state 53 INTERSECT shift, and go to state 54 PARALLEL shift, and go to state 55 PERPEND shift, and go to state 56 DISTANCE shift, and go to state 57 MIDPOINT shift, and go to state 58 PT_BETWN_PTS shift, and go to state 59 COLINEAR shift, and go to state 60 INTERSECTS shift, and go to state 61 SEPARATES shift, and go to state 62 INCLUDES shift, and go to state 63 INCIDENT shift, and go to state 64 DISTLARGER shift, and go to state 65 DISTSMALLER shift, and go to state 66 NOT shift, and go to state 67 MINUS shift, and go to state 68 TILDE_SLASH shift, and go to state 69 SLASH shift, and go to state 70 LPAREN shift, and go to state 72 LBRACK shift, and go to state 73 LCURLY shift, and go to state 74 expr go to state 268 func1 go to state 85 func2 go to state 86 func3 go to state 87 identifier go to state 88 local_identifier go to state 89 local_id go to state 90 id go to state 91 state 264 expr -> LBRACK expr COMMA expr COMMA expr . RBRACK (rule 62) expr -> expr . PLUS expr (rule 67) expr -> expr . MINUS expr (rule 68) expr -> expr . STAR expr (rule 69) expr -> expr . MOD expr (rule 70) expr -> expr . DIV expr (rule 71) expr -> expr . AND expr (rule 74) expr -> expr . OR expr (rule 75) expr -> expr . EQ_EQ expr (rule 76) expr -> expr . NOT_EQ expr (rule 77) expr -> expr . LT expr (rule 78) expr -> expr . LT_EQ expr (rule 79) expr -> expr . GT expr (rule 80) expr -> expr . GT_EQ expr (rule 81) expr -> expr . SLASH_SLASH expr (rule 82) expr -> expr . DOTX (rule 85) expr -> expr . DOTY (rule 86) expr -> expr . DOT1 (rule 87) expr -> expr . DOT2 (rule 88) expr -> expr . DOTRAD (rule 89) expr -> expr . DOTARG (rule 90) OR shift, and go to state 134 AND shift, and go to state 135 EQ_EQ shift, and go to state 136 NOT_EQ shift, and go to state 137 GT shift, and go to state 138 GT_EQ shift, and go to state 139 LT shift, and go to state 140 LT_EQ shift, and go to state 141 SLASH_SLASH shift, and go to state 142 PLUS shift, and go to state 143 MINUS shift, and go to state 144 STAR shift, and go to state 145 DIV shift, and go to state 146 MOD shift, and go to state 147 DOTX shift, and go to state 148 DOTY shift, and go to state 149 DOTARG shift, and go to state 150 DOTRAD shift, and go to state 151 DOT1 shift, and go to state 152 DOT2 shift, and go to state 153 RBRACK shift, and go to state 269 state 265 expr -> func2 LPAREN expr COMMA expr RPAREN . (rule 96) $default reduce using rule 96 (expr) state 266 expr -> func3 LPAREN expr COMMA expr COMMA . expr RPAREN (rule 97) INF shift, and go to state 3 PI shift, and go to state 4 I shift, and go to state 5 XI shift, and go to state 98 FI shift, and go to state 99 I_1 shift, and go to state 8 XI_1 shift, and go to state 9 FI_1 shift, and go to state 10 LABEL shift, and go to state 100 CIRCLE shift, and go to state 101 ELLIPSE shift, and go to state 102 RECTANGLE shift, and go to state 103 IF shift, and go to state 29 ID shift, and go to state 30 IMGFUNC shift, and go to state 31 CSTRING shift, and go to state 32 BOOL shift, and go to state 33 INUMBER shift, and go to state 34 RNUMBER shift, and go to state 35 ITOS shift, and go to state 36 RTOS shift, and go to state 37 TRUNC shift, and go to state 38 FLOAT shift, and go to state 39 SQRT shift, and go to state 40 SIN shift, and go to state 41 COS shift, and go to state 42 TAN shift, and go to state 43 ASIN shift, and go to state 44 ACOS shift, and go to state 45 ATAN shift, and go to state 46 LOG shift, and go to state 47 EXP shift, and go to state 48 RANDOM shift, and go to state 49 ROT shift, and go to state 50 SCALE shift, and go to state 51 TRANS shift, and go to state 52 REFLECT shift, and go to state 53 INTERSECT shift, and go to state 54 PARALLEL shift, and go to state 55 PERPEND shift, and go to state 56 DISTANCE shift, and go to state 57 MIDPOINT shift, and go to state 58 PT_BETWN_PTS shift, and go to state 59 COLINEAR shift, and go to state 60 INTERSECTS shift, and go to state 61 SEPARATES shift, and go to state 62 INCLUDES shift, and go to state 63 INCIDENT shift, and go to state 64 DISTLARGER shift, and go to state 65 DISTSMALLER shift, and go to state 66 NOT shift, and go to state 67 MINUS shift, and go to state 68 TILDE_SLASH shift, and go to state 69 SLASH shift, and go to state 70 LPAREN shift, and go to state 72 LBRACK shift, and go to state 73 LCURLY shift, and go to state 74 expr go to state 270 func1 go to state 85 func2 go to state 86 func3 go to state 87 identifier go to state 88 local_identifier go to state 89 local_id go to state 90 id go to state 91 state 267 expr -> ELLIPSE LPAREN expr COMMA expr COMMA expr . RPAREN (rule 65) expr -> expr . PLUS expr (rule 67) expr -> expr . MINUS expr (rule 68) expr -> expr . STAR expr (rule 69) expr -> expr . MOD expr (rule 70) expr -> expr . DIV expr (rule 71) expr -> expr . AND expr (rule 74) expr -> expr . OR expr (rule 75) expr -> expr . EQ_EQ expr (rule 76) expr -> expr . NOT_EQ expr (rule 77) expr -> expr . LT expr (rule 78) expr -> expr . LT_EQ expr (rule 79) expr -> expr . GT expr (rule 80) expr -> expr . GT_EQ expr (rule 81) expr -> expr . SLASH_SLASH expr (rule 82) expr -> expr . DOTX (rule 85) expr -> expr . DOTY (rule 86) expr -> expr . DOT1 (rule 87) expr -> expr . DOT2 (rule 88) expr -> expr . DOTRAD (rule 89) expr -> expr . DOTARG (rule 90) OR shift, and go to state 134 AND shift, and go to state 135 EQ_EQ shift, and go to state 136 NOT_EQ shift, and go to state 137 GT shift, and go to state 138 GT_EQ shift, and go to state 139 LT shift, and go to state 140 LT_EQ shift, and go to state 141 SLASH_SLASH shift, and go to state 142 PLUS shift, and go to state 143 MINUS shift, and go to state 144 STAR shift, and go to state 145 DIV shift, and go to state 146 MOD shift, and go to state 147 DOTX shift, and go to state 148 DOTY shift, and go to state 149 DOTARG shift, and go to state 150 DOTRAD shift, and go to state 151 DOT1 shift, and go to state 152 DOT2 shift, and go to state 153 RPAREN shift, and go to state 271 state 268 expr -> expr . PLUS expr (rule 67) expr -> expr . MINUS expr (rule 68) expr -> expr . STAR expr (rule 69) expr -> expr . MOD expr (rule 70) expr -> expr . DIV expr (rule 71) expr -> expr . AND expr (rule 74) expr -> expr . OR expr (rule 75) expr -> expr . EQ_EQ expr (rule 76) expr -> expr . NOT_EQ expr (rule 77) expr -> expr . LT expr (rule 78) expr -> expr . LT_EQ expr (rule 79) expr -> expr . GT expr (rule 80) expr -> expr . GT_EQ expr (rule 81) expr -> expr . SLASH_SLASH expr (rule 82) expr -> expr . DOTX (rule 85) expr -> expr . DOTY (rule 86) expr -> expr . DOT1 (rule 87) expr -> expr . DOT2 (rule 88) expr -> expr . DOTRAD (rule 89) expr -> expr . DOTARG (rule 90) expr -> PARALLEL LPAREN expr COMMA expr COMMA expr . COMMA expr RPAREN (rule 98) COMMA shift, and go to state 272 OR shift, and go to state 134 AND shift, and go to state 135 EQ_EQ shift, and go to state 136 NOT_EQ shift, and go to state 137 GT shift, and go to state 138 GT_EQ shift, and go to state 139 LT shift, and go to state 140 LT_EQ shift, and go to state 141 SLASH_SLASH shift, and go to state 142 PLUS shift, and go to state 143 MINUS shift, and go to state 144 STAR shift, and go to state 145 DIV shift, and go to state 146 MOD shift, and go to state 147 DOTX shift, and go to state 148 DOTY shift, and go to state 149 DOTARG shift, and go to state 150 DOTRAD shift, and go to state 151 DOT1 shift, and go to state 152 DOT2 shift, and go to state 153 state 269 expr -> LBRACK expr COMMA expr COMMA expr RBRACK . (rule 62) $default reduce using rule 62 (expr) state 270 expr -> expr . PLUS expr (rule 67) expr -> expr . MINUS expr (rule 68) expr -> expr . STAR expr (rule 69) expr -> expr . MOD expr (rule 70) expr -> expr . DIV expr (rule 71) expr -> expr . AND expr (rule 74) expr -> expr . OR expr (rule 75) expr -> expr . EQ_EQ expr (rule 76) expr -> expr . NOT_EQ expr (rule 77) expr -> expr . LT expr (rule 78) expr -> expr . LT_EQ expr (rule 79) expr -> expr . GT expr (rule 80) expr -> expr . GT_EQ expr (rule 81) expr -> expr . SLASH_SLASH expr (rule 82) expr -> expr . DOTX (rule 85) expr -> expr . DOTY (rule 86) expr -> expr . DOT1 (rule 87) expr -> expr . DOT2 (rule 88) expr -> expr . DOTRAD (rule 89) expr -> expr . DOTARG (rule 90) expr -> func3 LPAREN expr COMMA expr COMMA expr . RPAREN (rule 97) OR shift, and go to state 134 AND shift, and go to state 135 EQ_EQ shift, and go to state 136 NOT_EQ shift, and go to state 137 GT shift, and go to state 138 GT_EQ shift, and go to state 139 LT shift, and go to state 140 LT_EQ shift, and go to state 141 SLASH_SLASH shift, and go to state 142 PLUS shift, and go to state 143 MINUS shift, and go to state 144 STAR shift, and go to state 145 DIV shift, and go to state 146 MOD shift, and go to state 147 DOTX shift, and go to state 148 DOTY shift, and go to state 149 DOTARG shift, and go to state 150 DOTRAD shift, and go to state 151 DOT1 shift, and go to state 152 DOT2 shift, and go to state 153 RPAREN shift, and go to state 273 state 271 expr -> ELLIPSE LPAREN expr COMMA expr COMMA expr RPAREN . (rule 65) $default reduce using rule 65 (expr) state 272 expr -> PARALLEL LPAREN expr COMMA expr COMMA expr COMMA . expr RPAREN (rule 98) INF shift, and go to state 3 PI shift, and go to state 4 I shift, and go to state 5 XI shift, and go to state 98 FI shift, and go to state 99 I_1 shift, and go to state 8 XI_1 shift, and go to state 9 FI_1 shift, and go to state 10 LABEL shift, and go to state 100 CIRCLE shift, and go to state 101 ELLIPSE shift, and go to state 102 RECTANGLE shift, and go to state 103 IF shift, and go to state 29 ID shift, and go to state 30 IMGFUNC shift, and go to state 31 CSTRING shift, and go to state 32 BOOL shift, and go to state 33 INUMBER shift, and go to state 34 RNUMBER shift, and go to state 35 ITOS shift, and go to state 36 RTOS shift, and go to state 37 TRUNC shift, and go to state 38 FLOAT shift, and go to state 39 SQRT shift, and go to state 40 SIN shift, and go to state 41 COS shift, and go to state 42 TAN shift, and go to state 43 ASIN shift, and go to state 44 ACOS shift, and go to state 45 ATAN shift, and go to state 46 LOG shift, and go to state 47 EXP shift, and go to state 48 RANDOM shift, and go to state 49 ROT shift, and go to state 50 SCALE shift, and go to state 51 TRANS shift, and go to state 52 REFLECT shift, and go to state 53 INTERSECT shift, and go to state 54 PARALLEL shift, and go to state 55 PERPEND shift, and go to state 56 DISTANCE shift, and go to state 57 MIDPOINT shift, and go to state 58 PT_BETWN_PTS shift, and go to state 59 COLINEAR shift, and go to state 60 INTERSECTS shift, and go to state 61 SEPARATES shift, and go to state 62 INCLUDES shift, and go to state 63 INCIDENT shift, and go to state 64 DISTLARGER shift, and go to state 65 DISTSMALLER shift, and go to state 66 NOT shift, and go to state 67 MINUS shift, and go to state 68 TILDE_SLASH shift, and go to state 69 SLASH shift, and go to state 70 LPAREN shift, and go to state 72 LBRACK shift, and go to state 73 LCURLY shift, and go to state 74 expr go to state 274 func1 go to state 85 func2 go to state 86 func3 go to state 87 identifier go to state 88 local_identifier go to state 89 local_id go to state 90 id go to state 91 state 273 expr -> func3 LPAREN expr COMMA expr COMMA expr RPAREN . (rule 97) $default reduce using rule 97 (expr) state 274 expr -> expr . PLUS expr (rule 67) expr -> expr . MINUS expr (rule 68) expr -> expr . STAR expr (rule 69) expr -> expr . MOD expr (rule 70) expr -> expr . DIV expr (rule 71) expr -> expr . AND expr (rule 74) expr -> expr . OR expr (rule 75) expr -> expr . EQ_EQ expr (rule 76) expr -> expr . NOT_EQ expr (rule 77) expr -> expr . LT expr (rule 78) expr -> expr . LT_EQ expr (rule 79) expr -> expr . GT expr (rule 80) expr -> expr . GT_EQ expr (rule 81) expr -> expr . SLASH_SLASH expr (rule 82) expr -> expr . DOTX (rule 85) expr -> expr . DOTY (rule 86) expr -> expr . DOT1 (rule 87) expr -> expr . DOT2 (rule 88) expr -> expr . DOTRAD (rule 89) expr -> expr . DOTARG (rule 90) expr -> PARALLEL LPAREN expr COMMA expr COMMA expr COMMA expr . RPAREN (rule 98) OR shift, and go to state 134 AND shift, and go to state 135 EQ_EQ shift, and go to state 136 NOT_EQ shift, and go to state 137 GT shift, and go to state 138 GT_EQ shift, and go to state 139 LT shift, and go to state 140 LT_EQ shift, and go to state 141 SLASH_SLASH shift, and go to state 142 PLUS shift, and go to state 143 MINUS shift, and go to state 144 STAR shift, and go to state 145 DIV shift, and go to state 146 MOD shift, and go to state 147 DOTX shift, and go to state 148 DOTY shift, and go to state 149 DOTARG shift, and go to state 150 DOTRAD shift, and go to state 151 DOT1 shift, and go to state 152 DOT2 shift, and go to state 153 RPAREN shift, and go to state 275 state 275 expr -> PARALLEL LPAREN expr COMMA expr COMMA expr COMMA expr RPAREN . (rule 98) $default reduce using rule 98 (expr) state 276 $ go to state 277 state 277 $default accept SLASH shift, and go to state 70 LPAREN shift, and go to state 72 LBRACK shift, and go to state 73 LCURLtkeden1.41/Donald/parser.y010060000025250000164000000425530740377033100155160ustar00ashleyem00003510000005%{ /* * $Id: parser.y,v 1.16 2001/12/06 22:27:37 cssbz Exp $ */ /* This is from the Autoconf manual. Note the pragma directive is indented so that pre-ANSI C compilers will ignore it. [Ash] */ /* AIX requires this to be the first thing in the file */ #ifdef __GNUC__ # define alloca __builtin_alloca #else # if HAVE_ALLOCA_H # include # else # ifdef _AIX #pragma alloca # else # ifndef alloca /* predefined by HP cc +Olibcalls */ char *alloca (); # endif # endif # endif #endif static char rcsid[] = "$Id: parser.y,v 1.16 2001/12/06 22:27:37 cssbz Exp $"; #include "../config.h" #include #include #include #include "tree.h" #include "symbol.h" #include "error.h" #include "../Eden/error.h" #include "oper.h" #include "../EX/script.h" #include "../Eden/emalloc.h" #ifdef HAVE_DMALLOC #include #endif #define YYERROR_VERBOSE 1 #ifdef DEBUG extern int Debug; #define display(a) if (Debug & 16) fprintf(stderr, a) #define display2(a,i) if (Debug & 16) fprintf(stderr, a, i) #endif #ifndef DEBUG #define display(a) /* nothing */ #define display2(a,i) /* nothing */ #endif #define ERROR -1 extern Script *dd_script; extern int _changed; extern void eden_declare(char *, int, char *); extern void declare_openshape(void); extern void Declare(int, tree); extern void DeclareGraph(tree); extern void Define(tree, tree); extern void DefineFunc(int, tree); extern void Delete(tree); extern int reset_context(void); extern void change_scope(tree); extern void resume_scope(void); extern int count_id(tree); extern int count_expr(tree); extern void freeTree(tree); extern void yyerror(char *); extern char *expr_to_donald_name(tree); extern char *expr_to_eden_name(tree); extern char *eden_full_name(char *); static char *withinName; static char temp[256]; extern int dd_appAgentName; #ifdef DISTRIB extern void propagateDonaldDef(char *, char *); /* for agency --sun */ extern int handle_check1(char *); int withinHandle=1; #endif /* DISTRIB */ %} %union { char *s; /* identifier, etc */ int i; /* integer value */ double r; /* floating point value */ tree t; /* expression tree */ } %token INF PI %token I XI FI I_1 XI_1 FI_1 %token IMAGE %token MYCHAR %token REAL %token INT BOOLEAN POINT LABEL GSPEC GSPECLIST ANY %token LINE CIRCLE ELLIPSE SHAPE OPENSHAPE ARC RECTANGLE %token GRAPH OF %token VIEWPORT %token DELETE %token WITHIN %token IF THEN ELSE %token ID IMGFUNC %token CSTRING %token BOOL %token INUMBER %token RNUMBER %token ITOS RTOS %token TRUNC FLOAT %token SQRT SIN COS TAN ASIN ACOS ATAN LOG EXP RANDOM %token ROT SCALE TRANS REFLECT %token INTERSECT %token PARALLEL PERPEND DISTANCE %token MIDPOINT PT_BETWN_PTS %token COLINEAR INTERSECTS SEPARATES INCLUDES INCIDENT %token DISTLARGER DISTSMALLER /* %token DRAW %token MONITOR IMPOSE %token ALIAS AS %token FOR IN RANGE */ %token QUERY %type type_name func1 func2 func3 %type expr expr_list identifier local_identifier id local_id %type graph_spec graph_spec_list /* %type within_id %type defn_monitor defn_impose */ %left SEMICOLON %left COLON %right EQUALS %left COMMA /* %nonassoc DOTDOT */ %left ELSE %left OR %left AND %right NOT %left EQ_EQ NOT_EQ %left GT GT_EQ LT LT_EQ %left SLASH_SLASH %nonassoc ATSIGN %left PLUS MINUS %left STAR PERCENT DIV MOD %left TILDE TILDE_SLASH %left DOTX DOTY DOTARG DOTRAD %left DOT1 DOT2 %right UMINUS %left SLASH %nonassoc LID %nonassoc AMPERSAND HASH VERTBAR NEWLINE %nonassoc LPAREN RPAREN LBRACK RBRACK %nonassoc LCURLY RCURLY LANGLE RANGLE %expect 11 %% /*----- grammar -----*/ program_list: /* nothing */ | program_list stmt { dd_script->ready = 1; } | program_list error { yyerrok; } ; stmt: VIEWPORT ID { eden_declare($2, VIEWPORT, $2); } | declaration { if (_changed) { declare_openshape(); _changed = 0; } #ifdef DEBUG if (Debug & 16) print_all_symbols(); #endif } | definition | { appendEden("%+eden\n", dd_script); } evaluation { appendEden("%-eden\n", dd_script); } | within_clause { #ifdef DISTRIB withinHandle = 1; #endif /* DISTRIB */ } | delete { if (_changed) { declare_openshape(); _changed = 0; } } | NEWLINE /* null statement */ /* | defn_monitor { if (_changed) { declare_openshape(); _changed = 0; } } | defn_impose { if (_changed) { declare_openshape(); _changed = 0; } } | draw | alias | inside */ ; delete: DELETE expr_list NEWLINE { Delete($2); } ; /* draw: DRAW NEWLINE { draw_gfx(0); } | DRAW identifier NEWLINE { count_id($2); draw_gfx($2); free($2); } ; */ within_id: WITHIN identifier { #ifdef DISTRIB withinName = strdup(expr_to_eden_name($2)); /* within door {} - this finds 'door' */ if (handle_check1(withinName)) { /* The current agent is allowed to change the contents of the variable 'withinName' */ dd_appAgentName--; /* we don't need to prepend the agent name any more */ withinHandle = 1; sprintf(temp, "%%donald\nwithin %s {\n%%eden\n", expr_to_donald_name($2)); propagateDonaldDef(withinName, temp); change_scope($2); freeTree($2); /* propagateAgency1(withinName, temp); */ } else { withinHandle = 0; } #else dd_appAgentName--; change_scope($2); freeTree($2); #endif /* DISTRIB */ } ; within_clause: within_id stmt { #ifdef DISTRIB if (withinHandle) { resume_scope(); propagateDonaldDef(withinName, "%donald\n}\n%eden\n"); }; withinHandle = 1; dd_appAgentName++; #else dd_appAgentName++; resume_scope(); #endif } | within_id NEWLINE LCURLY stmt_list RCURLY { #ifdef DISTRIB if (withinHandle) { resume_scope(); propagateDonaldDef(withinName, "%donald\n}\n%eden\n"); }; withinHandle = 1; dd_appAgentName++; #else dd_appAgentName++; resume_scope(); #endif } | within_id LCURLY stmt_list RCURLY { #ifdef DISTRIB if (withinHandle) { resume_scope(); propagateDonaldDef(withinName, "%donald\n}\n%eden\n"); } withinHandle = 1; dd_appAgentName++; #else dd_appAgentName++; resume_scope(); #endif } ; stmt_list: stmt { dd_script->ready = 1; } | stmt_list stmt { dd_script->ready = 1; } ; declaration: type_name expr_list NEWLINE { #ifdef DISTRIB if (withinHandle) { Declare($1, $2); } else { freeTree($2); } #else Declare($1, $2); #endif /* DISTRIB */ } | GRAPH expr_list { DeclareGraph($2); } ; /* defn_monitor: MONITOR expr EQUALS expr COMMA expr COMMA expr NEWLINE { int no_id; tree mon_exp; mon_exp = dtree3(OP_MONITOR, $6, $4, $8); declare2(MONITOR, $2); if ((no_id = count_id($2)) == ERROR) don_err(IdListExpect, 0); if (no_id != count_expr(mon_exp)) don_err(IdExprUnmatch, 0); if (no_id > 1) appendEden("autocalc = OFF;\n", dd_script); Define($2, mon_exp); freeTree(mon_exp); if (no_id > 1) appendEden("autocalc = ON;\n", dd_script); } ; defn_impose: IMPOSE expr_list EQUALS expr NEWLINE { int no_id; tree imp_exp; imp_exp = dtree1(OP_IMPOSE, $4); declare2(IMPOSE, $2); if ((no_id = count_id($2)) == ERROR) don_err(IdListExpect, 0); if (no_id != count_expr(imp_exp)) don_err(IdExprUnmatch, 0); if (no_id > 1) appendEden("autocalc = OFF;\n", dd_script); Define($2, imp_exp); freeTree(imp_exp); if (no_id > 1) appendEden("autocalc = ON;\n", dd_script); } ; */ type_name: INT { $$ = INT; } | REAL { $$ = REAL; } | MYCHAR { $$ = MYCHAR; } | BOOLEAN { $$ = BOOLEAN; } | POINT { $$ = POINT; } | LINE { $$ = LINE; } | ARC { $$ = ARC; } | CIRCLE { $$ = CIRCLE; } | ELLIPSE { $$ = ELLIPSE; } | LABEL { $$ = LABEL; } | SHAPE { $$ = SHAPE; } | OPENSHAPE { $$ = OPENSHAPE; } | IMAGE { $$ = IMAGE; } | RECTANGLE { $$ = RECTANGLE; } ; definition: expr_list EQUALS expr_list NEWLINE { #ifdef DISTRIB if (withinHandle) { #endif /* DISTRIB */ int no_id; tree t1 = $1; tree t3 = $3; if ((no_id = count_id(t1)) == ERROR) don_err(IdListExpect, 0); if (no_id != count_expr(t3)) don_err(IdExprUnmatch, 0); if (no_id > 1) appendEden("autocalc = OFF;\n", dd_script); if (t3->type == ANY) t3->type = t1->type; Define(t1, t3); freeTree(t1); freeTree(t3); if (no_id > 1) appendEden("autocalc = ON;\n", dd_script); #ifdef DISTRIB } else { freeTree($1); freeTree($3); } #endif /* DISTRIB */ } | XI EQUALS expr NEWLINE { count_expr($3); DefineFunc(XI, $3); freeTree($3); } | FI EQUALS expr NEWLINE { count_expr($3); DefineFunc(FI, $3); freeTree($3); } ; evaluation: QUERY NEWLINE { appendEden($1, dd_script); appendEden("\n", dd_script); free($1); } | evaluation QUERY NEWLINE { appendEden($2, dd_script); appendEden("\n", dd_script); free($2); } ; expr_list: expr | expr_list COMMA expr { $$ = dtree2(OP_COMMA, $1, $3); } /* | range | range COMMA expr_list { display("range,expr_list\n"); } */ ; /* alias: ALIAS expr_list AS expr_list ; inside: ENTER expr DO stmt_list EXIT ; range: iterator { display("iterator\n"); } | subrange { display("subrange\n"); } | expr LBRACK STAR RBRACK | expr LCURLY STAR RCURLY | expr SLASH STAR | expr HASH STAR | expr AMPERSAND STAR ; iterator: LANGLE FOR type_name IN expr_list RANGE expr RANGLE ; subrange: expr DOTDOT expr { display("expr..expr "); } ; range_list: type_name ID | range_list COMMA type_name ID IN range ; */ expr: /* constants */ INF { $$ = dtree0(OP_INF); } | PI { $$ = dtree0(OP_PI); $$->type = REAL; Rvalue($$) = 3.141593; } | INUMBER { $$ = dtree0(OP_INUMBER); $$->type = INT; Ivalue($$) = $1; } | RNUMBER { $$ = dtree0(OP_RNUMBER); $$->type = REAL; Rvalue($$) = $1; display2("rnumber(%lf) ", $1); } | CSTRING { $$ = dtree0(OP_CSTRING); $$->type = MYCHAR; Cvalue($$) = $1; display2("cstring(%s) ", $1); } | BOOL { $$ = dtree0(OP_BOOL); $$->type = BOOLEAN; Bvalue($$) = $1; } /* graph related variables */ | I { $$ = dtree0(OP_I); $$->type = INT; } | XI { $$ = dtree0(OP_XI); $$->type = REAL; } | FI { $$ = dtree0(OP_FI); $$->type = REAL; } | I_1 { $$ = dtree0(OP_I_1); $$->type = INT; } | XI_1 { $$ = dtree0(OP_XI_1); $$->type = REAL; } | FI_1 { $$ = dtree0(OP_FI_1); $$->type = REAL; } /* graph spec */ | LBRACK graph_spec_list RBRACK { $$ = $2; } | LBRACK NEWLINE graph_spec_list RBRACK { $$ = $3; } /* variable */ | identifier %prec LID /* eden variable */ | ID NOT { $$ = dtree2(OP_EDEN, $1); } /* ( expr ) */ | LPAREN expr RPAREN { $$ = dtree1(OP_PAREN, $2); } /* constructors */ | LCURLY expr COMMA expr RCURLY { $$ = dtree2(OP_CART, $2, $4); } | LCURLY expr ATSIGN expr RCURLY { $$ = dtree2(OP_POLAR, $2, $4); } | LBRACK expr COMMA expr RBRACK { $$ = dtree2(OP_LINE, $2, $4); } | LBRACK expr COMMA expr COMMA expr RBRACK { $$ = dtree3(OP_ARC, $2, $4, $6); } | CIRCLE LPAREN expr COMMA expr RPAREN { $$ = dtree2(OP_CIRCLE, $3, $5); } | RECTANGLE LPAREN expr COMMA expr RPAREN { $$ = dtree2(OP_RECTANGLE, $3, $5); } | ELLIPSE LPAREN expr COMMA expr COMMA expr RPAREN { $$ = dtree3(OP_ELLIPSE, $3, $5, $7); } | LABEL LPAREN expr COMMA expr RPAREN { $$ = dtree2(OP_LABEL, $3, $5); } /* arithmetic expressions */ | expr PLUS expr { $$ = dtree2(OP_PLUS, $1, $3); } | expr MINUS expr { $$ = dtree2(OP_MINUS, $1, $3); } | expr STAR expr { $$ = dtree2(OP_MULT, $1, $3); } | expr MOD expr { $$ = dtree2(OP_MOD, $1, $3); } | expr DIV expr { $$ = dtree2(OP_DIV, $1, $3); } | MINUS expr %prec UMINUS { $$ = dtree1(OP_UMINUS, $2); } /* logic expressions */ /* | TILDE expr { $$ = dtree1(OP_TILDE, $2); } */ | NOT expr { $$ = dtree1(OP_NOT, $2); } | expr AND expr { $$ = dtree2(OP_AND, $1, $3); } | expr OR expr { $$ = dtree2(OP_OR, $1, $3); } | expr EQ_EQ expr { $$ = dtree2(OP_EQ_EQ, $1, $3); } | expr NOT_EQ expr { $$ = dtree2(OP_NOT_EQ, $1, $3); } | expr LT expr { $$ = dtree2(OP_LT, $1, $3); } | expr LT_EQ expr { $$ = dtree2(OP_LT_EQ, $1, $3); } | expr GT expr { $$ = dtree2(OP_GT, $1, $3); } | expr GT_EQ expr { $$ = dtree2(OP_GT_EQ, $1, $3); } /* string expressions */ | expr SLASH_SLASH expr { $$ = dtree2(OP_SLASH_SLASH, $1, $3); } | ITOS LPAREN expr RPAREN { $$ = dtree1(OP_ITOS, $3); } | RTOS LPAREN expr COMMA expr RPAREN { $$ = dtree2(OP_RTOS, $3, $5); } /* selectors */ | expr DOTX { $$ = dtree1(OP_DOTX, $1); } | expr DOTY { $$ = dtree1(OP_DOTY, $1); } | expr DOT1 { $$ = dtree1(OP_DOT1, $1); } | expr DOT2 { $$ = dtree1(OP_DOT2, $1); } | expr DOTRAD { $$ = dtree1(OP_DOTRAD, $1); } | expr DOTARG { $$ = dtree1(OP_DOTARG, $1); } /* functions */ | ID NOT LPAREN RPAREN { $$ = dtree2(OP_FUNC, $1, 0); } | ID NOT LPAREN expr_list RPAREN { $$ = dtree2(OP_FUNC, $1, $4); } | IMGFUNC LPAREN RPAREN { $$ = dtree2(OP_IMGFUNC, $1, 0); } | IMGFUNC LPAREN expr_list RPAREN { $$ = dtree2(OP_IMGFUNC, $1, $3); } | func1 LPAREN expr RPAREN { $$ = dtree1($1, $3); } | func2 LPAREN expr COMMA expr RPAREN { $$ = dtree2($1, $3, $5); } | func3 LPAREN expr COMMA expr COMMA expr RPAREN { $$ = dtree3($1, $3, $5, $7); } | PARALLEL LPAREN expr COMMA expr COMMA expr COMMA expr RPAREN { $$ = dtree4(OP_PARALLEL, $3, $5, $7, $9); } /* conditional expression */ | IF expr THEN expr ELSE expr %prec ELSE { $$ = dtree3(OP_IF, $4, $2, $6); } /* | VERTBAR expr VERTBAR */ ; func1: SQRT { $$ = OP_SQRT; } | SIN { $$ = OP_SIN; } | COS { $$ = OP_COS; } | TAN { $$ = OP_TAN; } | ASIN { $$ = OP_ASIN; } | ACOS { $$ = OP_ACOS; } | ATAN { $$ = OP_ATAN; } | LOG { $$ = OP_LOG; } | EXP { $$ = OP_EXP; } | TRUNC { $$ = OP_TRUNC; } | FLOAT { $$ = OP_FLOAT; } | MIDPOINT { $$ = OP_MIDPOINT; } | RANDOM { $$ = OP_RANDOM; } ; func2: INTERSECT { $$ = OP_INTERSECT; } | PERPEND { $$ = OP_PERPEND; } | DISTANCE { $$ = OP_DISTANCE; } | SCALE { $$ = OP_SCALE; } | INTERSECTS { $$ = OP_INTERSECTS; } | INCLUDES { $$ = OP_INCLUDES; } | INCIDENT { $$ = OP_INCIDENT; } | REFLECT { $$ = OP_REFLECT; } ; func3: ROT { $$ = OP_ROT; } | TRANS { $$ = OP_TRANS; } | PT_BETWN_PTS { $$ = OP_PT_BETWN_PTS; } | COLINEAR { $$ = OP_COLINEAR; } | SEPARATES { $$ = OP_SEPARATES; } | DISTLARGER { $$ = OP_DISTLARGER; } | DISTSMALLER { $$ = OP_DISTSMALLER; } ; identifier: local_identifier | SLASH local_identifier { $$ = dtree2(OP_GLOBAL, $2); } ; local_identifier: local_id SLASH local_identifier { $$ = dtree2(OP_SLASH, $1, $3); } | TILDE_SLASH local_identifier { $$ = dtree2(OP_SLASH, dtree1(OP_ID, 0), $2); dd_appAgentName--; } | local_id ; local_id: id %prec LID ; id: ID { $$ = dtree1(OP_ID, $1); } ; graph_spec_list: /* nothing */ { $$ = dtree2(OP_GSPECLIST, 0, 0); } | graph_spec | graph_spec_list SEMICOLON graph_spec { $$ = dtree2(OP_GSPECLIST, $1, $3); } | graph_spec_list SEMICOLON NEWLINE graph_spec { $$ = dtree2(OP_GSPECLIST, $1, $4); } ; graph_spec: type_name COLON { $$ = dtree2(OP_GSPEC, 0, (tree)$1); } | type_name COLON expr { $$ = dtree2(OP_GSPEC, $3, (tree)$1); } | type_name COLON NEWLINE { $$ = dtree2(OP_GSPEC, 0, (tree)$1); } | type_name COLON expr NEWLINE { $$ = dtree2(OP_GSPEC, $3, (tree)$1); } ; %% void yyerror(char *s) { don_err(Unclassified, s); } static char *errorstring[] = {ERRORSTRINGS}; /*---------------------------------------------------+---------+ | don_err | +---------*/ #include extern Tcl_Interp *interp; void don_err(enum errorcodes error_code, char *s) { extern void yyrestart(void); extern int yy_parse_init; char errStr[120]; Tcl_DString err, message; yyrestart(); /* reset lexical analyzer */ yy_parse_init = 1; /* reset bison */ deleteScript(dd_script); sprintf(errStr, errorstring[(int) error_code], s); if (reset_context() > 0) { strcat(errStr, " (context was reset)"); } errorf("DoNaLD: %s", errStr); } #ifdef DISTRIB /* This is a sort of drop-in replacement for appendEden, but with distribution [Ash, with Sun] */ void propagateDonaldDef(char *name, char *s) { extern void appendEden(char *, Script *); appendEden("propagate(\"", dd_script); appendEden(name, dd_script); appendEden("\", \"", dd_script); appendEden(s, dd_script); appendEden("\");\n", dd_script); } #endif /* DISTRIB */ tkeden1.41/Donald/symbol.c010060000025250000164000001026760733227744300155130ustar00ashleyem00003510000005/* * $Id: symbol.c,v 1.14 2001/08/02 16:26:11 cssbz Exp $ */ /* This handles the encoding of Donald definitions in Eden [Ash, with Sun] */ static char rcsid[] = "$Id: symbol.c,v 1.14 2001/08/02 16:26:11 cssbz Exp $"; #include #include #include #include #include "../config.h" #include "error.h" #include "tree.h" #include "symbol.h" #include "oper.h" #include "parser.h" #include "../EX/script.h" #include "../Eden/emalloc.h" #ifdef HAVE_DMALLOC #include #endif extern Tcl_Interp *interp; extern void *getmem(int); extern char *map_token_to_name(int); #ifdef DISTRIB extern void propagateDonaldDef(char *, char *); extern int handle_check1(char *); extern int withinHandle; #endif /* DISTRIB */ /* Code for debugging appendEden(char *s, Script *d) { appendEden(s, d); printf("%s", s); } */ Script *dd_script; static char temp[256]; /* maximum number of openshapes */ #define MAXCONTEXT 128 int _changed = 0; /* to prevent multiple redefinition of _ on e.g. int i,j */ static symbol *GlobalSymbols = SymEnd; static struct c { symbol *sym; symbol **table; } context[MAXCONTEXT] = { { SymEnd, &GlobalSymbols }, { 0, 0 } }; /* to do with monitor, now obsolete struct d { char *name; struct d *next; } *MonTable = (struct d *) 0; */ #define PARENT 0 #define SymbolTable *context[indx].table static struct c NORMAL = {SymEnd}; static int indx = 0; /* always points at the toppest context */ static int backindx = 0; /* always points at the toppest backcontext */ static struct c backcontext[MAXCONTEXT]; /* contains what change of context should takes when resume_context() */ char viewport_name[64]; /* function prototypes */ void change_prompt(void); void change_context(symbol *); void resume_context(void); int reset_context(void); void backup_context(void); void restore_context(void); static void change_scope2(tree); void change_scope(tree); void resume_scope(void); symbol *symbol_search(char *); symbol *context_search(char *); symbol *new_symbol(char *); void free_symbol(symbol *); symbol *look_up(char *); symbol *look_up_tree(tree); symbol *look_prev(char *); void declare_openshape(void); void declare_action(char *, char *, char *); void eden_delete(symbol *, char *); void eden_declare(char *, int, char *); void Declare(int, tree); void DeclareGraph(tree); void Delete(tree); void print_symbol_table(int, symbol *); void print_all_symbols(void); char *donald_full_name(char *); char *eden_full_name(char *); char *expr_to_donald_name(tree); char *expr_to_eden_name(tree); #ifdef DISTRIB int isGraph = 0; /* variables of graph do not be propagated, because we don't understand how the Donald graph function works! [Ash, with Sun] */ #endif /* DISTRIB */ static int isGraphAttr(char *); static void indent(int); static void insert_nl(void); static void dumpDonaldDeclaration(int, symbol *, int); static void dumpDonaldDefinition(int, symbol *); int dumpdonald(void); /*---------------------------------------------+---------------+ | change_prompt | +---------------*/ void change_prompt(void) { /* set dd_prompt to the current context */ extern char *dd_prompt; char *s; char *t; int i; int len; int prompt_len; prompt_len = strlen(dd_prompt); for (len = 0, i = 1; i <= indx; i++, len += strlen(t)) { t = context[i].sym->name; } if (prompt_len < len + 3 + indx) { dd_prompt = (char *) erealloc(dd_prompt, prompt_len + len + 3 + indx); } s = dd_prompt; strcpy(s, "["); s += 1; for (i = 1; i <= indx; i++) { t = context[i].sym->name; len = strlen(t); *s++ = '/'; strcpy(s, t); s += len; } if (indx) strcpy(s, "]"); else strcpy(s, "/]"); } /*--------------------------------------------+----------------+ | change_context | +----------------*/ void change_context(symbol * sym) { /* change context to sym */ if (sym == SymEnd) { /* ~ */ if (backindx > MAXCONTEXT) don_err(StackOverflow, "context "); backcontext[backindx++] = context[indx]; if (indx == 0) don_err(StackUnderflow, "context "); else --indx; } else { if (backindx > MAXCONTEXT) don_err(StackOverflow, "context "); backcontext[backindx++] = NORMAL; if (indx++ >= MAXCONTEXT) don_err(StackOverflow, "context "); context[indx].sym = sym; context[indx].table = &sym->derived; } } /*--------------------------------------------+----------------+ | resume_context | +----------------*/ void resume_context(void) { struct c cnt; if (backindx <= 0) don_err(StackUnderflow, "context "); cnt = backcontext[--backindx]; if (cnt.sym == SymEnd) { if (indx == 0) don_err(StackUnderflow, "context "); else --indx; } else { if (indx++ >= MAXCONTEXT) don_err(StackOverflow, "context "); context[indx] = cnt; } } /*---------------------------------------------+---------------+ | reset_context | +---------------*/ int reset_context(void) { /* cd root */ int ix = indx; indx = 0; /* root */ backindx = 0; return ix; } static int MaxBackupContext = 0; static int backupContextSize = 0; static struct c *backupContext = 0; static int MaxBackupIndx = 0; static int backupIndxSize = 0; static int *backupIndx = 0; /*--------------------------------------------+----------------+ | backup_context | +----------------*/ void backup_context(void) { int i; if (backupContext == 0) { backupContext = (struct c *) emalloc(sizeof(struct c) * (backindx + indx + 1)); MaxBackupContext = backindx + indx + 1; } else if (MaxBackupContext < backupContextSize + backindx + indx + 1) { backupContext = (struct c *) erealloc(backupContext, sizeof(struct c) * (backupContextSize + backindx + indx + 1)); MaxBackupContext = backupContextSize + backindx + indx + 1; } if (backupIndx == 0) { backupIndx = (int *) emalloc(sizeof(int) * 2); MaxBackupIndx = 2; } else if (MaxBackupIndx < backupIndxSize + 2) { backupIndx = (int *) erealloc(backupIndx, sizeof(int) * (backupIndxSize + 2)); MaxBackupIndx = backupIndxSize + 2; } for (i = 0; i <= indx; i++) backupContext[backupContextSize + i] = context[i]; backupIndx[backupIndxSize++] = indx; for (i = 0; i < backindx; i++) backupContext[backupContextSize + indx + 1 + i] = backcontext[i]; backupIndx[backupIndxSize++] = backindx; backupContextSize += indx + 1 + backindx; } /*-------------------------------------------+-----------------+ | restore_context | +-----------------*/ void restore_context(void) { int i; for (i = (backindx = backupIndx[--backupIndxSize]) - 1; i >= 0; --i) backcontext[i] = backupContext[--backupContextSize]; for (i = (indx = backupIndx[--backupIndxSize]); i >= 0; --i) context[i] = backupContext[--backupContextSize]; } /*---------------------------------------------+---------------+ | change_scope2 | +---------------*/ /* actually change the scope, called by change_scope */ static void change_scope2(tree expr) { /* int ix = indx; */ switch (expr->op) { case OP_ID: change_context(context_search((char *) Lexpr)); break; case OP_SLASH: change_context(context_search((char *) Lexpr->left)); change_scope2(Rexpr); break; case OP_GLOBAL: reset_context(); change_scope2(Lexpr); break; default: restore_context(); don_err(Impossible, "change_scope"); } } /*----------------------------------------------+--------------+ | change_scope | +--------------*/ void change_scope(tree expr) { backup_context(); change_scope2(expr); } /*----------------------------------------------+--------------+ | resume_scope | +--------------*/ void resume_scope(void) { restore_context(); } /*---------------------------------------------+---------------+ | symbol_search | +---------------*/ symbol * symbol_search(char *name) { symbol *sym; if (!(sym = look_up(name))) don_err(UndeclareID, donald_full_name(name)); return sym; } /*--------------------------------------------+----------------+ | context_search | +----------------*/ symbol * context_search(char *name) { symbol *sym; if (name == PARENT) return SymEnd; if (!(sym = look_up(name))) don_err(UndeclareID, donald_full_name(name)); if (sym->type != OPENSHAPE && sym->type != GRAPH) don_err(NotOpenshapeOrGraph, donald_full_name(name)); return sym; } /*------------------------------------------------+------------+ | new_symbol | +------------*/ symbol * new_symbol(char *name) { /* creat a new symbol in current context */ symbol *sym; /* Make sure it is new */ sym = (symbol *) getmem(sizeof(symbol)); sym->name = name; sym->type = UNDEFINED; /* not defined */ sym->defn.t = 0; /* not defined */ sym->master = topMasterStack(); sym->derived = SymEnd; sym->next = SymbolTable; return SymbolTable = sym; } /*-----------------------------------------------+-------------+ | free_symbol | +-------------*/ void free_symbol(symbol * sym) { /* free the storage occupied by sym */ extern void freeTree(tree); if (sym->name) free(sym->name); if (sym->viewport) free(sym->viewport); if (sym->defn.t && sym->type != GRAPH) freeTree(sym->defn.t); free(sym); } /* to do with monitor, now obsolete |*------------------------------------------------+------------+ | mon_symbol | +------------*| void mon_symbol(char *name) |* creat a new symbol in current context *| { struct d *d; |* Make sure it is new *| d = (struct d *) getmem(sizeof(struct d)); d->name = name; d->next = MonTable; MonTable = d; } */ /*---------------------------------------------------+---------+ | look_up | +---------*/ symbol * look_up(char *name) { /* look up the symbol in current context */ symbol *sym; for (sym = SymbolTable; sym != SymEnd; sym = sym->next) { if (strcmp(sym->name, name) == 0) break; /* found */ } return sym; /* sym == SymEnd if not found */ } /*----------------------------------------------+--------------+ | look_up_tree | +--------------*/ symbol * look_up_tree(tree expr) { /* look up the symbol in current context */ symbol *sym; int count; if (expr->op == OP_GLOBAL) { backup_context(); reset_context(); sym = look_up_tree(Lexpr); restore_context(); return sym; } for (count = 0; expr->op == OP_SLASH; count++, expr = Rexpr) change_context(context_search((char *) Lexpr->left)); /* Now, expr->op should be OP_ID */ for (sym = SymbolTable; sym != SymEnd; sym = sym->next) { if (Lexpr && strcmp(sym->name, (char *) Lexpr) == 0) break; /* found */ } while (count--) resume_context(); return sym; /* sym == SymEnd if not found */ } /*---------------------------------------------------+-----------+ | look_prev | +-----------*/ symbol * look_prev(char *name) { /* look up the symbol before name in current context */ symbol *sym, *sym_prev; sym_prev = SymEnd; for (sym = SymbolTable; sym != SymEnd; sym = sym->next) { if (strcmp(sym->name, name) == 0) break; /* found */ sym_prev = sym; } return sym_prev; /* sym == SymEnd if not found */ } static char x_default_graph[] = "SetGraph(\"%s\",\"%s\"); %s_viewport = \"%s\";\n"; #define declare_graph(id, did, vp) \ sprintf(temp, x_default_graph, id, did, id, vp);\ appendEden(temp, dd_script); /*------------------------------------------+-------------------+ | declare_openshape | +-------------------*/ /* sym is [ OPENSHAPE, sym/a, sym/b, ... ] */ void declare_openshape(void) { symbol *s; /*----- print the context name -----*/ /* indx == 0 --> root */ sprintf(temp, "%s is [ OPENSHAPE", indx ? eden_full_name(0) : "_"); appendEden(temp, dd_script); s = indx ? context[indx].sym->derived : *context[0].table; for (; s != SymEnd; s = s->next) { if (strcmp(s->name, "x") == 0) { /* printf("xi = %s", s->name); */ sprintf(temp, ", &%s", eden_full_name("_xi_")); } else if (strcmp(s->name, "f") == 0) { /* printf("fi = %s", s->name); */ sprintf(temp, ", &%s", eden_full_name("_fi_")); } else { /* printf("wwi = %s", s->name); */ sprintf(temp, ", &%s", eden_full_name(s->name)); } appendEden(temp, dd_script); } appendEden(" ];\n", dd_script); } /*-----------------------------------------------+--------------+ | eden_declare | +--------------*/ static char x_default_attr[] = "A%s = NullStr;\n"; static char x_draw_act[] = "proc P%s:%s, A%s, %s\n{\n\t%s(%s, &%s, &A%s);\n}\n"; #define declare_attribute(id) \ sprintf(temp, x_default_attr, id);\ appendEden(temp, dd_script); void declare_action(char *id, char *proc_name, char *vp) /* viewport name */ { if (!*vp) { strcpy(viewport_name, "DoNaLD"); vp = "DoNaLD"; appendEden("InitDoNaLDViewport();\n", dd_script); } sprintf(temp, x_draw_act, id, id, id, vp, proc_name, vp, id, id); appendEden(temp, dd_script); } static char x_delete_attr[] = "A%s = @; forget(\"A%s\");\n"; static char x_delete_act[] = "forget(\"P%s\");\ndd_delete(&%s,&%s,&A%s);\n"; static char x_delete_openshape[] = "%s = @; forget(\"%s\");\n"; static char x_delete_graph[] = "forget(\"P%s\");\n"; #define delete_attribute(id) \ sprintf(temp, x_delete_attr, id, id);\ appendEden(temp, dd_script); #define delete_action(id, vp) \ sprintf(temp, x_delete_act, id, id, vp, id);\ appendEden(temp, dd_script); #define delete_openshape(id) \ sprintf(temp, x_delete_openshape, id, id);\ appendEden(temp, dd_script); #define delete_graph(id) \ sprintf(temp, x_delete_graph, id);\ appendEden(temp, dd_script); void eden_delete(symbol * sym, char *vp) /* vp - viewport name */ { symbol *s; char *id = eden_full_name(sym->name); switch (sym->type) { case POINT: case LINE: case ARC: case CIRCLE: case RECTANGLE: case ELLIPSE: case LABEL: case SHAPE: delete_action(id, vp); delete_attribute(id); break; case GRAPH: delete_graph(id); case OPENSHAPE: change_context(sym); s = indx ? context[indx].sym->derived : *context[0].table; for (; s != SymEnd; s = s->next) { eden_delete(s, vp); SymbolTable = s->next; free_symbol(s); } resume_context(); delete_openshape(eden_full_name(sym->name)); break; case VIEWPORT: break; } _changed++; } void eden_declare(char *id, int type, char *vp) /* vp - viewport name */ { /* printf("eden_declare %s %i %s \n ", id, type, vp); */ switch (type) { case POINT: declare_attribute(id); declare_action(id, "plot_point", vp); break; case LINE: declare_attribute(id); declare_action(id, "plot_line", vp); break; case ARC: declare_attribute(id); declare_action(id, "plot_arc", vp); break; case CIRCLE: declare_attribute(id); declare_action(id, "plot_circle", vp); break; case RECTANGLE: declare_attribute(id); declare_action(id, "plot_rectangle", vp); break; case ELLIPSE: declare_attribute(id); declare_action(id, "plot_ellipse", vp); break; case LABEL: declare_attribute(id); declare_action(id, "plot_label", vp); break; case SHAPE: declare_attribute(id); declare_action(id, "plot_shape", vp); break; #ifdef DISTRIB /* case INT: case REAL: case BOOLEAN: case MYCHAR: sprintf(temp, "%s = @;\n", id); appendEden(temp, dd_script); break; */ /* this block will cause declaration becomes definition. In other words, variable's value will be changed and affect other variables due to dependency */ #endif /* DISTRIB */ case OPENSHAPE: case GRAPH: break; case VIEWPORT: #ifdef DISTRIB if (handle_check1((char *) id)) { /* declare is allowed */ if (!*viewport_name && !strcmp((char *) id, "DoNaLD")) { appendEden("InitDoNaLDViewport();\n", dd_script); } strcpy(viewport_name, (char *) id); if (withinHandle > 0) { /* excluding Within clause */ sprintf(temp, "%%donald\nviewport %s\n%%eden\n", (char *) id); propagateDonaldDef((char *) id, temp); } } #else if (!*viewport_name && !strcmp((char *) id, "DoNaLD")) { appendEden("InitDoNaLDViewport();\n", dd_script); } strcpy(viewport_name, (char *) id); #endif /* DISTRIB */ break; } _changed++; } /*---------------------------------------------------+---------+ | Declare | +---------*/ void Declare(int type, tree expr) { /* declare variables, only to Donald not to Eden */ /* type - type of variable */ /* expr - identifier expr(-list) */ symbol *sym; int dc; /* degree of changes */ if (expr != EMPTYTREE) { switch (expr->op) { case OP_ID: #ifdef DISTRIB if (handle_check1(eden_full_name((char *) Lexpr))) { /* declare is allowed */ #endif /* DISTRIB */ sym = look_up((char *) Lexpr); if (sym == SymEnd) { sym = new_symbol((char *) Lexpr); } else if (sym->type != type) { don_err(RedeclareID, donald_full_name((char *) Lexpr)); } sym->type = type; /* can redeclare the same variable to a new viewport only if it is of the same type */ eden_declare(eden_full_name((char *) Lexpr), type, viewport_name); sym->viewport = strdup(viewport_name); #ifdef DISTRIB if (sym != SymEnd && withinHandle > 0 && !isGraph) { /* send donaldDeclaration to others, but not graph */ sprintf(temp, "%%donald\n%s %s\n%%eden\n", map_token_to_name(sym->type), sym->name); propagateDonaldDef(eden_full_name(sym->name), temp); } } #endif /* DISTRIB */ break; case OP_SLASH: change_context(context_search((char *) Lexpr->left)); dc = _changed; Declare(type, Rexpr); if (_changed > dc) { declare_openshape(); /* take special care on context change */ _changed = dc; } resume_context(); break; case OP_GLOBAL: backup_context(); reset_context(); dc = _changed; Declare(type, Lexpr); if (_changed > dc) { declare_openshape(); /* take special care on context change */ _changed = dc; } restore_context(); break; case OP_COMMA: Declare(type, Lexpr); Declare(type, Rexpr); break; default: don_err(IdListExpect, 0); break; } } } /*----------------------------------------------+--------------+ | DeclareGraph | +--------------*/ void DeclareGraph(tree expr) { /* declare variables */ /* identifier expr(-list) */ symbol *sym; int dc; /* degree of changes */ tree t; if (expr != EMPTYTREE) { switch (expr->op) { case OP_ID: #ifdef DISTRIB if (handle_check1(eden_full_name((char *) Lexpr))) { /* declare is allowed */ #endif /* DISTRIB */ sym = look_up((char *) Lexpr); if (sym == SymEnd) { sym = new_symbol((char *) Lexpr); } else if (sym->type != GRAPH) { don_err(RedeclareID, donald_full_name((char *) Lexpr)); } sym->type = GRAPH; /* can redeclare the same variable to a new viewport only if it is of the same type */ declare_graph(eden_full_name((char *) Lexpr), donald_full_name((char *) Lexpr), (*viewport_name == '\0') ? "DoNaLD" : viewport_name); sym->viewport = strdup(viewport_name); #ifdef DISTRIB if (sym != SymEnd && withinHandle > 0) { /* send donaldDeclaration to others */ sprintf(temp, "%%donald\n%s %s\n%%eden\n", map_token_to_name(sym->type), sym->name); propagateDonaldDef(eden_full_name(sym->name), temp); } #endif /* DISTRIB */ /* sym->defn.f = f; */ /* declare variables of graph */ #ifdef DISTRIB /* these variable should not be propagated */ isGraph = 1; #endif /* DISTRIB */ change_context(sym); t = dtree1(OP_ID, (tree) "nSegment"); Declare(INT, t); t->left = (tree) "x"; Declare(REAL, t); t->left = (tree) "f"; Declare(REAL, t); t->left = (tree) "node"; Declare(GSPEC, t); t->left = (tree) "segment"; Declare(GSPEC, t); t->left = (tree) "viewport"; Declare(MYCHAR, t); free(t); resume_context(); #ifdef DISTRIB isGraph = 0; } #endif /* DISTRIB */ break; case OP_SLASH: change_context(context_search((char *) Lexpr->left)); dc = _changed; DeclareGraph(Rexpr); if (_changed > dc) { declare_openshape(); /* take special care on context change */ _changed = dc; } resume_context(); break; case OP_GLOBAL: backup_context(); reset_context(); dc = _changed; DeclareGraph(Lexpr); if (_changed > dc) { declare_openshape(); /* take special care on context change */ _changed = dc; } restore_context(); break; case OP_COMMA: DeclareGraph(Lexpr); DeclareGraph(Rexpr); break; default: don_err(IdListExpect, 0); break; } } } /* to do with monitor, now obsolete |*---------------------------------------------------+----------+ | declare2 | +----------*| void declare2(int type, tree expr) |* declare variables *| |* type - type of variable *| |* expr - identifier expr(-list) *| { symbol *sym; if (expr != EMPTYTREE) { switch (expr->op) { case OP_ID: if (!look_up(Lexpr)) { sym = new_symbol(Lexpr); sym->type = type; eden_declare(eden_full_name(Lexpr), type); mon_symbol(Lexpr); mon_declare(); } break; case OP_SLASH: change_context(context_search(Lexpr->left)); Declare(type, Rexpr); resume_context(); break; case OP_GLOBAL: backup_context(); reset_context(); Declare(type, Lexpr); restore_context(); break; case OP_COMMA: Declare(type, Lexpr); Declare(type, Rexpr); break; default: don_err(IdListExpect, 0); break; } } } */ /*---------------------------------------------------+--------+ | Delete | +--------*/ void Delete(tree expr) { /* Delete variables */ /* expr - identifier expr(-list) */ symbol *sym, *sym_prev; int dc; /* degree of changes */ if (expr != EMPTYTREE) { switch (expr->op) { case OP_ID: if ((sym = look_up((char *) Lexpr)) == 0) don_err(UndeclareID, donald_full_name((char *) Lexpr)); eden_delete(sym, viewport_name); sym_prev = look_prev((char *) Lexpr); if (sym_prev == SymEnd) SymbolTable = sym->next; else sym_prev->next = sym->next; free_symbol(sym); break; case OP_SLASH: change_context(context_search((char *) Lexpr->left)); dc = _changed; Delete(Rexpr); if (_changed > dc) { declare_openshape(); /* take special care on context change */ _changed = dc; } resume_context(); break; case OP_GLOBAL: backup_context(); reset_context(); Delete(Lexpr); restore_context(); break; case OP_COMMA: Delete(Lexpr); Delete(Rexpr); break; default: don_err(IdListExpect, 0); break; } } } /* to do with monitor, now obsolete |*------------------------------------------+-------------------+ | mon_declare | +-------------------*| |* sym is [ OPENSHAPE, sym/a, sym/b, ... ] *| void mon_declare(void) { struct d *s; |*----- print the context name -----*| |* indx == 0 --> root *| appendEden("_monmesg is [ ", dd_script); for (s = MonTable; s != (struct d *) 0; s = s->next) { if (s->next == NULL) sprintf(temp, " &_%s", s->name); else sprintf(temp, " &_%s,", s->name); appendEden(temp, dd_script); } appendEden(" ];\n", dd_script); } */ /*-----------------------------------------+--------------------+ | print_symbol_table | +--------------------*/ void print_symbol_table(int level, symbol * symtab) { symbol *sym; int i; for (sym = symtab; sym != SymEnd; sym = sym->next) { for (i = level; i; --i) fprintf(stderr, "| "); fprintf(stderr, "%s %d\n", sym->name, sym->type); if (sym->type == OPENSHAPE || sym->type == GRAPH) print_symbol_table(level + 1, sym->derived); } } /*------------------------------------------+-------------------+ | print_all_symbols | +-------------------*/ void print_all_symbols(void) { fprintf(stderr, "Symbol Table :-\n"); print_symbol_table(0, *context[0].table); fprintf(stderr, "Symbol Table End.\n"); } /*-------------------------------------------+------------------+ | donald_full_name | +------------------*/ char * donald_full_name(char *id) { static char name[256]; char *s = name; char *t; int i; int len; int id_len; id_len = id ? strlen(id) + 2 : 1; *s++ = '/'; for (i = 1; i <= indx; i++) { t = context[i].sym->name; len = strlen(t); if (&name[256] - s < id_len + len) don_err(Unclassified, "variable name too long"); strcpy(s, t); s += len; *s++ = '/'; } strcpy(s, id); return name; } /*---------------------------------------------+----------------+ | eden_full_name | +----------------*/ char * eden_full_name(char *id) { static char name[256]; char *s = name; char *t; int i; int len; int id_len; /* if (id == 0) ==> context name */ id_len = id ? strlen(id) + 2 : 0; for (i = 1; i <= indx; i++) { t = context[i].sym->name; /* printf("eden name %s %i", t, i); */ len = strlen(t); if (&name[256] - s < id_len + len) don_err(Unclassified, "variable name too long"); *s++ = '_'; #ifdef DISTRIB /* if (i==1 && !inPrefix) { len = strlen(t) -strlen(agentName); strncat(s, t, len); } else */ #endif /* DISTRIB */ strcpy(s, t); s += len; } if (id) { *s++ = '_'; strcpy(s, id); } return name; } /*----------------------------------------+---------------------+ | expr_to_donald_name | +---------------------*/ static char expr_name[256]; char * expr_to_donald_name(tree expr) /* turn an id-expr into a string */ { /* assume expr was checked */ *expr_name = '\0'; if (expr->op == OP_GLOBAL) { strcat(expr_name, "/"); expr = Lexpr; } for (; expr->op == OP_SLASH; expr = Rexpr) { strcat(expr_name, Lexpr->left ? (char *) Lexpr->left : "~"); strcat(expr_name, "/"); } strcat(expr_name, (char *) Lexpr); return expr_name; } /*------------------------------------------+-------------------+ | expr_to_eden_name | +-------------------*/ /* not very sophisticated, can't handle global id with ~ */ char * expr_to_eden_name(tree expr) /* turn an id-expr into a string */ { /* assume expr was checked */ tree e; int count; char *name; if (expr->op == OP_GLOBAL) { backup_context(); reset_context(); name = expr_to_eden_name(Lexpr); restore_context(); return name; } for (count = 0, e = expr; e->op == OP_SLASH; count++, e = e->right) change_context(context_search((char *) e->left->left)); /* Now, e->op should be OP_ID */ name = eden_full_name((char *) e->left); while (count--) resume_context(); return name; } /*-------------------------------------------------+------------+ | dumpdonald | +------------*/ static int isGraphAttr(char *name) { return !(strcmp(name, "nSegment") && strcmp(name, "f") && strcmp(name, "x") && strcmp(name, "node") && strcmp(name, "segment") && strcmp(name, "viewport")); } static void indent(int level) { while (level--) Tcl_EvalEC(interp, ".donald.t.text insert end { }"); } static void insert_nl(void) { Tcl_EvalEC(interp, ".donald.t.text insert end {\n}"); } static char *lastmaster; static char *lastvp; static int lasttype, neednl; static void dumpDonaldDeclaration(int level, symbol * symtab, int isGraph) { symbol *sym; extern char *map_token_to_name(int); for (sym = symtab; sym != SymEnd; sym = sym->next) { if (isGraph && isGraphAttr(sym->name)) continue; if (*sym->viewport == '\0') sym->viewport = strdup("DoNaLD"); if ((lastvp == 0 || strcmp(lastvp, sym->viewport)) && !(lastvp == 0 && strcmp("DoNaLD", sym->viewport) == 0)) { lasttype = 0; if (neednl) { insert_nl(); indent(level); } Tcl_VarEval(interp, ".donald.t.text insert end {viewport ", sym->viewport, "\n} viewport", 0); neednl = 0; lastvp = sym->viewport; } if (lasttype == sym->type && sym->type != GRAPH) { Tcl_VarEval(interp, ".donald.t.text insert end {, ", sym->name, "}", 0); neednl = 1; } else { if (neednl) { insert_nl(); neednl = 0; } indent(level); Tcl_VarEval(interp, ".donald.t.text insert end {", map_token_to_name(sym->type), " ", sym->name, "}", 0); neednl = 1; lasttype = sym->type; } if (sym->type == OPENSHAPE || sym->type == GRAPH) { insert_nl(); indent(level); neednl = 0; lasttype = 0; Tcl_VarEval(interp, ".donald.t.text insert end \"within ", sym->name, " {\\n\"", 0); dumpDonaldDeclaration(level + 1, sym->derived, sym->type == GRAPH); if (neednl) insert_nl(); indent(level); Tcl_EvalEC(interp, ".donald.t.text insert end \"}\\n\""); neednl = 0; lasttype = 0; } } } static void dumpDonaldDefinition(int level, symbol * symtab) { symbol *sym; extern char *dumpbuf; extern void initbuf(int); extern void dumpdtree(tree); for (sym = symtab; sym != SymEnd; sym = sym->next) { if (lastmaster == 0 || strcmp(lastmaster, sym->master)) { Tcl_VarEval(interp, ".donald.t.text insert end {AGENT ", sym->master, "\n} master", 0); lastmaster = sym->master; } if (sym->type == OPENSHAPE || sym->type == GRAPH) { indent(level); Tcl_VarEval(interp, ".donald.t.text insert end \"within ", sym->name, " {\\n\"", 0); dumpDonaldDefinition(level + 1, sym->derived); indent(level); Tcl_EvalEC(interp, ".donald.t.text insert end \"}\\n\""); } else if (sym->defn.t) { indent(level); Tcl_VarEval(interp, ".donald.t.text insert end {", sym->name, " = }", 0); initbuf(2048); /* initialize dumpbuf */ dumpdtree(sym->defn.t); Tcl_VarEval(interp, ".donald.t.text insert end \"", dumpbuf, "\"", 0); insert_nl(); } } } int dumpdonald(void) { Tcl_EvalEC(interp, "cleanup donald"); Tcl_EvalEC(interp, ".donald.t.text config -state normal"); /* dump type declarations */ lastvp = 0; lasttype = 0; neednl = 0; dumpDonaldDeclaration(0, GlobalSymbols, 0); if (neednl) insert_nl(); insert_nl(); /* dump variable definitions */ lastmaster = 0; dumpDonaldDefinition(0, GlobalSymbols); Tcl_EvalEC(interp, ".donald.t.text mark set insert 1.0"); Tcl_EvalEC(interp, ".donald.t.text see insert"); Tcl_EvalEC(interp, ".donald.t.text config -state disabled"); return TCL_OK; } case OP_SLASH: change_context(context_search(Lexpr->left)); tkeden1.41/Donald/symbol.h010060000025250000164000000012210701434525000154650ustar00ashleyem00003510000005/* * $Id: symbol.h,v 1.4 1999/11/16 21:20:40 ashley Rel1.10 $ */ struct symbol { char *name; /* symbol name */ char *viewport; /* symbol viewport */ char *master; /* who change this symbol last */ union { tree t; /* symbol definition */ char *f; /* graph function name */ } defn; /* symbol definition */ int type; /* symbol type */ struct symbol *derived; /* sub-directory */ struct symbol *next; /* next symbol entry */ }; typedef struct symbol symbol; extern symbol *SymbolTable; #define UNDEFINED 0 #define SymEnd (symbol*)0 extern char *topMasterStack(); tkeden1.41/Donald/tree.c010060000025250000164000000607020733227744300151360ustar00ashleyem00003510000005/* * $Id: tree.c,v 1.12 2001/08/02 16:26:11 cssbz Exp $ */ static char rcsid[] = "$Id: tree.c,v 1.12 2001/08/02 16:26:11 cssbz Exp $"; #include #include #include #include #include "../config.h" #include "tree.h" #include "symbol.h" #include "error.h" #include "oper.h" #include "parser.h" #include "../EX/script.h" #include "../Eden/emalloc.h" #ifdef HAVE_DMALLOC #include #endif extern Tcl_Interp *interp; extern void *getmem(int); extern char *map_token_to_name(int); extern char *expr_to_eden_name(tree); extern symbol *look_up_tree(tree); extern symbol *look_up(char *); extern char *eden_full_name(char *); extern Script *dd_script; static char temp[256]; static int stage = 1; /* controlling the translation process */ static char *defname; /* name of the variable to be defined */ static tree *TreeList; /* list of pointers to the image expressions */ static int treeListSize = 0; static int TopTreeList = 0; static char tempname[80]; /* name of a temp. image variable */ static int inPrintTree = 0; #define lastchar(s) s[strlen(s)-1] /* function prototypes */ void initbuf(int); void extendbuf(int); int is_shape(tree); int is_openshape(tree); int is_graph(tree); static void appendTreeList(tree); tree dtree4(int, tree, tree, tree, tree); tree dtree3(int, tree, tree, tree); tree dtree2(int, tree, tree); tree dtree1(int, tree); tree dtree0(int); int nary(int); void freeTree(tree); tree copyTree(tree); static void dump_str(char *); void dumpdtree(tree); void print_tree(tree expr); void Define(tree expr1, tree expr2); void DefineFunc(int FX, tree expr); #ifdef DISTRIB static int DonaldExprOracleCheck(tree); #endif /* DISTRIB */ static int dumpbufsize = 0; char *dumpbuf = 0; void initbuf(int size) { if (dumpbuf == 0) { dumpbuf = (char *) emalloc(size); dumpbufsize = size; } else if (size > dumpbufsize) { dumpbuf = (char *) erealloc(dumpbuf, size); dumpbufsize = size; } *dumpbuf = '\0'; } void extendbuf(int size) { if (dumpbuf == 0) { dumpbuf = (char *) emalloc(size); dumpbufsize = size; } else if (size > dumpbufsize) { dumpbuf = (char *) erealloc(dumpbuf, size); dumpbufsize = size; } } int is_shape(tree expr) { return expr->type == SHAPE; } int is_openshape(tree expr) { return expr->type == OPENSHAPE; } int is_graph(tree expr) { return expr->type == GRAPH; } static void appendTreeList(tree t) { if (treeListSize == 0) { treeListSize = 4; TreeList = (tree *) emalloc(sizeof(tree) * treeListSize); } else if (TopTreeList == treeListSize) { treeListSize += 4; TreeList = (tree *) erealloc(TreeList, sizeof(tree) * treeListSize); } TreeList[TopTreeList++] = t; } #define clearTreeList() (TopTreeList = 0) /*-------------------------+----------------------------------------+ | dtree0, dtree1, dtree2, dtree3, dtree4 | +----------------------------------------*/ /*----- creat a new tree -----*/ tree dtree4(int op, tree l, tree m, tree r, tree x) /* parallel, left, mid, right and extra children */ { tree ptr; ptr = (tree) getmem(sizeof(node4)); ptr->type = UNDEFINED; ptr->op = op; ptr->left = l; ptr->right = r; ptr->mid = m; ptr->extra = x; return ptr; } tree dtree3(int op, tree l, tree m, tree r) /* if...then...else/rot(,,)/etc. */ /* left, mid and right children */ { tree ptr; ptr = (tree) getmem(sizeof(node3)); ptr->type = UNDEFINED; ptr->op = op; ptr->left = l; ptr->right = r; ptr->mid = m; return ptr; } tree dtree2(int op, tree l, tree r) /* operator: + - * / etc. */ /* left and right children */ { tree ptr; ptr = (tree) getmem(sizeof(node2)); ptr->type = UNDEFINED; ptr->op = op; ptr->left = l; ptr->right = r; return ptr; } tree dtree1(int op, tree l) /* id, inumber, etc. */ /* left child */ { tree ptr; ptr = (tree) getmem(sizeof(node1)); ptr->type = UNDEFINED; ptr->op = op; ptr->left = l; return ptr; } tree dtree0(int op) /* inf */ { tree ptr; ptr = (tree) getmem(sizeof(node0)); ptr->type = UNDEFINED; ptr->op = op; return ptr; } /*---------------------------------------------------+---------+ | trans[] | +---------*/ static struct trans trans[] = TRANSLAT; /*--------------------------------------------+----------------+ | match_operator | +----------------*/ #define match_operator(op, s) \ (s = trans[(int)op].op_str, trans[(int)op].order) /*----------------------------------------------------+--------+ | orig[] | +--------*/ static struct trans orig[] = ORIGINAL; /*---------------------------------------+---------------------+ | match_orig_operator | +---------------------*/ #define match_orig_operator(op, s) \ (s = orig[(int)op].op_str, orig[(int)op].order) int nary(int opcode) { switch (trans[opcode].order) { case OP_IMPOSE: case OP_GSPEC: case UNARY: return 1; case BINARY: case INFIX: case OP_GSPECLIST: return 2; case OP_IF: case OP_MONITOR: case TRIARY: return 3; case QUADARY: return 4; default: return 0; } } /*--------------------------------------------------+----------+ | freeTree | +----------*/ /*----- free the memory of a tree -----*/ void freeTree(tree expr) { char *op_string; /* dummy */ switch (match_operator(expr->op, op_string)) { case OP_ID: case OP_EDEN: if (Lexpr) free(Lexpr); case OP_BOOL: case OP_CSTRING: case OP_RNUMBER: case OP_INUMBER: case CONSTANT: break; case QUADARY: freeTree(Xexpr); /* quadary */ case OP_IF: case OP_MONITOR: case TRIARY: freeTree(Mexpr); /* tri-ary */ case OP_SLASH: case INFIX: case BINARY: freeTree(Rexpr); /* binary */ case OP_IMPOSE: case UNARY: case OP_GLOBAL: freeTree(Lexpr); /* unary */ break; case OP_GSPECLIST: if (Lexpr) { freeTree(Lexpr); freeTree(Rexpr); } break; case OP_GSPEC: if (Lexpr) freeTree(Lexpr); break; case OP_IMGFUNC: case OP_FUNC: if (Lexpr) free(Lexpr); if (Rexpr) freeTree(Rexpr); break; default: don_err(Impossible, "free_tree"); break; } free(expr); /* free itself */ } #define Value(x) ((node0*)x)->d /*--------------------------------------------------+----------+ | copyTree | +----------*/ /*----- copy a tree -----*/ tree copyTree(tree expr) { tree t; char *op_string; /* dummy */ if (expr == 0) return 0; switch (match_operator(expr->op, op_string)) { case OP_ID: case OP_EDEN: t = dtree1(expr->op, (tree) (Lexpr ? strdup((char *) Lexpr) : 0)); t->type = expr->type; break; case OP_BOOL: case OP_CSTRING: case OP_RNUMBER: case OP_INUMBER: case CONSTANT: t = dtree0(expr->op); t->type = expr->type; Value(t) = Value(expr); break; case QUADARY: /* quadary */ t = dtree4(expr->op, copyTree(Lexpr), copyTree(Mexpr), copyTree(Rexpr), copyTree(expr->extra)); t->type = expr->type; break; case OP_IF: case OP_MONITOR: case TRIARY: /* tri-ary */ t = dtree3(expr->op, copyTree(Lexpr), copyTree(Mexpr), copyTree(Rexpr)); t->type = expr->type; break; case INFIX: case BINARY: /* binary */ case OP_SLASH: case OP_GSPECLIST: t = dtree2(expr->op, copyTree(Lexpr), copyTree(Rexpr)); t->type = expr->type; break; case OP_IMPOSE: case OP_GLOBAL: case UNARY: /* unary */ t = dtree1(expr->op, copyTree(Lexpr)); t->type = expr->type; break; case OP_GSPEC: t = dtree2(expr->op, copyTree(Lexpr), Rexpr); t->type = expr->type; break; case OP_IMGFUNC: case OP_FUNC: t = dtree2(expr->op, (tree) strdup((char *) Lexpr), copyTree(Rexpr)); t->type = expr->type; break; default: don_err(Impossible, "copyTree"); break; } return t; } /*-------------------------------------------------+-----------+ | dumpdtree | +-----------*/ static char Comma[] = ", "; static char Rparen[] = ")"; static void dump_str(char *s) { if ((int) strlen(dumpbuf) + (int) strlen(s) >= dumpbufsize) extendbuf(dumpbufsize + 2048); strcat(dumpbuf, s); } void dumpdtree(tree expr) { int order; char *op_string; char *s, *t; static glevel = 0; if (expr == EMPTYTREE) return; switch (expr->op) { case OP_EDEN: dump_str((char *) Lexpr); dump_str("!"); return; case OP_ID: dump_str(Lexpr ? (char *) Lexpr : "~"); return; case OP_SLASH: dumpdtree(Lexpr); dump_str("/"); dumpdtree(Rexpr); return; case OP_GLOBAL: dump_str("/"); dumpdtree(Lexpr); return; case OP_INUMBER: /* integer number */ sprintf(temp, "%d", Ivalue(expr)); dump_str(temp); return; case OP_RNUMBER: /* real number */ sprintf(temp, "%f", Rvalue(expr)); dump_str(temp); return; case OP_CSTRING: /* character string */ for (s = Cvalue(expr); *s != '\0'; s++) { t = dumpbuf + strlen(dumpbuf); switch (*s) { case '\\': *t++ = '\\'; *t++ = '\\'; *t = '\0'; break; case '"': *t++ = '\\'; *t++ = '"'; *t = '\0'; break; default: *t++ = *s; *t = '\0'; break; } } return; case OP_BOOL: /* boolean value */ sprintf(temp, Bvalue(expr) ? "true" : "false"); dump_str(temp); return; case OP_IMPOSE: /* impose variable */ dump_str("impose "); dumpdtree(Lexpr); return; case OP_IF: /* if .. then .. else .. */ dump_str("if "); dumpdtree(Mexpr); dump_str(" then "); dumpdtree(Lexpr); dump_str(" else "); dumpdtree(Rexpr); return; case OP_MONITOR: dump_str("("); dumpdtree(Mexpr); dump_str(") ? "); dumpdtree(Lexpr); dump_str(" : "); dumpdtree(Rexpr); return; case OP_CART: dump_str("{"); dumpdtree(Lexpr); dump_str(Comma); dumpdtree(Rexpr); dump_str("}"); return; case OP_POLAR: dump_str("{"); dumpdtree(Lexpr); dump_str(" @ "); dumpdtree(Rexpr); dump_str("}"); return; case OP_LINE: if (inPrintTree) dump_str("["); else dump_str("\\["); dumpdtree(Lexpr); dump_str(Comma); dumpdtree(Rexpr); dump_str("]"); return; case OP_ARC: if (inPrintTree) dump_str("["); else dump_str("\\["); dumpdtree(Lexpr); dump_str(Comma); dumpdtree(Mexpr); dump_str(Comma); dumpdtree(Rexpr); dump_str("]"); return; case OP_GSPECLIST: if (Lexpr == 0) { if (inPrintTree) dump_str("[]"); else dump_str("\\[]"); return; } if (glevel == 0) { if (inPrintTree) dump_str("["); else dump_str("\\["); glevel++; dumpdtree(Lexpr); dump_str(";\n\t"); dumpdtree(Rexpr); glevel--; dump_str("]"); } else { dumpdtree(Lexpr); dump_str(";\n\t"); dumpdtree(Rexpr); } return; case OP_GSPEC: if (glevel == 0) { if (inPrintTree) dump_str("["); else dump_str("\\["); glevel++; dump_str(map_token_to_name((int) expr->right)); dump_str(":"); if (Lexpr) dumpdtree(Lexpr); glevel--; dump_str("]"); } else { dump_str(map_token_to_name((int) expr->right)); dump_str(":"); if (Lexpr) dumpdtree(Lexpr); } return; case OP_I: case OP_XI: case OP_FI: case OP_I_1: case OP_XI_1: case OP_FI_1: if (inPrintTree) order = match_operator(expr->op, op_string); else order = match_orig_operator(expr->op, op_string); /* order is not used */ dump_str(op_string); return; case OP_IMGFUNC: dump_str("I!"); dump_str((char *) Lexpr); dump_str("("); dumpdtree(Rexpr); dump_str(")"); return; case OP_FUNC: dump_str((char *) Lexpr); dump_str("!("); dumpdtree(Rexpr); dump_str(")"); return; } /* otherwise, node is operator */ switch (order = match_orig_operator(expr->op, op_string)) { case CONSTANT: dump_str(op_string); return; case UNARY: /* unary operator */ dump_str(op_string); dumpdtree(Lexpr); if (lastchar(op_string) == '(') dump_str(Rparen); return; case POSTFIX: /* unary operator */ dumpdtree(Lexpr); dump_str(op_string); return; case BINARY: /* binary operator */ dump_str(op_string); dumpdtree(Lexpr); dump_str(Comma); dumpdtree(Rexpr); dump_str(Rparen); return; case INFIX: dumpdtree(Lexpr); dump_str(op_string); dumpdtree(Rexpr); return; case TRIARY: /* 3-ary */ dump_str(op_string); dumpdtree(Lexpr); dump_str(Comma); dumpdtree(Mexpr); dump_str(Comma); dumpdtree(Rexpr); dump_str(Rparen); return; case QUADARY: /* 4-ary */ dump_str(op_string); dumpdtree(Lexpr); dump_str(Comma); dumpdtree(Mexpr); dump_str(Comma); dumpdtree(Rexpr); dump_str(Comma); dumpdtree(Xexpr); dump_str(Rparen); return; default: fprintf(stderr, "%d", order); don_err(Impossible, "dumpdtree"); } } /*------------------------------------------------+------------+ | print_tree | +------------*/ #define print_comma() appendEden(", ", dd_script) #define print_rparen() appendEden(")", dd_script) void print_tree(tree expr) { int order; char *op_string; static glevel = 0; if (expr == EMPTYTREE) return; switch (expr->op) { case OP_ID: case OP_SLASH: case OP_GLOBAL: appendEden(expr_to_eden_name(expr), dd_script); return; case OP_INUMBER: /* integer number */ sprintf(temp, "%d", Ivalue(expr)); appendEden(temp, dd_script); return; case OP_RNUMBER: /* real number */ sprintf(temp, "%f", Rvalue(expr)); appendEden(temp, dd_script); return; case OP_EDEN: case OP_CSTRING: /* character string */ appendEden(Cvalue(expr), dd_script); return; case OP_BOOL: /* boolean value */ sprintf(temp, Bvalue(expr) ? "TRUE" : "FALSE"); appendEden(temp, dd_script); return; case OP_IMPOSE: /* impose variable */ appendEden(" impose ", dd_script); print_tree(Lexpr); return; case OP_IF: /* if .. then .. else .. */ case OP_MONITOR: appendEden("(", dd_script); print_tree(Mexpr); appendEden(") ? ", dd_script); print_tree(Lexpr); appendEden(" : ", dd_script); print_tree(Rexpr); return; case OP_GSPECLIST: if (Lexpr == 0) { appendEden("[]", dd_script); return; } if (glevel == 0) { appendEden("[", dd_script); glevel++; print_tree(Lexpr); appendEden(", ", dd_script); print_tree(Rexpr); --glevel; appendEden("]", dd_script); } else { print_tree(Lexpr); appendEden(", ", dd_script); print_tree(Rexpr); } return; case OP_GSPEC: if (glevel == 0) { appendEden("[", dd_script); glevel++; appendEden("\"", dd_script); appendEden(map_token_to_name((int) expr->right), dd_script); appendEden("\", \"", dd_script); if (Lexpr) { initbuf(2048); inPrintTree++; dumpdtree(Lexpr); inPrintTree--; appendEden(dumpbuf, dd_script); } appendEden("\"", dd_script); --glevel; appendEden("]", dd_script); } else { appendEden("\"", dd_script); appendEden(map_token_to_name((int) expr->right), dd_script); appendEden("\", \"", dd_script); if (Lexpr) { initbuf(2048); inPrintTree++; dumpdtree(Lexpr); inPrintTree--; appendEden(dumpbuf, dd_script); } appendEden("\"", dd_script); } return; case OP_IMGFUNC: if (stage == 1) { /* replace the function with a variable */ appendTreeList(expr); sprintf(tempname, "%s_temp%d", defname, TopTreeList); appendEden(tempname, dd_script); return; } /* stage 2 - actually translate the image function */ stage = 1; /* suppress expanding image sub-expressions */ appendEden((char *) Lexpr, dd_script); appendEden("(\"", dd_script); appendEden(tempname, dd_script); appendEden("\", ", dd_script); print_tree(Rexpr); appendEden(")", dd_script); return; case OP_FUNC: appendEden((char *) Lexpr, dd_script); appendEden("(", dd_script); print_tree(Rexpr); appendEden(")", dd_script); return; case OP_LABEL: appendEden(Ltype == IMAGE ? "image(" : "label(", dd_script); print_tree(Lexpr); print_comma(); print_tree(Rexpr); print_rparen(); return; } /* otherwise, node is operator */ switch (order = match_operator(expr->op, op_string)) { case CONSTANT: appendEden(op_string, dd_script); return; case UNARY: /* unary operator */ appendEden(op_string, dd_script); print_tree(Lexpr); if (lastchar(op_string) == '(') print_rparen(); return; case BINARY: /* binary operator */ appendEden(op_string, dd_script); print_tree(Lexpr); print_comma(); print_tree(Rexpr); print_rparen(); return; case INFIX: print_tree(Lexpr); appendEden(op_string, dd_script); print_tree(Rexpr); return; case TRIARY: /* 3-ary */ appendEden(op_string, dd_script); print_tree(Lexpr); print_comma(); print_tree(Mexpr); print_comma(); print_tree(Rexpr); print_rparen(); return; case QUADARY: /* 4-ary */ appendEden(op_string, dd_script); print_tree(Lexpr); print_comma(); print_tree(Mexpr); print_comma(); print_tree(Rexpr); print_comma(); print_tree(Xexpr); print_rparen(); return; default: fprintf(stderr, "%d", order); don_err(Impossible, "print_tree"); } } /*-----------------------------------------------------+--------+ | Define | +--------*/ void Define(tree expr1, tree expr2) { symbol *sym; int start, top, i; #ifdef DISTRIB extern int handle_check1(char *); extern void propagateDonaldDef(char *, char *); extern int withinHandle; #endif /* DISTRIB */ if (expr1 != EMPTYTREE) { switch (expr1->op) { case OP_ID: case OP_SLASH: case OP_GLOBAL: /* DISTRIB: need to check expr1 for handle & expr2 for oracle, and then propagate to others who are allowed to know. */ /* translate */ defname = strdup(expr_to_eden_name(expr1)); #ifdef DISTRIB if (!handle_check1(defname)) return; /* not be allowed to change --sun */ if (!DonaldExprOracleCheck(expr2)) return; /* some variables are not allowed to be observed --sun */ #endif /* DISTRIB */ stage = 1; /* to control the translation process translate image function as a temporary variable */ if (is_shape(expr1) && is_openshape(expr2)) { appendEden(defname, dd_script); appendEden(" is open2shape(", dd_script); print_tree(expr2); appendEden(");\n", dd_script); } else if (expr1->type == expr2->type) { appendEden(defname, dd_script); appendEden(" is ", dd_script); print_tree(expr2); appendEden(";\n", dd_script); } else don_err(IdExprUnmatch, 0); top = 0; do { start = top + 1; top = TopTreeList; for (i = TopTreeList; i >= start; --i) { stage = 2; /* to control the translation process; truly transate the image functions; stage may reset to 1 if the expr contains image subexpressions */ sprintf(tempname, "%s_temp%d", defname, i); appendEden(tempname, dd_script); appendEden(" is ", dd_script); print_tree(TreeList[i - 1]); appendEden(";\n", dd_script); } } while (top != TopTreeList); /* if there are image subexpr */ clearTreeList(); /* update symbol table entry */ sym = look_up_tree(expr1); sym->defn.t = copyTree(expr2); sym->master = topMasterStack(); #ifdef DISTRIB initbuf(2048); /* send DonaldDefinition to others --sun */ dump_str("%donald\n"); sprintf(temp, "%s = ", sym->name); dump_str(temp); inPrintTree++; dumpdtree(sym->defn.t); inPrintTree--; dump_str("\n%eden\n"); /* propagateAgency1(sym->name, dumpbuf); */ if (withinHandle) propagateDonaldDef(eden_full_name(sym->name), dumpbuf); /* appendEden("propagate(\"", dd_script); appendEden(eden_full_name(sym->name), dd_script); appendEden("\", \"", dd_script); appendEden(dumpbuf, dd_script); appendEden("\");\n", dd_script); */ #endif /* DISTRIB */ free(defname); break; case OP_COMMA: Define(expr1->left, expr2->left); Define(expr1->right, expr2->right); break; default: don_err(Impossible, "define"); break; } } } /*-------------------------------------------------+------------+ | DefineFunc | +------------*/ void DefineFunc(int FX, tree expr) /* FX = FI or XI */ { symbol *sym; if (Etype != REAL && Etype != ANY) don_err(IdExprUnmatch, 0); sym = look_up(FX == FI ? "f" : "x"); sym->defn.t = copyTree(expr); sym->master = topMasterStack(); appendEden(eden_full_name(FX == FI ? "_fi_" : "_xi_"), dd_script); appendEden(" = \"", dd_script); initbuf(2048); inPrintTree++; dumpdtree(expr); inPrintTree--; appendEden(dumpbuf, dd_script); appendEden("\";\n", dd_script); } #ifdef DISTRIB static int DonaldExprOracle; /* for agency --sun */ void checkDonaldExprOracle(tree expr) { extern int oracle_check1(char *); int order; char *op_string; static glevel = 0; char *exprName; if (expr == EMPTYTREE) return; switch (expr->op) { case OP_ID: case OP_SLASH: case OP_GLOBAL: exprName = strdup(expr_to_eden_name(expr)); if (!oracle_check1(exprName)) DonaldExprOracle = 0; return; case OP_INUMBER: /* integer number */ case OP_RNUMBER: /* real number */ case OP_EDEN: case OP_CSTRING: /* character string */ case OP_BOOL: /* boolean value */ return; case OP_IMPOSE: /* impose variable */ checkDonaldExprOracle(Lexpr); return; case OP_IF: /* if .. then .. else .. */ case OP_MONITOR: checkDonaldExprOracle(Mexpr); checkDonaldExprOracle(Lexpr); checkDonaldExprOracle(Rexpr); return; case OP_GSPECLIST: if (Lexpr == 0) { return; } if (glevel == 0) { glevel++; checkDonaldExprOracle(Lexpr); checkDonaldExprOracle(Rexpr); --glevel; } else { checkDonaldExprOracle(Lexpr); checkDonaldExprOracle(Rexpr); } return; case OP_GSPEC: if (glevel == 0) { glevel++; if (Lexpr) { checkDonaldExprOracle(Lexpr); } --glevel; } else { if (Lexpr) { checkDonaldExprOracle(Lexpr); } } return; case OP_IMGFUNC: if (stage == 1) { /* replace the function with a variable */ return; } /* stage 2 - actually translate the image function */ stage = 1; /* suppress expanding image sub-expressions */ checkDonaldExprOracle(Rexpr); return; case OP_FUNC: checkDonaldExprOracle(Rexpr); return; case OP_CART: case OP_POLAR: case OP_LINE: case OP_LABEL: checkDonaldExprOracle(Lexpr); checkDonaldExprOracle(Rexpr); return; case OP_ARC: checkDonaldExprOracle(Lexpr); checkDonaldExprOracle(Mexpr); checkDonaldExprOracle(Rexpr); return; } /* otherwise, node is operator */ switch (order = match_operator(expr->op, op_string)) { case CONSTANT: return; case UNARY: /* unary operator */ checkDonaldExprOracle(Lexpr); return; case BINARY: /* binary operator */ checkDonaldExprOracle(Lexpr); checkDonaldExprOracle(Rexpr); return; case INFIX: checkDonaldExprOracle(Lexpr); checkDonaldExprOracle(Rexpr); return; case TRIARY: /* 3-ary */ checkDonaldExprOracle(Lexpr); checkDonaldExprOracle(Mexpr); checkDonaldExprOracle(Rexpr); return; case QUADARY: /* 4-ary */ checkDonaldExprOracle(Lexpr); checkDonaldExprOracle(Mexpr); checkDonaldExprOracle(Rexpr); checkDonaldExprOracle(Xexpr); return; default: fprintf(stderr, "%d", order); don_err(Impossible, "print_tree"); } } static int DonaldExprOracleCheck(tree expr) { DonaldExprOracle = 1; checkDonaldExprOracle(expr); return DonaldExprOracle; } #endif /* DISTRIB */ */ appendEden(" impose ", dd_script); print_tree(Lexpr); rtkeden1.41/Donald/tree.h010060000025250000164000000032250701434525000151250ustar00ashleyem00003510000005/* * $Id: tree.h,v 1.4 1999/11/16 21:20:40 ashley Rel1.10 $ */ struct node4 { int type; int op; struct node4 *left; struct node4 *right; struct node4 *mid; struct node4 *extra; }; struct node3 { int type; int op; struct node4 *left; struct node4 *right; struct node4 *mid; }; struct node2 { int type; int op; struct node4 *left; struct node4 *right; }; struct node1 { int type; int op; struct node4 *left; }; struct node0 { int type; int op; union { int i; double r; char *s; } d; }; typedef struct node4 node4; typedef struct node3 node3; typedef struct node2 node2; typedef struct node1 node1; typedef struct node0 node0; typedef node4 *tree; extern tree dtree0(), dtree1(), dtree2(), dtree3(), dtree4(); #define EMPTYTREE (tree)0 #define Ivalue(expr) ((node0*)expr)->d.i #define Rvalue(expr) ((node0*)expr)->d.r #define Cvalue(expr) ((node0*)expr)->d.s #define Bvalue(expr) ((node0*)expr)->d.i #define Lexpr expr->left #define Mexpr expr->mid #define Rexpr expr->right #define Xexpr expr->extra #define Ltype Lexpr->type #define Mtype Mexpr->type #define Rtype Rexpr->type #define Xtype Xexpr->type #define Etype expr->type #define check_left() count_expr(Lexpr) #define check_right() count_expr(Rexpr) #define check_mid() count_expr(Mexpr) #define check_extra() count_expr(Xexpr) tkeden1.41/Donald/utility.c010060000025250000164000000011720733031403700156630ustar00ashleyem00003510000005/* * $Id: utility.c,v 1.8 2001/07/27 16:34:39 cssbz Exp $ */ static char rcsid[] = "$Id: utility.c,v 1.8 2001/07/27 16:34:39 cssbz Exp $"; #include "../config.h" #include "error.h" #include "../Eden/emalloc.h" #ifdef HAVE_DMALLOC #include #endif /*------------------------------------------------------------+--------+ | getmem | +--------*/ void * getmem(int size) { /* get memory of size */ void *ptr; if (!(ptr = emalloc(size))) don_err(OutOfMemory, 0); return ptr; } tkeden1.41/Eden/004070000025250000164000000000000747346162000134775ustar00ashleyem00003510000005tkeden1.41/Eden/agency.q.c010060000025250000164000000021250733032006500153340ustar00ashleyem00003510000005/* * $Id: agency.q.c,v 1.6 2001/07/27 17:09:09 cssbz Exp $ */ static char rcsid5[] = "$Id: agency.q.c,v 1.6 2001/07/27 17:09:09 cssbz Exp $"; #include "../config.h" #define EQUAL_agent(A,B) streq(A.name,B.name) #define FREE_agent(A) if(A.name)free(A.name) /* function prototypes */ agent_QUEUE *SEARCH_agent(agent_QUEUE *, agent, int); void DELETE_agent_ATOM(agent_QUEUE *, agent_ATOM); void MOVE_agent_Q(agent_QUEUE *, agent_QUEUE *); /* return the position of the n-th object in a agent queue */ agent_QUEUE * SEARCH_agent(agent_QUEUE * Q, agent obj, int n) { agent_QUEUE *P; FOREACH(P, Q) { if (EQUAL_agent(obj, P->obj) && !--n) return P; } return (agent_QUEUE *) 0; /* NOT FOUND */ } void DELETE_agent_ATOM(agent_QUEUE * Q, agent_ATOM A) { if (A && A != Q) { A->prev->next = A->next; A->next->prev = A->prev; DESTROY_agent_ATOM(A); } } void MOVE_agent_Q(agent_QUEUE * Qsrc, agent_QUEUE * Qdst) { if (!Q_EMPTY(Qsrc)) { (Qdst->prev->next = Qsrc->next)->prev = Qdst->prev; (Qsrc->prev->next = Qdst)->prev = Qsrc->prev; CLEAN_Q(Qsrc); } } tkeden1.41/Eden/agency.q.h010060000025250000164000000031400701434525000153410ustar00ashleyem00003510000005/* * $Id: agency.q.h,v 1.2 1999/11/16 21:20:40 ashley Rel1.10 $ */ #include "global.q.h" #ifndef STAMP_agent_QUEUE struct agent { char *name; }; typedef struct agent agent; struct agent_queue { struct agent_queue *prev; struct agent_queue *next; agent obj; }; typedef struct agent_queue agent_QUEUE; typedef agent_QUEUE *agent_ATOM; #ifndef streq #define streq(X,Y) (strcmp(X,Y)==0) #endif #define EQUAL_agent(A,B) streq(A.name,B.name) #define FREE_agent(A) if(A.name)free(A.name) extern agent_QUEUE *SEARCH_agent(agent_QUEUE *, agent, int); extern void DELETE_agent_ATOM(agent_QUEUE *, agent_ATOM); extern void MOVE_agent_Q(agent_QUEUE *, agent_QUEUE *); #ifndef NEW_agent #define NEW_agent(OBJ) OBJ #endif #define DESTROY_agent_ATOM(A) \ { \ FREE_agent((A)->obj); \ free(A); \ } #define DELETE_NTH_agent(Q,OBJ,n) DELETE_agent_ATOM(Q,SEARCH_agent(Q,OBJ,n)) #define DELETE_FIRST_agent(Q,OBJ) DELETE_agent_ATOM(Q,SEARCH_agent(Q,OBJ,1)) #define DELETE_FRONT_agent(Q) DELETE_agent_ATOM(Q,FRONT(Q)) #define DELETE_LAST_agent(Q) DELETE_agent_ATOM(Q,LAST(Q)) #define CLEAR_agent_Q(Q) \ while (!Q_EMPTY(Q)) DELETE_agent_ATOM(Q,(Q)->next) #define APPEND_agent_Q(Q,OBJ) \ { \ agent_ATOM A; \ ALLOC_ATOM(A); \ A->obj = NEW_agent(OBJ); \ APPEND_Q(Q,A); \ } #define INSERT_agent_Q(Q,OBJ) \ { \ agent_ATOM A; \ ALLOC_ATOM(A); \ A->obj = NEW_agent(OBJ); \ INSERT_Q(Q,A); \ } #define CONCAT_agent_Q(Qdst, Qsrc) \ { \ agent_QUEUE *P; \ FOREACH (P, Qsrc) APPEND_agent_Q(Qdst, P->obj); \ } #define IN_agent_Q(Q,OBJ) SEARCH_agent(Q,OBJ,1) #define STAMP_agent_QUEUE #endif tkeden1.41/Eden/builtin.c010060000025250000164000002717030744001113200153010ustar00ashleyem00003510000005/* * $Id: builtin.c,v 1.46 2002/03/01 23:44:26 cssbz Exp $ */ static char rcsid[] = "$Id: builtin.c,v 1.46 2002/03/01 23:44:26 cssbz Exp $"; /** * SOME BUILTIN FUNCTIONS * **/ #include #include #include #include #include /* for stat() */ #include /* for DBL_DIG */ #include "../config.h" #include "eden.h" #include "machine.h" #include "builtin.h" #include "yacc.h" #include "symptr.q.h" #include "hash.h" #include "notation.h" /* I never managed to get kbhit to do what I want it to do: ie pipe commands into tkeden via stdin, probably with a notation translator on the pipe somewhere, like in The Old Days. As it causes problems on Windoz (filio.h doesn't exist) it is commented out like this. [Ash] */ #ifdef WANT_KBHIT #include #include #include #endif #ifdef ipc #include #include #endif #include #include /* for PATH_MAX */ #include #ifndef TTYEDEN #include /* Tcl caches environment variables: so we must use Tcl's versions of the getenv and putenv functions [Ash] */ /* Tcl 8.2.0 Makefile implies don't use the Tcl getenv [Ash] */ #define putenv Tcl_PutEnv #define setenv TclSetEnv #define unsetenv TclUnsetEnv #include extern Tcl_Interp *interp; #endif #include "emalloc.h" extern void call(symptr, Datum, char *); extern char *topMasterStack(void); extern int topEntryStack(void); extern int appAgentName; /* VA [Ash] */ extern char *typename(); #ifdef DISTRIB void tkdefine1(symptr); /* for propagation --sun */ void propagate_agency(symptr); void propagateAgency(symptr, char *); void propagateAgency1(char *, char *); void SendServer(char *, char *); void SendClient(char *, char *); void SendotherClients(char *, char *); #endif /* DISTRIB */ #ifndef streq #define streq(X,Y) (strcmp(X,Y)==0) #endif struct BLIBTBL blibtbl[] = { #define INCLUDE 'T' #include "builtin.h" #undef INCLUDE {0, 0} }; void usage(char *s) { /* internal subroutine */ error2("usage: ", s); } #ifdef NO_CHECK_CIRCULAR int NCC = 0; /* 1 for disable circular check */ void dcc(void) { /* NCC mode on/off */ extern int NCC; if (paracount > 0) { mustint(para(1), "dcc()"); NCC = para(1).u.i; } else NCC = 1; pushUNDEF(); } #endif #ifdef DEBUG int Debug = 0; /* 1 for debugging */ extern int yydebug; extern int st_debug; extern int dd_debug; void debug(void) { /* debug modes on/off: 1: various 2: RunSet debugging 4: Eden parser debugging (=yydebug) 8: Sasami 16: Donald 32: Scout parser debugging (=st_debug) 64: malloc debugging (emalloc macro) 128: Tcl_Eval debugging 256: execute debugging 512: func/proc/procmacro call debugging 1024: VMWRIT debugging (in 1 also) 2048: Donald parser debugging (=dd_debug) 4096: Print errors on stderr as well as the error window ... add these debug values together to find the argument to give to the debug() function. [Ash] */ extern int Debug; if (paracount > 0) { mustint(para(1), "debug()"); Debug = para(1).u.i; yydebug = Debug & 4; #ifndef TTYEDEN st_debug = Debug & 32; dd_debug = Debug & 2048; #endif } else Debug = 1; pushUNDEF(); } #endif /* From Autoconf manual [Ash] */ #if TIME_WITH_SYS_TIME # include # include #else # if HAVE_SYS_TIME_H # include # else # include # endif #endif #ifdef __CYGWIN__ extern void cygwin_split_path(const char *, char *, char *); #else #ifdef HAVE_LIBGEN_H #include #endif /* HAVE_LIBGEN_H */ #endif void _eden_internal_dirname(void) { char *result, *myHeap; Datum d; #ifdef __CYGWIN__ char *basename; #endif if (paracount != 1) { usage("string _eden_internal_dirname(string)"); } else { muststr(para(1), "_eden_internal_dirname"); #ifdef __CYGWIN__ result = emalloc(PATH_MAX); basename = emalloc(PATH_MAX); cygwin_split_path(para(1).u.s, result, basename); #else /* not CYGWIN */ #ifdef HAVE_LIBGEN_H result = dirname(para(1).u.s); #else errorf("_eden_internal_dirname: dirname not compiled in on this platform"); #endif /* HAVE_LIBGEN_H */ #endif /* __CYGWIN__ */ myHeap = getheap(strlen(result) + 1); strcpy(myHeap, result); dpush(d, STRING, myHeap); #ifdef __CYGWIN__ free(result); free(basename); #endif } } void _eden_internal_basename(void) { char *result, *myHeap; Datum d; #ifdef __CYGWIN__ char *dirname; #endif if (paracount != 1) { usage("string _eden_internal_basename(string)"); } else { muststr(para(1), "_eden_internal_basename"); #ifdef __CYGWIN__ dirname = emalloc(PATH_MAX); result = emalloc(PATH_MAX); cygwin_split_path(para(1).u.s, dirname, result); #else /* not CYGWIN */ #ifdef HAVE_LIBGEN_H result = basename(para(1).u.s); #else errorf("_eden_internal_basename: basename not compiled in on this platform"); #endif /* HAVE_LIBGEN_H */ #endif /* __CYGWIN__ */ myHeap = getheap(strlen(result) + 1); strcpy(myHeap, result); dpush(d, STRING, myHeap); #ifdef __CYGWIN__ free(result); free(dirname); #endif } } void _eden_internal_cwd(void) { char *cwd; Datum d; char *myHeap; if (paracount != 0) { usage("string eden_internal_cwd()"); } if ((cwd = getcwd(NULL, PATH_MAX)) == NULL) { errorf("failed to get cwd"); } else { myHeap = getheap(strlen(cwd) + 1); strcpy(myHeap, cwd); dpush(d, STRING, myHeap); free(cwd); } } void _eden_internal_cd(void) { if (paracount == 1) { muststr(para(1), "_eden_internal_cd"); if (chdir(para(1).u.s)) { errorf("failed to cd into '%s': %s", para(1).u.s, strerror(errno)); } } else { usage("void _eden_internal_cd(string)"); } } /* local time */ void gettime(void) { Datum sec, min, hour, mday, mon, year, wday; struct tm *clock; time_t tloc; time(&tloc); clock = localtime(&tloc); dpush(sec, INTEGER, clock->tm_sec); dpush(min, INTEGER, clock->tm_min); dpush(hour, INTEGER, clock->tm_hour); dpush(mday, INTEGER, clock->tm_mday); dpush(mon, INTEGER, clock->tm_mon + 1); dpush(year, INTEGER, clock->tm_year); dpush(wday, INTEGER, clock->tm_wday); makearr(7); } /* time elapsed since Jan 1, 1970 in seconds */ void inttime(void) { Datum seconds; time_t tloc; dpush(seconds, INTEGER, time(&tloc)); } /* time elapsed since Jan 1, 1970 in milli-seconds */ void finetime(void) { Datum seconds, milli; struct timeval tloc; struct timezone tzone; gettimeofday(&tloc, &tzone); dpush(seconds, INTEGER, tloc.tv_sec); dpush(milli, INTEGER, tloc.tv_usec / 1000); makearr(2); } /* added by Chris Brown, 2000 */ void install_notation (void) { /* builtin: install a new notation */ char *name; char *pat_name; Datum d; int result; extern int installnot (char *, char *); extern char *libLocation; if (paracount != 2) usage("install_notation(name to use, name of first instruction);"); muststr(para(1), "install_notation()"); muststr(para(2), "install_notation()"); name = para(1).u.s; pat_name = para(2).u.s; if (!libLocation) errorf("could not install notation %s: location of library files is unknown (try using the -l argument)", name); result = installnot(name, pat_name); if (result == 0) error2("could not install notation ", name); dpush(d, INTEGER, result); } void f_eof(void) { Datum d; FILE *stream; if (paracount > 0) { mustint(para(1), "feof()"); stream = (FILE *) para(1).u.i; dpush(d, INTEGER, feof(stream)); } else usage("int feof(stream)"); } void get_char(void) { Datum d; dpush(d, INTEGER, getchar()); } #ifdef WANT_KBHIT /* So we can tell whether calling one of the getc functions will block. This version from a news article by floyd@ptialaska.net, which gives details of a POSIX kbhit function... [Ash] */ #define CMIN 1 #ifdef CTIME #undef CTIME #endif #define CTIME 1 void kbhit(void) { Datum d; int cnt = 0; int error; static struct termios Otty, Ntty; tcgetattr(0, &Otty); Ntty = Otty; Ntty.c_iflag = 0; /* input mode */ Ntty.c_oflag = 0; /* output mode */ Ntty.c_lflag &= ~ICANON; /* raw mode */ Ntty.c_cc[VMIN] = CMIN; /* minimum time to wait */ Ntty.c_cc[VTIME] = CTIME; /* minimum char's to wait for */ if (0 == (error = tcsetattr(0, TCSANOW, &Ntty))) { struct timeval tv; error += ioctl(0, FIONREAD, &cnt); error += tcsetattr(0, TCSANOW, &Otty); tv.tv_sec = 0; tv.tv_usec = 100; /* a slight time delay is required for tight loops */ select(1, NULL, NULL, NULL, &tv); } dpush(d, INTEGER, (error == 0 ? cnt : -1 )); } #endif /* WANT_KBHIT */ void fget_char(void) { Datum d; FILE *stream; if (paracount > 0) { mustint(para(1), "fgetc()"); stream = (FILE *) para(1).u.i; dpush(d, INTEGER, fgetc(stream)); } else usage("int fgetc(stream)"); } void file_stat(void) { char *filename; struct stat buf; int ret; Datum d; if (paracount != 1) usage("stat(filename);"); muststr(para(1), "stat()"); filename = para(1).u.s; ret = stat(filename, &buf); if (ret == 0) { /* stuff the info returned into a list */ dpush(d, INTEGER, buf.st_uid); dpush(d, INTEGER, buf.st_gid); dpush(d, INTEGER, buf.st_size); dpush(d, INTEGER, buf.st_atime); dpush(d, INTEGER, buf.st_mtime); dpush(d, INTEGER, buf.st_ctime); makearr(6); } else { /* there was an error */ errorf("failed to stat %s: %s", filename, strerror(errno)); } } #define MAXSTRLEN 256 void get_string(void) { Datum d; char *status; char *t; char *s = (char *) malloc(MAXSTRLEN); int slength; if (paracount > 0) { usage("string gets()"); } status = fgets(s, MAXSTRLEN, stdin); /* Remove the \n that is added by fgets() (thus keeping gets() semantics) [Ash] */ slength = strlen(s); if (slength > 0) { s[strlen(s)-1] = '\0'; } if (status) { t = getheap(strlen(s) + 1); strcpy(t, s); dpush(d, STRING, t); } else pushUNDEF(); free(s); } void fget_string(void) { Datum d; int n; FILE *stream; char *status; char *t; char *s; if (paracount > 0) { mustint(para(1), "fgets()"); n = para(1).u.i; mustint(para(2), "fgets()"); stream = (FILE *) para(2).u.i; s = (char *) malloc(n); status = fgets(s, n, stream); if (status) { t = getheap(strlen(s) + 1); strcpy(t, s); dpush(d, STRING, t); } else pushUNDEF(); free(s); } else usage("string fgets(n, stream)"); } void unget_char(void) { int c; FILE *stream; if (paracount > 0) { mustint(para(1), "ungetc()"); c = para(1).u.i; mustint(para(2), "ungetc()"); stream = (FILE *) para(2).u.i; ungetc(c, stream); } else usage("void ungetc(c, stream)"); } void scan_f(void) { Datum d; void *arg[9]; int i; char *format; if (paracount > 10) usage("scanf can handle at most 9 variables"); else if (paracount > 0) { muststr(para(1), "scanf()"); for (i = paracount; i > 1; --i) mustaddr(para(i), "scanf()"); format = para(1).u.s; for (i = paracount; i > 1; --i) if (para(i).u.a->type == STRING) arg[i - 2] = (void *) (para(i).u.a->u.i); else arg[i - 2] = (void *) &(para(i).u.a->u); i = scanf(format, arg[0], arg[1], arg[2], arg[3], arg[4], arg[5], arg[6], arg[7], arg[8]); } else usage("int scanf(format [, pointer ... ])"); dpush(d, INTEGER, i); } void fscan_f(void) { Datum d; void *arg[9]; int i; FILE *stream; char *format; if (paracount > 11) usage("fscanf can handle at most 9 variables"); else if (paracount > 0) { mustint(para(1), "fscanf()"); muststr(para(2), "fscanf()"); for (i = paracount; i > 2; --i) mustaddr(para(i), "fscanf()"); stream = (FILE *) para(1).u.i; format = para(2).u.s; for (i = paracount; i > 2; --i) if (para(i).u.a->type == STRING) arg[i - 3] = (void *) para(i).u.a->u.i; else arg[i - 3] = (void *) &(para(i).u.a->u); i = fscanf(stream, format, arg[0], arg[1], arg[2], arg[3], arg[4], arg[5], arg[6], arg[7], arg[8]); } else usage("int fscanf(stream, format [, pointer ... ])"); dpush(d, INTEGER, i); } void sscan_f(void) { Datum d; void *arg[9]; int i; char *str; char *format; if (paracount > 11) usage("sscanf can handle at most 9 variables"); else if (paracount > 0) { muststr(para(1), "sscanf()"); muststr(para(2), "sscanf()"); for (i = paracount; i > 2; --i) mustaddr(para(i), "sscanf()"); str = para(1).u.s; format = para(2).u.s; for (i = paracount; i > 2; --i) if (para(i).u.a->type == STRING) arg[i - 3] = (void *) para(i).u.a->u.i; else arg[i - 3] = (void *) &(para(i).u.a->u); i = sscanf(str, format, arg[0], arg[1], arg[2], arg[3], arg[4], arg[5], arg[6], arg[7], arg[8]); } else usage("int sscanf(string, format [, pointer ... ])"); dpush(d, INTEGER, i); } void substr(void) { /* sub-string function */ Datum d; int from, to, len, i; char *s, *t, *str; Datum ctos(Datum); if (paracount >= 3) { para(1) = ctos(para(1)); str = para(1).u.s; /* the string */ len = strlen(str); /* the strlen */ mustint(para(2), "substr()"); /* from */ mustint(para(3), "substr()"); /* to */ from = para(2).u.i - 1; to = para(3).u.i - 1; if (from < 0) error("substr: index out of range (from < 0)"); i = (from <= to) ? (to - from + 1) : 0; for (t = s = getheap(i + 1); from <= to; from++) *t++ = (from < len) ? str[from] : ' '; *t = '\0'; } else usage("substr(s, from, to)"); dpush(d, STRING, s); } void sublist(void) { Datum *a; int i, listlen, from, to; if (paracount >= 3) { mustlist(para(1), "sublist()"); mustint(para(2), "sublist()"); mustint(para(3), "sublist()"); a = para(1).u.a; listlen = a[0].u.i; from = para(2).u.i; to = para(3).u.i; if (from < 1) error("sublist: index out of range (from < 1)"); for (i = from; i <= to; i++) push(i <= listlen ? a[i] : UndefDatum); makearr(from <= to ? to - from + 1 : 0); } else usage("sublist(L, from, to)"); } /* internal function: print a datum. reflect should be true if the printed string may be used as code to re-execute: ie a string will be printed with quotes. */ void print(Datum d, FILE *f, int reflect) { int i; if (is_symbol(d)) { fprintf(f,"&%s", symbol_of(d)->name); } else if (is_local(d)) { fprintf(f,"(local variable #%d, location 0x%x, value ", local(d), d.u.v.x); switch (address_type(d)) { case DPTR: print(*dptr(d), f, reflect); break; case CPTR: if (reflect) { fprintf(f,"\"%s\"", cptr(d)); } else { fprintf(f,"%s", cptr(d)); } break; default: fprintf(f,"oops - internal error - unknown type of pointer"); } fprintf(f,")"); } else { switch (d.type) { case REAL: /* This hack comes from C FAQ Q 11.7 (eg http://www.faqs.org/faqs/C-faq/faq). It seems to be the only way to get the value of the cpp constant DBL_DIG into the fprintf format string. [Ash] */ #define Str(x) #x #define Xstr(x) Str(x) /* Need to specify the precision, otherwise 169.9999 comes out as 170 [Ash] */ fprintf(f, "%." Xstr(DBL_DIG) "g", d.u.r); break; case INTEGER: fprintf(f,"%d", d.u.i); break; case MYCHAR: if (reflect) { fprintf(f,"\'%c\'", d.u.i); } else { fprintf(f,"%c", d.u.i); } break; case STRING: if (d.u.s) { if (reflect) { fprintf(f,"\"%s\"", d.u.s); } else { fprintf(f,"%s", d.u.s); } } break; case LIST: fprintf(f,"["); for (i = 1; i <= d.u.a[0].u.i; i++) { print(d.u.a[i], f, 1); if (i < d.u.a[0].u.i) fprintf(f,","); } fprintf(f,"]"); break; case VAR: fprintf(f,"(%s is variable)", d.u.sym->name); break; case BLTIN: fprintf(f,"(%s is built-in function)", d.u.sym->name); break; case LIB: fprintf(f,"(%s is int-valued C function)", d.u.sym->name); break; case RLIB: fprintf(f,"(%s is real-valued C function)", d.u.sym->name); break; case FORMULA: fprintf(f,"@"); /* fprintf(f,"(%s is formula)", d.u.sym->name); */ break; case FUNCTION: fprintf(f,"(%s is user-defined function)", d.u.sym->name); break; case PROCEDURE: fprintf(f,"(%s is user-defined procedure)", d.u.sym->name); break; case PROCMACRO: fprintf(f,"(%s is user-defined procmacro)", d.u.sym->name); break; case UNDEF: fprintf(f,"@"); break; default: fprintf(f,"(type=%d, val=%d)", d.type, d.u.i); break; } } } /* for use from gdb */ void printstdout(Datum d) { print(d, stdout, 1); } void writeln(void) { /* pascal-like writeln */ b_write(); printf("\n"); } void b_write(void) { /* pascal-like write */ int i; for (i = 1; i <= paracount; i++) print(para(i), stdout, 0); pushUNDEF(); } void nameof(void) { /* built-in function: symbol name of a pointer */ Datum d, addr; char *s, *name; if (paracount != 1) usage("s = nameof(&var);"); addr = para(1); if (!is_symbol(addr)) errorf("nameof(): address needed (got %s)", typename(addr.type)); name = symbol_of(addr)->name; s = getheap(strlen(name) + 1); strcpy(s, name); dpush(d, STRING, s); } void scat(void) { /* string concatenation */ Datum d; int i; int len; char *s; Datum ctos(Datum); len = 0; for (i = 1; i <= paracount; i++) { para(i) = ctos(para(i)); len += strlen(para(i).u.s); } s = getheap(len + 1); for (i = 1, *s = '\0'; i <= paracount; i++) strcat(s, para(i).u.s); dpush(d, STRING, s); } void lcat(void) { int i, j, total, listlen; Datum *a; total = 0; for (i = 1; i <= paracount; i++) { mustlist(para(i), "lcat()"); a = para(i).u.a; total += (listlen = a[0].u.i); for (j = 1; j <= listlen; j++) push(a[j]); } makearr(total); } void b_exit(void) { /* builtin: exit the interpreter */ extern void terminate(int); terminate(paracount > 0 && isint(para(1)) ? para(1).u.i : 0); pushUNDEF(); } /* Eden execute() command */ void exec_string(void) { /* builtin: execute a string as a program */ int result; Datum d; notationType n; void pushEntryStack(int); void popEntryStack(void); int run(short, void *, char *); if (paracount == 0) usage("execute(string_expr);"); muststr(para(1), "execute()"); #ifdef DEBUG if (Debug&256) fprintf(stderr, "execute(\"%s\");\n", para(1).u.s); #endif pushEntryStack(EDEN); n = currentNotation; result = run(STRING_DEV, para(1).u.s, 0); changeNotation(n); popEntryStack(); dpush(d, INTEGER, result); } void exec_file(void) { /* builtin: execute a file as a program */ FILE *filein; char *name; Datum d; int result; void pushEntryStack(int); void popEntryStack(void); int run(short, void *, char *); int i, n; if (paracount == 0) usage("include(filename[, filename...]);"); n = paracount; /* don't rely on being able to read paracount (which is on the stack) after calling run() [Ash] */ for (i = 1; i <= n; i++) { muststr(para(i), "include()"); name = para(i).u.s; if ((filein = fopen(name, "r"))) { pushEntryStack(EDEN); result = run(FILE_DEV, filein, name); /* ``run'' will close the file */ popEntryStack(); } else { error2("can't read file ", name); } } #ifndef TTYEDEN setprompt(); #endif dpush(d, INTEGER, result); } /* call a function with a list as its argument */ void apply(void) { if (paracount >= 2) { switch (para(1).type) { case FUNCTION: case PROCEDURE: case PROCMACRO: case BLTIN: case LIB: case RLIB: if (para(2).type == LIST) call(para(1).u.sym, para(2), 0); break; default: usage("apply(function, list);"); break; } } else usage("apply(function, list);"); } static void pushlist(symptr_QUEUE * Q) { int count; Datum d; symptr_ATOM A; count = 0; FOREACH(A, Q) { dpush(d, STRING, A->obj->name); count++; } makearr(count); } #ifdef DISTRIB /* Only used for oracle, handle, state: the three item agent list [Ash] */ static void pushlist1(agent_QUEUE * Q) { int count; Datum d; agent_ATOM A; count = 0; FOREACH(A, Q) { dpush(d, STRING, A->obj.name); count++; } makearr(count); } #endif /* DISTRIB */ void symboldetail(void) { extern symptr hashtable[]; extern int hashindex(char *); extern char *typename(); symptr sp; Datum d; char *name; int i; if (paracount < 1) usage("symboldetail(symbol);"); if (!is_symbol(para(1)) && para(1).type != STRING) errorf("symboldetail(): address or symbol name needed (got %s)", typename(para(1).type)); if (is_symbol(para(1))) { /* If we've been passed a pointer, then just look it up [Ash] */ sp = symbol_of(para(1)); } else { /* If we've been passed a string, find the symbol [Ash] */ name = para(1).u.s; i = hashindex(name); for (sp = hashtable[i]; sp != (symptr) 0; sp = sp->next) if (strcmp(sp->name, name) == 0) { break; } if (sp == 0) error2("symboldetail(): no such variable ", name); } #ifdef DISTRIB /* if (!oracle_check(sp)) error2("no Oracle privilege on observable ", name);*/ /* --sun */ #endif /* DISTRIB */ /* sp is a pointer to the symbol we want to examine [Ash] */ dpush(d, STRING, sp->name); dpush(d, STRING, typename(sp->stype)); if (sp->text) { dpush(d, STRING, sp->text); } else { dpush(d, STRING, ""); } pushlist(&sp->targets); pushlist(&sp->sources); #ifdef DISTRIB pushlist1(&sp->OracleOf); pushlist1(&sp->HandleOf); pushlist1(&sp->StateOf); makearr(8); #else makearr(5); #endif /* DISTRIB */ } /* symboldetail creates a load of stuff on the stack in the Chris Roe case when there are lots of targets and sources around, so this function simply returns what Chris needs: the text that was used to define this symbol originally. Basically this is the same as symboldetail(summat)[3], but this version will not run out of stack space if you call it with a symbol with lots of targets and sources. [Ash, 8/3/2000] */ void symboltext(void) { extern symptr hashtable[]; extern int hashindex(char *); extern char *typename(); symptr sp; Datum d; char *name; int i; if (paracount < 1) usage("symboltext(symbol);"); if (!is_symbol(para(1)) && para(1).type != STRING) errorf("symboltext(): address or symbol name needed (got %s)", typename(para(1).type)); if (is_symbol(para(1))) { /* If we've been passed a pointer, then just look it up [Ash] */ sp = symbol_of(para(1)); } else { /* If we've been passed a string, find the symbol [Ash] */ name = para(1).u.s; i = hashindex(name); for (sp = hashtable[i]; sp != (symptr) 0; sp = sp->next) if (strcmp(sp->name, name) == 0) { break; } if (sp == 0) error2("symboltext(): no such variable ", name); } #ifdef DISTRIB /* if (!oracle_check(sp)) error2("no Oracle privilege on observable ", name);*/ /* --sun */ #endif /* DISTRIB */ /* sp is a pointer to the symbol we want to examine [Ash] */ if (sp->text) { dpush(d, STRING, sp->text); } else { dpush(d, STRING, ""); } } void symbols(void) { extern symptr hashtable[]; extern int typeno(); symptr sp; Datum d; Datum *p; Int count; Int i; Int any, pointer, type; if (paracount < 1 || para(1).type != STRING) usage("symbols(type);"); any = (strcmp(para(1).u.s, "any") == 0); pointer = (strcmp(para(1).u.s, "pointer") == 0); if (!any && !pointer) { type = typeno(para(1).u.s); } count = 0; for (i = 0; i <= HASHSIZE; i++) for (sp = hashtable[i]; sp != (symptr) 0; sp = sp->next) { if (any || type == sp->stype || (pointer && is_address(sp->d)) || type == sp->d.type) count++; } p = (Datum *) getheap((count + 1) * sizeof(Datum)); p[0].type = INTEGER; p[0].u.i = count; count = 1; for (i = 0; i <= HASHSIZE; i++) { for (sp = hashtable[i]; sp != (symptr) 0; sp = sp->next) { if (any || type == sp->stype || (pointer && is_address(sp->d)) || type == sp->d.type) { dpush(d, STRING, sp->name); p[count++] = pop(); } } } d.type = LIST; d.u.a = p; push(d); } /* transform the internal symbol table into a list */ void symtbl2list(void) { extern symptr hashtable[]; extern char *typename(int); symptr sp; Datum d; Datum *p; Int count; Int i; count = 0; for (i = 0; i <= HASHSIZE; i++) for (sp = hashtable[i]; sp != (symptr) 0; sp = sp->next) count++; p = (Datum *) getheap((count + 1) * sizeof(Datum)); p[0].type = INTEGER; p[0].u.i = count; count = 1; for (i = 0; i <= HASHSIZE; i++) { for (sp = hashtable[i]; sp != (symptr) 0; sp = sp->next) { dpush(d, STRING, sp->name); dpush(d, STRING, typename(sp->stype)); if (sp->text) { dpush(d, STRING, sp->text); } else { dpush(d, STRING, ""); } pushlist(&sp->targets); pushlist(&sp->sources); makearr(5); p[count++] = pop(); } } d.type = LIST; d.u.a = p; push(d); } void printhash(void) { /* for debugging */ extern symptr hashtable[]; symptr sp; int i; for (i = 0; i <= HASHSIZE; i++) { printf("%d ----------------------\n", i); for (sp = hashtable[i]; sp != (symptr) 0; sp = sp->next) { printf("%s\n", sp->name); } } pushUNDEF(); } #ifndef TTYEDEN static char defn[4096]; void tkdefineDatum(Datum d, char *s) { int i; char *t; if (is_symbol(d)) { sprintf(s, "&%s", symbol_of(d)->name); s += strlen(s); } else if (is_local(d)) { sprintf(s, "(local variable #%d, ", local(d)); s += strlen(s); sprintf(s, address_type(d) == DPTR ? "data pointer: %d)" : "char pointer: %d)", d.u.v.x); s += strlen(s); } else { switch (d.type) { case REAL: /* See similar code in print() [Ash] */ #define Str(x) #x #define Xstr(x) Str(x) sprintf(s, "%." Xstr(DBL_DIG) "g", d.u.r); s += strlen(s); break; case INTEGER: sprintf(s, "%d", d.u.i); s += strlen(s); break; case MYCHAR: sprintf(s, "'%c'", d.u.i); s += strlen(s); break; case STRING: if (d.u.s) { *s++ = '"'; for (t = d.u.s; *t != '\0'; t++) { switch (*t) { case '\\': *s++ = '\\'; *s++ = '\\'; break; case '"': *s++ = '\\'; *s++ = '"'; break; default: *s++ = *t; break; } } *s++ = '"'; *s++ = '\0'; } break; case LIST: sprintf(s, "["); s++; for (i = 1; i <= d.u.a[0].u.i; i++) { tkdefineDatum(d.u.a[i], s); s += strlen(s); if (i < d.u.a[0].u.i) { sprintf(s, ","); s++; } } sprintf(s, "]"); s++; break; case VAR: sprintf(s, "(%s is variable)", d.u.sym->name); s += strlen(s); break; case BLTIN: sprintf(s, "(%s is built-in function)", d.u.sym->name); s += strlen(s); break; case LIB: case RLIB: sprintf(s, "(%s is C function)", d.u.sym->name); s += strlen(s); break; case FORMULA: sprintf(s, "(%s is formula)", d.u.sym->name); s += strlen(s); break; case FUNCTION: sprintf(s, "(%s is user-defined function)", d.u.sym->name); s += strlen(s); break; case PROCEDURE: sprintf(s, "(%s is user-defined procedure)", d.u.sym->name); s += strlen(s); break; case PROCMACRO: sprintf(s, "(%s is user-defined procmacro)", d.u.sym->name); s += strlen(s); break; case UNDEF: sprintf(s, "@"); s++; break; default: sprintf(s, "(type=%d, val=%d)", d.type, d.u.i); break; } } } void tkdefine(symptr sp) { Tcl_DString command, message; if (*sp->name == '\0') return; /* why are there such cases? */ Tcl_DStringInit(&command); Tcl_DStringInit(&message); Tcl_DStringAppend(&command, "edenDefn ", -1); Tcl_DStringAppendElement(&command, sp->name); Tcl_DStringAppendElement(&message, sp->entry == INTERNAL ? "internal" : sp->entry == ARCA ? "arca" : sp->entry == SCOUT ? "scout" : sp->entry == DONALD ? "donald" : "eden"); Tcl_DStringAppendElement(&message, sp->master); Tcl_DStringAppendElement(&command, message.string); Tcl_DStringFree(&message); switch (sp->stype) { case FORMULA: Tcl_DStringAppend(&message, sp->name, -1); Tcl_DStringAppend(&message, " is", -1); Tcl_DStringAppend(&message, sp->text, -1); Tcl_DStringAppend(&message, "\n", -1); break; case FUNCTION: case PROCMACRO: case PROCEDURE:{ symptr_QUEUE *P, *Q; char *s = defn; Q = &sp->sources; for (P = FRONT(Q); P; P = NEXT(Q, P)) { sprintf(s, "%s %s", P == Q->next ? " :" : ",", P->obj->name); s += strlen(s); } *s++ = ' '; *s = '\0'; } Tcl_DStringAppend(&message, sp->stype == FUNCTION ? "func " : (sp->stype == PROCMACRO ? "procmacro " : "proc "), -1); Tcl_DStringAppend(&message, sp->name, -1); Tcl_DStringAppend(&message, defn, -1); if (sp->text) { Tcl_DStringAppend(&message, sp->text, -1); Tcl_DStringAppend(&message, "\n", -1); } break; default: tkdefineDatum(sp->d, defn); Tcl_DStringAppend(&message, sp->name, -1); Tcl_DStringAppend(&message, " = ", -1); Tcl_DStringAppend(&message, defn, -1); Tcl_DStringAppend(&message, ";\n", -1); break; } Tcl_DStringAppendElement(&command, message.string); if (Tcl_Eval(interp, command.string) != TCL_OK) { Tcl_DStringFree(&command); Tcl_DStringFree(&message); error2("Tcl errorInfo (from tkdefine): ", Tcl_GetVar(interp, "errorInfo", 0)); } Tcl_DStringFree(&command); Tcl_DStringFree(&message); } #ifdef DISTRIB void tkdefine1(symptr sp) { extern void push_text(char *, int); if (*sp->name == '\0') return; /* why are there such cases? */ push_text("%eden\n", 6); switch (sp->stype) { case FORMULA: push_text(sp->name, strlen(sp->name)); push_text(" is ", 4); push_text(sp->text, strlen(sp->text)); push_text("\n", 1); break; case FUNCTION: case PROCMACRO: case PROCEDURE: { symptr_QUEUE *P, *Q; char *s = defn; Q = &sp->sources; for (P = FRONT(Q); P; P = NEXT(Q, P)) { sprintf(s, "%s %s", P == Q->next ? " :" : ",", P->obj->name); s += strlen(s); } *s++ = ' '; *s = '\0'; } switch (sp->stype) { case FUNCTION: push_text("func ", 5); break; case PROCEDURE: push_text("proc ", 5); break; case PROCMACRO: push_text("procmacro ", 10); break; } push_text(sp->name, strlen(sp->name)); push_text(defn, strlen(defn)); if (sp->text) push_text(sp->text, strlen(sp->text)); push_text("\n", 1); break; default: tkdefineDatum(sp->d, defn); push_text(sp->name, strlen(sp->name)); push_text(" = ", 3); push_text(defn, strlen(defn)); push_text(";\n", 2); break; } push_text("\0", 1); } #endif /* DISTRIB */ int isUserDefined(symptr sp) { switch (sp->stype) { case FORMULA: case FUNCTION: case PROCMACRO: case PROCEDURE: return 1; default: switch (sp->d.type) { case REAL: case INTEGER: case MYCHAR: case STRING: case LIST: case VAR: return 1; case UNDEF: if (sp->changed == FALSE) return 1; } } return 0; } int isNotYetDefined(symptr sp) { switch (sp->stype) { case FORMULA: case FUNCTION: case PROCMACRO: case PROCEDURE: return 0; default: switch (sp->d.type) { case UNDEF: if (sp->changed) return 1; } } return 0; } /* AcceptTable holds a string representing a Tcl list containing the numerical indices of all the elements in the View Options listbox (ie agent names) that the user has selected. [Ash] */ static char *AcceptTable = 0; /* assuming this is enough to hold a large number of agent names */ #define ACCEPTTABLESIZE 2048 static void buildAcceptTable(void) { char *indices, *s; if (AcceptTable) free(AcceptTable); Tcl_Eval(interp, "winfo exists .view.left.list"); if (strcmp(interp->result, "0")) { /* window exists */ Tcl_EvalEC(interp, ".view.left.list curselection"); indices = strdup(Tcl_GetStringResult(interp)); /* find elements from listbox that correspond to the indices we have */ AcceptTable = emalloc(ACCEPTTABLESIZE); AcceptTable[0] = '\0'; s = strtok(indices, " "); while (s) { Tcl_VarEval(interp, ".view.left.list get ", s, 0); strncat(AcceptTable, interp->result, ACCEPTTABLESIZE); strncat(AcceptTable, " ", ACCEPTTABLESIZE); s = strtok(0, " "); } free(indices); } else { /* window does not exist */ AcceptTable = 0; } } /* Return 1 if the given agent name was selected for query by the user [Ash] */ static int acceptable(char *name) { char *s1, *s; if (!AcceptTable) return 1; s1 = strdup(AcceptTable); s = strtok(s1, " "); while (s) { if (strcmp(s, name) == 0) { free(s1); return 1; } s = strtok(0, " "); } free(s1); return 0; } static int symcmp( /* symptr *, symptr * */ ); /* qsort doesn't like full prototype */ /* print the internal symbol table into a Tk text Window */ int dumpeden(ClientData clientData, Tcl_Interp * interp, int argc, char *argv[]) { extern char *hptr; char *saveHeapPtr; extern symptr hashtable[]; symptr sp; symptr *p; symptr *pptr; Int count; Int i; char entry, show_not_yet_defined; char *lastMaster = ""; if (argc != 3) { Tcl_AppendResult(interp, "wrong # args: should be \"", "dumpeden notation-option show-not-yet-define\"", 0); return TCL_ERROR; } entry = atoi(argv[1]); show_not_yet_defined = atoi(argv[2]); /* Setting the fourth bit in the first argument causes dumpeden to use the same options as last time [Ash] */ if (!(entry & 0x8)) { buildAcceptTable(); } count = 0; for (i = 0; i <= HASHSIZE; i++) for (sp = hashtable[i]; sp != (symptr) 0; sp = sp->next) if ((isUserDefined(sp) || (show_not_yet_defined && isNotYetDefined(sp))) && acceptable(sp->master) && (((entry & 0x1) && sp->entry == SCOUT) || ((entry & 0x2) && sp->entry == DONALD) || sp->entry <= EDEN)) count++; saveHeapPtr = hptr; p = (symptr *) getheap(count * sizeof(symptr)); pptr = p; for (i = 0; i <= HASHSIZE; i++) for (sp = hashtable[i]; sp != (symptr) 0; sp = sp->next) if ((isUserDefined(sp) || (show_not_yet_defined && isNotYetDefined(sp))) && acceptable(sp->master) && (((entry & 0x1) && sp->entry == SCOUT) || ((entry & 0x2) && sp->entry == DONALD) || #ifdef WANT_SASAMI ((entry & 0x4) && sp->entry == SASAMI) || #endif sp->entry <= EDEN)) *pptr++ = sp; qsort(p, count, sizeof(symptr), symcmp); Tcl_EvalEC(interp, "cleanup eden"); for (i = 0; i < count; i++) { if (strcmp(p[i]->master, lastMaster)) { lastMaster = p[i]->master; Tcl_EvalEC(interp, ".eden.t.text config -state normal"); Tcl_VarEval(interp, ".eden.t.text insert end {AGENT ", lastMaster, "\n} masteragent", 0); Tcl_EvalEC(interp, ".eden.t.text config -state disabled"); } tkdefine(p[i]); } hptr = saveHeapPtr; Tcl_EvalEC(interp, ".eden.t.text mark set insert 1.0"); Tcl_EvalEC(interp, ".eden.t.text see insert"); return TCL_OK; } /* build a list of agents to be used in the View Options window */ int viewOptions(ClientData clientData, Tcl_Interp * interp, int argc, char *argv[]) { extern char *hptr; char *saveHeapPtr; extern symptr hashtable[]; symptr sp; symptr *p; symptr *pptr; Int count; Int i; char *lastMaster; if (argc != 1) { Tcl_AppendResult(interp, "wrong # args: should be \"", "setupViewOptions\"", 0); return TCL_ERROR; } lastMaster = ""; count = 0; for (i = 0; i <= HASHSIZE; i++) for (sp = hashtable[i]; sp != (symptr) 0; sp = sp->next) { if (strcmp(sp->master, lastMaster) && isUserDefined(sp)) { count++; lastMaster = sp->master; } } saveHeapPtr = hptr; p = (symptr *) getheap(count * sizeof(symptr)); lastMaster = ""; pptr = p; for (i = 0; i <= HASHSIZE; i++) for (sp = hashtable[i]; sp != (symptr) 0; sp = sp->next) { if (strcmp(sp->master, lastMaster) && isUserDefined(sp)) { *pptr++ = sp; lastMaster = sp->master; } } qsort(p, count, sizeof(symptr), symcmp); lastMaster = ""; for (i = 0; i < count; i++) { if (strcmp(p[i]->master, lastMaster)) { lastMaster = p[i]->master; Tcl_VarEval(interp, ".view.left.list insert end ", lastMaster, 0); } } hptr = saveHeapPtr; return TCL_OK; } static int symcmp(symptr * s1, symptr * s2) { int m; if (*s1 == *s2) return 0; if ((m = strcmp((*s1)->master, (*s2)->master))) return m; if ((*s1)->stype > (*s2)->stype) return 1; if ((*s1)->stype == (*s2)->stype) return strcmp((*s1)->name, (*s2)->name); return -1; } #endif /* not TTYEDEN ? */ /* remove a symbol from the symbol table */ #define OK 0 #define NOTFOUND 1 #define FAIL 2 void forget(void) { extern symptr hashtable[]; extern int hashindex(char *); extern symptr_QUEUE formula_queue, action_queue; extern void refer_to(symptr, symptr_QUEUE *); Datum d; int error_code; char *s; symptr sp, last; int i; symptr_QUEUE *Q; if (paracount < 1 || (para(1).type != STRING && !is_symbol(para(1)))) errorf("forget(): pointer or symbol name needed (got %s)", typename(para(1).type)); if (is_symbol(para(1))) { /* Find the textual name used when defining this pointer [Ash] */ s = symbol_of(para(1))->name; } else { s = para(1).u.s; } /* Find the location of the symbol in the hashtable, and the previous symbol in the hashtable linked list so that we can remove the symbol from the list [Ash] */ i = hashindex(s); last = (symptr) 0; for (sp = hashtable[i]; sp != (symptr) 0; sp = (last = sp)->next) { if (strcmp(sp->name, s) == 0) { break; /* terminate the for loop */ } } if (sp == (symptr)0) { /* Didn't find it. This will never happen when a pointer is given to forget() as use of a pointer reference causes Eden to create the pointed-to item (as @) if it does not already exist. [Ash] */ dpush(d, INTEGER, NOTFOUND); return; } if (Q_EMPTY(&sp->targets)) { /* this sp has no targets, so nothing references it, so it is safe to forget it [Ash] */ if (sp->name) free(sp->name); /* if (sp->inst) free(sp->inst); */ if (sp->text) free(sp->text); freedatum(sp->d); /* sp->targets is already EMPTY */ refer_to(sp, &sp->targets); /* free sources */ if (last) last->next = sp->next; else hashtable[i] = sp->next; free(sp); error_code = OK; /* forgotten OK */ } else { /* some objects refer to this sp (it has targets) */ /* error("can't forget", sp->name); */ error_code = FAIL; /* FAILure */ } /* remove object from evaluation (formula / action) queue */ switch (sp->stype) { case FORMULA: Q = &formula_queue; break; case BLTIN: case PROCEDURE: case FUNCTION: case PROCMACRO: Q = &action_queue; break; default: /* Is it an error ? */ Q = 0; break; /* don't queue up */ } if (Q) { DELETE_symptr_ATOM(Q, sp->Qloc); sp->Qloc = 0; } dpush(d, INTEGER, error_code); } static void packpara(Datum d, char *err_msg) { if (is_address(d)) *((Int *) getheap(sizeof(Int))) = (Int) & (dptr(d)->u.i); else switch (d.type) { case REAL: *((float *) getheap(sizeof(float))) = d.u.r; break; case INTEGER: *((int *) getheap(sizeof(int))) = d.u.i; break; case MYCHAR: *((char *) getheap(sizeof(char))) = d.u.i; break; case STRING: *((char **) getheap(sizeof(char **))) = d.u.s; break; case LIST: { Int n, i; n = d.u.a[0].u.i; /* no. of items */ for (i = 1; i <= n; i++) packpara(d.u.a[i], err_msg); } break; default: usage(err_msg); break; } } #define parameters (*fp->stackp) void pack(void) { char *mem; Datum d; mem = getheap(0); /* find the begin of memory block */ packpara(parameters, "address=pack(data,...);"); dpush(d, INTEGER, mem); } void array(void) { Int n; Datum d; if (paracount < 1) usage("list = array(n, data);"); mustint(para(1), "array()"); n = para(1).u.i; if (n < 0) error("listcat: -ve number in 1st argument"); if (paracount > 1) d = para(2); else d = UndefDatum; while (n--) push(d); makearr(para(1).u.i); } void user_error(void) { /* generate an error */ if (paracount > 0) { muststr(para(1), "user_error"); error(para(1).u.s); } else error("run-time error"); /* don't need a push since "error" never return */ } /*- touch variables (pointed to by a pointer) only their parents shall be re-evaluated -*/ void touch(void) { extern void schedule_parents_of(symptr); extern void eval_formula_queue(void); int i; for (i = 1; i <= paracount; i++) { mustaddr(para(i), "touch()"); schedule_parents_of((symptr) para(i).u.v.y); } eval_formula_queue(); pushUNDEF(); } void get_environ(void) { Datum d; char *s; if (paracount < 1) usage("string = getenv(\"env_name\")"); muststr(para(1), "getenv()"); if ((s = getenv(para(1).u.s))) { dpush(d, STRING, s); } else pushUNDEF(); } void put_environ(void) { Datum d; char *s; if (paracount < 1) usage("ok = putenv(\"env_name=value\")"); muststr(para(1), "putenv()"); s = getheap(strlen(para(1).u.s) + 1); strcpy(s, para(1).u.s); dpush(d, INTEGER, putenv(s)); } /*** errno ***/ #include void error_no(void) { Datum d; dpush(d, INTEGER, errno); } /*** process ***/ #undef FAIL #define FAIL (-1) void backgnd(void) { int pid; Datum d; Datum *p; int argc, i; char **argv; p = ¶(0); argc = p[0].u.i; if (argc < 2) usage("pid = backgnd(\"cmd\", \"cmd\", \"arg1\", ...);"); argv = (char **) emalloc(sizeof(char *) * argc); for (i = 2; i <= argc; i++) { muststr(p[i], "backgnd()"); argv[i - 2] = p[i].u.s; } argv[argc - 1] = (char *) 0; pid = fork(); switch (pid) { case 0: /* child process */ { FILE *f; f = fopen("/dev/null", "r"); close(0); /* close stdin */ dup2(fileno(f), 0); /* redirect stdin to /dev/null */ fclose(f); } pid = execvp(para(1).u.s, argv); if (pid == FAIL) { /* can't execute */ noticef("backgnd: can't execute %s\n", para(1).u.s); } break; default: /* parent process */ dpush(d, INTEGER, pid); break; } free(argv); } void pipe_process(void) { int pid; Datum d; Datum *p; int argc, i; char **argv; int fdes[2]; p = ¶(0); argc = p[0].u.i; if (argc < 2) usage("pid = pipe_process(\"cmd\", \"cmd\", \"arg1\", ...);"); muststr(p[1], "pipe_process()"); argv = (char **) getheap(sizeof(char *) * argc); for (i = 2; i <= argc; i++) { muststr(p[i], "pipe_process()"); argv[i - 2] = p[i].u.s; } argv[argc - 1] = (char *) 0; if (pipe(fdes) != FAIL) { pid = fork(); switch (pid) { case 0: /* child process */ i = fileno(stdin); close(i); /* close stdin */ dup2(fdes[0], i); /* redirect stdin */ close(fdes[1]); /* close other end */ pid = execvp(p[1].u.s, argv); if (pid == FAIL) { /* can't execute */ noticef("pipe: can't execute %s\n", p[1].u.s); } break; default: /* parent process */ i = fileno(stdout); close(i); /* close stdout */ dup2(fdes[1], i); /* redirect stdout */ close(fdes[0]); /* close other end */ dpush(d, INTEGER, pid); break; } } } void todo(void) { extern void queue(char *, char *); if (paracount < 1) usage("todo(string);"); muststr(para(1), "todo()"); queue(para(1).u.s, topMasterStack()); /* keep to the same master */ pushUNDEF(); } void get_msgq(void) { #ifdef ipc Datum d; if (paracount < 2) usage("msqid = get_message_queue(key,msgflg);"); mustint(para(1), "get_msgq()"); mustint(para(2), "get_msgq()"); dpush(d, INTEGER, msgget((key_t) para(1).u.i, para(2).u.i)); #endif } #define MSG_SIZE 1024 void send_message(void) { #ifdef ipc int msqid, msgflg; int result; int msize; Datum *p; Datum d; static struct msgbuf msg; p = ¶(0); if (p[0].u.i < 3) /* paracount */ usage("ok = send_msg(msqid,[mtype,mtext],msgflg);"); mustint(p[1], "send_msg()"); mustlist(p[2], "send_msg()"); if (p[2].u.a[0].u.i < 2) usage("ok = send_msg(msqid,[mtype,mtext],msgflg);"); mustint(p[2].u.a[1], "send_msg()"); muststr(p[2].u.a[2], "send_msg()"); mustint(p[3], "send_msg()"); msqid = p[1].u.i; msgflg = p[3].u.i; msg.mtype = (long) p[2].u.a[1].u.i; strncpy(msg.mtext, p[2].u.a[2].u.s, MSG_SIZE); msize = strlen(msg.mtext) + 1; if (msize > MSG_SIZE) msize = MSG_SIZE; result = msgsnd(msqid, &msg, msize, msgflg); if (result == -1) perror("send_msg"); dpush(d, INTEGER, result); #endif } void receive_message(void) { #ifdef ipc Datum *p; Datum d; int i, size; static struct msgbuf msg; p = ¶(0); if (p[0].u.i < 3) /* paracount */ usage("[mtype,mtext] = receive_message(msqid,mtype,msgflg);"); for (i = 1; i <= 3; i++) mustint(p[i], "receive_message()"); size = msgrcv(p[1].u.i, &msg, MSG_SIZE, (long) p[2].u.i, p[3].u.i); if (size == -1) { pushUNDEF(); } else { /* terminate the message with null character */ msg.mtext[(size >= MSG_SIZE) ? MSG_SIZE - 1 : size] = '\0'; dpush(d, INTEGER, msg.mtype); dpush(d, STRING, msg.mtext); makearr(2); } #endif } void remove_msgq(void) { #ifdef ipc Datum d; if (paracount < 1) usage("remove_msgq(msqid);"); mustint(para(1), "remove_msgq()"); dpush(d, INTEGER, msgctl(para(1).u.i, IPC_RMID, 0)); #endif } #ifndef TTYEDEN /* X Windows Stuff */ /**** * EX Commands * ****/ void E_Disp2PS(void) { if (paracount < 2) usage("Disp2PS(screen, file);"); pushUNDEF(); } void E_StringRemain(void) { if (paracount < 2) usage("StringRemain(screen, box);"); pushUNDEF(); } void E_tcl(void) { extern void warning(char *, char *); Datum d; if (paracount < 1) usage("string tcl(string)"); /* printf("E_tcl %s\n", para(1).u.s); */ if (isundef(para(1))) { errorf("Eden tcl() called with @ parameter"); } if (Tcl_GlobalEval(interp, para(1).u.s) == TCL_OK) { dpush(d, STRING, interp->result); } else { char * errorInfo; errorInfo = interp->result; /* Can't use errorf etc as this uses Tcl, which might be in a mess... */ fprintf(stderr, "Eden tcl() command, whilst executing `%s`, got Tcl errorInfo: %s\n", para(1).u.s, errorInfo); pushUNDEF(); } } static void Append(char *v, char *name, char *box) { Datum screenName, boxName; char *s; symptr sp; Datum *a; sp = lookup(v); if (sp == NULL) sp = install(v, VAR, UNDEF, 0); if (isundef(sp->d)) { makearr(0); sp->d = newdatum(pop()); } push(sp->d); s = (char *) getheap(strlen(name) + 1); strcpy(s, name); dpush(screenName, STRING, s); s = (char *) getheap(strlen(box) + 1); strcpy(s, box); dpush(boxName, STRING, s); makearr(2); a = (Datum *) erealloc(sp->d.u.a, (sp->d.u.a->u.i + 2) * sizeof(Datum)); a[++a->u.i] = newdatum(pop()); sp->d.u.a = a; sp->entry = topEntryStack(); sp->master = topMasterStack(); change(sp, FALSE); } static void Remove(char *v, char *name, char *box) { Datum d; int i, j; symptr sp; sp = lookup(v); for (i = sp->d.u.a[0].u.i; i > 0; i--) { d = sp->d.u.a[i]; if (d.u.a[0].u.i == 2 && isstr(d.u.a[1]) && strcmp(d.u.a[1].u.s, name) == 0 && isstr(d.u.a[2]) && strcmp(d.u.a[2].u.s, box) == 0) break; } if (i > 0) { freedatum(d); for (j = i + 1; j <= sp->d.u.a[0].u.i; j++) sp->d.u.a[j - 1] = sp->d.u.a[j]; --sp->d.u.a[0].u.i; sp->entry = topEntryStack(); sp->master = topMasterStack(); change(sp, FALSE); } } #include "screen.q.h" /* create a screen queue for bug fix --sun */ static ScoutScreenQ ScoutScreenList = EMPTYQUEUE(ScoutScreenList); #include "screen.q.c" /* create a screen queue - bug fix --sun */ void DisplayScreen(void) { Datum screen; int noOfscreen, noOfoScreen, next_ref, select; int k, l, r; int lskip, rskip; intQ *newref, *oldref, *new, discard, *ref, *r2; char *name; int lastBox; char s[256]; char *t; winfo *WinInfo; Datum oScreen; /* changed to variable rather than static --sun*/ winfo *oWinInfo; int MaxRef; intQ *Refer; ScoutScreen_ATOM ssptr; ScoutScreenQ ssq; if (paracount < 2 || !is_symbol(para(1)) || para(2).type != STRING) usage("DisplayScreen(&screen, screen_name);"); screen = symbol_of(para(1))->d; name = para(2).u.s; if (isundef(screen)) error("DisplayScreen called with screen undefined"); if (Q_EMPTY(&ScoutScreenList)) {init_ScoutScreenList();} if (!(ssptr = search_ScoutScreenQ(name))) {ssptr = add_ScoutScreen(name);} /* initialization [sy] */ oScreen = ssptr->obj.oScreen; Refer = ssptr->obj.Refer; MaxRef = ssptr->obj.MaxRef; oWinInfo = ssptr->obj.oWinInfo; /* trimming the size of the differences [sy] */ noOfscreen = screen.u.a[0].u.i;/* no of widgets in screen [Ash] */ noOfoScreen = oScreen.u.a[0].u.i; /* no of widgets in previous screen [Ash] */ /* find smaller no of widgets [Ash] */ k = (noOfscreen < noOfoScreen) ? noOfscreen : noOfoScreen; /* iterate through the widget list from the start until we find one that has changed. lskip is then the number of items on the start of the list that can be ignored (?) [Ash] */ for (l = 1; l <= k; l++) if (datacmp(screen.u.a[l], oScreen.u.a[l])) break; lskip = l - 1; /* iterate through the widget list from the end of each until we find one that has changed. rskip is then the number of items on the end of the list that can be ignored (?) [Ash] */ for (r = 0; r < k - lskip; r++) if (datacmp(screen.u.a[noOfscreen - r], oScreen.u.a[noOfoScreen - r])) break; rskip = r; /* printf("here %i %i %i %i %s %i\n", noOfscreen, noOfoScreen, lskip, rskip, name, MaxRef); */ /* match new windows to old windows [sy] */ /* for each of the positions in the non-skipped screen lists (both new and old), construct an empty linked list which will contain integers [Ash] */ newref = (intQ *) getheap(sizeof(intQ) * (noOfscreen - rskip - lskip)); for (l = 0; l < noOfscreen - rskip - lskip; l++) newref[l].prev = newref[l].next = newref + l; oldref = (intQ *) getheap(sizeof(intQ) * (noOfoScreen - rskip - lskip)); for (l = 0; l < noOfoScreen - rskip - lskip; l++) oldref[l].prev = oldref[l].next = oldref + l; /* k runs through previous screen, l through new screen. Each runs over the region of things that may have changed. For each l in k... try and identify where the old stuff has ended up in the new. At each position, add information to the two lists: oldref records where the new widget has moved to; newref records where the old widget was. [Ash] */ for (k = lskip; k < noOfoScreen - rskip; k++) { for (l = lskip; l < noOfscreen - rskip; l++) { if (datacmp(oScreen.u.a[k + 1], screen.u.a[l + 1]) == 0) { /* found new (l) widget in old (k): insert l in oldref, k in newref [Ash] */ /* identical window, take precedence [sy] */ new = (intQ *) getheap(sizeof(intQ)); new->obj = l; INSERT_Q(&oldref[k - lskip], new); new = (intQ *) getheap(sizeof(intQ)); new->obj = k; INSERT_Q(&newref[l - lskip], new); } else if ((oScreen.u.a[k + 1].u.a[1].u.i != 0 && oScreen.u.a[k + 1].u.a[1].u.i != 4) && (screen.u.a[l + 1].u.a[1].u.i != 0 && screen.u.a[l + 1].u.a[1].u.i != 4) && strcmp(oScreen.u.a[k + 1].u.a[5].u.s, screen.u.a[l + 1].u.a[5].u.s) == 0) { /* new (l) widget doesn't match old (k), but they are not TEXT (or TEXTBOX, added by Patrick), and value of pict is the same as before: append l after the current item in oldref, append k after the current item in newref [Ash] */ /* same picture, lower in precedence [sy] */ new = (intQ *) getheap(sizeof(intQ)); new->obj = l; APPEND_Q(&oldref[k - lskip], new); new = (intQ *) getheap(sizeof(intQ)); new->obj = k; APPEND_Q(&newref[l - lskip], new); } } } CLEAN_Q(&discard); /* Run through the old screen list, and put any widgets that no longer exist on the discard list. [Ash] */ for (l = lskip; l < noOfoScreen - rskip; l++) if (Q_EMPTY(&oldref[l - lskip])) { new = (intQ *) getheap(sizeof(intQ)); new->obj = l; APPEND_Q(&discard, new); } next_ref = noOfoScreen + 1; /* this doesn't seem to be usefully used at all [Ash] */ /* Run through the new screen list. [Ash] */ for (l = lskip; l < noOfscreen - rskip; l++) { if (Q_EMPTY(&newref[l - lskip])) { /* This widget is new (it didn't previously exist) [Ash] */ if (Q_EMPTY(&discard)) { select = next_ref++; /* this can't seem to have any effect [Ash] */ } else { select = discard.next->obj; discard.next = discard.next->next; discard.next->prev = &discard; new = (intQ *) getheap(sizeof(intQ)); new->obj = l; INSERT_Q(&oldref[select - lskip], new); } } else { /* If this new widget previously existed [Ash] */ select = newref[l - lskip].next->obj; for (ref = newref[l - lskip].next->next; ref != &newref[l - lskip]; ref = ref->next) { for (r2 = oldref[ref->obj - lskip].next; r2 != &oldref[ref->obj - lskip]; r2 = r2->next) { if (r2->obj == l) { r2 = r2->prev; r2->next = r2->next->next; r2->next->prev = r2; } } } for (ref = oldref[select - lskip].next; ref != &oldref[select - lskip]; ref = ref->next) { for (r2 = newref[ref->obj - lskip].next; r2 != &newref[ref->obj - lskip]; r2 = r2->next) { if (r2->obj == select) { r2 = r2->prev; r2->next = r2->next->next; r2->next->prev = r2; } } } } newref[l - lskip].obj = select; } /* final judgment if any window should actually be discarded [sy, but not in initial versions] */ /* Build the discard list again: it is a list of the widgets for which the oldref list is empty [Ash] */ CLEAN_Q(&discard); for (l = lskip; l < noOfoScreen - rskip; l++) if (Q_EMPTY(&oldref[l - lskip])) { new = (intQ *) getheap(sizeof(intQ)); new->obj = l; APPEND_Q(&discard, new); } /* remove unmatched old windows [sy] */ /* For each widget in the discard list, destroy it and any subboxes, and add it to the Refer list. [Ash] */ for (ref = discard.next; ref != &discard; ref = ref->next) { new = (intQ *) emalloc(sizeof(intQ)); new->obj = oWinInfo[ref->obj].ref; APPEND_Q(Refer, new); for (r = oWinInfo[ref->obj].nbox; r > 0; --r) { sprintf(s, "catch {destroy .%s.b%d_%d}", name, oWinInfo[ref->obj].ref, r); Tcl_EvalEC(interp, s); } if ((oScreen.u.a[ref->obj + 1].u.a[1].u.i != 0) && (oScreen.u.a[ref->obj + 1].u.a[1].u.i != 4)) { /* Non-TEXT and TEXTBOX widgets (DONALD, ARCA, IMAGE) seem to have an extra symbol in the symbol table, perhaps representing their contained image (?), which must now be removed [Ash] */ sprintf(s, "b%d_1", oWinInfo[ref->obj].ref); Remove(oScreen.u.a[ref->obj + 1].u.a[5].u.s, name, s); } } /* setup new WinInfo [sy] */ WinInfo = (winfo *) emalloc(sizeof(winfo) * noOfscreen); /* Copy the information from the unchanged and ignored widgets on the left and right across. The stuff in the middle... well... [Ash] */ for (r = 0; r < lskip; r++) WinInfo[r] = oWinInfo[r]; for (r = lskip; r < noOfscreen - rskip; r++) { if (newref[r - lskip].obj > noOfoScreen) { if (Q_EMPTY(Refer)) { WinInfo[r].ref = MaxRef++; } else { WinInfo[r].ref = Refer->next->obj; Refer->next = Refer->next->next; free(Refer->next->prev); Refer->next->prev = Refer; } WinInfo[r].nbox = 0; } else { WinInfo[r] = oWinInfo[newref[r - lskip].obj]; } } for (r = 1; r <= rskip; r++) WinInfo[noOfscreen - r] = oWinInfo[noOfoScreen - r]; /* draw new windows [sy] */ for (r = lskip; r < noOfscreen - rskip; r++) { Datum New, Old, win, screenName, winNo, boxName; if (newref[r - lskip].obj > noOfoScreen) { /* add window [sy] */ win = screen.u.a[r + 1]; switch (win.u.a[1].u.i) { /* looks like switching on CONTENT [Ash] */ case 0: /* TEXT [Ash] */ for (k = 1; k <= win.u.a[2].u.a[0].u.i; k++) { sprintf(s, "canvas .%s.b%d_%d", name, WinInfo[r].ref, k); Tcl_EvalEC(interp, s); } WinInfo[r].nbox = win.u.a[2].u.a[0].u.i; t = getheap(strlen(name) + 1); strcpy(t, name); dpush(screenName, STRING, t); dpush(winNo, INTEGER, r + 1); sprintf(s, "b%d", WinInfo[r].ref); t = getheap(strlen(s) + 1); strcpy(t, s); dpush(boxName, STRING, t); makearr(3); /* The next line is to make sure that the call command will not cause agentName to be prefixed to variables --sun */ appAgentName--; call(lookup("scout_show_canvas"), pop(), 0); appAgentName++; break; case 4: /* TEXTBOX [Ash] */ for (k = 1; k <= win.u.a[2].u.a[0].u.i; k++) { sprintf(s, "text .%s.b%d_%d", name, WinInfo[r].ref, k); Tcl_EvalEC(interp, s); } WinInfo[r].nbox = win.u.a[2].u.a[0].u.i; t = getheap(strlen(name) + 1); strcpy(t, name); dpush(screenName, STRING, t); dpush(winNo, INTEGER, r + 1); sprintf(s, "b%d", WinInfo[r].ref); t = getheap(strlen(s) + 1); strcpy(t, s); dpush(boxName, STRING, t); makearr(3); appAgentName--; call(lookup("scout_show_text"), pop(), 0); appAgentName++; break; case 1: /* DONALD [Ash] */ case 2: /* ARCA [Ash] */ default: /* IMAGE is 3 [Ash] */ sprintf(s, "canvas .%s.b%d_1", name, WinInfo[r].ref); Tcl_EvalEC(interp, s); WinInfo[r].nbox = 1; t = getheap(strlen(name) + 1); strcpy(t, name); dpush(screenName, STRING, t); /* 1st argument to scout_show_2D [Ash] */ dpush(winNo, INTEGER, r + 1); /* 2nd arg [Ash] */ sprintf(s, "b%d", WinInfo[r].ref); t = getheap(strlen(s) + 1); strcpy(t, s); dpush(boxName, STRING, t); /* 3rd arg [Ash] */ makearr(3); appAgentName--; call(lookup("scout_show_2D"), pop(), 0); appAgentName++; sprintf(s, "b%d_1", WinInfo[r].ref); Append(screen.u.a[r + 1].u.a[5].u.s, name, s); break; } } else if (datacmp(screen.u.a[r + 1], oScreen.u.a[newref[r - lskip].obj + 1])) { /* change existing window [sy] */ New = screen.u.a[r + 1]; Old = oScreen.u.a[newref[r - lskip].obj + 1]; /* Destroy and recreate the widget if the type has changed to or from TEXTBOX [Ash] */ if (((New.u.a[1].u.i == 4) && (Old.u.a[1].u.i != 4)) || ((New.u.a[1].u.i != 4) && (Old.u.a[1].u.i == 4))) { if (New.u.a[1].u.i != 4) { /* not TEXTBOX [Ash] */ for (k = 1; k <= New.u.a[2].u.a[0].u.i; k++) { sprintf(s, "catch { destroy .%s.b%d_%d }", name, oWinInfo[r].ref, k); Tcl_EvalEC(interp, s); sprintf(s, "canvas .%s.b%d_%d", name, WinInfo[r].ref, k); Tcl_EvalEC(interp, s); } } else { /* TEXTBOX [Ash] */ for (k = 1; k <= New.u.a[2].u.a[0].u.i; k++) { sprintf(s, "catch { destroy .%s.b%d_%d }", name, oWinInfo[r].ref, k); Tcl_EvalEC(interp, s); sprintf(s, "text .%s.b%d_%d", name, WinInfo[r].ref, k); Tcl_EvalEC(interp, s); } } } /* Destroy and recreate subboxes (if "frame" has more than one item in its list) [Ash] */ for (k = New.u.a[2].u.a[0].u.i + 1; k <= Old.u.a[2].u.a[0].u.i; k++) { sprintf(s, "catch { destroy .%s.b%d_%d }", name, oWinInfo[r].ref, k); Tcl_EvalEC(interp, s); } for (k = Old.u.a[2].u.a[0].u.i + 1; k <= New.u.a[2].u.a[0].u.i; k++) { switch (New.u.a[1].u.i) { case 4: /* TEXTBOX [Ash] */ sprintf(s, "text .%s.b%d_%d", name, WinInfo[r].ref, k); Tcl_EvalEC(interp, s); break; default: /* TEXT [Ash] */ sprintf(s, "canvas .%s.b%d_%d", name, WinInfo[r].ref, k); Tcl_EvalEC(interp, s); break; } } WinInfo[r].nbox = New.u.a[2].u.a[0].u.i; if (((Old.u.a[1].u.i != 0) && (Old.u.a[1].u.i != 4)) || ((New.u.a[1].u.i != 0) && (New.u.a[1].u.i != 4)) || strcmp(Old.u.a[5].u.s, New.u.a[5].u.s)) { if (Old.u.a[1].u.i != 0 && Old.u.a[1].u.i != 4) { sprintf(s, "b%d_1", oWinInfo[newref[r - lskip].obj].ref); Remove(Old.u.a[5].u.s, name, s); } if (New.u.a[1].u.i != 0 && New.u.a[1].u.i != 4) { sprintf(s, "b%d_1", WinInfo[r].ref); Append(New.u.a[5].u.s, name, s); } } switch (New.u.a[1].u.i) { /* looks like switching on CONTENT [Ash] */ /* This appears to be the same code as above under "draw new windows [sy]", but without the initial widget creation [Ash] */ case 0: /* TEXT [Ash] */ t = getheap(strlen(name) + 1); strcpy(t, name); dpush(screenName, STRING, t); dpush(winNo, INTEGER, r + 1); sprintf(s, "b%d", WinInfo[r].ref); t = getheap(strlen(s) + 1); strcpy(t, s); dpush(boxName, STRING, t); makearr(3); appAgentName--; call(lookup("scout_show_canvas"), pop(), 0); appAgentName++; break; case 4: /* TEXTBOX [Ash] */ t = getheap(strlen(name) + 1); strcpy(t, name); dpush(screenName, STRING, t); dpush(winNo, INTEGER, r + 1); sprintf(s, "b%d", WinInfo[r].ref); t = getheap(strlen(s) + 1); strcpy(t, s); dpush(boxName, STRING, t); makearr(3); appAgentName--; call(lookup("scout_show_text"), pop(), 0); appAgentName++; break; case 1: /* DONALD [Ash] */ case 2: /* ARCA [Ash] */ default: /* IMAGE is 3 [Ash] */ t = getheap(strlen(name) + 1); strcpy(t, name); dpush(screenName, STRING, t); dpush(winNo, INTEGER, r + 1); sprintf(s, "b%d", WinInfo[r].ref); t = getheap(strlen(s) + 1); strcpy(t, s); dpush(boxName, STRING, t); makearr(3); appAgentName--; call(lookup("scout_show_2D"), pop(), 0); appAgentName++; break; } } } /* restack display [sy] */ lastBox = lskip == 0 ? 0 : WinInfo[lskip - 1].ref * 100 + WinInfo[lskip - 1].nbox; for (r = lskip; r < noOfscreen - rskip; r++) { for (l = 1; l <= WinInfo[r].nbox; l++) { if (lastBox == 0) { sprintf(s, "raise .%s.b%d_%d", name, WinInfo[r].ref, l); Tcl_EvalEC(interp, s); } else { sprintf(s, "lower .%s.b%d_%d .%s.b%d_%d", name, WinInfo[r].ref, l, name, lastBox / 100, lastBox % 100); Tcl_EvalEC(interp, s); } lastBox = WinInfo[r].ref * 100 + l; } } /* clean up and save information for next change of display [sy] */ ssptr->obj.oWinInfo = WinInfo; freedatum(ssptr->obj.oScreen); /* Bug fix - Patrick forgot this, meaning that each time DisplayScreen is called (because the screen changed), we leak some memory. [Ash] */ ssptr->obj.oScreen = newdatum(screen); ssptr->obj.MaxRef = MaxRef; ssptr->obj.Refer = Refer; /* UPDATE_ScoutScreen(name, ssptr); */ pushUNDEF(); } /*** Functions for manipulating assocative memory ***/ typedef struct btree { struct btree *l; struct btree *r; int key; Datum vp; Datum ent; Datum attr; } Btree; Btree *WidgetMap = 0; static Btree * searchKey( Btree * map, int key ) { if (map == 0) { map = (Btree *) emalloc(sizeof(Btree)); map->l = map->r = 0; map->key = 0; return map; } if (map->key == key) return map; if (map->key > key) { if (map->l) return searchKey(map->l, key); else return map; } else if (map->r) return searchKey(map->r, key); else return map; } static void replaceKey(Btree * map, int key, Datum vp, Datum ent, Datum attr) { Btree *ans; Btree *new; ans = searchKey(map, key); if (ans->key != key) { /* not there */ new = (Btree *) emalloc(sizeof(Btree)); new->key = key; new->vp = newdatum(vp); new->ent = newdatum(ent); new->attr = newdatum(attr); if (key > ans->key) { new->l = 0; new->r = ans->r; ans->r = new; } else { new->r = 0; new->l = ans->l; ans->l = new; } } else { /* found */ freedatum(ans->vp); freedatum(ans->ent); freedatum(ans->attr); ans->vp = newdatum(vp); ans->ent = newdatum(ent); ans->attr = newdatum(attr); } } static char lookAttrResult[80]; static void lookAttr(char *s, char *attr) { char *head; int ls, la; ls = strlen(s); la = strlen(attr); if (ls <= la + 1) { lookAttrResult[0] = '\0'; return; } head = strchr(s, ','); if (head == 0) head = s + ls; if (strncmp(s, attr, la) == 0 && s[la] == '=') { strncpy(lookAttrResult, s + la + 1, (head - s) - la - 1); lookAttrResult[(head - s) - la - 1] = '\0'; } else if (*head != '\0') { lookAttr(head + 1, attr); } else { lookAttrResult[0] = '\0'; } } void PlotShape(void) { Datum viewport_list, viewport_name, vp_list, segPtr, attrPtr; Datum d; char *attr; int segid, i, j, fullUpdate; Btree *ans; char s[256]; char *screen, *var, *v; if (paracount < 3 || para(1).type != LIST || !is_symbol(para(3))) usage("PlotShape(viewport_list, segid, &attr);"); viewport_list = para(1); segPtr = para(2); attrPtr = para(3); segid = is_symbol(segPtr) ? segPtr.u.v.x : segPtr.u.i; muststr(symbol_of(attrPtr)->d, "PlotShape()"); attr = symbol_of(attrPtr)->d.u.s; ans = searchKey(WidgetMap, segid); if (WidgetMap == 0) WidgetMap = ans; if (ans->key != segid || datacmp(ans->ent, *dptr(segPtr)) || datacmp(ans->attr, *dptr(attrPtr))) { fullUpdate = 1; } else { /* only the viewport list has changed at most */ fullUpdate = 0; } vp_list = newhdat(viewport_list); if (!fullUpdate) { for (i = vp_list.u.a[0].u.i; i > 0; --i) { for (j = ans->vp.u.a[0].u.i; j > 0; --j) { if (datacmp(vp_list.u.a[i], ans->vp.u.a[j]) == 0) { freedatum(ans->vp.u.a[j]); ans->vp.u.a[j] = UndefDatum; /* don't need to free vp_list.u.a[i] because it is created by newhdat() */ vp_list.u.a[i] = UndefDatum; break; /* expect at most one match */ } } } } lookAttr(attr, "locus"); if (strcmp(lookAttrResult, "true")) { if (ans->key == segid) for (i = 1; i <= ans->vp.u.a[0].u.i; i++) { Datum d; d = ans->vp.u.a[i]; if (isundef(d)) continue; sprintf(s, "if [ winfo exists .%s.%s ] { .%s.%s delete t%d }", d.u.a[1].u.s, d.u.a[2].u.s, d.u.a[1].u.s, d.u.a[2].u.s, segid); Tcl_EvalEC(interp, s); } } lookAttr(attr, "color"); if (strcmp(lookAttrResult, "transparent")) { for (i = 1; i <= vp_list.u.a[0].u.i; i++) { viewport_name = vp_list.u.a[i]; if (isundef(viewport_name)) continue; screen = viewport_name.u.a[1].u.s; var = viewport_name.u.a[2].u.s; push(viewport_name); push(segPtr); push(*dptr(segPtr)); push(attrPtr); sprintf(s, "%s_xOrigin", var); if ((v = Tcl_GetVar(interp, s, TCL_GLOBAL_ONLY)) == NULL) error2("tcl variable not found: ", s); d.type = REAL; d.u.r = atof(v); push(d); sprintf(s, "%s_yOrigin", var); if ((v = Tcl_GetVar(interp, s, TCL_GLOBAL_ONLY)) == NULL) error2("tcl variable not found: ", s); d.type = REAL; d.u.r = atof(v); push(d); sprintf(s, "%s_xScale", var); if ((v = Tcl_GetVar(interp, s, TCL_GLOBAL_ONLY)) == NULL) error2("tcl variable not found: ", s); d.type = REAL; d.u.r = atof(v); push(d); sprintf(s, "%s_yScale", var); if ((v = Tcl_GetVar(interp, s, TCL_GLOBAL_ONLY)) == NULL) error2("tcl variable not found: ", s); d.type = REAL; d.u.r = atof(v); push(d); makearr(8); appAgentName--; call(lookup("draw_shape"), pop(), 0); appAgentName++; } } replaceKey(WidgetMap, segid, viewport_list, *dptr(segPtr), *dptr(attrPtr)); } #endif /* TTYEDEN? */ #ifdef DISTRIB /*---------------------------------------------------------------------------*/ /* for agency --sun */ extern int isServer; extern char *topMasterStack(void); void sendServer(void) /* for distributed tkEden --sun */ { /* send scripts to server by using Tcl */ if (paracount != 2) usage("sendServer(\"servername\", \"scripts\")"); muststr(para(1), "sendServer()"); muststr(para(2), "sendServer()"); SendServer(para(1).u.s, para(2).u.s); } void SendServer(char *serverName, char * sentScripts) { extern void warning(char *, char *); Tcl_DString command; if (isServer) return; if ( *sentScripts != 0) { Tcl_DStringInit(&command); Tcl_DStringAppend(&command, "sendServer ", -1); Tcl_DStringAppendElement(&command, sentScripts); Tcl_EvalEC(interp, command.string); Tcl_DStringFree(&command); } } void sendClient(void) { /* send scripts to server by using Tcl */ if (paracount != 2) usage("sendClient(\"clientname\", \"scripts\")"); muststr(para(1), "sendClient()"); muststr(para(2), "sendClient()"); SendClient(para(1).u.s, para(2).u.s); } void SendClient(char *clientName, char *sentScripts) { extern void warning(char *, char *); Tcl_DString command; char *s; if (!isServer) { s = (char *) malloc(strlen(clientName) + 1 + strlen(sentScripts) + 1 + 20); strcpy(s, "sendClient(\""); strcat(s, clientName); strcat(s, "\", \""); strcat(s, sentScripts); strcat(s, "\");"); SendServer("", s); free(s); return; } if ( *sentScripts != 0 && *clientName !=0) { Tcl_DStringInit(&command); Tcl_DStringAppend(&command, "sendClient ", -1); Tcl_DStringAppendElement(&command, clientName); Tcl_DStringAppendElement(&command, sentScripts); Tcl_EvalEC(interp, command.string); Tcl_DStringFree(&command); } } void SendOtherClients(char *clientName, char *sentScripts) { extern void warning(char *, char *); Tcl_DString command; if ( *sentScripts != 0) { Tcl_DStringInit(&command); Tcl_DStringAppend(&command, "sendOtherClients ", -1); Tcl_DStringAppendElement(&command, clientName); Tcl_DStringAppendElement(&command, sentScripts); Tcl_EvalEC(interp, command.string); Tcl_DStringFree(&command); } } void renewObs(void) { extern char *textptr, textcode[]; extern char agentName[128]; extern symptr lookup(char *); extern int oracle_check(symptr); symptr sp; char *name, *s, *t; int errorSW; if (paracount != 1) usage("renewObs(\"Observablename\")"); muststr(para(1), "renewObs()"); name = para(1).u.s; if (!isServer) { /* Bloody awful use of magic numbers here by Patrick, I'm afraid. This caused a nasty bug: need to do a better way of alloc-ing space for strings. [Ash] */ s = (char *) malloc(strlen(name) + 20); strcpy(s, "renewObs(\""); strcat(s, name); strcat(s, "\");"); SendServer("", s); free(s); return; } /* isServer must now be true (note the return above) [Ash] */ if ((sp = lookup(name)) == 0) { s = (char *) malloc(strlen(name) + 22 + 1); sprintf(s, "no such an observable %s", name); errorSW=1; } else { if (!oracle_check(sp)) { s = (char *) malloc(strlen(name) + 34 + 1); sprintf(s, "no ORACLE privilege on observable %s", name); errorSW=1; } else { s = textptr = textcode; /* set textptr at the begin of textcode */ *textptr = '\0'; tkdefine1(sp); /* will put text into textcode and change textptr */ errorSW = 0; } } if (*s == '\0') { error("unknown error in Query()"); } if (*agentName == '\0') { /* for server */ if (errorSW) { error(s); free(s); } else printf("%s", s); } else { if (errorSW) { t = (char *) malloc(strlen(s) + 50); sprintf(t, "tcl(\"show hist 1\");\n/*** renewObs ERROR \n%s\n***/\n", s); SendClient(agentName, t); free(t); free(s); } else { SendClient(agentName, s); /* This should not be here (duh!). s is set above, and is actually pointing to somewhere in textcode at this point, which was declared in code.c as a statically allocated array. So we don't need to free it. [Ash, Meurig and Chris :] */ /* free(s); */ } } } void queryObs(void) { extern char *textptr, textcode[]; extern char agentName[128]; extern symptr lookup(char *); extern int oracle_check(symptr); symptr sp; char *name, *s, *t, *s1; int errorSW; if (paracount != 1) usage("queryObs(\"Observablename\")"); muststr(para(1), "queryObs()"); name = para(1).u.s; if (!isServer) { s = (char *) malloc(strlen(name) + 20); strcpy(s, "queryObs(\""); strcat(s, name); strcat(s, "\");"); SendServer("", s); free(s); return; } if ((sp = lookup(name)) == 0) { s = (char *) malloc(strlen(name) + 22 + 1); sprintf(s, "no such an observable %s", name); errorSW=1; } else { if (!oracle_check(sp)) { s = (char *) malloc(strlen(name) + 34 + 1); sprintf(s, "no ORACLE privilege on observable %s", name); errorSW=1; } else { s = textptr = textcode; /* set textptr at the begin of textcode */ *textptr = '\0'; tkdefine1(sp); /* will put text into textcode and change textptr */ /* get current value */ switch (sp->d.type) { case VAR: case BLTIN: case LIB: case RLIB: case FUNCTION: case PROCMACRO: case PROCEDURE: s1 = " "; break; case FORMULA: s1 = (char *) malloc(strlen(sp->name) + 30); sprintf(s1, "current state: %s = @\n", sp->name); break; default: tkdefineDatum(sp->d, defn); s1 = (char *) malloc(strlen(defn) + strlen(sp->name) + 30); sprintf(s1, "current state: %s = %s\n", sp->name, defn); break; } errorSW = 0; } } if (*s == '\0') { error("unknown error in Query()"); } if (*agentName == '\0') { /* for server */ if (errorSW) { error(s); free(s); } else {printf("%s%s", s, s1); free(s1); } } else { if (errorSW) { t = (char *) malloc(strlen(s) + 50); sprintf(t, "tcl(\"show hist 1\");\n/*** queryObs\n%s\n***/\n", s); SendClient(agentName, t); free(t); } else { t = (char *) malloc(strlen(s) + strlen(s1) + 50); /* sprintf(t, "writeln(\"%s\", \"%s\");\n", s, s1); */ sprintf(t, "tcl(\"show hist 1\");\n/*** queryObs\n%s%s\n***/\n", s, s1); SendClient(agentName, t); free(t); free(s1); } } } void propagate(void) { if (paracount != 2) usage("propagate(\"Observablename\", \"scripts\")"); muststr(para(1), "propagate()"); muststr(para(2), "propagate()"); if (isServer) propagateAgency1(para(1).u.s, para(2).u.s); else return; /* { if (streq(topMasterStack(), "input")) return; else error("no propagation in a client end. Please use sendServer command"); } */ } void propagate_agency(symptr sp) { extern char *textptr, textcode[]; char *s; /* printf("propagate %s", sp->name); */ if (!isServer) return; if (streq(sp->master, "system")) return; s = textptr = textcode; /* set textptr at the begin of textcode */ *textptr = '\0'; tkdefine1(sp); /* will put text into textcode and change textptr */ /* printf("tkdefine %s", s); */ if (textptr) propagateAgency(sp, s); } void propagateAgency(symptr sp, char *s) { extern char agentName[128]; extern char *everyone; extern agent_ATOM search_agent_Q(agent_QUEUE *, char *); agent_QUEUE *AQ = &sp->OracleOf; agent_ATOM A; extern Int *propagateType; char *temp = (char *) malloc(strlen(s)+1); if (!isServer) return; strcpy(temp, s); /* because textcode may be changed during propagation */ if (temp) { if (*propagateType == 1) { if (Q_EMPTY(AQ)) { return; /* exclusive use */ /* if (*autoPropagate) SendOtherClients(agentName, s); */ } else { if (search_agent_Q(AQ, everyone)) { SendOtherClients(agentName, temp); } else { FOREACH(A, AQ) { if (!streq(A->obj.name, agentName) && !streq(A->obj.name, "SYSTEM")) { SendClient(A->obj.name, temp); } } } } } if (*propagateType == 0) SendOtherClients(agentName, temp); if (*propagateType == -1) return; } free(temp); } void propagateAgency1(char *name, char *s) { extern char agentName[128]; extern symptr lookup(char *); extern Int *EveryOneAllowed; extern Int *propagateType; symptr sp; if (!isServer) return; if ((sp = lookup(name)) != 0) propagateAgency(sp, s); else if (*EveryOneAllowed == 1 && *propagateType != -1) SendOtherClients(agentName, s); /* new variable --- In Donald openshspe, int, boolean, real and char are not defined in Eden yet , even they are declared in Donald. So at this moment, agency is dependent on EveryOneAllowed.. */ } void addAgency(void) { Datum d; symptr sp; char *name, *type, *ObsName; int LSDtype; extern void add_Obs_Q(char *, int, char *); extern int isServer; if (!isServer) return; /* If it is running in client end, it does nothing so far */ if (paracount != 3) usage("addAgency(\"LSDagentName\", \"LSDtype\", \"observableName\")"); muststr(para(1), "addAgency()"); muststr(para(2), "addAgency()"); muststr(para(3), "addAgency()"); name = para(1).u.s; type = para(2).u.s; ObsName = para(3).u.s; if ((sp=lookup(ObsName)) == 0) sp = install(ObsName, VAR, UNDEF, 0); if (!strcmp(type, "oracle")) { add_agent_Q(&sp->OracleOf, name); LSDtype =1; } else { if (!strcmp(type, "handle")) { add_agent_Q(&sp->HandleOf, name); LSDtype = 2; } else { if (!strcmp(type, "state")) { add_agent_Q(&sp->StateOf, name); LSDtype = 3; } else dpush(d, INTEGER, 0); } } add_Obs_Q(name, LSDtype, ObsName); dpush(d, INTEGER, 1); } void removeAgency(void) { Datum d; symptr sp; char *name, *type, *ObsName; int LSDtype; extern void remove_Obs_Q(char *, int, char *); extern void delete_agent_Q(agent_QUEUE *, char *, char *); extern int isServer; if (!isServer) return; /* If it is running in client end, it does nothing so far */ if (paracount != 3) usage("removeAgency(\"LSDagentName\", \"LSDtype\", \"observableName\")"); muststr(para(1), "removeAgency()"); muststr(para(2), "removeAgency()"); muststr(para(3), "removeAgency()"); name = para(1).u.s; type = para(2).u.s; ObsName = para(3).u.s; if ((sp=lookup(ObsName)) == 0) error2("no such observable ", ObsName); if (!strcmp(type, "oracle")) { delete_agent_Q(&sp->OracleOf, name, ObsName); LSDtype = 1; } else { if (!strcmp(type, "handle")) { delete_agent_Q(&sp->HandleOf, name, ObsName); LSDtype =2; } else { if (!strcmp(type, "state")) { delete_agent_Q(&sp->StateOf, name, ObsName); LSDtype =3; } else dpush(d, INTEGER, 0); } } remove_Obs_Q(name, LSDtype, ObsName); dpush(d, INTEGER, 1); } void checkAgency(void) { Datum d; symptr sp; char *name, *type, *ObsName; agent_QUEUE *AQ; agent_ATOM A; extern agent_ATOM search_agent_Q(agent_QUEUE *, char *); extern int isServer; if (!isServer) return; /* If it is running in client end, it does nothing so far */ if (paracount != 3) usage("checkAgency(\"LSDagentName\", \"LSDtype\", \"observableName\")"); muststr(para(1), "checkAgency()"); muststr(para(2), "checkAgency()"); muststr(para(3), "checkAgency()"); name = para(1).u.s; type = para(2).u.s; ObsName = para(3).u.s; if ((sp=lookup(ObsName)) == 0) { dpush(d, INTEGER, 0); /* no such observable */ return; } if (!strcmp(type, "oracle")) { AQ = &sp->OracleOf; } else { if (!strcmp(type, "handle")) { AQ = &sp->HandleOf; } else { if (!strcmp(type, "state")) { AQ = &sp->StateOf; } else { dpush(d, INTEGER, 0); /* no such LSDtype */ return; } } } if ((A=search_agent_Q(AQ, name))!=0) { dpush(d, INTEGER, 1); } else { dpush(d, INTEGER, 0); } return; } #endif /* DISTRIB */ #if defined(WANT_SASAMI) && !defined(TTYEDEN) // -------------------------------------------------------------------------- // Sasami functions - these are just stubs which call the real function code // over in Sasami/functions.c // See Sasami/functions.c for descriptions // -------------------------------------------------------------------------- void ed_sasami_vertex(void) { int i; double x,y,z; if (paracount < 4) usage("sasami_vertex(n,x,y,z)"); if (para(1).type!=INTEGER) usage("n must be an integer"); if (para(2).type==REAL) { x=para(2).u.r; } else { x=para(2).u.i; } if (para(3).type==REAL) { y=para(3).u.r; } else { y=para(3).u.i; } if (para(4).type==REAL) { z=para(4).u.r; } else { z=para(4).u.i; } sasami_vertex(para(1).u.i,x,y,z); } void ed_sasami_set_bgcolour(void) { int i; double r,g,b; if (paracount < 3) usage("sasami_set_bgcolour(r,g,b)"); if (para(1).type==REAL) { r=para(1).u.r; } else { r=para(1).u.i; } if (para(2).type==REAL) { g=para(2).u.r; } else { g=para(2).u.i; } if (para(3).type==REAL) { b=para(3).u.r; } else { b=para(3).u.i; } sasami_set_bgcolour(r,g,b); } void ed_sasami_poly_geom_vertex(void) { int i; double r,g,b; if (paracount < 3) usage("sasami_poly_geom_vertex(,,)"); if (para(1).type!=INTEGER) usage(" must be an integer"); if (para(2).type!=INTEGER) usage(" must be an integer"); if (para(3).type!=INTEGER) usage(" must be an integer"); sasami_poly_geom_vertex(para(1).u.i,para(2).u.i,para(3).u.i); } void ed_sasami_poly_tex_vertex(void) { int i; double r,g,b; if (paracount < 3) usage("sasami_poly_tex_vertex(,,)"); if (para(1).type!=INTEGER) usage(" must be an integer"); if (para(2).type!=INTEGER) usage(" must be an integer"); if (para(3).type!=INTEGER) usage(" must be an integer"); sasami_poly_tex_vertex(para(1).u.i,para(2).u.i,para(3).u.i); } void ed_sasami_object_poly(void) { int i; double r,g,b; if (paracount < 3) usage("sasami_object_poly(,,)"); if (para(1).type!=INTEGER) usage(" must be an integer"); if (para(2).type!=INTEGER) usage(" must be an integer"); if (para(3).type!=INTEGER) usage(" must be an integer"); sasami_object_poly(para(1).u.i,para(2).u.i,para(3).u.i); } void ed_sasami_poly_colour(void) { int i; double r,g,b,a; if (paracount < 5) usage("sasami_poly_colour(poly,r,g,b,a)"); if (para(1).type!=INTEGER) usage(" must be an integer"); if (para(2).type==REAL) { r=para(2).u.r; } else { r=para(2).u.i; } if (para(3).type==REAL) { g=para(3).u.r; } else { g=para(3).u.i; } if (para(4).type==REAL) { b=para(4).u.r; } else { b=para(4).u.i; } if (para(5).type==REAL) { a=para(5).u.r; } else { a=para(5).u.i; } sasami_poly_colour(para(1).u.i,r,g,b,a); } void ed_sasami_poly_material(void) { int i; if (paracount < 2) usage("sasami_poly_material(,)"); if (para(1).type!=INTEGER) usage(" must be an integer"); if (para(2).type!=INTEGER) usage(" must be an integer"); sasami_poly_material(para(1).u.i,para(2).u.i); } void ed_sasami_object_pos(void) { int i; double x,y,z; if (paracount < 4) usage("sasami_object_pos(object,x,y,z)"); if (para(1).type!=INTEGER) usage(" must be an integer"); if (para(2).type==REAL) { x=para(2).u.r; } else { x=para(2).u.i; } if (para(3).type==REAL) { y=para(3).u.r; } else { y=para(3).u.i; } if (para(4).type==REAL) { z=para(4).u.r; } else { z=para(4).u.i; } sasami_object_pos(para(1).u.i,x,y,z); } void ed_sasami_object_rot(void) { int i; double x,y,z; if (paracount < 4) usage("sasami_object_rot(object,x,y,z)"); if (para(1).type!=INTEGER) usage(" must be an integer"); if (para(2).type==REAL) { x=para(2).u.r; } else { x=para(2).u.i; } if (para(3).type==REAL) { y=para(3).u.r; } else { y=para(3).u.i; } if (para(4).type==REAL) { z=para(4).u.r; } else { z=para(4).u.i; } sasami_object_rot(para(1).u.i,x,y,z); } void ed_sasami_object_scale(void) { int i; double x,y,z; if (paracount < 4) usage("sasami_object_scale(object,x,y,z)"); if (para(1).type!=INTEGER) usage(" must be an integer"); if (para(2).type==REAL) { x=para(2).u.r; } else { x=para(2).u.i; } if (para(3).type==REAL) { y=para(3).u.r; } else { y=para(3).u.i; } if (para(4).type==REAL) { z=para(4).u.r; } else { z=para(4).u.i; } sasami_object_scale(para(1).u.i,x,y,z); } void ed_sasami_viewport(void) { int x,y; if (paracount < 2) usage("sasami_viewport(x,y)"); if (para(1).type!=INTEGER) usage(" must be an integer"); if (para(2).type!=INTEGER) usage(" must be an integer"); sasami_viewport(para(1).u.i,para(2).u.i); } void ed_sasami_setshowaxes(void) { int n; if (paracount < 1) usage("sasami_setshowaxes(n)"); if (para(1).type!=INTEGER) usage(" must be an integer"); sasami_setshowaxes(para(1).u.i); } void ed_sasami_material_ambient(void) { int i; double r,g,b,a; if (paracount < 5) usage("sasami_material_ambient(material,r,g,b,a)"); if (para(1).type!=INTEGER) usage(" must be an integer"); if (para(2).type==REAL) { r=para(2).u.r; } else { r=para(2).u.i; } if (para(3).type==REAL) { g=para(3).u.r; } else { g=para(3).u.i; } if (para(4).type==REAL) { b=para(4).u.r; } else { b=para(4).u.i; } if (para(5).type==REAL) { a=para(5).u.r; } else { a=para(5).u.i; } sasami_material_ambient(para(1).u.i,r,g,b,a); } void ed_sasami_material_diffuse(void) { int i; double r,g,b,a; if (paracount < 5) usage("sasami_material_diffuse(material,r,g,b,a)"); if (para(1).type!=INTEGER) usage(" must be an integer"); if (para(2).type==REAL) { r=para(2).u.r; } else { r=para(2).u.i; } if (para(3).type==REAL) { g=para(3).u.r; } else { g=para(3).u.i; } if (para(4).type==REAL) { b=para(4).u.r; } else { b=para(4).u.i; } if (para(5).type==REAL) { a=para(5).u.r; } else { a=para(5).u.i; } sasami_material_diffuse(para(1).u.i,r,g,b,a); } void ed_sasami_material_specular(void) { int i; double r,g,b,a; if (paracount < 5) usage("sasami_material_specular(material,r,g,b,a)"); if (para(1).type!=INTEGER) usage(" must be an integer"); if (para(2).type==REAL) { r=para(2).u.r; } else { r=para(2).u.i; } if (para(3).type==REAL) { g=para(3).u.r; } else { g=para(3).u.i; } if (para(4).type==REAL) { b=para(4).u.r; } else { b=para(4).u.i; } if (para(5).type==REAL) { a=para(5).u.r; } else { a=para(5).u.i; } sasami_material_specular(para(1).u.i,r,g,b,a); } void ed_sasami_material_texture(void) { int i; double r,g,b,a; if (paracount < 2) usage("sasami_material_texture(material,texture)"); if (para(1).type!=INTEGER) usage(" must be an integer"); if (para(2).type!=STRING) usage(" must be a string"); sasami_material_texture(para(1).u.i,para(2).u.s); } void ed_sasami_light_pos(void) { int i; double x,y,z; if (paracount < 4) usage("sasami_light_pos(light,x,y,z)"); if (para(1).type!=INTEGER) usage(" must be an integer"); if (para(2).type==REAL) { x=para(2).u.r; } else { x=para(2).u.i; } if (para(3).type==REAL) { y=para(3).u.r; } else { y=para(3).u.i; } if (para(4).type==REAL) { z=para(4).u.r; } else { z=para(4).u.i; } sasami_light_pos(para(1).u.i,x,y,z); } void ed_sasami_light_ambient(void) { int i; double r,g,b,a; if (paracount < 5) usage("sasami_light_ambient(light,r,g,b,a)"); if (para(1).type!=INTEGER) usage(" must be an integer"); if (para(2).type==REAL) { r=para(2).u.r; } else { r=para(2).u.i; } if (para(3).type==REAL) { g=para(3).u.r; } else { g=para(3).u.i; } if (para(4).type==REAL) { b=para(4).u.r; } else { b=para(4).u.i; } if (para(5).type==REAL) { a=para(5).u.r; } else { a=para(5).u.i; } sasami_light_ambient(para(1).u.i,r,g,b,a); } void ed_sasami_light_diffuse(void) { int i; double r,g,b,a; if (paracount < 5) usage("sasami_light_diffuse(light,r,g,b,a)"); if (para(1).type!=INTEGER) usage(" must be an integer"); if (para(2).type==REAL) { r=para(2).u.r; } else { r=para(2).u.i; } if (para(3).type==REAL) { g=para(3).u.r; } else { g=para(3).u.i; } if (para(4).type==REAL) { b=para(4).u.r; } else { b=para(4).u.i; } if (para(5).type==REAL) { a=para(5).u.r; } else { a=para(5).u.i; } sasami_light_diffuse(para(1).u.i,r,g,b,a); } void ed_sasami_light_specular(void) { int i; double r,g,b,a; if (paracount < 5) usage("sasami_light_specular(light,r,g,b,a)"); if (para(1).type!=INTEGER) usage(" must be an integer"); if (para(2).type==REAL) { r=para(2).u.r; } else { r=para(2).u.i; } if (para(3).type==REAL) { g=para(3).u.r; } else { g=para(3).u.i; } if (para(4).type==REAL) { b=para(4).u.r; } else { b=para(4).u.i; } if (para(5).type==REAL) { a=para(5).u.r; } else { a=para(5).u.i; } sasami_light_specular(para(1).u.i,r,g,b,a); } void ed_sasami_light_enabled(void) { if (paracount < 2) usage("sasami_light_specular(light,e)"); if (para(1).type!=INTEGER) usage(" must be an integer"); if (para(2).type!=INTEGER) usage(" must be an integer"); sasami_light_enabled(para(1).u.i,para(2).u.i); } void ed_sasami_light_directional(void) { if (paracount < 2) usage("sasami_light_specular(light,d)"); if (para(1).type!=INTEGER) usage(" must be an integer"); if (para(2).type!=INTEGER) usage(" must be an integer"); sasami_light_directional(para(1).u.i,para(2).u.i); } void ed_sasami_light_attenuation(void) { int i; double a; if (paracount < 2) usage("sasami_light_attenuation(light,attenuation)"); if (para(1).type!=INTEGER) usage(" must be an integer"); if (para(2).type==REAL) { a=para(2).u.r; } else { a=para(2).u.i; } sasami_light_attenuation(para(1).u.i,a); } void ed_sasami_object_visible(void) { if (paracount < 2) usage("sasami_object_visible(object,e)"); if (para(1).type!=INTEGER) usage(" must be an integer"); if (para(2).type!=INTEGER) usage(" must be an integer"); sasami_object_visible(para(1).u.i,para(2).u.i); } #endif /* defined(WANT_SASAMI) && !defined(TTYEDEN) */ rtex(void) { int i; double x,y,z; if (paracount < 4) tkeden1.41/Eden/builtin.h010060000025250000164000000114370743720520500153160ustar00ashleyem00003510000005/* * $Id: builtin.h,v 1.15 2002/02/27 16:34:13 cssbz Exp $ */ /* Adding a new built-in function to Eden: - declare it here in builtin.h - declare it in builtinf.h */ #if INCLUDE != 'T' #define paracount fp->stackp->u.a[0].u.i #define para(n) fp->stackp->u.a[n] #define dpush(x,y,z) x.type=y; x.u.i=(Int)(z); push(x) struct BLIBTBL { char *name; void (*func)(); }; extern struct BLIBTBL blibtbl[]; extern void usage(); #endif /*---------------------------------------------------------*/ #if INCLUDE == 'T' #define BIND(name,func) {name,func}, #else #define BIND(name,func) extern void func(); #endif /*---------------------------------------------------------*/ BIND( "notation", install_notation ) BIND( "exit", b_exit ) BIND( "execute", exec_string ) BIND( "include", exec_file ) BIND( "include_file", exec_file ) BIND( "_eden_internal_cwd", _eden_internal_cwd ) BIND( "_eden_internal_cd", _eden_internal_cd ) BIND( "_eden_internal_dirname", _eden_internal_dirname ) BIND( "_eden_internal_basename", _eden_internal_basename ) BIND( "apply", apply ) BIND( "substr", substr ) BIND( "strcat", scat ) BIND( "sublist", sublist ) BIND( "listcat", lcat ) BIND( "type", t_type ) BIND( "int", t_int ) BIND( "float", t_float ) BIND( "char", t_char ) BIND( "str", t_str ) BIND( "_type_convert", t_super ) BIND( "write", b_write ) BIND( "writeln", writeln ) BIND( "array", array ) BIND( "nameof", nameof ) BIND( "formula_list", formula_list ) BIND( "action_list", action_list ) BIND( "symbols", symbols ) BIND( "symboldetail", symboldetail ) BIND( "symboltext", symboltext ) BIND( "symboltable", symtbl2list ) BIND( "forget", forget ) BIND( "pack", pack ) BIND( "error", user_error ) BIND( "get_msgq", get_msgq ) BIND( "send_msg", send_message ) BIND( "receive_msg", receive_message ) BIND( "remove_msgq", remove_msgq ) BIND( "error_no", error_no ) BIND( "backgnd", backgnd ) BIND( "pipe", pipe_process ) BIND( "getenv", get_environ ) BIND( "putenv", put_environ ) BIND( "printhash", printhash ) BIND( "touch", touch ) BIND( "gettime", gettime ) BIND( "time", inttime ) BIND( "ftime", finetime ) BIND( "feof", f_eof ) BIND( "getchar", get_char ) #ifdef WANT_KBHIT BIND( "kbhit", kbhit ) #endif /* WANT_KBHIT */ BIND( "fgetc", fget_char ) BIND( "stat", file_stat ) BIND( "gets", get_string ) BIND( "fgets", fget_string ) BIND( "ungetc", unget_char ) BIND( "scanf", scan_f ) BIND( "fscanf", fscan_f ) BIND( "sscanf", sscan_f ) #ifdef DISTRIB BIND( "sendServer", sendServer ) BIND( "sendClient", sendClient ) BIND( "propagate", propagate ) BIND( "addAgency", addAgency ) BIND( "removeAgency", removeAgency ) BIND( "checkAgency", checkAgency ) BIND( "queryObs", queryObs ) BIND( "renewObs", renewObs ) #endif /* DISTRIB */ #ifdef NO_CHECK_CIRCULAR BIND( "dcc", dcc ) #endif /* NO_CHECK_CIRCULAR */ #ifdef DEBUG BIND( "debug", debug ) #endif /* DEBUG */ #ifndef TTYEDEN BIND( "Disp2PS", E_Disp2PS ) BIND( "StringRemain", E_StringRemain ) BIND( "tcl", E_tcl ) BIND( "DisplayScreen", DisplayScreen ) BIND( "PlotShape", PlotShape ) #endif BIND( "todo", todo ) #if defined(WANT_SASAMI) && !defined(TTYEDEN) /* Sasami functions */ BIND("sasami_vertex",ed_sasami_vertex) BIND("sasami_set_bgcolour",ed_sasami_set_bgcolour) BIND("sasami_poly_geom_vertex",ed_sasami_poly_geom_vertex) BIND("sasami_poly_tex_vertex",ed_sasami_poly_tex_vertex) BIND("sasami_poly_colour",ed_sasami_poly_colour) BIND("sasami_poly_material",ed_sasami_poly_material) BIND("sasami_object_poly",ed_sasami_object_poly) BIND("sasami_object_pos",ed_sasami_object_pos) BIND("sasami_object_rot",ed_sasami_object_rot) BIND("sasami_object_scale",ed_sasami_object_scale) BIND("sasami_object_visible",ed_sasami_object_visible) BIND("sasami_viewport",ed_sasami_viewport) BIND("sasami_setshowaxes",ed_sasami_setshowaxes) BIND("sasami_material_ambient",ed_sasami_material_ambient) BIND("sasami_material_diffuse",ed_sasami_material_diffuse) BIND("sasami_material_specular",ed_sasami_material_specular) BIND("sasami_material_texture",ed_sasami_material_texture) BIND("sasami_light_pos",ed_sasami_light_pos) BIND("sasami_light_ambient",ed_sasami_light_ambient) BIND("sasami_light_diffuse",ed_sasami_light_diffuse) BIND("sasami_light_specular",ed_sasami_light_specular) BIND("sasami_light_enabled",ed_sasami_light_enabled) BIND("sasami_light_attenuation",ed_sasami_light_attenuation) BIND("sasami_light_directional",ed_sasami_light_directional) #endif /* defined(WANT_SASAMI) && !defined(TTYEDEN) */ #undef BIND tkeden1.41/Eden/builtinf.h010060000025250000164000000053030743720523700154640ustar00ashleyem00003510000005/* * $Id: builtinf.h,v 1.7 2002/02/27 16:34:39 cssbz Exp $ * * builtin or predefined function table * */ /* builtin function table */ { "autocalc" }, { "notation" }, { "exit" }, { "execute" }, { "include" }, { "eager" }, { "include_file" }, { "_eden_internal_cwd" }, { "_eden_internal_cd" }, { "_eden_internal_dirname" }, { "_eden_internal_basename" }, { "cd" }, /* unfortunately having to define the non-_internal versions as well due to VA problems - this means that the user cannot then redefine the initial versions of these functions :( [Ash] */ { "cwd" }, { "dirname" }, { "basename" }, { "apply" }, { "substr" }, { "strcat" }, { "sublist" }, { "listcat" }, { "type" }, { "int" }, { "float" }, { "char" }, { "str" }, { "_type_convert" }, { "write" }, { "writeln" }, { "sendClient" }, { "sendServer" }, { "propagate" }, { "addAgency" }, { "removeAgency" }, { "checkAgency" }, { "FALSE" }, { "TRUE" }, { "ON" }, { "OFF" }, { "MOTION" }, { "ENTER" }, { "LEAVE" }, { "propagateType" }, { "EveryOneAllowed" }, { "synchronize" }, { "higherPriority" }, { "queryObs" }, { "renewObs" }, { "array" }, { "nameof" }, { "formula_list" }, { "action_list" }, { "symbols" }, { "symboldetail" }, { "symboltable" }, { "forget" }, { "pack" }, { "error" }, { "get_msgq" }, { "send_msg" }, { "receive_msg" }, { "remove_msgq" }, { "error_no" }, { "backgnd" }, { "pipe" }, { "getenv" }, { "putenv" }, { "printhash" }, { "touch" }, { "gettime" }, { "time" }, { "ftime" }, { "feof" }, { "getchar" }, { "fgetc" }, { "stat" }, { "gets" }, { "fgets" }, { "ungetc" }, { "scanf" }, { "fscanf" }, { "sscanf" }, { "system" }, #ifdef NO_CHECK_CIRCULAR { "dcc" }, #endif /* NO_CHECK_CIRCULAR */ #ifdef DEBUG { "debug" }, #endif /* DEBUG */ #ifndef TTYEDEN { "Disp2PS" }, { "StringRemain" }, { "tcl" }, { "DisplayScreen" }, { "OpenDisplay" }, { "PlotShape" }, { "DoNaLDdefaultWin" }, #endif { "todo" }, /* for Donald */ { "cart" }, { "CART" }, { "label" }, { "trans" }, { "line" }, { "circle" }, { "rectangle" }, { "arc" }, { "PI" }, { "str" }, { "int" }, { "float" }, { "intersect" }, { "parallel" }, { "perpend" }, { "between" }, { "colinear" }, { "intersects" }, { "separates" }, { "includes" }, { "distlarger" }, { "distsmaller" }, { "dist" }, { "midpoint" }, { "sqrt" }, { "cos" }, { "sin" }, { "tan" }, { "asin" }, { "acos" }, { "atan" }, { "log" }, { "exp" }, { "incident" }, { "ellipse" }, { "DD_random" }, { "rtos" }, { "dotx" }, { "doty" }, { "dot1" }, { "dot2" }, { "dotrad" }, { "dotarg" }, { "polar" }, { "rot" }, { "scale" }, { "vector_add" }, { "vector_sub" }, { "pt_add" }, { "pt_subtract" }, { "scalar_mult" }, { "scalar_div" }, { "scalar_mod" }, /* for adm */ { "sysClock" }, }, { "symboldetail" }, { "symboltable" }, { "forget" }, { "pack" }, { "error" }, { "get_msgq" }, { "send_msg" }, { "receive_msg" }, { "remove_msgq" }, { "error_no" }, { "backgnd" }, { "pipe" }, { "getenv" }, { "putenv" }, { "printhash" }, { "touch" }, { "gettime" }, { "time" }, { "ftime" }, { "feof" }, { tkeden1.41/Eden/code.c010060000025250000164000000502330744001120600145400ustar00ashleyem00003510000005/* * $Id: code.c,v 1.24 2002/03/01 23:45:10 cssbz Exp $ */ static char rcsid[] = "$Id: code.c,v 1.24 2002/03/01 23:45:10 cssbz Exp $"; #include #include #include "../config.h" #include "eden.h" #include "yacc.h" #include "notation.h" #include "emalloc.h" #ifdef HAVE_DMALLOC #include #endif #ifdef DEBUG #define DEBUGPRINT(X,Y,Z) if(Debug&1){fprintf(stderr,X,Y,Z);} #else #define DEBUGPRINT(X,Y,Z) #endif Datum UndefDatum = {UNDEF}; Datum stack[NSTACK]; /* the stack */ Datum *stackp; /* next free spot on stack */ Inst prog[NPROG]; /* the machine */ Inst *progp = prog; /* next free spot for code generation */ Inst *pc; /* program counter during execurtion */ union compiler_flags compiler_flag; Frame frame[NFRAME]; Frame *fp; /* frame pointer */ #define MAXENTRY 200 struct t entry_tbl[MAXENTRY];/* case entry table */ struct t *entry_ptr; /* function prototypes */ void reset_compiler_status(void); void initcode(void); void stack_overflow_err(void); Datum stack_underflow_err(void); void execute(Inst *); void ret_call(void); void call(symptr, Datum, char *); void eval(void); void change_targets(symptr, symptr_QUEUE *); void change_sources(symptr, symptr_QUEUE *); void related_by_code(void); Inst *code(Inst); void codeswitch(struct t *); void addentry(Datum *, Inst *); Inst *saveprog(Inst *, Inst *); void push_text(char *, int); char *savetext(char *); Inst *code_related_by(symptr); Inst *code_related_by_runtimelhs(); Inst *code_definition(int, symptr, Inst *, Inst *, Int, char *); Inst *code_definition_runtimelhs(int, Inst *, Inst *, Int, char *); Inst *code_eval(Inst *, Inst *); void evalDatum(Datum); #ifdef DISTRIB int handle_check(symptr); /* for agency --sun */ int oracle_check(symptr); int handle_check1(char *); int oracle_check1(char *); /* Say we have two definitions, 1) a is b+c, 2) x is y+a. Say agent SUN has a handle on a, but not on x. Strictly SUN should be allowed to change (1), but the change should not propagate to (2) - but this would cause inconsistency and so is not implemented in dtkeden. Instead we turn off all handle checking when performing triggeredActions [Ash, with Patrick] */ int triggeredAction = 0; #endif /* DISTRIB */ /* SUBROUTINE INITIALIZE THE RUN-TIME STATUS */ #define reset_prog_ptr() (progp=prog) void reset_compiler_status(void) { extern void clear_IDlist(void); DEBUGPRINT("VMEXEC|MCSTAT reset_compiler_status\n", 0, 0); reset_prog_ptr(); clear_IDlist(); reset_entry_tbl(); reset_compiler_flags(); } void initcode(void) { reset_frames(); freeheap(); reset_stack(); reset_eval(); reset_compiler_status(); } void stack_overflow_err(void) { error("stack overflow"); } Datum stack_underflow_err(void) { error("stack underflow"); return UndefDatum; /* dummy */ } #ifdef DEBUG /* Normally, push and pop are macros. With debugging, however, I want to be sure that side effect won't be a problem etc, so I'm rewriting them as functions. [Ash] */ inline void push(Datum d) { if (stackp>=&stack[NSTACK]) stack_overflow_err(); else { if (Debug&1) { fprintf(stderr, "DATSTK push "); print(d, stderr, 1); fprintf(stderr, " (datum at 0x%x, pushed to DATSTK %d)\n", &d, stackp - stack); } *stackp++ = d; } } inline Datum pop(void) { Datum d; if (stackp == stack) d = stack_underflow_err(); else { d = *--stackp; if (Debug&1) { fprintf(stderr, "DATSTK pop "); print(d, stderr, 1); fprintf(stderr, " (DATSTK now %d)\n", stackp - stack); } } return d; } #endif /* DEBUG */ #ifdef DEBUG struct INSTTBL { char *name; void (*func) (); }; struct INSTTBL insttbl[] = { #define INCLUDE 'T' #include "inst.h" #undef INCLUDE {0, 0} }; /* Disassemble: convert a VM opcode into its symbolic name [Ash] */ char * disAss(Inst d) { int i; static char addr[30]; /* should be big enough */ for (i = 0; insttbl[i].name; i++) if (d == insttbl[i].func) return insttbl[i].name; /* Not found */ sprintf(addr, "0x%x (%d)", d, d); return addr; } #endif /* DEBUG */ /* RUN-TIME CODE EVALUATE FUNCTION ID(...) WHERE ID = BLTIN, LIB, FUNCTION OR PROCEDURE. */ /* also can used to execute a heap of Inst which ents at (rts) --sun */ void execute(Inst * p) { Inst *resume_point; extern int interrupted; DEBUGPRINT("VMEXEC|VMREAD execute(0x%x) (to start, %d items on DATSTK)\n", p, stackp - stack); resume_point = pc; pc = p; while (*pc && !interrupted) { DEBUGPRINT("VMEXEC|VMREAD execute: next is pc=0x%x, *pc=%s\n", pc, disAss(*pc)); (*(*pc++)) (); } pc = resume_point; DEBUGPRINT("VMEXEC execute end execute(0x%x) (now %d items on DATSTK)\n", p, stackp - stack); } void ret_call(void) { extern void popMasterStack(void), popEntryStack(void); int i; DEBUGPRINT("CALSTK|DATSTK ret_call\n", 0, 0); if (fp->sp) { switch (fp->sp->stype) { case FUNCTION: case PROCMACRO: case PROCEDURE: i = fp->sp->nauto; /* if (stackp != &fp->stackp[i + 1]) { noticef("stack pointer was inconsistent on returning from %s %s (discarding %d Datums from stack)", typename(fp->sp->stype), fp->sp->name, stackp - &fp->stackp[i + 1]); } */ while (i >= 0) freedatum(fp->stackp[i--]); break; } } if (fp->master) popMasterStack(); popEntryStack(); pc = fp->retpc; stackp = fp->stackp; --fp; } void call(symptr sp, Datum args, char *master) { extern void pushEntryStack(int), pushMasterStack(char *); extern void call_lib(Inst), call_float(Inst); int i; Datum d; extern int appAgentName; if (fp++ >= &frame[NFRAME - 1]) { fp--; /* error handling will try to print out info from current frame */ errorf("call to %s %s nested too deeply", typename(sp->stype), sp->name); } DEBUGPRINT("CALSTK|DATSTK call %s: frame level %d\n", sp->name, fp - frame); /* appAgentName--; */ /* This statement may cause AgentName can't be prefixed */ fp->sp = sp; fp->retpc = pc; fp->stackp = stackp; fp->hptr = hptr; pushEntryStack(INTERNAL); fp->master = master; if (master) pushMasterStack(master); /* !@!@ perhaps sp->name here? [Ash] */ switch (sp->stype) { case FUNCTION: case PROCMACRO: case PROCEDURE: #ifdef DEBUG if (Debug & 512) { for (i = 0; i < fp - frame; i++) fprintf(stderr, " "); fprintf(stderr, "%s %s starting: args ", typename(sp->stype), sp->name); print(args, stderr, 1); fprintf(stderr, "\n"); } #endif push(newdatum(args)); /* put the arguments back */ i = sp->nauto; /* creat local variables */ while (i--) pushUNDEF(); execute(sp->inst); #ifdef DEBUG if (Debug & 512) { for (i = 0; i < fp - frame; i++) fprintf(stderr, " "); fprintf(stderr, "%s %s ending: return ", typename(sp->stype), sp->name); print(*(stackp-1), stderr, 1); fprintf(stderr, "\n"); } #endif break; case BLTIN: push(args); /* don't copy the whole structure ! */ ((Inst) sp->inst) (); break; case LIB: push(args); /* don't copy the whole structure ! */ call_lib((Inst) sp->inst); /* call the lib interface */ break; case RLIB: /* floating point C-function */ push(args); call_float((Inst) sp->inst); break; default: errorf("func/proc/procmacro '%s' needed", sp->name); break; } d = newhdat(pop()); /* preserve function return value */ ret_call(); push(d); /* appAgentName++; */ /* same as above problem --sun */ DEBUGPRINT("CALSTK end call %s (level %d)\n", sp->name, fp - frame); } void eval(void) { Datum args; Datum lvalue; DEBUGPRINT("VMOPER|CALSTK eval\n", 0, 0); args = pop(); /* arguments (a list) */ lvalue = pop(); /* lvalue */ switch (lvalue.type) { case BLTIN: case LIB: case RLIB: case FUNCTION: case PROCMACRO: case PROCEDURE: /* This works in this case... fprintf(stderr, "eval %s\n", lvalue.u.sym->name); [Ash] */ call(lvalue.u.sym, args, 0); break; default: errorf("func/proc/procmacro '%s' needed", lvalue.u.sym->name); break; } } /* SUBROUTINE add a symbol to by_list then change the related objects */ void change_targets(symptr sp, symptr_QUEUE * splist) { void refer_by(symptr, symptr_QUEUE *); symptr_QUEUE *A; DEBUGPRINT("SYMTBL|DEFNET change_targets %s\n", sp->name, 0); refer_by(sp, splist); FOREACH(A, splist) { change(A->obj, FALSE /* A->obj->changed */ ); } } /* SUBROUTINE add a symbol to the to_list of formula, function/procedure then change the related objects */ void change_sources(symptr sp, symptr_QUEUE * splist) { void refer_to(symptr, symptr_QUEUE *); extern int appAgentName; #ifdef DISTRIB extern void propagate_agency(symptr); /* for agency --sun */ #endif /* DISTRIB */ DEBUGPRINT("SYMTBL|DEFNET change_sources %s\n", sp->name, 0); switch (sp->stype) { case VAR: case FORMULA: refer_to(sp, splist); /* record (using sources and triggers) that sp refers to splist [Ash] */ change(sp, TRUE); break; case FUNCTION: case PROCMACRO: case PROCEDURE: refer_to(sp, splist); /* record (using sources and triggers) that sp refers to splist [Ash] */ change(sp, !Q_EMPTY(splist)); break; default: error("internal error: change_sources()"); } #ifdef DISTRIB if (appAgentName > 0) propagate_agency(sp); #endif /* DISTRIB */ } /* RUN-TIME CODE check a symbol whether is cyclic defined if ok then add it to the by_list */ void related_by_code(void) { extern int checkok(symptr, symptr_QUEUE *); symptr sp; symptr_QUEUE *splist; #ifdef NO_CHECK_CIRCULAR extern int NCC; #endif /* NO_CHECK_CIRCULAR */ DEBUGPRINT("VMOPER|VMREAD|SYMTBL|DEFNET related_by_code\n", 0, 0); sp = (symptr) (*pc++); splist = (symptr_QUEUE *) (*pc++); #ifdef NO_CHECK_CIRCULAR if (!NCC) #endif /* NO_CHECK_CIRCULAR */ if (!checkok(sp, splist)) error2(sp->name, ": CYCLIC DEFINITION: ABORTED"); change_targets(sp, splist); } /* RUN-TIME CODE check a symbol whether is cyclic defined if ok then add it to the by_list */ void related_by_code_runtimelhs(void) { extern int checkok(symptr, symptr_QUEUE *); symptr sp; symptr_QUEUE *splist; Datum addr; #ifdef NO_CHECK_CIRCULAR extern int NCC; #endif /* NO_CHECK_CIRCULAR */ DEBUGPRINT("VMREAD|SYMTBL|DEFNET related_by_code_runtimelhs\n", 0, 0); addr = pop(); mustaddr(addr, "related_by_code_runtimelhs"); sp = symbol_of(addr); splist = (symptr_QUEUE *) (*pc++); #ifdef NO_CHECK_CIRCULAR if (!NCC) #endif /* NO_CHECK_CIRCULAR */ if (!checkok(sp, splist)) error2(sp->name, ": CYCLIC DEFINITION: ABORTED"); change_targets(sp, splist); } /* ENCODER install one instruction or operand */ Inst * code(Inst f) { Inst *oprogp = progp; #ifdef DEBUG if ((Debug & 1) || (Debug & 1024)) { fprintf(stderr, "VMWRIT code %s to location progp=0x%x\n", disAss(f), progp); } #endif if (progp >= &prog[NPROG]) error("program too big"); *progp++ = f; return oprogp; } /* RUN-TIME CODE actual execution code of formula/function/procedure definition */ void codeswitch(struct t * tbl) { Inst *ip, *defp = (Inst *) 0; struct t *t = tbl; DEBUGPRINT("VRWRIT codeswitch\n", 0, 0); for (; tbl != entry_ptr; tbl++) { if (tbl->dp) { ip = code((Inst) tbl->dp); code((Inst) (tbl->ip - ip)); } else defp = tbl->ip; } entry_ptr = t; /* reset */ ip = code((Inst) 0); if (defp) code((Inst) (defp - ip)); else code((Inst) 2); /* there is no default case */ } /* ENCODER encode ``CASE'' or ``DEFAULT'' entry */ void addentry(Datum * dp, Inst * ip) { if (entry_ptr < &entry_tbl[MAXENTRY]) { entry_ptr->dp = dp; entry_ptr->ip = ip; entry_ptr++; } else error("no. of 'case' overflow"); } Inst * saveprog(Inst * p_begin, Inst * p_end) /* save a piece of program code at a permanent place */ { int size; Inst *p; Inst *q; size = ((char *) p_end) - ((char *) p_begin); p = (Inst *) emalloc(size); /* copy from p_begin to p_end into p (use q as an iterator) [Ash] */ for (q = p; p_begin != p_end;) *q++ = *p_begin++; return p; } #define LARGE_TEXT 0x20000 char textcode[LARGE_TEXT]; /* INPUT TEXT BUFFER */ char *textptr = textcode; /* end position of text buffer */ void push_text(char *text, int len) /* push some text on textcode */ /* len - number of char */ { /* orginal text is temp. stored */ if (textptr + len >= &textcode[LARGE_TEXT]) error("text buffer overflow"); strncpy(textptr, text, len); textptr += len; } char * savetext(char *text) { /* save text buffer permanently */ /* text - start position of text buffer */ char *s; *textptr = '\0'; /* force a null */ s = (char *) emalloc((textptr - text) + 1); return strcpy(s, text); } /* ENCODER encode the definition commands sequences */ /* This is used by the parser for "identifier is expr ';'" and proc/procmacro/func defines [Ash] */ Inst * code_definition(int type, symptr id, Inst * prog_start, Inst * prog_end, Int nauto, char *text) { Inst *p_begin, *p_end; Inst *oprogp; symptr_QUEUE *splist, *save_IDlist(void); #ifdef DISTRIB if (!handle_check(id)) { /* for agency --sun */ splist = save_IDlist(); /* I get the feeling this should clear the IDlist instead of saving it: when will splist be freed? [Ash] */ return progp; } #endif /* DISTRIB */ p_begin = saveprog(prog_start, prog_end); /* save prog_start to prog_end in a permanent place [Ash] */ p_end = p_begin + (prog_end - prog_start); oprogp = progp = prog_start; splist = save_IDlist(); code((Inst) definition); code((Inst) type); code((Inst) id); code((Inst) splist); code((Inst) p_begin); code((Inst) p_end); code((Inst) nauto); code((Inst) savetext(text)); return oprogp; } /* This is used by the parser for "'`'expr'`' is expr ';'", and so id is not passed in or saved. Note the first thing coded is definition_runtimelhs. Other than this, it is the same as code_definition above. This used to (less usefully) be called code_definition1. [Ash] */ Inst * code_definition_runtimelhs(int type, Inst * prog_start, Inst * prog_end, Int nauto, char *text) { Inst *p_begin, *p_end; Inst *oprogp; symptr_QUEUE *splist, *save_IDlist(void); p_begin = saveprog(prog_start, prog_end); p_end = p_begin + (prog_end - prog_start); oprogp = progp = prog_start; splist = save_IDlist(); code((Inst) definition_runtimelhs); /* note the change from code_definition */ code((Inst) type); code((Inst) splist); code((Inst) p_begin); code((Inst) p_end); code((Inst) nauto); code((Inst) savetext(text)); return oprogp; } /* This is used to implement eval(expr). expr is evaluated now (at code time) and is coded as a constant value. I think this was implemented by Patrick. It was originally called code_definition2, which seems a silly name as an eval has no persistent definition sense about it. [Ash] */ Inst * code_eval(Inst * prog_start, Inst * prog_end) { Inst *p_begin, *p_end; Inst *oprogp; Datum *dp, d; char *s; int i; /* extern void print(Datum); */ code((Inst) 0); execute(prog_start); unmarkGarbage(prog_start, progp); /* the next line is used to give up these codes from prog_start to prog_end --sun */ oprogp = progp = prog_start; /* t_str1(pop()); */ d = pop(); dp = (Datum *) emalloc(sizeof(Datum)); dp->type = d.type; switch (d.type) { case STRING: s = (char *) emalloc(strlen(d.u.s) + 1); dp->u.s = (char *) strcpy(s, d.u.s); break; case INTEGER: dp->u.i = d.u.i; break; case REAL: dp->u.r = d.u.r; break; case MYCHAR: dp->u.i = d.u.i; break; case UNDEF: dp->u.i = d.u.i; break; case LIST: /* need more codes --sun */ dp->u.a[0].u.i = d.u.a[0].u.i; for (i = 1; i <= d.u.a[0].u.i; i++) { dp->u.a[i] = d.u.a[i]; } break; default: error("EVAL error : unsuitable usage of eval syntax"); } evalDatum(d); markGarbage(progp, dp); code((Inst) constpush); code((Inst) dp); return oprogp; } /* ENCODER code the ``id ~> [...]'' command */ Inst * code_related_by(symptr sp) { extern symptr_QUEUE *save_IDlist(void); symptr_QUEUE *splist; Inst *ip; splist = save_IDlist(); ip = code((Inst) related_by_code); code((Inst) sp); code((Inst) splist); return ip; } Inst * code_related_by_runtimelhs() { extern symptr_QUEUE *save_IDlist(void); symptr_QUEUE *splist; Inst *ip; splist = save_IDlist(); ip = code((Inst) related_by_code_runtimelhs); code((Inst) splist); return ip; } #ifdef DISTRIB /* SUBROUTE check agency of a symbol --sun */ /* ------------------------------------------------------------------------ */ int handle_check(symptr sp) { extern char agentName[128]; extern char *everyone; if (sp==0) return 1; if (*agentName ==0) return 1; /* mean own */ if (triggeredAction) return 1; /* means it is a triggered action */ /* if (Q_EMPTY(&sp->HandleOf)) return 1; using evryone to allow everyone's agency */ if (search_agent_Q(&sp->HandleOf, everyone)) return 1; if (search_agent_Q(&sp->HandleOf, "SYSTEM")) return 1; if (search_agent_Q(&sp->HandleOf, agentName)) { /*printf("handleOK %s", sp->name);*/ return 1; } /* printf("HandleNo %s %s", agentName, sp->name);*/ return 0; } int handle_check1(char *name) { extern symptr lookup(char *); return handle_check(lookup(name)); } int oracle_check(symptr sp) { extern char agentName[128]; extern char *everyone; if (sp==0) return 1; if (*agentName ==0) return 1; /* means own */ if (triggeredAction) return 1; /* means it is a triggered action */ /* if (Q_EMPTY(&sp->OracleOf)) return 1; using everyone to allow everyone's agency */ if (search_agent_Q(&sp->OracleOf, everyone)) return 1; if (search_agent_Q(&sp->OracleOf, "SYSTEM")) return 1; if (search_agent_Q(&sp->OracleOf, agentName)) { /* printf("OracleOK %s", sp->name); */ return 1; } /* printf("OracleNo %s %s", agentName, sp->name); */ return 0; } int oracle_check1(char *name) { extern symptr lookup(char *); return oracle_check(lookup(name)); } #endif /* DISTRIB */ void evalDatum(Datum d) { char s2[80]; int i; switch (d.type) { case STRING: push_text("\"", 1); push_text(d.u.s, strlen(d.u.s)); push_text("\"", 1); break; case INTEGER: sprintf(s2, "%d", d.u.i); push_text(s2, strlen(s2)); break; case REAL: sprintf(s2, "%f", d.u.r); push_text(s2, strlen(s2)); break; case MYCHAR: push_text("'", 1); sprintf(s2, "%c", d.u.i); push_text(s2, 1); push_text("'", 1); break; case UNDEF: push_text("@", 1); break; case LIST: push_text("[", 1); for (i = 1; i <= d.u.a[0].u.i; i++) { evalDatum(d.u.a[i]); if (i < d.u.a[0].u.i) push_text(",", 1); } push_text("]", 1); break; default: error("EVAL error : unsuitable usage of eval syntax"); } } ++); splist = (symptr_QUEUE *) (*pc++); #ifdef NO_CHECK_CIRCULAR if (!NCC) #endif /* NO_CHECK_CIRCULAR */ if (!checkok(sp, splist)) error2(sp->name, ": CYCLIC DEFINITION: ABORTED"); change_targets(sp, splist); } /* RUN-TIME CODE check a symbol whether is cyclic defined if ok then add it to the by_list */ void related_by_code_rutkeden1.41/Eden/custom.h010060000025250000164000000005210701434525000151460ustar00ashleyem00003510000005/* * $Id: custom.h,v 1.3 1999/11/16 21:20:40 ashley Rel1.10 $ */ struct ILIBTBL { /* C LIB FUNCTIONS */ string name; int (*func) (); }; struct RLIBTBL { /* FLOATING POINT C LIB FUNCTIONS */ string name; double (*func) (); }; extern struct ILIBTBL ilibtbl[]; extern struct RLIBTBL rlibtbl[]; tkeden1.41/Eden/CVS/004070000025250000164000000000000744001151000141115ustar00ashleyem00003510000005tkeden1.41/Eden/CVS/Entries010060000025250000164000000031370744001151000154500ustar00ashleyem00003510000005/Makefile.in/1.14/Mon Feb 18 19:18:41 2002// /agency.q.c/1.6/Fri Jul 27 17:09:09 2001// /agency.q.h/1.2/Tue Nov 16 21:20:40 1999// /builtin.h/1.15/Wed Feb 27 16:34:13 2002// /builtinf.h/1.7/Wed Feb 27 16:34:39 2002// /custom.h/1.3/Tue Nov 16 21:20:40 1999// /eden.h/1.13/Fri Jul 27 17:27:16 2001// /emalloc.h/1.3/Fri Jul 27 17:28:17 2001// /entry.q.c/1.10/Fri Jul 27 17:28:43 2001// /entry.q.h/1.6/Fri Jul 27 17:29:07 2001// /error.h/1.1/Fri Jul 27 17:08:43 2001// /eval.c/1.12/Mon Feb 18 19:27:11 2002// /global.q.c/1.8/Fri Jul 27 17:31:17 2001// /hash.h/1.3/Tue Nov 16 21:20:40 1999// /heap.c/1.10/Fri Jul 27 17:32:20 2001// /input_device.h/1.5/Fri Jul 27 17:34:19 2001// /inst.h/1.9/Wed Feb 27 16:37:24 2002// /keyword.h/1.5/Fri Jul 27 17:35:51 2001// /lex.c/1.30/Mon Feb 18 19:28:14 2002// /lib.c/1.7/Mon Feb 18 19:29:51 2002// /machine.h/1.4/Fri Jul 27 17:50:35 2001// /macosxlibloc.c/1.1/Mon Feb 18 19:14:58 2002// /notation.h/1.8/Fri Aug 3 15:49:03 2001// /refer.c/1.8/Fri Jul 27 17:52:39 2001// /runset.c/1.9/Thu Dec 6 22:48:41 2001// /runset.h/1.4/Tue Nov 16 21:20:40 1999// /screen.q.c/1.6/Fri Jul 27 17:54:03 2001// /screen.q.h/1.3/Fri Jul 27 17:54:29 2001// /symbol.c/1.11/Fri Jul 27 17:56:37 2001// /symptr.q.c/1.8/Fri Jul 27 17:57:16 2001// /symptr.q.h/1.5/Fri Jul 27 17:57:42 2001// /trans.c/1.9/Wed Feb 27 16:50:00 2002// /type.c/1.19/Thu Dec 6 22:50:22 2001// /builtin.c/1.46/Fri Mar 1 23:44:26 2002// /code.c/1.24/Fri Mar 1 23:45:10 2002// /global.q.h/1.8/Fri Mar 1 23:45:34 2002// /machine.c/1.21/Fri Mar 1 23:46:19 2002// /main.c/1.53/Fri Mar 1 23:47:43 2002// /yacc.y/1.18/Fri Mar 1 23:48:22 2002// D tkeden1.41/Eden/CVS/Repository010060000025250000164000000000140743723740600162310ustar00ashleyem00003510000005tkeden/Eden tkeden1.41/Eden/CVS/Root010060000025250000164000000000550743723740600150020ustar00ashleyem00003510000005cssbz@cvs.eden.sourceforge.net:/cvsroot/eden tkeden1.41/Eden/eden.h010060000025250000164000000127400733032216400145550ustar00ashleyem00003510000005/* * $Id: eden.h,v 1.13 2001/07/27 17:27:16 cssbz Exp $ */ #ifdef NO_CHECK_CIRCULAR extern int NCC; #endif /* NO_CHECK_CIRCULAR */ #ifdef DEBUG extern int Debug; #endif /* DEBUG */ #ifndef FALSE #define FALSE (0) #endif #ifndef TRUE #define TRUE (1) #endif typedef int Int; /* pointer compatible integer */ typedef void (*Inst) (); typedef struct symbol *symptr; typedef struct Datum Datum; typedef union uDatum uDatum; #include "symptr.q.h" #ifdef DISTRIB /* For the three item agency list [Ash, with Patrick] */ #include "agency.q.h" #endif /* DISTRIB */ typedef struct symbol { char *name; /* variable name */ short stype; /* symbol type */ Inst *inst; /* instruction entry */ unsigned nauto; /* no. of local variables */ char *text; /* original text of definition, if any */ struct Datum { short type; /* data type */ union uDatum { double r; int i; /* integer/char */ char *s; /* string */ Datum *a; /* list */ symptr sym; /* symbol pointer */ struct { int x; int y; } v; } u; } d; symptr_QUEUE sources, targets; symptr_ATOM Qloc; /* location in action_queue / formula_queue */ char marked:1; /* flag */ char changed:1; /* flag */ char entry:6; /* 0 = INTERNAL, 1 = EDEN, 2 = DoNaLD, 3 = Scout, 4 = ARCA */ char *master; /* who change this symbol */ #ifdef DISTRIB agent_QUEUE OracleOf, HandleOf, StateOf; /* agency of all agents in this symbol(observable) --sun */ #endif /* DISTRIB */ symptr next; /* to link to another */ } symbol; /* bylist & tolist: for backward compatibility */ #define bylist targets #define tolist sources symptr install(char *, int, int, int); symptr lookup(char *); #include "error.h" extern Datum UndefDatum; extern Inst *progp, *progbase, prog[]; extern union compiler_flags { struct { unsigned define_level:8; unsigned loop_level:8; unsigned switch_level:8; unsigned formula:1; unsigned local_declare:1; unsigned arg_declare:1; unsigned procmacro:1; } s; int all; /* an int is 32 bit */ } compiler_flag; extern struct t { Datum *dp; Inst *ip; } *entry_ptr, entry_tbl[]; #define reset_entry_tbl() (entry_ptr=entry_tbl) #define reset_compiler_flags() (compiler_flag.all = 0) #define indef compiler_flag.s.define_level #define informula compiler_flag.s.formula #define inauto compiler_flag.s.local_declare #define inpara compiler_flag.s.arg_declare #define inloop compiler_flag.s.loop_level #define inswitch compiler_flag.s.switch_level #define inprocmacro compiler_flag.s.procmacro extern Datum newdatum(Datum); extern Datum newhdat(Datum); extern void freedatum(Datum); #define INCLUDE 'H' #include "inst.h" #undef INCLUDE /*----- typecheck.h -----*/ #define ADDRESSMASK 0xF000 #define SYMBOL 0x1000 #define LOCALV 0x2000 #define POINTERTYPE 0x0FFF #define DPTR 0x0001 #define CPTR 0x0002 #define isundef(d) (d.type == UNDEF) #define ischar(d) (d.type == MYCHAR) #define isstr(d) (d.type == STRING) #define isint(d) (d.type == INTEGER) #define isnum(d) (d.type==REAL||d.type==INTEGER||d.type==MYCHAR) #define is_address(d) (d.type & ADDRESSMASK) #define is_symbol(d) (is_address(d)==SYMBOL) #define is_local(d) (is_address(d)==LOCALV) #define address_type(d) (d.type & POINTERTYPE) #define dptr(d) ((Datum*)d.u.v.x) #define cptr(d) ((char *)d.u.s) #define symbol_of(d) ((symptr)d.u.v.y) #define local(d) (d.u.v.y) /*----- code.h -----*/ #define NSTACK 1024 extern Datum stack[]; /* the stack */ extern Datum *stackp; /* next free spot on stack */ #define top_of_stack stackp[-1] /* top of stack */ #ifdef DEBUG #define reset_stack() ((Debug&1 ? fprintf(stderr, "DATSTK reset_stack\n") \ : 0), \ stackp=stack) #else /* not DEBUG */ #define reset_stack() (stackp=stack) #endif extern Datum stack_underflow_err(void); extern void stack_overflow_err(void); #ifdef DEBUG #include void push(Datum); Datum pop(void); #else /* not DEBUG */ #define push(d) \ if (stackp>=&stack[NSTACK]) stack_overflow_err(); else *stackp++ = d #define pop() \ (stackp==stack? stack_underflow_err() : *--stackp) #endif /* DEBUG */ #define NPROG 5000 extern Inst prog[]; /* the machine */ extern Inst *progp; /* next free spot for code generation */ extern Inst *pc; /* program counter during execurtion */ typedef struct Frame { /* proc/func call stack frame */ symptr sp; /* symbol table entry */ Inst *retpc; /* where to resume after return */ Datum *stackp; /* the stack to be resume */ char *hptr; /* heap pointer */ char *master; /* master of the call */ } Frame; #define NFRAME 100 extern Frame frame[]; extern Frame *fp; /* frame pointer */ #define reset_frames() (fp=frame) /* INPUT DEVICE TYPES */ #define STRING_DEV 0 #define FILE_DEV 1 /*----- refer -----*/ #define NID 100 extern symptr_QUEUE IDlist; extern void addID(symptr); /*----- heap -----*/ #define HEAPSIZE 0x200000 /* change from 0x100000 for classroom --sun */ extern char *hptr, heap[]; extern char *getheap(int); extern void freeheap(void); /*----- eval -----*/ extern void reset_eval(void); extern void mark_changed(symptr); extern void change(symptr, int); tkeden1.41/Eden/emalloc.h010060000025250000164000000025010733032226100152460ustar00ashleyem00003510000005/* * $Id: emalloc.h,v 1.3 2001/07/27 17:28:17 cssbz Exp $ */ /* Error checking malloc functions - rewritten as macros so that we can tell where the memory leaks are using dmalloc [Ash] */ #include #include "error.h" #include "../config.h" #ifdef HAVE_DMALLOC #include #endif #if defined(DEBUG) && !defined(HAVE_DMALLOC) #include void *emalloc_p; extern int Debug; /* This will make a mess if used with expressions with side-effect. The info provided is also too simplistic to figure out where a memory leak might be occurring: for that, use dmalloc... [Ash] */ #define emalloc(n) ((emalloc_p = malloc(n)) ? \ (Debug&64 ? \ fprintf(stderr, \ "MALLOC emalloc(%d) 0x%x\n", n, emalloc_p) \ : 0),\ emalloc_p : \ (error("out of memory"), (void *)NULL) \ ) #define free(x) ((Debug&64 ? fprintf(stderr, "MALLOC free 0x%x\n", x) \ : 0), free(x)) #else /* not debugging */ void *emalloc_p; #define emalloc(n) ((emalloc_p = malloc(n)) ? \ emalloc_p \ : \ (error("out of memory"), (void *)NULL) \ ) #endif void *erealloc_p; #define erealloc(ptr, size) ((erealloc_p = realloc(ptr, size)) ? \ erealloc_p \ : \ (error("system error: erealloc"), (void *)NULL) \ ) tkeden1.41/Eden/entry.q.c010060000025250000164000000020150733032231300152230ustar00ashleyem00003510000005/* * $Id: entry.q.c,v 1.10 2001/07/27 17:28:43 cssbz Exp $ */ static char rcsid4[] = "$Id: entry.q.c,v 1.10 2001/07/27 17:28:43 cssbz Exp $"; #include "../config.h" #include "entry.q.h" /* function prototypes */ entry_QUEUE *SEARCH_entry(entry_QUEUE *, entry, int); void DELETE_entry_ATOM(entry_QUEUE *, entry_ATOM); void MOVE_entry_Q(entry_QUEUE *, entry_QUEUE *); /* return the position of the n-th object in a entry queue */ entry_QUEUE * SEARCH_entry(entry_QUEUE * Q, entry obj, int n) { entry_QUEUE *P; FOREACH(P, Q) { if (EQUAL_entry(obj, P->obj) && !--n) return P; } return (entry_QUEUE *) 0; /* NOT FOUND */ } void DELETE_entry_ATOM(entry_QUEUE * Q, entry_ATOM A) { if (A && A != Q) { A->prev->next = A->next; A->next->prev = A->prev; DESTROY_entry_ATOM(A); } } void MOVE_entry_Q(entry_QUEUE * Qsrc, entry_QUEUE * Qdst) { if (!Q_EMPTY(Qsrc)) { (Qdst->prev->next = Qsrc->next)->prev = Qdst->prev; (Qsrc->prev->next = Qdst)->prev = Qsrc->prev; CLEAN_Q(Qsrc); } } tkeden1.41/Eden/entry.q.h010060000025250000164000000027520733032234300152430ustar00ashleyem00003510000005/* * $Id: entry.q.h,v 1.6 2001/07/27 17:29:07 cssbz Exp $ */ #include "global.q.h" #ifndef _ENTRY_Q_H struct entry_queue { struct entry_queue *prev; struct entry_queue *next; entry obj; }; typedef struct entry_queue entry_QUEUE; typedef entry_QUEUE *entry_ATOM; extern entry_QUEUE *SEARCH_entry(entry_QUEUE *, entry, int); extern void DELETE_entry_ATOM(entry_QUEUE *, entry_ATOM); extern void MOVE_entry_Q(entry_QUEUE *, entry_QUEUE *); #ifndef NEW_entry #define NEW_entry(OBJ) OBJ #endif #ifndef FREE_entry #define FREE_entry(OBJ) /* do nothing */ #endif #ifndef EQUAL_entry #define EQUAL_entry(A,B) ((A)==(B)) #endif #define DESTROY_entry_ATOM(A) \ { \ FREE_entry((A)->obj); \ free(A); \ } #define DELETE_NTH_entry(Q,OBJ,n) DELETE_entry_ATOM(Q,SEARCH_entry(Q,OBJ,n)) #define DELETE_FIRST_entry(Q,OBJ) DELETE_entry_ATOM(Q,SEARCH_entry(Q,OBJ,1)) #define DELETE_FRONT_entry(Q) DELETE_entry_ATOM(Q,FRONT(Q)) #define DELETE_LAST_entry(Q) DELETE_entry_ATOM(Q,LAST(Q)) #define CLEAR_entry_Q(Q) \ while (!Q_EMPTY(Q)) DELETE_entry_ATOM(Q,(Q)->next) #define APPEND_entry_Q(Q,OBJ) \ { \ entry_ATOM A; \ ALLOC_ATOM(A); \ A->obj = NEW_entry(OBJ); \ APPEND_Q(Q,A); \ } #define INSERT_entry_Q(Q,OBJ) \ { \ entry_ATOM A; \ ALLOC_ATOM(A); \ A->obj = NEW_entry(OBJ); \ INSERT_Q(Q,A); \ } #define CONCAT_entry_Q(Qdst, Qsrc) \ { \ entry_QUEUE *P; \ FOREACH (P, Qsrc) APPEND_entry_Q(Qdst, P->obj); \ } #define IN_entry_Q(Q,OBJ) SEARCH_entry(Q,OBJ,1) #define _ENTRY_Q_H #endif W_entry(OBJ) OBJ #enditkeden1.41/Eden/error.h010070000025250000164000000004140733032003300147600ustar00ashleyem00003510000005/* * $Id: error.h,v 1.1 2001/07/27 17:08:43 cssbz Exp $ */ /* error.h */ extern void errorf(char *, ...); #define error(s) errorf("%s", s) #define error2(s, t) errorf("%s%s", s, t) extern void notice(char *, char *); extern void msgContent(char *, char *, int); tkeden1.41/Eden/eval.c010060000025250000164000000242160743425261700145770ustar00ashleyem00003510000005/* * $Id: eval.c,v 1.12 2002/02/18 19:27:11 cssbz Exp $ */ static char rcsid[] = "$Id: eval.c,v 1.12 2002/02/18 19:27:11 cssbz Exp $"; #include #include "../config.h" #include "eden.h" #include "yacc.h" #ifdef DEBUG #define DEBUGPRINT(s,t) if (Debug&1)fprintf(stderr,s,t); #define DEBUGPRINT2(s,t,u) if (Debug&1)fprintf(stderr,s,t,u); #else #define DEBUGPRINT(s,t) #define DEBUGPRINT2(s,t,u) #endif /* for debugging only */ #define print_action_list() {\ extern void action_list();\ action_list();\ print(pop(),stderr,1);\ printf("\n");\ } #define address(sp) { Datum d; d.type = SYMBOL | DPTR; d.u.v.x = (Int) &sp->d; d.u.v.y = (Int) sp; push(d); } symptr_QUEUE formula_queue = EMPTYQUEUE(formula_queue); symptr_QUEUE action_queue = EMPTYQUEUE(action_queue); /* function prototypes */ static void schedule(symptr); void schedule_parents_of(symptr); void resetLock(void); void eval_formula_queue(void); void invoke_action_queue(void); void eager(void); void change(symptr, int); void mark_changed(symptr); void formula_list(void); void action_list(void); void reset_eval(void); /* schedule: adds a given symbol to the appropriate queue depending upon its type. Formulae are added to the formula queue; actions are added to the action queue if they have sources (ie if it is a "triggered action" -- proc p:v {} is a triggered action, proc p {} is not); other types are ignored. If it is already in the queue, then move it to the end, so duplicates do not appear. This rule does not apply in dtkeden if synchronize is on. In this case, we may want to faithfully enact each redefinition, as they may be coming from another machine, even if we have not managed to finish evaluating the queue yet. Hence duplicates are allowed in this case. [Ash] */ static void schedule(symptr sp) { register symptr_ATOM P; register symptr_QUEUE *Q; #ifdef DISTRIB extern Int *synchronize; #endif /* DISTRIB */ switch (sp->stype) { case FORMULA: DEBUGPRINT("FQUEUE schedule %s\n", sp->name); Q = &formula_queue; break; case BLTIN: case PROCEDURE: case FUNCTION: case PROCMACRO: DEBUGPRINT("AQUEUE schedule %s\n", sp->name); Q = &action_queue; break; default: /* If VAR, for example */ DEBUGPRINT2("schedule: not scheduling %s %s\n", typename(sp->stype), sp->name); return; /* don't queue up */ } /* if (P = SEARCH_symptr(Q, sp, 1)) { */ #ifdef DISTRIB if ((P = sp->Qloc) && !*synchronize) /* This may raise a problem in a distributed or synchronized environment, because some information will be missed. For example, if we want to make a train move smoothly, we need to show every slight move. But this reschedule may make previous movements disappear. So we take synchronization into account --sun */ #else if ((P = sp->Qloc)) #endif /* not DISTRIB */ { /* Already there --> reschedule */ DELETE_ATOM(Q, P); APPEND_Q(Q, P); } else { /* Not there --> put it at the end */ switch (sp->stype) { case FORMULA: APPEND_symptr_Q(Q, sp); sp->Qloc = Q->prev; break; case BLTIN: case PROCEDURE: case PROCMACRO: case FUNCTION: /* if it's an action */ if (!Q_EMPTY(&sp->sources)) { APPEND_symptr_Q(Q, sp); sp->Qloc = Q->prev; } break; } } } /*----------------------------------------------** ** queue up all formulae and actions ** ** which depends on v ** **----------------------------------------------*/ void schedule_parents_of(symptr v) { /* builtin function */ register symptr_ATOM P; register symptr_QUEUE *Q; Q = &v->targets; FOREACH(P, Q) { mark_changed(P->obj); /* this target and recursively all of its targets... [Ash] */ schedule(P->obj); } } static int lock = FALSE; /* prevent nested eval & invoke of formula and action */ /* resetLock status after error */ void resetLock(void) { DEBUGPRINT("MCSTAT resetLock\n", 0); lock = FALSE; } / evaluate all formulae in the formula queue / /* eval_formula_queue(). This procedure prevents reentry by use of a lock: attempts to reenter whilst in execution will do nothing. Take one symbol at a time from the front of the formula queue. If it is marked as changed, and if it is ready (all its sources have unchanged values), then run its VM code to form its new value. Any formulae in the queue which are unchanged or not ready are not evaluated: they will presumably be done at the next eval_formula_queue, or perhaps they will be added to the end of the queue during this process. When this process has finished, evaluate the action queue (so that the state represented by definitions is presented as consistent to the actions). [Ash] */ void eval_formula_queue(void) { /* internal */ extern void update(symptr); extern int ready(symptr); register symptr_QUEUE *Q; register symptr sp; #ifdef DISTRIB extern int triggeredAction; #endif /* DISTRIB */ if (lock) return; lock = TRUE; Q = &formula_queue; DEBUGPRINT("MCSTAT|FQUEUE|SYMTBL|AQUEUE eval_formula_queue\n", 0); while (!Q_EMPTY(Q)) { sp = FRONT(Q)->obj; DELETE_FRONT_symptr(Q); sp->Qloc = 0; if (sp->changed) { if (ready(sp)) { DEBUGPRINT("eval_formula_queue: formula %s changed and ready: evaluating it\n", sp->name); #ifdef DISTRIB triggeredAction = 1; #endif /* DISTRIB */ /* evaluate the formula by executing its VM code */ update(sp); #ifdef DISTRIB triggeredAction = 0; #endif /* DISTRIB */ } else { DEBUGPRINT("eval_formula_queue: formula %s not ready: not evaluating it\n", sp->name); } } else { DEBUGPRINT("eval_formula_queue: formula %s not changed: not evaluating it\n", sp->name); } } lock = FALSE; if (!Q_EMPTY(&action_queue)) invoke_action_queue(); } / invoke all actions in the action queue / /* invoke_action_queue(). This procedure prevents reentry by use of a lock: attempts to reenter whilst in execution will do nothing. Take one symbol at a time from the front of the action queue. If it is ready (we don't care if it is marked as changed: actions are always evaluated if they are on the queue), call it, then throw away the value returned. Actions in the queue which are not ready (which have sources which are changed) are not evaluated: they will presumably be done at the next invoke_action_queue, or perhaps they will be added to the end of the queue during this process. When this process has finished, evaluate the formula queue if it now has items (so that formula and action queues are executed until they are empty). [Ash] */ void invoke_action_queue(void) { /* internal */ extern void call(symptr, Datum, char *); extern int ready(symptr); register symptr_QUEUE *Q; register symptr sp; Datum d; if (lock) return; lock = TRUE; Q = &action_queue; DEBUGPRINT("MCSTAT|AQUEUE|DATSTK|FQUEUE invoke_action_queue\n", 0); while (!Q_EMPTY(Q)) { sp = FRONT(Q)->obj; DELETE_FRONT_symptr(Q); sp->Qloc = 0; if (ready(sp)) { DEBUGPRINT("invoke_action_queue: invoke action %s\n", sp->name); makearr(0); d = pop(); /* creat null arguments */ call(sp, d, sp->name); /* invoke action */ popd(); /* drop the value returned */ /* eval_formula_queue(); */ } else { DEBUGPRINT("invoke_action_queue: action %s not invoked\n", sp->name); } } lock = FALSE; if (!Q_EMPTY(&formula_queue)) eval_formula_queue(); } /* eager(): force formula and action queue to evaluate (unless autocalc off) */ #ifndef TTYEDEN #include extern Tcl_Interp *interp; #endif void eager(void) { /* builtin C function */ int lockvalue; DEBUGPRINT("VMOPER|MCSTAT|FQUEUE eager\n", 0); lockvalue = lock; lock = FALSE; eval_formula_queue(); lock = lockvalue; #ifndef TTYEDEN Tcl_EvalEC(interp, "update"); #endif } /* change(): put `sp' in schedule and if `autocalc' is enabled evaluate it */ void change(symptr sp, int flag) { extern Int *autocalc; register Inst *savepc; DEBUGPRINT2("SYMTBL|FQUEUE|VMEXEC change %s->changed = %d)\n", sp->name, flag); sp->changed = flag; schedule(sp); schedule_parents_of(sp); /* schedule all targets of sp. Mark all targets of sp as changed. Additionally mark all targets of those targets as changed. (Why not follow all the way until find already marked as changed or end of the chain?) [Ash] */ if (*autocalc) { savepc = pc; eval_formula_queue(); /* invoke_action_queue(); */ pc = savepc; } } /* Recursively mark all targets (and targets of targets, and targets of targets of targets etc) as changed [Ash] */ void mark_changed(symptr sp) { register symptr_QUEUE *P, *Q; DEBUGPRINT("SYMTBL mark_changed(%s)\n", sp->name); if (!sp->changed) { /* not already marked */ sp->changed = TRUE; Q = &sp->targets; FOREACH(P, Q) mark_changed(P->obj); } } /* convert formula-queue to a list of pointers */ void formula_list(void) { /* builtin function */ register int count; register symptr_ATOM P; register symptr_QUEUE *Q; count = 0; Q = &formula_queue; FOREACH(P, Q) { address(P->obj); count++; } makearr(count); } /* convert action-queue to a list of pointers */ void action_list(void) { /* builtin function */ register symptr_ATOM P; register symptr_QUEUE *Q; register int count; count = 0; Q = &action_queue; FOREACH(P, Q) { address(P->obj); count++; } makearr(count); } void reset_eval(void) { register symptr_ATOM P; register symptr_QUEUE *Q; DEBUGPRINT("MCSTAT|FQUEUE|AQUEUE reset_eval\n", 0); lock = FALSE; Q = &formula_queue; FOREACH(P, Q) { P->obj->Qloc = 0; } CLEAR_symptr_Q(&formula_queue); Q = &action_queue; FOREACH(P, Q) { P->obj->Qloc = 0; } CLEAR_symptr_Q(&action_queue); } ROCEDURE: case FUNCTION: case PROCMACRO: DEBUGPRINT("AQUEUE schedule %s\n", sp->name); Q = &action_queue; break; default: /* If VAR, for example */ DEBUGPRINT2("schedule: not scheduling %s %s\n", typename(sp->stype), sp->name); return; /* don't queue up */ } /* if (P = SEARCH_symptr(Q, sp, 1)) { */ #ifdef DISTRItkeden1.41/Eden/global.q.c010060000025250000164000000010210733032254500153250ustar00ashleyem00003510000005/* * $Id: global.q.c,v 1.8 2001/07/27 17:31:17 cssbz Exp $ */ static char rcsid2[] = "$Id: global.q.c,v 1.8 2001/07/27 17:31:17 cssbz Exp $"; #include "../config.h" #include "global.q.h" /* function prototypes */ int Q_LEN(QUEUE *); QUEUE *WHERE_IS(QUEUE *, int); int Q_LEN(QUEUE * Q) { int count = 0; QUEUE *P; FOREACH(P, Q) count++; return count; } QUEUE * WHERE_IS(QUEUE * Q, int n) { QUEUE *P; for (P = FRONT(Q); P && --n; P = NEXT(Q, P)); return P; } tkeden1.41/Eden/global.q.h010060000025250000164000000025660744001123600153430ustar00ashleyem00003510000005/* * $Id: global.q.h,v 1.8 2002/03/01 23:45:34 cssbz Exp $ */ #ifndef _GLOBAL_Q_H #include "emalloc.h" struct eden_queue { struct eden_queue *prev; struct eden_queue *next; void *obj; /* dummy */ }; typedef struct eden_queue QUEUE; /* This is how this seems to be organised: - items are added to the head of the queue - the head of the queue can be found at *(Q->next) - the end of the queue is detected by (A->next) == Q [Ash] */ #define EMPTYQUEUE(Q) {&Q, &Q} #define CLEAN_Q(Q) ((Q)->prev=(Q)->next=(Q)) #define Q_EMPTY(Q) ((Q)->next==(Q)) /* Remove atom A */ #define DELETE_ATOM(Q,A) \ (((A)->prev->next=(A)->next)->prev=(A)->prev,(A)->prev=(A)->next=0) /* Insert A at Q: where Q was, A is, and Q==A->next */ #define INSERT_ATOM(Q,A) \ ((((A)->prev=((A)->next=(Q))->prev)->next=(A)),(Q)->prev=(A)) /* Insert A just after Q: Q->next==A */ #define APPEND_ATOM(Q,A) \ ((((A)->next=((A)->prev=(Q))->next)->prev=(A)),(Q)->next=(A)) #define APPEND_Q(Q,A) INSERT_ATOM(Q,A) #define INSERT_Q(Q,A) APPEND_ATOM(Q,A) #define NEXT(Q,A) ((Q)==(A)->next?0:(A)->next) #define PREV(Q,A) ((Q)==(A)->prev?0:(A)->prev) #define FRONT(Q) NEXT(Q,Q) #define LAST(Q) PREV(Q,Q) #define ALLOC_ATOM(A) (A=emalloc(sizeof(*A))) #define FOREACH(A,Q) for(A=FRONT(Q);A;A=NEXT(Q,A)) extern int Q_LEN(QUEUE *); extern QUEUE *WHERE_IS(QUEUE *, int); #define _GLOBAL_Q_H #endif tkeden1.41/Eden/hash.h010060000025250000164000000001670701434525000145650ustar00ashleyem00003510000005/* * $Id: hash.h,v 1.3 1999/11/16 21:20:40 ashley Rel1.10 $ */ #define HASHSIZE 127 /* 1 smaller than power of 2 */ tkeden1.41/Eden/heap.c010060000025250000164000000043140733032264400145530ustar00ashleyem00003510000005/* * $Id: heap.c,v 1.10 2001/07/27 17:32:20 cssbz Exp $ */ static char rcsid[] = "$Id: heap.c,v 1.10 2001/07/27 17:32:20 cssbz Exp $"; /*** * HEAP MEMORY MANAGER * ***/ #include "../config.h" #include "eden.h" #include #ifdef DEBUG #define DEBUGPRINT(s,t) {if(Debug&1)fprintf(stderr,s,t);} #else #define DEBUGPRINT(s,t) #endif char heap[HEAPSIZE]; char *hptr; /* function prototypes */ char *getheap(int); void freeheap(void); #define heap_overflow(p) ((p)>=&heap[HEAPSIZE]) /* Note that freeheap must be called before getheap is ever called, or else hptr will be uninitialised. [Ash] */ char * getheap(int size) { /* allocate memory from heap */ char *p; DEBUGPRINT("HEAPAL getheap(%d) ", size); DEBUGPRINT("start hptr=0x%x ", hptr); /* printf("ASH: getheap(%d). hptr currently=0x%x\n", size, hptr); */ if (heap_overflow(hptr + size)) error("heap overflow"); p = hptr; hptr = hptr + size; /* printf("ASH: hptr now=0x%x\n", hptr); */ /* Ensure the pointer is correctly aligned, so that the next allocated block does not cause an unaligned access when the data is accessed [Ash] */ if (((int) hptr & (DOUBLE_ALIGNMENT-1)) != 0) { hptr += DOUBLE_ALIGNMENT - ((int) hptr & (DOUBLE_ALIGNMENT-1)); /* printf("ASH: Corrected hptr=0x%x\n", hptr); */ } /* * sy's old version: * * #ifdef __GNUC__ * GCC requires double values on 8-byte boundaries on a Sparc * hptr += ((((int) hptr & 7) == 0) ? 0 : 8 - ((int) hptr & 7)); * #else * 4-byte boundaries alignment is enough for CC * hptr += ((((int) hptr & 3) == 0) ? 0 : 4 - ((int) hptr & 3)); * #endif */ DEBUGPRINT("end hptr=0x%x\n", hptr); return p; } void freeheap(void) { /* free heap by resetting the heap ptr */ DEBUGPRINT("VMOPER|HEAPAL freeheap ", 0); DEBUGPRINT("start hptr=0x%x ", hptr); if (fp == frame) hptr = heap; else hptr = fp->hptr; if (((int) hptr & (DOUBLE_ALIGNMENT-1)) != 0) { hptr += DOUBLE_ALIGNMENT - ((int) hptr & (DOUBLE_ALIGNMENT-1)); } DEBUGPRINT("end hptr=0x%x\n", hptr); } tkeden1.41/Eden/input_device.h010060000025250000164000000024540733032303300163150ustar00ashleyem00003510000005/* * $Id: input_device.h,v 1.5 2001/07/27 17:34:19 cssbz Exp $ */ struct input_device { /* Input device */ char *name; /* File name */ short type; /* Device type: file / string */ char *ptr; /* File-ptr / char-ptr */ char *sptr; /* Pointer to buffer for strings */ char newline; /* Newline read? */ int lineno; /* Line number */ int lastc; /* The forward char of last device */ char *linebuf; /* Buffer to hold the current line (for error messages) [Ash] */ int linebufsize; /* Currently allocated size of linebuf [Ash] */ int charno; /* Index of last read character in linebuf (for error messages) [Ash] */ int linebufend; /* Index of last written character in linebuf (which might not be charno after flushRestOfLine) [Ash] */ #ifdef TTYEDEN int usereadline; /* whether to use readline or just simple getc [Ash] */ #endif Frame *frame; /* Frame */ jmp_buf begin; /* Resume point when error occurred */ } Input_Devices[16]; /* 15 levels of input */ extern struct input_device *Inp_Dev; tkeden1.41/Eden/inst.h010060000025250000164000000037710743720550400146310ustar00ashleyem00003510000005/* * $Id: inst.h,v 1.9 2002/02/27 16:37:24 cssbz Exp $ */ /* This file defines C functions that can be used as Eden VM opcodes: ie function pointers to them can be coded into the prog array and they can be invoked by execute() or from somewhere else by a function pointer dereference. This file gets included from eden.h, when INCLUDE should be set to 'H' for Header, and from code.c if DEBUG is defined, for use in the disAss function, when INCLUDE should be set to 'T' to Table. [Ash] */ #if INCLUDE == 'H' #define INSTFUNC(name)extern void name(void); #elif INCLUDE == 'T' #ifdef __STDC__ #define INSTFUNC(name){#name, name}, #else /* not __STDC__... */ #define INSTFUNC(name){"name", name}, #endif #else #error Wrong value for preprocessor INCLUDE #endif /* These opcodes are defined in machine.c */ INSTFUNC(add) INSTFUNC(sub) INSTFUNC(mul) INSTFUNC(divide) INSTFUNC(mod) INSTFUNC(negate) INSTFUNC(lazy_not) INSTFUNC(not) INSTFUNC(concat) INSTFUNC(concatopt) INSTFUNC(jmp) INSTFUNC(jpt) INSTFUNC(jpf) INSTFUNC(jpnt) INSTFUNC(jpnf) INSTFUNC(and) INSTFUNC(or) INSTFUNC(ddup) INSTFUNC(popd) INSTFUNC(pushUNDEF) INSTFUNC(pushint) INSTFUNC(constpush) INSTFUNC(cnv_2_bool) INSTFUNC(gt) INSTFUNC(lt) INSTFUNC(ge) INSTFUNC(le) INSTFUNC(eq) INSTFUNC(ne) INSTFUNC(switchcode) INSTFUNC(definition) INSTFUNC(definition_runtimelhs) INSTFUNC(assign) INSTFUNC(inc_asgn) INSTFUNC(dec_asgn) INSTFUNC(pre_inc) INSTFUNC(post_inc) INSTFUNC(pre_dec) INSTFUNC(post_dec) INSTFUNC(noupdate) INSTFUNC(resetupdate) INSTFUNC(addr) INSTFUNC(lookup_address) INSTFUNC(localaddr) INSTFUNC(indexcalc) INSTFUNC(makelist) INSTFUNC(getvalue) INSTFUNC(sel) INSTFUNC(listsize) INSTFUNC(shift) INSTFUNC(append) INSTFUNC(insert) INSTFUNC(delete) INSTFUNC(query) INSTFUNC(bitand) INSTFUNC(bitor) /* ... end machine.c */ /* this is defined in eval.c */ INSTFUNC(eager) /* this is defined in heap.c */ INSTFUNC(freeheap) /* these are defined in code.c */ INSTFUNC(eval) INSTFUNC(related_by_code) INSTFUNC(related_by_code_runtimelhs) #undef INSTFUNC tkeden1.41/Eden/keyword.h010060000025250000164000000012340733032316700153260ustar00ashleyem00003510000005/* * $Id: keyword.h,v 1.5 2001/07/27 17:35:51 cssbz Exp $ * * keyword translation table * */ { "auto", AUTO }, { "para", PARA }, { "return", RETURN }, { "break", BREAK }, { "continue", CONTINUE}, { "if", IF }, { "else", ELSE }, { "do", DO }, { "while", WHILE }, { "for", FOR }, { "switch", SWITCH }, { "case", CASE }, { "default", DEFAULT }, { "shift", SHIFT }, { "append", APPEND }, { "insert", INSERT }, { "delete", DELETE }, { "func", FUNC }, { "proc", PROC }, { "procmacro", PMAC /* PROCMACRO is the type */ }, { "is", IS }, { "and", AND }, { "or", OR }, { "not", NOT }, { "eval", EVAL }, { "bitand", BITAND }, { "bitor", BITOR }, tkeden1.41/Eden/lex.c010060000025250000164000001031430743425271600144350ustar00ashleyem00003510000005/* * $Id: lex.c,v 1.30 2002/02/18 19:28:14 cssbz Exp $ */ static char rcsid[] = "$Id: lex.c,v 1.30 2002/02/18 19:28:14 cssbz Exp $"; #include #include #include #include #include #include #include "../config.h" #include "eden.h" #include "yacc.h" #if defined(TTYEDEN) #if defined(HAVE_CURSES) || defined(HAVE_NCURSES) #include #ifdef HAVE_READLINE #include #include #endif /* HAVE_READLINE */ #endif /* HAVE_CURSES or HAVE_NCURSES */ #else /* not TTYEDEN */ #include #include "../EX/script.h" #endif #include "notation.h" #include "input_device.h" #include "emalloc.h" #ifdef HAVE_DMALLOC #include #endif #define MAXTEXTLEN 4096 /* change from 1024 --sun */ static int bof; int nextc = ' '; char yytext[MAXTEXTLEN]; int yyleng = 0; extern YYSTYPE yylval; #ifdef TTYEDEN extern char *prompt, *prompt1; extern char *promptsemi, *promptchar, *promptcomment; #else /* not TTYEDEN */ extern Tcl_Interp *interp; #endif extern void pushEntryStack(int); extern void popEntryStack(void); extern void push_text(char *, int); int inEVAL = 0; #ifdef TTYEDEN extern int preprinted; extern void print_prompt_if_necessary(int); #endif /* For VAs [Ash] */ char agentName[128]; char agentType[3]; int appAgentName = 1; int append_agentName = 1; int append_NoAgentName = 1; int inPrefix = 1; /* function prototypes */ Datum *makedatum(int, uDatum); void init_lex(void); int yylex(void); int peek(void); int keyin(void); static void append_char(int); static int buffer_overflow(void); static int keyword_token(char *); static int number_token(void); static int id_token(void); static int multi_symbol_token(void); static void skip_comment(void); static void skip_one_line_comment(void); static void skip_percent_comment(void); static void backslash(char *); /* These for VA [Ash] */ int builtin_ft_check(char *); static char new_yytext[MAXTEXTLEN]; /* for distributed tkeden -- sun */ static void getAgentName(void); #ifdef DISTRIB static int setHighPrior = 0; /* Setting a higher priority (which doesn't work very well) - see the Tcl/Eden variable higherPriority in main.c [Ash] */ #endif /* DISTRIB */ /* app_char(c): put c into the yytext buffer and complain if it overflows [Ash] */ #define app_char(c) (yyleng>=MAXTEXTLEN?buffer_overflow():(yytext[yyleng++]=c)) /* input(): update nlstts from Inp_Dev, then basically set nextc=getc() [Ash] */ #ifdef TTYEDEN extern void nlstatus(void); #define input() (nlstatus(),app_char(nextc),nextc=keyin()) #else #define input() (app_char(nextc),nextc=keyin()) #endif /* TTYEDEN */ #define safe_input() (append_char(nextc),nextc=keyin()) #define unput(c) (pop_char(),ungetkey(c)) #define pop_char() --yyleng #define last_char yytext[yyleng-1] #define end_text1() yytext[yyleng]='\0' #define end_text() {accept_text(yytext,yyleng);yytext[yyleng]='\0';} #define clear_text() yyleng=0 #define accept_text(Text,Leng) if((indef||informula) && !inEVAL) push_text(Text,Leng) #define RETURN_TOKEN(T) {end_text(); return T;} /* changeNotation moved out of EX into Eden/lex.c [Ash] */ notationType currentNotation = EDEN; void changeNotation(notationType notation) { currentNotation = notation; } Datum * makedatum(int type, uDatum value) { /* MAKE A NEW DATUM FOR CONSTANTS */ Datum *p; p = (Datum *) emalloc(sizeof(Datum)); p->type = type; p->u = value; return p; } static void append_char(int c) { if (yyleng >= MAXTEXTLEN - 1) { end_text(); clear_text(); } yytext[yyleng++] = c; } static int buffer_overflow(void) { error("input buffer overflow"); return 1; /* would not reach */ } /* init_lex: read in one character [Ash] */ void init_lex(void) { bof = 1; input(); } static int keyword_token(char *name) { /* Is name a keyword ? 0 = no; lexeme = yes) */ static struct keyword_table { /* Keywords */ char *name; int kval; } keywords[] = { #include "keyword.h" { 0, 0 } }; int i; for (i = 0; keywords[i].name; i++) { if (strcmp(name, keywords[i].name) == 0) return keywords[i].kval; } return 0; } /* When prefixing names with the agent name, we need to check whether a function to be prefixed is a built-in function or not. Built-in functions like writeln, propagate etc should not be prefixed with an agent name eg SUN, but user-defined functions should be prefixed. [Ash, with Patrick] */ int builtin_ft_check(char *name) /* --sun */ { /* Is name a builtin function ? 0 = no; 1 = yes) */ static struct builtinF_table { /* builtin or predefined functions */ char *name; } builtinFs[] = { #include "builtinf.h" { 0 } }; int i; for (i = 0; builtinFs[i].name; i++) { if (strcmp(name, builtinFs[i].name) == 0) return 1; } return 0; } static int number_token(void) { int i; double r; int m, n, e, is_float; char *format; int is_hex; uDatum u; is_float = m = n = e = FALSE; while (isdigit(nextc)) { input(); m = TRUE; } if (nextc == '.') { input(); is_float = TRUE; } while (isdigit(nextc)) { input(); n = TRUE; } if (is_float && !m && !n) /* a single dot */ return '.'; if (nextc == 'E' || nextc == 'e') { input(); is_float = TRUE; if (nextc == '+' || nextc == '-') input(); while (isdigit(nextc)) { input(); e = TRUE; } if (!e) error("Floating-point format error"); } if (is_float) { /* floating point */ end_text(); sscanf(yytext, "%lf", &r); u.r = r; yylval.dp = makedatum(REAL, u); return CONSTANT; } else if (*yytext == '0') {/* octal or hexdecimal */ is_hex = nextc == 'x' || nextc == 'X'; format = is_hex ? "%x" : "%o"; if (is_hex) { do { input(); /* read the 'x' */ } while (isxdigit(nextc)); } end_text(); sscanf((is_hex ? yytext + 2 : yytext), format, &i); u.i = i; yylval.dp = makedatum(INTEGER, u); return CONSTANT; } else { /* decimal */ end_text(); u.i = atoi(yytext); yylval.dp = makedatum(INTEGER, u); return CONSTANT; } } static int id_token(void) { extern symptr lookup(char *); extern symptr install(char *, int, int, int); extern int local_declare(char *); extern int lookup_local(char *); int i; symptr sp; char *tempyytext; while (isalnum(nextc) || nextc == '_') { input(); } end_text1(); /* printf("yytext %s", yytext); */ if ((i = keyword_token(yytext))) { /* keyword ? */ if (i==EVAL) inEVAL = 1; end_text(); return i; /* return the lexeme */ } if (inauto || inpara) { /* declaring local variables ? */ end_text(); yylval.narg = local_declare(yytext); return LOCAL; } else { /* in statements */ if ((i = lookup_local(yytext))) { /* local variable ? */ end_text(); if (i < 0) { /* it is an argument */ yylval.narg = -i; return ARG; } else { /* it is a local variable */ yylval.narg = i; return LOCAL; } } else { if (builtin_ft_check(yytext) == 0) { /* Don't append (pre or post) an agent name if: 1) if a built-in function, 2) if we're in the general context (no >> syntax etc used), 3) the definitions are from a Scout window definition, 4) similarly, if the definitions are from a Donald 'within' definition, 5) if the name already has a ~ prefix [Ash, with Patrick] */ /* printf("yytext1 = %s %s %i %i %i\n", yytext, agentName, appAgentName, append_agentName, append_NoAgentName); */ if (*agentName != 0 && appAgentName > 0 && append_agentName > 0 && append_NoAgentName > 0) { tempyytext = yytext; new_yytext[0] = '\0'; if (yytext[0] == '_' && inPrefix) { strcat(new_yytext, "_"); tempyytext++; } if (inPrefix) strcat(new_yytext, agentName); else strcat(new_yytext, tempyytext); strcat(new_yytext, "_"); if (inPrefix) strcat(new_yytext, tempyytext); else strcat(new_yytext, agentName); strcpy(yytext, new_yytext); yyleng = strlen(yytext); /* printf("agentName = %s \n", agentName); */ /* printf("yytext = %s \n", yytext); */ } } end_text(); /* must be global [Ash] */ if ((sp = lookup(yytext)) == 0) { /* doesn't already exist [Ash] */ sp = install(yytext, VAR, UNDEF, 0); /* printf("new_yytext = %s", yytext); */ } #ifdef DISTRIB if (!strcmp(sp->name, "higherPriority")) setHighPrior=1; #endif /* DISTRIB */ yylval.sym = sp; return sp->stype; } } } static int multi_symbol_token(void) { static struct { char c1, c2; int token; } *tab, table[] = { { '+', '=', PLUS_EQ }, { '+', '+', PLUS_PLUS }, { '-', '=', MINUS_EQ }, { '-', '-', MINUS_MINUS }, { '/', '/', SLASH_SLASH }, { '=', '=', EQ_EQ }, { '!', '=', NOT_EQ }, { '~', '>', TILDE_GT }, { '>', '=', GT_EQ }, { '<', '=', LT_EQ }, { '&', '&', LAZY_AND }, { '|', '|', LAZY_OR }, { 0, 0, 0 } }; for (tab = table; tab->c1; tab++) { if (*yytext == tab->c1 && nextc == tab->c2) { input(); RETURN_TOKEN(tab->token); } } RETURN_TOKEN(*yytext); } static void skip_comment(void) { safe_input(); /* '/' has already skipped, skip '*' */ for (;;) { switch (nextc) { case '*': safe_input(); /* '*' */ if (nextc == '/') { safe_input(); /* skip '/' */ return; } break; case '/': safe_input(); /* skip '/' */ if (nextc == '*') { skip_comment(); } break; case 0: /* EOF */ error("unexpected end-of-file in /* */ comment"); return; default: safe_input(); } } } static void skip_one_line_comment(void) { /* We have '##' in the input, and the first # has already been skipped - skip the second #... */ safe_input(); /* Now nextc == character after the second #. Swallow characters until the beginning of the next line. Note that 0 (EOF) doesn't cause an error with a ## comment. [Ash] */ while (nextc != '\n' && nextc != '\r' && nextc != 0) safe_input(); } static int scoutScreenInitOpened = 0; /* Open the scout screen, but only if we haven't done it before */ void scoutScreenInitOpen(void) { symptr scoutScreenInitOpenSym; extern char *progname; /* Stop a second %scout reopening screen if the user closed it, and also stop re-entry into this function [Ash] */ if (scoutScreenInitOpened) return; scoutScreenInitOpened = 1; makearr(0); scoutScreenInitOpenSym = lookup("scoutScreenInitOpen"); if (scoutScreenInitOpenSym) { call(scoutScreenInitOpenSym, pop(), 0); } else { fprintf(stderr, "%s: Can't find scoutScreenInitOpen: do you have the correct -l setting?\n", progname); exit(-1); } } static void skip_percent_comment(void) { #ifndef TTYEDEN Script *script; extern Script *st_script, *dd_script; extern int run(short, void *, char *); extern void dd_lex(int), st_lex(int); extern void not_readchar(int); extern int setcurrentnot(char *); #ifdef WANT_SASAMI extern Script *sa_script; extern void sa_input(char); #endif /* WANT_SASAMI */ #ifdef DISTRIB extern void lsd_lex(int); #endif /* DISTRIB */ #endif /* not TTYEDEN */ /* skip_percent_comment is called when we are starting a new line and nextc=='%' [Ash] */ char *s; int start = yyleng; safe_input(); /* read in the initial '%' */ for (;;) { s = yytext + start; /* safe_input until we have an end-of-line or EOF */ if ((nextc != '\n') && (nextc != '\r') && (nextc != 0)) { safe_input(); continue; } else { /* now we've found the end of the line, terminate it correctly */ end_text1(); } if ((nextc == '\n') || (nextc == '\r')) { #ifdef TTYEDEN /* Dummy if start to make the else's below work... [Ash] */ if (0) {} #else /* DoNaLD -------------------------------------------- */ if (strncmp(s, "%donald", 7) == 0) { changeNotation(DONALD); dd_script = script = newScript(); for (nextc = peek(); nextc != '\0'; nextc = peek()) { if (Inp_Dev->newline && (nextc == '%' || nextc == '>' || nextc == '<')) { if (nextc == '>' || nextc == '<') { input(); getAgentName(); } else { nextc = '\n'; if (script->text[0] != '\0') { appAgentName--; /* printf("from donald 1"); */ pushEntryStack(DONALD); run(STRING_DEV, script->text, 0); popEntryStack(); appAgentName++; } deleteScript(script); return; } /* end if (nextc == '>' || nextc == '<') */ } /* end if (Inp_Dev->newline...) */ else { dd_lex(keyin()); if (script->ready) { if (script->text[0] != '\0') { appAgentName--; /* printf("from donald 2"); */ pushEntryStack(DONALD); run(STRING_DEV, script->text, 0); dd_script = script; popEntryStack(); /* printf("from donald 3"); */ appAgentName++; } resetScript(script); } /* end if (script->ready) */ } /* end if (Inp_Dev->newline...) (two versions) */ } /* end for (nextc = peek()...) */ keyin(); /* read the null character */ dd_lex('\n'); /* treat end-of-file as end-of-line */ if (script->text[0] != '\0') { appAgentName--; pushEntryStack(DONALD); run(STRING_DEV, script->text, 0); popEntryStack(); /* printf("from donald 4"); */ appAgentName++; } deleteScript(script); } /* end if (strncmp(s, "%donald", 7) == 0) */ /* SCOUT -------------------------------------------- */ else if (strncmp(s, "%scout", 6) == 0) { /* is SCOUT */ scoutScreenInitOpen(); changeNotation(SCOUT); st_script = script = newScript(); for (nextc = peek(); nextc != '\0'; nextc = peek()) { if (Inp_Dev->newline && (nextc == '%' || nextc == '>' || nextc == '<')) { if (nextc == '>' || nextc == '<') { input(); getAgentName(); } else { nextc = '\n'; if (script->text[0] != '\0') { appAgentName--; /* printf("from scout 1"); */ pushEntryStack(SCOUT); run(STRING_DEV, script->text, 0); popEntryStack(); appAgentName++; } deleteScript(script); return; } } /* end if (Inp_Dev->newline...) */ else { st_lex(keyin()); if (script->ready) { if (script->text[0] != '\0') { appAgentName--; /* printf("from scout 2 %s\n", script->text); */ pushEntryStack(SCOUT); run(STRING_DEV, script->text, 0); st_script = script; popEntryStack(); appAgentName++; } resetScript(script); } } } /* end for (nextc = peek();... */ keyin(); /* read the null character */ st_lex('\n'); /* treat end-of-file as end-of-line */ if (script->text[0] != '\0') { appAgentName--; pushEntryStack(SCOUT); run(STRING_DEV, script->text, 0); popEntryStack(); appAgentName++; } deleteScript(script); } /* end if (strncmp(s, "%scout", 6)... */ #ifdef WANT_SASAMI /* Sasami -------------------------------------------- */ else if (strncmp(s, "%sasami", 7) == 0) { changeNotation(SASAMI); sa_script = script = newScript(); for (nextc = peek(); nextc != '\0'; nextc = peek()) { if (Inp_Dev->newline && (nextc == '%' || nextc == '>' || nextc == '<')) { /* This is a %, > or < statement and shouldn't be passed to Sasami */ if (nextc == '>' || nextc == '<') { input(); getAgentName(); } else { nextc = '\n'; if (script->text[0] != '\0') { appAgentName--; /* printf("from sasami 1"); */ pushEntryStack(SASAMI); run(STRING_DEV, script->text, 0); popEntryStack(); appAgentName++; } deleteScript(script); return; } } else { /* This must be something worth sending to Sasami */ sa_input(keyin()); /* Now run the EDEN script that Sasami's produced (if there is one) */ if (script->ready) { if (script->text[0] != '\0') { appAgentName--; /* printf("from sasami 2"); */ pushEntryStack(SASAMI); run(STRING_DEV, script->text, 0); sa_script = script; popEntryStack(); /* printf("from sasami 3"); */ appAgentName++; } resetScript(script); } } } /* OK - finished with the input, so send an EOL to make sure that the parser runs the last input line, and exit. */ keyin(); /* read the null character */ sa_input('\n'); /* treat end-of-file as end-of-line */ if (script->text[0] != '\0') { appAgentName--; pushEntryStack(SASAMI); run(STRING_DEV, script->text, 0); popEntryStack(); /* printf("from sasami 4"); */ appAgentName++; } deleteScript(script); } /* end if (strncmp(s, "%sasami", 7) == 0) */ #endif /* WANT_SASAMI */ #ifdef DISTRIB /* LSD -------------------------------------------- */ else if (strncmp(s, "%lsd", 4) == 0) { changeNotation(LSD); for (nextc = peek(); nextc != '\0'; nextc = peek()) { if (Inp_Dev->newline && (nextc == '%' || nextc == '>' || nextc == '<')) { if (nextc == '>' || nextc == '<') { input(); getAgentName(); } else { nextc = '\n'; return; } } else { lsd_lex(keyin()); } } keyin(); /* read the null character */ lsd_lex('\n'); /* treat end-of-file as end-of-line */ } /* end if (strncmp(s, "%lsd", 4)... */ #endif /* DISTRIB */ #endif /* not TTYEDEN */ /* added by Chris Brown, 2000 */ else if (setcurrentnot(s)) { changeNotation(OTHER); /* Notation now changed to one implemented as a definitive parser. Slurp in the rest of the text until (just before) the next change of notation and parse it. [Ash] */ for (nextc = peek(); (nextc != '\0') && (nextc != EOF); nextc = peek()) { if (Inp_Dev->newline && nextc == '%') { nextc = '\n'; return; } else { not_readchar (keyin()); } } #ifdef TTYEDEN /* ttyeden does not currently keep track of the current notation properly. It should still be %eddi after an included file has changed to that notation and not back again, but this would require some work on the lexer. At least we can ensure that the prompt is correct here. [Ash] */ currentNotation = EDEN; /* peek() does not seem to manage to successfully push back the EOF character in TTYEDEN and so keyin() would cause another character to be read. Stop immediately instead. [Ash] */ return; #else keyin(); /* read the null character */ not_readchar ('\n'); /* treat end-of-file as end-of-line */ setprompt(); #endif } #ifndef TTYEDEN /* This push and pop facility ("%+eden") appears be used only in Donald [Ash] */ /* Push entry -------------------------------------------- */ else if (s[1] == '+') { /* appAgentName=0; */ if (strncmp(s + 2, "donald", 6) == 0) { /* is DoNaLD */ pushEntryStack(DONALD); } else if (strncmp(s + 2, "scout", 5) == 0) { /* is SCOUT */ pushEntryStack(SCOUT); } else if (strncmp(s + 2, "eden", 4) == 0) { /* is EDEN */ pushEntryStack(EDEN); #ifdef WANT_SASAMI } else if (strncmp(s + 2, "sasami", 6) == 0) { /* is Sasami */ pushEntryStack(SASAMI); #endif /* WANT_SASAMI */ } } /* end if (s[1] == '+') */ /* Pop entry -------------------------------------------- */ else if (s[1] == '-') { if (strncmp(s + 2, "donald", 6) == 0 /* is DoNaLD */ || strncmp(s + 2, "scout", 5) == 0 /* is SCOUT */ #ifdef WANT_SASAMI || strncmp(s + 2, "sasami", 6) == 0 /* is Sasami */ #endif || strncmp(s + 2, "eden", 4) == 0) { /* is EDEN */ popEntryStack(); /* appAgentName=1; */ } } /* end if (s[1] == '-') */ #endif /* not TTYEDEN */ /* Eden -------------------------------------------- */ else { changeNotation(EDEN); } return; } else if (nextc == 0) { /* EOF */ #ifdef TTYEDEN /* Dummy if start to make the else's below work... [Ash] */ if (0) {} #else if (strncmp(s, "%donald", 7) == 0) { /* is DoNaLD */ changeNotation(DONALD); } else if (strncmp(s, "%scout", 6) == 0) { /* is SCOUT */ changeNotation(SCOUT); } #ifdef WANT_SASAMI else if (strncmp(s, "%sasami", 7) == 0) { /* is Sasami */ changeNotation(SASAMI); } #endif /* WANT_SASAMI */ #endif /* not TTYEDEN */ /* added by Chris Brown, 2000 */ else if (setcurrentnot(s)) { /* is OTHER */ changeNotation(OTHER); } else { /* is EDEN */ changeNotation(EDEN); } return; } } } static void backslash(char *text) { /* interpret backslashs in a string */ int i, n; char *s = text; static char transtab[] = "b\bf\fn\nr\rt\t"; while (*s) { if (*s == '\\') { s++; if (isdigit(*s)) { for (n = 3, i = 0; n && isdigit(*s); --n, s++) i = (i << 3) | (*s - '0'); *text++ = i; } else if (islower(*s) && strchr(transtab, *s)) *text++ = strchr(transtab, *s++)[1]; else *text++ = *s++; } else { *text++ = *s++; } } *text = '\0'; } int yylex(void) { char *s; uDatum u; #ifdef DISTRIB extern Int *higherPriority; #endif /* DISTRIB */ /* initial for a token */ clear_text(); if (bof) { bof = 0; if (nextc == '%') { /* comment line */ skip_percent_comment();/* return next token */ end_text(); clear_text(); } /* printf("bof \n"); */ if (nextc == '>' || nextc == '<') getAgentName(); } restart: while (isspace(nextc) && (nextc != '\n') && (nextc != '\r')) { /* skip blanks */ input(); } if ((nextc == '\n') || (nextc == '\r')) { input(); if (nextc == '%') { /* comment line */ skip_percent_comment();/* return next token */ end_text(); clear_text(); } /* printf("restart\n"); */ if (nextc == '>' || nextc == '<') getAgentName(); goto restart; } end_text(); clear_text(); if (nextc == 0) { /* EOF */ #ifdef DISTRIB if (setHighPrior) { *higherPriority=0; setHighPrior = 0; } #endif return 0; /* don't do input() so next token is EOF */ } #ifdef TTYEDEN prompt = promptsemi; #endif if (isdigit(nextc) || nextc == '.') /* a number or a dot */ return number_token(); if (isalpha(nextc) || nextc == '_') /* a keyword or an identifier */ { append_agentName = 1; return id_token(); } if (nextc == '\'') { while (input(), nextc != '\'') { if (nextc == '\\') input(); else if (nextc == 0) error("unexpected end-of-file in character constant"); } input(); /* read the quote */ /* mustn't alter the following two lines */ end_text(); /* accept the text */ last_char = '\0'; /* delete the last quote */ backslash(yytext + 1); /* resolve the backslashs */ if (yytext[2]) /* more than one char */ error("single char expected"); u.i = yytext[1]; yylval.dp = makedatum(MYCHAR, u); return CONSTANT; } if (nextc == '\"') { #ifdef TTYEDEN prompt = promptchar; #endif while (input(), nextc != '\"') { if (nextc == '\\') input(); else if (nextc == 0) error("unexpected end-of-file in string constant"); } input(); /* read the quote */ /* mustn't alter the following two lines */ end_text(); /* accept the text */ last_char = '\0'; /* delete the last quote */ backslash(yytext + 1); /* resolve the backslashs */ s = (char *) emalloc(strlen(yytext)); strcpy(s, yytext + 1); u.s = s; yylval.dp = makedatum(STRING, u); return CONSTANT; } input(); /* accept the char, must be the 1st char */ switch (*yytext) { /* the 1st char */ case '@': yylval.dp = makedatum(UNDEF, u); /* bug fix Ash + Carters */ RETURN_TOKEN(CONSTANT); break; case '~': /* for agency --sun */ if (isalpha(nextc) || nextc == '_') { clear_text(); append_agentName = 0; return id_token(); } break; case '$': while (isdigit(nextc)) input(); if (yyleng == 1) RETURN_TOKEN('$'); yylval.narg = atoi(yytext + 1); RETURN_TOKEN(ARG); case '/': #ifdef TTYEDEN prompt = promptcomment; #endif if (nextc == '*') { /* nested comment */ skip_comment(); /* return next token */ end_text(); clear_text(); #ifdef TTYEDEN prompt = prompt1; #endif goto restart; } break; case '#': if (nextc == '#') { skip_one_line_comment(); end_text(); clear_text(); #ifdef TTYEDEN prompt = prompt1; #endif goto restart; } break; } return (multi_symbol_token()); } /* Figure out the prompt to be used at this moment for ttyeden. Caller has the responsibility of freeing the result. [Ash] */ #ifdef TTYEDEN char *fullPrompt() { char *toReturn, *notationName=0; toReturn = emalloc(30); if (currentNotation == OTHER) { getnotcomment(¬ationName); sprintf(toReturn, "%s %d%s", notationName, Inp_Dev->lineno + 1, prompt); } else { /* notation is Eden, so need not be included in the prompt */ sprintf(toReturn, "%d%s", Inp_Dev->lineno + 1, prompt); } return toReturn; } #endif /* TTYEDEN */ #if defined(TTYEDEN) && defined(HAVE_READLINE) /* rl_gets is taken straight from the readline info manual [Ash] */ static char *line_read = (char *)NULL; /* Read a string, and return a pointer to it. Returns NULL on EOF. */ char * rl_gets () { char *fullPromptText; extern symptr eden_prompt_sym; /* If the buffer has already been allocated, return the memory to the free pool. */ if (line_read) { free (line_read); line_read = (char *)NULL; } /* Get a line from the user. */ if (eden_prompt_sym->d.u.i) { fullPromptText = fullPrompt(); line_read = readline(fullPromptText); free(fullPromptText); } else { rl_expand_prompt(""); /* work around bug in readline4-4.2 reported to Debian as bug #105231 */ line_read = readline(""); } /* If the line has any text in it, save it on the history. */ if (line_read && *line_read) add_history (line_read); return (line_read); } /* Simulate a call to getc(stdin), but actually call rl_gets whenever necessary to use readline instead. Like getc(stdin), EOF is returned if Ctrl-D is pressed, and \n is returned at the end of each line. [Ash] */ static int getc_require_new_readline = 1; static char *getc_ptr = (char *)NULL; int rl_getc_wrapper() { if (getc_require_new_readline) getc_ptr = rl_gets(); if (getc_ptr == (char *)NULL) return EOF; if (*getc_ptr == '\0') { getc_require_new_readline = 1; *getc_ptr = '\n'; } else getc_require_new_readline = 0; return *getc_ptr++; } /* Simulate a call to ungetc(getc(stdin)), but actually use rl_gets to use readline instead. This is used in peek(). [Ash] */ int rl_getungetc() { int c; if (getc_require_new_readline) { getc_ptr = rl_gets(); getc_require_new_readline = 0; } if (getc_ptr == (char *)NULL) return EOF; if (*getc_ptr == '\0') return '\n'; return *getc_ptr; } int rl_getc_wouldBlock() { if (getc_ptr == (char *)NULL) return 0; if (*getc_ptr == '\0') return 1; else return 0; } #endif /* TTYEDEN && HAVE_READLINE */ /* Append c to Inp_Dev->linebuf, expanding the allocation if necessary, incrementing the Inp_Dev->linebufend pointer and keep linebuf terminated with a '\0'. [Ash] */ void append_linebuf(char c) { if ((Inp_Dev->linebufend+2) >= Inp_Dev->linebufsize) { Inp_Dev->linebufsize *= 2; Inp_Dev->linebuf = erealloc(Inp_Dev->linebuf, Inp_Dev->linebufsize); } Inp_Dev->linebuf[++Inp_Dev->linebufend] = c; Inp_Dev->linebuf[Inp_Dev->linebufend+1] = '\0'; /* keep the string terminated */ } int keyin(void) { /* READ A CHAR FROM INPUT DEVICE */ int c; FILE *filein; switch (Inp_Dev->type) { case FILE_DEV: filein = (FILE *) Inp_Dev->ptr; #ifdef TTYEDEN print_prompt_if_necessary(0); preprinted = FALSE; #ifdef HAVE_READLINE /* TTYEDEN and HAVE_READLINE */ if (filein == stdin && Inp_Dev->usereadline) c = rl_getc_wrapper(); else #endif /* TTYEDEN but don't HAVE_READLINE or not usereadline */ c = getc(filein); #else /* not TTYEDEN */ c = getc(filein); #endif if (c == EOF) c = 0; break; case STRING_DEV: c = *(Inp_Dev->ptr)++; break; } if (Inp_Dev->newline) { /* this is a /character after/ newline */ Inp_Dev->lineno++; Inp_Dev->linebufend = -1; Inp_Dev->charno = -1; } append_linebuf(c); Inp_Dev->newline = ((c == '\n') || (c == '\r')); Inp_Dev->charno++; /* keep this in sync with linebufend as long as we are not doing flushRestOfLine() */ return c; } /* Read the rest of the line into linebuf so we can print it all in an error condition [Ash] */ void flushRestOfLine(void) { FILE *filein; int c = 'a'; extern int wouldBlock(void); if (Inp_Dev->newline) { Inp_Dev->linebuf[Inp_Dev->linebufend] = '\0'; /* clear the unwanted \n */ return; /* already have the complete line */ } /* This case can occur if tkeden is interrupted with ctrl-c */ if (!(Inp_Dev->ptr)) return; /* This wouldBlock stuff might be invalidated by the above newline logic, I'm not sure. I'll leave it in anyway. [Ash] */ if (Inp_Dev->type == FILE_DEV) { filein = (FILE *) Inp_Dev->ptr; /* if the whole line has already been read in, then doing a getc() would cause a block */ if (filein == stdin) { #if defined(TTYEDEN) && defined(HAVE_READLINE) if (rl_getc_wouldBlock()) return; #else if (wouldBlock()) return; #endif } } while (isprint(c)) { switch (Inp_Dev->type) { case FILE_DEV: #ifdef TTYEDEN #ifdef HAVE_READLINE if (filein == stdin && Inp_Dev->usereadline) c = rl_getc_wrapper(); else #endif /* HAVE_READLINE */ c = getc(filein); #else c = getc(filein); #endif break; case STRING_DEV: c = *(Inp_Dev->ptr)++; break; } append_linebuf(c); } /* Last character read was invalid */ Inp_Dev->linebuf[Inp_Dev->linebufend] = '\0'; } /* Examine the next char to come from the input device, but leave it in the input buffer to actually be processed by keyin(). Note this can cause the process to become blocked. [Ash] */ int peek(void) { int c; FILE *filein; switch (Inp_Dev->type) { case FILE_DEV: filein = (FILE *) Inp_Dev->ptr; #ifdef TTYEDEN print_prompt_if_necessary(0); #endif #if defined(TTYEDEN) && defined(HAVE_READLINE) if (filein == stdin && Inp_Dev->usereadline) c = rl_getungetc(); else /* not stdin or not usereadline */ ungetc(c = getc(filein), filein); #else /* not TTYEDEN or don't HAVE_READLINE */ ungetc(c = getc(filein), filein); #endif if (c == EOF) c = 0; break; case STRING_DEV: c = *(Inp_Dev->ptr); break; } return c; } /* For VA [Ash, with Patrick] */ static void getAgentName(void) { extern symptr lookup(char *); symptr sp; char secondC, firstC; *agentType = '\0'; if ((firstC = nextc) == '>') inPrefix = 1; else inPrefix = 0; agentType[0] = firstC; input(); /* skip second '>' */ secondC = nextc; agentType[1] = secondC; agentType[2] = '\0'; input(); clear_text(); while (isalnum(nextc) || nextc == '_') input(); end_text1(); *agentName = '\0'; /* printf("secondc = %c \n", secondC); */ if (yytext[0] == '\0') { #ifndef TTYEDEN /* Show the agent name on the interface [Ash] */ Tcl_VarEval(interp, ".agentName config -text {}", 0); #endif clear_text(); return; } if (secondC=='>' || secondC=='~') { /* printf("getagentName = %s \n", yytext); */ strcpy(agentName, yytext); #ifndef TTYEDEN Tcl_VarEval(interp, ".agentName config -text {current agent: ", agentName, "}", 0); #endif /*strcat(agentName, "_");*/ clear_text(); if (secondC=='~') append_NoAgentName = 0; else append_NoAgentName = 1; return; } if (secondC=='<') { append_NoAgentName = 1; if ((sp = lookup(yytext)) == 0) { #ifndef TTYEDEN Tcl_VarEval(interp, ".agentName config -text {}", 0); #endif clear_text(); return; } else { switch(sp->d.type) { case INTEGER: sprintf(agentName, "%d", sp->d.u.i); break; case MYCHAR: sprintf(agentName, "%c", sp->d.u.i); break; case STRING: sprintf(agentName, "%s", sp->d.u.s); break; default: error2("expecting string, char or integer for virtual agent", sp->name); } /* printf("getagentName = %s \n", sp->d.u.s); */ /* strcpy(agentName, sp->d.u.s); */ #ifndef TTYEDEN Tcl_VarEval(interp, ".agentName config -text {current agent: ", agentName, "}", 0); #endif /*strcat(agentName, "_");*/ clear_text(); return; } } } mustn't alter the following two lines */ end_text(); /* accept the text */ last_char = '\0'; /* delete the last quote */ backslash(yytext + 1); /* resolve the backslashs */ s = (char *) emalloc(strlen(yytext)); strcpy(s, yytext + 1); u.s = s; yylval.dp = makedatum(STRING, u); return CONSTANT; } input(); /* accept the char, must be the 1st char */ switch (*yytext) { /* the 1st char */tkeden1.41/Eden/lib.c010060000025250000164000000050320743425305700144100ustar00ashleyem00003510000005/* * $Id: lib.c,v 1.7 2002/02/18 19:29:51 cssbz Exp $ */ static char rcsid[] = "$Id: lib.c,v 1.7 2002/02/18 19:29:51 cssbz Exp $"; #include "../config.h" #include "eden.h" #include "builtin.h" #include "yacc.h" /* * call_lib --- C library interface * * It is a useful interface to include the C library routines into the * language. * * Weak points: * * (1) Only the first 10 arguments can be passed. * * (2) The interface cannot deal with list (cause the different internal * representation of data structures). * * (3) All the values returned by library routines are integers. * Programmers must explicitly write the type convertion codes. See * type.c for the type-convertion functions. * * (4) The interface can handle ``true'' functions, NOT macros. * */ #define PARSIZE 10 #define PushInteger(data) {Datum d;d.type=INTEGER;d.u.i=(Int)data;push(d);} #define PushReal(data) {Datum d;d.type=REAL;d.u.r=(double)data;push(d);} /***/ void call_lib(Inst inst) { int i, j; int A[PARSIZE]; Int result; for (i = 1, j = 0; i <= paracount && j < PARSIZE; i++) { if (is_address(para(i))) A[j++] = (Int) & (((Datum *) para(i).u.v.x)->u.i); else switch (para(i).type) { case INTEGER: case MYCHAR: case STRING: A[j++] = para(i).u.i; break; case REAL: A[j++] = para(i).u.v.x; A[j++] = para(i).u.v.y; break; default: errorf("parameter with illegal type passed to C-lib function (got %s for parameter no %d)", typename(para(i).type), i); break; } } result = ((int (*) ()) inst) (A[0], A[1], A[2], A[3], A[4], A[5], A[6], A[7], A[8], A[9]); PushInteger(result); } void call_float(Inst inst) { /* All the functions that return real values seem to require real values for their parameters, so I'm casting any numbers passed in to reals. It isn't now possible to pass integers to a function declared as SameReal. [Ash] */ double A[PARSIZE]; double result; int i; for (i = 1; i <= paracount; i++) { switch(para(i).type) { case INTEGER: A[i-1] = (double)(fp->stackp->u.a[i].u.i); break; case REAL: A[i-1] = (double)(fp->stackp->u.a[i].u.r); break; default: errorf("parameter with illegal type passed to C-lib function: (got %s for parameter no %d)", typename(para(i).type), i); break; } } result = ((double (*) ()) inst) (A[0], A[1], A[2], A[3], A[4], A[5], A[6], A[7], A[8], A[9]); PushReal(result); } tkeden1.41/Eden/machine.c010060000025250000164000001254420746420216500152530ustar00ashleyem00003510000005/* * $Id: machine.c,v 1.21 2002/03/01 23:46:19 cssbz Exp $ */ static char rcsid[] = "$Id: machine.c,v 1.21 2002/03/01 23:46:19 cssbz Exp $"; /**** * * * This files contains most of the implementation of * * most of the pseduo-machine codes. * * * ****/ #include #include #include #include "../config.h" #include "eden.h" #include "yacc.h" #include "emalloc.h" #ifdef HAVE_DMALLOC #include #endif extern int topEntryStack(void); extern char *topMasterStack(void); extern Datum ctos(Datum); extern int appAgentName; extern char *typename(); #ifdef DISTRIB extern int handle_check(symptr); /* for agency --sun */ extern void propagate_agency(symptr); #endif /* DISTRIB */ void makearr(Int); #ifdef DEBUG #define DEBUGPRINT(s,t) {if(Debug&1)fprintf(stderr,s,t);} #else #define DEBUGPRINT(s,t) #endif #define dpush(x, y, z) x.u.i=(Int)(z); x.type = y; push(x); #define CheckRange(n,low,up) if(nup)out_of_range_error(n,low,up) /* pop_address used to be (more confusingly) called get_address [Ash] */ #define pop_address(addr,where) addr=pop();mustaddr(addr,where) #define is_string(d) (d.type == MYCHAR || d.type==STRING) #define is_list(d) (d.type == LIST) #define sametype(d1, d2) ((d1.type == d2.type) || (isnum(d1) && isnum(d2))) #define address(sp) { Datum d; d.type = SYMBOL | DPTR; \ d.u.v.x = (Int) &(sp->d); d.u.v.y = (Int) sp; push(d); } #ifdef DISTRIB #define ChangeSym(addr) if (is_symbol(addr)) {\ if (appAgentName > 0) propagate_agency(symbol_of(addr));\ change(symbol_of(addr), FALSE);\ symbol_of(addr)->entry = topEntryStack();\ symbol_of(addr)->master = topMasterStack();\ } #else #define ChangeSym(addr) if (is_symbol(addr)) {\ change(symbol_of(addr), FALSE);\ symbol_of(addr)->entry = topEntryStack();\ symbol_of(addr)->master = topMasterStack();\ } #endif /* DISTRIB */ void freedatum(Datum d) { /* free the content of the datum, not the datum itself */ int i; switch (d.type) { case STRING: if (d.u.s) free(d.u.s); /* free the string */ break; case LIST: for (i = 1; i <= d.u.a->u.i; i++) freedatum(d.u.a[i]);/* free each item */ free(d.u.a); /* free the list */ break; } } Datum newdatum(Datum d) { /* use malloc to duplicate a datum */ char *s; Datum *a; int i; switch (d.type) { case STRING: /* copy the content of a string */ if (d.u.s) { /* a precaution of NULL */ /* Allocate memory on the malloc heap for the string in d [Ash] */ s = (char *) emalloc(strlen(d.u.s) + 1); /* Copy d.u.s into the newly malloc'd space s, then set d.u.s to point to the new space [Ash] */ d.u.s = (char *) strcpy(s, d.u.s); } /* an error ? */ break; case LIST: /* copy the content of a list */ a = (Datum *) emalloc((d.u.a->u.i + 1) * sizeof(Datum)); for (i = 0; i <= d.u.a->u.i; i++) a[i] = newdatum(d.u.a[i]); d.u.a = a; break; } return d; } Datum newhdat(Datum d) { /* ("new *heap* datum" [Ash]) similiar to newdatum, but use heap to allocate space instead */ char *s; Datum *a; int i; switch (d.type) { case STRING: if (d.u.s) { s = (char *) getheap(strlen(d.u.s) + 1); d.u.s = (char *) strcpy(s, d.u.s); } else s = d.u.s; /* if null [Ash] */ break; case LIST: a = (Datum *) getheap((d.u.a->u.i + 1) * sizeof(Datum)); for (i = 0; i <= d.u.a->u.i; i++) { a[i] = newhdat(d.u.a[i]); } d.u.a = a; break; } return d; } void out_of_range_error(int i, int low, int up) { errorf("index out of range (%d is outside the range %d...%d)", i, low, up); } void mustint(Datum d, char *where) { if (d.type != INTEGER && d.type != MYCHAR) errorf("type clash: expecting %s (in %s, got %s)", typename(INTEGER), where, typename(d.type)); } void mustchar(Datum d, char *where) { if (d.type != INTEGER && d.type != MYCHAR) errorf("type clash: expecting %s (in %s, got %s)", typename(MYCHAR), where, typename(d.type)); } void muststr(Datum d, char *where) { if (d.type != STRING) errorf("type clash: expecting %s (in %s, got %s)", typename(STRING), where, typename(d.type)); } void mustlist(Datum d, char * where) { if (d.type != LIST) errorf("type clash: expecting %s (in %s, got %s)", typename(LIST), where, typename(d.type)); } void mustaddr(Datum d, char *where) { if (!is_address(d)) errorf("type clash: expecting reference to variable (in %s, got %s)", where, typename(d.type)); } void address_error(char *where) { errorf("type clash: expecting reference to variable (in %s)", where); } int get2num(Datum * dp1, Datum * dp2) { /* get 2 integer from stack */ *dp2 = pop(); *dp1 = pop(); switch (dp1->type) { case MYCHAR: dp1->type = INTEGER; case INTEGER: case REAL: break; case UNDEF: return UNDEF; /* undefined value */ default: errorf("type clash: number type required (got %s)", typename(dp1->type)); } switch (dp2->type) { case MYCHAR: dp1->type = INTEGER; case INTEGER: case REAL: break; case UNDEF: return UNDEF; /* undefined value */ default: errorf("type clash: number type required (got %s)", typename(dp2->type)); } if (dp1->type != REAL && dp2->type == REAL) { /* convert d1 to real */ dp1->type = REAL; dp1->u.r = dp1->u.i; return REAL; } if (dp1->type == REAL && dp2->type != REAL) { /* convert d2 to real */ dp2->type = REAL; dp2->u.r = dp2->u.i; return REAL; } return dp1->type; } void add(void) { /* operator + */ Datum d1, d2; DEBUGPRINT("VMOPER|DATSTK add\n", 0); switch (get2num(&d1, &d2)) { case INTEGER: d1.u.i += d2.u.i; break; case REAL: d1.u.r += d2.u.r; break; default: pushUNDEF(); return; } push(d1); } void sub(void) { /* operator - */ Datum d1, d2; DEBUGPRINT("VMOPER|DATSTK sub\n", 0); switch (get2num(&d1, &d2)) { case INTEGER: d1.u.i -= d2.u.i; break; case REAL: d1.u.r -= d2.u.r; break; default: pushUNDEF(); return; } push(d1); } void mul(void) { /* operator * */ Datum d1, d2; DEBUGPRINT("VMOPER|DATSTK mul\n", 0); switch (get2num(&d1, &d2)) { case INTEGER: d1.u.i *= d2.u.i; break; case REAL: d1.u.r *= d2.u.r; break; default: pushUNDEF(); return; } push(d1); } void divide(void) { /* operator / */ Datum d1, d2; DEBUGPRINT("VMOPER|DATSTK divide\n", 0); switch (get2num(&d1, &d2)) { case INTEGER: if (d2.u.i == 0) errorf("division by zero (trying to calculate %d/0)", d1.u.i); d1.u.i /= d2.u.i; break; case REAL: if (d2.u.r == 0.0) errorf("division by zero (trying to calculate %f/0)", d1.u.r); d1.u.r /= d2.u.r; break; default: pushUNDEF(); return; } push(d1); } void mod(void) { /* operator % */ Datum d1, d2; double r; DEBUGPRINT("VMOPER|DATSTK mod\n", 0); switch (get2num(&d1, &d2)) { case INTEGER: if (d2.u.i == 0) errorf("division by zero (trying to calculate %d%%0)", d1.u.i); d1.u.i %= d2.u.i; break; case REAL: d1.u.r = d1.u.r - ((int)(d1.u.r / d2.u.r) * d2.u.r); break; default: pushUNDEF(); return; } push(d1); } void negate(void) { /* unary minus - */ Datum d; DEBUGPRINT("VMOPER|DATSTK negate\n", 0); d = pop(); switch (d.type) { case MYCHAR: d.type = INTEGER; case INTEGER: d.u.i = -d.u.i; break; case REAL: d.u.r = -d.u.r; break; case UNDEF: pushUNDEF(); return; default: errorf("type clash on negation: number type required (got %s)", typename(d.type)); return; } push(d); } void lazy_not(void) { /* logical lazy not */ Datum d; DEBUGPRINT("VMOPER|DATSTK lazy_not\n", 0); d = pop(); if (!isint(d) && !isundef(d)) errorf("type clash: lazy not: expecting %s (got %s)", typename(INTEGER), typename(d.type)); switch (d.type) { case MYCHAR: d.type = INTEGER; case INTEGER: d.u.i = !d.u.i; break; case REAL: default: d.type = INTEGER; d.u.i = !d.u.r; break; } push(d); } void not(void) { /* logical not */ Datum d; DEBUGPRINT("VMOPER|DATSTK not\n", 0); d = pop(); if (!isint(d) && !isundef(d)) errorf("type clash: logical not: expecting %s (got %s)", typename(INTEGER), typename(d.type)); switch (d.type) { case MYCHAR: d.type = INTEGER; case INTEGER: d.u.i = !d.u.i; break; case REAL: d.type = INTEGER; d.u.i = !d.u.r; break; default: pushUNDEF(); return; } push(d); } void concat(void) { /* string/list concat opeator // */ Datum d1, d2; int len; char *s; int i, size1, size2; /* extern void print(Datum); */ DEBUGPRINT("VMOPER|DATSTK concat\n", 0); d2 = pop(); d1 = pop(); /* printf("d2 "); print(d2); printf("d1 "); print(d1); */ if (isundef(d1) || isundef(d2)) pushUNDEF(); else if (is_string(d1) && is_string(d2)) { d1 = ctos(d1); d2 = ctos(d2); len = strlen(d1.u.s) + strlen(d2.u.s); s = (char *) getheap(len + 1); d1.u.s = (char *) strcat(strcpy(s, d1.u.s), d2.u.s); push(d1); } else if (is_list(d1) && is_list(d2)) { size1 = d1.u.a->u.i; size2 = d2.u.a->u.i; /* This can easily blow the stack if we are concatenating long lists [Ash] */ for (i = 1; i <= size1; i++) push(d1.u.a[i]); for (i = 1; i <= size2; i++) push(d2.u.a[i]); makearr(size1 + size2); } else errorf("type clash on concatenation: expecting strings or lists (got %s and %s)", typename(d1.type), typename(d2.type)); } /* concat uses the stack to form the result of a list concatenation, which limits the size of the result. This is a problem when people use the common form 'l = l // stuff' and long lists. The opcode below is an optimised concatenation combined with assignment to work around this particular problem [Ash] */ void concatopt(void) { Datum toAppend, currValue, addr, d; Datum *a, *dp; int len; char *s; int i, nAppend; DEBUGPRINT("VMOPER|DATSTK concatopt\n", 0); /* Language: l = l // expr (or l might be a string: s = s // expr) VM code: addr l | lvalue | asgn addr l | primary | expr | getvalue | primary | | expr stuff | | concatopt | Stack: expr result (to be appended) current value of l (mainly to be ignored except for type checking) address of l (where to append) */ toAppend = pop(); currValue = pop(); addr = pop(); mustaddr(addr, "concatopt"); if (isundef(toAppend) || isundef(currValue)) pushUNDEF(); else if (is_string(toAppend) && is_string(currValue)) { /* form the concatenation of the two strings */ /* !@!@ Need to do a DISTRIB handle_check here really [Ash] */ /* if they are a char (in the Datum), convert them to a string (in the heap) */ currValue = ctos(currValue); toAppend = ctos(toAppend); /* fprintf(stdout, "concatopt: strings: %s // %s\n", currValue.u.s, toAppend.u.s); */ len = strlen(currValue.u.s) + strlen(toAppend.u.s); /* Create a new Datum with malloc'd string value */ d.type = STRING; d.u.s = (char *)emalloc(len + 1); d.u.s = strcat(strcpy(d.u.s, currValue.u.s), toAppend.u.s); /* This new Datum replaces the old one at addr */ freedatum(*dptr(addr)); *dptr(addr) = d; push(d); ChangeSym(addr); /* or symbol_of(currValue), but addr should be == to this */ } else if (is_list(toAppend) && is_list(currValue)) { /* fprintf(stdout, "concatopt: lists\n"); */ mustlist(*(dp = dptr(addr)), "concatopt"); /* !@!@ Need to do a DISTRIB handle_check here really [Ash] */ nAppend = toAppend.u.a->u.i; /* Lists are an array of Datums starting at dp->u.a. The first Datum is an INTEGER, giving the length of the list. Therefore dp->u.a must always be malloc'd at least to the size of one Datum. [Ash] */ a = (Datum *) erealloc(dp->u.a, (dp->u.a->u.i + nAppend + 1) * sizeof(Datum)); for (i = 1; i <= nAppend; i++) { /* a->u.i is no of items in the list [Ash] */ a[++a->u.i] = newdatum(toAppend.u.a[i]); } dp->u.a = a; ChangeSym(addr); /* Need to return the result of this operation. The resultant list might be large in this case, so can't really push back the result as we might blow the stack. address(symbol_of(addr)); would push &l, but that isn't right either. Follow what append does instead and give @ as a result. [Ash] */ pushUNDEF(); } else errorf("type clash on concatenation: expecting strings or lists (got %s and %s)", typename(currValue.type), typename(toAppend.type)); } void jmp(void) { /* unconditional jump */ Int i = (Int) (*pc++); DEBUGPRINT("VMOPER|DATSTK jmp\n", 0); pc += i; } void jpt(void) { /* jump on true */ Int i = (Int) (*pc++); Datum d; DEBUGPRINT("VMOPER|DATSTK jpt\n", 0); d = pop(); if (isundef(d)) { return; } else { mustint(d, "jpt (loop construct)"); if (d.u.i) pc += i; } } void jpf(void) { /* jump on false */ Int i = (Int) (*pc++); Datum d; DEBUGPRINT("VMOPER|DATSTK jpf\n", 0); d = pop(); if (isundef(d)) { return; } else { mustint(d, "jpf (loop construct)"); if (!d.u.i) pc += i; } } void jpnt(void) { /* jump on not true, i.e. on false or @ */ Int i = (Int) (*pc++); Datum d; DEBUGPRINT("VMOPER|DATSTK jpnt\n", 0); d = pop(); if (isundef(d)) { pc += i; } else { mustint(d, "jpnt (loop construct)"); if (!d.u.i) pc += i; } } void jpnf(void) { /* jump on not false, i.e. on true or @ */ Int i = (Int) (*pc++); Datum d; DEBUGPRINT("VMOPER|DATSTK jpnf\n", 0); d = pop(); if (isundef(d)) { pc += i; } else { mustint(d, "jpnf (loop construct)"); if (d.u.i) pc += i; } } void and(void) { /* eager, logical and */ Datum d1, d2; DEBUGPRINT("VMOPER|DATSTK and\n", 0); switch (get2num(&d1, &d2)) { case INTEGER: d1.u.i = d1.u.i && d2.u.i; break; case REAL: errorf("type clash: eager logical and: expecting %s (got %s and %s)", typename(INTEGER), typename(d1.type), typename(d2.type)); default: pushUNDEF(); return; } push(d1); } void or(void) { /* eager, logical or */ Datum d1, d2; DEBUGPRINT("VMOPER|DATSTK or\n", 0); switch (get2num(&d1, &d2)) { case INTEGER: d1.u.i = d1.u.i || d2.u.i; break; case REAL: errorf("type clash: eager logical or: expecting %s (got %s and %s)", typename(INTEGER), typename(d1.type), typename(d2.type)); default: pushUNDEF(); return; } push(d1); } /* bitwise and [Ash] */ void bitand(void) { Datum d1, d2; DEBUGPRINT("VMOPER|DATSTK bitand\n", 0); switch (get2num(&d1, &d2)) { case INTEGER: d1.u.i = d1.u.i & d2.u.i; break; case REAL: errorf("type clash: bitwise and: expecting %s (got %s and %s)", typename(INTEGER), typename(d1.type), typename(d2.type)); default: pushUNDEF(); return; } push(d1); } /* bitwise or [Ash] */ void bitor(void) { Datum d1, d2; DEBUGPRINT("VMOPER|DATSTK bitor\n", 0); switch (get2num(&d1, &d2)) { case INTEGER: d1.u.i = d1.u.i | d2.u.i; break; case REAL: errorf("type clash: bitwise or: expecting %s (got %s and %s)", typename(INTEGER), typename(d1.type), typename(d2.type)); default: pushUNDEF(); return; } push(d1); } void ddup(void) { /* duplicate datum */ Datum d; DEBUGPRINT("VMOPER|DATSTK ddup\n", 0); d = top_of_stack; push(d); /* since "push: is a macro, it is saver to copy top-of-stack in variables first. */ } void popd(void) { /* pop a datum off stack */ Datum dummy; DEBUGPRINT("VMOPER|DATSTK popd\n", 0); dummy = pop(); /* the compiler don't like we just do the macro pop(), so we assign it to a dummy variable. */ } void pushUNDEF(void) { /* push @ on stack */ DEBUGPRINT("VMOPER|DATSTK pushUNDEF\n", 0); push(UndefDatum); } void pushint(void) { /* interpret next instruction as an integer and push it onto stack */ Datum d; DEBUGPRINT("VMOPER|DATSTK pushint\n", 0); d.type = INTEGER; d.u.i = (Int) * pc++; push(d); } void constpush(void) { /* push a constant */ DEBUGPRINT("VMOPER|DATSTK constpush\n", 0); /* the constant is pointed to by the rest of the code*/ push(*((Datum *) (*pc))); /* Note that using push with an expression with side-effect is dangerous if DEBUG [Ash] */ pc++; } / datacmp() is called by all comparison operators / int datacmp(d1, d2) /* internal function */ Datum d1, d2; /* compare two data */ { /* return 0 = equal, +ve = greater than */ int i; /* -ve = less than */ double r; if (sametype(d1, d2)) { if (d1.type != REAL && d2.type == REAL) { /* convert d1 to real */ d1.type = REAL; d1.u.r = d1.u.i; } else if (d1.type == REAL && d2.type != REAL) { /* convert d2 to real */ d2.type = REAL; d2.u.r = d2.u.i; } switch (d1.type) { case UNDEF: return 0; case REAL: return (r = d1.u.r - d2.u.r) ? (r > 0.0 ? 1 : -1) : 0; case STRING: return strcmp(d1.u.s, d2.u.s); case LIST: if (d1.u.a->u.i != d2.u.a->u.i) return 1; /* not equal */ for (i = 1; i <= d1.u.a->u.i; i++) if (datacmp(d1.u.a[i], d2.u.a[i])) return 1; /* not equal */ return 0; /* equal */ default: return (d1.u.i - d2.u.i); } } else { return 1; /* not equal */ } } void cnv_2_bool(void) { /* convert an integer to boolean value */ DEBUGPRINT("VMOPER|DATSTK cnv_2_bool\n", 0); switch (top_of_stack.type) { case INTEGER: case MYCHAR: top_of_stack.type = INTEGER; top_of_stack.u.i = top_of_stack.u.i != 0; break; case UNDEF: break; default: errorf("type clash: convert integer to bool: expecting %s (got %s)", typename(INTEGER), typename(top_of_stack.type)); break; } } void gt(void) { /* > */ Datum d1, d2, d; DEBUGPRINT("VMOPER|DATSTK gt\n", 0); d2 = pop(); d1 = pop(); if (sametype(d1, d2)) { if (d1.type != UNDEF && d1.type != LIST) { dpush(d, INTEGER, datacmp(d1, d2) > 0); return; } } pushUNDEF(); } void lt(void) { /* < */ Datum d1, d2, d; DEBUGPRINT("VMOPER|DATSTK lt\n", 0); d2 = pop(); d1 = pop(); if (sametype(d1, d2)) { if (d1.type != UNDEF && d1.type != LIST) { dpush(d, INTEGER, datacmp(d1, d2) < 0); return; } } pushUNDEF(); } void ge(void) { /* >= */ Datum d1, d2, d; DEBUGPRINT("VMOPER|DATSTK ge\n", 0); d2 = pop(); d1 = pop(); if (sametype(d1, d2)) { if (d1.type != UNDEF && d1.type != LIST) { dpush(d, INTEGER, datacmp(d1, d2) >= 0); return; } } pushUNDEF(); } void le(void) { /* <= */ Datum d1, d2, d; DEBUGPRINT("VMOPER|DATSTK le\n", 0); d2 = pop(); d1 = pop(); if (sametype(d1, d2)) { if (d1.type != UNDEF && d1.type != LIST) { dpush(d, INTEGER, datacmp(d1, d2) <= 0); return; } } pushUNDEF(); } void eq(void) { /* == */ Datum d1, d2; DEBUGPRINT("VMOPER|DATSTK eq\n", 0); d2 = pop(); d1 = pop(); d1.u.i = datacmp(d1, d2) == 0; d1.type = INTEGER; push(d1); } void ne(void) { /* != */ Datum d1, d2; DEBUGPRINT("VMOPER|DATSTK ne\n", 0); d2 = pop(); d1 = pop(); d1.u.i = datacmp(d1, d2) != 0; d1.type = INTEGER; push(d1); } /*- * Switch is implement by a jump table. Table entries are of the form: * * where * is a pointer pointing to the actual constant datum, and * is the relative offset to code entry. * If is a null ptr, then it is the default case. * If the switch statement has no default case, the must * point to the next statement (i.e. = 2). * See codeswitch() in file code.c for encoding the switch statement. -*/ void switchcode(void) { /* switch statement code */ Datum d; DEBUGPRINT("VMOPER|DATSTK|VMREAD|VMEXEC switchcode\n", 0); d = pop(); /* value */ for (; *pc && datacmp(d, *(Datum *) (*pc)); pc += 2); pc += (Int) pc[1]; /* do a relative jump */ } void definition(void) { /* put defn/func/action in symbol table */ symptr sp; symptr_QUEUE *splist; Inst *prog_begin, *prog_end; Int type; Int nauto; char *text; int checkok(symptr, symptr_QUEUE *); void change_sources(symptr, symptr_QUEUE *); #ifdef NO_CHECK_CIRCULAR extern int NCC; #endif /* NO_CHECK_CIRCULAR */ type = (Int) (*pc++); sp = (symptr) (*pc++); splist = (symptr_QUEUE *) (*pc++); prog_begin = (Inst *) (*pc++); prog_end = (Inst *) (*pc++); nauto = (Int) (*pc++); text = (char *) (*pc++); #ifdef NO_CHECK_CIRCULAR if (!NCC) #endif /* NO_CHECK_CIRCULAR */ if (!checkok(sp, splist)) { error2(sp->name, ": CYCLIC DEF : ABORTED"); } /* If the symbol is already installed and has not changed, don't install it again (I think) [Ash] */ if (prog_begin != sp->inst) { /*- if (sp->inst && !indef) { free(sp->inst); DEBUGPRINT("** definition: free %s %d\n", sp->name); } -*/ sp->nauto = nauto; sp->inst = prog_begin; sp->stype = type; sp->d.type = type; sp->d.u.sym = sp; sp->text = text; sp->entry = topEntryStack(); sp->master = topMasterStack(); change_sources(sp, splist); } DEBUGPRINT("VMOPER|VMREAD|DEFNET definition %s\n", sp->name); } /* definition_runtimelhs appears to have been added by Patrick to be used in the "`expr` is expr;" case. It used to (less meaningfully) be called definition1. [Ash] */ void definition_runtimelhs(void) { /* put defn/func/action in symbol table */ symptr sp; symptr_QUEUE *splist; Inst *prog_begin, *prog_end; Int type; Int nauto; char *text; int checkok(symptr, symptr_QUEUE *); void change_sources(symptr, symptr_QUEUE *); Datum addr; #ifdef NO_CHECK_CIRCULAR extern int NCC; #endif /* NO_CHECK_CIRCULAR */ /* For "`expr1` is expr2;", the parser codes opcodes which create the result of expr1 on the stack, followed by lookup_address. This pops the string off the stack, looks up that name as a reference into the symbol table, then pops back the address of that variable (creating it if it doesn't exist). Now the following finds the symbol to be redefined. [Ash] */ pop_address(addr, "definition_runtimelhs (adding definition)"); sp = symbol_of(addr); type = (Int) (*pc++); splist = (symptr_QUEUE *) (*pc++); prog_begin = (Inst *) (*pc++); prog_end = (Inst *) (*pc++); nauto = (Int) (*pc++); text = (char *) (*pc++); #ifdef NO_CHECK_CIRCULAR if (!NCC) #endif /* NO_CHECK_CIRCULAR */ if (!checkok(sp, splist)) { error2(sp->name, ": CYCLIC DEF : ABORTED"); } /* If the symbol is already installed and has not changed, don't install it again (I think) [Ash] */ if (prog_begin != sp->inst) { /*- if (sp->inst && !indef) { free(sp->inst); DEBUGPRINT("** free %s %d\n", sp->name); } -*/ sp->nauto = nauto; sp->inst = prog_begin; sp->stype = type; sp->d.type = type; sp->d.u.sym = sp; sp->text = text; sp->entry = topEntryStack(); sp->master = topMasterStack(); change_sources(sp, splist); } DEBUGPRINT("VMOPER|VMREAD|DEFNET definition_runtimelhs %s\n", sp->name); } /** * RUN-TIME CODES OF ASSIGNMENT AND INCREMENT OPERATORS * **/ static void need_rwv(Datum addr, char *from) { /* check if lvalue a RWV ? */ if (is_local(addr)) return; if (is_symbol(addr)) { if (symbol_of(addr)->stype != VAR) { errorf("%s %s is %s, not a read/write variable", from, symbol_of(addr)->name, typename(symbol_of(addr)->stype)); } } } /* This only seems to be called by assign() [Ash] */ static void cnv_formula_to_rwv(Datum addr) { /* if sym is a formula, convert to rwv */ extern void change_sources(symptr, symptr_QUEUE *); symptr sp; static symptr_QUEUE NullList = EMPTYQUEUE(NullList); if (is_symbol(addr) && (sp = symbol_of(addr))->stype == FORMULA) { /*- * free(sp->inst); -*//* remove the code */ sp->inst = (Inst *) 0; sp->nauto = 0; sp->stype = VAR; /* free(sp->text); */ sp->text = (char *) 0; change_sources(sp, &NullList); } } void assign(void) { /* lvalue = expression */ Datum d, addr, tmp; #ifdef DISTRIB symptr sp; #endif /* DISTRIB */ DEBUGPRINT("VMOPER|DATSTK|SYMTBL assign\n", 0); d = pop(); /* value */ addr = pop(); /* address */ mustaddr(addr, "="); #ifdef DISTRIB if (is_symbol(addr)) sp = symbol_of(addr); /* for agency --sun */ else sp=0; if (handle_check(sp)) { #endif cnv_formula_to_rwv(addr); need_rwv(addr, "'=':"); switch (address_type(addr)) { case DPTR: tmp = newdatum(d); freedatum(*dptr(addr)); *dptr(addr) = tmp; break; case CPTR: mustchar(d, "="); *cptr(addr) = d.u.i; break; default: address_error("="); break; } push(d); ChangeSym(addr); #ifdef DISTRIB } else { pushUNDEF(); } #endif } void inc_asgn(void) { /* lvalue += expression */ Datum d, addr; #ifdef DISTRIB symptr sp; #endif /* DISTRIB */ DEBUGPRINT("VMOPER|DATSTK|SYMTBL inc_asgn\n", 0); mustint(d = pop(), "+="); /* value */ addr = pop(); /* address */ mustaddr(addr, "+="); #ifdef DISTRIB if (is_symbol(addr)) sp = symbol_of(addr); /* for agency --sun */ else sp=0; #endif /* DISTRIB */ #ifdef DISTRIB if (handle_check(sp)) { #endif need_rwv(addr, "'+=':"); /* original code --sun */ switch (address_type(addr)) { case DPTR: mustint(*dptr(addr), "+="); /* += only works on integers - could be fixed [Ash] */ dptr(addr)->u.i += d.u.i; break; case CPTR: mustchar(d, "+="); *cptr(addr) += d.u.i; break; default: address_error("+="); break; } push(d); ChangeSym(addr); #ifdef DISTRIB } else { pushUNDEF(); } #endif } void dec_asgn(void) { /* lvalue -= expression */ Datum d, addr; #ifdef DISTRIB symptr sp; #endif /* DISTRIB */ DEBUGPRINT("VMOPER|DATSTK|SYMTBL dec_asgn\n", 0); mustint(d = pop(), "-="); /* value */ addr = pop(); /* address */ mustaddr(addr, "-="); #ifdef DISTRIB if (is_symbol(addr)) sp = symbol_of(addr); /* for agency --sun */ else sp=0; #endif /* DISTRIB */ #ifdef DISTRIB if (handle_check(sp)) { #endif need_rwv(addr, "'-=':"); /* original code --sun */ switch (address_type(addr)) { case DPTR: mustint(*dptr(addr), "-="); /* -= only works on integers - could be fixed [Ash] */ dptr(addr)->u.i -= d.u.i; break; case CPTR: mustchar(d, "-="); *cptr(addr) -= d.u.i; break; default: address_error("-="); break; } push(d); ChangeSym(addr); #ifdef DISTRIB } else { pushUNDEF(); } #endif } void pre_inc(void) { /* ++lvalue */ Datum d, addr; #ifdef DISTRIB symptr sp; #endif /* DISTRIB */ DEBUGPRINT("VMOPER|DATSTK|SYMTBL pre_inc\n", 0); addr = pop(); /* address */ mustaddr(addr, "++ (pre-inc)"); #ifdef DISTRIB if (is_symbol(addr)) sp = symbol_of(addr); /* for agency --sun */ else sp=0; #endif /* DISTRIB */ #ifdef DISTRIB if (handle_check(sp)) { #endif need_rwv(addr, "'++':"); /* original code --sun */ switch (address_type(addr)) { case DPTR: mustint(*dptr(addr), "++ (pre-inc)"); (dptr(addr)->u.i)++; push(*dptr(addr)); break; case CPTR: (*cptr(addr))++; dpush(d, MYCHAR, *cptr(addr)); break; default: address_error("++ (pre-inc)"); break; } ChangeSym(addr); #ifdef DISTRIB } else { pushUNDEF(); } #endif } void post_inc(void) { /* lvalue++ */ Datum d, addr; #ifdef DISTRIB symptr sp; #endif /* DISTRIB */ DEBUGPRINT("VMOPER|DATSTK|SYMTBL post_inc\n", 0); addr = pop(); /* address */ mustaddr(addr, "++ (post-inc)"); #ifdef DISTRIB if (is_symbol(addr)) sp = symbol_of(addr); /* for agency --sun */ else sp=0; #endif /* DISTRIB */ #ifdef DISTRIB if (handle_check(sp)) { #endif need_rwv(addr, "'++':"); /* original code --sun */ switch (address_type(addr)) { case DPTR: mustint(*dptr(addr), "++ (post-inc)"); push(*dptr(addr)); (dptr(addr)->u.i)++; break; case CPTR: dpush(d, MYCHAR, *cptr(addr)); (*cptr(addr))++; break; default: address_error("++ (post-inc)"); break; } ChangeSym(addr); #ifdef DISTRIB } else { pushUNDEF(); } #endif } void pre_dec(void) { /* --lvalue */ Datum d, addr; #ifdef DISTRIB symptr sp; #endif /* DISTRIB */ DEBUGPRINT("VMOPER|DATSTK|SYMTBL pre_dec\n", 0); addr = pop(); /* address */ mustaddr(addr, "-- (pre-dec)"); #ifdef DISTRIB if (is_symbol(addr)) sp = symbol_of(addr); /* for agency --sun */ else sp=0; #endif /* DISTRIB */ #ifdef DISTRIB if (handle_check(sp)) { #endif need_rwv(addr, "'--':"); /* original code --sun */ switch (address_type(addr)) { case DPTR: mustint(*dptr(addr), "-- (pre-dec)"); --(dptr(addr)->u.i); push(*dptr(addr)); break; case CPTR: --(*cptr(addr)); dpush(d, MYCHAR, *cptr(addr)); break; default: address_error("-- (pre-dec)"); break; } ChangeSym(addr); #ifdef DISTRIB } else { pushUNDEF(); } #endif } void post_dec(void) { /* lvalue-- */ Datum d, addr; #ifdef DISTRIB symptr sp; #endif /* DISTRIB */ DEBUGPRINT("VMOPER|DATSTK|SYMTBL post_dec\n", 0); addr = pop(); /* address */ mustaddr(addr, "-- (post-dec)"); #ifdef DISTRIB if (is_symbol(addr)) sp = symbol_of(addr); /* for agency --sun */ else sp=0; #endif /* DISTRIB */ #ifdef DISTRIB if (handle_check(sp)) { #endif need_rwv(addr, "'--':"); /* original code --sun */ switch (address_type(addr)) { case DPTR: mustint(*dptr(addr), "-- (post-dec)"); push(*dptr(addr)); --(dptr(addr)->u.i); break; case CPTR: dpush(d, MYCHAR, *cptr(addr)); --(*cptr(addr)); break; default: address_error("-- (post-dec)"); break; } ChangeSym(addr); #ifdef DISTRIB } else { pushUNDEF(); } #endif } /* UPDATE seems used by the parser to implement the ? query operator, presumably to stop this operator causing evaluation as its argument is parsed. [Ash] */ static int UPDATE = 1; void noupdate(void) { DEBUGPRINT("VMOPER|MCSTAT noupdate\n", 0); UPDATE = 0; } void resetupdate(void) { DEBUGPRINT("VMOPER|MCSTAT resetupdate\n", 0); UPDATE = 1; } void update(symptr sp) { /* force the evaluation/execution of defn/action */ extern void execute(Inst *); DEBUGPRINT("MCSTAT|VMEXEC|SYMTBL update\n", 0); if (UPDATE) { execute(sp->inst); /* eval/exec defn/action */ freedatum(sp->d); /* free the old value */ sp->d = newdatum(pop());/* store the new value in data register */ change(sp, FALSE); /* update the flag */ } } void addr(void) { /* push addr of data */ symptr sp; sp = (symptr) (*pc++); DEBUGPRINT("VMOPER|VMREAD|DATSTK addr: %s\n", sp->name); if (sp->stype == FORMULA && sp->changed) { update(sp); } address(sp); /* address() will do the push */ } /*- Take a variable name from stack, and look up from symbol table. Put the address onto stack. If symbol not found, create it. -*/ void lookup_address(void) { Datum d; symptr sp; extern char agentName[128]; /* for distributed Tkeden --sun */ extern int appAgentName, inEVAL, inPrefix; char newStr[128], *tempStr; extern void addID(symptr); d = pop(); /* Cope with `@`, for example [Ash] */ if (d.type == UNDEF) { pushUNDEF(); return; } muststr(d, "lookup_address"); /* variable id name */ /* printf("oldString = %s %s %i\n", d.u.s, agentName, appAgentName); */ newStr[0] = '\0'; if (*agentName !=0 && appAgentName >0 && strncmp(d.u.s, "~", 1) && !inEVAL) { /* for distributed --sun */ tempStr = d.u.s; if (!strncmp(d.u.s, "_", 1)) { strcat(newStr, "_"); tempStr++; } if (inPrefix) strcpy(newStr, agentName); else strcpy(newStr, tempStr); strcat(newStr, "_"); if (inPrefix) strcat(newStr, tempStr); else strcat(newStr, agentName); } else { if (!strncmp(d.u.s, "~", 1)) d.u.s++; strcpy(newStr, d.u.s); } /* original sy code --use d.u.s but not newStr */ /* printf("newString = %s", newStr); */ sp = lookup(newStr); /* look up for name */ /* install it in symbol table if not there */ if (sp == NULL) { sp = install(newStr, VAR, UNDEF, 0); } DEBUGPRINT("VMOPER|DATSTK|SYMTBL lookup_address: %s\n", sp->name); if (sp->stype == FORMULA && sp->changed) { update(sp); } address(sp); /* put the address of sp onto stack */ if (informula && !inEVAL) addID(sp); /* put sp into IDlist for dependency: bugfix! --sun */ } void localaddr(void) { /* push the address of a local variable */ Datum d; Int n; n = (Int) * pc++; DEBUGPRINT("VMOPER|VMREAD|DATSTK localaddr: %d\n", n); d.type = LOCALV | DPTR; d.u.v.x = (Int) & fp->stackp[n]; d.u.v.y = n; push(d); /* push the address on stack */ } void indexcalc(void) { /* compute the address of the i-th item/char of a list/string */ Datum addr, *dp, index; Int i; extern Int *eden_error_index_range; DEBUGPRINT("VMOPER|DATSTK indexcalc\n", 0); mustint(index = pop(), "indexing into list/string"); /* index */ i = index.u.i; pop_address(addr, "indexing into list/string"); if (address_type(addr) == DPTR) { dp = dptr(addr); switch (dp->type) { case LIST: /*CheckRange(i, 1, dp->u.a->u.i);*/ if (i < 1 || i > dp->u.a->u.i) { if (*eden_error_index_range) out_of_range_error(i, 1, dp->u.a->u.i); else { pushUNDEF(); return; } } addr.type = (addr.type & ADDRESSMASK) | DPTR; addr.u.v.x = (Int) & (dp->u.a[i]); break; case STRING: /*CheckRange(i, 1, (int) strlen(dp->u.s));*/ if (i < 1 || i > strlen(dp->u.s)) { if (*eden_error_index_range) out_of_range_error(i, 1, strlen(dp->u.s)); else { pushUNDEF(); return; } } --i; addr.type = (addr.type & ADDRESSMASK) | CPTR; addr.u.v.x = (Int) & (dp->u.s[i]); break; /* This doesn't work as we can't generate an address of a char, unless we malloc'd some space here with the char followed by \000... [Ash] */ /* case MYCHAR: if (i != 1) { errorf("index error: trying to find the %dth item of a %s", i, typename(MYCHAR)); } addr.type = (addr.type & ADDRESSMASK) | CPTR; addr.u.v.x = (Int) & (dp->u.s[0]); break; */ default: errorf("index error: list or string required (got %s, when trying to find %dth item)", typename(dp->type), i); /* it isn't a list/string */ break; } } else { errorf("index error: data isn't a list or string (when trying to find %dth item)", i); } push(addr); } void makelist(void) { /* create a list */ DEBUGPRINT("VMOPER|VMREAD makelist\n", 0); makearr((Int) * pc++); /* the rest of instruction indicates the no. of items (on the stack) */ } /* makearr moves n items off the stack. It copies them to the heap, * and links them together to form a list. Item number 0 in the list * is an INTEGER, containing the number of items in the list. [Ash] */ void makearr(Int n) { /* create a list */ /* n - no. of items (on the stack) */ Datum arr, d; DEBUGPRINT("HEAPAL|DATSTK makearr(%d)\n", n); arr.type = LIST; /* allocate memory on the heap */ arr.u.a = (Datum *) getheap((n + 1) * sizeof(Datum)); arr.u.a->type = INTEGER; /* the 0-th item stores the no. of items */ arr.u.a->u.i = n; while (n > 0) { /* printf("ASH: makearr: n=%d\n", n); */ d = pop(); /* printf("ASH: makearr: done pop, &arr.u.a[n]=0x%x &d=0x%x\n", &arr.u.a[n], &d); */ /* I've replaced this code: arr.u.a[n--] = d; with the memcpy version below as I've had problems with it and "Advanced C programming by example" (John Perry) suggests this on page 25 [Ash] */ memcpy(&arr.u.a[n], &d, sizeof(d)); n--; } push(arr); /* return the list */ } void getvalue(void) { Datum d, addr; symptr sp; extern Int *autocalc; extern int ready(); extern Int *eden_notice_undef_reference; #ifdef DISTRIB extern int oracle_check(symptr); #endif /* DISTRIB */ DEBUGPRINT("VMOPER|DATSTK getvalue\n", 0); /* Originally pop_address(addr);... I'm attempting to make `@` work... [Ash] */ addr=pop(); if (addr.type == UNDEF) { pushUNDEF(); return; } mustaddr(addr, "getvalue"); sp = symbol_of(addr); #ifdef DISTRIB if (is_symbol(addr)) { /* for agency --sun */ if (!oracle_check(sp)) { pushUNDEF(); return; } } #endif /* DISTRIB */ if (*autocalc && is_symbol(addr) && sp->stype == FORMULA && sp->changed && ready(sp)) { update(sp); } if (is_symbol(addr) && sp->d.type == UNDEF && *eden_notice_undef_reference) { noticef("reference to undefined variable %s (turn these notices off with eden_notice_undef_reference=0;)", sp->name); } switch (address_type(addr)) { case DPTR: push(*dptr(addr)); break; case CPTR: dpush(d, MYCHAR, *cptr(addr) & 0xFF); break; default: address_error("getvalue"); break; } } void sel(void) { /* return an item of a list or string */ Datum index, dat; Int i; DEBUGPRINT("VMOPER|DATSTK sel\n", 0); mustint(index = pop(), "indexing into list/string"); i = index.u.i; dat = pop(); switch (dat.type) { case LIST: CheckRange(i, 1, dat.u.a->u.i); push(dat.u.a[i]); break; case STRING: --i; CheckRange(i, 0, (int) strlen(dat.u.s)); dpush(dat, MYCHAR, dat.u.s[i] & 0xFF); break; default: errorf("index error: list or string required (got %s, when trying to find %dth item)", typename(dat.type), i); } } void listsize(void) { /* return the current size of list */ Datum d; DEBUGPRINT("VMOPER|DATSTK listsize\n", 0); d = pop(); switch (d.type) { case MYCHAR: dpush(d, INTEGER, 1); break; case STRING: dpush(d, INTEGER, strlen(d.u.s)); break; case LIST: push(d.u.a[0]); break; default: pushUNDEF(); break; } } void shift(void) { Datum addr, *dp; Int i; DEBUGPRINT("VMOPER|DATSTK|SYMTBL shift\n", 0); pop_address(addr, "shift"); mustlist(*(dp = dptr(addr)), "shift"); if (dp->u.a->u.i > 0) { freedatum(dp->u.a[1]); for (i = 1; i < dp->u.a->u.i; i++) dp->u.a[i] = dp->u.a[i + 1]; --(dp->u.a->u.i); /* a->u.i is no of items in the list [Ash] */ ChangeSym(addr); } else error("zero sized list found in 'shift'"); } void append(void) { Datum addr, *dp; Datum d, *a; DEBUGPRINT("VMOPER|DATSTK|SYMTBL append\n", 0); d = pop(); /* value */ pop_address(addr, "append"); mustlist(*(dp = dptr(addr)), "append"); a = (Datum *) erealloc(dp->u.a, (dp->u.a->u.i + 2) * sizeof(Datum)); a[++a->u.i] = newdatum(d); /* a->u.i is no of items in the list [Ash] */ dp->u.a = a; ChangeSym(addr); } void insert(void) { Datum addr, *dp; Datum d, p, *a; Int i, pos; DEBUGPRINT("VMOPER|DATSTK|SYMTBL insert\n", 0); d = pop(); /* value */ mustint(p = pop(), "insert"); /* position */ pos = p.u.i; pop_address(addr, "insert"); mustlist(*(dp = dptr(addr)), "insert"); CheckRange(pos, 1, dp->u.a->u.i + 1); a = (Datum *) erealloc(dp->u.a, (dp->u.a->u.i + 2) * sizeof(Datum)); for (i = a->u.i; i >= pos; --i) /* move backward */ a[i + 1] = a[i]; a[pos] = newdatum(d); /* insert */ ++a->u.i; /* a->u.i is no of items in the list [Ash] */ dp->u.a = a; ChangeSym(addr); } void delete(void) { Datum addr, *dp; Datum p, *a; Int i, pos; DEBUGPRINT("VMOPER|DATSTK|SYMTBL delete\n", 0); mustint(p = pop(), "delete"); /* position */ pos = p.u.i; pop_address(addr, "delete"); mustlist(*(dp = dptr(addr)), "delete"); CheckRange(pos, 1, dp->u.a->u.i); a = dp->u.a; freedatum(a[pos]); /* delete */ for (i = pos + 1; i <= a->u.i; i++) /* move forward */ a[i - 1] = a[i]; --a->u.i; /* a->u.i is no of items in the list [Ash] */ dp->u.a = a; ChangeSym(addr); } void query(void) { Datum addr; symptr sp; symptr_QUEUE *P, *Q; extern void print(Datum, FILE *, int); DEBUGPRINT("VMOPER|DATSTK query\n", 0); pop_address(addr, "query (?)"); sp = symbol_of(addr); if (sp == (symptr)0) { /* addr.u.v.y did not point to the containing symbol of the Datum, so just print the Datum. [Ash] */ print(addr, stdout, 1); printf("\n"); } else { switch (sp->stype) { case FORMULA: printf("%s is%s ", sp->name, sp->text); printf("/* current value of %s is ", sp->name); print(sp->d, stdout, 1); printf(" */\n"); break; case FUNCTION: case PROCMACRO: case PROCEDURE: printf("%s %s", sp->stype == FUNCTION ? "func" : (sp->stype == PROCMACRO ? "procmacro" : "proc"), sp->name); Q = &sp->sources; for (P = FRONT(Q); P; P = NEXT(Q, P)) { printf("%c %s", P == Q->next ? ':' : ',', P->obj->name); } printf(" "); if (sp->text) printf("%s\n", sp->text); break; default: printf("%s=", sp->name); print(sp->d, stdout, 1); /* print datum: in builtin.c */ printf(";\n"); break; } printf("%s ~> [", sp->name); Q = &sp->targets; for (P = FRONT(Q); P; P = NEXT(Q, P)) { printf(P == Q->next ? "%s" : ", %s", P->obj->name); } printf("]; /* %s last changed by %s */\n", sp->name, sp->master); } pushUNDEF(); } r = d.u.s; if (!strncmp(d.u.s, "_", 1)) { strcat(newStr, "_"); tempStr++; } if (inPrefix) strcpy(newStr, agentName); else strcpy(newStr, tempStr); strcat(newStr, tkeden1.41/Eden/machine.h010060000025250000164000000004150733032475300152500ustar00ashleyem00003510000005/* * $Id: machine.h,v 1.4 2001/07/27 17:50:35 cssbz Exp $ */ extern void mustint(Datum, char *); extern void mustchar(Datum, char *); extern void muststr(Datum, char *); extern void mustlist(Datum, char *); extern void mustaddr(Datum, char *); extern int datacmp(); tkeden1.41/Eden/macosxlibloc.c010060000025250000164000000033300743425126200163140ustar00ashleyem00003510000005#if defined(__APPLE__) && !defined(TTYEDEN) #include /* !@!@ Fudge! */ #include "/Developer/Headers/FlatCarbon/CFBundle.h" extern void setLibLocation(char *); #ifndef MAX_PATH_LEN #define MAX_PATH_LEN 1024 #endif void setMacOSXLibLoc(void) { /* lib-tkeden is located within the tkeden.app "bundle" directory (which is represented to the user in the Finder as an application icon). Get the reference to where it is. */ CFBundleRef mainBundleRef; mainBundleRef = CFBundleGetMainBundle(); if (mainBundleRef != NULL) { CFURLRef libtkedenURL; libtkedenURL = CFBundleCopyResourceURL(mainBundleRef, CFSTR("lib-tkeden"), NULL, NULL); if (libtkedenURL != NULL) { char *libtkedenPath = malloc(MAX_PATH_LEN + 1); /* char *cstr = malloc(1024); CFStringGetCString(CFURLGetString(libtkedenURL), cstr, 1024, kCFStringEncodingISOLatin2); fprintf(stderr, "libtkedenPath=%s\n", cstr); */ if (CFURLGetFileSystemRepresentation(libtkedenURL, true, libtkedenPath, MAX_PATH_LEN)) { setLibLocation(libtkedenPath); } else { /* gcc needs the -fpascal-strings option to allow \p (which means form a Pascal string: max 255 chars, the first byte states the length) */ StandardAlert(kAlertStopAlert, "\pOoops", "\pCouldn't GetFileSystemRepresentation of libtkedenURL", NULL, NULL); exit(1); } free(libtkedenPath); } else { StandardAlert(kAlertStopAlert, "\pOoops", "\pCouldn't find libtkedenURL", NULL, NULL); } } else { StandardAlert(kAlertStopAlert, "\pOoops", "\pCouldn't find mainBundleRef", NULL, NULL); } } #endif /* __APPLE__ and not TTYEDEN */ char *libtkedenPath = malloc(MAX_PATH_LEN + 1); /* char *cstr = malloc(1024); CFStringGetCString(CFURLGetString(libtkedenURL), cstr, 1024, kCFStringEncodingISOLatin2); fprintf(stderr, "libtkedenPath=%s\n", cstr); */ if (CFURLGetFileSystemRepresenttkeden1.41/Eden/main.c010060000025250000164000001303610744001143700145610ustar00ashleyem00003510000005/* * $Id: main.c,v 1.53 2002/03/01 23:47:43 cssbz Exp $ */ static char rcsid[] = "$Id: main.c,v 1.53 2002/03/01 23:47:43 cssbz Exp $"; #ifndef __WIN32__ # if defined(_WIN32) || defined(WIN32) || defined(__CYGWIN__) # define __WIN32__ # endif #endif #include "../config.h" #include #include #include #include #include #include #include #include #include #include /* for S_ISREG */ #include /* for getcwd() and gethostname() for DISTRIB [Ash] */ #include /* for PATH_MAX */ #include /* for M_PI */ #ifdef DISTRIB #include /* for MAXHOSTNAMELEN on Solaris [Ash] */ #include /* for MAXHOSTNAMELEN on Linux [Ash] */ #endif #include "../version.h" #include "emalloc.h" #ifdef HAVE_DMALLOC #include #endif /* From Autoconf manual [Ash] */ # if TIME_WITH_SYS_TIME # include # include # else # if HAVE_SYS_TIME_H # include # else # include # endif # endif #include "eden.h" #include "yacc.h" #include "builtin.h" #include "runset.h" #if defined(TTYEDEN) && defined(HAVE_READLINE) /* this must be included after yacc.h as it potentially defines RETURN */ #include #endif #include "../Misc/custom.h" #ifndef TTYEDEN #include /* Tcl caches environment variables: so we must use Tcl's versions of the getenv and putenv functions [Ash] */ #ifdef __APPLE__ /* Tcl/Tk on MacOS X seems to have a non-functioning Tcl_PutEnv */ #define putenv putenv #else #define putenv Tcl_PutEnv #endif /* Tcl 8.2.0 Makefile implies don't use the Tcl getenv [Ash] */ #define setenv TclSetEnv #define unsetenv TclUnsetEnv #include extern Tcl_Interp *interp; extern void EXinitTcl(void); #endif /* not TTYEDEN */ #ifndef TTYEDEN #ifdef __APPLE__ /*#include #include "tkMacOSX.h" #include "tkMacOSXEvent.h"*/ #endif #endif #include "notation.h" extern notationType currentNotation; char *libLocation = NULL; /* Location of Eden and Tcl library files - this replaces the use of the PUBLIC environment variable [Ash] */ char *progname; jmp_buf start; int startValid = 0; char **gargv; /* global argument list */ int gargc; Int *autocalc; Int *eden_error_index_range; /* enable / disable errors on encountering list or string references that are out of range [Ash] */ Int *eden_notice_undef_reference; /* enable / disable warning notices when making references to variables that are undefined [Ash] */ Int *eden_backticks_dependency_hack; /* enable / disable hack that gives back-ticks on the RHS "dependency", but on a one-off basis [Ash] */ int interrupted = 0; #ifdef DISTRIB int socketPort = 9000; /* for distributed Tkeden --sun */ char hostName[MAXHOSTNAMELEN]; char *hostNamePtr = 0; char *everyone = "EVERYONE"; Int *synchronize; /* connecting with Tcl/Tk to handle synchronized communication */ Int *EveryOneAllowed; /* to handle agency of an observable with a positive way, i.e. allowing every agent has agency when no listed name, or a negative way, i.e. allowing every agent has no agency when no listed name. */ Int *higherPriority; /* to handle execusively running a runset without any new running runset, i.e. all actions in queue will not be put into runset before current runset is finished --sun. Patrick confesses to this not working very well, which is why it is left undocumented ;) [Ash, with Patrick] */ Int *propagateType; /* to handle scripts' distributed propagation */ int isServer = 1; #endif /* DISTRIB */ #include "input_device.h" struct input_device *Inp_Dev = Input_Devices; struct input_device *Inp_Dev_Save = 0; /* work around bug in gcc - see below [Ash] */ #ifdef DEBUG #define DEBUGPRINT(s,i) if (Debug & 1) fprintf(stderr,s,i); #define DEBUGPRINT2(s,i,j) if (Debug & 1) fprintf(stderr,s,i,j); #else #define DEBUGPRINT(s,i) #define DEBUGPRINT2(s,i,j) #endif static RunSet RS1, RS2; static RunSet *RS; #ifdef TTYEDEN void checkRunSet(void); #else void checkRunSet(ClientData); #endif extern void incGarbageLevel(void), decGarbageLevel(void); extern void clearGarbage(void); #ifdef TTYEDEN char *prompt1 = "|> "; /* Usual prompt [Ash] */ char *promptsemi = ";> "; /* Prompt when waiting for a semi-colon */ char *promptchar = "\"> "; /* Prompt when waiting for a close-quote */ char *promptcomment = "*> "; /* Prompt when waiting for a close-comment */ char *prompt; symptr eden_prompt_sym; /* ttyeden: print prompts or not [Ash] */ int preprinted = FALSE; /* if TRUE, this makes printing the prompt a no-op. It is set to TRUE whenever the prompt is printed and FALSE whenever input is read. [Ash] */ int nlstts = TRUE; /* newline status? [Ash] */ /* nlstatus: update nlstts from Inp_Dev [Ash] */ void nlstatus(void) { nlstts = Inp_Dev->newline; } void print_prompt(void) { char *fullPromptText; extern char *fullPrompt(); if (!Inp_Dev->usereadline) { if (eden_prompt_sym->d.u.i) { fullPromptText = fullPrompt(); fprintf(stderr, "%s", fullPromptText); free(fullPromptText); } } preprinted = TRUE; } /* Also does a checkRunSet as this is ommitted otherwise when using the definitive parser. This is the easiest place to find where to do the checkRunSet. [Ash] */ void print_prompt_if_necessary(int doCheckRunSet) { if (Inp_Dev->type == FILE_DEV && (FILE *) Inp_Dev->ptr == stdin) { if (Inp_Dev->newline) { if (!preprinted) print_prompt(); } if (doCheckRunSet) { do { checkRunSet(); clearGarbage(); incGarbageLevel(); } while (RS->nitems > 0 && wouldBlock()); } } } #else /* not TTYEDEN */ int eden_interrupt_handler(ClientData, Tcl_Interp *, int, char *[]); #endif int wouldBlock(void) { fd_set fdset; int fd = fileno((FILE *) (Inp_Dev->ptr)); struct timeval timeout; timeout.tv_sec = timeout.tv_usec = 0; FD_ZERO(&fdset); FD_SET(fd, &fdset); return select(FD_SETSIZE, &fdset, 0, 0, &timeout) <= 0; } int run(short, void *, char *); void pushEntryStack(int); void popEntryStack(void); void clearEntryStack(void); int topEntryStack(void); void pushMasterStack(char *); void popMasterStack(void); void clearMasterStack(void); char *topMasterStack(void); void warning(char *, char *); void yyerror(char *); void init(void); void terminate(int); void run_init(Inst *); void user_trace(void); void queue(char *, char *); int main(int, char *[]); /* change type from void to int due to gcc 2.8.1 */ static int entryStackSize = 0; static int TopEntryStack = 0; static int *EntryStack; void pushEntryStack(int m) { DEBUGPRINT("ENTSTK pushEntryStack(%d)\n", m); if (entryStackSize == 0) { entryStackSize = 16; EntryStack = (int *) emalloc(sizeof(int) * entryStackSize); } else if (TopEntryStack == entryStackSize) { entryStackSize += 16; EntryStack = (int *) erealloc(EntryStack, sizeof(int) * entryStackSize); } EntryStack[TopEntryStack++] = m; } void popEntryStack(void) { DEBUGPRINT("ENTSTK popEntryStack\n", 0); if (--TopEntryStack < 0) TopEntryStack = 0; } void clearEntryStack(void) { DEBUGPRINT("ENTSTK clearEntryStack\n", 0); TopEntryStack = 0; pushEntryStack(0); } int topEntryStack(void) { return EntryStack[TopEntryStack - 1]; } static int masterStackSize = 0; static int TopMasterStack = 0; static char **MasterStack; void pushMasterStack(char *m) { if (masterStackSize == 0) { /* agent names can be maximum 16 chars in length [Ash] */ masterStackSize = 16; MasterStack = (char **) emalloc(sizeof(char *) * masterStackSize); } else if (TopMasterStack == masterStackSize) { masterStackSize += 16; MasterStack = (char **) erealloc(MasterStack, sizeof(char *) * masterStackSize); } MasterStack[TopMasterStack++] = m; } /* !@!@ I think popMasterStack and clearMasterStack should free the associated memory [Ash] */ void popMasterStack(void) { if (--TopMasterStack < 0) TopMasterStack = 0; } void clearMasterStack(void) { TopMasterStack = 0; } char * topMasterStack(void) { return MasterStack[TopMasterStack - 1]; } static time_t lastBeepTime = 0; static void setTimer(time_t * t) { time(t); } static char timedEventsEnabled(time_t * t) { return (time(NULL) > (*t + 3)); } #ifdef TTYEDEN void errorComplete(void) { /* do nothing */ } void errorContentf(char *fmt, ...) { va_list argp; va_start(argp, fmt); vfprintf(stderr, fmt, argp); va_end(argp); } void appendHist(char *toAppend) { /* do nothing */ } #else /* not TTYEDEN */ void errorComplete(void) { char tclCommand[30]; strcpy(tclCommand, "errorComplete"); /* Stop rapid beeping: only beep if we haven't done so for a while [Ash] */ if (timedEventsEnabled(&lastBeepTime)) { setTimer(&lastBeepTime); strcat(tclCommand, " 1\n"); } else { strcat(tclCommand, " 0\n"); } if (Tcl_Eval(interp, tclCommand) != TCL_OK) { fprintf(stderr, "Tcl error (errorComplete): %s\n", Tcl_GetStringResult(interp)); exit(-1); } } void errorContentf(char *fmt, ...) { va_list argp; char *errorMessage; Tcl_DString tclCommand; /* need to use Tcl_DStrings as want to ensure spaces and other characters are properly dealt with */ errorMessage = emalloc(Inp_Dev->linebufsize + 100); Tcl_DStringInit(&tclCommand); Tcl_DStringAppendElement(&tclCommand, "appendErr"); va_start(argp, fmt); vsnprintf(errorMessage, Inp_Dev->linebufsize + 100, fmt, argp); va_end(argp); Tcl_DStringAppendElement(&tclCommand, errorMessage); if (Tcl_Eval(interp, tclCommand.string) != TCL_OK) { fprintf(stderr, "Tcl error (errorContentf): %s\n", Tcl_GetStringResult(interp)); exit(-1); } Tcl_DStringFree(&tclCommand); free(errorMessage); } void appendHist(char *toAppend) { Tcl_DString tclCommand; Tcl_DStringInit(&tclCommand); Tcl_DStringAppendElement(&tclCommand, "appendHist"); Tcl_DStringAppendElement(&tclCommand, toAppend); if (Tcl_Eval(interp, tclCommand.string) != TCL_OK) { fprintf(stderr, "Tcl error (appendHist): %s\n", Tcl_GetStringResult(interp)); exit(-1); } Tcl_DStringFree(&tclCommand); } #endif /* So that notice() knows we are in the middle of reporting an error so that it can format the output correctly */ static int inerrorfretcall = 0; void noticef(char *fmt, ...) { va_list argp; char errorsbuf[256]; #ifdef TTYEDEN if (inerrorfretcall) fprintf(stderr, "\n"); fprintf(stderr, "%s: notice: ", progname); va_start(argp, fmt); vfprintf(stderr, fmt, argp); va_end(argp); if (fp != Inp_Dev->frame) { fprintf(stderr, " in %s%s", fp->master ? "action " : "", fp->master ? fp->master : fp->sp->name); } fprintf(stderr, "\n"); #else va_start(argp, fmt); vsnprintf(errorsbuf, sizeof(errorsbuf), fmt, argp); va_end(argp); if (inerrorfretcall) errorContentf("\n"); errorContentf("notice: %s", errorsbuf); if (fp != Inp_Dev->frame) { errorContentf(" in %s%s", fp->master ? "action " : "", fp->master ? fp->master : fp->sp->name); } errorContentf("\n"); errorComplete(); printf("%s: notice: %s\n", progname, errorsbuf); #endif } void warningf(char *fmt, ...) { char errorsbuf[256]; /* to hold the individual line causing the error */ va_list argp; va_start(argp, fmt); vsnprintf(errorsbuf, sizeof(errorsbuf), fmt, argp); va_end(argp); #ifdef TTYEDEN fprintf(stderr, "%s: warning: %s\n", progname, errorsbuf); #else errorContentf("warning: %s\n", errorsbuf); errorComplete(); fprintf(stderr, "%s: warning: %s\n", progname, errorsbuf); #endif } void warning(char *s, char *t) { /* print warning message */ warningf("%s%s", s, t); } /* Print error message and skip the rest of the input. Call this with printf style arguments */ void errorf(char *fmt, ...) { extern void ret_call(void); extern void reset_pseudo_machine_status(void); extern void reset_compiler_status(void); extern void freeheap(void); extern void flushRestOfLine(void); extern int nextc; int ntmp, i; char *stmp, *stmpout; char *errorsbuf; /* to hold the individual line causing the error */ va_list argp; errorsbuf = emalloc(Inp_Dev->linebufsize + 100); #ifdef TTYEDEN fprintf(stderr, "%s: error: ", progname); va_start(argp, fmt); vfprintf(stderr, fmt, argp); va_end(argp); #else /* must make our own copy of the error first (especially in the case of errors from Tcl_EvalEC, where a call to Tcl_Eval here would overwrite the error information) [Ash] */ va_start(argp, fmt); vsnprintf(errorsbuf, Inp_Dev->linebufsize + 100, fmt, argp); va_end(argp); /* careful: we can't use Tcl_EvalEC as if the error was generated there, it would cause re-entrancy [Ash] */ errorContentf("%s", errorsbuf); #ifdef DEBUG if (Debug & 4096) fprintf(stderr, "%s: error: %s\n", progname, errorsbuf); #endif /* DEBUG */ #endif /* not TTYEDEN */ free(errorsbuf); /* slurp the rest of the line into Inp_Dev->linebuf so it shows in the error message */ flushRestOfLine(); if (Inp_Dev != Input_Devices) { /* show error messages */ i = 0; while (fp > Inp_Dev->frame) { /* free the memory for frame */ if (fp->master) { /* fp->sp->name == fp->master */ errorContentf(i++ ? " called by action %s" : " in action %s", fp->sp->name); } else { if (fp->sp) { errorContentf(i++ ? " called by %s" : " in %s", fp->sp->name); } } inerrorfretcall++; ret_call(); inerrorfretcall--; } if (Inp_Dev->type == FILE_DEV) { if (Inp_Dev->name) errorContentf(" while executing file %s", Inp_Dev->name); else errorContentf(" while executing stdin"); } else { errorContentf(" while executing string"); } errorContentf(" near line %d, char %d:\n", Inp_Dev->lineno, Inp_Dev->charno); errorContentf("%s\n", Inp_Dev->linebuf); for (i = 0; i < Inp_Dev->charno-1; i++) { if (Inp_Dev->linebuf[i] == '\t') errorContentf("\t"); else errorContentf(" "); } errorContentf("^\n"); switch (Inp_Dev->type) { case FILE_DEV: /* flush rest of file */ fseek((FILE *) Inp_Dev->ptr, 0L, 2); break; case STRING_DEV: /* empty the string */ *Inp_Dev->ptr = '\0'; break; } nextc = 0; /* EOF */ Inp_Dev->charno = 0; Inp_Dev->linebuf[0] = '\0'; } #ifdef TTYEDEN prompt = prompt1; #else errorComplete(); #endif /* errorComplete() may cause Tcl to do edenCmd (via the binding on window changes. The Eden invoked will use the stack, so don't reset everything until /after/ errorComplete() has finished. (fix for "bug42") [Ash] */ freeheap(); reset_stack(); reset_eval(); reset_compiler_status(); if (startValid) { DEBUGPRINT("errorf: longjmp\n", 0); /* Work around bug in gcc - see this being used in run [Ash] */ Inp_Dev_Save = Inp_Dev; /* Jump to resume. The execution will jump to the last matching call to setjmp (either to the last setjmp(start) or setjmp(Inp_Dev->begin), depending on the value of Inp_Dev), as if it is a return from that call. setjmp returns the last parameter given here, 1. [Ash] */ longjmp((Inp_Dev == Input_Devices ? start : Inp_Dev->begin), 1); } else { /* Can't restart */ fprintf(stderr, "%s: error: ", progname); va_start(argp, fmt); vfprintf(stderr, fmt, argp); va_end(argp); fprintf(stderr, "\n"); exit(-1); } } void yyerror(char *s) { /* report compile-time error */ error(s); } #ifndef TTYEDEN /* This is the implementation for the new Tcl "interrupt" command, which is called when the Interrupt button is pressed... [Ash] */ int eden_interrupt_handler(ClientData clientData, Tcl_Interp * interp, int argc, char *argv[]) { interrupted = 1; fprintf(stderr, "%s: interrupt button pressed\n", progname); return TCL_OK; } #endif static time_t lastControlCTime = 0; RETSIGTYPE Control_C(int sig) { /* Two interrupts within three seconds cause the normal behaviour [Ash] */ if (timedEventsEnabled(&lastControlCTime)) { signal(SIGINT, Control_C); setTimer(&lastControlCTime); } else { /* Linux doesn't seem to reset to SIG_DFL automatically (although I think K+R says it should [Ash] */ signal(SIGINT, SIG_DFL); raise(SIGINT); } #ifndef TTYEDEN interrupted = 1; #endif /* don't use Tcl to give the error message as it might be in a non-re-entrable state (seem to have this problem particularly in Sasami) [Ash] */ fprintf(stderr, "%s: interrupted using control-c: press again within three seconds to quit\n", progname); } /* checkRunSet. tkeden's run-time strategy works like this. One of the last things in the main() routine is to set a callback to checkRunSet when Tcl is idle. checkRunSet looks at the RS. If it has items, it runs them. Then it sets the prompt and the callback. If the RS was empty, it does a Tcl update, then swaps RS. If the new RS has items, it sets the callback. If the new RS is empty, the callback is not set up. This scheme would cause any further input to be ignored, so queue() sets the callback when adding items to the RS. dtkeden's strategy is the same as tkeden. ttyeden's strategy is probably buggy. [Ash] */ #ifdef TTYEDEN void checkRunSet(void) #else void checkRunSet(ClientData clientData) #endif { Action a; #ifndef TTYEDEN extern void setprompt(void); Tcl_CancelIdleCall(checkRunSet, 0); #endif if (interrupted) { warning("interrupted: clearing both RunSets (current queue and todo)", ""); clearRunSet(&RS1); clearRunSet(&RS2); interrupted = 0; } #ifdef DEBUG if (Debug & 2) { fprintf(stderr, "checkRunSet start: RS->nitems=%d\n", RS->nitems); printRunSet(RS); } #endif /* DEBUG */ if (RS->nitems > 0) { /* There are some items in RS [Ash] */ /* I guess that run() may put items into the RunSet, so this while loop is necessary [Ash] */ while (RS->nitems > 0) { a = getAction(RS); pushMasterStack(a.master); #ifdef DEBUG if (Debug & 2) fprintf(stderr, "checkRunSet: RS->nitems=%d: run action %s\n", RS->nitems, a.s); #endif /* DEBUG */ run(STRING_DEV, a.s, 0); popMasterStack(); free(a.s); } #ifndef TTYEDEN #ifdef DEBUG if (Debug & 2) fprintf(stderr, "checkRunSet: doing Tcl_DoWhenIdle and setprompt\n"); #endif setprompt(); Tcl_DoWhenIdle(checkRunSet, 0); #endif } else { /* The RS is empty: swap RSs [Ash] */ #ifndef TTYEDEN /* normally tk will wait till idle to update, but Eden will check the runset when idle, so the screen will not be updated. So update explicitly here */ #ifdef DEBUG if (Debug & 2) fprintf(stderr, "checkRunSet: doing Tcl update\n"); #endif Tcl_EvalEC(interp, "update"); #endif /* Swap RunSets */ #ifdef DEBUG if (Debug & 2) fprintf(stderr, "checkRunSet: swapping RunSets\n"); #endif RS = (RS == &RS1) ? &RS2 : &RS1; #ifdef DEBUG if (Debug & 2) { fprintf(stderr, "checkRunSet just swopped RS: RS->nitems=%d\n", RS->nitems); printRunSet(RS); } #endif /* DEBUG */ #ifndef TTYEDEN if (RS->nitems > 0) { #ifdef DEBUG if (Debug & 2) fprintf(stderr, "checkRunSet: doing Tcl_DoWhenIdle\n"); #endif Tcl_DoWhenIdle(checkRunSet, 0); } #endif } } /* Add a line of script (cmd) to the non-active RunSet. master is the name of the agent responsible (eg "input", "interface"...). [Ash] */ void queue(char *cmd, char *master) { /* printf("QUEUE %s EOQ \n", cmd); */ addAction((RS == &RS1) ? &RS2 : &RS1, cmd, master); #ifndef TTYEDEN Tcl_DoWhenIdle(checkRunSet, 0); #endif } void init(void) { /* INITIALIZATION */ /* init builtin function, variables, etc */ void install_custom_variables(void); register int i; register symptr s; /* install builtin C library functions */ for (i = 0; blibtbl[i].name; i++) { s = install(blibtbl[i].name, BLTIN, BLTIN, 0); s->inst = (Inst *) blibtbl[i].func; s->d.type = BLTIN; s->d.u.sym = s; } /* install integer C library functions */ for (i = 0; ilibtbl[i].name; i++) { s = install(ilibtbl[i].name, LIB, LIB, 0); s->inst = (Inst *) ilibtbl[i].func; s->d.type = LIB; s->d.u.sym = s; } /* install real (floating-point) C library functions */ for (i = 0; rlibtbl[i].name; i++) { s = install(rlibtbl[i].name, RLIB, RLIB, 0); s->inst = (Inst *) rlibtbl[i].func; s->d.type = RLIB; s->d.u.sym = s; } install_custom_variables(); /* custom-built */ } void terminate(int code) { exit(code); } void run_init(Inst * pc) { /* init before running */ progp = pc; reset_entry_tbl(); reset_compiler_flags(); #ifdef TTYEDEN prompt = prompt1; #endif } int run(short type, void *ptr, char *name) { /* RUN A PROGRAM */ /* type - SOURCE TYPE: FILE_DEV/STRING_DEV (note stdin is a file [Ash])*/ /* ptr - FILE POINTER / STRING_DEV */ /* name - FILE NAME (IF ANY) */ /* EXECUTE UNTIL EOF OR ERROR OCCURRED */ char errorflag = FALSE; Inst *savepc = progp; int token; extern int nextc; extern void init_lex(void), execute(Inst *); #ifdef DEBUG #define INITPTRSTUFFLEN 30 /* for printing out the initial part of ptr in debugging output [Ash] */ char initPtrStuff[INITPTRSTUFFLEN+1]; #endif /* It is good to use our custom bison.simple if we can. Eden doesn't apparently seem to need to token-at-a-time parsing (indeed, I've had to modify things to make Eden work with this style of parser), but I'm hoping that this might solve the problems we've had recently with user input being locked out on occasion. We also benefit from my modification to bison.simple which prints out information after a parse error, even if there are many possibilities to show. I've made my modifications here a conditional compile as I'm not sure I've got it right! [Ash] */ #define USE_CUSTOM_BISON_SIMPLE 1 #ifdef USE_CUSTOM_BISON_SIMPLE extern int yyparse(int); extern int yylex(void); extern void setyyparseinit(int); int parseret; #else extern int yyparse(void); #endif Inp_Dev++; Inp_Dev->frame = fp; Inp_Dev->name = name; #define LINEBUFINITIALSIZE 256 if (!Inp_Dev->linebuf) { Inp_Dev->linebuf = emalloc(LINEBUFINITIALSIZE); Inp_Dev->linebufsize = LINEBUFINITIALSIZE; } Inp_Dev->linebuf[0] = '\0'; Inp_Dev->linebufend = -1; Inp_Dev->charno = -1; switch (Inp_Dev->type = type) { case FILE_DEV: Inp_Dev->ptr = ptr; break; case STRING_DEV: Inp_Dev->sptr = (char *) emalloc(strlen(ptr) + 1); strcpy(Inp_Dev->sptr, ptr); Inp_Dev->ptr = Inp_Dev->sptr; break; } Inp_Dev->newline = TRUE; #ifdef TTYEDEN nlstatus(); #endif Inp_Dev->lineno = 0; Inp_Dev->lastc = nextc; #ifdef DEBUG if (Debug&1) { if (type == STRING_DEV) { char *p; int n; for (p = ptr, n = 0; isprint(*p) && n<(INITPTRSTUFFLEN-3); p++, n++) initPtrStuff[n] = *p; initPtrStuff[n] = '\0'; if ((n == INITPTRSTUFFLEN-3) || (*p != '\0')) strcat(initPtrStuff, "..."); } fprintf(stderr, "MCSTAT run start: %s %s%s%s Inp_Dev level: %d\n", type == FILE_DEV ? "FILE_DEV" : "STRING_DEV", name ? name : "", name ? " " : "", type == STRING_DEV ? initPtrStuff : "", Inp_Dev - Input_Devices); } #endif /* A matching call of longjmp(Inp_Dev->begin, val) will cause execution to jump to here. errorflag will be set to the val passed above. (K+R C, second edition, page 254). [Ash] */ DEBUGPRINT("run: setjmp\n", 0); errorflag = setjmp(Inp_Dev->begin); #ifdef TTYEDEN #ifdef HAVE_READLINE Inp_Dev->usereadline=1; #else Inp_Dev->usereadline=0; #endif #endif #if defined(TTYEDEN) && defined(HAVE_READLINE) /* don't use readline for input which is coming via a pipe */ if (type == FILE_DEV) { struct stat stats; fstat(fileno((FILE *)Inp_Dev->ptr), &stats); /* fprintf(stderr, "st_mode = %o\n", stats.st_mode); */ if (S_ISFIFO(stats.st_mode)) { Inp_Dev->usereadline=0; } } #endif init_lex(); /* reads in one character. However I think UNIX blocks until a complete line has been read in the case of ttyeden [Ash] */ run_init(savepc); incGarbageLevel(); #ifdef TTYEDEN /* There seems to be a strange bug in gcc. Under some (quite normal) circumstances, when compiled with -O2, gcc seems to optimise away Inp_Dev, leaving it = 0 at this point after the longjmp to the setjmp above. Unfortunately gdb seems to lie about this - the value of 0 can only be seen by observing the Seg fault that results and by manually inserting printfs below. Working around it by setting it back to what it was before the longjmp here. [Ash] */ //fprintf(stderr, "Inp_Dev = %d\n", Inp_Dev); if (errorflag) Inp_Dev = Inp_Dev_Save; /* work around bug in gcc [Ash] */ //fprintf(stderr, "Inp_Dev = %d\n", Inp_Dev); print_prompt_if_necessary(0); #endif #ifdef USE_CUSTOM_BISON_SIMPLE while (!interrupted) { setyyparseinit(1); /* re-initialise the parser */ while (!interrupted) { token = yylex(); DEBUGPRINT("PARSER yylex() returned %d\n", token); if (!token) goto postexec; /* same effect as interrupted, but no other effects */ parseret = yyparse(token); DEBUGPRINT("PARSER yyparse() returned %d\n", parseret); if (parseret >= 0) break; } if (interrupted) break; #else while (!interrupted && yyparse()) { #endif execute(savepc); run_init(savepc); clearGarbage(); incGarbageLevel(); #ifdef TTYEDEN print_prompt_if_necessary(1); #endif } postexec: decGarbageLevel(); /* finished, remove the device */ nextc = Inp_Dev->lastc; switch (Inp_Dev->type) { case FILE_DEV: /* close the file, but not stdin */ if ((FILE *) Inp_Dev->ptr != stdin) fclose((FILE *) Inp_Dev->ptr); break; case STRING_DEV: free(Inp_Dev->sptr); break; } --Inp_Dev; /* remove device */ progp = savepc; freeheap(); DEBUGPRINT2("MCSTAT run end: Inp_Dev level: %d, errorflag: %d\n", Inp_Dev - Input_Devices, errorflag); return errorflag; /* return error flag */ } void user_trace(void) { /* EDEN function */ Frame *p; fprintf(stderr, "\n"); for (p = &frame[1]; p <= fp; p++) fprintf(stderr, p == fp ? "%s\n" : "%s->", p->sp->name); } void setLibLocation(char *location) { char *toPutEnv; char *cwd; if (libLocation) free(libLocation); libLocation = emalloc(255); #ifndef __WIN32__ if (location[0] != '/') { /* Location specified as a relative path, so make it absolute by prepending the current working directory */ if ((cwd = getcwd(NULL, PATH_MAX)) == NULL) { perror("Failed to get current working directory"); exit(2); } strcpy(libLocation, cwd); free(cwd); strcat(libLocation, "/"); strcat(libLocation, location); } else { strcpy(libLocation, location); } #else strcpy(libLocation, location); #endif /* Assign the result to an environment variable as well (so it can be used by Tcl) */ toPutEnv = emalloc(255); *toPutEnv = '\0'; strcat(toPutEnv, "TKEDEN_LIB="); strcat(toPutEnv, libLocation); if (putenv(toPutEnv) == -1) { perror("Failed to putenv TKEDEN_LIB"); } /* It appears we must not now free(toPutEnv) [Ash] */ } #ifndef streq #define streq(s1,s2) (strcmp(s1,s2)==0) #endif #ifdef DISTRIB void printUsage() { /* DISTRIB */ fprintf(stderr, "Usage: %s [-s|-a] -c -h {-l} {-v|-u} {-e }|{} {-e }|{}...\n", progname); fprintf(stderr, " -s invoke as the server (\"superagent\") -a invoke as a client (\"agent\") -c channel number: 0,1,2,3, ..., 99 -h hostname of the machine running the dtkeden server (only required if running as a client [-a]) -l name of the directory containing the library files -v output version information and exit -u output this usage information and exit -e execute 'code' if file is '-', standard input will be read See %s for more information\n", TKEDEN_WEB_SITE); } #elif defined TTYEDEN void printUsage() { /* TTYEDEN */ fprintf(stderr, "Usage: %s [-l] {-v|-u} {-n|-i} {-e |} {{-n|-i} {-e |}}...\n", progname); fprintf(stderr, " -l name of the directory containing the library files (optional, but required for some functionality eg the definitive parser) -n non-interactive mode (don't print prompts) -i interactive mode (do print prompts) -v output version information and exit -u output this usage information and exit -e execute 'code' if file is '-', standard input will be read See %s for more information\n", TKEDEN_WEB_SITE); } #else /* probably TKEDEN */ void printUsage() { /* TKEDEN */ fprintf(stderr, "Usage: %s {-l} {-v|-u} {-e }|{} {-e }|{}...\n", progname); fprintf(stderr, " -l name of the directory containing the library files -v output version information and exit -u output this usage information and exit -e execute 'code' if file is '-', standard input will be read See %s for more information\n", TKEDEN_WEB_SITE); } #endif /* probably TKEDEN */ /* Print the version number and exit (probably requested to do so via a command line option) [Ash] */ void printVersion(void) { fprintf(stderr, "%s: %s version %s\n", progname, TKEDEN_VARIANT, TKEDEN_VERSION); fprintf(stderr, "Lib directory is %s\n", libLocation ? libLocation : "unknown"); #ifdef DISTRIB fprintf(stderr, "hostName is %s\n", hostName ? hostName : "unknown"); #endif fprintf(stderr, "Use the -u option for information on usage of command options\n"); fprintf(stderr, "See %s for more information\n", TKEDEN_WEB_SITE); exit(0); } #ifdef DISTRIB /* Figure out the name of this host. This is used particularly by a dtkeden client to figure out which host to contact as the server. Note this setting may well be overridden by the user specifying a -h option. [Ash] */ void setHostName(void) { if (gethostname(hostName, MAXHOSTNAMELEN)) { fprintf(stderr, "%s: gethostname failed\n", progname); exit(1); } hostNamePtr = hostName; } #endif #if defined(__WIN32__) && !defined(TTYEDEN) RETSIGTYPE confirmSig(int sig) { signal(sig, SIG_DFL); fprintf(stderr, "Signal %d received - press return to continue\n", sig); getchar(); raise(sig); } #endif /* Create system Eden func and procs. [Ash] */ void init_eden(void) { FILE *initFile; char *name = "/eden.eden"; char fullname[255]; /* This hack comes from C FAQ Q 11.7 (eg http://www.faqs.org/faqs/C-faq/faq). It seems to be the only way to get the value of a cpp constant into a C string constant [Ash] */ #define Str(x) #x #define Xstr(x) Str(x) /* Want these to be accessible from ttyeden when libLocation is not set, so can't read these from an init file. [Ash] */ char initStr[] = " func cwd { return _eden_internal_cwd(); } proc cd { _eden_internal_cd($1); touch(&cwd); } dirname is _eden_internal_dirname; basename is _eden_internal_basename; PI = " Xstr(M_PI) ";"; run(STRING_DEV, initStr, 0); /* If it is possible, execute the initialisation file */ if (!libLocation) return; strcpy(fullname, libLocation); strcat(fullname, name); if ((initFile = fopen(fullname, "r")) == 0) errorf("couldn't open initialisation file %s: %s", fullname, strerror(errno)); run(FILE_DEV, initFile, name); } #if defined(TTYEDEN) && defined(HAVE_READLINE) void initreadline(void) { /* Allow conditional parsing of the ~/.inputrc file */ rl_readline_name = "ttyeden"; /* Stop tab key attempting to expand into filenames */ rl_bind_key('\t', rl_insert); } #endif int main(int argc, char *argv[]) { /* MAIN PROGRAM */ /* Options processing [Ash] */ char op; /* stores one option returned at a time from getopt [Ash] */ int argerr = 0; /* whether there has been an error during option processing [Ash] */ int usedArg = 1; /* the arguments processed so far - so we can figure out later on how many filenames are on the command line [Ash] */ extern char *optarg; /* getopt sets this when it comes across an option with an argument [Ash] */ extern int optind; /* this is an index into argv set by getopt [Ash] */ extern void initcode(void), init_LocalVarList(void); FILE *filein; char *name; symptr s; #ifdef DISTRIB extern void init_LSDagentList(void); #endif /* DISTRIB */ #ifndef TTYEDEN extern void EXinit(void); extern void init_donald(void), init_scout(void), init_notations(void); #endif #ifdef __WIN32__ extern cygwin_conv_to_full_win32_path(const char *path, char *win32_path); char *cwd; char *cwdwin32style; char *toPutEnv; char *passToSetLibLocation; #endif #ifdef WANT_SASAMI extern void sa_init_sasami(); #endif /* WANT_SASAMI */ char edenCmd[PATH_MAX + 100]; #if defined(__APPLE__) && !defined(TTYEDEN) Tk_MacOSXSetupTkNotifier(); #endif #if defined(__WIN32__) && !defined(TTYEDEN) /* Try and give the user a chance to see any fatal error messages before tkeden quits and the DOS stdout/stderr window disappears [Ash] */ signal(SIGHUP, confirmSig); signal(SIGINT, confirmSig); signal(SIGQUIT, confirmSig); signal(SIGILL, confirmSig); signal(SIGKILL, confirmSig); signal(SIGBUS, confirmSig); signal(SIGSEGV, confirmSig); signal(SIGTERM, confirmSig); #endif progname = argv[0]; #ifdef __WIN32__ /* Let's try and derive the info required from the current working directory, on Windows only [Ash] */ if ((cwd = getcwd(NULL, PATH_MAX)) == NULL) { perror("Failed to get current working directory"); exit(2); } cwdwin32style = emalloc(PATH_MAX); cygwin_conv_to_full_win32_path(cwd, cwdwin32style); free(cwd); toPutEnv = emalloc(255); *toPutEnv = '\0'; /* This works manually... strcat(toPutEnv, "TCL_LIBRARY=c:\\cygwin\\usr\\share\\tcl8.0"); */ strcat(toPutEnv, "TCL_LIBRARY="); strcat(toPutEnv, cwdwin32style); strcat(toPutEnv, "\\share\\tcl8.0"); putenv(toPutEnv); /* I think we can't free(toPutEnv) now */ passToSetLibLocation = emalloc(255); *passToSetLibLocation = '\0'; /* This works manually... strcat(passToSetLibLocation, "c:\\cygwin\\home\\default\\tkeden1.15\\lib-tkeden"); */ strcat(passToSetLibLocation, cwdwin32style); strcat(passToSetLibLocation, "\\lib-tkeden"); setLibLocation(passToSetLibLocation); free(passToSetLibLocation); #endif /* __WIN32__ */ #if defined(__APPLE__) && !defined(TTYEDEN) setMacOSXLibLoc(); #endif /* __APPLE__ and not TTYEDEN */ #ifndef TTYEDEN /* If we don't do this, on cygwin we get an error from Tcl_Init "couldn't stat "": no such file or directory" [Ash] */ Tcl_FindExecutable(progname); /* This is required by Tcl 8.2.0, otherwise the Tcl_PutEnv in setLibLocation falls over due to an uninitialised Tcl encoding system. The initialisation of Tcl probably calls TclInitEncodingSubsystem();, which is required. [Ash] */ EXinitTcl(); #endif /* TTYEDEN */ #ifdef DISTRIB setHostName(); #endif /* DISTRIB */ #ifdef DISTRIB /* ':' in the getopt opt-string means that the preceding option has an argument. A '+' character starting the options string requests getopt to stop options processing as soon as a non-option argument is encountered (see getopt(3) on Linux). [Ash] */ while ((op = getopt(argc, argv, "+sac:h:vul:e")) != EOF) { #elif defined(TTYEDEN) while ((op = getopt(argc, argv, "+vunil:e")) != EOF) { #else /* probably tkeden */ #ifdef __APPLE__ /* For some reason, -p (perhaps -psn actually) is passed on Mac OS X: ignore it */ while ((op = getopt(argc, argv, "+vul:ep:")) != EOF) { #else while ((op = getopt(argc, argv, "+vul:e")) != EOF) { #endif /* __APPLE__ */ #endif /* -e, -n, -i must come after the other options which are processed by getopt (ie they represent the start of the filename list...) [Ash] */ if ((op == 'e') || (op == 'n') || (op == 'i')) { optind--; /* we want the filename reading while loop below to process this argument */ break; } switch (op) { #ifdef DISTRIB case 's': isServer = 1; usedArg++; break; case 'a': isServer = 0; usedArg++; break; case 'c': socketPort = socketPort + atoi(optarg); usedArg += 2; break; case 'h': strcpy(hostName, optarg); usedArg += 2; break; #endif case 'u': printUsage(); exit(0); case 'l': setLibLocation(optarg); usedArg += 2; break; case 'v': printVersion(); /* does not return */ case 'p': /* For some reason, -p (perhaps -psn actually) is passed on Mac OS X: ignore it */ fprintf(stderr, "argument p %s\n", optarg); break; case '?': /* unknown option character */ case ':': /* missing parameter for one of the options */ argerr++; break; } if (argerr) { printUsage(); exit(-1); } } /* TTYEDEN still works if the -l argument is not given, but some facilities (eg the definitive parser) will not be available */ #ifndef TTYEDEN if (!libLocation) { fprintf(stderr, "%s: Could not find library files location (try using the -l argument)\n", progname); exit(-1); } #endif /* TTYEDEN */ #ifdef DISTRIB if (socketPort > 9099) { /* The user enters a number from 0-99, but actually we use a socket number from 9000 upwards :) [Ash, with Patrick] */ fprintf(stderr, "Channel number must be less than 100\n"); printUsage(); exit(-1); } #endif #ifdef TTYEDEN #ifdef HAVE_READLINE initreadline(); #endif prompt = prompt1; #endif setbuf(stdout, 0); clearEntryStack(); clearMasterStack(); pushMasterStack("system"); #ifdef DISTRIB (s = install("EveryOneAllowed", VAR, INTEGER, 1))->changed = FALSE; EveryOneAllowed = &s->d.u.i; #endif /* DISTRIB */ (s = install("autocalc", VAR, INTEGER, 1))->changed = FALSE; autocalc = &s->d.u.i; (s = install("eden_error_index_range", VAR, INTEGER, 1))->changed = FALSE; eden_error_index_range = &s->d.u.i; (s = install("eden_notice_undef_reference", VAR, INTEGER, 0))->changed = FALSE; eden_notice_undef_reference = &s->d.u.i; (s = install("eden_backticks_dependency_hack", VAR, INTEGER, 0))->changed = FALSE; eden_backticks_dependency_hack = &s->d.u.i; #ifdef TTYEDEN (s = install("eden_prompt", VAR, INTEGER, 1))->changed = FALSE; eden_prompt_sym = s; #endif /* TTYEDEN */ #ifdef DISTRIB (s = install("synchronize", VAR, INTEGER, 0))->changed = FALSE; synchronize = &s->d.u.i; (s = install("higherPriority", VAR, INTEGER, 0))->changed = FALSE; higherPriority = &s->d.u.i; (s = install("propagateType", VAR, INTEGER, 1))->changed = FALSE; propagateType = &s->d.u.i; #endif /* DISTRIB */ initRunSet(&RS1); initRunSet(&RS2); RS = &RS1; #ifndef TTYEDEN EXinit(); #endif signal(SIGINT, Control_C); init(); initcode(); init_LocalVarList(); #ifdef DISTRIB init_LSDagentList(); /* initial LSDagentList --sun */ #endif /* DISTRIB */ init_eden(); #ifndef TTYEDEN init_donald(); init_scout(); #ifdef WANT_SASAMI sa_init_sasami(); #endif /* WANT_SASAMI */ #endif init_notations(); /* added by Chris Brown, 2000 */ popMasterStack(); pushMasterStack("initialisation"); /* Figure out where the end of the options (and start of the filename list) is [Ash] */ gargc = argc - usedArg; gargv = argv + optind; setjmp(start); /* set resume point */ startValid++; while (gargc-- > 0) { /* Recall that argv is an array of pointers to the already-separated command arguments [Ash] */ name = *gargv++; /* We seem to end up with gargc = 1 on Mac OS X, but gargv is NULL. */ if (name == NULL) continue; if (streq(name, "-")) { /* - is shorthand for stdin */ run(FILE_DEV, stdin, name); continue; } #ifdef TTYEDEN if (streq(name, "-n")) { eden_prompt_sym->d.u.i = FALSE; change(eden_prompt_sym, TRUE); continue; } if (streq(name, "-i")) { eden_prompt_sym->d.u.i = TRUE; change(eden_prompt_sym, TRUE); continue; } #endif if (streq(name, "-e")) { /* Execute the following argument as a string [Ash] */ char *argIn, *argProcessed, *inp, *outp, c; argIn = *gargv++; gargc--; /* we've consumed another argument */ /* translate "\n" to newline */ argProcessed = emalloc(strlen(argIn) + 1); inp = argIn; outp = argProcessed; do { c = *inp++; if ((c == '\\') && (*inp == 'n')) { inp++; *outp++ = '\n'; } else { *outp++ = c; } } while (c != '\0'); appendHist(argProcessed); run(STRING_DEV, argProcessed, 0); free(argProcessed); #ifdef TTYEDEN currentNotation = EDEN; /* fudge but which makes the prompt correct [Ash] */ #else setprompt(); #endif continue; } if (*name == '-') { /* First character is -, but it isn't one of the above options, so print a message and carry on */ fprintf(stderr, "%s: unknown argument %s\n", progname, name); continue; } /* else a filename */ if ((filein = fopen(name, "r"))) { /* Do this on WIN32 only, as it messes things up when starting tkeden with filename arguments which include relative pathnames - a problem on UNIX as most people use the command line to start tkeden, but on WIN32 this hack is usually necessary so that files can be dragged onto the tkeden icon and then include other files from that directory successfully. [Ash] */ #ifdef __WIN32__ /* cd into the directory containing the file, to give any Eden include(...) procedures a chance [Ash] */ sprintf(edenCmd, "%%eden\ncd(dirname(\"%s\"));\n", name); appendHist(edenCmd); run(STRING_DEV, edenCmd, 0); /* this whole command is a bit of a lie really, but it should help the user to appreciate what is going on [Ash] */ sprintf(edenCmd, "include(basename(\"%s\")); /* (invoked from command line) */\n", name); appendHist(edenCmd); #else /* On UNIX, don't do the cd'ing but do leave something in the history [Ash] */ sprintf(edenCmd, "%%eden\ninclude(\"%s\"); /* (invoked from command line) */\n", name); appendHist(edenCmd); #endif run(FILE_DEV, filein, name); #ifndef TTYEDEN setprompt(); #endif continue; } else { fprintf(stderr, "%s: can't open %s\n", progname, name); } } popMasterStack(); #ifdef TTYEDEN pushMasterStack("input"); setjmp(start); /* set resume point */ run(FILE_DEV, stdin, "stdin"); popMasterStack(); #else Tcl_DoWhenIdle(checkRunSet, 0); setjmp(start); /* set resume point */ Tk_MainLoop(); #endif /* TTYEDEN */ terminate(0); } win32style; char *toPutEnv; char *passToSetLibLocation; #endif #ifdef WANT_SASAMI extern void sa_init_sasami(); #endif /* WANT_SASAMI */ char edenCmd[PATH_MAX + 100]; #if defined(__APPLE__) && !defined(TTYEDEN) Tk_MacOSXSetupTkNotifier(); #endif #if definedtkeden1.41/Eden/Makefile.in010060000025250000164000000005000743425162100155310ustar00ashleyem00003510000005# # $Id: Makefile.in,v 1.14 2002/02/18 19:18:41 cssbz Exp $ # PARSER_SOURCE = yacc.y PARSER_OUT = yacc.c PARSER_HEADERS_OUT = yacc.h SOURCES = builtin.c code.c eval.c heap.c global.q.c lex.c lib.c machine.c \ main.c refer.c runset.c symbol.c type.c trans.c \ macosxlibloc.c LIB = libeden.a include ../generic.mk tkeden1.41/Eden/notation.h010060000025250000164000000005610733254375700155120ustar00ashleyem00003510000005/* * $Id: notation.h,v 1.8 2001/08/03 15:49:03 cssbz Exp $ */ typedef enum { INTERNAL, EDEN, SCOUT, DONALD, ARCA, OTHER #ifdef WANT_SASAMI , SASAMI #endif /* WANT_SASAMI */ #ifdef DISTRIB ,LSD #endif } notationType; extern notationType currentNotation; void changeNotation(notationType); void setprompt(void); void evaluate(char *, char *); tkeden1.41/Eden/refer.c010060000025250000164000000210310733032514700147350ustar00ashleyem00003510000005/* * $Id: refer.c,v 1.8 2001/07/27 17:52:39 cssbz Exp $ */ static char rcsid[] = "$Id: refer.c,v 1.8 2001/07/27 17:52:39 cssbz Exp $"; /**** * REFERENCE LIST MAINTAINER * ****/ #include #include "../config.h" #include "eden.h" #include "yacc.h" #include "emalloc.h" #ifdef HAVE_DMALLOC #include #endif symptr_QUEUE IDlist = EMPTYQUEUE(IDlist); symptr_QUEUE *lastNullInIDlist = &IDlist; Int *autocalc; #ifdef DEBUG #define DEBUGPRINT(X,Y) if (Debug&1) { fprintf(stderr, X, Y); } #else #define DEBUGPRINT(X,Y) #endif #ifdef DEBUG void printlist(symptr_QUEUE * Q) { /* INTERNAL: PRINT A DEPENDENCY LIST */ /* USED FOR DEBUGGING ONLY */ register symptr_ATOM P; FOREACH(P, Q) fprintf(stderr, " %s", P->obj ? P->obj->name : "*"); printf("\n"); } #endif /* DEBUG */ void addID(symptr id) { /* INTERNAL: ADD AN IDENTIFIER USED BY PARSER */ /* Original code here was: if (!id || !IN_symptr_Q(&IDlist, id)) APPEND_symptr_Q(&IDlist, id); When all the macros are expanded, this looks like: if (!id || !SEARCH_symptr(&IDlist, id, 1)) { symptr_ATOM A; A = emalloc(sizeof(*A)); A->obj = NEW_symptr(id); ((A)->prev=((A)->next=(&IDlist))->prev)->next=(A); (&IDlist)->prev=(A); } ... which implements the following: append the id to the IDlist, unless it is non-zero and we already have an occurrance of it in the list. (Ie we can have multiple nulls within the list, but no multiple occurrances of actual ids). Notice the OR used in the if, not an AND: id==0, idinQ -> T || F -> T (append) id==0, !idinQ -> T || T -> T (append) id!=0, idinQ -> F || F -> F (don't append) id!=0, !idinQ -> F || T -> T (append) ('clever' but highly confusing code as it is searching for one significant case which might be better done using an AND). This 'clever' coding is unfortunately incorrect. addID / IDlist is actually used by the parser to maintain lists of identifiers for three separate purposes: within 'is' formulae definitions, within proc/func/procmacro action definitions, and within ~> related_by definitions. It appears (as the code documentation is lacking) that the removal of multiple occurrances of ids is intended to stop multiple triggering (eg proc p : a, a... or p is a+a leading to [a,a] triggers). However, we are now discovering that these three purposes are not separate: when an 'is' formula redefinition is made within a triggered action, the removal of multiple occurrances of ids can cause a problem. What I believe this function should really implement is a queue of ids which are unique between nulls. Eg b * a b * b is allowed, but b * a b b * b is not. [Ash] */ if (id == (symptr)0) { /* A null (list terminator): add it */ APPEND_symptr_Q(&IDlist, id); lastNullInIDlist = LAST(&IDlist); DEBUGPRINT("addID: id=* ", 0); } else { /* An id: add it only if it is unique since the last null */ symptr_QUEUE *P; int n = 0; P = FRONT(lastNullInIDlist); while (P && ((P->obj) != (symptr)0) && (P != &IDlist)) { if (EQUAL_symptr(id, P->obj)) n++; P = NEXT(lastNullInIDlist, P); } if (n < 1) { /* This is an id which we haven't seen since the last null */ APPEND_symptr_Q(&IDlist, id); DEBUGPRINT("addID: id=%s ", id->name); #ifdef DEBUG } else { /* We've seen this id more than once */ DEBUGPRINT("addID: not adding id=%s ", id->name); #endif } } #ifdef DEBUG if (Debug&1) { fprintf(stderr, "IDlist now"); printlist(&IDlist); } #endif } void clear_IDlist(void) { CLEAR_symptr_Q(&IDlist); lastNullInIDlist = &IDlist; } /* save_IDlist: this seems to work through the items added by addID to IDlist, saving them in newly malloc'd memory (well, the first item is newly malloc'd), re-linking them as we go, stopping when we find a queued item whose obj is null. A pointer to the new queue is returned. This is used by functions in code.c which code redefinitions (is formulae and proc/func/procmacro actions) and the related_by operator ~>. [Ash] */ symptr_QUEUE * save_IDlist(void) { register symptr_ATOM A; register symptr_QUEUE *P, *Q; P = &IDlist; Q = (symptr_QUEUE *) emalloc(sizeof(symptr_QUEUE)); CLEAN_Q(Q); while ((A = LAST(P))) { DELETE_ATOM(P, A); if (A->obj == (symptr) 0) { DESTROY_symptr_ATOM(A); break; } INSERT_Q(Q, A); } lastNullInIDlist = &IDlist; return Q; } /* refer_to(): pass this a symbol and its sources. This seems to update information in sp and the Q with the information that sp has Q has its sources. [Ash] */ void refer_to(symptr sp, symptr_QUEUE * Q) { /* INTERNAL: APPEND SYMBOL TO SOURCES */ register symptr_ATOM Symbol; register symptr_QUEUE *SourceTargets, *Sources; /* I don't understand this code at all well, so my explanatory comments may be totally wrong :( [Ash] */ #ifdef DEBUG if (Debug&1) { fprintf(stderr, "refer_to: sp=%s, Q=", sp->name); printlist(Q); } #endif /* Find the symbol's existing list of sources */ Sources = &sp->sources; /* Remove any existing target pointers to this symbol */ FOREACH(Symbol, Sources) { SourceTargets = &Symbol->obj->targets; DELETE_FIRST_symptr(SourceTargets, sp); } /* Now remove any existing list of sources from this symbol */ CLEAR_symptr_Q(Sources); /* Add the sources passed here (Q) as a parameter to this symbol (sp) */ FOREACH(Symbol, Q) { APPEND_symptr_Q(Sources, Symbol->obj); } /* Make the target pointers of the sources passed here (Q) point to this symbol (sp) */ FOREACH(Symbol, Sources) { SourceTargets = &Symbol->obj->targets; APPEND_symptr_Q(SourceTargets, sp); } } void refer_by(symptr sp, symptr_QUEUE * Q) { /* INTERNAL: APPEND SYMBOL TO TARGETS */ register symptr id; register symptr_ATOM Symbol; register symptr_QUEUE *Targets, *Sources; FOREACH(Symbol, Q) { id = Symbol->obj; Sources = &id->sources; DELETE_FIRST_symptr(Sources, sp); APPEND_symptr_Q(Sources, sp); Targets = &sp->targets; DELETE_FIRST_symptr(Targets, id); APPEND_symptr_Q(Targets, id); } } /* checkok1 is used by checkok below [Ash] */ int checkok1(symptr sp, symptr_QUEUE * Q) { /* INTERNAL: IF SYMBOL IN THE LIST ? */ /* TRUE = 1 = NOT IN THE LIST */ /* FALSE = 0 = ALREADY EXISTED */ register symptr id; register symptr_ATOM P; FOREACH(P, Q) { id = P->obj; if (id->marked) continue; id->marked = 1; if (id == sp) return FALSE; if (!checkok1(sp, &id->sources)) return FALSE; } return TRUE; } /* checkok2 is used by checkok below [Ash] */ int checkok2(symptr sp, symptr_QUEUE * Q) { /* INTERNAL: IF SYMBOL IN THE LIST ? */ /* TRUE = 1 = NOT IN THE LIST */ /* FALSE = 0 = ALREADY EXISTED */ register symptr id; register symptr_ATOM P; FOREACH(P, Q) { id = P->obj; if (!id->marked) continue; id->marked = 0; if (id == sp) return FALSE; if (!checkok2(sp, &id->sources)) return FALSE; } return TRUE; } /* checkok() checks for an attempt to introduce a cyclic definition. It checks that the sp (the symbol we are about to introduce) is not referenced by any items in Q (the sources of the symbol we are about to introduce), or any of Q's sources. Looks like it uses a kind of mark/sweep algorithm: mark each object as we look at it. If we've seen it before, ignore it, else check it and all its sources for equality with sp. When we've found a result one way or the other, do the search again, removing the marks we made along the way. [Ash] */ int checkok(symptr sp, symptr_QUEUE * Q) { /* INTERNAL: IF SYMBOL IN THE LIST ? */ /* TRUE = 1 = NOT IN THE LIST */ /* FALSE = 0 = ALREADY EXISTED */ int result = checkok1(sp, Q); checkok2(sp, Q); /* clear the markings by checkok1() */ return result; } /* ready() is used during evaluation. It checks the sources of a symbol to see if they are marked as having been changed (in which case the symbol cannot be evaluated yet). [Ash] */ int ready(symptr sp) { /* INTERNAL: CHECK CHILDREN OF SYMBOL */ /* TRUE = ALL CHILDREN ARE UP-TO-DATE */ register symptr_ATOM P; register symptr_QUEUE *Q; Q = &sp->sources; FOREACH(P, Q) { if (P->obj->changed) return FALSE; } return TRUE; } tkeden1.41/Eden/runset.c010060000025250000164000000032150740377271100151620ustar00ashleyem00003510000005/* * $Id: runset.c,v 1.9 2001/12/06 22:48:41 cssbz Exp $ */ static char rcsid[] = "$Id: runset.c,v 1.9 2001/12/06 22:48:41 cssbz Exp $"; #include #include #include "../config.h" #include "runset.h" #include "eden.h" #include "emalloc.h" #ifdef HAVE_DMALLOC #include #endif void initRunSet(RunSet * rs) { rs->nitems = 0; rs->head = rs->tail = (Action *) emalloc(sizeof(Action)); rs->tail->s = 0; rs->tail->master = 0; rs->tail->next = 0; } void clearRunSet(RunSet * rs) { while (rs->nitems) rmAction(rs); } Action getAction(RunSet * rs) { Action *ptr = rs->head->next; Action a; a.s = ptr->s; a.master = ptr->master; rs->head->next = rs->head->next->next; free(ptr); rs->nitems--; if (rs->nitems == 0) rs->tail = rs->head; return a; } void rmAction(RunSet * rs) { Action *ptr = rs->head->next; free(ptr->s); rs->head->next = rs->head->next->next; free(ptr); rs->nitems--; if (rs->nitems == 0) rs->tail = rs->head; } void addAction(RunSet * rs, char *s, char *master) { rs->tail->next = (Action *) malloc(sizeof(Action)); rs->tail = rs->tail->next; rs->tail->s = strdup(s); rs->tail->master = master; rs->tail->next = 0; rs->nitems++; } #ifdef DEBUG /* for debugging purpose */ #include void printRunSet(RunSet * rs) { Action *ptr; int n = 0; if (rs->nitems == 0) { fprintf(stderr, "** printRunSet: no items in RS\n"); } else { for (ptr = rs->head->next; ptr; ptr = ptr->next) { fprintf(stderr, "** printRunSet: %d: %s\n", ++n, ptr->s); } } } #endif tkeden1.41/Eden/runset.h010060000025250000164000000011010701434525000151470ustar00ashleyem00003510000005/* * $Id: runset.h,v 1.4 1999/11/16 21:20:40 ashley Rel1.10 $ */ typedef struct Action { char *s; char *master; struct Action *next; } Action; typedef struct RunSet { int nitems; struct Action *head; struct Action *tail; } RunSet; extern void initRunSet(RunSet *); extern void clearRunSet(RunSet *); extern Action getAction(RunSet *); extern void rmAction(RunSet *); extern void addAction(RunSet *, char *, char *); #ifdef DEBUG extern void printRunSet(RunSet *); #endif extern void queue(char *, char *); tkeden1.41/Eden/screen.q.c010060000025250000164000000016660733032527300153640ustar00ashleyem00003510000005/* * $Id: screen.q.c,v 1.6 2001/07/27 17:54:03 cssbz Exp $ */ static char rcsid2[] = "$Id: screen.q.c,v 1.6 2001/07/27 17:54:03 cssbz Exp $"; void init_ScoutScreenList(void) { CLEAN_Q(&ScoutScreenList); } ScoutScreen_ATOM search_ScoutScreenQ(char *name) { ScoutScreen_ATOM A; FOREACH(A, &ScoutScreenList) { if (A->obj.name == (char *) 0) break; if (streq(A->obj.name, name)) /* match */ return A; } return (ScoutScreen_ATOM) 0; } ScoutScreen_ATOM add_ScoutScreen(char *name) { ScoutScreen E; ScoutScreen_ATOM F; makearr(0); /* used to make a null datum --sun */ F = FRONT(&ScoutScreenList); E.name = emalloc(strlen(name) + 1); strcpy(E.name, name); E.oScreen = newdatum(pop()); E.oWinInfo = 0; E.MaxRef = 1; E.Refer = (intQ *) emalloc(sizeof(intQ)); CLEAN_Q(E.Refer); INSERT_ScoutScreen_Q(&ScoutScreenList, E); return FRONT(&ScoutScreenList); } tkeden1.41/Eden/screen.q.h010060000025250000164000000014350733032532500153610ustar00ashleyem00003510000005/* * $Id: screen.q.h,v 1.3 2001/07/27 17:54:29 cssbz Exp $ */ #include "global.q.h" typedef struct intQ { struct intQ *prev; struct intQ *next; int obj; } intQ; typedef struct { int ref; int nbox; } winfo; typedef struct ScoutScreen { char *name; Datum oScreen; winfo *oWinInfo; int MaxRef; intQ *Refer; } ScoutScreen; typedef struct ScoutScreenQ { struct ScoutScreenQ *prev; struct ScoutScreenQ *next; ScoutScreen obj; } ScoutScreenQ; typedef ScoutScreenQ *ScoutScreen_ATOM; #ifndef NEW_ScoutScreen #define NEW_ScoutScreen(OBJ) OBJ #endif #define INSERT_ScoutScreen_Q(Q,OBJ) \ { \ ScoutScreen_ATOM A; \ ALLOC_ATOM(A); \ A->obj = NEW_ScoutScreen(OBJ); \ INSERT_Q(Q,A); \ } tkeden1.41/Eden/symbol.c010060000025250000164000000206740733032552500151530ustar00ashleyem00003510000005/* * $Id: symbol.c,v 1.11 2001/07/27 17:56:37 cssbz Exp $ */ static char rcsid[] = "$Id: symbol.c,v 1.11 2001/07/27 17:56:37 cssbz Exp $"; /* * SYMBOL TABLE: INSTALL AND LOOK-UP * */ #include #include #include "../config.h" #include "eden.h" #include "yacc.h" #include "symptr.q.c" /* some of the code is used by other modules */ #include "hash.h" #include "notation.h" #ifdef DISTRIB #include "agency.q.c" #endif /* DISTRIB */ #include "emalloc.h" #ifdef HAVE_DMALLOC #include #endif #ifdef DISTRIB void add_agent_Q(agent_QUEUE *, char *); agent_ATOM search_agent_Q(agent_QUEUE *, char *); void delete_agent_Q(agent_QUEUE *, char *, char *); #endif /* DISTRIB */ /*-------------------------------------------------------------------- SYMBOL HASH TABLE --------------------------------------------------------------------*/ /* HASHSIZE is defined in "hash.h": must be power of 2 minus 1 */ int hashindex(char *s) { int i = 0; while (*s) i ^= *s++; return i & HASHSIZE; } symptr hashtable[HASHSIZE + 1] = {(symptr) 0}; /* init to nulls */ symptr lookup(char *s) { /* FIND SYMBOL OF NAME S */ /* 0 = NOT FOUND, ELSE = SYMBOL POINTER */ symptr sp; for (sp = hashtable[hashindex(s)]; sp != (symptr) 0; sp = sp->next) if (strcmp(sp->name, s) == 0) return sp; return 0; /* 0 ==> not found */ } symptr install(char *s, int st, int t, int i) /* INTERNAL: INSTALL A SYMBOL IN SYMBOL TABLE */ /* s = symbol name */ /* st = symbol type */ /* t = initial data type */ /* i = initial data value */ { extern symptr hashtable[]; int indx; symptr sp; extern topEntryStack(void); extern char *topMasterStack(void); extern char agentName[128]; extern notationType currentNotation; extern int builtin_ft_check(char *); extern int append_agentName; extern int append_NoAgentName; #ifdef DISTRIB extern Int *EveryOneAllowed; extern char *everyone; #endif /* DISTRIB */ sp = (symptr) emalloc(sizeof(symbol)); sp->name = emalloc(strlen(s) + 1); /* +1 for '\0' */ strcpy(sp->name, s); sp->stype = st; sp->inst = (Inst *) 0; sp->nauto = 0; sp->changed = TRUE; sp->text = (char *) 0; sp->d.type = t; if (t == UNDEF) { sp->d.u.sym = sp; /* put a reference to the symbol in the UNDEF Datum so that name details etc can be found in the event of an error (in eval(), say) [Ash] */ } else { sp->d.u.i = i; } CLEAN_Q(&sp->targets); CLEAN_Q(&sp->sources); #ifdef DISTRIB CLEAN_Q(&sp->OracleOf); CLEAN_Q(&sp->HandleOf); CLEAN_Q(&sp->StateOf); /* if (*agentName!=0 && builtin_ft_check(s) ==0 && currentNotation != LSD && append_NoAgentName > 0 && append_agentName > 0 ) { add_agent_Q(&sp->HandleOf, agentName); add_agent_Q(&sp->OracleOf, agentName); } depends on design decision. if agent owns default rights? --sun */ /*add_agent_Q(&sp->HandleOf, "wmb"); delete_agent_Q(&sp->HandleOf, "sun"); add_agent_Q(&sp->HandleOf, "wmb"); -- for test */ #endif /* DISTRIB */ sp->Qloc = 0; sp->marked = 0; sp->entry = topEntryStack(); sp->master = topMasterStack(); #ifdef DISTRIB if (streq(sp->name, "EveryOneAllowed") || *EveryOneAllowed) { if (streq(topMasterStack(), "system") && !streq(sp->name, "screen") && !streq(sp->name, "DoNaLDdefaultWin") && !streq(sp->name, "DoNaLD")) { add_agent_Q(&sp->HandleOf, "SYSTEM"); add_agent_Q(&sp->OracleOf, "SYSTEM"); add_agent_Q(&sp->StateOf, "SYSTEM"); } else { add_agent_Q(&sp->HandleOf, everyone); add_agent_Q(&sp->OracleOf, everyone); add_agent_Q(&sp->StateOf, everyone); } } #endif /* DISTRIB */ sp->next = hashtable[indx = hashindex(s)]; /* put at front of list */ hashtable[indx] = sp; return sp; } #ifdef DISTRIB /* Add a new global variable to the symbol table, with an initially undefined value. This is needed so that other modules (ie LSD) don't need to know the value of UNDEF (#including yacc.h leads to conflicts with YYSTYPE). [by Ash] */ symptr installGlobalUndef(char *name) { return install(name, VAR, UNDEF, 0); } void add_agent_Q(agent_QUEUE * AQ, char *name) { agent_ATOM AA; extern char *everyone; if(AA = search_agent_Q(AQ, everyone)) DELETE_agent_ATOM(AQ, AA); if (!(AA = search_agent_Q(AQ, name))) { AA = emalloc(sizeof(agent_QUEUE)); AA->obj.name = emalloc(strlen(name)+1); strcpy(AA->obj.name, name); AA->prev = (agent_QUEUE *) 0; AA->next = (agent_QUEUE *) 0; INSERT_Q(AQ, AA); } } agent_ATOM search_agent_Q(agent_QUEUE * AQ, char *name) { agent_ATOM Q; FOREACH(Q, AQ) { if (Q->obj.name == (char *) 0) break; if (streq(Q->obj.name, name)) return Q ; } return (agent_ATOM) 0; } void delete_agent_Q(agent_QUEUE * AQ, char *name, char *ObsName) { agent_ATOM Q; symptr sp; extern char *everyone; Q=search_agent_Q(AQ, name); if (Q) DELETE_agent_ATOM(AQ, Q); if (sp = lookup(ObsName)) { if (Q_EMPTY(AQ) && search_agent_Q(&sp->StateOf, everyone)) add_agent_Q(AQ, everyone); } } #endif /* DISTRIB */ /*-------------------------------------------------------------------- LOCAL VARIABLE LOOK UP --------------------------------------------------------------------*/ struct entry { char *name; short level; short num; }; typedef struct entry entry; #define streq(X,Y) (strcmp(X,Y)==0) #define EQUAL_entry(A,B) streq(A.name,B.name) #define FREE_entry(A) if(A.name)free(A.name) #include "entry.q.c" static entry_QUEUE LocalVarList = EMPTYQUEUE(LocalVarList); /* * look up the position of local variable * 0 = not in LocalVarList */ entry_ATOM search_local(char *name) { entry_ATOM A; FOREACH(A, &LocalVarList) { if (A->obj.name == (char *) 0) break; /* printf("search %s %s %i %i\n", A->obj.name, name, A->obj.level, A->obj.num); */ if (streq(A->obj.name, name)) /* match */ return A; } return (entry_ATOM) 0; } /* * add a local variable to the list * return the entry of the list */ entry_ATOM add_local_variable(char *name) { entry_ATOM E; entry_ATOM F; F = FRONT(&LocalVarList); E = emalloc(sizeof(entry_QUEUE)); E->obj.name = emalloc(strlen(name) + 1); strcpy(E->obj.name, name); E->obj.level = indef; if (inpara) { E->obj.num = F->obj.num - 1; } else { /* inauto */ if (F->obj.num < 0) E->obj.num = 1; else E->obj.num = F->obj.num + 1; } E->prev = (entry_QUEUE *) 0; E->next = (entry_QUEUE *) 0; INSERT_Q(&LocalVarList, E); return FRONT(&LocalVarList); } /* * insert a level marker */ void insert_level_marker(int level) { entry E; E.name = (char *) 0; E.level = level; E.num = 0; INSERT_entry_Q(&LocalVarList, E); } /* * initialist the LocalVarList */ void init_LocalVarList(void) { CLEAN_Q(&LocalVarList); insert_level_marker(0); } /* delete all entry not smaller than the level */ void delete_local_level(int level) { entry_ATOM E; entry_QUEUE *Q = &LocalVarList; for (E = FRONT(Q); E->obj.level >= level; E = FRONT(Q)) DELETE_FRONT_entry(Q); } void printlocal(void) { entry_ATOM E; FOREACH(E, &LocalVarList) printf("%s %d %d\n", E->obj.name ? E->obj.name : "*", E->obj.level, E->obj.num); } int local_declare(char *name) { entry_ATOM E; if (search_local(name)) error2("redeclare local variable:", name); E = add_local_variable(name); return E->obj.num; } int lookup_local(char *name) { entry_ATOM E; if ((E = search_local(name))) { if (E->obj.level != indef) error2("local variable is not in this level:", name); return E->obj.num; } else return 0; } symptr_QUEUE break_q = EMPTYQUEUE(break_q); symptr_QUEUE cont_q = EMPTYQUEUE(cont_q); void dispatch(Inst * p, symptr_QUEUE * Q) { APPEND_symptr_Q(Q, (symptr) p); } void patch(Inst * mark, Inst * p, symptr_QUEUE * Q) { symptr_ATOM A; Inst *ip; while ((A = LAST(Q))) { ip = (Inst *) A->obj; DELETE_symptr_ATOM(Q, A); if (ip == mark) return; ip[1] = (Inst) (p - (ip + 2)); } /* should not get here */ error("compiler error while patching code"); } { if (streq(topMasterStack(), "system") && !streq(sp->name, "tkeden1.41/Eden/symptr.q.c010060000025250000164000000022510733032557400154360ustar00ashleyem00003510000005/* * $Id: symptr.q.c,v 1.8 2001/07/27 17:57:16 cssbz Exp $ */ static char rcsid3[] = "$Id: symptr.q.c,v 1.8 2001/07/27 17:57:16 cssbz Exp $"; #include "../config.h" #include "symptr.q.h" /* This function has highly concealed semantics. Note particularly the &&: the expression with side-effect on the RHS will only be executed if the LHS is true. The function appears to iterate through the given queue until the nth occurrance of obj, then returns a new queue pointer to that point. [Ash] */ /* return the position of the n-th object in a symptr queue [sy or edward] */ symptr_QUEUE * SEARCH_symptr(symptr_QUEUE * Q, symptr obj, int n) { symptr_QUEUE *P; FOREACH(P, Q) { if (EQUAL_symptr(obj, P->obj) && !--n) return P; } return (symptr_QUEUE *) 0; /* NOT FOUND */ } void DELETE_symptr_ATOM(symptr_QUEUE * Q, symptr_ATOM A) { if (A && A != Q) { A->prev->next = A->next; A->next->prev = A->prev; DESTROY_symptr_ATOM(A); } } void MOVE_symptr_Q(symptr_QUEUE * Qsrc, symptr_QUEUE * Qdst) { if (!Q_EMPTY(Qsrc)) { (Qdst->prev->next = Qsrc->next)->prev = Qdst->prev; (Qsrc->prev->next = Qdst)->prev = Qsrc->prev; CLEAN_Q(Qsrc); } } tkeden1.41/Eden/symptr.q.h010060000025250000164000000026340733032562600154460ustar00ashleyem00003510000005/* * $Id: symptr.q.h,v 1.5 2001/07/27 17:57:42 cssbz Exp $ */ #include "global.q.h" #ifndef _SYMPTR_Q_H struct symptr_queue { struct symptr_queue *prev; struct symptr_queue *next; symptr obj; }; typedef struct symptr_queue symptr_QUEUE; typedef symptr_QUEUE *symptr_ATOM; extern symptr_QUEUE *SEARCH_symptr(symptr_QUEUE *, symptr, int); extern void DELETE_symptr_ATOM(symptr_QUEUE *, symptr_ATOM); #ifndef NEW_symptr #define NEW_symptr(OBJ) OBJ #endif #ifndef FREE_symptr #define FREE_symptr(OBJ) /* do nothing */ #endif #ifndef EQUAL_symptr #define EQUAL_symptr(A,B) ((A)==(B)) #endif #define DESTROY_symptr_ATOM(A) \ { \ FREE_symptr((A)->obj); \ free(A); \ } #define DELETE_NTH_symptr(Q,OBJ,n) DELETE_symptr_ATOM(Q,SEARCH_symptr(Q,OBJ,n)) #define DELETE_FIRST_symptr(Q,OBJ) DELETE_symptr_ATOM(Q,SEARCH_symptr(Q,OBJ,1)) #define DELETE_FRONT_symptr(Q) DELETE_symptr_ATOM(Q,FRONT(Q)) #define DELETE_LAST_symptr(Q) DELETE_symptr_ATOM(Q,LAST(Q)) #define CLEAR_symptr_Q(Q) \ while (!Q_EMPTY(Q)) DELETE_symptr_ATOM(Q,(Q)->next) #define APPEND_symptr_Q(Q,OBJ) \ { \ symptr_ATOM A; \ ALLOC_ATOM(A); \ A->obj = NEW_symptr(OBJ); \ APPEND_Q(Q,A); \ } #define CONCAT_symptr_Q(Qdst, Qsrc) \ { \ symptr_QUEUE *P; \ FOREACH (P, Qsrc) APPEND_symptr_Q(Qdst, P->obj); \ } /* This finds the first occurrance of OBJ in Q [Ash] */ #define IN_symptr_Q(Q,OBJ) SEARCH_symptr(Q,OBJ,1) #define _SYMPTR_Q_H #endif tkeden1.41/Eden/trans.c010060000025250000164000000112040743720707000147640ustar00ashleyem00003510000005/* * $Id: trans.c,v 1.9 2002/02/27 16:50:00 cssbz Exp $ */ /* trans.c - functions to incorporate the configurable translator into tkeden Chris Brown, 2000 */ #include #include #ifndef TTYEDEN #include #endif #include "eden.h" /* notation is just a name, a starting agent name and a next pointer */ typedef struct _notdef * notptr; typedef struct _notdef { char * name; char * agent_name; notptr next; } notdef; /* list of installed notations */ notptr notlist = (notptr) 0; /* currently selected notation */ notptr currentnot = (notptr) 0; /* did the translator successfully initialise? */ int active = 0; void init_notations (); notptr lookupnot (char *); int installnot (char *, char *); int setcurrentnot (char *); void getnotcomment (char **); void not_readchar (int); extern int run (short, void *, char *); /* called from main.c */ void init_notations () { FILE *initFile; char *name = "/trans.eden"; char fullname [255]; extern char *libLocation; /* If libLocation is not set, silently return and don't activate the translator [Ash] */ if (!libLocation) return; /* initialise all global variables */ currentnot = (notptr) 0; notlist = (notptr) 0; active = 0; /* get the location of trans.e containing the translator EDEN code */ strcpy(fullname, libLocation); strcat(fullname, name); if ((initFile = fopen(fullname, "r")) == 0) return; /* run trans.e */ run(FILE_DEV, initFile, name); /* if the file was there, activate the translator */ active = 1; } /* lookupnot returns: a notations from the list with name s or 0 if not found */ notptr lookupnot (char *s) { notptr np; for (np = notlist; np != (notptr) 0; np = np->next) { /* Compare s with each name in the notlist. Use the length of the name in the notlist + 1 to compare with the complete name, including the \0 at the end. [Ash] */ if (strncmp(np->name, s, strlen(np->name)+1) == 0) return np; } return (notptr) 0; } /* install_not installs a notation and returns how successful it was called from built-in function "notation" from builtin.c */ int installnot (char * name, char * agent_name) { notptr np; #ifndef TTYEDEN extern Tcl_Interp *interp; Tcl_DString tclCommand; #endif np = (notptr) emalloc (sizeof (notptr)); if (np == (notptr) 0) return 0; np->name = emalloc (strlen (name) + 1); /* +1 for '\0' */ strcpy (np->name, name); np->agent_name = emalloc (strlen (agent_name) + 1); strcpy (np->agent_name, agent_name); np->next = notlist; /* put at front of list */ notlist = np; #ifndef TTYEDEN /* Add a new radiobutton for this new notation on the interface [Ash] */ Tcl_DStringInit(&tclCommand); Tcl_DStringAppend(&tclCommand, "addNotationRadioButton ", -1); Tcl_DStringAppend(&tclCommand, name, -1); Tcl_GlobalEvalEC(interp, tclCommand.string); Tcl_DStringFree(&tclCommand); #endif /* not TTYEDEN */ return 1; } /* setcurrentnot given a string like "%eddi", check if such a notation is installed if so, switch to it and return 1. otherwise return 0 called from the read_hash_comment function in lex.c */ int setcurrentnot (char * name) { notptr np; char execstr [100]; /* not allowed to translate */ if (!active) return 0; /* not a notation-change command */ if (name [0] != '%') return 0; np = lookupnot (name + 1); /* if such a notation exists, make it the current one and empty the execution buffer */ if (np != 0) { run (STRING_DEV, "flush_parser ();", 0); sprintf (execstr, "setup_parser (\"%s\");", np->agent_name); run (STRING_DEV, execstr, 0); currentnot = np; return 1; } /* not a notation name or no such notation */ return 0; } /* getnotcomment get a string of the form "%eddi" but for the current language called from EX/parser.c */ void getnotcomment (char ** comment) { *comment = (char *) 0; if (currentnot != (notptr) 0) { *comment = emalloc (strlen (currentnot->name) + 3); strcpy (*comment, "%"); strcat (*comment, currentnot->name); } } /* not_readchar interpret a character of a custom notation */ void not_readchar (int c) { /* create execute string */ char execstr [20]; if (c == '\'') strcpy(execstr, "parsechar ('\\\'');"); else if (c == '\\') strcpy(execstr, "parsechar ('\\\\');"); else sprintf(execstr, "parsechar ('%c');", c); /* execute it */ run (STRING_DEV, execstr, 0); } tkeden1.41/Eden/type.c010060000025250000164000000157370740377305600146420ustar00ashleyem00003510000005/* * $Id: type.c,v 1.19 2001/12/06 22:50:22 cssbz Exp $ */ static char rcsid[] = "$Id: type.c,v 1.19 2001/12/06 22:50:22 cssbz Exp $"; /*** * TYPE CONVERSION FUNCTIONS * ***/ #include #include #include "../config.h" #include "eden.h" #include "builtin.h" #include "yacc.h" #include "emalloc.h" #ifdef HAVE_DMALLOC #include #endif void t_str1(Datum); extern Datum newhdat(Datum); static struct { short type; char *name; } datatype[] = { { UNDEF, "@" }, { REAL, "float" }, { INTEGER, "int" }, { MYCHAR, "char" }, { STRING, "string" }, { LIST, "list" }, { FORMULA, "formula" }, { FUNCTION, "func" }, { PROCEDURE, "proc" }, { PROCMACRO, "procmacro" }, { BLTIN, "builtin" }, { LIB, "C-func" }, { RLIB, "Real-func" }, { VAR, "var" }, { 0, "???" } }; Datum ctos(Datum d) { /* convert char to string */ if (ischar(d)) { /* only if Datum is char */ char *s; s = (char *) getheap(2);/* put the string on heap */ *s = d.u.i; s[1] = '\0'; d.u.s = s; d.type = STRING; } if (!isstr(d)) error("string needed"); return d; } int typeno(char *typename) { int i; for (i = 0; datatype[i].type; i++) { if (strcmp(typename, datatype[i].name) == 0) break; } if (datatype[i].type == 0) error("unknown data type"); return datatype[i].type; } char * typename(int type) { int i; for (i = 0; datatype[i].type; i++) { if (type == datatype[i].type) break; } return datatype[i].name; } /* type(data): type of datum in the form of a string */ void t_type(void) { /* data type name */ Datum d; short type; int i; if (paracount == 0) usage("s = type(expr);"); type = para(1).type; if (type & ADDRESSMASK) { dpush(d, STRING, "pointer"); } else { for (i = 0; datatype[i].type; i++) { if (type == datatype[i].type) break; } dpush(d, STRING, datatype[i].name); } } /* int(data): convert datum to an integer */ void t_int(void) { Datum d; if (paracount == 0) usage("i = int(expr);"); d = para(1); if (is_symbol(d)) { d.u.i = d.u.v.x; } else { switch (d.type) { case REAL: d.u.i = d.u.r; case INTEGER: case MYCHAR: break; case STRING: d.u.i = atoi(d.u.s); break; default: pushUNDEF(); /* return @ */ return; } } d.type = INTEGER; push(d); } /* float(data): builtin function convert datum to an integer */ void t_float(void) { Datum d; if (paracount == 0) usage("f = float(expr);"); d = para(1); if (is_symbol(d)) { d.u.r = d.u.v.x; } else { switch (d.type) { case INTEGER: case MYCHAR: d.u.r = d.u.i; case REAL: break; case STRING: d.u.r = atof(d.u.s); break; default: pushUNDEF(); /* return @ */ return; } } d.type = REAL; push(d); } /* char(datum): builtin function convert datum to a character */ void t_char(void) { /* convert to char */ Datum d; if (paracount == 0) usage("c = char(expr);"); d = para(1); switch (d.type) { case REAL: d.u.i = d.u.r; case INTEGER: case MYCHAR: break; case STRING: /* the 1st char of string */ d.u.i = *d.u.s & 0377; /* '\0' if s == "" */ break; default: pushUNDEF(); /* return @ */ return; } d.type = MYCHAR; push(d); } /* str(datum): builtin function convert datum to a string */ void t_str(void) { Datum d; if (paracount == 0) usage("c = str(expr);"); d = para(1); t_str1(d); } /* separating t_str to two subs. the latter can be used by other programs --sun */ void t_str1(Datum d) { /* Static buffer, used for type conversions likely to result in a small resulting string [Ash] */ char buf[1024]; /* Dynamic buffer, used when creating a string from a list [Ash] */ char *dynbuf; int dynbuflen; /* dynamic buffer length [Ash] */ int i; int type; Datum d1; if (is_symbol(d)) { sprintf(buf, "&%s", symbol_of(d)->name); } else if (is_local(d)) { sprintf(buf, "%d", d.u.v.x); } else { switch (d.type) { case STRING: push(d); return; case LIST: /* Patrick added a list -> string conversion function [Ash] */ /* All of the code in this file is similar to the print() function in builtin.c, which performs the task for writeln() and so on. However, print does not need to store the result anywhere, simply write it out. [Ash] */ /* Initial size and allocation units of dynbuf [Ash] */ #define STR_DYNBUF_LEN_UNITS 1028 dynbuf = (char *) emalloc(STR_DYNBUF_LEN_UNITS); dynbuflen = STR_DYNBUF_LEN_UNITS; *dynbuf=0; strcat(dynbuf, "["); /* For each item in the list... [Ash] */ for (i = 1; i <= d.u.a[0].u.i; i++) { type = d.u.a[i].type; /* remember the type for later use [Ash] */ t_str1(d.u.a[i]); /* Convert that item to a string [Ash] */ d1 = pop(); /* If dynbuf is not big enough, expand it [Ash] */ if (strlen(dynbuf) > (dynbuflen - 10)) { dynbuflen += STR_DYNBUF_LEN_UNITS; dynbuf = erealloc(dynbuf, dynbuflen); } if (type == STRING) { /* Strings in lists come out with double quote separators [Ash] */ strcat(dynbuf, "\""); strcat(dynbuf, d1.u.s); strcat(dynbuf, "\""); } else if (type == MYCHAR) { /* Chars in lists come out with single quote separators [Ash] */ strcat(dynbuf, "\'"); strcat(dynbuf, d1.u.s); strcat(dynbuf, "\'"); } else { strcat(dynbuf, d1.u.s); } if (i < d.u.a[0].u.i) strcat(dynbuf, ","); } strcat(dynbuf, "]"); d.type = STRING; d.u.s = dynbuf; d = newhdat(d); /* copy it to the heap */ push(d); free(dynbuf); return; case UNDEF: buf[0] = '@'; buf[1] = '\0'; break; case REAL: sprintf(buf, "%f", d.u.r); break; case INTEGER: sprintf(buf, "%d", d.u.i); break; case MYCHAR: buf[0] = d.u.i; buf[1] = '\0'; break; default: pushUNDEF(); /* return @ */ return; } } d.type = STRING; d.u.s = buf; d = newhdat(d); /* copy it to the heap */ push(d); } /*---- _type_convert(datum, typename): builtin function convert datum to type specified by typename. ! ! ! DANGER --- MAY CAUSE CLASH IF NOT CAREFUL ! ! ! no type checking. no memory allocation. extremely dangerous to convert into string or list. ----*/ void t_super(void) { /* super type convertion */ Datum d; Datum t; char *s; int i; extern void muststr(Datum); if (paracount < 2) usage("data = _type_convert(data, \"type\");"); d = para(1); t = para(2); muststr(t); s = t.u.s; for (i = 0; datatype[i].type; i++) { if (strcmp(s, datatype[i].name) == 0) break; } d.type = datatype[i].type; push(d); } include #endif void tkeden1.41/Eden/yacc.c010060000025250000164000002407030745661043600145710ustar00ashleyem00003510000005 /* A Bison parser, made from yacc.y by GNU Bison version 1.28 */ #define YYBISON 1 /* Identify Bison output. */ #define UNDEF 257 #define REAL 258 #define INTEGER 259 #define MYCHAR 260 #define STRING 261 #define LIST 262 #define CONSTANT 263 #define VAR 264 #define FORMULA 265 #define BLTIN 266 #define LIB 267 #define RLIB 268 #define FUNC 269 #define PROC 270 #define PMAC 271 #define FUNCTION 272 #define PROCEDURE 273 #define PROCMACRO 274 #define AUTO 275 #define PARA 276 #define LOCAL 277 #define BREAK 278 #define CONTINUE 279 #define SWITCH 280 #define CASE 281 #define DEFAULT 282 #define DO 283 #define FOR 284 #define WHILE 285 #define IF 286 #define ELSE 287 #define SHIFT 288 #define APPEND 289 #define INSERT 290 #define DELETE 291 #define RETURN 292 #define ARG 293 #define IS 294 #define TILDE_GT 295 #define PLUS_EQ 296 #define MINUS_EQ 297 #define OR 298 #define LAZY_OR 299 #define AND 300 #define LAZY_AND 301 #define BITAND 302 #define BITOR 303 #define EQ_EQ 304 #define NOT_EQ 305 #define GT_EQ 306 #define LT_EQ 307 #define SLASH_SLASH 308 #define NEGATE 309 #define NOT 310 #define PLUS_PLUS 311 #define MINUS_MINUS 312 #define ASTERISK 313 #define EVAL 314 #line 1 "yacc.y" /* * $Id: yacc.y,v 1.18 2002/03/01 23:48:22 cssbz Exp $ */ /* This is from the Autoconf manual. Note the pragma directive is indented so that pre-ANSI C compilers will ignore it. [Ash] */ /* AIX requires this to be the first thing in the file */ #ifdef __GNUC__ # define alloca __builtin_alloca #else # if HAVE_ALLOCA_H # include # else # ifdef _AIX #pragma alloca # else # ifndef alloca /* predefined by HP cc +Olibcalls */ char *alloca (); # endif # endif # endif #endif static char rcsid[] = "$Id: yacc.y,v 1.18 2002/03/01 23:48:22 cssbz Exp $"; #include "../config.h" #include #include "eden.h" #include "emalloc.h" #ifdef HAVE_DMALLOC #include #endif #include "error.h" #define YYERROR_VERBOSE 1 #define WANT_SETYYPARSEINIT #define code2(c1,c2) code(c1); code(c2) #define code3(c1,c2,c3) code(c1); code(c2); code(c3) #define fromto(F,T) (F)[1] = (Inst)((T)-((F)+2)) extern char *textptr, textcode[]; extern symptr_QUEUE break_q, cont_q; extern void patch(Inst *, Inst *, symptr_QUEUE *); extern void dispatch(Inst *, symptr_QUEUE *); #define dispatch_break() dispatch(progp, &break_q); code2(jmp, 0) #define dispatch_continue() dispatch(progp, &cont_q); code2(jmp, 0) #define patch_break(mark,p) patch(mark, p, &break_q) #define patch_continue(mark,p) patch(mark, p, &cont_q) #define rts (Inst) 0 typedef struct { Inst *location; Datum *dp; } Garbage; typedef struct { Inst *start; Inst *end; } UsefulGarbage; static int MAXGARBAGE = 0; static int MAXUSABLE = 0; static Garbage *garbage; static UsefulGarbage *usable; static int nGarbage = 0; static int nUsable = 0; static int garbageLevel = 0; extern int inEVAL; extern int *autocalc; extern int *eden_backticks_dependency_hack; /* Garbage seems to be a structure describing which information on the stack can be thrown away. But see also the Usable structure :) */ void markGarbage(location, dp) Inst *location; Datum *dp; { if (MAXGARBAGE == 0) { garbage = (Garbage *) emalloc(sizeof(Garbage) * 64); MAXGARBAGE = 64; } if (nGarbage == MAXGARBAGE) { MAXGARBAGE += 64; garbage = (Garbage *) erealloc(garbage, sizeof(Garbage) * MAXGARBAGE); } garbage[nGarbage].location = location; garbage[nGarbage].dp = dp; nGarbage++; } /* Usable describes information on the stack that must be kept. Usable overrides Garbage - see Garbage above :) */ void unmarkGarbage(start, end) Inst *start; Inst *end; { if (MAXUSABLE == 0) { usable = (UsefulGarbage *) emalloc(sizeof(UsefulGarbage) * 4); MAXUSABLE = 4; } if (nUsable == MAXUSABLE) { MAXUSABLE += 4; usable = (UsefulGarbage *) erealloc(usable, sizeof(UsefulGarbage) * MAXUSABLE); } usable[nUsable].start = start; usable[nUsable].end = end; nUsable++; } void incGarbageLevel(void) { garbageLevel++; } void decGarbageLevel(void) { --garbageLevel; } void clearGarbage(void) { int i, j, save; if (--garbageLevel == 0) { for (i = 0; i < nGarbage; i++) { save = 0; /* nonzero ('true') if we should keep this information */ for (j = 0; j < nUsable; j++) { if (garbage[i].location >= usable[j].start && garbage[i].location <= usable[j].end) { /* this garbage is within this usable section, so we should keep it */ save = 1; break; } } if (!save) { /* don't save the info - free it up */ freedatum(*garbage[i].dp); free(garbage[i].dp); } } nGarbage = nUsable = 0; } } void defnonly(char *s) { /* warn if illegal definition */ if (!indef) error2(s, "used outside definition"); } extern void addentry(Datum *, Inst *); extern Inst *code(/* Inst */); extern Inst *code_related_by(symptr); extern Inst *code_related_by_runtimelhs(); extern Inst *code_definition(int, symptr, Inst *, Inst *, Int, char *); extern Inst *code_definition_runtimelhs(int, Inst *, Inst *, Int, char *); extern Inst *code_eval(Inst *, Inst *); extern void execute(Inst *); /* can be used to execute pc at end with (rts) */ extern void codeswitch(struct t *); extern void insert_level_marker(int), delete_local_level(int); extern void push_text(char *, int); #line 177 "yacc.y" typedef union { Datum *dp; /* constants */ symptr sym; /* symbol table ptr */ Inst *inst; /* machine instruction */ Int narg; /* number of arguments */ Inst fun; /* binop */ struct t *sw; /* switch */ char *tbegin; /* beginning of text */ } YYSTYPE; #include #ifndef __cplusplus #ifndef __STDC__ #define const #endif #endif #define YYFINAL 282 #define YYFLAG -32768 #define YYNTBASE 84 #define YYTRANSLATE(x) ((unsigned)(x) <= 314 ? yytranslate[x] : 136) static const char yytranslate[] = { 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 67, 2, 70, 74, 64, 71, 2, 78, 79, 62, 59, 42, 60, 2, 63, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 81, 80, 57, 43, 55, 46, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 75, 2, 76, 2, 2, 77, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 82, 2, 83, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 44, 45, 47, 48, 49, 50, 51, 52, 53, 54, 56, 58, 61, 65, 66, 68, 69, 72, 73 }; #if YYDEBUG != 0 static const short yyprhs[] = { 0, 0, 1, 3, 5, 7, 9, 11, 13, 18, 21, 25, 29, 33, 37, 41, 45, 46, 53, 56, 59, 62, 65, 67, 69, 73, 78, 83, 85, 88, 91, 95, 98, 102, 108, 116, 122, 126, 129, 132, 135, 140, 148, 156, 163, 170, 179, 181, 183, 185, 187, 190, 192, 195, 197, 200, 201, 203, 206, 207, 208, 210, 214, 215, 218, 221, 223, 224, 226, 228, 230, 232, 234, 236, 238, 240, 242, 244, 246, 248, 251, 256, 260, 264, 268, 272, 276, 280, 284, 288, 292, 296, 300, 304, 305, 309, 312, 315, 318, 321, 328, 332, 336, 340, 344, 348, 352, 357, 359, 361, 363, 365, 367, 369, 371, 378, 379, 389, 391, 396, 397, 405, 407, 408, 418, 420, 422, 424, 426, 428, 429, 432, 433, 435, 437, 441, 442, 443, 448, 449, 450, 456, 458, 462, 463, 465, 467 }; static const short yyrhs[] = { -1, 90, 0, 1, 0, 106, 0, 23, 0, 74, 0, 39, 0, 85, 75, 108, 76, 0, 62, 88, 0, 62, 71, 85, 0, 77, 108, 77, 0, 78, 85, 79, 0, 85, 43, 108, 0, 85, 44, 108, 0, 85, 45, 108, 0, 0, 85, 43, 85, 87, 61, 108, 0, 68, 85, 0, 85, 68, 0, 69, 85, 0, 85, 69, 0, 85, 0, 89, 0, 78, 108, 79, 0, 88, 78, 134, 79, 0, 89, 75, 108, 76, 0, 114, 0, 108, 80, 0, 38, 80, 0, 38, 108, 80, 0, 34, 80, 0, 34, 85, 80, 0, 35, 85, 42, 108, 80, 0, 36, 85, 42, 108, 42, 108, 80, 0, 37, 85, 42, 108, 80, 0, 27, 9, 81, 0, 28, 81, 0, 24, 80, 0, 25, 80, 0, 103, 108, 104, 90, 0, 93, 94, 95, 96, 97, 98, 90, 0, 92, 90, 31, 78, 108, 79, 80, 0, 91, 78, 108, 79, 99, 90, 0, 32, 78, 108, 79, 99, 90, 0, 32, 78, 108, 79, 99, 90, 100, 90, 0, 101, 0, 80, 0, 31, 0, 29, 0, 30, 78, 0, 80, 0, 108, 80, 0, 80, 0, 108, 80, 0, 0, 79, 0, 108, 79, 0, 0, 0, 33, 0, 82, 102, 83, 0, 0, 102, 90, 0, 26, 78, 0, 79, 0, 0, 107, 0, 12, 0, 13, 0, 14, 0, 10, 0, 11, 0, 18, 0, 19, 0, 20, 0, 9, 0, 86, 0, 88, 0, 71, 85, 0, 75, 105, 134, 76, 0, 108, 59, 108, 0, 108, 60, 108, 0, 108, 62, 108, 0, 108, 63, 108, 0, 108, 64, 108, 0, 108, 61, 108, 0, 108, 55, 108, 0, 108, 56, 108, 0, 108, 57, 108, 0, 108, 58, 108, 0, 108, 53, 108, 0, 108, 54, 108, 0, 0, 46, 109, 85, 0, 60, 108, 0, 108, 70, 0, 67, 108, 0, 66, 108, 0, 108, 46, 99, 108, 111, 108, 0, 108, 49, 108, 0, 108, 47, 108, 0, 108, 112, 108, 0, 108, 113, 108, 0, 108, 51, 108, 0, 108, 52, 108, 0, 110, 78, 108, 79, 0, 73, 0, 81, 0, 50, 0, 48, 0, 118, 0, 121, 0, 115, 0, 107, 117, 75, 127, 76, 80, 0, 0, 77, 108, 77, 116, 117, 75, 127, 76, 80, 0, 41, 0, 107, 120, 108, 80, 0, 0, 77, 108, 77, 119, 120, 108, 80, 0, 40, 0, 0, 123, 107, 122, 126, 124, 129, 131, 102, 125, 0, 15, 0, 16, 0, 17, 0, 82, 0, 83, 0, 0, 81, 128, 0, 0, 128, 0, 107, 0, 128, 42, 107, 0, 0, 0, 22, 130, 133, 80, 0, 0, 0, 131, 21, 132, 133, 80, 0, 23, 0, 133, 42, 23, 0, 0, 135, 0, 108, 0, 135, 42, 108, 0 }; #endif #if YYDEBUG != 0 static const short yyrline[] = { 0, 241, 242, 245, 248, 250, 255, 260, 266, 267, 268, 269, 285, 294, 295, 297, 299, 299, 310, 311, 312, 313, 316, 318, 319, 322, 325, 329, 331, 332, 334, 336, 339, 340, 342, 344, 346, 352, 358, 363, 368, 377, 393, 401, 410, 414, 419, 420, 423, 428, 433, 438, 439, 442, 443, 446, 449, 450, 453, 456, 459, 462, 465, 471, 475, 481, 484, 487, 488, 489, 490, 493, 495, 496, 497, 498, 501, 504, 507, 508, 509, 510, 511, 512, 513, 514, 515, 516, 517, 518, 519, 520, 521, 522, 523, 527, 528, 529, 530, 531, 534, 535, 536, 540, 544, 545, 546, 552, 554, 557, 563, 569, 570, 571, 574, 578, 579, 583, 587, 594, 595, 603, 609, 615, 632, 633, 634, 637, 650, 655, 657, 661, 663, 666, 668, 671, 672, 673, 676, 678, 680, 683, 685, 688, 689, 692, 694 }; #endif #if YYDEBUG != 0 || defined (YYERROR_VERBOSE) static const char * const yytname[] = { "$","error","$undefined.","UNDEF", "REAL","INTEGER","MYCHAR","STRING","LIST","CONSTANT","VAR","FORMULA","BLTIN", "LIB","RLIB","FUNC","PROC","PMAC","FUNCTION","PROCEDURE","PROCMACRO","AUTO", "PARA","LOCAL","BREAK","CONTINUE","SWITCH","CASE","DEFAULT","DO","FOR","WHILE", "IF","ELSE","SHIFT","APPEND","INSERT","DELETE","RETURN","ARG","IS","TILDE_GT", "','","'='","PLUS_EQ","MINUS_EQ","'?'","OR","LAZY_OR","AND","LAZY_AND","BITAND", "BITOR","EQ_EQ","NOT_EQ","'>'","GT_EQ","'<'","LT_EQ","'+'","'-'","SLASH_SLASH", "'*'","'/'","'%'","NEGATE","NOT","'!'","PLUS_PLUS","MINUS_MINUS","'#'","'&'", "ASTERISK","EVAL","'$'","'['","']'","'`'","'('","')'","';'","':'","'{'","'}'", "program","lvalue","asgn","@1","primary","secondary","stmt","while","do","for", "expr1","expr2","end_expr2","expr3","end_expr3","then","else","compound","stmtlist", "switch","cases","begin","id","identifier","expr","@2","evaluate","colon","lazy_and", "lazy_or","defn","declare_relation","@3","tilde_gt","declare_formula","@4","is", "declare_action","@5","action","def_begin","def_end","refer_opt","id_list_opt", "id_list","declare_para","@6","declare_local","@7","local_list","arglist","argument_list", NULL }; #endif static const short yyr1[] = { 0, 84, 84, 84, 85, 85, 85, 85, 85, 85, 85, 85, 85, 86, 86, 86, 87, 86, 86, 86, 86, 86, 88, 88, 88, 89, 89, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 91, 92, 93, 94, 94, 95, 95, 96, 97, 97, 98, 99, 100, 101, 102, 102, 103, 104, 105, 106, 106, 106, 106, 107, 107, 107, 107, 107, 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, 109, 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, 110, 111, 112, 113, 114, 114, 114, 115, 116, 115, 117, 118, 119, 118, 120, 122, 121, 123, 123, 123, 124, 125, 126, 126, 127, 127, 128, 128, 129, 130, 129, 131, 132, 131, 133, 133, 134, 134, 135, 135 }; static const short yyr2[] = { 0, 0, 1, 1, 1, 1, 1, 1, 4, 2, 3, 3, 3, 3, 3, 3, 0, 6, 2, 2, 2, 2, 1, 1, 3, 4, 4, 1, 2, 2, 3, 2, 3, 5, 7, 5, 3, 2, 2, 2, 4, 7, 7, 6, 6, 8, 1, 1, 1, 1, 2, 1, 2, 1, 2, 0, 1, 2, 0, 0, 1, 3, 0, 2, 2, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 4, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 0, 3, 2, 2, 2, 2, 6, 3, 3, 3, 3, 3, 3, 4, 1, 1, 1, 1, 1, 1, 1, 6, 0, 9, 1, 4, 0, 7, 1, 0, 9, 1, 1, 1, 1, 1, 0, 2, 0, 1, 1, 3, 0, 0, 4, 0, 0, 5, 1, 3, 0, 1, 1, 3 }; static const short yydefact[] = { 0, 3, 76, 71, 72, 68, 69, 70, 124, 125, 126, 73, 74, 75, 5, 0, 0, 0, 0, 0, 49, 0, 48, 0, 0, 0, 0, 0, 0, 7, 93, 0, 0, 0, 0, 0, 0, 0, 107, 6, 66, 0, 0, 47, 62, 22, 77, 78, 23, 2, 0, 0, 0, 46, 0, 4, 67, 0, 0, 27, 113, 111, 112, 0, 38, 39, 64, 0, 37, 50, 0, 0, 0, 31, 0, 67, 0, 0, 0, 29, 0, 0, 95, 0, 22, 9, 98, 97, 18, 20, 79, 143, 0, 22, 0, 0, 0, 0, 0, 19, 21, 0, 143, 0, 0, 0, 51, 0, 0, 0, 121, 117, 0, 0, 59, 0, 110, 0, 109, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 96, 28, 0, 0, 0, 122, 36, 0, 0, 0, 32, 0, 0, 0, 30, 94, 10, 145, 0, 144, 11, 12, 24, 61, 63, 22, 13, 14, 15, 0, 0, 0, 0, 0, 53, 55, 0, 52, 65, 0, 131, 0, 0, 101, 100, 104, 105, 91, 92, 87, 88, 89, 90, 81, 82, 86, 83, 84, 85, 102, 103, 0, 129, 59, 11, 0, 0, 0, 80, 0, 0, 0, 0, 8, 25, 26, 59, 0, 0, 54, 40, 133, 0, 132, 118, 0, 106, 0, 0, 0, 33, 0, 35, 146, 0, 0, 0, 0, 0, 56, 58, 0, 0, 0, 108, 0, 130, 127, 135, 44, 0, 131, 0, 17, 43, 0, 0, 57, 114, 134, 99, 136, 138, 60, 0, 34, 0, 120, 42, 41, 0, 62, 45, 0, 141, 0, 139, 0, 116, 0, 137, 0, 128, 123, 142, 0, 140, 0, 0, 0 }; static const short yydefgoto[] = { 280, 45, 46, 205, 47, 48, 157, 50, 51, 52, 107, 168, 211, 233, 249, 175, 257, 53, 95, 54, 172, 91, 55, 75, 57, 81, 58, 238, 135, 136, 59, 60, 203, 112, 61, 204, 113, 62, 195, 63, 241, 276, 221, 215, 216, 255, 263, 264, 274, 268, 151, 152 }; static const short yypact[] = { 262, -32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, -32768,-32768,-32768,-32768, -74, -60, -57, 13, -53,-32768, -42,-32768, -40, 750, 803, 803, 803, 560,-32768,-32768, 772, 786, 772, 772, 803, 803, 803,-32768,-32768,-32768, 772, 772,-32768,-32768, -11,-32768, -26, -32,-32768, -24, 486, 584,-32768, 772,-32768, -28, 872, -17,-32768,-32768, -32768,-32768, 114,-32768,-32768,-32768, -14,-32768,-32768, 772, 772, 803,-32768, -45,-32768, -38, -35, -33,-32768, 907, 803, 7, 803, -4, -26, 7, 7, -4, -4, -4, 772, 1425, -19, 1187, 336, 772, 772, 772,-32768,-32768, 772, 772, 772, 772, 41,-32768, 656, 942, 1221,-32768, -32768, 8, 772,-32768, 772,-32768, 772,-32768, 772, 772, 772, 772, 772, 772, 772, 772, 772, 772, 772, 772, 772, 772,-32768,-32768, 772, 772, 772,-32768,-32768, 1255, 1457, -20,-32768, 772, 772, 772,-32768, -4, -4, 1545, 6, 43, 25,-32768,-32768,-32768,-32768, 1, 1545, 1545, 1545, 107, 9, 1489, 1289, 11,-32768,-32768, 977,-32768, -32768, 486, 114, 1012, 772, 1567, 1587, 256, 256, 134, 134, 56, 56, 56, 56, -47, -47, -47, 16, 16, 16, 1587, 1567, 1323, 10,-32768,-32768, 1047, 1520, 1082, -32768, 772, 46, 53, 49,-32768,-32768,-32768,-32768, 772, 680,-32768,-32768,-32768, 35, 89,-32768, 836,-32768, 114, 54, 486,-32768, 772,-32768, 1545, 62, 772, 772, 486, 1357,-32768,-32768, 1391, 61, 114,-32768, 772, 89,-32768, 120, 110, 1117, 114, 1152, 1545,-32768, 64, 486,-32768, -32768,-32768, 1545,-32768,-32768,-32768, 486,-32768, 70,-32768, -32768,-32768, 124, 127,-32768, 69,-32768, -41,-32768, 411, -32768, 128,-32768, 124,-32768,-32768,-32768, -39,-32768, 150, 176,-32768 }; static const short yypgoto[] = {-32768, 103,-32768,-32768, 146,-32768, 2,-32768,-32768,-32768,-32768, -32768,-32768,-32768,-32768, -182,-32768,-32768, -84,-32768,-32768, -32768,-32768, 0, -23,-32768,-32768,-32768,-32768,-32768,-32768, -32768,-32768, -22,-32768,-32768, -2,-32768,-32768,-32768,-32768, -32768,-32768, -62, -13,-32768,-32768,-32768,-32768, -89, 98, -32768 }; #define YYLAST 1657 static const short yytable[] = { 56, 272, 49, 272, 144, 80, 64, 145, 82, 146, 86, 87, 110, 111, 222, 130, 131, 132, 92, 94, 65, 66, 67, 133, 96, 97, 98, 230, 68, 108, 101, 109, 96, 97, 98, 143, 69, 101, 70, 273, 101, 279, 101, 103, 96, 97, 98, 140, 141, 99, 100, 56, 102, 105, 104, 101, 101, 99, 100, 154, 154, 137, -16, 138, 101, -119, -115, 139, 150, 99, 100, 101, 166, 159, 160, 161, 101,-32768, 162, 150, 164, 165, 201, 173, 169, 202, 133, 111, 207, 210, 174, 220, 176, 110, 177, 56, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 229, 235, 192, 193, 194, 127, 128, 129, 130, 131, 132, 198, 199, 200, 3, 4, 133, 74, 76, 77, 78, 236, 11, 12, 13, 84, 240, 244, 88, 89, 90, 251, 254, 256, 261, 93, 266, 267, 269, 271, 281, 277, 218, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 56, 214, 213, 142, 282, 133, 85, 226, 270, 227, 259, 206, 148, 278, 149, 231, 234, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 158, 163, 243, 228, 0, 133, 245, 246, 239, 0, 0, 0, 0, 0, 0, 0, 253, 0, 0, 0, 0, 214, 0, 56, 0, 242, 0, 0, 0, 0, 0, 56, 0, 247, 0, 0, 0, 252, 0, 0, 0, 0, 0, 0, 0, 214, 0, 0, 0, 0, 56, 0, 262, 0, 0, 0, 0, 0, 56, 0, 265, 0, 0, -1, 1, 0, 0, 0, 0, 0, 0, 56, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 0, 0, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 0, 24, 25, 26, 27, 28, 29, 0, 0, 0, 0, 0, 0, 30, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 0, 31, 0, 32, 0, 133, 0, 33, 34, 35, 36, 0, 37, 0, 38, 39, 40, 0, 41, 42, 0, 43, 0, 44, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 0, 0, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 0, 24, 25, 26, 27, 28, 29, 0, 0, 0, 0, 0, 0, 30, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 31, 0, 32, 0, 0, 0, 33, 34, 35, 36, 0, 37, 0, 38, 39, 40, 0, 41, 42, 0, 43, 0, 44, 156, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 0, 0, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 0, 24, 25, 26, 27, 28, 29, 0, 0, 0, 0, 0, 0, 30, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 31, 0, 32, 0, 0, 0, 33, 34, 35, 36, 0, 37, 0, 38, 39, 40, 0, 41, 42, 0, 43, 0, 44, 275, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 0, 0, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 0, 24, 25, 26, 27, 28, 29, 0, 0, 0, 0, 0, 0, 30, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 31, 0, 32, 0, 0, 0, 33, 34, 35, 36, 0, 37, 0, 38, 39, 40, 0, 41, 42, 0, 43, 0, 44, 2, 3, 4, 5, 6, 7, 0, 0, 0, 11, 12, 13, 0, 0, 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 3, 4, 5, 6, 7, 29, 0, 0, 11, 12, 13, 0, 30, 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 31, 0, 32, 29, 0, 0, 33, 34, 35, 36, 30, 37, 0, 38, 39, 40, 0, 71, 42, 0, 79, 0, 0, 0, 31, 0, 32, 0, 0, 0, 33, 34, 35, 36, 0, 37, 0, 38, 39, 40, 0, 71, 42, 0, 106, 2, 3, 4, 5, 6, 7, 0, 0, 0, 11, 12, 13, 0, 0, 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 3, 4, 5, 6, 7, 29, 0, 0, 11, 12, 13, 0, 30, 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 31, 0, 32, 29, 0, 0, 33, 34, 35, 36, 30, 37, 0, 38, 39, 40, 0, 71, 42, 0, 167, 0, 0, 0, 31, 0, 32, 0, 0, 0, 33, 34, 35, 36, 0, 37, 0, 38, 39, 40, 0, 71, 42, 232, 3, 4, 5, 6, 7, 0, 0, 0, 11, 12, 13, 0, 0, 14, 0, 0, 0, 0, 0, 0, 0, 2, 3, 4, 5, 6, 7, 0, 0, 29, 11, 12, 13, 0, 0, 14, 3, 4, 5, 6, 7, 0, 0, 0, 11, 12, 13, 0, 0, 14, 0, 29, 32, 3, 4, 5, 6, 7, 30, 0, 0, 11, 12, 13, 39, 29, 14, 71, 72, 0, 73, 0, 31, 0, 32, 0, 0, 0, 33, 34, 35, 36, 29, 37, 0, 38, 39, 40, 32, 71, 42, 0, 0, 0, 0, 0, 0, 83, 0, 0, 39, 0, 0, 71, 42, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 39, 0, 0, 71, 72, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 0, 0, 0, 0, 0, 133, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 237, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 0, 0, 0, 0, 0, 133, 0, 0, 0, 0, 0, 0, 0, 0, 0, 134, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 0, 0, 0, 0, 0, 133, 0, 0, 0, 0, 0, 0, 0, 0, 0, 147, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 0, 0, 0, 0, 0, 133, 0, 0, 0, 0, 0, 0, 0, 0, 0, 170, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 0, 0, 0, 0, 0, 133, 0, 0, 0, 0, 0, 0, 0, 0, 0, 212, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 0, 0, 0, 0, 0, 133, 0, 0, 0, 0, 0, 0, 0, 0, 0, 217, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 0, 0, 0, 0, 0, 133, 0, 0, 0, 0, 0, 0, 0, 0, 0, 223, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 0, 0, 0, 0, 0, 133, 0, 0, 0, 0, 0, 0, 0, 0, 0, 225, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 0, 0, 0, 0, 0, 133, 0, 0, 0, 0, 0, 0, 0, 0, 0, 258, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 0, 0, 0, 0, 0, 133, 0, 0, 0, 0, 0, 0, 0, 0, 0, 260, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 0, 0, 0, 0, 0, 133, 0, 0, 0, 0, 0, 0, 0, 0, 155, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 0, 0, 0, 0, 0, 133, 0, 0, 0, 0, 0, 0, 0, 0, 171, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 0, 0, 0, 0, 0, 133, 0, 0, 0, 0, 0, 0, 0, 0, 196, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 0, 0, 0, 0, 0, 133, 0, 0, 0, 0, 0, 0, 0, 0, 209, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 0, 0, 0, 0, 0, 133, 0, 0, 0, 0, 0, 0, 0, 0, 219, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 0, 0, 0, 0, 0, 133, 0, 0, 0, 0, 0, 0, 0, 0, 248, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 0, 0, 0, 0, 0, 133, 0, 0, 0, 0, 0, 0, 0, 0, 250, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 0, 0, 0, 0, 0, 133, 0, 0, 0, 0, 0, 0, 153, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 0, 0, 0, 0, 0, 133, 0, 0, 0, 0, 0, 0, 197, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 0, 0, 0, 0, 0, 133, 0, 0, 224, 0, 0, 208, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 0, 0, 0, 0, 0, 133, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 0, 0, 0, 0, 0, 133, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 0, 0, 0, 0, 0, 133, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 0, 0, 0, 0, 0, 133 }; static const short yycheck[] = { 0, 42, 0, 42, 42, 28, 80, 42, 31, 42, 33, 34, 40, 41, 196, 62, 63, 64, 41, 42, 80, 78, 9, 70, 43, 44, 45, 209, 81, 52, 75, 54, 43, 44, 45, 80, 78, 75, 78, 80, 75, 80, 75, 75, 43, 44, 45, 70, 71, 68, 69, 51, 78, 51, 78, 75, 75, 68, 69, 79, 79, 78, 61, 63, 75, 40, 41, 81, 91, 68, 69, 75, 31, 96, 97, 98, 75, 70, 101, 102, 103, 104, 76, 75, 107, 42, 70, 41, 79, 78, 113, 81, 115, 40, 117, 95, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 61, 76, 135, 136, 137, 59, 60, 61, 62, 63, 64, 144, 145, 146, 10, 11, 70, 24, 25, 26, 27, 42, 18, 19, 20, 32, 82, 75, 35, 36, 37, 80, 22, 33, 80, 42, 76, 23, 21, 80, 0, 23, 175, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 172, 173, 172, 72, 0, 70, 32, 202, 264, 203, 244, 76, 81, 274, 83, 210, 211, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 96, 102, 224, 204, -1, 70, 228, 229, 220, -1, -1, -1, -1, -1, -1, -1, 238, -1, -1, -1, -1, 220, -1, 222, -1, 222, -1, -1, -1, -1, -1, 230, -1, 230, -1, -1, -1, 236, -1, -1, -1, -1, -1, -1, -1, 244, -1, -1, -1, -1, 249, -1, 249, -1, -1, -1, -1, -1, 257, -1, 257, -1, -1, 0, 1, -1, -1, -1, -1, -1, -1, 270, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, -1, -1, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, -1, 34, 35, 36, 37, 38, 39, -1, -1, -1, -1, -1, -1, 46, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, -1, 60, -1, 62, -1, 70, -1, 66, 67, 68, 69, -1, 71, -1, 73, 74, 75, -1, 77, 78, -1, 80, -1, 82, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, -1, -1, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, -1, 34, 35, 36, 37, 38, 39, -1, -1, -1, -1, -1, -1, 46, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 60, -1, 62, -1, -1, -1, 66, 67, 68, 69, -1, 71, -1, 73, 74, 75, -1, 77, 78, -1, 80, -1, 82, 83, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, -1, -1, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, -1, 34, 35, 36, 37, 38, 39, -1, -1, -1, -1, -1, -1, 46, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 60, -1, 62, -1, -1, -1, 66, 67, 68, 69, -1, 71, -1, 73, 74, 75, -1, 77, 78, -1, 80, -1, 82, 83, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, -1, -1, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, -1, 34, 35, 36, 37, 38, 39, -1, -1, -1, -1, -1, -1, 46, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 60, -1, 62, -1, -1, -1, 66, 67, 68, 69, -1, 71, -1, 73, 74, 75, -1, 77, 78, -1, 80, -1, 82, 9, 10, 11, 12, 13, 14, -1, -1, -1, 18, 19, 20, -1, -1, 23, -1, -1, -1, -1, -1, -1, -1, -1, -1, 9, 10, 11, 12, 13, 14, 39, -1, -1, 18, 19, 20, -1, 46, 23, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 60, -1, 62, 39, -1, -1, 66, 67, 68, 69, 46, 71, -1, 73, 74, 75, -1, 77, 78, -1, 80, -1, -1, -1, 60, -1, 62, -1, -1, -1, 66, 67, 68, 69, -1, 71, -1, 73, 74, 75, -1, 77, 78, -1, 80, 9, 10, 11, 12, 13, 14, -1, -1, -1, 18, 19, 20, -1, -1, 23, -1, -1, -1, -1, -1, -1, -1, -1, -1, 9, 10, 11, 12, 13, 14, 39, -1, -1, 18, 19, 20, -1, 46, 23, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 60, -1, 62, 39, -1, -1, 66, 67, 68, 69, 46, 71, -1, 73, 74, 75, -1, 77, 78, -1, 80, -1, -1, -1, 60, -1, 62, -1, -1, -1, 66, 67, 68, 69, -1, 71, -1, 73, 74, 75, -1, 77, 78, 79, 10, 11, 12, 13, 14, -1, -1, -1, 18, 19, 20, -1, -1, 23, -1, -1, -1, -1, -1, -1, -1, 9, 10, 11, 12, 13, 14, -1, -1, 39, 18, 19, 20, -1, -1, 23, 10, 11, 12, 13, 14, -1, -1, -1, 18, 19, 20, -1, -1, 23, -1, 39, 62, 10, 11, 12, 13, 14, 46, -1, -1, 18, 19, 20, 74, 39, 23, 77, 78, -1, 80, -1, 60, -1, 62, -1, -1, -1, 66, 67, 68, 69, 39, 71, -1, 73, 74, 75, 62, 77, 78, -1, -1, -1, -1, -1, -1, 71, -1, -1, 74, -1, -1, 77, 78, 62, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 74, -1, -1, 77, 78, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, -1, -1, -1, -1, -1, 70, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 81, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, -1, -1, -1, -1, -1, 70, -1, -1, -1, -1, -1, -1, -1, -1, -1, 80, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, -1, -1, -1, -1, -1, 70, -1, -1, -1, -1, -1, -1, -1, -1, -1, 80, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, -1, -1, -1, -1, -1, 70, -1, -1, -1, -1, -1, -1, -1, -1, -1, 80, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, -1, -1, -1, -1, -1, 70, -1, -1, -1, -1, -1, -1, -1, -1, -1, 80, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, -1, -1, -1, -1, -1, 70, -1, -1, -1, -1, -1, -1, -1, -1, -1, 80, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, -1, -1, -1, -1, -1, 70, -1, -1, -1, -1, -1, -1, -1, -1, -1, 80, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, -1, -1, -1, -1, -1, 70, -1, -1, -1, -1, -1, -1, -1, -1, -1, 80, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, -1, -1, -1, -1, -1, 70, -1, -1, -1, -1, -1, -1, -1, -1, -1, 80, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, -1, -1, -1, -1, -1, 70, -1, -1, -1, -1, -1, -1, -1, -1, -1, 80, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, -1, -1, -1, -1, -1, 70, -1, -1, -1, -1, -1, -1, -1, -1, 79, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, -1, -1, -1, -1, -1, 70, -1, -1, -1, -1, -1, -1, -1, -1, 79, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, -1, -1, -1, -1, -1, 70, -1, -1, -1, -1, -1, -1, -1, -1, 79, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, -1, -1, -1, -1, -1, 70, -1, -1, -1, -1, -1, -1, -1, -1, 79, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, -1, -1, -1, -1, -1, 70, -1, -1, -1, -1, -1, -1, -1, -1, 79, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, -1, -1, -1, -1, -1, 70, -1, -1, -1, -1, -1, -1, -1, -1, 79, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, -1, -1, -1, -1, -1, 70, -1, -1, -1, -1, -1, -1, -1, -1, 79, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, -1, -1, -1, -1, -1, 70, -1, -1, -1, -1, -1, -1, 77, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, -1, -1, -1, -1, -1, 70, -1, -1, -1, -1, -1, -1, 77, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, -1, -1, -1, -1, -1, 70, -1, -1, 42, -1, -1, 76, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, -1, -1, -1, -1, -1, 70, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, -1, -1, -1, -1, -1, 70, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, -1, -1, -1, -1, -1, 70, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, -1, -1, -1, -1, -1, 70 }; /* -*-C-*- Note some compilers choke on comments on `#line' lines. */ /* MODIFICATION 1: fix all #line directives as they have the wrong * filename and line numbers. Note #line no = actual number + 1 * #line 3 "/usr/local/share/bison.simple" */ #line 7 "bison/bison.simple" /* END MODIFICATION 1 */ /* This file comes from bison-1.28. */ /* This is a MODIFIED version of bison's Skeleton output parser The change is such that the parser only process one token at each call to yyparse(). The token is the argument to yyparse(). This means that this parser is token driven. Example use: while (token = yylex()) { yyparse(token); } Additionally: error handling patched to show expected when there are > 5 expected during an error. [Ash, May 2001]. There are 13 patches of MODIFICATION in the Skeleton (not including this comment) */ /* Skeleton output parser for bison, Copyright (C) 1984, 1989, 1990 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /* As a special exception, when this file is copied by Bison into a Bison output file, you may use that output file without restriction. This special exception was added by the Free Software Foundation in version 1.24 of Bison. */ /* This is the parser code that is written into each bison parser when the %semantic_parser declaration is not specified in the grammar. It was written by Richard Stallman by simplifying the hairy parser used when %semantic_parser is specified. */ #ifndef YYSTACK_USE_ALLOCA #ifdef alloca #define YYSTACK_USE_ALLOCA #else /* alloca not defined */ #ifdef __GNUC__ #define YYSTACK_USE_ALLOCA #define alloca __builtin_alloca #else /* not GNU C. */ #if (!defined (__STDC__) && defined (sparc)) || defined (__sparc__) || defined (__sparc) || defined (__sgi) || (defined (__sun) && defined (__i386)) #define YYSTACK_USE_ALLOCA #include #else /* not sparc */ /* We think this test detects Watcom and Microsoft C. */ /* This used to test MSDOS, but that is a bad idea since that symbol is in the user namespace. */ #if (defined (_MSDOS) || defined (_MSDOS_)) && !defined (__TURBOC__) #if 0 /* No need for malloc.h, which pollutes the namespace; instead, just don't use alloca. */ #include #endif #else /* not MSDOS, or __TURBOC__ */ #if defined(_AIX) /* I don't know what this was needed for, but it pollutes the namespace. So I turned it off. rms, 2 May 1997. */ /* #include */ #pragma alloca #define YYSTACK_USE_ALLOCA #else /* not MSDOS, or __TURBOC__, or _AIX */ #if 0 #ifdef __hpux /* haible@ilog.fr says this works for HPUX 9.05 and up, and on HPUX 10. Eventually we can turn this on. */ #define YYSTACK_USE_ALLOCA #define alloca __builtin_alloca #endif /* __hpux */ #endif #endif /* not _AIX */ #endif /* not MSDOS, or __TURBOC__ */ #endif /* not sparc */ #endif /* not GNU C */ #endif /* alloca not defined */ #endif /* YYSTACK_USE_ALLOCA not defined */ #ifdef YYSTACK_USE_ALLOCA #define YYSTACK_ALLOC alloca #else #define YYSTACK_ALLOC malloc #endif /* Note: there must be only one dollar sign in this file. It is replaced by the list of actions, each action as one case of the switch. */ #define yyerrok (yyerrstatus = 0) #define yyclearin (yychar = YYEMPTY) #define YYEMPTY -2 #define YYEOF 0 #define YYACCEPT goto yyacceptlab #define YYABORT goto yyabortlab #define YYERROR goto yyerrlab1 /* Like YYERROR except do call yyerror. This remains here temporarily to ease the transition to the new meaning of YYERROR, for GCC. Once GCC version 2 has supplanted version 1, this can go. */ #define YYFAIL goto yyerrlab #define YYRECOVERING() (!!yyerrstatus) #define YYBACKUP(token, value) \ do \ if (yychar == YYEMPTY && yylen == 1) \ { yychar = (token), yylval = (value); \ yychar1 = YYTRANSLATE (yychar); \ YYPOPSTACK; \ goto yybackup; \ } \ else \ { yyerror ("syntax error: cannot back up"); YYERROR; } \ while (0) #define YYTERROR 1 #define YYERRCODE 256 #ifndef YYPURE #define YYLEX yylex() #endif #ifdef YYPURE #ifdef YYLSP_NEEDED #ifdef YYLEX_PARAM #define YYLEX yylex(&yylval, &yylloc, YYLEX_PARAM) #else #define YYLEX yylex(&yylval, &yylloc) #endif #else /* not YYLSP_NEEDED */ #ifdef YYLEX_PARAM #define YYLEX yylex(&yylval, YYLEX_PARAM) #else #define YYLEX yylex(&yylval) #endif #endif /* not YYLSP_NEEDED */ #endif /* If nonreentrant, generate the variables here */ #ifndef YYPURE int yychar; /* the lookahead symbol */ YYSTYPE yylval; /* the semantic value of the */ /* lookahead symbol */ #ifdef YYLSP_NEEDED YYLTYPE yylloc; /* location data for the lookahead */ /* symbol */ #endif int yynerrs; /* number of parse errors so far */ #endif /* not YYPURE */ #if YYDEBUG != 0 int yydebug; /* nonzero means print parse trace */ /* Since this is uninitialized, it does not stop multiple parsers from coexisting. */ #endif /* YYINITDEPTH indicates the initial size of the parser's stacks */ #ifndef YYINITDEPTH #define YYINITDEPTH 200 #endif /* YYMAXDEPTH is the maximum size the stacks can grow to (effective only if the built-in stack extension method is used). */ #if YYMAXDEPTH == 0 #undef YYMAXDEPTH #endif #ifndef YYMAXDEPTH #define YYMAXDEPTH 10000 #endif /* Define __yy_memcpy. Note that the size argument should be passed with type unsigned int, because that is what the non-GCC definitions require. With GCC, __builtin_memcpy takes an arg of type size_t, but it can handle unsigned int. */ #if __GNUC__ > 1 /* GNU C and GNU C++ define this. */ #define __yy_memcpy(TO,FROM,COUNT) __builtin_memcpy(TO,FROM,COUNT) #else /* not GNU C or C++ */ #ifndef __cplusplus /* This is the most reliable way to avoid incompatibilities in available built-in functions on various systems. */ static void __yy_memcpy (to, from, count) char *to; char *from; unsigned int count; { register char *f = from; register char *t = to; register int i = count; while (i-- > 0) *t++ = *f++; } #else /* __cplusplus */ /* This is the most reliable way to avoid incompatibilities in available built-in functions on various systems. */ static void __yy_memcpy (char *to, char *from, unsigned int count) { register char *t = to; register char *f = from; register int i = count; while (i-- > 0) *t++ = *f++; } #endif #endif /* MODIFICATION 2: same as MODIFICATION 1 * #line 217 "/usr/local/share/bison.simple" */ #line 241 "bison/bison.simple" /* END MODIFICATION 2 */ /* The user can define YYPARSE_PARAM as the name of an argument to be passed into yyparse. The argument should have type void *. It should actually point to an object. Grammar actions can access the variable by casting it to the proper pointer type. */ #ifdef YYPARSE_PARAM #ifdef __cplusplus #define YYPARSE_PARAM_ARG void *YYPARSE_PARAM #define YYPARSE_PARAM_DECL #else /* not __cplusplus */ #define YYPARSE_PARAM_ARG YYPARSE_PARAM #define YYPARSE_PARAM_DECL void *YYPARSE_PARAM; #endif /* not __cplusplus */ #else /* not YYPARSE_PARAM */ #define YYPARSE_PARAM_ARG #define YYPARSE_PARAM_DECL #endif /* not YYPARSE_PARAM */ /* Prevent warning if -Wstrict-prototypes. */ #ifdef __GNUC__ /* MODIFICATION 3: yyparse() takes an argument that is the lex token * #ifdef YYPARSE_PARAM * int yyparse (void *); * #else * int yyparse (void); * #endif */ int yyparse(int); /* END MODIFICATION 3 */ #endif /* MODIFICATION 4: add a variable yy_parse_init to control the initialisation of the parser and an accessor function */ static int yy_parse_init = 1; #ifdef WANT_SETYYPARSEINIT /* Added this function to allow Eden to use this bison.simple. Needs conditional compilation as we can only have one function with this name otherwise the linker moans (can't compile this into Donald, Scout etc). The name here doesn't get automatically translated by the sed or bison -p. [Ash] */ void setyyparseinit(int setto) { yy_parse_init = setto; } #endif /* END MODIFICATION 4 */ /* MODIFICATION 5: turning the local variables of yyparse() into static, global variables so that the parser can be reentered */ static int yystate; static int yyn; static short *yyssp; static YYSTYPE *yyvsp; static int yyerrstatus; /* number of tokens to shift before error messages enabled */ static int yychar1 = 0; /* lookahead token as an internal (translated) token number */ static short yyssa[YYINITDEPTH]; /* the state stack */ static YYSTYPE yyvsa[YYINITDEPTH]; /* the semantic value stack */ static short *yyss = yyssa; /* refer to the stacks thru separate pointers */ static YYSTYPE *yyvs = yyvsa; /* to allow yyoverflow to reallocate them elsewhere */ #ifdef YYLSP_NEEDED static YYLTYPE yylsa[YYINITDEPTH]; /* the location stack */ static YYLTYPE *yyls = yylsa; static YYLTYPE *yylsp; #define YYPOPSTACK (yyvsp--, yyssp--, yylsp--) #else #define YYPOPSTACK (yyvsp--, yyssp--) #endif static int yystacksize = YYINITDEPTH; static int yyfree_stacks = 0; #ifdef YYPURE static int yychar; static YYSTYPE yylval; static int yynerrs; #ifdef YYLSP_NEEDED static YYLTYPE yylloc; #endif #endif static YYSTYPE yyval; /* the variable used to return */ /* semantic values from the action */ /* routines */ static int yylen; /* END MODIFICATION 5 */ /* MODIFICATION 6: yyparse() takes an argument that is the lex token * int * yyparse(YYPARSE_PARAM_ARG) * YYPARSE_PARAM_DECL * { */ int yyparse(token) int token; { /* END MODIFICATION 6 */ /* MODIFICATION 7: deal with initialisation */ int yy_token_read = 0; if (!yy_parse_init) goto lex; yy_parse_init = 0; /* END MODIFICATION 7 */ #if YYDEBUG != 0 if (yydebug) fprintf(stderr, "Starting parse\n"); #endif yystate = 0; yyerrstatus = 0; yynerrs = 0; yychar = YYEMPTY; /* Cause a token to be read. */ /* Initialize stack pointers. Waste one element of value and location stack so that they stay on the same level as the state stack. The wasted elements are never initialized. */ yyssp = yyss - 1; yyvsp = yyvs; #ifdef YYLSP_NEEDED yylsp = yyls; #endif /* Push a new state, which is found in yystate . */ /* In all cases, when you get here, the value and location stacks have just been pushed. so pushing a state here evens the stacks. */ yynewstate: *++yyssp = yystate; if (yyssp >= yyss + yystacksize - 1) { /* Give user a chance to reallocate the stack */ /* Use copies of these so that the &'s don't force the real ones into memory. */ YYSTYPE *yyvs1 = yyvs; short *yyss1 = yyss; #ifdef YYLSP_NEEDED YYLTYPE *yyls1 = yyls; #endif /* Get the current used size of the three stacks, in elements. */ int size = yyssp - yyss + 1; #ifdef yyoverflow /* Each stack pointer address is followed by the size of the data in use in that stack, in bytes. */ #ifdef YYLSP_NEEDED /* This used to be a conditional around just the two extra args, but that might be undefined if yyoverflow is a macro. */ yyoverflow("parser stack overflow", &yyss1, size * sizeof (*yyssp), &yyvs1, size * sizeof (*yyvsp), &yyls1, size * sizeof (*yylsp), &yystacksize); #else yyoverflow("parser stack overflow", &yyss1, size * sizeof (*yyssp), &yyvs1, size * sizeof (*yyvsp), &yystacksize); #endif yyss = yyss1; yyvs = yyvs1; #ifdef YYLSP_NEEDED yyls = yyls1; #endif #else /* no yyoverflow */ /* Extend the stack our own way. */ if (yystacksize >= YYMAXDEPTH) { yyerror("parser stack overflow"); if (yyfree_stacks) { free (yyss); free (yyvs); #ifdef YYLSP_NEEDED free (yyls); #endif } return 2; } yystacksize *= 2; if (yystacksize > YYMAXDEPTH) yystacksize = YYMAXDEPTH; #ifndef YYSTACK_USE_ALLOCA yyfree_stacks = 1; #endif yyss = (short *) YYSTACK_ALLOC (yystacksize * sizeof (*yyssp)); __yy_memcpy ((char *)yyss, (char *)yyss1, size * (unsigned int) sizeof (*yyssp)); yyvs = (YYSTYPE *) YYSTACK_ALLOC (yystacksize * sizeof (*yyvsp)); __yy_memcpy ((char *)yyvs, (char *)yyvs1, size * (unsigned int) sizeof (*yyvsp)); #ifdef YYLSP_NEEDED yyls = (YYLTYPE *) YYSTACK_ALLOC (yystacksize * sizeof (*yylsp)); __yy_memcpy ((char *)yyls, (char *)yyls1, size * (unsigned int) sizeof (*yylsp)); #endif #endif /* no yyoverflow */ yyssp = yyss + size - 1; yyvsp = yyvs + size - 1; #ifdef YYLSP_NEEDED yylsp = yyls + size - 1; #endif #if YYDEBUG != 0 if (yydebug) fprintf(stderr, "Stack size increased to %d\n", yystacksize); #endif if (yyssp >= yyss + yystacksize - 1) YYABORT; } #if YYDEBUG != 0 if (yydebug) fprintf(stderr, "Entering state %d\n", yystate); #endif goto yybackup; yybackup: /* Do appropriate processing given the current state. */ /* Read a lookahead token if we need one and don't already have one. */ /* yyresume: */ /* First try to decide what to do without reference to lookahead token. */ yyn = yypact[yystate]; if (yyn == YYFLAG) goto yydefault; /* Not known => get a lookahead token if don't already have one. */ /* yychar is either YYEMPTY or YYEOF or a valid token in external form. */ if (yychar == YYEMPTY) { #if YYDEBUG != 0 if (yydebug) fprintf(stderr, "Reading a token: "); #endif /* MODIFICATION 8: consume the argument token * yychar = YYLEX; */ lex: if (yy_token_read) return -1; /* token consumed */ yy_token_read = 1; yychar = token; /* END MODIFICATION 8 */ } /* Convert token to internal form (in yychar1) for indexing tables with */ if (yychar <= 0) /* This means end of input. */ { yychar1 = 0; yychar = YYEOF; /* Don't call YYLEX any more */ #if YYDEBUG != 0 if (yydebug) fprintf(stderr, "Now at end of input.\n"); #endif } else { yychar1 = YYTRANSLATE(yychar); #if YYDEBUG != 0 if (yydebug) { fprintf (stderr, "Next token is %d (%s", yychar, yytname[yychar1]); /* Give the individual parser a way to print the precise meaning of a token, for further debugging info. */ #ifdef YYPRINT YYPRINT (stderr, yychar, yylval); #endif fprintf (stderr, ")\n"); } #endif } yyn += yychar1; if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != yychar1) goto yydefault; yyn = yytable[yyn]; /* yyn is what to do for this token type in this state. Negative => reduce, -yyn is rule number. Positive => shift, yyn is new state. New state is final state => don't bother to shift, just return success. 0, or most negative number => error. */ if (yyn < 0) { if (yyn == YYFLAG) goto yyerrlab; yyn = -yyn; goto yyreduce; } else if (yyn == 0) goto yyerrlab; if (yyn == YYFINAL) YYACCEPT; /* Shift the lookahead token. */ #if YYDEBUG != 0 if (yydebug) fprintf(stderr, "Shifting token %d (%s), ", yychar, yytname[yychar1]); #endif /* Discard the token being shifted unless it is eof. */ if (yychar != YYEOF) yychar = YYEMPTY; *++yyvsp = yylval; #ifdef YYLSP_NEEDED *++yylsp = yylloc; #endif /* count tokens shifted since error; after three, turn off error status. */ if (yyerrstatus) yyerrstatus--; yystate = yyn; goto yynewstate; /* Do the default action for the current state. */ yydefault: yyn = yydefact[yystate]; if (yyn == 0) goto yyerrlab; /* Do a reduction. yyn is the number of a rule to reduce with. */ yyreduce: yylen = yyr2[yyn]; if (yylen > 0) yyval = yyvsp[1-yylen]; /* implement default value of the action */ #if YYDEBUG != 0 if (yydebug) { int i; fprintf (stderr, "Reducing via rule %d (line %d), ", yyn, yyrline[yyn]); /* Print the symbols being reduced, and their result. */ for (i = yyprhs[yyn]; yyrhs[i] > 0; i++) fprintf (stderr, "%s ", yytname[yyrhs[i]]); fprintf (stderr, " -> %s\n", yytname[yyr1[yyn]]); } #endif switch (yyn) { case 2: #line 242 "yacc.y" { code2(freeheap, rts); textptr = textcode; return 1; ; break;} case 3: #line 245 "yacc.y" { yyerrok; ; break;} case 4: #line 249 "yacc.y" { yyval.inst = code2(addr, yyvsp[0].sym); ; break;} case 5: #line 250 "yacc.y" { defnonly("local variable"); if (inEVAL) error("can't reference local variable within eval()"); yyval.inst = code2(localaddr, yyvsp[0].narg); ; break;} case 6: #line 255 "yacc.y" { defnonly("$"); if (inEVAL) error("can't reference local $ variable within eval()"); yyval.inst = code2(localaddr, (Inst)0); ; break;} case 7: #line 260 "yacc.y" { defnonly("$"); if (inEVAL) error("can't reference local $ variable within eval()"); yyval.inst = code2(localaddr, (Inst)0); code3(pushint, (Inst)yyvsp[0].narg, indexcalc); ; break;} case 8: #line 266 "yacc.y" { code(indexcalc); ; break;} case 9: #line 267 "yacc.y" { yyval.inst = yyvsp[0].inst; ; break;} case 10: #line 268 "yacc.y" { yyval.inst = yyvsp[0].inst; ; break;} case 11: #line 269 "yacc.y" { yyval.inst = yyvsp[-1].inst; code(lookup_address); /* The below is a hack by Patrick which evaluates expr at parse time. It seems to be necessary in some situations (eg the project timetable). It was added in yacc.y 1.8 (6th Sept 1999, release 1.0), removed again in yacc.y 1.15 (27th July 2001, release 1.13), and made optional in 1.18 (release 1.38). [Ash] */ if (informula && !inEVAL && *autocalc && *eden_backticks_dependency_hack) { code(rts); execute(yyvsp[-1].inst); progp--; /* remove rts */ } ; break;} case 12: #line 285 "yacc.y" { yyval.inst = yyvsp[-1].inst; ; break;} case 13: #line 294 "yacc.y" { code(assign); ; break;} case 14: #line 296 "yacc.y" { code(inc_asgn); ; break;} case 15: #line 298 "yacc.y" { code(dec_asgn); ; break;} case 16: #line 299 "yacc.y" { code(getvalue); ; break;} case 17: #line 300 "yacc.y" { if (yyvsp[-5].inst[1] == yyvsp[-3].inst[1]) { // l = l // expr: optimise code(concatopt); } else { // l = notl // expr: // treat normally code(concat); code(assign); } ; break;} case 18: #line 310 "yacc.y" { code(pre_inc); yyval.inst = yyvsp[0].inst; ; break;} case 19: #line 311 "yacc.y" { code(post_inc); ; break;} case 20: #line 312 "yacc.y" { code(pre_dec); yyval.inst = yyvsp[0].inst; ; break;} case 21: #line 313 "yacc.y" { code(post_dec); ; break;} case 22: #line 317 "yacc.y" { code(getvalue); ; break;} case 24: #line 319 "yacc.y" { yyval.inst = yyvsp[-1].inst; ; break;} case 25: #line 324 "yacc.y" { code3(makelist, yyvsp[-1].narg, eval); ; break;} case 26: #line 326 "yacc.y" { code(sel); ; break;} case 28: #line 331 "yacc.y" { code2(popd, freeheap); ; break;} case 29: #line 332 "yacc.y" { defnonly("return"); yyval.inst = code2(pushUNDEF, rts); ; break;} case 30: #line 334 "yacc.y" { defnonly("return"); yyval.inst = yyvsp[-1].inst; code(rts); ; break;} case 31: #line 336 "yacc.y" { defnonly("shift"); yyval.inst = code3(localaddr, 0, shift); ; break;} case 32: #line 339 "yacc.y" { yyval.inst = yyvsp[-1].inst; code(shift); ; break;} case 33: #line 341 "yacc.y" { yyval.inst = yyvsp[-3].inst; code2(append, freeheap); ; break;} case 34: #line 343 "yacc.y" { yyval.inst = yyvsp[-5].inst; code2(insert, freeheap); ; break;} case 35: #line 345 "yacc.y" { yyval.inst = yyvsp[-3].inst; code2(delete, freeheap); ; break;} case 36: #line 346 "yacc.y" { if (inswitch) addentry(yyvsp[-1].dp, progp); else error("'case' used outside switch"); yyval.inst = progp; ; break;} case 37: #line 352 "yacc.y" { if (inswitch) addentry(0, progp); else error("'default' used outside switch"); yyval.inst = progp; ; break;} case 38: #line 358 "yacc.y" { if (!inloop && !inswitch) error("'break' used outside loop/switch"); yyval.inst = progp; dispatch_break(); ; break;} case 39: #line 363 "yacc.y" { if (!inloop) error("'continue' used outside loop"); yyval.inst = progp; dispatch_continue(); ; break;} case 40: #line 368 "yacc.y" { dispatch_break(); fromto(yyvsp[-1].inst, progp); code(switchcode); codeswitch(yyvsp[-3].sw); patch_break(yyvsp[-2].inst, progp); yyval.inst = yyvsp[-2].inst; --inswitch; ; break;} case 41: #line 381 "yacc.y" { Inst * p = code(jmp); code(yyvsp[-2].inst - (p + 2)); fromto(yyvsp[-3].inst, yyvsp[0].inst); if (yyvsp[-4].inst != yyvsp[-3].inst - 2) fromto(yyvsp[-3].inst-2, progp); fromto(yyvsp[-1].inst, yyvsp[-4].inst); patch_continue(yyvsp[-5].inst, yyvsp[-2].inst); patch_break(yyvsp[-5].inst, progp); yyval.inst = yyvsp[-5].inst; --inloop; ; break;} case 42: #line 394 "yacc.y" { Inst * p = code(jpt); code(yyvsp[-5].inst - (p + 2)); patch_continue(yyvsp[-5].inst, yyvsp[-2].inst); patch_break(yyvsp[-5].inst, progp); yyval.inst = yyvsp[-5].inst; --inloop; ; break;} case 43: #line 402 "yacc.y" { Inst * p = code(jmp); code(yyvsp[-3].inst - (p + 2)); fromto(yyvsp[-1].inst, progp); patch_continue(yyvsp[-3].inst, yyvsp[-3].inst); patch_break(yyvsp[-3].inst, progp); yyval.inst = yyvsp[-3].inst; --inloop; ; break;} case 44: #line 411 "yacc.y" { fromto(yyvsp[-1].inst, progp); yyval.inst = yyvsp[-3].inst; ; break;} case 45: #line 415 "yacc.y" { fromto(yyvsp[-3].inst, yyvsp[0].inst); fromto(yyvsp[-1].inst, progp); yyval.inst = yyvsp[-5].inst; ; break;} case 47: #line 420 "yacc.y" { yyval.inst = progp; ; break;} case 48: #line 423 "yacc.y" { inloop++; dispatch(progp, &cont_q); dispatch(progp, &break_q); ; break;} case 49: #line 428 "yacc.y" { inloop++; dispatch(progp, &cont_q); dispatch(progp, &break_q); ; break;} case 50: #line 433 "yacc.y" { inloop++; dispatch(progp, &cont_q); dispatch(progp, &break_q); ; break;} case 51: #line 438 "yacc.y" { yyval.inst = progp; ; break;} case 52: #line 439 "yacc.y" { code(popd); ; break;} case 53: #line 442 "yacc.y" { yyval.inst = code2(jmp, 0); ; break;} case 54: #line 443 "yacc.y" { code2(jpnt, 0); ; break;} case 55: #line 446 "yacc.y" { yyval.inst = code2(jmp, 0); ; break;} case 56: #line 449 "yacc.y" { yyval.inst = code2(jmp, 0); ; break;} case 57: #line 450 "yacc.y" { code3(popd, jmp, 0); ; break;} case 58: #line 453 "yacc.y" { yyval.inst = code2(jmp, 0); ; break;} case 59: #line 456 "yacc.y" { yyval.inst = code2(jpnt, 0); ; break;} case 60: #line 459 "yacc.y" { yyval.inst = code2(jmp, 0); ; break;} case 61: #line 462 "yacc.y" { yyval.inst = yyvsp[-1].inst; ; break;} case 62: #line 465 "yacc.y" { /* A loop with empty contents still needs to prevent the heap from overflowing [Ash] */ /* $$ = progp; */ yyval.inst = code(freeheap); ; break;} case 63: #line 471 "yacc.y" { /*fprintf(stderr, "rd inprocmacro=%d\n", inprocmacro);*/ if (inprocmacro) code(eager); ; break;} case 64: #line 475 "yacc.y" { yyval.sw = entry_ptr; inswitch++; dispatch(progp, &break_q); ; break;} case 65: #line 481 "yacc.y" { yyval.inst = code2(jmp, 0); ; break;} case 66: #line 484 "yacc.y" { yyval.inst = progp; ; break;} case 67: #line 487 "yacc.y" { if (informula && !inEVAL) addID(yyvsp[0].sym); ; break;} case 76: #line 502 "yacc.y" { markGarbage(progp, yyvsp[0].dp); yyval.inst = code2(constpush, (Inst)yyvsp[0].dp); ; break;} case 77: #line 504 "yacc.y" { if (informula) error("assignment used inside formula"); ; break;} case 79: #line 508 "yacc.y" { yyval.inst = yyvsp[0].inst; ; break;} case 80: #line 509 "yacc.y" { code2(makelist, (Inst)yyvsp[-1].narg); yyval.inst = yyvsp[-2].inst; ; break;} case 81: #line 510 "yacc.y" { code(add); ; break;} case 82: #line 511 "yacc.y" { code(sub); ; break;} case 83: #line 512 "yacc.y" { code(mul); ; break;} case 84: #line 513 "yacc.y" { code(divide); ; break;} case 85: #line 514 "yacc.y" { code(mod); ; break;} case 86: #line 515 "yacc.y" { code(concat); ; break;} case 87: #line 516 "yacc.y" { code(gt); ; break;} case 88: #line 517 "yacc.y" { code(ge); ; break;} case 89: #line 518 "yacc.y" { code(lt); ; break;} case 90: #line 519 "yacc.y" { code(le); ; break;} case 91: #line 520 "yacc.y" { code(eq); ; break;} case 92: #line 521 "yacc.y" { code(ne); ; break;} case 93: #line 522 "yacc.y" { code(noupdate); ; break;} case 94: #line 523 "yacc.y" { yyval.inst = yyvsp[0].inst; code(query); code(resetupdate); ; break;} case 95: #line 527 "yacc.y" { yyval.inst = yyvsp[0].inst; code(negate); ; break;} case 96: #line 528 "yacc.y" { code(listsize); ; break;} case 97: #line 529 "yacc.y" { yyval.inst = yyvsp[0].inst; code(lazy_not); ; break;} case 98: #line 530 "yacc.y" { yyval.inst = yyvsp[0].inst; code(not); ; break;} case 99: #line 531 "yacc.y" { fromto(yyvsp[-3].inst, yyvsp[0].inst); fromto(yyvsp[-1].inst, progp); ; break;} case 100: #line 534 "yacc.y" { code(and); ; break;} case 101: #line 535 "yacc.y" { code(or); ; break;} case 102: #line 537 "yacc.y" { fromto(yyvsp[-1].inst, progp); code(cnv_2_bool); ; break;} case 103: #line 541 "yacc.y" { fromto(yyvsp[-1].inst, progp); code(cnv_2_bool); ; break;} case 104: #line 544 "yacc.y" { code(bitand); ; break;} case 105: #line 545 "yacc.y" { code(bitor); ; break;} case 106: #line 546 "yacc.y" { code(rts); unmarkGarbage(yyvsp[-1].inst, progp); yyval.inst = code_eval(yyvsp[-1].inst, progp); inEVAL = 0; ; break;} case 107: #line 552 "yacc.y" { inEVAL = 1; ; break;} case 108: #line 554 "yacc.y" { yyval.inst = code2(jmp, 0); ; break;} case 109: #line 557 "yacc.y" { code(ddup); yyval.inst = code2(jpnt, 0); code(popd); ; break;} case 110: #line 563 "yacc.y" { code(ddup); yyval.inst = code2(jpnf, 0); code(popd); ; break;} case 114: #line 576 "yacc.y" { yyval.inst = code_related_by(yyvsp[-5].sym); ; break;} case 115: #line 578 "yacc.y" { yyval.inst = yyvsp[-1].inst; code(lookup_address); ; break;} case 116: #line 580 "yacc.y" { yyval.inst = code_related_by_runtimelhs(); ; break;} case 117: #line 584 "yacc.y" { addID((symptr) 0); ; break;} case 118: #line 588 "yacc.y" { informula = 0; code(rts); unmarkGarbage(yyvsp[-1].inst, progp); yyval.inst = code_definition( FORMULA, yyvsp[-3].sym, yyvsp[-1].inst, progp, 0, yyvsp[-2].tbegin); ; break;} case 119: #line 594 "yacc.y" { code(lookup_address); ; break;} case 120: #line 595 "yacc.y" { informula = 0; code(rts); unmarkGarbage(yyvsp[-1].inst, progp); yyval.inst = code_definition_runtimelhs( FORMULA, yyvsp[-1].inst, progp, 0, yyvsp[-2].tbegin); ; break;} case 121: #line 603 "yacc.y" { yyval.tbegin = textptr; informula = 1; addID((symptr) 0); ; break;} case 122: #line 610 "yacc.y" { inprocmacro = (yyvsp[-1].narg == 2); /*fprintf(stderr, "inprocmacro=%d\n", inprocmacro);*/ addID((symptr) 0); ; break;} case 123: #line 619 "yacc.y" { code2(pushUNDEF, rts); unmarkGarbage(yyvsp[-1].inst, progp); yyval.inst = code_definition( (yyvsp[-8].narg ? ((yyvsp[-8].narg == 1) ? FUNCTION : PROCMACRO) : PROCEDURE), yyvsp[-7].sym, yyvsp[-1].inst, progp, yyvsp[-2].narg, yyvsp[-4].tbegin ); delete_local_level(yyvsp[0].narg); inprocmacro = 0; ; break;} case 124: #line 632 "yacc.y" { yyval.narg = 1; ; break;} case 125: #line 633 "yacc.y" { yyval.narg = 0; ; break;} case 126: #line 634 "yacc.y" { yyval.narg = 2; ; break;} case 127: #line 638 "yacc.y" { static char c = '{'; if (indef) yyval.tbegin = textptr - 1; else { yyval.tbegin = textptr; push_text(&c,1); } insert_level_marker(++indef); ; break;} case 128: #line 651 "yacc.y" { yyval.narg = indef--; ; break;} case 129: #line 656 "yacc.y" { yyval.narg = 0; ; break;} case 130: #line 657 "yacc.y" { yyval.narg = yyvsp[0].narg; ; break;} case 131: #line 662 "yacc.y" { yyval.narg = 0; ; break;} case 133: #line 667 "yacc.y" { yyval.narg = 1; addID(yyvsp[0].sym); ; break;} case 134: #line 668 "yacc.y" { yyval.narg = yyvsp[-2].narg + 1; addID(yyvsp[0].sym); ; break;} case 136: #line 672 "yacc.y" { inpara = 1; ; break;} case 137: #line 673 "yacc.y" { inpara = 0; ; break;} case 138: #line 677 "yacc.y" { yyval.narg = 0; ; break;} case 139: #line 679 "yacc.y" { inauto = 1; ; break;} case 140: #line 680 "yacc.y" { inauto = 0; yyval.narg = yyvsp[-4].narg + yyvsp[-1].narg; ; break;} case 141: #line 684 "yacc.y" { yyval.narg = 1; ; break;} case 142: #line 685 "yacc.y" { yyval.narg = yyvsp[-2].narg + 1; ; break;} case 143: #line 688 "yacc.y" { yyval.narg = 0; ; break;} case 145: #line 693 "yacc.y" { yyval.narg = 1; ; break;} case 146: #line 694 "yacc.y" { yyval.narg = yyvsp[-2].narg + 1; ; break;} } /* the action file gets copied in in place of this dollarsign */ /* MODIFICATION 9: same as MODIFICATION 1 * #line 543 "/usr/local/share/bison.simple" */ #line 617 "bison/bison.simple" /* END MODIFICATION 9 */ yyvsp -= yylen; yyssp -= yylen; #ifdef YYLSP_NEEDED yylsp -= yylen; #endif #if YYDEBUG != 0 if (yydebug) { short *ssp1 = yyss - 1; fprintf (stderr, "state stack now"); while (ssp1 != yyssp) fprintf (stderr, " %d", *++ssp1); fprintf (stderr, "\n"); } #endif *++yyvsp = yyval; #ifdef YYLSP_NEEDED yylsp++; if (yylen == 0) { yylsp->first_line = yylloc.first_line; yylsp->first_column = yylloc.first_column; yylsp->last_line = (yylsp-1)->last_line; yylsp->last_column = (yylsp-1)->last_column; yylsp->text = 0; } else { yylsp->last_line = (yylsp+yylen-1)->last_line; yylsp->last_column = (yylsp+yylen-1)->last_column; } #endif /* Now "shift" the result of the reduction. Determine what state that goes to, based on the state we popped back to and the rule number reduced by. */ yyn = yyr1[yyn]; yystate = yypgoto[yyn - YYNTBASE] + *yyssp; if (yystate >= 0 && yystate <= YYLAST && yycheck[yystate] == *yyssp) yystate = yytable[yystate]; else yystate = yydefgoto[yyn - YYNTBASE]; goto yynewstate; yyerrlab: /* here on detecting error */ if (! yyerrstatus) /* If not already recovering from an error, report this error. */ { ++yynerrs; #ifdef YYERROR_VERBOSE yyn = yypact[yystate]; if (yyn > YYFLAG && yyn < YYLAST) { int size = 0; char *msg; int x, count; count = 0; /* Start X at -yyn if nec to avoid negative indexes in yycheck. */ for (x = (yyn < 0 ? -yyn : 0); x < (sizeof(yytname) / sizeof(char *)); x++) if (yycheck[x + yyn] == x) size += strlen(yytname[x]) + 15, count++; /* MODIFICATION 10: increase space for error message * msg = (char *) malloc(size + 15); */ msg = (char *) malloc(size + 100); /* END MODIFICATION 10 */ if (msg != 0) { strcpy(msg, "parse error"); /* MODIFICATION 11: print expected even when there are > 5 expected, * and print what was encountered * if (count < 5) */ sprintf(msg + strlen(msg), ", encountered `%s'", yytname[yychar1]); if (1) /* END MODIFICATION 11 */ { count = 0; for (x = (yyn < 0 ? -yyn : 0); x < (sizeof(yytname) / sizeof(char *)); x++) if (yycheck[x + yyn] == x) { /* MODIFICATION 12: indicate when there are > 5 expected but not printed */ if (count > 5) count++; else { /* END MODIFICATION 12 */ strcat(msg, count == 0 ? ", expecting `" : " or `"); strcat(msg, yytname[x]); strcat(msg, "'"); count++; /* MODIFICATION 13: indicate when there are > 5 expected but not printed * } */ } } if (count > 5) { sprintf(msg + strlen(msg), " or... (%d other possibilities)", count - 6); } /* END MODIFICATION 13 */ } yyerror(msg); free(msg); } else yyerror ("parse error; also virtual memory exceeded"); } else #endif /* YYERROR_VERBOSE */ yyerror("parse error"); } goto yyerrlab1; yyerrlab1: /* here on error raised explicitly by an action */ if (yyerrstatus == 3) { /* if just tried and failed to reuse lookahead token after an error, discard it. */ /* return failure if at end of input */ if (yychar == YYEOF) YYABORT; #if YYDEBUG != 0 if (yydebug) fprintf(stderr, "Discarding token %d (%s).\n", yychar, yytname[yychar1]); #endif yychar = YYEMPTY; } /* Else will try to reuse lookahead token after shifting the error token. */ yyerrstatus = 3; /* Each real token shifted decrements this */ goto yyerrhandle; yyerrdefault: /* current state does not do anything special for the error token. */ #if 0 /* This is wrong; only states that explicitly want error tokens should shift them. */ yyn = yydefact[yystate]; /* If its default is to accept any token, ok. Otherwise pop it.*/ if (yyn) goto yydefault; #endif yyerrpop: /* pop the current state because it cannot handle the error token */ if (yyssp == yyss) YYABORT; yyvsp--; yystate = *--yyssp; #ifdef YYLSP_NEEDED yylsp--; #endif #if YYDEBUG != 0 if (yydebug) { short *ssp1 = yyss - 1; fprintf (stderr, "Error: state stack now"); while (ssp1 != yyssp) fprintf (stderr, " %d", *++ssp1); fprintf (stderr, "\n"); } #endif yyerrhandle: yyn = yypact[yystate]; if (yyn == YYFLAG) goto yyerrdefault; yyn += YYTERROR; if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != YYTERROR) goto yyerrdefault; yyn = yytable[yyn]; if (yyn < 0) { if (yyn == YYFLAG) goto yyerrpop; yyn = -yyn; goto yyreduce; } else if (yyn == 0) goto yyerrpop; if (yyn == YYFINAL) YYACCEPT; #if YYDEBUG != 0 if (yydebug) fprintf(stderr, "Shifting error token, "); #endif *++yyvsp = yylval; #ifdef YYLSP_NEEDED *++yylsp = yylloc; #endif yystate = yyn; goto yynewstate; yyacceptlab: /* YYACCEPT comes here. */ if (yyfree_stacks) { free (yyss); free (yyvs); #ifdef YYLSP_NEEDED free (yyls); #endif } return 0; yyabortlab: /* YYABORT comes here. */ if (yyfree_stacks) { free (yyss); free (yyvs); #ifdef YYLSP_NEEDED free (yyls); #endif } return 1; } #line 696 "yacc.y" /*----------------------- end of grammar --------------------------*/ break;} case 99: #line 531 "yacc.y" { fromto(yyvsp[-3].itkeden1.41/Eden/yacc.h010060000025250000164000000025650745661043600146000ustar00ashleyem00003510000005typedef union { Datum *dp; /* constants */ symptr sym; /* symbol table ptr */ Inst *inst; /* machine instruction */ Int narg; /* number of arguments */ Inst fun; /* binop */ struct t *sw; /* switch */ char *tbegin; /* beginning of text */ } YYSTYPE; #define UNDEF 257 #define REAL 258 #define INTEGER 259 #define MYCHAR 260 #define STRING 261 #define LIST 262 #define CONSTANT 263 #define VAR 264 #define FORMULA 265 #define BLTIN 266 #define LIB 267 #define RLIB 268 #define FUNC 269 #define PROC 270 #define PMAC 271 #define FUNCTION 272 #define PROCEDURE 273 #define PROCMACRO 274 #define AUTO 275 #define PARA 276 #define LOCAL 277 #define BREAK 278 #define CONTINUE 279 #define SWITCH 280 #define CASE 281 #define DEFAULT 282 #define DO 283 #define FOR 284 #define WHILE 285 #define IF 286 #define ELSE 287 #define SHIFT 288 #define APPEND 289 #define INSERT 290 #define DELETE 291 #define RETURN 292 #define ARG 293 #define IS 294 #define TILDE_GT 295 #define PLUS_EQ 296 #define MINUS_EQ 297 #define OR 298 #define LAZY_OR 299 #define AND 300 #define LAZY_AND 301 #define BITAND 302 #define BITOR 303 #define EQ_EQ 304 #define NOT_EQ 305 #define GT_EQ 306 #define LT_EQ 307 #define SLASH_SLASH 308 #define NEGATE 309 #define NOT 310 #define PLUS_PLUS 311 #define MINUS_MINUS 312 #define ASTERISK 313 #define EVAL 314 extern YYSTYPE yylval; tkeden1.41/Eden/yacc.output010060000025250000164000007175130745661043600157170ustar00ashleyem00003510000005 Terminals which are not used: UNDEF REAL INTEGER MYCHAR STRING LIST Conflict in state 82 between rule 95 and token '?' resolved as reduce. Conflict in state 82 between rule 95 and token OR resolved as reduce. Conflict in state 82 between rule 95 and token LAZY_OR resolved as reduce. Conflict in state 82 between rule 95 and token AND resolved as reduce. Conflict in state 82 between rule 95 and token LAZY_AND resolved as reduce. Conflict in state 82 between rule 95 and token BITAND resolved as reduce. Conflict in state 82 between rule 95 and token BITOR resolved as reduce. Conflict in state 82 between rule 95 and token EQ_EQ resolved as reduce. Conflict in state 82 between rule 95 and token NOT_EQ resolved as reduce. Conflict in state 82 between rule 95 and token '>' resolved as reduce. Conflict in state 82 between rule 95 and token GT_EQ resolved as reduce. Conflict in state 82 between rule 95 and token '<' resolved as reduce. Conflict in state 82 between rule 95 and token LT_EQ resolved as reduce. Conflict in state 82 between rule 95 and token '+' resolved as reduce. Conflict in state 82 between rule 95 and token '-' resolved as reduce. Conflict in state 82 between rule 95 and token SLASH_SLASH resolved as reduce. Conflict in state 82 between rule 95 and token '*' resolved as reduce. Conflict in state 82 between rule 95 and token '/' resolved as reduce. Conflict in state 82 between rule 95 and token '%' resolved as reduce. Conflict in state 82 between rule 95 and token '#' resolved as an error. Conflict in state 86 between rule 98 and token '?' resolved as reduce. Conflict in state 86 between rule 98 and token OR resolved as reduce. Conflict in state 86 between rule 98 and token LAZY_OR resolved as reduce. Conflict in state 86 between rule 98 and token AND resolved as reduce. Conflict in state 86 between rule 98 and token LAZY_AND resolved as reduce. Conflict in state 86 between rule 98 and token BITAND resolved as reduce. Conflict in state 86 between rule 98 and token BITOR resolved as reduce. Conflict in state 86 between rule 98 and token EQ_EQ resolved as reduce. Conflict in state 86 between rule 98 and token NOT_EQ resolved as reduce. Conflict in state 86 between rule 98 and token '>' resolved as reduce. Conflict in state 86 between rule 98 and token GT_EQ resolved as reduce. Conflict in state 86 between rule 98 and token '<' resolved as reduce. Conflict in state 86 between rule 98 and token LT_EQ resolved as reduce. Conflict in state 86 between rule 98 and token '+' resolved as reduce. Conflict in state 86 between rule 98 and token '-' resolved as reduce. Conflict in state 86 between rule 98 and token SLASH_SLASH resolved as reduce. Conflict in state 86 between rule 98 and token '*' resolved as reduce. Conflict in state 86 between rule 98 and token '/' resolved as reduce. Conflict in state 86 between rule 98 and token '%' resolved as reduce. Conflict in state 86 between rule 98 and token '#' resolved as an error. Conflict in state 87 between rule 97 and token '?' resolved as reduce. Conflict in state 87 between rule 97 and token OR resolved as reduce. Conflict in state 87 between rule 97 and token LAZY_OR resolved as reduce. Conflict in state 87 between rule 97 and token AND resolved as reduce. Conflict in state 87 between rule 97 and token LAZY_AND resolved as reduce. Conflict in state 87 between rule 97 and token BITAND resolved as reduce. Conflict in state 87 between rule 97 and token BITOR resolved as reduce. Conflict in state 87 between rule 97 and token EQ_EQ resolved as reduce. Conflict in state 87 between rule 97 and token NOT_EQ resolved as reduce. Conflict in state 87 between rule 97 and token '>' resolved as reduce. Conflict in state 87 between rule 97 and token GT_EQ resolved as reduce. Conflict in state 87 between rule 97 and token '<' resolved as reduce. Conflict in state 87 between rule 97 and token LT_EQ resolved as reduce. Conflict in state 87 between rule 97 and token '+' resolved as reduce. Conflict in state 87 between rule 97 and token '-' resolved as reduce. Conflict in state 87 between rule 97 and token SLASH_SLASH resolved as reduce. Conflict in state 87 between rule 97 and token '*' resolved as reduce. Conflict in state 87 between rule 97 and token '/' resolved as reduce. Conflict in state 87 between rule 97 and token '%' resolved as reduce. Conflict in state 87 between rule 97 and token '#' resolved as an error. Conflict in state 159 between rule 13 and token '?' resolved as shift. Conflict in state 159 between rule 13 and token OR resolved as shift. Conflict in state 159 between rule 13 and token LAZY_OR resolved as shift. Conflict in state 159 between rule 13 and token AND resolved as shift. Conflict in state 159 between rule 13 and token LAZY_AND resolved as shift. Conflict in state 159 between rule 13 and token BITAND resolved as shift. Conflict in state 159 between rule 13 and token BITOR resolved as shift. Conflict in state 159 between rule 13 and token EQ_EQ resolved as shift. Conflict in state 159 between rule 13 and token NOT_EQ resolved as shift. Conflict in state 159 between rule 13 and token '>' resolved as shift. Conflict in state 159 between rule 13 and token GT_EQ resolved as shift. Conflict in state 159 between rule 13 and token '<' resolved as shift. Conflict in state 159 between rule 13 and token LT_EQ resolved as shift. Conflict in state 159 between rule 13 and token '+' resolved as shift. Conflict in state 159 between rule 13 and token '-' resolved as shift. Conflict in state 159 between rule 13 and token SLASH_SLASH resolved as shift. Conflict in state 159 between rule 13 and token '*' resolved as shift. Conflict in state 159 between rule 13 and token '/' resolved as shift. Conflict in state 159 between rule 13 and token '%' resolved as shift. Conflict in state 159 between rule 13 and token '#' resolved as shift. Conflict in state 160 between rule 14 and token '?' resolved as shift. Conflict in state 160 between rule 14 and token OR resolved as shift. Conflict in state 160 between rule 14 and token LAZY_OR resolved as shift. Conflict in state 160 between rule 14 and token AND resolved as shift. Conflict in state 160 between rule 14 and token LAZY_AND resolved as shift. Conflict in state 160 between rule 14 and token BITAND resolved as shift. Conflict in state 160 between rule 14 and token BITOR resolved as shift. Conflict in state 160 between rule 14 and token EQ_EQ resolved as shift. Conflict in state 160 between rule 14 and token NOT_EQ resolved as shift. Conflict in state 160 between rule 14 and token '>' resolved as shift. Conflict in state 160 between rule 14 and token GT_EQ resolved as shift. Conflict in state 160 between rule 14 and token '<' resolved as shift. Conflict in state 160 between rule 14 and token LT_EQ resolved as shift. Conflict in state 160 between rule 14 and token '+' resolved as shift. Conflict in state 160 between rule 14 and token '-' resolved as shift. Conflict in state 160 between rule 14 and token SLASH_SLASH resolved as shift. Conflict in state 160 between rule 14 and token '*' resolved as shift. Conflict in state 160 between rule 14 and token '/' resolved as shift. Conflict in state 160 between rule 14 and token '%' resolved as shift. Conflict in state 160 between rule 14 and token '#' resolved as shift. Conflict in state 161 between rule 15 and token '?' resolved as shift. Conflict in state 161 between rule 15 and token OR resolved as shift. Conflict in state 161 between rule 15 and token LAZY_OR resolved as shift. Conflict in state 161 between rule 15 and token AND resolved as shift. Conflict in state 161 between rule 15 and token LAZY_AND resolved as shift. Conflict in state 161 between rule 15 and token BITAND resolved as shift. Conflict in state 161 between rule 15 and token BITOR resolved as shift. Conflict in state 161 between rule 15 and token EQ_EQ resolved as shift. Conflict in state 161 between rule 15 and token NOT_EQ resolved as shift. Conflict in state 161 between rule 15 and token '>' resolved as shift. Conflict in state 161 between rule 15 and token GT_EQ resolved as shift. Conflict in state 161 between rule 15 and token '<' resolved as shift. Conflict in state 161 between rule 15 and token LT_EQ resolved as shift. Conflict in state 161 between rule 15 and token '+' resolved as shift. Conflict in state 161 between rule 15 and token '-' resolved as shift. Conflict in state 161 between rule 15 and token SLASH_SLASH resolved as shift. Conflict in state 161 between rule 15 and token '*' resolved as shift. Conflict in state 161 between rule 15 and token '/' resolved as shift. Conflict in state 161 between rule 15 and token '%' resolved as shift. Conflict in state 161 between rule 15 and token '#' resolved as shift. Conflict in state 176 between rule 101 and token '?' resolved as reduce. Conflict in state 176 between rule 101 and token OR resolved as reduce. Conflict in state 176 between rule 101 and token LAZY_OR resolved as reduce. Conflict in state 176 between rule 101 and token AND resolved as shift. Conflict in state 176 between rule 101 and token LAZY_AND resolved as shift. Conflict in state 176 between rule 101 and token BITAND resolved as shift. Conflict in state 176 between rule 101 and token BITOR resolved as shift. Conflict in state 176 between rule 101 and token EQ_EQ resolved as shift. Conflict in state 176 between rule 101 and token NOT_EQ resolved as shift. Conflict in state 176 between rule 101 and token '>' resolved as shift. Conflict in state 176 between rule 101 and token GT_EQ resolved as shift. Conflict in state 176 between rule 101 and token '<' resolved as shift. Conflict in state 176 between rule 101 and token LT_EQ resolved as shift. Conflict in state 176 between rule 101 and token '+' resolved as shift. Conflict in state 176 between rule 101 and token '-' resolved as shift. Conflict in state 176 between rule 101 and token SLASH_SLASH resolved as shift. Conflict in state 176 between rule 101 and token '*' resolved as shift. Conflict in state 176 between rule 101 and token '/' resolved as shift. Conflict in state 176 between rule 101 and token '%' resolved as shift. Conflict in state 176 between rule 101 and token '#' resolved as shift. Conflict in state 177 between rule 100 and token '?' resolved as reduce. Conflict in state 177 between rule 100 and token OR resolved as reduce. Conflict in state 177 between rule 100 and token LAZY_OR resolved as reduce. Conflict in state 177 between rule 100 and token AND resolved as reduce. Conflict in state 177 between rule 100 and token LAZY_AND resolved as reduce. Conflict in state 177 between rule 100 and token BITAND resolved as shift. Conflict in state 177 between rule 100 and token BITOR resolved as shift. Conflict in state 177 between rule 100 and token EQ_EQ resolved as shift. Conflict in state 177 between rule 100 and token NOT_EQ resolved as shift. Conflict in state 177 between rule 100 and token '>' resolved as shift. Conflict in state 177 between rule 100 and token GT_EQ resolved as shift. Conflict in state 177 between rule 100 and token '<' resolved as shift. Conflict in state 177 between rule 100 and token LT_EQ resolved as shift. Conflict in state 177 between rule 100 and token '+' resolved as shift. Conflict in state 177 between rule 100 and token '-' resolved as shift. Conflict in state 177 between rule 100 and token SLASH_SLASH resolved as shift. Conflict in state 177 between rule 100 and token '*' resolved as shift. Conflict in state 177 between rule 100 and token '/' resolved as shift. Conflict in state 177 between rule 100 and token '%' resolved as shift. Conflict in state 177 between rule 100 and token '#' resolved as shift. Conflict in state 178 between rule 104 and token '?' resolved as reduce. Conflict in state 178 between rule 104 and token OR resolved as reduce. Conflict in state 178 between rule 104 and token LAZY_OR resolved as reduce. Conflict in state 178 between rule 104 and token AND resolved as reduce. Conflict in state 178 between rule 104 and token LAZY_AND resolved as reduce. Conflict in state 178 between rule 104 and token BITAND resolved as reduce. Conflict in state 178 between rule 104 and token BITOR resolved as reduce. Conflict in state 178 between rule 104 and token EQ_EQ resolved as shift. Conflict in state 178 between rule 104 and token NOT_EQ resolved as shift. Conflict in state 178 between rule 104 and token '>' resolved as shift. Conflict in state 178 between rule 104 and token GT_EQ resolved as shift. Conflict in state 178 between rule 104 and token '<' resolved as shift. Conflict in state 178 between rule 104 and token LT_EQ resolved as shift. Conflict in state 178 between rule 104 and token '+' resolved as shift. Conflict in state 178 between rule 104 and token '-' resolved as shift. Conflict in state 178 between rule 104 and token SLASH_SLASH resolved as shift. Conflict in state 178 between rule 104 and token '*' resolved as shift. Conflict in state 178 between rule 104 and token '/' resolved as shift. Conflict in state 178 between rule 104 and token '%' resolved as shift. Conflict in state 178 between rule 104 and token '#' resolved as shift. Conflict in state 179 between rule 105 and token '?' resolved as reduce. Conflict in state 179 between rule 105 and token OR resolved as reduce. Conflict in state 179 between rule 105 and token LAZY_OR resolved as reduce. Conflict in state 179 between rule 105 and token AND resolved as reduce. Conflict in state 179 between rule 105 and token LAZY_AND resolved as reduce. Conflict in state 179 between rule 105 and token BITAND resolved as reduce. Conflict in state 179 between rule 105 and token BITOR resolved as reduce. Conflict in state 179 between rule 105 and token EQ_EQ resolved as shift. Conflict in state 179 between rule 105 and token NOT_EQ resolved as shift. Conflict in state 179 between rule 105 and token '>' resolved as shift. Conflict in state 179 between rule 105 and token GT_EQ resolved as shift. Conflict in state 179 between rule 105 and token '<' resolved as shift. Conflict in state 179 between rule 105 and token LT_EQ resolved as shift. Conflict in state 179 between rule 105 and token '+' resolved as shift. Conflict in state 179 between rule 105 and token '-' resolved as shift. Conflict in state 179 between rule 105 and token SLASH_SLASH resolved as shift. Conflict in state 179 between rule 105 and token '*' resolved as shift. Conflict in state 179 between rule 105 and token '/' resolved as shift. Conflict in state 179 between rule 105 and token '%' resolved as shift. Conflict in state 179 between rule 105 and token '#' resolved as shift. Conflict in state 180 between rule 91 and token '?' resolved as reduce. Conflict in state 180 between rule 91 and token OR resolved as reduce. Conflict in state 180 between rule 91 and token LAZY_OR resolved as reduce. Conflict in state 180 between rule 91 and token AND resolved as reduce. Conflict in state 180 between rule 91 and token LAZY_AND resolved as reduce. Conflict in state 180 between rule 91 and token BITAND resolved as reduce. Conflict in state 180 between rule 91 and token BITOR resolved as reduce. Conflict in state 180 between rule 91 and token EQ_EQ resolved as reduce. Conflict in state 180 between rule 91 and token NOT_EQ resolved as reduce. Conflict in state 180 between rule 91 and token '>' resolved as shift. Conflict in state 180 between rule 91 and token GT_EQ resolved as shift. Conflict in state 180 between rule 91 and token '<' resolved as shift. Conflict in state 180 between rule 91 and token LT_EQ resolved as shift. Conflict in state 180 between rule 91 and token '+' resolved as shift. Conflict in state 180 between rule 91 and token '-' resolved as shift. Conflict in state 180 between rule 91 and token SLASH_SLASH resolved as shift. Conflict in state 180 between rule 91 and token '*' resolved as shift. Conflict in state 180 between rule 91 and token '/' resolved as shift. Conflict in state 180 between rule 91 and token '%' resolved as shift. Conflict in state 180 between rule 91 and token '#' resolved as shift. Conflict in state 181 between rule 92 and token '?' resolved as reduce. Conflict in state 181 between rule 92 and token OR resolved as reduce. Conflict in state 181 between rule 92 and token LAZY_OR resolved as reduce. Conflict in state 181 between rule 92 and token AND resolved as reduce. Conflict in state 181 between rule 92 and token LAZY_AND resolved as reduce. Conflict in state 181 between rule 92 and token BITAND resolved as reduce. Conflict in state 181 between rule 92 and token BITOR resolved as reduce. Conflict in state 181 between rule 92 and token EQ_EQ resolved as reduce. Conflict in state 181 between rule 92 and token NOT_EQ resolved as reduce. Conflict in state 181 between rule 92 and token '>' resolved as shift. Conflict in state 181 between rule 92 and token GT_EQ resolved as shift. Conflict in state 181 between rule 92 and token '<' resolved as shift. Conflict in state 181 between rule 92 and token LT_EQ resolved as shift. Conflict in state 181 between rule 92 and token '+' resolved as shift. Conflict in state 181 between rule 92 and token '-' resolved as shift. Conflict in state 181 between rule 92 and token SLASH_SLASH resolved as shift. Conflict in state 181 between rule 92 and token '*' resolved as shift. Conflict in state 181 between rule 92 and token '/' resolved as shift. Conflict in state 181 between rule 92 and token '%' resolved as shift. Conflict in state 181 between rule 92 and token '#' resolved as shift. Conflict in state 182 between rule 87 and token '?' resolved as reduce. Conflict in state 182 between rule 87 and token OR resolved as reduce. Conflict in state 182 between rule 87 and token LAZY_OR resolved as reduce. Conflict in state 182 between rule 87 and token AND resolved as reduce. Conflict in state 182 between rule 87 and token LAZY_AND resolved as reduce. Conflict in state 182 between rule 87 and token BITAND resolved as reduce. Conflict in state 182 between rule 87 and token BITOR resolved as reduce. Conflict in state 182 between rule 87 and token EQ_EQ resolved as reduce. Conflict in state 182 between rule 87 and token NOT_EQ resolved as reduce. Conflict in state 182 between rule 87 and token '>' resolved as reduce. Conflict in state 182 between rule 87 and token GT_EQ resolved as reduce. Conflict in state 182 between rule 87 and token '<' resolved as reduce. Conflict in state 182 between rule 87 and token LT_EQ resolved as reduce. Conflict in state 182 between rule 87 and token '+' resolved as shift. Conflict in state 182 between rule 87 and token '-' resolved as shift. Conflict in state 182 between rule 87 and token SLASH_SLASH resolved as shift. Conflict in state 182 between rule 87 and token '*' resolved as shift. Conflict in state 182 between rule 87 and token '/' resolved as shift. Conflict in state 182 between rule 87 and token '%' resolved as shift. Conflict in state 182 between rule 87 and token '#' resolved as shift. Conflict in state 183 between rule 88 and token '?' resolved as reduce. Conflict in state 183 between rule 88 and token OR resolved as reduce. Conflict in state 183 between rule 88 and token LAZY_OR resolved as reduce. Conflict in state 183 between rule 88 and token AND resolved as reduce. Conflict in state 183 between rule 88 and token LAZY_AND resolved as reduce. Conflict in state 183 between rule 88 and token BITAND resolved as reduce. Conflict in state 183 between rule 88 and token BITOR resolved as reduce. Conflict in state 183 between rule 88 and token EQ_EQ resolved as reduce. Conflict in state 183 between rule 88 and token NOT_EQ resolved as reduce. Conflict in state 183 between rule 88 and token '>' resolved as reduce. Conflict in state 183 between rule 88 and token GT_EQ resolved as reduce. Conflict in state 183 between rule 88 and token '<' resolved as reduce. Conflict in state 183 between rule 88 and token LT_EQ resolved as reduce. Conflict in state 183 between rule 88 and token '+' resolved as shift. Conflict in state 183 between rule 88 and token '-' resolved as shift. Conflict in state 183 between rule 88 and token SLASH_SLASH resolved as shift. Conflict in state 183 between rule 88 and token '*' resolved as shift. Conflict in state 183 between rule 88 and token '/' resolved as shift. Conflict in state 183 between rule 88 and token '%' resolved as shift. Conflict in state 183 between rule 88 and token '#' resolved as shift. Conflict in state 184 between rule 89 and token '?' resolved as reduce. Conflict in state 184 between rule 89 and token OR resolved as reduce. Conflict in state 184 between rule 89 and token LAZY_OR resolved as reduce. Conflict in state 184 between rule 89 and token AND resolved as reduce. Conflict in state 184 between rule 89 and token LAZY_AND resolved as reduce. Conflict in state 184 between rule 89 and token BITAND resolved as reduce. Conflict in state 184 between rule 89 and token BITOR resolved as reduce. Conflict in state 184 between rule 89 and token EQ_EQ resolved as reduce. Conflict in state 184 between rule 89 and token NOT_EQ resolved as reduce. Conflict in state 184 between rule 89 and token '>' resolved as reduce. Conflict in state 184 between rule 89 and token GT_EQ resolved as reduce. Conflict in state 184 between rule 89 and token '<' resolved as reduce. Conflict in state 184 between rule 89 and token LT_EQ resolved as reduce. Conflict in state 184 between rule 89 and token '+' resolved as shift. Conflict in state 184 between rule 89 and token '-' resolved as shift. Conflict in state 184 between rule 89 and token SLASH_SLASH resolved as shift. Conflict in state 184 between rule 89 and token '*' resolved as shift. Conflict in state 184 between rule 89 and token '/' resolved as shift. Conflict in state 184 between rule 89 and token '%' resolved as shift. Conflict in state 184 between rule 89 and token '#' resolved as shift. Conflict in state 185 between rule 90 and token '?' resolved as reduce. Conflict in state 185 between rule 90 and token OR resolved as reduce. Conflict in state 185 between rule 90 and token LAZY_OR resolved as reduce. Conflict in state 185 between rule 90 and token AND resolved as reduce. Conflict in state 185 between rule 90 and token LAZY_AND resolved as reduce. Conflict in state 185 between rule 90 and token BITAND resolved as reduce. Conflict in state 185 between rule 90 and token BITOR resolved as reduce. Conflict in state 185 between rule 90 and token EQ_EQ resolved as reduce. Conflict in state 185 between rule 90 and token NOT_EQ resolved as reduce. Conflict in state 185 between rule 90 and token '>' resolved as reduce. Conflict in state 185 between rule 90 and token GT_EQ resolved as reduce. Conflict in state 185 between rule 90 and token '<' resolved as reduce. Conflict in state 185 between rule 90 and token LT_EQ resolved as reduce. Conflict in state 185 between rule 90 and token '+' resolved as shift. Conflict in state 185 between rule 90 and token '-' resolved as shift. Conflict in state 185 between rule 90 and token SLASH_SLASH resolved as shift. Conflict in state 185 between rule 90 and token '*' resolved as shift. Conflict in state 185 between rule 90 and token '/' resolved as shift. Conflict in state 185 between rule 90 and token '%' resolved as shift. Conflict in state 185 between rule 90 and token '#' resolved as shift. Conflict in state 186 between rule 81 and token '?' resolved as reduce. Conflict in state 186 between rule 81 and token OR resolved as reduce. Conflict in state 186 between rule 81 and token LAZY_OR resolved as reduce. Conflict in state 186 between rule 81 and token AND resolved as reduce. Conflict in state 186 between rule 81 and token LAZY_AND resolved as reduce. Conflict in state 186 between rule 81 and token BITAND resolved as reduce. Conflict in state 186 between rule 81 and token BITOR resolved as reduce. Conflict in state 186 between rule 81 and token EQ_EQ resolved as reduce. Conflict in state 186 between rule 81 and token NOT_EQ resolved as reduce. Conflict in state 186 between rule 81 and token '>' resolved as reduce. Conflict in state 186 between rule 81 and token GT_EQ resolved as reduce. Conflict in state 186 between rule 81 and token '<' resolved as reduce. Conflict in state 186 between rule 81 and token LT_EQ resolved as reduce. Conflict in state 186 between rule 81 and token '+' resolved as reduce. Conflict in state 186 between rule 81 and token '-' resolved as reduce. Conflict in state 186 between rule 81 and token SLASH_SLASH resolved as reduce. Conflict in state 186 between rule 81 and token '*' resolved as shift. Conflict in state 186 between rule 81 and token '/' resolved as shift. Conflict in state 186 between rule 81 and token '%' resolved as shift. Conflict in state 186 between rule 81 and token '#' resolved as shift. Conflict in state 187 between rule 82 and token '?' resolved as reduce. Conflict in state 187 between rule 82 and token OR resolved as reduce. Conflict in state 187 between rule 82 and token LAZY_OR resolved as reduce. Conflict in state 187 between rule 82 and token AND resolved as reduce. Conflict in state 187 between rule 82 and token LAZY_AND resolved as reduce. Conflict in state 187 between rule 82 and token BITAND resolved as reduce. Conflict in state 187 between rule 82 and token BITOR resolved as reduce. Conflict in state 187 between rule 82 and token EQ_EQ resolved as reduce. Conflict in state 187 between rule 82 and token NOT_EQ resolved as reduce. Conflict in state 187 between rule 82 and token '>' resolved as reduce. Conflict in state 187 between rule 82 and token GT_EQ resolved as reduce. Conflict in state 187 between rule 82 and token '<' resolved as reduce. Conflict in state 187 between rule 82 and token LT_EQ resolved as reduce. Conflict in state 187 between rule 82 and token '+' resolved as reduce. Conflict in state 187 between rule 82 and token '-' resolved as reduce. Conflict in state 187 between rule 82 and token SLASH_SLASH resolved as reduce. Conflict in state 187 between rule 82 and token '*' resolved as shift. Conflict in state 187 between rule 82 and token '/' resolved as shift. Conflict in state 187 between rule 82 and token '%' resolved as shift. Conflict in state 187 between rule 82 and token '#' resolved as shift. Conflict in state 188 between rule 86 and token '?' resolved as reduce. Conflict in state 188 between rule 86 and token OR resolved as reduce. Conflict in state 188 between rule 86 and token LAZY_OR resolved as reduce. Conflict in state 188 between rule 86 and token AND resolved as reduce. Conflict in state 188 between rule 86 and token LAZY_AND resolved as reduce. Conflict in state 188 between rule 86 and token BITAND resolved as reduce. Conflict in state 188 between rule 86 and token BITOR resolved as reduce. Conflict in state 188 between rule 86 and token EQ_EQ resolved as reduce. Conflict in state 188 between rule 86 and token NOT_EQ resolved as reduce. Conflict in state 188 between rule 86 and token '>' resolved as reduce. Conflict in state 188 between rule 86 and token GT_EQ resolved as reduce. Conflict in state 188 between rule 86 and token '<' resolved as reduce. Conflict in state 188 between rule 86 and token LT_EQ resolved as reduce. Conflict in state 188 between rule 86 and token '+' resolved as reduce. Conflict in state 188 between rule 86 and token '-' resolved as reduce. Conflict in state 188 between rule 86 and token SLASH_SLASH resolved as reduce. Conflict in state 188 between rule 86 and token '*' resolved as shift. Conflict in state 188 between rule 86 and token '/' resolved as shift. Conflict in state 188 between rule 86 and token '%' resolved as shift. Conflict in state 188 between rule 86 and token '#' resolved as shift. Conflict in state 189 between rule 83 and token '?' resolved as reduce. Conflict in state 189 between rule 83 and token OR resolved as reduce. Conflict in state 189 between rule 83 and token LAZY_OR resolved as reduce. Conflict in state 189 between rule 83 and token AND resolved as reduce. Conflict in state 189 between rule 83 and token LAZY_AND resolved as reduce. Conflict in state 189 between rule 83 and token BITAND resolved as reduce. Conflict in state 189 between rule 83 and token BITOR resolved as reduce. Conflict in state 189 between rule 83 and token EQ_EQ resolved as reduce. Conflict in state 189 between rule 83 and token NOT_EQ resolved as reduce. Conflict in state 189 between rule 83 and token '>' resolved as reduce. Conflict in state 189 between rule 83 and token GT_EQ resolved as reduce. Conflict in state 189 between rule 83 and token '<' resolved as reduce. Conflict in state 189 between rule 83 and token LT_EQ resolved as reduce. Conflict in state 189 between rule 83 and token '+' resolved as reduce. Conflict in state 189 between rule 83 and token '-' resolved as reduce. Conflict in state 189 between rule 83 and token SLASH_SLASH resolved as reduce. Conflict in state 189 between rule 83 and token '*' resolved as reduce. Conflict in state 189 between rule 83 and token '/' resolved as reduce. Conflict in state 189 between rule 83 and token '%' resolved as reduce. Conflict in state 189 between rule 83 and token '#' resolved as shift. Conflict in state 190 between rule 84 and token '?' resolved as reduce. Conflict in state 190 between rule 84 and token OR resolved as reduce. Conflict in state 190 between rule 84 and token LAZY_OR resolved as reduce. Conflict in state 190 between rule 84 and token AND resolved as reduce. Conflict in state 190 between rule 84 and token LAZY_AND resolved as reduce. Conflict in state 190 between rule 84 and token BITAND resolved as reduce. Conflict in state 190 between rule 84 and token BITOR resolved as reduce. Conflict in state 190 between rule 84 and token EQ_EQ resolved as reduce. Conflict in state 190 between rule 84 and token NOT_EQ resolved as reduce. Conflict in state 190 between rule 84 and token '>' resolved as reduce. Conflict in state 190 between rule 84 and token GT_EQ resolved as reduce. Conflict in state 190 between rule 84 and token '<' resolved as reduce. Conflict in state 190 between rule 84 and token LT_EQ resolved as reduce. Conflict in state 190 between rule 84 and token '+' resolved as reduce. Conflict in state 190 between rule 84 and token '-' resolved as reduce. Conflict in state 190 between rule 84 and token SLASH_SLASH resolved as reduce. Conflict in state 190 between rule 84 and token '*' resolved as reduce. Conflict in state 190 between rule 84 and token '/' resolved as reduce. Conflict in state 190 between rule 84 and token '%' resolved as reduce. Conflict in state 190 between rule 84 and token '#' resolved as shift. Conflict in state 191 between rule 85 and token '?' resolved as reduce. Conflict in state 191 between rule 85 and token OR resolved as reduce. Conflict in state 191 between rule 85 and token LAZY_OR resolved as reduce. Conflict in state 191 between rule 85 and token AND resolved as reduce. Conflict in state 191 between rule 85 and token LAZY_AND resolved as reduce. Conflict in state 191 between rule 85 and token BITAND resolved as reduce. Conflict in state 191 between rule 85 and token BITOR resolved as reduce. Conflict in state 191 between rule 85 and token EQ_EQ resolved as reduce. Conflict in state 191 between rule 85 and token NOT_EQ resolved as reduce. Conflict in state 191 between rule 85 and token '>' resolved as reduce. Conflict in state 191 between rule 85 and token GT_EQ resolved as reduce. Conflict in state 191 between rule 85 and token '<' resolved as reduce. Conflict in state 191 between rule 85 and token LT_EQ resolved as reduce. Conflict in state 191 between rule 85 and token '+' resolved as reduce. Conflict in state 191 between rule 85 and token '-' resolved as reduce. Conflict in state 191 between rule 85 and token SLASH_SLASH resolved as reduce. Conflict in state 191 between rule 85 and token '*' resolved as reduce. Conflict in state 191 between rule 85 and token '/' resolved as reduce. Conflict in state 191 between rule 85 and token '%' resolved as reduce. Conflict in state 191 between rule 85 and token '#' resolved as shift. Conflict in state 192 between rule 102 and token '?' resolved as reduce. Conflict in state 192 between rule 102 and token OR resolved as reduce. Conflict in state 192 between rule 102 and token LAZY_OR resolved as reduce. Conflict in state 192 between rule 102 and token AND resolved as reduce. Conflict in state 192 between rule 102 and token LAZY_AND resolved as reduce. Conflict in state 192 between rule 102 and token BITAND resolved as shift. Conflict in state 192 between rule 102 and token BITOR resolved as shift. Conflict in state 192 between rule 102 and token EQ_EQ resolved as shift. Conflict in state 192 between rule 102 and token NOT_EQ resolved as shift. Conflict in state 192 between rule 102 and token '>' resolved as shift. Conflict in state 192 between rule 102 and token GT_EQ resolved as shift. Conflict in state 192 between rule 102 and token '<' resolved as shift. Conflict in state 192 between rule 102 and token LT_EQ resolved as shift. Conflict in state 192 between rule 102 and token '+' resolved as shift. Conflict in state 192 between rule 102 and token '-' resolved as shift. Conflict in state 192 between rule 102 and token SLASH_SLASH resolved as shift. Conflict in state 192 between rule 102 and token '*' resolved as shift. Conflict in state 192 between rule 102 and token '/' resolved as shift. Conflict in state 192 between rule 102 and token '%' resolved as shift. Conflict in state 192 between rule 102 and token '#' resolved as shift. Conflict in state 193 between rule 103 and token '?' resolved as reduce. Conflict in state 193 between rule 103 and token OR resolved as reduce. Conflict in state 193 between rule 103 and token LAZY_OR resolved as reduce. Conflict in state 193 between rule 103 and token AND resolved as shift. Conflict in state 193 between rule 103 and token LAZY_AND resolved as shift. Conflict in state 193 between rule 103 and token BITAND resolved as shift. Conflict in state 193 between rule 103 and token BITOR resolved as shift. Conflict in state 193 between rule 103 and token EQ_EQ resolved as shift. Conflict in state 193 between rule 103 and token NOT_EQ resolved as shift. Conflict in state 193 between rule 103 and token '>' resolved as shift. Conflict in state 193 between rule 103 and token GT_EQ resolved as shift. Conflict in state 193 between rule 103 and token '<' resolved as shift. Conflict in state 193 between rule 103 and token LT_EQ resolved as shift. Conflict in state 193 between rule 103 and token '+' resolved as shift. Conflict in state 193 between rule 103 and token '-' resolved as shift. Conflict in state 193 between rule 103 and token SLASH_SLASH resolved as shift. Conflict in state 193 between rule 103 and token '*' resolved as shift. Conflict in state 193 between rule 103 and token '/' resolved as shift. Conflict in state 193 between rule 103 and token '%' resolved as shift. Conflict in state 193 between rule 103 and token '#' resolved as shift. Conflict in state 246 between rule 17 and token '?' resolved as shift. Conflict in state 246 between rule 17 and token OR resolved as shift. Conflict in state 246 between rule 17 and token LAZY_OR resolved as shift. Conflict in state 246 between rule 17 and token AND resolved as shift. Conflict in state 246 between rule 17 and token LAZY_AND resolved as shift. Conflict in state 246 between rule 17 and token BITAND resolved as shift. Conflict in state 246 between rule 17 and token BITOR resolved as shift. Conflict in state 246 between rule 17 and token EQ_EQ resolved as shift. Conflict in state 246 between rule 17 and token NOT_EQ resolved as shift. Conflict in state 246 between rule 17 and token '>' resolved as shift. Conflict in state 246 between rule 17 and token GT_EQ resolved as shift. Conflict in state 246 between rule 17 and token '<' resolved as shift. Conflict in state 246 between rule 17 and token LT_EQ resolved as shift. Conflict in state 246 between rule 17 and token '+' resolved as shift. Conflict in state 246 between rule 17 and token '-' resolved as shift. Conflict in state 246 between rule 17 and token SLASH_SLASH resolved as shift. Conflict in state 246 between rule 17 and token '*' resolved as shift. Conflict in state 246 between rule 17 and token '/' resolved as shift. Conflict in state 246 between rule 17 and token '%' resolved as shift. Conflict in state 246 between rule 17 and token '#' resolved as shift. Conflict in state 253 between rule 99 and token '?' resolved as shift. Conflict in state 253 between rule 99 and token OR resolved as shift. Conflict in state 253 between rule 99 and token LAZY_OR resolved as shift. Conflict in state 253 between rule 99 and token AND resolved as shift. Conflict in state 253 between rule 99 and token LAZY_AND resolved as shift. Conflict in state 253 between rule 99 and token BITAND resolved as shift. Conflict in state 253 between rule 99 and token BITOR resolved as shift. Conflict in state 253 between rule 99 and token EQ_EQ resolved as shift. Conflict in state 253 between rule 99 and token NOT_EQ resolved as shift. Conflict in state 253 between rule 99 and token '>' resolved as shift. Conflict in state 253 between rule 99 and token GT_EQ resolved as shift. Conflict in state 253 between rule 99 and token '<' resolved as shift. Conflict in state 253 between rule 99 and token LT_EQ resolved as shift. Conflict in state 253 between rule 99 and token '+' resolved as shift. Conflict in state 253 between rule 99 and token '-' resolved as shift. Conflict in state 253 between rule 99 and token SLASH_SLASH resolved as shift. Conflict in state 253 between rule 99 and token '*' resolved as shift. Conflict in state 253 between rule 99 and token '/' resolved as shift. Conflict in state 253 between rule 99 and token '%' resolved as shift. Conflict in state 253 between rule 99 and token '#' resolved as shift. State 48 contains 1 shift/reduce conflict. State 84 contains 1 shift/reduce conflict. State 85 contains 1 shift/reduce conflict. State 93 contains 1 shift/reduce conflict. State 149 contains 1 shift/reduce conflict. State 158 contains 1 reduce/reduce conflict. State 242 contains 1 shift/reduce conflict. Grammar rule 1 program -> /* empty */ rule 2 program -> stmt rule 3 program -> error rule 4 lvalue -> id rule 5 lvalue -> LOCAL rule 6 lvalue -> '$' rule 7 lvalue -> ARG rule 8 lvalue -> lvalue '[' expr ']' rule 9 lvalue -> '*' primary rule 10 lvalue -> '*' '&' lvalue rule 11 lvalue -> '`' expr '`' rule 12 lvalue -> '(' lvalue ')' rule 13 asgn -> lvalue '=' expr rule 14 asgn -> lvalue PLUS_EQ expr rule 15 asgn -> lvalue MINUS_EQ expr rule 16 @1 -> /* empty */ rule 17 asgn -> lvalue '=' lvalue @1 SLASH_SLASH expr rule 18 asgn -> PLUS_PLUS lvalue rule 19 asgn -> lvalue PLUS_PLUS rule 20 asgn -> MINUS_MINUS lvalue rule 21 asgn -> lvalue MINUS_MINUS rule 22 primary -> lvalue rule 23 primary -> secondary rule 24 primary -> '(' expr ')' rule 25 secondary -> primary '(' arglist ')' rule 26 secondary -> secondary '[' expr ']' rule 27 stmt -> defn rule 28 stmt -> expr ';' rule 29 stmt -> RETURN ';' rule 30 stmt -> RETURN expr ';' rule 31 stmt -> SHIFT ';' rule 32 stmt -> SHIFT lvalue ';' rule 33 stmt -> APPEND lvalue ',' expr ';' rule 34 stmt -> INSERT lvalue ',' expr ',' expr ';' rule 35 stmt -> DELETE lvalue ',' expr ';' rule 36 stmt -> CASE CONSTANT ':' rule 37 stmt -> DEFAULT ':' rule 38 stmt -> BREAK ';' rule 39 stmt -> CONTINUE ';' rule 40 stmt -> switch expr cases stmt rule 41 stmt -> for expr1 expr2 end_expr2 expr3 end_expr3 stmt rule 42 stmt -> do stmt WHILE '(' expr ')' ';' rule 43 stmt -> while '(' expr ')' then stmt rule 44 stmt -> IF '(' expr ')' then stmt rule 45 stmt -> IF '(' expr ')' then stmt else stmt rule 46 stmt -> compound rule 47 stmt -> ';' rule 48 while -> WHILE rule 49 do -> DO rule 50 for -> FOR '(' rule 51 expr1 -> ';' rule 52 expr1 -> expr ';' rule 53 expr2 -> ';' rule 54 expr2 -> expr ';' rule 55 end_expr2 -> /* empty */ rule 56 expr3 -> ')' rule 57 expr3 -> expr ')' rule 58 end_expr3 -> /* empty */ rule 59 then -> /* empty */ rule 60 else -> ELSE rule 61 compound -> '{' stmtlist '}' rule 62 stmtlist -> /* empty */ rule 63 stmtlist -> stmtlist stmt rule 64 switch -> SWITCH '(' rule 65 cases -> ')' rule 66 begin -> /* empty */ rule 67 id -> identifier rule 68 id -> BLTIN rule 69 id -> LIB rule 70 id -> RLIB rule 71 identifier -> VAR rule 72 identifier -> FORMULA rule 73 identifier -> FUNCTION rule 74 identifier -> PROCEDURE rule 75 identifier -> PROCMACRO rule 76 expr -> CONSTANT rule 77 expr -> asgn rule 78 expr -> primary rule 79 expr -> '&' lvalue rule 80 expr -> '[' begin arglist ']' rule 81 expr -> expr '+' expr rule 82 expr -> expr '-' expr rule 83 expr -> expr '*' expr rule 84 expr -> expr '/' expr rule 85 expr -> expr '%' expr rule 86 expr -> expr SLASH_SLASH expr rule 87 expr -> expr '>' expr rule 88 expr -> expr GT_EQ expr rule 89 expr -> expr '<' expr rule 90 expr -> expr LT_EQ expr rule 91 expr -> expr EQ_EQ expr rule 92 expr -> expr NOT_EQ expr rule 93 @2 -> /* empty */ rule 94 expr -> '?' @2 lvalue rule 95 expr -> '-' expr rule 96 expr -> expr '#' rule 97 expr -> '!' expr rule 98 expr -> NOT expr rule 99 expr -> expr '?' then expr colon expr rule 100 expr -> expr AND expr rule 101 expr -> expr OR expr rule 102 expr -> expr lazy_and expr rule 103 expr -> expr lazy_or expr rule 104 expr -> expr BITAND expr rule 105 expr -> expr BITOR expr rule 106 expr -> evaluate '(' expr ')' rule 107 evaluate -> EVAL rule 108 colon -> ':' rule 109 lazy_and -> LAZY_AND rule 110 lazy_or -> LAZY_OR rule 111 defn -> declare_formula rule 112 defn -> declare_action rule 113 defn -> declare_relation rule 114 declare_relation -> identifier tilde_gt '[' id_list_opt ']' ';' rule 115 @3 -> /* empty */ rule 116 declare_relation -> '`' expr '`' @3 tilde_gt '[' id_list_opt ']' ';' rule 117 tilde_gt -> TILDE_GT rule 118 declare_formula -> identifier is expr ';' rule 119 @4 -> /* empty */ rule 120 declare_formula -> '`' expr '`' @4 is expr ';' rule 121 is -> IS rule 122 @5 -> /* empty */ rule 123 declare_action -> action identifier @5 refer_opt def_begin declare_para declare_local stmtlist def_end rule 124 action -> FUNC rule 125 action -> PROC rule 126 action -> PMAC rule 127 def_begin -> '{' rule 128 def_end -> '}' rule 129 refer_opt -> /* empty */ rule 130 refer_opt -> ':' id_list rule 131 id_list_opt -> /* empty */ rule 132 id_list_opt -> id_list rule 133 id_list -> identifier rule 134 id_list -> id_list ',' identifier rule 135 declare_para -> /* empty */ rule 136 @6 -> /* empty */ rule 137 declare_para -> PARA @6 local_list ';' rule 138 declare_local -> /* empty */ rule 139 @7 -> /* empty */ rule 140 declare_local -> declare_local AUTO @7 local_list ';' rule 141 local_list -> LOCAL rule 142 local_list -> local_list ',' LOCAL rule 143 arglist -> /* empty */ rule 144 arglist -> argument_list rule 145 argument_list -> expr rule 146 argument_list -> argument_list ',' expr Terminals, with rules where they appear $ (-1) '!' (33) 97 '#' (35) 96 '$' (36) 6 '%' (37) 85 '&' (38) 10 79 '(' (40) 12 24 25 42 43 44 45 50 64 106 ')' (41) 12 24 25 42 43 44 45 56 57 65 106 '*' (42) 9 10 83 '+' (43) 81 ',' (44) 33 34 35 134 142 146 '-' (45) 82 95 '/' (47) 84 ':' (58) 36 37 108 130 ';' (59) 28 29 30 31 32 33 34 35 38 39 42 47 51 52 53 54 114 116 118 120 137 140 '<' (60) 89 '=' (61) 13 17 '>' (62) 87 '?' (63) 94 99 '[' (91) 8 26 80 114 116 ']' (93) 8 26 80 114 116 '`' (96) 11 116 120 '{' (123) 61 127 '}' (125) 61 128 error (256) 3 UNDEF (257) REAL (258) INTEGER (259) MYCHAR (260) STRING (261) LIST (262) CONSTANT (263) 36 76 VAR (264) 71 FORMULA (265) 72 BLTIN (266) 68 LIB (267) 69 RLIB (268) 70 FUNC (269) 124 PROC (270) 125 PMAC (271) 126 FUNCTION (272) 73 PROCEDURE (273) 74 PROCMACRO (274) 75 AUTO (275) 140 PARA (276) 137 LOCAL (277) 5 141 142 BREAK (278) 38 CONTINUE (279) 39 SWITCH (280) 64 CASE (281) 36 DEFAULT (282) 37 DO (283) 49 FOR (284) 50 WHILE (285) 42 48 IF (286) 44 45 ELSE (287) 60 SHIFT (288) 31 32 APPEND (289) 33 INSERT (290) 34 DELETE (291) 35 RETURN (292) 29 30 ARG (293) 7 IS (294) 121 TILDE_GT (295) 117 PLUS_EQ (296) 14 MINUS_EQ (297) 15 OR (298) 101 LAZY_OR (299) 110 AND (300) 100 LAZY_AND (301) 109 BITAND (302) 104 BITOR (303) 105 EQ_EQ (304) 91 NOT_EQ (305) 92 GT_EQ (306) 88 LT_EQ (307) 90 SLASH_SLASH (308) 17 86 NEGATE (309) NOT (310) 98 PLUS_PLUS (311) 18 19 MINUS_MINUS (312) 20 21 ASTERISK (313) EVAL (314) 107 Nonterminals, with rules where they appear program (84) on left: 1 2 3 lvalue (85) on left: 4 5 6 7 8 9 10 11 12, on right: 8 10 12 13 14 15 17 18 19 20 21 22 32 33 34 35 79 94 asgn (86) on left: 13 14 15 17 18 19 20 21, on right: 77 @1 (87) on left: 16, on right: 17 primary (88) on left: 22 23 24, on right: 9 25 78 secondary (89) on left: 25 26, on right: 23 26 stmt (90) on left: 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47, on right: 2 40 41 42 43 44 45 63 while (91) on left: 48, on right: 43 do (92) on left: 49, on right: 42 for (93) on left: 50, on right: 41 expr1 (94) on left: 51 52, on right: 41 expr2 (95) on left: 53 54, on right: 41 end_expr2 (96) on left: 55, on right: 41 expr3 (97) on left: 56 57, on right: 41 end_expr3 (98) on left: 58, on right: 41 then (99) on left: 59, on right: 43 44 45 99 else (100) on left: 60, on right: 45 compound (101) on left: 61, on right: 46 stmtlist (102) on left: 62 63, on right: 61 63 123 switch (103) on left: 64, on right: 40 cases (104) on left: 65, on right: 40 begin (105) on left: 66, on right: 80 id (106) on left: 67 68 69 70, on right: 4 identifier (107) on left: 71 72 73 74 75, on right: 67 114 118 123 133 134 expr (108) on left: 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 94 95 96 97 98 99 100 101 102 103 104 105 106, on right: 8 11 13 14 15 17 24 26 28 30 33 34 35 40 42 43 44 45 52 54 57 81 82 83 84 85 86 87 88 89 90 91 92 95 96 97 98 99 100 101 102 103 104 105 106 116 118 120 145 146 @2 (109) on left: 93, on right: 94 evaluate (110) on left: 107, on right: 106 colon (111) on left: 108, on right: 99 lazy_and (112) on left: 109, on right: 102 lazy_or (113) on left: 110, on right: 103 defn (114) on left: 111 112 113, on right: 27 declare_relation (115) on left: 114 116, on right: 113 @3 (116) on left: 115, on right: 116 tilde_gt (117) on left: 117, on right: 114 116 declare_formula (118) on left: 118 120, on right: 111 @4 (119) on left: 119, on right: 120 is (120) on left: 121, on right: 118 120 declare_action (121) on left: 123, on right: 112 @5 (122) on left: 122, on right: 123 action (123) on left: 124 125 126, on right: 123 def_begin (124) on left: 127, on right: 123 def_end (125) on left: 128, on right: 123 refer_opt (126) on left: 129 130, on right: 123 id_list_opt (127) on left: 131 132, on right: 114 116 id_list (128) on left: 133 134, on right: 130 132 134 declare_para (129) on left: 135 137, on right: 123 @6 (130) on left: 136, on right: 137 declare_local (131) on left: 138 140, on right: 123 140 @7 (132) on left: 139, on right: 140 local_list (133) on left: 141 142, on right: 137 140 142 arglist (134) on left: 143 144, on right: 25 80 argument_list (135) on left: 145 146, on right: 144 146 state 0 error shift, and go to state 1 CONSTANT shift, and go to state 2 VAR shift, and go to state 3 FORMULA shift, and go to state 4 BLTIN shift, and go to state 5 LIB shift, and go to state 6 RLIB shift, and go to state 7 FUNC shift, and go to state 8 PROC shift, and go to state 9 PMAC shift, and go to state 10 FUNCTION shift, and go to state 11 PROCEDURE shift, and go to state 12 PROCMACRO shift, and go to state 13 LOCAL shift, and go to state 14 BREAK shift, and go to state 15 CONTINUE shift, and go to state 16 SWITCH shift, and go to state 17 CASE shift, and go to state 18 DEFAULT shift, and go to state 19 DO shift, and go to state 20 FOR shift, and go to state 21 WHILE shift, and go to state 22 IF shift, and go to state 23 SHIFT shift, and go to state 24 APPEND shift, and go to state 25 INSERT shift, and go to state 26 DELETE shift, and go to state 27 RETURN shift, and go to state 28 ARG shift, and go to state 29 '?' shift, and go to state 30 '-' shift, and go to state 31 '*' shift, and go to state 32 NOT shift, and go to state 33 '!' shift, and go to state 34 PLUS_PLUS shift, and go to state 35 MINUS_MINUS shift, and go to state 36 '&' shift, and go to state 37 EVAL shift, and go to state 38 '$' shift, and go to state 39 '[' shift, and go to state 40 '`' shift, and go to state 41 '(' shift, and go to state 42 ';' shift, and go to state 43 '{' shift, and go to state 44 $ reduce using rule 1 (program) program go to state 280 lvalue go to state 45 asgn go to state 46 primary go to state 47 secondary go to state 48 stmt go to state 49 while go to state 50 do go to state 51 for go to state 52 compound go to state 53 switch go to state 54 id go to state 55 identifier go to state 56 expr go to state 57 evaluate go to state 58 defn go to state 59 declare_relation go to state 60 declare_formula go to state 61 declare_action go to state 62 action go to state 63 state 1 program -> error . (rule 3) $default reduce using rule 3 (program) state 2 expr -> CONSTANT . (rule 76) $default reduce using rule 76 (expr) state 3 identifier -> VAR . (rule 71) $default reduce using rule 71 (identifier) state 4 identifier -> FORMULA . (rule 72) $default reduce using rule 72 (identifier) state 5 id -> BLTIN . (rule 68) $default reduce using rule 68 (id) state 6 id -> LIB . (rule 69) $default reduce using rule 69 (id) state 7 id -> RLIB . (rule 70) $default reduce using rule 70 (id) state 8 action -> FUNC . (rule 124) $default reduce using rule 124 (action) state 9 action -> PROC . (rule 125) $default reduce using rule 125 (action) state 10 action -> PMAC . (rule 126) $default reduce using rule 126 (action) state 11 identifier -> FUNCTION . (rule 73) $default reduce using rule 73 (identifier) state 12 identifier -> PROCEDURE . (rule 74) $default reduce using rule 74 (identifier) state 13 identifier -> PROCMACRO . (rule 75) $default reduce using rule 75 (identifier) state 14 lvalue -> LOCAL . (rule 5) $default reduce using rule 5 (lvalue) state 15 stmt -> BREAK . ';' (rule 38) ';' shift, and go to state 64 state 16 stmt -> CONTINUE . ';' (rule 39) ';' shift, and go to state 65 state 17 switch -> SWITCH . '(' (rule 64) '(' shift, and go to state 66 state 18 stmt -> CASE . CONSTANT ':' (rule 36) CONSTANT shift, and go to state 67 state 19 stmt -> DEFAULT . ':' (rule 37) ':' shift, and go to state 68 state 20 do -> DO . (rule 49) $default reduce using rule 49 (do) state 21 for -> FOR . '(' (rule 50) '(' shift, and go to state 69 state 22 while -> WHILE . (rule 48) $default reduce using rule 48 (while) state 23 stmt -> IF . '(' expr ')' then stmt (rule 44) stmt -> IF . '(' expr ')' then stmt else stmt (rule 45) '(' shift, and go to state 70 state 24 stmt -> SHIFT . ';' (rule 31) stmt -> SHIFT . lvalue ';' (rule 32) VAR shift, and go to state 3 FORMULA shift, and go to state 4 BLTIN shift, and go to state 5 LIB shift, and go to state 6 RLIB shift, and go to state 7 FUNCTION shift, and go to state 11 PROCEDURE shift, and go to state 12 PROCMACRO shift, and go to state 13 LOCAL shift, and go to state 14 ARG shift, and go to state 29 '*' shift, and go to state 32 '$' shift, and go to state 39 '`' shift, and go to state 71 '(' shift, and go to state 72 ';' shift, and go to state 73 lvalue go to state 74 id go to state 55 identifier go to state 75 state 25 stmt -> APPEND . lvalue ',' expr ';' (rule 33) VAR shift, and go to state 3 FORMULA shift, and go to state 4 BLTIN shift, and go to state 5 LIB shift, and go to state 6 RLIB shift, and go to state 7 FUNCTION shift, and go to state 11 PROCEDURE shift, and go to state 12 PROCMACRO shift, and go to state 13 LOCAL shift, and go to state 14 ARG shift, and go to state 29 '*' shift, and go to state 32 '$' shift, and go to state 39 '`' shift, and go to state 71 '(' shift, and go to state 72 lvalue go to state 76 id go to state 55 identifier go to state 75 state 26 stmt -> INSERT . lvalue ',' expr ',' expr ';' (rule 34) VAR shift, and go to state 3 FORMULA shift, and go to state 4 BLTIN shift, and go to state 5 LIB shift, and go to state 6 RLIB shift, and go to state 7 FUNCTION shift, and go to state 11 PROCEDURE shift, and go to state 12 PROCMACRO shift, and go to state 13 LOCAL shift, and go to state 14 ARG shift, and go to state 29 '*' shift, and go to state 32 '$' shift, and go to state 39 '`' shift, and go to state 71 '(' shift, and go to state 72 lvalue go to state 77 id go to state 55 identifier go to state 75 state 27 stmt -> DELETE . lvalue ',' expr ';' (rule 35) VAR shift, and go to state 3 FORMULA shift, and go to state 4 BLTIN shift, and go to state 5 LIB shift, and go to state 6 RLIB shift, and go to state 7 FUNCTION shift, and go to state 11 PROCEDURE shift, and go to state 12 PROCMACRO shift, and go to state 13 LOCAL shift, and go to state 14 ARG shift, and go to state 29 '*' shift, and go to state 32 '$' shift, and go to state 39 '`' shift, and go to state 71 '(' shift, and go to state 72 lvalue go to state 78 id go to state 55 identifier go to state 75 state 28 stmt -> RETURN . ';' (rule 29) stmt -> RETURN . expr ';' (rule 30) CONSTANT shift, and go to state 2 VAR shift, and go to state 3 FORMULA shift, and go to state 4 BLTIN shift, and go to state 5 LIB shift, and go to state 6 RLIB shift, and go to state 7 FUNCTION shift, and go to state 11 PROCEDURE shift, and go to state 12 PROCMACRO shift, and go to state 13 LOCAL shift, and go to state 14 ARG shift, and go to state 29 '?' shift, and go to state 30 '-' shift, and go to state 31 '*' shift, and go to state 32 NOT shift, and go to state 33 '!' shift, and go to state 34 PLUS_PLUS shift, and go to state 35 MINUS_MINUS shift, and go to state 36 '&' shift, and go to state 37 EVAL shift, and go to state 38 '$' shift, and go to state 39 '[' shift, and go to state 40 '`' shift, and go to state 71 '(' shift, and go to state 42 ';' shift, and go to state 79 lvalue go to state 45 asgn go to state 46 primary go to state 47 secondary go to state 48 id go to state 55 identifier go to state 75 expr go to state 80 evaluate go to state 58 state 29 lvalue -> ARG . (rule 7) $default reduce using rule 7 (lvalue) state 30 expr -> '?' . @2 lvalue (rule 94) $default reduce using rule 93 (@2) @2 go to state 81 state 31 expr -> '-' . expr (rule 95) CONSTANT shift, and go to state 2 VAR shift, and go to state 3 FORMULA shift, and go to state 4 BLTIN shift, and go to state 5 LIB shift, and go to state 6 RLIB shift, and go to state 7 FUNCTION shift, and go to state 11 PROCEDURE shift, and go to state 12 PROCMACRO shift, and go to state 13 LOCAL shift, and go to state 14 ARG shift, and go to state 29 '?' shift, and go to state 30 '-' shift, and go to state 31 '*' shift, and go to state 32 NOT shift, and go to state 33 '!' shift, and go to state 34 PLUS_PLUS shift, and go to state 35 MINUS_MINUS shift, and go to state 36 '&' shift, and go to state 37 EVAL shift, and go to state 38 '$' shift, and go to state 39 '[' shift, and go to state 40 '`' shift, and go to state 71 '(' shift, and go to state 42 lvalue go to state 45 asgn go to state 46 primary go to state 47 secondary go to state 48 id go to state 55 identifier go to state 75 expr go to state 82 evaluate go to state 58 state 32 lvalue -> '*' . primary (rule 9) lvalue -> '*' . '&' lvalue (rule 10) VAR shift, and go to state 3 FORMULA shift, and go to state 4 BLTIN shift, and go to state 5 LIB shift, and go to state 6 RLIB shift, and go to state 7 FUNCTION shift, and go to state 11 PROCEDURE shift, and go to state 12 PROCMACRO shift, and go to state 13 LOCAL shift, and go to state 14 ARG shift, and go to state 29 '*' shift, and go to state 32 '&' shift, and go to state 83 '$' shift, and go to state 39 '`' shift, and go to state 71 '(' shift, and go to state 42 lvalue go to state 84 primary go to state 85 secondary go to state 48 id go to state 55 identifier go to state 75 state 33 expr -> NOT . expr (rule 98) CONSTANT shift, and go to state 2 VAR shift, and go to state 3 FORMULA shift, and go to state 4 BLTIN shift, and go to state 5 LIB shift, and go to state 6 RLIB shift, and go to state 7 FUNCTION shift, and go to state 11 PROCEDURE shift, and go to state 12 PROCMACRO shift, and go to state 13 LOCAL shift, and go to state 14 ARG shift, and go to state 29 '?' shift, and go to state 30 '-' shift, and go to state 31 '*' shift, and go to state 32 NOT shift, and go to state 33 '!' shift, and go to state 34 PLUS_PLUS shift, and go to state 35 MINUS_MINUS shift, and go to state 36 '&' shift, and go to state 37 EVAL shift, and go to state 38 '$' shift, and go to state 39 '[' shift, and go to state 40 '`' shift, and go to state 71 '(' shift, and go to state 42 lvalue go to state 45 asgn go to state 46 primary go to state 47 secondary go to state 48 id go to state 55 identifier go to state 75 expr go to state 86 evaluate go to state 58 state 34 expr -> '!' . expr (rule 97) CONSTANT shift, and go to state 2 VAR shift, and go to state 3 FORMULA shift, and go to state 4 BLTIN shift, and go to state 5 LIB shift, and go to state 6 RLIB shift, and go to state 7 FUNCTION shift, and go to state 11 PROCEDURE shift, and go to state 12 PROCMACRO shift, and go to state 13 LOCAL shift, and go to state 14 ARG shift, and go to state 29 '?' shift, and go to state 30 '-' shift, and go to state 31 '*' shift, and go to state 32 NOT shift, and go to state 33 '!' shift, and go to state 34 PLUS_PLUS shift, and go to state 35 MINUS_MINUS shift, and go to state 36 '&' shift, and go to state 37 EVAL shift, and go to state 38 '$' shift, and go to state 39 '[' shift, and go to state 40 '`' shift, and go to state 71 '(' shift, and go to state 42 lvalue go to state 45 asgn go to state 46 primary go to state 47 secondary go to state 48 id go to state 55 identifier go to state 75 expr go to state 87 evaluate go to state 58 state 35 asgn -> PLUS_PLUS . lvalue (rule 18) VAR shift, and go to state 3 FORMULA shift, and go to state 4 BLTIN shift, and go to state 5 LIB shift, and go to state 6 RLIB shift, and go to state 7 FUNCTION shift, and go to state 11 PROCEDURE shift, and go to state 12 PROCMACRO shift, and go to state 13 LOCAL shift, and go to state 14 ARG shift, and go to state 29 '*' shift, and go to state 32 '$' shift, and go to state 39 '`' shift, and go to state 71 '(' shift, and go to state 72 lvalue go to state 88 id go to state 55 identifier go to state 75 state 36 asgn -> MINUS_MINUS . lvalue (rule 20) VAR shift, and go to state 3 FORMULA shift, and go to state 4 BLTIN shift, and go to state 5 LIB shift, and go to state 6 RLIB shift, and go to state 7 FUNCTION shift, and go to state 11 PROCEDURE shift, and go to state 12 PROCMACRO shift, and go to state 13 LOCAL shift, and go to state 14 ARG shift, and go to state 29 '*' shift, and go to state 32 '$' shift, and go to state 39 '`' shift, and go to state 71 '(' shift, and go to state 72 lvalue go to state 89 id go to state 55 identifier go to state 75 state 37 expr -> '&' . lvalue (rule 79) VAR shift, and go to state 3 FORMULA shift, and go to state 4 BLTIN shift, and go to state 5 LIB shift, and go to state 6 RLIB shift, and go to state 7 FUNCTION shift, and go to state 11 PROCEDURE shift, and go to state 12 PROCMACRO shift, and go to state 13 LOCAL shift, and go to state 14 ARG shift, and go to state 29 '*' shift, and go to state 32 '$' shift, and go to state 39 '`' shift, and go to state 71 '(' shift, and go to state 72 lvalue go to state 90 id go to state 55 identifier go to state 75 state 38 evaluate -> EVAL . (rule 107) $default reduce using rule 107 (evaluate) state 39 lvalue -> '$' . (rule 6) $default reduce using rule 6 (lvalue) state 40 expr -> '[' . begin arglist ']' (rule 80) $default reduce using rule 66 (begin) begin go to state 91 state 41 lvalue -> '`' . expr '`' (rule 11) declare_relation -> '`' . expr '`' @3 tilde_gt '[' id_list_opt ']' ';' (rule 116) declare_formula -> '`' . expr '`' @4 is expr ';' (rule 120) CONSTANT shift, and go to state 2 VAR shift, and go to state 3 FORMULA shift, and go to state 4 BLTIN shift, and go to state 5 LIB shift, and go to state 6 RLIB shift, and go to state 7 FUNCTION shift, and go to state 11 PROCEDURE shift, and go to state 12 PROCMACRO shift, and go to state 13 LOCAL shift, and go to state 14 ARG shift, and go to state 29 '?' shift, and go to state 30 '-' shift, and go to state 31 '*' shift, and go to state 32 NOT shift, and go to state 33 '!' shift, and go to state 34 PLUS_PLUS shift, and go to state 35 MINUS_MINUS shift, and go to state 36 '&' shift, and go to state 37 EVAL shift, and go to state 38 '$' shift, and go to state 39 '[' shift, and go to state 40 '`' shift, and go to state 71 '(' shift, and go to state 42 lvalue go to state 45 asgn go to state 46 primary go to state 47 secondary go to state 48 id go to state 55 identifier go to state 75 expr go to state 92 evaluate go to state 58 state 42 lvalue -> '(' . lvalue ')' (rule 12) primary -> '(' . expr ')' (rule 24) CONSTANT shift, and go to state 2 VAR shift, and go to state 3 FORMULA shift, and go to state 4 BLTIN shift, and go to state 5 LIB shift, and go to state 6 RLIB shift, and go to state 7 FUNCTION shift, and go to state 11 PROCEDURE shift, and go to state 12 PROCMACRO shift, and go to state 13 LOCAL shift, and go to state 14 ARG shift, and go to state 29 '?' shift, and go to state 30 '-' shift, and go to state 31 '*' shift, and go to state 32 NOT shift, and go to state 33 '!' shift, and go to state 34 PLUS_PLUS shift, and go to state 35 MINUS_MINUS shift, and go to state 36 '&' shift, and go to state 37 EVAL shift, and go to state 38 '$' shift, and go to state 39 '[' shift, and go to state 40 '`' shift, and go to state 71 '(' shift, and go to state 42 lvalue go to state 93 asgn go to state 46 primary go to state 47 secondary go to state 48 id go to state 55 identifier go to state 75 expr go to state 94 evaluate go to state 58 state 43 stmt -> ';' . (rule 47) $default reduce using rule 47 (stmt) state 44 compound -> '{' . stmtlist '}' (rule 61) $default reduce using rule 62 (stmtlist) stmtlist go to state 95 state 45 lvalue -> lvalue . '[' expr ']' (rule 8) asgn -> lvalue . '=' expr (rule 13) asgn -> lvalue . PLUS_EQ expr (rule 14) asgn -> lvalue . MINUS_EQ expr (rule 15) asgn -> lvalue . '=' lvalue @1 SLASH_SLASH expr (rule 17) asgn -> lvalue . PLUS_PLUS (rule 19) asgn -> lvalue . MINUS_MINUS (rule 21) primary -> lvalue . (rule 22) '=' shift, and go to state 96 PLUS_EQ shift, and go to state 97 MINUS_EQ shift, and go to state 98 PLUS_PLUS shift, and go to state 99 MINUS_MINUS shift, and go to state 100 '[' shift, and go to state 101 $default reduce using rule 22 (primary) state 46 expr -> asgn . (rule 77) $default reduce using rule 77 (expr) state 47 secondary -> primary . '(' arglist ')' (rule 25) expr -> primary . (rule 78) '(' shift, and go to state 102 $default reduce using rule 78 (expr) state 48 primary -> secondary . (rule 23) secondary -> secondary . '[' expr ']' (rule 26) '[' shift, and go to state 103 '[' [reduce using rule 23 (primary)] $default reduce using rule 23 (primary) state 49 program -> stmt . (rule 2) $default reduce using rule 2 (program) state 50 stmt -> while . '(' expr ')' then stmt (rule 43) '(' shift, and go to state 104 state 51 stmt -> do . stmt WHILE '(' expr ')' ';' (rule 42) CONSTANT shift, and go to state 2 VAR shift, and go to state 3 FORMULA shift, and go to state 4 BLTIN shift, and go to state 5 LIB shift, and go to state 6 RLIB shift, and go to state 7 FUNC shift, and go to state 8 PROC shift, and go to state 9 PMAC shift, and go to state 10 FUNCTION shift, and go to state 11 PROCEDURE shift, and go to state 12 PROCMACRO shift, and go to state 13 LOCAL shift, and go to state 14 BREAK shift, and go to state 15 CONTINUE shift, and go to state 16 SWITCH shift, and go to state 17 CASE shift, and go to state 18 DEFAULT shift, and go to state 19 DO shift, and go to state 20 FOR shift, and go to state 21 WHILE shift, and go to state 22 IF shift, and go to state 23 SHIFT shift, and go to state 24 APPEND shift, and go to state 25 INSERT shift, and go to state 26 DELETE shift, and go to state 27 RETURN shift, and go to state 28 ARG shift, and go to state 29 '?' shift, and go to state 30 '-' shift, and go to state 31 '*' shift, and go to state 32 NOT shift, and go to state 33 '!' shift, and go to state 34 PLUS_PLUS shift, and go to state 35 MINUS_MINUS shift, and go to state 36 '&' shift, and go to state 37 EVAL shift, and go to state 38 '$' shift, and go to state 39 '[' shift, and go to state 40 '`' shift, and go to state 41 '(' shift, and go to state 42 ';' shift, and go to state 43 '{' shift, and go to state 44 lvalue go to state 45 asgn go to state 46 primary go to state 47 secondary go to state 48 stmt go to state 105 while go to state 50 do go to state 51 for go to state 52 compound go to state 53 switch go to state 54 id go to state 55 identifier go to state 56 expr go to state 57 evaluate go to state 58 defn go to state 59 declare_relation go to state 60 declare_formula go to state 61 declare_action go to state 62 action go to state 63 state 52 stmt -> for . expr1 expr2 end_expr2 expr3 end_expr3 stmt (rule 41) CONSTANT shift, and go to state 2 VAR shift, and go to state 3 FORMULA shift, and go to state 4 BLTIN shift, and go to state 5 LIB shift, and go to state 6 RLIB shift, and go to state 7 FUNCTION shift, and go to state 11 PROCEDURE shift, and go to state 12 PROCMACRO shift, and go to state 13 LOCAL shift, and go to state 14 ARG shift, and go to state 29 '?' shift, and go to state 30 '-' shift, and go to state 31 '*' shift, and go to state 32 NOT shift, and go to state 33 '!' shift, and go to state 34 PLUS_PLUS shift, and go to state 35 MINUS_MINUS shift, and go to state 36 '&' shift, and go to state 37 EVAL shift, and go to state 38 '$' shift, and go to state 39 '[' shift, and go to state 40 '`' shift, and go to state 71 '(' shift, and go to state 42 ';' shift, and go to state 106 lvalue go to state 45 asgn go to state 46 primary go to state 47 secondary go to state 48 expr1 go to state 107 id go to state 55 identifier go to state 75 expr go to state 108 evaluate go to state 58 state 53 stmt -> compound . (rule 46) $default reduce using rule 46 (stmt) state 54 stmt -> switch . expr cases stmt (rule 40) CONSTANT shift, and go to state 2 VAR shift, and go to state 3 FORMULA shift, and go to state 4 BLTIN shift, and go to state 5 LIB shift, and go to state 6 RLIB shift, and go to state 7 FUNCTION shift, and go to state 11 PROCEDURE shift, and go to state 12 PROCMACRO shift, and go to state 13 LOCAL shift, and go to state 14 ARG shift, and go to state 29 '?' shift, and go to state 30 '-' shift, and go to state 31 '*' shift, and go to state 32 NOT shift, and go to state 33 '!' shift, and go to state 34 PLUS_PLUS shift, and go to state 35 MINUS_MINUS shift, and go to state 36 '&' shift, and go to state 37 EVAL shift, and go to state 38 '$' shift, and go to state 39 '[' shift, and go to state 40 '`' shift, and go to state 71 '(' shift, and go to state 42 lvalue go to state 45 asgn go to state 46 primary go to state 47 secondary go to state 48 id go to state 55 identifier go to state 75 expr go to state 109 evaluate go to state 58 state 55 lvalue -> id . (rule 4) $default reduce using rule 4 (lvalue) state 56 id -> identifier . (rule 67) declare_relation -> identifier . tilde_gt '[' id_list_opt ']' ';' (rule 114) declare_formula -> identifier . is expr ';' (rule 118) IS shift, and go to state 110 TILDE_GT shift, and go to state 111 $default reduce using rule 67 (id) tilde_gt go to state 112 is go to state 113 state 57 stmt -> expr . ';' (rule 28) expr -> expr . '+' expr (rule 81) expr -> expr . '-' expr (rule 82) expr -> expr . '*' expr (rule 83) expr -> expr . '/' expr (rule 84) expr -> expr . '%' expr (rule 85) expr -> expr . SLASH_SLASH expr (rule 86) expr -> expr . '>' expr (rule 87) expr -> expr . GT_EQ expr (rule 88) expr -> expr . '<' expr (rule 89) expr -> expr . LT_EQ expr (rule 90) expr -> expr . EQ_EQ expr (rule 91) expr -> expr . NOT_EQ expr (rule 92) expr -> expr . '#' (rule 96) expr -> expr . '?' then expr colon expr (rule 99) expr -> expr . AND expr (rule 100) expr -> expr . OR expr (rule 101) expr -> expr . lazy_and expr (rule 102) expr -> expr . lazy_or expr (rule 103) expr -> expr . BITAND expr (rule 104) expr -> expr . BITOR expr (rule 105) '?' shift, and go to state 114 OR shift, and go to state 115 LAZY_OR shift, and go to state 116 AND shift, and go to state 117 LAZY_AND shift, and go to state 118 BITAND shift, and go to state 119 BITOR shift, and go to state 120 EQ_EQ shift, and go to state 121 NOT_EQ shift, and go to state 122 '>' shift, and go to state 123 GT_EQ shift, and go to state 124 '<' shift, and go to state 125 LT_EQ shift, and go to state 126 '+' shift, and go to state 127 '-' shift, and go to state 128 SLASH_SLASH shift, and go to state 129 '*' shift, and go to state 130 '/' shift, and go to state 131 '%' shift, and go to state 132 '#' shift, and go to state 133 ';' shift, and go to state 134 lazy_and go to state 135 lazy_or go to state 136 state 58 expr -> evaluate . '(' expr ')' (rule 106) '(' shift, and go to state 137 state 59 stmt -> defn . (rule 27) $default reduce using rule 27 (stmt) state 60 defn -> declare_relation . (rule 113) $default reduce using rule 113 (defn) state 61 defn -> declare_formula . (rule 111) $default reduce using rule 111 (defn) state 62 defn -> declare_action . (rule 112) $default reduce using rule 112 (defn) state 63 declare_action -> action . identifier @5 refer_opt def_begin declare_para declare_local stmtlist def_end (rule 123) VAR shift, and go to state 3 FORMULA shift, and go to state 4 FUNCTION shift, and go to state 11 PROCEDURE shift, and go to state 12 PROCMACRO shift, and go to state 13 identifier go to state 138 state 64 stmt -> BREAK ';' . (rule 38) $default reduce using rule 38 (stmt) state 65 stmt -> CONTINUE ';' . (rule 39) $default reduce using rule 39 (stmt) state 66 switch -> SWITCH '(' . (rule 64) $default reduce using rule 64 (switch) state 67 stmt -> CASE CONSTANT . ':' (rule 36) ':' shift, and go to state 139 state 68 stmt -> DEFAULT ':' . (rule 37) $default reduce using rule 37 (stmt) state 69 for -> FOR '(' . (rule 50) $default reduce using rule 50 (for) state 70 stmt -> IF '(' . expr ')' then stmt (rule 44) stmt -> IF '(' . expr ')' then stmt else stmt (rule 45) CONSTANT shift, and go to state 2 VAR shift, and go to state 3 FORMULA shift, and go to state 4 BLTIN shift, and go to state 5 LIB shift, and go to state 6 RLIB shift, and go to state 7 FUNCTION shift, and go to state 11 PROCEDURE shift, and go to state 12 PROCMACRO shift, and go to state 13 LOCAL shift, and go to state 14 ARG shift, and go to state 29 '?' shift, and go to state 30 '-' shift, and go to state 31 '*' shift, and go to state 32 NOT shift, and go to state 33 '!' shift, and go to state 34 PLUS_PLUS shift, and go to state 35 MINUS_MINUS shift, and go to state 36 '&' shift, and go to state 37 EVAL shift, and go to state 38 '$' shift, and go to state 39 '[' shift, and go to state 40 '`' shift, and go to state 71 '(' shift, and go to state 42 lvalue go to state 45 asgn go to state 46 primary go to state 47 secondary go to state 48 id go to state 55 identifier go to state 75 expr go to state 140 evaluate go to state 58 state 71 lvalue -> '`' . expr '`' (rule 11) CONSTANT shift, and go to state 2 VAR shift, and go to state 3 FORMULA shift, and go to state 4 BLTIN shift, and go to state 5 LIB shift, and go to state 6 RLIB shift, and go to state 7 FUNCTION shift, and go to state 11 PROCEDURE shift, and go to state 12 PROCMACRO shift, and go to state 13 LOCAL shift, and go to state 14 ARG shift, and go to state 29 '?' shift, and go to state 30 '-' shift, and go to state 31 '*' shift, and go to state 32 NOT shift, and go to state 33 '!' shift, and go to state 34 PLUS_PLUS shift, and go to state 35 MINUS_MINUS shift, and go to state 36 '&' shift, and go to state 37 EVAL shift, and go to state 38 '$' shift, and go to state 39 '[' shift, and go to state 40 '`' shift, and go to state 71 '(' shift, and go to state 42 lvalue go to state 45 asgn go to state 46 primary go to state 47 secondary go to state 48 id go to state 55 identifier go to state 75 expr go to state 141 evaluate go to state 58 state 72 lvalue -> '(' . lvalue ')' (rule 12) VAR shift, and go to state 3 FORMULA shift, and go to state 4 BLTIN shift, and go to state 5 LIB shift, and go to state 6 RLIB shift, and go to state 7 FUNCTION shift, and go to state 11 PROCEDURE shift, and go to state 12 PROCMACRO shift, and go to state 13 LOCAL shift, and go to state 14 ARG shift, and go to state 29 '*' shift, and go to state 32 '$' shift, and go to state 39 '`' shift, and go to state 71 '(' shift, and go to state 72 lvalue go to state 142 id go to state 55 identifier go to state 75 state 73 stmt -> SHIFT ';' . (rule 31) $default reduce using rule 31 (stmt) state 74 lvalue -> lvalue . '[' expr ']' (rule 8) stmt -> SHIFT lvalue . ';' (rule 32) '[' shift, and go to state 101 ';' shift, and go to state 143 state 75 id -> identifier . (rule 67) $default reduce using rule 67 (id) state 76 lvalue -> lvalue . '[' expr ']' (rule 8) stmt -> APPEND lvalue . ',' expr ';' (rule 33) ',' shift, and go to state 144 '[' shift, and go to state 101 state 77 lvalue -> lvalue . '[' expr ']' (rule 8) stmt -> INSERT lvalue . ',' expr ',' expr ';' (rule 34) ',' shift, and go to state 145 '[' shift, and go to state 101 state 78 lvalue -> lvalue . '[' expr ']' (rule 8) stmt -> DELETE lvalue . ',' expr ';' (rule 35) ',' shift, and go to state 146 '[' shift, and go to state 101 state 79 stmt -> RETURN ';' . (rule 29) $default reduce using rule 29 (stmt) state 80 stmt -> RETURN expr . ';' (rule 30) expr -> expr . '+' expr (rule 81) expr -> expr . '-' expr (rule 82) expr -> expr . '*' expr (rule 83) expr -> expr . '/' expr (rule 84) expr -> expr . '%' expr (rule 85) expr -> expr . SLASH_SLASH expr (rule 86) expr -> expr . '>' expr (rule 87) expr -> expr . GT_EQ expr (rule 88) expr -> expr . '<' expr (rule 89) expr -> expr . LT_EQ expr (rule 90) expr -> expr . EQ_EQ expr (rule 91) expr -> expr . NOT_EQ expr (rule 92) expr -> expr . '#' (rule 96) expr -> expr . '?' then expr colon expr (rule 99) expr -> expr . AND expr (rule 100) expr -> expr . OR expr (rule 101) expr -> expr . lazy_and expr (rule 102) expr -> expr . lazy_or expr (rule 103) expr -> expr . BITAND expr (rule 104) expr -> expr . BITOR expr (rule 105) '?' shift, and go to state 114 OR shift, and go to state 115 LAZY_OR shift, and go to state 116 AND shift, and go to state 117 LAZY_AND shift, and go to state 118 BITAND shift, and go to state 119 BITOR shift, and go to state 120 EQ_EQ shift, and go to state 121 NOT_EQ shift, and go to state 122 '>' shift, and go to state 123 GT_EQ shift, and go to state 124 '<' shift, and go to state 125 LT_EQ shift, and go to state 126 '+' shift, and go to state 127 '-' shift, and go to state 128 SLASH_SLASH shift, and go to state 129 '*' shift, and go to state 130 '/' shift, and go to state 131 '%' shift, and go to state 132 '#' shift, and go to state 133 ';' shift, and go to state 147 lazy_and go to state 135 lazy_or go to state 136 state 81 expr -> '?' @2 . lvalue (rule 94) VAR shift, and go to state 3 FORMULA shift, and go to state 4 BLTIN shift, and go to state 5 LIB shift, and go to state 6 RLIB shift, and go to state 7 FUNCTION shift, and go to state 11 PROCEDURE shift, and go to state 12 PROCMACRO shift, and go to state 13 LOCAL shift, and go to state 14 ARG shift, and go to state 29 '*' shift, and go to state 32 '$' shift, and go to state 39 '`' shift, and go to state 71 '(' shift, and go to state 72 lvalue go to state 148 id go to state 55 identifier go to state 75 state 82 expr -> expr . '+' expr (rule 81) expr -> expr . '-' expr (rule 82) expr -> expr . '*' expr (rule 83) expr -> expr . '/' expr (rule 84) expr -> expr . '%' expr (rule 85) expr -> expr . SLASH_SLASH expr (rule 86) expr -> expr . '>' expr (rule 87) expr -> expr . GT_EQ expr (rule 88) expr -> expr . '<' expr (rule 89) expr -> expr . LT_EQ expr (rule 90) expr -> expr . EQ_EQ expr (rule 91) expr -> expr . NOT_EQ expr (rule 92) expr -> '-' expr . (rule 95) expr -> expr . '#' (rule 96) expr -> expr . '?' then expr colon expr (rule 99) expr -> expr . AND expr (rule 100) expr -> expr . OR expr (rule 101) expr -> expr . lazy_and expr (rule 102) expr -> expr . lazy_or expr (rule 103) expr -> expr . BITAND expr (rule 104) expr -> expr . BITOR expr (rule 105) '#' error (nonassociative) $default reduce using rule 95 (expr) lazy_and go to state 135 lazy_or go to state 136 state 83 lvalue -> '*' '&' . lvalue (rule 10) VAR shift, and go to state 3 FORMULA shift, and go to state 4 BLTIN shift, and go to state 5 LIB shift, and go to state 6 RLIB shift, and go to state 7 FUNCTION shift, and go to state 11 PROCEDURE shift, and go to state 12 PROCMACRO shift, and go to state 13 LOCAL shift, and go to state 14 ARG shift, and go to state 29 '*' shift, and go to state 32 '$' shift, and go to state 39 '`' shift, and go to state 71 '(' shift, and go to state 72 lvalue go to state 149 id go to state 55 identifier go to state 75 state 84 lvalue -> lvalue . '[' expr ']' (rule 8) primary -> lvalue . (rule 22) '[' shift, and go to state 101 '[' [reduce using rule 22 (primary)] $default reduce using rule 22 (primary) state 85 lvalue -> '*' primary . (rule 9) secondary -> primary . '(' arglist ')' (rule 25) '(' shift, and go to state 102 '(' [reduce using rule 9 (lvalue)] $default reduce using rule 9 (lvalue) state 86 expr -> expr . '+' expr (rule 81) expr -> expr . '-' expr (rule 82) expr -> expr . '*' expr (rule 83) expr -> expr . '/' expr (rule 84) expr -> expr . '%' expr (rule 85) expr -> expr . SLASH_SLASH expr (rule 86) expr -> expr . '>' expr (rule 87) expr -> expr . GT_EQ expr (rule 88) expr -> expr . '<' expr (rule 89) expr -> expr . LT_EQ expr (rule 90) expr -> expr . EQ_EQ expr (rule 91) expr -> expr . NOT_EQ expr (rule 92) expr -> expr . '#' (rule 96) expr -> NOT expr . (rule 98) expr -> expr . '?' then expr colon expr (rule 99) expr -> expr . AND expr (rule 100) expr -> expr . OR expr (rule 101) expr -> expr . lazy_and expr (rule 102) expr -> expr . lazy_or expr (rule 103) expr -> expr . BITAND expr (rule 104) expr -> expr . BITOR expr (rule 105) '#' error (nonassociative) $default reduce using rule 98 (expr) lazy_and go to state 135 lazy_or go to state 136 state 87 expr -> expr . '+' expr (rule 81) expr -> expr . '-' expr (rule 82) expr -> expr . '*' expr (rule 83) expr -> expr . '/' expr (rule 84) expr -> expr . '%' expr (rule 85) expr -> expr . SLASH_SLASH expr (rule 86) expr -> expr . '>' expr (rule 87) expr -> expr . GT_EQ expr (rule 88) expr -> expr . '<' expr (rule 89) expr -> expr . LT_EQ expr (rule 90) expr -> expr . EQ_EQ expr (rule 91) expr -> expr . NOT_EQ expr (rule 92) expr -> expr . '#' (rule 96) expr -> '!' expr . (rule 97) expr -> expr . '?' then expr colon expr (rule 99) expr -> expr . AND expr (rule 100) expr -> expr . OR expr (rule 101) expr -> expr . lazy_and expr (rule 102) expr -> expr . lazy_or expr (rule 103) expr -> expr . BITAND expr (rule 104) expr -> expr . BITOR expr (rule 105) '#' error (nonassociative) $default reduce using rule 97 (expr) lazy_and go to state 135 lazy_or go to state 136 state 88 lvalue -> lvalue . '[' expr ']' (rule 8) asgn -> PLUS_PLUS lvalue . (rule 18) '[' shift, and go to state 101 $default reduce using rule 18 (asgn) state 89 lvalue -> lvalue . '[' expr ']' (rule 8) asgn -> MINUS_MINUS lvalue . (rule 20) '[' shift, and go to state 101 $default reduce using rule 20 (asgn) state 90 lvalue -> lvalue . '[' expr ']' (rule 8) expr -> '&' lvalue . (rule 79) '[' shift, and go to state 101 $default reduce using rule 79 (expr) state 91 expr -> '[' begin . arglist ']' (rule 80) CONSTANT shift, and go to state 2 VAR shift, and go to state 3 FORMULA shift, and go to state 4 BLTIN shift, and go to state 5 LIB shift, and go to state 6 RLIB shift, and go to state 7 FUNCTION shift, and go to state 11 PROCEDURE shift, and go to state 12 PROCMACRO shift, and go to state 13 LOCAL shift, and go to state 14 ARG shift, and go to state 29 '?' shift, and go to state 30 '-' shift, and go to state 31 '*' shift, and go to state 32 NOT shift, and go to state 33 '!' shift, and go to state 34 PLUS_PLUS shift, and go to state 35 MINUS_MINUS shift, and go to state 36 '&' shift, and go to state 37 EVAL shift, and go to state 38 '$' shift, and go to state 39 '[' shift, and go to state 40 '`' shift, and go to state 71 '(' shift, and go to state 42 $default reduce using rule 143 (arglist) lvalue go to state 45 asgn go to state 46 primary go to state 47 secondary go to state 48 id go to state 55 identifier go to state 75 expr go to state 150 evaluate go to state 58 arglist go to state 151 argument_list go to state 152 state 92 lvalue -> '`' expr . '`' (rule 11) expr -> expr . '+' expr (rule 81) expr -> expr . '-' expr (rule 82) expr -> expr . '*' expr (rule 83) expr -> expr . '/' expr (rule 84) expr -> expr . '%' expr (rule 85) expr -> expr . SLASH_SLASH expr (rule 86) expr -> expr . '>' expr (rule 87) expr -> expr . GT_EQ expr (rule 88) expr -> expr . '<' expr (rule 89) expr -> expr . LT_EQ expr (rule 90) expr -> expr . EQ_EQ expr (rule 91) expr -> expr . NOT_EQ expr (rule 92) expr -> expr . '#' (rule 96) expr -> expr . '?' then expr colon expr (rule 99) expr -> expr . AND expr (rule 100) expr -> expr . OR expr (rule 101) expr -> expr . lazy_and expr (rule 102) expr -> expr . lazy_or expr (rule 103) expr -> expr . BITAND expr (rule 104) expr -> expr . BITOR expr (rule 105) declare_relation -> '`' expr . '`' @3 tilde_gt '[' id_list_opt ']' ';' (rule 116) declare_formula -> '`' expr . '`' @4 is expr ';' (rule 120) '?' shift, and go to state 114 OR shift, and go to state 115 LAZY_OR shift, and go to state 116 AND shift, and go to state 117 LAZY_AND shift, and go to state 118 BITAND shift, and go to state 119 BITOR shift, and go to state 120 EQ_EQ shift, and go to state 121 NOT_EQ shift, and go to state 122 '>' shift, and go to state 123 GT_EQ shift, and go to state 124 '<' shift, and go to state 125 LT_EQ shift, and go to state 126 '+' shift, and go to state 127 '-' shift, and go to state 128 SLASH_SLASH shift, and go to state 129 '*' shift, and go to state 130 '/' shift, and go to state 131 '%' shift, and go to state 132 '#' shift, and go to state 133 '`' shift, and go to state 153 lazy_and go to state 135 lazy_or go to state 136 state 93 lvalue -> lvalue . '[' expr ']' (rule 8) lvalue -> '(' lvalue . ')' (rule 12) asgn -> lvalue . '=' expr (rule 13) asgn -> lvalue . PLUS_EQ expr (rule 14) asgn -> lvalue . MINUS_EQ expr (rule 15) asgn -> lvalue . '=' lvalue @1 SLASH_SLASH expr (rule 17) asgn -> lvalue . PLUS_PLUS (rule 19) asgn -> lvalue . MINUS_MINUS (rule 21) primary -> lvalue . (rule 22) '=' shift, and go to state 96 PLUS_EQ shift, and go to state 97 MINUS_EQ shift, and go to state 98 PLUS_PLUS shift, and go to state 99 MINUS_MINUS shift, and go to state 100 '[' shift, and go to state 101 ')' shift, and go to state 154 ')' [reduce using rule 22 (primary)] $default reduce using rule 22 (primary) state 94 primary -> '(' expr . ')' (rule 24) expr -> expr . '+' expr (rule 81) expr -> expr . '-' expr (rule 82) expr -> expr . '*' expr (rule 83) expr -> expr . '/' expr (rule 84) expr -> expr . '%' expr (rule 85) expr -> expr . SLASH_SLASH expr (rule 86) expr -> expr . '>' expr (rule 87) expr -> expr . GT_EQ expr (rule 88) expr -> expr . '<' expr (rule 89) expr -> expr . LT_EQ expr (rule 90) expr -> expr . EQ_EQ expr (rule 91) expr -> expr . NOT_EQ expr (rule 92) expr -> expr . '#' (rule 96) expr -> expr . '?' then expr colon expr (rule 99) expr -> expr . AND expr (rule 100) expr -> expr . OR expr (rule 101) expr -> expr . lazy_and expr (rule 102) expr -> expr . lazy_or expr (rule 103) expr -> expr . BITAND expr (rule 104) expr -> expr . BITOR expr (rule 105) '?' shift, and go to state 114 OR shift, and go to state 115 LAZY_OR shift, and go to state 116 AND shift, and go to state 117 LAZY_AND shift, and go to state 118 BITAND shift, and go to state 119 BITOR shift, and go to state 120 EQ_EQ shift, and go to state 121 NOT_EQ shift, and go to state 122 '>' shift, and go to state 123 GT_EQ shift, and go to state 124 '<' shift, and go to state 125 LT_EQ shift, and go to state 126 '+' shift, and go to state 127 '-' shift, and go to state 128 SLASH_SLASH shift, and go to state 129 '*' shift, and go to state 130 '/' shift, and go to state 131 '%' shift, and go to state 132 '#' shift, and go to state 133 ')' shift, and go to state 155 lazy_and go to state 135 lazy_or go to state 136 state 95 compound -> '{' stmtlist . '}' (rule 61) stmtlist -> stmtlist . stmt (rule 63) CONSTANT shift, and go to state 2 VAR shift, and go to state 3 FORMULA shift, and go to state 4 BLTIN shift, and go to state 5 LIB shift, and go to state 6 RLIB shift, and go to state 7 FUNC shift, and go to state 8 PROC shift, and go to state 9 PMAC shift, and go to state 10 FUNCTION shift, and go to state 11 PROCEDURE shift, and go to state 12 PROCMACRO shift, and go to state 13 LOCAL shift, and go to state 14 BREAK shift, and go to state 15 CONTINUE shift, and go to state 16 SWITCH shift, and go to state 17 CASE shift, and go to state 18 DEFAULT shift, and go to state 19 DO shift, and go to state 20 FOR shift, and go to state 21 WHILE shift, and go to state 22 IF shift, and go to state 23 SHIFT shift, and go to state 24 APPEND shift, and go to state 25 INSERT shift, and go to state 26 DELETE shift, and go to state 27 RETURN shift, and go to state 28 ARG shift, and go to state 29 '?' shift, and go to state 30 '-' shift, and go to state 31 '*' shift, and go to state 32 NOT shift, and go to state 33 '!' shift, and go to state 34 PLUS_PLUS shift, and go to state 35 MINUS_MINUS shift, and go to state 36 '&' shift, and go to state 37 EVAL shift, and go to state 38 '$' shift, and go to state 39 '[' shift, and go to state 40 '`' shift, and go to state 41 '(' shift, and go to state 42 ';' shift, and go to state 43 '{' shift, and go to state 44 '}' shift, and go to state 156 lvalue go to state 45 asgn go to state 46 primary go to state 47 secondary go to state 48 stmt go to state 157 while go to state 50 do go to state 51 for go to state 52 compound go to state 53 switch go to state 54 id go to state 55 identifier go to state 56 expr go to state 57 evaluate go to state 58 defn go to state 59 declare_relation go to state 60 declare_formula go to state 61 declare_action go to state 62 action go to state 63 state 96 asgn -> lvalue '=' . expr (rule 13) asgn -> lvalue '=' . lvalue @1 SLASH_SLASH expr (rule 17) CONSTANT shift, and go to state 2 VAR shift, and go to state 3 FORMULA shift, and go to state 4 BLTIN shift, and go to state 5 LIB shift, and go to state 6 RLIB shift, and go to state 7 FUNCTION shift, and go to state 11 PROCEDURE shift, and go to state 12 PROCMACRO shift, and go to state 13 LOCAL shift, and go to state 14 ARG shift, and go to state 29 '?' shift, and go to state 30 '-' shift, and go to state 31 '*' shift, and go to state 32 NOT shift, and go to state 33 '!' shift, and go to state 34 PLUS_PLUS shift, and go to state 35 MINUS_MINUS shift, and go to state 36 '&' shift, and go to state 37 EVAL shift, and go to state 38 '$' shift, and go to state 39 '[' shift, and go to state 40 '`' shift, and go to state 71 '(' shift, and go to state 42 lvalue go to state 158 asgn go to state 46 primary go to state 47 secondary go to state 48 id go to state 55 identifier go to state 75 expr go to state 159 evaluate go to state 58 state 97 asgn -> lvalue PLUS_EQ . expr (rule 14) CONSTANT shift, and go to state 2 VAR shift, and go to state 3 FORMULA shift, and go to state 4 BLTIN shift, and go to state 5 LIB shift, and go to state 6 RLIB shift, and go to state 7 FUNCTION shift, and go to state 11 PROCEDURE shift, and go to state 12 PROCMACRO shift, and go to state 13 LOCAL shift, and go to state 14 ARG shift, and go to state 29 '?' shift, and go to state 30 '-' shift, and go to state 31 '*' shift, and go to state 32 NOT shift, and go to state 33 '!' shift, and go to state 34 PLUS_PLUS shift, and go to state 35 MINUS_MINUS shift, and go to state 36 '&' shift, and go to state 37 EVAL shift, and go to state 38 '$' shift, and go to state 39 '[' shift, and go to state 40 '`' shift, and go to state 71 '(' shift, and go to state 42 lvalue go to state 45 asgn go to state 46 primary go to state 47 secondary go to state 48 id go to state 55 identifier go to state 75 expr go to state 160 evaluate go to state 58 state 98 asgn -> lvalue MINUS_EQ . expr (rule 15) CONSTANT shift, and go to state 2 VAR shift, and go to state 3 FORMULA shift, and go to state 4 BLTIN shift, and go to state 5 LIB shift, and go to state 6 RLIB shift, and go to state 7 FUNCTION shift, and go to state 11 PROCEDURE shift, and go to state 12 PROCMACRO shift, and go to state 13 LOCAL shift, and go to state 14 ARG shift, and go to state 29 '?' shift, and go to state 30 '-' shift, and go to state 31 '*' shift, and go to state 32 NOT shift, and go to state 33 '!' shift, and go to state 34 PLUS_PLUS shift, and go to state 35 MINUS_MINUS shift, and go to state 36 '&' shift, and go to state 37 EVAL shift, and go to state 38 '$' shift, and go to state 39 '[' shift, and go to state 40 '`' shift, and go to state 71 '(' shift, and go to state 42 lvalue go to state 45 asgn go to state 46 primary go to state 47 secondary go to state 48 id go to state 55 identifier go to state 75 expr go to state 161 evaluate go to state 58 state 99 asgn -> lvalue PLUS_PLUS . (rule 19) $default reduce using rule 19 (asgn) state 100 asgn -> lvalue MINUS_MINUS . (rule 21) $default reduce using rule 21 (asgn) state 101 lvalue -> lvalue '[' . expr ']' (rule 8) CONSTANT shift, and go to state 2 VAR shift, and go to state 3 FORMULA shift, and go to state 4 BLTIN shift, and go to state 5 LIB shift, and go to state 6 RLIB shift, and go to state 7 FUNCTION shift, and go to state 11 PROCEDURE shift, and go to state 12 PROCMACRO shift, and go to state 13 LOCAL shift, and go to state 14 ARG shift, and go to state 29 '?' shift, and go to state 30 '-' shift, and go to state 31 '*' shift, and go to state 32 NOT shift, and go to state 33 '!' shift, and go to state 34 PLUS_PLUS shift, and go to state 35 MINUS_MINUS shift, and go to state 36 '&' shift, and go to state 37 EVAL shift, and go to state 38 '$' shift, and go to state 39 '[' shift, and go to state 40 '`' shift, and go to state 71 '(' shift, and go to state 42 lvalue go to state 45 asgn go to state 46 primary go to state 47 secondary go to state 48 id go to state 55 identifier go to state 75 expr go to state 162 evaluate go to state 58 state 102 secondary -> primary '(' . arglist ')' (rule 25) CONSTANT shift, and go to state 2 VAR shift, and go to state 3 FORMULA shift, and go to state 4 BLTIN shift, and go to state 5 LIB shift, and go to state 6 RLIB shift, and go to state 7 FUNCTION shift, and go to state 11 PROCEDURE shift, and go to state 12 PROCMACRO shift, and go to state 13 LOCAL shift, and go to state 14 ARG shift, and go to state 29 '?' shift, and go to state 30 '-' shift, and go to state 31 '*' shift, and go to state 32 NOT shift, and go to state 33 '!' shift, and go to state 34 PLUS_PLUS shift, and go to state 35 MINUS_MINUS shift, and go to state 36 '&' shift, and go to state 37 EVAL shift, and go to state 38 '$' shift, and go to state 39 '[' shift, and go to state 40 '`' shift, and go to state 71 '(' shift, and go to state 42 $default reduce using rule 143 (arglist) lvalue go to state 45 asgn go to state 46 primary go to state 47 secondary go to state 48 id go to state 55 identifier go to state 75 expr go to state 150 evaluate go to state 58 arglist go to state 163 argument_list go to state 152 state 103 secondary -> secondary '[' . expr ']' (rule 26) CONSTANT shift, and go to state 2 VAR shift, and go to state 3 FORMULA shift, and go to state 4 BLTIN shift, and go to state 5 LIB shift, and go to state 6 RLIB shift, and go to state 7 FUNCTION shift, and go to state 11 PROCEDURE shift, and go to state 12 PROCMACRO shift, and go to state 13 LOCAL shift, and go to state 14 ARG shift, and go to state 29 '?' shift, and go to state 30 '-' shift, and go to state 31 '*' shift, and go to state 32 NOT shift, and go to state 33 '!' shift, and go to state 34 PLUS_PLUS shift, and go to state 35 MINUS_MINUS shift, and go to state 36 '&' shift, and go to state 37 EVAL shift, and go to state 38 '$' shift, and go to state 39 '[' shift, and go to state 40 '`' shift, and go to state 71 '(' shift, and go to state 42 lvalue go to state 45 asgn go to state 46 primary go to state 47 secondary go to state 48 id go to state 55 identifier go to state 75 expr go to state 164 evaluate go to state 58 state 104 stmt -> while '(' . expr ')' then stmt (rule 43) CONSTANT shift, and go to state 2 VAR shift, and go to state 3 FORMULA shift, and go to state 4 BLTIN shift, and go to state 5 LIB shift, and go to state 6 RLIB shift, and go to state 7 FUNCTION shift, and go to state 11 PROCEDURE shift, and go to state 12 PROCMACRO shift, and go to state 13 LOCAL shift, and go to state 14 ARG shift, and go to state 29 '?' shift, and go to state 30 '-' shift, and go to state 31 '*' shift, and go to state 32 NOT shift, and go to state 33 '!' shift, and go to state 34 PLUS_PLUS shift, and go to state 35 MINUS_MINUS shift, and go to state 36 '&' shift, and go to state 37 EVAL shift, and go to state 38 '$' shift, and go to state 39 '[' shift, and go to state 40 '`' shift, and go to state 71 '(' shift, and go to state 42 lvalue go to state 45 asgn go to state 46 primary go to state 47 secondary go to state 48 id go to state 55 identifier go to state 75 expr go to state 165 evaluate go to state 58 state 105 stmt -> do stmt . WHILE '(' expr ')' ';' (rule 42) WHILE shift, and go to state 166 state 106 expr1 -> ';' . (rule 51) $default reduce using rule 51 (expr1) state 107 stmt -> for expr1 . expr2 end_expr2 expr3 end_expr3 stmt (rule 41) CONSTANT shift, and go to state 2 VAR shift, and go to state 3 FORMULA shift, and go to state 4 BLTIN shift, and go to state 5 LIB shift, and go to state 6 RLIB shift, and go to state 7 FUNCTION shift, and go to state 11 PROCEDURE shift, and go to state 12 PROCMACRO shift, and go to state 13 LOCAL shift, and go to state 14 ARG shift, and go to state 29 '?' shift, and go to state 30 '-' shift, and go to state 31 '*' shift, and go to state 32 NOT shift, and go to state 33 '!' shift, and go to state 34 PLUS_PLUS shift, and go to state 35 MINUS_MINUS shift, and go to state 36 '&' shift, and go to state 37 EVAL shift, and go to state 38 '$' shift, and go to state 39 '[' shift, and go to state 40 '`' shift, and go to state 71 '(' shift, and go to state 42 ';' shift, and go to state 167 lvalue go to state 45 asgn go to state 46 primary go to state 47 secondary go to state 48 expr2 go to state 168 id go to state 55 identifier go to state 75 expr go to state 169 evaluate go to state 58 state 108 expr1 -> expr . ';' (rule 52) expr -> expr . '+' expr (rule 81) expr -> expr . '-' expr (rule 82) expr -> expr . '*' expr (rule 83) expr -> expr . '/' expr (rule 84) expr -> expr . '%' expr (rule 85) expr -> expr . SLASH_SLASH expr (rule 86) expr -> expr . '>' expr (rule 87) expr -> expr . GT_EQ expr (rule 88) expr -> expr . '<' expr (rule 89) expr -> expr . LT_EQ expr (rule 90) expr -> expr . EQ_EQ expr (rule 91) expr -> expr . NOT_EQ expr (rule 92) expr -> expr . '#' (rule 96) expr -> expr . '?' then expr colon expr (rule 99) expr -> expr . AND expr (rule 100) expr -> expr . OR expr (rule 101) expr -> expr . lazy_and expr (rule 102) expr -> expr . lazy_or expr (rule 103) expr -> expr . BITAND expr (rule 104) expr -> expr . BITOR expr (rule 105) '?' shift, and go to state 114 OR shift, and go to state 115 LAZY_OR shift, and go to state 116 AND shift, and go to state 117 LAZY_AND shift, and go to state 118 BITAND shift, and go to state 119 BITOR shift, and go to state 120 EQ_EQ shift, and go to state 121 NOT_EQ shift, and go to state 122 '>' shift, and go to state 123 GT_EQ shift, and go to state 124 '<' shift, and go to state 125 LT_EQ shift, and go to state 126 '+' shift, and go to state 127 '-' shift, and go to state 128 SLASH_SLASH shift, and go to state 129 '*' shift, and go to state 130 '/' shift, and go to state 131 '%' shift, and go to state 132 '#' shift, and go to state 133 ';' shift, and go to state 170 lazy_and go to state 135 lazy_or go to state 136 state 109 stmt -> switch expr . cases stmt (rule 40) expr -> expr . '+' expr (rule 81) expr -> expr . '-' expr (rule 82) expr -> expr . '*' expr (rule 83) expr -> expr . '/' expr (rule 84) expr -> expr . '%' expr (rule 85) expr -> expr . SLASH_SLASH expr (rule 86) expr -> expr . '>' expr (rule 87) expr -> expr . GT_EQ expr (rule 88) expr -> expr . '<' expr (rule 89) expr -> expr . LT_EQ expr (rule 90) expr -> expr . EQ_EQ expr (rule 91) expr -> expr . NOT_EQ expr (rule 92) expr -> expr . '#' (rule 96) expr -> expr . '?' then expr colon expr (rule 99) expr -> expr . AND expr (rule 100) expr -> expr . OR expr (rule 101) expr -> expr . lazy_and expr (rule 102) expr -> expr . lazy_or expr (rule 103) expr -> expr . BITAND expr (rule 104) expr -> expr . BITOR expr (rule 105) '?' shift, and go to state 114 OR shift, and go to state 115 LAZY_OR shift, and go to state 116 AND shift, and go to state 117 LAZY_AND shift, and go to state 118 BITAND shift, and go to state 119 BITOR shift, and go to state 120 EQ_EQ shift, and go to state 121 NOT_EQ shift, and go to state 122 '>' shift, and go to state 123 GT_EQ shift, and go to state 124 '<' shift, and go to state 125 LT_EQ shift, and go to state 126 '+' shift, and go to state 127 '-' shift, and go to state 128 SLASH_SLASH shift, and go to state 129 '*' shift, and go to state 130 '/' shift, and go to state 131 '%' shift, and go to state 132 '#' shift, and go to state 133 ')' shift, and go to state 171 cases go to state 172 lazy_and go to state 135 lazy_or go to state 136 state 110 is -> IS . (rule 121) $default reduce using rule 121 (is) state 111 tilde_gt -> TILDE_GT . (rule 117) $default reduce using rule 117 (tilde_gt) state 112 declare_relation -> identifier tilde_gt . '[' id_list_opt ']' ';' (rule 114) '[' shift, and go to state 173 state 113 declare_formula -> identifier is . expr ';' (rule 118) CONSTANT shift, and go to state 2 VAR shift, and go to state 3 FORMULA shift, and go to state 4 BLTIN shift, and go to state 5 LIB shift, and go to state 6 RLIB shift, and go to state 7 FUNCTION shift, and go to state 11 PROCEDURE shift, and go to state 12 PROCMACRO shift, and go to state 13 LOCAL shift, and go to state 14 ARG shift, and go to state 29 '?' shift, and go to state 30 '-' shift, and go to state 31 '*' shift, and go to state 32 NOT shift, and go to state 33 '!' shift, and go to state 34 PLUS_PLUS shift, and go to state 35 MINUS_MINUS shift, and go to state 36 '&' shift, and go to state 37 EVAL shift, and go to state 38 '$' shift, and go to state 39 '[' shift, and go to state 40 '`' shift, and go to state 71 '(' shift, and go to state 42 lvalue go to state 45 asgn go to state 46 primary go to state 47 secondary go to state 48 id go to state 55 identifier go to state 75 expr go to state 174 evaluate go to state 58 state 114 expr -> expr '?' . then expr colon expr (rule 99) $default reduce using rule 59 (then) then go to state 175 state 115 expr -> expr OR . expr (rule 101) CONSTANT shift, and go to state 2 VAR shift, and go to state 3 FORMULA shift, and go to state 4 BLTIN shift, and go to state 5 LIB shift, and go to state 6 RLIB shift, and go to state 7 FUNCTION shift, and go to state 11 PROCEDURE shift, and go to state 12 PROCMACRO shift, and go to state 13 LOCAL shift, and go to state 14 ARG shift, and go to state 29 '?' shift, and go to state 30 '-' shift, and go to state 31 '*' shift, and go to state 32 NOT shift, and go to state 33 '!' shift, and go to state 34 PLUS_PLUS shift, and go to state 35 MINUS_MINUS shift, and go to state 36 '&' shift, and go to state 37 EVAL shift, and go to state 38 '$' shift, and go to state 39 '[' shift, and go to state 40 '`' shift, and go to state 71 '(' shift, and go to state 42 lvalue go to state 45 asgn go to state 46 primary go to state 47 secondary go to state 48 id go to state 55 identifier go to state 75 expr go to state 176 evaluate go to state 58 state 116 lazy_or -> LAZY_OR . (rule 110) $default reduce using rule 110 (lazy_or) state 117 expr -> expr AND . expr (rule 100) CONSTANT shift, and go to state 2 VAR shift, and go to state 3 FORMULA shift, and go to state 4 BLTIN shift, and go to state 5 LIB shift, and go to state 6 RLIB shift, and go to state 7 FUNCTION shift, and go to state 11 PROCEDURE shift, and go to state 12 PROCMACRO shift, and go to state 13 LOCAL shift, and go to state 14 ARG shift, and go to state 29 '?' shift, and go to state 30 '-' shift, and go to state 31 '*' shift, and go to state 32 NOT shift, and go to state 33 '!' shift, and go to state 34 PLUS_PLUS shift, and go to state 35 MINUS_MINUS shift, and go to state 36 '&' shift, and go to state 37 EVAL shift, and go to state 38 '$' shift, and go to state 39 '[' shift, and go to state 40 '`' shift, and go to state 71 '(' shift, and go to state 42 lvalue go to state 45 asgn go to state 46 primary go to state 47 secondary go to state 48 id go to state 55 identifier go to state 75 expr go to state 177 evaluate go to state 58 state 118 lazy_and -> LAZY_AND . (rule 109) $default reduce using rule 109 (lazy_and) state 119 expr -> expr BITAND . expr (rule 104) CONSTANT shift, and go to state 2 VAR shift, and go to state 3 FORMULA shift, and go to state 4 BLTIN shift, and go to state 5 LIB shift, and go to state 6 RLIB shift, and go to state 7 FUNCTION shift, and go to state 11 PROCEDURE shift, and go to state 12 PROCMACRO shift, and go to state 13 LOCAL shift, and go to state 14 ARG shift, and go to state 29 '?' shift, and go to state 30 '-' shift, and go to state 31 '*' shift, and go to state 32 NOT shift, and go to state 33 '!' shift, and go to state 34 PLUS_PLUS shift, and go to state 35 MINUS_MINUS shift, and go to state 36 '&' shift, and go to state 37 EVAL shift, and go to state 38 '$' shift, and go to state 39 '[' shift, and go to state 40 '`' shift, and go to state 71 '(' shift, and go to state 42 lvalue go to state 45 asgn go to state 46 primary go to state 47 secondary go to state 48 id go to state 55 identifier go to state 75 expr go to state 178 evaluate go to state 58 state 120 expr -> expr BITOR . expr (rule 105) CONSTANT shift, and go to state 2 VAR shift, and go to state 3 FORMULA shift, and go to state 4 BLTIN shift, and go to state 5 LIB shift, and go to state 6 RLIB shift, and go to state 7 FUNCTION shift, and go to state 11 PROCEDURE shift, and go to state 12 PROCMACRO shift, and go to state 13 LOCAL shift, and go to state 14 ARG shift, and go to state 29 '?' shift, and go to state 30 '-' shift, and go to state 31 '*' shift, and go to state 32 NOT shift, and go to state 33 '!' shift, and go to state 34 PLUS_PLUS shift, and go to state 35 MINUS_MINUS shift, and go to state 36 '&' shift, and go to state 37 EVAL shift, and go to state 38 '$' shift, and go to state 39 '[' shift, and go to state 40 '`' shift, and go to state 71 '(' shift, and go to state 42 lvalue go to state 45 asgn go to state 46 primary go to state 47 secondary go to state 48 id go to state 55 identifier go to state 75 expr go to state 179 evaluate go to state 58 state 121 expr -> expr EQ_EQ . expr (rule 91) CONSTANT shift, and go to state 2 VAR shift, and go to state 3 FORMULA shift, and go to state 4 BLTIN shift, and go to state 5 LIB shift, and go to state 6 RLIB shift, and go to state 7 FUNCTION shift, and go to state 11 PROCEDURE shift, and go to state 12 PROCMACRO shift, and go to state 13 LOCAL shift, and go to state 14 ARG shift, and go to state 29 '?' shift, and go to state 30 '-' shift, and go to state 31 '*' shift, and go to state 32 NOT shift, and go to state 33 '!' shift, and go to state 34 PLUS_PLUS shift, and go to state 35 MINUS_MINUS shift, and go to state 36 '&' shift, and go to state 37 EVAL shift, and go to state 38 '$' shift, and go to state 39 '[' shift, and go to state 40 '`' shift, and go to state 71 '(' shift, and go to state 42 lvalue go to state 45 asgn go to state 46 primary go to state 47 secondary go to state 48 id go to state 55 identifier go to state 75 expr go to state 180 evaluate go to state 58 state 122 expr -> expr NOT_EQ . expr (rule 92) CONSTANT shift, and go to state 2 VAR shift, and go to state 3 FORMULA shift, and go to state 4 BLTIN shift, and go to state 5 LIB shift, and go to state 6 RLIB shift, and go to state 7 FUNCTION shift, and go to state 11 PROCEDURE shift, and go to state 12 PROCMACRO shift, and go to state 13 LOCAL shift, and go to state 14 ARG shift, and go to state 29 '?' shift, and go to state 30 '-' shift, and go to state 31 '*' shift, and go to state 32 NOT shift, and go to state 33 '!' shift, and go to state 34 PLUS_PLUS shift, and go to state 35 MINUS_MINUS shift, and go to state 36 '&' shift, and go to state 37 EVAL shift, and go to state 38 '$' shift, and go to state 39 '[' shift, and go to state 40 '`' shift, and go to state 71 '(' shift, and go to state 42 lvalue go to state 45 asgn go to state 46 primary go to state 47 secondary go to state 48 id go to state 55 identifier go to state 75 expr go to state 181 evaluate go to state 58 state 123 expr -> expr '>' . expr (rule 87) CONSTANT shift, and go to state 2 VAR shift, and go to state 3 FORMULA shift, and go to state 4 BLTIN shift, and go to state 5 LIB shift, and go to state 6 RLIB shift, and go to state 7 FUNCTION shift, and go to state 11 PROCEDURE shift, and go to state 12 PROCMACRO shift, and go to state 13 LOCAL shift, and go to state 14 ARG shift, and go to state 29 '?' shift, and go to state 30 '-' shift, and go to state 31 '*' shift, and go to state 32 NOT shift, and go to state 33 '!' shift, and go to state 34 PLUS_PLUS shift, and go to state 35 MINUS_MINUS shift, and go to state 36 '&' shift, and go to state 37 EVAL shift, and go to state 38 '$' shift, and go to state 39 '[' shift, and go to state 40 '`' shift, and go to state 71 '(' shift, and go to state 42 lvalue go to state 45 asgn go to state 46 primary go to state 47 secondary go to state 48 id go to state 55 identifier go to state 75 expr go to state 182 evaluate go to state 58 state 124 expr -> expr GT_EQ . expr (rule 88) CONSTANT shift, and go to state 2 VAR shift, and go to state 3 FORMULA shift, and go to state 4 BLTIN shift, and go to state 5 LIB shift, and go to state 6 RLIB shift, and go to state 7 FUNCTION shift, and go to state 11 PROCEDURE shift, and go to state 12 PROCMACRO shift, and go to state 13 LOCAL shift, and go to state 14 ARG shift, and go to state 29 '?' shift, and go to state 30 '-' shift, and go to state 31 '*' shift, and go to state 32 NOT shift, and go to state 33 '!' shift, and go to state 34 PLUS_PLUS shift, and go to state 35 MINUS_MINUS shift, and go to state 36 '&' shift, and go to state 37 EVAL shift, and go to state 38 '$' shift, and go to state 39 '[' shift, and go to state 40 '`' shift, and go to state 71 '(' shift, and go to state 42 lvalue go to state 45 asgn go to state 46 primary go to state 47 secondary go to state 48 id go to state 55 identifier go to state 75 expr go to state 183 evaluate go to state 58 state 125 expr -> expr '<' . expr (rule 89) CONSTANT shift, and go to state 2 VAR shift, and go to state 3 FORMULA shift, and go to state 4 BLTIN shift, and go to state 5 LIB shift, and go to state 6 RLIB shift, and go to state 7 FUNCTION shift, and go to state 11 PROCEDURE shift, and go to state 12 PROCMACRO shift, and go to state 13 LOCAL shift, and go to state 14 ARG shift, and go to state 29 '?' shift, and go to state 30 '-' shift, and go to state 31 '*' shift, and go to state 32 NOT shift, and go to state 33 '!' shift, and go to state 34 PLUS_PLUS shift, and go to state 35 MINUS_MINUS shift, and go to state 36 '&' shift, and go to state 37 EVAL shift, and go to state 38 '$' shift, and go to state 39 '[' shift, and go to state 40 '`' shift, and go to state 71 '(' shift, and go to state 42 lvalue go to state 45 asgn go to state 46 primary go to state 47 secondary go to state 48 id go to state 55 identifier go to state 75 expr go to state 184 evaluate go to state 58 state 126 expr -> expr LT_EQ . expr (rule 90) CONSTANT shift, and go to state 2 VAR shift, and go to state 3 FORMULA shift, and go to state 4 BLTIN shift, and go to state 5 LIB shift, and go to state 6 RLIB shift, and go to state 7 FUNCTION shift, and go to state 11 PROCEDURE shift, and go to state 12 PROCMACRO shift, and go to state 13 LOCAL shift, and go to state 14 ARG shift, and go to state 29 '?' shift, and go to state 30 '-' shift, and go to state 31 '*' shift, and go to state 32 NOT shift, and go to state 33 '!' shift, and go to state 34 PLUS_PLUS shift, and go to state 35 MINUS_MINUS shift, and go to state 36 '&' shift, and go to state 37 EVAL shift, and go to state 38 '$' shift, and go to state 39 '[' shift, and go to state 40 '`' shift, and go to state 71 '(' shift, and go to state 42 lvalue go to state 45 asgn go to state 46 primary go to state 47 secondary go to state 48 id go to state 55 identifier go to state 75 expr go to state 185 evaluate go to state 58 state 127 expr -> expr '+' . expr (rule 81) CONSTANT shift, and go to state 2 VAR shift, and go to state 3 FORMULA shift, and go to state 4 BLTIN shift, and go to state 5 LIB shift, and go to state 6 RLIB shift, and go to state 7 FUNCTION shift, and go to state 11 PROCEDURE shift, and go to state 12 PROCMACRO shift, and go to state 13 LOCAL shift, and go to state 14 ARG shift, and go to state 29 '?' shift, and go to state 30 '-' shift, and go to state 31 '*' shift, and go to state 32 NOT shift, and go to state 33 '!' shift, and go to state 34 PLUS_PLUS shift, and go to state 35 MINUS_MINUS shift, and go to state 36 '&' shift, and go to state 37 EVAL shift, and go to state 38 '$' shift, and go to state 39 '[' shift, and go to state 40 '`' shift, and go to state 71 '(' shift, and go to state 42 lvalue go to state 45 asgn go to state 46 primary go to state 47 secondary go to state 48 id go to state 55 identifier go to state 75 expr go to state 186 evaluate go to state 58 state 128 expr -> expr '-' . expr (rule 82) CONSTANT shift, and go to state 2 VAR shift, and go to state 3 FORMULA shift, and go to state 4 BLTIN shift, and go to state 5 LIB shift, and go to state 6 RLIB shift, and go to state 7 FUNCTION shift, and go to state 11 PROCEDURE shift, and go to state 12 PROCMACRO shift, and go to state 13 LOCAL shift, and go to state 14 ARG shift, and go to state 29 '?' shift, and go to state 30 '-' shift, and go to state 31 '*' shift, and go to state 32 NOT shift, and go to state 33 '!' shift, and go to state 34 PLUS_PLUS shift, and go to state 35 MINUS_MINUS shift, and go to state 36 '&' shift, and go to state 37 EVAL shift, and go to state 38 '$' shift, and go to state 39 '[' shift, and go to state 40 '`' shift, and go to state 71 '(' shift, and go to state 42 lvalue go to state 45 asgn go to state 46 primary go to state 47 secondary go to state 48 id go to state 55 identifier go to state 75 expr go to state 187 evaluate go to state 58 state 129 expr -> expr SLASH_SLASH . expr (rule 86) CONSTANT shift, and go to state 2 VAR shift, and go to state 3 FORMULA shift, and go to state 4 BLTIN shift, and go to state 5 LIB shift, and go to state 6 RLIB shift, and go to state 7 FUNCTION shift, and go to state 11 PROCEDURE shift, and go to state 12 PROCMACRO shift, and go to state 13 LOCAL shift, and go to state 14 ARG shift, and go to state 29 '?' shift, and go to state 30 '-' shift, and go to state 31 '*' shift, and go to state 32 NOT shift, and go to state 33 '!' shift, and go to state 34 PLUS_PLUS shift, and go to state 35 MINUS_MINUS shift, and go to state 36 '&' shift, and go to state 37 EVAL shift, and go to state 38 '$' shift, and go to state 39 '[' shift, and go to state 40 '`' shift, and go to state 71 '(' shift, and go to state 42 lvalue go to state 45 asgn go to state 46 primary go to state 47 secondary go to state 48 id go to state 55 identifier go to state 75 expr go to state 188 evaluate go to state 58 state 130 expr -> expr '*' . expr (rule 83) CONSTANT shift, and go to state 2 VAR shift, and go to state 3 FORMULA shift, and go to state 4 BLTIN shift, and go to state 5 LIB shift, and go to state 6 RLIB shift, and go to state 7 FUNCTION shift, and go to state 11 PROCEDURE shift, and go to state 12 PROCMACRO shift, and go to state 13 LOCAL shift, and go to state 14 ARG shift, and go to state 29 '?' shift, and go to state 30 '-' shift, and go to state 31 '*' shift, and go to state 32 NOT shift, and go to state 33 '!' shift, and go to state 34 PLUS_PLUS shift, and go to state 35 MINUS_MINUS shift, and go to state 36 '&' shift, and go to state 37 EVAL shift, and go to state 38 '$' shift, and go to state 39 '[' shift, and go to state 40 '`' shift, and go to state 71 '(' shift, and go to state 42 lvalue go to state 45 asgn go to state 46 primary go to state 47 secondary go to state 48 id go to state 55 identifier go to state 75 expr go to state 189 evaluate go to state 58 state 131 expr -> expr '/' . expr (rule 84) CONSTANT shift, and go to state 2 VAR shift, and go to state 3 FORMULA shift, and go to state 4 BLTIN shift, and go to state 5 LIB shift, and go to state 6 RLIB shift, and go to state 7 FUNCTION shift, and go to state 11 PROCEDURE shift, and go to state 12 PROCMACRO shift, and go to state 13 LOCAL shift, and go to state 14 ARG shift, and go to state 29 '?' shift, and go to state 30 '-' shift, and go to state 31 '*' shift, and go to state 32 NOT shift, and go to state 33 '!' shift, and go to state 34 PLUS_PLUS shift, and go to state 35 MINUS_MINUS shift, and go to state 36 '&' shift, and go to state 37 EVAL shift, and go to state 38 '$' shift, and go to state 39 '[' shift, and go to state 40 '`' shift, and go to state 71 '(' shift, and go to state 42 lvalue go to state 45 asgn go to state 46 primary go to state 47 secondary go to state 48 id go to state 55 identifier go to state 75 expr go to state 190 evaluate go to state 58 state 132 expr -> expr '%' . expr (rule 85) CONSTANT shift, and go to state 2 VAR shift, and go to state 3 FORMULA shift, and go to state 4 BLTIN shift, and go to state 5 LIB shift, and go to state 6 RLIB shift, and go to state 7 FUNCTION shift, and go to state 11 PROCEDURE shift, and go to state 12 PROCMACRO shift, and go to state 13 LOCAL shift, and go to state 14 ARG shift, and go to state 29 '?' shift, and go to state 30 '-' shift, and go to state 31 '*' shift, and go to state 32 NOT shift, and go to state 33 '!' shift, and go to state 34 PLUS_PLUS shift, and go to state 35 MINUS_MINUS shift, and go to state 36 '&' shift, and go to state 37 EVAL shift, and go to state 38 '$' shift, and go to state 39 '[' shift, and go to state 40 '`' shift, and go to state 71 '(' shift, and go to state 42 lvalue go to state 45 asgn go to state 46 primary go to state 47 secondary go to state 48 id go to state 55 identifier go to state 75 expr go to state 191 evaluate go to state 58 state 133 expr -> expr '#' . (rule 96) $default reduce using rule 96 (expr) state 134 stmt -> expr ';' . (rule 28) $default reduce using rule 28 (stmt) state 135 expr -> expr lazy_and . expr (rule 102) CONSTANT shift, and go to state 2 VAR shift, and go to state 3 FORMULA shift, and go to state 4 BLTIN shift, and go to state 5 LIB shift, and go to state 6 RLIB shift, and go to state 7 FUNCTION shift, and go to state 11 PROCEDURE shift, and go to state 12 PROCMACRO shift, and go to state 13 LOCAL shift, and go to state 14 ARG shift, and go to state 29 '?' shift, and go to state 30 '-' shift, and go to state 31 '*' shift, and go to state 32 NOT shift, and go to state 33 '!' shift, and go to state 34 PLUS_PLUS shift, and go to state 35 MINUS_MINUS shift, and go to state 36 '&' shift, and go to state 37 EVAL shift, and go to state 38 '$' shift, and go to state 39 '[' shift, and go to state 40 '`' shift, and go to state 71 '(' shift, and go to state 42 lvalue go to state 45 asgn go to state 46 primary go to state 47 secondary go to state 48 id go to state 55 identifier go to state 75 expr go to state 192 evaluate go to state 58 state 136 expr -> expr lazy_or . expr (rule 103) CONSTANT shift, and go to state 2 VAR shift, and go to state 3 FORMULA shift, and go to state 4 BLTIN shift, and go to state 5 LIB shift, and go to state 6 RLIB shift, and go to state 7 FUNCTION shift, and go to state 11 PROCEDURE shift, and go to state 12 PROCMACRO shift, and go to state 13 LOCAL shift, and go to state 14 ARG shift, and go to state 29 '?' shift, and go to state 30 '-' shift, and go to state 31 '*' shift, and go to state 32 NOT shift, and go to state 33 '!' shift, and go to state 34 PLUS_PLUS shift, and go to state 35 MINUS_MINUS shift, and go to state 36 '&' shift, and go to state 37 EVAL shift, and go to state 38 '$' shift, and go to state 39 '[' shift, and go to state 40 '`' shift, and go to state 71 '(' shift, and go to state 42 lvalue go to state 45 asgn go to state 46 primary go to state 47 secondary go to state 48 id go to state 55 identifier go to state 75 expr go to state 193 evaluate go to state 58 state 137 expr -> evaluate '(' . expr ')' (rule 106) CONSTANT shift, and go to state 2 VAR shift, and go to state 3 FORMULA shift, and go to state 4 BLTIN shift, and go to state 5 LIB shift, and go to state 6 RLIB shift, and go to state 7 FUNCTION shift, and go to state 11 PROCEDURE shift, and go to state 12 PROCMACRO shift, and go to state 13 LOCAL shift, and go to state 14 ARG shift, and go to state 29 '?' shift, and go to state 30 '-' shift, and go to state 31 '*' shift, and go to state 32 NOT shift, and go to state 33 '!' shift, and go to state 34 PLUS_PLUS shift, and go to state 35 MINUS_MINUS shift, and go to state 36 '&' shift, and go to state 37 EVAL shift, and go to state 38 '$' shift, and go to state 39 '[' shift, and go to state 40 '`' shift, and go to state 71 '(' shift, and go to state 42 lvalue go to state 45 asgn go to state 46 primary go to state 47 secondary go to state 48 id go to state 55 identifier go to state 75 expr go to state 194 evaluate go to state 58 state 138 declare_action -> action identifier . @5 refer_opt def_begin declare_para declare_local stmtlist def_end (rule 123) $default reduce using rule 122 (@5) @5 go to state 195 state 139 stmt -> CASE CONSTANT ':' . (rule 36) $default reduce using rule 36 (stmt) state 140 stmt -> IF '(' expr . ')' then stmt (rule 44) stmt -> IF '(' expr . ')' then stmt else stmt (rule 45) expr -> expr . '+' expr (rule 81) expr -> expr . '-' expr (rule 82) expr -> expr . '*' expr (rule 83) expr -> expr . '/' expr (rule 84) expr -> expr . '%' expr (rule 85) expr -> expr . SLASH_SLASH expr (rule 86) expr -> expr . '>' expr (rule 87) expr -> expr . GT_EQ expr (rule 88) expr -> expr . '<' expr (rule 89) expr -> expr . LT_EQ expr (rule 90) expr -> expr . EQ_EQ expr (rule 91) expr -> expr . NOT_EQ expr (rule 92) expr -> expr . '#' (rule 96) expr -> expr . '?' then expr colon expr (rule 99) expr -> expr . AND expr (rule 100) expr -> expr . OR expr (rule 101) expr -> expr . lazy_and expr (rule 102) expr -> expr . lazy_or expr (rule 103) expr -> expr . BITAND expr (rule 104) expr -> expr . BITOR expr (rule 105) '?' shift, and go to state 114 OR shift, and go to state 115 LAZY_OR shift, and go to state 116 AND shift, and go to state 117 LAZY_AND shift, and go to state 118 BITAND shift, and go to state 119 BITOR shift, and go to state 120 EQ_EQ shift, and go to state 121 NOT_EQ shift, and go to state 122 '>' shift, and go to state 123 GT_EQ shift, and go to state 124 '<' shift, and go to state 125 LT_EQ shift, and go to state 126 '+' shift, and go to state 127 '-' shift, and go to state 128 SLASH_SLASH shift, and go to state 129 '*' shift, and go to state 130 '/' shift, and go to state 131 '%' shift, and go to state 132 '#' shift, and go to state 133 ')' shift, and go to state 196 lazy_and go to state 135 lazy_or go to state 136 state 141 lvalue -> '`' expr . '`' (rule 11) expr -> expr . '+' expr (rule 81) expr -> expr . '-' expr (rule 82) expr -> expr . '*' expr (rule 83) expr -> expr . '/' expr (rule 84) expr -> expr . '%' expr (rule 85) expr -> expr . SLASH_SLASH expr (rule 86) expr -> expr . '>' expr (rule 87) expr -> expr . GT_EQ expr (rule 88) expr -> expr . '<' expr (rule 89) expr -> expr . LT_EQ expr (rule 90) expr -> expr . EQ_EQ expr (rule 91) expr -> expr . NOT_EQ expr (rule 92) expr -> expr . '#' (rule 96) expr -> expr . '?' then expr colon expr (rule 99) expr -> expr . AND expr (rule 100) expr -> expr . OR expr (rule 101) expr -> expr . lazy_and expr (rule 102) expr -> expr . lazy_or expr (rule 103) expr -> expr . BITAND expr (rule 104) expr -> expr . BITOR expr (rule 105) '?' shift, and go to state 114 OR shift, and go to state 115 LAZY_OR shift, and go to state 116 AND shift, and go to state 117 LAZY_AND shift, and go to state 118 BITAND shift, and go to state 119 BITOR shift, and go to state 120 EQ_EQ shift, and go to state 121 NOT_EQ shift, and go to state 122 '>' shift, and go to state 123 GT_EQ shift, and go to state 124 '<' shift, and go to state 125 LT_EQ shift, and go to state 126 '+' shift, and go to state 127 '-' shift, and go to state 128 SLASH_SLASH shift, and go to state 129 '*' shift, and go to state 130 '/' shift, and go to state 131 '%' shift, and go to state 132 '#' shift, and go to state 133 '`' shift, and go to state 197 lazy_and go to state 135 lazy_or go to state 136 state 142 lvalue -> lvalue . '[' expr ']' (rule 8) lvalue -> '(' lvalue . ')' (rule 12) '[' shift, and go to state 101 ')' shift, and go to state 154 state 143 stmt -> SHIFT lvalue ';' . (rule 32) $default reduce using rule 32 (stmt) state 144 stmt -> APPEND lvalue ',' . expr ';' (rule 33) CONSTANT shift, and go to state 2 VAR shift, and go to state 3 FORMULA shift, and go to state 4 BLTIN shift, and go to state 5 LIB shift, and go to state 6 RLIB shift, and go to state 7 FUNCTION shift, and go to state 11 PROCEDURE shift, and go to state 12 PROCMACRO shift, and go to state 13 LOCAL shift, and go to state 14 ARG shift, and go to state 29 '?' shift, and go to state 30 '-' shift, and go to state 31 '*' shift, and go to state 32 NOT shift, and go to state 33 '!' shift, and go to state 34 PLUS_PLUS shift, and go to state 35 MINUS_MINUS shift, and go to state 36 '&' shift, and go to state 37 EVAL shift, and go to state 38 '$' shift, and go to state 39 '[' shift, and go to state 40 '`' shift, and go to state 71 '(' shift, and go to state 42 lvalue go to state 45 asgn go to state 46 primary go to state 47 secondary go to state 48 id go to state 55 identifier go to state 75 expr go to state 198 evaluate go to state 58 state 145 stmt -> INSERT lvalue ',' . expr ',' expr ';' (rule 34) CONSTANT shift, and go to state 2 VAR shift, and go to state 3 FORMULA shift, and go to state 4 BLTIN shift, and go to state 5 LIB shift, and go to state 6 RLIB shift, and go to state 7 FUNCTION shift, and go to state 11 PROCEDURE shift, and go to state 12 PROCMACRO shift, and go to state 13 LOCAL shift, and go to state 14 ARG shift, and go to state 29 '?' shift, and go to state 30 '-' shift, and go to state 31 '*' shift, and go to state 32 NOT shift, and go to state 33 '!' shift, and go to state 34 PLUS_PLUS shift, and go to state 35 MINUS_MINUS shift, and go to state 36 '&' shift, and go to state 37 EVAL shift, and go to state 38 '$' shift, and go to state 39 '[' shift, and go to state 40 '`' shift, and go to state 71 '(' shift, and go to state 42 lvalue go to state 45 asgn go to state 46 primary go to state 47 secondary go to state 48 id go to state 55 identifier go to state 75 expr go to state 199 evaluate go to state 58 state 146 stmt -> DELETE lvalue ',' . expr ';' (rule 35) CONSTANT shift, and go to state 2 VAR shift, and go to state 3 FORMULA shift, and go to state 4 BLTIN shift, and go to state 5 LIB shift, and go to state 6 RLIB shift, and go to state 7 FUNCTION shift, and go to state 11 PROCEDURE shift, and go to state 12 PROCMACRO shift, and go to state 13 LOCAL shift, and go to state 14 ARG shift, and go to state 29 '?' shift, and go to state 30 '-' shift, and go to state 31 '*' shift, and go to state 32 NOT shift, and go to state 33 '!' shift, and go to state 34 PLUS_PLUS shift, and go to state 35 MINUS_MINUS shift, and go to state 36 '&' shift, and go to state 37 EVAL shift, and go to state 38 '$' shift, and go to state 39 '[' shift, and go to state 40 '`' shift, and go to state 71 '(' shift, and go to state 42 lvalue go to state 45 asgn go to state 46 primary go to state 47 secondary go to state 48 id go to state 55 identifier go to state 75 expr go to state 200 evaluate go to state 58 state 147 stmt -> RETURN expr ';' . (rule 30) $default reduce using rule 30 (stmt) state 148 lvalue -> lvalue . '[' expr ']' (rule 8) expr -> '?' @2 lvalue . (rule 94) '[' shift, and go to state 101 $default reduce using rule 94 (expr) state 149 lvalue -> lvalue . '[' expr ']' (rule 8) lvalue -> '*' '&' lvalue . (rule 10) '[' shift, and go to state 101 '[' [reduce using rule 10 (lvalue)] $default reduce using rule 10 (lvalue) state 150 expr -> expr . '+' expr (rule 81) expr -> expr . '-' expr (rule 82) expr -> expr . '*' expr (rule 83) expr -> expr . '/' expr (rule 84) expr -> expr . '%' expr (rule 85) expr -> expr . SLASH_SLASH expr (rule 86) expr -> expr . '>' expr (rule 87) expr -> expr . GT_EQ expr (rule 88) expr -> expr . '<' expr (rule 89) expr -> expr . LT_EQ expr (rule 90) expr -> expr . EQ_EQ expr (rule 91) expr -> expr . NOT_EQ expr (rule 92) expr -> expr . '#' (rule 96) expr -> expr . '?' then expr colon expr (rule 99) expr -> expr . AND expr (rule 100) expr -> expr . OR expr (rule 101) expr -> expr . lazy_and expr (rule 102) expr -> expr . lazy_or expr (rule 103) expr -> expr . BITAND expr (rule 104) expr -> expr . BITOR expr (rule 105) argument_list -> expr . (rule 145) '?' shift, and go to state 114 OR shift, and go to state 115 LAZY_OR shift, and go to state 116 AND shift, and go to state 117 LAZY_AND shift, and go to state 118 BITAND shift, and go to state 119 BITOR shift, and go to state 120 EQ_EQ shift, and go to state 121 NOT_EQ shift, and go to state 122 '>' shift, and go to state 123 GT_EQ shift, and go to state 124 '<' shift, and go to state 125 LT_EQ shift, and go to state 126 '+' shift, and go to state 127 '-' shift, and go to state 128 SLASH_SLASH shift, and go to state 129 '*' shift, and go to state 130 '/' shift, and go to state 131 '%' shift, and go to state 132 '#' shift, and go to state 133 $default reduce using rule 145 (argument_list) lazy_and go to state 135 lazy_or go to state 136 state 151 expr -> '[' begin arglist . ']' (rule 80) ']' shift, and go to state 201 state 152 arglist -> argument_list . (rule 144) argument_list -> argument_list . ',' expr (rule 146) ',' shift, and go to state 202 $default reduce using rule 144 (arglist) state 153 lvalue -> '`' expr '`' . (rule 11) declare_relation -> '`' expr '`' . @3 tilde_gt '[' id_list_opt ']' ';' (rule 116) declare_formula -> '`' expr '`' . @4 is expr ';' (rule 120) IS reduce using rule 119 (@4) TILDE_GT reduce using rule 115 (@3) $default reduce using rule 11 (lvalue) @3 go to state 203 @4 go to state 204 state 154 lvalue -> '(' lvalue ')' . (rule 12) $default reduce using rule 12 (lvalue) state 155 primary -> '(' expr ')' . (rule 24) $default reduce using rule 24 (primary) state 156 compound -> '{' stmtlist '}' . (rule 61) $default reduce using rule 61 (compound) state 157 stmtlist -> stmtlist stmt . (rule 63) $default reduce using rule 63 (stmtlist) state 158 lvalue -> lvalue . '[' expr ']' (rule 8) asgn -> lvalue . '=' expr (rule 13) asgn -> lvalue . PLUS_EQ expr (rule 14) asgn -> lvalue . MINUS_EQ expr (rule 15) asgn -> lvalue . '=' lvalue @1 SLASH_SLASH expr (rule 17) asgn -> lvalue '=' lvalue . @1 SLASH_SLASH expr (rule 17) asgn -> lvalue . PLUS_PLUS (rule 19) asgn -> lvalue . MINUS_MINUS (rule 21) primary -> lvalue . (rule 22) '=' shift, and go to state 96 PLUS_EQ shift, and go to state 97 MINUS_EQ shift, and go to state 98 PLUS_PLUS shift, and go to state 99 MINUS_MINUS shift, and go to state 100 '[' shift, and go to state 101 SLASH_SLASH reduce using rule 16 (@1) SLASH_SLASH [reduce using rule 22 (primary)] $default reduce using rule 22 (primary) @1 go to state 205 state 159 asgn -> lvalue '=' expr . (rule 13) expr -> expr . '+' expr (rule 81) expr -> expr . '-' expr (rule 82) expr -> expr . '*' expr (rule 83) expr -> expr . '/' expr (rule 84) expr -> expr . '%' expr (rule 85) expr -> expr . SLASH_SLASH expr (rule 86) expr -> expr . '>' expr (rule 87) expr -> expr . GT_EQ expr (rule 88) expr -> expr . '<' expr (rule 89) expr -> expr . LT_EQ expr (rule 90) expr -> expr . EQ_EQ expr (rule 91) expr -> expr . NOT_EQ expr (rule 92) expr -> expr . '#' (rule 96) expr -> expr . '?' then expr colon expr (rule 99) expr -> expr . AND expr (rule 100) expr -> expr . OR expr (rule 101) expr -> expr . lazy_and expr (rule 102) expr -> expr . lazy_or expr (rule 103) expr -> expr . BITAND expr (rule 104) expr -> expr . BITOR expr (rule 105) '?' shift, and go to state 114 OR shift, and go to state 115 LAZY_OR shift, and go to state 116 AND shift, and go to state 117 LAZY_AND shift, and go to state 118 BITAND shift, and go to state 119 BITOR shift, and go to state 120 EQ_EQ shift, and go to state 121 NOT_EQ shift, and go to state 122 '>' shift, and go to state 123 GT_EQ shift, and go to state 124 '<' shift, and go to state 125 LT_EQ shift, and go to state 126 '+' shift, and go to state 127 '-' shift, and go to state 128 SLASH_SLASH shift, and go to state 129 '*' shift, and go to state 130 '/' shift, and go to state 131 '%' shift, and go to state 132 '#' shift, and go to state 133 $default reduce using rule 13 (asgn) lazy_and go to state 135 lazy_or go to state 136 state 160 asgn -> lvalue PLUS_EQ expr . (rule 14) expr -> expr . '+' expr (rule 81) expr -> expr . '-' expr (rule 82) expr -> expr . '*' expr (rule 83) expr -> expr . '/' expr (rule 84) expr -> expr . '%' expr (rule 85) expr -> expr . SLASH_SLASH expr (rule 86) expr -> expr . '>' expr (rule 87) expr -> expr . GT_EQ expr (rule 88) expr -> expr . '<' expr (rule 89) expr -> expr . LT_EQ expr (rule 90) expr -> expr . EQ_EQ expr (rule 91) expr -> expr . NOT_EQ expr (rule 92) expr -> expr . '#' (rule 96) expr -> expr . '?' then expr colon expr (rule 99) expr -> expr . AND expr (rule 100) expr -> expr . OR expr (rule 101) expr -> expr . lazy_and expr (rule 102) expr -> expr . lazy_or expr (rule 103) expr -> expr . BITAND expr (rule 104) expr -> expr . BITOR expr (rule 105) '?' shift, and go to state 114 OR shift, and go to state 115 LAZY_OR shift, and go to state 116 AND shift, and go to state 117 LAZY_AND shift, and go to state 118 BITAND shift, and go to state 119 BITOR shift, and go to state 120 EQ_EQ shift, and go to state 121 NOT_EQ shift, and go to state 122 '>' shift, and go to state 123 GT_EQ shift, and go to state 124 '<' shift, and go to state 125 LT_EQ shift, and go to state 126 '+' shift, and go to state 127 '-' shift, and go to state 128 SLASH_SLASH shift, and go to state 129 '*' shift, and go to state 130 '/' shift, and go to state 131 '%' shift, and go to state 132 '#' shift, and go to state 133 $default reduce using rule 14 (asgn) lazy_and go to state 135 lazy_or go to state 136 state 161 asgn -> lvalue MINUS_EQ expr . (rule 15) expr -> expr . '+' expr (rule 81) expr -> expr . '-' expr (rule 82) expr -> expr . '*' expr (rule 83) expr -> expr . '/' expr (rule 84) expr -> expr . '%' expr (rule 85) expr -> expr . SLASH_SLASH expr (rule 86) expr -> expr . '>' expr (rule 87) expr -> expr . GT_EQ expr (rule 88) expr -> expr . '<' expr (rule 89) expr -> expr . LT_EQ expr (rule 90) expr -> expr . EQ_EQ expr (rule 91) expr -> expr . NOT_EQ expr (rule 92) expr -> expr . '#' (rule 96) expr -> expr . '?' then expr colon expr (rule 99) expr -> expr . AND expr (rule 100) expr -> expr . OR expr (rule 101) expr -> expr . lazy_and expr (rule 102) expr -> expr . lazy_or expr (rule 103) expr -> expr . BITAND expr (rule 104) expr -> expr . BITOR expr (rule 105) '?' shift, and go to state 114 OR shift, and go to state 115 LAZY_OR shift, and go to state 116 AND shift, and go to state 117 LAZY_AND shift, and go to state 118 BITAND shift, and go to state 119 BITOR shift, and go to state 120 EQ_EQ shift, and go to state 121 NOT_EQ shift, and go to state 122 '>' shift, and go to state 123 GT_EQ shift, and go to state 124 '<' shift, and go to state 125 LT_EQ shift, and go to state 126 '+' shift, and go to state 127 '-' shift, and go to state 128 SLASH_SLASH shift, and go to state 129 '*' shift, and go to state 130 '/' shift, and go to state 131 '%' shift, and go to state 132 '#' shift, and go to state 133 $default reduce using rule 15 (asgn) lazy_and go to state 135 lazy_or go to state 136 state 162 lvalue -> lvalue '[' expr . ']' (rule 8) expr -> expr . '+' expr (rule 81) expr -> expr . '-' expr (rule 82) expr -> expr . '*' expr (rule 83) expr -> expr . '/' expr (rule 84) expr -> expr . '%' expr (rule 85) expr -> expr . SLASH_SLASH expr (rule 86) expr -> expr . '>' expr (rule 87) expr -> expr . GT_EQ expr (rule 88) expr -> expr . '<' expr (rule 89) expr -> expr . LT_EQ expr (rule 90) expr -> expr . EQ_EQ expr (rule 91) expr -> expr . NOT_EQ expr (rule 92) expr -> expr . '#' (rule 96) expr -> expr . '?' then expr colon expr (rule 99) expr -> expr . AND expr (rule 100) expr -> expr . OR expr (rule 101) expr -> expr . lazy_and expr (rule 102) expr -> expr . lazy_or expr (rule 103) expr -> expr . BITAND expr (rule 104) expr -> expr . BITOR expr (rule 105) '?' shift, and go to state 114 OR shift, and go to state 115 LAZY_OR shift, and go to state 116 AND shift, and go to state 117 LAZY_AND shift, and go to state 118 BITAND shift, and go to state 119 BITOR shift, and go to state 120 EQ_EQ shift, and go to state 121 NOT_EQ shift, and go to state 122 '>' shift, and go to state 123 GT_EQ shift, and go to state 124 '<' shift, and go to state 125 LT_EQ shift, and go to state 126 '+' shift, and go to state 127 '-' shift, and go to state 128 SLASH_SLASH shift, and go to state 129 '*' shift, and go to state 130 '/' shift, and go to state 131 '%' shift, and go to state 132 '#' shift, and go to state 133 ']' shift, and go to state 206 lazy_and go to state 135 lazy_or go to state 136 state 163 secondary -> primary '(' arglist . ')' (rule 25) ')' shift, and go to state 207 state 164 secondary -> secondary '[' expr . ']' (rule 26) expr -> expr . '+' expr (rule 81) expr -> expr . '-' expr (rule 82) expr -> expr . '*' expr (rule 83) expr -> expr . '/' expr (rule 84) expr -> expr . '%' expr (rule 85) expr -> expr . SLASH_SLASH expr (rule 86) expr -> expr . '>' expr (rule 87) expr -> expr . GT_EQ expr (rule 88) expr -> expr . '<' expr (rule 89) expr -> expr . LT_EQ expr (rule 90) expr -> expr . EQ_EQ expr (rule 91) expr -> expr . NOT_EQ expr (rule 92) expr -> expr . '#' (rule 96) expr -> expr . '?' then expr colon expr (rule 99) expr -> expr . AND expr (rule 100) expr -> expr . OR expr (rule 101) expr -> expr . lazy_and expr (rule 102) expr -> expr . lazy_or expr (rule 103) expr -> expr . BITAND expr (rule 104) expr -> expr . BITOR expr (rule 105) '?' shift, and go to state 114 OR shift, and go to state 115 LAZY_OR shift, and go to state 116 AND shift, and go to state 117 LAZY_AND shift, and go to state 118 BITAND shift, and go to state 119 BITOR shift, and go to state 120 EQ_EQ shift, and go to state 121 NOT_EQ shift, and go to state 122 '>' shift, and go to state 123 GT_EQ shift, and go to state 124 '<' shift, and go to state 125 LT_EQ shift, and go to state 126 '+' shift, and go to state 127 '-' shift, and go to state 128 SLASH_SLASH shift, and go to state 129 '*' shift, and go to state 130 '/' shift, and go to state 131 '%' shift, and go to state 132 '#' shift, and go to state 133 ']' shift, and go to state 208 lazy_and go to state 135 lazy_or go to state 136 state 165 stmt -> while '(' expr . ')' then stmt (rule 43) expr -> expr . '+' expr (rule 81) expr -> expr . '-' expr (rule 82) expr -> expr . '*' expr (rule 83) expr -> expr . '/' expr (rule 84) expr -> expr . '%' expr (rule 85) expr -> expr . SLASH_SLASH expr (rule 86) expr -> expr . '>' expr (rule 87) expr -> expr . GT_EQ expr (rule 88) expr -> expr . '<' expr (rule 89) expr -> expr . LT_EQ expr (rule 90) expr -> expr . EQ_EQ expr (rule 91) expr -> expr . NOT_EQ expr (rule 92) expr -> expr . '#' (rule 96) expr -> expr . '?' then expr colon expr (rule 99) expr -> expr . AND expr (rule 100) expr -> expr . OR expr (rule 101) expr -> expr . lazy_and expr (rule 102) expr -> expr . lazy_or expr (rule 103) expr -> expr . BITAND expr (rule 104) expr -> expr . BITOR expr (rule 105) '?' shift, and go to state 114 OR shift, and go to state 115 LAZY_OR shift, and go to state 116 AND shift, and go to state 117 LAZY_AND shift, and go to state 118 BITAND shift, and go to state 119 BITOR shift, and go to state 120 EQ_EQ shift, and go to state 121 NOT_EQ shift, and go to state 122 '>' shift, and go to state 123 GT_EQ shift, and go to state 124 '<' shift, and go to state 125 LT_EQ shift, and go to state 126 '+' shift, and go to state 127 '-' shift, and go to state 128 SLASH_SLASH shift, and go to state 129 '*' shift, and go to state 130 '/' shift, and go to state 131 '%' shift, and go to state 132 '#' shift, and go to state 133 ')' shift, and go to state 209 lazy_and go to state 135 lazy_or go to state 136 state 166 stmt -> do stmt WHILE . '(' expr ')' ';' (rule 42) '(' shift, and go to state 210 state 167 expr2 -> ';' . (rule 53) $default reduce using rule 53 (expr2) state 168 stmt -> for expr1 expr2 . end_expr2 expr3 end_expr3 stmt (rule 41) $default reduce using rule 55 (end_expr2) end_expr2 go to state 211 state 169 expr2 -> expr . ';' (rule 54) expr -> expr . '+' expr (rule 81) expr -> expr . '-' expr (rule 82) expr -> expr . '*' expr (rule 83) expr -> expr . '/' expr (rule 84) expr -> expr . '%' expr (rule 85) expr -> expr . SLASH_SLASH expr (rule 86) expr -> expr . '>' expr (rule 87) expr -> expr . GT_EQ expr (rule 88) expr -> expr . '<' expr (rule 89) expr -> expr . LT_EQ expr (rule 90) expr -> expr . EQ_EQ expr (rule 91) expr -> expr . NOT_EQ expr (rule 92) expr -> expr . '#' (rule 96) expr -> expr . '?' then expr colon expr (rule 99) expr -> expr . AND expr (rule 100) expr -> expr . OR expr (rule 101) expr -> expr . lazy_and expr (rule 102) expr -> expr . lazy_or expr (rule 103) expr -> expr . BITAND expr (rule 104) expr -> expr . BITOR expr (rule 105) '?' shift, and go to state 114 OR shift, and go to state 115 LAZY_OR shift, and go to state 116 AND shift, and go to state 117 LAZY_AND shift, and go to state 118 BITAND shift, and go to state 119 BITOR shift, and go to state 120 EQ_EQ shift, and go to state 121 NOT_EQ shift, and go to state 122 '>' shift, and go to state 123 GT_EQ shift, and go to state 124 '<' shift, and go to state 125 LT_EQ shift, and go to state 126 '+' shift, and go to state 127 '-' shift, and go to state 128 SLASH_SLASH shift, and go to state 129 '*' shift, and go to state 130 '/' shift, and go to state 131 '%' shift, and go to state 132 '#' shift, and go to state 133 ';' shift, and go to state 212 lazy_and go to state 135 lazy_or go to state 136 state 170 expr1 -> expr ';' . (rule 52) $default reduce using rule 52 (expr1) state 171 cases -> ')' . (rule 65) $default reduce using rule 65 (cases) state 172 stmt -> switch expr cases . stmt (rule 40) CONSTANT shift, and go to state 2 VAR shift, and go to state 3 FORMULA shift, and go to state 4 BLTIN shift, and go to state 5 LIB shift, and go to state 6 RLIB shift, and go to state 7 FUNC shift, and go to state 8 PROC shift, and go to state 9 PMAC shift, and go to state 10 FUNCTION shift, and go to state 11 PROCEDURE shift, and go to state 12 PROCMACRO shift, and go to state 13 LOCAL shift, and go to state 14 BREAK shift, and go to state 15 CONTINUE shift, and go to state 16 SWITCH shift, and go to state 17 CASE shift, and go to state 18 DEFAULT shift, and go to state 19 DO shift, and go to state 20 FOR shift, and go to state 21 WHILE shift, and go to state 22 IF shift, and go to state 23 SHIFT shift, and go to state 24 APPEND shift, and go to state 25 INSERT shift, and go to state 26 DELETE shift, and go to state 27 RETURN shift, and go to state 28 ARG shift, and go to state 29 '?' shift, and go to state 30 '-' shift, and go to state 31 '*' shift, and go to state 32 NOT shift, and go to state 33 '!' shift, and go to state 34 PLUS_PLUS shift, and go to state 35 MINUS_MINUS shift, and go to state 36 '&' shift, and go to state 37 EVAL shift, and go to state 38 '$' shift, and go to state 39 '[' shift, and go to state 40 '`' shift, and go to state 41 '(' shift, and go to state 42 ';' shift, and go to state 43 '{' shift, and go to state 44 lvalue go to state 45 asgn go to state 46 primary go to state 47 secondary go to state 48 stmt go to state 213 while go to state 50 do go to state 51 for go to state 52 compound go to state 53 switch go to state 54 id go to state 55 identifier go to state 56 expr go to state 57 evaluate go to state 58 defn go to state 59 declare_relation go to state 60 declare_formula go to state 61 declare_action go to state 62 action go to state 63 state 173 declare_relation -> identifier tilde_gt '[' . id_list_opt ']' ';' (rule 114) VAR shift, and go to state 3 FORMULA shift, and go to state 4 FUNCTION shift, and go to state 11 PROCEDURE shift, and go to state 12 PROCMACRO shift, and go to state 13 $default reduce using rule 131 (id_list_opt) identifier go to state 214 id_list_opt go to state 215 id_list go to state 216 state 174 expr -> expr . '+' expr (rule 81) expr -> expr . '-' expr (rule 82) expr -> expr . '*' expr (rule 83) expr -> expr . '/' expr (rule 84) expr -> expr . '%' expr (rule 85) expr -> expr . SLASH_SLASH expr (rule 86) expr -> expr . '>' expr (rule 87) expr -> expr . GT_EQ expr (rule 88) expr -> expr . '<' expr (rule 89) expr -> expr . LT_EQ expr (rule 90) expr -> expr . EQ_EQ expr (rule 91) expr -> expr . NOT_EQ expr (rule 92) expr -> expr . '#' (rule 96) expr -> expr . '?' then expr colon expr (rule 99) expr -> expr . AND expr (rule 100) expr -> expr . OR expr (rule 101) expr -> expr . lazy_and expr (rule 102) expr -> expr . lazy_or expr (rule 103) expr -> expr . BITAND expr (rule 104) expr -> expr . BITOR expr (rule 105) declare_formula -> identifier is expr . ';' (rule 118) '?' shift, and go to state 114 OR shift, and go to state 115 LAZY_OR shift, and go to state 116 AND shift, and go to state 117 LAZY_AND shift, and go to state 118 BITAND shift, and go to state 119 BITOR shift, and go to state 120 EQ_EQ shift, and go to state 121 NOT_EQ shift, and go to state 122 '>' shift, and go to state 123 GT_EQ shift, and go to state 124 '<' shift, and go to state 125 LT_EQ shift, and go to state 126 '+' shift, and go to state 127 '-' shift, and go to state 128 SLASH_SLASH shift, and go to state 129 '*' shift, and go to state 130 '/' shift, and go to state 131 '%' shift, and go to state 132 '#' shift, and go to state 133 ';' shift, and go to state 217 lazy_and go to state 135 lazy_or go to state 136 state 175 expr -> expr '?' then . expr colon expr (rule 99) CONSTANT shift, and go to state 2 VAR shift, and go to state 3 FORMULA shift, and go to state 4 BLTIN shift, and go to state 5 LIB shift, and go to state 6 RLIB shift, and go to state 7 FUNCTION shift, and go to state 11 PROCEDURE shift, and go to state 12 PROCMACRO shift, and go to state 13 LOCAL shift, and go to state 14 ARG shift, and go to state 29 '?' shift, and go to state 30 '-' shift, and go to state 31 '*' shift, and go to state 32 NOT shift, and go to state 33 '!' shift, and go to state 34 PLUS_PLUS shift, and go to state 35 MINUS_MINUS shift, and go to state 36 '&' shift, and go to state 37 EVAL shift, and go to state 38 '$' shift, and go to state 39 '[' shift, and go to state 40 '`' shift, and go to state 71 '(' shift, and go to state 42 lvalue go to state 45 asgn go to state 46 primary go to state 47 secondary go to state 48 id go to state 55 identifier go to state 75 expr go to state 218 evaluate go to state 58 state 176 expr -> expr . '+' expr (rule 81) expr -> expr . '-' expr (rule 82) expr -> expr . '*' expr (rule 83) expr -> expr . '/' expr (rule 84) expr -> expr . '%' expr (rule 85) expr -> expr . SLASH_SLASH expr (rule 86) expr -> expr . '>' expr (rule 87) expr -> expr . GT_EQ expr (rule 88) expr -> expr . '<' expr (rule 89) expr -> expr . LT_EQ expr (rule 90) expr -> expr . EQ_EQ expr (rule 91) expr -> expr . NOT_EQ expr (rule 92) expr -> expr . '#' (rule 96) expr -> expr . '?' then expr colon expr (rule 99) expr -> expr . AND expr (rule 100) expr -> expr . OR expr (rule 101) expr -> expr OR expr . (rule 101) expr -> expr . lazy_and expr (rule 102) expr -> expr . lazy_or expr (rule 103) expr -> expr . BITAND expr (rule 104) expr -> expr . BITOR expr (rule 105) AND shift, and go to state 117 LAZY_AND shift, and go to state 118 BITAND shift, and go to state 119 BITOR shift, and go to state 120 EQ_EQ shift, and go to state 121 NOT_EQ shift, and go to state 122 '>' shift, and go to state 123 GT_EQ shift, and go to state 124 '<' shift, and go to state 125 LT_EQ shift, and go to state 126 '+' shift, and go to state 127 '-' shift, and go to state 128 SLASH_SLASH shift, and go to state 129 '*' shift, and go to state 130 '/' shift, and go to state 131 '%' shift, and go to state 132 '#' shift, and go to state 133 $default reduce using rule 101 (expr) lazy_and go to state 135 lazy_or go to state 136 state 177 expr -> expr . '+' expr (rule 81) expr -> expr . '-' expr (rule 82) expr -> expr . '*' expr (rule 83) expr -> expr . '/' expr (rule 84) expr -> expr . '%' expr (rule 85) expr -> expr . SLASH_SLASH expr (rule 86) expr -> expr . '>' expr (rule 87) expr -> expr . GT_EQ expr (rule 88) expr -> expr . '<' expr (rule 89) expr -> expr . LT_EQ expr (rule 90) expr -> expr . EQ_EQ expr (rule 91) expr -> expr . NOT_EQ expr (rule 92) expr -> expr . '#' (rule 96) expr -> expr . '?' then expr colon expr (rule 99) expr -> expr . AND expr (rule 100) expr -> expr AND expr . (rule 100) expr -> expr . OR expr (rule 101) expr -> expr . lazy_and expr (rule 102) expr -> expr . lazy_or expr (rule 103) expr -> expr . BITAND expr (rule 104) expr -> expr . BITOR expr (rule 105) BITAND shift, and go to state 119 BITOR shift, and go to state 120 EQ_EQ shift, and go to state 121 NOT_EQ shift, and go to state 122 '>' shift, and go to state 123 GT_EQ shift, and go to state 124 '<' shift, and go to state 125 LT_EQ shift, and go to state 126 '+' shift, and go to state 127 '-' shift, and go to state 128 SLASH_SLASH shift, and go to state 129 '*' shift, and go to state 130 '/' shift, and go to state 131 '%' shift, and go to state 132 '#' shift, and go to state 133 $default reduce using rule 100 (expr) lazy_and go to state 135 lazy_or go to state 136 state 178 expr -> expr . '+' expr (rule 81) expr -> expr . '-' expr (rule 82) expr -> expr . '*' expr (rule 83) expr -> expr . '/' expr (rule 84) expr -> expr . '%' expr (rule 85) expr -> expr . SLASH_SLASH expr (rule 86) expr -> expr . '>' expr (rule 87) expr -> expr . GT_EQ expr (rule 88) expr -> expr . '<' expr (rule 89) expr -> expr . LT_EQ expr (rule 90) expr -> expr . EQ_EQ expr (rule 91) expr -> expr . NOT_EQ expr (rule 92) expr -> expr . '#' (rule 96) expr -> expr . '?' then expr colon expr (rule 99) expr -> expr . AND expr (rule 100) expr -> expr . OR expr (rule 101) expr -> expr . lazy_and expr (rule 102) expr -> expr . lazy_or expr (rule 103) expr -> expr . BITAND expr (rule 104) expr -> expr BITAND expr . (rule 104) expr -> expr . BITOR expr (rule 105) EQ_EQ shift, and go to state 121 NOT_EQ shift, and go to state 122 '>' shift, and go to state 123 GT_EQ shift, and go to state 124 '<' shift, and go to state 125 LT_EQ shift, and go to state 126 '+' shift, and go to state 127 '-' shift, and go to state 128 SLASH_SLASH shift, and go to state 129 '*' shift, and go to state 130 '/' shift, and go to state 131 '%' shift, and go to state 132 '#' shift, and go to state 133 $default reduce using rule 104 (expr) lazy_and go to state 135 lazy_or go to state 136 state 179 expr -> expr . '+' expr (rule 81) expr -> expr . '-' expr (rule 82) expr -> expr . '*' expr (rule 83) expr -> expr . '/' expr (rule 84) expr -> expr . '%' expr (rule 85) expr -> expr . SLASH_SLASH expr (rule 86) expr -> expr . '>' expr (rule 87) expr -> expr . GT_EQ expr (rule 88) expr -> expr . '<' expr (rule 89) expr -> expr . LT_EQ expr (rule 90) expr -> expr . EQ_EQ expr (rule 91) expr -> expr . NOT_EQ expr (rule 92) expr -> expr . '#' (rule 96) expr -> expr . '?' then expr colon expr (rule 99) expr -> expr . AND expr (rule 100) expr -> expr . OR expr (rule 101) expr -> expr . lazy_and expr (rule 102) expr -> expr . lazy_or expr (rule 103) expr -> expr . BITAND expr (rule 104) expr -> expr . BITOR expr (rule 105) expr -> expr BITOR expr . (rule 105) EQ_EQ shift, and go to state 121 NOT_EQ shift, and go to state 122 '>' shift, and go to state 123 GT_EQ shift, and go to state 124 '<' shift, and go to state 125 LT_EQ shift, and go to state 126 '+' shift, and go to state 127 '-' shift, and go to state 128 SLASH_SLASH shift, and go to state 129 '*' shift, and go to state 130 '/' shift, and go to state 131 '%' shift, and go to state 132 '#' shift, and go to state 133 $default reduce using rule 105 (expr) lazy_and go to state 135 lazy_or go to state 136 state 180 expr -> expr . '+' expr (rule 81) expr -> expr . '-' expr (rule 82) expr -> expr . '*' expr (rule 83) expr -> expr . '/' expr (rule 84) expr -> expr . '%' expr (rule 85) expr -> expr . SLASH_SLASH expr (rule 86) expr -> expr . '>' expr (rule 87) expr -> expr . GT_EQ expr (rule 88) expr -> expr . '<' expr (rule 89) expr -> expr . LT_EQ expr (rule 90) expr -> expr . EQ_EQ expr (rule 91) expr -> expr EQ_EQ expr . (rule 91) expr -> expr . NOT_EQ expr (rule 92) expr -> expr . '#' (rule 96) expr -> expr . '?' then expr colon expr (rule 99) expr -> expr . AND expr (rule 100) expr -> expr . OR expr (rule 101) expr -> expr . lazy_and expr (rule 102) expr -> expr . lazy_or expr (rule 103) expr -> expr . BITAND expr (rule 104) expr -> expr . BITOR expr (rule 105) '>' shift, and go to state 123 GT_EQ shift, and go to state 124 '<' shift, and go to state 125 LT_EQ shift, and go to state 126 '+' shift, and go to state 127 '-' shift, and go to state 128 SLASH_SLASH shift, and go to state 129 '*' shift, and go to state 130 '/' shift, and go to state 131 '%' shift, and go to state 132 '#' shift, and go to state 133 $default reduce using rule 91 (expr) lazy_and go to state 135 lazy_or go to state 136 state 181 expr -> expr . '+' expr (rule 81) expr -> expr . '-' expr (rule 82) expr -> expr . '*' expr (rule 83) expr -> expr . '/' expr (rule 84) expr -> expr . '%' expr (rule 85) expr -> expr . SLASH_SLASH expr (rule 86) expr -> expr . '>' expr (rule 87) expr -> expr . GT_EQ expr (rule 88) expr -> expr . '<' expr (rule 89) expr -> expr . LT_EQ expr (rule 90) expr -> expr . EQ_EQ expr (rule 91) expr -> expr . NOT_EQ expr (rule 92) expr -> expr NOT_EQ expr . (rule 92) expr -> expr . '#' (rule 96) expr -> expr . '?' then expr colon expr (rule 99) expr -> expr . AND expr (rule 100) expr -> expr . OR expr (rule 101) expr -> expr . lazy_and expr (rule 102) expr -> expr . lazy_or expr (rule 103) expr -> expr . BITAND expr (rule 104) expr -> expr . BITOR expr (rule 105) '>' shift, and go to state 123 GT_EQ shift, and go to state 124 '<' shift, and go to state 125 LT_EQ shift, and go to state 126 '+' shift, and go to state 127 '-' shift, and go to state 128 SLASH_SLASH shift, and go to state 129 '*' shift, and go to state 130 '/' shift, and go to state 131 '%' shift, and go to state 132 '#' shift, and go to state 133 $default reduce using rule 92 (expr) lazy_and go to state 135 lazy_or go to state 136 state 182 expr -> expr . '+' expr (rule 81) expr -> expr . '-' expr (rule 82) expr -> expr . '*' expr (rule 83) expr -> expr . '/' expr (rule 84) expr -> expr . '%' expr (rule 85) expr -> expr . SLASH_SLASH expr (rule 86) expr -> expr . '>' expr (rule 87) expr -> expr '>' expr . (rule 87) expr -> expr . GT_EQ expr (rule 88) expr -> expr . '<' expr (rule 89) expr -> expr . LT_EQ expr (rule 90) expr -> expr . EQ_EQ expr (rule 91) expr -> expr . NOT_EQ expr (rule 92) expr -> expr . '#' (rule 96) expr -> expr . '?' then expr colon expr (rule 99) expr -> expr . AND expr (rule 100) expr -> expr . OR expr (rule 101) expr -> expr . lazy_and expr (rule 102) expr -> expr . lazy_or expr (rule 103) expr -> expr . BITAND expr (rule 104) expr -> expr . BITOR expr (rule 105) '+' shift, and go to state 127 '-' shift, and go to state 128 SLASH_SLASH shift, and go to state 129 '*' shift, and go to state 130 '/' shift, and go to state 131 '%' shift, and go to state 132 '#' shift, and go to state 133 $default reduce using rule 87 (expr) lazy_and go to state 135 lazy_or go to state 136 state 183 expr -> expr . '+' expr (rule 81) expr -> expr . '-' expr (rule 82) expr -> expr . '*' expr (rule 83) expr -> expr . '/' expr (rule 84) expr -> expr . '%' expr (rule 85) expr -> expr . SLASH_SLASH expr (rule 86) expr -> expr . '>' expr (rule 87) expr -> expr . GT_EQ expr (rule 88) expr -> expr GT_EQ expr . (rule 88) expr -> expr . '<' expr (rule 89) expr -> expr . LT_EQ expr (rule 90) expr -> expr . EQ_EQ expr (rule 91) expr -> expr . NOT_EQ expr (rule 92) expr -> expr . '#' (rule 96) expr -> expr . '?' then expr colon expr (rule 99) expr -> expr . AND expr (rule 100) expr -> expr . OR expr (rule 101) expr -> expr . lazy_and expr (rule 102) expr -> expr . lazy_or expr (rule 103) expr -> expr . BITAND expr (rule 104) expr -> expr . BITOR expr (rule 105) '+' shift, and go to state 127 '-' shift, and go to state 128 SLASH_SLASH shift, and go to state 129 '*' shift, and go to state 130 '/' shift, and go to state 131 '%' shift, and go to state 132 '#' shift, and go to state 133 $default reduce using rule 88 (expr) lazy_and go to state 135 lazy_or go to state 136 state 184 expr -> expr . '+' expr (rule 81) expr -> expr . '-' expr (rule 82) expr -> expr . '*' expr (rule 83) expr -> expr . '/' expr (rule 84) expr -> expr . '%' expr (rule 85) expr -> expr . SLASH_SLASH expr (rule 86) expr -> expr . '>' expr (rule 87) expr -> expr . GT_EQ expr (rule 88) expr -> expr . '<' expr (rule 89) expr -> expr '<' expr . (rule 89) expr -> expr . LT_EQ expr (rule 90) expr -> expr . EQ_EQ expr (rule 91) expr -> expr . NOT_EQ expr (rule 92) expr -> expr . '#' (rule 96) expr -> expr . '?' then expr colon expr (rule 99) expr -> expr . AND expr (rule 100) expr -> expr . OR expr (rule 101) expr -> expr . lazy_and expr (rule 102) expr -> expr . lazy_or expr (rule 103) expr -> expr . BITAND expr (rule 104) expr -> expr . BITOR expr (rule 105) '+' shift, and go to state 127 '-' shift, and go to state 128 SLASH_SLASH shift, and go to state 129 '*' shift, and go to state 130 '/' shift, and go to state 131 '%' shift, and go to state 132 '#' shift, and go to state 133 $default reduce using rule 89 (expr) lazy_and go to state 135 lazy_or go to state 136 state 185 expr -> expr . '+' expr (rule 81) expr -> expr . '-' expr (rule 82) expr -> expr . '*' expr (rule 83) expr -> expr . '/' expr (rule 84) expr -> expr . '%' expr (rule 85) expr -> expr . SLASH_SLASH expr (rule 86) expr -> expr . '>' expr (rule 87) expr -> expr . GT_EQ expr (rule 88) expr -> expr . '<' expr (rule 89) expr -> expr . LT_EQ expr (rule 90) expr -> expr LT_EQ expr . (rule 90) expr -> expr . EQ_EQ expr (rule 91) expr -> expr . NOT_EQ expr (rule 92) expr -> expr . '#' (rule 96) expr -> expr . '?' then expr colon expr (rule 99) expr -> expr . AND expr (rule 100) expr -> expr . OR expr (rule 101) expr -> expr . lazy_and expr (rule 102) expr -> expr . lazy_or expr (rule 103) expr -> expr . BITAND expr (rule 104) expr -> expr . BITOR expr (rule 105) '+' shift, and go to state 127 '-' shift, and go to state 128 SLASH_SLASH shift, and go to state 129 '*' shift, and go to state 130 '/' shift, and go to state 131 '%' shift, and go to state 132 '#' shift, and go to state 133 $default reduce using rule 90 (expr) lazy_and go to state 135 lazy_or go to state 136 state 186 expr -> expr . '+' expr (rule 81) expr -> expr '+' expr . (rule 81) expr -> expr . '-' expr (rule 82) expr -> expr . '*' expr (rule 83) expr -> expr . '/' expr (rule 84) expr -> expr . '%' expr (rule 85) expr -> expr . SLASH_SLASH expr (rule 86) expr -> expr . '>' expr (rule 87) expr -> expr . GT_EQ expr (rule 88) expr -> expr . '<' expr (rule 89) expr -> expr . LT_EQ expr (rule 90) expr -> expr . EQ_EQ expr (rule 91) expr -> expr . NOT_EQ expr (rule 92) expr -> expr . '#' (rule 96) expr -> expr . '?' then expr colon expr (rule 99) expr -> expr . AND expr (rule 100) expr -> expr . OR expr (rule 101) expr -> expr . lazy_and expr (rule 102) expr -> expr . lazy_or expr (rule 103) expr -> expr . BITAND expr (rule 104) expr -> expr . BITOR expr (rule 105) '*' shift, and go to state 130 '/' shift, and go to state 131 '%' shift, and go to state 132 '#' shift, and go to state 133 $default reduce using rule 81 (expr) lazy_and go to state 135 lazy_or go to state 136 state 187 expr -> expr . '+' expr (rule 81) expr -> expr . '-' expr (rule 82) expr -> expr '-' expr . (rule 82) expr -> expr . '*' expr (rule 83) expr -> expr . '/' expr (rule 84) expr -> expr . '%' expr (rule 85) expr -> expr . SLASH_SLASH expr (rule 86) expr -> expr . '>' expr (rule 87) expr -> expr . GT_EQ expr (rule 88) expr -> expr . '<' expr (rule 89) expr -> expr . LT_EQ expr (rule 90) expr -> expr . EQ_EQ expr (rule 91) expr -> expr . NOT_EQ expr (rule 92) expr -> expr . '#' (rule 96) expr -> expr . '?' then expr colon expr (rule 99) expr -> expr . AND expr (rule 100) expr -> expr . OR expr (rule 101) expr -> expr . lazy_and expr (rule 102) expr -> expr . lazy_or expr (rule 103) expr -> expr . BITAND expr (rule 104) expr -> expr . BITOR expr (rule 105) '*' shift, and go to state 130 '/' shift, and go to state 131 '%' shift, and go to state 132 '#' shift, and go to state 133 $default reduce using rule 82 (expr) lazy_and go to state 135 lazy_or go to state 136 state 188 expr -> expr . '+' expr (rule 81) expr -> expr . '-' expr (rule 82) expr -> expr . '*' expr (rule 83) expr -> expr . '/' expr (rule 84) expr -> expr . '%' expr (rule 85) expr -> expr . SLASH_SLASH expr (rule 86) expr -> expr SLASH_SLASH expr . (rule 86) expr -> expr . '>' expr (rule 87) expr -> expr . GT_EQ expr (rule 88) expr -> expr . '<' expr (rule 89) expr -> expr . LT_EQ expr (rule 90) expr -> expr . EQ_EQ expr (rule 91) expr -> expr . NOT_EQ expr (rule 92) expr -> expr . '#' (rule 96) expr -> expr . '?' then expr colon expr (rule 99) expr -> expr . AND expr (rule 100) expr -> expr . OR expr (rule 101) expr -> expr . lazy_and expr (rule 102) expr -> expr . lazy_or expr (rule 103) expr -> expr . BITAND expr (rule 104) expr -> expr . BITOR expr (rule 105) '*' shift, and go to state 130 '/' shift, and go to state 131 '%' shift, and go to state 132 '#' shift, and go to state 133 $default reduce using rule 86 (expr) lazy_and go to state 135 lazy_or go to state 136 state 189 expr -> expr . '+' expr (rule 81) expr -> expr . '-' expr (rule 82) expr -> expr . '*' expr (rule 83) expr -> expr '*' expr . (rule 83) expr -> expr . '/' expr (rule 84) expr -> expr . '%' expr (rule 85) expr -> expr . SLASH_SLASH expr (rule 86) expr -> expr . '>' expr (rule 87) expr -> expr . GT_EQ expr (rule 88) expr -> expr . '<' expr (rule 89) expr -> expr . LT_EQ expr (rule 90) expr -> expr . EQ_EQ expr (rule 91) expr -> expr . NOT_EQ expr (rule 92) expr -> expr . '#' (rule 96) expr -> expr . '?' then expr colon expr (rule 99) expr -> expr . AND expr (rule 100) expr -> expr . OR expr (rule 101) expr -> expr . lazy_and expr (rule 102) expr -> expr . lazy_or expr (rule 103) expr -> expr . BITAND expr (rule 104) expr -> expr . BITOR expr (rule 105) '#' shift, and go to state 133 $default reduce using rule 83 (expr) lazy_and go to state 135 lazy_or go to state 136 state 190 expr -> expr . '+' expr (rule 81) expr -> expr . '-' expr (rule 82) expr -> expr . '*' expr (rule 83) expr -> expr . '/' expr (rule 84) expr -> expr '/' expr . (rule 84) expr -> expr . '%' expr (rule 85) expr -> expr . SLASH_SLASH expr (rule 86) expr -> expr . '>' expr (rule 87) expr -> expr . GT_EQ expr (rule 88) expr -> expr . '<' expr (rule 89) expr -> expr . LT_EQ expr (rule 90) expr -> expr . EQ_EQ expr (rule 91) expr -> expr . NOT_EQ expr (rule 92) expr -> expr . '#' (rule 96) expr -> expr . '?' then expr colon expr (rule 99) expr -> expr . AND expr (rule 100) expr -> expr . OR expr (rule 101) expr -> expr . lazy_and expr (rule 102) expr -> expr . lazy_or expr (rule 103) expr -> expr . BITAND expr (rule 104) expr -> expr . BITOR expr (rule 105) '#' shift, and go to state 133 $default reduce using rule 84 (expr) lazy_and go to state 135 lazy_or go to state 136 state 191 expr -> expr . '+' expr (rule 81) expr -> expr . '-' expr (rule 82) expr -> expr . '*' expr (rule 83) expr -> expr . '/' expr (rule 84) expr -> expr . '%' expr (rule 85) expr -> expr '%' expr . (rule 85) expr -> expr . SLASH_SLASH expr (rule 86) expr -> expr . '>' expr (rule 87) expr -> expr . GT_EQ expr (rule 88) expr -> expr . '<' expr (rule 89) expr -> expr . LT_EQ expr (rule 90) expr -> expr . EQ_EQ expr (rule 91) expr -> expr . NOT_EQ expr (rule 92) expr -> expr . '#' (rule 96) expr -> expr . '?' then expr colon expr (rule 99) expr -> expr . AND expr (rule 100) expr -> expr . OR expr (rule 101) expr -> expr . lazy_and expr (rule 102) expr -> expr . lazy_or expr (rule 103) expr -> expr . BITAND expr (rule 104) expr -> expr . BITOR expr (rule 105) '#' shift, and go to state 133 $default reduce using rule 85 (expr) lazy_and go to state 135 lazy_or go to state 136 state 192 expr -> expr . '+' expr (rule 81) expr -> expr . '-' expr (rule 82) expr -> expr . '*' expr (rule 83) expr -> expr . '/' expr (rule 84) expr -> expr . '%' expr (rule 85) expr -> expr . SLASH_SLASH expr (rule 86) expr -> expr . '>' expr (rule 87) expr -> expr . GT_EQ expr (rule 88) expr -> expr . '<' expr (rule 89) expr -> expr . LT_EQ expr (rule 90) expr -> expr . EQ_EQ expr (rule 91) expr -> expr . NOT_EQ expr (rule 92) expr -> expr . '#' (rule 96) expr -> expr . '?' then expr colon expr (rule 99) expr -> expr . AND expr (rule 100) expr -> expr . OR expr (rule 101) expr -> expr . lazy_and expr (rule 102) expr -> expr lazy_and expr . (rule 102) expr -> expr . lazy_or expr (rule 103) expr -> expr . BITAND expr (rule 104) expr -> expr . BITOR expr (rule 105) BITAND shift, and go to state 119 BITOR shift, and go to state 120 EQ_EQ shift, and go to state 121 NOT_EQ shift, and go to state 122 '>' shift, and go to state 123 GT_EQ shift, and go to state 124 '<' shift, and go to state 125 LT_EQ shift, and go to state 126 '+' shift, and go to state 127 '-' shift, and go to state 128 SLASH_SLASH shift, and go to state 129 '*' shift, and go to state 130 '/' shift, and go to state 131 '%' shift, and go to state 132 '#' shift, and go to state 133 $default reduce using rule 102 (expr) lazy_and go to state 135 lazy_or go to state 136 state 193 expr -> expr . '+' expr (rule 81) expr -> expr . '-' expr (rule 82) expr -> expr . '*' expr (rule 83) expr -> expr . '/' expr (rule 84) expr -> expr . '%' expr (rule 85) expr -> expr . SLASH_SLASH expr (rule 86) expr -> expr . '>' expr (rule 87) expr -> expr . GT_EQ expr (rule 88) expr -> expr . '<' expr (rule 89) expr -> expr . LT_EQ expr (rule 90) expr -> expr . EQ_EQ expr (rule 91) expr -> expr . NOT_EQ expr (rule 92) expr -> expr . '#' (rule 96) expr -> expr . '?' then expr colon expr (rule 99) expr -> expr . AND expr (rule 100) expr -> expr . OR expr (rule 101) expr -> expr . lazy_and expr (rule 102) expr -> expr . lazy_or expr (rule 103) expr -> expr lazy_or expr . (rule 103) expr -> expr . BITAND expr (rule 104) expr -> expr . BITOR expr (rule 105) AND shift, and go to state 117 LAZY_AND shift, and go to state 118 BITAND shift, and go to state 119 BITOR shift, and go to state 120 EQ_EQ shift, and go to state 121 NOT_EQ shift, and go to state 122 '>' shift, and go to state 123 GT_EQ shift, and go to state 124 '<' shift, and go to state 125 LT_EQ shift, and go to state 126 '+' shift, and go to state 127 '-' shift, and go to state 128 SLASH_SLASH shift, and go to state 129 '*' shift, and go to state 130 '/' shift, and go to state 131 '%' shift, and go to state 132 '#' shift, and go to state 133 $default reduce using rule 103 (expr) lazy_and go to state 135 lazy_or go to state 136 state 194 expr -> expr . '+' expr (rule 81) expr -> expr . '-' expr (rule 82) expr -> expr . '*' expr (rule 83) expr -> expr . '/' expr (rule 84) expr -> expr . '%' expr (rule 85) expr -> expr . SLASH_SLASH expr (rule 86) expr -> expr . '>' expr (rule 87) expr -> expr . GT_EQ expr (rule 88) expr -> expr . '<' expr (rule 89) expr -> expr . LT_EQ expr (rule 90) expr -> expr . EQ_EQ expr (rule 91) expr -> expr . NOT_EQ expr (rule 92) expr -> expr . '#' (rule 96) expr -> expr . '?' then expr colon expr (rule 99) expr -> expr . AND expr (rule 100) expr -> expr . OR expr (rule 101) expr -> expr . lazy_and expr (rule 102) expr -> expr . lazy_or expr (rule 103) expr -> expr . BITAND expr (rule 104) expr -> expr . BITOR expr (rule 105) expr -> evaluate '(' expr . ')' (rule 106) '?' shift, and go to state 114 OR shift, and go to state 115 LAZY_OR shift, and go to state 116 AND shift, and go to state 117 LAZY_AND shift, and go to state 118 BITAND shift, and go to state 119 BITOR shift, and go to state 120 EQ_EQ shift, and go to state 121 NOT_EQ shift, and go to state 122 '>' shift, and go to state 123 GT_EQ shift, and go to state 124 '<' shift, and go to state 125 LT_EQ shift, and go to state 126 '+' shift, and go to state 127 '-' shift, and go to state 128 SLASH_SLASH shift, and go to state 129 '*' shift, and go to state 130 '/' shift, and go to state 131 '%' shift, and go to state 132 '#' shift, and go to state 133 ')' shift, and go to state 219 lazy_and go to state 135 lazy_or go to state 136 state 195 declare_action -> action identifier @5 . refer_opt def_begin declare_para declare_local stmtlist def_end (rule 123) ':' shift, and go to state 220 $default reduce using rule 129 (refer_opt) refer_opt go to state 221 state 196 stmt -> IF '(' expr ')' . then stmt (rule 44) stmt -> IF '(' expr ')' . then stmt else stmt (rule 45) $default reduce using rule 59 (then) then go to state 222 state 197 lvalue -> '`' expr '`' . (rule 11) $default reduce using rule 11 (lvalue) state 198 stmt -> APPEND lvalue ',' expr . ';' (rule 33) expr -> expr . '+' expr (rule 81) expr -> expr . '-' expr (rule 82) expr -> expr . '*' expr (rule 83) expr -> expr . '/' expr (rule 84) expr -> expr . '%' expr (rule 85) expr -> expr . SLASH_SLASH expr (rule 86) expr -> expr . '>' expr (rule 87) expr -> expr . GT_EQ expr (rule 88) expr -> expr . '<' expr (rule 89) expr -> expr . LT_EQ expr (rule 90) expr -> expr . EQ_EQ expr (rule 91) expr -> expr . NOT_EQ expr (rule 92) expr -> expr . '#' (rule 96) expr -> expr . '?' then expr colon expr (rule 99) expr -> expr . AND expr (rule 100) expr -> expr . OR expr (rule 101) expr -> expr . lazy_and expr (rule 102) expr -> expr . lazy_or expr (rule 103) expr -> expr . BITAND expr (rule 104) expr -> expr . BITOR expr (rule 105) '?' shift, and go to state 114 OR shift, and go to state 115 LAZY_OR shift, and go to state 116 AND shift, and go to state 117 LAZY_AND shift, and go to state 118 BITAND shift, and go to state 119 BITOR shift, and go to state 120 EQ_EQ shift, and go to state 121 NOT_EQ shift, and go to state 122 '>' shift, and go to state 123 GT_EQ shift, and go to state 124 '<' shift, and go to state 125 LT_EQ shift, and go to state 126 '+' shift, and go to state 127 '-' shift, and go to state 128 SLASH_SLASH shift, and go to state 129 '*' shift, and go to state 130 '/' shift, and go to state 131 '%' shift, and go to state 132 '#' shift, and go to state 133 ';' shift, and go to state 223 lazy_and go to state 135 lazy_or go to state 136 state 199 stmt -> INSERT lvalue ',' expr . ',' expr ';' (rule 34) expr -> expr . '+' expr (rule 81) expr -> expr . '-' expr (rule 82) expr -> expr . '*' expr (rule 83) expr -> expr . '/' expr (rule 84) expr -> expr . '%' expr (rule 85) expr -> expr . SLASH_SLASH expr (rule 86) expr -> expr . '>' expr (rule 87) expr -> expr . GT_EQ expr (rule 88) expr -> expr . '<' expr (rule 89) expr -> expr . LT_EQ expr (rule 90) expr -> expr . EQ_EQ expr (rule 91) expr -> expr . NOT_EQ expr (rule 92) expr -> expr . '#' (rule 96) expr -> expr . '?' then expr colon expr (rule 99) expr -> expr . AND expr (rule 100) expr -> expr . OR expr (rule 101) expr -> expr . lazy_and expr (rule 102) expr -> expr . lazy_or expr (rule 103) expr -> expr . BITAND expr (rule 104) expr -> expr . BITOR expr (rule 105) ',' shift, and go to state 224 '?' shift, and go to state 114 OR shift, and go to state 115 LAZY_OR shift, and go to state 116 AND shift, and go to state 117 LAZY_AND shift, and go to state 118 BITAND shift, and go to state 119 BITOR shift, and go to state 120 EQ_EQ shift, and go to state 121 NOT_EQ shift, and go to state 122 '>' shift, and go to state 123 GT_EQ shift, and go to state 124 '<' shift, and go to state 125 LT_EQ shift, and go to state 126 '+' shift, and go to state 127 '-' shift, and go to state 128 SLASH_SLASH shift, and go to state 129 '*' shift, and go to state 130 '/' shift, and go to state 131 '%' shift, and go to state 132 '#' shift, and go to state 133 lazy_and go to state 135 lazy_or go to state 136 state 200 stmt -> DELETE lvalue ',' expr . ';' (rule 35) expr -> expr . '+' expr (rule 81) expr -> expr . '-' expr (rule 82) expr -> expr . '*' expr (rule 83) expr -> expr . '/' expr (rule 84) expr -> expr . '%' expr (rule 85) expr -> expr . SLASH_SLASH expr (rule 86) expr -> expr . '>' expr (rule 87) expr -> expr . GT_EQ expr (rule 88) expr -> expr . '<' expr (rule 89) expr -> expr . LT_EQ expr (rule 90) expr -> expr . EQ_EQ expr (rule 91) expr -> expr . NOT_EQ expr (rule 92) expr -> expr . '#' (rule 96) expr -> expr . '?' then expr colon expr (rule 99) expr -> expr . AND expr (rule 100) expr -> expr . OR expr (rule 101) expr -> expr . lazy_and expr (rule 102) expr -> expr . lazy_or expr (rule 103) expr -> expr . BITAND expr (rule 104) expr -> expr . BITOR expr (rule 105) '?' shift, and go to state 114 OR shift, and go to state 115 LAZY_OR shift, and go to state 116 AND shift, and go to state 117 LAZY_AND shift, and go to state 118 BITAND shift, and go to state 119 BITOR shift, and go to state 120 EQ_EQ shift, and go to state 121 NOT_EQ shift, and go to state 122 '>' shift, and go to state 123 GT_EQ shift, and go to state 124 '<' shift, and go to state 125 LT_EQ shift, and go to state 126 '+' shift, and go to state 127 '-' shift, and go to state 128 SLASH_SLASH shift, and go to state 129 '*' shift, and go to state 130 '/' shift, and go to state 131 '%' shift, and go to state 132 '#' shift, and go to state 133 ';' shift, and go to state 225 lazy_and go to state 135 lazy_or go to state 136 state 201 expr -> '[' begin arglist ']' . (rule 80) $default reduce using rule 80 (expr) state 202 argument_list -> argument_list ',' . expr (rule 146) CONSTANT shift, and go to state 2 VAR shift, and go to state 3 FORMULA shift, and go to state 4 BLTIN shift, and go to state 5 LIB shift, and go to state 6 RLIB shift, and go to state 7 FUNCTION shift, and go to state 11 PROCEDURE shift, and go to state 12 PROCMACRO shift, and go to state 13 LOCAL shift, and go to state 14 ARG shift, and go to state 29 '?' shift, and go to state 30 '-' shift, and go to state 31 '*' shift, and go to state 32 NOT shift, and go to state 33 '!' shift, and go to state 34 PLUS_PLUS shift, and go to state 35 MINUS_MINUS shift, and go to state 36 '&' shift, and go to state 37 EVAL shift, and go to state 38 '$' shift, and go to state 39 '[' shift, and go to state 40 '`' shift, and go to state 71 '(' shift, and go to state 42 lvalue go to state 45 asgn go to state 46 primary go to state 47 secondary go to state 48 id go to state 55 identifier go to state 75 expr go to state 226 evaluate go to state 58 state 203 declare_relation -> '`' expr '`' @3 . tilde_gt '[' id_list_opt ']' ';' (rule 116) TILDE_GT shift, and go to state 111 tilde_gt go to state 227 state 204 declare_formula -> '`' expr '`' @4 . is expr ';' (rule 120) IS shift, and go to state 110 is go to state 228 state 205 asgn -> lvalue '=' lvalue @1 . SLASH_SLASH expr (rule 17) SLASH_SLASH shift, and go to state 229 state 206 lvalue -> lvalue '[' expr ']' . (rule 8) $default reduce using rule 8 (lvalue) state 207 secondary -> primary '(' arglist ')' . (rule 25) $default reduce using rule 25 (secondary) state 208 secondary -> secondary '[' expr ']' . (rule 26) $default reduce using rule 26 (secondary) state 209 stmt -> while '(' expr ')' . then stmt (rule 43) $default reduce using rule 59 (then) then go to state 230 state 210 stmt -> do stmt WHILE '(' . expr ')' ';' (rule 42) CONSTANT shift, and go to state 2 VAR shift, and go to state 3 FORMULA shift, and go to state 4 BLTIN shift, and go to state 5 LIB shift, and go to state 6 RLIB shift, and go to state 7 FUNCTION shift, and go to state 11 PROCEDURE shift, and go to state 12 PROCMACRO shift, and go to state 13 LOCAL shift, and go to state 14 ARG shift, and go to state 29 '?' shift, and go to state 30 '-' shift, and go to state 31 '*' shift, and go to state 32 NOT shift, and go to state 33 '!' shift, and go to state 34 PLUS_PLUS shift, and go to state 35 MINUS_MINUS shift, and go to state 36 '&' shift, and go to state 37 EVAL shift, and go to state 38 '$' shift, and go to state 39 '[' shift, and go to state 40 '`' shift, and go to state 71 '(' shift, and go to state 42 lvalue go to state 45 asgn go to state 46 primary go to state 47 secondary go to state 48 id go to state 55 identifier go to state 75 expr go to state 231 evaluate go to state 58 state 211 stmt -> for expr1 expr2 end_expr2 . expr3 end_expr3 stmt (rule 41) CONSTANT shift, and go to state 2 VAR shift, and go to state 3 FORMULA shift, and go to state 4 BLTIN shift, and go to state 5 LIB shift, and go to state 6 RLIB shift, and go to state 7 FUNCTION shift, and go to state 11 PROCEDURE shift, and go to state 12 PROCMACRO shift, and go to state 13 LOCAL shift, and go to state 14 ARG shift, and go to state 29 '?' shift, and go to state 30 '-' shift, and go to state 31 '*' shift, and go to state 32 NOT shift, and go to state 33 '!' shift, and go to state 34 PLUS_PLUS shift, and go to state 35 MINUS_MINUS shift, and go to state 36 '&' shift, and go to state 37 EVAL shift, and go to state 38 '$' shift, and go to state 39 '[' shift, and go to state 40 '`' shift, and go to state 71 '(' shift, and go to state 42 ')' shift, and go to state 232 lvalue go to state 45 asgn go to state 46 primary go to state 47 secondary go to state 48 expr3 go to state 233 id go to state 55 identifier go to state 75 expr go to state 234 evaluate go to state 58 state 212 expr2 -> expr ';' . (rule 54) $default reduce using rule 54 (expr2) state 213 stmt -> switch expr cases stmt . (rule 40) $default reduce using rule 40 (stmt) state 214 id_list -> identifier . (rule 133) $default reduce using rule 133 (id_list) state 215 declare_relation -> identifier tilde_gt '[' id_list_opt . ']' ';' (rule 114) ']' shift, and go to state 235 state 216 id_list_opt -> id_list . (rule 132) id_list -> id_list . ',' identifier (rule 134) ',' shift, and go to state 236 $default reduce using rule 132 (id_list_opt) state 217 declare_formula -> identifier is expr ';' . (rule 118) $default reduce using rule 118 (declare_formula) state 218 expr -> expr . '+' expr (rule 81) expr -> expr . '-' expr (rule 82) expr -> expr . '*' expr (rule 83) expr -> expr . '/' expr (rule 84) expr -> expr . '%' expr (rule 85) expr -> expr . SLASH_SLASH expr (rule 86) expr -> expr . '>' expr (rule 87) expr -> expr . GT_EQ expr (rule 88) expr -> expr . '<' expr (rule 89) expr -> expr . LT_EQ expr (rule 90) expr -> expr . EQ_EQ expr (rule 91) expr -> expr . NOT_EQ expr (rule 92) expr -> expr . '#' (rule 96) expr -> expr . '?' then expr colon expr (rule 99) expr -> expr '?' then expr . colon expr (rule 99) expr -> expr . AND expr (rule 100) expr -> expr . OR expr (rule 101) expr -> expr . lazy_and expr (rule 102) expr -> expr . lazy_or expr (rule 103) expr -> expr . BITAND expr (rule 104) expr -> expr . BITOR expr (rule 105) '?' shift, and go to state 114 OR shift, and go to state 115 LAZY_OR shift, and go to state 116 AND shift, and go to state 117 LAZY_AND shift, and go to state 118 BITAND shift, and go to state 119 BITOR shift, and go to state 120 EQ_EQ shift, and go to state 121 NOT_EQ shift, and go to state 122 '>' shift, and go to state 123 GT_EQ shift, and go to state 124 '<' shift, and go to state 125 LT_EQ shift, and go to state 126 '+' shift, and go to state 127 '-' shift, and go to state 128 SLASH_SLASH shift, and go to state 129 '*' shift, and go to state 130 '/' shift, and go to state 131 '%' shift, and go to state 132 '#' shift, and go to state 133 ':' shift, and go to state 237 colon go to state 238 lazy_and go to state 135 lazy_or go to state 136 state 219 expr -> evaluate '(' expr ')' . (rule 106) $default reduce using rule 106 (expr) state 220 refer_opt -> ':' . id_list (rule 130) VAR shift, and go to state 3 FORMULA shift, and go to state 4 FUNCTION shift, and go to state 11 PROCEDURE shift, and go to state 12 PROCMACRO shift, and go to state 13 identifier go to state 214 id_list go to state 239 state 221 declare_action -> action identifier @5 refer_opt . def_begin declare_para declare_local stmtlist def_end (rule 123) '{' shift, and go to state 240 def_begin go to state 241 state 222 stmt -> IF '(' expr ')' then . stmt (rule 44) stmt -> IF '(' expr ')' then . stmt else stmt (rule 45) CONSTANT shift, and go to state 2 VAR shift, and go to state 3 FORMULA shift, and go to state 4 BLTIN shift, and go to state 5 LIB shift, and go to state 6 RLIB shift, and go to state 7 FUNC shift, and go to state 8 PROC shift, and go to state 9 PMAC shift, and go to state 10 FUNCTION shift, and go to state 11 PROCEDURE shift, and go to state 12 PROCMACRO shift, and go to state 13 LOCAL shift, and go to state 14 BREAK shift, and go to state 15 CONTINUE shift, and go to state 16 SWITCH shift, and go to state 17 CASE shift, and go to state 18 DEFAULT shift, and go to state 19 DO shift, and go to state 20 FOR shift, and go to state 21 WHILE shift, and go to state 22 IF shift, and go to state 23 SHIFT shift, and go to state 24 APPEND shift, and go to state 25 INSERT shift, and go to state 26 DELETE shift, and go to state 27 RETURN shift, and go to state 28 ARG shift, and go to state 29 '?' shift, and go to state 30 '-' shift, and go to state 31 '*' shift, and go to state 32 NOT shift, and go to state 33 '!' shift, and go to state 34 PLUS_PLUS shift, and go to state 35 MINUS_MINUS shift, and go to state 36 '&' shift, and go to state 37 EVAL shift, and go to state 38 '$' shift, and go to state 39 '[' shift, and go to state 40 '`' shift, and go to state 41 '(' shift, and go to state 42 ';' shift, and go to state 43 '{' shift, and go to state 44 lvalue go to state 45 asgn go to state 46 primary go to state 47 secondary go to state 48 stmt go to state 242 while go to state 50 do go to state 51 for go to state 52 compound go to state 53 switch go to state 54 id go to state 55 identifier go to state 56 expr go to state 57 evaluate go to state 58 defn go to state 59 declare_relation go to state 60 declare_formula go to state 61 declare_action go to state 62 action go to state 63 state 223 stmt -> APPEND lvalue ',' expr ';' . (rule 33) $default reduce using rule 33 (stmt) state 224 stmt -> INSERT lvalue ',' expr ',' . expr ';' (rule 34) CONSTANT shift, and go to state 2 VAR shift, and go to state 3 FORMULA shift, and go to state 4 BLTIN shift, and go to state 5 LIB shift, and go to state 6 RLIB shift, and go to state 7 FUNCTION shift, and go to state 11 PROCEDURE shift, and go to state 12 PROCMACRO shift, and go to state 13 LOCAL shift, and go to state 14 ARG shift, and go to state 29 '?' shift, and go to state 30 '-' shift, and go to state 31 '*' shift, and go to state 32 NOT shift, and go to state 33 '!' shift, and go to state 34 PLUS_PLUS shift, and go to state 35 MINUS_MINUS shift, and go to state 36 '&' shift, and go to state 37 EVAL shift, and go to state 38 '$' shift, and go to state 39 '[' shift, and go to state 40 '`' shift, and go to state 71 '(' shift, and go to state 42 lvalue go to state 45 asgn go to state 46 primary go to state 47 secondary go to state 48 id go to state 55 identifier go to state 75 expr go to state 243 evaluate go to state 58 state 225 stmt -> DELETE lvalue ',' expr ';' . (rule 35) $default reduce using rule 35 (stmt) state 226 expr -> expr . '+' expr (rule 81) expr -> expr . '-' expr (rule 82) expr -> expr . '*' expr (rule 83) expr -> expr . '/' expr (rule 84) expr -> expr . '%' expr (rule 85) expr -> expr . SLASH_SLASH expr (rule 86) expr -> expr . '>' expr (rule 87) expr -> expr . GT_EQ expr (rule 88) expr -> expr . '<' expr (rule 89) expr -> expr . LT_EQ expr (rule 90) expr -> expr . EQ_EQ expr (rule 91) expr -> expr . NOT_EQ expr (rule 92) expr -> expr . '#' (rule 96) expr -> expr . '?' then expr colon expr (rule 99) expr -> expr . AND expr (rule 100) expr -> expr . OR expr (rule 101) expr -> expr . lazy_and expr (rule 102) expr -> expr . lazy_or expr (rule 103) expr -> expr . BITAND expr (rule 104) expr -> expr . BITOR expr (rule 105) argument_list -> argument_list ',' expr . (rule 146) '?' shift, and go to state 114 OR shift, and go to state 115 LAZY_OR shift, and go to state 116 AND shift, and go to state 117 LAZY_AND shift, and go to state 118 BITAND shift, and go to state 119 BITOR shift, and go to state 120 EQ_EQ shift, and go to state 121 NOT_EQ shift, and go to state 122 '>' shift, and go to state 123 GT_EQ shift, and go to state 124 '<' shift, and go to state 125 LT_EQ shift, and go to state 126 '+' shift, and go to state 127 '-' shift, and go to state 128 SLASH_SLASH shift, and go to state 129 '*' shift, and go to state 130 '/' shift, and go to state 131 '%' shift, and go to state 132 '#' shift, and go to state 133 $default reduce using rule 146 (argument_list) lazy_and go to state 135 lazy_or go to state 136 state 227 declare_relation -> '`' expr '`' @3 tilde_gt . '[' id_list_opt ']' ';' (rule 116) '[' shift, and go to state 244 state 228 declare_formula -> '`' expr '`' @4 is . expr ';' (rule 120) CONSTANT shift, and go to state 2 VAR shift, and go to state 3 FORMULA shift, and go to state 4 BLTIN shift, and go to state 5 LIB shift, and go to state 6 RLIB shift, and go to state 7 FUNCTION shift, and go to state 11 PROCEDURE shift, and go to state 12 PROCMACRO shift, and go to state 13 LOCAL shift, and go to state 14 ARG shift, and go to state 29 '?' shift, and go to state 30 '-' shift, and go to state 31 '*' shift, and go to state 32 NOT shift, and go to state 33 '!' shift, and go to state 34 PLUS_PLUS shift, and go to state 35 MINUS_MINUS shift, and go to state 36 '&' shift, and go to state 37 EVAL shift, and go to state 38 '$' shift, and go to state 39 '[' shift, and go to state 40 '`' shift, and go to state 71 '(' shift, and go to state 42 lvalue go to state 45 asgn go to state 46 primary go to state 47 secondary go to state 48 id go to state 55 identifier go to state 75 expr go to state 245 evaluate go to state 58 state 229 asgn -> lvalue '=' lvalue @1 SLASH_SLASH . expr (rule 17) CONSTANT shift, and go to state 2 VAR shift, and go to state 3 FORMULA shift, and go to state 4 BLTIN shift, and go to state 5 LIB shift, and go to state 6 RLIB shift, and go to state 7 FUNCTION shift, and go to state 11 PROCEDURE shift, and go to state 12 PROCMACRO shift, and go to state 13 LOCAL shift, and go to state 14 ARG shift, and go to state 29 '?' shift, and go to state 30 '-' shift, and go to state 31 '*' shift, and go to state 32 NOT shift, and go to state 33 '!' shift, and go to state 34 PLUS_PLUS shift, and go to state 35 MINUS_MINUS shift, and go to state 36 '&' shift, and go to state 37 EVAL shift, and go to state 38 '$' shift, and go to state 39 '[' shift, and go to state 40 '`' shift, and go to state 71 '(' shift, and go to state 42 lvalue go to state 45 asgn go to state 46 primary go to state 47 secondary go to state 48 id go to state 55 identifier go to state 75 expr go to state 246 evaluate go to state 58 state 230 stmt -> while '(' expr ')' then . stmt (rule 43) CONSTANT shift, and go to state 2 VAR shift, and go to state 3 FORMULA shift, and go to state 4 BLTIN shift, and go to state 5 LIB shift, and go to state 6 RLIB shift, and go to state 7 FUNC shift, and go to state 8 PROC shift, and go to state 9 PMAC shift, and go to state 10 FUNCTION shift, and go to state 11 PROCEDURE shift, and go to state 12 PROCMACRO shift, and go to state 13 LOCAL shift, and go to state 14 BREAK shift, and go to state 15 CONTINUE shift, and go to state 16 SWITCH shift, and go to state 17 CASE shift, and go to state 18 DEFAULT shift, and go to state 19 DO shift, and go to state 20 FOR shift, and go to state 21 WHILE shift, and go to state 22 IF shift, and go to state 23 SHIFT shift, and go to state 24 APPEND shift, and go to state 25 INSERT shift, and go to state 26 DELETE shift, and go to state 27 RETURN shift, and go to state 28 ARG shift, and go to state 29 '?' shift, and go to state 30 '-' shift, and go to state 31 '*' shift, and go to state 32 NOT shift, and go to state 33 '!' shift, and go to state 34 PLUS_PLUS shift, and go to state 35 MINUS_MINUS shift, and go to state 36 '&' shift, and go to state 37 EVAL shift, and go to state 38 '$' shift, and go to state 39 '[' shift, and go to state 40 '`' shift, and go to state 41 '(' shift, and go to state 42 ';' shift, and go to state 43 '{' shift, and go to state 44 lvalue go to state 45 asgn go to state 46 primary go to state 47 secondary go to state 48 stmt go to state 247 while go to state 50 do go to state 51 for go to state 52 compound go to state 53 switch go to state 54 id go to state 55 identifier go to state 56 expr go to state 57 evaluate go to state 58 defn go to state 59 declare_relation go to state 60 declare_formula go to state 61 declare_action go to state 62 action go to state 63 state 231 stmt -> do stmt WHILE '(' expr . ')' ';' (rule 42) expr -> expr . '+' expr (rule 81) expr -> expr . '-' expr (rule 82) expr -> expr . '*' expr (rule 83) expr -> expr . '/' expr (rule 84) expr -> expr . '%' expr (rule 85) expr -> expr . SLASH_SLASH expr (rule 86) expr -> expr . '>' expr (rule 87) expr -> expr . GT_EQ expr (rule 88) expr -> expr . '<' expr (rule 89) expr -> expr . LT_EQ expr (rule 90) expr -> expr . EQ_EQ expr (rule 91) expr -> expr . NOT_EQ expr (rule 92) expr -> expr . '#' (rule 96) expr -> expr . '?' then expr colon expr (rule 99) expr -> expr . AND expr (rule 100) expr -> expr . OR expr (rule 101) expr -> expr . lazy_and expr (rule 102) expr -> expr . lazy_or expr (rule 103) expr -> expr . BITAND expr (rule 104) expr -> expr . BITOR expr (rule 105) '?' shift, and go to state 114 OR shift, and go to state 115 LAZY_OR shift, and go to state 116 AND shift, and go to state 117 LAZY_AND shift, and go to state 118 BITAND shift, and go to state 119 BITOR shift, and go to state 120 EQ_EQ shift, and go to state 121 NOT_EQ shift, and go to state 122 '>' shift, and go to state 123 GT_EQ shift, and go to state 124 '<' shift, and go to state 125 LT_EQ shift, and go to state 126 '+' shift, and go to state 127 '-' shift, and go to state 128 SLASH_SLASH shift, and go to state 129 '*' shift, and go to state 130 '/' shift, and go to state 131 '%' shift, and go to state 132 '#' shift, and go to state 133 ')' shift, and go to state 248 lazy_and go to state 135 lazy_or go to state 136 state 232 expr3 -> ')' . (rule 56) $default reduce using rule 56 (expr3) state 233 stmt -> for expr1 expr2 end_expr2 expr3 . end_expr3 stmt (rule 41) $default reduce using rule 58 (end_expr3) end_expr3 go to state 249 state 234 expr3 -> expr . ')' (rule 57) expr -> expr . '+' expr (rule 81) expr -> expr . '-' expr (rule 82) expr -> expr . '*' expr (rule 83) expr -> expr . '/' expr (rule 84) expr -> expr . '%' expr (rule 85) expr -> expr . SLASH_SLASH expr (rule 86) expr -> expr . '>' expr (rule 87) expr -> expr . GT_EQ expr (rule 88) expr -> expr . '<' expr (rule 89) expr -> expr . LT_EQ expr (rule 90) expr -> expr . EQ_EQ expr (rule 91) expr -> expr . NOT_EQ expr (rule 92) expr -> expr . '#' (rule 96) expr -> expr . '?' then expr colon expr (rule 99) expr -> expr . AND expr (rule 100) expr -> expr . OR expr (rule 101) expr -> expr . lazy_and expr (rule 102) expr -> expr . lazy_or expr (rule 103) expr -> expr . BITAND expr (rule 104) expr -> expr . BITOR expr (rule 105) '?' shift, and go to state 114 OR shift, and go to state 115 LAZY_OR shift, and go to state 116 AND shift, and go to state 117 LAZY_AND shift, and go to state 118 BITAND shift, and go to state 119 BITOR shift, and go to state 120 EQ_EQ shift, and go to state 121 NOT_EQ shift, and go to state 122 '>' shift, and go to state 123 GT_EQ shift, and go to state 124 '<' shift, and go to state 125 LT_EQ shift, and go to state 126 '+' shift, and go to state 127 '-' shift, and go to state 128 SLASH_SLASH shift, and go to state 129 '*' shift, and go to state 130 '/' shift, and go to state 131 '%' shift, and go to state 132 '#' shift, and go to state 133 ')' shift, and go to state 250 lazy_and go to state 135 lazy_or go to state 136 state 235 declare_relation -> identifier tilde_gt '[' id_list_opt ']' . ';' (rule 114) ';' shift, and go to state 251 state 236 id_list -> id_list ',' . identifier (rule 134) VAR shift, and go to state 3 FORMULA shift, and go to state 4 FUNCTION shift, and go to state 11 PROCEDURE shift, and go to state 12 PROCMACRO shift, and go to state 13 identifier go to state 252 state 237 colon -> ':' . (rule 108) $default reduce using rule 108 (colon) state 238 expr -> expr '?' then expr colon . expr (rule 99) CONSTANT shift, and go to state 2 VAR shift, and go to state 3 FORMULA shift, and go to state 4 BLTIN shift, and go to state 5 LIB shift, and go to state 6 RLIB shift, and go to state 7 FUNCTION shift, and go to state 11 PROCEDURE shift, and go to state 12 PROCMACRO shift, and go to state 13 LOCAL shift, and go to state 14 ARG shift, and go to state 29 '?' shift, and go to state 30 '-' shift, and go to state 31 '*' shift, and go to state 32 NOT shift, and go to state 33 '!' shift, and go to state 34 PLUS_PLUS shift, and go to state 35 MINUS_MINUS shift, and go to state 36 '&' shift, and go to state 37 EVAL shift, and go to state 38 '$' shift, and go to state 39 '[' shift, and go to state 40 '`' shift, and go to state 71 '(' shift, and go to state 42 lvalue go to state 45 asgn go to state 46 primary go to state 47 secondary go to state 48 id go to state 55 identifier go to state 75 expr go to state 253 evaluate go to state 58 state 239 refer_opt -> ':' id_list . (rule 130) id_list -> id_list . ',' identifier (rule 134) ',' shift, and go to state 236 $default reduce using rule 130 (refer_opt) state 240 def_begin -> '{' . (rule 127) $default reduce using rule 127 (def_begin) state 241 declare_action -> action identifier @5 refer_opt def_begin . declare_para declare_local stmtlist def_end (rule 123) PARA shift, and go to state 254 $default reduce using rule 135 (declare_para) declare_para go to state 255 state 242 stmt -> IF '(' expr ')' then stmt . (rule 44) stmt -> IF '(' expr ')' then stmt . else stmt (rule 45) ELSE shift, and go to state 256 ELSE [reduce using rule 44 (stmt)] $default reduce using rule 44 (stmt) else go to state 257 state 243 stmt -> INSERT lvalue ',' expr ',' expr . ';' (rule 34) expr -> expr . '+' expr (rule 81) expr -> expr . '-' expr (rule 82) expr -> expr . '*' expr (rule 83) expr -> expr . '/' expr (rule 84) expr -> expr . '%' expr (rule 85) expr -> expr . SLASH_SLASH expr (rule 86) expr -> expr . '>' expr (rule 87) expr -> expr . GT_EQ expr (rule 88) expr -> expr . '<' expr (rule 89) expr -> expr . LT_EQ expr (rule 90) expr -> expr . EQ_EQ expr (rule 91) expr -> expr . NOT_EQ expr (rule 92) expr -> expr . '#' (rule 96) expr -> expr . '?' then expr colon expr (rule 99) expr -> expr . AND expr (rule 100) expr -> expr . OR expr (rule 101) expr -> expr . lazy_and expr (rule 102) expr -> expr . lazy_or expr (rule 103) expr -> expr . BITAND expr (rule 104) expr -> expr . BITOR expr (rule 105) '?' shift, and go to state 114 OR shift, and go to state 115 LAZY_OR shift, and go to state 116 AND shift, and go to state 117 LAZY_AND shift, and go to state 118 BITAND shift, and go to state 119 BITOR shift, and go to state 120 EQ_EQ shift, and go to state 121 NOT_EQ shift, and go to state 122 '>' shift, and go to state 123 GT_EQ shift, and go to state 124 '<' shift, and go to state 125 LT_EQ shift, and go to state 126 '+' shift, and go to state 127 '-' shift, and go to state 128 SLASH_SLASH shift, and go to state 129 '*' shift, and go to state 130 '/' shift, and go to state 131 '%' shift, and go to state 132 '#' shift, and go to state 133 ';' shift, and go to state 258 lazy_and go to state 135 lazy_or go to state 136 state 244 declare_relation -> '`' expr '`' @3 tilde_gt '[' . id_list_opt ']' ';' (rule 116) VAR shift, and go to state 3 FORMULA shift, and go to state 4 FUNCTION shift, and go to state 11 PROCEDURE shift, and go to state 12 PROCMACRO shift, and go to state 13 $default reduce using rule 131 (id_list_opt) identifier go to state 214 id_list_opt go to state 259 id_list go to state 216 state 245 expr -> expr . '+' expr (rule 81) expr -> expr . '-' expr (rule 82) expr -> expr . '*' expr (rule 83) expr -> expr . '/' expr (rule 84) expr -> expr . '%' expr (rule 85) expr -> expr . SLASH_SLASH expr (rule 86) expr -> expr . '>' expr (rule 87) expr -> expr . GT_EQ expr (rule 88) expr -> expr . '<' expr (rule 89) expr -> expr . LT_EQ expr (rule 90) expr -> expr . EQ_EQ expr (rule 91) expr -> expr . NOT_EQ expr (rule 92) expr -> expr . '#' (rule 96) expr -> expr . '?' then expr colon expr (rule 99) expr -> expr . AND expr (rule 100) expr -> expr . OR expr (rule 101) expr -> expr . lazy_and expr (rule 102) expr -> expr . lazy_or expr (rule 103) expr -> expr . BITAND expr (rule 104) expr -> expr . BITOR expr (rule 105) declare_formula -> '`' expr '`' @4 is expr . ';' (rule 120) '?' shift, and go to state 114 OR shift, and go to state 115 LAZY_OR shift, and go to state 116 AND shift, and go to state 117 LAZY_AND shift, and go to state 118 BITAND shift, and go to state 119 BITOR shift, and go to state 120 EQ_EQ shift, and go to state 121 NOT_EQ shift, and go to state 122 '>' shift, and go to state 123 GT_EQ shift, and go to state 124 '<' shift, and go to state 125 LT_EQ shift, and go to state 126 '+' shift, and go to state 127 '-' shift, and go to state 128 SLASH_SLASH shift, and go to state 129 '*' shift, and go to state 130 '/' shift, and go to state 131 '%' shift, and go to state 132 '#' shift, and go to state 133 ';' shift, and go to state 260 lazy_and go to state 135 lazy_or go to state 136 state 246 asgn -> lvalue '=' lvalue @1 SLASH_SLASH expr . (rule 17) expr -> expr . '+' expr (rule 81) expr -> expr . '-' expr (rule 82) expr -> expr . '*' expr (rule 83) expr -> expr . '/' expr (rule 84) expr -> expr . '%' expr (rule 85) expr -> expr . SLASH_SLASH expr (rule 86) expr -> expr . '>' expr (rule 87) expr -> expr . GT_EQ expr (rule 88) expr -> expr . '<' expr (rule 89) expr -> expr . LT_EQ expr (rule 90) expr -> expr . EQ_EQ expr (rule 91) expr -> expr . NOT_EQ expr (rule 92) expr -> expr . '#' (rule 96) expr -> expr . '?' then expr colon expr (rule 99) expr -> expr . AND expr (rule 100) expr -> expr . OR expr (rule 101) expr -> expr . lazy_and expr (rule 102) expr -> expr . lazy_or expr (rule 103) expr -> expr . BITAND expr (rule 104) expr -> expr . BITOR expr (rule 105) '?' shift, and go to state 114 OR shift, and go to state 115 LAZY_OR shift, and go to state 116 AND shift, and go to state 117 LAZY_AND shift, and go to state 118 BITAND shift, and go to state 119 BITOR shift, and go to state 120 EQ_EQ shift, and go to state 121 NOT_EQ shift, and go to state 122 '>' shift, and go to state 123 GT_EQ shift, and go to state 124 '<' shift, and go to state 125 LT_EQ shift, and go to state 126 '+' shift, and go to state 127 '-' shift, and go to state 128 SLASH_SLASH shift, and go to state 129 '*' shift, and go to state 130 '/' shift, and go to state 131 '%' shift, and go to state 132 '#' shift, and go to state 133 $default reduce using rule 17 (asgn) lazy_and go to state 135 lazy_or go to state 136 state 247 stmt -> while '(' expr ')' then stmt . (rule 43) $default reduce using rule 43 (stmt) state 248 stmt -> do stmt WHILE '(' expr ')' . ';' (rule 42) ';' shift, and go to state 261 state 249 stmt -> for expr1 expr2 end_expr2 expr3 end_expr3 . stmt (rule 41) CONSTANT shift, and go to state 2 VAR shift, and go to state 3 FORMULA shift, and go to state 4 BLTIN shift, and go to state 5 LIB shift, and go to state 6 RLIB shift, and go to state 7 FUNC shift, and go to state 8 PROC shift, and go to state 9 PMAC shift, and go to state 10 FUNCTION shift, and go to state 11 PROCEDURE shift, and go to state 12 PROCMACRO shift, and go to state 13 LOCAL shift, and go to state 14 BREAK shift, and go to state 15 CONTINUE shift, and go to state 16 SWITCH shift, and go to state 17 CASE shift, and go to state 18 DEFAULT shift, and go to state 19 DO shift, and go to state 20 FOR shift, and go to state 21 WHILE shift, and go to state 22 IF shift, and go to state 23 SHIFT shift, and go to state 24 APPEND shift, and go to state 25 INSERT shift, and go to state 26 DELETE shift, and go to state 27 RETURN shift, and go to state 28 ARG shift, and go to state 29 '?' shift, and go to state 30 '-' shift, and go to state 31 '*' shift, and go to state 32 NOT shift, and go to state 33 '!' shift, and go to state 34 PLUS_PLUS shift, and go to state 35 MINUS_MINUS shift, and go to state 36 '&' shift, and go to state 37 EVAL shift, and go to state 38 '$' shift, and go to state 39 '[' shift, and go to state 40 '`' shift, and go to state 41 '(' shift, and go to state 42 ';' shift, and go to state 43 '{' shift, and go to state 44 lvalue go to state 45 asgn go to state 46 primary go to state 47 secondary go to state 48 stmt go to state 262 while go to state 50 do go to state 51 for go to state 52 compound go to state 53 switch go to state 54 id go to state 55 identifier go to state 56 expr go to state 57 evaluate go to state 58 defn go to state 59 declare_relation go to state 60 declare_formula go to state 61 declare_action go to state 62 action go to state 63 state 250 expr3 -> expr ')' . (rule 57) $default reduce using rule 57 (expr3) state 251 declare_relation -> identifier tilde_gt '[' id_list_opt ']' ';' . (rule 114) $default reduce using rule 114 (declare_relation) state 252 id_list -> id_list ',' identifier . (rule 134) $default reduce using rule 134 (id_list) state 253 expr -> expr . '+' expr (rule 81) expr -> expr . '-' expr (rule 82) expr -> expr . '*' expr (rule 83) expr -> expr . '/' expr (rule 84) expr -> expr . '%' expr (rule 85) expr -> expr . SLASH_SLASH expr (rule 86) expr -> expr . '>' expr (rule 87) expr -> expr . GT_EQ expr (rule 88) expr -> expr . '<' expr (rule 89) expr -> expr . LT_EQ expr (rule 90) expr -> expr . EQ_EQ expr (rule 91) expr -> expr . NOT_EQ expr (rule 92) expr -> expr . '#' (rule 96) expr -> expr . '?' then expr colon expr (rule 99) expr -> expr '?' then expr colon expr . (rule 99) expr -> expr . AND expr (rule 100) expr -> expr . OR expr (rule 101) expr -> expr . lazy_and expr (rule 102) expr -> expr . lazy_or expr (rule 103) expr -> expr . BITAND expr (rule 104) expr -> expr . BITOR expr (rule 105) '?' shift, and go to state 114 OR shift, and go to state 115 LAZY_OR shift, and go to state 116 AND shift, and go to state 117 LAZY_AND shift, and go to state 118 BITAND shift, and go to state 119 BITOR shift, and go to state 120 EQ_EQ shift, and go to state 121 NOT_EQ shift, and go to state 122 '>' shift, and go to state 123 GT_EQ shift, and go to state 124 '<' shift, and go to state 125 LT_EQ shift, and go to state 126 '+' shift, and go to state 127 '-' shift, and go to state 128 SLASH_SLASH shift, and go to state 129 '*' shift, and go to state 130 '/' shift, and go to state 131 '%' shift, and go to state 132 '#' shift, and go to state 133 $default reduce using rule 99 (expr) lazy_and go to state 135 lazy_or go to state 136 state 254 declare_para -> PARA . @6 local_list ';' (rule 137) $default reduce using rule 136 (@6) @6 go to state 263 state 255 declare_action -> action identifier @5 refer_opt def_begin declare_para . declare_local stmtlist def_end (rule 123) $default reduce using rule 138 (declare_local) declare_local go to state 264 state 256 else -> ELSE . (rule 60) $default reduce using rule 60 (else) state 257 stmt -> IF '(' expr ')' then stmt else . stmt (rule 45) CONSTANT shift, and go to state 2 VAR shift, and go to state 3 FORMULA shift, and go to state 4 BLTIN shift, and go to state 5 LIB shift, and go to state 6 RLIB shift, and go to state 7 FUNC shift, and go to state 8 PROC shift, and go to state 9 PMAC shift, and go to state 10 FUNCTION shift, and go to state 11 PROCEDURE shift, and go to state 12 PROCMACRO shift, and go to state 13 LOCAL shift, and go to state 14 BREAK shift, and go to state 15 CONTINUE shift, and go to state 16 SWITCH shift, and go to state 17 CASE shift, and go to state 18 DEFAULT shift, and go to state 19 DO shift, and go to state 20 FOR shift, and go to state 21 WHILE shift, and go to state 22 IF shift, and go to state 23 SHIFT shift, and go to state 24 APPEND shift, and go to state 25 INSERT shift, and go to state 26 DELETE shift, and go to state 27 RETURN shift, and go to state 28 ARG shift, and go to state 29 '?' shift, and go to state 30 '-' shift, and go to state 31 '*' shift, and go to state 32 NOT shift, and go to state 33 '!' shift, and go to state 34 PLUS_PLUS shift, and go to state 35 MINUS_MINUS shift, and go to state 36 '&' shift, and go to state 37 EVAL shift, and go to state 38 '$' shift, and go to state 39 '[' shift, and go to state 40 '`' shift, and go to state 41 '(' shift, and go to state 42 ';' shift, and go to state 43 '{' shift, and go to state 44 lvalue go to state 45 asgn go to state 46 primary go to state 47 secondary go to state 48 stmt go to state 265 while go to state 50 do go to state 51 for go to state 52 compound go to state 53 switch go to state 54 id go to state 55 identifier go to state 56 expr go to state 57 evaluate go to state 58 defn go to state 59 declare_relation go to state 60 declare_formula go to state 61 declare_action go to state 62 action go to state 63 state 258 stmt -> INSERT lvalue ',' expr ',' expr ';' . (rule 34) $default reduce using rule 34 (stmt) state 259 declare_relation -> '`' expr '`' @3 tilde_gt '[' id_list_opt . ']' ';' (rule 116) ']' shift, and go to state 266 state 260 declare_formula -> '`' expr '`' @4 is expr ';' . (rule 120) $default reduce using rule 120 (declare_formula) state 261 stmt -> do stmt WHILE '(' expr ')' ';' . (rule 42) $default reduce using rule 42 (stmt) state 262 stmt -> for expr1 expr2 end_expr2 expr3 end_expr3 stmt . (rule 41) $default reduce using rule 41 (stmt) state 263 declare_para -> PARA @6 . local_list ';' (rule 137) LOCAL shift, and go to state 267 local_list go to state 268 state 264 declare_action -> action identifier @5 refer_opt def_begin declare_para declare_local . stmtlist def_end (rule 123) declare_local -> declare_local . AUTO @7 local_list ';' (rule 140) AUTO shift, and go to state 269 $default reduce using rule 62 (stmtlist) stmtlist go to state 270 state 265 stmt -> IF '(' expr ')' then stmt else stmt . (rule 45) $default reduce using rule 45 (stmt) state 266 declare_relation -> '`' expr '`' @3 tilde_gt '[' id_list_opt ']' . ';' (rule 116) ';' shift, and go to state 271 state 267 local_list -> LOCAL . (rule 141) $default reduce using rule 141 (local_list) state 268 declare_para -> PARA @6 local_list . ';' (rule 137) local_list -> local_list . ',' LOCAL (rule 142) ',' shift, and go to state 272 ';' shift, and go to state 273 state 269 declare_local -> declare_local AUTO . @7 local_list ';' (rule 140) $default reduce using rule 139 (@7) @7 go to state 274 state 270 stmtlist -> stmtlist . stmt (rule 63) declare_action -> action identifier @5 refer_opt def_begin declare_para declare_local stmtlist . def_end (rule 123) CONSTANT shift, and go to state 2 VAR shift, and go to state 3 FORMULA shift, and go to state 4 BLTIN shift, and go to state 5 LIB shift, and go to state 6 RLIB shift, and go to state 7 FUNC shift, and go to state 8 PROC shift, and go to state 9 PMAC shift, and go to state 10 FUNCTION shift, and go to state 11 PROCEDURE shift, and go to state 12 PROCMACRO shift, and go to state 13 LOCAL shift, and go to state 14 BREAK shift, and go to state 15 CONTINUE shift, and go to state 16 SWITCH shift, and go to state 17 CASE shift, and go to state 18 DEFAULT shift, and go to state 19 DO shift, and go to state 20 FOR shift, and go to state 21 WHILE shift, and go to state 22 IF shift, and go to state 23 SHIFT shift, and go to state 24 APPEND shift, and go to state 25 INSERT shift, and go to state 26 DELETE shift, and go to state 27 RETURN shift, and go to state 28 ARG shift, and go to state 29 '?' shift, and go to state 30 '-' shift, and go to state 31 '*' shift, and go to state 32 NOT shift, and go to state 33 '!' shift, and go to state 34 PLUS_PLUS shift, and go to state 35 MINUS_MINUS shift, and go to state 36 '&' shift, and go to state 37 EVAL shift, and go to state 38 '$' shift, and go to state 39 '[' shift, and go to state 40 '`' shift, and go to state 41 '(' shift, and go to state 42 ';' shift, and go to state 43 '{' shift, and go to state 44 '}' shift, and go to state 275 lvalue go to state 45 asgn go to state 46 primary go to state 47 secondary go to state 48 stmt go to state 157 while go to state 50 do go to state 51 for go to state 52 compound go to state 53 switch go to state 54 id go to state 55 identifier go to state 56 expr go to state 57 evaluate go to state 58 defn go to state 59 declare_relation go to state 60 declare_formula go to state 61 declare_action go to state 62 action go to state 63 def_end go to state 276 state 271 declare_relation -> '`' expr '`' @3 tilde_gt '[' id_list_opt ']' ';' . (rule 116) $default reduce using rule 116 (declare_relation) state 272 local_list -> local_list ',' . LOCAL (rule 142) LOCAL shift, and go to state 277 state 273 declare_para -> PARA @6 local_list ';' . (rule 137) $default reduce using rule 137 (declare_para) state 274 declare_local -> declare_local AUTO @7 . local_list ';' (rule 140) LOCAL shift, and go to state 267 local_list go to state 278 state 275 def_end -> '}' . (rule 128) $default reduce using rule 128 (def_end) state 276 declare_action -> action identifier @5 refer_opt def_begin declare_para declare_local stmtlist def_end . (rule 123) $default reduce using rule 123 (declare_action) state 277 local_list -> local_list ',' LOCAL . (rule 142) $default reduce using rule 142 (local_list) state 278 declare_local -> declare_local AUTO @7 local_list . ';' (rule 140) local_list -> local_list . ',' LOCAL (rule 142) ',' shift, and go to state 272 ';' shift, and go to state 279 state 279 declare_local -> declare_local AUTO @7 local_list ';' . (rule 140) $default reduce using rule 140 (declare_local) state 280 $ go to state 281 state 281 $ go to state 282 state 282 $default accept re_relation -> identifier tilde_gt '[' id_list_opt ']' ';' . (rule 114) $default reduce using rule 114 (declare_relation) state 252 id_list -> id_list ',' identiftkeden1.41/Eden/yacc.y010060000025250000164000000415710745167763700146340ustar00ashleyem00003510000005%{ /* * $Id: yacc.y,v 1.18 2002/03/01 23:48:22 cssbz Exp $ */ /* This is from the Autoconf manual. Note the pragma directive is indented so that pre-ANSI C compilers will ignore it. [Ash] */ /* AIX requires this to be the first thing in the file */ #ifdef __GNUC__ # define alloca __builtin_alloca #else # if HAVE_ALLOCA_H # include # else # ifdef _AIX #pragma alloca # else # ifndef alloca /* predefined by HP cc +Olibcalls */ char *alloca (); # endif # endif # endif #endif static char rcsid[] = "$Id: yacc.y,v 1.18 2002/03/01 23:48:22 cssbz Exp $"; #include "../config.h" #include #include "eden.h" #include "emalloc.h" #ifdef HAVE_DMALLOC #include #endif #include "error.h" #define YYERROR_VERBOSE 1 #define WANT_SETYYPARSEINIT #define code2(c1,c2) code(c1); code(c2) #define code3(c1,c2,c3) code(c1); code(c2); code(c3) #define fromto(F,T) (F)[1] = (Inst)((T)-((F)+2)) extern char *textptr, textcode[]; extern symptr_QUEUE break_q, cont_q; extern void patch(Inst *, Inst *, symptr_QUEUE *); extern void dispatch(Inst *, symptr_QUEUE *); #define dispatch_break() dispatch(progp, &break_q); code2(jmp, 0) #define dispatch_continue() dispatch(progp, &cont_q); code2(jmp, 0) #define patch_break(mark,p) patch(mark, p, &break_q) #define patch_continue(mark,p) patch(mark, p, &cont_q) #define rts (Inst) 0 typedef struct { Inst *location; Datum *dp; } Garbage; typedef struct { Inst *start; Inst *end; } UsefulGarbage; static int MAXGARBAGE = 0; static int MAXUSABLE = 0; static Garbage *garbage; static UsefulGarbage *usable; static int nGarbage = 0; static int nUsable = 0; static int garbageLevel = 0; extern int inEVAL; extern int *autocalc; extern int *eden_backticks_dependency_hack; /* Garbage seems to be a structure describing which information on the stack can be thrown away. But see also the Usable structure :) */ void markGarbage(location, dp) Inst *location; Datum *dp; { if (MAXGARBAGE == 0) { garbage = (Garbage *) emalloc(sizeof(Garbage) * 64); MAXGARBAGE = 64; } if (nGarbage == MAXGARBAGE) { MAXGARBAGE += 64; garbage = (Garbage *) erealloc(garbage, sizeof(Garbage) * MAXGARBAGE); } garbage[nGarbage].location = location; garbage[nGarbage].dp = dp; nGarbage++; } /* Usable describes information on the stack that must be kept. Usable overrides Garbage - see Garbage above :) */ void unmarkGarbage(start, end) Inst *start; Inst *end; { if (MAXUSABLE == 0) { usable = (UsefulGarbage *) emalloc(sizeof(UsefulGarbage) * 4); MAXUSABLE = 4; } if (nUsable == MAXUSABLE) { MAXUSABLE += 4; usable = (UsefulGarbage *) erealloc(usable, sizeof(UsefulGarbage) * MAXUSABLE); } usable[nUsable].start = start; usable[nUsable].end = end; nUsable++; } void incGarbageLevel(void) { garbageLevel++; } void decGarbageLevel(void) { --garbageLevel; } void clearGarbage(void) { int i, j, save; if (--garbageLevel == 0) { for (i = 0; i < nGarbage; i++) { save = 0; /* nonzero ('true') if we should keep this information */ for (j = 0; j < nUsable; j++) { if (garbage[i].location >= usable[j].start && garbage[i].location <= usable[j].end) { /* this garbage is within this usable section, so we should keep it */ save = 1; break; } } if (!save) { /* don't save the info - free it up */ freedatum(*garbage[i].dp); free(garbage[i].dp); } } nGarbage = nUsable = 0; } } void defnonly(char *s) { /* warn if illegal definition */ if (!indef) error2(s, "used outside definition"); } extern void addentry(Datum *, Inst *); extern Inst *code(/* Inst */); extern Inst *code_related_by(symptr); extern Inst *code_related_by_runtimelhs(); extern Inst *code_definition(int, symptr, Inst *, Inst *, Int, char *); extern Inst *code_definition_runtimelhs(int, Inst *, Inst *, Int, char *); extern Inst *code_eval(Inst *, Inst *); extern void execute(Inst *); /* can be used to execute pc at end with (rts) */ extern void codeswitch(struct t *); extern void insert_level_marker(int), delete_local_level(int); extern void push_text(char *, int); %} %union { Datum *dp; /* constants */ symptr sym; /* symbol table ptr */ Inst *inst; /* machine instruction */ Int narg; /* number of arguments */ Inst fun; /* binop */ struct t *sw; /* switch */ char *tbegin; /* beginning of text */ } %token UNDEF %token REAL %token INTEGER %token MYCHAR %token STRING %token LIST %token CONSTANT %token VAR %token FORMULA %token BLTIN LIB RLIB %token FUNC PROC PMAC %token FUNCTION %token PROCEDURE %token PROCMACRO %token AUTO PARA %token LOCAL %token BREAK CONTINUE %token SWITCH CASE DEFAULT %token DO FOR WHILE IF ELSE %token SHIFT APPEND INSERT DELETE RETURN %token ARG %type id identifier %type lvalue primary secondary %type lazy_and lazy_or colon %type expr %type expr1 expr2 end_expr2 expr3 end_expr3 %type switch %type cases %type stmt compound %type asgn %type stmtlist %type then else begin %type action def_end %type is def_begin evaluate %type defn declare_formula declare_action declare_relation %type declare_local local_list %type refer_opt id_list id_list_opt %type arglist argument_list %nonassoc IS TILDE_GT %left ',' %right '=' PLUS_EQ MINUS_EQ %right '?' %left OR LAZY_OR %left AND LAZY_AND %left BITAND BITOR %left EQ_EQ NOT_EQ %left '>' GT_EQ '<' LT_EQ %left '+' '-' SLASH_SLASH %left '*' '/' '%' %nonassoc NEGATE NOT '!' PLUS_PLUS MINUS_MINUS '#' '&' ASTERISK EVAL %expect 6 %% program: /* nothing */ | stmt { code2(freeheap, rts); textptr = textcode; return 1; } | error { yyerrok; } ; lvalue: id { $$ = code2(addr, $1); } | LOCAL { defnonly("local variable"); if (inEVAL) error("can't reference local variable within eval()"); $$ = code2(localaddr, $1); } | '$' { defnonly("$"); if (inEVAL) error("can't reference local $ variable within eval()"); $$ = code2(localaddr, (Inst)0); } | ARG { defnonly("$"); if (inEVAL) error("can't reference local $ variable within eval()"); $$ = code2(localaddr, (Inst)0); code3(pushint, (Inst)$1, indexcalc); } | lvalue '[' expr ']' { code(indexcalc); } | '*' primary %prec ASTERISK { $$ = $2; } | '*' '&' lvalue { $$ = $3; } | '`' expr '`' { $$ = $2; code(lookup_address); /* The below is a hack by Patrick which evaluates expr at parse time. It seems to be necessary in some situations (eg the project timetable). It was added in yacc.y 1.8 (6th Sept 1999, release 1.0), removed again in yacc.y 1.15 (27th July 2001, release 1.13), and made optional in 1.18 (release 1.38). [Ash] */ if (informula && !inEVAL && *autocalc && *eden_backticks_dependency_hack) { code(rts); execute($2); progp--; /* remove rts */ } } | '(' lvalue ')' { $$ = $2; } ; /* these didn't work as attempts at adding concatopt... */ /* | lvalue '=' primary SLASH_SLASH expr */ /* | lvalue '=' id { $$=code2(addr, $3); } SLASH_SLASH expr */ /* | lvalue '=' lvalue { code(getvalue); } SLASH_SLASH expr */ /* | lvalue '=' simplelvalue SLASH_SLASH expr */ asgn: lvalue '=' expr { code(assign); } | lvalue PLUS_EQ expr %prec '=' { code(inc_asgn); } | lvalue MINUS_EQ expr %prec '=' { code(dec_asgn); } | lvalue '=' lvalue { code(getvalue); } SLASH_SLASH expr %prec '=' { if ($1[1] == $3[1]) { // l = l // expr: optimise code(concatopt); } else { // l = notl // expr: // treat normally code(concat); code(assign); } } | PLUS_PLUS lvalue { code(pre_inc); $$ = $2; } | lvalue PLUS_PLUS { code(post_inc); } | MINUS_MINUS lvalue { code(pre_dec); $$ = $2; } | lvalue MINUS_MINUS { code(post_dec); } ; primary: lvalue { code(getvalue); } | secondary | '(' expr ')' { $$ = $2; } ; secondary: primary '(' arglist ')' { code3(makelist, $3, eval); } | secondary '[' expr ']' { code(sel); } ; stmt: defn | expr ';' { code2(popd, freeheap); } | RETURN ';' { defnonly("return"); $$ = code2(pushUNDEF, rts); } | RETURN expr ';' { defnonly("return"); $$ = $2; code(rts); } | SHIFT ';' { defnonly("shift"); $$ = code3(localaddr, 0, shift); } | SHIFT lvalue ';' { $$ = $2; code(shift); } | APPEND lvalue ',' expr ';' { $$ = $2; code2(append, freeheap); } | INSERT lvalue ',' expr ',' expr ';' { $$ = $2; code2(insert, freeheap); } | DELETE lvalue ',' expr ';' { $$ = $2; code2(delete, freeheap); } | CASE CONSTANT ':' { if (inswitch) addentry($2, progp); else error("'case' used outside switch"); $$ = progp; } | DEFAULT ':' { if (inswitch) addentry(0, progp); else error("'default' used outside switch"); $$ = progp; } | BREAK ';' { if (!inloop && !inswitch) error("'break' used outside loop/switch"); $$ = progp; dispatch_break(); } | CONTINUE ';' { if (!inloop) error("'continue' used outside loop"); $$ = progp; dispatch_continue(); } | switch expr cases stmt { dispatch_break(); fromto($3, progp); code(switchcode); codeswitch($1); patch_break($2, progp); $$ = $2; --inswitch; } | for expr1 expr2 end_expr2 expr3 end_expr3 stmt { Inst * p = code(jmp); code($5 - (p + 2)); fromto($4, $7); if ($3 != $4 - 2) fromto($4-2, progp); fromto($6, $3); patch_continue($2, $5); patch_break($2, progp); $$ = $2; --inloop; } | do stmt WHILE '(' expr ')' ';' { Inst * p = code(jpt); code($2 - (p + 2)); patch_continue($2, $5); patch_break($2, progp); $$ = $2; --inloop; } | while '(' expr ')' then stmt { Inst * p = code(jmp); code($3 - (p + 2)); fromto($5, progp); patch_continue($3, $3); patch_break($3, progp); $$ = $3; --inloop; } | IF '(' expr ')' then stmt { fromto($5, progp); $$ = $3; } | IF '(' expr ')' then stmt else stmt { fromto($5, $8); fromto($7, progp); $$ = $3; } | compound | ';' { $$ = progp; } ; while: WHILE { inloop++; dispatch(progp, &cont_q); dispatch(progp, &break_q); } ; do: DO { inloop++; dispatch(progp, &cont_q); dispatch(progp, &break_q); } ; for: FOR '(' { inloop++; dispatch(progp, &cont_q); dispatch(progp, &break_q); } ; expr1: ';' { $$ = progp; } | expr ';' { code(popd); } ; expr2: ';' { $$ = code2(jmp, 0); } | expr ';' { code2(jpnt, 0); } ; end_expr2: /* nothing */ { $$ = code2(jmp, 0); } ; expr3: ')' { $$ = code2(jmp, 0); } | expr ')' { code3(popd, jmp, 0); } ; end_expr3: /* nothing */ { $$ = code2(jmp, 0); } ; then: /* nothing */ { $$ = code2(jpnt, 0); } ; else: ELSE { $$ = code2(jmp, 0); } ; compound: '{' stmtlist '}' { $$ = $2; } ; stmtlist: /* nothing */ { /* A loop with empty contents still needs to prevent the heap from overflowing [Ash] */ /* $$ = progp; */ $$ = code(freeheap); } | stmtlist stmt { /*fprintf(stderr, "rd inprocmacro=%d\n", inprocmacro);*/ if (inprocmacro) code(eager); } ; switch: SWITCH '(' { $$ = entry_ptr; inswitch++; dispatch(progp, &break_q); } ; cases: ')' { $$ = code2(jmp, 0); } ; begin: /* nothing */ { $$ = progp; } ; id: identifier { if (informula && !inEVAL) addID($1); } | BLTIN | LIB | RLIB ; identifier: VAR | FORMULA | FUNCTION | PROCEDURE | PROCMACRO ; expr: CONSTANT { markGarbage(progp, $1); $$ = code2(constpush, (Inst)$1); } | asgn { if (informula) error("assignment used inside formula"); } | primary /* already coded in primary */ | '&' lvalue %prec NEGATE { $$ = $2; } | '[' begin arglist ']' { code2(makelist, (Inst)$3); $$ = $2; } | expr '+' expr { code(add); } | expr '-' expr { code(sub); } | expr '*' expr { code(mul); } | expr '/' expr { code(divide); } | expr '%' expr { code(mod); } | expr SLASH_SLASH expr { code(concat); } | expr '>' expr { code(gt); } | expr GT_EQ expr { code(ge); } | expr '<' expr { code(lt); } | expr LT_EQ expr { code(le); } | expr EQ_EQ expr { code(eq); } | expr NOT_EQ expr { code(ne); } | '?' { code(noupdate); } lvalue %prec NEGATE { $$ = $3; code(query); code(resetupdate); } | '-' expr %prec NEGATE { $$ = $2; code(negate); } | expr '#' { code(listsize); } | '!' expr { $$ = $2; code(lazy_not); } | NOT expr { $$ = $2; code(not); } | expr '?' then expr colon expr { fromto($3, $6); fromto($5, progp); } | expr AND expr { code(and); } | expr OR expr { code(or); } | expr lazy_and expr %prec LAZY_AND { fromto($2, progp); code(cnv_2_bool); } | expr lazy_or expr %prec LAZY_OR { fromto($2, progp); code(cnv_2_bool); } | expr BITAND expr { code(bitand); } | expr BITOR expr { code(bitor); } | evaluate '(' expr ')' { code(rts); unmarkGarbage($3, progp); $$ = code_eval($3, progp); inEVAL = 0; } ; evaluate: EVAL { inEVAL = 1; } colon: ':' { $$ = code2(jmp, 0); } ; lazy_and: LAZY_AND { code(ddup); $$ = code2(jpnt, 0); code(popd); } ; lazy_or: LAZY_OR { code(ddup); $$ = code2(jpnf, 0); code(popd); } ; defn: declare_formula | declare_action | declare_relation ; declare_relation: identifier tilde_gt '[' id_list_opt ']' ';' { $$ = code_related_by($1); } /* related_by_runtimelhs by [Ash] */ | '`' expr '`' { $$ = $2; code(lookup_address); } tilde_gt '[' id_list_opt ']' ';' { $$ = code_related_by_runtimelhs(); } ; tilde_gt: TILDE_GT { addID((symptr) 0); } ; declare_formula: identifier is expr ';' { informula = 0; code(rts); unmarkGarbage($3, progp); $$ = code_definition( FORMULA, $1, $3, progp, 0, $2); } | '`' expr '`' { code(lookup_address); } /* --sun */ is expr ';' { informula = 0; code(rts); unmarkGarbage($6, progp); $$ = code_definition_runtimelhs( FORMULA, $6, progp, 0, $5); } ; is: IS { $$ = textptr; informula = 1; addID((symptr) 0); } ; declare_action: action identifier { inprocmacro = ($1 == 2); /*fprintf(stderr, "inprocmacro=%d\n", inprocmacro);*/ addID((symptr) 0); } refer_opt def_begin declare_para declare_local stmtlist def_end { code2(pushUNDEF, rts); unmarkGarbage($8, progp); $$ = code_definition( ($1 ? (($1 == 1) ? FUNCTION : PROCMACRO) : PROCEDURE), $2, $8, progp, $7, $5 ); delete_local_level($9); inprocmacro = 0; } ; action: FUNC { $$ = 1; } | PROC { $$ = 0; } | PMAC { $$ = 2; } ; def_begin: '{' { static char c = '{'; if (indef) $$ = textptr - 1; else { $$ = textptr; push_text(&c,1); } insert_level_marker(++indef); } ; def_end: '}' { $$ = indef--; } ; /* optional refer_opt: ie nothing, or a refer [Ash] */ refer_opt: /* nothing */ { $$ = 0; } | ':' id_list { $$ = $2; } ; /* optional id_list: ie nothing, or an id_list [Ash] */ id_list_opt: /* nothing */ { $$ = 0; } | id_list ; id_list: identifier { $$ = 1; addID($1); } | id_list ',' identifier { $$ = $1 + 1; addID($3); } ; declare_para: /* nothing */ | PARA { inpara = 1; } local_list ';' { inpara = 0; } ; declare_local: /* nothing */ { $$ = 0; } | declare_local AUTO { inauto = 1; } local_list ';' { inauto = 0; $$ = $1 + $4; } ; local_list: LOCAL { $$ = 1; } | local_list ',' LOCAL { $$ = $1 + 1; } ; arglist: /* nothing */ { $$ = 0; } | argument_list ; argument_list: expr { $$ = 1; } | argument_list ',' expr { $$ = $1 + 1; } ; %% /*----------------------- end of grammar --------------------------*/ situations (eg the project timetable). It was added in yacc.y 1.8 (6th Sept 1999, release 1.0), tkeden1.41/EX/004070000025250000164000000000000747346161700131465ustar00ashleyem00003510000005tkeden1.41/EX/CVS/004070000025250000164000000000000744001047500135635ustar00ashleyem00003510000005tkeden1.41/EX/CVS/Entries010060000025250000164000000003220744001047500151130ustar00ashleyem00003510000005/Makefile.in/1.13/Fri Jul 27 16:22:10 2001// /ex.c/1.26/Wed Feb 27 16:31:55 2002// /parser.c/1.14/Thu Sep 27 14:07:23 2001// /script.h/1.6/Tue Nov 16 21:20:40 1999// /script.c/1.15/Fri Mar 1 23:39:40 2002// D tkeden1.41/EX/CVS/Repository010060000025250000164000000000120743723740600156700ustar00ashleyem00003510000005tkeden/EX tkeden1.41/EX/CVS/Root010060000025250000164000000000550743723740600144430ustar00ashleyem00003510000005cssbz@cvs.eden.sourceforge.net:/cvsroot/eden tkeden1.41/EX/ex.c010060000025250000164000000335110743720477300137260ustar00ashleyem00003510000005/* * $Id: ex.c,v 1.26 2002/02/27 16:31:55 cssbz Exp $ */ /* [Ben] Check for Win32 */ #ifndef __WIN32__ # if defined(_WIN32) || defined(WIN32) || defined(__CYGWIN__) # define __WIN32__ # endif #endif static char rcsid[] = "$Id: ex.c,v 1.26 2002/02/27 16:31:55 cssbz Exp $"; #include #include #include #include #include #include #include /* for PATH_MAX */ #include "../config.h" #include "../Eden/notation.h" #include "../Eden/eden.h" #include "../version.h" #ifdef DISTRIB #include /* for MAXHOSTNAMELEN on Solaris [Ash] */ #include /* for MAXHOSTNAMELEN on Linux [Ash] */ #endif #include "../Eden/emalloc.h" #ifdef HAVE_DMALLOC #include #endif extern int run(short, void *, char *); extern void queue(char *, char *); extern void warningf(char *, ...); extern void pushMasterStack(char *); extern void popMasterStack(void); extern void evaluate(char *, char *); extern void terminate(int); extern int eden_interrupt_handler(ClientData, Tcl_Interp *, int, char *[]); extern int dumpeden(ClientData, Tcl_Interp *, int, char *[]); extern int dumpscout(ClientData, Tcl_Interp *, int, char *[]); extern int dumpdonald(ClientData, Tcl_Interp *, int, char *[]); extern int viewOptions(ClientData, Tcl_Interp *, int, char *[]); #ifdef DISTRIB extern int dumpLSD(ClientData, Tcl_Interp *, int, char *[]); extern int getNotation(ClientData, Tcl_Interp *, int, char *[]); /* sun */ #endif /* DISTRIB */ #include /* Tcl caches environment variables: so we must use Tcl's versions of the getenv and putenv functions [Ash] */ /* Tcl 8.2.0 Makefile implies don't use the Tcl getenv [Ash] */ #define putenv Tcl_PutEnv #define setenv TclSetEnv #define unsetenv TclUnsetEnv #include Tcl_Interp *interp; Tk_Window mainWindow; static int edenCmd(ClientData, Tcl_Interp *, int, char *[]); static int todoCmd(ClientData, Tcl_Interp *, int, char *[]); static int evaluateCmd(ClientData, Tcl_Interp *, int, char *[]); static int quitCmd(ClientData, Tcl_Interp *, int, char *[]); static int refreshCmd(ClientData, Tcl_Interp *, int, char *[]); static int gotoCmd(ClientData, Tcl_Interp *, int, char *[]); int Tcl_AppInit(Tcl_Interp *); void EXinit(void); extern char *ex_sptr, ex_sbuf[]; char *sptr; extern char *progname; extern char *libLocation; #define STRING_DEV 0 /* This implements the Tcl "eden" command [Ash] */ static int edenCmd(ClientData clientData, Tcl_Interp * interp, int argc, char *argv[]) { notationType notation; if (argc != 2) { warningf("Tcl: eden: wrong # of arguments - expecting 1, got %d", argc - 1); } notation = currentNotation; changeNotation(EDEN); pushMasterStack("user"); run(STRING_DEV, argv[1], 0); popMasterStack(); changeNotation(notation); return TCL_OK; } static int todoCmd(ClientData clientData, Tcl_Interp * interp, int argc, char *argv[]) { if (argc != 2) { warningf("Tcl: eden: wrong # of arguments - expecting 1, got %d", argc - 1); } queue(argv[1], "interface"); return TCL_OK; } static int evaluateCmd(ClientData clientData, Tcl_Interp * interp, int argc, char *argv[]) { if (argc != 2) { warningf("Tcl: evaluate: wrong # of arguments - expecting 1, got %d", argc - 1); } evaluate(argv[1], "input"); return TCL_OK; } static int quitCmd(ClientData clientData, Tcl_Interp * interp, int argc, char *argv[]) { terminate(0); return TCL_ERROR; } static int refreshCmd(ClientData clientData, Tcl_Interp * interp, int argc, char *argv[]) { Tk_Window tkwin; XEvent e; if (argc != 2) { warningf("Tcl: refresh: wrong # of arguments - expecting 1, got %d", argc - 1); } tkwin = Tk_NameToWindow(interp, argv[1], mainWindow); e.xexpose.type = Expose; e.xexpose.send_event = True; e.xexpose.display = Tk_Display(tkwin); e.xexpose.window = Tk_WindowId(tkwin); e.xexpose.x = 0; e.xexpose.y = 0; e.xexpose.width = Tk_Width(tkwin); e.xexpose.height = Tk_Height(tkwin); e.xexpose.count = 1; XSendEvent(Tk_Display(tkwin), Tk_WindowId(tkwin), True, NoEventMask, &e); return TCL_OK; } static int gotoCmd(ClientData clientData, Tcl_Interp * interp, int argc, char *argv[]) { /* I guess removed from Windows by [Ben] due to different interaction style there... although I'm not even sure that this function is used at all. [Ash] */ #ifndef __WIN32__ Tk_Window tkwin; if (argc != 4) { interp->result = "wrong # args"; return TCL_ERROR; } if (strlen(argv[1]) == 0) { XWarpPointer(Tk_Display(mainWindow), 0, None, 0, 0, 0, 0, atoi(argv[2]), atoi(argv[3])); } else { tkwin = Tk_NameToWindow(interp, argv[1], mainWindow); XWarpPointer(Tk_Display(tkwin), 0, Tk_WindowId(tkwin), 0, 0, 0, 0, atoi(argv[2]), atoi(argv[3])); } interp->result = ""; return TCL_OK; #endif } /* Tcl_Eval with Error Check - uses Tcl_EvalEx for speed if we have it [Ash] */ #ifdef HAVE_TCL_EVALEX #define TCL_EVALEX(i, s, n, f) Tcl_EvalEx(i, s, n, f) #else #define TCL_EVALEX(i, s, n, f) Tcl_Eval(i, s) #endif inline void Tcl_EvalEC(Tcl_Interp * interp, char *script) { #ifdef DEBUG if (Debug & 128) fprintf(stderr, "Tcl_EvalEC(\"%s\")\n", script); #endif if (TCL_EVALEX(interp, script, -1, 0) != TCL_OK) { errorf("Tcl error (Tcl_EvalEC): %s", Tcl_GetStringResult(interp)); } } /* Tcl_GlobalEval with Error Check - uses Tcl_EvalEx for speed [Ash] */ inline void Tcl_GlobalEvalEC(Tcl_Interp * interp, char *script) { #ifdef DEBUG if (Debug & 128) fprintf(stderr, "Tcl_GlobalEvalEC(\"%s\")\n", script); #endif if (TCL_EVALEX(interp, script, -1, TCL_EVAL_GLOBAL) != TCL_OK) { errorf("Tcl error (Tcl_GlobalEvalEC): %s", Tcl_GetStringResult(interp)); } } #ifdef __CYGWIN__ int cygwin_conv_to_full_win32_path_tcl(ClientData clientData, Tcl_Interp *interp, int argc, char *argv[]) { extern cygwin_conv_to_full_win32_path(const char *path, char *win32_path); char winpath[PATH_MAX]; if (argc != 2) { warningf("cygwin_conv_to_full_win32_path: requires 1 argument, got %d", argc - 1); } if (!cygwin_conv_to_full_win32_path(argv[1], winpath)) { Tcl_SetResult(interp, winpath, TCL_STATIC); return TCL_OK; } else { return TCL_ERROR; } } #endif int Tcl_AppInit(Tcl_Interp * interp) { if (Tcl_Init(interp) == TCL_ERROR) return TCL_ERROR; if (Tk_Init(interp) == TCL_ERROR) return TCL_ERROR; #ifdef __APPLE__ TkMacOSXInitAppleEvents(interp); TkMacOSXInitMenus(interp); #endif Tcl_CreateCommand(interp, "quit", quitCmd, NULL, NULL); Tcl_CreateCommand(interp, "evaluate", evaluateCmd, NULL, NULL); Tcl_CreateCommand(interp, "eden", edenCmd, NULL, NULL); Tcl_CreateCommand(interp, "todo", todoCmd, NULL, NULL); Tcl_CreateCommand(interp, "refresh", refreshCmd, NULL, NULL); Tcl_CreateCommand(interp, "goto", gotoCmd, NULL, NULL); Tcl_CreateCommand(interp, "dumpeden", dumpeden, NULL, NULL); Tcl_CreateCommand(interp, "dumpscout", dumpscout, NULL, NULL); Tcl_CreateCommand(interp, "dumpdonald", dumpdonald, NULL, NULL); Tcl_CreateCommand(interp, "setupViewOptions", viewOptions, NULL, NULL); Tcl_CreateCommand(interp, "interrupt", eden_interrupt_handler, NULL, NULL); #ifdef DISTRIB Tcl_CreateCommand(interp, "dumpLSD", dumpLSD, NULL, NULL); Tcl_CreateCommand(interp, "getOldNotation", getNotation, NULL, NULL); Tcl_CreateCommand(interp, "getCurrentNotation", getNotation, NULL, NULL); #endif /* DISTRIB */ #ifdef __WIN32__ Tcl_CreateCommand(interp, "cygwin_conv_to_full_win32_path", cygwin_conv_to_full_win32_path_tcl, NULL, NULL); #endif #ifdef FAILED_CONSOLE_ATTEMPT /* This doesn't work: tcl output via puts etc goes to this console window (and Tcl commands typed there are executed!), but output from Eden to stdout etc does not */ #ifdef __APPLE__ /* * If we don't have a TTY, then use the Tk based console * interpreter instead. */ if (ttyname(0) == NULL) { Tk_InitConsoleChannels(interp); /* Tcl_RegisterChannel(interp, Tcl_GetStdChannel(TCL_STDIN)); Tcl_RegisterChannel(interp, Tcl_GetStdChannel(TCL_STDOUT)); Tcl_RegisterChannel(interp, Tcl_GetStdChannel(TCL_STDERR)); */ Tcl_RegisterChannel(interp, Tcl_MakeFileChannel(stdin, TCL_READABLE)); Tcl_RegisterChannel(interp, Tcl_MakeFileChannel(stdout, TCL_WRITABLE)); Tcl_RegisterChannel(interp, Tcl_MakeFileChannel(stderr, TCL_WRITABLE)); if (Tk_CreateConsoleWindow(interp) == TCL_ERROR) { return TCL_ERROR; } Tcl_Eval(interp, "console show"); } #endif #endif /* FAILED_CONSOLE_ATTEMPT */ return TCL_OK; } void EXinitTcl(void) { interp = Tcl_CreateInterp(); /* Set the "tcl_interactive" variable. */ Tcl_SetVar(interp, "tcl_interactive", "1", TCL_GLOBAL_ONLY); /* Invoke application-specific initialization. */ if (Tcl_AppInit(interp) != TCL_OK) { fprintf(stderr, "Tcl_AppInit failed: %s\n", interp->result); exit(1); } } void EXinit(void) { extern char *progname; #ifdef DISTRIB extern char hostName[MAXHOSTNAMELEN]; /* provided in Eden/main.c [Ash] */ extern int socketPort; /* for distributed tkEden --sun */ extern char *current_Notation; extern char *hostNamePtr; extern Int *synchronize; extern int isServer; #endif /* DISTRIB */ char *name = "/edenio.tcl"; extern char currentAgentName[128]; extern char currentAgentType[3]; extern char *currentAgentNamePtr; extern char *currentAgentTypePtr; char fullname[255]; /* This seems safe to do: if $DISPLAY is unset, Tcl_AppInit will have failed earlier [Ash] */ char *display = getenv("DISPLAY"); char *class = (char *) ckalloc((unsigned) (strlen(progname) + 1)); char *envcontents; /* These must be static so they don't go out of scope and disappear, leaving Tcl saying "where are they", causing Seg faults etc. D'oh! [Ash] */ static char *version; /* version of tkeden [Ash] */ static char *variant; /* whether tty, tk, d, ? [Ash] */ static char *webSite; /* address of the EM web site [Ash] */ static char *win32version; /* Win32 version number [Ben] */ static char *sasamiAvail; /* whether we have sasami [Ash] */ static char *apple; /* whether we are running on an Apple */ strcpy(class, progname); class[0] = toupper((unsigned char) class[0]); /* EXinitTcl() should have already been called by main.c [Ash] */ mainWindow = Tk_MainWindow(interp); ckfree(class); if (mainWindow == NULL) { fprintf(stderr, "%s\n", interp->result); exit(1); } /* Work out file name of Tcl interface code */ strcpy(fullname, libLocation); strcat(fullname, name); currentAgentNamePtr = currentAgentName; currentAgentTypePtr = currentAgentType; #ifdef DISTRIB if (isServer) { /* DISTRIB, server */ Tcl_LinkVar(interp, "svcPort", (char *) &socketPort, TCL_LINK_INT); Tcl_LinkVar(interp, "eshost", (char *) &hostNamePtr, TCL_LINK_STRING); Tcl_LinkVar(interp, "oldNotation", (char *) ¤t_Notation, TCL_LINK_STRING); Tcl_LinkVar(interp, "oldAgentType", (char *) ¤tAgentTypePtr, TCL_LINK_STRING); Tcl_LinkVar(interp, "oldAgentName", (char *) ¤tAgentNamePtr, TCL_LINK_STRING); } else { /* DISTRIB, client */ Tcl_LinkVar(interp, "esport", (char *) &socketPort, TCL_LINK_INT); Tcl_LinkVar(interp, "eshost", (char *) &hostNamePtr, TCL_LINK_STRING); Tcl_LinkVar(interp, "currentNotation", (char *) ¤t_Notation, TCL_LINK_STRING); } /* printf("sockPort = %i", socketPort); */ Tcl_LinkVar(interp, "synchronize", (char *) synchronize, TCL_LINK_INT); Tcl_LinkVar(interp, "_dtkeden_isServer", (char *) &isServer, TCL_LINK_BOOLEAN | TCL_LINK_READ_ONLY); #endif /* DISTRIB */ /* Create Tcl variables... */ version = Tcl_Alloc(TKEDEN_VERSION_MAX_LEN); *version = 0; strcat(version, TKEDEN_VERSION); Tcl_LinkVar(interp, "_tkeden_version", (char *) &version, TCL_LINK_STRING | TCL_LINK_READ_ONLY); variant = Tcl_Alloc(TKEDEN_VARIANT_MAX_LEN); *variant = 0; strcat(variant, TKEDEN_VARIANT); Tcl_LinkVar(interp, "_tkeden_variant", (char *) &variant, TCL_LINK_STRING | TCL_LINK_READ_ONLY); webSite = Tcl_Alloc(TKEDEN_WEB_SITE_MAX_LEN); *webSite = 0; strcat(webSite, TKEDEN_WEB_SITE); Tcl_LinkVar(interp, "_tkeden_web_site", (char *) &webSite, TCL_LINK_STRING | TCL_LINK_READ_ONLY); sasamiAvail = Tcl_Alloc(2); *sasamiAvail = 0; #ifdef WANT_SASAMI strcat(sasamiAvail, "1"); #else strcat(sasamiAvail, "0"); #endif Tcl_LinkVar(interp, "_tkeden_sasamiAvail", (char *) &sasamiAvail, TCL_LINK_STRING | TCL_LINK_READ_ONLY); /* [Ben] Create _tkeden_win32_version variable (used in TCL to check for Win32) _tkeden_win32_version is "0.0" if not running on Win32 This is set in version.h */ win32version = Tcl_Alloc(TKEDEN_WIN32_VERSION_MAX_LEN); *win32version = 0; strcat(win32version, TKEDEN_WIN32_VERSION); Tcl_LinkVar(interp, "_tkeden_win32_version", (char *) &win32version, TCL_LINK_STRING | TCL_LINK_READ_ONLY); /* Hack something so that Tcl can tell when we are running on an Apple, and do the Apple menu etc */ apple = Tcl_Alloc(5); *apple = 0; #ifdef __APPLE__ strcat(apple, "1"); #else strcat(apple, "0"); #endif Tcl_LinkVar(interp, "_tkeden_apple", (char *) &apple, TCL_LINK_STRING | TCL_LINK_READ_ONLY); if (Tcl_EvalFile(interp, fullname) != TCL_OK) { fprintf(stderr, "%s: Tcl error whilst evaluating %s\n", progname, fullname); fprintf(stderr, "Tcl errorInfo (from EXinit): %s\n", Tcl_GetVar(interp, "errorInfo", 0)); exit(1); } #ifdef DISTRIB /* setSocketPort(); */ #endif /* DISTRIB */ } e.xexpose.display = Tk_Display(tkwin); e.xexpose.window = Tk_WindowId(tkwin); e.xexpose.x = 0; e.xexpose.y = 0; e.xexpose.width = Tk_Width(tkwin); e.xexpose.hetkeden1.41/EX/Makefile.in010060000025250000164000000002050733031246200151700ustar00ashleyem00003510000005# # $Id: Makefile.in,v 1.13 2001/07/27 16:22:10 cssbz Exp $ # SOURCES = ex.c parser.c script.c LIB = libex.a include ../generic.mk tkeden1.41/EX/parser.c010060000025250000164000000235560735463123300146070ustar00ashleyem00003510000005/* * $Id: parser.c,v 1.14 2001/09/27 14:07:23 cssbz Exp $ */ static char rcsid[] = "$Id: parser.c,v 1.14 2001/09/27 14:07:23 cssbz Exp $"; #include "../config.h" #include #include #include #include extern Tcl_Interp *interp; extern void change_prompt(void); extern char agentName[128]; /* sun */ extern int setcurrentnot(char *); /* Chris Brown 2000 */ extern void getnotcomment (char **); #include "script.h" #include "../Eden/notation.h" #include "../Eden/eden.h" int lineno = 1; /* starting line number = 1 */ int prompt_on = 1; #define STRING_DEV 0 extern notationType currentNotation; char currentAgentName[128] = " "; char currentAgentType[3] = ">>"; /* EXPERIENCE: connecting to a TCL variable, you have to use a pointer rather than an array. --sun */ char *currentAgentNamePtr = 0; char *currentAgentTypePtr = 0; char *current_Notation = "%eden"; /* sun - different from currentNotation (mind the underbar!) */ char *otherNotation = 0; /* added by Chris Brown, 2000 */ Script *curScript; /* function prototypes */ void changeNotation(notationType); void setprompt(void); static void distribute(char *, Script *); void evaluate(char *, char *); #ifdef DISTRIB int getNotation(ClientData, Tcl_Interp *, int, char *[]); /* sun */ static void getClientName(char *, Script *); static int readIn; static char clientName[128]; #endif /* DISTRIB */ #ifdef DISTRIB /* To enable us to pack data in its own notation to enable it to be sent between machines (or clients... :) [Ash] */ int /* for distributed tkeden --sun */ getNotation(ClientData clientData, Tcl_Interp * interp, int argc, char *argv[]) { extern char agentType[3]; if (currentNotation == EDEN) current_Notation = "%eden"; if (currentNotation == DONALD) current_Notation = "%donald"; if (currentNotation == SCOUT) current_Notation = "%scout"; if (currentNotation == LSD) current_Notation = "%lsd"; /* added by Chris Brown, 2000 */ if (currentNotation == OTHER) { if (otherNotation != (char *) 0) { free (otherNotation); otherNotation = (char *) 0; } getnotcomment (&otherNotation); if (otherNotation != (char *) 0) current_Notation = otherNotation; } #ifdef WANT_SASAMI if (currentNotation == SASAMI) current_Notation = "%sasami"; #endif /* currentAgentName = agentName; currentAgentType = agentType; */ return TCL_OK; } #endif /* DISTRIB */ void setprompt(void) { char label[128]; char *stmtType; /* the contents of the label above the Input window [Ash] */ extern char *dd_prompt; extern char agentType[3]; #ifdef DISTRIB extern char *LSDagentName; #endif /* DISTRIB */ if (currentNotation == EDEN) { current_Notation = "%eden"; stmtType = "Enter EDEN statements:"; } /* added by Chris Brown, 2000 */ if (currentNotation == OTHER) { if (otherNotation != (char *) 0) { free(otherNotation); otherNotation = (char *) 0; } getnotcomment(&otherNotation); if (otherNotation != (char *) 0) { current_Notation = otherNotation; /* Put the name of the notation into the prompt [Ash] */ strcpy(label, "Enter "); strcat(label, otherNotation+1); /* don't copy the first character, which is a % */ strcat(label, " statements:"); stmtType = label; } else { /* This probably shouldn't ever be reached, but leave it here for safety... [Ash] */ stmtType = "Enter statements:"; } } #ifdef WANT_SASAMI if (currentNotation == SASAMI) { current_Notation = "%sasami"; strcpy(label,"Enter Sasami statements:"); stmtType = label; } #endif if (currentNotation == DONALD) { current_Notation = "%donald"; change_prompt(); /* update string for DoNaLD context */ strcpy(label, "Enter DoNaLD statements (in context "); strcat(label, dd_prompt); strcat(label, "):"); stmtType = label; } if (currentNotation == SCOUT) { current_Notation = "%scout"; stmtType = "Enter SCOUT statements:"; } #ifdef DISTRIB if (currentNotation == LSD) { current_Notation = "%lsd"; if (LSDagentName == (char *) 0) sprintf(label, "Enter LSD description:"); else sprintf(label, "Enter LSD description for AGENT %s: ", LSDagentName); stmtType = label; } #endif /* DISTRIB */ Tcl_VarEval(interp, ".prompt config -text {", stmtType, "}", 0); Tcl_VarEval(interp, "set notation {", current_Notation, "}", 0); /* Display the current VA above the Input window [Ash] */ if (*agentName) strcpy(currentAgentName, agentName); else strcpy(currentAgentName, ""); if (*agentType) strcpy(currentAgentType, agentType); else strcpy(currentAgentType, ">>"); } #ifdef DISTRIB /* This implements some wierd functionality for Meurig, sending definitions to clients using a >>$ type notation. It probably isn't needed any more, but a little tricky to delete it. [Ash, with Patrick] */ static void getClientName(char *str, Script *script) { extern symptr lookup(char *); symptr sp; char *s1= str; char *s2 =0; char *sptr; int i; char clientVarName[128]; if (strncmp(s1, ">$", 2) == 0 || strncmp(s1, "<$", 2) == 0) { s2=s1; s1++; s1++; for (sptr = s1, i = 0; *s1 != '\0' && *s1 != '\n'; s1++, i++); if (strncmp(s2, ">$", 2) == 0) { strncat(clientName, sptr, i); } else { *clientVarName=0; strncpy(clientVarName, sptr, i); if ((sp=lookup(clientVarName)) == 0 || i==0) { *clientName=0; } else { strcpy(clientName, sp->d.u.s); } } readIn=0; } if (strncmp(s1, "$$", 2) == 0) { *clientName=0; readIn=1; } if (strncmp(s1, ">>$", 3) == 0 || strncmp(s1, "><$", 3) == 0) { s2=s1; s1 = s1+3; for (sptr = s1, i = 0; *s1 != '\0' && *s1 != '\n'; s1++, i++); if (strncmp(s2, ">>$", 3) == 0) { strncpy(clientName, sptr, i); } else { *clientVarName=0; strncpy(clientVarName, sptr, i); if ((sp=lookup(clientVarName)) == 0 || i==0) { *clientName=0; } else { strcpy(clientName, sp->d.u.s); } } appendnEden(">>", script, 2); appendEden(clientName, script); appendnEden("\n", script, 1); readIn=1; } } #endif /* DISTRIB */ static void distribute(char *str, Script * script) { char *s = str; char *sptr; char *notname; int i; #ifdef DISTRIB char sentData[2048]; #endif /* DISTRIB */ /* Ensure the script is in the correct notation [Ash] */ switch (currentNotation) { case DONALD: appendEden("%donald\n", script); break; case SCOUT: appendEden("%scout\n", script); break; /* added by Chris Brown, 2000 */ case OTHER: getnotcomment(¬name); if (notname != (char *) 0) { appendEden(notname, script); appendEden("\n", script); free(notname); } break; /* end added by Chris Brown */ #ifdef WANT_SASAMI case SASAMI: appendEden("%sasami\n", script); break; #endif /* WANT_SASAMI */ #ifdef DISTRIB case LSD: appendEden("%lsd\n", script); #endif /* DISTRIB */ default: break; } while (*s) { /* If this line is a %notation line, update our idea of which notation we are currently using. A %notation line is appended for the current notation for every line above [Ash] */ if (strncmp(s, "%donald", 7) == 0) { /* is DoNaLD */ changeNotation(DONALD); } else if (strncmp(s, "%scout", 6) == 0) { /* is SCOUT */ changeNotation(SCOUT); } else if (setcurrentnot(s)) { changeNotation(OTHER); #ifdef DISTRIB } else if (strncmp(s, "%lsd", 4) == 0) { /* is LSD */ changeNotation(LSD); #endif /* DISTRIB */ } else if (strncmp(s, "%eden", 5) == 0) { /* is EDEN */ changeNotation(EDEN); #ifdef WANT_SASAMI } else if (strncmp(s, "%sasami", 7) == 0) { /* is Sasami */ changeNotation(SASAMI); #endif /* WANT_SASAMI */ } /* Count the number of chars in s (terminated by \0 or \n) [Ash] */ for (sptr = s, i = 0; *s != '\0' && *s != '\n'; s++, i++); #ifdef DISTRIB if (strncmp(sptr, ">>$", 3)==0 || strncmp(sptr, "><$", 3)==0 || strncmp(sptr, ">$", 2) == 0 || strncmp(sptr, "<$", 2) == 0 || strncmp(sptr, "$$", 2) == 0) { /* Meurig's funny extra notation - probably not used any more [Ash, with Patrick <--blame Patrick for this! :] */ getClientName(sptr, script); } else { if (readIn == 1) { appendnEden(sptr, script, i); appendnEden("\n", script, 1); } if (*clientName !=0) { *sentData=0; strncat(sentData, sptr, i); appendEden("sendClient(\"", script); appendEden(clientName, script); appendEden("\", \"", script); appendEden(sentData, script); appendEden("\");\n", script); } } #else /* Append one line of s to script [Ash] */ appendnEden(sptr, script, i); appendnEden("\n", script, 1); #endif /* DISTRIB */ if (*s != '\0') { /* *s must be '\n' */ s++; } lineno++; } } /* evaluate() = translate followed by queue(). Appears to only be called from evaluateCmd (implementation of the Tcl 'evaluate' command). [Ash] */ void evaluate(char *s, char *master) { Script *script; extern Script *dd_script, *st_script; #ifdef WANT_SASAMI extern Script *sa_script; #endif extern void queue(char *, char *); script = newScript(); dd_script = st_script = script; #ifdef WANT_SASAMI sa_script = script; #endif #ifdef DISTRIB *clientName=0; readIn=1; #endif /* DISTRIB */ distribute(s, script); queue(script->text, master); deleteScript(script); } of the notation into the prompt [Ash] */ strcpy(label, "Enter "); strcat(label, otherNotation+1); /* don't copy the first character, whitkeden1.41/EX/script.c010060000025250000164000000047360744001047400146100ustar00ashleyem00003510000005/* * $Id: script.c,v 1.15 2002/03/01 23:39:40 cssbz Exp $ */ static char rcsid[] = "$Id: script.c,v 1.15 2002/03/01 23:39:40 cssbz Exp $"; #include #include #include "../config.h" #include "script.h" #include "../Eden/emalloc.h" #ifdef HAVE_DMALLOC #include #endif /* function prototypes */ Script *newScript(void); void resetScript(Script *); void deleteScript(Script *); void appendEden(char *, Script *); void appendnEden(char *, Script *, int); #define TEXTLEN 1024 static Script **ScriptBuffer; static int nScriptBuffer = 0; static int scriptLevel = 0; /* A script appears to be the area in which Eden code is gradually built up from Eden code (with no translation) and Donald and Scout code (via translation). This code implements a stack of scripts. [Ash] */ Script * newScript(void) { Script *script; if (nScriptBuffer > scriptLevel) { /* there are spare script buffers */ script = ScriptBuffer[scriptLevel]; } else { /* need a new script buffer */ script = (Script *) emalloc(sizeof(Script)); script->text = (char *) emalloc(TEXTLEN); script->maxScript = TEXTLEN; if (nScriptBuffer == 0) { ScriptBuffer = (Script **) emalloc(sizeof(Script *)); } else { ScriptBuffer = (Script **) erealloc(ScriptBuffer, sizeof(Script *) * (nScriptBuffer + 1)); } ScriptBuffer[nScriptBuffer++] = script; } script->text[0] = '\0'; script->ready = 0; scriptLevel++; return script; } void resetScript(Script * script) { script->text[0] = '\0'; script->ready = 0; } void deleteScript(Script * script) { scriptLevel--; script->ready = 0; } /* Append s to the end of script, expanding script if necessary [Ash] */ void appendEden(char *s, Script * script) { if (script->maxScript > (int) strlen(script->text) + (int) strlen(s)) { strcat(script->text, s); } else { script->text = (char *) erealloc(script->text, script->maxScript * 2); script->maxScript *= 2; strcat(script->text, s); } } /* Append at most n characters of s to the end of script, expanding script if necessary [Ash] */ void appendnEden(char *s, Script * script, int n) { if (script->maxScript > (int) strlen(script->text) + n) { strncat(script->text, s, n); } else { while (script->maxScript < strlen(script->text) + n) { script->maxScript *= 2; } script->text = (char *) erealloc(script->text, script->maxScript); strncat(script->text, s, n); } } tkeden1.41/EX/script.h010060000025250000164000000007440701434525000146100ustar00ashleyem00003510000005/* * $Id: script.h,v 1.6 1999/11/16 21:20:40 ashley Rel1.10 $ */ typedef struct Script { int maxScript; /* maximum size of script */ char *text; /* actual translated script */ int ready; /* if a complete statement is translated */ } Script; extern Script *newScript(void); extern void resetScript(Script *); extern void deleteScript(Script *); extern void appendEden(char *, Script *); extern void appendnEden(char *, Script *, int); tkeden1.41/generic.mk.in010070000025250000164000000055270743720464100152050ustar00ashleyem00003510000005# (Note generic.mk is generated automatically from generic.mk.in by configure) # # $Id: generic.mk.in,v 1.2 2002/02/27 16:30:25 cssbz Exp $ # # This Makefile snippet is included from other Makefiles, one for almost each # subdirectory in the distribution. SHELL=/bin/sh AR = ar ARFLAGS = cq INSTALL = install CC = @CC@ CPP = @CPP@ CONF_CFLAGS = @CFLAGS@ CPPFLAGS = @CPPFLAGS@ DEFS = @DEFS@ X_CFLAGS = @X_CFLAGS@ RANLIB = @RANLIB@ AW_X_LIBS = @AW_X_LIBS@ CURSES_TYPE = @CURSES_TYPE@ CURSES_INCLUDE = @CURSES_INCLUDE@ CURSES_LIB_PATH = @CURSES_LIB_PATH@ TCL_INCLUDE = @TCL_INCLUDE@ TK_INCLUDE = @TK_INCLUDE@ DMALLOC_INCLUDE = @DMALLOC_INCLUDE@ READLINE_INCLUDE = @READLINE_INCLUDE@ OPENGL_INCLUDE = @OPENGL_INCLUDE@ PNG_INCLUDE = @PNG_INCLUDE@ # Explicitly set the SUFFIXES list in case it already has a silly setting .SUFFIXES: .SUFFIXES: .c .o # Implicit rule to make .o files from .c files .c.o: $(CC) -c $(CPPFLAGS) $(ALLCFLAGS) $< -o $@ # CFLAGS should go at the end here, so the user is free to define # CFLAGS and override any of our settings ALLCFLAGS = -g -D$(VARIANT) \ $(CURSES_INCLUDE) $(TCL_INCLUDE) $(TK_INCLUDE) \ $(DMALLOC_INCLUDE) $(READLINE_INCLUDE) $(OPENGL_INCLUDE) \ $(DEFS) $(X_CFLAGS) $(CONF_CFLAGS) $(CFLAGS) PARSER_SKEL = ../bison/bison.simple PARSER_OBJ = $(PARSER_OUT:.c=.o) LEXER_OUT = $(NOTATION_PREFIX)$(LEXER_SOURCE) SOURCES += $(PARSER_OUT) $(LEXER_OUT) OBJS = $(SOURCES:.c=.o) # This is used in depends.mk and in the clean targets below DEPENDS = $(SOURCES:.c=.d) default: $(LIB) $(LIB): $(OBJS) -rm -f $@ $(AR) $(ARFLAGS) $@ $(OBJS) $(RANLIB) $@ # We definately have to use bison, not yacc, as we use BISON_SIMPLE # Make bison use st as the output prefix to avoid clashing with the # other parsers. --name-prefix doesn't seem to work on ARMLinux, using # -p instead. If NOTATION_PREFIX is blank, don't do the -p option. $(PARSER_OUT): $(PARSER_SOURCE) $(PARSER_SKEL) if test -z "$(NOTATION_PREFIX)"; \ then BISON_SIMPLE=$(PARSER_SKEL) \ bison -v --defines -o $@ $(PARSER_SOURCE); \ else BISON_SIMPLE=$(PARSER_SKEL) \ bison -v -p $(NOTATION_PREFIX) \ --defines -o $@ $(PARSER_SOURCE); fi # Bison's -p fails to translate the yyrestart name, so do it here... $(PARSER_OBJ): $(PARSER_OUT) $(CC) -c $(CPPFLAGS) $(ALLCFLAGS) \ -Dyyrestart=$(NOTATION_PREFIX)restart $(PARSER_OUT) \ -o $@ # Make the generated sources generate: $(PARSER_OUT) $(LEXER_OUT) $(LEXER_OUT): $(LEXER_SOURCE) sed -e 's/yy/$(NOTATION_PREFIX)/g' \ -e 's/YY/Y$(NOTATION_PREFIX)/g' \ $(LEXER_SOURCE) > $(LEXER_OUT) clean: -rm $(LIB) $(OBJS) # Even remove the generated sources reallyclean: -rm $(LIB) $(OBJS) $(PARSER_OUT) $(PARSER_HEADERS_OUT) \ $(LEXER_OUT) $(DEPENDS) # Include a Makefile giving instructions about dependencies if enabled by # passing --enable-depend to ./configure @DEPEND_MAKEDEFS@ ES: .SUFFIXES: .c .o # Implicit rule to make .o files from .c files .c.o: $(CC) -c $(CPPFLAGS) $(ALLCFLAGS) $< -o $@ # CFLAGS should go at the end here, so the user itkeden1.41/install-sh010070000025250000164000000112450672531510700146250ustar00ashleyem00003510000005#! /bin/sh # # install - install a program, script, or datafile # This comes from X11R5. # # Calling this script install-sh is preferred over install.sh, to prevent # `make' implicit rules from creating a file called install from it # when there is no Makefile. # # This script is compatible with the BSD install script, but was written # from scratch. # # set DOITPROG to echo to test this script # Don't use :- since 4.3BSD and earlier shells don't like it. doit="${DOITPROG-}" # put in absolute paths if you don't have them in your path; or use env. vars. mvprog="${MVPROG-mv}" cpprog="${CPPROG-cp}" chmodprog="${CHMODPROG-chmod}" chownprog="${CHOWNPROG-chown}" chgrpprog="${CHGRPPROG-chgrp}" stripprog="${STRIPPROG-strip}" rmprog="${RMPROG-rm}" mkdirprog="${MKDIRPROG-mkdir}" transformbasename="" transform_arg="" instcmd="$mvprog" chmodcmd="$chmodprog 0755" chowncmd="" chgrpcmd="" stripcmd="" rmcmd="$rmprog -f" mvcmd="$mvprog" src="" dst="" dir_arg="" while [ x"$1" != x ]; do case $1 in -c) instcmd="$cpprog" shift continue;; -d) dir_arg=true shift continue;; -m) chmodcmd="$chmodprog $2" shift shift continue;; -o) chowncmd="$chownprog $2" shift shift continue;; -g) chgrpcmd="$chgrpprog $2" shift shift continue;; -s) stripcmd="$stripprog" shift continue;; -t=*) transformarg=`echo $1 | sed 's/-t=//'` shift continue;; -b=*) transformbasename=`echo $1 | sed 's/-b=//'` shift continue;; *) if [ x"$src" = x ] then src=$1 else # this colon is to work around a 386BSD /bin/sh bug : dst=$1 fi shift continue;; esac done if [ x"$src" = x ] then echo "install: no input file specified" exit 1 else true fi if [ x"$dir_arg" != x ]; then dst=$src src="" if [ -d $dst ]; then instcmd=: else instcmd=mkdir fi else # Waiting for this to be detected by the "$instcmd $src $dsttmp" command # might cause directories to be created, which would be especially bad # if $src (and thus $dsttmp) contains '*'. if [ -f $src -o -d $src ] then true else echo "install: $src does not exist" exit 1 fi if [ x"$dst" = x ] then echo "install: no destination specified" exit 1 else true fi # If destination is a directory, append the input filename; if your system # does not like double slashes in filenames, you may need to add some logic if [ -d $dst ] then dst="$dst"/`basename $src` else true fi fi ## this sed command emulates the dirname command dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'` # Make sure that the destination directory exists. # this part is taken from Noah Friedman's mkinstalldirs script # Skip lots of stat calls in the usual case. if [ ! -d "$dstdir" ]; then defaultIFS=' ' IFS="${IFS-${defaultIFS}}" oIFS="${IFS}" # Some sh's can't handle IFS=/ for some reason. IFS='%' set - `echo ${dstdir} | sed -e 's@/@%@g' -e 's@^%@/@'` IFS="${oIFS}" pathcomp='' while [ $# -ne 0 ] ; do pathcomp="${pathcomp}${1}" shift if [ ! -d "${pathcomp}" ] ; then $mkdirprog "${pathcomp}" else true fi pathcomp="${pathcomp}/" done fi if [ x"$dir_arg" != x ] then $doit $instcmd $dst && if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else true ; fi && if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else true ; fi && if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else true ; fi && if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else true ; fi else # If we're going to rename the final executable, determine the name now. if [ x"$transformarg" = x ] then dstfile=`basename $dst` else dstfile=`basename $dst $transformbasename | sed $transformarg`$transformbasename fi # don't allow the sed command to completely eliminate the filename if [ x"$dstfile" = x ] then dstfile=`basename $dst` else true fi # Make a temp file name in the proper directory. dsttmp=$dstdir/#inst.$$# # Move or copy the file name to the temp name $doit $instcmd $src $dsttmp && trap "rm -f ${dsttmp}" 0 && # and set any options; do chmod last to preserve setuid bits # If any of these fail, we abort the whole thing. If we want to # ignore errors from any of these, just make sure not to ignore # errors from the above "$doit $instcmd $src $dsttmp" command. if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else true;fi && if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else true;fi && if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else true;fi && if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else true;fi && # Now rename the file to the real destination. $doit $rmcmd -f $dstdir/$dstfile && $doit $mvcmd $dsttmp $dstdir/$dstfile fi && exit 0 tkeden1.41/lib-tkeden/004075500025250000164000000000000747346161700146625ustar00ashleyem00003510000005tkeden1.41/lib-tkeden/arca.lib010064400025250000164000000563440733204145200162520ustar00ashleyem00003510000005/*** * - EDEN library routines - * * - edenlib.e - * ****/ /* $Id: arca.lib,v 1.2 2001/08/01 17:58:02 cssbz Exp $ */ /* used the operator `varname` which turns a string into a variable */ setbuf(stdout, 0); NullStr =""; ON = 1; OFF = 0; CART ='C'; LINE ='L'; LABEL ='T'; ABST ='A'; EXPL ='E'; INT ='I'; VERT ='V'; COL ='C'; DIAG ='D'; DEBUG ='N'; ARROW_BEGIN = 0.51; ARROW_END = 0.6; ARROW_FACTOR = 0.05; _ARROW = ON; _LABEL = ON; _line_colour=["red","blue","green","brown","thistle","yellow","lightblue"]; proc debugmsg { if (DEBUG=='Y') writeln($1); } proc _writeln { auto count; for (count = 1; count <= $#; count++) writeln($[count]); } func if_assign { return $1 ? $2 : $3; } proc check_mode { if ($1 == 0) writeln("ERROR LHS IS ABSTRACT OR UNDEFINED"); } func one_int { return [INT,EXPL,0,$1]; } UNDEF = one_int(@); UNDEF_VERT = [VERT, EXPL, 2, [[UNDEF], [UNDEF]]]; UNDEF_COL = [COL, EXPL, @, [[UNDEF]]]; func op_and { return $1 && $2; } func op_or { return $1 || $2; } func check_int{ auto modval, val,value, int; int = ($# == 2) ? $1 : $1[4][$3]; val = int[4]; if (val==@) return [$2[1],$2[2],$2[3],value]; modval = $2[3]; value = (modval==0 || modval==1 ) ? val : val % modval; if (value == 0) value = modval; if (modval==@) return[INT,ABST,int[3],value]; if ($2!=@) if (int[3]!=$2[3] && int[3]) { writeln("ERROR INTS OF INCOMPATIBLE MODULUS"); exit(0); } else return ($2[2]==EXPL) ? [$2[1],$2[2],$2[3],value] : [$2[1],$2[2],int[3],value]; else return[INT,@,@,int[4]]; } func int_mult { /* if ($1==2 || $2==@) return [INT,@,@,@]; */ if ($1[3]!=$2[3] && $1[3] && $2[3]) writeln("ERROR INTEGERS OF INCOMPATIBLE DIM"); else return [$1[1],$1[2],$1[3],$1[4] * $2[4]]; } func int_div { /* if ($1==2 || $2==@) return [INT,@,@,@]; */ if ($1[3]!=$2[3] && $1[3] && $2[3]) writeln("ERROR INTEGERS OF INCOMPATIBLE DIM"); else return [$1[1],$1[2],$1[3],int($1[4] / $2[4])]; } func int_add { /* if ($1==2 || $2==@) return [INT,@,@,@]; */ if ($1[3]!=$2[3] && $1[3] && $2[3]) writeln("ERROR INTEGERS OF INCOMPATIBLE DIM"); else return [$1[1],$1[2],$1[3],$1[4] + $2[4]]; } func int_sub { /* if ($1==2 || $2==@) return UNDEF; */ if ($1[3]!=$2[3] && $1[3] || $2[3]) { writeln("ERROR INTEGERS OF INCOMPATIBLE DIM"); return UNDEF; } else return ($1[3]>$2[3]) ? [$1[1],$1[2],$1[3],$1[4] - $2[4]] : [$1[1],$1[2],$2[3],$1[4] - $2[4]]; } func int_mod { if ($2[3]==0) return [$1[1],$1[2],$1[3],$1[4] % $2[4]]; else { writeln("ERROR ILLEGAL DIM IN MOD INT"); return UNDEF; }; } func int_rup { auto result, sign; if ($1[4] == @ || $2[4] == @) return UNDEF; sign = ($2[4] < 0) ? -1 : 1; result = $1[4] % $2[4]; return one_int((result == 0) ? $1[4] : (result > 0) ? $1[4] - result + sign * $2[4] : $1[4] + result - sign * $2[4]); } func int_smash { auto new_mod, int1, int2, result; int1 = $1[4]; int2 = $2[4]; if (int1 == @ || int2 == @ || $1[3] == @ || $2[3] == @) return UNDEF; new_mod = $1[3] * $2[3]; result = int1+$1[3]; while (result%$1[3] != int1 || result%$2[3] != int2) result = result+$1[3]; return [INT,$1[2],new_mod,result]; } func int_inv { auto u,v,q,r,f,g,h,m,n; n = $1[3]; m = $1[4]; if (n == @ || m == @) return UNDEF; u=m; v=n; r=n; f=1; g=0; h=0; while (r) { q=u/v; h=f-g*q; r=u-v*q; f=g; u=v; g=h; v=r; }; if (u==1) return [INT,EXPL,$1[3],f]; writeln("NO INVERSE - INT INV"); return UNDEF; } func int_prime {return [INT, EXPL, 0,$1[4]];}/*normalises after mod calc*/ func int_size {return [INT,EXPL,0,$1[3]];} func i_eq { return ($1[4]==$2[4]); } func int_lt { if ($1[3] == $2[3]) { return ($1[4] == @ || $2[4] == @) ? 0 : ($1[4] < $2[4]); } else { writeln("ERROR INTS OF INCOMPATIBLE DIM"); return 0; }; } func int_grt { if ($1[3] == $2[3]) { return ($1[4] == @ || $2[4] == @) ? 0 : ($1[4] > $2[4]); } else { writeln("ERROR INTS OF INCOMPATIBLE DIM"); return 0; } } func int_ltoe { if ($1[3] == $2[3]) { return ($1[4] == @ || $2[4] == @) ? 0 : ($1[4] <= $2[4]); } else { writeln("ERROR INTS OF INCOMPATIBLE DIM"); return 0; } } func int_gtoe { if ($1[3] == $2[3]) { return ($1[4] == @ || $2[4] == @) ? 0 : ($1[4] >= $2[4]); } else { writeln("ERROR INTS OF INCOMPATIBLE DIM"); return 0; } } func int_ne { if ($1[3] == $2[3]) { return ($1[4] == @ || $2[4] == @) ? 0 : ($1[4] != $2[4]); } else { writeln("ERROR INTS OF INCOMPATIBLE DIM"); return 0; } } func i_actval {return @;} /*replaces symbolic expressions with values */ func find_min { auto min, count; min = @; for(count=1; count<=$1#; count++) if ($1[count]!=@ && $2[count]) min = (min==@ || $1[count]<$1[min]) ? count : min; return min; } func col_dist{ para start, end; auto count, ncols, at, dists, useable; useable = []; dists = []; ncols = $# ; for(count = 1; count<=$3[3]; count++) { useable = useable//[1]; dists = dists//[@]; } if (start == 0 || end == 0) return UNDEF; if (start > $3[3] || end > $3[3]) { writeln( "START OR END POINT OUT OF RANGE OF PERM"); return UNDEF; } dists[start] = 0; for (at = find_min(dists,useable); at!=end && at!=@; at = find_min(dists,useable)) { for (count=3; count<=ncols; count++){ if ($[count][4][at][4]!=@ && $[count][4][at][4] && (dists[$[count][4][at][4]]==@ || dists[$[count][4][at][4]]>dists[at]+1)) dists[$[count][4][at][4]]=dists[at]+1; }; useable[at]=0; } return(one_int(dists[end])); } func col_mult { auto count, permsize, result; permsize = $1[4]#; result = []; if (($1[4]# != $2[4]#)) { writeln("ERROR INCOMPATIBLE PERMS"); return UNDEF_COL; } for (count = 1; count <= permsize; count= count+1) result = ($2[4][count][4]!=@ && $2[4][count][4] && $1[4][$2[4][count][4]][4]) ? result // [$1[4][$2[4][count][4]]] : result // [UNDEF]; return [COL,EXPL,permsize,result]; } func vert_col { return [COL, $1[2], $1[3], $1[4]]; } func join_cols { auto count, size, result; if ($1[3] == 0 || $2[3] == 0) return UNDEF_COL; if ($1[3] > $2[3]) { size = $1[3]; result = $1[4]; for (count = 1; count <= $2[3]; count++) if (result[count][4] == @) result[count] = $2[4][count]; } else { size = $2[3]; result = $2[4]; for (count = 1; count <= $1[3]; count++) if ($1[4][count][4] != @ && $1[4][count][4]) result[count] = $1[4][count]; }; return [COL, EXPL, size, result]; } func col_size { auto length, count, largest; length = $1#; largest = length; for (count = 1; count <= length; count++) if ($1[count][4] != @ && $1[count][4] > largest) largest = $1[count][4]; return largest; } func list_undef { para length; auto count, result; result = []; for (count = 1; count < length; count ++) append result, UNDEF; return result; } func check_col { auto ERROR, count, undef; ERROR = 0; if ($2[3] != 0){ undef = list_undef($2[3]); if ($1[4]# != $2[3]) { writeln("ERROR COLS OF INCOMPATIBLE SIZE"); ERROR = 1; } else for (count = 1; count <= $1[4]#; count++) { if ($1[4][count][4] != @ && $1[4][count][4] > $2[3]){ writeln("INT OUT OF RANGE IN COL"); ERROR = 1; }; }; } else undef = list_undef($1[4]#); return (ERROR==1) ? [COL,$2[2],$2[3], undef] : [COL,$2[2],$1[3],$1[4]]; } func c_make { auto size, count, result ; result = []; size = col_size($1); for (count = 1; count <= size; count++) append result, UNDEF; for (count = 1; count <= $1# - 1; count++) { if ($1[count][4] != @ && $1[count][4]) result[$1[count][4]] = $1[count+1]; if ($1[count+1][4] == @ && $1[count][4] == 0) result[$1[count][4]]= UNDEF; }; if ($1[$1#][4] != @ && $1[$1#][4]) result[$1[$1#][4]] = $1[1]; return [COL,EXPL,size,result]; } func col_exp { auto count, result, size; size = $2[4]; result = $1; if ($2[4] != @){ if ($2[4] < 0) size = - $2[4]; for (count = 1; count <= size-1; count++) result = col_mult(result ,$1); }; if ($2[4]==0){ result = []; for (count= 1; count<= $1[4]#; count++) append result, one_int(count); result = [COL,EXPL,$1[3]]//[result]; }; return ($2[4] != @) ? (($2[4] > -1) ? result : col_inv(result)) : UNDEF_COL; } func cactval {return @;} func col_inv { /*inverse of a perm*/ auto result, count; result = []; if ($1[3] != $1[4]# || $1[3]==@ || $1[4]==@) return UNDEF_COL; for (count = 1; count<= $1[3]; count++) append result, UNDEF; for (count = 1; count<= $1[3]; count++) if (($1[4][count][4]==@)||($1[4][count][4]==0)); /* writeln("WARNING-PERM NOT COMPLETELY DEFINED - INV");*/ else result[$1[4][count][4]] = one_int(count); return [$1[1], $1[2], $1[3], result]; } func cat_cols { auto count, size, result; size = $1[3] + $2[3]; result = $1[4] // $2[4]; for (count = $1[3]+1; count <= size; count++) if (result[count][4] != @) result[count][4] += $1[3]; return [COL, EXPL, size, result]; } func colisize {return [INT,EXPL,0,$1[3]];} /*degree of the perm*/ proc c_bin_fns { /*works for binary functions*/ auto ERROR, count, undef; ERROR = 0; if ($1[3] != 0){ undef = list_undef($1[3]); if ($2[4]# != $1[3]){ writeln("ERROR COLS OF INCOMPATIBLE SIZE"); ERROR = 1; }; for (count = 1; ERROR == 0 && count <= $1[3]; count++){ if ($2[4][count][4] != @ && $2[4][count][4] > $1[3]){ writeln("INT OUT OF RANGE IN COL"); ERROR = 1; }; }; }; } proc v_make { return [VERT,EXPL,$1#,$1]; } func check_vert { auto vert; vert = ($#==2) ? $1 : $1[$3]; if (vert[3] != $2[3] && $2[3]!=0){ writeln("ERROR VERTS OF INCOMPATIBLE DIM"); return UNDEF_VERT; } else return [vert[1], $2[2], vert[3], vert[4]]; } proc v_bin_fns { /*works for binary functions*/ if ($1[3]!=$2[3] && $1[2]!=ABST) writeln("ERROR VERTS OF INCOMPATIBLE DIM"); } func vert_add { auto result, count; if ($1[4]==@ || $2[4]==@) return UNDEF_VERT; if($1[3]!=$2[3]) writeln("ERROR VERTS INCOMPATIBLE DIM (RHS)"); result =[]; for (count = 1; count <= $1[3]; count++) append result, int_add($1[4][count],$2[4][count]); return [$1[1],$1[2],$1[3],result]; } func vert_sub { auto result, count; if ($1[4]==@ || $2[4]==@) return UNDEF_VERT; if($1[3]!=$2[3]) writeln("ERROR VERTS INCOMPATIBLE DIM (RHS)"); result =[]; for (count = 1; count <= $1[3]; count++) append result, int_sub($1[4][count],$2[4][count]); return [$1[1],$1[2],$1[3],result]; } proc vert_mult { auto result, count; if ($1[4]==@ || $2[4]==@) return UNDEF_VERT; result =[]; for (count = 1; count <= $2[3]; count++) append result, int_mult($1,$2[4][count]); return [$2[1],$2[2],$2[3],result]; } func vert_rot { para vert, other; auto xc, yc, xr, yr, angle, plane1, plane2; angle = other[4][1][4] * PI / 180; plane1 = other[4][2][4]; plane2 = other[4][3][4]; xc = vert[4][plane1][4]; yc = vert[4][plane2][4]; if ((angle * plane1 * plane2 * xc * yc) == @) return UNDEF_VERT; xr = int(xc * cos(angle) - yc * sin(angle)); yr = int(xc * sin(angle) + yc * cos(angle)); vert[4][plane1] = one_int(xr); vert[4][plane2] = one_int(yr); return vert; } func v_ref {return @;} /*reflection*/ func vert_smash { /*cat vertices dim N ,M -> N+M*/ return [$1[1],$2[2],$1[3]+$2[3], $1[4]//$2[4]]; } func v_actval {return @;} func vert_size {return [INT,EXPL,0,$1[3]];} func vneq { auto count, result; result = 0; if ($1[3] != $2[3]) writeln("ERROR VERTS Of INCOMPATIBLE DIM (IF)"); else for (count = 1; count <= $1[3]; count++) if ($1[4][count] == $2[4][count]) result++; return result!=$1[3]; } func veq { auto count, result; if ($1[3] != $2[3]) writeln("ERROR VERTS Of INCOMPATIBLE DIM (IF)"); else for (count = 1; count <= $1[3]; count++) if ($1[4][count] == $2[4][count]) result++; return result==$1[3]; } proc d_bin_fns{ if ($1[3]!=$2[3] && $1[3]!=0) writeln("ERROR DIAGS OF INCOMPATIBLE SIZE"); } func check_diag { if ($2[3]==0 || $1[3]==$2[3]) return $1[4][2]; } func diag_join { return [DIAG, EXPL, $2[3]+$1[3], [EXPL, $1[4][2]//$2[4][2]]]; } func sub_diag { auto subsize, result, count; subsize = $# - 1; result = []; for (count = 1; count <= subsize; count++) { if ($[count+1][4] != @) append result, $1[4][2][$[count+1][4]]; else append result, UNDEF_VERT; } return [DIAG, EXPL, $#-1, [EXPL, result]]; } func diag_mult { auto result, count; result = []; for (count = 1;count <= $2[3]; count++) append result, vert_mult($1,$2[4][2][count]); return [DIAG, EXPL, $2[3], [EXPL, result]]; } func diag_rot { auto result, count; result = []; for (count = 1;count <= $1[3]; count++) append result, vert_rot($1[4][2][count], $2); return [DIAG, EXPL, $1[3], [EXPL, result]]; } func v_trans { auto count, verts, result; result = []; verts = $2[4][2]#; for (count=1; count <= verts; count++) append result, vert_add( $1, $2[4][2][count]); return [$2[1],$2[2],$2[3], [$2[4][1], result], $2[5]]; } func diag_smash { auto count, result; result = []; for (count = 1; count <= $1[3]; count++) result = result//v_trans($1[4][2][count],$2)[4][2]; return [$2[1],$2[2],$2[3]*$1[3], [$1[4][1], result]]; } func diag_size {return [INT,EXPL,0,$1[2][2]];} /*number of verts*/ func nd_2d { para vert; auto count, count2, dim; dim = vert#; for (count = dim; count>=3; count--) for (count2 = dim-1; count2 >= 1; count2--) if (vert[count2][4] > 0) { vert[count2][4] = vert[count2][4] - 0.1*vert[count][4]; if (vert[count2][4] < 0) vert[count2][4] = 0; } else if (vert[count2][4] < 0 ) { vert[count2][4] = vert[count2][4] + 0.1*vert[count][4]; if (vert[count2][4] > 0)vert[count2][4] = 0; }; return [vert[1],vert[2]]; } func inColList { para list, item; auto i; if (list == []) return 0; for (i = 1; i <= list#; i++) if (list[i] == item) return i; return 0; } /*** Functions for manipulating assocative memory ***/ func searchKey { para map, key; auto start, mid, end; start = 1; end = (*map)#; mid = (start + end) / 2; while ( start <= mid && mid <= end ) { if ((*map)[mid][1] > key) end = mid - 1; else if ((*map)[mid][1] < key) start = mid + 1; else /* match */ return [ mid, (*map)[mid][2] ]; mid = (start + end) / 2; } return [mid < start ? start : mid, @]; } func putKey { para map, key, data; auto ans; ans = searchKey(map, key); if (ans[2] == @) { insert *map, ans[1], [key, data]; return ans[1]; } else /* already there */ return 0; /* fail */ } func deleteKey { para map, key; auto ans; ans = searchKey(map, key); if (ans[2] == @) { return 0; /* fail */ } else { /* found */ delete *map, ans[1]; return ans[1]; } } func replaceKey { para map, key, data; auto ans; ans = searchKey(map, key); if (ans[1] > (*map)# || (*map)[ans[1]][1] != key) /* not there */ insert *map, ans[1], [key, data]; else /* found */ (*map)[ans[1]][2] = data; return ans[1]; } proc dispNoLabels { auto diag, dname, oldDiagCols, cols, window, j, vertex; auto collist, pos; diag = *($[$#-1]); dname = nameof($[$#-1]); oldDiagCols = "old_"//dname//"_cols"; if (`oldDiagCols` == @) `oldDiagCols` = []; collist = []; cols = $#-2; window = $[$#]; for (j = cols; j >= 2; j -= 2) { append collist, $[j-1]; if (pos = inColList(`oldDiagCols`, $[j-1])) { delete `oldDiagCols`, pos; } delete_shape(&`$[j-1]//"__"`); draw_col($[j-1],$[j][4],diag[4][2],window); } while (`oldDiagCols` != []) { delete_shape(&``oldDiagCols`[1]//"__"`); shift `oldDiagCols`; } vertex = "L_"//dname; delete_shape(&`vertex`); `oldDiagCols` = collist; } proc dispWithLabels { auto diag, dname, oldDiagCols, cols, window, i, j, vertex; auto collist, pos; auto var, viewport_name; diag = *($[$#-1]); dname = nameof($[$#-1]); oldDiagCols = "old_"//dname//"_cols"; if (`oldDiagCols` == @) `oldDiagCols` = []; collist = []; cols = $#-2; window = $[$#]; for (j = cols; j >= 2; j -= 2) { append collist, $[j-1]; if (pos = inColList(`oldDiagCols`, $[j-1])) { delete `oldDiagCols`, pos; } delete_shape(&`$[j-1]//"__"`); draw_col($[j-1],$[j][4],diag[4][2],window); } while (`oldDiagCols` != []) { delete_shape(&``oldDiagCols`[1]//"__"`); shift `oldDiagCols`; } vertex = "L_"//dname; delete_shape(&`vertex`); `oldDiagCols` = collist; for(i = 1; i<=diag[4][2]#; i++){ x1 = nd_2d(diag[4][2][i][4])[1][4]; y1 = nd_2d(diag[4][2][i][4])[2][4]; _p1 = cart(x1,y1); _L_attr = "color=gray1"; `vertex` = label(str(i),_p1); PLOT_label(`window`, &`vertex`, &_L_attr); } } proc draw_col { para c_nm,cols,verts,window; auto k1,x1,y1,x2,y2,li,vert; auto colour, style, _L_attr; auto var, viewport_name; colour = c_nm[c_nm#]-'a'+1; colour = colour ? colour : _line_colour#; style = (displayDepth > 1) ? "solid,color="//_line_colour[colour] : (colour == 1) ? "solid,color=gray1" : "dashed,dash="//str(colour*20+2); _L_attr = "linestyle="//style ; for (k1=1;k1<=cols#;k1++){ vert = nd_2d(verts[k1][4]); x1=vert[1][4]; y1=vert[2][4]; _p1 = cart(x1,y1); if ((cols[k1][4] != @ && cols[k1][4])&& (k1!=cols[cols[k1][4]][4] || k1 0, otherwise returns -number e.g abs(-7)=7, abs(2)=2. nthroot(number,n) : returns the n'th root of the number given e.g nthroot(4,2)=2, nthroot(81,4)=3. **There may be some problems with precision of the answer with large n due to the C library function used. ** factorial(number) : returns the factorial of the number given e.g factorial(4)=24, factorial(-2)=@. product(number, ... ) : returns the numbers passed multiplied together e.g product(2,3)=6, product(a)=360. sign(number) : returns -1 if number is < 0, 0 if number = 0, 1 if number > 0 e.g sign(4)=1, sign(-230.2323)=-1. even(number) : returns the nearest even number to the number given e.g even(4.5)=4, even(5.5)=6. odd(number) : returns the nearest odd number to the number given e.g odd(4.5)=5, odd(3.5)=3. mround(number,multiple) : returns the number rounded to the nearest multiple of the given multiple e.g mround(62,6)=60. sumsq(number, .. ) or sumsq([list of numbers]) : returns the sum of the squares of the numbers passed e.g sumsq(2,3,4)=29, sumsq(a)=86. trunc(number) : returns the integer part of the number given e.g trunc(4.56)=4. combin(total,n) : returns the number of ways n numbers can be picked from total number of items e.g combin(4,2)=6. ceiling(number,multiple) : returns the number rounded to the nearest multiple of the given multiple that is greater than the number e.g ceiling(62,6)=66. floor(number,multiple) : returns the number rounded to the nearest multiple of the given multiple that is lower than the number e.g floor(64,6)=60. degrees(angle) : returns an angle given in radians with its equivalent in degrees in a range 0-360 e.g degrees(PI)=180. radians(angle) : returns an angle given in degrees with its equivalent in radians in a range 0-2*PI e.g radians(180)=3.14... rounddigits(number,digits) : returns the number rounded to the specified number of digits e.g round(123,2)=120, round(123,1)=100, round(123.232,4)=123.2. gcd(number, ...) or gcd([list of numbers]) : returns the largest number which will divide exactly into all the numbers passed e.g gcd(2,6)=2, gcd(6,9,24)=3, gcd(3,7,24,28)=1, gcd(a)=1. lcm(number, ...) or lcm([list of numbers]) : returns the smallest number that all the numbers passed will divide exactly into it e.g lcm(8,12)=24, lcm(4,6,8)=24, lcm(a)=60. variance(number, ...) or variance([list of numbers]) : returns the variance of the numbers passed or the list of numbers passed to it e.g variance(23,34,46,43)=80.5, variance(a) = 1.5. stdev(number, ...) or stdev([list of numbers]) : returns the standard deviation of the numbers passed or the list of numbers passed to it e.g stdev(23,45,67)=17.96..., stdev(a)=1.22... sort([list of numbers], direction) : returns the list of numbers sorted. the direction parameter should be 1 to return an ascending list, 2 to return a descending list e.g sort(a,2)=[6,5,4,3]. median([list of numbers]) : returns the median element of a list of elements, those elements do not need to be in any sorted order e.g median(a)=4.5. These functions have been tested, but there may still be some bugs in some of the routines. Please email croe@dcs if you find any problems with the routines. Most of the functions do not perform any error checking, they assume you are providing a valid list of parameters. Added two more functions from Chris Roe, inspired by functions from complexGardner1999: randomise() : seeds the random number generator with a random number rnd(number) : returns a random number between 0 and the number. Note that both 0 and number are included in the range. e.g rnd(1234)=567, rnd(9)=4. Lack of specification about rand() range documented in eden.txt. Added rgb2color and rgb2colour functions to eden.eden. Examples of use: %donald line l l=[{10,10}, {200,200}] %scout string g; window ash = { type: TEXT string: "Ash" frame: ([{10, 10}, {100, 100}]) bgcolor : g }; screen=; %eden g is rgb2colour(ri,gi,bi); A_l is strcat("linewidth=5,color=", g); ri=0;gi=10;bi=255; Added Help->Colour names, which contains the information from the file /usr/openwin/lib/X11/rgb.txt and some help about how to use colours in Donald and Scout. Added small amount of detail about EOF to Eden fgets file function in eden.txt. ** 1.40 Wed Apr 17 11:47:12 BST 2002 ** A few silly mistakes in the reimplementation of mouseClick observables (in 1.39) fixed. The multiple backups of the ~/.tkeden-history file added in 1.12 caused problems with multiple concurrent instances of tkeden running in the same user account with an NFS mounted home directory: machine 1 shifts history files, starts to use tkeden-history, machine 2 shifts history files, machine 1 gives stale NFS handle error. Changed from renaming files to shift them to copying instead. This means all the tkeden-history files will have the same file date, making it more difficult to find the relevant data when grubbing around in the history files, but it is possible to run multiple tkedens from the same account without problem. ** 1.39 Mon Apr 15 20:19:51 BST 2002 ** Reorganised descriptions of file handling functions in eden.txt slightly. The fix added in 1.37 which gives an error message on an attempt to eval() a local variable is now extended to attempts to reference the local variable $. The new builtin Donald reflect function was not working when given an openshape and a line: the parser was expecting it to return an openshape due to a missing break in Donald/check.c, whereas it actually (and should) return a shape. Fixed. Also added an extra test and error message to open2shape, and fixed donald.txt, which implied that rot, scale, reflect etc only take shapes, whereas in fact they take any Donald type. Optionally reinstated the "VB-like" feature of mouseClick observables removed in scout.init.e 1.11 (Eden version 1.17). To turn this old feature back on again, do "tkeden_vbfeatures=1;" in Eden. This is for use in getting old models to work only: new models should not use mouseClick and other "VB-like" features as they have been found in general to create more problems than they solve currently. ** 1.38 Fri Mar 1 23:31:32 GMT 2002 ** Fixed an inconsistency: query (?) previously ommitted the semi-colon after a procedural variable. Now the output from ?a; will show a semi-colon after both procedural and formulae variables. Added Eden stat() function, which provides access to meta-data about files (modification times etc). Updated fgets() documentation in eden.txt. Changed filenames in lib-tkeden to use the new extension names: .eden etc. Renamed macro.e to eden.eden, which is now loaded at startup (if it can be found). Removed eddipf.e file -- the text of this is now included at the start of eddi.eden. Added Eden symboldefinition function, which is intended to fix problems with the data returned by symboldetail() and relatives, as it returns the definition of an Eden symbol in a form that can be fed back to Eden using execute(), todo() etc. Bug fixed in agent-based parser: characters can now be escaped in strings: TEST << ["oh \"quote\""]; is now valid. Changed occurrances of "definitive parser" in this text to the more correct "observation-oriented parser", as the parser makes little use of definitions. Added copyproc() and showpara() procs to eden.eden. Introduced an optimisation that will allow the use of a particular list append idiom on long lists. The list concatenation operator is limited in the resultant size of list that it can produce, meaning that 'l=l//[q]' would fail with a stack overflow error if l was larger than 1023 items. This particular operation is now optimised (by additions to the parser and virtual machine) to the effect that 'l=l//[q]' is effectively translated internally to 'append l, q'. Note that the value of the expression 'l=l//[q]' is now @, not the value of the new list as previously, due to space limitations. A variation on the problem, 'l=[q]//l', is not optimised as it is a less common idiom. The optimisation also copes with strings, although the concatenation is not done in-place in this case. This change should allow EDDI to cope with much larger results (eg large joins). Added some more possibilities to debug(). debug(256): prints calls to execute, debug(512): prints calls to func / proc / procmacros with their arguments and return results (including indentation to show level of nesting), debug(1024): prints VMWRIT output (when opcodes are created in the VM for later execution). This last is also a part of the debug(1) output, which is generally far too detailed to be useful. Modularised tkeden notation radio button code. Added a Tcl proc named "removeNotationRadioButton" to allow scripts to remove the radio button for a notation in order to hide the notation's existence (note the notation itself is not actually removed). An example of use: %eden tcl("removeNotationRadioButton donald"); Added printstdout C function for use from gdb. Fixed commas within strings in EDDI: T << ["h,w"]; is now possible (previously the comma would have caused this to be recognised as two attributes). Fixed bug in EX/script.c: a textual script store was not being resized correctly when given a large amount of script. A fix was introduced in the last version to cope with the fact that TEXTBOXes are a different kind of Tk widget to the other types (TEXT, DONALD, ARCA, IMAGE). The previous fix was not correct: the code which was enabled was actually handling frames (lists of boxes). The obtuse and lengthy DisplayScreen procedure is now more understood and some comments have been added, as well as a more reasonable fix for this problem. Previously, Eden floating point values that were very close to their integer equivalent would be printed out as integers by query (?), writeln etc. 169.9999 would be shown as 170, for example. Now, floating point values are printed out at the precision available on the machine. Added Chris Brown to credits.txt. dtkeden bug fixed, which was introduced in release 1.21 (builtin.c 1.39) with the introduction of the 'procmacro' facility. When defining a procedure or function on the server, the redefinition sent to the client was corrupted: func definitions had 'proc procmacro' appended, procs had 'procmacro', due to some missing break statements in a switch. PI was previously undefined in ttyeden (as it was part of Donald), and defined to only 7 significant figures. Made PI a standard Eden definition, set from the more precise value available on the system from . Added information to Eden and Donald quick reference guides (eg note that in Donald, it is referred to as lower case pi). Added Chris Roe's round() function to eden.eden. Added documentation for macro, copyproc, showpara, round and eval to the Eden quick reference. Added documentation about ~/x, /x etc to Donald quick reference. Added debug(2048) to debug the Donald parser. Added debug(4096), which causes tkeden to print errors on stderr as well as in the error window. Donald parser was having problems on UNIX when reading files with DOS line feeds. In particular, within x NEWLINE { } was failing, because DOS line feeds are CR (\r), LF (\n), which was being treated as two NEWLINEs. The Donald lexer now ignores a \n which follows a \r. Optionally reinstated some code to do with back-ticks which appears to make the project timetable model work. Enable this hack by setting the Eden variable eden_backticks_dependency_hack to 1. Exactly what the hack does is not yet well understood, so it is optional for the moment. ** 1.37 Tue Feb 19 17:29:00 GMT 2002 ** Sync'd code with CVS. Attempts to eval() a local variable now give an error message instead of a crash. Eg 'func t { auto i; i=2; writeln(eval(i)); }'. eval is defined to give the value of a variable at point of definition. This is at the entry of the function in this case, when the function is not being evaluated, and so any local variables as yet have no value (although we do know that they are local variables). Hence an error is appropriate. Mac OS X tkeden port is progressing. Now automatically locates lib-tkeden, which is situated within the Resources directory of the application bundle. Bug fixed in call_float (which is where real-valued C library functions are called) on Mac OS X. sin(3.14159/2.0) would return 0.909297, not 1. In 1.19, a change was made: all values passed to a C library functions declared as SameReal (which are functions that return a real value, eg sin, cos) are passed double values -- integer parameters are cast to double type before passing. Now a more subtle internal change has been added to this: the C library is now given an array of doubles, not ints. Added debug(128) option for debugging calls to Tcl_EvalEC and Tcl_GlobalEvalEC. Added information about arguments to debug to eden.txt. Added an additional example to scout.txt. Fixed a bug where redefining the Scout screen to one that included TEXTBOXes might fail. When the screen variable is changed, the corresponding Tk widgets are modified in place if possible, not destroyed and recreated from scratch. Scout windows of type TEXT, DONALD, IMAGE and ARCA all seem to use the Tk canvas widget. TEXTBOX however uses the Tk text widget, and so when a window changes type to and from TEXTBOX, the corresponding Tk widget must be destroyed and recreated, else various Tk error messages occur when the widget attributes are changed. DisplayScreen is now nearly unmaintainable, being 400 lines of obtuse C code. It seems to contain some code which appears to try to manage the above situation. It seems to have been failing due to two erronous "+1"s, which are now commented out. Further use may reveal the original intention of these "+1"s and require a different solution. ** 1.36 Thursday November 29 19:26:19 GMT 2001 ** Using the system's close window button on the View Eden Definitions window previously caused a Tcl/Tk error, as I'd changed the menu code for this window, but not the close window code which relies on it. Updated EDDI files from Meurig's current version a little: new version of deps.e and new file newaddvals.e. Also cleaned up my modifications a little. ** 1.35 Tue Nov 20 13:22:19 GMT 2001 ** Merged in Chris Roe's Donald reflect primitive as a new Donald built-in. Added one line giving the syntax to the Donald Quick Reference on the Help menu. Fixed ttyeden on Darwin (Mac OS X). Now compiles and works OK (were problems with header files etc). No dirname and basename functions. Fixed implementation of Eden str() function when dealing with lists. Previously it had the same fault that was corrected in printing (writeln etc) in 1.29: strings and chars in lists were converted by str and were not given surrounding quotes. Now this example functions correctly: 1|> l=["hi",'h',5,[6]]; 2|> writeln(l); ["hi",'h',5,[6]] 3|> writeln(str(l)); ["hi",'h',5,[6]] ** 1.34 Thursday November 15 20:03:13 GMT 2001 ** EDDI in dtkeden server previously printed "Unrecognised EDDI statement" on stdout if the server's notation was set to EDDI and a client started or finished or if broadcast mode was selected. This problem was narrowed down to the EDDI parser not understanding virtual agent commands: a line containing '>>' is executed in the these scenarios. The EDDI parser is now fixed so that it ignores statements that begin with the virtual agent >>, <>, ><, << and >~ prefixes. ** 1.33 Thursday November 15 16:52:38 GMT 2001 ** Improved MAKING.A.RELEASE checklist. The scale function in donald.init.e previously ignored arcs. Chris Roe fixed this for his COG model. This improvement is now merged into tkeden, so Donald should now scale arcs. However, Chris' fix may be a slight fudge as it apparently doesn't scale the arc's "bend". ** 1.32 Fri Nov 2 12:24:37 GMT 2001 ** Typo fix in builtin.h and builtinf.h ** 1.31 Fri Nov 2 11:58:24 GMT 2001 ** Change to Meurig's newpivctn.e EDDI file. The prompt in ttyeden was previously incorrect after including a script file with a change of notation (or providing a -e option with a change of notation). The machine would actually revert to accepting Eden (incorrect) but the prompt would still show the other notation (actually correct). Given the time limitations today, I have made the easier fix, which is to fix the prompt to correctly show the state of the machine. As the semantics of an include() (or mention of a script file on the command line) is direct inclusion of that file in the input stream (rather than a "procedure call"), the machine should actually stay in the new notation (ie notation changes should persist across EOF). This will however require some restructuring of the lexer. This problem does not occur when typing input directly, as stdin never gives EOF. tkeden does not have this problem as notation changes are handled by functions in EX (which is not in ttyeden). ** 1.30 Thu Nov 1 19:31:37 GMT 2001 ** When using eager() in a tight Eden loop to modify a Sasami display, this previously caused a Segmentation fault. The crash no longer occurs, but the Sasami display is corrupted. Improved debug(2) output (RunSet debugging). Test with (eg): writeln(1); todo("writeln(2);"); todo("todo(\"writeln(3);\");"); Eden include() now stores number of parameters (file names) in a C stack variable, rather than relying on being able to read it from the Eden stack after each include. This should stop a few crashes due to nonsense values being read from the Eden stack. tkeden now correctly appends information to the history about the files stated for execution on the command line on UNIX. (On Windows, "cd(dirname(filename))" is done for each file before execution of "include(basename(filename)", which appears in the history). Both platforms now have a comment appended in the history which states the files were invoked from the command line. It was previously possible for the tkeden prompt (eg "Enter Eden Statements") and radio buttons to get out of synch with the actual current notation. Specifically, the Eden include() function, invocation of files mentioned on the command line and observation-oriented parser generator may have had this problem. This problem was not observed on Windows (for some reason). Added installeddi() Eden procedure, which adds the eddi parser to the environment when invoked. Added this info to the Eden Quick Reference. The Update button in the View Eden Definitions window now keeps the vertical scrollbar position instead of resetting it to the top of the document each time it is pressed. Added an Edit menu with Copy, Cut, Paste options to the View Eden Definitions window. This required reworking of the Eden Definitions menubar. Added information about return codes of forget() and type casting to the Eden Quick Reference. Tcl now sets the prompt label using the correct case of "statements" (which is later overwritten by C code anyway..., but which can be observed when running on a slow machine). The Eden forget() function can now take a pointer. However it will never return 1 (for "not found") as use of a pointer reference causes Eden to create the pointed-to item (as @) if it does not already exist. Added slightly more detail to Eden quick ref about nested comments. There was a bug in the one-line comment (##) code, which caused the next line to be ignored if the comment characters were followed immediately by a newline. "Merged in" Meurig's eddi changes by concatenating them into one long eddi.e file. ** 1.29 Tuesday October 16 19:22:15 BST 2001 ** Fixed bug introduced into ttyeden in 1.27. The fix was introduced as ttyeden didn't seem to deal with items in the todo() list correctly. The "fix" caused clearGarbage to be called at incorrect points, meaning Datums that were actually in use were freed: writeln("what the ****"); would print "(type=-14907, val=-976894523)" (as the string Datum was corrupted). checkRunSet and the associated clearGarbage, incGarbageLevel are now only done in one instance of print_prompt_if_necessary. This may reinstate the problems with todo() that the "fix" was introduced to solve, but there was no clean test case for it, and I no longer have Michael's ttyeden model code to test. Changed printing of strings and chars. Strings are now output with surrounding double quotes, chars are output with single quotes, unless their output was caused by writeln (in which case the contents of the string is usually required). This should help debugging (the ? query operator now shows the type more clearly) and reflection (when Eden code observes Eden code, perhaps re-executing it). writeln on a list always shows quotes, as it is also surrounded with list constructors and is therefore a "reflection" type of output. Fixed a bug introduced when improving the Donald error output. If Donald was "within" a context, this was not reset (an oversight introduced when adding this improvement). There was no way to return to the root context (as the Donald parser looks for "within { ... }" and will not accept "}" without the preceeding tokens). The context is now correctly reset and notice is given of this in the Donald error message. For example: %donald openshape ash within ash { error ** 1.28 Monday October 15 16:23:30 BST 2001 ** Fixed 'invalid command name: "tcl_wordBreakAfter"' error on Windows after Michael found how to reproduce it (double click in the input window). The problem was caused by the ommission of the tclIndex file from the Windows distribution (quite a few of the Tcl/Tk files are ommitted in order to save space). Files using DOS line-feeds (CR, LF: \r\n) in non-Eden notations (Donald, Scout, LSD, Sasami, custom) were causing errors when interpreted with the include() function (interpreting the code via the input window: File -> Open was OK as Tcl reads the file and seems to correct the line feeds). This is a very old bug: a problem even in tkeden-dec151997. Now fixed. ** 1.27 Thu Sep 27 18:44:13 2001 ** Now guessing location of library files directory on Windows in ttyeden (previously was only doing this for tkeden). eddi.e now tries to find eddipf.e in TKEDEN_LIB, not the current directory, so the command given below for starting tk/ttyeden with the eddi parser should now work even if eddipf.e is not in the current directory. File -> Execute -> eddi.e now works. Previously any Tcl code which required access to a global Tcl variable would fail when run from File -> Execute (as the Tcl 'eden' command was run within the access scope of the Tcl 'include' procedure). Moved checkRunSet into print_prompt_if_necessary (ttyeden only). This fixes a bug where ttyeden didn't seem to deal with items in the todo() list correctly. ** 1.26 Thursday September 27 12:49:42 BST 2001 ** Chris Brown's fix for strings containing single-quotes ttyeden now shows -l setting on -v. Fixed bug where %eddiarrgh would be a valid notation change. Other built-in notation changes with additional postfixes (eg %lsdarrgh) should still be valid, but notations in the observation-oriented parser now require an exact match. Fixed bug where a notation starting with an uppercase letter would cause an error in tkeden (as Tk doesn't seem to allow window names that start with uppercase letters). Including the eddi observation-oriented parser into the standard distribution. Load it with the Eden code 'include(getenv("TKEDEN_LIB")//"/eddi.e");'. This can be done from the command line: tkeden -l lib-tkeden -e 'include(getenv("TKEDEN_LIB")//"/eddi.e");' (this also works with ttyeden). ** 1.25 Friday September 14 17:11:49 BST 2001 ** Fixed minor bug preventing tkeden compiling without Sasami. Made it possible to use the observation-oriented parser within ttyeden. The observation-oriented parser requires the file trans.e within the library files directory, and so the -l argument now applies to ttyeden. If the -l argument is not given, ttyeden still operates, but the observation-oriented parser is not available (functions defined in trans.e are not available - likely error messages include "...'ident_ex' needed..."). The ttyeden prompt now includes the name of the current notation if this is not Eden, for example: "%eddi 4|>". Fixed many input-reading bugs to allow this to happen correctly (to do with EOF handling, prompt printing, line termination etc). There may still be some more bugs as the code is messy (Eden/lex.c really needs a rewrite in many places) and it is difficult to test all possible conditions. Fixed a memory bug in tkeden's prompt ("Enter xx statements:") setting code. ** 1.24 Wed Aug 15 16:15:34 2001 ** Eden "system" command now defined as a built-in, meaning that it should now work in a non-root virtual agent context (previously, the tilde "root virtual agent" specifier would have needed to be appended, ie "~system"). The cd(dirname(fileToInclude)) hack introduced in 1.17 which makes it possible to drag a model start-up file onto the tkeden icon on Windows (the hack sets the working directory such that the other model files can be found) was causing problems on UNIX when people start the tool with a command line including relative pathnames, so this hack is now only used on Windows. Chris's observation-oriented parser is now not compiled into ttyeden. It could be, but the executable then needs to be able to find trans.e and the -l option would then become mandatory for ttyeden, meaning it wouldn't be just a simple stand-alone executable. Since the current notation development using the parser seems to be proceeding using tkeden functionality, ommitting the parser from ttyeden shouldn't cause too much of a problem for now. ** 1.23 Monday August 13 18:18:58 BST 2001 ** Chris's updates to his observation-oriented parser: some functionality has been moved into Eden - particularly the decision about when to start parsing a complete 'chunk', meaning that a parser for a language with definitions spread across several lines is now possible. ** 1.22 Friday August 3 16:49:31 BST 2001 ** Merged in Chris Brown's observation-oriented parser. This may cause problems with some models as the additional Eden code which implements the observation-oriented parser may use namespace that is already used by some other models. Made installnot create a new radio button on the interface for a newly installed notation. Added 'notation' to eden.txt quick reference guide. ** 1.21 Thursday August 2 18:02:12 BST 2001 ** Fixed CVS/Root files which contained cssbz@127.0.0.1... instead of the correct cssbz@cvs.eden.sourceforge.net... Undoing a change I made in 1.19 which was to rename all upper-case filenames, as this will cause too much hassle with CVS. Compiled Tk Img package at DCS and made edenio.tcl load it if it is available. This gives Scout the ability to load images in the formats BMP, XBM, XPM, GIF (with transparency, but without LZW), PNG, JPEG, TIFF and postscript (previously it could only handle the Tk default of PPM/PGM and GIF). Updated various documentation with credits, installation and usage information. Help -> About tkeden now shows patch level of Tcl and Tk (eg 8.3.3 instead of 8.3), and also whether the Img package is available. Sync'd all the code with CVS again. Added 'setcvstag' target to Makefile to enable recording of releases in CVS. ** 1.20 Wed Jul 18 18:26:59 2001 ** Added ENTSTK to possible debug() output reset_stack and reset_compiler_status now give debug output Fixed "bug42": introducing the screen_width etc definitions in 1.19 caused a segv after an error in some circumstances (in particular, when the user made an error in a file that they included from a file after a %scout line). I had previously worked around this problem by leaving out a Tk "update" after adding text to the error window. If an "update" is not performed at that point, the error window appears to freeze during a series of repeated errors. Adding this update is in fact a new feature, but adding it revealed the above problem - that the error handling code was causing some Eden code to run with the intent of updating the screen_width definitions, and this foobarred the stack state (which is actually above the current stack pointer and so supposedly "discarded", but is still required after an error condition). Now the machine state is reset after the call to the error handling code, meaning the error handling code uses stack space above the state that must be left undisturbed. Limited testing so far seems to show that this fixes the problem. Now error messages should be visible in the error window even if Eden is in a tight loop (which is especially important now that complete error messages are not logged to a file). Added 'tkwait visibility' to OpenDisplay procedure, which means that any Scout screens should be shown even if Eden goes straight into a tight loop when starting up. Added to debug(2) output Fixed bug in error line buffer implementation. The 'rtos' function in donald.init.e had a bug causing memory to be overwritten. The first argument to sprintf must first be initialised to a string of length the same size or longer than the string to be written into it. Added warnings to eden.txt documentation. Proper error message if scoutScreenInitOpen can't be found (ie we are using the wrong -l settings). Character number reported on error now starts at 1, not 0. Donald dashed and dotted lines will now appear solid if your Tk version is less than 8.3 (the old dash_bitmap hack was removed in 1.19, which caused these lines to not appear at all). So we now have a dashed/dotted lines solution which should work reliably on all platforms and fail safe to solid if the platform cannot cope. (Note that the current Windows distribution uses Tk 8.0 and so dotted lines will not appear there). ** 1.19 Sat, 14 Jul 2001 21:35:52 ** Previously, calling touch() with a non-pointer (eg touch(me)) caused a Segmentation Fault and crash. Now it gives an error. Removed code from scout.init.e which fudges heights and widths to work with "buggy Tk" (version 4.0b3? - very old now). Added warningf C function (using varargs) to enable more complex warning output. Made warning use it. Improved error messages in the C-implemented Tcl commands, eg eden, todo, evaluate etc (see EX/ex.c). Scout now 'knows' the size of each display. Implemented some Tcl / Eden which defines Scout integers, named displayname_width and displayname_height which are the width and height of the display window. These observables are redefined when the window is resized by the user. This should make it possible to centre things within Scout windows, etc. This particular interface doesn't fit cleanly with the rest of Scout - perhaps this information should be obtained from Scout using displayname.width etc, but this would require more work. This hack will do for the moment - beware of future changes if you use it. Defined the new functions cd, cwd, dirname, basename as built-in functions so that when we are not in the root VA, the agent name does not get prepended. Unfortunately this means that the user cannot redefine the initial versions of these functions. Added Scout DFwidth and DFheight parameters describing the width and height of the screen to be opened (meaning we can redefine these before screen is opened...) Calling the Eden tcl() function with @ now results in an error message, not a Segmentation Fault. Control-C twice to kill tkeden on Linux now works correctly and doesn't go into a loop. Figured out Donald {distance @ angle} operator and added to (the previously extremely poor) documentation (also documented that Eden sin and cos require radians...) Fixed a bug involving passing strings with " characters in text boxes to Scout (a Tcl problem). Find... didn't work on Linux as \c was being interpreted as an escape sequence there (not sure what it is supposed to be interpreted as). Quickly fixed by using marks instead - not sure if this is a good solution. Made a separate Errors window and separated out history entries from errors. Now no longer a need to surround errors with comment characters. Errors from all notations should now appear in a uniform and more helpful way. Adding the startup stuff provided on the command line (eg -e, filenames...) to the history. Fixed (well, avoiding) a bug which caused tkeden to fail with Seg fault after encountering an error during initial startup (specifically, it seems to appear when the user makes an error in a file that they have included from a file included from a file, after a %scout line, all of which appears to be causing the errorf longjmp to jump to the include() C function (which it shouldn't) which then dereferences paracount and gets a nonsense value since there is nothing on the stack at that point). Somewhat obscurely, removing the Tcl "update" call after the error (which I inserted to get the display of error messages working OK during an error loop) causes this to work OK - eh?! The Tcl "raise" procedure (which brings a window to the front) appears to be causing problems on Linux, so I've redefined it to blank for the moment. Added what was encountered to the information given on a parse error (previously just printed what was expected) from translators using bison.simple (Eden, Donald, Scout). The error location indicator (^) now takes account of tabs in the input line, so points to the correct place if tabs are used. Fixed a bug where the heap was not freed when a empty statement list was used. Eg 'while (f()) {}' would cause heap overflow if f() did not return false fairly quickly, as the arguments to f() (a list of length 0) were added to heap on every call. The heap space would normally be reclaimed after execution of the first statement in the loop, but not in this circumstance. Added debugging output to internal C malloc function. Enable with debug(64); Circle colouring in Donald has been reported previously as not working. It is still working - at some point in the past, the attribute name required changed from 'color' to 'outlinecolor'. The -e command line option didn't work correctly on Linux when it followed a filename (eg ttyeden errortest/args.e -e "writeln('n');"), as getopt on that platform permutes the contents of argv as it scans so that eventually all non-options are at the end. Turned this behaviour off and -e now works correctly on Linux. ttyeden -u output was incorrect. C-lib "illegally typed" error message improved. Stack trace given for error messages now says "in ..." for first func/proc... rather than "called by". This should help to understand where the error occurred, for example in the case where a proc/func etc tries to reference outside the parameter list - the location of the error was likely to be construed as the caller in the old error message style. Code that would have probably caused "called by action " fixed. Error message formatting improved where 'stack pointer was inconsistent' is mixed with an error message. Decided to remove 'stack pointer was inconsistent' notice as most of the time it simply seems to just add more noise to error messages - the pointer was inconsistent because an error occurred, I believe probably in all circumstances. Added an 'error number' identifier which shows up in the history and error windows, allowing us to reconcile the two together if need be, and as a reminder in the history file that the input caused an error. In 1.13 C-lib real-valued functions were modified to give an error when called with non-real parameters (before, they used to silently return strange values). Now any integer values passed to one of these functions (eg sin, sqrt...) are internally cast to floating point before calling the C function, so that meaningful results are now obtained when calling these functions with integer values. Improved 'not read/write variable' error message (which happens in eg 'writeln++' where writeln is not a local variable). Now giving the name and type of the offending variable. arca.lib now uses a modern-style font name declaration, so has more hope of working on multiple platforms. Added '##' as a one-line comment to Eden. The character sequence '##' now causes Eden to ignore input until after the end of the line is encountered. The single '#' character cannot be used as a one-line comment token in Eden as '#' is already used to denote list/string length (and the C++ one-line comment '//' is also already used in Eden for list/string concatenation). '##' comments can already be used in Donald, Scout and Sasami as those notations already implement the '#' one-line comment syntax. '##' can therefore be used in any notation currently built-in to tkeden. 'Error number' identifiers now inserted into history are now commented with '##', so that history can be re-run in tkeden with no modification. Turned filename completion (a function provided by readline when you press Tab) off in ttyeden. Readline now knows that the application name is ttyeden, so conditionals using this information are possible in ~/.inputrc (but this is currently untested). Fixed a bug in and improved the ttyeden prompt. Previously, a comment would cause the prompt to fail to reset from the "waiting" prompt ("+> ") to the usual prompt (":> "). Now the prompt correctly resets, and there are multiple possible "waiting" prompts. The usual prompt has been modified to make the difference between it and the "waiting for semi-colon" prompt clearer. The new prompts are: |> - the usual prompt ;> - prompt when waiting for a semi-colon |> - prompt when waiting for a close-quote *> - prompt when waiting for a close-comment Reworked the tkeden previous/next history implementation added in 1.13, which used a cyclic buffer to represent history. This implementation wasn't the same as other implementations of history (eg in various shells) and caused the history to be overwritten after using Previous to "go back in time" and then continuing to make entries (overwriting history). On inspection, other implementations of history seem to be simpler than this and "go back in time" only for the duration of the current entry. tkeden now follows this scheme, retaining twenty items of history, and beeping if the user attempts to go beyond the recorded limits. Added Alt-p and Alt-n key shortcuts to tkeden for previous / next in history, as some configurations have no Meta key and Alt-Control-Up/Down is used by the window manager. Shift-Control-Tab was causing the entire menu bar to tear itself off. Fixed. Donald dashed and dotted attribute support reworked using the third party Tk "dash patch" which was finally merged into Tk in version 8.3. These attributes will not function if you are using earlier versions of Tk, but if you are, they are likely to function correctly (unlike the previous hack which involved 'stippling' the geometry with a dotty bitmap, which failed to function at certain angles on certain platforms). This version of Tk does not seem to be easily available in cygwin and hence the PC port, but the previously hacked version didn't work on the PC anyway. It seems that the attribute "linestyle=dotted" was not supported at all in the previous version (despite existing in the documentation) - it should work now. Renamed files with all upper-case names as they cause problems when they exist on a vfat (Windows) partition mounted from Linux. Checked out memory leak bug in COMICAL/ROADSYS, which was mostly fixed in 1.1 ("bug5"). There is still a small leak, but it looks like this is probably attributable to Tcl (specifically TclpAlloc). Added eden_prompt variable to ttyeden Eden which specifies whether the prompt will be displayed: 1 (default) means the prompt will be displayed, 0 means don't show the prompt. The value can be modified directly or via the -n and -i command line options (which do correctly trigger any actions triggered by eden_prompt as they should). Had to work around a bug in libreadline4 (reported to Debian as bug #105231) to get this to work. Bug fix: ttyeden previously would quit after two control-C presses, no matter how length a time interval between them. Bug fix: ttyeden does not now use readline if the current input file is a pipe (technically, ISFIFO), meaning that the 'old-style' pipeline translators still behave as they did. Removed some dead code relating to storage about input. Reworked my line buffer (added for error handling) so that it resizes dynamically, meaning Eden once again has no line length limit (I unwittingly introduced one probably around version 1.13). ** 1.18 Fri Jun 29 2001 5:30am :( ** Changed Scout "parse error" to something more informative. The 'sensitive' functionality added for Chris in 1.13 below is still not right, despite some more fixes in 1.17. When 'sensitive' is used in a window in a virtual agent context, the ON, MOTION etc values were being prepended with an agent name, meaning their value was unknown, meaning that the parser moaned. Changed these values back into items in the constants table, meaning that the VA name translation is not done. Had to hack the values of these constants, given that Scout lacks a proper 'integer' type (they are actually 'double' - see below). Now added an 'integerhonest' type, the tree constructor function of which actually takes an integer. The internal value is still stored as a double, as per Simon's original hack (which was added before the start of version control on this source). In summary: 'sensitive' now works in VAs, but Scout still needs un-hacking wrt the integer type. Renamed 'dummy.c' to 'nothing.c' as the configure script seems to keep removing it on Linux. Got dtkeden to compile on Linux (need different headers for MAXHOSTNAMELEN) Bug fixed: previously trying to File -> Open a file without an extension would lead to an attempt to load the filename with a .e extension. Documented font specifications in Help -> About Donald, Scout Updated Eden Quick Reference with a few more of the additions I've made. Changed default file extension in File -> Open etc to *, as none of our existing models use the .eden, .donald... extensions yet. Fixed a bug introduced in 1.17 where Scout windows always seemed to have a border. This was actually due to yet another bug in my 'sensitive' reimplementation, which caused screen[n][14] (the sensitive attribute) to be defined as @ if it wasn't specified by the modeller. Previously it would have been defined as 0 in this case. Now it is defined as DFsensitive, which is zero by default. ** 1.17 Wed Jun 27 2001 4am :( ** The Scout 'integer' type is actually more subtle than described below. Actually Scout has another type, 'real' (which is only mentioned in an example in the documentation). Both 'real' and 'integer' are stored as C doubles, and have the parser identifier INTEGER. When a Scout number is output to Eden, tests are performed to see if the decimal part is zero - if it is, then the number is output (mostly) as an integer. We still need the 'real' type, particularly when scaling images, and replacing this hack with a proper implementation of real and integer separate types would take more time than is available at present, so moving back to the previous (hacked) implementation. This implementation causes problems when feeding numbers from Scout to some Eden functions, but this can be worked around in the models by casting to (int) when required. The 'sensitive' functionality added for Chris in 1.13 below was actually buggy (it was untested until now): the functions in scout.init.e were being passed the value of the pointer to the sensitive attribute, not the actual value. This is now fixed, and the mouse / key Tcl bindings are now set up by one procedure in scout.init.e instead of two. MOTION, ENTER and LEAVE will not work within TEXTBOXes for now, as some more work needs to be done on TEXTBOX first. _mouseClick ("VB-like"?) functionality removed from scout.init.e at the same time as above, as the use of this feature in models seems to cause more problems than it solves. (Note: this will break some existing models). Minor bug fixed: errors from keyboard input in ttyeden would be reported as from file '@': now correctly from file "stdin". Added Eden cwd() function and cd() procedure. The cwd() function is marked as out-of-date whenever cd is called, so the procedure 'proc pcwd : cwd { writeln("cwd now ", cwd()); }', giving a UNIX shell-like prompt is possible. Added Eden dirname() and basename() functions, which give the containing directory and filename of a file path respectively. Now, for each initial file to load specified on the command line, cd-ing into the containing directory of each file before attempting to execute it. This will leave the cwd set to the containing directory of the last file on the command line. This is intended to make Eden include(...) calls in a script more effective if the tool doesn't have a sensible initial cwd (which is true on Windows most of the time). Some of the code for this trick is implemented in Eden, so that the cwd() function will be correctly re-evaluated when the cds are performed. Note that it is possible to make Eden appear in the Send To right-button menu in Windows by setting up a short-cut to it in the C:\WINDOWS\SHORTCUTS folder. This cd hack should make this short-cut trick work in more situations (note that it is also possible to select multiple files to Send To Eden). Note that the include() Eden function does not itself do a cd() - if you are using include(), you may do a cd() in the script yourself. Rewritten the File -> Open / Execute cd trick introduced in 1.15 from Tcl into Eden, meaning the cwd() function will be correctly re-evaluated when including files via this interface-driven route. Removed traces of 'tkusage', which apparently was an external application intended to keep track of the use of tkeden. Now storing the last twenty items of tkeden previous/next history. Deleted some stuff from edenio.tcl that was no longer needed (some comments and the old file browser things). Set the colours for the radio button bar to something other than grey to distinguish it from the menu bar on Windows. Removed code from edenio.tcl which fudges the text search to work with "buggy Tk" (version 4.0b3? - very old now). Added key shortcuts Alt-s and to View Options dialog. Find dialog: added case sensitivity option, "find in...", key short-cuts. Improved display of found text: previously it used the selection (sel) to highlight the text, which was not visible unless the window has focus on windows. It is worth noting that the Find dialog can take regular expressions (eg "ash.ey", '.' meaning any character or "^start", '^' meaning start of line etc etc) as the search string. Added Help -> Scout, DoNaLD and Sasami quick references, but they aren't really finished yet. ** 1.16 Mon Jun 25 2001 10pm ** Eden include() can now take multiple filenames: eg 'include("one.e", "two.e");'. This should assist us with replacing our many 'run' UNIX shell scripts (of the form 'tkeden stuff.e blurb.s') with 'run.e' Eden scripts (of the form 'include("stuff.e", "blurb.s");'). "multiplePossible" trivial Windows bug introduced in 1.15 fixed. File menu now has File -> Open and File -> Execute, as the meaning of Include was a little unclear (although it is technically correct, referring to the Eden function). Changed file types used: now using .eden, .donald, .scout, .sasami and .script. The single character file-types were inadequate in many ways (we now have >1 notation as a candidate for .s, .s is also used for assembler files etc). '.script' is intended to be used for the circumstance where a text file contains a script which uses mixed notations: Eden and Donald, for instance. Hopefully this won't cause problems with Windows 8.3 filename limitations. Adjusted keys.txt slightly - moved previous / next up as they are quite a common need. Eden's IPC functions (send_msg...) are now an optional compile (enable with ./configure --enable-ipc) as I can't get them to compile on Linux. Rewrote Eden gets() function to actually use fgets() as use of gets() results in the compiler warning "the `gets' function is dangerous and should not be used." Reworked the curses stuff a bit to make it compile on Solaris and Linux more easily. Rethought the declaration of the 'rand' function to make it compile on Solaris and Linux more easily. Also 'srand'. Sasami had some source files where the end of the file was missing a newline - the compiler on Linux warns about this, so corrected. (Probably) fixed a bug where Tcl would give 'invalid command name "tcl_wordBreakAfter"' when clicking in the input window after an error. This was introduced in the previous version when the Windows distribution was optimised to fit onto a floppy disk, missing out the file tcl8.0/word.tcl. Previously, the Scout 'integer' type was actually stored internally as a double and passed to Eden as a floating point number. This caused problems in the jugs model as the value was then passed to an Eden function which expected an integer type. Scout now holds 'integer' values as integer, and attempting to define a non-integer Scout value will result in "failed assertion" error at runtime. Previously redefining the type of a variable in Scout would cause a segmentation fault and a crash. It seems that 'extern char *scoutErrorStr' and 'extern char scoutErrorStr[]' are not equivalent and this is where the problem stems from (the area of memory designated for the error message was in read-only memory). So now Scout gives a nicer error message and doesn't crash. ** Rel1.15 Mon Jun 25 2001 ** Ancient history added to this file. Improved window creation on Windows: hopefully they should mostly be created on top now. Fixed bug in View Eden Definitions that caused some agents not to be displayed (bug due to me forgetting that malloc doesn't zero memory). Now specifying font for input window as courier - so we get fixed width characters on Windows. Tcl_Init was falling over with "couldn't stat "": no such file or directory" - fixed by inserting a call to Tcl_FindExecutable in main.c Changed many #include <...> to #include "..." to denote that they are not system header files. Removed -I., -I.. and -I../Eden from CC Make rule, so the location of all header files should now be explicitly stated. Ported the new Sasami implementation (using Togl) back onto Windows. Changed right mouse button being used to button 3 so it works on Windows (this will cause the button used to be changed on UNIX). now deiconifies and raises windows that were iconified (eg minimised on the Windows taskbar) Changed method of specifying ~/.tkeden-history, meaning this should now work on Windows (but assuming the $HOME variable is set...). Auto-detecting where the Eden library files and Tcl init files (ie the setting of the TCL_LIBRARY environment variable) are from the current working directory on Windows, meaning we can do away with needing the run.bat hack to start tkeden (which previously required some manual user configuration). Things even seem to work when we install into a directory with spaces in the path (eg "My Documents", "Program Files" etc), although I'd guess that not all models will handle this situation well. Updated the make windist implementation. DOS line feed versions of the text files are now created using a unix2dos.sh script I created, so that Windows users attempting to read the documentation with Notepad are not stuck. Previously we needed the binary cygpath to be installed along with tkeden, as we need the functionality to convert from UNIX style paths to Windows style paths in edenio.tcl. Now a new Tcl command cygwin_conv_to_full_win32_path is implemented which calls the CYGWIN DLL to give this functionality instead, so we no longer need the cygpath binary. Updated credits.txt to show libraries used. Rewritten some font and display handling functions (StringWidth, FontWidth, FontHeight, DisplayDepth) that were previously in C in Eden, using Tcl functions. Removed EX/disp.c and EX/disp.h as the functions are no longer needed. Fonts should now work on Windows as they do on UNIX (the jugs demo seems to work correctly, for example). The default Scout font is now specified in a platform- independent manner, and seems to be a good size on Windows at least. Note that now that the font handling is mainly Eden code, some dynamic configuration can be achieved - eg the value of DFfont can be changed (eg 'DFfont = "{courier 18}";') and the screen will update automatically etc. As the DOS tkeden stdout/stderr window now disappears as soon as tkeden exits, which gives the user very little time to view any error messages, tkeden now includes a signal handler which asks for the return key to be pressed in the window before the signal takes effect. This won't work in all potential cases, but it should do some. Reworked the menu bar in order to get the key shortcuts working correctly on Windows. Unfortunately the changes required mean it is no longer possible to show the Accept and Interrupt menu entries differently from the others. To solve this, Accept and Interrupt are now buttons in the radio buttons frame. Reworked the file save / open dialogs, using functionality that Tk provides. The result will look the same on Windows, but a better dialog will be provided on UNIX. Removed win32ex.c, win32ex.h as no longer needed. It is now possible to File -> Include multiple files simultaneously (but on Windows only - this has only recently been implemented in Tk 8.4a2 on UNIX). Use Control or Shift to select multiple files on Windows. Previously, File -> Include always inserted the text of the given file into the input window, and then into the history window when the accept button was pressed. This fills up the history rather quickly. Now we have File -> Open, which gives this behaviour, and File -> Include, which does an Eden include(...) to read the contents of the file into the tool without filling the history too much. Changed default value of undef_reference_notice to 0 as we have too many existing models which reference undefined values as they load. If you are debugging a model and suspect that problems may be being caused by undefined values, try setting undef_reference_notice=1; Checked: I've heard reports previously that running models with intensive continuous computation may cause the tkeden interface to have problems (eg allegedly it was difficult to do File -> Quit whilst the VCCS was running). I've checked this problem again now and it seems to have been fixed. Now cd'ing into the directory containing the file when doing File -> Open or File -> Include, which helps Eden include(...)'s in the model to work. Added code to main.c which makes the library location path an absolute path if it was specified as relative (by prepending the current working directory) to make the Help items work in this circumstance. Decided on size of 10 points for the edencode default font, which seems to give our customary size on UNIX (although it may be a little large on Windows). ** Rel1.14 Thu Jun 14 2001 ** Added Help -> CHANGELOG Merged Ben's Windows Changelog information into this file. Added Help -> Credits Fixed bug in errorf that caused Tcl errors (eg from Tcl_EvalEC) to come up with no information. Fixed sasami_viewport_bpp (I don't see how it could have worked before). Debugging facility getting still more functionality. Call the Eden function debug() with a sum from these values to set what you want to see: 1: various 2: RunSet debugging 4: Eden parser debugging (=yydebug) 8: Sasami 16: Donald 32: Scout parser debugging (=st_debug) Improved the input window text insert cursor: it is now coloured, bigger and the flashing is hopefully a bit better (it spends little time being off, meaning you shouldn't lose sight of it). Added Help -> Eden Quick Reference, with formatted (blue) "optional" syntax text. Added ellipsis (...) where appropriate on menu entries to show that they lead to dialogue boxes... Added a -e argument, which enables the passing of some code to execute from the command line. Any occurrances of \n are translated to newline characters (as the shell passes them literally) before execution of the string, to enable notations to be switched etc. Examples of use: tkeden one.e -e "writeln(1);" two.e tkeden -e "%sasami\nopen_display" Note this might cause problems if you actually want to use a \n as you normally would (eg in an Eden writeln). Fixed some bugs in command line handling (I think -n, -i would not have worked on ttyeden in combination with files since I changed option handling to use getopt...). Figured out how to work around a bug which causes Sasami to use false colours on a Solaris machine with a cheap graphics card. There is a bug somewhere (Sasami, Togl, Tk, X, OpenGL?) which causes Eden to use the wrong visual and colormap when running using Solaris 8 X and OpenGL on a machine with an 8-bit (old, low end) graphics card. The easiest way to solve this problem currently seems to be to link Eden using Mesa (which is most simply described as an open-source OpenGL)... so I've added the necessary tests and options to configure to allow Mesa to be used instead of the Solaris OpenGL. Sasami seems to work now even on an XDM terminal (albeit extremely slowwwly). ** Rel1.13 Mon Jun 4 2001 ** Attempting to add a 'procmacro' feature, similar to 'proc' but with a screen update and user input phase (ie tcl "update") - basically, a call to eager() between each statement as they are executed. Eden procs appear to have two optimisations compared to entering statements line by line in the input window: screen update is delayed during RunSet evaluation, and the formula queue is not updated unless it is necessary (eg writeln on a changed variable). This optimisation is useful and necessary as we quite often want state change to be indivisible. 'procmacro' was named thus due to the existing definition of a procedure named 'macro', which does string substitution and is used by Donald and some of the older models I should think. Defined YYERROR_VERBOSE to get more information during parse errors. Added errorf function which operates like printf. This has allowed me to improve many of the error messages, giving extra detail of the problem (typically, I'm printing out the value that causes a problem and what was expected). Added information to the UNDEF (@) Datum which allows me to give an error message stating /which/ func/proc/procmacro could not be found in that event. Made Eden use bison.simple, meaning we should get more helpful parse error messages and possibly fairer input input / calculation balance. Added to debug() functionality - it now controls yydebug as well. Now giving decent location information on errors, in the form: error blah while blah near line x, char x: original line ^ (char indicator) Added %expect definitions to parsers to prevent shift/reduce conflict errors on parsing expect when the number of conflicts changes. Added an Update button to the View Eden Definitions window which rebuilds using the options that the user chose last time (avoiding having to select them again using the View Options window). Fixed a bug which shows when a triggered action combined with an internal formula redefinition use the same triggers, eg proc xx : b { a is b+1; }. In this example, b was previously given the trigger [xx] when it should really be given [xx, a]. The lack of triggering means that the definitions involved suffered from lack of reevaluation and their value could get out of date. Fixed a bug which occurred when the frame overflowed. For example proc p { p(); }; p(); would give an error with "called by action ^A^CX" or even seg fault. Now not attempting to print out nonsense frame information. Improved information (giving type of item called) given in this error message as well. Internal documentation improved a lot whereever I can. C-lib real-valued functions (eg sin, cos, pow...) used to give strange results when called with non-real parameters. All of these functions seem to require real-valued parameters, so Eden now gives an informative error message when the wrong type is encountered. Put more information into the int-valued C-lib error message as well. Fixed a bug involving use of query which would in some circumstances cause a seg fault. Eg proc p { para q; ?q; }; p(42);. Changed query operator. When it encountered values, previously it would simply display them: 4:> a=42; 5:> ?a; 42 a ~> []; Now the query operator prints "a=42" for consistency with its other outputs. It also now prints out the identity of the agent who changed the symbol last. Improving debug() output a lot. Categorising each output: CALSTK call stack (changes call stack) SYMTBL symbol table modification DEFNET definition network (changes definition network structure in SYMTBL) VMREAD reads data from prog array VMWRIT writes data to prog array VMEXEC virtual machine execute change progp DATSTK data stack operation MCSTAT use of other machine state HEAPAL involves some heap allocation VMOPER virtual machine op (in inst.h + probably invoked via func ptr deref) FQUEUE formula queue AQUEUE action queue PARSER parser use | (bitwise OR) to form combinations, in the order that it occurs procedurally. Added a disassembler function disAss and using this in execute and other places to display the symbolic name of the opcode about to be executed etc. Rewrote push and pop as functions for DEBUG, which will slow performance in DEBUG mode but lets me print out valuable stack debugging information. Added a notice if you attempt to get the value of a variable which is actually undefined (this should be useful as people frequently mis-type variable names, I'm told!). You can turn this on and off with using the variable undef_reference_notice - required as this isn't an error and can be intended behaviour in some models. The default is for these warnings to be on - might need to reconsider this later. Added a Next item to the Edit menu. Now have Previous / Next. The input window now stores ten previous items entered and you can cycle through them with Edit -> Previous and Next. As well as the Alt-E, [r|n] shortcuts for these (can't use Alt-E, p as this might be used in the future for paste), I've implemented Control-Alt-[up|down]: use the cursor keys. Had to use the two modifiers together as CDE uses Alt-[up|down] and Tcl seems to give a simple up/down through the text with Control-[up|down]. Also added Control-Alt-0 key shortcut for clear for completeness. The key shortcuts are marked in the Edit menu. Also added Meta- shortcuts for those with meta keys. Changed Accept into a raised button, to show it is different to File etc which are menus. Giving current value in a comment for formula on ? query to save people having to writeln formulae to get values as well as ? query to find the definition. Previously tkeden beeped every time an error occurred. If you were unlucky and got a series of errors or even a loop, you had an embarrassing stream of beeps. Now tkeden only beeps if it hasn't beeped in the last three seconds. Scout screen window does not now appear when tkeden is initially started (it always used to previously, usually causing the input window to be obscured). The screen window is created on the first occurrance of '%scout', when we can assume that the window is going to be used. Made the default input window a bit bigger. Made tabs in the input window the width of two characters to try and help people format their code there more easily. Control-U in the input window now deletes any text to the left of the cursor on the current line (as per many UNIX shells etc) - an easy way to quickly undo something you just typed which was wrong. Added a few more items to the Edit menu: Select all, Select non, Copy, Cut, Paste. The title of all windows created by tkeden now include the tkeden version number, and for dtkeden, whether dtkeden is running in server or client mode. This should help to identify whether the history window that has just popped up in dtkeden is from the server or the client. Now when you attempt to close the History window, Eden definitions etc using the window manager (clicking on the window's close box), it works. (Hopefully including windows created by scout here). Added help to the Eden Redefinitions window which reminds us that control-click can be used to select individual items. Now, if Shift-Control-Tab is pressed in any tkeden (input window, View Definitions, scout windows...), all the tkeden windows are brought to the top, with the Input window top-most. This should help with window management when there are many windows on the screen. Additions to Eden built-ins specifying behaviour now changed to eden_error_index_range and eden_notice_undef_reference - more sensible and hopefully avoids most clashes with user code. Made it possible to do related by statements with a LHS that is evaluated at run-time, eg r="c";`r`~>[q]; Fixed a bug which prevented the use of related by statements within procs eg proc q : w { a ~> [q]; } (before, note that ?q would have shown the lack of identification of the w trigger). Removed some code added by Patrick to yacc.y 1.8 (Rel1.0) which looks like it was attempting to fix the problem of referential dependency. It actually makes this problem (if indeed it was attempting to fix it) worse. Moved Edit menu next to File menu (so order is now File, Edit, View...) Added source code Makefile dependency checking, using the preprocessor options to get this information. Enable with --enable-depend to ./configure: see INSTALL.TXT. Made dtkeden View -> Client connections window consistent with the other View windows in the interface. Also, the dtkeden client Send button is now raised, whereas on the server it is normal, in an attempt to show whether the button is a menu heading or an action button. Improved usage information (-u) for dtkeden. Made Tcl aware if Sasami is available or not, and hide the relevant options if it is not. Added radio buttons above the tkeden prompt which emphasise the currently selected notation (ie which interpreter we are talking to) and which can be used to set the currently selected notation without needing to type %donald etc at the top of the input text. Gave the text input window a white background to make the interface look less mono coloured and to make text there more readable, both on the screen and in printed screen shots. Added a Help -> About key shortcuts dialogue giving lots of information about possible key presses in the input window and elsewhere. Ported Sasami to UNIX. Replaced Ben's Windows-specific Sasami window-creation code - using an implementation of an OpenGL Tk widget named Togl (http://togl.sourceforge.net/ - had to get the most recent development version from SourceForge CVS) instead. Sasami also uses GLpng for loading PNG images as texture maps (http://www.wyatt100.freeserve.co.uk/download.htm) - luckily this compiles OK on Solaris. Now the Sasami window creation code is mainly Tcl/Tk, in edenio.tcl. The mouse movement code is also now in Tcl. Sasami errors now use the Eden (not Windows) facilities. These changes should allow portability of Sasami across UNIX / PC / Mac (in the future) and should allow extensions: 1) feedback of which polygons the mouse is currently positioned over to Eden, 2) wrapping of (multiple?) Sasami windows in Scout. Sasami is now always included in tkeden, unless you specify not using a configure option. The Sasami window now seems to be resizable (I assume Tcl is passing events through to the togl widget), so if a model is running slowly on your particular machine, you can make the window smaller. Now when Eden changes some Sasami state, the renderer is not immediately invoked - rendering is delayed until the next Tcl update (until a change of RunSet) and so rendering a change to the Rubiks cube etc is now much, much faster. I've changed the default camera position too, to be further away from the origin as most models seem to be quite large. LICENSE files added to Docs for Togl, GLpng. Major re-implementation of the Makefiles as the make 'include' directive seems to be fairly globally available, so all the Makefiles now include ../generic.mk. Control-C now just causes the error message to occur on stderr, as the reentrant call into Tcl when interrupted in Sasami causes Tcl to crash. Also now using a timer (like the beep timer) for control-c: previously, control-c could only be pressed once during a session - the second interrupt killed tkeden. Now tkeden can be killed by interrupting twice within three seconds - if the interval is longer than three seconds, the warning message appears again. main.c: checkRunSet unified multiple TTYEDEN, DISTRIB etc versions into one piece of code. Run time behaviour of the versions may change slightly as a result - hopefully for the better. Pressing the interrupt button now gives a visual indication of the press. The VMEXEC machine now stops executing if the interrupt button was pressed (so it should be easier to stop tkeden if it is stuck in a tight loop). Wrote a Tcl_EvalEC function to evaluate Tcl code and do an error check on the result. Actually uses Tcl_EvalEx which should speed things up slightly. Bug fixed: definition of a TEXTBOX in Scout would show up as UNKNOWN in the View Scout window and in a Scout query ? operation. Added 'bitand' and 'bitor' infix operators to Eden: same syntax as the eager 'and' and 'or' operators, but they give the bitwise result. Added sensitive: ENTER and sensitive: LEAVE functionality for Chris. OFF, ON, MOTION, ENTER and LEAVE are now pre-defined Scout symbols: combine them by adding, eg: 'sensitive: ON + ENTER'. ** Rel1.12 ** Fixed a bug with back-ticks ``. A change that Patrick introduced made back-ticks evaluate at first definition, even if autocalc was off, causing possible undefined function errors etc (unfortunate as the View Eden Definitions etc show definitions first, then functions). Also the code had a confusing and unnecessary * pointer dereference - fixed. Got Tcl to sort the list given in File -> Include (finally). Added index_range_error Eden integer value. It works in a similar way to `autocalc'. If the value is 1 (as it is by default), then Eden's behaviour is as previously: it gives an error "index error: out of range" when asked to evaluate a reference into a string or list which is out of range. Setting index_range_error to 0 causes Eden to simply return @ and give no error instead. Added an Edit menu with Previous and Clear options. Added key short cuts for windows opened with OpenDisplay (so you can now remove the annoying default scout window using the keyboard only if you don't want it). Now keeping three backups of ~/.tkeden-history (as people don't seem to look at this file after a crash until they've restarted tkeden a few times). ** Rel1.11 ** Added GPL license and changed existing CHANGES.TXT to add this Removed 'doubling stack allocation' experiment which never should have really found it's way into a release 'cos it didn't work. Added changes required to tkeden/Makefile.in and configure.in in order to be able to build on my Sparc 2 at home (Solaris 7 + some GNU things). Improved build documentation - removed very outdated INSTALL document, replaced with a document describing requirements and build process. ** Wed Nov 15 16:40:41 GMT 2000 Rel1.10 ** About to create a tarball for import into SourceForge. Will leave the RCS information around in the hope that they can import it into CVS, but remove all generated files and also the stuff in the Windows dir that isn't part of Eden source. Also it looks like it is difficult to rename directories etc in CVS so lib-tkeden1.9 will become lib-tkeden. Reworked this CHANGE.LOG into reverse chronological order. ** Wednesday October 11 17:55:40 BST 2000 Rel1.9 ** Minor changes to documentation in Windows/run.bat and TODO Had been experimenting to try and get something like cat - | arca.trans | tkeden to work (ie tkeden reads commands from stdin whilst running all other stuff simultaneously). Ran into problems with buffering in pipes, so the kbhit() function I added is now ifdef'd out. ** Sunday September 3 21:49:19 BST 2000 Rel1.8 ** Added comment to scout.init.e about using Tcl to do trivial ImageScale-ing. Copied $PUBLIC/lib/tkeden/nArca.init.e into the lib directory as arca.lib, and added revision control header as arca seems to be considered more "mainstream" than I thought. Sorted out Docs/TODO a lot. windist target strips the executable now - this makes it all fit onto one floppy :) ** Thursday August 31 18:57:44 BST 2000 Rel1.7 ** Found a copy of config.guess and config.sub from /dcs/rap/mp3/cdparanoia/cdparanoia-III-alpha9.7/ as the GNU CVS site is down. This seems to be required now that locally, autoconf seems to have been "upgraded" to 2.14a (and the older version has been removed). Directory structure cleaned up a little: Docs and Windows subdirectories introduced, README.TXT in the main directory. (Rel1.7 released, but again in a minute) config.sub wasn't recent enough to work on Cygwin. Found more recent copies in /package/gap4r2/cnf. Copied some of Ben C's support files into the Windows subdirectory... Glpng etc. Fixing bugs to do with configur-ating Sasami Merging in Ben C's changes to the Tcl code Put some of the info from Ben C's Readme into the Windows directory. (Rel1.7 released, but again in a minute) Added a windist target to the main Makefile and wrote a run.bat script that detects whether tkeden is in the current directory or not. Added more directories to the setrcsstate target in main Makefile.in Removed guessLibLocation as it just doesn't work in too many circumstances. We'll have to rely on wrapper scripts etc using the -l argument. Merged in changes from BenC's Sasami version 0.6 (previously I had his version 0.3, and I'd simply left out all of the actual Sasami notation, just keeping the changes necessary to get tkeden to run on Windows. It now looks like Sasami will be considered a "standard" part of tkeden (a nicer solution would be a plug-in style thing, but we don't have the time to do this), and so I've made it optionally compiled when WANT_SASAMI is defined. Sasami only works on Windoz at present). Windows version 0.4 -> 0.6 changes: --Win32-V0.4---------------------------------------------------------------- Added support for materials (which gives full control over lighting parameters and texturing) through the "material" object type. Linked in the glPNG library for loading PNG files as textures. This means that Sasami now needs the glPNG libraries compiled and installed to compile correctly. glPNG can be found in the Sasami distribution (hopefully) or at http://www.wyatt100.freeserve.co.uk/download.htm . Commented out the glBindTexture/glGenTextures calls in glpng.c to avoid needing to link it with the non-existant OpenGL 1.1 library for CygWin. (note : this hack is no longer needed - see below) Added texture-mapping support, with auto-generation of texture co-ordinates if they aren't provided, and support for using texture binding to prevent texture-thrashing. Built the "Rubik's cube" example script. Increased the default ambient lighting a bit so objects no longer appear 100% black when not facing the light source. Built a new libopengl32.a based on MSVCs one, which includes the 1.1 functions - most notably glGenTextures and glBindTexture, which are used by the texture-mapping code. This fixes the problems with OpenGL implementations which don't export these via wglGetProcAddress (such as the MS and SGI software implementations), and means that a custom build of glPNG is no longer required. Packaged up the Sasami examples in a slightly more convienient directory. First "public" release version --Win32-V0.5---------------------------------------------------------------- Rewrote the Sasami parser to cope with variable number of parameters in notations, and altered various functions to take advantage of this - mainly by allowing multiple vertices/polys/etc to be specified in one call. Added commas to the list of things the parser considers seperators, allowing for scripts to use (easier to read in some circumstances) comma seperated notation. Fixed a stupid bug where the whole parsed string was converted to lowercase, including variable names - effectively preventing Sasami from reading Eden variables whose names contained uppercase characters! Fixed a *very* nasty bug where texture loading and rendering could take place before OpenGL was initialised, resulting in an instant crash...! Implemented a parser for Lightwave format .OBJ and .MTL files, converting them to Sasami code on-the-fly (and hence into Sasami objects). Reenginnered billiards model to give a 3D display. --Win32-V0.6---------------------------------------------------------------- Added better Windows message handling - Sasami now responds correctly to window actions when Eden is blocking the main thread (eg : "while (1) eager();"). Built animation sample (animate.s) to demonstation time-delta-based animation loops. Fixed a bug that caused textures to be lost when the viewport was resized. Added support for user-definable lighting. Fixed user-definable lighting to work properly, and added sa_r_maxlights to reflect the number of OpenGL-accelerated lights available. Finished up support for alpha-transparency, and wrote glass.s sample to demonstrate it. Altered default lighting so that models are reasonably evenly lit. Altered "load_obj" command so that by default it only loads the object and material definations as Eden declarations, and added "load_full_obj" command which loads everything (the previous behaviour). Fixed a stupid glFrustrum typo that was causing the far clip plane to be ridiculously close, and objects to appear to be microscopic in size (perspective-wise)! Fixed a bug in the OBJ loader that prevented objects with co-ordinates specified with exponents from being loaded correctly. Edited animate.s sample to use todo() instead of eager() so that it doesn't block Eden from executing user input. Added visible flag to objects. ** Monday April 3 20:18:06 BST 2000 Rel1.6: onto new Dell PC, Windoz again, with merged in changes (and again a few mins later) And into $PUBLIC/bin ** Fixed silly bug in Scout/Makefile.in that caused Scout to fail to recover from parse errors. (bug15) Increased size of a buffer that was being overwritten by Patrick's code (bug16) in the SIT! model. Fixes made on the new PC for Windoz: o -X11 doesn't work on Windoz: need -lGDI32 -lUSER32 -lCOMDLG32 -lOPENGL32 -lKERNEL32 instead o Eden/main.c libgen.h not on Windoz. dirname does not exist. Commented out - will have to manually provide the location with -l. o Misc/custom.h needs the __WIN32__ declaration o EX/disp.c different fontHeight etc required on Windoz - replaced Ben's nominal values libLocation error message added if not set. winportextras files (.dlls, run.bat etc) added to the distribution. ** Thursday March 23 16:18:11 GMT 2000 Rel1.5: onto new Dell PC, Windoz ** tkeden prompt changed to show the current VA. Installed at DCS. Version number not updated. bug10 (railway accident server seg fault) fixed in my copy scout.init.e updated: Tcl bound events now all redefine symbols with a "~" prepended in an attempt to avoid problems with the current VA setting. Need to update DCS copy bug11 (timetable @ screen seg fault) fixed in my copy Added a new function, symboltext() for Chris. Need to document. Attempted to make stack resize dynamically. Fixed readline prompt problem by making readline print the prompt (previously it was done by Eden and would fail to be reprinted for example on a Ctrl-U). ** Fri Jan 14 15:27:40 GMT 2000 Rel1.4: into $PUBLIC ** o A copyright notice in the about dialogue o Get rid of HOSTNAME env variable o Change use of CHAR to something else to prevent clashes with Windoz header files (says Ben) o `@` now gives @, not an "expecting string" error. o Get ttyeden to use GNU readline to enable decent editing. o Merged in Ben's changes, as follows: You need to set up the PUBLIC variable with something like "export PUBLIC=/programs/eden". Also, set TCL_LIBRARY=/cygwin/cygwin-b20/share/tcl8.0. --Win32-V0.1---------------------------------------------------------------- Modified : configure makefile.in eden\builtin.c eden\eden.h ex\disp.c ex\disp.h misc\customlib.h donald\tree.h Initial Win32 port. Not much works! --Win32-V0.2----------------------------------------------------------------- Modified : tkeden\configure tkeden\ex\disp.c tkeden\ex\ex.c tkeden\version.h lib\tkeden\edenio.tcl tkeden\ex\win32ex.c tkeden\ex\win32ex.h tkeden\ex\makefile.in Implemented "hacked" versions of FontWidth & FontHeight. Altered configure script to link in Windows GDI functions. Implemented native DisplayDepth() function. Implemented slightly dodgy version of StringWidth. RoomViewer now works (FontWidth/FontHeight problems), albeit with misaligned text. Added Win32 version numbering to version.h. Added Win32 version number message to Help->About window. Removed the focus-follows-mouse flag when running on Windows, as this is not normal Windows behaviour and will only confuse/annoy users! Added win32ex files to EX to hold Windows GUI functions. Rewrote the File->Include code to use a standard Windows dialog. Rewrote the File->Save code to use a standard Windows dialog. --Win32-V0.3----------------------------------------------------------------- Modified : tkeden\version.h tkeden\ex\parser.c tkeden\eden\notation.h tkeden\ex\lex.c tkeden\ex\script.c tkeden\sasami\* tkeden\makefile.in tkeden\configure tkeden\* , pretty much! :-( Added hooks to allow Sasami code to be entered and parsed. Created modified lexer/parser based on Donald code. Dumped Donald lexer/parser as it's way too complex. Wrote parser for Sasami code. Added Sasami OpenGL rendering code. Added Sasami functions to builtin.c for reading back changes to data. Sasami vertex rendering now works. Fixed up some structural bugs and implemented polygon rendering. Added auto-normal generation so OpenGL lighting works. Fixed crash-on-shutdown bug due to not destroying WGL context correctly. Fixed support for comments in Sasami Added object handling code, and modelview matrix logic for objects Moved variables like background colour to be "true" Eden variables rather than function calls. Fixed lazy-creation of certain objects causing crashes if the object was used before any parameters set. Added "`" notation for passing code to Eden. Added the ability to change viewport resolution from Eden, and to toggle the axes indicators. Created a simple morphing object demo. ** Mon Nov 8 21:54:31 GMT 1999 Rel1.3: to take home with me! ** o Investigated with tcl/tk 8.2.0 (was previously using tcl/tk 8.0). Fixed environment variable handling. Now OK. o Makefile should mark lib files with version number o configure: don't stop compilation if we don't have tcl/tk o Error message "unexpected end-of-file in chararcter constant" !! ** Wed Nov 3 16:16:12 GMT 1999 Rel1.2: bug fixes to 1.1. Ooops - didn't mean to increment the version no. ** o Bug fix: myttyeden, s=0;s=1l; - seg fault. Not in ttyeden Investigated, and found only in wierd set of circumstances - ignore. o Error message "type clash: expectingint" !! o Error message "no such variable ash ...called by" o Error message "func/proc needed ...while executing" o bug7 at ITS Same as above - found it happened lots at ITS. Worked around. ** Wed Nov 3 13:51:59 GMT 1999 Rel1.1: installed at ITS under ~cssbz for CS233 experiments with Eddi ** o $PUBLIC. Could eliminate by using dirname(argv[0]) or similar. However, Eden support code uses it. Could rewrite Eden support code, but other Eden code might assume it. Perhaps could detect with this procedure, then set the variable once the tkeden process has started. However - this looses us flexibility - cannot set PUBLIC to somewhere else deliberately. Perhaps could allow an override with a command line option. Would this solve more problems than it causes (esp wrt the Windoz port?). Perhaps change to EM_PUBLIC whilst about it. Or set EM_PUBLIC in a wrapper around tkeden etc... then users don't need to keep modifying their setup. Or maybe EM_LIB would be more appropriate. Wrapper script should set the variable if it is not already set to allow overriding. Or perhaps lib files should be in a subdirectory of dirname, including the tkeden version number to allow installation of multiple versions. o Provide a way to override the library files detection result o Rewrote emalloc etc as macros and other stuff to enable dmalloc to give sensible reports o Fix the Scout memory leak that Simon found: bug5 o Redid COPYING file. Couldn't reproduce: o Fix the Tcl bug that Simon found: OXO demo "Tcl errors occur when you shut the model down with the clock (animation) still running." o Copy and paste problems on UNIX. A Tcl problem. Don't move the mouse whilst you click the middle button. ** (about) Fri Oct 8 20:13:02 1999 Rel1.0: to Ben Carter for OpenGL expts ** o These changes made by Ashley Ward. o Throw away Imake stuff, start again with autoconf. o Merge in Patrick's dtkeden changes o Put unused code in Attic. Also their RCS files o Fix ttyeden on Linux (rethink linking to curses?) o Remove -R and -ldl from linking on Linux. Also need -I/usr/include/ncurses. Also need -lncurses, not -lcurses o Move Attic directories into one directory, possibly out of the source distribution o Fix curses stuff - try with ncurses_g? o Check through error messages etc output from tkeden - fix for good English :) o Check for PUBLIC being set - if unset, crashes with seg fault on ARML. o Check what happens when DISPLAY is not set or xhost problem - falls over nicely? o "...near line " could do with some more description of the line. o Compile with optimisation (gcc -O2, cc -xO2 + change the number) o Move Imakefiles into Attic o Remove unnecessary gunk from start of Makefile.ins - install eg o Can ttyeden do donald and scout? If not, remove the code from the link... o Remove UNIX command dependencies: 'ls' in file handling o dtkeden has a new TEXTBOX functionality - document! o Need a dynamic buf in type.c, t_str to prevent overflow and Seg fault when converting long lists to strings. o Do we have a Y2K problem, with the results from gettime(), time(), ftime()? o Eden gettime() uses C-lib time() and C-lib localtime(), the year result of which is years since 1900. So applications, currently receiving the number 99, will receive the number 100 next year. So OK. o Eden time() is basically a call to C-lib time(), so OK. o Eden ftime() is basically a call to C-lib gettimeofday(), so OK. o A -v option to show the current version (of tk and tty eden) o Help -> About Tkeden to show version number. Perhaps also print it on stdout when started up. (no!). Perhaps also show $tcl_version. o Remove RCS Log header o Make sure all the code has a static RCS Id header so we can use strings on the executable. o Move lib/bison into the source directory. Remove the sym links. o Fixed the Segmentation fault found when running the dtkeden railway demo o Tcl error messages seem to be swallowed and replaced with less helpful ones. See especially the definition of tcl() - whereever that is... o Rewrote curses linkage to remove SunOS dependencies o Added a new hook: _tkeden_showxoutput = 1; shows xoutput tcl output And now some ancient history... ** September 3 1999 ** o tkeden.S and tkeden.C merged into one dtkeden version with a command argument -s(superagent)|-a(agent). o -h command argument added ** December 15 1997 ** o Unknown changes ** December 9 1997 ** o tkeden.S and tkeden.C (server and client) variants created by Patrick Sun, later to be called dtkeden, created from the tkeden source. o -c command argument added. o This version must be run on gem (as gem is hard-coded as the host). ** September 26 1997 ** o Two versions of tkeden compiled for DCS, possibly by Richard Cartwright, it looks like one for 'sun5' (tkeden-sep2619972) and one other (tkeden-sep261997). ** October 28 1996 ** o A version of tkeden compiled for DCS (by Simon Yung?). ** June 20 1996 ** o A version of ttyeden compiled for DCS (by Simon Yung?) on SunOS? ** February 27 1996 ** o Last RCS check-in made by Simon Yung? ** July 7 1995 ** o First RCS check-in made by Simon Yung? up the PUBLIC variable with something like "export PUBLIC=/programs/eden". Also, set TCL_LIBRARY=/cygwin/cygwin-b20/share/tcl8.0. --Win32-V0.1---------------------------------------------------------------- Modified : configure makefitkeden1.41/lib-tkeden/client.tcl010064400025250000164000000152100733204162300166210ustar00ashleyem00003510000005# # $Id: client.tcl,v 1.6 2001/08/01 17:59:47 cssbz Exp $ # # Just the client specific bits of tcl. This is sourced when appropriate # from edenio.tcl [Ash] # Client-Server & Socket # display the message of client connection on client window # read script line-by-line sent by the server from socket and # evoke eden evaluation proc read_sock {sock} { global receiveScripts EOF esvrSock global EOS ECS serverReply variantversion set lineScript [gets $sock] set lineScript [string trimright $lineScript] if {[eof $sock]} { close $sock set esvrSock "" tk_dialog .message "$variantversion: Network Message" \ "The dtkeden server has been shut down and the connection has been closed." \ warning 0 OK # puts "Connection is closed..." } else { if {$lineScript == $ECS} { incr serverReply return } if {$lineScript == $EOF || $lineScript == $EOS} { appendHist $receiveScripts # set receiveScripts "ScoutWinTrigged = 0;\n$receiveScripts\n" set receiveScripts "$receiveScripts\n" evaluate $receiveScripts if {$lineScript == $EOS} { #puts $esvrSock $EOS sendServer $EOS } set receiveScripts "" } else { set receiveScripts "$receiveScripts\n$lineScript" } } } proc sendUsrName {} { global usrName EOU getUsrName variantversion _tkeden_version set getUsrName 1 sendServer1 "$EOU" set variantversion "dtkeden $_tkeden_version (client:$usrName)" wm title . "$variantversion: Input" } proc loginUsrName {} { global esport eshost variantversion toplevel .login wm title .login "$variantversion: Login" label .login.mess -text "You have connected to the dtkeden server \n\ with channel <[expr $esport-9000]>\ on host <$eshost>.\n\ Please login with your agent name" entry .login.usrName -relief sunken -textvariable usrName pack .login.mess .login.usrName -side top -padx 1m -pady 2m button .login.ok -text "OK" -command { if {[string trim $usrName] != ""} { sendUsrName; destroy .login } else { bell } } # button .login.cancel -text "Cancel" -command { notLogin; destroy .login } button .login.clear -text "Clear" -command { set usrName ""; focus .login.usrName } pack .login.ok .login.clear -side left -expand 1 bind .login.usrName { sendUsrName; destroy .login } focus .login.usrName grab .login } proc setupSocket {} { global usrName getUsrName global esvrSock eshost esport variantversion puts "$variantversion: connecting to dtkeden server channel <[expr $esport-9000]> on host <$eshost>..." # this is a synchronous connection: # The command does not return until the server responds to the # connection request set errCode [catch {set esvrSock [socket $eshost $esport]} string] # puts $errCode # Setup monitoring on the socket so that when there is data to be # read the proc "read_sock" is called if {$errCode == 0 } { # puts "You are connected to tkServer in 'gem'...\n" fileevent $esvrSock readable [list read_sock $esvrSock] # configure channel modes # ensure the socket is line buffered so we can get a line of text # at a time (Cos thats what the server expects)... # Depending on your needs you may also want this unbuffered so # you don't block in reading a chunk larger than has been fed # into the socket # i.e fconfigure $esvrSock -blocking off fconfigure $esvrSock -buffering line -translation {crlf crlf} # set up our keyboard read event handler: # Vector stdin data to the socket #fileevent stdin readable [list read_stdin $esvrSock] # message indicating connection accepted and we're ready to go # wait for and handle either socket or stdin events... #vwait eventLoop if {$usrName == "" } { loginUsrName } else { sendUsrName } vwait getUsrName } else { puts "Fail to connect dtkeden server channel <[expr $esport-9000]> on host <$eshost>." puts "Using dtkeden as a stand-alone environment" .radios.send config -state disabled bell } } # read scripts from tkeden input window and send them to server set sendServerDebug 0 proc sendServer { text } { global EOF ECS synchronize serverReply sendServerDebug # don't change synchronize which comes from ../Eden/main.client.c if ($sendServerDebug) { puts "sendServerDebug: sendServer1" } if {$synchronize > 0} { while {$serverReply < 0} { vwait serverReply } } if ($sendServerDebug) { puts "sendServerDebug: sendServer2" } if {$synchronize > 0} { set text "$text\n$ECS" } else { set text "$text\n$EOF" } if ($sendServerDebug) { puts "sendServerDebug: sendServer3" } sendServer1 $text } proc sendServer1 {text} { global esvrSock usrName EOF currentNotation global synchronize serverReply sendServerDebug if ($sendServerDebug) { puts "sendServerDebug: sendServer4" } set isCancel -1 set text "$text$usrName" if {$esvrSock == "" } { set isCancel [connectServer] } if {$isCancel == "0"} return if {$esvrSock != ""} { # set errCode [catch {.menu.accept invoke} string] ; # may need to handle error control??? # puts "text $text" set errCode -1 while {$errCode !=0} { getCurrentNotation # cannot change currentNotation below. It comes from EX/Exinit() set errCode [catch {puts $esvrSock "$currentNotation\n$text"} string] if {$errCode != 0} { set isCancel [connectServer] if {$isCancel == "0"} break } } if {$synchronize > 0} { incr serverReply -1 while {$serverReply < 0} { vwait serverReply } } } } proc connectServer {} { global esvrSock variantversion set selectButton -1 while { $selectButton != 0 } { set selectButton [tk_dialog .message "$variantversion: Connection Failed" \ "Cannot connect to server" warning 0 Cancel Retry ] if {$selectButton == "1"} { set esvrSock "" setupSocket if {$esvrSock != ""} break } } return $selectButton } set EOF "@#$%EOF%$#@" set EOU "@#$%EOU%$#@" set EOS "@#$%EOS%$#@" set ECS "@#$%ECS%$#@" set serverReply 0 set receiveScripts "" set usrName "" set getUsrName 0 #set eshost "gem" #set esport 7000 #puts "eshost $eshost esport $esport" set esvrSock "" setupSocket tkeden1.41/lib-tkeden/credits.txt010064400025250000164000000056210743772142600170560ustar00ashleyem00003510000005Eden: the Evaluator of DEfinitive Notations Copyright (c) 1995-2001 The University of TV. All rights reserved. Authors: Edward Yun Wai Yung (Eden) Simon Yun Pui Yung (tkeden) Pi-Hwa (Patrick) Sun (dtkeden) Richard Cartwright (initial work on PC port, bug fixes etc) Amanda Wright (initial work on PC port) Ben Carter (Sasami on PC, finishing PC port) Chris Brown (Observation-oriented parser) Ashley Ward (rationalisation, new auto-configure system, Sasami on UNIX, bug fixes, CVS, interface improvements, Mac OS port, teeth gnashing...) Certain variants of Eden use some of these libraries: Tcl/Tk http://tcl.activestate.com cygwin http://www.cygwin.com readline http://cnswww.cns.cwru.edu/~chet/readline/rltop.html Togl http://togl.sourceforge.net/ GLpng http://www.wyatt100.freeserve.co.uk/download.htm libpng http://www.libpng.org/pub/png libz http://www.zlib.org/ ncurses http://www.clark.net/pub/dickey/ncurses/ncurses.html Tk Img package http://members1.chello.nl/~j.nijtmans/img.html This software is provided "as is", and no warranty, express or implied, is given. Neither the author nor the University of TV takes any responsibility whatsoever for any use or misuse of this software, or any damage created by its use or misuse. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. Permission to use, copy, modify, and distribute this software and documentation for non-commercial purposes and without fee is hereby granted, provided that the University of TV copyright notices and this permission notice appear in all copies. Neither the author nor The University of TV makes any representations about the suitability of this software and documentation for any purpose. It is provided ``as is'' without express or implied warranty. Commercial use of this software requires specific permission from the University of TV; contact the Empirical Modelling project through the web pages at http://www.dcs.warwick.ac.uk/modelling/ or by snail mail at The Empirical Modelling Project, Department of Computer Science, University of TV, Coventry, CV4 7AL, UK for further information. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA tkeden1.41/lib-tkeden/CVS/004074400025250000164000000000000744001222200152655ustar00ashleyem00003510000005tkeden1.41/lib-tkeden/CVS/Entries010064400025250000164000000012550744001222200166230ustar00ashleyem00003510000005/arca.lib/1.2/Wed Aug 1 17:58:02 2001// /client.tcl/1.6/Wed Aug 1 17:59:47 2001// /edenio.tcl/1.23/Wed Feb 27 19:59:57 2002// /keys.txt/1.1/Wed Aug 1 17:57:07 2001// /sasami.txt/1.1/Wed Aug 1 17:57:07 2001// /scout.eden/1.1/Wed Feb 27 16:27:43 2002// /scout.txt/1.2/Tue Feb 19 14:48:54 2002// /server.tcl/1.5/Wed Aug 1 18:00:40 2001// /trans.eden/1.1/Wed Feb 27 16:28:29 2002// /eddi.eden/1.1/Thu Feb 28 14:15:28 2002// /credits.txt/1.3/Fri Mar 1 15:49:42 2002// /donald.eden/1.2/Fri Mar 1 23:50:51 2002// /donald.txt/1.3/Fri Mar 1 18:37:29 2002// /eden.eden/1.2/Fri Mar 1 23:52:06 2002// /eden.txt/1.6/Fri Mar 1 22:05:55 2002// /change.log/1.12/Fri Mar 1 23:31:36 2002// D tkeden1.41/lib-tkeden/CVS/Repository010064400025250000164000000000220743723741500174030ustar00ashleyem00003510000005tkeden/lib-tkeden tkeden1.41/lib-tkeden/CVS/Root010064400025250000164000000000550743723741500161550ustar00ashleyem00003510000005cssbz@cvs.eden.sourceforge.net:/cvsroot/eden tkeden1.41/lib-tkeden/donald.eden010064400025250000164000001034050745661243100167510ustar00ashleyem00003510000005/* * $Id: donald.eden,v 1.2 2002/03/01 23:50:51 cssbz Exp $ */ /* --- SPECIFICATION FOR OPERATORS AND INITIALIZE GRAPHICS --- */ setbuf(stdout, 0); OFF = 0; ON = 1; FALSE = 0; TRUE = 1; NullStr = ""; NullList = []; /* PI = 3.141593; */ /* TYPE = 1; X = 2; Y = 3; P1 = 2; P2 = 3; P3 = 4; CENTRE = 2; RADIUS = 3; TEXT = 2; */ INF = '!'; /* [ INF ] */ /* INT = 'I'; /* [ INT, I ] */ */ REAL = 'R'; /* [ REAL, ??? ] */ CHAR = 'W'; /* [ CHAR, ??? ] */ BOOLEAN = 'B'; /* [ BOOLEAN, B ] */ CART = 'C'; /* [ CART, X, Y ] */ POLAR = 'P'; /* [ POLAR, R, A ] */ LINE = 'L'; /* [ LINE, P1, P2 ] */ ARC = 'U'; /* [ ARC, P1, P2, R ] */ CIRCLE = 'E'; /* [ CIRCLE, P, R] */ RECTANGLE = 'G'; /* [ RECTANGLE, P1, P2] */ ELLIPSE = 'Q'; /* [ ELLIPSE, P, P, P ] */ LABEL = 'T'; /* [ LABEL, W, P ] */ SHAPE = 'S'; /* [ SHAPE, ??? ] */ OPENSHAPE = 'O'; /* [ OPENSHAPE, ... ] */ IMAGE = 'I'; /* [ IMAGE, W, P ] */ /* MONITOR = 'M'; /* [ MONITOR, B, ...] */ IMPOSE = 'I'; /* [ IMPOSE, I ] */ */ if (tcl("set tk_version") < "8.3") { dashedopt = ""; dottedopt = ""; } else { dashedopt = " -dash {_}"; dottedopt = " -dash {.}"; } /* check for ill-defined value argument: list return: @ if the list is @ 1 if all terms are well-defined 0 if partly undefined */ func idv { para d; auto i; if (d == @) return 1; if (type(d) != "list") return 0; for (i = d#; i > 0; --i) { if (idv(d[i])) return 1; } return 0; } /* real to string conversion using sprintf(), see sprintf(3) for format spec */ func rtos { para r, format; auto s; s = substr("", 1, 255); /* create a 255-char long string */ sprintf(s, "%"//format, r); if (s# > 255) { error("rtos: goofed up with memory allocation"); } return s; } func DD_random { if (type($1) == "int") { return rand() % $1; } else { return rand() * $1 / 2147483647; } } /* POINT */ func cart { return [CART, $1, $2]; /* [ CART, X, Y ] */ } /* POINT */ func polar { return [POLAR, $1, $2]; /* [ POLAR, R, A ] */ } /* LINE */ func line { return [LINE, $1, $2]; /* [ LINE, P1, P2 ] */ } /* ARC */ func arc { return [ARC, $1, $2, $3]; /* [ LINE, P1, P2, ANGLE ] */ } /* CIRCLE */ func circle { return [CIRCLE, $1, $2]; /* [ CIRCLE, P, R] */ } /* RECTANGLE */ func rectangle { return [RECTANGLE, $1, $2]; /* [ RECTANGLE, P1, P2] */ } /* ELLIPSE */ func ellipse { return [ELLIPSE, $1, $2, $3]; /* [ ELLIPSE, P, P, P] */ } /* LABEL */ func image /* CHAR $1; POINT $2; */ { return [IMAGE, $1, $2]; /* [ IMAGE, T, P] */ } /* LABEL */ func label /* CHAR $1; POINT $2; */ { return [LABEL, $1, $2]; /* [ LABEL, T, P] */ } /* /* MONITOR */ func monitor { return [MONITOR, $2, $1, $3]; /* [ MONITOR, mesg1, bool, mesg2 ] */ } */ /* SHAPE */ /* Takes a list of pointers (an OPENSHAPE) and dereferences each item recursively. Thus translating ["O", &t, &v] into ["S", t, v] [Ash] */ func open2shape { para openShape; auto shape, entity, i; if (openShape == @) return @; if (openShape[1] != 'O') error("open2shape given " // openShape[1] // " type and not an openshape"); shape = [SHAPE]; for (i = 2; i <= openShape#; i++) { entity = *(openShape[i]); if (type(entity) == "list") if (entity[1] == 'O') shape = shape // [open2shape(entity)]; else shape = shape // [entity]; } return shape; } /* POINT */ func intersect { para line1, line2; auto a1, a2, b1, b2, c1, c2, s, t; if (idv(line1) || idv(line2)) return @; a1 = line1[3][3] - line1[2][3]; /* implicit eqn */ b1 = line1[2][2] - line1[3][2]; /* of line line1 */ c1 = line1[2][3] * line1[3][2] - line1[3][3] * line1[2][2]; a2 = line2[3][3] - line2[2][3]; /* implicit eqn */ b2 = line2[2][2] - line2[3][2]; /* of line line2 */ c2 = line2[2][3] * line2[3][2] - line2[3][3] * line2[2][2]; if (a1 * b2 == a2 * b1) writeln("intersect(): Can't happen on parallel lines"); else { /* find intersection of lines */ s = (b1 * c2 - b2 * c1) / (a1 * b2 - a2 * b1); t = (c1 * a2 - c2 * a1) / (a1 * b2 - a2 * b1); return [CART, s, t]; } } /* LINE */ func parallel { para line, point, alpha, beta; auto a1, a2, b1, b2, m; if (idv(line) || idv(point) || alpha == @ || beta == @) return @; alpha = float(alpha); /* make sure it is real number */ beta = float(beta); /* vert and horiz lines have no gradient */ /* parallel lines have the same gradient */ m = (line[2][2] == line[3][2] || line[2][3] == line[3][3]) ? 0.0 : float(line[3][3] - line[2][3] / line[3][2] - line[2][2]); if (line[2][2] == line[3][2]) { /* line is vertical */ b1 = point[3] - alpha; b2 = point[3] + beta; if (m == 0) a1 = a2 = float(point[2]); else { a1 = (b1 - point[3]) / m + point[2]; a2 = (b2 - point[3]) / m + point[2]; } } else { /* line is horizontal or other */ a1 = point[2] - alpha; b1 = (a1 - point[2]) * m + point[3]; a2 = point[2] + beta; b2 = (a2 - point[2]) * m + point[3]; } return [LINE, [CART, a1, b1], [CART, a2, b2]]; } /* LINE */ func perpend { para point, line; auto a1, a2, b1, b2, c1, c2, x, y; if (idv(point) || idv(line)) return @; /* implicit eqn of point $1 */ a1 = float(line[2][2] - line[3][2]); b1 = float(line[2][3] - line[3][3]); c1 = -a1 * point[2] - b1 * point[3]; /* implicit eqn of line $2 */ a2 = float(line[3][3] - line[2][3]); b2 = float(line[2][2] - line[3][2]); c2 = float(line[2][3] * line[3][2] - line[3][3] * line[2][2]); /* find perpendicular */ x = (b1 * c2 - b2 * c1) / (a1 * b2 - a2 * b1); y = (c1 * a2 - c2 * a1) / (a1 * b2 - a2 * b1); return [LINE, point, [CART, x, y]]; } /* REAL */ func dist /* POINT(LINE) $1; POINT(LINE) $2 */ { para arg1, arg2; auto a, b, c; if (idv(arg1) || idv(arg2)) return @; switch (arg1[1]) { case 'C': case 'P': if (arg1[1] == POLAR) arg1 = polar_to_cart(arg1); if (arg2[1] == POLAR) arg2 = polar_to_cart(arg2); a = (arg1[2] - arg2[2]) * (arg1[2] - arg2[2]); b = (arg1[3] - arg2[3]) * (arg1[3] - arg2[3]); return sqrt(float(a + b)); case 'L': if (arg1[2][1] == POLAR) arg1[2] = polar_to_cart(arg1[2]); if (arg1[3][1] == POLAR) arg1[3] = polar_to_cart(arg1[3]); if (arg2[2][1] == POLAR) arg2[2] = polar_to_cart(arg2[2]); if (arg2[3][1] == POLAR) arg2[3] = polar_to_cart(arg2[3]); a = arg1[3][3] - arg1[2][3]; b = arg1[3][2] - arg1[2][2]; c = arg1[2][3] * arg2[2][2] - arg1[3][3] * arg1[2][2]; return sqrt(float(a * arg2[2] + b * arg2[3] + c)) * (a * arg2[2] + b * arg2[3] + c) / (a * a + b * b); } } /* POINT */ func midpoint { para line; auto s, t; if (idv(line)) return @; if (line[2][1] == POLAR) line[2] = polar_to_cart(line[2]); if (line[3][1] == POLAR) line[3] = polar_to_cart(line[3]); s = (line[2][2] + line[3][2]) / 2.0; t = (line[2][3] + line[3][3]) / 2.0; return [CART, s, t]; } /* ENTITY */ func trans { para entity, x, y; auto point, i; if (idv(entity) || x == @ || y == @) return @; point = [CART, x, y]; switch (entity[1]) { case 'C': case 'P': return vector_add(entity, point); case 'R': writeln("trans(): Can't happen on ", entity[1]); break; case 'L': return [LINE, vector_add(entity[2], point), vector_add(entity[3], point)]; case 'U': return [ARC, vector_add(entity[2], point), vector_add(entity[3], point), entity[4]]; case 'E': return [CIRCLE, vector_add(entity[2], point), entity[3]]; case 'G': return [RECTANGLE, vector_add(entity[2], point), vector_add(entity[3], point)]; case 'Q' : return[ELLIPSE, vector_add(entity[2],point), vector_add(entity[3],point), vector_add(entity[4],point)]; case 'L': /* 3D line ? */ return [LINE, vector_add(entity[2], point), vector_add(entity[3], point), vector_add(entity[4], point)]; case 'O': entity = open2shape(entity); case 'S': for (i = 2; i <= entity#; i++) entity[i] = trans(entity[i], x, y); return entity; case 'T': return [LABEL, entity[2], vector_add(entity[3], point)]; case 'I': return [IMAGE, entity[2], vector_add(entity[3], point)]; } } /* ENTITY */ func rot { para entity, point, angle; auto i, s, t, dx, dy, center; auto s1, t1, s2, t2; if (idv(entity) || idv(point) || angle == @) return @; angle = float(angle); switch (entity[1]) { case 'C': case 'P': if (entity[1] == POLAR) entity = polar_to_cart(entity); if (point[1] == POLAR) point = polar_to_cart(point); dx = entity[2] - point[2]; dy = entity[3] - point[3]; s = dx * cos(angle) - dy * sin(angle) + point[2]; t = dx * sin(angle) + dy * cos(angle) + point[3]; return [CART, s, t]; case 'R': writeln("rot(): Can't happen on ", entity[1]); return entity; case 'L': return [LINE, rot(entity[2], point, angle), rot(entity[3], point, angle)]; case 'U': return [ARC, rot(entity[2], point, angle), rot(entity[3], point, angle), entity[4]]; case 'E': return [CIRCLE, rot(entity[2], point, angle), entity[3]]; case 'G': return [RECTANGLE, rot(entity[2], point, angle), rot(entity[3], point, angle)]; case 'Q': return [ELLIPSE, rot(entity[2], point, angle), rot(entity[3], point, angle), rot(entity[4], point, angle)]; case 'O': entity = open2shape(entity); case 'S': for (i = 2; i <= entity#; i++) entity[i] = rot(entity[i], point, angle); return entity; case 'T': return [LABEL, entity[2], rot(entity[3], point, angle)]; case 'I': return [IMAGE, entity[2], rot(entity[3], point, angle)]; } } /* ENTITY */ func scale { para entity, factor; auto i, dx, dy, s1, s2, t1, t2, r, center; if (idv(entity) || factor == @) return @; switch (entity[1]) { case 'P': entity = polar_to_cart(entity); case 'C': return [CART, entity[2] * factor, entity[3] * factor]; case 'L' : return [LINE, scale(entity[2], factor), scale(entity[3], factor)]; case 'E' : r = entity[3] * factor; /* scale radius */ center = scale(entity[2], factor); return [CIRCLE, center, r]; case 'G' : return [RECTANGLE, scale(entity[2], factor), scale(entity[3], factor)]; /* ARC ('U') case by Chris Roe, who mentioned that this might be a fudge as it doesn't scale the arc's "bend" */ case 'U' : return [ARC, scale(entity[2], factor), scale(entity[3], factor), entity[4]]; case 'Q' : return [ELLIPSE, scale(entity[2], factor), scale(entity[3], factor), scale(entity[4], factor)]; case 'O': entity = open2shape(entity); case 'S': for (i = 2; i <= entity# ; i++) entity[i] = scale(entity[i], factor); return entity; case 'T': return [LABEL, entity[2], scale(entity[3], factor)]; case 'I': return [IMAGE, entity[2], scale(entity[3], factor)]; } } /* The reflect Eden function below is by Chris Roe. The implement-it-as-a-builtin stuff is Ash's fault. */ func reflect { para entity, line; auto i, s, t, l, px, py, center; auto s1, t1, s2, t2; if (idv(entity) || idv(line) == @) return @; switch (entity[1]) { case 'C': case 'P': if (entity[1] == POLAR) entity = polar_to_cart(entity); l = perpend([CART,entity[2],entity[3]],line); px = l[3][2]; /* intersection point of the normal and the mirror */ py = l[3][3]; /* is the point at which reflection takes place */ s = entity[2] + (2*(px-entity[2])); t = entity[3] + (2*(py-entity[3])); return [CART, s, t]; case 'R': writeln("reflect(): Can't happen on ", entity[1]); return entity; case 'L': return [LINE, reflect(entity[2], line), reflect(entity[3], line)]; case 'U': return [ARC, reflect(entity[2], line), reflect(entity[3], line), entity[4]]; case 'E': return [CIRCLE, reflect(entity[2], line), entity[3]]; case 'G': return [RECTANGLE, reflect(entity[2], line), reflect(entity[3], line)]; case 'Q': return [ELLIPSE, reflect(entity[2], line), reflect(entity[3], line), reflect(entity[4], line)]; case 'O': entity = open2shape(entity); case 'S': for (i = 2; i <= entity#; i++) entity[i] = reflect(entity[i], line); return entity; case 'T': return [LABEL, entity[2], reflect(entity[3], line)]; case 'I': return [IMAGE, entity[2], reflect(entity[3], line)]; } } /* LINE */ func line_reverse { if ($1 == @) return @; return [LINE, $1[3], $1[2]]; } /* POINT */ func dotx { para point; if (point == @) return @; point = polar_to_cart(point); return [CART, point[2], 0.0]; } /* POINT */ func doty { para point; if (point == @) return @; point = polar_to_cart(point); return [CART, 0.0, point[3]]; } func dot1 { if ($1 == @) return @; return $1[2]; } func dot2 { if ($1 == @) return @; return $1[3]; } func dotrad { if ($1 == @) return @; return cart_to_polar($1)[2]; } func dotarg { if ($1 == @) return @; return cart_to_polar($1)[3]; } func vector_add { para point1, point2; if (idv(point1) || idv(point2)) return @; if (point1[1] == POLAR) point1 = polar_to_cart(point1); if (point2[1] == POLAR) point2 = polar_to_cart(point2); return [CART, point1[2] + point2[2], point1[3] + point2[3]]; } func vector_sub { para point1, point2; if (idv(point1) || idv(point2)) return @; if (point1[1] == POLAR) point1 = polar_to_cart(point1); if (point2[1] == POLAR) point2 = polar_to_cart(point2); return [CART, point1[2] - point2[2], point1[3] - point2[3]]; } func scalar_mult { para point, value; if (idv(point) || idv(value)) return @; if (point[1] == POLAR) return [POLAR, float(point[3]) * value, point[2]]; else return [CART, float(point[2]) * value, float(point[3] * value)]; } func scalar_div { para point, value; if (idv(point) || idv(value)) return @; if (point[1] == POLAR) return [POLAR, float(point[3]) / value, point[2]]; else return [CART, float(point[2]) / value, float(point[3] / value)]; } func scalar_mod { para point, value; if (idv(point) || idv(value)) return @; if (point[1] == POLAR) return [POLAR, int(point[3]) % int(value), point[2]]; else return [CART, int(point[2]) % int(value), int(point[3]) % int(value)]; } /* ----- BOOLEAN CONDITIONS ----- */ /* BOOLEAN */ func pt_betwn_pts { para point1, point2, point3; if (idv(point1) || idv(point2) || idv(point3)) return @; if (point1[1] == POLAR) point1 = polar_to_cart(point1); if (point2[1] == POLAR) point2 = polar_to_cart(point2); return ( (point1[2] <= point2[2] && point2[2] <= point3[2]) || (point1[2] >= point2[2] && point2[2] >= point3[2]) ) && ( (point1[3] <= point2[3] && point2[3] <= point3[3]) || (point1[3] >= point2[3] && point2[3] >= point3[3]) ) ; } /* BOOLEAN */ func colinear { para point1, point2, point3; auto dab, dbc, dac; if (idv(point1) || idv(point2) || idv(point3)) return @; dab = dist(point1, point2); dbc = dist(point2, point3); dac = dist(point1, point3); return dab == dbc + dac || dac == dab + dbc || dbc == dab + dac; } /* BOOLEAN */ func intersects { para line1, line2; auto a1, a2, b1, b2, c1, c2, s, t; if (idv(line1) || idv(line2)) return @; a1 = float(line1[3][3] - line1[2][3]); /* implicit eqn */ b1 = float(line1[2][2] - line1[3][2]); /* of line1 */ c1 = float(line1[2][3] * line1[3][2] - line1[3][3] * line1[2][2]); a2 = float(line2[3][3] - line2[2][3]); /* implicit eqn */ b2 = float(line2[2][2] - line2[3][2]); /* of line2 */ c2 = float(line2[2][3] * line2[3][2] - line2[3][3] * line2[2][2]); if (a1 * b2 == a2 * b1) { writeln("intersect(): Can't happen on parallel lines"); return FALSE; } else { /* find point of intersection */ s = (b1 * c2 - b2 * c1) / (a1 * b2 - a2 * b1); /* x co-ord */ t = (c1 * a2 - c2 * a1) / (a1 * b2 - a2 * b1); /* y co-ord */ if (pt_betwn_pts(line1[2], [CART, s, t], line1[3]) && pt_betwn_pts(line2[2], [CART, s, t], line2[3])) return TRUE; /* intersection of */ else return FALSE; /* actual line only */ } } /* BOOLEAN */ func separates { para line, point1, point2; auto a1, a2, a3, b1, b2, b3, c1, c2, c3, s2, s3; if (idv(line) || idv(point1) || idv(point2)) return @; a1 = float(line[3][3] - line[2][3]); /* implicit eqn */ b1 = float(line[2][2] - line[3][2]); /* line $1 */ c1 = float(line[2][3] * line[3][2] - line[3][3] * line[2][2]); /* perpendicular line from point2 to line */ a2 = float(line[2][2] - line[3][2]); b2 = float(line[2][3] - line[3][3]); c2 = -a2 * point1[2] - b2 * point1[3]; a3 = a2; /* perpendicular line */ b3 = b2; /* from point2 to line */ c3 = -a3 * point2[2] - b3 * point2[3]; s2 = (b1 * c2 - b2 * c1) / (a1 * b2 - a2 * b1); s3 = (b1 * c3 - b3 * c1) / (a1 * b3 - a3 * b1); if (point1[2] > s2 && point2[2] > s3) return FALSE; /* Points on +side of line */ if (point1[2] < s2 && point2[2] < s3) return FALSE; /* Points on -side of line */ else return TRUE; /* Line separates points */ } /* BOOLEAN */ func includes { para Circle, point; auto s, t; if (idv(Circle) || idv(point)) return @; s = (Circle[2][2] - point[2]) * (Circle[2][2] - point[2]); t = (Circle[2][3] - point[3]) * (Circle[2][3] - point[3]); return (sqrt(float (s + t)) <= Circle[3]); } /* BOOLEAN */ func incident { para entity, point; auto s, t; if (idv(entity) || idv(point)) return @; switch (entity[1]) { case 'L': /* LINE */ return (colinear(entity[2], point, entity[3])); /* substitute x- and y- coordinate into circle */ case 'E': /* CIRCLE */ s = (entity[2][2] - point[2]) * (entity[2][2] - point[2]); t = (entity[2][3] - point[3]) * (entity[2][3] - point[3]); return (sqrt(float(s + t)) == entity[3]); } } /* BOOLEAN */ func distlarger { para entity, point, value; auto a, b, c, d; if (idv(entity) || idv(point) || idv(value)) return @; switch (entity[1]) { case 'C': case 'P': if (entity[1] == POLAR) entity = polar_to_cart(entity); if (point[1] == POLAR) point = polar_to_cart(point); a = (entity[2] - point[2]) * (entity[2] - point[2]); b = (entity[3] - point[3]) * (entity[3] - point[3]); d = sqrt(float(a + b)); return d > value; case 'L': if (entity[2][1] == POLAR) entity[2] = polar_to_cart(entity[2]); if (entity[3][1] == POLAR) entity[3] = polar_to_cart(entity[3]); if (point[1] == POLAR) point = polar_to_cart(point); a = entity[3][3] - entity[2][3]; b = entity[3][2] - entity[2][2]; c = entity[2][3] * entity[2][2] - entity[3][3] * entity[2][2]; d = sqrt(float(a * point[2] + b * point[3] + c)) * (a * point[2] + b * point[3] + c) / (a * a + b * b); return d > value; } } /* BOOLEAN */ func distsmaller { para entity, point, value; auto a, b, c, d; if (idv(entity) || idv(point) || idv(value)) return @; switch (entity[1]) { case 'C': case 'P': if (entity[1] == POLAR) entity = polar_to_cart(entity); if (point[1] == POLAR) point = polar_to_cart(point); a = (entity[2] - point[2]) * (entity[2] - point[2]); b = (entity[3] - point[3]) * (entity[3] - point[3]); d = sqrt(float(a + b)); return d < value; case 'L': if (entity[2][1] == POLAR) entity[2] = polar_to_cart(entity[2]); if (entity[3][1] == POLAR) entity[3] = polar_to_cart(entity[3]); if (point[1] == POLAR) point = polar_to_cart(point); a = entity[3][2] - entity[2][2]; b = entity[3][3] - entity[2][3]; c = entity[2][3] * entity[2][2] - entity[3][3] * entity[2][2]; d = sqrt(float(a * point[2] + b * point[3] + c)) * (a * point[2] + b * point[3] + c) / (a * a + b * b); return d < value; } } func cart_to_polar { para cart; if (idv(cart)) return @; if (cart[1] == POLAR) return cart; if (cart[1] != CART) error("argument is not in cart coordinate"); cart[2] = float(cart[2]); cart[3] = float(cart[3]); if (cart[2] == 0.0 && cart[3] == 0.0) return [POLAR, 0.0, 0.0]; return [POLAR, sqrt(cart[2]*cart[2]+cart[3]*cart[3]), atan2(cart[3], cart[2])]; } func polar_to_cart { para polar; if (idv(polar)) return @; if (polar[1] == CART) return polar; if (polar[1] != POLAR) error("argument is not in polar coordinate"); return [CART, polar[2] * cos(float(polar[3])), polar[2] * sin(float(polar[3]))]; } func toComma { para s; auto i; for (i = 1; i <= s# && s[i] != ','; i++); return (i > 0) ? substr(s, 1, i-1) : ""; } func lookAttr { para s, attr; auto head; if (s# <= attr# + 1) return ""; head = toComma(s); if (substr(s, 1, attr#+1) == (attr//"=")) return substr(head, attr#+2, head#); else if (s# > head# + 1 + attr# + 1) return lookAttr(substr(s, head# + 2, s#), attr); else return ""; } /* ----- GRAPHICS DRAWING ROUTINE ----- */ _tkeden_showxoutput = 0; proc xoutput { auto i, s; if ($# == 0) return; s = str($1); for (i = 2; i <= $#; i++) s = strcat(s, " ", str($[i])); /* do '_tkeden_showxoutput = 1;' to debug Donald graphics [Ash] */ if (_tkeden_showxoutput) writeln("xoutput: tcl(\"", s, "\");"); tcl(s); } proc xdelete { para viewport_name, segid; auto command; command = "."//viewport_name[1]//"."//viewport_name[2]; xoutput("if [winfo exists", command, "] {",command, "delete", "t"//str(int(segid)), "}"); } proc xpoint { para viewport_name, segid, x, y, attr, xOrigin, yOrigin, xScale, yScale; auto command, color, var; var = viewport_name[2]; command = "."//viewport_name[1]//"."//var; color = lookAttr(*attr, "color"); color = (color == "") ? "-fill $"//var//"_fg" : "-fill "//color; x = x * xScale + xOrigin; y = y * yScale + yOrigin; xoutput(command, "create line", x, y, x, y, color, "-tags {all t"//str(int(segid))//"}"); } proc xline { para viewport_name, segid, x1, y1, x2, y2, attr, xOrigin, yOrigin, xScale, yScale; auto command, val, opt, var; var = viewport_name[2]; command = "."//viewport_name[1]//"."//var; val = lookAttr(*attr, "color"); opt = "-fill " // ((val == "") ? "$"//var//"_fg" : val); val = lookAttr(*attr, "arrow"); opt = opt // " -arrow " // ((val == "") ? "none" : val); val = lookAttr(*attr, "linewidth"); if (val != "") opt = opt // " -width " // val; val = lookAttr(*attr, "linestyle"); if (val == "dashed") opt = opt // dashedopt; else if (val == "dotted") opt = opt // dottedopt; x1 = x1 * xScale + xOrigin; y1 = y1 * yScale + yOrigin; x2 = x2 * xScale + xOrigin; y2 = y2 * yScale + yOrigin; xoutput(command, "create line", x1, y1, x2, y2, opt, "-tags {all t"//str(int(segid))//"}"); } proc xrectangle { para viewport_name, segid, x1, y1, x2, y2, attr, xOrigin, yOrigin, xScale, yScale; auto command, col, val, var, opt, outcol; var = viewport_name[2]; command = "."//viewport_name[1]//"."//var; opt = ""; outcol = lookAttr(*attr, "outlinecolor"); opt = "-outline " // ((outcol == "") ? "$"//var//"_fg" : outcol); col = lookAttr(*attr, "color"); val = lookAttr(*attr, "fill"); opt = opt // " -fill " // ((val == "solid") ? ((col == "") ? "$"//var//"_fg" : col) : "{}"); val = lookAttr(*attr, "linewidth"); opt = opt // " -width " // ((val == "") ? "1.0" : val); val = lookAttr(*attr, "linestyle"); if (val == "dashed") opt = opt // dashedopt; else if (val == "dotted") opt = opt // dottedopt; x1 = x1 * xScale + xOrigin; y1 = y1 * yScale + yOrigin; x2 = x2 * xScale + xOrigin; y2 = y2 * yScale + yOrigin; xoutput(command, "create rect", x1, y1, x2, y2, opt, "-tags {all t"//str(int(segid))//"}"); } proc xarc { para viewport_name, segid, x1, y1, x2, y2, a, attr, xOrigin, yOrigin, xScale, yScale; auto p1, p2, cx, cy, r, rad, b, c, start, col, outcol; auto command, val, opt, var; var = viewport_name[2]; command = "."//viewport_name[1]//"."//var; if ((a >= 0 ? a : -a) < 1.0) { /* small angle, treat as straight line */ x1 = x1 * xScale + xOrigin; y1 = y1 * yScale + yOrigin; x2 = x2 * xScale + xOrigin; y2 = y2 * yScale + yOrigin; xline(viewport_name, segid, x1, y1, x2, y2, xOrigin, yOrigin, xScale, yScale); return; } col = lookAttr(*attr, "color"); opt = "-fill " // ((col == "") ? "$"//var//"_fg" : col); outcol = lookAttr(*attr, "outlinecolor"); opt = opt // " -outline " // ((outcol == "") ? "$"//var//"_fg" : outcol); val = lookAttr(*attr, "linewidth"); if (val != "") opt = opt // " -width " // val; val = lookAttr(*attr, "linestyle"); if (val == "dashed") opt = opt // dashedopt; else if (val == "dotted") opt = opt // dottedopt; val = lookAttr(*attr, "fill"); opt = opt // " -style " // ((val == "") ? "arc" : "pieslice"); /* treat it properly as a genuine arc */ a = float(a); if (a > 360 || a < -360) error("arc angle must be in between -360 and 360"); x1 = float(x1); y1 = float(y1); x2 = float(x2); y2 = float(y2); p1 = [CART, x1, y1]; p2 = [CART, x2, y2]; rad = a * PI / 180; rad = rad >= 0 ? rad : 2 * PI + rad; b = (PI - rad) / 2; c = cart_to_polar(vector_sub(p2, p1))[3]; r = sqrt((x2-x1)*(x2-x1)+(y2-y1)*(y2-y1)) / 2 / sin(rad / 2); r = r >= 0 ? r : -r; cx = x1 + r * cos(c - b); cy = y1 + r * sin(c - b); start = 90 + (c - rad / 2) * 180 / PI; start = start - int(start / 360) * 360; start = start >= 0 ? start : start + 360; x1 = (cx - r) * xScale + xOrigin; y1 = (cy - r) * yScale + yOrigin; x2 = (cx + r) * xScale + xOrigin; y2 = (cy + r) * yScale + yOrigin; xoutput(command, "create arc", x1, y1, x2, y2, "-start", start, "-extent", a, opt, "-tags {all t"//str(int(segid))//"}"); } proc xcircle { para viewport_name, segid, x, y, r, attr, xOrigin, yOrigin, xScale, yScale; auto command, col, val, var, opt, outcol; var = viewport_name[2]; command = "."//viewport_name[1]//"."//var; opt = ""; outcol = lookAttr(*attr, "outlinecolor"); opt = "-outline " // ((outcol == "") ? "$"//var//"_fg" : outcol); col = lookAttr(*attr, "color"); val = lookAttr(*attr, "fill"); opt = opt // " -fill " // ((val == "solid") ? ((col == "") ? "$"//var//"_fg" : col) : "{}"); val = lookAttr(*attr, "linewidth"); opt = opt // " -width " // ((val == "") ? "1.0" : val); val = lookAttr(*attr, "linestyle"); if (val == "dashed") opt = opt // dashedopt; else if (val == "dotted") opt = opt // dottedopt; x = x * xScale + xOrigin; y = y * yScale + yOrigin; xoutput(command, "create oval", x-r*xScale, y-r*yScale, x+r*xScale, y+r*yScale, opt, "-tags {all t"//str(int(segid))//"}"); } proc xellipse { para viewport_name, segid, x0, y0, x1, y1, x2, y2, attr, xOrigin, yOrigin, xScale, yScale; auto command, val, opt, var, dx1, dy1, dx2, dy2, outcol; var = viewport_name[2]; command = "."//viewport_name[1]//"."//var; val = lookAttr(*attr, "color"); opt = (val == "") ? "-fill $"//var//"_fg" : "-fill "//val; val = lookAttr(*attr, "linewidth"); opt = opt // " -width " // ((val == "") ? "1.0" : val); val = lookAttr(*attr, "linestyle"); if (val == "dashed") opt = opt // dashedopt; else if (val == "dotted") opt = opt // dottedopt; x0 = x0 * xScale + xOrigin; y0 = y0 * yScale + yOrigin; x1 = x1 * xScale + xOrigin; y1 = y1 * yScale + yOrigin; x2 = x2 * xScale + xOrigin; y2 = y2 * yScale + yOrigin; val = lookAttr(*attr, "fill"); dx1 = 4.0 * (x1 - x0) / 3; dy1 = 4.0 * (y1 - y0) / 3; dx2 = 4.0 * (x2 - x0) / 3; dy2 = 4.0 * (y2 - y0) / 3; if (val == "") { xoutput(command, "create line", x0-dx2, y0-dy2, x0+dx1, y0+dy1, x0+dx2, y0+dy2, x0-dx1, y0-dy1, x0-dx2, y0-dy2, opt, "-smooth true -splinesteps 5 -tags {all t" //str(int(segid))//"}"); } else { outcol = lookAttr(*attr, "outlinecolor"); opt = opt // " -outline " // ((outcol == "") ? "$"//var//"_fg" : outcol); xoutput(command, "create polygon", x0-dx2, y0-dy2, x0+dx1, y0+dy1, x0+dx2, y0+dy2, x0-dx1, y0-dy1, x0-dx2, y0-dy2, opt, "-smooth true -splinesteps 5 -tags {all t" //str(int(segid))//"}"); } } proc xtext { para viewport_name, segid, x, y, text, attr, xOrigin, yOrigin, xScale, yScale; auto command, var, val, opt; var = viewport_name[2]; command = "."//viewport_name[1]//"."//var; opt = "-fill "; val = lookAttr(*attr, "color"); opt = opt // (val == "" ? "$"//var//"_fg" : val); val = lookAttr(*attr, "font"); opt = opt // " -font " // (val == "" ? "$"//var//"_font" : val); x = x * xScale + xOrigin; y = y * yScale + yOrigin; xoutput(command, "create text", x, y, "-text {"//text//"}", opt, "-tags {all t"//str(int(segid))//"}"); } proc ximage { para viewport_name, segid, x, y, image, attr, xOrigin, yOrigin, xScale, yScale; auto command, var, val, opt; var = viewport_name[2]; command = "."//viewport_name[1]//"."//var; x = x * xScale + xOrigin; y = y * yScale + yOrigin; xoutput(command, "create image", x, y, "-image", image, "-tags {all t"//str(int(segid))//"}"); } /**** * INITIALIZE ROOT CONTEXT * ****/ /*-----------------------------------------------------------------------------+ | plot_point, plot_line, plot_rectangle, plot_circle, plot_ellipse, plot_shape | +-----------------------------------------------------------------------------*/ plot_point is plot_shape; plot_line is plot_shape; plot_arc is plot_shape; plot_circle is plot_shape; plot_ellipse is plot_shape; plot_rectangle is plot_shape; plot_label is plot_shape; plot_shape is PlotShape; proc draw_shape { para viewport_name, SegName, entity, attr, xOrigin, yOrigin, xScale, yScale; auto x1, y1, x2, y2, i, p1, p2; if (viewport_name == @ || SegName == @ || idv(entity)) return; switch (entity[1]) { case 'C': xpoint(viewport_name, SegName, entity[2], entity[3], attr, xOrigin, yOrigin, xScale, yScale); break; case 'P': p1 = polar_to_cart(entity); xpoint(viewport_name, SegName, p1[2], p1[3], attr, xOrigin, yOrigin, xScale, yScale); break; case 'L': if (entity[2][1] == POLAR) { entity[2] = polar_to_cart(entity[2]); } if (entity[3][1] == POLAR) { entity[3] = polar_to_cart(entity[3]); } xline(viewport_name, SegName, entity[2][2], entity[2][3], entity[3][2], entity[3][3], attr, xOrigin, yOrigin, xScale, yScale); break; case 'G': xrectangle(viewport_name, SegName, entity[2][2], entity[2][3], entity[3][2], entity[3][3], attr, xOrigin, yOrigin, xScale, yScale); break; case 'U': if (entity[2][1] == POLAR) { entity[2] = polar_to_cart(entity[2]); } if (entity[3][1] == POLAR) { entity[3] = polar_to_cart(entity[3]); } xarc(viewport_name, SegName, entity[2][2], entity[2][3], entity[3][2], entity[3][3], entity[4], attr, xOrigin, yOrigin, xScale, yScale); break; case 'E': if (entity[2][1] == POLAR) { entity[2] = polar_to_cart(entity[2]); } xcircle(viewport_name, SegName, entity[2][2], entity[2][3], entity[3], attr, xOrigin, yOrigin, xScale, yScale); break; case 'Q': if (entity[2][1] == POLAR) { entity[2] = polar_to_cart(entity[2]); } if (entity[3][1] == POLAR) { entity[3] = polar_to_cart(entity[3]); } if (entity[4][1] == POLAR) { entity[4] = polar_to_cart(entity[4]); } xellipse(viewport_name, SegName, entity[2][2], entity[2][3], entity[3][2], entity[3][3], entity[4][2], entity[4][3], attr, xOrigin, yOrigin, xScale, yScale); break; case 'T': if (entity[3][1] == POLAR) entity[3] = polar_to_cart(entity[3]); xtext(viewport_name, SegName, entity[3][2], entity[3][3], str(entity[2]), attr, xOrigin, yOrigin, xScale, yScale); break; case 'I': if (entity[3][1] == POLAR) entity[3] = polar_to_cart(entity[3]); ximage(viewport_name, SegName, entity[3][2], entity[3][3], str(entity[2]), attr, xOrigin, yOrigin, xScale, yScale); break; case 'S': for (i = 2; i <= entity#; i++) draw_shape(viewport_name, SegName, entity[i], attr, xOrigin, yOrigin, xScale, yScale); break; default: writeln("ERROR: draw_shape(" , entity, ");"); break; } } proc dd_delete { para id, viewport, attr; plot_shape([], id, attr); *id = @; } proc InitDoNaLDViewport { OpenDisplay("donaldscreen", 500, 500); tcl("wm title .donaldscreen DoNaLD"); execute("%scout window DoNaLDdefaultWin = { type: DONALD pict: \"DoNaLD\" box: [{0,0}, {500, 500}] border: 1 };\n%eden"); tcl("canvas .donaldscreen.default"); DoNaLD is scout_show_2D_window(DoNaLDdefaultWin, ".donaldscreen.default", "default") ? [["donaldscreen", "default"]] : [["donaldscreen", "default"]]; } /* include(getenv("TKEDEN_LIB") // "/macro.e"); */ proc SetGraph { para ename, dname; execute(macro(" proc P?1 : ?1_viewport, ?1__fi_, ?1__xi_, ?1_nSegment, ?1_?3, ?1_?4 { auto i, j, s, xi, xi_1, fi, fi_1; xi = \"(\"//?1__xi_//\")\"; xi_1 = macro(xi, \"??2\"); fi = \"(\"//macro(?1__fi_, \"??1\", xi)//\")\"; fi_1 = macro(fi, \"??2\"); execute(\"%donald\\nviewport \"//?1_viewport//\"\\nwithin ?2 {\\n\"); if (o?1_nNode != @) for (j = o?1_nNode[2]; j > 0; j--) for (i = o?1_nNode[1]; i > 0; i--) execute(macro(\"%donald\\ndelete ?3??2_??1\", str(i-1),str(j))); if (o?1_nSegment != @) for (j = o?1_nSegment[2]; j > 0; j--) for (i = o?1_nSegment[1]; i > 0; i--) execute(macro(\"%donald\\ndelete ?4??2_??1\", str(i), str(j))); "//" if (?1_?3 != []) { for (j = 0; j < ?1_?3# / 2; j++) { s = \"\"; for (i = ?1_nSegment; i >= 0; i--) { s = s // macro(\" ?3??2_??1\", str(i), str(j+1)); if (i > 0) s = s // ','; } if (?1_nSegment > 0) execute(\"%donald\\n\"//?1_?3[2*j+1]//s); if (?1_?3[2*j+2] != \"\") for (i = ?1_nSegment; i >= 0; i--) execute(macro(macro(\"%donald\\n?3????3_??1 = \"//?1_?3[2*j+2], \"??1\", xi, fi, \"??2\", xi_1, fi_1), str(i), str(i-1), str(j+1))); } o?1_nNode = [?1_nSegment + 1, ?1_?3# / 2]; } else o?1_nNode = [0,0]; "//" if (?1_?4 != []) { for (j = 0; j < ?1_?4# / 2; j++) { s = \"\"; for (i = ?1_nSegment; i > 0; i--) { s = s // macro(\" ?4??2_??1\", str(i), str(j+1)); if (i > 1) s = s // ','; } if (?1_nSegment >= 0) execute(\"%donald\\n\"//?1_?4[2*j+1]//s); if (?1_?4[2*j+2] != \"\") for (i = ?1_nSegment; i > 0; i--) execute(macro(macro(\"%donald\\n?4????3_??1 = \"//?1_?4[2*j+2], \"??1\", xi, fi, \"??2\", xi_1, fi_1), str(i), str(i-1), str(j+1))); } o?1_nSegment = [?1_nSegment, ?1_?4# / 2]; } else o?1_nSegment = [0,0]; execute(\"%donald\\n}\"); } ", ename, dname, "node", "segment")); } proc quit {} ttr(*attr, "linestyle"); if (val == "dashed") opt = opt // dashedopt; else if (val == "dotted") opt = opt // dottedopt; val = lookAttr(*attr, "fill"); opt = opt // " -style " // ((val == "") ? "arc" : "pieslice"); /* treat it properly as atkeden1.41/lib-tkeden/donald.txt010064400025250000164000000076350746225674100166720ustar00ashleyem00003510000005------ DoNaLD (Definitive Notation for Line Drawing) QUICK REFERENCE ------ Warning: this documentation isn't quite finished yet... CONTENTS OF THIS QUICK REFERENCE: 1. Syntax 2. Data types 3. Functions 4. References 5. Pre-defined variables 6. Attributes 7. Viewports 8. More information -- 1. SYNTAX ----------------------------------------------------------------- No semi-colons: line feeds are terminators Line continuation: use \ at the end of a line to continue to the next # UNIX shell style one-line comments Variables must be declared before use (except when using the ! operator) Redeclaration of type is not possible Name space: append ! to an identifier to reference an Eden variable: eg eq!(a, b) Escaping to Eden: ? is a one-line escape to Eden (remember to terminate with a semi-colon) -- 2. DATA TYPES ------------------------------------------------------------- int: 34 real: 10.0 char: "abc" boolean: true, false point: {50, 100} point: {modulo @ angle} ie distance and angle (radians) from the origin line: [{10, 10}, {80, 90}] arc: [point1, point2, r] -- note arc is NOT arc(p, p, r) circle: circle(centre, radius), circle({500, 500}, 400) ellipse: ellipse(centre, major, minor) rectangle: rectangle(point1, point2) label: label(string, point) image: I!ImageFile("gif", "hill.gif") openshape: openshape cross within cross { line l1, l2 l1 = [{10, -10}, {-10, 10}] l2 = [{10, 10}, {-10, -10}] } shape: shape S S = trans(cross, 100, 200) graph: (see other documentation) -- 3. FUNCTIONS -------------------------------------------------------------- Arithmetic: + - * div mod sqrt log exp trunc float rand Trigonometric: sin cos tan asin acos atan Relational: && || ! < <= == > >= Geometric: point midpoint(line) point intersect(line, line) line perpend(point, line) real dist(point, point) bool intersects(line, line) bool separates(line, point, point) bool includes(circle, point) bool incident(line, point) bool incident(circle, point) bool pt_betwn_pts(point, point, point) bool colinear(point, point, point) bool distlarger(point, point, value) bool distlarger(line, point, value) bool distsmaller(point, point, value) bool distsmaller(line, point, value) Shape transformations (note "entity" can be any Donald type): trans(entity, x, y) scale(entity, ratio) rot(entity, point, angle) reflect(entity, line) String functions: // (string concatenation) itos(int) rtos(real, fprintf-format-string) Image functions: I!functionName denotes a function returning an image -- 4. REFERENCES ------------------------------------------------------------- x: variable x in the immediate context ~/x: variable x in the context one level up /x: variable x in the root (topmost) context x!: the Eden variable x .1, .2: first and second points of a line or first and second coordinates of a point .x, .y: projection of a point onto the x- and y- axes -- 5. PRE-DEFINED VARIABLES -------------------------------------------------- pi: ratio of circle circumference to diameter (note upper case PI in Eden) -- 6. ATTRIBUTES ------------------------------------------------------------- To give an attribute to the DoNaLD variable Obj/line1, use the Eden escape: ?A_Obj_line1 = "attribute1=value1,attribute2=value2..."; color outlinecolor linewidth linestyle: dotted, dashed or solid arrow: first, last, both or none locus: true, false fill: solid or hollow font: a string: "{family size style}"... family = times, courier or helvetica, size = in points (1/72th inch) style = normal, bold, roman, italic, underline, overstrike (multiple styles are possible: "{times 12 {bold italic}}") -- 7. VIEWPORTS -------------------------------------------------------------- viewport VIEW1 The default viewport is DoNaLD. -- 8. MORE INFORMATION ------------------------------------------------------- See http://www.dcs.warwick.ac.uk/modelling/ for more detail. ine, point, point) bool includes(circle, point) bool incident(line, point) bool incident(circle, potkeden1.41/lib-tkeden/eddi.eden010064400025250000164000002076340743743560000164260ustar00ashleyem00003510000005%eden /* * $Id: eddi.eden,v 1.1 2002/02/28 14:15:28 cssbz Exp $ * Warning: this is a generated file */ ## ## Original file eddipf.e (length 10703, dated Oct 23 08:58) follows... ## %eden /* File: eddipf.e Program: EDEN functions for EDDI/P Date: 6/2/96 Author: Son V Truong */ /* Generally messed around with since by Ashley and Meurig */ /* Added some checking to the input of functions - Michael */ /* */ /* Make a version of a table with no repeated rows */ func Makedistinct { para l; auto result, elt, ix; result = []; while (l#!=0) { elt = l[1]; shift l; ix = 1; while ((ix<=result#)&&(elt!=result[ix])) ix++; if (result#" : { for (i=1; i<=keys#; i++) { if (keys[i] > $4) append tlist1,$1[i+1]; } break; } case ">=" : { for (i=1; i<=keys#; i++) { if (keys[i] >= $4) append tlist1,$1[i+1]; } break; } default : writeln("EDDI/P Error: not a comparison."); } return makedistinct(tlist1); } func getkcols { auto i; tlist = []; for (i=1; i<=$1[1][1]#; i++) if ($1[1][1][i] == 1) append tlist, $1[1][i+1]; return tlist; } func rdupcols { auto i,j,k; tlist = [[[]]]; colnos = [2]; delcols = [$1[1][2]]; for (i=3; i<=$1[1]#; i++) if (notin(delcols,$1[1][i])) { append colnos, i; append delcols, $1[1][i]; } for (j=1; j<=colnos#; j++) { append tlist[1][1], $1[1][1][colnos[j]-1]; append tlist[1], $1[1][colnos[j]]; } for (k=2; k<=$1#; k++) { append tlist, []; for (j=1; j<=colnos#; j++) append tlist[k], $1[k][colnos[j]-1]; } return makedistinct(tlist); } func matchcols /* [[mct1],[mct2]] = matchcols(t1,t2) */ { auto i,j; mct1 = []; mct2 = []; for(i=2;i<=$1[1]#;i++) for(j=2;j<=$2[1]#;j++) { if ($1[1][i] == $2[1][j]) { append mct1,i; append mct2,j; } } return [mct1,mct2]; } func njoin { auto i,j,k,x,y,z; if ($#<2) { writeln("EDEN: ERROR: two tables not provided for njoin."); return [[[]]]; } else if (($1==@) || ($2==@)) { writeln("EDEN: ERROR: njoin has received at least one "// "undefined table."); return [[[]]]; } tlist1 = []; vals1 = []; vals2 = []; nvals1 = []; nvals2 = []; append tlist1, $1[1]; matcols = matchcols($1,$2); if (matcols != [[],[]]) { for (i=1; i<=matcols[1]#; i++) append vals1, getcolval($1,matcols[1][i]-1); for (i=1; i<=matcols[2]#; i++) append vals2, getcolval($2,matcols[2][i]-1); for (j=1; j<=vals1[1]#; j++) { append nvals1, []; for (k=1; k<=vals1#; k++) append nvals1[j], vals1[k][j]; } for (j=1; j<=vals2[1]#; j++) { append nvals2, []; for (k=1; k<=vals2#; k++) append nvals2[j], vals2[k][j]; } attr = $1[1]; attr[1] = attr[1] // $2[1][1]; for (i=2; i<=$2[1]#; i++) append attr, $2[1][i]; tlist = [attr]; z = 1; for (x=1; x<=nvals1#; x++) for (y=1; y<=nvals2#; y++) if (nvals1[x] == nvals2[y]) { append tlist, $1[x+1]; z++; for (i=1; i<=$2[y+1]#; i++) append tlist[z], $2[y+1][i]; } return rdupcols(tlist); } else { attr = $1[1]; attr[1] = attr[1] // $2[1][1]; for (i=2; i<=$2[1]#; i++) append attr, $2[1][i]; tlist = [attr]; for (x=2;x<=$1#;x++) for (y=2; y<=$2#; y++) { append tlist, ($1[x] // $2[y]); } return tlist; } } func epipe { auto i; tlist = []; for(i=2;i<=$1#;i++) append tlist,$1[i]; return tlist; } ## ## Original file eddi.e (length 6144, dated Feb 21 22:43) follows... ## %eden /* Modification by Ash */ /* include ("eddi/eddipf.e"); */ /* Removed by Ash Feb 21 2002: will be inserted above */ /* include(getenv("TKEDEN_LIB")//"/eddipf.e"); */ operators = [[':',"select_wrapper"],['%',"project"],['.',"inter"],['*',"njoin"],['+',"union"],['-',"diff"]]; func lookupop { para op; auto i; for (i = 1; i <= operators#; i++) if (char (op) == operators [i][1]) return operators [i][2]; return "unknown"; } func select_wrapper { para tbl, pred; auto var, op, val, i, j; i = 1; while (i <= pred# && (isalphanum (pred[i]) || pred[i] == ' ')) i++; var = stripspace(substr (pred, 1, i - 1)); j = i; while (i <= pred# && pred[i] != ' ' && !isalphanum (pred [i])) i++; op = stripspace (substr (pred, j, i - 1)); val = converttonum (stripspace (substr (pred, i, pred#))); if (type (val) == "string") val = cutquotes (val); return select (tbl, var, op, val); } eddi_tables = []; proc droptable { para tbl; auto i, new_tables; new_tables = []; for (i = 1; i <= eddi_tables#; i++) if (eddi_tables [i] != tbl) new_tables = new_tables // [eddi_tables [i]]; eddi_tables = new_tables; forget (tbl); } proc addtotablelist { para tbl; eddi_tables = eddi_tables // [tbl]; } proc listtables { auto i; writeln ("----------------"); for (i = 1; i <= eddi_tables#; i++) writeln (eddi_tables [i]); writeln ("----------------"); } eddi_notation = [";", "eddi_statement", []]; eddi_statement = ["suffix", ";", "eddi_statement_1", ["fail", "eddi_statement_1"]]; /* eddi_statement_1 = ["prefix", "?", "table_val", ["script", ["declare", "relname"], ["setparas", ["relname"]], ["later", "showrel (%%);", "relname"]], ["fail", "eddi_statement_2"]]; */ /* For reg_exp queries rather than just table name */ eddi_statement_1 = ["prefix", "?", "rel_exp", ["script", ["declare", "relname"], ["setparas", ["relname"]], ["later", "showrel (%%);", "relname"]], ["fail", "eddi_statement_2"]]; eddi_statement_2 = ["prefix", "~", "table_name", ["script", ["declare", "relname"], ["setparas", ["relname"]], ["later", "droptable (%%);", "relname"]], ["fail", "eddi_statement_3"]]; eddi_statement_3 = ["pivot", "<<", ["table_name", "tuples"], ["script", ["declare", "relname"], ["setparas", ["relname"], []], ["later", "$$ = addvals ($$, %%);", "relname", "relname", "v_substrs[2]"]], ["fail", "eddi_statement_4"]]; eddi_statement_4 = ["pivot", "!!", ["table_name", "tuples"], ["script", ["declare", "relname"], ["setparas", ["relname"], []], ["later", "$$ = delvals ($$, %%);", "relname", "relname", "v_substrs[2]"]], ["fail", "eddi_statement_5"]]; eddi_statement_5 = ["pivot", "is", ["table_name", "rel_exp"], ["script", ["declare", "relname", "expr"], ["setparas", ["relname"], ["expr"]], ["later", "$$ is %%;", "relname", "expr"]], ["fail", "eddi_statement_6"]]; eddi_statement_6 = ["pivot", "(", ["table_name", "create_state"], ["script", ["declare", "relname", "cdata"], ["setparas", ["relname"], ["cdata"]], ["later", "$$ = create ($$); addtotablelist (\"$$\");", "relname", "cdata", "relname"]], ["fail", "eddi_statement_7"]]; eddi_statement_7 = ["literal", "#", ["script", ["execute", "listtables ();"]]]; table_name = ident_ex ([["script", ["execute", "%% = \"%%\";", "v_paras[1]", "v_string"]]]); table_val = ident_ex ([["script", ["execute", "%% is %%;", "v_paras[1]", "v_string"]]]); func op_exp { para op, next; return ["pivot", str (op), ["rel_exp", "rel_exp"], ["script", ["declare", "p1", "p2"], ["setparas", ["p1"], ["p2"]], ["execute", "%% is " // lookupop (op) // "(%%, %%);", "v_paras[1]", "p1", "p2"]], ["ignore", ["bras"]], ["fail", next]]; } rel_exp = op_exp ('+', "rel_exp_1"); rel_exp_1 = op_exp ('-', "rel_exp_2"); rel_exp_2 = op_exp ('*', "rel_exp_3"); rel_exp_3 = op_exp ('.', "rel_exp_4"); rel_exp_4 = ["rev_pivot", "%", ["rel_exp", "attr_list"], ["script", ["declare", "expr_part", "attr_part"], ["setparas", ["expr_part"], ["attr_part"]], ["execute", "%% is " // lookupop ('%') // "(%%, %%);", "v_paras[1]", "expr_part", "attr_part"]], ["ignore", ["bras"]], ["fail", "rel_exp_5"]]; rel_exp_5 = ["rev_pivot", ":", ["rel_exp", "predicate"], ["script", ["declare", "expr_part"], ["setparas", ["expr_part"], []], ["execute", "%% is " // lookupop (':') // "(%%, ##);", "v_paras[1]", "expr_part", "v_substrs[2]"]], ["ignore", ["bras"]], ["fail", "rel_exp_6"]]; rel_exp_6 = ["prefix", "(", "rel_exp_7", ["fail", "table_val"], ["script", ["setparas", ["v_paras[1]"]]]]; rel_exp_7 = ["suffix", ")", "rel_exp", ["script", ["setparas", ["v_paras[1]"]]]]; tuples = ["split", ",", "tuple", ["ignore", ["sq_bras"]]]; tuple = ["prefix", "[", "tuple_1"]; tuple_1 = ["suffix", "]", "tuple_2"]; tuple_2 = ["split", ",", "tuple_3"]; tuple_3 = ["prefix", "\"", "tuple_5", ["fail", "float_num"]]; tuple_5 = ["suffix", "\"", "stringval"]; attr_list = ["split", ",", "col_name", ["script", ["allparas", "attrs"], ["execute", "%% is %%;", "v_paras[1]", "attrs"]]]; col_name = ident_ex ([["script", ["execute", "%% = \"%%\";", "v_paras[1]", "v_string"]]]); predicate = anything; stringval = anything; func convertcols { para inlist; auto outstr, i; if (inlist# < 1) return ""; outstr = "\"" // inlist [1][1] // "\", \"" // inlist [1][2] // "\""; for (i = 2; i <= inlist#; i++) outstr = outstr // ", \"" // inlist [i][1] // "\", \"" // inlist [i][2] // "\""; return outstr; } create_state = ["suffix", ")", "create_state_1", ["script", ["declare", "cdata"], ["setparas", ["cdata"]], ["execute", "%% is convertcols (%%);", "v_paras[1]", "cdata"]]]; create_state_1 = ["split", ",", "col_info", ["script", ["allparas", "cols"], ["execute", "%% is %%;", "v_paras[1]", "cols"]]]; col_info = ["pivot", " ", ["col_name", "col_info_2"], ["script", ["declare", "cname", "cdata"], ["setparas", ["cname"], ["cdata"]], ["execute", "%% is [%%, %%];", "v_paras[1]", "cname", "cdata"]]]; col_info_2 = ["suffix", "key", "anything", ["script", ["execute", "%% = \"#\";", "v_paras[1]"]], ["fail", "col_info_3"]]; col_info_3 = ["read_all", [], ["script", ["execute", "%% = \"X\";", "v_paras[1]"]]]; notation ("eddi", "eddi_notation"); ## ## Original file neweddipf.e (length 10034, dated Oct 23 20:07) follows... ## %eden /* File: eddipf.e Program: EDEN functions for EDDI/P Date: 6/2/96 Author: Son V Truong */ /* Generally messed around with since by Ashley and Meurig */ /* Added some checking to the input of functions - Michael */ /* */ /* Make a version of a table with no repeated rows */ func Makedistinct { para l; auto result, elt, ix; result = []; while (l#!=0) { elt = l[1]; shift l; ix = 1; while ((ix<=result#)&&(elt!=result[ix])) ix++; if (result#" : { for (i=1; i<=keys#; i++) { if (keys[i] > $4) append tlist1,$1[i+1]; } break; } case ">=" : { for (i=1; i<=keys#; i++) { if (keys[i] >= $4) append tlist1,$1[i+1]; } break; } default : writeln("EDDI/P Error: not a comparison."); } return makedistinct(tlist1); } func getkcols { auto i; tlist = []; for (i=1; i<=$1[1][1]#; i++) if ($1[1][1][i] == 1) append tlist, $1[1][i+1]; return tlist; } func rdupcols { auto i,j,k; tlist = [[[]]]; colnos = [2]; delcols = [$1[1][2]]; for (i=3; i<=$1[1]#; i++) if (notin(delcols,$1[1][i])) { append colnos, i; append delcols, $1[1][i]; } for (j=1; j<=colnos#; j++) { append tlist[1][1], $1[1][1][colnos[j]-1]; append tlist[1], $1[1][colnos[j]]; } for (k=2; k<=$1#; k++) { append tlist, []; for (j=1; j<=colnos#; j++) append tlist[k], $1[k][colnos[j]-1]; } return makedistinct(tlist); } func matchcols /* [[mct1],[mct2]] = matchcols(t1,t2) */ { auto i,j; mct1 = []; mct2 = []; for(i=2;i<=$1[1]#;i++) for(j=2;j<=$2[1]#;j++) { if ($1[1][i] == $2[1][j]) { append mct1,i; append mct2,j; } } return [mct1,mct2]; } func njoin { auto i,j,k,x,y,z; if ($#<2) { writeln("EDEN: ERROR: two tables not provided for njoin."); return @; } else if (($1==@) || ($2==@)) { writeln("EDEN: ERROR: njoin has received at least one "// "undefined table."); return @; } tlist1 = []; vals1 = []; vals2 = []; nvals1 = []; nvals2 = []; append tlist1, $1[1]; matcols = matchcols($1,$2); if (matcols != [[],[]]) { for (i=1; i<=matcols[1]#; i++) append vals1, getcolval($1,matcols[1][i]-1); for (i=1; i<=matcols[2]#; i++) append vals2, getcolval($2,matcols[2][i]-1); for (j=1; j<=vals1[1]#; j++) { append nvals1, []; for (k=1; k<=vals1#; k++) append nvals1[j], vals1[k][j]; } for (j=1; j<=vals2[1]#; j++) { append nvals2, []; for (k=1; k<=vals2#; k++) append nvals2[j], vals2[k][j]; } attr = $1[1]; attr[1] = attr[1] // $2[1][1]; for (i=2; i<=$2[1]#; i++) append attr, $2[1][i]; tlist = [attr]; z = 1; for (x=1; x<=nvals1#; x++) for (y=1; y<=nvals2#; y++) if (nvals1[x] == nvals2[y]) { append tlist, $1[x+1]; z++; for (i=1; i<=$2[y+1]#; i++) append tlist[z], $2[y+1][i]; } return rdupcols(tlist); } else { attr = $1[1]; attr[1] = attr[1] // $2[1][1]; for (i=2; i<=$2[1]#; i++) append attr, $2[1][i]; tlist = [attr]; for (x=2;x<=$1#;x++) for (y=2; y<=$2#; y++) { append tlist, ($1[x] // $2[y]); } return tlist; } } func epipe { auto i; tlist = []; for(i=2;i<=$1#;i++) append tlist,$1[i]; return tlist; } ## ## Original file newshowrel2.e (length 4517, dated Oct 9 17:57) follows... ## %eden _DUMMY = [[[0],"A"],[0]]; /* a dummy eddi relation _DUMMY (A int); _DUMMY << [1]; */ curr_rel = _DUMMY; /* file derived from newshowrel.dev.e which contains some development stuff */ /* Added check for a defined table to showrel(rel) - Michael */ num_tuple is curr_rel#-1; curr_attr is curr_rel[1][curr_index+1]; curr_attr_value is curr_rel[curr_tuple_num+1][curr_index]; /* curr_attr_str is (curr_rel[1][1][curr_index]==1)?curr_attr_value:ntzstr(curr_attr_value); */ curr_attr_str is ntzstr(curr_attr_value); curr_attr_len is curr_attr_str#; /* curr_attr_len is (curr_rel[1][1][curr_index]==1)?curr_attr_value#:str(curr_attr_value)#; */ func ntzstr { /* no trailing zeros display for real x */ /* this conversion function also passes strings through unmodified */ /* this is because of the boundary problem in the definitive environment */ /* whereby neither curr_tuple_num = 0 / 1 is appropriate */ para x; auto strx, i, j, result; strx = str(x); j = strx#; if (x==int(x)) return(str(int(x))); if (x!=str(x)) { i=1; while (strx[i]!='.') i++; while ((j>i) && (strx[j]=='0')) j--; }; result = ""; for (i=1; i<=j; i++) result = result // strx[i]; return result; }; func normalise_len { para s, n; auto i, result; i = 0; result = ""; while (i display list for $1 above $2 */ auto s,i; s = $1; for (i=1; i<=$2#; i++) { append s, $2[i]; } return s; } func displayrt { /* two display lists $1 and $2 -> display list for $1 to right of $2 */ auto s,i; s = []; for (i=1; i<=$1#; i++) { append s, ($1[i] // $2[i]); } return s; } /* some instances of showrel() in action that can be used to test above in connection with the fruits.eddi database */ /* curr_rel = ALLFRUITS; display_list(mkdisplist_rel()); NEWFRUITS = [ALLFRUITS[1]]; /* empty relation */ curr_rel = NEWFRUITS; display_list(mkdisplist_rel()); curr_rel = CITRUS; display_list(mkdisplist_rel()); MIX = union(APPLE, CITRUS); curr_rel = MIX; display_list(mkdisplist_rel()); */ proc showrel { para rel; if (rel==@) { writeln("EDEN: ERROR: showrel has been given an "// "undefined table."); return [[[]]]; } autocalc = 0; curr_rel = rel; display_list(mkdisplist_rel()); if (rel# == 2) writeln("(1 row)"); else writeln("(" // str(rel#-1) // " rows)"); curr_rel = _DUMMY; autocalc = 1; }; ## ## Original file newselect2.e (length 2709, dated Oct 27 10:57) follows... ## autocalc=0; func select /* t2 = select(t1,c,c_op,c_val) */ { auto i,j,k,addcol,compval, constval, constelt; tlist1 = []; /* why isn't tlist auto? */ if ($1==@) { writeln("EDEN: ERROR: select has been given an "// "undefined table."); return @; } else if (!isinlist($2, tail($1[1]))) { writeln("EDEN: ERROR: select has been given an "// "invalid attribute."); return @; } append tlist1, $1[1]; keys = getcolval($1,getcolumn($1,$2)); /* writeln(type($4), " ", $4); indicates types of selection */ constelt =((type($4) == "string") && ($4[1]== '\"')) ? cutquotes($4) : $4; constval = []; for (i=1; i<=$1#-1; i++) constval = constval // [constelt]; compval = constval; /* constval is the list of constant values of type number or string that is appropriate when $4 is a literal value */ if ((type($4) == "string") && ($4[1]!= '\"')) { if (!isinlist($4, tail($1[1]))) { writeln("EDEN: ERROR: select has been given an "// "invalid attribute."); return @; } else compval = getcolval($1,getcolumn($1,$4)); } /* compval is the list of values resulting from column selection where $4 is the name of an attribute in the relation $1 */ switch($3) { case "==" : { for (i=1; i<=keys#; i++) { if (keys[i] == compval[i]) append tlist1,$1[i+1]; } break; } case "!=" : { for (i=1; i<=keys#; i++) { if (keys[i] != compval[i]) append tlist1,$1[i+1]; } break; } case "<" : { for (i=1; i<=keys#; i++) { if (keys[i] < compval[i]) append tlist1,$1[i+1]; } break; } case "<=" : { for (i=1; i<=keys#; i++) { if (keys[i] <= compval[i]) append tlist1,$1[i+1]; } break; } case ">" : { for (i=1; i<=keys#; i++) { if (keys[i] > compval[i]) append tlist1,$1[i+1]; } break; } case ">=" : { for (i=1; i<=keys#; i++) { if (keys[i] >= compval[i]) append tlist1,$1[i+1]; } break; } default : writeln("EDDI/P Error: not a comparison."); return(@); } return makedistinct(tlist1); } func select_wrapper { para tbl, pred; auto var, op, val, i, j; i = 1; while (i <= pred# && (isalphanum (pred[i]) || pred[i] == ' ')) i++; var = stripspace(substr (pred, 1, i - 1)); j = i; while (i <= pred# && pred[i] != ' ' && !isalphanum (pred [i]) && pred[i] != '\"') i++; /* originally the terminating condition pred[i] == '\"' was omitted */ op = stripspace (substr (pred, j, i - 1)); val = converttonum (stripspace (substr (pred, i, pred#))); return select (tbl, var, op, val); } autocalc=1; ## ## Original file curragent.e (length 2560, dated Oct 10 10:04) follows... ## %eden /* this resets curr_agent to 0 whenever an sql query is parsed, and so ensures that the vanilla pivot operation is applied in eddi translation phase */ SQL0_statement is ["suffix", ";", "SQL1", ["script", ["execute", "curr_agent = 0;"], ["declare","statement"], ["setparas",["statement"]], ["later","append SQL0_statement_list, %%;","statement"]] ]; SQL_statement is ["suffix", ";", "SQL1", ["script", ["execute", "curr_agent = 0;"], ["declare","statement"], ["setparas",["statement"]], ["later","append SQL_statement_list, %%;","statement"]] ]; SQL_to_eddi_statement is ["suffix", ";", "SQL1", ["script", ["execute", "curr_agent = 0;"], ["declare","statement"], ["setparas",["statement"]], ["later","append SQL_to_eddi_statement_list, %%;","statement"]] ]; /* eddi_statement_1 = ["prefix", "?", "table_val", ["script", ["declare", "relname"], ["setparas", ["relname"]], ["later", "showrel (%%);", "relname"], ["execute", "curr_agent=1;"]], ["fail", "eddi_statement_2"]]; */ /* For reg_exp queries rather than just table name */ eddi_statement_1 = ["prefix", "?", "rel_exp", ["script", ["declare", "relname"], ["setparas", ["relname"]], ["later", "showrel (%%);", "relname"], ["execute", "curr_agent = 1;"] ], ["fail", "eddi_statement_2"]]; eddi_statement_2 = ["prefix", "~", "table_name", ["script", ["declare", "relname"], ["setparas", ["relname"]], ["later", "droptable (%%);", "relname"], ["execute", "curr_agent = 2;"] ], ["fail", "eddi_statement_3"]]; eddi_statement_3 = ["pivot", "<<", ["table_name", "tuples"], ["script", ["declare", "relname"], ["setparas", ["relname"], []], ["later", "$$ = addvals ($$, %%);", "relname", "relname", "v_substrs[2]"], ["execute", "curr_agent = 3;"] ], ["fail", "eddi_statement_4"]]; eddi_statement_4 = ["pivot", "!!", ["table_name", "tuples"], ["script", ["declare", "relname"], ["setparas", ["relname"], []], ["later", "$$ = delvals ($$, %%);", "relname", "relname", "v_substrs[2]"], ["execute", "curr_agent = 4;"] ], ["fail", "eddi_statement_5"]]; eddi_statement_5 = ["pivot", "is", ["table_name", "rel_exp"], ["script", ["declare", "relname", "expr"], ["setparas", ["relname"], ["expr"]], ["later", "$$ is %%;", "relname", "expr"], ["execute", "curr_agent = 5;"] ], ["fail", "eddi_statement_6"]]; eddi_statement_6 = ["pivot", "(", ["table_name", "create_state"], ["script", ["declare", "relname", "cdata"], ["setparas", ["relname"], ["cdata"]], ["later", "$$ = create ($$); addtotablelist (\"$$\");", "relname", "cdata", "relname"], ["execute", "curr_agent = 6;"] ], ["fail", "eddi_statement_7"]]; ## ## Original file newpivctn.e (length 3229, dated Nov 1 20:08) follows... ## %eden autocalc=0; /* func pivot { para instr, piv, ignore; auto i; i = extract (instr, piv, ignore, 1); if ( (i == 0) || ( ((curr_agent==1) || (curr_agent==5) || (curr_agent==8)) && ( (isdigit(instr[i-1])) || (i+piv#==instr#) || (isdigit(instr[i+piv#+1])) ) ) ) return []; else return [substr(instr,1,i-1), substr(instr,i+piv#,instr#)]; } */ /* func pivot { para instr, piv, ignore; auto i; i = extract (instr, piv, ignore, 1); /* consult setting of curr_agent to determine whether there is a possibility that '.' appears a decimal point and a rel op curr_agent is 1 (query), 5 (definition), 6 (assignment) */ if (i!=0) while ( (i!=0) && ((curr_agent==1) || (curr_agent==5) || (curr_agent==6)) && ( (isdigit(instr[i-1])) && (i+piv#<=instr#) &&(isdigit(instr[i+piv#])) ) ) i = extract (instr, piv, ignore, i+piv#); if (i == 0) return []; else return [substr(instr,1,i-1), substr(instr,i+piv#,instr#)]; } */ func pivot { para instr, piv, ignore; auto i; i = extract (instr, piv, ignore, 1); /* consult setting of curr_agent to determine whether there is a possibility that '.' appears a decimal point and a rel op curr_agent is 1 (query), 5 (definition), 6 (assignment) */ if (i!=0) while ( (i!=0) && ( ( ((curr_agent==1)||(curr_agent==5)||(curr_agent==6)) && ( (i>1) && (isdigit(instr[i-1])) && (i+piv#<=instr#) &&(isdigit(instr[i+piv#])) ) ) || ( ((i>1) && (ischar(instr[i-1])) && (ischar(instr[i])) ) ||( (ischar(instr[i+piv#-1])) && (i+piv#<=instr#) && (ischar(instr[i+piv#])) ) ) ) ) i = extract (instr, piv, ignore, i+piv#); if (i == 0) return []; else return [substr(instr,1,i-1), substr(instr,i+piv#,instr#)]; } /* the three versions of pivot above are a flawed pivot that distinguishes decimal point from intersect, but can this overlook intersect, a better version that finds intersect OK in any event, and a version that also detects when a alphabetic pivot occurs in the adjacent context of a letter, as in IN in SINNING */ func converttonum { para instr; auto i, radix, sum; i = instr#; radix = 1; sum = 0; while ((i >= 1) && (isdigit (instr [i]))) { sum += ((instr [i] - '0') * radix); radix = radix * 10; i--; } if (i==0) return sum; if (!isdigit(instr [i]) && (instr[i]!='.')) return instr; if (instr[i]=='.') sum2 = float(sum) / float(radix); radix = 1; i--; /* writeln(sum2); */ sum= 0; while (i >= 1) { if (!isdigit(instr[i])) return instr; if (isdigit (instr [i])) { sum += ((instr [i] - '0') * radix); radix = radix * 10; i--; } } /* writeln(" ", i); */ return sum+sum2; } autocalc=1; ## ## Original file asgn.e (length 957, dated Oct 10 10:47) follows... ## /* adding an assignment of relations to eddi, as in X = APPLE : PRICE > 0.25;*/ /* observe assignment before the create table clause which is identified through its use of the round brackets. Otherwise have problems with assignments of the form X = ( ... ); Statement 6 is =, statement 7 is create, statement 8 is # */ %eden eddi_statement_7 = ["pivot", "(", ["table_name", "create_state"], ["script", ["declare", "relname ", "cdata"], ["setparas", ["relname"], ["cdata"]], ["later", "$$ = create ($$); addtotablelist (\"$$\");", "relname", "cdata", "relname"], ["execute", "curr_agent=7;"]], ["fail", "eddi_statement_8"]]; eddi_statement_6 = ["pivot", "=", ["table_name", "rel_exp"], ["script", ["declare", "relname", "expr"], ["setparas", ["relname"], ["expr"]], ["later", "$$ = %%;", "relname", "expr"], ["execute", "curr_agent=6;"]], ["fail", "eddi_statement_7"]]; eddi_statement_8 = ["literal", "#", ["script", ["execute", "listtables ();"]]]; ## ## Original file prec.e (length 1191, dated Oct 9 17:57) follows... ## %eden /* this file changes the precedence of the eddi ops - giving higher precedence to * than to % and : and lowest precedence to +, - and . */ rel_exp = op_exp ('+', "rel_exp_1"); rel_exp_1 = op_exp ('-', "rel_exp_2"); rel_exp_5 = op_exp ('*', "rel_exp_6"); rel_exp_2 = op_exp ('.', "rel_exp_3"); rel_exp_3 = ["rev_pivot", "%", ["rel_exp", "attr_list"], ["script", ["declare", "expr_part", "attr_part"], ["setparas", ["expr_part"], ["attr_part"]], ["execute", "%% is " // lookupop ('%') // "(%%, %%);", "v_paras[1]", "expr_part", "attr_part"]], ["ignore", ["bras"]], ["fail", "rel_exp_4"]]; rel_exp_4 = ["rev_pivot", ":", ["rel_exp", "predicate"], ["script", ["declare", "expr_part"], ["setparas", ["expr_part"], []], ["execute", "%% is " // lookupop (':') // "(%%, ##);", "v_paras[1]", "expr_part", "v_substrs[2]"]], ["ignore", ["bras"]], ["fail", "rel_exp_5"]]; /* it overcomes the problems of parsing eddi expressions such as: ?ALLFRUITS * APPLE : BEGIN < 4; and deals with the sql equivalent SELECT * FROM ALLFRUITS, APPLE WHERE BEGIN < 4; well also More complex expressions such as SELECT * FROM ALLFRUITS WHERE (BEGIN < 4 AND END > 8) OR BEGIN = 5; still parse also */ ## ## Original file catalogue.e (length 5792, dated Oct 31 08:21) follows... ## %eddi _CATALOGUE ( relname CHAR, reltype CHAR, defn CHAR, ptr POINTER); %eden /* this line was added after type checking: it makes use of redundant fields in the relation table record that had been inappropriately used for key information */ _CATALOGUE[1][1] = ["string", "string", "string", "pointer"]; func search_CAT { para tablename; auto cat, i, result; cat = _CATALOGUE; i= 1; result = 0; shift cat; while (cat!=[]) { i++; if (cat[1][1] == tablename) result = i; shift cat; } return result; } proc delrelvar { para tablename; /* name of table - as string - presumed to be in the catalogue */ *(_CATALOGUE[search_CAT(tablename)][4]) = @; } eddi_statement_8 = ["literal", "#", ["script", ["execute", "curr_agent=8; showrel(CATALOGUE);"]]]; eddi_statement_1 = ["prefix", "?", "rel_exp", ["script", ["declare", "relname"], ["setparas", ["relname"]], ["later", "showrel (%%);", "relname"], ["execute", "curr_agent=1;"]],["fail", "eddi_statement_2"]]; /* handle this checking elsewhere in parsing rel expressions eddi_statement_1 = ["prefix", "?", "rel_exp", ["script", ["declare", "relname"], ["setparas", ["relname"]], ["later", "if (search_CAT(%%)!=0) showrel (%%); else writeln(\"Table not in catalogue\");", "relname", "relname"], ["execute", "curr_agent=1;"]],["fail", "eddi_statement_2"]]; */ eddi_statement_2 = ["prefix", "~", "table_name", ["script", ["declare", "relname"], ["setparas", ["relname"]], ["later", "if ((%%[1]!='_') && (search_CAT(%%)>2)) { delrelvar(%%); delete _CATALOGUE, search_CAT(%%);} else {if (search_CAT(%%)==2) writeln (\"Can't delete the catalogue\"); else writeln(\"Table / view name is not in the catalogue\");}", "relname", "relname", "relname", "relname", "relname"], ["execute", "curr_agent=2;"]], ["fail", "eddi_statement_3"]]; eddi_statement_5 = ["pivot", "is", ["table_name", "rel_exp"], ["script", ["declare", "relname", "expr"], ["setparas", ["relname"], ["expr"]], ["execute", "curr_agent=5; instr = v_string;"], ["later", "if (search_CAT(%%)==0) { $$ is %%; _CATALOGUE = addvals (_CATALOGUE, [\"$$\", \"view\", instr, &$$]); } else writeln(\"Table name already in use\");", "relname", "relname", "expr", "relname", "relname"]], ["fail", "eddi_statement_6"]]; eddi_statement_6 = ["pivot", "=", ["table_name", "rel_exp"], ["script", ["declare", "relname", "expr"], ["setparas", ["relname"], ["expr"]], ["later", "if (search_CAT(%%)==0) { $$ = %%; _CATALOGUE = addvals (_CATALOGUE, [\"$$\", \"table\", \"\", &$$]); } else writeln(\"Table name already in use\");", "relname", "relname", "expr", "relname", "relname"], ["execute", "curr_agent=6;"]], ["fail", "eddi_statement_7"]]; eddi_statement_7 = ["pivot", "(", ["table_name", "create_state"], ["script", ["declare", "relname", "cdata"], ["setparas", ["relname"], ["cdata"]], ["later", "if (search_CAT(%%)==0) { $$ = create ($$); _CATALOGUE = addvals (_CATALOGUE, [\"$$\", \"table\", \"\", &$$]); } else writeln(\"Table name already in use\");", "relname", "relname", "cdata", "relname", "relname"], ["execute", "curr_agent=7;"]], ["fail", "eddi_statement_8"]]; %eddi CATALOGUE is _CATALOGUE % relname, reltype; %eden func size { para tblname; return *(_CATALOGUE[search_CAT(tblname)][4])# -1; } /* writeln(size("CATALOGUE")); */ func typerel { para tblname; return tail((*(_CATALOGUE[search_CAT(tblname)][4]))[1]); } /* writeln(typerel("CATALOGUE")); */ func typedom { para tblname; return (*(_CATALOGUE[search_CAT(tblname)][4]))[1][1]; } /* writeln(typedom("CATALOGUE")); */ func relvartype { para tblname; return _CATALOGUE[search_CAT(tblname)][2]; } /* writeln(relvartype("CATALOGUE")); */ func viewdefn { para tblname; return _CATALOGUE[search_CAT(tblname)][3]; } func searchCAT { para tablename; auto cat, i, result; cat = CATALOGUE; i= 1; result = 0; shift cat; while (cat!=[]) { i++; if (cat[1][1] == tablename) result = i; shift cat; } return result; } proc describe { para tblname; if (searchCAT(tblname)!= 0) { writeln(tblname // " is a " // relvartype(tblname)); if (relvartype(tblname)=="view") writeln("\tdefn: " // viewdefn(tblname)); write("\ttype: "); writeln(typedom(tblname)); write("\tattr: "); writeln(typerel(tblname)); write("\tsize: "); writeln(size(tblname)); } else writeln ("There is no table or view ", tblname); } eddi_statement = ["suffix", ";", "eddi_statement_0", ["fail", "eddi_statement_0"]]; eddi_statement_0 = ["prefix", "??", ["describetbl"], ["fail", "eddi_statement_1"]]; describetbl = ["read_all", [], ["script", ["execute", "if (searchCAT(\"%%\")!=0) describe(\"%%\"); else writeln(\"%%\" // \" is not in the catalogue\");", "v_string", "v_string", "v_string"]]]; eddi_statement_6 = ["pivot", "=", ["table_name", "rel_exp"], ["script", ["declare", "relname", "expr"], ["setparas", ["relname"], ["expr"]], ["later", "if (search_CAT(%%)==0) { if (%%!=@) {$$ = %%; _CATALOGUE = addvals (_CATALOGUE, [\"$$\", \"table\", \"\", &$$]);} else writeln(\"Invalid assignment\"); } else writeln(\"Table name already in use\");", "relname", "expr", "relname", "expr", "relname", "relname"], ["execute", "curr_agent=6;"]], ["fail", "eddi_statement_7"]]; eddi_statement_5 = ["pivot", "is", ["table_name", "rel_exp"], ["script", ["declare", "relname", "expr"], ["setparas", ["relname"], ["expr"]], ["execute", "curr_agent=5; instr = v_string;"], ["later", "if (search_CAT(%%)==0) { if (%%!=@) {$$ is %%; _CATALOGUE = addvals (_CATALOGUE, [\"$$\", \"view\", instr, &$$]);} else writeln(\"Invalid definition\"); } else writeln(\"Table name already in use\");", "relname", "expr", "relname", "expr", "relname", "relname"]], ["fail", "eddi_statement_6"]]; ## ## Original file newproject.e (length 3268, dated Oct 23 09:35) follows... ## %eden /* 22/10/01 WMB attempts to prevent serious errors when projection called with invalid arguments. Now check to see whether list of attrs in projection is valid, and whether really have a table value to project from. If invalid, returns @ rather than [[[]]] */ func isinlist { para elt, lst; auto result; result = 0; while(lst!=[]) { if (elt==lst[1]) result = 1; shift lst; } return result; } func inclist { para l1, l2; auto result; result = 1; while (l2!=[]) { if (!isinlist(l2[1], l1)) result = 0; shift l2; } return result; } /* func project /* t2 = project(t1,c_list) */ { auto i,j,k; /* writeln("Project called with pars ", $1, " ", $2); */ if ($#<1) { writeln("EDEN: ERROR: table not provided for project."); return @; } else { if ($1==@) { writeln("EDEN: ERROR: project has received an "// "undefined table."); return @; } else if (!inclist(tail($1[1]), $2)){ writeln("EDEN: ERROR: invalid attribute "// "in projection."); return @; } } tlist = [[[]]]; /* For renaming attrs: c_list can contain [col_name,new_name] - ME*/ for (i=1; i<=$2#; i++) if (type($2[i]) == "list") { append tlist[1],$2[i][2]; $2[i] = $2[i][1]; } else append tlist[1],$2[i]; for (i=2; i<=$1#; i++) append tlist,[]; for (i=1; i<=$2#; i++) { addcol = getcolumn($1,$2[i]); append tlist[1][1], $1[1][1][addcol]; for (j=2; j<=$1#; j++) append tlist[j], $1[j][addcol]; } return makedistinct(tlist); } */ func extractattrs { para attrlist; auto result; result = []; while (attrlist != []) { result = result // [(type(attrlist[1])=="list")?attrlist[1][1]:attrlist[1]]; shift attrlist; } return result; } func project { auto i,j,k,attr; /* project takes as its 2nd argument a single attribute name or an (attribute name, rename) pair */ /* writeln("Project called with pars ", $1, " ", $2); */ if ($#<1) { writeln("EDEN: ERROR: table not provided for project."); return @; } else { if ($1==@) { writeln("EDEN: ERROR: project has received an "// "undefined table."); return @; } else if (!inclist(tail($1[1]), extractattrs($2))) { writeln("EDEN: ERROR: invalid attribute "// "in projection."); return @; } } tlist = [[[]]]; /* For renaming attrs: c_list can contain [col_name,new_name] - ME*/ for (i=1; i<=$2#; i++) if (type($2[i]) == "list") { append tlist[1],$2[i][2]; $2[i] = $2[i][1]; } else append tlist[1],$2[i]; for (i=2; i<=$1#; i++) append tlist,[]; for (i=1; i<=$2#; i++) { addcol = getcolumn($1,$2[i]); append tlist[1][1], $1[1][1][addcol]; for (j=2; j<=$1#; j++) append tlist[j], $1[j][addcol]; } return makedistinct(tlist); } ## ## Original file renameattrs.e (length 445, dated Oct 22 21:47) follows... ## attr_list = ["split", ",", "col_naming", ["script", ["allparas", "attrs"], ["execute", "%% is %%;", "v_paras[1]", "attrs"]]]; col_naming = ["pivot", ">>", ["col_name", "col_name"], ["script",["declare", "nameL", "nameR"], ["setparas", ["nameL"], ["nameR"]], ["execute", "%% is [%%, %%];", "v_paras[1]", "nameL", "nameR"]], ["fail", "col_name"]]; col_name = ident_ex ([["script", ["execute", "%% = \"%%\";", "v_paras[1]", "v_string"]]]); ## ## Original file comment.e (length 816, dated Oct 25 22:16) follows... ## eddi_statement = ["suffix", ";", "eddi_comment", ["fail", "eddi_comment"]]; eddi_comment = ["prefix", "##", ["anything"], ["fail", "eddi_statement_0"]]; eddi_notation = ["\n", "eddi_statement", []]; /* eddi_comment = ["prefix", "##", ["anyline"], ["fail", "eddi_statement_0"]]; anyline = ["read_line", []]; func read_line { para instr; auto i, result; result = ""; i=1; if (instr#>0) while ((i<=instr#) && (instr[i]!='\n')) { result = result // instr[i]; i++; } return result; } */ /* having problems with this - with read_all comments are eating into lines until terminated by a semi-colon, and above is causing index errors. Previous attempts giving lower precedence to the match with prefix ## interfered with comments with keywords (such as 'is') in them! */ ## ## Original file deps.e (length 3753, dated Nov 20 15:56) follows... ## func dependants { para tblname; auto result, symbolinfo, currvar, ddcurrvar; result = [[], []]; symbolinfo = symboldetail(tblname)[4]; /* writeln(symboldetail(tblname)[4]); */ if (symbolinfo!=[]) while (symbolinfo!=[]) { currvar = symbolinfo[1]; if (search_CAT(currvar)!=0) result[1] = result[1] // [currvar]; else result[2] = result[2] // [currvar]; ddcurrvar = dependants(currvar); result[1] = result[1] // ddcurrvar[1]; result[2] = result[2] // ddcurrvar[2]; shift symbolinfo; } result[1] = Makedistinct(result[1]); result[2] = Makedistinct(result[2]); return result; } func dependees { para tblname; auto result, symbolinfo, currvar, ddcurrvar; result = [[], []]; symbolinfo = symboldetail(tblname)[5]; /* writeln(symboldetail(tblname)[4]); */ if (symbolinfo!=[]) while (symbolinfo!=[]) { currvar = symbolinfo[1]; if (search_CAT(currvar)!=0) result[1] = result[1] // [currvar]; else result[2] = result[2] // [currvar]; ddcurrvar = dependees(currvar); result[1] = result[1] // ddcurrvar[1]; result[2] = result[2] // ddcurrvar[2]; shift symbolinfo; } result[1] = Makedistinct(result[1]); result[2] = Makedistinct(result[2]); return result; } /* Makedistinct invocation introduced here by WMB on 20/11/01 */ /* proc garbage_collect { auto i, j, dCAT; for (i=3; i<=CATALOGUE#; i++) { dCAT = dependants(CATALOGUE[i][1]); writeln("i = ", i); writeln(dCAT); writeln((dCAT[2])#); for (j=1; j<=dCAT[2]#; j++) { writeln(dependants(dCAT[2][j])); if ((dependants(dCAT[2][j])[1])==[]) { writeln(dCAT[2][j]); } } } } */ /* idea is to inspect the list of dependants of variables in the CATALOGUE that are of the form var_ ... , and perform x=x; for each one that has no dependant in the CATALOGUE */ proc garbage_collect { auto i, j, dCAT; for (i=2; i<=CATALOGUE#; i++) { dCAT = dependants(CATALOGUE[i][1]); /* writeln("i = ", i); writeln(dCAT); writeln((dCAT[2])#); */ for (j=1; j<=dCAT[2]#; j++) { /* writeln(dependants(dCAT[2][j])); */ if ((dependants(dCAT[2][j])[1])==[]) { /* writeln(dCAT[2][j]); */ self_asgn(dCAT[2][j]); } } } } proc self_asgn { para varname; execute (varname // "=" // varname //";"); } /* this removes all links to var_n variables that aren't used to maintain views - could also execute forget(varname); to delete entirely */ eddi_statement = ["suffix", ";", "eddi_comment", ["script", ["later", "garbage_collect();"]], ["fail", "eddi_comment"]]; /* eliminate inappropriate dependencies after each eddi_statement */ proc describe { para tblname; if (searchCAT(tblname)!= 0) { writeln(); writeln(tblname // " is a " // relvartype(tblname)); if (relvartype(tblname)=="view") writeln("\tdefn: " // viewdefn(tblname)); write("\ttype: "); writeln(typedom(tblname)); write("\t\attr: "); writeln(typerel(tblname)); write("\tsize: "); writeln(size(tblname)); write("The list of views dependent on ", tblname, " is : "); writeln(dependants(tblname)[1]); writeln(); } else writeln ("There is no table or view ", tblname); } eddi_statement_2 = ["prefix", "~", "table_name", ["script", ["declare", "relname"], ["setparas", ["relname"]], ["later", "if ((%%[1]!='_') && (search_CAT(%%)>2) && (dependants(%%)[1]==[])) { delrelvar(%%); delete _CATALOGUE, search_CAT(%%);} else {if (search_CAT(%%)==2) writeln (\"Can't delete the catalogue\"); else {if ((search_CAT(%%)>2) && (dependants(%%)[1]!=[])) writeln(\"Cannot delete table / view with dependants\"); else writeln(\"Table / view name is not in the catalogue\");}}", "relname", "relname", "relname", "relname", "relname", "relname", "relname", "relname"], ["execute", "curr_agent=2;"]], ["fail", "eddi_statement_3"]]; ## ## Original file checktype.e (length 5671, dated Oct 31 08:05) follows... ## /* these observation rules need not be changed - include for info: eddi_statement_7 = ["pivot", "(", ["table_name", "create_state"], ["script", ["declare", "relname", "cdata"], ["setparas", ["relname"], ["cdata"]], ["later", "if (search_CAT(%%)==0) { $$ = create ($$); _CATALOGUE = addvals (_CATALOGUE, [\"$$\", \"table\", \"\", &$$]); } else writeln(\"Table name already in use\");", "relname", "relname", "cdata", "relname", "relname"], ["execute", "curr_agent=7;"]], ["fail", "eddi_statement_8"]]; create_state = ["suffix", ")", "create_state_1", ["script", ["declare", "cdata"], ["setparas", ["cdata"]], ["execute", "%% is convertcols (%%);", "v_paras[1]", "cdata"]]]; create_state_1 = ["split", ",", "col_info", ["script", ["allparas", "cols"], ["execute", "%% is %%;", "v_paras[1]", "cols"]]]; col_info = ["pivot", " ", ["col_name", "col_info_2"], ["script", ["declare", "cname", "cdata"], ["setparas", ["cname"], ["cdata"]], ["execute", "%% is [%%, %%];", "v_paras[1]", "cname", "cdata"]]]; col_info_2 = ["suffix", "key", "anything", ["script", ["execute", "%% = \"#\";", "v_paras[1]"]], ["fail", "col_info_3"]]; */ col_info_3 = ["read_all", [], ["script", ["execute", "%% = \"%%\";", "v_paras[1]", "v_string"]]]; /* modifying col_info_3 to return the type of the domain for col */ /* func create { auto i, tlist; tlist = [[[]]]; for (i=1; i<=$#; i+=2) { append tlist[1],$[i]; if (($[i+1] == "CHAR")||($[i+1] == "char")) append tlist[1][1],"string"; else if (($[i+1] == "REAL")||($[i+1] == "real")) append tlist[1][1],"float"; else append tlist[1][1],"int"; } return tlist; } */ /* for type checking in tuple introduction not to pose problems initially, must ensure that _CATALOGUE has typeseq as given by _CATALOGUE[1][1] = ["string", "string", "string", "pointer"]; */ func create { auto i, tlist; /* for (i=1; i<=$#; i++) writeln($[i]); */ tlist = [[[]]]; for (i=1; i<=$#; i+=2) { append tlist[1],$[i]; if (($[i+1] == "CHAR")||($[i+1] == "char")) append tlist[1][1],"string"; else if (($[i+1] == "REAL")||($[i+1] == "real")) append tlist[1][1],"float"; else if (($[i+1] == "INT")||($[i+1] == "int")) append tlist[1][1],"int"; else if (($[i+1] == "POINTER")||($[i+1] == "pointer")) append tlist[1][1],"pointer"; else { writeln("Unrecognised type - defaults to int"); append tlist[1][1], "int";} } return tlist; } /* also need to restrict add and delete tuples to views eddi_statement_3 = ["pivot", "<<", ["table_name", "tuples"], ["script", ["declare", "relname"], ["setparas", ["relname"], []], ["later", "$$ = addvals ($$, %%);", "relname", "relname", "v_substrs[2]"]], ["fail", "eddi_statement_4"]]; */ func istablevar { para tblname; return ((search_CAT(tblname)!=0) && (CATALOGUE[search_CAT(tblname)][2]=="table")); } /* writeln(istablevar("allfruits")); writeln(istablevar("allfruit")); writeln(istablevar("FRUITS")); */ eddi_statement_3 = ["pivot", "<<", ["table_name", "tuples"], ["script", ["declare", "relname"], ["setparas", ["relname"], []], ["execute", "curr_agent=3;"],["later", "if(istablevar(\"$$\")) $$ = addvals ($$, %%); else writeln(\"Can't add tuples to a view / non-existent table\");", "relname", "relname", "relname", "v_substrs[2]"]], ["fail", "eddi_statement_4"]]; eddi_statement_4 = ["pivot", "!!", ["table_name", "tuples"], ["script", ["declare", "relname"], ["setparas", ["relname"], []], ["execute", "curr_agent=4;"], ["later", "if(istablevar(\"$$\")) $$ = delvals ($$, %%); else writeln(\"Can't delete tuples from a view / non-existent table\");", "relname", "relname", "relname", "v_substrs[2]"]], ["fail", "eddi_statement_5"]]; /* eddi_statement_3 and eddi_statement_4 have been modified to prevent adding to / deleting from a view: require no further modification - only addvals needs to be changed to prevent inappropriately typed tuples from being introduced */ func addvals /* table2 = addvals(t1,tup1,tup2,...,tupN) */ { auto i; if ($#<1) { writeln("EDEN: ERROR: table not provided for addvals."); return [[[]]]; } else if ($1==@) { writeln("EDEN: ERROR: addvals has received an "// "undefined table."); return [[[]]]; } for (i=2; i<=$#; i++) { if ($1[1]#-1 == $[i]#) { if (typeseq($[i])==$1[1][1]) { if (notin($1,$[i])==1) { append $1,$[i]; /* writeln("Tuple added to table"); */ } else writeln("EDDI/EDEN ERROR: tuple exists already."); } else writeln("EDEN: ERROR: Tuple of incorrect datatype"); } else writeln("EDEN: ERROR: incorrect number of values."); } return $1; } /* typeseq returns the list of types of tuple elts in a list */ func typeseq { para tple; auto result; result = []; while (tple!=[]) { result = result // [type(tple[1])]; shift tple; } return result; } func ucompatdom /* bool = ucompat(t1,t2): union compatible on domain */ { return ($1[1][1] == $2[1][1]); } func ucompatrel /* bool = ucompat(t1,t2): union compatible on attrname */ { return (tail($1[1]) == tail($2[1])); } /* propose to define ucompat(x,y) as ucompatdom(x,y) && ucompatdom(x,y); */ func ucompat { para x,y; return ucompatdom(x,y) && ucompatrel(x,y); } ## ## Original file error.e (length 2401, dated Oct 31 08:03) follows... ## eddi_statement_8 = ["literal", "#", ["script", ["execute", "curr_agent = 8; showrel (CATALOGUE);"]], ["fail", "error_unrecog"]]; error_unrecog = ["read_all", [], ["script", ["execute", "writeln(\"Unrecognised EDDI statement\");"]]]; table_name = ident_ex ([["script", ["execute", "%% = \"%%\";", "v_paras[1]", "v_string"]], ["fail", "error_tblname"]]); table_val = ident_ex ([["script", ["execute", "if (search_CAT(%%) != 0) %% is %%; else writeln(\"Invalid table\"", "v_string", "v_paras[1]", "v_string"]], ["fail", "error_tblval"]]); /* table_val = ident_ex ([["script", ["execute", "%% is %%;", "v_paras[1]", "v_string"]], ["fail", "error_tblval"]]); */ table_val = ident_ex ([["script", ["execute", "if (search_CAT(\"%%\")!=0) %% is %%; else writeln(\"Invalid table reference\");", "v_string", "v_paras[1]", "v_string"]], ["fail", "error_tblval"]]); error_tblval = ["read_all", [], ["script", ["execute", "writeln(\"Unrecognised table value\");"]]]; error_tblname = ["read_all", [], ["script", ["execute", "writeln(\"Unrecognised table name\");"]]]; /* other error issue addressed 27/10/01 is response to ?select; in eddi: don't invoke showrel(tblname) unless the table name is in the catalogue - modified table_val above is to fix this */ alphanum = ["read_all", [["a", "z"], ["A", "Z"], ["_"], ["0", "9"]], ["fail", "error_ident"]]; error_ident = ["read_all", [], ["script", ["execute", "writeln(\"Unrecognised EDDI identifier\");"]]]; col_name = ident_ex ([["script", ["execute", "%% = \"%%\";", "v_paras[1]", "v_string"]], ["fail", "error_col_name"]]); error_col_name = ["read_all", [], ["script", ["execute", "writeln(\"EDDI: unrecognised column name\");"]]]; col_info = ["pivot", " ", ["col_name", "col_info_2"], ["script", ["declare", "cname", "cdata"], ["setparas", ["cname"], ["cdata"]], ["execute", "%% is [%%, %%];", "v_paras[1]", "cname", "cdata"]], ["fail", "error_col_info"]]; error_col_info = ["read_all", [], ["script", ["execute", "writeln(\"EDDI: unrecognised column for projection\");"]]]; create_state = ["suffix", ")", "create_state_1", ["script", ["declare", "cdata"], ["setparas", ["cdata"]], ["execute", "%% is convertcols (%%);", "v_paras[1]", "cdata"]], ["fail", "error_create_state"]]; error_create_state = ["read_all", [], ["script", ["execute", "writeln(\"EDDI: unrecognised tuple list in table create\");"]]]; ## ## Original file truncate.e (length 1629, dated Oct 29 13:00) follows... ## /* this introduces ~~X; for DROP and ~X; for TRUNCATE */ /* eddi_statement_2 = ["prefix", "~~", "table_name", ["script", ["declare", "relname"], ["setparas", ["relname"]], ["later", "if ((%%[1]!='_') && (search_CAT(%%)>2)) { delrelvar(%%); delete _CATALOGUE, search_CAT(%%);} else {if (search_CAT(%%)==2) writeln (\"Can't delete the catalogue\"); else writeln(\"Table / view name is not in the catalogue\");}", "relname", "relname", "relname", "relname", "relname"], ["execute", "curr_agent=2;"]], ["fail", "eddi_statement_2a"]]; */ eddi_statement_2a = ["prefix", "~", "table_name", ["script", ["declare", "relname"], ["setparas", ["relname"]], ["later", "if ((%%[1]!='_') && (search_CAT(%%)!=0)) {if (CATALOGUE[search_CAT(%%)][2]==\"table\") $$ = [$$[1]]; else writeln(\"Can't truncate a view\");} else writeln(\"Table / view name is not in the catalogue\");", "relname", "relname", "relname", "relname", "relname"],["execute", "curr_agent = 2;"]],["fail", "eddi_statement_3"]]; eddi_statement_2 = ["prefix", "~~", "table_name", ["script", ["declare", "relname"], ["setparas", ["relname"]], ["later", "if ((%%[1]!='_') && (search_CAT(%%)>2) && (dependants(%%)[ 1]==[])) { delrelvar(%%); delete _CATALOGUE, search_CAT(%%);} else {if (search_CAT(%%)==2) writeln (\"Can't delete the catalogue\"); else {if ((search_CAT(%%)>2) && (dependants(%%)[1]!=[])) writeln(\"Cannot delete table / view with dependants\"); else writeln(\"Table / view name is not in the catalogue\");}}", "relname", "relname", "relname", "relname", "relname", "relname", "relname", "relname"], ["execute", "curr_agent=2;"]], ["fail", "eddi_statement_2a"]]; ## ## Original file unnjoin.e (length 957, dated Oct 31 23:22) follows... ## /* this is the SQL style unnatural join that replaces natural join */ func unnjoin { auto i,j,k,x,y,z; if ($#<2) { writeln("EDEN: ERROR: two tables not provided for njoin."); return @; } else if (($1==@) || ($2==@)) { writeln("EDEN: ERROR: njoin has received at least one "// "undefined table."); return @; } tlist1 = []; vals1 = []; vals2 = []; nvals1 = []; nvals2 = []; append tlist1, $1[1]; matcols = matchcols($1,$2); for (i=1; i<=matcols[1]#; i++) { $1[1][matcols[1][i]] = $1[1][matcols[1][i]] // "_1"; $2[1][matcols[2][i]] = $2[1][matcols[2][i]] // "_2"; } /* writeln($1[1]); */ attr = $1[1]; attr[1] = attr[1] // $2[1][1]; /* writeln($2[1]); */ for (i=2; i<=$2[1]#; i++) append attr, $2[1][i]; tlist = [attr]; /* writeln(tlist); */ for (x=2;x<=$1#;x++) for (y=2; y<=$2#; y++) { append tlist, ($1[x] // $2[y]); } return tlist; } ## ## Original file uneddify.e (length 909, dated Nov 1 17:08) follows... ## %eden ## the uneddifying interface func ucompatdomrel { para x,y; return ucompatdom(x,y) && ucompatrel(x,y); } distinctvals = [1,0]; ucompatval = [ucompatdomrel, ucompatdom, ucompatrel]; joinval = ["njoin", "unnjoin"]; /* these descriptive identifiers aren't used except to initialise variables temporarily, but indicate the semantics of the various options for ucompatix etc */ CHECKDOMREL = 1; CHECKDOM = 2; CHECKREL = 3; NODUPROWS = 1; DUPROWS = 2; NATJOIN = 1; UNNATJOIN = 2; ucompatix = CHECKDOMREL; distinctix = NODUPROWS; joinix = NATJOIN; ucompat is ucompatval[ucompatix]; EDDI_distinct is distinctvals[distinctix]; EDDI_join is joinval[joinix]; operators is [[':',"select_wrapper"],['%',"project"],['.',"inter"],['*',EDDI_join],['+',"union"],['-',"diff"]]; rel_exp_5 is op_exp('*', "rel_exp_6"); proc changejoin: joinix { touch(&op_exp); } ## ## Original file ignoreva.e (length 559, dated Nov 29 19:13) follows... ## %eden /* Fix by Ash: Ignore virtual agent statements */ eddi_comment = ["prefix", "##", ["anything"], ["fail", "eddi_virtualagent1"]]; eddi_virtualagent1 = ["prefix", ">>", ["anything"], ["fail", "eddi_virtualagent2"]]; eddi_virtualagent2 = ["prefix", "<>", ["anything"], ["fail", "eddi_virtualagent3"]]; eddi_virtualagent3 = ["prefix", "><", ["anything"], ["fail", "eddi_virtualagent4"]]; eddi_virtualagent4 = ["prefix", "<<", ["anything"], ["fail", "eddi_virtualagent5"]]; eddi_virtualagent5 = ["prefix", ">~", ["anything"], ["fail", "eddi_statement_0"]]; ## ## Original file newaddvals.e (length 730, dated Nov 29 09:25) follows... ## /* this modified version of addvals allows duplicate tuples to be added to a table when EDDI is working in "allow duplicate tuple" evaluation mode */ func addvals /* table2 = addvals(t1,tup1,tup2,...,tupN) */ { auto i; if ($#<1) { writeln("EDEN: ERROR: table not provided for addvals."); return @; } else if ($1==@) { writeln("EDEN: ERROR: addvals has received an "// "undefined table."); return @; } for (i=2; i<=$#; i++) { if ($1[1]#-1 == $[i]#) { if ((notin($1,$[i])==1) || EDDI_distinct==0) append $1,$[i]; else writeln("EDDI/EDEN ERROR: tuple exists already."); } else writeln("EDEN: ERROR: incorrect number of values."); } return $1; } ## ## Original file commafix.e (length 173, dated Feb 27 20:49) follows... ## /* Allows strings to contain commas - fix by Ash 24-2-2002 */ quotes=[["\"", "\""], ["quotes"]]; addblocks("quotes"); tuple_2=["split",",","tuple_3",["ignore",["quotes"]]]; */ func istablevar { para tblname; return ((search_CAT(tblname)!=0) && (CATALOGUE[search_CATtkeden1.41/lib-tkeden/eden.eden010064400025250000164000000361450747346107500164360ustar00ashleyem00003510000005/* * $Id: eden.eden,v 1.2 2002/03/01 23:52:06 cssbz Exp $ */ /*--------------------------------------------------------------------------- function macro(macro_str, para_str1, para_str2, .., para_strN) Expands 'macro_str' by substituting 'para_strI' for "?I" and returns the resultant string (ref.: Edward Yung, M.Sc. thesis, `89, vol.2). ---------------------------------------------------------------------------*/ func macro { auto i, j, l, m, n, c, s; s = ""; l = (m = $1)#; shift; i = 1; while (i <= l) { for (j = i; j <= l && m[j] != '?'; j++); if (i != j) s = s // substr(m, i, j - 1); if (j <= l) { j++; n = (c = (j > l) ? '?' : m[j]) - '0'; s = s // ((1 <= n && n <= $#) ? $[n] : c); } i = j + 1; } return s; } proc installeddi { include(getenv("TKEDEN_LIB")//"/eddi.eden"); } /* symboldefinition returns the Eden definition of a symbol s in a form that can be given to the Eden parser (via execute(), todo() etc), whatever the type of symbol s. It will return a blank string when asked for the definition of a builtin function (since there is no meaningful Eden code representation of the function). This function is intended to fix problems with the data returned by symboldetail() etc. Pass symboldefinition a string naming the symbol or a pointer to the symbol. */ func symboldefinition { para s; auto sd, ret; /* convert s to a pointer if it is not already */ if (type(s) == "string") s = &`s`; else if (type(s) != "pointer") error("address or symbol name needed (got "//type(s)//")"); sd = symboldetail(s); switch (sd[2]) { case "var": if (type(*s) == "string") ret = nameof(s) // "=\"" // str(*s) // "\";"; else ret = nameof(s) // "=" // str(*s) // ";"; break; case "formula": ret = nameof(s) // " is" // sd[3]; break; case "proc": ret = "proc " // nameof(s) // " " // sd[3] // ";"; break; case "procmacro": ret = "procmacro " // nameof(s) // " " // sd[3] // ";"; break; case "func": ret = "func " // nameof(s) // " " // sd[3] // ";"; break; case "builtin": case "Real-func": case "C-func": ret = ""; break; } return ret; } /* this copies a proc to a new name. copy("rot", "rotnew"); copies the definition of proc rot to proc rotnew. */ proc copyproc { para old, new; execute("proc " // new // " " // symboltext(old) // ";"); } /* this adjusts the definition of a proc so that, when called, the parameters and, optionally, return result are printed. showpara("rot", 1) causes proc rot to show its parameters when called. */ proc showpara { para p, showret; copy(p, p // "_preshowpara"); execute(macro(" proc ?1 { auto ret; write(\"?1: \", $, \"...\"); ret=apply(?1_preshowpara, $); if (?2) writeln(ret); return ret; }; ", str(p), str(showret))); } /* Make a real value into an integer with rounding. (by Chris Roe) */ func round { para r; if (r-int(r)>=0.5) return int(r)+1; else return int(r); } /* The following are some eden primitive functions */ /* Chris Roe - May 2002 */ /* Each function has a header comment to explain its usage and an example */ /* max returns the maximum of the parameters it is passed. e.g max(1,2)=2, max(1,2,3,4,5,6) = 6. */ func max { auto result,i,data; if (type($[1])=="list") {data= $[1];} else {data = $;} result = data[1]; for (i=1; i<=data#; i++) { if (data[i]>result) {result = data[i];} } return result; } /* min returns the minimum of the parameters it is passed. e.g min(1,2)=1, min(3,4,5,6) = 3 */ func min { auto result,i,data; if (type($[1])=="list") {data= $[1];} else {data = $;} result = data[1]; for (i=1; i<=data#; i++) { if (data[i]=0) {return num;} else {return -num;} } /* nthroot returns the nth root of the number it is passed and the root it is asked for. e.g nthroot(4,2)=2, nthroot(81,4)=3 */ /* there may be some problems with this .. e.g nthroot(1028,10) should = 2 but actually comes out as 2.0000789 etc */ func nthroot { para num, root; return pow(num,1.0/root); } /* factorial returns the factorial of the number it is passed. Only works with integers.. e.g factorial(4)=24, */ func factorial { para num; auto i,result; if ((type(num)!="int")||(num<0)) {return @;} if (num==0) {return 1;} result = 1; for (i=1; i<=num; i++) { result = result * i; } return result; } /* product returns the product of the parameters it is passed. Only works with numbers... e.g product(2,3)=6, product(4,7,2)= 56 */ func product { auto i,result,data; if (type($[1])=="list") {data= $[1];} else {data = $;} result = 1; for (i=1; i<=data#; i++) { if ((type(data[i])!="int")&&(type(data[i])!="float")) {return @;} result = result * data[i]; } return result; } /* sign returns -1 if the number passed is -ve, 0 if it is 0 and 1 if it is +ve e.g sign(4)=1, sign(-230.2323)= -1 */ func sign { para num; if (num<0) {return -1;} if (num>0) {return 1;} return 0; } /* even returns the nearest even number to the number given. negative numbers are adjusted away from zero. e.g even(4.5)=4, even(5.5)=6*/ func even { para num; /* e.g 4.5 .. int(4.5) = 4, 4%2=0.. so 4 closest even number */ if (int(num) % 2 == 0) {return int(num);} /* otherwise got to be odd and closer to the next even number which will be +1 */ /* use sign for -ve numbers which will have % result of -1.. try writeln(int(-3.2)%2); */ return int(num)+sign(num); } /* even returns the nearest odd number to the number given. negative numbers are adjusted away from zero. e.g odd(4.5)=5, odd(3.5)=3*/ func odd { para num; /* if its closest to an even number, return num+sign(num), i.e the nearest odd */ if (int(num) % 2 == 0) { return int(num)+sign(num); } /* otherwise int is already odd so return that.. */ return int(num); } /* mround returns the number rounded to the nearest multiple.. e.g mround(62,6)=60 */ func mround { para num,multiple; /* need to force floating point division */ return sign(num)*round(float(abs(num))/multiple)*multiple; } /* sumsq returns the sum of the squares of the parameters passed to it, e.g sumsq(2,3,4) = 29 */ func sumsq { auto i, result,data; if (type($[1])=="list") {data= $[1];} else {data = $;} result = 0; for (i=1; i<=data#; i++) { if ((type(data[i])!="int")&&(type(data[i])!="float")) {return @;} result = result + (data[i]*data[i]); } return result; } /* trunc returns the number with the fractional part removed. this is the same as the int function in eden - included for completeness.. e.g trunc(4.56)=4 */ func trunc { return int($[1]); } /* combin returns the number of ways n items can be picked from a total number of items. the n cannot be more than the total.. e.g combin(4,2)=6 */ func combin { para total,n; if (n>total) {return @;} return factorial(total)/(factorial(n)*factorial(total-n)); } /* ceiling returns the number rounded *up* to the nearest multiple of significance, e.g ceiling(62,6)=66 */ func ceiling { para num, multiple; /* i.e the case that matches mround() */ if (mround(num,multiple)>=((float(num)/multiple)*multiple)) { return mround(num,multiple); } /* otherwise if mround rounds down, add the multiple to it */ return mround(num,multiple)+multiple; } /* floor returns the number rounded *down* to the nearest multiple of significance, e.g floor(64,6)=60 */ func floor { para num, multiple; /* i.e the case that matches mround() */ if (mround(num,multiple)<=((num/multiple)*multiple)) { return mround(num,multiple); } /* otherwise if mround rounds down, add the multiple to it */ return mround(num,multiple)-multiple; } /* degrees takes an angle in radians and converts it to degrees, e.g degrees(PI)=180 */ func degrees { para angleinradians; return (angleinradians * (180/PI)) - (trunc((angleinradians * (180/PI))/360)*360) ; } /* radians takes an angle in degrees and converts it to radians, e.g radians(180)=3.14 etc */ /*NOTE - see degrees for implementational issue */ func radians { para angleindegrees; return (angleindegrees / (180/PI)) - (trunc((angleindegrees / ((180/PI))/(2*PI)))*(2*PI)); } /* rounddigits takes a number and rounds it to the number of digits specified.. e.g round(123,2) = 120, round(123,1) = 100, round(123.232,4)=123.2 */ func rounddigits { para num,digits; auto intpart,fracpart,numdigits; auto negative; negative = sign(num); if (sign(num)==-1) {num = -num;} intpart = int(num); fracpart = num-int(num); numintdigits = ceiling(log10(num),1); /* no fractional part - and more digits specified than in num, e.g round(123,4)=123 */ if ((fracpart==0)&&(pow(10,digits-1)>num)) {return num*negative;} /* if the number has a fractional part but the number of digits required is less than this, i.e rounddigits(123.56767,2) we can ignore the fraction. Note that we cannot ignore the fraction if the same.. e.g rounddigits(123.8,3)=129... */ if (ceiling(log10(num),1)>digits) {num = int(num);} if ((pow(10,digits-1) <= num) ) { /*i.e we are returning an integer */ if ((num % (int(pow(10,numintdigits-digits)))) < (pow(10,numintdigits-digits)/2)) { /* pow and % used to return the values */ return (num - num % (int(pow(10,numintdigits-digits))))*negative; } else { return (num - num % (int(pow(10,numintdigits-digits))) + pow(10,numintdigits-digits))*negative; } } /* otherwise we've got a real number to deal with */ /* sorts out case when e.g rounddigits(123.8,3) or rounddigits(1234.4,4).. */ if (ceiling(log10(num),1)==digits) {return round(num)*negative;} /* otherwise the answer will also be a real number and we have a real number.. */ return (intpart +round(fracpart*pow(10,digits-numintdigits))* (pow(10,-(digits-numintdigits))))*negative; } /* more eden primitive functions - 2nd may 2002, chris roe */ /* gcd takes numeric parameters and returns their greatest common divisor. any number of numbers can be passed.. e.g gcd(2,6)=2, gcd(6,9,24)=3, gcd(3,7,24,28)=1 */ func gcd { auto n1,n2,data,temp; if (type($[1])=="list") {data = $[1];} else {data = $;} while (data#>2) { temp = gcd(data[1],data[2]); data[2] = temp; delete data,1; } n1 = data[1]; n2 = data[2]; /* now have 2 numbers.. n1 & n2.. can compute gcd directly */ /* use euclid's algorithm.. */ r = 1; while (r>0) { /* ensure n1>n2 by swapping if neccessary */ if (n2>n1) {temp = n2; n2 = n1; n1 = temp;} r = n1 % n2; if (r==0) {return n2;} n1 = r; } return min(n1,n2); } /* lcm takes numeric parameters and returns the lowest common multiple of them.. e.g lcm(8,12)=24, lcm(4,6,8)=24. Note - use the fact that gcd(a,b)*lcm(a,b)=a*b for all a and b integers... see maths textbook for a proof!! */ func lcm { auto n1,n2,data,temp; if (type($[1])=="list") {data = $[1];} else {data = $;} while (data#>2) { temp = lcm(data[1],data[2]); data[2] = temp; delete data,1; } n1 = data[1]; n2 = data[2]; /* now assume have 2 numbers, n1 & n2.. can compute lcm directly */ return (n1*n2)/gcd(n1,n2); } /* variance takes and calculates the variance, i.e the sum of the deviations between each element and the mean divided by the number of data points. It can cope with either a number of numeric parameters passed to it, or a list containing numbers... e.g variance(23,34,46,2343) or variance(b) where b=[432,43,56,78] etc */ func variance { auto avg,data,i,result; if (type($[1])=="list") {data = $[1];} else {data = $;} /* data now contains a list of numbers */ avg = average(data); result = 0; for (i=1; i<=data#; i++) { result = result + ((data[i]-avg)*(data[i]-avg)); } return float(result) / data#; } /* stdev takes a list of numbers or numeric parameters and returns the standard deviation, or the square root of the variance... e.g stdev(23,45,67) or stdev(b) where b=[3,4,5,9] */ func stdev { auto data; if (type($[1])=="list") {data = $[1];} else {data = $;} return sqrt(variance(data)); } /* given a list of numbers, sorts them into ascending or descending order... */ /* uses bubble sort! improve sorting algorithm... */ /* 1 = ascending, 2 = descending */ func sort { para l,dir; auto i,j,result,temp,swap,ascending,descending; ascending = 1; descending = 2; swap = 1; while (swap>0) { swap = 0; for (i=1; i<=l#-1; i++) { if ( ((dir==ascending)&&(l[i]>l[i+1])) || ((dir==descending)&&(l[i]255)||(greenval>255)||(blueval>255)) error("colour out of range"); /* round to nearest integer - need to have each component as a strict 2 +character length hex number - can't deal with real numbers directly, and don't need to? */ redval = round(redval); greenval = round(greenval); blueval = round(blueval); /* use the c func to get the string back */ s = ""; sprintf(s,"#%02x%02x%02x",redval,greenval,blueval); return s; } func rgb2colour { return apply(rgb2color, $); } are adjusted away from zero. e.g even(4.5)=4, even(5.5)=6*/ func even { para num; /* e.g 4.5 .. int(4.5) = 4, 4%2=0.. so 4 closest even number */ if (int(num) % 2 == 0) {return int(num);} /* otherwise got to be odd and closer to the next even number which will be +1 */ /* use sign for -ve numbers which will have % result of -1.. try writeln(int(-3.2)%2); */ return int(num)+sign(num); } tkeden1.41/lib-tkeden/eden.txt010064400025250000147000000357010747345743300175550ustar00ashleydcsother00003510000005---------- EDEN (Evaluator of DEfinitive Notations) QUICK REFERENCE ---------- Parts of syntax which are !@Ooptional are shown like this!@P CONTENTS OF THIS QUICK REFERENCE: 1. C-like syntax 2. Data types 3. Operators 4. Procedural statements 5. User-defined functions, procedures, actions... 6. Pre-defined variables 7. Pre-defined functions and procedures 8. C-library functions and procedures 9. Writing a clock 10. More information -- 1. C-LIKE SYNTAX ---------------------------------------------------------- Statements are followed by the semi-colon; /* Multi-line C-style comments /* ...although note they may nest in Eden */ */ ## one-line comments start with two hash characters Assignment: v = 1; Definition: a is f(b, c); Function: func square { return $1*$1; } Procedure: proc inc_a { a++; } Action: proc print : q { writeln("q is ", q); } Name space: can access Scout variables directly. to access Donald variables, prepend an underscore _ Variable declaration is not required or possible. Redeclaration of type is automatic -- 2. DATA TYPES ------------------------------------------------------------- Undefined: @ Integer: 123, 018 (octal), 0xAB (hex) Character: 'A', '\n', '\009' Floating point: 1.23e-15 String: s = "this is a string" s[1] is the first character of the string s Pointer: ip = &int_variable * dereferences a pointer: *ip == int_variable List: L = [ 100, 'a', "string", [1,2,3] ] L[1] is the first item of L L[4][2] is the second item in the fourth item of L L# is the length of list L L // M is the concatenation of L and M See also append, insert, delete and shift -- 3. OPERATORS -------------------------------------------------------------- Strict: Returns @ if an operand is @ Lazy: Leaves the second operand unevaluated if it is unnecessary Eager: Always evaluates both operands Arithmetic (strict): + - (difference and unary) * / % (remainder) Relational: < > <= >= Equality: == != Logical (lazy): && || ! Logical (eager): and or not Bitwise (eager): bitand bitor Conditional: cond ? iftrue : iffalseor@ Assignment: = += -= Prefix assignment: ++lvalue --lvalue Postfix assignment: lvalue++ lvalue-- Indirection: a=1; r="a"; v=`r`; Now v == 1 (note: there are problems with use of indirection on the RHS of a definition) Type casting is implemented through functions: see int(), char() etc below -- 4. PROCEDURAL STATEMENTS -------------------------------------------------- Compound statements: { statement; !@Ostatements...!@P } insert list, position, value; (note: - no brackets - these are not functions append list, value; - they operate only only lists, not delete list, position; strings) shift !@Olist!@P; (shift with no argument deletes the first item from $) if (expression) statement !@Oelse statement!@P while (expression) statement do statement while (expression); for (!@Oinitialisation!@P; !@Opre-iteration-test!@P; !@Opost-statement!@P) statement switch (expression) { case constant: statement; !@Odefault statement;!@P } break; causes termination of the smallest enclosing while, do, for, switch continue; causes continuation of smallest enclosing while, do, for return !@Oexpression!@P; Null statement: ; Dependency link: identifier ~> [ !@Oidentifier_list!@P ]; Query: ?lvalue; Value freezing: eval(sym): takes the value of sym at definition entry time (note this is at proc definition time if eval is used within a proc) -- 5. USER-DEFINED FUNCTIONS, PROCEDURES, ACTIONS... ------------------------- func identifier { !@Opara id_list;!@P !@Oauto id_list;!@P !@Ostatements...!@P } proc identifier !@O: id_list!@P { !@Opara id_list;!@P !@Oauto id_list;!@P !@Ostatements...!@P } procmacro identifier { !@Opara id_list;!@P !@Oauto id_list;!@P !@Ostatements...!@P } $ is the argument list of a function $3 is the third argument $[n] is the n-th argument Function call: four = square(2); -- 6. PRE-DEFINED VARIABLES -------------------------------------------------- stdin: standard input stdout: standard output stderr: standard error autocalc: whether Eden automatically recalculates formula definitions _tkeden_showxoutput: whether to show info sent to Tcl for debugging purposes (see also debug(128)) eden_error_index_range: whether to generate an error or @ when referencing outside an array eden_notice_undef_reference: whether to give notices about references to undefined values tkeden_vbfeatures: whether to implement "VB-like features" in Scout (eg mouseClick observables). These features are not recommended for use in new models. PI: ratio of circle circumference to diameter (note lower case pi in DoNaLD) -- 7. PRE-DEFINED FUNCTIONS AND PROCEDURES ----------------------------------- write(args...): print arguments on stdout writeln(args...): print arguments on stdout, appending a newline (\n) type(data): returns the type of data as a string int(data): returns data after cast to integer type char(data): returns data after cast to character type str(data): returns data after cast to character type float(data): returns data after cast to floating point type substr(string, from, to): returns a substring of string strcat(strings...): returns the string concatenation of its arguments nameof(pointer): returns the name of the symbol to which the pointer points sublist(list, from, to): returns a sublist of list listcat(lists...): returns the list concatenation of its arguments array(size, data): returns a list constructed from data items, of length size time(): returns the current time in seconds since Jan 1, 1970 ftime(): returns the current time in [second, milli] form gettime(): returns the current time in [second, minute, hour, day of month, month of year, year, day of week] form apply(function, list): calls function with list as argument execute(string): executes string as Eden statements todo(string): will execute string as Eden statements after current evaluation terminates include(string!@O, string...!@P): executes the contents of the named file(s) as Eden statements cd(string): changes the current working directory cwd(): returns the current working directory dirname(string): returns the containing directory of a given filepath basename(string): returns the filename (leafname) of a given filepath exit(status): terminates the program, returning status as exit status forget(string): attempts to remove the named variable from the symbol table. Returns 0 for OK, 1 for not found, 2 for failure forget(pointer): attempts to remove the pointed-to variable from the symbol table. Returns 0 for OK, 2 for failure (1 is not possible). eager(): evaluate all out of date formula variables and actions now, update the screen, whatever the state of autocalc touch(pointers...): put the targets of the pointed to variables on the evaluation queue formula_list(): returns list of pointers to queued formula variables action_list(): returns list of pointers to queued actions symboltable(): returns the current symbol table as a list of lists symbols(string): returns a list of symbols from the symbol table which are of the specified type symboldetail(string): returns a list of information about the named symbol symboldetail(pointer): returns a list of information about the named symbol symboltext(string): returns the original text used when defining a symbol symboltext(pointer): returns the original text used when defining a symbol symboldefinition(string): returns a symbol in Eden-interpretable form symboldefinition(pointer): returns a symbol in Eden-interpretable form getenv(env): returns the string contents of the environment variable env putenv(env): set environment variable: env should have the form "name=value" error(message): generate an Eden error error_no(): returns the last system (not Eden) error number backgnd(path, cmd, arg1, arg2...): executes a process in the background pipe(path, cmd, arg1, arg2...): pipes stdout to the process given by path get_msgq(key flag): gets a message queue remove_msgq(msgqid): removes a message from the message queue msgqid send_msg(msgid, [msg_type, msg_text], flag): send a message on a message queue receive_msg(msgqid, msg_type, flag): receive a message from a message queue notation(name, agentname): install a new definitive notation installeddi(): install the eddi notation macro(s, para1, para2, ..., paraN): substitute ?1 in s with para1, ?2 with para2 etc and return the result copyproc(oldname, newname): copy a proc to a new name showpara(procname, showret): adjust the definition of a proc so that, when called, the parameters and, optionally, return result are printed round(r): make a real value into an integer with rounding max(number, ...) or max([list of numbers]) : returns the maximum of the numbers min(number, ...) or min([list of numbers]) : returns the minimum of the numbers sum(number, ...) or sum([list of numbers]) : returns the sum of the numbers abs(number) : returns number if > 0, otherwise returns -number (e.g abs(-7)=7) average(number, ...) or average([list of numbers]) : returns the average of the numbers nthroot(number, n) : returns the n'th root of the number given factorial(number) : returns the factorial of the number given product(number, ... ) : returns the numbers passed multiplied together sign(number) : returns -1 if number is < 0, 0 if number = 0, 1 if number > 0 even(number) : returns the nearest even number to the number given odd(number) : returns the nearest odd number to the number given mround(number, multiple) : returns the number rounded to the nearest multiple of the given multiple (e.g mround(62,6)=60) sumsq(number, .. ) or sumsq([list of numbers]) : returns the sum of the squares of the numbers passed trunc(number) : returns the integer part of the number given combin(total, n) : returns the number of ways n numbers can be picked from total number of items ceiling(number, multiple) : returns the number rounded to the nearest multiple of the given multiple that is greater than the number floor(number, multiple) : returns the number rounded to the nearest multiple of the given multiple that is lower than the number degrees(angle) : returns an angle given in radians with its equivalent in degrees in a range 0-360 radians(angle) : returns an angle given in degrees with its equivalent in radians in a range 0-2*PI rounddigits(number, digits) : returns the number rounded to the specified number of digits (e.g rounddigits(123.45,2)=120) gcd(number, ...) or gcd([list of numbers]) : returns the largest number which will divide exactly into all the numbers passed lcm(number, ...) or lcm([list of numbers]) : returns the smallest number that all the numbers passed will divide exactly into it variance(number, ...) or variance([list of numbers]) : returns the variance of the numbers passed or the list of numbers passed to it stdev(number, ...) or stdev([list of numbers]) : returns the standard deviation of the numbers passed or the list of numbers passed to it sort([list of numbers], direction) : returns the list of numbers sorted. the direction parameter should be 1 to return an ascending list, 2 to return a descending list median([list of numbers]) : returns the median element of a list of elements, those elements do not need to be in any sorted order randomise() : seeds the random number generator with a random number rnd(number) : returns a random number between 0 and the number. Note that both 0 and number are included in the range. rgb2color(r, g, b): takes values in range 0-255 and returns a colour reference (which should be treated as opaque) to be used in SCOUT/DoNaLD rgb2colour(r, g, b): same as rgb2color -- 8. C-LIBRARY FUNCTIONS AND PROCEDURES ------------------------------------- (see their man pages for more detail) fopen(filename, mode): opens a file, returning the fileid fclose(fileid): closes a file stream fgetc(fileid): gets and returns a character from a file stream fgets(n, fileid): returns a string (max n characters) read from a file stream and @ when end of file has been reached fscanf(fileid, format, &out1, &out2...): formatted read from the input stream gets(): returns a string read from stdin ungetc(c, fileid): pushes the character back onto the input stream fileid fprintf(fileid, format, args...): prints a formatted string to a file stream fputc(char, fileid): prints a character to a file stream pclose(fileid): close a pipe popen(command, mode): open a pipe, returning fileid putw(w, fileid): puts a machine word to a file stream setbuf(fileid, buf): set the buffer size of a file sprintf(&s, format, args...): formatted print to a string (warning: s must first be initialised to a string of appropriate length) sscanf(&s, format, &out1, &out2...): formatted read from string s system(string): execute command in a sub-shell stat(filename): returns a list of information about the named file: UID, GID, size, times of last access, data modification, file status change srand(seed): seed the random number generator rand(): return a random number (range is system dependent) sin(float): returns the sine of its (radians) argument cos(float): returns the cosine of its (radians) argument tan(float): returns the tangent of its (radians) argument asin(float): returns the principle arcsine of its (radians) argument acos(float): returns the principle arccosine of its (radians) argument atan(float): returns the principle arctangent of its (radians) argument atan2(y, x): returns the principle value of the arctangent of y/x (floats) sqrt(float): returns the square root of its argument pow(x, y): returns the value of x raised to the power y (floats) log(float): returns the natural logarithm of its argument (which must be +ve) log10(float): returns the logarithm to base 10 of its argument exp(float): returns the exponential (pow(e,x)) of its argument ... the above always return a float, even if all arguments are ints debug(status): sets the interpreter debugging mode. Add these values to form the parameter: 1: various 2: RunSet debugging 4: Eden parser debugging (=yydebug) 8: Sasami 16: Donald 32: Scout parser debugging (=st_debug) 64: malloc debugging (emalloc macro) 128: Tcl_Eval debugging 256: execute debugging 512: func / proc / procmacro call debugging 1024: VMWRIT debugging (in 1 also) 2048: Donald parser debugging (=dd_debug) 4096: Print errors on stderr as well as the error window pack(data...): stores data in a newly allocated memory space on the heap ... there may be more built-in functions and procedures depending upon the Eden variant you are using. -- 9. WRITING A CLOCK -------------------------------------------------------- proc clocking : clock { /* a clocking process */ todo("clock++;"); /* increment clock after current evaluation finishes */ } proc device1 : clock { /* action synchronised by the clock */ ... /* action body */ } proc device2 : clock { ... /* action body */ } -- 10. MORE INFORMATION ------------------------------------------------------ See the full manual available at http://www.dcs.warwick.ac.uk/modelling/ for more detail. data after cast to character type float(data): returns data afttkeden1.41/lib-tkeden/edenio.tcl010064400025250000164000001371640747345704000166350ustar00ashleyem00003510000005# $Id: edenio.tcl,v 1.23 2002/02/27 19:59:57 cssbz Exp $ # # [Ben] Only use focusfollowsmouse on Unix, as on Win32 this is non-standard # behaviour and will confuse users if {$_tkeden_win32_version == "0.0"} { tk_focusFollowsMouse } if {$_tkeden_variant == "dtkeden"} { if {$_dtkeden_isServer} { set variantversion "dtkeden $_tkeden_version (server)" } else { set variantversion "dtkeden $_tkeden_version (client)" } } else { # tkeden set variantversion "tkeden $_tkeden_version" } wm title . "$variantversion: Input" set radiosBg grey60 set radiosButtonBg grey50 frame .radios -background $radiosBg -borderwidth 0 button .radios.accept -text "Accept" -underline 0 \ -background $radiosButtonBg -command {accept} pack .radios.accept -side left if {$_tkeden_variant == "dtkeden"} { if {$_dtkeden_isServer} { button .radios.send -text "Send" -underline 0 \ -background $radiosButtonBg -command {selectClients} } else { button .radios.send -text "Send" -underline 0 \ -background $radiosButtonBg -command { set text [.text get 1.0 end] set text [string trim $text] if {$text != ""} { set errCode [catch {.menu.accept invoke} string] sendServer $text } } } pack .radios.send -side left } set notation "%eden" proc addNotationRadioButton {notation} { global radiosBg # Tk widgets must start with a lowercase letter set widget ".radios.[string tolower $notation]" radiobutton $widget -variable notation \ -highlightbackground $radiosBg -background $radiosBg \ -value "%$notation" -text "%$notation" \ -command { # the % at the start doesn't seem to be required here, strangely appendHist "$notation\n"; evaluate "$notation\n" } pack $widget -side left } # provided so people can customise the tkeden interface a little proc removeNotationRadioButton {notation} { set widget ".radios.[string tolower $notation]" destroy $widget } addNotationRadioButton eden addNotationRadioButton donald addNotationRadioButton scout if {$_tkeden_sasamiAvail == "1"} { addNotationRadioButton sasami } if {$_tkeden_variant == "dtkeden"} { addNotationRadioButton lsd } button .radios.interrupt -text "Interrupt" \ -background $radiosButtonBg -command {interrupt} pack .radios.interrupt -side right menu .menu . config -menu .menu # This is similar to the background colour used for the menus on Solaris # but not quite (unfortunately) set bg grey60 frame .labelframe -borderwidth 0 -background $bg # The prompt shows the current notation [Ash] label .prompt -anchor w -text "Enter EDEN statements:" -background $bg # The labelframe also contains the current virtual agent [Ash] label .agentName -anchor e -text "" -background $bg pack .prompt -side left -fill x -in .labelframe pack .agentName -side right -fill x -in .labelframe # ideally we should use this font whereever Eden code is displayed font create edencode -family courier -size 10 text .text -width 80 -height 15 -yscrollcommand ".scroll set" \ -background white -foreground black -insertbackground blue \ -insertofftime 80 -insertontime 1000 -insertwidth 2p \ -font edencode # set tabs to width of two characters (have to set it in pixels) [Ash] .text configure -tabs [font measure [.text cget -font] 00] scrollbar .scroll -command ".text yview" pack .radios -side top -fill x pack .labelframe -side top -fill x pack .scroll -side right -fill y pack .text -side right -fill both -expand 1 set m [menu .menu.file -tearoff 0] .menu add cascade -label "File" -underline 0 -menu .menu.file $m add command -label "Open..." -command {include Open} -underline 0 $m add command -label "Execute..." -command {include Execute} -underline 0 $m add separator set saveAsReusable 1 $m add checkbutton -label "Save as reusable definitions" \ -variable saveAsReusable -offvalue 0 -onvalue 1 $m add command -label "Save all definitions..." \ -command {save all} -underline 5 $m add command -label "Save Scout definitions..." \ -command {save scout} -underline 5 $m add command -label "Save DoNaLD definitions..." \ -command {save donald} -underline 5 $m add command -label "Save Eden definitions..." \ -command {save eden} -underline 5 if {$_tkeden_variant == "dtkeden"} { if {$_dtkeden_isServer} { $m add command -label "Save LSD description..." \ -command {save lsd} -underline 5 } } $m add command -label "Save history..." \ -command {save hist} -underline 5 $m add separator $m add command -label "Quit" -command { close $histfile; quit; } -underline 0 if {$_tkeden_apple} { set m [menu .menu.apple -tearoff 0] .menu add cascade -menu .menu.apple $m add command -label "About $_tkeden_variant..." -command about ## !@!@ thought this might stop the error on Apple-Q, but it doesn't ## $m add command -label "Quit tkeden" -command { close $histfile; quit; } } # don't use tearoffs on the Apple platform set m [menu .menu.edit -tearoff [expr !$_tkeden_apple]] .menu add cascade -label "Edit" -underline 0 -menu .menu.edit # (I found the keysym names using xmodmap -pk as I don't know the # virtual event names for select all and select none). $m add command -label "Select all" -underline 7 \ -accelerator "Control-/" \ -command {event generate .text } $m add command -label "Select none" \ -accelerator "Control-\\" \ -command {event generate .text } $m add command -label "Copy" -underline 0 \ -command {event generate .text <>} $m add command -label "Cut" -underline 2 \ -command {event generate .text <>} $m add command -label "Paste" -underline 0 \ -command {event generate .text <>} $m add command -label "Previous" \ -accelerator "Control-Alt-Up or Meta-Up" \ -command {previous} -underline 1 $m add command \ -label "Next" \ -accelerator "Control-Alt-Down or Meta-Down" \ -command {next} -underline 0 $m add command -label "Clear" \ -accelerator "Control-Alt-0 or Meta-0" \ -command {clearInputWindow} -underline 1 set m [menu .menu.show -tearoff [expr !$_tkeden_apple]] .menu add cascade -label "View" -underline 0 -menu .menu.show $m add checkbutton -label "View history..." \ -variable showhist -command {show hist $showhist} -underline 5 $m add checkbutton -label "View errors..." \ -variable showerr -command {show err $showerr} -underline 6 $m add checkbutton -label "View Scout definitions..." \ -variable showscout -command {show scout $showscout} -underline 5 $m add checkbutton -label "View DoNaLD definitions..." \ -variable showdonald -command {show donald $showdonald} -underline 5 $m add checkbutton -label "View Eden definitions..." \ -variable showeden -command {show eden $showeden} -underline 5 if {$_tkeden_variant == "dtkeden"} { if {$_dtkeden_isServer} { $m add checkbutton -label "View LSD descriptions..." \ -variable showlsd -command {show lsd $showlsd} -underline 5 $m add checkbutton -label "View client connections..." \ -variable showclient -command {show client $showclient} \ -underline 5 set m2 [menu .menu.type] .menu add cascade -label "Type" -menu .menu.type -underline 0 set proType 0 $m2 add radiobutton -label "Normal mode" \ -variable proType -value 0 $m2 add radiobutton -label "Interference mode" \ -variable proType -value 1 $m2 add radiobutton -label "Broadcast mode" \ -variable proType -value 2 \ -command { appendHist ">>\n"; evaluate ">>\n" } $m2 add radiobutton -label "Private mode" \ -variable proType -value 3 } } set m [menu .menu.help -tearoff 0] .menu add cascade -label "Help" -underline 0 -menu .menu.help # About is in the Apple menu on the Apple platform if {$_tkeden_apple == "0"} { $m add command -label "About $_tkeden_variant..." -command about \ -underline 0 } $m add command -label "Credits..." -command credits \ -underline 0 $m add command -label "Key shortcuts..." -command keys \ -underline 0 $m add command -label "Eden quick reference..." \ -command edenQuickRef -underline 0 $m add command -label "Scout quick reference..." \ -command scoutQuickRef -underline 0 $m add command -label "Donald quick reference..." \ -command donaldQuickRef -underline 0 $m add command -label "Sasami quick reference..." \ -command sasamiQuickRef -underline 4 $m add command -label "Colour names..." \ -command colourNames -underline 7 $m add command -label "ChangeLog..." -command changeLog \ -underline 1 bind .text { accept } bind .text { accept } bind .text { previous } bind .text { previous } bind .text { previous } bind .text { previous } bind .text { next } bind .text { next } bind .text { next } bind .text { next } bind .text { clearInputWindow } bind .text { clearInputWindow } bind .text { controlU } bind .text { controlU } proc bringToTop {} { set wins "[winfo children .] ."; foreach w $wins { set tlw [winfo toplevel $w]; if {[wm state $tlw] == "iconic"} { wm deiconify $tlw; } if {$w != ".menu"} { raise $w } } } # bring all our windows to the top if this combination of keys is pressed bind all { bringToTop } bindtags .text {all .text Text} update # History window toplevel .hist wm title .hist "$variantversion: Command History" frame .hist.menu -relief raised -borderwidth 2 pack .hist.menu -side top -fill x button .hist.menu.save -text "Save" -underline 0 -command {save hist} \ -relief flat -highlightthickness 0 bind .hist { .hist.menu.save invoke } bind .hist { .hist.menu.save invoke } button .hist.menu.find -text "Find" -underline 0 -command {find hist} \ -relief flat -highlightthickness 0 bind .hist { .hist.menu.find invoke } bind .hist { .hist.menu.find invoke } button .hist.menu.close -text "Close" -underline 0 \ -command {global showhist; set showhist 0; show hist 0} \ -relief flat -highlightthickness 0 bind .hist { .hist.menu.close invoke } bind .hist { .hist.menu.close invoke } pack .hist.menu.save .hist.menu.find .hist.menu.close -side left frame .hist.t pack .hist.t -fill both -expand 1 text .hist.t.text -state disabled -width 80 -height 10 \ -yscrollcommand ".hist.t.scroll set" -font edencode scrollbar .hist.t.scroll -command ".hist.t.text yview" pack .hist.t.scroll -side right -fill y pack .hist.t.text -side right -fill both -expand 1 wm withdraw .hist wm protocol .hist WM_DELETE_WINDOW ".hist.menu.close invoke;" update # Error window toplevel .err wm title .err "$variantversion: Errors" frame .err.menu -relief raised -borderwidth 2 pack .err.menu -side top -fill x button .err.menu.save -text "Save" -underline 0 -command {save err} \ -relief flat -highlightthickness 0 bind .err { .err.menu.save invoke } bind .err { .err.menu.save invoke } button .err.menu.find -text "Find" -underline 0 -command {find err} \ -relief flat -highlightthickness 0 bind .err { .err.menu.find invoke } bind .err { .err.menu.find invoke } button .err.menu.close -text "Close" -underline 0 \ -command {global showerr; set showerr 0; show err 0} \ -relief flat -highlightthickness 0 bind .err { .err.menu.close invoke } bind .err { .err.menu.close invoke } pack .err.menu.save .err.menu.find .err.menu.close -side left frame .err.t pack .err.t -fill both -expand 1 text .err.t.text -state disabled -width 80 -height 10 \ -yscrollcommand ".err.t.scroll set" -font edencode scrollbar .err.t.scroll -command ".err.t.text yview" pack .err.t.scroll -side right -fill y pack .err.t.text -side right -fill both -expand 1 wm withdraw .err wm protocol .err WM_DELETE_WINDOW ".err.menu.close invoke;" update if {$_tkeden_variant == "dtkeden"} { if {$_dtkeden_isServer} { toplevel .client wm title .client "$variantversion: Client Connections" frame .client.menu -relief raised -borderwidth 2 pack .client.menu -side top -fill x button .client.menu.close -text "Close" -underline 0 \ -relief flat -highlightthickness 0 \ -command {global showclient; set showclient 0; show client 0;} bind .client { .client.menu.close invoke } bind .client { .client.menu.close invoke } pack .client.menu.close -side left frame .client.t pack .client.t -fill both -expand 1 text .client.t.text -state disabled -width 80 -height 10 \ -yscrollcommand ".client.t.scroll set" scrollbar .client.t.scroll -command ".client.t.text yview" pack .client.t.scroll -side right -fill y pack .client.t.text -side right -fill both -expand 1 wm withdraw .client wm protocol .client WM_DELETE_WINDOW ".client.menu.close invoke;" update } } toplevel .scout wm title .scout "$variantversion: Scout Definitions" frame .scout.menu -relief raised -borderwidth 2 pack .scout.menu -side top -fill x button .scout.menu.save -text "Save" -underline 0 -command {save scout} \ -relief flat -highlightthickness 0 bind .scout { .scout.menu.save invoke } bind .scout { .scout.menu.save invoke } button .scout.menu.find -text "Find" -underline 0 -command {find scout} \ -relief flat -highlightthickness 0 bind .scout { .scout.menu.find invoke } bind .scout { .scout.menu.find invoke } button .scout.menu.rebuild -text "Rebuild" -underline 0 \ -command {dumpscout} \ -relief flat -highlightthickness 0 bind .scout { .scout.menu.rebuild invoke } bind .scout { .scout.menu.rebuild invoke } button .scout.menu.close -text "Close" -underline 0 \ -command {global showscout; set showscout 0; show scout 0} \ -relief flat -highlightthickness 0 bind .scout { .scout.menu.close invoke } bind .scout { .scout.menu.close invoke } pack .scout.menu.save .scout.menu.find .scout.menu.rebuild .scout.menu.close \ -side left frame .scout.t pack .scout.t -fill both -expand 1 text .scout.t.text -state disabled -width 80 -height 20 \ -yscrollcommand ".scout.t.scroll set" -font edencode scrollbar .scout.t.scroll -command ".scout.t.text yview" pack .scout.t.scroll -side right -fill y pack .scout.t.text -side right -fill both -expand 1 wm withdraw .scout wm protocol .scout WM_DELETE_WINDOW ".scout.menu.close invoke;" update toplevel .donald wm title .donald "$variantversion: DoNaLD Definitions" frame .donald.menu -relief raised -borderwidth 2 pack .donald.menu -side top -fill x button .donald.menu.save -text "Save" -underline 0 -command {save donald} \ -relief flat -highlightthickness 0 bind .donald { .donald.menu.save invoke } bind .donald { .donald.menu.save invoke } button .donald.menu.find -text "Find" -underline 0 -command {find donald} \ -relief flat -highlightthickness 0 bind .donald { .donald.menu.find invoke } bind .donald { .donald.menu.find invoke } button .donald.menu.rebuild -text "Rebuild" -underline 0 \ -command {dumpdonald} \ -relief flat -highlightthickness 0 bind .donald { .donald.menu.rebuild invoke } bind .donald { .donald.menu.rebuild invoke } button .donald.menu.close -text "Close" -underline 0 \ -command {global showdonald; set showdonald 0; show donald 0} \ -relief flat -highlightthickness 0 bind .donald { .donald.menu.close invoke } bind .donald { .donald.menu.close invoke } pack .donald.menu.save .donald.menu.find .donald.menu.rebuild \ .donald.menu.close -side left frame .donald.t pack .donald.t -fill both -expand 1 text .donald.t.text -state disabled -width 80 -height 20 \ -yscrollcommand ".donald.t.scroll set" -font edencode .donald.t.text tag config viewport -background #efd4b4 .donald.t.text tag config master -background #efd4b4 scrollbar .donald.t.scroll -command ".donald.t.text yview" pack .donald.t.scroll -side right -fill y pack .donald.t.text -side right -fill both -expand 1 wm withdraw .donald wm protocol .donald WM_DELETE_WINDOW ".donald.menu.close invoke;" update if {$_tkeden_variant == "dtkeden"} { if {$_dtkeden_isServer} { toplevel .lsd wm title .lsd "$variantversion: LSD Descriptions" frame .lsd.menu -relief raised -borderwidth 2 pack .lsd.menu -side top -fill x button .lsd.menu.save -text "Save" -underline 0 -command {save lsd} \ -relief flat -highlightthickness 0 bind .lsd { .lsd.menu.save invoke } bind .lsd { .lsd.menu.save invoke } button .lsd.menu.find -text "Find" -underline 0 -command {find lsd} \ -relief flat -highlightthickness 0 bind .lsd { .lsd.menu.find invoke } bind .lsd { .lsd.menu.find invoke } button .lsd.menu.rebuild -text "Rebuild" -underline 0 \ -command {dumpLSD} \ -relief flat -highlightthickness 0 bind .lsd { .lsd.menu.rebuild invoke } bind .lsd { .lsd.menu.rebuild invoke } button .lsd.menu.close -text "Close" -underline 0 \ -command {global showlsd; set showlsd 0; show lsd 0} \ -relief flat -highlightthickness 0 bind .lsd { .lsd.menu.close invoke } bind .lsd { .lsd.menu.close invoke } pack .lsd.menu.save .lsd.menu.find .lsd.menu.rebuild .lsd.menu.close \ -side left frame .lsd.t pack .lsd.t -fill both -expand 1 text .lsd.t.text -state disabled -width 80 -height 20 \ -yscrollcommand ".lsd.t.scroll set" scrollbar .lsd.t.scroll -command ".lsd.t.text yview" pack .lsd.t.scroll -side right -fill y pack .lsd.t.text -side right -fill both -expand 1 wm withdraw .lsd wm protocol .lsd WM_DELETE_WINDOW ".lsd.menu.close invoke;" update } } toplevel .eden wm title .eden "$variantversion: Eden Definitions" menu .eden.menu .eden config -menu .eden.menu set m [menu .eden.menu.edit -tearoff [expr !$_tkeden_apple]] .eden.menu add cascade -label "Edit" -underline 0 -menu .eden.menu.edit $m add command -label "Copy" -underline 0 \ -command {event generate .eden.t.text <>} $m add command -label "Cut" -underline 2 \ -command {event generate .eden.t.text <>} $m add command -label "Paste" -underline 0 \ -command {event generate .eden.t.text <>} .eden.menu add command -label "Save" -underline 0 -command {save eden} .eden.menu add command -label "Find" -underline 0 -command {find eden} .eden.menu add command -label "Rebuild" -underline 0 -command {viewOption} .eden.menu add command -label "Update" -underline 0 -command {edenUpdate} .eden.menu add command -label "Close" -underline 0 \ -command {global showeden; set showeden 0; show eden 0} frame .eden.t pack .eden.t -fill both -expand 1 text .eden.t.text -state disabled -width 80 -height 20 \ -yscrollcommand ".eden.t.scroll set" -font edencode .eden.t.text tag config masteragent -background #efd4b4 .eden.t.text tag config scout -foreground red .eden.t.text tag config donald -foreground blue scrollbar .eden.t.scroll -command ".eden.t.text yview" pack .eden.t.scroll -side right -fill y pack .eden.t.text -side right -fill both -expand 1 wm withdraw .eden wm protocol .eden WM_DELETE_WINDOW "set showeden 0; show eden 0" update if {$_tkeden_win32_version == "0.0"} { # we're on UNIX set histfilename $env(HOME)/.tkeden-history } else { # cygwin seems to require filenames in DOS (C:\blah) format set histfilename \ [cygwin_conv_to_full_win32_path "$env(HOME)/.tkeden-history"] } # Keep a few backups around as people don't seem to look for the # history file until they've restarted tkeden once or twice. Ideally # this would preserve file dates to make it easier to find data when # grubbing around in the history files, but there isn't an option for # this in Tcl file copy. We could use file rename, but this causes # problems with multiple concurrent instances of tkeden running in the # same user account with an NFS mounted home directory (machine 1 # shifts history files, starts to use tkeden-history, machine 2 shifts # history files, machine 1 gives stale NFS handle error). [Ash] catch {file copy -force ${histfilename}.2 ${histfilename}.3} catch {file copy -force ${histfilename}.1 ${histfilename}.2} catch {file copy -force $histfilename ${histfilename}.1} set histfile [open $histfilename w] proc appendHist {text} { global histfile .hist.t.text config -state normal .hist.t.text insert end $text puts $histfile $text nonewline flush $histfile .hist.t.text see end .hist.t.text config -state disabled } set errorNo 0 set errorAppendNo 0 set error "" proc appendErr {text} { global errorNo errorAppendNo error .err.t.text config -state normal if {$errorAppendNo == 0} { .err.t.text insert end "## ERROR number [incr errorNo]:\n" } incr errorAppendNo append error $text .err.t.text insert end $text .err.t.text see end .err.t.text config -state disabled } proc errorComplete {beep} { global errorNo errorAppendNo error set errorInitialText [string range $error 0 55] if {[string length $error] > 55} {append errorInitialText "..."} appendHist "## ERROR number $errorNo: $errorInitialText\n" set errorAppendNo 0 set error "" set showerr 1 show err 1 raise .err if {$beep} {bell} # Force .err to refresh, meaning the new error information is # shown on the screen even if we are in a tight loop. This call # causes any events on windows to trigger, which may then # cause some Eden to execute - this was the cause of "bug42". update idletasks } # Previous text set pentries "" # Number of entries of previous text to keep set pmax 20 # Current (per-entry session) position in history set ppos 0 proc accept {} { global pentries pmax ppos set text [.text get 1.0 end] appendHist $text # 1) remove the spurious \n that comes from Tcl's text widget # 2) append this entry to the list we are keeping # 3) remove an old entry from the front of the list if necessary # 3) if {[llength $pentries] >= $pmax} { set pentries [lrange $pentries 1 end] } # 2), 1) lappend pentries [string range $text 0 [expr [string length $text]-2]] evaluate $text clearInputWindow set ppos [llength $pentries]; } proc previous {} { global pentries pmax ppos set text [.text get 1.0 end] clearInputWindow set ppos [expr $ppos - 1] if {$ppos < 0} { set ppos 0 bell } .text insert end [lindex $pentries $ppos] } proc next {} { global pentries pmax ppos set text [.text get 1.0 end] clearInputWindow incr ppos if {$ppos > [llength $pentries]} { set ppos [llength $pentries] bell } .text insert end [lindex $pentries $ppos] } proc clearInputWindow {} { .text delete 1.0 end } proc controlU {} { # delete the text to the left of the cursor .text delete {insert linestart} insert } proc interface {statement} { global _tkeden_variant _dtkeden_isServer appendHist $statement if {$_tkeden_variant == "dtkeden"} { if {! ($_dtkeden_isServer)} { # Patrick's change to client only - dunno why [Ash] set statement "$statement\n" } } todo $statement } # This is used in scout.init.e for TEXTBOX [Ash] proc interfaceTEXT {statement} { todo $statement } proc cleanup {w} { .$w.t.text config -state normal .$w.t.text delete 1.0 end .$w.t.text config -state disabled } proc Review {} { global viewToBeDefined viewOption viewScout viewDoNaLD viewSasami set viewOption 0 if {$viewScout} { set viewOption [expr $viewOption + 1] } if {$viewDoNaLD} { set viewOption [expr $viewOption + 2] } if {$viewSasami} { set viewOption [expr $viewOption + 4] } dumpeden $viewOption $viewToBeDefined } proc edenDefn {v n d} { set r [.eden.t.text tag ranges eden%$v] .eden.t.text config -state normal if [llength $r] { .eden.t.text delete eden%$v.first eden%$v.last .eden.t.text insert [lindex $r 0] $d [list $n eden%$v] } else { .eden.t.text insert end $d [list $n eden%$v] } .eden.t.text config -state disabled } proc scoutDefn {v d} { set r [.scout.t.text tag ranges scout%$v] .scout.t.text config -state normal if [llength $r] { .scout.t.text delete scout%$v.first scout%$v.last .scout.t.text insert [lindex $r 0] $d scout%$v } else { .scout.t.text insert end $d scout%$v } .scout.t.text config -state disabled } # This based on mkDialogue below... [Ash] proc fileDialogue {fileName w winTitle} { global variantversion env catch {destroy $w} toplevel $w -class Dialog wm title $w "$variantversion: $winTitle" wm iconname $w "$winTitle" # Create two frames in the main window. The top frame will hold the # message and the bottom one will hold the buttons. Arrange them # one above the other, with any extra vertical space split between # them. frame $w.top -relief raised -border 1 frame $w.bot -relief raised -border 1 pack $w.top $w.bot -side top -fill both -expand yes text $w.top.text -state disabled -width 78 -height 31 \ -yscrollcommand "$w.top.scroll set" -background white \ -foreground black -font edencode scrollbar $w.top.scroll -command "$w.top.text yview" pack $w.top.scroll -side right -fill y pack $w.top.text -side top -expand yes -padx 3 -pady 3 if [catch {open "$env(TKEDEN_LIB)/$fileName" r} fileId] { puts stderr "Cannot open $env(TKEDEN_LIB)/$fileName: $fileId" } else { $w.top.text config -state normal $w.top.text insert end [read $fileId] close $fileId $w.top.text config -state disabled } # Create as many buttons as needed and arrange them from left to right # in the bottom frame. Embed the left button in an additional sunken # frame to indicate that it is the default button, and arrange for that # button to be invoked as the default action for clicks and returns in # the dialog. set args "OK" if {[llength $args] > 0} { set arg [lindex $args 0] frame $w.bot.0 -relief sunken -border 1 pack $w.bot.0 -side left -expand yes -padx 10 -pady 10 button $w.bot.0.button -text [lindex $arg 0] \ -command "[lindex $arg 1]; destroy $w" pack $w.bot.0.button -expand yes -padx 6 -pady 6 bind $w "[lindex $arg 1]; destroy $w" focus $w set i 1 foreach arg [lrange $args 1 end] { button $w.bot.$i -text [lindex $arg 0] \ -command "[lindex $arg 1]; destroy $w" pack $w.bot.$i -side left -expand yes -padx 10 set i [expr $i+1] } } bind $w [list focus $w] focus $w } # Create the About key shortcuts dialogue box containing info... [Ash] # See the Tcl text(n) man page for some of the information in the file proc keys {} { fileDialogue "keys.txt" .keys "Key shortcuts" } proc changeLog {} { fileDialogue "change.log" .changeLog "ChangeLog" } proc credits {} { fileDialogue "credits.txt" .credits "Credits" } # this from Ousterhout "Tcl and the Tk toolkit" page 219 proc forAllMatches {w pattern script} { scan [$w index end] %d numLines for {set i 1} {$i < $numLines} {incr i} { $w mark set last $i.0 while {[regexp -indices $pattern \ [$w get last "last lineend"] indices]} { $w mark set first \ "last + [lindex $indices 0] chars" $w mark set last "last + 1 chars \ + [lindex $indices 1] chars" uplevel $script } } } # Translate text file markup into formatted text by adding appropriate tags # [Ash] proc setTags {w} { $w.top.text config -state normal # Surround text denoting optional stuff with !@O and !@P. See # Ousterhout "Tcl and the Tk toolkit" page 91 for information # about Tcl regular expressions forAllMatches $w.top.text {!@O[^!@]*!@P} { $w.top.text delete first "first + 3 char" $w.top.text delete "last - 3 char" last $w.top.text tag add optional first last } $w.top.text tag configure optional -foreground blue $w.top.text config -state disabled } proc edenQuickRef {} { fileDialogue "eden.txt" .edenQuickRef "Eden Quick Reference" setTags .edenQuickRef } proc scoutQuickRef {} { fileDialogue "scout.txt" .scoutQuickRef "Scout Quick Reference" } proc donaldQuickRef {} { fileDialogue "donald.txt" .scoutQuickRef "DoNaLD Quick Reference" } proc sasamiQuickRef {} { fileDialogue "sasami.txt" .sasamiQuickRef "Sasami Quick Reference" } proc colourNames {} { fileDialogue "rgb.txt" .colourNames "Colour Names" } proc reinit {} { global env #set wins "[winfo children .] ."; #foreach w $wins { destroy $w; } destroy . # This almost works: $_tkeden_win32_version is undefined tho :( source $env(TKEDEN_LIB)/edenio.tcl } # Create the About dialogue box containing version and other information [Ash] proc about {} { global _tkeden_variant _tkeden_version _tkeden_web_site \ _dtkeden_isServer tcl_patchLevel tk_patchLevel \ _tkeden_win32_version env variantversion haveImg toplevel .about -class Dialog wm title .about "$variantversion: About" label .about.variant -text "This is $_tkeden_variant, version $_tkeden_version" if {$_tkeden_variant == "dtkeden"} { if {$_dtkeden_isServer} { label .about.isserver -text "Invoked in super-agent (server) mode" } else { label .about.isserver -text "Invoked in agent (client) mode" } } label .about.copyright -text "Copyright (C) The University of TV. All rights reserved" label .about.separator1 -text "--------------------------------" label .about.usage -text "Invoke $_tkeden_variant with the -u option for details of command line options usage" label .about.website -text "See $_tkeden_web_site for more information" label .about.separator2 -text "--------------------------------" label .about.diagnosis -text "This information may be useful when diagnosing problems:" if {$_tkeden_win32_version != "0.0"} { label .about.win32version -text "Win32 version V$_tkeden_win32_version" } else { label .about.win32version -text "Unix version" } label .about.libfiles -text "Library files are located in \n$env(TKEDEN_LIB)" label .about.tclversion -text "Tcl is version $tcl_patchLevel, Tk is version $tk_patchLevel\nTk Img package (PNG, JPEG...) is [expr {$haveImg ? {available} : {not available}}]" button .about.ok -text OK -command {destroy .about} if {$_tkeden_variant == "dtkeden"} { pack .about.variant .about.isserver .about.copyright \ .about.separator1 .about.usage .about.website \ .about.separator2 .about.diagnosis .about.win32version \ .about.libfiles .about.tclversion \ .about.ok -pady 5 } else { pack .about.variant .about.copyright \ .about.separator1 .about.usage .about.website \ .about.separator2 .about.diagnosis .about.win32version \ .about.libfiles .about.tclversion \ .about.ok -pady 5 } } # These long extensions have been re-thought from the original .e, .d, # .s practice. [Ash] set fileTypes { {{All files} *} {{Eden files} {.eden}} {{DoNaLD files} {.donald}} {{Scout files} {.scout}} {{Sasami files} {.sasami}} {{Eddi files} {.eddi}} {{Script (multi-notation) files} {.script}} } proc include style { global variantversion fileTypes notation _tkeden_win32_version if {$_tkeden_win32_version == "0.0"} { # tk_getOpenFile -multiple true isn't possible until 8.4a2 on UNIX # and I can't find where to download that version (and it's alpha) set fileNames [tk_getOpenFile \ -filetypes $fileTypes -parent . \ -title "$variantversion: $style" ] } else { # we're on Windows: -multiple is possible set fileNames [tk_getOpenFile \ -filetypes $fileTypes -parent . \ -multiple true \ -title "$variantversion: $style"] } foreach file $fileNames { # Change directory so that Eden include(...) is more likely to # work. 'cd [file dirname $file]' is the Tcl version, but # I've rewritten it in Eden so that the cwd() function will be # correctly re-evaluated eden "cd(dirname(\"$file\"));" if {$style == "Open"} { set errCode [catch {set incFile [open $file r]} string] if {$errCode == 0} { while {[gets $incFile line] >= 0} { .text insert end "$line\n" } .text see end close $incFile } else { tk_dialog .message "$variantversion: Warning" \ "Cannot open file \"$file\"" warning 0 OK } } elseif {$style == "Execute"} { appendHist "%eden\n" appendHist "include(\"$file\");\n" # want to do this: eden "include(\"$file\");" # but at evaluation level 0 (so that global variables such as # $radiosBg can be found). $file needs to be evaluated # now, but the rest must not be. set cmd {eden "include(\"} append cmd "$file" append cmd {\");"} uplevel #0 $cmd # now switch back to current notation appendHist "$notation\n" } else { error {internal error: include style unknown} } } } proc save w { global variantversion saveAsReusable fileTypes set fileName [tk_getSaveFile -initialfile untitled.$w -parent . \ -title "$variantversion: Save $w As" -defaultextension $w \ -filetypes $fileTypes] if {$fileName != ""} { SaveToFile $w $fileName $saveAsReusable } } proc SaveToFile {w file executable} { global viewOption viewToBeDefined _tkeden_variant _dtkeden_isServer if {[catch {open $file w} fid]} { mkDialog .error "-aspect 300 -text \{$fid\}" {OK {}} tkwait visibility .error grab .error } else { case $w { all { dumpeden 63 0 dumpscout dumpdonald if {$_tkeden_variant == "dtkeden"} { if {$_dtkeden_isServer} { dumpLSD } } if {$executable} { edenDefn autocalc eden "" puts $fid {autocalc = 0;} eden {tcl("set vp_in_use {"//vp_in_use(DFscreen)//"}");} global vp_in_use foreach vp $vp_in_use { edenDefn $vp eden "" } puts $fid %scout SaveScout $fid $executable if {$_tkeden_variant == "dtkeden"} { if {$_dtkeden_isServer} { puts $fid %lsd Savelsd $fid $executable } } puts $fid %donald SaveDonald $fid $executable puts $fid %eden SaveEden $fid $executable -omit masteragent scout donald system } else { puts $fid %scout SaveScout $fid $executable if {$_tkeden_variant == "dtkeden"} { if {$_dtkeden_isServer} { puts $fid %lsd Savelsd $fid $executable } } puts $fid %donald SaveDonald $fid $executable puts $fid %eden SaveEden $fid $executable } if {$executable} { puts $fid {autocalc = 1;} } dumpeden $viewOption $viewToBeDefined } hist { puts $fid [.hist.t.text get 1.0 end] nonewline } eden { if {$executable} { dumpeden 63 0 edenDefn autocalc eden "" puts $fid {autocalc = 0;} eden {tcl("set vp_in_use {"//vp_in_use(DFscreen)//"}");} global vp_in_use foreach vp $vp_in_use { edenDefn $vp eden "" } SaveEden $fid $executable -omit masteragent system } else { dumpeden $viewOption $viewToBeDefined SaveEden $fid $executable } if {$executable} { puts $fid {autocalc = 1;} dumpeden $viewOption $viewToBeDefined } } scout { dumpscout puts $fid "%scout" SaveScout $fid $executable } lsd { # This code should never happen in client and plain tkeden dumpLSD puts $fid "%lsd" Savelsd $fid $executable } donald { dumpdonald puts $fid "%donald" SaveDonald $fid $executable } } close $fid } } proc SaveEden {fid executable args} { if {[lsearch $args -omit] == 0} { set args [lrange $args 1 end] } set lastline [lindex [split [.eden.t.text index end] "."] 0] for {set i 1} {$i <= $lastline} {incr i} { set in 1 set tags [.eden.t.text tag names $i.0] foreach filter $args { if {[lsearch $tags $filter] != -1} { set in 0 break } } if {$in} { puts $fid [.eden.t.text get $i.0linestart $i.0lineend] } } } proc SaveScout {fid executable} { if $executable { foreach t [.scout.t.text tag names] { if [string match scout%* $t] { set text [.scout.t.text get $t.first $t.last] set eq [string first = $text] if {$eq == -1} { puts $fid $text nonewline } else { puts $fid [string range $text 0 [expr $eq - 2]] nonewline puts $fid {;} } } } foreach t [.scout.t.text tag names] { if [string match scout%* $t] { set text [.scout.t.text get $t.first $t.last] set eq [string first = $text] if {$eq != -1} { puts $fid $text nonewline } } } } else { puts $fid [.scout.t.text get 1.0 end] nonewline } } proc SaveDonald {fid executable} { for {set i 1} {$i <= [.donald.t.text index end]} {incr i} { set line [.donald.t.text get $i.0 "$i.0 lineend"] if {![string match AGENT* $line]} { puts $fid $line } } } if {$_tkeden_variant == "dtkeden"} { if {$_dtkeden_isServer} { proc Savelsd {fid executable} { for {set i 1} {$i <= [.lsd.t.text index end]} {incr i} { set line [.lsd.t.text get $i.0 "$i.0 lineend"] puts $fid $line } } } } proc TextSearch {w direction caseSensitive string} { if {[expr [string compare [.$w.t.text tag nextrange found 1.0] ""] \ && [string compare $direction -forwards] == 0]} { if {[expr [string compare [.$w.t.text index insert] \ [.$w.t.text index found.first]] == 0]} { .$w.t.text mark set insert [.$w.t.text index found.last] } } .$w.t.text tag remove found 1.0 end if {$caseSensitive} { set caseSwitch "-exact" } else { set caseSwitch "-nocase" } set index [.$w.t.text search $direction $caseSwitch -regexp \ -count len -- $string insert] if {[string length $index] > 0} { .$w.t.text mark set insert $index .$w.t.text see $index # This doesn't work on Linux as \c is an escape - rewritten [Ash] #.$w.t.text tag add found $index $index+$len\chars .$w.t.text mark set first $index .$w.t.text mark set last "$index + $len chars" .$w.t.text tag add found first last .$w.t.text tag configure found -background blue } else { bell } } proc find w { global variantversion catch {destroy .find} toplevel .find -class Dialog wm title .find "$variantversion: Find in $w" frame .find.top pack .find.top -fill both entry .find.top.e -relief sunken -textvariable searchString checkbutton .find.top.case -variable caseSensitive -text "case sensitive" pack .find.top.e .find.top.case -side left -padx 5 frame .find.bot pack .find.bot -fill both button .find.bot.forward -text "Forward" -underline 0 -width 8 \ -command "TextSearch $w -forwards \$caseSensitive \$searchString" button .find.bot.backward -text "Backward" -underline 0 -width 8 \ -command "TextSearch $w -backwards \$caseSensitive \$searchString" button .find.bot.cancel -text Cancel -command "destroy .find" -width 8 bind .find { .find.bot.forward invoke } bind .find { .find.bot.forward invoke } bind .find { .find.bot.backward invoke } bind .find { .find.bot.backward invoke } pack .find.bot.forward -side left -expand yes -padx 5 -pady 5 pack .find.bot.backward -side left -expand yes -padx 5 -pady 5 pack .find.bot.cancel -side left -expand yes -padx 5 -pady 5 tkwait visibility .find grab .find } set viewOption 0 set viewToBeDefined 0 set viewScout 0 set viewDoNaLD 0 set viewSasami 0 proc edenUpdate {} { global viewOption viewToBeDefined # save the position of the vertical scrollbar set yscroll [lindex [.eden.t.text yview] 0] # dumpeden is a tkeden Tcl command created in EX/ex.c dumpeden [expr $viewOption + 8] $viewToBeDefined .eden.t.text yview moveto $yscroll } # viewOption is called when the Rebuild button is pressed [Ash] proc viewOption {} { global variantversion _tkeden_sasamiAvail catch {destroy .view} toplevel .view -class Dialog wm title .view "$variantversion: View Options" wm transient .view .eden frame .view.left pack .view.left -fill both -side left -expand yes label .view.left.name -justify left \ -text "Highlight to view:\ncontrol-click: individual items,\nshift-click: a range:" pack .view.left.name -side top -fill none -anchor nw scrollbar .view.left.scroll -command ".view.left.list yview" pack .view.left.scroll -side right -fill y listbox .view.left.list -yscroll ".view.left.scroll set" \ -selectmode extended -relief sunken -width 20 -height 20 -setgrid yes pack .view.left.list -side left -fill both -expand yes frame .view.right pack .view.right -side right checkbutton .view.right.yet \ -text "with yet-to-be-defined variables" \ -variable viewToBeDefined checkbutton .view.right.scout \ -text "with translated Scout definitions" \ -variable viewScout checkbutton .view.right.donald \ -text "with translated DoNaLD definitions" \ -variable viewDoNaLD if {$_tkeden_sasamiAvail == "1"} { checkbutton .view.right.sasami \ -text "with translated Sasami definitions" \ -variable viewSasami } button .view.right.all -text "Select All" -width 12 -underline 0 \ -command { .view.left.list selection set 0 end } button .view.right.none -text "Clear All" -width 12 \ -command { .view.left.list selection clear 0 end } frame .view.right.ok -relief sunken -border 1 button .view.right.ok.button -text OK -width 12 \ -command { Review; destroy .view; raise .eden } pack .view.right.ok.button -padx 10 -pady 10 button .view.right.cancel -text Cancel -command "destroy .view" -width 12 pack .view.right.all .view.right.none -side top -padx 5 -pady 5 pack .view.right.yet .view.right.scout .view.right.donald \ -side top -anchor sw if {$_tkeden_sasamiAvail == "1"} { pack .view.right.yet .view.right.sasami -side top -anchor sw } pack .view.right.ok .view.right.cancel -side top -padx 5 -pady 5 bind .view { .view.right.ok.button invoke } bind .view { .view.right.all invoke } bind .view { .view.right.all invoke } # setupViewOptions is a tkeden Tcl command created in EX/ex.c setupViewOptions tkwait visibility .view grab .view } if {$_tkeden_variant == "dtkeden"} { if {$_dtkeden_isServer} { proc selectClients {} { global clientSock sockName clientName variantversion if {[llength $clientSock] <= 0} { tk_dialog .message "$variantversion: Message" "No connected client" warning -1 OK return } else { catch {destroy .select} toplevel .select -class Dialog wm title .select "$variantversion: Select Clients" frame .select.left pack .select.left -fill both -side left -expand yes label .select.left.name -text "Select clients to receive:" pack .select.left.name -side top -fill none -anchor nw scrollbar .select.left.scroll -command ".select.left.list yview" pack .select.left.scroll -side right -fill y listbox .select.left.list -yscroll ".select.left.scroll set" \ -selectmode multiple -relief sunken -width 20 -height 10 -setgrid yes pack .select.left.list -side left -fill both -expand yes frame .select.right pack .select.right -side right # Something may be wrong here - emacs gets the formatting # wrong [Ash] button .select.right.all -text "Select All" -command { .select.left.list selection set 0 end } -width 12 button .select.right.none -text "Clear All" -command { .select.left.list selection clear 0 end } -width 12 button .select.right.ok -text OK -command { global sockName set text [.text get 1.0 end] set selectedClients {} foreach i [.select.left.list curselection] { set currClient [.select.left.list get $i] lappend selectedClients $sockName($currClient) } sendClientsSock $selectedClients $text .text delete 1.0 end destroy .select } -width 12 button .select.right.cancel -text Cancel -command "destroy .select" -width 12 pack .select.right.all .select.right.none -side top -padx 5 -pady 5 pack .select.right.ok .select.right.cancel -side top -padx 5 -pady 5 .select.left.list insert end "Own" foreach wsock $clientSock { # puts $clientName($wsock) .select.left.list insert end $clientName($wsock) } tkwait visibility .select grab .select } } } } # mkDialog w msgArgs list list ... # # Create a dialog box with a message and any number of buttons at # the bottom. # # Arguments: # w - Name to use for new top-level window. # msgArgs - List of arguments to use when creating the message of the # dialog box (e.g. text, justifcation, etc.) # list - A two-element list that describes one of the buttons that # will appear at the bottom of the dialog. The first element # gives the text to be displayed in the button and the second # gives the command to be invoked when the button is invoked. # # @(#) mkDialog.tcl 1.1 94/08/10 15:35:00 proc mkDialog {w msgArgs args} { global variantversion catch {destroy $w} toplevel $w -class Dialog wm title $w "$variantversion: Dialog Box" wm iconname $w "Dialog" # Create two frames in the main window. The top frame will hold the # message and the bottom one will hold the buttons. Arrange them # one above the other, with any extra vertical space split between # them. frame $w.top -relief raised -border 1 frame $w.bot -relief raised -border 1 pack $w.top $w.bot -side top -fill both -expand yes # Create the message widget and arrange for it to be centered in the # top frame. eval message $w.top.msg -justify center $msgArgs pack $w.top.msg -side top -expand yes -padx 3 -pady 3 # Create as many buttons as needed and arrange them from left to right # in the bottom frame. Embed the left button in an additional sunken # frame to indicate that it is the default button, and arrange for that # button to be invoked as the default action for clicks and returns in # the dialog. if {[llength $args] > 0} { set arg [lindex $args 0] frame $w.bot.0 -relief sunken -border 1 pack $w.bot.0 -side left -expand yes -padx 10 -pady 10 button $w.bot.0.button -text [lindex $arg 0] \ -command "[lindex $arg 1]; destroy $w" pack $w.bot.0.button -expand yes -padx 6 -pady 6 bind $w "[lindex $arg 1]; destroy $w" focus $w set i 1 foreach arg [lrange $args 1 end] { button $w.bot.$i -text [lindex $arg 0] \ -command "[lindex $arg 1]; destroy $w" pack $w.bot.$i -side left -expand yes -padx 10 set i [expr $i+1] } } bind $w [list focus $w] focus $w } proc show {w yes} { if $yes { wm deiconify .$w raise .$w case $w { scout {dumpscout} donald {dumpdonald} eden {viewOption} lsd {dumpLSD} } # the lsd above should never be matched in client # or plain tkeden [Ash] } else { wm withdraw .$w } } # Called when the user does %sasami open_display: called from Sasami render.c proc sasamiWindow {width height} { global variantversion toplevel .sasami -width $width -height $height wm title .sasami "$variantversion: Sasami" frame .sasami.f togl .sasami.f.togl -width $width -height $height -double true \ -privatecmap false -depth true -rgba true pack .sasami.f.togl -fill both -expand t pack .sasami.f -fill both -expand t bind .sasami.f.togl {sasamiB %x %y} bind .sasami.f.togl {sasamiB1Motion %x %y} bind .sasami.f.togl {sasamiB %x %y} bind .sasami.f.togl {sasamiB3Motion %x %y} } set sasamiOldX 0 set sasamiOldY 0 proc sasamiB { x y } { global sasamiOldX sasamiOldY set sasamiOldX $x set sasamiOldY $y } # This is called when mouse button 1 is pressed and moved in the Sasami # window: rotate about the X & Y axes. proc sasamiB1Motion { x y } { global sasamiOldX sasamiOldY set diffX [expr $x - $sasamiOldX] set diffY [expr $y - $sasamiOldY] .sasami.f.togl setXrot [expr [sasami_getXrot] - $diffY] .sasami.f.togl setYrot [expr [sasami_getYrot] - $diffX] .sasami.f.togl render set sasamiOldX $x set sasamiOldY $y } # This is called when mouse button 3 is pressed and moved in the Sasami # window: zoom in and out on the Z axis. proc sasamiB3Motion { x y } { global sasamiOldY set diffY [expr $y - $sasamiOldY] .sasami.f.togl setZpos [expr [sasami_getZpos] - $diffY] .sasami.f.togl render set sasamiOldX $x set sasamiOldY $y } proc sasamiWindowClose {} { destroy .sasami } # If the Img package (PNG etc) is available then load it set haveImg [expr ! [catch {package require Img}]] if {$_tkeden_variant == "dtkeden"} { if {$_dtkeden_isServer} { source $env(TKEDEN_LIB)/server.tcl } else { source $env(TKEDEN_LIB)/client.tcl } } ton .find.bot.backward -text "Backward" -underline 0 -width 8 \ -command "TextSearch $w -backwards \$caseSensitive \$searchString" button .find.bot.cancel -text Cancel -command "destroy .find" -width 8 bind .find { .find.bot.forward invoke } bind .find { .find.bot.forward invoke } bind .find { .find.bot.backward invoke } bind .find { .fitkeden1.41/lib-tkeden/keys.txt010064400025250000164000000043360733204136300163630ustar00ashleyem00003510000005Some menus and buttons have key shortcuts. These are shown with an underlined letter, and can be activated by pressing Alt and that letter. For example: Accept the current input: Alt-a View the Eden Definitions window: Alt-v Alt-e Valid throughout Eden: Bring all Eden windows to the front: Shift-Control-Tab (in any window) Using the mouse in the input window: Select text: drag Select word: double-click Select words: drag after a double-click Select line: triple-click Select lines: drag after a triple-click Adjust ends of selection: Shift + drag button 1 Reposition cursor without affecting selection: Control + click Insert text at mouse cursor: click button 2 Scroll view: drag button 2 Using the keyboard in the input window: Move backwards in input history: Meta-Up or Control-Alt-Up or Alt-p Move forwards in input history: Meta-Down or Control-Alt-Down or Alt-n Cursor left: Left or Control-b Cursor right: Right or Control-f Move cursor by words: as above, with Control or Meta Move cursor to start of line: Home or Control-a Move cursor to end of line: End or Control-e Cursor up: Up or Control-p Cursor down: Down or Control-n Move cursor by paragraphs: as above, with Control Move cursor up one screenful: Prior (Page up) Move cursor down one screenful: Next (Page down) or Control-v Move cursor to start of text: Control-Home or Meta-< Move cursor to end of text: Control-End or Meta-> Select text: as above, with Shift Select all text: Control-/ Select no text: Control-\\ Copy selection to clipboard: Copy (F16) or Meta-w Cut selection to clipboard: Cut (F20) or Control-w Insert clipboard at cursor: Paste (F18) or Control-y Delete to left of cursor: Backspace or Control-h Delete to right of cursor: Delete or Control-d Delete word to right of cursor: Meta-d Delete word to left of cursor: Meta-Backspace or Meta-Delete Delete to end of line: Control-k Delete to beginning of line: Control-u Delete selection: Control-x Clear all text in input window: Meta-0 or Control-Alt-0 Open new line (insert newline): Control-o Reverse order of two characters to right of cursor: Control-t Indent: tab stops (use the Tab key) are set to two character widths tkeden1.41/lib-tkeden/sasami.txt010064400025250000164000000041330746225727100166730ustar00ashleyem00003510000005------------------------- Sasami QUICK REFERENCE ----------------------------- CONTENTS OF THIS QUICK REFERENCE: 1. Syntax 2. Commands 3. Variables 4. More information -- 1. SYNTAX ----------------------------------------------------------------- No semi-colons: line feeds are terminators # UNIX shell style one-line comments Whitespace and commas are command / parameter separators Escaping to Eden: ` (back-tick) is a one-line escape to Eden. -- 2. COMMANDS --------------------------------------------------------------- open_display close_display vertex [z] polygon poly_geom_vertex poly_tex_vertex poly_colour [a] poly_material material material_ambient [a] (ambient = in darkness) material_diffuse [a] (diffuse = in normal light) material_specular [a] (specular = in direct light) material_texture object object_poly object_pos object_rot object_scale light light_pos light_enabled light_directional light_attenuation light_ambient [a] light_diffuse [a] light_specular [a] load_full_obj load_obj (loads only objects and materials into Eden) bgcolour viewport -- 3. VARIABLES -------------------------------------------------------------- sasami_viewport_xsize sasami_viewport_ysize sasami_viewport_bpp sasami_bgcolour_r sasami_bgcolour_g sasami_bgcolour_b sasami_show_axes -- 4. MORE INFORMATION ------------------------------------------------------- See http://www.dcs.warwick.ac.uk/modelling/ for more detail. tkeden1.41/lib-tkeden/scout.eden010064400025250000164000000534370746176321300166570ustar00ashleyem00003510000005/* * $Id: scout.eden,v 1.1 2002/02/27 16:27:43 cssbz Exp $ */ /**** * * * This file is the function library of the SCOUT system * * It contains definitions of attributes, EDEN version of * * some SCOUT functions, screen updating functions and * * its sub-functions and initialization procedures * * * ****/ /** Initialise EX **/ /* luckily these first two are the same as required by donald in donald.init.e. These must be the same values as are defined in the Scout namespace in Scout/lex.c (init_scout). Also define these in builtinf.h [Ash] */ OFF = 0; ON = 1; MOTION = 2; ENTER = 4; LEAVE = 8; CLIENT_LIST = []; /* declare a list for server end to list all connected clients */ DFfont = "{courier 10}"; DFscreen = "screen"; /* should not change this */ DFalign = 0; /* 0 - no, 1 - left, 2 - right, 3 - centre, 4 - left & right */ DFbgcolor = tcl(". cget -background"); DFfgcolor = "black"; DFbdcolor = "black"; DFborder = 0; DFrelief = "raise"; DFxmin = 0; DFymin = 0; DFxmax = 1000; DFymax = 1000; DFhighlight = 1; DFsensitive = OFF; DFwidth = 500; DFheight = 500; proc HandleDisplayResizeEvent { para widget, name, width, height; /* Ignore messages about child widgets */ if (widget == "." // name) { /* Don't redefine if the values haven't changed. This will cause "reference to undefined variable" notices if they are enabled the first time this is done. */ if ((`name//"_width"` != width) || (`name//"_height"` != height)) { execute("%scout\ninteger "//name//"_width="//str(width)// "; integer "//name//"_height="//str(height)//";"); } } } proc OpenDisplay { para name, width, height; if (name[1] >= 'A' && name[1] <= 'Z') name = "_"//name; tcl("toplevel ."//name//" -background "//DFbgcolor// " -width "//str(width)//" -height "//str(height)); tcl("wm protocol ."//name//" WM_DELETE_WINDOW { set show_"//name// " 0; show "//name//" 0;}"); tcl("wm title ."//name//" \""//name//" ($variantversion)\""); tcl("uplevel #0 {set show_"//name//" 1}"); /* the -underline here should really look through the other items in the * menu and find the first unique character to use as a key shortcut * [Ash], April 2001 */ tcl(".menu.show add checkbutton -label "//name// " -variable show_"//name//" -command {show "//name// " $show_"//name//"} -underline 1"); tcl("bind ."//name//" { " // "eden {~HandleDisplayResizeEvent(\"%W\", \""//name//"\", %w, %h);}" // " }"); HandleDisplayResizeEvent("."//name, name, width, height); execute("%scout\ndisplay ~" // name // ";\n%eden\n"); tcl("tkwait visibility ."//name); } proc DestroyDisplay { para name; if (name[1] >= 'A' && name[1] <= 'Z') name = "_"//name; tcl("destroy ."//name); tcl(".menu.show delete "//name); tcl("unset show_"//name); } func StringWidth { para win, font, string; if ((win == @) || (font == @) || (string == @)) return @; return int(tcl("font measure " // font // " -displayof ." // win // " " // "{" // string // "}")); } func FontWidth { para win, font; /* Measuring the width of the (wide) character 'W' */ return StringWidth(win, font, "W"); } func FontHeight { para win, font; return int(tcl("font metrics " // font // " -displayof ." // win // " -linespace")); } func DisplayDepth { para win; return int(tcl("winfo depth ." // win)); } /* This gets called when '%scout' is done for the first time */ proc scoutScreenInitOpen { OpenDisplay(DFscreen, DFwidth, DFheight); fontWidth is FontWidth(DFscreen, DFfont); fontHeight is FontHeight(DFscreen, DFfont); displayDepth is DisplayDepth(DFscreen); } /**** * SCOUT functions * ****/ func pt_add /* ( point, point) */ /* + (point addition) */ { return [$1[1] + $2[1], $1[2] + $2[2]]; } func pt_subtract /* ( point, point) */ /* - (point subtraction) */ { return [$1[1] - $2[1], $1[2] - $2[2]]; } func row { return $1 * fontHeight; } func column { return $1 * fontWidth; } proc update_row : fontHeight { touch(&row); } proc update_column : fontWidth { touch(&column); } func dotint /* ( list, int ) */ /* .1 (i.e. dotint(point, 1)) .2 (i.e. dotint(point, 2)) .type (i.e. dotint(window, 1)) .frame (i.e. dotint(window, 2)) .string (i.e. dotint(window, 3)) .box (i.e. dotint(window, 4)) .pict (i.e. dotint(window, 5)) .xmin (i.e. dotint(window, 6)) .ymin (i.e. dotint(window, 7)) .xmax (i.e. dotint(window, 8)) .ymax (i.e. dotint(window, 9)) .bg (i.e. dotint(window, 10)) .fg (i.e. dotint(window, 11)) .border (i.e. dotint(window, 12)) .align (i.e. dotint(window, 13)) .sensitive (i.e. dotint(window, 14)) .bordercolor (i.e. dotint(window, 15)) .font (i.e. dotint(window, 16)) .relief (i.e. dotint(window, 17)) .(int) (for frame and display) */ { return $1[int($2)]; } func dotne /* ( box ) */ /* .ne */ { return [$1[3], $1[2]]; } func dotnw /* ( box ) */ /* .nw */ { return [$1[1], $1[2]]; } func dotse /* ( box ) */ /* .se */ { return [$1[3], $1[4]]; } func dotsw /* ( box ) */ /* .sw */ { return [$1[1], $1[4]]; } func dotn /* ( box ) */ /* .n */ { return [($1[1] + $1[3]) / 2, $1[2]]; } func dote /* ( box ) */ /* .e */ { return [$1[3], ($1[2] + $1[4]) / 2]; } func dots /* ( box ) */ /* .s */ { return [($1[1] + $1[3]) / 2, $1[4]]; } func dotw /* ( box ) */ /* .w */ { return [$1[1], ($1[2] + $1[4]) / 2]; } func boxshift /* ( box, x, y ) */ { para box, x, y; return [box[1] + x, box[2] + y, box[3] + x, box[4] + y]; } func app /* ( list, position, element ) */ /* append (for both frame and display) */ { insert $1, int($2) + 1, $3; return $1; } func del /* ( list, position ) */ /* delete (for both frame and display) */ { delete $1, $2; return $1; } func list_append /* ( list, list ) */ /* & (for both frame and display) */ { return $1 // $2; } func formbox /* ( point, point ) */ /* constructor of box : < P1, P2 > */ { return [$1[1], $1[2], $2[1], $2[2]]; } proc update_textbox : column, row { touch(&textbox); } func textbox { return [$1[1], $1[2], $1[1] + column($3) + 1, $1[2] + row($2) - 1]; } func box_width /* ( box ) */ /* return the width of the box in pixel */ { return $1[3] - $1[1] + 1; } func box_height /* ( box ) */ /* return the height of the box in pixel */ { return $1[4] - $1[2] + 1; } func capacity /* ( box ) */ /* return [r, c], no of row and no of col the box can hold */ { return [($1[4] - $1[2] - 1) / fontHeight, ($1[3] - $1[1] - 1) / fontWidth]; } /*** * string manipulating functions * ***/ /* this doesn't seem to be used anywhere [Ash] */ func Quote { para s; auto ret, i; if (type(s) != "string") { return str(s); } ret = "\""; for (i = 1; i <= s#; i++) { switch (s[i]) { case '"': ret = ret // "\\\""; break; case '\\': ret = ret // "\\\\"; break; default: ret = ret // s[i]; break; } } return ret // "\""; } /** * image related functions * **/ /* return the height of an image */ func ImageHeight { return tcl("image height "//$1); } /* return the width of an image */ func ImageWidth { return tcl("image width "//$1); } /* read, name and return the image from file image format currently available are ppm and gif */ func ImageFile { para imageName, type, filename; xoutput("image create photo", imageName, "-format", type, "-file", filename); return imageName; } func isInteger { return ($1 == int($1)); } /* scale the srcImage, name and return the scaled image as imageName */ /* This function uses the external utility pnmscale to do the job as Tcl can only currently scale images by integer amounts, and requires "zoom" for positive and "subsample" for negative amounts. Unfortunately the pnm utilities seem to be quite a UNIX thing and getting this way of things to work on Windoz could be quite a headache. :(. Anyway - if you want to fudge a scaled image using only Tcl, use something like xoutput("image create photo ", imageName); xoutput(imageName, "copy", srcImage, "-subsample 3"); return imageName here. [Ash, Sept 2000] */ func ImageScale { para imageName, srcImage, xscale, yscale; writeln("ImageScale: xscale ", xscale, " yscale ", yscale); if ((isInteger(xscale*10)) && (isInteger(yscale*10))) { xoutput("image create photo ", imageName); /* see man photo(n) for -subsample details */ xoutput(imageName, "copy", srcImage, "-subsample " // str(int(xscale*10)) // " " // str(int(yscale*10))); return imageName; } else { tcl("image create photo "//imageName); xoutput(srcImage, "write /tmp/1"//imageName); xoutput("exec pnmscale -xscale", xscale, "-yscale", yscale, "/tmp/1"//imageName, "> /tmp/2"//imageName); xoutput(imageName, "read /tmp/2"//imageName); xoutput("exec rm /tmp/1"//imageName, "/tmp/2"//imageName); return imageName; } } /* cut a rectangle out of the srcImage, name and return result as imageName */ func ImageCut { para imageName, srcImage, x, y, width, height; tcl("image create photo "//imageName); xoutput(srcImage, "write /tmp/1"//imageName); xoutput("exec pnmcut", x, y, width, height, "/tmp/1"//imageName, "> /tmp/2"//imageName); xoutput(imageName, "read /tmp/2"//imageName); xoutput("exec rm /tmp/1"//imageName, "/tmp/2"//imageName); return imageName; } /* create pattern using ppmpat */ /* ppmpat generates ascii PPM which cannot be recognised by Tk */ func ImagePat { para imageName, form, width, height; tcl("image create photo "//imageName); xoutput("exec ppmpat -"//form, width, height, "> /tmp/1"//imageName); xoutput(imageName, "read /tmp/1"//imageName); xoutput("exec rm /tmp/1"//imageName); return imageName; } /* procedure for displaying an image */ proc ShowImage { para I_source, source; auto command, i, width, height; for (i = 1; i <= (*source)#; i++) { command = "."//(*source)[i][1]//"."//(*source)[i][2]; width = int(tcl(command//" cget -width")); height = int(tcl(command//" cget -height")); xoutput(command, "create image", width / 2, height / 2, "-tags image -image", *I_source); } } / screen updating actions / func Position { para bd, width, just; auto x, j, anchor; switch (int(just)) { case 1: x = 0; j = "left"; anchor = "nw"; break; case 2: x = width; j = "right"; anchor = "ne"; break; case 3: x = width / 2; j = "center"; anchor = "n"; break; case 0: case 4: /* not supported by Tk */ default: x = 0; j = "left"; anchor = "nw"; break; } return str(int(bd + x))//" "//str(int(bd))//" -anchor "//anchor //" -justify "//j; } proc scout_show_2D /* display a DoNaLD/ARCA picture */ { para screen, winNo, boxName; /* writeln("scout_show_2D: ", $); */ scout_show_2D_window(`screen`[winNo], "."//screen//"."//boxName//"_1", boxName//"_1"); } proc dobinding { para sensitive, widget, windowName, var, boxNumber; auto mouseName, keyName, mousePosName, mouseEnterName, mouseLeaveName, xCoord, yCoord, mouseClickName, mouseClickStuff; sensitive = int(sensitive); /* yuk - integerhonest hack [Ash] */ if (boxNumber > 0) { /* TEXT - have the boxNumber within the frame to deal with */ mouseName = "~"//windowName//"_mouse_"//str(boxNumber); keyName = "~"//windowName//"_key_"//str(boxNumber); mousePosName = "~"//windowName//"_mousePos_"//str(boxNumber); mouseEnterName = "~"//windowName//"_mouseEnter_"//str(boxNumber); mouseLeaveName = "~"//windowName//"_mouseLeave_"//str(boxNumber); mouseClickName = "~"//windowName//"_mouseClick"; xCoord = "%x"; yCoord = "%y"; } else { /* not TEXT - no boxNumber but must correct for window coordinate system */ mouseName = "~"//windowName//"_mouse"; keyName = "~"//windowName//"_key"; mousePosName = "~"//windowName//"_mousePos"; mouseEnterName = "~"//windowName//"_mouseEnter"; mouseLeaveName = "~"//windowName//"_mouseLeave"; mouseClickName = "~"//windowName//"_mouseClick"; xCoord = "[expr (%x-$"//var//"_xOrigin)/$"//var//"_xScale]"; yCoord = "[expr (%y-$"//var//"_yOrigin)/$"//var//"_yScale]"; } if (sensitive bitand ON) { /* the window is interested in mouse actions and key strokes */ /* implement some old, deprecated features if required */ if (tkeden_vbfeatures == 1) { mouseClickStuff = mouseClickName // " = TRUE;\\n"; } else { mouseClickStuff = ""; } xoutput("bind", widget, "