Browse Source

cpitf.c, cleanup using wl_ functions

rlar 14 years ago
parent
commit
75d6f6da5e
  1. 20
      src/frontend/cpitf.c

20
src/frontend/cpitf.c

@ -27,8 +27,6 @@ Author: 1985 Wayne A. Christopher, U. C. Berkeley CAD Group
void void
ft_cpinit(void) ft_cpinit(void)
{ {
wordlist *wl;
wordlist wl1, wl2, wl3;
bool found = FALSE, t = TRUE; bool found = FALSE, t = TRUE;
char buf[BSIZE_SP], **x, *s, *r,*copys; char buf[BSIZE_SP], **x, *s, *r,*copys;
struct comm *c; struct comm *c;
@ -176,6 +174,9 @@ ft_cpinit(void)
/* Make vectors from values in predefs[] for the current plot. /* Make vectors from values in predefs[] for the current plot.
Define functions from entries in udfs[] (like user defined functions). Define functions from entries in udfs[] (like user defined functions).
*/ */
{
wordlist wl1, wl2, wl3;
wl1.wl_next = &wl2; wl1.wl_next = &wl2;
wl1.wl_prev = NULL; wl1.wl_prev = NULL;
wl2.wl_next = NULL; wl2.wl_next = NULL;
@ -211,6 +212,7 @@ ft_cpinit(void)
wl2.wl_word = udfs[i + 1]; wl2.wl_word = udfs[i + 1];
com_define(&wl1); com_define(&wl1);
} }
}
/* Reset this for the front end. */ /* Reset this for the front end. */
cp_hash = '*'; cp_hash = '*';
@ -225,10 +227,14 @@ ft_cpinit(void)
(void) sprintf(buf, "sourcepath = ( %s %s %s )", DIR_CWD, Lib_Path, Inp_Path); (void) sprintf(buf, "sourcepath = ( %s %s %s )", DIR_CWD, Lib_Path, Inp_Path);
else else
(void) sprintf(buf, "sourcepath = ( %s %s )", DIR_CWD, Lib_Path); (void) sprintf(buf, "sourcepath = ( %s %s )", DIR_CWD, Lib_Path);
{
wordlist *wl;
wl = cp_doglob(cp_lexer(buf)); wl = cp_doglob(cp_lexer(buf));
cp_striplist(wl); cp_striplist(wl);
com_set(wl); com_set(wl);
wl_free(wl); wl_free(wl);
}
/* Now source the standard startup file spinit or tclspinit. */ /* Now source the standard startup file spinit or tclspinit. */
@ -352,7 +358,6 @@ cp_oddcomm(char *s, wordlist *wl)
{ {
FILE *fp; FILE *fp;
char buf[BSIZE_SP]; char buf[BSIZE_SP];
wordlist ww;
if ((fp = inp_pathopen(s, "r")) != NULL) { if ((fp = inp_pathopen(s, "r")) != NULL) {
(void) fclose(fp); (void) fclose(fp);
@ -369,11 +374,10 @@ cp_oddcomm(char *s, wordlist *wl)
cp_remvar("argv"); cp_remvar("argv");
return (TRUE); return (TRUE);
} else if (wl && eq(wl->wl_word, "=")) { } else if (wl && eq(wl->wl_word, "=")) {
ww.wl_next = wl;
wl->wl_prev = &ww;
ww.wl_prev = NULL;
ww.wl_word = s;
com_let(&ww);
wordlist *ww = wl_cons(copy(s), wl);
com_let(ww);
wl_chop_rest(ww);
wl_free(ww);
return (TRUE); return (TRUE);
} else } else
return (FALSE); return (FALSE);

Loading…
Cancel
Save