26 #if defined (HAVE_CONFIG_H)
37 #if defined (OCTAVE_USE_WINDOWS_API)
38 # define WIN32_LEAN_AND_MEAN 1
70 #if ! defined (SHELL_PATH)
71 # define SHELL_PATH "/bin/sh"
76 #define STRINGIFY(s) STRINGIFY1(s)
77 #define STRINGIFY1(s) #s
87 GNU Octave is free software: you can redistribute it and/or modify it\n\
88 under the terms of the GNU General Public License as published by\n\
89 the Free Software Foundation, either version 3 of the License, or\n\
90 (at your option) any later version.\n\
92 GNU Octave is distributed in the hope that it will be useful, but\n\
93 WITHOUT ANY WARRANTY; without even the implied warranty of\n\
94 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n\
95 GNU General Public License for more details.\n\
97 You should have received a copy of the GNU General Public License\n\
98 along with GNU Octave; see the file COPYING. If not, see\n\
99 <https://www.gnu.org/licenses/>.\n\
120 error (
"system: unable to start subprocess for '%s'", cmd_str.c_str ());
124 std::ostringstream output_buf;
134 if (! cmd->eof () && errno == EAGAIN)
146 int cmd_status = cmd->
close ();
153 retval =
ovl (cmd_status, output_buf.str ());
173 restore_signal_mask (
void *mask)
242 int nargin = args.length ();
244 if (nargin == 0 || nargin > 3)
250 std::string type_str = args(2).xstring_value (
"system: TYPE must be a string");
252 if (type_str ==
"sync")
254 else if (type_str ==
"async")
257 error (R
"(system: TYPE must be "sync" or "async")");
262 bool return_output = (nargin == 1 && nargout > 1);
268 return_output = args(1).is_true ();
272 error (ee,
"system: RETURN_OUTPUT must be boolean value true or false");
276 if (return_output && type ==
et_async)
277 error (
"system: can't return output from commands run asynchronously");
279 std::string cmd_str = args(0).xstring_value (
"system: first argument must be a string");
281 #if defined (OCTAVE_USE_WINDOWS_API)
284 cmd_str =
'"' + cmd_str +
'"';
288 ([] (
void *mask) { restore_signal_mask (mask); }, get_signal_mask ());
295 else if (return_output)
332 Cell c =
m.contents (key);
341 DEFUN (__octave_config_info__, args, ,
358 static bool initialized =
false;
362 std::map<std::string, octave_value> conf_info_map
365 #if defined (OCTAVE_ENABLE_64)
366 {
"ENABLE_64",
true },
368 {
"ENABLE_64",
false },
371 #if defined (OCTAVE_ENABLE_COMMAND_LINE_PUSH_PARSER)
372 {
"ENABLE_COMMAND_LINE_PUSH_PARSER",
true },
374 {
"ENABLE_COMMAND_LINE_PUSH_PARSER",
false },
377 #if defined (ENABLE_DOCS)
378 {
"ENABLE_DOCS",
true },
380 {
"ENABLE_DOCS",
false },
383 #if defined (OCTAVE_ENABLE_FLOAT_TRUNCATE)
384 {
"ENABLE_FLOAT_TRUNCATE",
true },
386 {
"ENABLE_FLOAT_TRUNCATE",
false },
389 #if defined (OCTAVE_ENABLE_OPENMP)
390 {
"ENABLE_OPENMP",
true },
392 {
"ENABLE_OPENMP",
false },
442 std::map<std::string, octave_value> build_env_map
571 bool unix_system =
true;
572 bool mac_system =
false;
573 bool windows_system =
false;
575 #if defined (__WIN32__)
576 windows_system =
true;
577 #if ! defined (__CYGWIN__)
582 #if defined (OCTAVE_USE_OS_X_API)
591 config.
assign (
"float_format",
594 config.
assign (
"words_big_endian",
597 config.
assign (
"words_little_endian",
607 int nargin = args.length ();
616 std::string arg = args(0).xstring_value (
"__octave_config_info__: OPTION argument must be a string");
621 info = find_config_info (build_env, arg);
624 info = find_config_info (build_features, arg);
627 error (
"__octave_config_info__: no info for '%s'", arg.c_str ());
632 retval =
ovl (config);
649 OCTAVE_END_NAMESPACE(
octave)
651 #if defined (__GNUG__) && defined (DEBUG_NEW_DELETE)
653 int debug_new_delete = 0;
655 typedef void (*vfp)();
656 extern vfp __new_handler;
659 __builtin_new (std::size_t sz)
673 if (debug_new_delete)
674 std::cerr <<
"__builtin_new: " << p << std::endl;
680 __builtin_delete (
void *ptr)
682 if (debug_new_delete)
683 std::cerr <<
"__builtin_delete: " << ptr << std::endl;
pid_t octave_async_system_wrapper(const char *cmd)
octave_scalar_map features()
const char * PTHREAD_LIBS
const char * UMFPACK_LIBS
const char * CHOLMOD_LDFLAGS
const char * FLTK_CPPFLAGS
const char * MAGICK_LDFLAGS
const char * HDF5_CPPFLAGS
const char * FONTCONFIG_LIBS
const char * ARPACK_LDFLAGS
const char * GLPK_CPPFLAGS
const char * COLAMD_LDFLAGS
const char * OCT_LINK_OPTS
const char * OCTAVE_LINK_OPTS
const char * AMD_CPPFLAGS
const char * CXSPARSE_LIBS
const char * QRUPDATE_LDFLAGS
const char * QRUPDATE_LIBS
const char * F77_INTEGER_8_FLAG
const char * FFTW3_CPPFLAGS
const char * CAMD_CPPFLAGS
const char * WARN_CXXFLAGS
const char * FLTK_LDFLAGS
const char * COLAMD_CPPFLAGS
const char * OCT_LINK_DEPS
const char * PCRE_LDFLAGS
const char * MKOCTFILE_DL_LDFLAGS
const char * FFTW3_LDFLAGS
const char * FFTW3F_CPPFLAGS
const char * SUITESPARSECONFIG_LIBS
const char * LD_STATIC_FLAG
const char * RDYNAMIC_FLAG
const char * CHOLMOD_LIBS
const char * UMFPACK_CPPFLAGS
const char * HDF5_LDFLAGS
const char * QHULL_LDFLAGS
const char * X11_INCFLAGS
const char * FFTW3F_LDFLAGS
const char * FT2_CPPFLAGS
const char * CHOLMOD_CPPFLAGS
const char * READLINE_LIBS
const char * CXSPARSE_LDFLAGS
const char * GLPK_LDFLAGS
const char * PCRE_CPPFLAGS
const char * FONTCONFIG_CPPFLAGS
const char * OCTAVE_LINK_DEPS
const char * QRUPDATE_CPPFLAGS
const char * CCOLAMD_LIBS
const char * CAMD_LDFLAGS
const char * CURL_CPPFLAGS
const char * CXSPARSE_CPPFLAGS
const char * CURL_LDFLAGS
const char * CCOLAMD_CPPFLAGS
const char * PTHREAD_CFLAGS
const char * LIBOCTINTERP
const char * XTRA_CXXFLAGS
const char * ARPACK_CPPFLAGS
const char * CCOLAMD_LDFLAGS
const char * F77_FLOAT_STORE_FLAG
const char * UMFPACK_LDFLAGS
const char * QHULL_CPPFLAGS
const char * MAGICK_CPPFLAGS
bool isempty() const
Size of the specified dimension.
void add(F &&fcn, Args &&... args)
void assign(const std::string &k, const octave_value &val)
bool is_undefined() const
void octave_unblock_async_signals()
OCTAVE_BEGIN_NAMESPACE(octave) static octave_value daspk_fcn
std::string startupfile_dir()
std::string dataroot_dir()
std::string oct_doc_dir()
std::string default_pager()
std::string local_ver_arch_lib_dir()
std::string local_oct_file_dir()
std::string local_startupfile_dir()
std::string canonical_host_type()
std::string oct_fonts_dir()
std::string local_fcn_file_dir()
std::string include_dir()
std::string local_api_oct_file_dir()
std::string local_arch_lib_dir()
std::string oct_tests_dir()
std::string fcn_file_dir()
std::string local_api_fcn_file_dir()
std::string local_ver_fcn_file_dir()
std::string oct_etc_dir()
std::string local_ver_oct_file_dir()
std::string local_api_arch_lib_dir()
std::string libexec_dir()
std::string oct_file_dir()
std::string oct_data_dir()
std::string oct_include_dir()
std::string oct_lib_dir()
std::string arch_lib_dir()
#define DEFUN(name, args_name, nargout_name, doc)
Macro to define a builtin function.
void() error(const char *fmt,...)
child_list & __get_child_list__()
std::string liboctinterp_hg_id()
int system(const std::string &cmd_str)
bool words_little_endian()
std::string float_format_as_string(float_format flt_fmt)
float_format native_float_format()
std::string fftwf_version()
std::string fftw_version()
process_execution_result run_command_and_return_output(const std::string &cmd_str)
bool wifexited(int status)
int wexitstatus(int status)
return octave_value(v1.char_array_value() . concat(v2.char_array_value(), ra_idx),((a1.is_sq_string()||a2.is_sq_string()) ? '\'' :'"'))
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_alloc_signal_mask(void)
std::string octave_name_version_and_copyright(bool html)
#define OCTAVE_MINOR_VERSION
#define OCTAVE_PATCH_VERSION
#define OCTAVE_MAJOR_VERSION
#define OCTAVE_RELEASE_DATE
#define OCTAVE_API_VERSION