26 #if defined (HAVE_CONFIG_H)
37 #if defined (OCTAVE_USE_WINDOWS_API)
38 # define WIN32_LEAN_AND_MEAN 1
71 #if ! defined (SHELL_PATH)
72 # define SHELL_PATH "/bin/sh"
83 GNU Octave is free software: you can redistribute it and/or modify it\n\
84 under the terms of the GNU General Public License as published by\n\
85 the Free Software Foundation, either version 3 of the License, or\n\
86 (at your option) any later version.\n\
88 GNU Octave is distributed in the hope that it will be useful, but\n\
89 WITHOUT ANY WARRANTY; without even the implied warranty of\n\
90 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n\
91 GNU General Public License for more details.\n\
93 You should have received a copy of the GNU General Public License\n\
94 along with GNU Octave; see the file COPYING. If not, see\n\
95 <https://www.gnu.org/licenses/>.\n\
117 error (
"system: unable to start subprocess for '%s'", cmd_str.c_str ());
121 std::ostringstream output_buf;
131 if (! cmd->eof () && errno == EAGAIN)
143 int cmd_status = cmd->
close ();
150 retval =
ovl (cmd_status, output_buf.str ());
179 DEFUN (system, args, nargout,
239 int nargin = args.length ();
241 if (nargin == 0 || nargin > 3)
247 std::string type_str = args(2).xstring_value (
"system: TYPE must be a string");
249 if (type_str ==
"sync")
251 else if (type_str ==
"async")
254 error (R
"(system: TYPE must be "sync" or "async")");
259 bool return_output = (nargin == 1 && nargout > 1);
265 return_output = args(1).is_true ();
267 catch (octave::execution_exception& e)
269 error (e,
"system: RETURN_OUTPUT must be boolean value true or false");
274 error (
"system: can't return output from commands run asynchronously");
276 std::string cmd_str = args(0).xstring_value (
"system: first argument must be a string");
278 #if defined (OCTAVE_USE_WINDOWS_API)
281 cmd_str =
'"' + cmd_str +
'"';
293 else if (return_output)
297 int status = system (cmd_str.c_str ());
330 Cell c =
m.contents (key);
339 DEFUN (__octave_config_info__, args, ,
356 static bool initialized =
false;
360 std::map<std::string, octave_value> conf_info_map
363 #if defined (OCTAVE_ENABLE_64)
364 {
"ENABLE_64",
true },
366 {
"ENABLE_64",
false },
369 #if defined (OCTAVE_ENABLE_COMMAND_LINE_PUSH_PARSER)
370 {
"ENABLE_COMMAND_LINE_PUSH_PARSER",
true },
372 {
"ENABLE_COMMAND_LINE_PUSH_PARSER",
false },
375 #if defined (ENABLE_DOCS)
376 {
"ENABLE_DOCS",
true },
378 {
"ENABLE_DOCS",
false },
381 #if defined (OCTAVE_ENABLE_FLOAT_TRUNCATE)
382 {
"ENABLE_FLOAT_TRUNCATE",
true },
384 {
"ENABLE_FLOAT_TRUNCATE",
false },
387 #if defined (ENABLE_JIT)
388 {
"ENABLE_JIT",
true },
390 {
"ENABLE_JIT",
false },
393 #if defined (OCTAVE_ENABLE_OPENMP)
394 {
"ENABLE_OPENMP",
true },
396 {
"ENABLE_OPENMP",
false },
442 std::map<std::string, octave_value> build_env_map
575 bool unix_system =
true;
576 bool mac_system =
false;
577 bool windows_system =
false;
579 #if defined (__WIN32__)
580 windows_system =
true;
581 #if ! defined (__CYGWIN__)
586 #if defined (OCTAVE_USE_OS_X_API)
595 config.
assign (
"float_format",
598 config.
assign (
"words_big_endian",
601 config.
assign (
"words_little_endian",
611 int nargin = args.length ();
620 std::string arg = args(0).xstring_value (
"__octave_config_info__: OPTION argument must be a string");
631 error (
"__octave_config_info__: no info for '%s'", arg.c_str ());
653 #if defined (__GNUG__) && defined (DEBUG_NEW_DELETE)
655 int debug_new_delete = 0;
657 typedef void (*vfp)(void);
658 extern vfp __new_handler;
661 __builtin_new (
size_t sz)
675 if (debug_new_delete)
676 std::cerr <<
"__builtin_new: " << p << std::endl;
682 __builtin_delete (
void *ptr)
684 if (debug_new_delete)
685 std::cerr <<
"__builtin_delete: " << ptr << std::endl;
pid_t octave_async_system_wrapper(const char *cmd)
bool isempty(void) const
Size of the specified dimension.
void add_method(T *obj, void(T::*method)(Params...), Args &&... args)
void add_fcn(void(*fcn)(Params...), Args &&... args)
void assign(const std::string &k, const octave_value &val)
bool is_undefined(void) const
int file_number(void) const
OCTINTERP_API void print_usage(void)
#define DEFUN(name, args_name, nargout_name, doc)
Macro to define a builtin function.
void error(const char *fmt,...)
OCTAVE_API std::string liboctinterp_hg_id(void)
const char * CCOLAMD_LIBS
const char * UMFPACK_LIBS
const char * CHOLMOD_CPPFLAGS
const char * PCRE_LDFLAGS
const char * PTHREAD_CFLAGS
const char * PTHREAD_LIBS
const char * CCOLAMD_LDFLAGS
const char * HDF5_CPPFLAGS
const char * F77_FLOAT_STORE_FLAG
const char * CXSPARSE_LIBS
const char * CURL_LDFLAGS
const char * SUITESPARSECONFIG_LIBS
const char * FONTCONFIG_CPPFLAGS
const char * COLAMD_CPPFLAGS
const char * FFTW3_LDFLAGS
const char * READLINE_LIBS
const char * CHOLMOD_LIBS
const char * OCTAVE_LINK_DEPS
const char * QT_OPENGL_LIBS
const char * CHOLMOD_LDFLAGS
const char * QRUPDATE_LDFLAGS
const char * FFTW3F_LDFLAGS
const char * FT2_CPPFLAGS
const char * CXSPARSE_LDFLAGS
const char * QHULL_CPPFLAGS
const char * OCTAVE_LINK_OPTS
const char * ARPACK_LDFLAGS
const char * FLTK_CPPFLAGS
const char * WARN_CXXFLAGS
const char * UMFPACK_CPPFLAGS
const char * XTRA_CXXFLAGS
const char * QRUPDATE_LIBS
const char * ARPACK_CPPFLAGS
const char * AMD_CPPFLAGS
const char * RDYNAMIC_FLAG
const char * X11_INCFLAGS
const char * QHULL_LDFLAGS
const char * MKOCTFILE_DL_LDFLAGS
const char * LD_STATIC_FLAG
const char * FONTCONFIG_LIBS
const char * MAGICK_CPPFLAGS
const char * PCRE_CPPFLAGS
OCTAVE_API octave_scalar_map features(void)
const char * LIBOCTINTERP
const char * CXSPARSE_CPPFLAGS
const char * CCOLAMD_CPPFLAGS
const char * OCT_LINK_DEPS
const char * OCT_LINK_OPTS
const char * LLVM_LDFLAGS
const char * CAMD_LDFLAGS
const char * FFTW3_CPPFLAGS
const char * MAGICK_LDFLAGS
const char * GLPK_CPPFLAGS
const char * QRUPDATE_CPPFLAGS
const char * FFTW3F_CPPFLAGS
const char * CURL_CPPFLAGS
const char * GLPK_LDFLAGS
const char * FLTK_LDFLAGS
const char * UMFPACK_LDFLAGS
const char * HDF5_LDFLAGS
const char * LLVM_CPPFLAGS
const char * F77_INTEGER_8_FLAG
const char * COLAMD_LDFLAGS
const char * CAMD_CPPFLAGS
std::string local_ver_oct_file_dir(void)
std::string local_fcn_file_dir(void)
std::string oct_data_dir(void)
std::string oct_doc_dir(void)
std::string oct_fonts_dir(void)
std::string dataroot_dir(void)
std::string image_dir(void)
std::string default_pager(void)
std::string canonical_host_type(void)
std::string startupfile_dir(void)
std::string local_ver_arch_lib_dir(void)
std::string oct_file_dir(void)
std::string local_arch_lib_dir(void)
std::string arch_lib_dir(void)
std::string include_dir(void)
std::string local_oct_file_dir(void)
std::string info_dir(void)
std::string local_api_oct_file_dir(void)
std::string libexec_dir(void)
std::string oct_lib_dir(void)
std::string man_dir(void)
std::string man1_ext(void)
std::string local_api_arch_lib_dir(void)
std::string man1_dir(void)
std::string data_dir(void)
std::string local_api_fcn_file_dir(void)
std::string lib_dir(void)
std::string local_startupfile_dir(void)
std::string oct_etc_dir(void)
std::string bin_dir(void)
std::string oct_include_dir(void)
std::string fcn_file_dir(void)
std::string oct_tests_dir(void)
std::string local_ver_fcn_file_dir(void)
std::string float_format_as_string(float_format flt_fmt)
float_format native_float_format(void)
bool words_little_endian(void)
bool words_big_endian(void)
int wexitstatus(int status)
bool wifexited(int status)
std::string fftw_version(void)
std::string fftwf_version(void)
child_list & __get_child_list__(const std::string &who)
return octave_value(v1.char_array_value() . concat(v2.char_array_value(), ra_idx),((a1.is_sq_string()||a2.is_sq_string()) ? '\'' :'"'))
octave_value::octave_value(const Array< char > &chm, char type) return retval
octave_value_list ovl(const OV_Args &... args)
Construct an octave_value_list with less typing.
void octave_unblock_signal_by_name(const char *signame)
void octave_set_signal_mask(void *mask)
void octave_free_signal_mask(void *mask)
void octave_get_signal_mask(void *mask)
void octave_unblock_async_signals(void)
void * octave_alloc_signal_mask(void)
static octave_value_list run_command_and_return_output(const std::string &cmd_str)
static void * get_signal_mask(void)
static void restore_signal_mask(void *mask)
static octave_value find_config_info(const octave_scalar_map &m, const std::string &key)
std::string octave_name_version_and_copyright(void)
#define OCTAVE_RELEASE_DATE
#define OCTAVE_API_VERSION