| Line 22... |
Line 22... |
| 22 |
* 2. CONSOLE I/O
|
22 |
* 2. CONSOLE I/O
|
| 23 |
*
|
23 |
*
|
| 24 |
* The first group of functions is concerned with reading and
|
24 |
* The first group of functions is concerned with reading and
|
| 25 |
* writing to the system console.
|
25 |
* writing to the system console.
|
| 26 |
*
|
26 |
*
|
| 27 |
* int R_ReadConsole(char *prompt, char *buf, int buflen, int hist)
|
27 |
* int R_ReadConsole(const char *prompt, unsigned char *buf,
|
| - |
|
28 |
* int buflen, int hist)
|
| 28 |
*
|
29 |
*
|
| 29 |
* This function prints the given prompt at the console and then
|
30 |
* This function prints the given prompt at the console and then
|
| 30 |
* does an fgets(3)-like operation, transferring up to "buflen" bytes
|
31 |
* does an fgets(3)-like operation, transferring up to "buflen" bytes
|
| 31 |
* into the buffer "buf". This should be zero-terminated, and end
|
32 |
* into the buffer "buf". This should be zero-terminated, and end
|
| 32 |
* with "\n\0" if there is no more input available (but not if the
|
33 |
* with "\n\0" if there is no more input available (but not if the
|
| 33 |
* input line exceeds "buflen" bytes). If "hist" is non-zero, then
|
34 |
* input line exceeds "buflen" bytes). If "hist" is non-zero, then
|
| 34 |
* the line is added to any command history which is being maintained.
|
35 |
* the line is added to any command history which is being maintained.
|
| 35 |
* Note that this is one natural place from which to run an event loop.
|
36 |
* Note that this is one natural place from which to run an event loop.
|
| 36 |
*
|
37 |
*
|
| 37 |
* void R_WriteConsole(char *buf, int buflen)
|
38 |
* void R_WriteConsole(const char *buf, int buflen)
|
| 38 |
* void R_WriteConsoleEx(char *buf, int buflen, int otype)
|
39 |
* void R_WriteConsoleEx(const char *buf, int buflen, int otype)
|
| 39 |
*
|
40 |
*
|
| 40 |
* Those functions write the given buffer out to the console. No
|
41 |
* Those functions write the given buffer out to the console. No
|
| 41 |
* special actions are required. Under Unix the characters are
|
42 |
* special actions are required. Under Unix the characters are
|
| 42 |
* just appended to stdout. otype determines whether the content is
|
43 |
* just appended to stdout. otype determines whether the content is
|
| 43 |
* regular output (0) or error/warning (1) and can be used by GUIs
|
44 |
* regular output (0) or error/warning (1) and can be used by GUIs
|
| Line 57... |
Line 58... |
| 57 |
*
|
58 |
*
|
| 58 |
* This function clears any errors associated with reading from the
|
59 |
* This function clears any errors associated with reading from the
|
| 59 |
* console. In Unix it is used to clear any EOF condition associated
|
60 |
* console. In Unix it is used to clear any EOF condition associated
|
| 60 |
* with stdin.
|
61 |
* with stdin.
|
| 61 |
*
|
62 |
*
|
| 62 |
* void R_ShowMessage(char *s)
|
63 |
* void R_ShowMessage(const char *s)
|
| 63 |
*
|
64 |
*
|
| 64 |
* Display the (multi-line) message in the string s. This might be
|
65 |
* Display the (multi-line) message in the string s. This might be
|
| 65 |
* printed on an error stream or displayed in a message dialog box:
|
66 |
* printed on an error stream or displayed in a message dialog box:
|
| 66 |
* it should be brought to the user's attention immediately.
|
67 |
* it should be brought to the user's attention immediately.
|
| 67 |
*
|
68 |
*
|
| Line 96... |
Line 97... |
| 96 |
* This function invokes any actions which occur at system termination.
|
97 |
* This function invokes any actions which occur at system termination.
|
| 97 |
*
|
98 |
*
|
| 98 |
*
|
99 |
*
|
| 99 |
* 5) FILESYSTEM INTERACTION
|
100 |
* 5) FILESYSTEM INTERACTION
|
| 100 |
*
|
101 |
*
|
| 101 |
* int FileExists(char *file)
|
102 |
* int FileExists(const char *file)
|
| 102 |
*
|
103 |
*
|
| 103 |
* This function returns 1 if the named file exists and 0 otherwise.
|
104 |
* This function returns 1 if the named file exists and 0 otherwise.
|
| 104 |
* On Unix/Windows this is just an interface to "stat".
|
105 |
* On Unix/Windows this is just an interface to "stat".
|
| 105 |
*
|
106 |
*
|
| 106 |
* int R_HiddenFile(char *file)
|
107 |
* int R_HiddenFile(const char *file)
|
| 107 |
*
|
108 |
*
|
| 108 |
* This function returns 1 if the named file is "hidden". In Unix,
|
109 |
* This function returns 1 if the named file is "hidden". In Unix,
|
| 109 |
* this is the case if the file name begins with a '.'. On the Mac
|
110 |
* this is the case if the file name begins with a '.'. On the Mac
|
| 110 |
* a file is hidden if the file name ends in '\r'.
|
111 |
* a file is hidden if the file name ends in '\r'.
|
| 111 |
* More complex tests may be needed on other platforms.
|
112 |
* More complex tests may be needed on other platforms.
|
| 112 |
*
|
113 |
*
|
| 113 |
* int R_ShowFiles(int nfile, char **file, char **headers, char *wtitle,
|
114 |
* int R_ShowFiles(int nfile, const char **file, const char **headers,
|
| 114 |
* Rboolean del, char *pager)
|
115 |
* const char *wtitle, Rboolean del, const char *pager)
|
| 115 |
*
|
116 |
*
|
| 116 |
* nfile = number of files
|
117 |
* nfile = number of files
|
| 117 |
* file = array of filenames
|
118 |
* file = array of filenames
|
| 118 |
* headers = the `headers' args of file.show. Printed before each file.
|
119 |
* headers = the `headers' args of file.show. Printed before each file.
|
| 119 |
* wtitle = title for window: the `title' arg of file.show
|
120 |
* wtitle = title for window: the `title' arg of file.show
|
| Line 123... |
Line 124... |
| 123 |
* This function is used to display the contents of files. On (raw)
|
124 |
* This function is used to display the contents of files. On (raw)
|
| 124 |
* Unix this means invoking a pager on the file. On Gui-based platforms
|
125 |
* Unix this means invoking a pager on the file. On Gui-based platforms
|
| 125 |
* the file would probably be displayed in a window with the given
|
126 |
* the file would probably be displayed in a window with the given
|
| 126 |
* title.
|
127 |
* title.
|
| 127 |
*
|
128 |
*
|
| 128 |
* int R_ChooseFile(int new, char *buf, int len)
|
129 |
* int R_ChooseFile(int new, const char *buf, int len)
|
| 129 |
*
|
130 |
*
|
| 130 |
* Choose a file and return its name in buf of length len. On
|
131 |
* Choose a file and return its name in buf of length len. On
|
| 131 |
* command-line systems ask the user, on GUI platforms bring up a
|
132 |
* command-line systems ask the user, on GUI platforms bring up a
|
| 132 |
* dialog box.
|
133 |
* dialog box.
|
| 133 |
*
|
134 |
*
|
| 134 |
* Argument new is designed to choose the style of dialog box
|
135 |
* Argument new is designed to choose the style of dialog box
|
| 135 |
* presented to the user: at present only new = 0 is used. (In
|
136 |
* presented to the user: at present only new = 0 is used. (In
|
| 136 |
* file.choose(new), new is logical.)
|
137 |
* file.choose(new), new is logical.)
|
| 137 |
*
|
138 |
*
|
| 138 |
* char* R_ExpandFileName(char *s)
|
139 |
* char* R_ExpandFileName(const char *s)
|
| 139 |
*
|
140 |
*
|
| 140 |
* This is a utility function which can be used to expand special
|
141 |
* This is a utility function which can be used to expand special
|
| 141 |
* characters in file names. In Unix it's sole function is to expand
|
142 |
* characters in file names. In Unix it's sole function is to expand
|
| 142 |
* and "~"s which occur in filenames. The minimal action is to
|
143 |
* and "~"s which occur in filenames. The minimal action is to
|
| 143 |
* return the argument unaltered.
|
144 |
* return the argument unaltered.
|