insert("input", T_CHAN|T_BUILTIN, 1, &info);
info.vc.st.builtin=file;
- info.vc.offset=wz+pz;
+ info.vc.offset=wz+vz;
insert("output", T_CHAN|T_BUILTIN, 1, &info);
info.vc.st.builtin=file;
- info.vc.offset=2*(wz+pz);
+ info.vc.offset=2*(wz+vz);
insert("error", T_CHAN|T_BUILTIN, 1, &info);
/* DEF EOF= -1, TEXT= -2, RAW= -3: */
int wz = 4, pz = 4, vz = 4;
int Lflag;
static Lab=0;
-char *malloc();
+char *Malloc();
void init()
{
void maxdes()
{
C_df_dnam("maxcdes");
- rom(wz, 0L); rom(wz, -1L); rom(wz, (long) (wz+pz));
+ rom(wz, 0L); rom(wz, -1L); rom(wz, (long) (wz+vz));
C_df_dnam("maxwdes");
rom(wz, 0L); rom(wz, -1L); rom(wz, (long) vz);
C_df_dnam("maxbdes");
if (lab!=nil) free(lab);
- lab=malloc(strlen(name)+(1+sizeof(int)*3+1));
+ lab=Malloc(strlen(name)+(1+sizeof(int)*3+1));
/* That is: P<L><name>\0 */
sprint(lab, "P%d", L);
apf= cmp<0 ? &pf->left : &pf->right;
if (pf==nil) {
- *apf= pf= (struct ftree *) malloc(sizeof *pf);
- pf->file=strcpy(malloc(strlen(f)+1), f);
+ *apf= pf= (struct ftree *) Malloc(sizeof *pf);
+ pf->file=strcpy(Malloc(strlen(f)+1), f);
pf->lab=0;
pf->left=pf->right=nil;
}
{
C_zer((arith) pz);
C_cal("pc_fork");
- C_asp(pz);
+ C_asp((arith) pz);
C_lfr((arith) wz);
C_zne((label) new_label(NONZERO));
}
static void rvalue(), assignable(), inputable(), outputable(), subscriptable();
static void assigned();
+char *Malloc();
/* The new_* functions make use of the used() and assinged() functions to
* make known what is done to a variable.
subscriptable(left, right, byte, &type, &arr_siz);
break;
}
- pe= (struct expr *) malloc(sizeof *pe);
+ pe= (struct expr *) Malloc(sizeof *pe);
pe->kind=E_NODE;
pe->type=type;
{
register struct expr *pe;
- pe= (struct expr *) malloc(sizeof *pe);
+ pe= (struct expr *) Malloc(sizeof *pe);
pe->kind=E_VAR;
{
register struct expr *pe;
- pe= (struct expr *) malloc(sizeof *pe);
+ pe= (struct expr *) Malloc(sizeof *pe);
pe->kind=E_CONST;
pe->type=T_VALUE;
{
register struct expr *pe;
- pe= (struct expr *) malloc(sizeof *pe);
+ pe= (struct expr *) Malloc(sizeof *pe);
pe->kind=kind;
pe->type=T_VALUE|T_ARR;
tab=tab->next;
pe->arr_siz++;
- free(junk);
+ free((char *)junk);
}
return pe;
{
register struct expr *c;
- c= (struct expr *) malloc(sizeof *c);
+ c= (struct expr *) Malloc(sizeof *c);
*c= *e;
return c;
{
register struct expr *pe;
- pe= (struct expr *) malloc(sizeof *pe);
+ pe= (struct expr *) Malloc(sizeof *pe);
pe->kind=E_NOW;
pe->type=T_VALUE;
report("channel variable expected");
used(chan);
- pe= (struct expr *) malloc(sizeof *pe);
+ pe= (struct expr *) Malloc(sizeof *pe);
pe->kind=E_IO;
pe->type=T_VOID;
{
register struct expr *pe;
- pe= (struct expr *) malloc(sizeof *pe);
+ pe= (struct expr *) Malloc(sizeof *pe);
used(proc);
{
register struct table *pt;
- pt= (struct table *) malloc(sizeof *pt);
+ pt= (struct table *) Malloc(sizeof *pt);
pt->val=val;
pt->next= **aapt;
{
register struct expr_list *elp;
- elp= (struct expr_list *) malloc(sizeof *elp);
+ elp= (struct expr_list *) Malloc(sizeof *elp);
elp->arg=arg;
elp->next= **aaelp;
destroy(elp->arg);
junk=elp;
elp=elp->next;
- free(junk);
+ free((char *)junk);
}
}
break;
}
- free(e);
+ free((char *)e);
}
}
register char *key=keyword;
if (islower(*str)) {
- do
- *key++ = toupper(*str++);
- while (key<keyword+MAXKEYLEN && islower(*str));
+ do {
+ *key++ = toupper(*str);
+ str++;
+ } while (key<keyword+MAXKEYLEN && islower(*str));
} else {
do
*key++ = *str++;
# define TABSTOP(ind) (((ind)+TAB)&(~(TAB-1)))
# endif
-char *malloc(), *strcpy();
+char *Malloc(), *strcpy();
struct token token;
int ind=0; /* Indentation level of current line */
register key;
if ((key=keyword(yytext))==IDENTIFIER)
- token.t_sval=strcpy(malloc(yyleng+1), yytext);
+ token.t_sval=strcpy(Malloc(yyleng+1), yytext);
return key;
}
case IDENTIFIER:
if (inst) {
sprint(fake_id, "_%d", ++fake_cnt);
- token.t_sval=strcpy(malloc(strlen(fake_id)+1),
+ token.t_sval=strcpy(Malloc(strlen(fake_id)+1),
fake_id);
return "IDENTIFIER";
} else
return "NUMBER";
case STRING:
if (inst) {
- token.t_sval=malloc(1);
+ token.t_sval=Malloc(1);
token.t_sval[0]=0;
} else
free(token.t_sval);
static void nonconst(), nonpositive(), rep_cleanup(), check_assoc();
void init_builtins();
+char *strcpy();
extern int yylineno, LLsymb;
union type_info info, none;
} else
if (e1->u.const<=0)
nonpositive(siz);
- *e=new_node(FOR, *e, e1);
+ *e=new_node(FOR, *e, e1, *byte);
slice=1;
}
]?
{ if (!subs_call && var_proc(var)) {
if (pars!=nil)
report("no actual parameters");
- *e=new_call(*e, nil);
+ *e=new_call(*e, (char *)nil);
}
}
| vector_constant(e)
}:
item(e)
[ AS expression(&e1)
- { *e=new_node(AS, *e, e1); }
+ { *e=new_node(AS, *e, e1, 0); }
| [
'?' { out=0; }
| '!' { out=1; }
op=LLsymb;
}
operator element(&e1)
- { *e=new_node(op, *e, e1); }
+ { *e=new_node(op, *e, e1, 0); }
]*
| monadic_op(&op) element(&e1)
- { *e=new_node(op, e1, nil); }
+ { *e=new_node(op, e1, (char *)nil, 0); }
;
val_expr(register struct expr **e;) :
);
}
}
+
+No_Mem()
+{
+ fatal("out of memory");
+}
}
extern int err, yylineno;
extern char *curr_file;
+/*VARARGS1*/
report(fmt, arg1, arg2, arg3) char *fmt;
{
fprint(STDERR, "%s (%d) F: ", curr_file, yylineno);
err=1;
}
+/*VARARGS1*/
warning(fmt, arg1, arg2, arg3) char *fmt, *arg1;
{
fprint(STDERR, "%s (%d) E: ", curr_file, yylineno);
fprint(STDERR,"\n");
}
+/*VARARGS1*/
fatal(fmt, arg1, arg2, arg3) char *fmt, *arg1;
{
fprint(STDERR, "%s (%d) X: ", curr_file, yylineno);
static struct symtab *sym_table=nil;
-char *malloc();
+char *Malloc();
static struct symbol **search_sym(tree, name)
struct symbol **tree;
return nil;
}
- ps= (struct symbol *) malloc(sizeof *ps);
+ ps= (struct symbol *) Malloc(sizeof *ps);
ps->s_name=name;
{
register struct symtab *ps;
- ps= (struct symtab *) malloc(sizeof *ps);
+ ps= (struct symtab *) Malloc(sizeof *ps);
ps->local=nil;
ps->global=sym_table;
while (par!=nil) {
junk=par;
par=par->pr_next;
- free(junk);
+ free((char *)junk);
}
} else
if ((ps->s_type&T_TYPE)==T_CONST)
destroy(ps->s_info.t_const);
- free(ps->s_name);
- free(ps);
+ free((char *)(ps->s_name));
+ free((char *)ps);
}
}
{
register struct par_list *pl;
- pl= (struct par_list *) malloc(sizeof *pl);
+ pl= (struct par_list *) Malloc(sizeof *pl);
pl->pr_type=type;
pl->pr_var=var;
return offset+ ((var->s_type&T_ARR) ? pz : vz);
}
}
+ return pz;
}