Browse Source

lexical #1/6, cleanup

rlar 14 years ago
parent
commit
5d245c9dab
  1. 17
      src/frontend/parser/lexical.c

17
src/frontend/parser/lexical.c

@ -75,19 +75,22 @@ static int numeofs = 0;
*/ */
#define append(word) \ #define append(word) \
{ wordlist *aux = wl_cons(word, NULL); \
do { \
wordlist *aux = wl_cons(word, NULL); \
if (cw) \ if (cw) \
cw->wl_next = aux; \ cw->wl_next = aux; \
aux->wl_prev = cw; \ aux->wl_prev = cw; \
cw = aux; \ cw = aux; \
if (!wlist) \ if (!wlist) \
wlist = cw; \ wlist = cw; \
}
} while(0)
#define newword \ #define newword \
do { \
append(copy(buf)); \ append(copy(buf)); \
bzero(buf, NEW_BSIZE_SP); \ bzero(buf, NEW_BSIZE_SP); \
i = 0;
i = 0; \
} while(0)
/* CDHW Debug function */ /* CDHW Debug function */
@ -105,7 +108,6 @@ pwlist_echo( /*CDHW used to perform function of set echo */
for (wl = wlist; wl; wl = wl->wl_next) for (wl = wlist; wl; wl = wl->wl_next)
fprintf(cp_err, "%s ", wl->wl_word ); fprintf(cp_err, "%s ", wl->wl_word );
fprintf(cp_err, "\n"); fprintf(cp_err, "\n");
return;
} }
/* CDHW */ /* CDHW */
@ -173,7 +175,7 @@ gotchar:
wl_free(wlist); wl_free(wlist);
wlist = cw = NULL; wlist = cw = NULL;
if (string) if (string)
return (NULL);
return NULL;
while (((c = input(cp_inp_cur)) != '\n') && (c != EOF)) while (((c = input(cp_inp_cur)) != '\n') && (c != EOF))
; ;
goto nloop; goto nloop;
@ -278,7 +280,7 @@ gotchar:
} }
wl_free(wlist); wl_free(wlist);
return (NULL);
return NULL;
} }
case ESCAPE: case ESCAPE:
if (cp_interactive && !cp_nocc) { if (cp_interactive && !cp_nocc) {
@ -339,7 +341,7 @@ ldefault: if ((cp_chars[c] & CPC_BRL) && (i > 0)) {
done: done:
if (wlist->wl_word) pwlist_echo(wlist,"Command>"); if (wlist->wl_word) pwlist_echo(wlist,"Command>");
return (wlist);
return wlist;
} }
static void static void
@ -369,5 +371,4 @@ prompt(void)
s++; s++;
} }
(void) fflush(cp_out); (void) fflush(cp_out);
return;
} }
Loading…
Cancel
Save