int UnknownIdIsZero = 0; /* interpret unknown id as integer 0 */
char *string_token();
+char *strcpy();
PushLex()
{
}
case STCHAR: /* character constant */
{
- register int val = 0, size = 0;
+ register arith val = 0;
+ register int size = 0;
LoadChar(c);
if (c == '\'')
size++;
LoadChar(c);
}
- if (size > sizeof(int))
+ if (size > sizeof(arith))
error("character constant too long");
ptok->tk_val = val;
return ptok->tk_symb = INTEGER;
register char *np = &buf[1];
register int base = 10;
register int vch;
- register int val = 0;
+ register arith val = 0;
if (c == '0') {
*np++ = c;
LoadChar(c);
}
str[pos++] = '\0'; /* for filenames etc. */
+ str = Srealloc(str, pos);
return str;
}
to it.
*/
+#include <em_arith.h>
+
/* the structure of a token: */
struct token {
int tok_symb; /* the token itself */
union {
- int tok_val; /* numeric values */
+ arith tok_val; /* numeric values */
char *tok_str; /* string/filespecifier */
} tok_data;
};
/* EVALUATION OF BINARY OPERATORS */
#include "Lpars.h"
+#include <em_arith.h>
ch7bin(pval, oper, val)
- register int *pval, val;
+ register arith *pval, val;
int oper;
{
switch (oper) {
/* EVALUATION OF MONADIC OPERATORS */
#include "Lpars.h"
+#include <em_arith.h>
ch7mon(oper, pval)
- register int *pval;
+ register arith *pval;
{
switch (oper) {
case '~':
/* PREPROCESSOR: CONTROLLINE INTERPRETER */
#include "interface.h"
-#include <em_arith.h>
#include "LLlex.h"
#include "Lpars.h"
#include "debug.h"
inctable[0] = WorkingDir;
if (filenm) {
if (!InsertFile(filenm, &inctable[tok==FILESPECIFIER],&result)){
- error("cannot find include file \"%s\"", filenm);
+ fatal("cannot find include file \"%s\"", filenm);
}
else {
WorkingDir = getwdir(result);
text_size <<= 1);
}
else {
- int sz = idp - id_buf;
+ int sz = idp - id_buf + 1;
idp = id_buf;
- while (pos + sz >= text_size)
- text = Srealloc(text,
- text_size <<= 1);
+ while (pos + sz >= text_size) text_size <<= 1;
+ text = Srealloc(text, text_size);
while (text[pos++] = *idp++) ;
pos--;
}
}
}
text[pos++] = '\0';
+ text = Srealloc(text, pos);
*length = pos - 1;
return text;
}
{
#include "LLlex.h"
+#include <em_arith.h>
-extern int ifval;
+extern arith ifval;
}
if_expression
;
/* 7.1 */
-primary(int *pval;)
+primary(arith *pval;)
:
constant(pval)
|
'(' expression(pval) ')'
;
-unary(int *pval;)
+unary(arith *pval;)
{int oper;}
:
unop(&oper)
primary(pval)
;
-binary_expression(int maxrank; int *pval;)
- {int oper; int val1;}
+binary_expression(int maxrank; arith *pval;)
+ {int oper; arith val1;}
:
unary(pval)
[%while (rank_of(DOT) <= maxrank)
;
/* 7.13 */
-conditional_expression(int *pval;)
- {int val1 = 0, val2 = 0;}
+conditional_expression(arith *pval;)
+ {arith val1 = 0, val2 = 0;}
:
/* allow all binary operators */
binary_expression(rank_of('?') - 1, pval)
;
/* 7.14 */
-assignment_expression(int *pval;)
+assignment_expression(arith *pval;)
:
conditional_expression(pval)
;
/* 7.15 */
-expression(int *pval;)
- {int val1;}
+expression(arith *pval;)
+ {arith val1;}
:
assignment_expression(pval)
[ ','
{*oper = DOT;}
;
-constant(int *pval;) :
+constant(arith *pval;) :
INTEGER
{*pval = dot.tk_val;}
;
-constant_expression (int *pval;) :
+constant_expression (arith *pval;) :
assignment_expression(pval)
;
/* MAIN PROGRAM */
#include <alloc.h>
+#include <em_arith.h>
#include "file_info.h"
#include "idfsize.h"
extern int err_occurred;
int idfsize = IDFSIZE;
-int ifval;
+arith ifval;
char *prog_name;
#include "textsize.h" /* UF */
#include <alloc.h>
-#include <em_arith.h>
#include <assert.h>
#include "idf.h"
#include "input.h"
}
text[pos] = '\0';
*siztext = pos;
- return text;
+ return Srealloc(text, pos+1);
}
EXPORT