Mercurial > hg > octave-nkf
annotate src/sysdep.cc @ 10840:89f4d7e294cc
Grammarcheck .cc files
author | Rik <octave@nomad.inbox5.com> |
---|---|
date | Sat, 31 Jul 2010 11:18:11 -0700 |
parents | 57a59eae83cc |
children | 2f36145742c9 |
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 | |
2508 | 281 #if defined (SCO) |
282 static void | |
283 SCO_init (void) | |
284 { | |
285 #if defined (HAVE_IEEEFP_H) | |
286 // Disable trapping on common exceptions. | |
287 fpsetmask (~(FP_X_OFL|FP_X_INV|FP_X_DZ|FP_X_DNML|FP_X_UFL|FP_X_IMP)); | |
288 #endif | |
289 } | |
290 #endif | |
291 | |
1 | 292 void |
293 sysdep_init (void) | |
294 { | |
9441
160c564d5d25
initialize floating point values properly for NetBSD systems
Aleksej Saushev <asau@inbox.ru>
parents:
9411
diff
changeset
|
295 #if defined (__386BSD__) || defined (__FreeBSD__) || defined(__NetBSD__) |
2508 | 296 BSD_init (); |
5451 | 297 #elif defined (__MINGW32__) |
298 MINGW_init (); | |
6080 | 299 #elif defined (_MSC_VER) |
300 MSVC_init (); | |
2610 | 301 #elif defined (NeXT) |
1 | 302 NeXT_init (); |
2610 | 303 #elif defined (__EMX__) |
2546 | 304 OS2_init (); |
2508 | 305 #elif defined (SCO) |
306 SCO_init (); | |
1 | 307 #endif |
444 | 308 |
309 octave_ieee_init (); | |
1 | 310 } |
311 | |
5451 | 312 void |
313 sysdep_cleanup (void) | |
314 { | |
315 MINGW_SIGNAL_CLEANUP (); | |
316 } | |
317 | |
767 | 318 // Set terminal in raw mode. From less-177. |
319 // | |
320 // Change terminal to "raw mode", or restore to "normal" mode. | |
321 // "Raw mode" means | |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10266
diff
changeset
|
322 // 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
|
323 // 2. Input is not echoed. |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10266
diff
changeset
|
324 // 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
|
325 // 4. \t is NOT expanded into spaces. |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10266
diff
changeset
|
326 // 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
|
327 // etc. are NOT disabled. |
767 | 328 // It doesn't matter whether an input \n is mapped to \r, or vice versa. |
329 | |
529 | 330 void |
3657 | 331 raw_mode (bool on, bool wait) |
529 | 332 { |
3657 | 333 static bool curr_on = false; |
529 | 334 |
335 int tty_fd = STDIN_FILENO; | |
336 if (! isatty (tty_fd)) | |
337 { | |
338 if (interactive) | |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10266
diff
changeset
|
339 error ("stdin is not a tty!"); |
529 | 340 return; |
341 } | |
342 | |
343 if (on == curr_on) | |
344 return; | |
345 | |
346 #if defined (HAVE_TERMIOS_H) | |
347 { | |
348 struct termios s; | |
349 static struct termios save_term; | |
350 | |
351 if (on) | |
352 { | |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10266
diff
changeset
|
353 // Get terminal modes. |
529 | 354 |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10266
diff
changeset
|
355 tcgetattr (tty_fd, &s); |
529 | 356 |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10266
diff
changeset
|
357 // Save modes and set certain variables dependent on modes. |
529 | 358 |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10266
diff
changeset
|
359 save_term = s; |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10266
diff
changeset
|
360 // ospeed = s.c_cflag & CBAUD; |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10266
diff
changeset
|
361 // erase_char = s.c_cc[VERASE]; |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10266
diff
changeset
|
362 // kill_char = s.c_cc[VKILL]; |
529 | 363 |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10266
diff
changeset
|
364 // Set the modes to the way we want them. |
529 | 365 |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10266
diff
changeset
|
366 s.c_lflag &= ~(ICANON|ECHO|ECHOE|ECHOK|ECHONL); |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10266
diff
changeset
|
367 s.c_oflag |= (OPOST|ONLCR); |
529 | 368 #if defined (OCRNL) |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10266
diff
changeset
|
369 s.c_oflag &= ~(OCRNL); |
529 | 370 #endif |
371 #if defined (ONOCR) | |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10266
diff
changeset
|
372 s.c_oflag &= ~(ONOCR); |
529 | 373 #endif |
374 #if defined (ONLRET) | |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10266
diff
changeset
|
375 s.c_oflag &= ~(ONLRET); |
529 | 376 #endif |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10266
diff
changeset
|
377 s.c_cc[VMIN] = wait ? 1 : 0; |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10266
diff
changeset
|
378 s.c_cc[VTIME] = 0; |
529 | 379 } |
380 else | |
381 { | |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10266
diff
changeset
|
382 // Restore saved modes. |
1358 | 383 |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10266
diff
changeset
|
384 s = save_term; |
529 | 385 } |
3658 | 386 |
9411
c9636d98e5cd
fix kbhit(1) to not discard waiting keystrokes
Joe Rothweiler <octaveuser@sensicomm.com>
parents:
9242
diff
changeset
|
387 tcsetattr (tty_fd, wait ? TCSAFLUSH : TCSADRAIN, &s); |
529 | 388 } |
389 #elif defined (HAVE_TERMIO_H) | |
390 { | |
391 struct termio s; | |
392 static struct termio save_term; | |
393 | |
394 if (on) | |
395 { | |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10266
diff
changeset
|
396 // Get terminal modes. |
529 | 397 |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10266
diff
changeset
|
398 ioctl (tty_fd, TCGETA, &s); |
529 | 399 |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10266
diff
changeset
|
400 // Save modes and set certain variables dependent on modes. |
529 | 401 |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10266
diff
changeset
|
402 save_term = s; |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10266
diff
changeset
|
403 // ospeed = s.c_cflag & CBAUD; |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10266
diff
changeset
|
404 // erase_char = s.c_cc[VERASE]; |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10266
diff
changeset
|
405 // kill_char = s.c_cc[VKILL]; |
529 | 406 |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10266
diff
changeset
|
407 // Set the modes to the way we want them. |
529 | 408 |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10266
diff
changeset
|
409 s.c_lflag &= ~(ICANON|ECHO|ECHOE|ECHOK|ECHONL); |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10266
diff
changeset
|
410 s.c_oflag |= (OPOST|ONLCR); |
529 | 411 #if defined (OCRNL) |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10266
diff
changeset
|
412 s.c_oflag &= ~(OCRNL); |
529 | 413 #endif |
414 #if defined (ONOCR) | |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10266
diff
changeset
|
415 s.c_oflag &= ~(ONOCR); |
529 | 416 #endif |
417 #if defined (ONLRET) | |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10266
diff
changeset
|
418 s.c_oflag &= ~(ONLRET); |
529 | 419 #endif |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10266
diff
changeset
|
420 s.c_cc[VMIN] = wait ? 1 : 0; |
529 | 421 } |
422 else | |
423 { | |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10266
diff
changeset
|
424 // Restore saved modes. |
1358 | 425 |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10266
diff
changeset
|
426 s = save_term; |
529 | 427 } |
3658 | 428 |
529 | 429 ioctl (tty_fd, TCSETAW, &s); |
430 } | |
431 #elif defined (HAVE_SGTTY_H) | |
432 { | |
433 struct sgttyb s; | |
434 static struct sgttyb save_term; | |
435 | |
436 if (on) | |
437 { | |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10266
diff
changeset
|
438 // Get terminal modes. |
529 | 439 |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10266
diff
changeset
|
440 ioctl (tty_fd, TIOCGETP, &s); |
529 | 441 |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10266
diff
changeset
|
442 // Save modes and set certain variables dependent on modes. |
529 | 443 |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10266
diff
changeset
|
444 save_term = s; |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10266
diff
changeset
|
445 // ospeed = s.sg_ospeed; |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10266
diff
changeset
|
446 // erase_char = s.sg_erase; |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10266
diff
changeset
|
447 // kill_char = s.sg_kill; |
529 | 448 |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10266
diff
changeset
|
449 // Set the modes to the way we want them. |
529 | 450 |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10266
diff
changeset
|
451 s.sg_flags |= CBREAK; |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10266
diff
changeset
|
452 s.sg_flags &= ~(ECHO); |
529 | 453 } |
454 else | |
455 { | |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10266
diff
changeset
|
456 // Restore saved modes. |
1358 | 457 |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10266
diff
changeset
|
458 s = save_term; |
529 | 459 } |
3658 | 460 |
529 | 461 ioctl (tty_fd, TIOCSETN, &s); |
462 } | |
463 #else | |
4064 | 464 warning ("no support for raw mode console I/O on this system"); |
465 | |
466 // Make sure the current mode doesn't toggle. | |
467 on = curr_on; | |
529 | 468 #endif |
469 | |
470 curr_on = on; | |
471 } | |
472 | |
6726 | 473 FILE * |
474 octave_popen (const char *command, const char *mode) | |
475 { | |
476 #if defined (__MINGW32__) || defined (_MSC_VER) | |
477 if (mode && mode[0] && ! mode[1]) | |
478 { | |
479 char tmode[3]; | |
480 tmode[0] = mode[0]; | |
481 tmode[1] = 'b'; | |
482 tmode[2] = 0; | |
483 | |
484 return _popen (command, tmode); | |
485 } | |
486 else | |
487 return _popen (command, mode); | |
488 #else | |
489 return popen (command, mode); | |
490 #endif | |
491 } | |
492 | |
493 int | |
494 octave_pclose (FILE *f) | |
495 { | |
496 #if defined (__MINGW32__) || defined (_MSC_VER) | |
497 return _pclose (f); | |
498 #else | |
499 return pclose (f); | |
500 #endif | |
501 } | |
502 | |
767 | 503 // Read one character from the terminal. |
504 | |
529 | 505 int |
4067 | 506 octave_kbhit (bool wait) |
529 | 507 { |
4067 | 508 #ifdef HAVE__KBHIT |
4081 | 509 int c = (! wait && ! _kbhit ()) ? 0 : std::cin.get (); |
4067 | 510 #else |
3658 | 511 raw_mode (true, wait); |
512 | |
5770 | 513 // Get current handler. |
514 octave_interrupt_handler saved_interrupt_handler | |
515 = octave_ignore_interrupts (); | |
516 | |
517 // Restore it, disabling system call restarts (if possible) so the | |
518 // read can be interrupted. | |
519 | |
520 octave_set_interrupt_handler (saved_interrupt_handler, false); | |
521 | |
3658 | 522 int c = std::cin.get (); |
5770 | 523 |
3658 | 524 if (std::cin.fail () || std::cin.eof ()) |
525 std::cin.clear (); | |
526 | |
5770 | 527 // Restore it, enabling system call restarts (if possible). |
528 octave_set_interrupt_handler (saved_interrupt_handler, true); | |
529 | |
3658 | 530 raw_mode (false, true); |
4067 | 531 #endif |
3658 | 532 |
529 | 533 return c; |
534 } | |
535 | |
1957 | 536 DEFUN (clc, , , |
3332 | 537 "-*- texinfo -*-\n\ |
10840 | 538 @deftypefn {Built-in Function} {} clc ()\n\ |
3332 | 539 @deftypefnx {Built-in Function} {} home ()\n\ |
540 Clear the terminal screen and move the cursor to the upper left corner.\n\ | |
3333 | 541 @end deftypefn") |
529 | 542 { |
2926 | 543 command_editor::clear_screen (); |
529 | 544 |
2926 | 545 return octave_value_list (); |
529 | 546 } |
547 | |
549 | 548 DEFALIAS (home, clc); |
549 | |
1957 | 550 DEFUN (getenv, args, , |
3301 | 551 "-*- texinfo -*-\n\ |
552 @deftypefn {Built-in Function} {} getenv (@var{var})\n\ | |
553 Return the value of the environment variable @var{var}. For example,\n\ | |
554 \n\ | |
555 @example\n\ | |
556 getenv (\"PATH\")\n\ | |
557 @end example\n\ | |
558 \n\ | |
559 @noindent\n\ | |
560 returns a string containing the value of your path.\n\ | |
561 @end deftypefn") | |
529 | 562 { |
4233 | 563 octave_value retval; |
529 | 564 |
565 int nargin = args.length (); | |
566 | |
712 | 567 if (nargin == 1) |
529 | 568 { |
3523 | 569 std::string name = args(0).string_value (); |
636 | 570 |
571 if (! error_state) | |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10266
diff
changeset
|
572 retval = octave_env::getenv (name); |
529 | 573 } |
574 else | |
5823 | 575 print_usage (); |
529 | 576 |
577 return retval; | |
578 } | |
579 | |
1957 | 580 DEFUN (putenv, args, , |
3301 | 581 "-*- texinfo -*-\n\ |
10840 | 582 @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
|
583 @deftypefnx {Built-in Function} {} setenv (@var{var}, @var{value})\n\ |
3301 | 584 Set the value of the environment variable @var{var} to @var{value}.\n\ |
585 @end deftypefn") | |
1706 | 586 { |
2086 | 587 octave_value_list retval; |
1706 | 588 |
589 int nargin = args.length (); | |
590 | |
7759
84a7f00586aa
Alias setenv to putenv. Allow single arg to putenv
David Bateman <dbateman@free.fr>
parents:
7231
diff
changeset
|
591 if (nargin == 2 || nargin == 1) |
1706 | 592 { |
3523 | 593 std::string var = args(0).string_value (); |
1706 | 594 |
595 if (! error_state) | |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10266
diff
changeset
|
596 { |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10266
diff
changeset
|
597 std::string val = (nargin == 2 |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10266
diff
changeset
|
598 ? args(1).string_value () : std::string ()); |
1706 | 599 |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10266
diff
changeset
|
600 if (! error_state) |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10266
diff
changeset
|
601 octave_env::putenv (var, val); |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10266
diff
changeset
|
602 else |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10266
diff
changeset
|
603 error ("putenv: second argument should be a string"); |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10266
diff
changeset
|
604 } |
1706 | 605 else |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10266
diff
changeset
|
606 error ("putenv: first argument should be a string"); |
1706 | 607 } |
608 else | |
5823 | 609 print_usage (); |
1706 | 610 |
611 return retval; | |
612 } | |
7759
84a7f00586aa
Alias setenv to putenv. Allow single arg to putenv
David Bateman <dbateman@free.fr>
parents:
7231
diff
changeset
|
613 DEFALIAS (setenv, putenv); |
1706 | 614 |
5775 | 615 // FIXME -- perhaps kbhit should also be able to print a prompt? |
3372 | 616 |
3657 | 617 DEFUN (kbhit, args, , |
3372 | 618 "-*- texinfo -*-\n\ |
619 @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
|
620 Read a single keystroke from the keyboard. If called with one\n\ |
3657 | 621 argument, don't wait for a keypress. For example,\n\ |
3372 | 622 \n\ |
623 @example\n\ | |
624 x = kbhit ();\n\ | |
625 @end example\n\ | |
626 \n\ | |
627 @noindent\n\ | |
628 will set @var{x} to the next character typed at the keyboard as soon as\n\ | |
629 it is typed.\n\ | |
3657 | 630 \n\ |
631 @example\n\ | |
632 x = kbhit (1);\n\ | |
633 @end example\n\ | |
634 \n\ | |
635 @noindent\n\ | |
636 identical to the above example, but don't wait for a keypress,\n\ | |
637 returning the empty string if no key is available.\n\ | |
3372 | 638 @end deftypefn") |
529 | 639 { |
4233 | 640 octave_value retval; |
529 | 641 |
5775 | 642 // FIXME -- add timeout and default value args? |
529 | 643 |
3676 | 644 if (interactive || forced_interactive) |
529 | 645 { |
6423 | 646 feval ("drawnow"); |
647 | |
4067 | 648 int c = octave_kbhit (args.length () == 0); |
3657 | 649 |
3658 | 650 if (c == -1) |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10266
diff
changeset
|
651 c = 0; |
3657 | 652 |
529 | 653 char *s = new char [2]; |
654 s[0] = c; | |
655 s[1] = '\0'; | |
656 retval = s; | |
657 } | |
658 | |
659 return retval; | |
660 } | |
661 | |
1957 | 662 DEFUN (pause, args, , |
3301 | 663 "-*- texinfo -*-\n\ |
664 @deftypefn {Built-in Function} {} pause (@var{seconds})\n\ | |
665 Suspend the execution of the program. If invoked without any arguments,\n\ | |
666 Octave waits until you type a character. With a numeric argument, it\n\ | |
667 pauses for the given number of seconds. For example, the following\n\ | |
668 statement prints a message and then waits 5 seconds before clearing the\n\ | |
669 screen.\n\ | |
670 \n\ | |
671 @example\n\ | |
672 @group\n\ | |
6848 | 673 fprintf (stderr, \"wait please...\\n\");\n\ |
3301 | 674 pause (5);\n\ |
675 clc;\n\ | |
676 @end group\n\ | |
677 @end example\n\ | |
678 @end deftypefn") | |
529 | 679 { |
2086 | 680 octave_value_list retval; |
529 | 681 |
682 int nargin = args.length (); | |
683 | |
712 | 684 if (! (nargin == 0 || nargin == 1)) |
529 | 685 { |
5823 | 686 print_usage (); |
529 | 687 return retval; |
688 } | |
689 | |
1579 | 690 if (nargin == 1) |
529 | 691 { |
1579 | 692 double dval = args(0).double_value (); |
636 | 693 |
1579 | 694 if (! error_state) |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10266
diff
changeset
|
695 { |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10266
diff
changeset
|
696 if (! xisnan (dval)) |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10266
diff
changeset
|
697 { |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10266
diff
changeset
|
698 feval ("drawnow"); |
6419 | 699 |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10266
diff
changeset
|
700 if (xisinf (dval)) |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10266
diff
changeset
|
701 { |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10266
diff
changeset
|
702 flush_octave_stdout (); |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10266
diff
changeset
|
703 octave_kbhit (); |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10266
diff
changeset
|
704 } |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10266
diff
changeset
|
705 else |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10266
diff
changeset
|
706 octave_sleep (dval); |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10266
diff
changeset
|
707 } |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10266
diff
changeset
|
708 else |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10266
diff
changeset
|
709 warning ("pause: NaN is an invalid delay"); |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10266
diff
changeset
|
710 } |
529 | 711 } |
1579 | 712 else |
3234 | 713 { |
6423 | 714 feval ("drawnow"); |
3234 | 715 flush_octave_stdout (); |
4067 | 716 octave_kbhit (); |
3234 | 717 } |
2630 | 718 |
719 return retval; | |
720 } | |
721 | |
722 DEFUN (sleep, args, , | |
3301 | 723 "-*- texinfo -*-\n\ |
724 @deftypefn {Built-in Function} {} sleep (@var{seconds})\n\ | |
725 Suspend the execution of the program for the given number of seconds.\n\ | |
726 @end deftypefn") | |
2630 | 727 { |
728 octave_value_list retval; | |
729 | |
730 if (args.length () == 1) | |
1579 | 731 { |
2630 | 732 double dval = args(0).double_value (); |
733 | |
734 if (! error_state) | |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10266
diff
changeset
|
735 { |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10266
diff
changeset
|
736 if (xisnan (dval)) |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10266
diff
changeset
|
737 warning ("sleep: NaN is an invalid delay"); |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10266
diff
changeset
|
738 else |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10266
diff
changeset
|
739 { |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10266
diff
changeset
|
740 feval ("drawnow"); |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10266
diff
changeset
|
741 octave_sleep (dval); |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10266
diff
changeset
|
742 } |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10266
diff
changeset
|
743 } |
1579 | 744 } |
2630 | 745 else |
5823 | 746 print_usage (); |
2630 | 747 |
748 return retval; | |
749 } | |
750 | |
751 DEFUN (usleep, args, , | |
3301 | 752 "-*- texinfo -*-\n\ |
753 @deftypefn {Built-in Function} {} usleep (@var{microseconds})\n\ | |
754 Suspend the execution of the program for the given number of\n\ | |
755 microseconds. On systems where it is not possible to sleep for periods\n\ | |
756 of time less than one second, @code{usleep} will pause the execution for\n\ | |
757 @code{round (@var{microseconds} / 1e6)} seconds.\n\ | |
758 @end deftypefn") | |
2630 | 759 { |
760 octave_value_list retval; | |
761 | |
762 if (args.length () == 1) | |
763 { | |
764 double dval = args(0).double_value (); | |
765 | |
766 if (! error_state) | |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10266
diff
changeset
|
767 { |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10266
diff
changeset
|
768 if (xisnan (dval)) |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10266
diff
changeset
|
769 warning ("usleep: NaN is an invalid delay"); |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10266
diff
changeset
|
770 else |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10266
diff
changeset
|
771 { |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10266
diff
changeset
|
772 feval ("drawnow"); |
6423 | 773 |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10266
diff
changeset
|
774 int delay = NINT (dval); |
2631 | 775 |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10266
diff
changeset
|
776 if (delay > 0) |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10266
diff
changeset
|
777 octave_usleep (delay); |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10266
diff
changeset
|
778 } |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10266
diff
changeset
|
779 } |
2630 | 780 } |
781 else | |
5823 | 782 print_usage (); |
529 | 783 |
784 return retval; | |
785 } | |
786 | |
5775 | 787 // FIXME -- maybe this should only return 1 if IEEE floating |
862 | 788 // point functions really work. |
789 | |
1957 | 790 DEFUN (isieee, , , |
3301 | 791 "-*- texinfo -*-\n\ |
792 @deftypefn {Built-in Function} {} isieee ()\n\ | |
793 Return 1 if your computer claims to conform to the IEEE standard for\n\ | |
794 floating point calculations.\n\ | |
795 @end deftypefn") | |
862 | 796 { |
4600 | 797 oct_mach_info::float_format flt_fmt = oct_mach_info::native_float_format (); |
2317 | 798 |
4574 | 799 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
|
800 || flt_fmt == oct_mach_info::flt_fmt_ieee_big_endian); |
862 | 801 } |
802 | |
4600 | 803 DEFUN (native_float_format, , , |
804 "-*- texinfo -*-\n\ | |
805 @deftypefn {Built-in Function} {} native_float_format ()\n\ | |
806 Return the native floating point format as a string\n\ | |
807 @end deftypefn") | |
808 { | |
809 oct_mach_info::float_format flt_fmt = oct_mach_info::native_float_format (); | |
810 | |
811 return octave_value (oct_mach_info::float_format_as_string (flt_fmt)); | |
812 } | |
813 | |
1957 | 814 DEFUN (tilde_expand, args, , |
3301 | 815 "-*- texinfo -*-\n\ |
816 @deftypefn {Built-in Function} {} tilde_expand (@var{string})\n\ | |
817 Performs tilde expansion on @var{string}. If @var{string} begins with a\n\ | |
818 tilde character, (@samp{~}), all of the characters preceding the first\n\ | |
819 slash (or all characters, if there is no slash) are treated as a\n\ | |
820 possible user name, and the tilde and the following characters up to the\n\ | |
821 slash are replaced by the home directory of the named user. If the\n\ | |
822 tilde is followed immediately by a slash, the tilde is replaced by the\n\ | |
10840 | 823 home directory of the user running Octave. For example:\n\ |
3301 | 824 \n\ |
825 @example\n\ | |
826 @group\n\ | |
827 tilde_expand (\"~joeuser/bin\")\n\ | |
828 @result{} \"/home/joeuser/bin\"\n\ | |
829 tilde_expand (\"~/bin\")\n\ | |
830 @result{} \"/home/jwe/bin\"\n\ | |
831 @end group\n\ | |
832 @end example\n\ | |
833 @end deftypefn") | |
1750 | 834 { |
4233 | 835 octave_value retval; |
1750 | 836 |
837 int nargin = args.length (); | |
838 | |
839 if (nargin == 1) | |
6116 | 840 { |
841 octave_value arg = args(0); | |
842 | |
843 string_vector sv = arg.all_strings (); | |
844 | |
845 if (! error_state) | |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10266
diff
changeset
|
846 { |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10266
diff
changeset
|
847 sv = file_ops::tilde_expand (sv); |
6116 | 848 |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10266
diff
changeset
|
849 if (arg.is_cellstr ()) |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10266
diff
changeset
|
850 retval = Cell (arg.dims (), sv); |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10266
diff
changeset
|
851 else |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10266
diff
changeset
|
852 retval = sv; |
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10266
diff
changeset
|
853 } |
6116 | 854 else |
10315
57a59eae83cc
untabify src C++ source files
John W. Eaton <jwe@octave.org>
parents:
10266
diff
changeset
|
855 error ("tilde_expand: expecting argument to be char or cellstr object"); |
6116 | 856 } |
1750 | 857 else |
5823 | 858 print_usage (); |
1750 | 859 |
860 return retval; | |
861 } | |
862 | |
2552 | 863 #if defined (__EMX__) && defined (OS2) |
864 | |
8746
5dd06f19e9be
handle commands in the lexer
John W. Eaton <jwe@octave.org>
parents:
8021
diff
changeset
|
865 DEFUN (extproc, , , |
2926 | 866 "extproc: ignored by Octave") |
2552 | 867 { |
868 return octave_value_list (); | |
869 } | |
870 | |
871 DEFALIAS (EXTPROC, extproc); | |
872 | |
873 #endif |