- print with no parameters should just print an empty line; it doesn't
Neil
Code: Select all
list_6:
;if ((ch == IF) || (ch == FOR) || (ch == DO))
cpx #IF
beq list_7
cpx #FOR
beq list_7
cpx #DO
bne list_8
list_7: ;indent++;
inc indent
list_8:
;if ((ch == ENDIF) || (ch == NEXT) || (ch == WHILE))
cpx #ENDIF
beq list_9
cpx #NEXT
beq list_9
cpx #WHILE
bne list_10
list_9:
;indent--;
dec indent
bpl list_10
stz indent ; don't go negative!
Code: Select all
WHILE foo < 10 CYCLE
PROC table (foo)
REPEATCode: Select all
CYCLE
PROC table (foo)
REPEAT UNTIL foo < 10Code: Select all
char * do_do (char * where)
{
/* Execute the 'do' clause by calling it recursively; it continues
* until the matching 'while' statement. That statement returns NULL
* if its comparison clause is true, indicating that the loop should
* continue, or the address of the line following 'while'
*/
char * loop_address; // first line in the do loop
char * cont_address; // first line after the while
char * while_address; // the while line
where -= 4;
where = find_next_line (where);
loop_address = where;
while_address = find_pair (where, DO);
cont_address = find_next_line (while_address); // first line after while
do
{
where = loop_address;
do
{
where = execute(where);
}
while ((NULL != where) && (where != cont_address));
}
while ((NULL == where) && (ERR_NONE == err));
return where;
}
char * do_while (char * where)
{
/* test a condition; if true, return NULL
* otherwise, return the address of the next line
*/
if (compare())
{
return NULL;
}
else
{
return find_next_line (where - 4);
}
}