From: em Date: Thu, 17 Jan 1985 14:10:27 +0000 (+0000) Subject: Checking in Martin's changes. X-Git-Tag: release-5-5~5771 X-Git-Url: https://git.ndcode.org/public/gitweb.cgi?a=commitdiff_plain;h=6512a304a0c9470207b388ca884e490646430711;p=ack.git Checking in Martin's changes. --- diff --git a/lang/basic/src.old/basic.yacc b/lang/basic/src.old/basic.yacc index 8872d9903..9a7fcd0d2 100644 --- a/lang/basic/src.old/basic.yacc +++ b/lang/basic/src.old/basic.yacc @@ -87,6 +87,7 @@ int chann; /* input/output channel */ char *formatstring; /* formatstring used for printing */ Symbol *s; /* Symbol dummy */ %} +/* We need to type things properly to limit complaints of lint*/ %% programline : INTVALUE {newblock(ival); newemblock(ival);} stmts EOLN | '#' INTVALUE STRVALUE EOLN @@ -417,8 +418,8 @@ factor : INTVALUE {$$=loadint(ival);} | '(' expression ')' {$$=$2;} | '-' factor { $$=negate($2);} | FLTVALUE {$$=loaddbl(dval);} - | STRVALUE {$$=loadstr($1);} - | variable {$$=loadvar($1);} + | STRVALUE {$$= STRINGTYPE; loadstr($1);} + | variable {$$=$1; loadvar($1);} | INKEYSYM '$' { emcode("cal","$_inkey"); emcode("lfr",EMPTRSIZE); $$= STRINGTYPE; @@ -426,8 +427,8 @@ factor : INTVALUE {$$=loadint(ival);} | VARPTR '(' '#' intvalue ')' { warning("Not supported"); $$=INTTYPE;} | FUNCTION {$$= callfcn($1,0);} | FUNCTION '(' cross exprlist')' {$$=callfcn($1,$4);} - | funcname { $$=fcnend($1);} - | funcname funccall ')' { $$=fcnend($1,$2);} + | funcname { $$=fcnend(0);} + | funcname funccall ')' { $$=fcnend($2);} | MIDSYM '$' midparms { emcode("cal","$_mid"); emcode("asp",itoa($3)); @@ -460,4 +461,4 @@ exprlist: expression { typetable[0]= $1; $$=1;} #ifndef NORCSID static char rcs_id[] = "$Header$" ; #endif -#include "lex.c" +#include "basic.lex" diff --git a/lang/basic/src.old/bem.h b/lang/basic/src.old/bem.h index ccf00892b..18f1aaaa3 100644 --- a/lang/basic/src.old/bem.h +++ b/lang/basic/src.old/bem.h @@ -61,3 +61,5 @@ extern char *itoa(); extern char *datalabel(); extern char *instrlabel(); extern char *typesize(); +extern char *typestring(); +extern void sprintf(); diff --git a/lang/basic/src.old/compile.c b/lang/basic/src.old/compile.c index f23e44ff7..301922033 100644 --- a/lang/basic/src.old/compile.c +++ b/lang/basic/src.old/compile.c @@ -6,13 +6,15 @@ static char rcs_id[] = "$Header$" ; /* compile the next program in the list */ +/* Here we should open the input file. (for the future) */ FILE *yyin; -compileprogram() +compileprogram(dummyprog) +char *dummyprog; { while( getline()) - yyparse(); - fclose(yyin); + (void) yyparse(); + (void) fclose(yyin); } diff --git a/lang/basic/src.old/eval.c b/lang/basic/src.old/eval.c index 2cddba508..40bc8c789 100644 --- a/lang/basic/src.old/eval.c +++ b/lang/basic/src.old/eval.c @@ -321,7 +321,6 @@ int type; { /* load a simple variable its address is on the stack*/ emcode("loi",typestring(type)); - return(type); } loadint(value) int value; @@ -343,7 +342,6 @@ loadstr(value) int value; { emcode("lae",datalabel(value)); - return(STRINGTYPE); } loadaddr(s) Symbol *s; diff --git a/lang/basic/src.old/graph.c b/lang/basic/src.old/graph.c index 0a3a08235..d7624292a 100644 --- a/lang/basic/src.old/graph.c +++ b/lang/basic/src.old/graph.c @@ -11,6 +11,13 @@ Linerecord *firstline, *currline, *lastline; +List *newlist() +{ + List *l; + l= (List *) salloc(sizeof(List)); + return(l); +} + /* Line management is handled here */ Linerecord *srchline(nr) @@ -94,7 +101,7 @@ int nr; if(debug) printf("goto label %d\n",nr); /* update currline */ - ll= (List *) salloc( sizeof(*ll)); + ll= newlist(); ll-> linenr=nr; ll-> nextlist= currline->gotos; currline->gotos= ll; @@ -108,7 +115,7 @@ int nr; { /* declare forward label */ if(debug) printf("declare forward %d\n",nr); - ll= (List *) salloc( sizeof(*ll)); + ll= newlist(); ll->emlabel= genlabel(); ll-> linenr=nr; ll->nextlist= forwardlabel; @@ -132,9 +139,8 @@ int gosubcnt=1; List *gosublabel() { List *l; - int n; - l= (List *) salloc(sizeof(List)); + l= newlist(); l->nextlist=0; l->emlabel=genlabel(); if( gotail){ @@ -192,7 +198,7 @@ int nr; { List *l; - l= (List *) salloc(sizeof(List)); + l= newlist(); l->emlabel= gotolabel(nr); l->nextlist=0; if( jumphead==0) jumphead= jumptail= l; @@ -247,7 +253,7 @@ int type; } jumphead= jumptail=0; jumpcnt=0; - l= (List *) salloc(sizeof(List)); + l= newlist(); l->nextlist=0; l->emlabel=firstlabel; if( gotail){ @@ -277,12 +283,12 @@ simpleprogram() /* a small EM programs has been found */ prologcode(); prolog2(); - fclose(tmpfile); + (void) fclose(tmpfile); tmpfile= fopen(tmpfname,"r"); if( tmpfile==NULL) fatal("tmp file disappeared"); while( (length=fread(buf,1,512,tmpfile)) != 0) - fwrite(buf,1,length,emfile); + (void) fwrite(buf,1,length,emfile); epilogcode(); - unlink(tmpfname); + (void) unlink(tmpfname); } diff --git a/lang/basic/src.old/parsepar.c b/lang/basic/src.old/parsepar.c index 67c5448e4..978a1cfd1 100644 --- a/lang/basic/src.old/parsepar.c +++ b/lang/basic/src.old/parsepar.c @@ -15,10 +15,9 @@ parseparams(argc,argv) int argc; char **argv; { - int i,j,k; + int i; char *ext; - j=k=0; if(argc< 4) { fprintf(stderr,"usage %s .i .e \n", argv[0]); @@ -32,7 +31,7 @@ char **argv; case 't': traceflag++; break; /* line tracing */ case 'h':/* split EM file */ hflag=0; - threshold= (long) atol(argv[i][2]); + threshold= atoi(argv[i][2]); if( threshold==0) threshold= THRESHOLD; break; diff --git a/lang/basic/src.old/split.c b/lang/basic/src.old/split.c index 54ac69222..72c289b6e 100644 --- a/lang/basic/src.old/split.c +++ b/lang/basic/src.old/split.c @@ -41,8 +41,8 @@ List *l; phase1() { /* copy all offloaded blocks */ - Linerecord *lr, *lf,*lr2; - int blksize; + Linerecord *lr, *lf; + long blksize; lf= lr= firstline; blksize= lr->codelines; diff --git a/lang/basic/src.old/symbols.c b/lang/basic/src.old/symbols.c index 3b5f9242b..5bd45e078 100644 --- a/lang/basic/src.old/symbols.c +++ b/lang/basic/src.old/symbols.c @@ -191,8 +191,7 @@ heading( ) if( fcn->symtype== DEFAULTTYPE) fcn->symtype= DOUBLETYPE; } -fcnsize(s) -Symbol *s; +fcnsize() { /* generate portable function size */ int i; @@ -210,7 +209,7 @@ int type; emcode("ret", typestring(fcn->symtype)); /* generate portable EM code */ fprintf(tmpfile," end "); - fcnsize(fcn); + fcnsize(); s= firstsym; while(s) { @@ -226,7 +225,7 @@ int type; dclparm(s) Symbol *s; { - int i,size=0; + int size=0; if( s->symtype== DEFAULTTYPE) s->symtype= DOUBLETYPE; s->isparam=1; @@ -257,9 +256,10 @@ Symbol *s; fcnindex++; fcntable[fcnindex]=s; } + return(s->symtype); } -fcnend(fcntype, parmcount) -int fcntype, parmcount; +fcnend(parmcount) +int parmcount; { int type; /* check number of arguments */ @@ -270,7 +270,7 @@ int fcntype, parmcount; fprintf(tmpfile," cal $_%s\n",fcn->symname); emlinecount++; fprintf(tmpfile," asp "); - fcnsize(fcn); + fcnsize(); emcode("lfr",typestring(fcn->symtype)); type= fcn->symtype; fcnindex--;