static void receive_output_cb(GString *string, GIOCondition condition, G_GNUC_UNUSED gpointer gdata) { if (condition & (G_IO_IN | G_IO_PRI)) { char *term = string->str + string->len - 1; const char *error = NULL; switch (*term) { case '\n' : if (string->len >= 2 && term[-1] == '\r') term--; /* falldown */ case '\r' : *term = '\0'; break; case '\0' : error = "binary zero encountered"; break; default : error = "line too long or incomplete"; } if (leading_receive) debug_parse(string->str, error); leading_receive = !error; } if (!commands->len) views_update(debug_state()); update_state(debug_state()); }
void debug_rcv(char ch) { static int lineptr = 0; static char linebuff[256]; if ((ch=='\r') || (lineptr==255)) { linebuff[lineptr] = 0; if (lineptr) { debug_parse(linebuff); } lineptr = 0; SendDebugPrompt; } else if (iscntrl(ch)) { switch (ch) { case BS: if (lineptr) { DebugPutChar(ch); lineptr--; } break; } } else { linebuff[lineptr++] = ch; DebugPutChar(ch); } }
virtual void visitCodeVar(CodeVar* v2) { if (match_eval(v2)) { return; } POETCode* v2parse = v2->get_parseInfo(); assert (v2parse != 0); if (v2parse == EMPTY) PARSE_MISMATCH(v2,r1,lineno); // v2 is built only through scanning POETCode* pars=0; switch (v2parse->get_enum()) { case SRC_OP: case SRC_XVAR: break; /*QY: parameters are not involved in parsing*/ default: pars = v2->get_entry().get_param(); } POETCode* r1Save = r1; try { if (pars != 0) v2->get_entry().get_symTable()->push_table(false); LocalVar* inherit_var = v2->get_entry().get_inherit_var(); if (inherit_var != 0) { inherit_var->get_entry().set_code( inherit); if (debug_parse()) std::cerr << inherit_var->toString(OUTPUT_VAR_VAL) << "\n"; } apply(v2parse,fullmatch); if (fullmatch != 0) fullmatch=EMPTY; if (pars != 0) { /*QY get the values stored in pars*/ pars=ReplaceSingletonListVisitor().apply(pars); POETCode* cond = v2->get_static_attr("cond"); if (cond != 0 && !AST2Bool(eval_AST(cond))) PARSE_MISMATCH(v2,pars,lineno); res = v2->invoke_rebuild(pars); v2->get_entry().get_symTable()->pop_table(); } else if (v2->get_entry().get_param() != 0) { if (!v2->check_cond(res)) PARSE_MISMATCH(v2,res,lineno); POETCode* rres = v2->invoke_rebuild(res); res = rres; } else if (v2->get_entry().get_code() != 0) res = fac->build_codeRef(v2->get_entry(),0); } catch (ParseError err) { if (pars != 0) v2->get_entry().get_symTable()->pop_table(); r1 = r1Save; throw err; } catch (Error err) { std::cerr << " From parsing code template " << v2->toString() << "\n"; throw err; } }