void get_function(void) { function = read_function(); function_symbol = search_symbol(function, &function_code, 0); if (function_symbol == NULL) { function_symbol = poolp; pushstr("ECL_NIL"); pushc('\0'); } function_c_name = translate_function(function); }
char * read_token(void) { int c; int left_paren = 0; char *p; p = poolp; c = readc(); while (isspace(c)) c = readc(); do { if (c == '(') { left_paren++; pushc(c); } else if (c == ')') { if (left_paren == 0) { break; } else { left_paren--; pushc(c); } } else if (isspace(c) && left_paren == 0) { do c = readc(); while (isspace(c)); break; } else if (c == '@') { c = readc(); if (c == '\'') { (void)read_symbol(0); poolp--; } else if (c == '[') { (void)read_symbol(1); poolp--; } else if (c == '@') { pushc(c); } else { char *name; unreadc(c); poolp = name = read_function(); (void)translate_function(poolp); } } else { pushc(c); } c = readc(); } while (1); unreadc(c); pushc('\0'); return(p); }
void asm_translate(struct Syntree_node *root) { if (root == NULL) return ; struct Syntree_node *sn; for (sn = root; sn; sn = sn->next) { switch (sn->nkind) { case K_FUNC: translate_function(sn); break; case K_STMT: translate_statement(sn); break; case K_EXPR: translate_expression(sn); } } }
void main_loop(void) { int c; int in_defun=0; char *p; lineno = 1; reset(); put_lineno(); LOOP: c = jump_to_at(); if (c == ')') { if (!in_defun) error("unmatched @) found"); in_defun = 0; putc('}',out); reset(); goto LOOP; } else if (c == '\'') { char *p; poolp = pool; p = read_symbol(0); pushc('\0'); fprintf(out,"%s",p); goto LOOP; } else if (c == '[') { char *p; poolp = pool; p = read_symbol(1); pushc('\0'); fprintf(out,"%s",p); goto LOOP; } else if (c != '(') { char *p; unreadc(c); poolp = pool; poolp = p = read_function(); fprintf(out,"%s",translate_function(poolp)); goto LOOP; } p = read_token(); if (strcmp(p, "defun") == 0) { if (in_defun) error("@) expected before new function definition"); in_defun = 1; get_function(); get_lambda_list(); put_fhead(); put_lineno(); c = jump_to_at(); put_declaration(); put_lineno(); } else if (strcmp(p, "return") == 0) { tab_save = tab; get_return(); put_return(); } else error_symbol(p); goto LOOP; }