annotate NOTES @ 3:52c033864347

add build instructions to NOTES file
author John W. Eaton <jwe@octave.org>
date Wed, 22 May 2019 16:21:06 -0400
parents dff751fb985c
children 822a2fe5bb51
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
3
52c033864347 add build instructions to NOTES file
John W. Eaton <jwe@octave.org>
parents: 0
diff changeset
1 To build:
52c033864347 add build instructions to NOTES file
John W. Eaton <jwe@octave.org>
parents: 0
diff changeset
2
52c033864347 add build instructions to NOTES file
John W. Eaton <jwe@octave.org>
parents: 0
diff changeset
3 qmake calc.pro
52c033864347 add build instructions to NOTES file
John W. Eaton <jwe@octave.org>
parents: 0
diff changeset
4 make
52c033864347 add build instructions to NOTES file
John W. Eaton <jwe@octave.org>
parents: 0
diff changeset
5
0
dff751fb985c initial revision
John W. Eaton <jwe@octave.org>
parents:
diff changeset
6 Current terminal widget:
dff751fb985c initial revision
John W. Eaton <jwe@octave.org>
parents:
diff changeset
7
dff751fb985c initial revision
John W. Eaton <jwe@octave.org>
parents:
diff changeset
8 * Run Octave in a separate thread. On unixy, interact through pty.
dff751fb985c initial revision
John W. Eaton <jwe@octave.org>
parents:
diff changeset
9 On Windows systems, use hidden console and mirror contents in Qt
dff751fb985c initial revision
John W. Eaton <jwe@octave.org>
parents:
diff changeset
10 widget.
dff751fb985c initial revision
John W. Eaton <jwe@octave.org>
parents:
diff changeset
11
dff751fb985c initial revision
John W. Eaton <jwe@octave.org>
parents:
diff changeset
12 Octave interpreter sees input directly, same as for normal
dff751fb985c initial revision
John W. Eaton <jwe@octave.org>
parents:
diff changeset
13 terminal application. Good, because no change in the way Octave
dff751fb985c initial revision
John W. Eaton <jwe@octave.org>
parents:
diff changeset
14 accepts and parses input. Bad because GUI is not in control of
dff751fb985c initial revision
John W. Eaton <jwe@octave.org>
parents:
diff changeset
15 input and must arrange to communicate across threads.
dff751fb985c initial revision
John W. Eaton <jwe@octave.org>
parents:
diff changeset
16
dff751fb985c initial revision
John W. Eaton <jwe@octave.org>
parents:
diff changeset
17 Terminal window can (in theory) be used to run other applications
dff751fb985c initial revision
John W. Eaton <jwe@octave.org>
parents:
diff changeset
18 started from the system command (for example). This feature works
dff751fb985c initial revision
John W. Eaton <jwe@octave.org>
parents:
diff changeset
19 well enough for us to use less running as a separate process to
dff751fb985c initial revision
John W. Eaton <jwe@octave.org>
parents:
diff changeset
20 handle paging output, but it doesn't work for all applications.
dff751fb985c initial revision
John W. Eaton <jwe@octave.org>
parents:
diff changeset
21 For example, I am not able to run editors like Emacs or vi in the
dff751fb985c initial revision
John W. Eaton <jwe@octave.org>
parents:
diff changeset
22 GUI terminal window.
dff751fb985c initial revision
John W. Eaton <jwe@octave.org>
parents:
diff changeset
23
dff751fb985c initial revision
John W. Eaton <jwe@octave.org>
parents:
diff changeset
24 To make less work as the pager on Unixy systems, the Octave must
dff751fb985c initial revision
John W. Eaton <jwe@octave.org>
parents:
diff changeset
25 fork, call setsid in the child to detach from the controlling
dff751fb985c initial revision
John W. Eaton <jwe@octave.org>
parents:
diff changeset
26 terminal, and then exec the GUI.
dff751fb985c initial revision
John W. Eaton <jwe@octave.org>
parents:
diff changeset
27
dff751fb985c initial revision
John W. Eaton <jwe@octave.org>
parents:
diff changeset
28 GUI must deal with threads when communicating with the
dff751fb985c initial revision
John W. Eaton <jwe@octave.org>
parents:
diff changeset
29 interpreter.
dff751fb985c initial revision
John W. Eaton <jwe@octave.org>
parents:
diff changeset
30
dff751fb985c initial revision
John W. Eaton <jwe@octave.org>
parents:
diff changeset
31 Proposal:
dff751fb985c initial revision
John W. Eaton <jwe@octave.org>
parents:
diff changeset
32
dff751fb985c initial revision
John W. Eaton <jwe@octave.org>
parents:
diff changeset
33 * GUI terminal widget is in control of input.
dff751fb985c initial revision
John W. Eaton <jwe@octave.org>
parents:
diff changeset
34
dff751fb985c initial revision
John W. Eaton <jwe@octave.org>
parents:
diff changeset
35 Use callback interface for readline to handle command line
dff751fb985c initial revision
John W. Eaton <jwe@octave.org>
parents:
diff changeset
36 editing.
dff751fb985c initial revision
John W. Eaton <jwe@octave.org>
parents:
diff changeset
37
dff751fb985c initial revision
John W. Eaton <jwe@octave.org>
parents:
diff changeset
38 Use push parser to parse lines as they become available. Push
dff751fb985c initial revision
John W. Eaton <jwe@octave.org>
parents:
diff changeset
39 parser will return status of parse, either complete or needing
dff751fb985c initial revision
John W. Eaton <jwe@octave.org>
parents:
diff changeset
40 more input.
dff751fb985c initial revision
John W. Eaton <jwe@octave.org>
parents:
diff changeset
41
dff751fb985c initial revision
John W. Eaton <jwe@octave.org>
parents:
diff changeset
42 Uses the following readline callbacks to manage input and update
dff751fb985c initial revision
John W. Eaton <jwe@octave.org>
parents:
diff changeset
43 the display. We may need more in the future to handle other
dff751fb985c initial revision
John W. Eaton <jwe@octave.org>
parents:
diff changeset
44 features.
dff751fb985c initial revision
John W. Eaton <jwe@octave.org>
parents:
diff changeset
45
dff751fb985c initial revision
John W. Eaton <jwe@octave.org>
parents:
diff changeset
46 rl_getc_function
dff751fb985c initial revision
John W. Eaton <jwe@octave.org>
parents:
diff changeset
47 rl_redisplay_function
dff751fb985c initial revision
John W. Eaton <jwe@octave.org>
parents:
diff changeset
48 rl_completion_display_matches_hook
dff751fb985c initial revision
John W. Eaton <jwe@octave.org>
parents:
diff changeset
49
dff751fb985c initial revision
John W. Eaton <jwe@octave.org>
parents:
diff changeset
50 rl_prep_term_function (do nothing)
dff751fb985c initial revision
John W. Eaton <jwe@octave.org>
parents:
diff changeset
51 rl_deprep_term_function (do nothing)
dff751fb985c initial revision
John W. Eaton <jwe@octave.org>
parents:
diff changeset
52
dff751fb985c initial revision
John W. Eaton <jwe@octave.org>
parents:
diff changeset
53 Call rl_callback_handler_install to setup readlines
dff751fb985c initial revision
John W. Eaton <jwe@octave.org>
parents:
diff changeset
54 callback mode. This sets the initial prompt and provides a pointer
dff751fb985c initial revision
John W. Eaton <jwe@octave.org>
parents:
diff changeset
55 to a function that readline should call when a complete line of
dff751fb985c initial revision
John W. Eaton <jwe@octave.org>
parents:
diff changeset
56 input is available.
dff751fb985c initial revision
John W. Eaton <jwe@octave.org>
parents:
diff changeset
57
dff751fb985c initial revision
John W. Eaton <jwe@octave.org>
parents:
diff changeset
58 Call rl_callback_read_char when a character is available for
dff751fb985c initial revision
John W. Eaton <jwe@octave.org>
parents:
diff changeset
59 readline to handle. We currently store the character to read in a
dff751fb985c initial revision
John W. Eaton <jwe@octave.org>
parents:
diff changeset
60 global value, then rl_get_function returns that character to
dff751fb985c initial revision
John W. Eaton <jwe@octave.org>
parents:
diff changeset
61 readline.
dff751fb985c initial revision
John W. Eaton <jwe@octave.org>
parents:
diff changeset
62
dff751fb985c initial revision
John W. Eaton <jwe@octave.org>
parents:
diff changeset
63 Call rl_callback_handler_remove when shutting down.
dff751fb985c initial revision
John W. Eaton <jwe@octave.org>
parents:
diff changeset
64
dff751fb985c initial revision
John W. Eaton <jwe@octave.org>
parents:
diff changeset
65 To avoid global variables, it would be helpful if we could use
dff751fb985c initial revision
John W. Eaton <jwe@octave.org>
parents:
diff changeset
66 lambda functions/functors as callbacks instead of plain C function
dff751fb985c initial revision
John W. Eaton <jwe@octave.org>
parents:
diff changeset
67 pointers.
dff751fb985c initial revision
John W. Eaton <jwe@octave.org>
parents:
diff changeset
68
dff751fb985c initial revision
John W. Eaton <jwe@octave.org>
parents:
diff changeset
69 Questions:
dff751fb985c initial revision
John W. Eaton <jwe@octave.org>
parents:
diff changeset
70
dff751fb985c initial revision
John W. Eaton <jwe@octave.org>
parents:
diff changeset
71 * With this arrangement, would the interpreter have to run in a
dff751fb985c initial revision
John W. Eaton <jwe@octave.org>
parents:
diff changeset
72 separtae thread?
dff751fb985c initial revision
John W. Eaton <jwe@octave.org>
parents:
diff changeset
73
dff751fb985c initial revision
John W. Eaton <jwe@octave.org>
parents:
diff changeset
74 * Example parser currently computes results
dff751fb985c initial revision
John W. Eaton <jwe@octave.org>
parents:
diff changeset
75 immediately. How do we deal with parsing multiple expressions and
dff751fb985c initial revision
John W. Eaton <jwe@octave.org>
parents:
diff changeset
76 statements with this method?
dff751fb985c initial revision
John W. Eaton <jwe@octave.org>
parents:
diff changeset
77
dff751fb985c initial revision
John W. Eaton <jwe@octave.org>
parents:
diff changeset
78 * Do we need text position markers to keep track of the prompt position
dff751fb985c initial revision
John W. Eaton <jwe@octave.org>
parents:
diff changeset
79 (beginning of current line) when inserting or clearing text?