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 ());
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 +
'"';
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 },
395 {
"api_version", OCTAVE_API_VERSION },
423 {
"major_version",
STRINGIFY (OCTAVE_MAJOR_VERSION) },
427 {
"minor_version",
STRINGIFY (OCTAVE_MINOR_VERSION) },
436 {
"patch_version",
STRINGIFY (OCTAVE_PATCH_VERSION) },
437 {
"release_date", OCTAVE_RELEASE_DATE },
442 std::map<std::string, octave_value> build_env_map
572 bool unix_system =
true;
573 bool mac_system =
false;
574 bool windows_system =
false;
576 #if defined (__WIN32__)
577 windows_system =
true;
578 #if ! defined (__CYGWIN__)
583 #if defined (OCTAVE_USE_OS_X_API)
592 config.
assign (
"float_format",
595 config.
assign (
"words_big_endian",
598 config.
assign (
"words_little_endian",
608 int nargin = args.length ();
617 std::string arg = args(
618 0).xstring_value (
"__octave_config_info__: OPTION argument must be a string");
629 error (
"__octave_config_info__: no info for '%s'", arg.c_str ());
634 retval =
ovl (config);
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 (std::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)
OCTINTERP_API const char * YACC
OCTINTERP_API const char * OCT_LINK_OPTS
OCTINTERP_API const char * FONTCONFIG_CPPFLAGS
OCTINTERP_API const char * LIBOCTINTERP
OCTINTERP_API const char * CC
OCTINTERP_API const char * ARPACK_LDFLAGS
OCTINTERP_API const char * CURL_LDFLAGS
OCTINTERP_API const char * MAGICK_LIBS
OCTINTERP_API const char * EXEEXT
OCTINTERP_API const char * CHOLMOD_LDFLAGS
OCTINTERP_API const char * FFLAGS
OCTINTERP_API const char * F77_INTEGER_8_FLAG
OCTINTERP_API const char * QRUPDATE_LDFLAGS
OCTINTERP_API const char * CHOLMOD_CPPFLAGS
OCTINTERP_API const char * Z_LDFLAGS
OCTINTERP_API const char * FFTW3_LDFLAGS
OCTINTERP_API const char * RDYNAMIC_FLAG
OCTINTERP_API const char * ARPACK_LIBS
OCTINTERP_API const char * LDFLAGS
OCTINTERP_API const char * CPICFLAG
OCTINTERP_API const char * WARN_CFLAGS
OCTINTERP_API const char * FONTCONFIG_LIBS
OCTINTERP_API const char * UMFPACK_LIBS
OCTINTERP_API const char * OCTAVE_LINK_DEPS
OCTINTERP_API const char * LIBS
OCTINTERP_API const char * CXXPICFLAG
OCTINTERP_API const char * FLTK_LIBS
OCTINTERP_API const char * Z_LIBS
OCTINTERP_API const char * LEX
OCTINTERP_API const char * FT2_LIBS
OCTINTERP_API octave_scalar_map features(void)
OCTINTERP_API const char * CXXFLAGS
OCTINTERP_API const char * GNUPLOT
OCTINTERP_API const char * FFTW3F_CPPFLAGS
OCTINTERP_API const char * F77_FLOAT_STORE_FLAG
OCTINTERP_API const char * MKOCTFILE_DL_LDFLAGS
OCTINTERP_API const char * WARN_CXXFLAGS
OCTINTERP_API const char * MAGICK_LDFLAGS
OCTINTERP_API const char * QRUPDATE_LIBS
OCTINTERP_API const char * CAMD_CPPFLAGS
OCTINTERP_API const char * FFTW3_LIBS
OCTINTERP_API const char * CHOLMOD_LIBS
OCTINTERP_API const char * QRUPDATE_CPPFLAGS
OCTINTERP_API const char * X11_LIBS
OCTINTERP_API const char * XTRA_CXXFLAGS
OCTINTERP_API const char * COLAMD_LDFLAGS
OCTINTERP_API const char * STATIC_LIBS
OCTINTERP_API const char * FFTW3F_LDFLAGS
OCTINTERP_API const char * CURL_CPPFLAGS
OCTINTERP_API const char * CURL_LIBS
OCTINTERP_API const char * AR
OCTINTERP_API const char * SHARED_LIBS
OCTINTERP_API const char * CCOLAMD_CPPFLAGS
OCTINTERP_API const char * ARPACK_CPPFLAGS
OCTINTERP_API const char * UMFPACK_CPPFLAGS
OCTINTERP_API const char * DL_LDFLAGS
OCTINTERP_API const char * OCTAVE_LINK_OPTS
OCTINTERP_API const char * COLAMD_LIBS
OCTINTERP_API const char * X11_INCFLAGS
OCTINTERP_API const char * AMD_LIBS
OCTINTERP_API const char * COLAMD_CPPFLAGS
OCTINTERP_API const char * PTHREAD_CFLAGS
OCTINTERP_API const char * FLIBS
OCTINTERP_API const char * CXSPARSE_CPPFLAGS
OCTINTERP_API const char * HDF5_LDFLAGS
OCTINTERP_API const char * GCC_VERSION
OCTINTERP_API const char * CAMD_LIBS
OCTINTERP_API const char * DEFS
OCTINTERP_API const char * CXX
OCTINTERP_API const char * BLAS_LIBS
OCTINTERP_API const char * FFTW3_CPPFLAGS
OCTINTERP_API const char * FLTK_CPPFLAGS
OCTINTERP_API const char * LN_S
OCTINTERP_API const char * QHULL_LIBS
OCTINTERP_API const char * CARBON_LIBS
OCTINTERP_API const char * GLPK_CPPFLAGS
OCTINTERP_API const char * LEXLIB
OCTINTERP_API const char * QT_LIBS
OCTINTERP_API const char * HDF5_CPPFLAGS
OCTINTERP_API const char * ARFLAGS
OCTINTERP_API const char * FLTK_LDFLAGS
OCTINTERP_API const char * CCOLAMD_LIBS
OCTINTERP_API const char * LFLAGS
OCTINTERP_API const char * CPPFLAGS
OCTINTERP_API const char * FPICFLAG
OCTINTERP_API const char * GXX_VERSION
OCTINTERP_API const char * PCRE_LIBS
OCTINTERP_API const char * LAPACK_LIBS
OCTINTERP_API const char * YFLAGS
OCTINTERP_API const char * SH_LDFLAGS
OCTINTERP_API const char * OPENGL_LIBS
OCTINTERP_API const char * QHULL_CPPFLAGS
OCTINTERP_API const char * UMFPACK_LDFLAGS
OCTINTERP_API const char * PTHREAD_LIBS
OCTINTERP_API const char * HDF5_LIBS
OCTINTERP_API const char * F77
OCTINTERP_API const char * FFTW3F_LIBS
OCTINTERP_API const char * CFLAGS
OCTINTERP_API const char * CXSPARSE_LDFLAGS
OCTINTERP_API const char * READLINE_LIBS
OCTINTERP_API const char * LD_STATIC_FLAG
OCTINTERP_API const char * GLPK_LIBS
OCTINTERP_API const char * Z_CPPFLAGS
OCTINTERP_API const char * SUITESPARSECONFIG_LIBS
OCTINTERP_API const char * RANLIB
OCTINTERP_API const char * MAGICK_CPPFLAGS
OCTINTERP_API const char * QT_CPPFLAGS
OCTINTERP_API const char * OCT_LINK_DEPS
OCTINTERP_API const char * XTRA_CFLAGS
OCTINTERP_API const char * CXXCPP
OCTINTERP_API const char * LIBOCTAVE
OCTINTERP_API const char * QHULL_LDFLAGS
OCTINTERP_API const char * AMD_CPPFLAGS
OCTINTERP_API const char * config_opts
OCTINTERP_API const char * PCRE_LDFLAGS
OCTINTERP_API const char * QT_LDFLAGS
OCTINTERP_API const char * GLPK_LDFLAGS
OCTINTERP_API const char * FT2_CPPFLAGS
OCTINTERP_API const char * AMD_LDFLAGS
OCTINTERP_API const char * CXSPARSE_LIBS
OCTINTERP_API const char * QT_OPENGL_LIBS
OCTINTERP_API const char * CCOLAMD_LDFLAGS
OCTINTERP_API const char * CAMD_LDFLAGS
OCTINTERP_API const char * PCRE_CPPFLAGS
OCTARRAY_OVERRIDABLE_FUNC_API bool isempty(void) 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(void) const
int file_number(void) const
void octave_unblock_async_signals(void)
OCTAVE_BEGIN_NAMESPACE(octave) static octave_value daspk_fcn
std::string local_fcn_file_dir(void)
std::string oct_tests_dir(void)
std::string local_ver_oct_file_dir(void)
std::string canonical_host_type(void)
std::string local_api_fcn_file_dir(void)
std::string man1_dir(void)
std::string startupfile_dir(void)
std::string default_pager(void)
std::string oct_doc_dir(void)
std::string image_dir(void)
std::string local_oct_file_dir(void)
std::string fcn_file_dir(void)
std::string man_dir(void)
std::string include_dir(void)
std::string oct_file_dir(void)
std::string data_dir(void)
std::string dataroot_dir(void)
std::string man1_ext(void)
std::string libexec_dir(void)
std::string local_startupfile_dir(void)
std::string info_dir(void)
std::string oct_etc_dir(void)
std::string local_arch_lib_dir(void)
std::string local_ver_arch_lib_dir(void)
std::string lib_dir(void)
std::string local_api_arch_lib_dir(void)
std::string oct_include_dir(void)
std::string oct_data_dir(void)
std::string bin_dir(void)
std::string local_api_oct_file_dir(void)
std::string local_ver_fcn_file_dir(void)
std::string arch_lib_dir(void)
std::string oct_lib_dir(void)
std::string oct_fonts_dir(void)
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,...)
child_list & __get_child_list__(void)
OCTINTERP_API std::string liboctinterp_hg_id(void)
int system(const std::string &cmd_str)
bool words_little_endian(void)
bool words_big_endian(void)
std::string float_format_as_string(float_format flt_fmt)
float_format native_float_format(void)
std::string fftwf_version(void)
std::string fftw_version(void)
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)
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)