#include <stdlib.h>
#include <stdio.h>
#include "bem.h"
+#include "util.h"
+#include "gencode.h"
+#include "eval.h"
+#include "func.h"
#include "llmess.h"
typedef union {
* See the copyright notice in the ACK home directory, in the file "Copyright".
*/
-#ifndef NORSCID
+
+#ifndef NORCSID
static char rcs_lex[] = "$Id$" ;
#endif
int kex[27];
/* Initialize the keyword table */
-fillkex()
+void fillkex(void)
{
Key *k;
int i;
}
}
-getinputline()
+int getinputline(void)
{
/* get next input line */
-typechar()
+int typechar(void)
{
switch(*cptr)
{
char name[SIGNIFICANT+1];
-lookup()
+int lookup(void)
{
Key *k;
Symbol *Sym;
/* Parsing unsigned numbers */
-readconstant()
+int readconstant(void)
{
/* read HEX and OCTAL numbers */
char *c;
#ifdef ____
/* Computes base to the power exponent. This was not done in the old
compiler */
-double powr(base,exp)
-double base;
-int exp;
+double powr(double base,int exp)
{
int i;
double result;
#endif
-number()
+int number(void)
{
long i1;
int overflow = 0;
-scanstring()
+int scanstring(void)
{
int i,length=0;
char firstchar = *cptr;
-yylex()
+int yylex(void)
{
char *c;
*/
#include "bem.h"
+#include "parsepar.h"
+#include "system.h"
+#include "graph.h"
-#ifndef NORSCID
+
+#ifndef NORCSID
static char rcs_id[] = "$Id$" ;
static char rcs_bem[] = RCS_BEM ;
static char rcs_symb[] = RCS_SYMB ;
int BEMINTSIZE = EMINTSIZE;
int BEMPTRSIZE = EMPTRSIZE;
int BEMFLTSIZE = EMFLTSIZE;
-main(argc,argv)
-int argc;
-char **argv;
+
+extern void initialize(void);
+extern void compileprogram(void);
+
+int main(int argc,char **argv)
{
extern int errorcnt;
*/
#include <stdlib.h>
+#include <stdio.h>
#include <ctype.h>
#include <string.h>
#include <signal.h>
-#include <system.h>
-#include <print.h>
-#include <em.h>
-#include <em_mes.h>
+#include "system.h"
+#include "print.h"
+#include "em.h"
+#include "em_mes.h"
/* Author: M.L. Kersten
** Here all the global objects are defined.
* See the copyright notice in the ACK home directory, in the file "Copyright".
*/
+/*#include "bem.h"*/
+#include <stdio.h>
+#include "system.h"
+#include "gencode.h"
#include "bem.h"
-#ifndef NORSCID
+#ifndef NORCSID
static char rcs_id[] = "$Id$" ;
#endif
+extern int getinputline(void);
+extern void LLparse(void);
/* compile the next program in the list */
/* Here we should open the input file. (for the future) */
File *yyin;
-compileprogram()
+void compileprogram(void)
{
extern int basicline;
epilogcode in the new version of the compiler */
while( basicline = 0, getinputline())
- (void) LLparse();
+ {
+ LLparse();
+ }
epilogcode();
sys_close(yyin);
}
*/
#include "bem.h"
+#include "util.h"
+#include "gencode.h"
-#ifndef NORSCID
+#ifndef NORCSID
static char rcs_id[] = "$Id$" ;
#endif
generate code for assignment statements
*/
-exprtype(ltype,rtype)
-int ltype,rtype;
+static int exprtype(int ltype,int rtype)
{
/* determine the result type of an expression */
if ( ltype==STRINGTYPE || rtype==STRINGTYPE)
-void
-conversion(oldtype,newtype)
-int oldtype,newtype;
+void conversion(int oldtype,int newtype)
{
/* the value on top of the stack should be converted */
if ( oldtype==newtype) return;
C_lfr((arith)BEMINTSIZE);
break;
} else if ( newtype==FLOATTYPE || newtype==DOUBLETYPE)
+ {
break;
+ }
+ break;
default:
if (debug)
print("type n=%d o=%d\n",newtype,oldtype);
-void
-extraconvert(oldtype,newtype,topstack)
-int oldtype,newtype,topstack;
+void extraconvert(int oldtype,int newtype,int topstack)
{
/* the value below the top of the stack should be converted */
if ( oldtype==newtype ) return;
-boolop(ltype,rtype,operator)
-int ltype,rtype,operator;
+int boolop(int ltype,int rtype,int operator)
{
if ( operator != NOTSYM)
{
-genbool(operator)
-int operator;
+void genbool(int operator)
{
int l1,l2;
-relop( ltype,rtype,operator)
-int ltype,rtype,operator;
+int relop(int ltype,int rtype,int operator)
{
int result;
-plusmin(ltype,rtype,operator)
-int ltype,rtype,operator;
+int plusmin(int ltype,int rtype,int operator)
{
int result;
-muldiv(ltype,rtype,operator)
-int ltype,rtype,operator;
+int muldiv(int ltype,int rtype,int operator)
{
int result;
-negate(type)
-int type;
+int negate(int type)
{
switch(type)
{
#ifdef ___
-power(ltype,rtype)
-int ltype,rtype;
+int power(int ltype,int rtype)
{
int resulttype = exprtype(ltype, rtype);
return(resulttype);
}
#else
-power(ltype,rtype)
-int ltype,rtype;
+int power(int ltype,int rtype)
{
extraconvert(ltype,DOUBLETYPE,rtype);
conversion(rtype,DOUBLETYPE);
#endif
-int typesize(ltype)
-int ltype;
+int typesize(int ltype)
{
switch( ltype)
{
-int typestring(type)
-int type;
+int typestring(int type)
{
switch(type)
{
-loadvar(type)
-int type;
+void loadvar(int type)
{
/* load a simple variable its address is on the stack*/
C_loi((arith)typestring(type));
-loadint(value)
-int value;
+int loadint(int value)
{
C_loc((arith)value);
return(INTTYPE);
-loaddbl(value)
-char *value;
+int loaddbl(char* value)
{
int index;
-loadstr(value)
-int value;
+void loadstr(int value)
{
C_lae_dlb((label)value,(arith)0);
}
-loadaddr(s)
-Symbol *s;
+int loadaddr(Symbol *s)
{
extern Symbol *fcn;
int i,j;
/* This is a new routine */
-save_address()
+void save_address(void)
{
C_lae_dnam("dummy3",(arith)0);
C_sti((arith)BEMPTRSIZE);
-assign(type,lt)
-int type,lt;
+void assign(int type,int lt)
{
extern int e1,e2;
-storevar(lab,type)
-int lab,type;
+void storevar(int lab,int type)
{
/*store value back */
C_lae_dlb((label)lab,(arith)0);
-newarrayload(s)
-Symbol *s;
+void newarrayload(Symbol *s)
{
if ( dimtop<MAXDIMENSIONS) dimtop++;
if ( s->dimensions==0)
-endarrayload()
+int endarrayload(void)
{
return(arraystk[dimtop--]->symtype);
}
-void
-loadarray(type)
-int type;
+void loadarray(int type)
{
int dim;
Symbol *s;
--- /dev/null
+/* Copyright (c) 2019 ACK Project.
+ * See the copyright notice in the ACK home directory,
+ * in the file "Copyright".
+ *
+ */
+#ifndef __EVAL_H_INCLUDED__
+#define __EVAL_H_INCLUDED__
+
+#include "symbols.h"
+
+
+/*--------------------------- Utilities -----------------------*/
+
+/** From an internal type definition return the size in bytes of the data.
+ * If not a known data type return an integer size. */
+extern int typesize(int ltype);
+/** From an internal type definition return the size in bytes of the data. If not a
+ * known data type return a 0 size. */
+extern int typestring(int type);
+
+
+/*-------------------------- Code generation ---------------------*/
+
+/** Emit code to convert from the old internal type to the new internal type definition.
+ * Generates an error if the type conversion is not allowed. */
+extern void conversion(int oldtype,int newtype);
+/** Emit code to store a value of the specified type from the top of stack
+ * into the specified variable pointed to by label.
+ */
+extern void storevar(int lab,int type);
+
+/** Emit code to load a simple variable value on the stack. On input the address of the variable
+ * is on the stack. */
+extern void loadvar(int type);
+
+extern void extraconvert(int oldtype,int newtype,int topstack);
+
+extern void loadstr(int value);
+extern int endarrayload(void);
+extern void loadarray(int type);
+extern void save_address(void);
+extern void assign(int type,int lt);
+extern int boolop(int ltype,int rtype,int operator);
+extern int relop(int ltype,int rtype,int operator);
+extern int plusmin(int ltype,int rtype,int operator);
+extern int muldiv(int ltype,int rtype,int operator);
+extern int negate(int type);
+extern int power(int ltype,int rtype);
+extern int loadint(int value);
+extern int loaddbl(char* value);
+extern int loadaddr(Symbol *s);
+extern void newarrayload(Symbol *s);
+
+#endif /* __EVAL_H_INCLUDED */
*/
#include "bem.h"
+#include "util.h"
+#include "eval.h"
-#ifndef NORSCID
+#ifndef NORCSID
static char rcs_id[] = "$Id$" ;
#endif
-parm(cnt)
-int cnt;
+void parm(int cnt)
{
if( cnt> exprlimit)
error("Not enough arguments");
-callfcn(fcnnr,cnt,typetable)
-int fcnnr,cnt;
-int *typetable;
+int callfcn(int fcnnr,int cnt,int *typetable)
{
int pop=DOUBLETYPE;
int res=DOUBLETYPE;
--- /dev/null
+/* Copyright (c) 2019 ACK Project.
+ * See the copyright notice in the ACK home directory,
+ * in the file "Copyright".
+ *
+ */
+#ifndef __FUNC_H_INCLUDED__
+#define __FUNC_H_INCLUDED__
+
+
+extern int callfcn(int fcnnr,int cnt,int *typetable);
+
+
+#endif /* __FUNC_H_INCLUDED__ */
*/
#include "bem.h"
-#include "system.h"
+#include "graph.h"
+#include "eval.h"
+#include "util.h"
+#include "gencode.h"
-#ifndef NORSCID
+#ifndef NORCSID
static char rcs_id[] = "$Id$" ;
#endif
-genlabel()
+int genlabel(void)
{
return(emlabel++);
}
-genemlabel()
+int genemlabel(void)
{
int l;
int tronoff=0;
-newemblock(nr)
-int nr;
+void newemblock(int nr)
{
C_df_ilb((label)currline->emlabel);
C_lin((arith)nr);
/* Handle data statements */
List *datalist=0;
-datastmt()
+void datastmt(void)
{
List *l,*l1;
-datatable()
+void datatable(void)
{
List *l;
int line=0;
/* ERROR and exception handling */
-exceptstmt(lab)
-int lab;
+void exceptstmt(int lab)
{
/* exceptions to subroutines are supported only */
extern int gosubcnt;
-errorstmt(exprtype)
-int exprtype;
+void errorstmt(int exprtype)
{
/* convert expression to a valid error number */
/* obtain the message and print it */
/* BASIC IO */
-openstmt(recsize)
-int recsize;
+void openstmt(int recsize)
{
C_loc((arith)recsize);
C_cal("_opnchn");
-printstmt(exprtype)
-int exprtype;
+void printstmt(int exprtype)
{
switch(exprtype)
{
-zone(i)
-int i;
+void zone(int i)
{
if ( i) C_cal("_zone");
}
-writestmt(exprtype,comma)
-int exprtype,comma;
+void writestmt(int exprtype, int comma)
{
if ( comma) C_cal("_wrcomma");
-restore(lab)
-int lab;
+void restore(int lab)
{
/* save this information too */
-prompt(qst)
-int qst;
+void prompt(int qst)
{
setchannel(-1);
C_cal("_prstr");
-linestmt(type)
-int type;
+void linestmt(int type)
{
if ( type!= STRINGTYPE)
error("String variable expected");
-readelm(type)
-int type;
+void readelm(int type)
{
switch(type)
{
/* Swap exchanges the variable values */
-swapstmt(ltype,rtype)
-int ltype, rtype;
+void swapstmt(int ltype,int rtype)
{
if ( ltype!= rtype)
error("Type mismatch");
/* input/output handling */
-setchannel(val)
-int val;
-{ /* obtain file descroption */
+void setchannel(int val)
+{
+ /* obtain file descroption */
C_loc((arith)val);
C_cal("_setchan");
C_asp((arith)BEMINTSIZE);
/* The if-then-else statements */
-ifstmt(type)
-int type;
+int ifstmt(int type)
{
/* This BASIC follows the True= -1 rule */
int nr;
-thenpart( elselab)
-int elselab;
+int thenpart(int elselab)
{
int nr;
-elsepart(lab)int lab;
+void elsepart(int lab)
{
C_df_ilb((label)lab);
}
-forinit(s)
-Symbol *s;
+void forinit(Symbol *s)
{
int type;
struct FORSTRUCT *f;
-forexpr(type)
-int type;
+void forexpr(int type)
{
/* save start value of loop variable in a save place*/
/* to avoid clashing with final value and step expression */
-forlimit(type)
-int type;
+void forlimit(int type)
{
/* save the limit value too*/
int result;
-forskipped(f)
-struct FORSTRUCT *f;
+void forskipped(struct FORSTRUCT *f)
{
int type;
-forstep(type)
-int type;
+void forstep(int type)
{
int result;
int varaddress;
-nextstmt(s)
-Symbol *s;
+void nextstmt(Symbol *s)
{
if (forcnt>MAXFORDEPTH || forcnt<0 ||
(s && s!= fortable[forcnt].loopvar))
-pokestmt(type1,type2)
-int type1,type2;
+void pokestmt(int type1,int type2)
{
conversion(type1,INTTYPE);
conversion(type2,INTTYPE);
int whilecnt, whilelabels[MAXDEPTH][2]; /*0=head,1=out */
-whilestart()
+void whilestart(void)
{
whilecnt++;
if ( whilecnt==MAXDEPTH)
-whiletst(exprtype)
-int exprtype;
+void whiletst(int exprtype)
{
/* test expression type */
conversion(exprtype,INTTYPE);
-wend()
+void wend(void)
{
if ( whilecnt<1)
error("not part of while statement");
/* generate code for the final version */
-prologcode()
+void prologcode(void)
{
/* generate the EM prolog code */
C_df_dnam("fltnull");
-prolog2()
+void prolog2(void)
{
int result;
label l = genlabel(), l2;
/* NEW */
-gendata()
+void gendata(void)
{
C_loc((arith)0);
C_cal("_setchan");
-epilogcode()
+void epilogcode(void)
{
/* finalization code */
int nr;
--- /dev/null
+/* Copyright (c) 2019 ACK Project.
+ * See the copyright notice in the ACK home directory,
+ * in the file "Copyright".
+ *
+ */
+#ifndef __GENCODE_H_INCLUDED__
+#define __GENCODE_H_INCLUDED__
+
+#include "symbols.h"
+
+
+/*--------------------------- Utilities -----------------------*/
+
+/** Return a global value identifier used for code generation */
+extern int genlabel(void);
+
+
+/*-------------------------- Code generation ---------------------*/
+
+/** Emit a label definition and return the label identifier generated. */
+extern int genemlabel(void);
+
+
+void newemblock(int nr);
+void newblock(int nr);
+void datastmt(void);
+void datatable(void);
+/* ERROR and exception handling */
+void exceptstmt(int lab);
+void errorstmt(int exprtype);
+/* BASIC IO */
+void openstmt(int recsize);
+void printstmt(int exprtype);
+void zone(int i);
+void writestmt(int exprtype, int comma);
+void restore(int lab);
+void prompt(int qst);
+void linestmt(int type);
+void readelm(int type);
+/* Swap exchanges the variable values */
+void swapstmt(int ltype,int rtype);
+void setchannel(int val);
+int ifstmt(int type);
+int thenpart(int elselab);
+void elsepart(int lab);
+void forinit(Symbol *s);
+void forexpr(int type);
+void forlimit(int type);
+void forstep(int type);
+void nextstmt(Symbol *s);
+void pokestmt(int type1,int type2);
+void whilestart(void);
+void whiletst(int exprtype);
+void wend(void);
+/* generate code for the final version */
+void prologcode(void);
+void prolog2(void);
+void gendata(void);
+void epilogcode(void);
+void setchannel(int val);
+void gendata(void);
+
+
+#endif /* __GENCODE_H_INCLUDED__ */
*/
#include "bem.h"
+#include "util.h"
+#include "eval.h"
+#include "gencode.h"
-#ifndef NORSCID
+#ifndef NORCSID
static char rcs_id[] = "$Id$" ;
#endif
-List *newlist()
+List *newlist(void)
{
List *l;
/* Line management is handled here */
-Linerecord *srchline(nr)
-int nr;
+Linerecord *srchline(int nr)
{
Linerecord *l;
-List *srchforward(nr)
-int nr;
+List *srchforward(int nr)
{
List *l;
-linewarnings()
+void linewarnings(void)
{
List *l;
extern int errorcnt;
-newblock(nr)
-int nr;
+void newblock(int nr)
{
Linerecord *l;
List *frwrd;
-gotolabel(nr)
-int nr;
+int gotolabel(int nr)
{
/* simulate a goto statement in the line record table */
Linerecord *l1;
-gotostmt(nr)
-int nr;
+void gotostmt(int nr)
{
C_bra((label) gotolabel(nr));
}
-List *gosublabel()
+List *gosublabel(void)
{
List *l;
-gosubstmt(lab)
-int lab;
+void gosubstmt(int lab)
{
List *l;
int nr,n;
-genreturns()
+void genreturns(void)
{
int count;
int nr;
-returnstmt()
+void returnstmt(void)
{
C_cal("_retstmt");
C_lfr((arith) BEMINTSIZE);
int jumpcnt;
-jumpelm(nr)
-int nr;
+void jumpelm(int nr)
{
List *l;
-ongotostmt(type)
-int type;
+void ongotostmt(int type)
{
/* generate the code itself, index in on top of the stack */
/* blurh, store the number of entries in the descriptor */
-ongosubstmt(type)
-int type;
+void ongosubstmt(int type)
{
List *l;
int firstlabel;
* See the copyright notice in the ACK home directory, in the file "Copyright".
*/
+#ifndef __GRAPH_H_INCLUDED__
+#define __GRAPH_H_INCLUDED__
+
#ifndef NORCSID
# define RCS_GRAPH "$Id$"
#endif
extern List *forwardlabel;
extern List *gosublabel();
+extern void jumpelm(int nr);
+extern int gotolabel(int nr);
+extern void linewarnings(void);
+
+/*-------------------------- Code generation ---------------------*/
+
+
+extern void genreturns(void);
+extern void gosubstmt(int lab);
+extern void gotostmt(int nr);
+extern void returnstmt(void);
+extern void ongosubstmt(int type);
+extern void ongotostmt(int type);
+
+#endif
* See the copyright notice in the ACK home directory, in the file "Copyright".
*/
+#include <stdio.h>
#include "bem.h"
+#include "util.h"
-#ifndef NORSCID
+#ifndef NORCSID
static char rcs_id[] = "$Id$";
#endif
File *datfile;
+extern void fillkex(void);
-
-initialize()
+void initialize(void)
{
register char *cindex, *cptr;
int result1, result2;
}
}
cptr=datfname;
- while ( *cptr++ = *cindex++ );
+ while ( (*cptr++ = *cindex++) !=0 );
/* Strip trailing suffix */
if ( cptr>datfname+3 && cptr[-3]=='.' ) cptr[-3]=0;
strcat(datfname,".d");
* See the copyright notice in the ACK home directory, in the file "Copyright".
*/
+#include <stdio.h>
#include "tokentab.h"
+#include "system.h"
+#include "print.h"
/* Mod van gertjan */
extern int LLsymb;
extern int toknum;
-error_char(format,ch)
-char *format;
-char ch;
+void error_char(char *format,char ch)
{
extern int listing,errorcnt;
extern int basicline;
-error_string(format,str)
-char *format;
-char *str;
+void error_string(char* format,char* str)
{
extern int listing,errorcnt;
extern int basicline;
-LLmessage( insertedtok )
-int insertedtok;
+void LLmessage(int insertedtok )
{
if ( insertedtok < 0 ) {
error("Fatal stack overflow\n");
--- /dev/null
+User options:
+D parser debugging
+t line tracing
+d debug information
+E generate full listing
+L don't generate linenumbers and filename indications
+w suppress warning diagnostics
+VwN set word size to N bytes
+VpN set pointer size to N bytes
+VfN set real size to N bytes
+
\ No newline at end of file
* See the copyright notice in the ACK home directory, in the file "Copyright".
*/
+#include "parsepar.h"
#include "bem.h"
+#include <stdio.h>
+#include "print.h"
+#include "system.h"
+#include "util.h"
-#ifndef NORSCID
+
+#ifndef NORCSID
static char rcs_id[] = "$Id$" ;
#endif
-parseparams(argc,argv)
-int argc;
-char **argv;
+void parseparams(int argc,char **argv)
{
int files=0 ;
int i;
--- /dev/null
+/* Copyright (c) 2019 ACK Project.
+ * See the copyright notice in the ACK home directory,
+ * in the file "Copyright".
+ *
+ */
+#ifndef __PARSEPAR_H_INCLUDED__
+#define __PARSEPAR_H_INCLUDED__
+
+/** -l listing required */
+extern int listing;
+/** -d compiler debugging */
+extern int debug;
+/** -w warning flags */
+extern int wflag;
+/** generate line tracing code. */
+extern int traceflag;
+/** generate LIN statements */
+extern int nolins;
+
+
+void parseparams(int argc,char **argv);
+
+#endif /* __PARSEPAR_H_INCLUDED__ */
* See the copyright notice in the ACK home directory, in the file "Copyright".
*/
+#include "symbols.h"
+#include <stdlib.h>
+#include <string.h>
+#include <ctype.h>
#include "bem.h"
+#include "eval.h"
+#include "gencode.h"
+#include "util.h"
-#ifndef NORSCID
+
+
+#ifndef NORCSID
static char rcs_id[] = "$Id$" ;
#endif
/* which may be set by OPTION BASE */
-initdeftype()
+/* Local declarations */
+static void get_space(int type,int size);
+
+
+void initdeftype(void)
{
int i;
-Symbol *srchsymbol(str)
-char *str;
+Symbol *srchsymbol(char* str)
{
Symbol *s;
-void
-dcltype(s)
-Symbol *s;
+void dcltype(Symbol *s)
{
/* type declarer */
int type;
type=s->symtype;
if (type==DEFAULTTYPE)
/* use the default rule */
- type= deftype[*s->symname];
+ type= deftype[(int)(*s->symname)];
/* generate the emlabel too */
if ( s->symalias==0)
s->symalias= dclspace(type);
-dclarray(s)
-Symbol *s;
+void dclarray(Symbol *s)
{
int i; int size;
-get_space(type,size)
-int type,size;
+static void get_space(int type,int size)
{
switch ( type ) {
-defarray(s)
-Symbol *s;
+void defarray(Symbol *s)
{
/* array is used without dim statement, set default limits */
int i;
-dclspace(type)
+int dclspace(int type)
{
int nr;
/* SOME COMPILE TIME OPTIONS */
-optionbase(ival)
-int ival;
+void optionbase(int ival)
{
if ( ival<0 || ival>1)
error("illegal option base value");
-setdefaulttype(type)
-int type;
+void setdefaulttype(int type)
{
extern char *cptr;
char first,last,i;
-newscope(s)
-Symbol *s;
+void newscope(Symbol *s)
{
if (debug) print("new scope for %s\n",s->symname);
alternate= firstsym;
-heading( )
+void heading(void)
{
char procname[50];
-int fcnsize()
+static int fcnsize(void)
{
/* generate portable function size */
int i,sum; /* sum is NEW */
-endscope(type)
-int type;
+void endscope(int type)
{
Symbol *s;
-dclparm(s)
-Symbol *s;
+void dclparm(Symbol *s)
{
int size=0;
-fcncall(s)
-Symbol *s;
+int fcncall(Symbol *s)
{
if ( !s->isfunction)
error("Function not declared");
-fcnend(parmcount)
-int parmcount;
+int fcnend(int parmcount)
{
int type;
static char concatbuf[50]; /* NEW */
-callparm(ind,type)
-int ind,type;
+void callparm(int ind,int type)
{
if ( fcnindex<0) error("unexpected parameter");
if ( ind >= fcn->dimensions)
* See the copyright notice in the ACK home directory, in the file "Copyright".
*/
+#ifndef __SYMBOLS_H_INCLUDED__
+#define __SYMBOLS_H_INCLUDED__
+
#ifndef NORCSID
# define RCS_SYMB "$Id$"
#endif
int isparam;
} Symbol;
-extern Symbol *srchsymbol();
+void initdeftype(void);
+Symbol *srchsymbol(char* str);
+void dcltype(Symbol *s);
+void dclarray(Symbol *s);
+void defarray(Symbol *s);
+int dclspace(int type);
+void optionbase(int ival);
+void setdefaulttype(int type);
+void newscope(Symbol *s);
+void heading(void);
+void endscope(int type);
+void dclparm(Symbol *s);
+int fcncall(Symbol *s);
+int fcnend(int parmcount);
+void callparm(int ind,int type);
+
+#endif /* __SYMBOLS_H_INCLUDED__ */
+
* See the copyright notice in the ACK home directory, in the file "Copyright".
*/
+#include "system.h"
+#include "util.h"
#include "bem.h"
-#ifndef NORSCID
+
+#ifndef NORCSID
static char rcs_id[] = "$Id$" ;
#endif
-void
-warning(str)
-char *str;
+
+static void Xerror(char *type, char *str)
+{
+ extern int listing;
+ extern int basicline;
+
+ if( !listing) fprint(STDERR, "LINE %d:",basicline);
+ fprint(STDERR, "%s:%s\n",type, str);
+}
+
+
+
+
+void warning(char* str)
{
if (wflag) return;
Xerror("WARNING", str);
}
-error(str)
-char *str;
+void error(char* str)
{
Xerror("ERROR", str);
errorcnt++;
}
-Xerror(type, str)
-char *str;
-char *type;
-{
- extern int listing;
- extern int basicline;
-
- if( !listing) fprint(STDERR, "LINE %d:",basicline);
- fprint(STDERR, "%s:%s\n",type, str);
-}
-
-fatal(str)
-char *str;
+void fatal(char* str)
{
Xerror("FATAL",str);
C_close();
-notyetimpl()
+void notyetimpl(void)
{
warning("not yet implemented");
}
-illegalcmd()
+void illegalcmd(void)
{
warning("illegal command");
}
-char *myitoa(i)
-int i;
+char *myitoa(int i)
{
static char buf[30];
}
-
-
-
-
-char *salloc(length)
-unsigned length;
+char *salloc(unsigned int length)
{
char *s,*c;
--- /dev/null
+/* Copyright (c) 2019 ACK Project.
+ * See the copyright notice in the ACK home directory,
+ * in the file "Copyright".
+ *
+ */
+#ifndef __UTIL_H_INCLUDED__
+#define __UTIL_H_INCLUDED__
+
+/** Raises a warning with the specified message. */
+void warning(char* str);
+/** Raises a non fatal error with the specified message. */
+void error(char* str);
+/** Raises a fatal error with the specified message and
+ quits the application. */
+void fatal(char* str);
+/** Error management to raise a warning on an unimplemented
+ * feature. */
+void notyetimpl(void);
+/** Error management to raise a warning on an illegal command
+ line option. */
+void illegalcmd(void);
+
+
+char *myitoa(int i);
+
+/** Tries to allocates a memory block of the specified number of bytes, and exits
+ * with a fatal error upon a failure. Upon allocation success, fills the allocated
+ * memory block with binary 0.
+ */
+char *salloc(unsigned int length);
+
+#endif /* __UTIL_H_INCLUDED__ */
int toknum;
-yylexp()
+extern int yylex(void);
+
+int yylexp(void)
{
/* als toknum != 0 dan bevat toknum een door LLmessage back-ge-pushed token */