void render() { char *refs[ndraw]; const int nd = conlinenum(refs); // console output const auto font = text::fontdim(); text::displaywidth(font.x); loopj(nd) text::draw(refs[j], font.x, float(sys::scrh)-font.y*(j+1)); // command line const auto cmd = curcmd(); if (cmd) text::drawf("> %s_", vec2f(font.x, float(sys::scrh)-font.y*(nd+1)), cmd); }
float height() { char *refs[ndraw]; const auto cmd = curcmd(); const int nd = conlinenum(refs) + (cmd?1:0); return float(sys::scrh)-nd*text::fontdim().y; }
/* EXECUTE -- Each loop corresponds to an exec in the interpreted code. * This occurs when a script task or process is ready to run. In background * mode, we skip the preliminaries and jump right in and interpret the * compiled code. */ static void execute (int mode) { int parsestat; XINT old_parhead; char *curcmd(); alldone = 0; gologout = 0; if (mode == BACKGROUND) { if (setjmp (jumpcom)) onerr(); goto bkg; } /* Called when control stack contains only the firsttask. ONEOF sets * alldone true when eof/bye is seen and currentask=firstask, * terminating the loop and returning to main. */ do { /* Bkg_update() checks for blocked or finished bkg jobs and prints * a message if it finds one. This involves one or more access() * calls so don't call it more than every 5 seconds. The errenv * jump vector is used by cl_error() for error restart. The JUMPCOM * vector is used to intercept system errors which would otherwise * restart the CL. */ if (currentask->t_flags & T_INTERACTIVE) { static long last_clktime; if (c_clktime (last_clktime) > BKG_QUANTUM) { last_clktime = c_clktime (0L); bkg_update (1); } validerrenv = 1; setjmp (errenv); ninterrupts = 0; if (setjmp (jumpcom)) onerr(); } else if (!(currentask->t_flags & T_SCRIPT)) setjmp (intenv); pc = currentask->t_bascode; currentask->t_topd = topd; currentask->t_topcs = topcs; recursion = 0; errlev = 0; c_erract (OK); yeof = 0; /* In the new CL the parser needs to know more about parameters * than before. Hence param files may be read in during parsing. * Since we discard the dictionary after parsing we must unlink * these param files, and re-read them when the * program is run. This is inefficient but appears to work. */ old_parhead = parhead; if (gologout) yeof++; else { yy_startblock (LOG); /* start new history blk */ parsestat = yyparse(); /* parse command block */ topd = currentask->t_topd; /* discard addconst()'s */ topcs = currentask->t_topcs; /* discard compiler temps */ parhead = old_parhead; /* forget param files. */ if (parsestat != 0) cl_error (E_IERR, "parser gagged"); } if (dobkg) { bkg_spawn (curcmd()); } else { bkg: if (yeof) oneof(); /* restores previous task */ else { /* set stack above pc, point pc back to code */ topos = basos = pc - 1; pc = currentask->t_bascode; } if (!alldone) run(); /* run code starting at pc */ } } until (alldone); }