![]() Unless we actually write a terminal emulator (like the current terminal widgets) then it is not possible to use readline's rl_redisplay function directly. See, for example, how complicated the default rl_redisplay function is in the readline library. Fixing that will make the redisplay function significantly more complex. The example program doesn't attempt handle multi-line prompts or prompts with invisible characters (color specifications, for example).Octave wouldn't have this problem because we already build a parse tree then execute it once it is complete. The example parser currently also performs evaluations and computes results immediately so it doesn't properly handle expression lists that are split across multiple lines.You'll see this behavior if you build the example program with CALC_USE_INTERPRETER_THREAD defined. Otherwise, we may print the next prompt before the output from the previous expression is evaluated and printed. If the interpreter does run in a separate thread, we still must wait for it to calculate and return a result so we can synchronize input and output.If the interpreter is not running in a separate thread but but the graphics engine is, then what happens to graphics callbacks when the parser is in the middle of parsing an expression? Or is this not an issue because separate parsers can be used even if there is only one evaluator? Could it ultimately be possible to have the evaluator running in multiple threads?.It could offer some advantages, but only if it is possible for the GUI to do useful things while the interpreter is busy. ![]() With this arrangement, would the interpreter have to run in a separate thread? As the example shows, it's not absolutely necessary.That file also contains the following list of open questions that will need to be resolved if we are going to attempt a switch. See the NOTES file for build instructions. So now jwe has reworked it using Qt and you can find the sources here: It worked as an example, but was not much help for Octave since we are using Qt. To properly handle input that spans multiple lines, a push parser is used instead of the current pull parser. Jwe included a simple example written with gtkmm to illustrate the idea of having the terminal widget in the GUI be in control of input and output and feed lines of text to the interpreter. This question was addressed again in May 2019. Way back in January 2012, jwe posted the following message about changing the terminal widget in the GUI to handle input differently.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |