66 for (wl = wlist; wl && (strchr(wl->
wl_word,
')') ==
NULL);
68 (
void) strcat(buf, wl->wl_word);
72 for (t = buf; *t; t++);
73 for (s = wl->wl_word; *s && (*s !=
')'); s++, t++)
79 wl->wl_word =
copy(s);
96 for (b = tbuf; *b; b++)
97 if (isspace(*b) || (*b ==
'(')) {
103 fprintf(
cp_err,
"Error: %s is a predefined function.\n",tbuf);
125 for (s = b; *s; s++) {
131 else if (*s ==
')') {
134 else if (*s ==
',') {
139 for (udf = udfuncs; udf; udf = udf->
ud_next)
181 pn->pn_value->v_length = d->
v_length;
182 pn->pn_value->v_type = d->
v_type;
183 pn->pn_value->v_flags = d->
v_flags;
184 pn->pn_value->v_plot = d->
v_plot;
186 pn->pn_value->v_realdata =
191 pn->pn_value->v_compdata =
197 else if (pn->pn_op) {
199 if (pn->pn_op->op_arity == 2)
202 else if (pn->pn_func) {
220 s = strchr(name,
'(' );
226 for (udf = udfuncs; udf; udf = udf->
ud_next)
231 for (udf = udfuncs; udf; udf = udf->
ud_next)
250 (void) strcat(buf, ud->ud_name);
251 for (s = ud->ud_name; *s; s++);
252 (void) strcat(buf,
" (");
255 (void) strcat(buf, s);
259 (void) strcat(buf,
", ");
262 (void) strcat(buf,
") = ");
278 else if (pn->pn_func) {
283 else if (pn->pn_op && (pn->pn_op->op_arity == 2)) {
290 else if (pn->pn_op && (pn->pn_op->op_arity == 1)) {
310 int arity = 0, rarity;
318 for (udf = udfuncs; udf; udf = udf->
ud_next)
330 "Warning: the user-defined function %s has %d args\n",
334 for (s = udf->
ud_name; *s; s++)
351 static struct pnode *
365 if (tree->pn_value) {
379 t = d->
v_name + strlen(s) + 2;
380 while (*t && isspace(*t)) t++;
383 func =
alloc(
struct func);
398 else if (tree->pn_func) {
400 func =
alloc(
struct func);
403 func->
fu_func = tree->pn_func->fu_func;
406 else if (tree->pn_op) {
408 op =
alloc(
struct op);
410 op->
op_num = tree->pn_op->op_num;
411 op->
op_arity = tree->pn_op->op_arity;
412 op->
op_func = tree->pn_op->op_func;
419 fprintf(
cp_err,
"trcopy: Internal Error: bad parse node\n");
432 static struct pnode *
442 if (ptry && ptry->
pn_op &&
466 if (*wlist->wl_word ==
'*' ||
eq(wlist->wl_word,
"all")) {
467 for (udf = udfuncs; udf; udf = udn) {
477 for (udf = udfuncs; udf; udf = udf->
ud_next) {
491 wlist = wlist->wl_next;
static char buf[MAXPROMPT]
struct pnode * ft_getpnames()
static struct pnode * ntharg()
void com_define(wordlist *wlist)
static struct pnode * trcopy()
struct pnode * ft_substdef(char *name, struct pnode *args)
void com_undefine(wordlist *wlist)
static struct udfunc * udfuncs
struct dvec *(* op_func)()