Skip to content

Commit

Permalink
Replace print() with printf().
Browse files Browse the repository at this point in the history
  • Loading branch information
davidgiven committed Dec 5, 2024
1 parent 3938f8a commit 04bec50
Show file tree
Hide file tree
Showing 48 changed files with 323 additions and 356 deletions.
16 changes: 8 additions & 8 deletions lang/basic/src/basic.lex
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ void fillkex(void)
if (debug)
{
for(i=0;i<27;i++)
print("%c:%d\n",'a'+i,kex[i]);
printf("%c:%d\n",'a'+i,kex[i]);
}
}

Expand Down Expand Up @@ -296,7 +296,7 @@ int lookup(void)
/* keywords door delimiters gescheiden */
cptr += k->length;
yylval.integer= k->classvalue;
if (debug) print("lookup:%d %d\n",
if (debug) printf("lookup:%d %d\n",
k->classvalue,k->token);
if ( k->token == FUNCTION)
{
Expand Down Expand Up @@ -329,7 +329,7 @@ int lookup(void)
}
if ( typech)
Sym->symtype=typech;
if (debug) print("lookup:%d Identifier\n",Sym);
if (debug) printf("lookup:%d Identifier\n",Sym);
if ( (name[0]=='f' || name[0]=='F') &&
(name[1]=='n' || name[1]=='N') )
return(FUNCTID);
Expand Down Expand Up @@ -422,7 +422,7 @@ int number(void)
}
/*NOSTRICT*/ ival= i1;
#ifdef YYDEBUG
if (yydebug) print("number:INTVALUE %d",i1);
if (yydebug) printf("number:INTVALUE %d",i1);
#endif
return(INTVALUE);
}
Expand Down Expand Up @@ -452,7 +452,7 @@ int number(void)
*d = 0;
cptr=c;
#ifdef YYDEBUG
if (yydebug) print("number:FLTVALUE %s",dval);
if (yydebug) printf("number:FLTVALUE %s",dval);
#endif
return(FLTVALUE);
}
Expand Down Expand Up @@ -481,7 +481,7 @@ int scanstring(void)
case 0:
case '\n':
#ifdef YYDEBUG
if (yydebug) print("STRVALUE\n");
if (yydebug) printf("STRVALUE\n");
#endif
if ( firstchar == '"')
error("non-terminated string");
Expand Down Expand Up @@ -521,7 +521,7 @@ int scanstring(void)
C_rom_icon(myitoa(length),(arith)BEMINTSIZE);
}
#ifdef YYDEBUG
if (yydebug) print("STRVALUE found\n");
if (yydebug) printf("STRVALUE found\n");
#endif
return(STRVALUE);
}
Expand Down Expand Up @@ -561,7 +561,7 @@ int yylex(void)
return(EOLN);
case 0:
#ifdef YYDEBUG
if ( yydebug) print("end of buffer");
if ( yydebug) printf("end of buffer");
#endif
return(0);
case '"':
Expand Down
14 changes: 7 additions & 7 deletions lang/basic/src/eval.c
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ void conversion(int oldtype,int newtype)
C_cif ();
} else {
if (debug)
print("type n=%d o=%d\n",newtype,oldtype);
printf("type n=%d o=%d\n",newtype,oldtype);
error("conversion error");
}
break;
Expand All @@ -67,7 +67,7 @@ void conversion(int oldtype,int newtype)
break;
default:
if (debug)
print("type n=%d o=%d\n",newtype,oldtype);
printf("type n=%d o=%d\n",newtype,oldtype);
error("conversion error");
}
}
Expand All @@ -78,7 +78,7 @@ void extraconvert(int oldtype,int newtype,int topstack)
{
/* the value below the top of the stack should be converted */
if ( oldtype==newtype ) return;
if ( debug) print("extra convert %d %d %d\n",oldtype,newtype,topstack);
if ( debug) printf("extra convert %d %d %d\n",oldtype,newtype,topstack);
/* save top in dummy */

switch( topstack)
Expand Down Expand Up @@ -188,7 +188,7 @@ int relop(int ltype,int rtype,int operator)
{
int result;

if (debug) print("relop %d %d op=%d\n",ltype,rtype,operator);
if (debug) printf("relop %d %d op=%d\n",ltype,rtype,operator);
result= exprtype(ltype,rtype);
extraconvert(ltype,result,rtype);
conversion(rtype,result);
Expand Down Expand Up @@ -348,7 +348,7 @@ int typesize(int ltype)
return(BEMPTRSIZE);
default:
error("typesize:unexpected");
if (debug) print("type received %d\n",ltype);
if (debug) printf("type received %d\n",ltype);
}
return(BEMINTSIZE);
}
Expand Down Expand Up @@ -417,12 +417,12 @@ int loadaddr(Symbol *s)
int i,j;
arith sum;

