1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756
|
/*
* parse.c logo parser module dvb
*
* Copyright (C) 1993 by the Regents of the University of California
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
*/
#ifdef HAVE_WX
#ifdef WIN32
#define NEW_WIN32
#endif
#undef WIN32
#endif
#ifdef WIN32
#include <windows.h>
#endif
#include "logo.h"
#include "globals.h"
#ifdef HAVE_TERMIO_H
#ifdef HAVE_WX
#ifndef NEW_WIN32
#include <termios.h>
#endif
#else
#include <termio.h>
#endif
#else
#ifdef HAVE_SGTTY_H
#include <sgtty.h>
#endif
#endif
#include <ctype.h>
#ifdef ibm
#ifndef _MSC_VER
#include <bios.h>
extern int getch(void);
#endif /* _MSC_VER */
#endif
#ifdef __RZTC__
#include <disp.h>
#endif
# ifdef HAVE_WX
#ifdef getc
#undef getc
#endif
#define getc getFromWX_2
#define getch getFromWX
extern int check_wx_stop(int force_yield);
extern void wx_enable_scrolling();
extern void wx_refresh();
#endif
FILE *readstream;
FILE *writestream;
FILE *loadstream;
FILE *dribblestream = NULL;
int input_blocking = 0;
NODE *deepend_proc_name = NIL;
#if 0
char *cmdHistory[HIST_MAX] = {0};
char **hist_inptr, **hist_outptr;
#endif
int readingInstruction = 0;
int rd_getc(FILE *strm) {
int c;
#ifdef WIN32
MSG msg;
#endif
#ifndef WIN32 /* skip this section ... */
#ifdef __RZTC__
if (strm == stdin) zflush();
c = ztc_getc(strm);
#else
c = getc(strm);
#endif
if (strm == stdin && c != EOF) update_coords(c);
#ifndef mac
if (c == '\r') return rd_getc(strm);
#endif
#ifdef ibm
if (c == 17 && interactive && strm==stdin) { /* control-q */
to_pending = 0;
err_logo(STOP_ERROR,NIL);
if (input_blocking) {
#ifdef SIG_TAKES_ARG
logo_stop(0);
#else
logo_stop();
#endif
}
}
if (c == 23 && interactive && strm==stdin) { /* control-w */
#ifndef __RZTC__
getc(strm); /* eat up the return */
#endif
#ifdef SIG_TAKES_ARG
logo_pause(0);
#else
logo_pause();
#endif
return(rd_getc(strm));
}
#endif
#else /* WIN32 */
if (strm == stdin) {
if (winPasteText && !line_avail) winDoPaste();
if (!line_avail) {
win32_text_cursor();
while (GetMessage(&msg, NULL, 0, 0)) {
TranslateMessage(&msg);
DispatchMessage(&msg);
if (line_avail)
break;
}
}
c = read_line[read_index++];
if (c == 17 && interactive && strm==stdin) { /* control-q */
to_pending = 0;
err_logo(STOP_ERROR,NIL);
line_avail = 0;
free(read_line);
if (input_blocking) logo_stop(0);
return('\n');
}
if (c == 23 && interactive && strm==stdin) { /* control-w */
line_avail = 0;
free(read_line);
logo_pause(0);
return(rd_getc(strm));
}
if (c == '\n') {
line_avail = 0;
free(read_line);
}
}
else /* reading from a file */
c = getc(strm);
#endif /* WIN32 */
#ifdef ecma
return((c == EOF) ? c : ecma_clear(c));
#else
return(c);
#endif
}
void rd_print_prompt(char *str) {
#ifdef ibm
#if defined(__RZTC__) || defined(WIN32)
if (in_graphics_mode && !in_splitscreen)
#else
#ifndef _MSC_VER
if (in_graphics_mode && ibm_screen_top == 0)
#endif /* _MSC_VER */
#endif
lsplitscreen(NIL);
#endif
#ifdef HAVE_WX
if(in_graphics_mode && !in_splitscreen)
lsplitscreen(NIL);
#endif
#ifdef mac
extern int in_fscreen(void);
if (in_fscreen())
lsplitscreen(NIL);
#endif
ndprintf(stdout,"%t",str);
#if defined(__RZTC__) && !defined(WIN32) /* sowings */
zflush();
#endif
}
#if defined(__RZTC__) && !defined(WIN32) /* sowings */
void zrd_print_prompt(char *str) {
newline_bugfix();
rd_print_prompt(str);
}
#else
#define zrd_print_prompt rd_print_prompt
#endif
#define into_line(chr) {if (phys_line >= p_end) { \
p_len += MAX_PHYS_LINE; \
p_pos = phys_line - p_line; \
p_line = realloc(p_line, p_len); \
p_end = &p_line[p_len-1]; \
phys_line = &p_line[p_pos]; \
} \
*phys_line++ = (chr);}
char *p_line = 0, *p_end;
int p_len = MAX_PHYS_LINE;
char ender[100];
NODE *reader(FILE *strm, char *prompt) {
int c = 0, dribbling, vbar = 0, paren = 0;
int bracket = 0, brace = 0, p_pos, contin=1, insemi=0, raw=0;
char *phys_line, *lookfor = ender;
NODETYPES this_type = STRING;
NODE *ret;
char *old_stringptr = print_stringptr;
int old_stringlen = print_stringlen;
fix_turtle_shownness();
//readingInstruction = !strcmp(prompt, "? ");
readingInstruction = (strm == stdin);
#ifdef HAVE_WX
wx_refresh();
if(readingInstruction) {
wx_enable_scrolling();
}
#endif
print_stringptr = ender;
print_stringlen = 99;
ndprintf(NULL, "\n%p\n", theName(Name_end));
*print_stringptr = '\0';
print_stringptr = old_stringptr;
print_stringlen = old_stringlen;
if (!strcmp(prompt, "RW")) { /* called by readword */
prompt = "";
contin = 0;
}
if (!strcmp(prompt, "RAW")) { /* called by readrawline */
prompt = "";
contin = 0;
raw = 1;
}
charmode_off();
#ifdef WIN32
dribbling = 0;
#else
dribbling = (dribblestream != NULL && strm == stdin);
#endif
if (p_line == 0) {
p_line = malloc(MAX_PHYS_LINE);
if (p_line == NULL) {
err_logo(OUT_OF_MEM, NIL);
return UNBOUND;
}
p_end = &p_line[MAX_PHYS_LINE-1];
}
phys_line = p_line;
if (strm == stdin && *prompt) {
if (interactive) {
rd_print_prompt(prompt);
#ifdef WIN32
win32_update_text();
#endif
}
}
if (strm == stdin) {
input_blocking++;
erract_errtype = FATAL;
}
#ifndef TIOCSTI
if (!setjmp(iblk_buf)) {
#endif
c = rd_getc(strm);
/* if ((c=='\b' || c=='\127') && strm==stdin && interactive) {
silent_load(LogoLogo, logolib);
c = rd_getc(strm);
} */ /* 6.0 */
#ifdef mac
if (c == '\r') c = '\n'; /* seen in raw mode by keyp, never read */
#endif
while (c != EOF && (vbar || paren || bracket || brace || c != '\n')
&& NOT_THROWING) {
if (dribbling) rd_putc(c, dribblestream);
if (!raw && c == '\\' && (c = rd_getc(strm)) != EOF) {
if (dribbling) rd_putc(c, dribblestream);
c = setparity(c);
this_type = BACKSLASH_STRING;
if (c == setparity('\n') && strm == stdin) {
if (interactive) zrd_print_prompt("\\ ");
}
}
if (c != EOF) into_line(c);
if (raw) {
c = rd_getc(strm);
continue;
}
if (*prompt && (c&0137) == ((*lookfor)&0137)) {
lookfor++;
if (*lookfor == 0) {
if (deepend_proc_name != NIL)
err_logo(DEEPEND, deepend_proc_name);
else
err_logo(DEEPEND_NONAME, NIL);
break;
}
} else lookfor = ender;
if (c == '|' && !insemi) {
vbar = !vbar;
this_type = VBAR_STRING;
} else if (contin && !vbar && !insemi) {
if (c == '(') paren++;
else if (paren && c == ')') paren--;
else if (c == '[') bracket++;
else if (bracket && c == ']') bracket--;
else if (c == '{') brace++;
else if (brace && c == '}') brace--;
else if (c == ';') insemi++;
}
if (this_type == STRING && strchr(special_chars, c))
this_type = VBAR_STRING;
if (/* (vbar || paren ...) && */ c == '\n') {
insemi = 0;
if (strm == stdin) {
if (interactive) zrd_print_prompt(vbar ? "| " : "~ ");
}
}
while (!vbar && c == '~' && (c = rd_getc(strm)) != EOF) {
int gotspc = 0;
while (c == ' ' || c == '\t') {
gotspc = 1;
c = rd_getc(strm);
}
if (dribbling) rd_putc(c, dribblestream);
if (c != '\n' && gotspc) into_line(' ');
into_line(c);
if (c == '\n') {
insemi = 0;
if (interactive && strm == stdin) zrd_print_prompt("~ ");
}
else if (c == '(') paren++;
else if (paren && c == ')') paren--;
else if (c == '[') bracket++;
else if (bracket && c == ']') bracket--;
else if (c == '{') brace++;
else if (brace && c == '}') brace--;
else if (c == ';') insemi++;
}
if (c != EOF) c = rd_getc(strm);
}
#ifndef TIOCSTI
}
#endif
*phys_line = '\0';
input_blocking = 0;
#if defined(__RZTC__) && !defined(WIN32) /* sowings */
fix_cursor();
if (interactive && strm == stdin) newline_bugfix();
#endif
if (dribbling)
rd_putc('\n', dribblestream);
if (c == EOF && strm == stdin) {
if (interactive) clearerr(stdin);
rd_print_prompt("\n");
}
if (phys_line == p_line) return(Null_Word); /* so emptyp works */
ret = make_strnode(p_line, (struct string_block *)NULL, (int)strlen(p_line),
this_type, strnzcpy);
#if 0
if (strm == stdin && !strcmp(prompt, "? ")){
char *histline = malloc(1+strlen(p_line));
strcpy(histline, p_line);
*hist_inptr++ = histline;
if (hist_inptr >= &cmdHistory[HIST_MAX]) {
hist_inptr = cmdHistory;
}
if (*hist_inptr) {
free(*hist_inptr);
*hist_inptr = 0;
}
hist_outptr = hist_inptr;
}
#endif
//added (evan)
readingInstruction = 0;
return(ret);
}
NODE *list_to_array(NODE *list) {
NODE *np = list, *result;
FIXNUM len = 0, i;
for (; np; np = cdr(np)) len++;
result = make_array(len);
setarrorg(result,1);
for (i = 0, np = list; np; np = cdr(np))
(getarrptr(result))[i++] = car(np);
return(result);
}
#define parens(ch) (ch == '(' || ch == ')' || ch == ';')
#define infixs(ch) (ch == '*' || ch == '/' || ch == '+' || ch == '-' || ch == '=' || ch == '<' || ch == '>')
#define white_space(ch) (ch == ' ' || ch == '\t' || ch == '\n' || ch == '\0')
NODE *parser_iterate(char **inln, char *inlimit, struct string_block *inhead,
BOOLEAN semi, int endchar) {
char ch, *wptr = NULL;
static char terminate = '\0'; /* KLUDGE */
NODE *outline = NIL, *lastnode = NIL, *tnode = NIL;
int windex = 0, vbar = 0;
NODETYPES this_type = STRING;
BOOLEAN broken = FALSE;
do {
/* get the current character and increase pointer */
ch = **inln;
if (!vbar && windex == 0) wptr = *inln;
if (++(*inln) >= inlimit) *inln = &terminate;
/* skip through comments and line continuations */
while (!vbar && ((semi && ch == ';') ||
#ifdef WIN32
(ch == '~' && (**inln == 012 || **inln == 015)))) {
while (ch == '~' && (**inln == 012 || **inln == 015)) {
#else
(ch == '~' && **inln == '\n'))) {
while (ch == '~' && **inln == '\n') {
#endif
if (++(*inln) >= inlimit) *inln = &terminate;
ch = **inln;
if (windex == 0) wptr = *inln;
else {
if (**inln == ']' || **inln == '[' ||
**inln == '{' || **inln == '}') {
ch = ' ';
break;
} else {
broken = TRUE;
}
}
if (++(*inln) >= inlimit) *inln = &terminate;
}
if (semi && ch == ';') {
#ifdef WIN32
if (**inln != 012 && **inln != 015)
#else
if (**inln != '\n')
#endif
do {
ch = **inln;
if (windex == 0) wptr = *inln;
else broken = TRUE;
if (++(*inln) >= inlimit) *inln = &terminate;
}
#ifdef WIN32
while (ch != '\0' && ch != '~' && **inln != 012 && **inln != 015);
#else /* !Win32 */
while (ch != '\0' && ch != '~' && **inln != '\n');
#endif
if (ch != '\0' && ch != '~') ch = '\n';
}
}
/* flag that this word will be of BACKSLASH_STRING type */
if (getparity(ch)) this_type = BACKSLASH_STRING;
if (ch == '|') {
vbar = !vbar;
this_type = VBAR_STRING;
broken = TRUE; /* so we'll copy the chars */
}
else if (vbar || (!white_space(ch) && ch != ']' &&
ch != '{' && ch != '}' && ch != '['))
windex++;
if (vbar) continue;
else if (ch == endchar) break;
else if (ch == ']') err_logo(UNEXPECTED_BRACKET, NIL);
else if (ch == '}') err_logo(UNEXPECTED_BRACE, NIL);
/* if this is a '[', parse a new list */
else if (ch == '[') {
tnode = cons(parser_iterate(inln,inlimit,inhead,semi,']'), NIL);
if (**inln == '\0') ch = '\0';
}
else if (ch == '{') {
tnode = cons(list_to_array
(parser_iterate(inln,inlimit,inhead,semi,'}')), NIL);
if (**inln == '@') {
int i = 0, sign = 1;
(*inln)++;
if (**inln == '-') {
sign = -1;
(*inln)++;
}
while ((ch = **inln) >= '0' && ch <= '9') {
i = (i*10) + ch - '0';
(*inln)++;
}
setarrorg(car(tnode),sign*i);
}
if (**inln == '\0') ch = '\0';
}
/* if this character or the next one will terminate string, make the word */
else if (white_space(ch) || **inln == ']' || **inln == '[' ||
**inln == '{' || **inln == '}') {
if (windex > 0 || this_type == VBAR_STRING) {
if (broken == FALSE)
tnode = cons(make_strnode(wptr, inhead, windex,
this_type, strnzcpy),
NIL);
else {
tnode = cons(make_strnode(wptr,
(struct string_block *)NULL, windex,
this_type, (semi ? mend_strnzcpy : mend_nosemi)),
NIL);
broken = FALSE;
}
this_type = STRING;
windex = 0;
}
}
/* put the word onto the end of the return list */
if (tnode != NIL) {
if (outline == NIL) outline = tnode;
else setcdr(lastnode, tnode);
lastnode = tnode;
tnode = NIL;
}
} while (ch);
return(outline);
}
NODE *parser(NODE *nd, BOOLEAN semi) {
NODE *rtn;
int slen;
char *lnsav;
rtn = cnv_node_to_strnode(nd);
slen = getstrlen(rtn);
lnsav = getstrptr(rtn);
rtn = parser_iterate(&lnsav,lnsav + slen,getstrhead(rtn),semi,-1);
return(rtn);
}
NODE *lparse(NODE *args) {
NODE *arg, *val = UNBOUND;
arg = string_arg(args);
if (NOT_THROWING) {
val = parser(arg, FALSE);
}
return(val);
}
NODE *runparse_node(NODE *nd, NODE **ndsptr) {
NODE *outline = NIL, *tnode = NIL, *lastnode = NIL, *snd;
char *wptr, *tptr;
struct string_block *whead;
int wlen, wcnt, tcnt, isnumb, gotdot;
NODETYPES wtyp;
BOOLEAN monadic_minus = FALSE;
if (nd == Minus_Tight) return cons(nd, NIL);
snd = cnv_node_to_strnode(nd);
wptr = getstrptr(snd);
wlen = getstrlen(snd);
wtyp = nodetype(snd);
wcnt = 0;
whead = getstrhead(snd);
while (wcnt < wlen) {
if (*wptr == ';') {
*ndsptr = NIL;
break;
}
if (*wptr == '"') {
tcnt = 0;
tptr = ++wptr;
wcnt++;
while (wcnt < wlen && !parens(*wptr)) {
if (wtyp == BACKSLASH_STRING && getparity(*wptr))
wtyp = PUNBOUND; /* flag for "\( case */
wptr++, wcnt++, tcnt++;
}
if (wtyp == PUNBOUND) {
wtyp = BACKSLASH_STRING;
tnode = cons(make_quote(intern(make_strnode(tptr, NULL,
tcnt, wtyp, noparity_strnzcpy))), NIL);
} else
tnode = cons(make_quote(intern(make_strnode(tptr, whead, tcnt,
wtyp, strnzcpy))), NIL);
} else if (*wptr == ':') {
tcnt = 0;
tptr = ++wptr;
wcnt++;
while (wcnt < wlen && !parens(*wptr) && !infixs(*wptr))
wptr++, wcnt++, tcnt++;
tnode = cons(make_colon(intern(make_strnode(tptr, whead, tcnt,
wtyp, strnzcpy))), NIL);
} else if (wcnt == 0 && *wptr == '-' && monadic_minus == FALSE &&
wcnt+1 < wlen && !white_space(*(wptr+1))) {
/* minus sign with space before and no space after is unary */
tnode = cons(make_intnode((FIXNUM)0), NIL);
monadic_minus = TRUE;
} else if (parens(*wptr) || infixs(*wptr)) {
if (monadic_minus)
tnode = cons(Minus_Tight, NIL);
else if (wcnt+1 < wlen &&
((*wptr == '<' && (*(wptr+1) == '=' || *(wptr+1) == '>'))
|| (*wptr == '>' && *(wptr+1) == '='))) {
tnode = cons(intern(make_strnode(wptr, whead, 2,
STRING, strnzcpy)), NIL);
wptr++, wcnt++;
} else
tnode = cons(intern(make_strnode(wptr, whead, 1,
STRING, strnzcpy)), NIL);
monadic_minus = FALSE;
wptr++, wcnt++;
} else {
tcnt = 0;
tptr = wptr;
/* isnumb 4 means nothing yet;
* 0 means digits so far, 1 means just saw
* 'e' so minus can be next, 2 means no longer
* eligible even if an 'e' comes along */
isnumb = 4;
gotdot = 0;
if (*wptr == '?') {
isnumb = 3; /* turn ?5 to (? 5) */
wptr++, wcnt++, tcnt++;
}
while (wcnt < wlen && !parens(*wptr) &&
(!infixs(*wptr) || (isnumb == 1 && (*wptr == '-' || *wptr == '+')))) {
if (isnumb == 4 && isdigit(*wptr)) isnumb = 0;
if (isnumb == 0 && tcnt > 0 && (*wptr == 'e' || *wptr == 'E'))
isnumb = 1;
else if (!(isdigit(*wptr) || (!gotdot && *wptr == '.')) || isnumb == 1)
isnumb = 2;
if (*wptr == '.') gotdot++;
wptr++, wcnt++, tcnt++;
}
if (isnumb == 3 && tcnt > 1) { /* ?5 syntax */
NODE *qmtnode;
qmtnode = cons_list(0, Left_Paren, Query,
cnv_node_to_numnode
(make_strnode(tptr+1, whead,
tcnt-1, wtyp, strnzcpy)),
END_OF_LIST);
if (outline == NIL) {
outline = qmtnode;
} else {
setcdr(lastnode, qmtnode);
}
lastnode = cddr(qmtnode);
tnode = cons(Right_Paren, NIL);
} else if (isnumb < 2 && tcnt > 0) {
tnode = cons(cnv_node_to_numnode(make_strnode(tptr, whead, tcnt,
wtyp, strnzcpy)),
NIL);
} else
tnode = cons(intern(make_strnode(tptr, whead, tcnt,
wtyp, strnzcpy)),
NIL);
}
if (outline == NIL) outline = tnode;
else setcdr(lastnode, tnode);
lastnode = tnode;
}
return(outline);
}
NODE *runparse(NODE *ndlist) {
NODE *curnd = NIL, *outline = NIL, *tnode = NIL, *lastnode = NIL;
char *str;
if (nodetype(ndlist) == RUN_PARSE)
return parsed__runparse(ndlist);
if (!is_list(ndlist)) {
err_logo(BAD_DATA_UNREC, ndlist);
return(NIL);
}
if (ndlist != NIL && is_word(curnd=car(ndlist)) && getstrlen(curnd) >= 2 &&
(str=getstrptr(curnd)) && *str++ == '#' && *str == '!')
return NIL; /* shell-script #! treated as comment line */
while (ndlist != NIL) {
curnd = car(ndlist);
ndlist = cdr(ndlist);
if (!is_word(curnd))
tnode = cons(curnd, NIL);
else {
if (!numberp(curnd))
tnode = runparse_node(curnd, &ndlist);
else
tnode = cons(cnv_node_to_numnode(curnd), NIL);
}
if (tnode != NIL) {
if (outline == NIL) outline = tnode;
else setcdr(lastnode, tnode);
lastnode = tnode;
while (cdr(lastnode) != NIL) {
lastnode = cdr(lastnode);
if (check_throwing) break;
}
}
if (check_throwing) break;
}
return(outline);
}
NODE *lrunparse(NODE *args) {
NODE *arg;
arg = car(args);
while (nodetype(arg) == ARRAY && NOT_THROWING) {
setcar(args, err_logo(BAD_DATA, arg));
arg = car(args);
}
if (NOT_THROWING && !aggregate(arg))
arg = parser(arg, TRUE);
if (NOT_THROWING)
return runparse(arg);
return UNBOUND;
}
|