Mercurial > octave
annotate src/sysdep.cc @ 11229:2f36145742c9
eliminate special cases for SCO systems
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Wed, 10 Nov 2010 20:36:16 -0500 |
parents | 89f4d7e294cc |
children | 2f29b765c0ef |
rev | line source |
---|---|
1 | 1 /* |
2 | |
7017 | 3 Copyright (C) 1993, 1994, 1995, 1996, 1997, 1999, 2000, 2002, 2003, |
8920 | 4 2005, 2006, 2007, 2008, 2009 John W. Eaton |
1 | 5 |
6 This file is part of Octave. | |
7 | |
8 Octave is free software; you can redistribute it and/or modify it | |
9 under the terms of the GNU General Public License as published by the | |
7016 | 10 Free Software Foundation; either version 3 of the License, or (at your |
11 option) any later version. | |
1 | 12 |
13 Octave is distributed in the hope that it will be useful, but WITHOUT | |
14 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
15 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
16 for more details. | |
17 | |
18 You should have received a copy of the GNU General Public License | |
7016 | 19 along with Octave; see the file COPYING. If not, see |
20 <http://www.gnu.org/licenses/>. | |
1 | 21 |
22 */ | |
23 | |
240 | 24 #ifdef HAVE_CONFIG_H |
1192 | 25 #include <config.h> |
1 | 26 #endif |
27 | |
1346 | 28 #include <cfloat> |
1343 | 29 #include <cstddef> |
1346 | 30 #include <cstdio> |
1343 | 31 #include <cstdlib> |
32 #include <cstring> | |
33 | |
3503 | 34 #include <iostream> |
1728 | 35 #include <string> |
36 | |
529 | 37 #include <sys/types.h> |
38 #include <unistd.h> | |
1 | 39 |
1430 | 40 #if defined (HAVE_TERMIOS_H) |
41 #include <termios.h> | |
42 #elif defined (HAVE_TERMIO_H) | |
43 #include <termio.h> | |
44 #elif defined (HAVE_SGTTY_H) | |
45 #include <sgtty.h> | |
4067 | 46 #endif |
47 | |
48 #if defined (HAVE_CONIO_H) | |
49 #include <conio.h> | |
1430 | 50 #endif |
51 | |
3248 | 52 #if defined (HAVE_SYS_IOCTL_H) |
53 #include <sys/ioctl.h> | |
54 #endif | |
55 | |
1463 | 56 #if defined (HAVE_FLOATINGPOINT_H) |
57 #include <floatingpoint.h> | |
58 #endif | |
59 | |
2508 | 60 #if defined (HAVE_IEEEFP_H) |
61 #include <ieeefp.h> | |
62 #endif | |
63 | |
2926 | 64 #include "cmd-edit.h" |
65 #include "file-ops.h" | |
2893 | 66 #include "lo-mappers.h" |
7231 | 67 #include "lo-math.h" |
2317 | 68 #include "mach-info.h" |
2926 | 69 #include "oct-env.h" |
5451 | 70 #include "quit.h" |
1769 | 71 |
6208 | 72 #include "Cell.h" |
1352 | 73 #include "defun.h" |
74 #include "error.h" | |
529 | 75 #include "input.h" |
1755 | 76 #include "oct-obj.h" |
2370 | 77 #include "ov.h" |
3234 | 78 #include "pager.h" |
6419 | 79 #include "parse.h" |
5770 | 80 #include "sighandlers.h" |
1352 | 81 #include "sysdep.h" |
1755 | 82 #include "toplev.h" |
529 | 83 #include "utils.h" |
6598 | 84 #include "file-stat.h" |
529 | 85 |
86 #ifndef STDIN_FILENO | |
87 #define STDIN_FILENO 1 | |
88 #endif | |
444 | 89 |
9441
160c564d5d25
initialize floating point values properly for NetBSD systems
Aleksej Saushev <asau@inbox.ru>
parents:
9411
diff
changeset
|
90 #if defined (__386BSD__) || defined (__FreeBSD__) || defined (__NetBSD__) |
2508 | 91 static void |
92 BSD_init (void) | |
93 { | |
94 #if defined (HAVE_FLOATINGPOINT_H) | |
95 // Disable trapping on common exceptions. | |
4164 | 96 #ifndef FP_X_DNML |
97 #define FP_X_DNML 0 | |
98 #endif | |
2508 | 99 fpsetmask (~(FP_X_OFL|FP_X_INV|FP_X_DZ|FP_X_DNML|FP_X_UFL|FP_X_IMP)); |
100 #endif | |
101 } | |
102 #endif | |
103 | |
6956 | 104 #if defined (__WIN32__) && ! defined (_POSIX_VERSION) |
6080 | 105 static void |
106 w32_set_octave_home (void) | |
107 { | |
108 int n = 1024; | |
109 | |
6086 | 110 std::string bin_dir (n, '\0'); |
6080 | 111 |
112 while (true) | |
113 { | |
6954 | 114 HMODULE hMod = GetModuleHandle ("octinterp"); |
115 int status = GetModuleFileName (hMod, &bin_dir[0], n); | |
6080 | 116 |
117 if (status < n) | |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10266
diff
changeset
|
118 { |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10266
diff
changeset
|
119 bin_dir.resize (status); |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10266
diff
changeset
|
120 break; |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10266
diff
changeset
|
121 } |
6080 | 122 else |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10266
diff
changeset
|
123 { |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10266
diff
changeset
|
124 n *= 2; |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10266
diff
changeset
|
125 bin_dir.resize (n); |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10266
diff
changeset
|
126 } |
6080 | 127 } |
128 | |
129 if (! bin_dir.empty ()) | |
130 { | |
131 size_t pos = bin_dir.rfind ("\\bin\\"); | |
132 | |
8021 | 133 if (pos != std::string::npos) |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10266
diff
changeset
|
134 octave_env::putenv ("OCTAVE_HOME", bin_dir.substr (0, pos)); |
6080 | 135 } |
136 } | |
137 | |
6960 | 138 void |
5451 | 139 w32_set_quiet_shutdown (void) |
140 { | |
141 // Let the user close the console window or shutdown without the | |
142 // pesky dialog. | |
143 // | |
5775 | 144 // FIXME -- should this be user configurable? |
5451 | 145 SetProcessShutdownParameters (0x280, SHUTDOWN_NORETRY); |
146 } | |
147 | |
6960 | 148 void |
5451 | 149 MINGW_signal_cleanup (void) |
150 { | |
5455 | 151 w32_set_quiet_shutdown (); |
5451 | 152 |
5455 | 153 w32_raise_final (); |
5451 | 154 } |
155 #endif | |
156 | |
157 #if defined (__MINGW32__) | |
158 static void | |
159 MINGW_init (void) | |
160 { | |
6080 | 161 w32_set_octave_home (); |
162 | |
5451 | 163 // Init mutex to protect setjmp/longjmp and get main thread context |
164 w32_sigint_init (); | |
165 | |
166 w32_set_quiet_shutdown (); | |
167 } | |
168 #endif | |
169 | |
6080 | 170 #if defined (_MSC_VER) |
171 static void | |
172 MSVC_init (void) | |
173 { | |
174 w32_set_octave_home (); | |
6135 | 175 |
176 // Init mutex to protect setjmp/longjmp and get main thread context | |
177 w32_sigint_init (); | |
178 | |
179 w32_set_quiet_shutdown (); | |
6080 | 180 } |
181 #endif | |
182 | |
4091 | 183 |
6598 | 184 // Return TRUE if FILE1 and FILE2 refer to the same (physical) file. |
185 | |
186 bool | |
187 same_file_internal (const std::string& file1, const std::string& file2) | |
188 { | |
189 #ifdef OCTAVE_USE_WINDOWS_API | |
190 | |
6691 | 191 bool retval = false; |
192 | |
6598 | 193 // Windows native code |
194 // Reference: http://msdn2.microsoft.com/en-us/library/aa363788.aspx | |
195 | |
6691 | 196 HANDLE hfile1 = CreateFile (file1.c_str (), 0, FILE_SHARE_READ, 0, |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10266
diff
changeset
|
197 OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0); |
6691 | 198 |
199 if (hfile1 != INVALID_HANDLE_VALUE) | |
200 { | |
201 HANDLE hfile2 = CreateFile (file2.c_str (), 0, FILE_SHARE_READ, 0, | |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10266
diff
changeset
|
202 OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0); |
6598 | 203 |
6691 | 204 if (hfile2 != INVALID_HANDLE_VALUE) |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10266
diff
changeset
|
205 { |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10266
diff
changeset
|
206 BY_HANDLE_FILE_INFORMATION hfi1; |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10266
diff
changeset
|
207 BY_HANDLE_FILE_INFORMATION hfi2; |
6691 | 208 |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10266
diff
changeset
|
209 if (GetFileInformationByHandle (hfile1, &hfi1) |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10266
diff
changeset
|
210 && GetFileInformationByHandle (hfile2, &hfi2)) |
6598 | 211 |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10266
diff
changeset
|
212 retval = (hfi1.dwVolumeSerialNumber == hfi2.dwVolumeSerialNumber |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10266
diff
changeset
|
213 && hfi1.nFileIndexHigh == hfi2.nFileIndexHigh |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10266
diff
changeset
|
214 && hfi1.nFileIndexLow == hfi2.nFileIndexLow); |
6598 | 215 |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10266
diff
changeset
|
216 CloseHandle (hfile2); |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10266
diff
changeset
|
217 } |
6691 | 218 |
6598 | 219 CloseHandle (hfile1); |
220 } | |
6691 | 221 |
222 return retval; | |
6598 | 223 |
224 #else | |
225 | |
226 // POSIX Code | |
227 | |
228 file_stat fs_file1 (file1); | |
229 file_stat fs_file2 (file2); | |
230 | |
231 return (fs_file1 && fs_file2 | |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10266
diff
changeset
|
232 && fs_file1.ino () == fs_file2.ino () |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10266
diff
changeset
|
233 && fs_file1.dev () == fs_file2.dev ()); |
6598 | 234 |
235 #endif | |
236 } | |
237 | |
4284 | 238 #if defined (__DECCXX) |
239 | |
240 // These don't seem to be instantiated automatically... | |
241 | |
242 template std::istream& | |
243 std::operator >> (std::istream&, std::complex<double>&); | |
244 | |
245 template std::string& | |
246 std::string::append (const std::string&, size_t, size_t); | |
247 | |
248 #endif | |
249 | |
2610 | 250 #if defined (NeXT) |
1 | 251 extern "C" |
252 { | |
253 typedef void (*_cplus_fcn_int) (int); | |
254 extern void (*malloc_error (_cplus_fcn_int)) (int); | |
255 } | |
256 | |
257 static void | |
258 malloc_handler (int code) | |
259 { | |
260 if (code == 5) | |
217 | 261 warning ("hopefully recoverable malloc error: freeing wild pointer"); |
1 | 262 else |
2926 | 263 panic ("probably irrecoverable malloc error: code %d", code); |
1 | 264 } |
265 | |
266 static void | |
267 NeXT_init (void) | |
268 { | |
269 malloc_error (malloc_handler); | |
270 } | |
3333 | 271 #endif |
1 | 272 |
2546 | 273 #if defined (__EMX__) |
274 OS2_init (void) | |
275 { | |
276 _control87 ((EM_INVALID | EM_DENORMAL | EM_ZERODIVIDE | EM_OVERFLOW | |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10266
diff
changeset
|
277 | EM_UNDERFLOW | EM_INEXACT), MCW_EM); |
2546 | 278 } |
279 #endif | |
280 | |
1 | 281 void |
282 sysdep_init (void) | |
283 { | |
9441
160c564d5d25
initialize floating point values properly for NetBSD systems
Aleksej Saushev <asau@inbox.ru>
parents:
9411
diff
changeset
|
284 #if defined (__386BSD__) || defined (__FreeBSD__) || defined(__NetBSD__) |
2508 | 285 BSD_init (); |
5451 | 286 #elif defined (__MINGW32__) |
287 MINGW_init (); | |
6080 | 288 #elif defined (_MSC_VER) |
289 MSVC_init (); | |
2610 | 290 #elif defined (NeXT) |
1 | 291 NeXT_init (); |
2610 | 292 #elif defined (__EMX__) |
2546 | 293 OS2_init (); |
1 | 294 #endif |
444 | 295 |
296 octave_ieee_init (); | |
1 | 297 } |
298 | |
5451 | 299 void |
300 sysdep_cleanup (void) | |
301 { | |
302 MINGW_SIGNAL_CLEANUP (); | |
303 } | |
304 | |
767 | 305 // Set terminal in raw mode. From less-177. |
306 // | |
307 // Change terminal to "raw mode", or restore to "normal" mode. | |
308 // "Raw mode" means | |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10266
diff
changeset
|
309 // 1. An outstanding read will complete on receipt of a single keystroke. |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10266
diff
changeset
|
310 // 2. Input is not echoed. |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10266
diff
changeset
|
311 // 3. On output, \n is mapped to \r\n. |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10266
diff
changeset
|
312 // 4. \t is NOT expanded into spaces. |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10266
diff
changeset
|
313 // 5. Signal-causing characters such as ctrl-C (interrupt), |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10266
diff
changeset
|
314 // etc. are NOT disabled. |
767 | 315 // It doesn't matter whether an input \n is mapped to \r, or vice versa. |
316 | |
529 | 317 void |
3657 | 318 raw_mode (bool on, bool wait) |
529 | 319 { |
3657 | 320 static bool curr_on = false; |
529 | 321 |
322 int tty_fd = STDIN_FILENO; | |
323 if (! isatty (tty_fd)) | |
324 { | |
325 if (interactive) | |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10266
diff
changeset
|
326 error ("stdin is not a tty!"); |
529 | 327 return; |
328 } | |
329 | |
330 if (on == curr_on) | |
331 return; | |
332 | |
333 #if defined (HAVE_TERMIOS_H) | |
334 { | |
335 struct termios s; | |
336 static struct termios save_term; | |
337 | |
338 if (on) | |
339 { | |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10266
diff
changeset
|
340 // Get terminal modes. |
529 | 341 |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10266
diff
changeset
|
342 tcgetattr (tty_fd, &s); |
529 | 343 |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10266
diff
changeset
|
344 // Save modes and set certain variables dependent on modes. |
529 | 345 |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10266
diff
changeset
|
346 save_term = s; |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10266
diff
changeset
|
347 // ospeed = s.c_cflag & CBAUD; |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10266
diff
changeset
|
348 // erase_char = s.c_cc[VERASE]; |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10266
diff
changeset
|
349 // kill_char = s.c_cc[VKILL]; |
529 | 350 |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10266
diff
changeset
|
351 // Set the modes to the way we want them. |
529 | 352 |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10266
diff
changeset
|
353 s.c_lflag &= ~(ICANON|ECHO|ECHOE|ECHOK|ECHONL); |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10266
diff
changeset
|
354 s.c_oflag |= (OPOST|ONLCR); |
529 | 355 #if defined (OCRNL) |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10266
diff
changeset
|
356 s.c_oflag &= ~(OCRNL); |
529 | 357 #endif |
358 #if defined (ONOCR) | |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10266
diff
changeset
|
359 s.c_oflag &= ~(ONOCR); |
529 | 360 #endif |
361 #if defined (ONLRET) | |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10266
diff
changeset
|
362 s.c_oflag &= ~(ONLRET); |
529 | 363 #endif |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10266
diff
changeset
|
364 s.c_cc[VMIN] = wait ? 1 : 0; |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10266
diff
changeset
|
365 s.c_cc[VTIME] = 0; |
529 | 366 } |
367 else | |
368 { | |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10266
diff
changeset
|
369 // Restore saved modes. |
1358 | 370 |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10266
diff
changeset
|
371 s = save_term; |
529 | 372 } |
3658 | 373 |
9411
c9636d98e5cd
fix kbhit(1) to not discard waiting keystrokes
Joe Rothweiler <octaveuser@sensicomm.com>
parents:
9242
diff
changeset
|
374 tcsetattr (tty_fd, wait ? TCSAFLUSH : TCSADRAIN, &s); |
529 | 375 } |
376 #elif defined (HAVE_TERMIO_H) | |
377 { | |
378 struct termio s; | |
379 static struct termio save_term; | |
380 | |
381 if (on) | |
382 { | |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10266
diff
changeset
|
383 // Get terminal modes. |
529 | 384 |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10266
diff
changeset
|
385 ioctl (tty_fd, TCGETA, &s); |
529 | 386 |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10266
diff
changeset
|
387 // Save modes and set certain variables dependent on modes. |
529 | 388 |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10266
diff
changeset
|
389 save_term = s; |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10266
diff
changeset
|
390 // ospeed = s.c_cflag & CBAUD; |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10266
diff
changeset
|
391 // erase_char = s.c_cc[VERASE]; |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10266
diff
changeset
|
392 // kill_char = s.c_cc[VKILL]; |
529 | 393 |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10266
diff
changeset
|
394 // Set the modes to the way we want them. |
529 | 395 |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10266
diff
changeset
|
396 s.c_lflag &= ~(ICANON|ECHO|ECHOE|ECHOK|ECHONL); |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10266
diff
changeset
|
397 s.c_oflag |= (OPOST|ONLCR); |
529 | 398 #if defined (OCRNL) |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10266
diff
changeset
|
399 s.c_oflag &= ~(OCRNL); |
529 | 400 #endif |
401 #if defined (ONOCR) | |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10266
diff
changeset
|
402 s.c_oflag &= ~(ONOCR); |
529 | 403 #endif |
404 #if defined (ONLRET) | |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10266
diff
changeset
|
405 s.c_oflag &= ~(ONLRET); |
529 | 406 #endif |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10266
diff
changeset
|
407 s.c_cc[VMIN] = wait ? 1 : 0; |
529 | 408 } |
409 else | |
410 { | |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10266
diff
changeset
|
411 // Restore saved modes. |
1358 | 412 |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10266
diff
changeset
|
413 s = save_term; |
529 | 414 } |
3658 | 415 |
529 | 416 ioctl (tty_fd, TCSETAW, &s); |
417 } | |
418 #elif defined (HAVE_SGTTY_H) | |
419 { | |
420 struct sgttyb s; | |
421 static struct sgttyb save_term; | |
422 | |
423 if (on) | |
424 { | |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10266
diff
changeset
|
425 // Get terminal modes. |
529 | 426 |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10266
diff
changeset
|
427 ioctl (tty_fd, TIOCGETP, &s); |
529 | 428 |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10266
diff
changeset
|
429 // Save modes and set certain variables dependent on modes. |
529 | 430 |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10266
diff
changeset
|
431 save_term = s; |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10266
diff
changeset
|
432 // ospeed = s.sg_ospeed; |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10266
diff
changeset
|
433 // erase_char = s.sg_erase; |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10266
diff
changeset
|
434 // kill_char = s.sg_kill; |
529 | 435 |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10266
diff
changeset
|
436 // Set the modes to the way we want them. |
529 | 437 |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10266
diff
changeset
|
438 s.sg_flags |= CBREAK; |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10266
diff
changeset
|
439 s.sg_flags &= ~(ECHO); |
529 | 440 } |
441 else | |
442 { | |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10266
diff
changeset
|
443 // Restore saved modes. |
1358 | 444 |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10266
diff
changeset
|
445 s = save_term; |
529 | 446 } |
3658 | 447 |
529 | 448 ioctl (tty_fd, TIOCSETN, &s); |
449 } | |
450 #else | |
4064 | 451 warning ("no support for raw mode console I/O on this system"); |
452 | |
453 // Make sure the current mode doesn't toggle. | |
454 on = curr_on; | |
529 | 455 #endif |
456 | |
457 curr_on = on; | |
458 } | |
459 | |
6726 | 460 FILE * |
461 octave_popen (const char *command, const char *mode) | |
462 { | |
463 #if defined (__MINGW32__) || defined (_MSC_VER) | |
464 if (mode && mode[0] && ! mode[1]) | |
465 { | |
466 char tmode[3]; | |
467 tmode[0] = mode[0]; | |
468 tmode[1] = 'b'; | |
469 tmode[2] = 0; | |
470 | |
471 return _popen (command, tmode); | |
472 } | |
473 else | |
474 return _popen (command, mode); | |
475 #else | |
476 return popen (command, mode); | |
477 #endif | |
478 } | |
479 | |
480 int | |
481 octave_pclose (FILE *f) | |
482 { | |
483 #if defined (__MINGW32__) || defined (_MSC_VER) | |
484 return _pclose (f); | |
485 #else | |
486 return pclose (f); | |
487 #endif | |
488 } | |
489 | |
767 | 490 // Read one character from the terminal. |
491 | |
529 | 492 int |
4067 | 493 octave_kbhit (bool wait) |
529 | 494 { |
4067 | 495 #ifdef HAVE__KBHIT |
4081 | 496 int c = (! wait && ! _kbhit ()) ? 0 : std::cin.get (); |
4067 | 497 #else |
3658 | 498 raw_mode (true, wait); |
499 | |
5770 | 500 // Get current handler. |
501 octave_interrupt_handler saved_interrupt_handler | |
502 = octave_ignore_interrupts (); | |
503 | |
504 // Restore it, disabling system call restarts (if possible) so the | |
505 // read can be interrupted. | |
506 | |
507 octave_set_interrupt_handler (saved_interrupt_handler, false); | |
508 | |
3658 | 509 int c = std::cin.get (); |
5770 | 510 |
3658 | 511 if (std::cin.fail () || std::cin.eof ()) |
512 std::cin.clear (); | |
513 | |
5770 | 514 // Restore it, enabling system call restarts (if possible). |
515 octave_set_interrupt_handler (saved_interrupt_handler, true); | |
516 | |
3658 | 517 raw_mode (false, true); |
4067 | 518 #endif |
3658 | 519 |
529 | 520 return c; |
521 } | |
522 | |
1957 | 523 DEFUN (clc, , , |
3332 | 524 "-*- texinfo -*-\n\ |
10840 | 525 @deftypefn {Built-in Function} {} clc ()\n\ |
3332 | 526 @deftypefnx {Built-in Function} {} home ()\n\ |
527 Clear the terminal screen and move the cursor to the upper left corner.\n\ | |
3333 | 528 @end deftypefn") |
529 | 529 { |
2926 | 530 command_editor::clear_screen (); |
529 | 531 |
2926 | 532 return octave_value_list (); |
529 | 533 } |
534 | |
549 | 535 DEFALIAS (home, clc); |
536 | |
1957 | 537 DEFUN (getenv, args, , |
3301 | 538 "-*- texinfo -*-\n\ |
539 @deftypefn {Built-in Function} {} getenv (@var{var})\n\ | |
540 Return the value of the environment variable @var{var}. For example,\n\ | |
541 \n\ | |
542 @example\n\ | |
543 getenv (\"PATH\")\n\ | |
544 @end example\n\ | |
545 \n\ | |
546 @noindent\n\ | |
547 returns a string containing the value of your path.\n\ | |
548 @end deftypefn") | |
529 | 549 { |
4233 | 550 octave_value retval; |
529 | 551 |
552 int nargin = args.length (); | |
553 | |
712 | 554 if (nargin == 1) |
529 | 555 { |
3523 | 556 std::string name = args(0).string_value (); |
636 | 557 |
558 if (! error_state) | |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10266
diff
changeset
|
559 retval = octave_env::getenv (name); |
529 | 560 } |
561 else | |
5823 | 562 print_usage (); |
529 | 563 |
564 return retval; | |
565 } | |
566 | |
1957 | 567 DEFUN (putenv, args, , |
3301 | 568 "-*- texinfo -*-\n\ |
10840 | 569 @deftypefn {Built-in Function} {} putenv (@var{var}, @var{value})\n\ |
7759
84a7f00586aa
Alias setenv to putenv. Allow single arg to putenv
David Bateman <dbateman@free.fr>
parents:
7231
diff
changeset
|
570 @deftypefnx {Built-in Function} {} setenv (@var{var}, @var{value})\n\ |
3301 | 571 Set the value of the environment variable @var{var} to @var{value}.\n\ |
572 @end deftypefn") | |
1706 | 573 { |
2086 | 574 octave_value_list retval; |
1706 | 575 |
576 int nargin = args.length (); | |
577 | |
7759
84a7f00586aa
Alias setenv to putenv. Allow single arg to putenv
David Bateman <dbateman@free.fr>
parents:
7231
diff
changeset
|
578 if (nargin == 2 || nargin == 1) |
1706 | 579 { |
3523 | 580 std::string var = args(0).string_value (); |
1706 | 581 |
582 if (! error_state) | |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10266
diff
changeset
|
583 { |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10266
diff
changeset
|
584 std::string val = (nargin == 2 |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10266
diff
changeset
|
585 ? args(1).string_value () : std::string ()); |
1706 | 586 |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10266
diff
changeset
|
587 if (! error_state) |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10266
diff
changeset
|
588 octave_env::putenv (var, val); |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10266
diff
changeset
|
589 else |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10266
diff
changeset
|
590 error ("putenv: second argument should be a string"); |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10266
diff
changeset
|
591 } |
1706 | 592 else |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10266
diff
changeset
|
593 error ("putenv: first argument should be a string"); |
1706 | 594 } |
595 else | |
5823 | 596 print_usage (); |
1706 | 597 |
598 return retval; | |
599 } | |
7759
84a7f00586aa
Alias setenv to putenv. Allow single arg to putenv
David Bateman <dbateman@free.fr>
parents:
7231
diff
changeset
|
600 DEFALIAS (setenv, putenv); |
1706 | 601 |
5775 | 602 // FIXME -- perhaps kbhit should also be able to print a prompt? |
3372 | 603 |
3657 | 604 DEFUN (kbhit, args, , |
3372 | 605 "-*- texinfo -*-\n\ |
606 @deftypefn {Built-in Function} {} kbhit ()\n\ | |
9039
51dc9691f23f
Cleanup documentation files errors.texi, debug.texi, io.texi
Rik <rdrider0-list@yahoo.com>
parents:
8920
diff
changeset
|
607 Read a single keystroke from the keyboard. If called with one\n\ |
3657 | 608 argument, don't wait for a keypress. For example,\n\ |
3372 | 609 \n\ |
610 @example\n\ | |
611 x = kbhit ();\n\ | |
612 @end example\n\ | |
613 \n\ | |
614 @noindent\n\ | |
615 will set @var{x} to the next character typed at the keyboard as soon as\n\ | |
616 it is typed.\n\ | |
3657 | 617 \n\ |
618 @example\n\ | |
619 x = kbhit (1);\n\ | |
620 @end example\n\ | |
621 \n\ | |
622 @noindent\n\ | |
623 identical to the above example, but don't wait for a keypress,\n\ | |
624 returning the empty string if no key is available.\n\ | |
3372 | 625 @end deftypefn") |
529 | 626 { |
4233 | 627 octave_value retval; |
529 | 628 |
5775 | 629 // FIXME -- add timeout and default value args? |
529 | 630 |
3676 | 631 if (interactive || forced_interactive) |
529 | 632 { |
6423 | 633 feval ("drawnow"); |
634 | |
4067 | 635 int c = octave_kbhit (args.length () == 0); |
3657 | 636 |
3658 | 637 if (c == -1) |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10266
diff
changeset
|
638 c = 0; |
3657 | 639 |
529 | 640 char *s = new char [2]; |
641 s[0] = c; | |
642 s[1] = '\0'; | |
643 retval = s; | |
644 } | |
645 | |
646 return retval; | |
647 } | |
648 | |
1957 | 649 DEFUN (pause, args, , |
3301 | 650 "-*- texinfo -*-\n\ |
651 @deftypefn {Built-in Function} {} pause (@var{seconds})\n\ | |
652 Suspend the execution of the program. If invoked without any arguments,\n\ | |
653 Octave waits until you type a character. With a numeric argument, it\n\ | |
654 pauses for the given number of seconds. For example, the following\n\ | |
655 statement prints a message and then waits 5 seconds before clearing the\n\ | |
656 screen.\n\ | |
657 \n\ | |
658 @example\n\ | |
659 @group\n\ | |
6848 | 660 fprintf (stderr, \"wait please...\\n\");\n\ |
3301 | 661 pause (5);\n\ |
662 clc;\n\ | |
663 @end group\n\ | |
664 @end example\n\ | |
665 @end deftypefn") | |
529 | 666 { |
2086 | 667 octave_value_list retval; |
529 | 668 |
669 int nargin = args.length (); | |
670 | |
712 | 671 if (! (nargin == 0 || nargin == 1)) |
529 | 672 { |
5823 | 673 print_usage (); |
529 | 674 return retval; |
675 } | |
676 | |
1579 | 677 if (nargin == 1) |
529 | 678 { |
1579 | 679 double dval = args(0).double_value (); |
636 | 680 |
1579 | 681 if (! error_state) |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10266
diff
changeset
|
682 { |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10266
diff
changeset
|
683 if (! xisnan (dval)) |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10266
diff
changeset
|
684 { |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10266
diff
changeset
|
685 feval ("drawnow"); |
6419 | 686 |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10266
diff
changeset
|
687 if (xisinf (dval)) |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10266
diff
changeset
|
688 { |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10266
diff
changeset
|
689 flush_octave_stdout (); |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10266
diff
changeset
|
690 octave_kbhit (); |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10266
diff
changeset
|
691 } |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10266
diff
changeset
|
692 else |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10266
diff
changeset
|
693 octave_sleep (dval); |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10266
diff
changeset
|
694 } |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10266
diff
changeset
|
695 else |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10266
diff
changeset
|
696 warning ("pause: NaN is an invalid delay"); |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10266
diff
changeset
|
697 } |
529 | 698 } |
1579 | 699 else |
3234 | 700 { |
6423 | 701 feval ("drawnow"); |
3234 | 702 flush_octave_stdout (); |
4067 | 703 octave_kbhit (); |
3234 | 704 } |
2630 | 705 |
706 return retval; | |
707 } | |
708 | |
709 DEFUN (sleep, args, , | |
3301 | 710 "-*- texinfo -*-\n\ |
711 @deftypefn {Built-in Function} {} sleep (@var{seconds})\n\ | |
712 Suspend the execution of the program for the given number of seconds.\n\ | |
713 @end deftypefn") | |
2630 | 714 { |
715 octave_value_list retval; | |
716 | |
717 if (args.length () == 1) | |
1579 | 718 { |
2630 | 719 double dval = args(0).double_value (); |
720 | |
721 if (! error_state) | |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10266
diff
changeset
|
722 { |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10266
diff
changeset
|
723 if (xisnan (dval)) |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10266
diff
changeset
|
724 warning ("sleep: NaN is an invalid delay"); |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10266
diff
changeset
|
725 else |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10266
diff
changeset
|
726 { |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10266
diff
changeset
|
727 feval ("drawnow"); |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10266
diff
changeset
|
728 octave_sleep (dval); |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10266
diff
changeset
|
729 } |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10266
diff
changeset
|
730 } |
1579 | 731 } |
2630 | 732 else |
5823 | 733 print_usage (); |
2630 | 734 |
735 return retval; | |
736 } | |
737 | |
738 DEFUN (usleep, args, , | |
3301 | 739 "-*- texinfo -*-\n\ |
740 @deftypefn {Built-in Function} {} usleep (@var{microseconds})\n\ | |
741 Suspend the execution of the program for the given number of\n\ | |
742 microseconds. On systems where it is not possible to sleep for periods\n\ | |
743 of time less than one second, @code{usleep} will pause the execution for\n\ | |
744 @code{round (@var{microseconds} / 1e6)} seconds.\n\ | |
745 @end deftypefn") | |
2630 | 746 { |
747 octave_value_list retval; | |
748 | |
749 if (args.length () == 1) | |
750 { | |
751 double dval = args(0).double_value (); | |
752 | |
753 if (! error_state) | |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10266
diff
changeset
|
754 { |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10266
diff
changeset
|
755 if (xisnan (dval)) |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10266
diff
changeset
|
756 warning ("usleep: NaN is an invalid delay"); |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10266
diff
changeset
|
757 else |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10266
diff
changeset
|
758 { |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10266
diff
changeset
|
759 feval ("drawnow"); |
6423 | 760 |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10266
diff
changeset
|
761 int delay = NINT (dval); |
2631 | 762 |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10266
diff
changeset
|
763 if (delay > 0) |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10266
diff
changeset
|
764 octave_usleep (delay); |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10266
diff
changeset
|
765 } |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10266
diff
changeset
|
766 } |
2630 | 767 } |
768 else | |
5823 | 769 print_usage (); |
529 | 770 |
771 return retval; | |
772 } | |
773 | |
5775 | 774 // FIXME -- maybe this should only return 1 if IEEE floating |
862 | 775 // point functions really work. |
776 | |
1957 | 777 DEFUN (isieee, , , |
3301 | 778 "-*- texinfo -*-\n\ |
779 @deftypefn {Built-in Function} {} isieee ()\n\ | |
780 Return 1 if your computer claims to conform to the IEEE standard for\n\ | |
781 floating point calculations.\n\ | |
782 @end deftypefn") | |
862 | 783 { |
4600 | 784 oct_mach_info::float_format flt_fmt = oct_mach_info::native_float_format (); |
2317 | 785 |
4574 | 786 return octave_value (flt_fmt == oct_mach_info::flt_fmt_ieee_little_endian |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10266
diff
changeset
|
787 || flt_fmt == oct_mach_info::flt_fmt_ieee_big_endian); |
862 | 788 } |
789 | |
4600 | 790 DEFUN (native_float_format, , , |
791 "-*- texinfo -*-\n\ | |
792 @deftypefn {Built-in Function} {} native_float_format ()\n\ | |
793 Return the native floating point format as a string\n\ | |
794 @end deftypefn") | |
795 { | |
796 oct_mach_info::float_format flt_fmt = oct_mach_info::native_float_format (); | |
797 | |
798 return octave_value (oct_mach_info::float_format_as_string (flt_fmt)); | |
799 } | |
800 | |
1957 | 801 DEFUN (tilde_expand, args, , |
3301 | 802 "-*- texinfo -*-\n\ |
803 @deftypefn {Built-in Function} {} tilde_expand (@var{string})\n\ | |
804 Performs tilde expansion on @var{string}. If @var{string} begins with a\n\ | |
805 tilde character, (@samp{~}), all of the characters preceding the first\n\ | |
806 slash (or all characters, if there is no slash) are treated as a\n\ | |
807 possible user name, and the tilde and the following characters up to the\n\ | |
808 slash are replaced by the home directory of the named user. If the\n\ | |
809 tilde is followed immediately by a slash, the tilde is replaced by the\n\ | |
10840 | 810 home directory of the user running Octave. For example:\n\ |
3301 | 811 \n\ |
812 @example\n\ | |
813 @group\n\ | |
814 tilde_expand (\"~joeuser/bin\")\n\ | |
815 @result{} \"/home/joeuser/bin\"\n\ | |
816 tilde_expand (\"~/bin\")\n\ | |
817 @result{} \"/home/jwe/bin\"\n\ | |
818 @end group\n\ | |
819 @end example\n\ | |
820 @end deftypefn") | |
1750 | 821 { |
4233 | 822 octave_value retval; |
1750 | 823 |
824 int nargin = args.length (); | |
825 | |
826 if (nargin == 1) | |
6116 | 827 { |
828 octave_value arg = args(0); | |
829 | |
830 string_vector sv = arg.all_strings (); | |
831 | |
832 if (! error_state) | |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10266
diff
changeset
|
833 { |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10266
diff
changeset
|
834 sv = file_ops::tilde_expand (sv); |
6116 | 835 |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10266
diff
changeset
|
836 if (arg.is_cellstr ()) |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10266
diff
changeset
|
837 retval = Cell (arg.dims (), sv); |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10266
diff
changeset
|
838 else |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10266
diff
changeset
|
839 retval = sv; |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10266
diff
changeset
|
840 } |
6116 | 841 else |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10266
diff
changeset
|
842 error ("tilde_expand: expecting argument to be char or cellstr object"); |
6116 | 843 } |
1750 | 844 else |
5823 | 845 print_usage (); |
1750 | 846 |
847 return retval; | |
848 } | |
849 | |
2552 | 850 #if defined (__EMX__) && defined (OS2) |
851 | |
8746
5dd06f19e9be
handle commands in the lexer
John W. Eaton <jwe@octave.org>
parents:
8021
diff
changeset
|
852 DEFUN (extproc, , , |
2926 | 853 "extproc: ignored by Octave") |
2552 | 854 { |
855 return octave_value_list (); | |
856 } | |
857 | |
858 DEFALIAS (EXTPROC, extproc); | |
859 | |
860 #endif |