Checking in Martin's changes.
authorem <none@none>
Thu, 17 Jan 1985 14:10:27 +0000 (14:10 +0000)
committerem <none@none>
Thu, 17 Jan 1985 14:10:27 +0000 (14:10 +0000)
lang/basic/src.old/basic.yacc
lang/basic/src.old/bem.h
lang/basic/src.old/compile.c
lang/basic/src.old/eval.c
lang/basic/src.old/graph.c
lang/basic/src.old/parsepar.c
lang/basic/src.old/split.c
lang/basic/src.old/symbols.c

index 8872d99..9a7fcd0 100644 (file)
@@ -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"
index ccf0089..18f1aaa 100644 (file)
@@ -61,3 +61,5 @@ extern char *itoa();
 extern char *datalabel();
 extern char *instrlabel();
 extern char *typesize();
+extern char *typestring();
+extern void sprintf();
index f23e44f..3019220 100644 (file)
@@ -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);
 }
index 2cddba5..40bc8c7 100644 (file)
@@ -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;
index 0a3a082..d762429 100644 (file)
@@ -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);
 }
index 67c5448..978a1cf 100644 (file)
@@ -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 <flags> <file>.i <file>.e <source>\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;
index 54ac692..72c289b 100644 (file)
@@ -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;
index 3b5f924..5bd45e0 100644 (file)
@@ -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--;