home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Otherware
/
Otherware_1_SB_Development.iso
/
amiga
/
misc
/
icalc.lzh
/
icalc
/
src
/
ufunc.c
< prev
Wrap
C/C++ Source or Header
|
1991-09-29
|
857b
|
55 lines
/*
* icalc - complex-expression parser
*
* These are the routines to implement user-functions.
* Structure definition is in complex.h.
*
* (C) Martin W Scott, 1991.
*/
#include "complex.h"
#include "memory.h"
Symbol *findsym(sl, s)
SymList *sl;
char *s;
{
if (sl)
if (!strcmp(s,sl->sym->name))
return sl->sym;
else
return findsym(sl->next, s);
else
return NULL;
}
void clear_ufunc(func)
UserFunc *func;
{
RemKey **oldkey = rem_setkey(&func->remkey);
rem_freeall();
func->tree = NULL;
rem_setkey(oldkey);
}
void init_ufunc(func) /* reset fields of user function */
UserFunc *func;
{
func->remkey = NULL;
func->params = NULL;
}
SymList *addparam(sl, s) /* add symbol (parameter) to list */
SymList *sl;
Symbol *s;
{
SymList *newsl;
newsl = rem_malloc(sizeof(SymList));
newsl->sym = s;
newsl->next = sl;
return newsl;
}