rs@uunet.UU.NET (Rich Salz) (06/24/87)
Submitted by: Brian Harvey <bh@mit-amt>
Mod.Sources: Volume 10, Number 24
Archive-Name: logo/Part04
#! /bin/sh
# This is a shell archive. Remove anything before this line, then unpack
# it by saving it into a file and typing "sh file". To overwrite existing
# files, type "sh file -c". You can also feed this as standard input via
# unshar, or by typing "sh <file", e.g.. If this archive is complete, you
# will see the following message at the end:
# "End of archive 4 (of 6)."
# Contents: logo.y
# Wrapped by rsalz@pineapple.bbn.com on Wed Jun 24 14:26:59 1987
PATH=/bin:/usr/bin:/usr/ucb ; export PATH
if test -f logo.y -a "${1}" != "-c" ; then
echo shar: Will not over-write existing file \"logo.y\"
else
echo shar: Extracting \"logo.y\" \(19535 characters\)
sed "s/^X//" >logo.y <<'END_OF_logo.y'
X
X%nonassoc LOWPREC
X%nonassoc '<' '>' '='
X%left '+' '-'
X%left '*' '/' '\\'
X%left '^'
X%left UNARY
X%token TWOOP ONEOP NOOP ONECOM
X%token CSTRING UINT
X%token LTO IFCOM LEDIT LIFTF LTRACE
X%token LPROC LPEND LAEND LGO
X%token CLIST TWOCOM NOCOM
X%token RUNCOM RNEND REPCOM THREECOM
X%{
X#include "logo.h"
X
Xchar popname[NAMELEN+1];
Xint multnum;
Xstruct object *multarg = 0;
X#include <setjmp.h>
Xextern jmp_buf runret;
Xjmp_buf yerrbuf;
Xint catching = 0;
Xint flagquit = 0;
Xextern struct runblock *thisrun;
X#ifndef NOTURTLE
Xextern int turtdes;
Xextern struct display *mydpy;
X#endif
Xint errtold = 0;
Xint yyline =0;
Xchar ibuf[IBUFSIZ] ={0};
Xchar *ibufptr =NULL;
Xchar *getbpt =0;
Xchar titlebuf[100] ={0};
Xchar *titleptr =NULL;
Xextern char *cpystr();
Xint letflag =0;
Xint topf =0;
Xint pflag =0;
Xchar charib =0;
Xint endflag =0, rendflag = 0;
Xint traceflag =0;
Xint currtest = 0;
Xint argno =(-1);
Xint *stkbase =NULL;
Xint stkbi =0;
Xstruct stkframe *fbr =NULL;
Xstruct plist *proclist =NULL;
X#ifdef PAUSE
Xint pauselev = 0;
Xextern int psigflag,errpause;
X#endif
X
Xstruct object *add(), *sub(), *mult(), *div(), *rem(), *and(), *or();
Xstruct object *greatp(), *lessp(), *lmax(), *lmin(), *lis();
Xstruct object *worcat(), *sencat(), *equal(), *lemp(), *comp();
Xstruct object *lnump(), *lsentp(), *lwordp(), *length(), *zerop();
Xstruct object *first(), *butfir(), *last(), *butlas(), *alllk();
Xstruct object *lnamep(), *lrandd(), *rnd(), *sq(), *lpow(), *lsin();
Xstruct object *lcos(), *latan(), *ltime(), *request(), *readlist();
Xstruct object *cmprint(), *cmtype(), *cmoutput(), *lsleep(), *lbreak();
Xstruct object *cmlocal(), *assign(), *cmedit(), *lstop(), *show(), *erase();
Xstruct object *help(), *describe(), *ltrace(), *luntrace(), *lbyecom();
Xstruct object *sometrace();
X#ifndef NOTURTLE
Xstruct object *getturtle(), *forward(), *back();
Xstruct object *left(), *right(), *penup(), *cmpendown(), *clearscreen();
Xstruct object *fullscreen(), *splitscreen(), *showturtle();
Xstruct object *hideturtle(), *textscreen(), *cmpenerase(), *pencolor();
Xstruct object *wipeclean(), *penmode(), *penreverse(), *shownp(), *towardsxy();
Xstruct object *setcolor(), *setxy(), *setheading();
Xstruct object *xcor(), *ycor(), *heading(), *getpen();
Xstruct object *scrunch(), *setscrunch();
X#endif
Xstruct object *ltopl(), *cmfprint(), *cmftype(), *pots(), *fput(), *lput();
Xstruct object *list(), *loread(), *lowrite(), *fileclose(), *cbreak();
Xstruct object *lfread(), *lfword(), *fileprint(), *filefprint();
Xstruct object *filetype(), *fileftype(), *callunix(), *repcount();
X#ifdef DEBUG
Xstruct object *setdebquit(), *setmemtrace(), *setyaccdebug();
X#endif
Xstruct object *readchar(), *keyp(), *intpart(), *round(), *toascii();
Xstruct object *tochar(), *loflush(), *settest(), *memberp(), *item();
X#ifdef PAUSE
Xstruct object *unpause(), *dopause(), *setipause(), *setqpause(); /* PAUSE */
Xstruct object *seterrpause(), *clrerrpause();
X#endif
X#ifdef FLOOR
Xstruct object *hitoot(), *lotoot(), *lampon(), *lampoff();
Xstruct object *ftouch(), *btouch(), *ltouch(), *rtouch();
X#endif
X#ifndef SMALL
Xstruct object *gprop(), *plist(), *pps(), *remprop();
X#endif
X#ifdef SETCURSOR
Xstruct object *clrtxt(), *setcur();
X#endif
X
Xstruct lexstruct keywords[] =
X{
X "sum",TWOOP,add,NULL,
X "difference",TWOOP,sub,"diff",
X "product",TWOOP,mult,NULL,
X "quotient",TWOOP,div,NULL,
X "remainder",TWOOP,rem,"mod",
X "both",TWOOP,and,"and",
X "either",TWOOP,or,"or",
X "greaterp",TWOOP,greatp,NULL,
X "lessp",TWOOP,lessp,NULL,
X "maximum",TWOOP,lmax,"max",
X "minimum",TWOOP,lmin,"min",
X "is",TWOOP,lis,NULL,
X "word",TWOOP,worcat,NULL,
X "sentence",TWOOP,sencat,"se",
X "equalp",TWOOP,equal,NULL,
X "emptyp",ONEOP,lemp,NULL,
X "not",ONEOP,comp,NULL,
X "numberp",ONEOP,lnump,NULL,
X "sentencep",ONEOP,lsentp,NULL,
X "wordp",ONEOP,lwordp,NULL,
X "count",ONEOP,length,NULL,
X "zerop",ONEOP,zerop,NULL,
X "first",ONEOP,first,NULL,
X "butfirst",ONEOP,butfir,"bf",
X "last",ONEOP,last,NULL,
X "butlast",ONEOP,butlas,"bl",
X "thing",ONEOP,alllk,NULL,
X "namep",ONEOP,lnamep,NULL,
X "random",ONEOP,rnd,"rnd",
X "sqrt",ONEOP,sq,NULL,
X "pow",TWOOP,lpow,NULL,
X "sin",ONEOP,lsin,NULL,
X "cos",ONEOP,lcos,NULL,
X "arctan",ONEOP,latan,"atan",
X "time",NOOP,ltime,NULL,
X "request",NOOP,request,NULL,
X "readlist",NOOP,readlist,"rl",
X "print",ONECOM,cmprint,"pr",
X "type",ONECOM,cmtype,NULL,
X "output",ONECOM,cmoutput,"op",
X "wait",ONECOM,lsleep,NULL,
X "local",ONECOM,cmlocal,NULL,
X "make",TWOCOM,assign,NULL,
X "if",IFCOM,0,NULL,
X "to",LTO,0,NULL,
X "end",LPEND,0,NULL,
X "stop",NOCOM,lstop,NULL,
X "break",NOCOM,lbreak,NULL,
X "edit",LEDIT,cmedit,"ed",
X "go",LGO,0,NULL,
X "show",ONECOM,show,"po",
X "erase",ONECOM,erase,"er",
X "help",NOCOM,help,NULL,
X "describe",ONECOM,describe,NULL,
X "trace",LTRACE,sometrace,NULL,
X "untrace",NOCOM,luntrace,NULL,
X "goodbye",NOCOM,lbyecom,"bye",
X#ifndef NOTURTLE
X "turtle",ONECOM,getturtle,"tur",
X "forward",ONECOM,forward,"fd",
X "back",ONECOM,back,"bk",
X "left",ONECOM,left,"lt",
X "right",ONECOM,right,"rt",
X#ifdef FLOOR
X "hitoot",ONECOM,hitoot,"hit",
X "lotoot",ONECOM,lotoot,"lot",
X "lampon",NOCOM,lampon,"lon",
X "lampoff",NOCOM,lampoff,"loff",
X#endif
X "penup",NOCOM,penup,"pu",
X "pendown",NOCOM,cmpendown,"pd",
X "clearscreen",NOCOM,clearscreen,"cs",
X "fullscreen",NOCOM,fullscreen,"full",
X "splitscreen",NOCOM,splitscreen,"split",
X "showturtle",NOCOM,showturtle,"st",
X "hideturtle",NOCOM,hideturtle,"ht",
X "textscreen",NOCOM,textscreen,"text",
X "penerase",NOCOM,cmpenerase,"pe",
X "pencolor",ONECOM,pencolor,"penc",
X "setcolor",TWOCOM,setcolor,"setc",
X "setxy",TWOCOM,setxy,NULL,
X "setheading",ONECOM,setheading,"seth",
X "wipeclean",NOCOM,wipeclean,"clean",
X "penmode",NOOP,penmode,NULL,
X "penreverse",NOCOM,penreverse,"px",
X "shownp",NOOP,shownp,NULL,
X "towardsxy",TWOOP,towardsxy,NULL,
X#ifdef FLOOR
X "ftouch",NOOP,ftouch,"fto",
X "btouch",NOOP,btouch,"bto",
X "ltouch",NOOP,ltouch,"lto",
X "rtouch",NOOP,rtouch,"rto",
X#endif
X "xcor",NOOP,xcor,NULL,
X "ycor",NOOP,ycor,NULL,
X "heading",NOOP,heading,NULL,
X "getpen",NOOP,getpen,NULL,
X "scrunch",NOOP,scrunch,NULL,
X "setscrunch",ONECOM,setscrunch,"setscrun",
X#endif
X "toplevel",NOCOM,ltopl,NULL,
X "fprint",ONECOM,cmfprint,"fp",
X "ftype",ONECOM,cmftype,"fty",
X "pots",NOCOM,pots,NULL,
X "fput",TWOOP,fput,NULL,
X "lput",TWOOP,lput,NULL,
X "list",TWOOP,list,NULL,
X "openread",ONEOP,loread,"openr",
X "openwrite",ONEOP,lowrite,"openw",
X "close",ONECOM,fileclose,NULL,
X "fileread",ONEOP,lfread,"fird",
X "fileword",ONEOP,lfword,"fiwd",
X "fileprint",TWOCOM,fileprint,"fip",
X "filefprint",TWOCOM,filefprint,"fifp",
X "filetype",TWOCOM,filetype,"fity",
X "fileftype",TWOCOM,fileftype,"fifty",
X "unix",ONECOM,callunix,NULL,
X "run",RUNCOM,0,NULL,
X "repeat",REPCOM,0,NULL,
X "repcount",NOOP,repcount,NULL,
X#ifdef DEBUG
X "debquit",NOCOM,setdebquit,NULL,
X "memtrace",NOCOM,setmemtrace,NULL,
X "yaccdebug",NOCOM,setyaccdebug,NULL,
X#endif
X "cbreak",ONECOM,cbreak,NULL,
X "readchar",NOOP,readchar,"rc",
X "keyp",NOOP,keyp,NULL,
X "int",ONEOP,intpart,NULL,
X "round",ONEOP,round,NULL,
X "ascii",ONEOP,toascii,NULL,
X "char",ONEOP,tochar,NULL,
X "oflush",NOCOM,loflush,NULL,
X#ifndef SMALL
X "gprop",TWOOP,gprop,NULL,
X "plist",ONEOP,plist,NULL,
X "pprop",THREECOM,0,NULL,
X "pps",NOCOM,pps,NULL,
X "remprop",TWOCOM,remprop,NULL,
X#endif
X "test",ONECOM,settest,NULL,
X "iftrue",LIFTF,(struct object *(*)())1,"ift",
X "iffalse",LIFTF,0,"iff",
X "memberp",TWOOP,memberp,NULL,
X "item",TWOOP,item,"nth",
X#ifdef PAUSE
X "continue",NOCOM,unpause,"co",
X "pause",NOCOM,dopause,NULL,
X "setipause",NOCOM,setipause,NULL,
X "setqpause",NOCOM,setqpause,NULL,
X "errpause",NOCOM,seterrpause,NULL,
X "errquit",NOCOM,clrerrpause,NULL,
X#endif
X#ifdef SETCURSOR
X "cleartext",NOCOM,clrtxt,"ct",
X "setcursorxy",TWOCOM,setcur,"setcxy",
X#endif
X NULL,NULL,NULL,NULL,
X};
X
X#define uperror {errtold++;YYERROR;}
X
X#ifdef PAUSE
X#define catch(X) {if(!setjmp(yerrbuf)){if(flagquit)errhand();catching++;X;catching=0;}else{catching=0;uperror}}
X#else
X#define catch(X) {X;}
X#endif
X%}
X%%
Xstart_sym : |
X start_sym command ={
X popname[0] = '\0';
X#ifdef PAUSE
X if (psigflag) dopause();
X#endif
X yyprompt(1);
X } |
X start_sym error ={
X popname[0] = '\0';
X if (!errtold) {
X logoyerror();
X }
X errtold = 0;
X errwhere();
X#ifdef PAUSE
X if ((!errpause&&!pauselev) || !fbr)
X#endif
X errzap();
X yyerrok;yyclearin;
X yyprompt(0);
X };
Xcommand :
X LEDIT rnewline ={
X catch(doedit(););
X $$ = -1;
X } |
X LTRACE rnewline ={
X catch(ltrace(););
X $$ = -1;
X } |
X onecom valuearg newline ={
X catch($$=(int)(*keywords[$1].lexval)($2););} |
X onecom error ={notenf($1);uperror;} |
X TWOCOM valuearg valuearg newline ={
X catch((*keywords[$1].lexval)($2,$3);); $$ = -1;} |
X TWOCOM error ={notenf($1);uperror;} |
X THREECOM valuearg valuearg valuearg newline ={
X#ifndef SMALL
X catch(pprop($2,$3,$4););
X#endif
X $$ = -1;
X } |
X THREECOM error ={
X if (!errtold) {
X puts("Not enough inputs to pprop.");
X }
X uperror;
X } |
X rnewline ={ $$= -1; } |
X NOCOM newline ={
X catch((*keywords[$1].lexval)();); $$= -1;} |
X LGO white3 valuearg newline ={
X catch(go($3););
X $$= -1;
X } |
X LGO error ={notenf($1);uperror;} |
X ifcall ={
X if (($1 != -1) && !endflag) {
X if (!errtold)
X pf1("You don't say what to do with %l.\n",$1);
X uperror;
X }
X $$ = $1;
X } |
X title ={
X if ($1== -1)
X uperror
X else
X catch(proccreate($1););
X $$ = -1;
X } |
X arg newline {
X if (thisrun && !pflag) {
X $$ = $1;
X } else {
X if(($1 != -1) && !endflag) {
X if (!errtold)
X pf1("You don't say what to do with %l\n",$1);
X uperror;
X }
X }
X } ;
X
Xonecom : ONECOM | LEDIT | LTRACE ;
X
Xvaluearg: userarg ={
X if ($1 == -1) {
X if (!errtold) {
X printf("%s didn't output.\n",
X popname);
X }
X uperror;
X }
X } |
X sysarg ;
X
Xlabint : UINT %prec UNARY ={ yyline=((struct object *)$1)->obint; mfree($1); $$ = 0;};
X
Xarg : userarg | sysarg ;
X
Xuserarg : proccall %prec UNARY |
X runcall %prec LOWPREC ;
X
Xsysarg : TWOOP valuearg valuearg %prec LOWPREC ={
X catch($$=(int)(*keywords[$1].lexval)($2,$3););
X } |
X TWOOP valuearg error %prec LOWPREC ={op2er1($1,$2);uperror;} |
X TWOOP error %prec LOWPREC ={notenf($1);uperror;} |
X ONEOP valuearg %prec LOWPREC ={
X catch($$=(int)(*keywords[$1].lexval)($2););
X } |
X ONEOP error %prec LOWPREC ={notenf($1);uperror;} |
X NOOP %prec LOWPREC ={
X catch($$=(int)(*keywords[$1].lexval)(););
X } |
X UINT %prec LOWPREC |
X '\"' CSTRING { $$=$2; } |
X '[' CLIST ']' { $$=$2; } |
X ':' CSTRING {
X catch($$=(int)alllk($2););
X } |
X valuearg '+' valuearg ={
X catch($$=(int)add($1,$3););
X } |
X valuearg '+' error ={inferr($1,$2);uperror;} |
X valuearg '-' valuearg ={
X catch($$=(int)sub($1,$3););
X } |
X valuearg '-' error ={inferr($1,$2);uperror;} |
X '-' valuearg %prec UNARY ={
X catch($$=(int)opp($2););
X } |
X '-' error %prec UNARY ={unerr('-');uperror;} |
X valuearg '^' valuearg {
X catch($$=(int)lpow($1,$3););
X } |
X valuearg '^' error { inferr($1,$2);uperror; } |
X valuearg '*' valuearg ={
X catch($$=(int)mult($1,$3););
X } |
X valuearg '*' error ={inferr($1,$2);uperror;} |
X valuearg '/' valuearg ={
X catch($$=(int)div($1,$3););
X } |
X valuearg '/' error ={inferr($1,$2);uperror;} |
X valuearg '\\' valuearg ={
X catch($$=(int)rem($1,$3););
X } |
X valuearg '\\' error ={inferr($1,$2);uperror;} |
X valuearg '=' valuearg ={
X catch($$=(int)equal($1,$3);)
X } |
X valuearg '=' error ={inferr($1,$2);uperror;} |
X valuearg '<' valuearg ={
X catch($$=(int)lessp($1,$3););
X } |
X valuearg '<' error ={inferr($1,$2);uperror;} |
X valuearg '>' valuearg ={
X catch($$=(int)greatp($1,$3););
X } |
X valuearg '>' error ={inferr($1,$2);uperror;} |
X '{' TWOOP oparglist rbrak {
X catch($$=multiop($2,globcopy(multarg)););
X lfree(multarg);
X multarg = 0;
X }|
X '(' TWOOP oparglist rbrak {
X catch($$=multiop($2,globcopy(multarg)););
X lfree(multarg);
X multarg = 0;
X }|
X '(' valuearg rbrak ={$$=$2;} ;
X
Xoparglist : valuearg ={
X catch(multarg = globcons($1,0););
X mfree($1);
X multnum = 1;
X } |
X valuearg oparglist ={
X catch(multarg = globcons($1,multarg););
X mfree($1);
X multnum++;
X };
Xtitle : tbegin varlist '\n' ={
X strcpy(titleptr,"\n");
X $$=$1;
X } |
X tbegin '\n' ={
X strcpy(titleptr,"\n");
X $$=$1;
X } |
X tbegin varlist error ={
X mfree($1);
X terr();
X $$= -1;
X } |
X tbegin error ={
X mfree($1);
X terr();
X $$= -1;
X };
Xtbegin : LTO LPROC ={
X titleptr=cpystr(titlebuf,"to ",
X ((struct object *)($2))->obstr,NULL);
X $$=$2;
X } |
X LTO primitive ={
X if (!errtold) printf("Can't redefine primitive %s\n",
X keywords[$2].word);
X uperror;
X };
Xprimitive : NOOP | ONEOP | TWOOP | NOCOM | ONECOM | TWOCOM | THREECOM
X | IFCOM | LTO | LEDIT | LIFTF | LGO
X | RUNCOM | REPCOM | LPEND ;
Xvarlist : varsyn ={titleptr=cpystr(titleptr," :",
X ((struct object *)($1))->obstr,NULL);
X mfree($1);
X } |
X varlist varsyn {titleptr=cpystr(titleptr," :",
X ((struct object *)($2))->obstr,NULL);
X mfree($2);
X } ;
Xvarsyn : ':' CSTRING {$$=$2;};
Xproccall : procname args argend commlist procend ={
X $$=$4;
X frmpop($4);
X } |
X procname error ={
X if (!errtold) printf("Not enough inputs to %s\n",
X proclist->procname->obstr);
X uperror;
X };
Xargs: | arglist;
Xarglist : valuearg %prec LOWPREC ={
X catch(argassign($1););
X } |
X arglist valuearg %prec LOWPREC ={
X catch(argassign($2););
X } ;
Xargend : LAEND ={procprep();};
Xcommlist : ={yyline=1; $$ = -1;} |
X commlist labint command ={
X popname[0] = '\0';
X#ifdef PAUSE
X if (psigflag) dopause();
X if (thisrun && thisrun->str == (struct object *)(-1))
X yyprompt(1);
X#endif
X $$=$3;
X } |
X commlist command ={
X popname[0] = '\0';
X if (pflag) yyline++;
X#ifdef PAUSE
X if (psigflag) dopause();
X if (thisrun && thisrun->str == (struct object *)(-1))
X yyprompt(1);
X#endif
X $$=$2;
X } |
X commlist error ={
X popname[0] = '\0';
X#ifdef PAUSE
X if ((!errpause&&!pauselev) || !fbr)
X#endif
X uperror;
X#ifdef PAUSE
X if (!errtold) {
X logoyerror();
X }
X errtold = 0;
X errwhere();
X yyerrok;yyclearin;
X if (thisrun && thisrun->str == (struct object *)(-1))
X yyprompt(0);
X#endif
X };
Xprocend : LPEND |
X labint LPEND ;
Xprocname : LPROC ={
X catch(newproc($1););
X };
Xrcommlist : ={$$ = -1;} |
X rcommlist command ={
X popname[0] = '\0';
X#ifdef PAUSE
X if (psigflag) dopause();
X if (thisrun && thisrun->str == (struct object *)(-1))
X yyprompt(1);
X#endif
X $$=$2;
X } |
X rcommlist error ={
X popname[0] = '\0';
X#ifdef PAUSE
X if ((!errpause&&!pauselev) || !fbr)
X#endif
X uperror;
X#ifdef PAUSE
X if (!errtold) {
X logoyerror();
X }
X errtold = 0;
X errwhere();
X yyerrok;yyclearin;
X if (thisrun && thisrun->str == (struct object *)(-1))
X yyprompt(0);
X#endif
X };
Xruncall : realrun | reprun | ifrun ;
Xrealrun : runstart rcommlist runend ={
X unrun();
X $$ = $2;
X strcpy(popname,"run");
X };
Xreprun : reprstart rcommlist runend ={
X unrun();
X $$ = $2;
X strcpy(popname,"repeat");
X };
Xifrun : ifrstart rcommlist runend ={
X unrun();
X $$ = $2;
X strcpy(popname,"if");
X };
Xrunstart : RUNCOM valuearg %prec LOWPREC ={
X catch(dorun($2,(FIXNUM)0););
X } ;
Xreprstart : REPCOM valuearg valuearg %prec LOWPREC ={
X catch(dorep($2,$3););
X } ;
Xifrstart : IFCOM valuearg valuearg valuearg %prec LOWPREC ={
X {
X int i;
X
X catch(i = truth($2););
X if (i) {
X catch(dorun($3,(FIXNUM)0););
X mfree($4);
X } else {
X catch(dorun($4,(FIXNUM)0););
X mfree($3);
X }
X }
X } |
X IFCOM error ={
X if (!errtold) printf("Not enough inputs to if.\n");
X uperror;
X } ;
Xrunend : RNEND;
Xifcall : ifstart rcommlist runend ={
X unrun();
X $$ = $2;
X };
Xifstart : IFCOM valuearg valuearg rnewline ={
X {
X int i;
X
X catch(i = truth($2););
X if (i) {catch(dorun($3,(FIXNUM)0););}
X else {
X catch(dorun(0,(FIXNUM)0););
X mfree($3);
X }
X }
X } |
X LIFTF valuearg newline ={
X if ((int)keywords[$1].lexval==currtest) {
X catch(dorun($2,(FIXNUM)0););
X } else {
X catch(dorun(0,(FIXNUM)0););
X mfree($2);
X }
X } ;
Xwhite3 : | LTO ;
Xrbrak : '}' | ')' ;
Xnewline : '\n' | ';' | ;
Xrnewline : '\n' | ';' ;
X%%
X
Xextern struct object *makelist();
X
X#ifdef PAUSE
Xyylex1()
X#else
Xyylex()
X#endif
X{
X register char *str;
X char s[100];
X char c;
X register pc;
X register i;
X NUMBER dubl;
X int floatflag;
X FIXNUM fixn;
X
X if (yyerrflag) return(1);
X else if (argno==0 && pflag!=1) {
X if (fbr->oldyyc==-2) fbr->oldyyc= -1;
X return(LAEND);
X } else if (endflag==1 && pflag>1) {
X endflag=0;
X return(LPEND);
X }
X else if (pflag==2) {
X pc= *(stkbase+stkbi++);
X if (stkbi==PSTKSIZ-1) {
X stkbase= (int *)(*(stkbase+PSTKSIZ-1));
X stkbi=1;
X }
X yylval= *(stkbase+stkbi++);
X if (pc==LPROC || pc==CSTRING || pc==UINT || pc==CLIST) {
X yylval=(int)localize((struct object *)yylval);
X }
X if (stkbi==PSTKSIZ-1) {
X stkbase= (int *)(*(stkbase+PSTKSIZ-1));
X stkbi=1;
X }
X if (pc== -1) return(0);
X else return(pc);
X } else if (letflag==1) {
X str=s;
X while (!index(" \t\n[](){}\";",(c = getchar()))) {
X if (c == '\\') c = getchar() /* |0200 */ ;
X else if (c == '%') c = ' ' /* |0200 */ ;
X *str++ = c;
X }
X charib=c;
X *str='\0';
X yylval=(int)localize(objcpstr(s));
X letflag=0;
X return(CSTRING);
X } else if (letflag==2) {
X str = s;
X while (( (c=getchar())>='a' && c<='z' )
X || (c>='A' && c<='Z') || (c>='0' && c<='9')
X || (c=='.') || (c=='_') ) {
X if (c>='A' && c<='Z') c += 040;
X *str++ = c;
X }
X charib = c;
X *str = '\0';
X letflag = 0;
X yylval = (int)localize(objcpstr(s));
X return(CSTRING);
X }
X else if (letflag==3) {
X yylval = (int)makelist();
X letflag = 4;
X return(CLIST);
X }
X else if (letflag==4) {
X letflag = 0;
X return(yylval = getchar());
X }
X while ((c=getchar())==' ' || c=='\t')
X ;
X if (rendflag) {
X getbpt = 0;
X if (rendflag < 3)
X --rendflag;
X else if (!thisrun || thisrun->svpflag)
X rendflag = 0;
X return(RNEND);
X }
X
X if (c == '!') /* comment feature */
X while ((c=getchar()) && (c != '\n')) ;
X
X if ((c<'a' || c>'z') && (c<'A' || c>'Z')
X && (c<'0' || c>'9') && c!='.') {
X yylval=c;
X if (c=='\"') letflag=1;
X if (c==':') letflag=2;
X if (c=='[') letflag=3;
X return(c);
X }
X else if ((c>='0' && c<='9')|| c=='.') {
X floatflag = (c=='.');
X str=s;
X while ((c>='0' && c<='9')||(c=='E')||(c=='e')||(c=='.')) {
X *str++=c;
X if (c=='.') floatflag++;
X if ((c=='e')||(c=='E')) {
X floatflag++;
X c = getchar();
X if ((c=='+')||(c=='-')) {
X *str++ = c;
X c = getchar();
X }
X } else c=getchar();
X }
X charib=c;
X *str='\0';
X if (floatflag) {
X sscanf(s,EFMT,&dubl);
X yylval=(int)localize(objdub(dubl));
X } else {
X sscanf(s,FIXFMT,&fixn);
X yylval=(int)localize(objint(fixn));
X }
X return(UINT);
X } else {
X if (c < 'a') c += 040;
X yylval=(int)(str=s);
X *str++=c;
X c=getchar();
X if (c >= 'A' && c <= 'Z') c += 040;
X while ((c>='a' && c<='z') || (c>='0' && c<='9')
X || (c=='.') || (c=='_')) {
X *str++=c;
X c=getchar();
X if (c >= 'A' && c <= 'Z') c += 040;
X }
X charib=c;
X *str='\0';
X for (i=0; keywords[i].word; i++) {
X if (!strcmp(yylval,keywords[i].word) ||
X (keywords[i].abbr &&
X !strcmp(yylval,keywords[i].abbr))) {
X yylval=i;
X return(keywords[i].lexret);
X }
X }
X yylval=(int)localize(objcpstr(s));
X return(LPROC);
X }
X}
X
X#ifdef PAUSE
Xyylex() {
X int x;
X
X if (catching) return(yylex1());
X if (!setjmp(yerrbuf)) {
X if (flagquit) errhand();
X catching++;
X x = yylex1();
X catching=0;
X return(x);
X } else {
X catching=0;
X return(12345); /* This should cause an error up there */
X }
X}
X#endif
X
Xint isuint(x)
Xint x;
X{
X return(x == UINT);
X}
X
Xint isstored(x)
Xint x;
X{
X return(x==UINT || x==LPROC || x==CSTRING || x==CLIST);
X}
X
Xyyprompt(clear) {
X register int i;
X
X if (!ibufptr && !getbpt && !pflag) {
X flagquit = 0;
X#ifdef PAUSE
X if (pauselev > 0) {
X for (i=pauselev; --i >=0; )
X putchar('-');
X }
X#endif
X putchar('?');
X#ifndef NOTURTLE
X if ((turtdes<0) && clear)
X (*mydpy->state)('*');
X#endif
X fflush(stdout);
X }
X}
X
END_OF_logo.y
if test 19535 -ne `wc -c <logo.y`; then
echo shar: \"logo.y\" unpacked with wrong size!
fi
# end of overwriting check
fi
echo shar: End of archive 4 \(of 6\).
cp /dev/null ark4isdone
MISSING=""
for I in 1 2 3 4 5 6 ; do
if test ! -f ark${I}isdone ; then
MISSING="${MISSING} ${I}"
fi
done
if test "${MISSING}" = "" ; then
echo You have unpacked all 6 archives.
echo "Now see the README"
rm -f ark[1-9]isdone
else
echo You still need to unpack the following archives:
echo " " ${MISSING}
fi
## End of shell archive.
exit 0