Deleted Added
full compact
run.c (118194) run.c (125601)
1/****************************************************************
2Copyright (C) Lucent Technologies 1997
3All Rights Reserved
4
5Permission to use, copy, modify, and distribute this software and
6its documentation for any purpose and without fee is hereby
7granted, provided that the above copyright notice appear in all
8copies and that both that the copyright notice and this

--- 205 unchanged lines hidden (view full) ---

214struct Frame *frame = NULL; /* base of stack frames; dynamically allocated */
215int nframe = 0; /* number of frames allocated */
216struct Frame *fp = NULL; /* frame pointer. bottom level unused */
217
218Cell *call(Node **a, int n) /* function call. very kludgy and fragile */
219{
220 static Cell newcopycell = { OCELL, CCOPY, 0, "", 0.0, NUM|STR|DONTFREE };
221 int i, ncall, ndef;
1/****************************************************************
2Copyright (C) Lucent Technologies 1997
3All Rights Reserved
4
5Permission to use, copy, modify, and distribute this software and
6its documentation for any purpose and without fee is hereby
7granted, provided that the above copyright notice appear in all
8copies and that both that the copyright notice and this

--- 205 unchanged lines hidden (view full) ---

214struct Frame *frame = NULL; /* base of stack frames; dynamically allocated */
215int nframe = 0; /* number of frames allocated */
216struct Frame *fp = NULL; /* frame pointer. bottom level unused */
217
218Cell *call(Node **a, int n) /* function call. very kludgy and fragile */
219{
220 static Cell newcopycell = { OCELL, CCOPY, 0, "", 0.0, NUM|STR|DONTFREE };
221 int i, ncall, ndef;
222 int freed = 0; /* handles potential double freeing when fcn & param share a tempcell */
222 Node *x;
223 Cell *args[NARGS], *oargs[NARGS]; /* BUG: fixed size arrays */
224 Cell *y, *z, *fcn;
225 char *s;
226
227 fcn = execute(a[0]); /* the function itself */
228 s = fcn->nval;
229 if (!isfcn(fcn))

--- 61 unchanged lines hidden (view full) ---

291 oargs[i]->tval &= ~(STR|NUM|DONTFREE);
292 oargs[i]->sval = t->sval;
293 tempfree(t);
294 }
295 }
296 } else if (t != y) { /* kludge to prevent freeing twice */
297 t->csub = CTEMP;
298 tempfree(t);
223 Node *x;
224 Cell *args[NARGS], *oargs[NARGS]; /* BUG: fixed size arrays */
225 Cell *y, *z, *fcn;
226 char *s;
227
228 fcn = execute(a[0]); /* the function itself */
229 s = fcn->nval;
230 if (!isfcn(fcn))

--- 61 unchanged lines hidden (view full) ---

292 oargs[i]->tval &= ~(STR|NUM|DONTFREE);
293 oargs[i]->sval = t->sval;
294 tempfree(t);
295 }
296 }
297 } else if (t != y) { /* kludge to prevent freeing twice */
298 t->csub = CTEMP;
299 tempfree(t);
300 } else if (t == y && t->csub == CCOPY) {
301 t->csub = CTEMP;
302 tempfree(t);
303 freed = 1;
299 }
300 }
301 tempfree(fcn);
302 if (isexit(y) || isnext(y))
303 return y;
304 }
305 }
306 tempfree(fcn);
307 if (isexit(y) || isnext(y))
308 return y;
304 tempfree(y); /* this can free twice! */
309 if (freed == 0) {
310 tempfree(y); /* don't free twice! */
311 }
305 z = fp->retval; /* return value */
306 dprintf( ("%s returns %g |%s| %o\n", s, getfval(z), getsval(z), z->tval) );
307 fp--;
308 return(z);
309}
310
311Cell *copycell(Cell *x) /* make a copy of a cell in a temp */
312{

--- 1601 unchanged lines hidden ---
312 z = fp->retval; /* return value */
313 dprintf( ("%s returns %g |%s| %o\n", s, getfval(z), getsval(z), z->tval) );
314 fp--;
315 return(z);
316}
317
318Cell *copycell(Cell *x) /* make a copy of a cell in a temp */
319{

--- 1601 unchanged lines hidden ---