Mercurial > hg > octave-nkf
comparison libinterp/corefcn/sysdep.cc @ 19463:030d56f67363
implement the open function
* open.m: New function.
* system.txi: Document it.
* __unimplemented__.m (missing_functions): Remove open from the list.
* scripts/miscellaneous/module.mk (miscellaneous_FCN_FILES):
Include open.m in the list.
* sysdep.cc (F__w32_shell_execute__): New function.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Wed, 15 Oct 2014 22:35:59 -0400 |
parents | efccb2a65b9a |
children | 912158cf524d |
comparison
equal
deleted
inserted
replaced
19462:efccb2a65b9a | 19463:030d56f67363 |
---|---|
104 | 104 |
105 #if defined (__WIN32__) && ! defined (_POSIX_VERSION) | 105 #if defined (__WIN32__) && ! defined (_POSIX_VERSION) |
106 | 106 |
107 #define WIN32_LEAN_AND_MEAN | 107 #define WIN32_LEAN_AND_MEAN |
108 #include <tlhelp32.h> | 108 #include <tlhelp32.h> |
109 #include <windows.h> | |
109 | 110 |
110 static void | 111 static void |
111 w32_set_octave_home (void) | 112 w32_set_octave_home (void) |
112 { | 113 { |
113 std::string bin_dir; | 114 std::string bin_dir; |
176 w32_set_octave_home (); | 177 w32_set_octave_home (); |
177 | 178 |
178 command_editor::prefer_env_winsize (true); | 179 command_editor::prefer_env_winsize (true); |
179 } | 180 } |
180 #endif | 181 #endif |
182 | |
183 DEFUN (__w32_shell_execute__, args, , | |
184 "-*- texinfo -*-\n\ | |
185 @deftypefn {Loadable Function} {} __w32_shell_execute__ (@var{file})\n\ | |
186 Undocumented internal function.\n\ | |
187 @end deftypefn") | |
188 { | |
189 bool retval = false; | |
190 | |
191 #if defined (__WIN32__) && ! defined (_POSIX_VERSION) | |
192 if (args.length () == 1) | |
193 { | |
194 std::string file = args(0).string_value (); | |
195 | |
196 if (! error_state) | |
197 { | |
198 HINSTANCE status = ShellExecute (0, 0, file.c_str (), 0, 0, SW_SHOWNORMAL); | |
199 | |
200 // ShellExecute returns a value greater than 32 if successful. | |
201 retval = (reinterpret_cast<ptrdiff_t> (status) > 32); | |
202 } | |
203 else | |
204 error ("__w32_shell_execute__: expecting argument to be a file name"); | |
205 } | |
206 else | |
207 print_usage (); | |
208 #endif | |
209 | |
210 return octave_value (retval); | |
211 } | |
181 | 212 |
182 #if defined (__MINGW32__) | 213 #if defined (__MINGW32__) |
183 static void | 214 static void |
184 MINGW_init (void) | 215 MINGW_init (void) |
185 { | 216 { |