The R Project SVN R

Rev

Rev 80171 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 80171 Rev 86820
Line 41... Line 41...
41
  DaviD W. Sanderson, Goran Bostrom, Michael Gleason, Glenn Kasten,
41
  DaviD W. Sanderson, Goran Bostrom, Michael Gleason, Glenn Kasten,
42
  Edin Hodzic, Eric J Bivona, Kai Uwe Rommel, Danny Quah, Ulrich Betzler
42
  Edin Hodzic, Eric J Bivona, Kai Uwe Rommel, Danny Quah, Ulrich Betzler
43
 
43
 
44
PS: I don't have, and don't want to add, a vi mode, sorry.
44
PS: I don't have, and don't want to add, a vi mode, sorry.
45
 
45
 
46
This version is with modifications by R Core, including a Windows port, support
46
This version is with modifications by R Core, including a Windows port,
-
 
47
support for multi-byte characters, support for lines of arbitrary length and
47
for multi-byte characters and partial support for Unicode sequences.
48
partial support for Unicode sequences.
48
 
49
 
49
************************** End-User Interface ***************************
50
************************** End-User Interface ***************************
50
 
51
 
51
Entering printable keys generally inserts new text into the buffer (unless
52
Entering printable keys generally inserts new text into the buffer (unless
52
in overwrite mode, see below).  Other special keys can be used to modify
53
in overwrite mode, see below).  Other special keys can be used to modify
Line 116... Line 117...
116
************************** Programmer Interface ***************************
117
************************** Programmer Interface ***************************
117
 
118
 
118
The programmer accesses input-edit through these functions, and optionally
119
The programmer accesses input-edit through these functions, and optionally
119
through three additional function pointer hooks.  The four functions are:
120
through three additional function pointer hooks.  The four functions are:
120
 
121
 
121
int getline(char *prompt, char *buf, int buflen)
122
int getline(const char *prompt, char *buf, int buflen)
122
 
123
 
123
	Prints the prompt and allows the user to edit the current line.  A
124
	Prints the prompt and allows the user to edit the current line.  A
124
        pointer to a buffer to store the line is passed in "buf" with the
125
        pointer to a buffer to store the line is passed in "buf" with the
125
        length of "buflen".  The user finishes exiting by typing a newline
126
        length of "buflen".  The user finishes exiting by typing a newline
126
        or a return.  The buffer contains the newline character.  The user
127
        or a return.  The buffer contains the newline character.  The user
Line 136... Line 137...
136
        main program should check to make sure this is true.  If input or
137
        main program should check to make sure this is true.  If input or
137
        output have been redirected the main program should use buffered IO
138
        output have been redirected the main program should use buffered IO
138
        (stdio) rather than the slow 1 character read()s that getline uses. 
139
        (stdio) rather than the slow 1 character read()s that getline uses. 
139
        Returns non-zero on EOF.
140
        Returns non-zero on EOF.
140
 
141
 
-
 
142
int getline2(const char *prompt, char **buf)
-
 
143
 
-
 
144
        The same as getline(), but the buffer is allocated dynamically, so
-
 
145
        that the line length is unlimited.  It has to be freed by the caller
-
 
146
        using gl_free().
-
 
147
 
-
 
148
void gl_free(void *ptr)
-
 
149
 
-
 
150
        Free buffer returned by getline2().
-
 
151
 
141
void gl_setwidth(int width)
152
void gl_setwidth(int width)
142
 
153
 
143
        Set the width of the terminal to the specified width. The default
154
        Set the width of the terminal to the specified width. The default
144
	width is 80 characters, so this function need only be called if the
155
	width is 80 characters, so this function need only be called if the
145
	width of the terminal is not 80.  Since horizontal scrolling is
156
	width of the terminal is not 80.  Since horizontal scrolling is