if (debug) print("load %s %d\n",s->symname,s->symtype);
if (debug) printf("load %s %d\n",s->symname,s->symtype);
if ( s->symalias>0)
C_lae_dlb((label)s->symalias,(arith)0);
else {
j= -s->symalias;
if (debug) print("load parm %d\n",j);
if (debug) printf("load parm %d\n",j);
/* first count the sizes. */
sum = 0;
for(i=fcn->dimensions;i>j;i--)
Expand Down
2 changes: 1 addition & 1 deletion lang/basic/src/func.c
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ int callfcn(int fcnnr,int cnt,int *typetable)

type= typetable[0];
exprlimit=cnt;
if(debug) print("fcn=%d\n",fcnnr);
if(debug) printf("fcn=%d\n",fcnnr);

switch(fcnnr)
{
Expand Down
12 changes: 6 additions & 6 deletions lang/basic/src/graph.c
Original file line number Diff line number Diff line change
Expand Up @@ -78,15 +78,15 @@ void newblock(int nr)
Linerecord *l;
List *frwrd;

if ( debug) print("newblock at %d\n",nr);
if ( debug) printf("newblock at %d\n",nr);
if ( nr>0 && currline && currline->linenr>= nr)
{
if ( debug) print("old line:%d\n",currline->linenr);
if ( debug) printf("old line:%d\n",currline->linenr);
error("Lines out of sequence");
}

frwrd=srchforward(nr);
if ( frwrd && debug) print("forward found %d\n",frwrd->emlabel);
if ( frwrd && debug) printf("forward found %d\n",frwrd->emlabel);
l= srchline(nr);
if ( l)
{
Expand Down Expand Up @@ -117,7 +117,7 @@ int gotolabel(int nr)
Linerecord *l1;
List *ll;

if (debug) print("goto label %d\n",nr);
if (debug) printf("goto label %d\n",nr);
/* update currline */
ll= newlist();
ll-> linenr=nr;
Expand All @@ -132,7 +132,7 @@ int gotolabel(int nr)
if ( l1==0)
{
/* declare forward label */
if (debug) print("declare forward %d\n",nr);
if (debug) printf("declare forward %d\n",nr);
ll= newlist();
ll->emlabel= genlabel();
ll-> linenr=nr;
Expand Down Expand Up @@ -278,7 +278,7 @@ void ongotostmt(int type)
l= l->nextlist;
}
jumphead= jumptail=0; jumpcnt=0;
if (debug) print("ongotst:%d labels\n", jumpcnt);
if (debug) printf("ongotst:%d labels\n", jumpcnt);
conversion(type,INTTYPE);
C_dup((arith) BEMINTSIZE);
C_zlt(err_goto_label);
Expand Down
20 changes: 10 additions & 10 deletions lang/basic/src/symbols.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ Symbol *srchsymbol(char* str)
Symbol *s;

/* search symbol table entry or create it */
if (debug) print("srchsymbol %s\n",str);
if (debug) printf("srchsymbol %s\n",str);
s=firstsym;

while (s)
Expand All @@ -69,7 +69,7 @@ Symbol *srchsymbol(char* str)
s->symname= (char *) salloc((unsigned) strlen(str)+1);
strcpy(s->symname,str);
firstsym= s;
if (debug) print("%s allocated\n",str);
if (debug) printf("%s allocated\n",str);
return(s);
}

Expand All @@ -89,7 +89,7 @@ void dcltype(Symbol *s)
if ( s->symalias==0)
s->symalias= dclspace(type);
s->symtype= type;
if (debug) print("symbol set to %d\n",type);
if (debug) printf("symbol set to %d\n",type);
}


Expand All @@ -99,8 +99,8 @@ void dclarray(Symbol *s)
int i; int size;

if ( s->symtype==DEFAULTTYPE) s->symtype= DOUBLETYPE;
if (debug) print("generate space and descriptors for %d\n",s->symtype);
if (debug) print("dim %d\n",s->dimensions);
if (debug) printf("generate space and descriptors for %d\n",s->symtype);
if (debug) printf("dim %d\n",s->dimensions);
s->symalias= genlabel();
/* generate descriptors */
size=1;
Expand All @@ -118,7 +118,7 @@ void dclarray(Symbol *s)
size = size* (s->dimlimit[i]+1-indexbase);
}

if (debug) print("size=%d\n",size);
if (debug) printf("size=%d\n",size);
/* size of stuff */
C_df_dlb((label)s->symalias);
get_space(s->symtype,size); /* Van ons. */
Expand Down Expand Up @@ -206,7 +206,7 @@ void setdefaulttype(int type)
char first,last,i;

/* handcrafted parser for letter ranges */
if (debug) print("deftype:%s\n",cptr);
if (debug) printf("deftype:%s\n",cptr);
while ( isspace(*cptr)) cptr++;
if ( !isalpha(*cptr))
error("letter expected");
Expand Down Expand Up @@ -235,7 +235,7 @@ Symbol *fcn;

void newscope(Symbol *s)
{
if (debug) print("new scope for %s\n",s->symname);
if (debug) printf("new scope for %s\n",s->symname);
alternate= firstsym;
firstsym = NIL;
fcn=s;
Expand Down Expand Up @@ -281,7 +281,7 @@ void endscope(int type)
{
Symbol *s;

if ( debug) print("endscope");
if ( debug) printf("endscope");
conversion(type,fcn->symtype);
C_ret((arith) typestring(fcn->symtype));
/* generate portable EM code */
Expand Down Expand Up @@ -312,7 +312,7 @@ void dclparm(Symbol *s)
fcn->dimlimit[fcn->dimensions]= s->symtype;
fcn->dimensions++;
s->symalias= -fcn->dimensions;
if ( debug) print("parameter %d offset %d\n",fcn->dimensions-1,-size);
if ( debug) printf("parameter %d offset %d\n",fcn->dimensions-1,-size);
}


Expand Down
4 changes: 2 additions & 2 deletions lang/cem/cemcom.ansi/dataflow.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,12 @@ void DfaStartFunction(char* nm)
void DfaEndFunction(void)
{
if (NumberOfCalls == 0)
print("DFA: %s: --none--\n", CurrentFunction);
printf("DFA: %s: --none--\n", CurrentFunction);
}

void DfaCallFunction(char* s)
{
print("DFA: %s: %s\n", CurrentFunction, s);
printf("DFA: %s: %s\n", CurrentFunction, s);
++NumberOfCalls;
}
#endif /* DATAFLOW */
Loading

0 comments on commit 04bec50

Please sign in to comment.