23 #if defined (HAVE_CONFIG_H)
34 #if defined (OCTAVE_USE_WINDOWS_API)
35 # define WIN32_LEAN_AND_MEAN 1
66 #if ! defined (SHELL_PATH)
67 # define SHELL_PATH "/bin/sh"
78 GNU Octave is free software; you can redistribute it and/or modify\n\
79 it under the terms of the GNU General Public License as published by\n\
80 the Free Software Foundation; either version 3 of the License, or\n\
81 (at your option) any later version.\n\
83 GNU Octave is distributed in the hope that it will be useful,\n\
84 but WITHOUT ANY WARRANTY; without even the implied warranty of\n\
85 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n\
86 GNU General Public License for more details.\n\
88 You should have received a copy of the GNU General Public License\n\
89 along with this program. If not, see <http://www.gnu.org/licenses/>.\n\
109 error (
"system: unable to start subprocess for '%s'", cmd_str.c_str ());
113 std::ostringstream output_buf;
123 if (! cmd->eof () && errno ==
EAGAIN)
135 int cmd_status = cmd->
close ();
142 retval =
ovl (cmd_status, output_buf.str ());
203 if (nargin == 0 || nargin > 3)
209 std::string type_str =
args(2).xstring_value (
"system: TYPE must be a string");
211 if (type_str ==
"sync")
213 else if (type_str ==
"async")
216 error (
"system: TYPE must be \"sync\" or \"async\"");
224 bool return_output = (nargin == 1 &&
nargout > 1);
230 return_output =
args(1).is_true ();
232 catch (octave::execution_exception&
e)
234 error (e,
"system: RETURN_OUTPUT must be boolean value true or false");
238 if (return_output && type ==
et_async)
239 error (
"system: can't return output from commands run asynchronously");
241 std::string cmd_str =
args(0).xstring_value (
"system: first argument must be a string");
243 #if defined (OCTAVE_USE_WINDOWS_API)
246 cmd_str =
"\"" + cmd_str +
"\"";
251 else if (return_output)
255 int status =
system (cmd_str.c_str ());
310 #if defined (ENABLE_DYNAMIC_LINKING)
311 bool octave_supports_dynamic_linking =
true;
313 bool octave_supports_dynamic_linking =
false;
316 static bool initialized =
false;
318 struct conf_info_struct
324 static const conf_info_struct conf_info[] =
328 #if defined (OCTAVE_ENABLE_64)
329 {
"ENABLE_64",
true },
331 {
"ENABLE_64",
false },
334 #if defined (OCTAVE_ENABLE_ATOMIC_REFCOUNT)
335 {
"ENABLE_ATOMIC_REFCOUNT",
true },
337 {
"ENABLE_ATOMIC_REFCOUNT",
false },
340 #if defined (OCTAVE_ENABLE_BOUNDS_CHECK)
341 {
"ENABLE_BOUNDS_CHECK",
true },
343 {
"ENABLE_BOUNDS_CHECK",
false },
346 #if defined (ENABLE_DOCS)
347 {
"ENABLE_DOCS",
true },
349 {
"ENABLE_DOCS",
false },
352 #if defined (ENABLE_DYNAMIC_LINKING)
353 {
"ENABLE_DYNAMIC_LINKING",
true },
355 {
"ENABLE_DYNAMIC_LINKING",
false },
358 #if defined (OCTAVE_ENABLE_FLOAT_TRUNCATE)
359 {
"ENABLE_FLOAT_TRUNCATE",
true },
361 {
"ENABLE_FLOAT_TRUNCATE",
false },
364 #if defined (ENABLE_JIT)
365 {
"ENABLE_JIT",
true },
367 {
"ENABLE_JIT",
false },
370 #if defined (OCTAVE_ENABLE_OPENMP)
371 {
"ENABLE_OPENMP",
true },
373 {
"ENABLE_OPENMP",
false },
422 struct build_info_struct
428 static const build_info_struct build_info[] =
577 const build_info_struct& elt = build_info[i++];
579 const char *key = elt.key;
582 build_env.
assign (key, elt.val);
590 const conf_info_struct& elt = conf_info[i++];
592 const char *key = elt.key;
595 config.
assign (key, elt.val);
600 bool unix_system =
true;
601 bool mac_system =
false;
602 bool windows_system =
false;
604 #if defined (__WIN32__)
605 windows_system =
true;
606 #if ! defined (__CYGWIN__)
611 #if defined (OCTAVE_USE_OS_X_API)
622 config.
assign (
"float_format",
625 config.
assign (
"words_big_endian",
628 config.
assign (
"words_little_endian",
647 std::string arg =
args(0).xstring_value (
"__octave_config_info__: OPTION argument must be a string");
652 info = find_config_info (build_env, arg);
655 info = find_config_info (build_features, arg);
658 error (
"__octave_config_info__: no info for '%s'", arg.c_str ());
663 retval =
ovl (config);
680 #if defined (__GNUG__) && defined (DEBUG_NEW_DELETE)
682 int debug_new_delete = 0;
684 typedef void (*vfp)(void);
685 extern vfp __new_handler;
688 __builtin_new (
size_t sz)
702 if (debug_new_delete)
703 std::cerr <<
"__builtin_new: " << p << std::endl;
709 __builtin_delete (
void *ptr)
711 if (debug_new_delete)
712 std::cerr <<
"__builtin_delete: " << ptr << std::endl;
#define OCTAVE_FCNFILEDIR
const char * RDYNAMIC_FLAG
const char * OSMESA_CPPFLAGS
bool is_empty(void) const
const char * UMFPACK_LDFLAGS
const char * X11_INCFLAGS
bool isfield(const std::string &name) const
const char * MAGICK_CPPFLAGS
const char * FLTK_LDFLAGS
const char * FFTW3_CPPFLAGS
#define OCTAVE_LOCALVEROCTFILEDIR
static std::string subst_octave_home(const std::string &s)
const char * LIBOCTINTERP
std::string liboctinterp_hg_id(void)
OCTAVE_EXPORT octave_value_list isa nd deftypefn *return ovl(args(0).is_integer_type())
OCTINTERP_API void print_usage(void)
const char * UMFPACK_CPPFLAGS
const char * F77_FLOAT_STORE_FLAG
const char * SUITESPARSE_CONFIG_LIBS
#define OCTAVE_LOCALFCNFILEDIR
identity matrix If supplied two scalar respectively For allows like xample val
const char * LLVM_LDFLAGS
const octave_value & contents(const_iterator p) const
octave_scalar_map features(void)
#define OCTAVE_LOCALSTARTUPFILEDIR
const char * COLAMD_LDFLAGS
const char * OSMESA_LDFLAGS
static void remove(pid_t pid)
#define DEFUN(name, args_name, nargout_name, doc)
const char * F77_INTEGER_8_FLAG
const char * QHULL_LDFLAGS
#define OCTAVE_LOCALARCHLIBDIR
void error(const char *fmt,...)
const char * QRUPDATE_CPPFLAGS
const char * FFTW3F_LDFLAGS
const char * PTHREAD_CFLAGS
#define OCTAVE_STARTUPFILEDIR
#define OCTAVE_OCTTESTSDIR
const char * FONTCONFIG_LIBS
#define OCTAVE_OCTFILEDIR
const char * LLVM_CPPFLAGS
const char * OCTAVE_LINK_DEPS
#define OCTAVE_API_VERSION
#define OCTAVE_ARCHLIBDIR
const char * CHOLMOD_CPPFLAGS
const char * FONTCONFIG_CPPFLAGS
#define OCTAVE_CANONICAL_HOST_TYPE
const char * CXSPARSE_CPPFLAGS
const char * XTRA_CXXFLAGS
static bool words_little_endian(void)
const char * QRUPDATE_LDFLAGS
const char * CURL_LDFLAGS
#define OCTAVE_DATAROOTDIR
const char * CCOLAMD_CPPFLAGS
const char * OCTAVE_LINK_OPTS
const char * CXSPARSE_LIBS
#define OCTAVE_RELEASE_DATE
const char * CXSPARSE_LDFLAGS
pid_t octave_async_system_wrapper(const char *cmd)
const char * FT2_CPPFLAGS
const char * FFTW3_LDFLAGS
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)
void add_fcn(void(*fcn)(void))
const char * LD_STATIC_FLAG
#define OCTAVE_DEFAULT_PAGER
const char * OCT_LINK_DEPS
static bool words_big_endian(void)
std::string octave_fftwf_version(void)
nd deftypefn *octave_map m
const char * OCT_LINK_OPTS
const char * ARPACK_CPPFLAGS
int wexitstatus(int status)
#define OCTAVE_INCLUDEDIR
const char * HDF5_CPPFLAGS
const char * AMD_CPPFLAGS
const char * HDF5_LDFLAGS
const char * CHOLMOD_LIBS
const char * CCOLAMD_LIBS
const char * QRUPDATE_LIBS
static std::string float_format_as_string(float_format)
#define OCTAVE_LOCALAPIFCNFILEDIR
the sparsity preserving column transformation such that that defines the pivoting threshold can be given in which case it defines the c
#define OCTAVE_LOCALOCTFILEDIR
#define OCTAVE_LOCALVERARCHLIBDIR
const char * CURL_CPPFLAGS
bool wifexited(int status)
static float_format native_float_format(void)
const char * UMFPACK_LIBS
octave::unwind_protect frame
#define OCTAVE_OCTDATADIR
#define OCTAVE_LOCALAPIOCTFILEDIR
const char * MAGICK_LDFLAGS
const char * GLPK_LDFLAGS
const char * CAMD_LDFLAGS
const char * PCRE_CPPFLAGS
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 text mode reading and writing automatically converts linefeeds to the appropriate line end character for the system(carriage-return linefeed on Windows, carriage-return on Macintosh).The default when no mode is specified is binary mode.Additionally
static octave_value_list run_command_and_return_output(const std::string &cmd_str)
const char * ARPACK_LDFLAGS
std::string octave_fftw_version(void)
=val(i)}if ode{val(i)}occurs in table i
#define OCTAVE_EXEC_PREFIX
void assign(const std::string &k, const octave_value &val)
const char * CCOLAMD_LDFLAGS
bool is_undefined(void) const
std::string octave_name_version_and_copyright(void)
const char * MKOCTFILE_DL_LDFLAGS
const char * READLINE_LIBS
#define OCTAVE_OCTINCLUDEDIR
const char * FFTW3F_CPPFLAGS
#define OCTAVE_LOCALAPIARCHLIBDIR
const char * QHULL_CPPFLAGS
#define OCTAVE_LIBEXECDIR
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
const char * CHOLMOD_LDFLAGS
int file_number(void) const
#define OCTAVE_LOCALVERFCNFILEDIR
const char * PTHREAD_LIBS
return octave_value(v1.char_array_value().concat(v2.char_array_value(), ra_idx),((a1.is_sq_string()||a2.is_sq_string())? '\'': '"'))
const char * COLAMD_CPPFLAGS