23 #if defined (HAVE_CONFIG_H) 34 #if defined (OCTAVE_USE_WINDOWS_API) 35 # define WIN32_LEAN_AND_MEAN 1 69 #if ! defined (SHELL_PATH) 70 # define SHELL_PATH "/bin/sh" 81 GNU Octave is free software: you can redistribute it and/or modify it\n\ 82 under the terms of the GNU General Public License as published by\n\ 83 the Free Software Foundation, either version 3 of the License, or\n\ 84 (at your option) any later version.\n\ 86 GNU Octave is distributed in the hope that it will be useful,\n\ 87 but WITHOUT ANY WARRANTY; without even the implied warranty of\n\ 88 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n\ 89 GNU General Public License for more details.\n\ 91 You should have received a copy of the GNU General Public License\n\ 92 along with GNU Octave; see the file COPYING. If not, see\n\ 93 <https://www.gnu.org/licenses/>.\n\ 115 error (
"system: unable to start subprocess for '%s'", cmd_str.c_str ());
119 std::ostringstream output_buf;
129 if (! cmd->eof () && errno ==
EAGAIN)
141 int cmd_status = cmd->
close ();
148 retval =
ovl (cmd_status, output_buf.str ());
238 int nargin = args.length ();
246 std::string type_str = args(2).xstring_value (
"system: TYPE must be a string");
248 if (type_str ==
"sync")
250 else if (type_str ==
"async")
253 error (R
"(system: TYPE must be "sync" or "async")"); 264 return_output = args(1).is_true ();
266 catch (octave::execution_exception&
e)
268 error (
e,
"system: RETURN_OUTPUT must be boolean value true or false");
273 error (
"system: can't return output from commands run asynchronously");
275 std::string cmd_str = args(0).xstring_value (
"system: first argument must be a string");
277 #if defined (OCTAVE_USE_WINDOWS_API) 280 cmd_str =
'"' + cmd_str +
'"';
291 else if (return_output)
295 int status =
system (cmd_str.c_str ());
337 DEFUN (__octave_config_info__, args, ,
350 #if defined (ENABLE_DYNAMIC_LINKING) 351 bool octave_supports_dynamic_linking =
true;
353 bool octave_supports_dynamic_linking =
false;
364 std::map<std::string, octave_value> conf_info_map
367 #if defined (OCTAVE_ENABLE_64) 368 {
"ENABLE_64",
true },
370 {
"ENABLE_64",
false },
373 #if defined (OCTAVE_ENABLE_ATOMIC_REFCOUNT) 374 {
"ENABLE_ATOMIC_REFCOUNT",
true },
376 {
"ENABLE_ATOMIC_REFCOUNT",
false },
379 #if defined (ENABLE_DOCS) 380 {
"ENABLE_DOCS",
true },
382 {
"ENABLE_DOCS",
false },
385 #if defined (ENABLE_DYNAMIC_LINKING) 386 {
"ENABLE_DYNAMIC_LINKING",
true },
388 {
"ENABLE_DYNAMIC_LINKING",
false },
391 #if defined (OCTAVE_ENABLE_FLOAT_TRUNCATE) 392 {
"ENABLE_FLOAT_TRUNCATE",
true },
394 {
"ENABLE_FLOAT_TRUNCATE",
false },
397 #if defined (ENABLE_JIT) 398 {
"ENABLE_JIT",
true },
400 {
"ENABLE_JIT",
false },
403 #if defined (OCTAVE_ENABLE_OPENMP) 404 {
"ENABLE_OPENMP",
true },
406 {
"ENABLE_OPENMP",
false },
452 std::map<std::string, octave_value> build_env_map
592 bool unix_system =
true;
593 bool mac_system =
false;
594 bool windows_system =
false;
596 #if defined (__WIN32__) 597 windows_system =
true;
598 #if ! defined (__CYGWIN__) 603 #if defined (OCTAVE_USE_OS_X_API) 614 config.
assign (
"float_format",
617 config.
assign (
"words_big_endian",
620 config.
assign (
"words_little_endian",
630 int nargin = args.length ();
644 info = find_config_info (build_env,
arg);
647 info = find_config_info (build_features,
arg);
650 error (
"__octave_config_info__: no info for '%s'",
arg.c_str ());
672 #if defined (__GNUG__) && defined (DEBUG_NEW_DELETE) 674 int debug_new_delete = 0;
676 typedef void (*vfp)(void);
677 extern vfp __new_handler;
680 __builtin_new (
size_t sz)
687 p = std::malloc (
sz);
691 p = std::malloc (
sz);
694 if (debug_new_delete)
695 std::cerr <<
"__builtin_new: " <<
p << std::endl;
701 __builtin_delete (
void *ptr)
703 if (debug_new_delete)
704 std::cerr <<
"__builtin_delete: " << ptr << std::endl;
std::string local_fcn_file_dir(void)
std::string oct_fonts_dir(void)
const char * RDYNAMIC_FLAG
const char * OSMESA_CPPFLAGS
std::string info_dir(void)
std::string oct_doc_dir(void)
const char * UMFPACK_LDFLAGS
const char * PCRE_LDFLAGS
const char * X11_INCFLAGS
const char * MAGICK_CPPFLAGS
const char * FLTK_LDFLAGS
child_list & __get_child_list__(const std::string &who)
const char * FFTW3_CPPFLAGS
std::string oct_etc_dir(void)
const char * LIBOCTINTERP
OCTINTERP_API void print_usage(void)
const char * UMFPACK_CPPFLAGS
const char * F77_FLOAT_STORE_FLAG
const char * LLVM_LDFLAGS
nd example oindent opens the file binary numeric values will be read assuming they are stored in IEEE format with the least significant bit and then converted to the native representation Opening a file that is already open simply opens it again and returns a separate file id It is not an error to open a file several though writing to the same file through several different file ids may produce unexpected results The possible values of text mode reading and writing automatically converts linefeeds to the appropriate line end character for the system(carriage-return linefeed on Windows). The default when no mode is specified is binary. Additionally
OCTAVE_API octave_scalar_map features(void)
std::string xstring_value(const char *fmt,...) const
const char * COLAMD_LDFLAGS
const char * OSMESA_LDFLAGS
void add_fcn(void(*fcn)(void))
std::string lib_dir(void)
#define DEFUN(name, args_name, nargout_name, doc)
Macro to define a builtin function.
const char * F77_INTEGER_8_FLAG
const char * QHULL_LDFLAGS
std::string oct_lib_dir(void)
void error(const char *fmt,...)
std::string man_dir(void)
const char * QRUPDATE_CPPFLAGS
const char * FFTW3F_LDFLAGS
std::string man1_dir(void)
const char * PTHREAD_CFLAGS
const char * FONTCONFIG_LIBS
std::string data_dir(void)
const char * LLVM_CPPFLAGS
const char * OCTAVE_LINK_DEPS
bool isfield(const std::string &name) const
static void * get_signal_mask(void)
const char * CHOLMOD_CPPFLAGS
const char * SUITESPARSECONFIG_LIBS
const char * FONTCONFIG_CPPFLAGS
#define OCTAVE_API_VERSION
nd example oindent opens the file binary numeric values will be read assuming they are stored in IEEE format with the least significant bit and then converted to the native representation Opening a file that is already open simply opens it again and returns a separate file id It is not an error to open a file several though writing to the same file through several different file ids may produce unexpected results The possible values of text mode reading and writing automatically converts linefeeds to the appropriate line end character for the you may append a you must also open the file in binary mode The parameter conversions are currently only supported for and permissions will be set to and then everything is written in a single operation This is very efficient and improves performance c
const char * CXSPARSE_CPPFLAGS
const char * XTRA_CXXFLAGS
std::string fcn_file_dir(void)
const char * QRUPDATE_LDFLAGS
const char * CURL_LDFLAGS
std::string man1_ext(void)
std::string bin_dir(void)
const char * CCOLAMD_CPPFLAGS
const char * OCTAVE_LINK_OPTS
std::string startupfile_dir(void)
const char * CXSPARSE_LIBS
std::string dataroot_dir(void)
const char * CXSPARSE_LDFLAGS
pid_t octave_async_system_wrapper(const char *cmd)
const char * FT2_CPPFLAGS
const char * FFTW3_LDFLAGS
std::string local_ver_fcn_file_dir(void)
const char * CAMD_CPPFLAGS
OCTAVE_EXPORT octave_value_list return the number of command line arguments passed to Octave If called with the optional argument the function xample nargout(@histc)
const char * LD_STATIC_FLAG
const char * OCT_LINK_DEPS
std::string arch_lib_dir(void)
std::string local_api_arch_lib_dir(void)
#define OCTAVE_RELEASE_DATE
std::string canonical_host_type(void)
const char * OCT_LINK_OPTS
std::string default_pager(void)
std::string local_api_fcn_file_dir(void)
void octave_free_signal_mask(void *mask)
float_format native_float_format(void)
std::string local_oct_file_dir(void)
const char * ARPACK_CPPFLAGS
int wexitstatus(int status)
std::string image_dir(void)
const char * HDF5_CPPFLAGS
const char * AMD_CPPFLAGS
std::string libexec_dir(void)
std::string fftwf_version(void)
const char * HDF5_LDFLAGS
const char * CHOLMOD_LIBS
const char * CCOLAMD_LIBS
void octave_set_signal_mask(void *mask)
const char * QRUPDATE_LIBS
std::string fftw_version(void)
void * octave_alloc_signal_mask(void)
bool words_big_endian(void)
void octave_unblock_async_signals(void)
const char * CURL_CPPFLAGS
std::string oct_file_dir(void)
bool wifexited(int status)
std::string local_arch_lib_dir(void)
std::string local_api_oct_file_dir(void)
void octave_get_signal_mask(void *mask)
const char * UMFPACK_LIBS
octave::unwind_protect frame
return octave_value(v1.char_array_value() . concat(v2.char_array_value(), ra_idx),((a1.is_sq_string()||a2.is_sq_string()) ? '\'' :'"'))
const char * MAGICK_LDFLAGS
const char * GLPK_LDFLAGS
std::string local_ver_oct_file_dir(void)
const char * CAMD_LDFLAGS
const char * PCRE_CPPFLAGS
static octave_value_list run_command_and_return_output(const std::string &cmd_str)
const char * ARPACK_LDFLAGS
const octave_value & contents(const_iterator p) const
bool is_undefined(void) const
OCTAVE_EXPORT octave_value_list isa nd deftypefn *return ovl(args(0).isinteger())
void assign(const std::string &k, const octave_value &val)
OCTAVE_API std::string liboctinterp_hg_id(void)
std::string include_dir(void)
std::string oct_include_dir(void)
int file_number(void) const
const char * CCOLAMD_LDFLAGS
std::string octave_name_version_and_copyright(void)
const char * MKOCTFILE_DL_LDFLAGS
void add_method(T *obj, void(T::*method)(void))
std::string oct_tests_dir(void)
const char * READLINE_LIBS
const char * FFTW3F_CPPFLAGS
std::string local_ver_arch_lib_dir(void)
static void restore_signal_mask(void *mask)
const char * QHULL_CPPFLAGS
const char * WARN_CXXFLAGS
const char * GLPK_CPPFLAGS
If this string is the system will ring the terminal sometimes it is useful to be able to print the original representation of the string
const char * FLTK_CPPFLAGS
std::string oct_data_dir(void)
std::string local_startupfile_dir(void)
bool words_little_endian(void)
const char * CHOLMOD_LDFLAGS
const char * PTHREAD_LIBS
std::string float_format_as_string(float_format flt_fmt)
const char * COLAMD_CPPFLAGS