annotate libinterp/corefcn/toplev.cc @ 29654:d13d090cb03a stable

use std::size_t and std::ptrdiff_t in C++ code (bug #60471) Files affected: make_int.cc, file-editor-tab.cc, octave-qscintilla.cc, Cell.cc, Cell.h, call-stack.cc, call-stack.h, cellfun.cc, data.cc, debug.cc, dlmread.cc, error.cc, event-queue.h, fcn-info.cc, fcn-info.h, file-io.cc, ft-text-renderer.cc, gl2ps-print.cc, graphics.cc, graphics.in.h, help.cc, hex2num.cc, input.cc, latex-text-renderer.cc, load-path.cc, load-save.cc, load-save.h, ls-hdf5.cc, ls-mat-ascii.cc, ls-mat5.cc, ls-oct-text.cc, mex.cc, mexproto.h, mxarray.h, oct-map.cc, oct-stream.cc, oct-stream.h, pager.cc, pager.h, pr-output.cc, regexp.cc, settings.h, stack-frame.cc, stack-frame.h, strfns.cc, syminfo.cc, symrec.h, symscope.cc, symscope.h, symtab.cc, sysdep.cc, toplev.cc, utils.cc, utils.h, variables.cc, __fltk_uigetfile__.cc, __init_fltk__.cc, audioread.cc, gzip.cc, cdef-class.cc, cdef-manager.cc, cdef-method.cc, cdef-object.cc, cdef-object.h, ov-base-diag.cc, ov-base-diag.h, ov-base-mat.cc, ov-base-mat.h, ov-base-scalar.cc, ov-base-scalar.h, ov-base-sparse.h, ov-base.cc, ov-base.h, ov-cell.cc, ov-cell.h, ov-ch-mat.cc, ov-class.cc, ov-class.h, ov-classdef.cc, ov-fcn-handle.cc, ov-java.cc, ov-lazy-idx.h, ov-perm.cc, ov-perm.h, ov-range.h, ov-str-mat.cc, ov-struct.cc, ov-struct.h, ov-usr-fcn.cc, ov-usr-fcn.h, ov.cc, ov.h, ovl.cc, octave.cc, bp-table.cc, jit-ir.cc, jit-ir.h, jit-typeinfo.cc, jit-typeinfo.h, jit-util.h, lex.h, lex.ll, oct-lvalue.cc, oct-parse.yy, parse.h, profiler.h, pt-eval.cc, pt-eval.h, pt-jit.cc, pt-jit.h, pt-pr-code.cc, pt-tm-const.cc, pt-tm-const.h, Array.h, CMatrix.cc, DiagArray2.h, PermMatrix.h, Sparse.h, dMatrix.cc, fCMatrix.cc, fMatrix.cc, bsxfun-defs.cc, oct-fftw.cc, oct-fftw.h, randpoisson.cc, sparse-chol.cc, mx-inlines.cc, file-ops.cc, lo-sysdep.cc, oct-env.cc, oct-time.cc, action-container.cc, action-container.h, base-list.h, caseless-str.h, cmd-edit.cc, cmd-hist.cc, data-conv.cc, data-conv.h, f77-fcn.h, file-info.cc, file-info.h, kpse.cc, kpse.h, lo-cutils.h, lo-hash.h, lo-regexp.cc, oct-base64.cc, oct-base64.h, oct-binmap.h, oct-glob.cc, oct-shlib.cc, oct-shlib.h, oct-sort.cc, oct-sparse.h, oct-string.cc, quit.cc, unwind-prot.h, url-transfer.cc, main.in.cc, mkoctfile.in.cc, and shared-fcns.h. (grafted from aef11bb4e6d1f303ad9de5688fcb7244ef48867e)
author John W. Eaton <jwe@octave.org>
date Wed, 28 Apr 2021 22:57:42 -0400
parents 0a5b15007766
children 32f4357ac8d9
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
27923
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
1 ////////////////////////////////////////////////////////////////////////
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
2 //
29358
0a5b15007766 update Octave Project Developers copyright for the new year
John W. Eaton <jwe@octave.org>
parents: 28604
diff changeset
3 // Copyright (C) 1995-2021 The Octave Project Developers
27923
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
4 //
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
5 // See the file COPYRIGHT.md in the top-level directory of this
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
6 // distribution or <https://octave.org/copyright/>.
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
7 //
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
8 // This file is part of Octave.
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
9 //
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
10 // Octave is free software: you can redistribute it and/or modify it
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
11 // under the terms of the GNU General Public License as published by
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
12 // the Free Software Foundation, either version 3 of the License, or
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
13 // (at your option) any later version.
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
14 //
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
15 // Octave is distributed in the hope that it will be useful, but
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
16 // WITHOUT ANY WARRANTY; without even the implied warranty of
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
17 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
18 // GNU General Public License for more details.
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
19 //
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
20 // You should have received a copy of the GNU General Public License
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
21 // along with Octave; see the file COPYING. If not, see
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
22 // <https://www.gnu.org/licenses/>.
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
23 //
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
24 ////////////////////////////////////////////////////////////////////////
1683
5282f171363d [project @ 1995-12-30 03:46:07 by jwe]
jwe
parents:
diff changeset
25
21724
aba2e6293dd8 use "#if ..." consistently instead of "#ifdef" and "#ifndef"
John W. Eaton <jwe@octave.org>
parents: 21618
diff changeset
26 #if defined (HAVE_CONFIG_H)
21301
40de9f8f23a6 Use '#include "config.h"' rather than <config.h>.
Rik <rik@octave.org>
parents: 21253
diff changeset
27 # include "config.h"
1683
5282f171363d [project @ 1995-12-30 03:46:07 by jwe]
jwe
parents:
diff changeset
28 #endif
5282f171363d [project @ 1995-12-30 03:46:07 by jwe]
jwe
parents:
diff changeset
29
4489
a90c3cbded0d [project @ 2003-08-28 16:08:26 by jwe]
jwe
parents: 4440
diff changeset
30 #include <cerrno>
1683
5282f171363d [project @ 1995-12-30 03:46:07 by jwe]
jwe
parents:
diff changeset
31 #include <cstdlib>
25438
cb1606f78f6b prefer <istream>, <ostream>, or <iosfwd> to <iostream> where possible
John W. Eaton <jwe@octave.org>
parents: 25284
diff changeset
32
4221
a7d8e5dd87ad [project @ 2002-12-06 22:34:47 by jwe]
jwe
parents: 4217
diff changeset
33 #include <new>
5765
7ba9ad1fec11 [project @ 2006-04-17 05:05:15 by jwe]
jwe
parents: 5744
diff changeset
34 #include <sstream>
1728
42b4f904f1af [project @ 1996-01-09 11:36:01 by jwe]
jwe
parents: 1704
diff changeset
35 #include <string>
42b4f904f1af [project @ 1996-01-09 11:36:01 by jwe]
jwe
parents: 1704
diff changeset
36
21979
d04da18a407a use OCTAVE_USE_WINDOWS_API more consistently
John W. Eaton <jwe@octave.org>
parents: 21966
diff changeset
37 #if defined (OCTAVE_USE_WINDOWS_API)
21949
baeffde5c87d fix build for Windows systems
John W. Eaton <jwe@octave.org>
parents: 21942
diff changeset
38 # define WIN32_LEAN_AND_MEAN 1
baeffde5c87d fix build for Windows systems
John W. Eaton <jwe@octave.org>
parents: 21942
diff changeset
39 # include <windows.h>
baeffde5c87d fix build for Windows systems
John W. Eaton <jwe@octave.org>
parents: 21942
diff changeset
40 #endif
baeffde5c87d fix build for Windows systems
John W. Eaton <jwe@octave.org>
parents: 21942
diff changeset
41
22264
9b78fda78300 fix build failure for --without-z (bug #48757)
John W. Eaton <jwe@octave.org>
parents: 22094
diff changeset
42 #include "async-system-wrapper.h"
22094
9203833cab7d move new interpreter class to separate file
John W. Eaton <jwe@octave.org>
parents: 22091
diff changeset
43 #include "child-list.h"
1683
5282f171363d [project @ 1995-12-30 03:46:07 by jwe]
jwe
parents:
diff changeset
44 #include "lo-error.h"
21600
184b85b31e03 more updates for version function
mmuetzel <markus.muetzel@gmx.de>
parents: 21598
diff changeset
45 #include "oct-fftw.h"
13983
7dd7cccf0757 clean up memory allocated for singletons before exit
John W. Eaton <jwe@octave.org>
parents: 13981
diff changeset
46 #include "oct-locbuf.h"
21921
ecfcc8527661 hide sys/wait.h header and provide wrappers for waitpid macros
John W. Eaton <jwe@octave.org>
parents: 21907
diff changeset
47 #include "oct-syscalls.h"
25284
78fb24bdd8bb unblock async signals before executing subprocess (bug #53635)
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
48 #include "signal-wrappers.h"
1755
3a9462b655f1 [project @ 1996-01-22 04:47:22 by jwe]
jwe
parents: 1751
diff changeset
49 #include "str-vec.h"
21899
7c053ad1c7ba hide sys/select header
John W. Eaton <jwe@octave.org>
parents: 21855
diff changeset
50 #include "wait-for-input.h"
1683
5282f171363d [project @ 1995-12-30 03:46:07 by jwe]
jwe
parents:
diff changeset
51
21220
d78e45987d6a rename octave::build_env namespace from octave::config
John W. Eaton <jwe@octave.org>
parents: 21200
diff changeset
52 #include "build-env.h"
21607
37f6ed8a6f1b store liboctave and liboctinterp hg ids separately
John W. Eaton <jwe@octave.org>
parents: 21605
diff changeset
53 #include "liboctinterp-build-info.h"
13983
7dd7cccf0757 clean up memory allocated for singletons before exit
John W. Eaton <jwe@octave.org>
parents: 13981
diff changeset
54 #include "defaults.h"
1683
5282f171363d [project @ 1995-12-30 03:46:07 by jwe]
jwe
parents:
diff changeset
55 #include "defun.h"
5282f171363d [project @ 1995-12-30 03:46:07 by jwe]
jwe
parents:
diff changeset
56 #include "error.h"
5282f171363d [project @ 1995-12-30 03:46:07 by jwe]
jwe
parents:
diff changeset
57 #include "file-io.h"
23712
b95c430c0649 revamp insertion of config variables into binaries and eliminate some macros
John W. Eaton <jwe@octave.org>
parents: 23577
diff changeset
58 #include "help.h"
24734
5d8c4cbc56d7 don't use singleton pattern for child_list
John W. Eaton <jwe@octave.org>
parents: 24534
diff changeset
59 #include "interpreter-private.h"
22089
c2c668b3051b use classes for octave application and interpreter
John W. Eaton <jwe@octave.org>
parents: 22051
diff changeset
60 #include "octave.h"
2162
a940dcdfe9de [project @ 1996-05-13 10:31:51 by jwe]
jwe
parents: 2145
diff changeset
61 #include "oct-map.h"
20940
48b2ad5ee801 maint: Rename oct-obj.[cc|h] to ovl.[cc|h] for clarity.
Rik <rik@octave.org>
parents: 20939
diff changeset
62 #include "ovl.h"
13983
7dd7cccf0757 clean up memory allocated for singletons before exit
John W. Eaton <jwe@octave.org>
parents: 13981
diff changeset
63 #include "ov.h"
1683
5282f171363d [project @ 1995-12-30 03:46:07 by jwe]
jwe
parents:
diff changeset
64 #include "pager.h"
5282f171363d [project @ 1995-12-30 03:46:07 by jwe]
jwe
parents:
diff changeset
65 #include "procstream.h"
5282f171363d [project @ 1995-12-30 03:46:07 by jwe]
jwe
parents:
diff changeset
66 #include "sysdep.h"
5282f171363d [project @ 1995-12-30 03:46:07 by jwe]
jwe
parents:
diff changeset
67 #include "unwind-prot.h"
5282f171363d [project @ 1995-12-30 03:46:07 by jwe]
jwe
parents:
diff changeset
68 #include "utils.h"
23466
5da300c55e89 use "" instead of <> for including defaults.h and version.h
John W. Eaton <jwe@octave.org>
parents: 23220
diff changeset
69 #include "version.h"
1683
5282f171363d [project @ 1995-12-30 03:46:07 by jwe]
jwe
parents:
diff changeset
70
21724
aba2e6293dd8 use "#if ..." consistently instead of "#ifdef" and "#ifndef"
John W. Eaton <jwe@octave.org>
parents: 21618
diff changeset
71 #if ! defined (SHELL_PATH)
21200
fcac5dbbf9ed maint: Indent #ifdef blocks in libinterp.
Rik <rik@octave.org>
parents: 21182
diff changeset
72 # define SHELL_PATH "/bin/sh"
15756
ea1a1fb00744 Make the path to the shell interpreter configuable
Mike Miller <mtmiller@ieee.org>
parents: 15596
diff changeset
73 #endif
ea1a1fb00744 Make the path to the shell interpreter configuable
Mike Miller <mtmiller@ieee.org>
parents: 15596
diff changeset
74
1957
0e6a0a271998 [project @ 1996-02-15 01:08:15 by jwe]
jwe
parents: 1907
diff changeset
75 DEFUN (warranty, , ,
21966
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21949
diff changeset
76 doc: /* -*- texinfo -*-
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21949
diff changeset
77 @deftypefn {} {} warranty ()
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21949
diff changeset
78 Describe the conditions for copying and distributing Octave.
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21949
diff changeset
79 @end deftypefn */)
1683
5282f171363d [project @ 1995-12-30 03:46:07 by jwe]
jwe
parents:
diff changeset
80 {
17510
7542f4496974 eliminate some macros in version.h
John W. Eaton <jwe@octave.org>
parents: 17281
diff changeset
81 octave_stdout << "\n" << octave_name_version_and_copyright () << "\n\
3922
38c61cbf086c [project @ 2002-05-01 06:48:35 by jwe]
jwe
parents: 3892
diff changeset
82 \n\
24534
194eb4bd202b maint: Update punctuation for GPL v3 license text.
Rik <rik@octave.org>
parents: 24009
diff changeset
83 GNU Octave is free software: you can redistribute it and/or modify it\n\
24007
e8a74d95b4f3 maint: Use same format for Copyright statement throught code base.
Rik <rik@octave.org>
parents: 23990
diff changeset
84 under the terms of the GNU General Public License as published by\n\
24534
194eb4bd202b maint: Update punctuation for GPL v3 license text.
Rik <rik@octave.org>
parents: 24009
diff changeset
85 the Free Software Foundation, either version 3 of the License, or\n\
1683
5282f171363d [project @ 1995-12-30 03:46:07 by jwe]
jwe
parents:
diff changeset
86 (at your option) any later version.\n\
5282f171363d [project @ 1995-12-30 03:46:07 by jwe]
jwe
parents:
diff changeset
87 \n\
26177
f2d795f07c84 maint: Use standard copyright phrasing in all files.
Rik <rik@octave.org>
parents: 25931
diff changeset
88 GNU Octave is distributed in the hope that it will be useful, but\n\
f2d795f07c84 maint: Use standard copyright phrasing in all files.
Rik <rik@octave.org>
parents: 25931
diff changeset
89 WITHOUT ANY WARRANTY; without even the implied warranty of\n\
1683
5282f171363d [project @ 1995-12-30 03:46:07 by jwe]
jwe
parents:
diff changeset
90 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n\
5282f171363d [project @ 1995-12-30 03:46:07 by jwe]
jwe
parents:
diff changeset
91 GNU General Public License for more details.\n\
5282f171363d [project @ 1995-12-30 03:46:07 by jwe]
jwe
parents:
diff changeset
92 \n\
5282f171363d [project @ 1995-12-30 03:46:07 by jwe]
jwe
parents:
diff changeset
93 You should have received a copy of the GNU General Public License\n\
24007
e8a74d95b4f3 maint: Use same format for Copyright statement throught code base.
Rik <rik@octave.org>
parents: 23990
diff changeset
94 along with GNU Octave; see the file COPYING. If not, see\n\
24534
194eb4bd202b maint: Update punctuation for GPL v3 license text.
Rik <rik@octave.org>
parents: 24009
diff changeset
95 <https://www.gnu.org/licenses/>.\n\
1683
5282f171363d [project @ 1995-12-30 03:46:07 by jwe]
jwe
parents:
diff changeset
96 \n";
5282f171363d [project @ 1995-12-30 03:46:07 by jwe]
jwe
parents:
diff changeset
97
21078
49852ff04747 maint: Remove unnecessary declarations of retval.
Rik <rik@octave.org>
parents: 21055
diff changeset
98 return ovl ();
1683
5282f171363d [project @ 1995-12-30 03:46:07 by jwe]
jwe
parents:
diff changeset
99 }
5282f171363d [project @ 1995-12-30 03:46:07 by jwe]
jwe
parents:
diff changeset
100
5282f171363d [project @ 1995-12-30 03:46:07 by jwe]
jwe
parents:
diff changeset
101 // Execute a shell command.
5282f171363d [project @ 1995-12-30 03:46:07 by jwe]
jwe
parents:
diff changeset
102
2086
bfb775fb6fe8 [project @ 1996-04-25 05:55:19 by jwe]
jwe
parents: 2084
diff changeset
103 static octave_value_list
3523
b80bbb43a1a9 [project @ 2000-02-02 10:25:52 by jwe]
jwe
parents: 3503
diff changeset
104 run_command_and_return_output (const std::string& cmd_str)
2083
679d7262a525 [project @ 1996-04-25 04:29:27 by jwe]
jwe
parents: 2078
diff changeset
105 {
2086
bfb775fb6fe8 [project @ 1996-04-25 05:55:19 by jwe]
jwe
parents: 2084
diff changeset
106 octave_value_list retval;
21743
f4d7d0eb5b0c use namespace for unwind_protect class
John W. Eaton <jwe@octave.org>
parents: 21739
diff changeset
107 octave::unwind_protect frame;
2083
679d7262a525 [project @ 1996-04-25 04:29:27 by jwe]
jwe
parents: 2078
diff changeset
108
679d7262a525 [project @ 1996-04-25 04:29:27 by jwe]
jwe
parents: 2078
diff changeset
109 iprocstream *cmd = new iprocstream (cmd_str.c_str ());
24734
5d8c4cbc56d7 don't use singleton pattern for child_list
John W. Eaton <jwe@octave.org>
parents: 24534
diff changeset
110 frame.add_delete (cmd);
2083
679d7262a525 [project @ 1996-04-25 04:29:27 by jwe]
jwe
parents: 2078
diff changeset
111
24734
5d8c4cbc56d7 don't use singleton pattern for child_list
John W. Eaton <jwe@octave.org>
parents: 24534
diff changeset
112 octave::child_list& kids
5d8c4cbc56d7 don't use singleton pattern for child_list
John W. Eaton <jwe@octave.org>
parents: 24534
diff changeset
113 = octave::__get_child_list__ ("run_command_and_return_output");
5d8c4cbc56d7 don't use singleton pattern for child_list
John W. Eaton <jwe@octave.org>
parents: 24534
diff changeset
114 frame.add_method (kids, &octave::child_list::remove, cmd->pid ());
3060
9c6cd52f3f5a [project @ 1997-06-25 18:30:40 by jwe]
jwe
parents: 3020
diff changeset
115
20962
3aa293be0e8d maint: Invert simple conditionals in if/else/error paradigm.
Rik <rik@octave.org>
parents: 20946
diff changeset
116 if (! *cmd)
3aa293be0e8d maint: Invert simple conditionals in if/else/error paradigm.
Rik <rik@octave.org>
parents: 20946
diff changeset
117 error ("system: unable to start subprocess for '%s'", cmd_str.c_str ());
3aa293be0e8d maint: Invert simple conditionals in if/else/error paradigm.
Rik <rik@octave.org>
parents: 20946
diff changeset
118
3aa293be0e8d maint: Invert simple conditionals in if/else/error paradigm.
Rik <rik@octave.org>
parents: 20946
diff changeset
119 int fid = cmd->file_number ();
3aa293be0e8d maint: Invert simple conditionals in if/else/error paradigm.
Rik <rik@octave.org>
parents: 20946
diff changeset
120
3aa293be0e8d maint: Invert simple conditionals in if/else/error paradigm.
Rik <rik@octave.org>
parents: 20946
diff changeset
121 std::ostringstream output_buf;
2095
36903d507b0e [project @ 1996-04-28 09:00:07 by jwe]
jwe
parents: 2086
diff changeset
122
20962
3aa293be0e8d maint: Invert simple conditionals in if/else/error paradigm.
Rik <rik@octave.org>
parents: 20946
diff changeset
123 char ch;
4494
93ad80b6eef6 [project @ 2003-09-03 20:27:00 by jwe]
jwe
parents: 4489
diff changeset
124
20962
3aa293be0e8d maint: Invert simple conditionals in if/else/error paradigm.
Rik <rik@octave.org>
parents: 20946
diff changeset
125 for (;;)
3aa293be0e8d maint: Invert simple conditionals in if/else/error paradigm.
Rik <rik@octave.org>
parents: 20946
diff changeset
126 {
3aa293be0e8d maint: Invert simple conditionals in if/else/error paradigm.
Rik <rik@octave.org>
parents: 20946
diff changeset
127 if (cmd->get (ch))
3aa293be0e8d maint: Invert simple conditionals in if/else/error paradigm.
Rik <rik@octave.org>
parents: 20946
diff changeset
128 output_buf.put (ch);
3aa293be0e8d maint: Invert simple conditionals in if/else/error paradigm.
Rik <rik@octave.org>
parents: 20946
diff changeset
129 else
10212
56f7734f5448 fix process creation failure handling in system()
Jaroslav Hajek <highegg@gmail.com>
parents: 10186
diff changeset
130 {
20962
3aa293be0e8d maint: Invert simple conditionals in if/else/error paradigm.
Rik <rik@octave.org>
parents: 20946
diff changeset
131 if (! cmd->eof () && errno == EAGAIN)
10212
56f7734f5448 fix process creation failure handling in system()
Jaroslav Hajek <highegg@gmail.com>
parents: 10186
diff changeset
132 {
20962
3aa293be0e8d maint: Invert simple conditionals in if/else/error paradigm.
Rik <rik@octave.org>
parents: 20946
diff changeset
133 cmd->clear ();
3147
894d516b4a00 [project @ 1998-02-06 06:00:08 by jwe]
jwe
parents: 3141
diff changeset
134
21899
7c053ad1c7ba hide sys/select header
John W. Eaton <jwe@octave.org>
parents: 21855
diff changeset
135 if (octave_wait_for_input (fid) != 1)
10212
56f7734f5448 fix process creation failure handling in system()
Jaroslav Hajek <highegg@gmail.com>
parents: 10186
diff changeset
136 break;
56f7734f5448 fix process creation failure handling in system()
Jaroslav Hajek <highegg@gmail.com>
parents: 10186
diff changeset
137 }
20962
3aa293be0e8d maint: Invert simple conditionals in if/else/error paradigm.
Rik <rik@octave.org>
parents: 20946
diff changeset
138 else
3aa293be0e8d maint: Invert simple conditionals in if/else/error paradigm.
Rik <rik@octave.org>
parents: 20946
diff changeset
139 break;
10212
56f7734f5448 fix process creation failure handling in system()
Jaroslav Hajek <highegg@gmail.com>
parents: 10186
diff changeset
140 }
20962
3aa293be0e8d maint: Invert simple conditionals in if/else/error paradigm.
Rik <rik@octave.org>
parents: 20946
diff changeset
141 }
3147
894d516b4a00 [project @ 1998-02-06 06:00:08 by jwe]
jwe
parents: 3141
diff changeset
142
20962
3aa293be0e8d maint: Invert simple conditionals in if/else/error paradigm.
Rik <rik@octave.org>
parents: 20946
diff changeset
143 int cmd_status = cmd->close ();
2083
679d7262a525 [project @ 1996-04-25 04:29:27 by jwe]
jwe
parents: 2078
diff changeset
144
21921
ecfcc8527661 hide sys/wait.h header and provide wrappers for waitpid macros
John W. Eaton <jwe@octave.org>
parents: 21907
diff changeset
145 if (octave::sys::wifexited (cmd_status))
ecfcc8527661 hide sys/wait.h header and provide wrappers for waitpid macros
John W. Eaton <jwe@octave.org>
parents: 21907
diff changeset
146 cmd_status = octave::sys::wexitstatus (cmd_status);
20962
3aa293be0e8d maint: Invert simple conditionals in if/else/error paradigm.
Rik <rik@octave.org>
parents: 20946
diff changeset
147 else
3aa293be0e8d maint: Invert simple conditionals in if/else/error paradigm.
Rik <rik@octave.org>
parents: 20946
diff changeset
148 cmd_status = 127;
2083
679d7262a525 [project @ 1996-04-25 04:29:27 by jwe]
jwe
parents: 2078
diff changeset
149
20962
3aa293be0e8d maint: Invert simple conditionals in if/else/error paradigm.
Rik <rik@octave.org>
parents: 20946
diff changeset
150 retval = ovl (cmd_status, output_buf.str ());
2083
679d7262a525 [project @ 1996-04-25 04:29:27 by jwe]
jwe
parents: 2078
diff changeset
151
679d7262a525 [project @ 1996-04-25 04:29:27 by jwe]
jwe
parents: 2078
diff changeset
152 return retval;
679d7262a525 [project @ 1996-04-25 04:29:27 by jwe]
jwe
parents: 2078
diff changeset
153 }
679d7262a525 [project @ 1996-04-25 04:29:27 by jwe]
jwe
parents: 2078
diff changeset
154
25284
78fb24bdd8bb unblock async signals before executing subprocess (bug #53635)
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
155 // Combine alloc+get in one action.
78fb24bdd8bb unblock async signals before executing subprocess (bug #53635)
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
156
78fb24bdd8bb unblock async signals before executing subprocess (bug #53635)
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
157 static void *
78fb24bdd8bb unblock async signals before executing subprocess (bug #53635)
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
158 get_signal_mask (void)
78fb24bdd8bb unblock async signals before executing subprocess (bug #53635)
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
159 {
78fb24bdd8bb unblock async signals before executing subprocess (bug #53635)
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
160 void *mask = octave_alloc_signal_mask ();
78fb24bdd8bb unblock async signals before executing subprocess (bug #53635)
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
161
78fb24bdd8bb unblock async signals before executing subprocess (bug #53635)
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
162 octave_get_signal_mask (mask);
78fb24bdd8bb unblock async signals before executing subprocess (bug #53635)
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
163
78fb24bdd8bb unblock async signals before executing subprocess (bug #53635)
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
164 return mask;
78fb24bdd8bb unblock async signals before executing subprocess (bug #53635)
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
165 }
78fb24bdd8bb unblock async signals before executing subprocess (bug #53635)
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
166
78fb24bdd8bb unblock async signals before executing subprocess (bug #53635)
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
167 // Combine set+free in one action.
78fb24bdd8bb unblock async signals before executing subprocess (bug #53635)
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
168
78fb24bdd8bb unblock async signals before executing subprocess (bug #53635)
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
169 static void
78fb24bdd8bb unblock async signals before executing subprocess (bug #53635)
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
170 restore_signal_mask (void *mask)
78fb24bdd8bb unblock async signals before executing subprocess (bug #53635)
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
171 {
78fb24bdd8bb unblock async signals before executing subprocess (bug #53635)
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
172 octave_set_signal_mask (mask);
78fb24bdd8bb unblock async signals before executing subprocess (bug #53635)
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
173
78fb24bdd8bb unblock async signals before executing subprocess (bug #53635)
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
174 octave_free_signal_mask (mask);
78fb24bdd8bb unblock async signals before executing subprocess (bug #53635)
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
175 }
78fb24bdd8bb unblock async signals before executing subprocess (bug #53635)
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
176
5285
fe5ee25a5e6c [project @ 2005-04-19 15:02:49 by jwe]
jwe
parents: 5275
diff changeset
177 enum system_exec_type { et_sync, et_async };
fe5ee25a5e6c [project @ 2005-04-19 15:02:49 by jwe]
jwe
parents: 5275
diff changeset
178
1957
0e6a0a271998 [project @ 1996-02-15 01:08:15 by jwe]
jwe
parents: 1907
diff changeset
179 DEFUN (system, args, nargout,
21966
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21949
diff changeset
180 doc: /* -*- texinfo -*-
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21949
diff changeset
181 @deftypefn {} {} system ("@var{string}")
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21949
diff changeset
182 @deftypefnx {} {} system ("@var{string}", @var{return_output})
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21949
diff changeset
183 @deftypefnx {} {} system ("@var{string}", @var{return_output}, @var{type})
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21949
diff changeset
184 @deftypefnx {} {[@var{status}, @var{output}] =} system (@dots{})
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21949
diff changeset
185 Execute a shell command specified by @var{string}.
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21949
diff changeset
186
28604
69cba42a01ca doc: Re-order system() docs to match order of parameters.
Rik <rik@octave.org>
parents: 27923
diff changeset
187 If @var{system} is called with one or more output arguments, or if the optional
69cba42a01ca doc: Re-order system() docs to match order of parameters.
Rik <rik@octave.org>
parents: 27923
diff changeset
188 argument @var{return_output} is true and the subprocess is started
21966
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21949
diff changeset
189 synchronously, then the output from the command is returned as a variable.
28604
69cba42a01ca doc: Re-order system() docs to match order of parameters.
Rik <rik@octave.org>
parents: 27923
diff changeset
190 Otherwise, if the subprocess is executed synchronously, its output is sent to
69cba42a01ca doc: Re-order system() docs to match order of parameters.
Rik <rik@octave.org>
parents: 27923
diff changeset
191 the standard output. To send the output of a command executed with
21966
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21949
diff changeset
192 @code{system} through the pager, use a command like
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21949
diff changeset
193
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21949
diff changeset
194 @example
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21949
diff changeset
195 @group
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21949
diff changeset
196 [~, text] = system ("cmd");
24801
daf61c7dfcae Change default status of pager to "off" (bug #53217).
Rik <rik@octave.org>
parents: 24734
diff changeset
197 more on;
21966
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21949
diff changeset
198 disp (text);
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21949
diff changeset
199 @end group
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21949
diff changeset
200 @end example
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21949
diff changeset
201
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21949
diff changeset
202 @noindent
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21949
diff changeset
203 or
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21949
diff changeset
204
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21949
diff changeset
205 @example
24801
daf61c7dfcae Change default status of pager to "off" (bug #53217).
Rik <rik@octave.org>
parents: 24734
diff changeset
206 @group
daf61c7dfcae Change default status of pager to "off" (bug #53217).
Rik <rik@octave.org>
parents: 24734
diff changeset
207 more on;
21966
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21949
diff changeset
208 printf ("%s\n", nthargout (2, "system", "cmd"));
24801
daf61c7dfcae Change default status of pager to "off" (bug #53217).
Rik <rik@octave.org>
parents: 24734
diff changeset
209 @end group
21966
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21949
diff changeset
210 @end example
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21949
diff changeset
211
28604
69cba42a01ca doc: Re-order system() docs to match order of parameters.
Rik <rik@octave.org>
parents: 27923
diff changeset
212 If the optional argument @var{type} is @qcode{"async"}, the process is started
69cba42a01ca doc: Re-order system() docs to match order of parameters.
Rik <rik@octave.org>
parents: 27923
diff changeset
213 in the background and the process ID of the child process is returned
69cba42a01ca doc: Re-order system() docs to match order of parameters.
Rik <rik@octave.org>
parents: 27923
diff changeset
214 immediately. Otherwise, the child process is started and Octave waits until it
69cba42a01ca doc: Re-order system() docs to match order of parameters.
Rik <rik@octave.org>
parents: 27923
diff changeset
215 exits. If the @var{type} argument is omitted, it defaults to the value
69cba42a01ca doc: Re-order system() docs to match order of parameters.
Rik <rik@octave.org>
parents: 27923
diff changeset
216 @qcode{"sync"}.
69cba42a01ca doc: Re-order system() docs to match order of parameters.
Rik <rik@octave.org>
parents: 27923
diff changeset
217
69cba42a01ca doc: Re-order system() docs to match order of parameters.
Rik <rik@octave.org>
parents: 27923
diff changeset
218 The @code{system} function can return two values. The first is the exit status
69cba42a01ca doc: Re-order system() docs to match order of parameters.
Rik <rik@octave.org>
parents: 27923
diff changeset
219 of the command and the second is any output from the command that was written
69cba42a01ca doc: Re-order system() docs to match order of parameters.
Rik <rik@octave.org>
parents: 27923
diff changeset
220 to the standard output stream. For example,
21966
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21949
diff changeset
221
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21949
diff changeset
222 @example
24009
eef8c31ffe97 Document that the shell for system() differs between OS (bug #49825).
Rik <rik@octave.org>
parents: 24007
diff changeset
223 [status, output] = system ("echo foo & exit 2");
21966
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21949
diff changeset
224 @end example
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21949
diff changeset
225
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21949
diff changeset
226 @noindent
28604
69cba42a01ca doc: Re-order system() docs to match order of parameters.
Rik <rik@octave.org>
parents: 27923
diff changeset
227 will set the variable @var{output} to the string @samp{foo}, and the variable
69cba42a01ca doc: Re-order system() docs to match order of parameters.
Rik <rik@octave.org>
parents: 27923
diff changeset
228 @var{status} to the integer @samp{2}.
21966
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21949
diff changeset
229
28604
69cba42a01ca doc: Re-order system() docs to match order of parameters.
Rik <rik@octave.org>
parents: 27923
diff changeset
230 For commands run asynchronously, @var{status} is the process id of the command
69cba42a01ca doc: Re-order system() docs to match order of parameters.
Rik <rik@octave.org>
parents: 27923
diff changeset
231 shell that is started to run the command.
24009
eef8c31ffe97 Document that the shell for system() differs between OS (bug #49825).
Rik <rik@octave.org>
parents: 24007
diff changeset
232
eef8c31ffe97 Document that the shell for system() differs between OS (bug #49825).
Rik <rik@octave.org>
parents: 24007
diff changeset
233 The shell used for executing commands varies with operating system and is
25003
2365c2661b3c doc: Spellcheck documentation ahead of 4.4 release.
Rik <rik@octave.org>
parents: 24899
diff changeset
234 typically @file{/bin/sh} for UNIX systems and @nospell{@file{cmd.exe}} for
28604
69cba42a01ca doc: Re-order system() docs to match order of parameters.
Rik <rik@octave.org>
parents: 27923
diff changeset
235 Windows systems.
21966
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21949
diff changeset
236 @seealso{unix, dos}
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21949
diff changeset
237 @end deftypefn */)
1683
5282f171363d [project @ 1995-12-30 03:46:07 by jwe]
jwe
parents:
diff changeset
238 {
5282f171363d [project @ 1995-12-30 03:46:07 by jwe]
jwe
parents:
diff changeset
239 int nargin = args.length ();
5282f171363d [project @ 1995-12-30 03:46:07 by jwe]
jwe
parents:
diff changeset
240
20799
c349d4c91ce2 eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20791
diff changeset
241 if (nargin == 0 || nargin > 3)
c349d4c91ce2 eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20791
diff changeset
242 print_usage ();
2083
679d7262a525 [project @ 1996-04-25 04:29:27 by jwe]
jwe
parents: 2078
diff changeset
243
20799
c349d4c91ce2 eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20791
diff changeset
244 system_exec_type type = et_sync;
c349d4c91ce2 eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20791
diff changeset
245 if (nargin == 3)
c349d4c91ce2 eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20791
diff changeset
246 {
c349d4c91ce2 eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20791
diff changeset
247 std::string type_str = args(2).xstring_value ("system: TYPE must be a string");
11123
fbec4b3be59f toplev.cc (Fsystem): allow optional return_output and type arguments to be specified independently
John W. Eaton <jwe@octave.org>
parents: 11104
diff changeset
248
20799
c349d4c91ce2 eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20791
diff changeset
249 if (type_str == "sync")
c349d4c91ce2 eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20791
diff changeset
250 type = et_sync;
c349d4c91ce2 eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20791
diff changeset
251 else if (type_str == "async")
c349d4c91ce2 eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20791
diff changeset
252 type = et_async;
c349d4c91ce2 eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20791
diff changeset
253 else
23803
90689bdbe048 Use C++11 raw string literals to avoid escaping double quotes.
Rik <rik@octave.org>
parents: 23721
diff changeset
254 error (R"(system: TYPE must be "sync" or "async")");
20799
c349d4c91ce2 eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20791
diff changeset
255 }
11123
fbec4b3be59f toplev.cc (Fsystem): allow optional return_output and type arguments to be specified independently
John W. Eaton <jwe@octave.org>
parents: 11104
diff changeset
256
20939
b17fda023ca6 maint: Use new C++ archetype in more files.
Rik <rik@octave.org>
parents: 20923
diff changeset
257 octave_value_list retval;
b17fda023ca6 maint: Use new C++ archetype in more files.
Rik <rik@octave.org>
parents: 20923
diff changeset
258
b17fda023ca6 maint: Use new C++ archetype in more files.
Rik <rik@octave.org>
parents: 20923
diff changeset
259 bool return_output = (nargin == 1 && nargout > 1);
b17fda023ca6 maint: Use new C++ archetype in more files.
Rik <rik@octave.org>
parents: 20923
diff changeset
260
20799
c349d4c91ce2 eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20791
diff changeset
261 if (nargin > 1)
c349d4c91ce2 eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20791
diff changeset
262 {
c349d4c91ce2 eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20791
diff changeset
263 try
c349d4c91ce2 eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20791
diff changeset
264 {
c349d4c91ce2 eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20791
diff changeset
265 return_output = args(1).is_true ();
c349d4c91ce2 eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20791
diff changeset
266 }
22327
d0562b3159c7 move more classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 22323
diff changeset
267 catch (octave::execution_exception& e)
20799
c349d4c91ce2 eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20791
diff changeset
268 {
c349d4c91ce2 eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20791
diff changeset
269 error (e, "system: RETURN_OUTPUT must be boolean value true or false");
c349d4c91ce2 eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20791
diff changeset
270 }
c349d4c91ce2 eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20791
diff changeset
271 }
c349d4c91ce2 eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20791
diff changeset
272
c349d4c91ce2 eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20791
diff changeset
273 if (return_output && type == et_async)
20831
35241c4b696c eliminate return statements after calls to error
John W. Eaton <jwe@octave.org>
parents: 20799
diff changeset
274 error ("system: can't return output from commands run asynchronously");
20799
c349d4c91ce2 eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20791
diff changeset
275
c349d4c91ce2 eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20791
diff changeset
276 std::string cmd_str = args(0).xstring_value ("system: first argument must be a string");
1683
5282f171363d [project @ 1995-12-30 03:46:07 by jwe]
jwe
parents:
diff changeset
277
21979
d04da18a407a use OCTAVE_USE_WINDOWS_API more consistently
John W. Eaton <jwe@octave.org>
parents: 21966
diff changeset
278 #if defined (OCTAVE_USE_WINDOWS_API)
20799
c349d4c91ce2 eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20791
diff changeset
279 // Work around weird double-quote handling on Windows systems.
c349d4c91ce2 eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20791
diff changeset
280 if (type == et_sync)
23803
90689bdbe048 Use C++11 raw string literals to avoid escaping double quotes.
Rik <rik@octave.org>
parents: 23721
diff changeset
281 cmd_str = '"' + cmd_str + '"';
7104
b26d0cd10a42 [project @ 2007-11-06 17:18:41 by jwe]
jwe
parents: 7017
diff changeset
282 #endif
b26d0cd10a42 [project @ 2007-11-06 17:18:41 by jwe]
jwe
parents: 7017
diff changeset
283
25284
78fb24bdd8bb unblock async signals before executing subprocess (bug #53635)
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
284 octave::unwind_protect frame;
78fb24bdd8bb unblock async signals before executing subprocess (bug #53635)
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
285
78fb24bdd8bb unblock async signals before executing subprocess (bug #53635)
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
286 frame.add_fcn (restore_signal_mask, get_signal_mask ());
78fb24bdd8bb unblock async signals before executing subprocess (bug #53635)
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
287
78fb24bdd8bb unblock async signals before executing subprocess (bug #53635)
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
288 octave_unblock_async_signals ();
26826
20881d195d20 fix handling of SIGTSTP (bug #51903)
John W. Eaton <jwe@octave.org>
parents: 26603
diff changeset
289 octave_unblock_signal_by_name ("SIGTSTP");
25284
78fb24bdd8bb unblock async signals before executing subprocess (bug #53635)
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
290
20799
c349d4c91ce2 eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20791
diff changeset
291 if (type == et_async)
22264
9b78fda78300 fix build failure for --without-z (bug #48757)
John W. Eaton <jwe@octave.org>
parents: 22094
diff changeset
292 retval(0) = octave_async_system_wrapper (cmd_str.c_str ());
20799
c349d4c91ce2 eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20791
diff changeset
293 else if (return_output)
c349d4c91ce2 eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20791
diff changeset
294 retval = run_command_and_return_output (cmd_str);
c349d4c91ce2 eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20791
diff changeset
295 else
c349d4c91ce2 eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20791
diff changeset
296 {
c349d4c91ce2 eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20791
diff changeset
297 int status = system (cmd_str.c_str ());
2321
dac9933079e6 [project @ 1996-07-15 21:08:05 by jwe]
jwe
parents: 2299
diff changeset
298
20799
c349d4c91ce2 eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20791
diff changeset
299 // The value in status is as returned by waitpid. If
c349d4c91ce2 eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20791
diff changeset
300 // the process exited normally, extract the actual exit
c349d4c91ce2 eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20791
diff changeset
301 // status of the command. Otherwise, return 127 as a
c349d4c91ce2 eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20791
diff changeset
302 // failure code.
20582
ba2b07c13913 use new string_value method to handle value extraction errors
John W. Eaton <jwe@octave.org>
parents: 20555
diff changeset
303
21921
ecfcc8527661 hide sys/wait.h header and provide wrappers for waitpid macros
John W. Eaton <jwe@octave.org>
parents: 21907
diff changeset
304 if (octave::sys::wifexited (status))
ecfcc8527661 hide sys/wait.h header and provide wrappers for waitpid macros
John W. Eaton <jwe@octave.org>
parents: 21907
diff changeset
305 status = octave::sys::wexitstatus (status);
20799
c349d4c91ce2 eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20791
diff changeset
306
c349d4c91ce2 eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20791
diff changeset
307 retval(0) = status;
1683
5282f171363d [project @ 1995-12-30 03:46:07 by jwe]
jwe
parents:
diff changeset
308 }
5282f171363d [project @ 1995-12-30 03:46:07 by jwe]
jwe
parents:
diff changeset
309
5282f171363d [project @ 1995-12-30 03:46:07 by jwe]
jwe
parents:
diff changeset
310 return retval;
5282f171363d [project @ 1995-12-30 03:46:07 by jwe]
jwe
parents:
diff changeset
311 }
5282f171363d [project @ 1995-12-30 03:46:07 by jwe]
jwe
parents:
diff changeset
312
12846
9ce9e1e2d2c8 codesprint: new tests for toplev.cc
John W. Eaton <jwe@octave.org>
parents: 12483
diff changeset
313 /*
9ce9e1e2d2c8 codesprint: new tests for toplev.cc
John W. Eaton <jwe@octave.org>
parents: 12483
diff changeset
314 %!test
14018
5d5685216876 Deprecate shell_cmd function and update system, dos, unix commands
Rik <octave@nomad.inbox5.com>
parents: 14016
diff changeset
315 %! cmd = ls_command ();
12846
9ce9e1e2d2c8 codesprint: new tests for toplev.cc
John W. Eaton <jwe@octave.org>
parents: 12483
diff changeset
316 %! [status, output] = system (cmd);
14018
5d5685216876 Deprecate shell_cmd function and update system, dos, unix commands
Rik <octave@nomad.inbox5.com>
parents: 14016
diff changeset
317 %! assert (status, 0);
12846
9ce9e1e2d2c8 codesprint: new tests for toplev.cc
John W. Eaton <jwe@octave.org>
parents: 12483
diff changeset
318 %! assert (ischar (output));
9ce9e1e2d2c8 codesprint: new tests for toplev.cc
John W. Eaton <jwe@octave.org>
parents: 12483
diff changeset
319 %! assert (! isempty (output));
14018
5d5685216876 Deprecate shell_cmd function and update system, dos, unix commands
Rik <octave@nomad.inbox5.com>
parents: 14016
diff changeset
320
5d5685216876 Deprecate shell_cmd function and update system, dos, unix commands
Rik <octave@nomad.inbox5.com>
parents: 14016
diff changeset
321 %!error system ()
5d5685216876 Deprecate shell_cmd function and update system, dos, unix commands
Rik <octave@nomad.inbox5.com>
parents: 14016
diff changeset
322 %!error system (1, 2, 3)
12846
9ce9e1e2d2c8 codesprint: new tests for toplev.cc
John W. Eaton <jwe@octave.org>
parents: 12483
diff changeset
323 */
9ce9e1e2d2c8 codesprint: new tests for toplev.cc
John W. Eaton <jwe@octave.org>
parents: 12483
diff changeset
324
21226
a55b8ece1ecd reorganize octave_config_info again
John W. Eaton <jwe@octave.org>
parents: 21220
diff changeset
325 static octave_value
a55b8ece1ecd reorganize octave_config_info again
John W. Eaton <jwe@octave.org>
parents: 21220
diff changeset
326 find_config_info (const octave_scalar_map& m, const std::string& key)
a55b8ece1ecd reorganize octave_config_info again
John W. Eaton <jwe@octave.org>
parents: 21220
diff changeset
327 {
a55b8ece1ecd reorganize octave_config_info again
John W. Eaton <jwe@octave.org>
parents: 21220
diff changeset
328 if (m.isfield (key))
a55b8ece1ecd reorganize octave_config_info again
John W. Eaton <jwe@octave.org>
parents: 21220
diff changeset
329 {
a55b8ece1ecd reorganize octave_config_info again
John W. Eaton <jwe@octave.org>
parents: 21220
diff changeset
330 Cell c = m.contents (key);
a55b8ece1ecd reorganize octave_config_info again
John W. Eaton <jwe@octave.org>
parents: 21220
diff changeset
331
23577
80c42f4cca13 maint: Deprecate is_empty and replace with isempty.
Rik <rik@octave.org>
parents: 23487
diff changeset
332 if (! c.isempty ())
21226
a55b8ece1ecd reorganize octave_config_info again
John W. Eaton <jwe@octave.org>
parents: 21220
diff changeset
333 return c(0);
a55b8ece1ecd reorganize octave_config_info again
John W. Eaton <jwe@octave.org>
parents: 21220
diff changeset
334 }
a55b8ece1ecd reorganize octave_config_info again
John W. Eaton <jwe@octave.org>
parents: 21220
diff changeset
335
a55b8ece1ecd reorganize octave_config_info again
John W. Eaton <jwe@octave.org>
parents: 21220
diff changeset
336 return octave_value ();
a55b8ece1ecd reorganize octave_config_info again
John W. Eaton <jwe@octave.org>
parents: 21220
diff changeset
337 }
a55b8ece1ecd reorganize octave_config_info again
John W. Eaton <jwe@octave.org>
parents: 21220
diff changeset
338
21434
1da428cbf401 deprecate octave_config_info
John W. Eaton <jwe@octave.org>
parents: 21421
diff changeset
339 DEFUN (__octave_config_info__, args, ,
21966
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21949
diff changeset
340 doc: /* -*- texinfo -*-
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21949
diff changeset
341 @deftypefn {} {} __octave_config_info__ ()
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21949
diff changeset
342 @deftypefnx {} {} __octave_config_info__ (@var{option})
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21949
diff changeset
343 Return a structure containing configuration and installation information for
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21949
diff changeset
344 Octave.
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21949
diff changeset
345
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21949
diff changeset
346 If @var{option} is a string, return the configuration information for the
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21949
diff changeset
347 specified option.
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21949
diff changeset
348
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21949
diff changeset
349 @seealso{computer}
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21949
diff changeset
350 @end deftypefn */)
2162
a940dcdfe9de [project @ 1996-05-13 10:31:51 by jwe]
jwe
parents: 2145
diff changeset
351 {
23715
e8e27cd4156c * toplev.cc (F__octave_config_info__): Reorganize initialization.
John W. Eaton <jwe@octave.org>
parents: 23712
diff changeset
352 static octave_scalar_map config;
e8e27cd4156c * toplev.cc (F__octave_config_info__): Reorganize initialization.
John W. Eaton <jwe@octave.org>
parents: 23712
diff changeset
353 static octave_scalar_map build_env;
e8e27cd4156c * toplev.cc (F__octave_config_info__): Reorganize initialization.
John W. Eaton <jwe@octave.org>
parents: 23712
diff changeset
354 static octave_scalar_map build_features;
e8e27cd4156c * toplev.cc (F__octave_config_info__): Reorganize initialization.
John W. Eaton <jwe@octave.org>
parents: 23712
diff changeset
355
4357
d700cfed902a [project @ 2003-02-22 18:48:18 by jwe]
jwe
parents: 4356
diff changeset
356 static bool initialized = false;
2162
a940dcdfe9de [project @ 1996-05-13 10:31:51 by jwe]
jwe
parents: 2145
diff changeset
357
23715
e8e27cd4156c * toplev.cc (F__octave_config_info__): Reorganize initialization.
John W. Eaton <jwe@octave.org>
parents: 23712
diff changeset
358 if (! initialized)
e8e27cd4156c * toplev.cc (F__octave_config_info__): Reorganize initialization.
John W. Eaton <jwe@octave.org>
parents: 23712
diff changeset
359 {
e8e27cd4156c * toplev.cc (F__octave_config_info__): Reorganize initialization.
John W. Eaton <jwe@octave.org>
parents: 23712
diff changeset
360 std::map<std::string, octave_value> conf_info_map
23717
06579337237b move configuration variables inside octave::config namespace
John W. Eaton <jwe@octave.org>
parents: 23715
diff changeset
361 = {{ "DEFAULT_PAGER", octave::config::default_pager () },
21226
a55b8ece1ecd reorganize octave_config_info again
John W. Eaton <jwe@octave.org>
parents: 21220
diff changeset
362
21229
a83e7a384ee0 create and install a subset of config.h in octave-config.h
John W. Eaton <jwe@octave.org>
parents: 21226
diff changeset
363 #if defined (OCTAVE_ENABLE_64)
23715
e8e27cd4156c * toplev.cc (F__octave_config_info__): Reorganize initialization.
John W. Eaton <jwe@octave.org>
parents: 23712
diff changeset
364 { "ENABLE_64", true },
21226
a55b8ece1ecd reorganize octave_config_info again
John W. Eaton <jwe@octave.org>
parents: 21220
diff changeset
365 #else
23715
e8e27cd4156c * toplev.cc (F__octave_config_info__): Reorganize initialization.
John W. Eaton <jwe@octave.org>
parents: 23712
diff changeset
366 { "ENABLE_64", false },
21226
a55b8ece1ecd reorganize octave_config_info again
John W. Eaton <jwe@octave.org>
parents: 21220
diff changeset
367 #endif
a55b8ece1ecd reorganize octave_config_info again
John W. Eaton <jwe@octave.org>
parents: 21220
diff changeset
368
27534
f70d7a9ee3fd include ENABLE_COMMAND_LINE_PUSH_PARSER in build info struct
John W. Eaton <jwe@octave.org>
parents: 27486
diff changeset
369 #if defined (OCTAVE_ENABLE_COMMAND_LINE_PUSH_PARSER)
f70d7a9ee3fd include ENABLE_COMMAND_LINE_PUSH_PARSER in build info struct
John W. Eaton <jwe@octave.org>
parents: 27486
diff changeset
370 { "ENABLE_COMMAND_LINE_PUSH_PARSER", true },
f70d7a9ee3fd include ENABLE_COMMAND_LINE_PUSH_PARSER in build info struct
John W. Eaton <jwe@octave.org>
parents: 27486
diff changeset
371 #else
f70d7a9ee3fd include ENABLE_COMMAND_LINE_PUSH_PARSER in build info struct
John W. Eaton <jwe@octave.org>
parents: 27486
diff changeset
372 { "ENABLE_COMMAND_LINE_PUSH_PARSER", false },
f70d7a9ee3fd include ENABLE_COMMAND_LINE_PUSH_PARSER in build info struct
John W. Eaton <jwe@octave.org>
parents: 27486
diff changeset
373 #endif
f70d7a9ee3fd include ENABLE_COMMAND_LINE_PUSH_PARSER in build info struct
John W. Eaton <jwe@octave.org>
parents: 27486
diff changeset
374
21226
a55b8ece1ecd reorganize octave_config_info again
John W. Eaton <jwe@octave.org>
parents: 21220
diff changeset
375 #if defined (ENABLE_DOCS)
23715
e8e27cd4156c * toplev.cc (F__octave_config_info__): Reorganize initialization.
John W. Eaton <jwe@octave.org>
parents: 23712
diff changeset
376 { "ENABLE_DOCS", true },
21226
a55b8ece1ecd reorganize octave_config_info again
John W. Eaton <jwe@octave.org>
parents: 21220
diff changeset
377 #else
23715
e8e27cd4156c * toplev.cc (F__octave_config_info__): Reorganize initialization.
John W. Eaton <jwe@octave.org>
parents: 23712
diff changeset
378 { "ENABLE_DOCS", false },
21226
a55b8ece1ecd reorganize octave_config_info again
John W. Eaton <jwe@octave.org>
parents: 21220
diff changeset
379 #endif
a55b8ece1ecd reorganize octave_config_info again
John W. Eaton <jwe@octave.org>
parents: 21220
diff changeset
380
21229
a83e7a384ee0 create and install a subset of config.h in octave-config.h
John W. Eaton <jwe@octave.org>
parents: 21226
diff changeset
381 #if defined (OCTAVE_ENABLE_FLOAT_TRUNCATE)
23715
e8e27cd4156c * toplev.cc (F__octave_config_info__): Reorganize initialization.
John W. Eaton <jwe@octave.org>
parents: 23712
diff changeset
382 { "ENABLE_FLOAT_TRUNCATE", true },
21226
a55b8ece1ecd reorganize octave_config_info again
John W. Eaton <jwe@octave.org>
parents: 21220
diff changeset
383 #else
23715
e8e27cd4156c * toplev.cc (F__octave_config_info__): Reorganize initialization.
John W. Eaton <jwe@octave.org>
parents: 23712
diff changeset
384 { "ENABLE_FLOAT_TRUNCATE", false },
21226
a55b8ece1ecd reorganize octave_config_info again
John W. Eaton <jwe@octave.org>
parents: 21220
diff changeset
385 #endif
a55b8ece1ecd reorganize octave_config_info again
John W. Eaton <jwe@octave.org>
parents: 21220
diff changeset
386
a55b8ece1ecd reorganize octave_config_info again
John W. Eaton <jwe@octave.org>
parents: 21220
diff changeset
387 #if defined (ENABLE_JIT)
23715
e8e27cd4156c * toplev.cc (F__octave_config_info__): Reorganize initialization.
John W. Eaton <jwe@octave.org>
parents: 23712
diff changeset
388 { "ENABLE_JIT", true },
21226
a55b8ece1ecd reorganize octave_config_info again
John W. Eaton <jwe@octave.org>
parents: 21220
diff changeset
389 #else
23715
e8e27cd4156c * toplev.cc (F__octave_config_info__): Reorganize initialization.
John W. Eaton <jwe@octave.org>
parents: 23712
diff changeset
390 { "ENABLE_JIT", false },
21226
a55b8ece1ecd reorganize octave_config_info again
John W. Eaton <jwe@octave.org>
parents: 21220
diff changeset
391 #endif
a55b8ece1ecd reorganize octave_config_info again
John W. Eaton <jwe@octave.org>
parents: 21220
diff changeset
392
21229
a83e7a384ee0 create and install a subset of config.h in octave-config.h
John W. Eaton <jwe@octave.org>
parents: 21226
diff changeset
393 #if defined (OCTAVE_ENABLE_OPENMP)
23715
e8e27cd4156c * toplev.cc (F__octave_config_info__): Reorganize initialization.
John W. Eaton <jwe@octave.org>
parents: 23712
diff changeset
394 { "ENABLE_OPENMP", true },
21226
a55b8ece1ecd reorganize octave_config_info again
John W. Eaton <jwe@octave.org>
parents: 21220
diff changeset
395 #else
23715
e8e27cd4156c * toplev.cc (F__octave_config_info__): Reorganize initialization.
John W. Eaton <jwe@octave.org>
parents: 23712
diff changeset
396 { "ENABLE_OPENMP", false },
21226
a55b8ece1ecd reorganize octave_config_info again
John W. Eaton <jwe@octave.org>
parents: 21220
diff changeset
397 #endif
a55b8ece1ecd reorganize octave_config_info again
John W. Eaton <jwe@octave.org>
parents: 21220
diff changeset
398
23715
e8e27cd4156c * toplev.cc (F__octave_config_info__): Reorganize initialization.
John W. Eaton <jwe@octave.org>
parents: 23712
diff changeset
399 { "api_version", OCTAVE_API_VERSION },
23717
06579337237b move configuration variables inside octave::config namespace
John W. Eaton <jwe@octave.org>
parents: 23715
diff changeset
400 { "archlibdir", octave::config::arch_lib_dir () },
06579337237b move configuration variables inside octave::config namespace
John W. Eaton <jwe@octave.org>
parents: 23715
diff changeset
401 { "bindir", octave::config::bin_dir () },
06579337237b move configuration variables inside octave::config namespace
John W. Eaton <jwe@octave.org>
parents: 23715
diff changeset
402 { "canonical_host_type", octave::config::canonical_host_type () },
06579337237b move configuration variables inside octave::config namespace
John W. Eaton <jwe@octave.org>
parents: 23715
diff changeset
403 { "datadir", octave::config::data_dir () },
06579337237b move configuration variables inside octave::config namespace
John W. Eaton <jwe@octave.org>
parents: 23715
diff changeset
404 { "datarootdir", octave::config::dataroot_dir () },
06579337237b move configuration variables inside octave::config namespace
John W. Eaton <jwe@octave.org>
parents: 23715
diff changeset
405 { "fcnfiledir", octave::config::fcn_file_dir () },
23715
e8e27cd4156c * toplev.cc (F__octave_config_info__): Reorganize initialization.
John W. Eaton <jwe@octave.org>
parents: 23712
diff changeset
406 { "fftw_version", octave::fftw_version () },
e8e27cd4156c * toplev.cc (F__octave_config_info__): Reorganize initialization.
John W. Eaton <jwe@octave.org>
parents: 23712
diff changeset
407 { "fftwf_version", octave::fftwf_version () },
23717
06579337237b move configuration variables inside octave::config namespace
John W. Eaton <jwe@octave.org>
parents: 23715
diff changeset
408 { "imagedir", octave::config::image_dir () },
06579337237b move configuration variables inside octave::config namespace
John W. Eaton <jwe@octave.org>
parents: 23715
diff changeset
409 { "includedir", octave::config::include_dir () },
06579337237b move configuration variables inside octave::config namespace
John W. Eaton <jwe@octave.org>
parents: 23715
diff changeset
410 { "infodir", octave::config::info_dir () },
06579337237b move configuration variables inside octave::config namespace
John W. Eaton <jwe@octave.org>
parents: 23715
diff changeset
411 { "libdir", octave::config::lib_dir () },
06579337237b move configuration variables inside octave::config namespace
John W. Eaton <jwe@octave.org>
parents: 23715
diff changeset
412 { "libexecdir", octave::config::libexec_dir () },
23715
e8e27cd4156c * toplev.cc (F__octave_config_info__): Reorganize initialization.
John W. Eaton <jwe@octave.org>
parents: 23712
diff changeset
413 // Each library and executable has its own definition of the hg
e8e27cd4156c * toplev.cc (F__octave_config_info__): Reorganize initialization.
John W. Eaton <jwe@octave.org>
parents: 23712
diff changeset
414 // id. We check for consistency when Octave starts so we just
e8e27cd4156c * toplev.cc (F__octave_config_info__): Reorganize initialization.
John W. Eaton <jwe@octave.org>
parents: 23712
diff changeset
415 // store and report one of them here.
e8e27cd4156c * toplev.cc (F__octave_config_info__): Reorganize initialization.
John W. Eaton <jwe@octave.org>
parents: 23712
diff changeset
416 { "hg_id", liboctinterp_hg_id () },
23717
06579337237b move configuration variables inside octave::config namespace
John W. Eaton <jwe@octave.org>
parents: 23715
diff changeset
417 { "localapiarchlibdir", octave::config::local_api_arch_lib_dir () },
06579337237b move configuration variables inside octave::config namespace
John W. Eaton <jwe@octave.org>
parents: 23715
diff changeset
418 { "localapifcnfiledir", octave::config::local_api_fcn_file_dir () },
06579337237b move configuration variables inside octave::config namespace
John W. Eaton <jwe@octave.org>
parents: 23715
diff changeset
419 { "localapioctfiledir", octave::config::local_api_oct_file_dir () },
06579337237b move configuration variables inside octave::config namespace
John W. Eaton <jwe@octave.org>
parents: 23715
diff changeset
420 { "localarchlibdir", octave::config::local_arch_lib_dir () },
06579337237b move configuration variables inside octave::config namespace
John W. Eaton <jwe@octave.org>
parents: 23715
diff changeset
421 { "localfcnfiledir", octave::config::local_fcn_file_dir () },
06579337237b move configuration variables inside octave::config namespace
John W. Eaton <jwe@octave.org>
parents: 23715
diff changeset
422 { "localoctfiledir", octave::config::local_oct_file_dir () },
06579337237b move configuration variables inside octave::config namespace
John W. Eaton <jwe@octave.org>
parents: 23715
diff changeset
423 { "localstartupfiledir", octave::config::local_startupfile_dir () },
06579337237b move configuration variables inside octave::config namespace
John W. Eaton <jwe@octave.org>
parents: 23715
diff changeset
424 { "localverarchlibdir", octave::config::local_ver_arch_lib_dir () },
06579337237b move configuration variables inside octave::config namespace
John W. Eaton <jwe@octave.org>
parents: 23715
diff changeset
425 { "localverfcnfiledir", octave::config::local_ver_fcn_file_dir () },
06579337237b move configuration variables inside octave::config namespace
John W. Eaton <jwe@octave.org>
parents: 23715
diff changeset
426 { "localveroctfiledir", octave::config::local_ver_oct_file_dir () },
06579337237b move configuration variables inside octave::config namespace
John W. Eaton <jwe@octave.org>
parents: 23715
diff changeset
427 { "man1dir", octave::config::man1_dir () },
06579337237b move configuration variables inside octave::config namespace
John W. Eaton <jwe@octave.org>
parents: 23715
diff changeset
428 { "man1ext", octave::config::man1_ext () },
06579337237b move configuration variables inside octave::config namespace
John W. Eaton <jwe@octave.org>
parents: 23715
diff changeset
429 { "mandir", octave::config::man_dir () },
06579337237b move configuration variables inside octave::config namespace
John W. Eaton <jwe@octave.org>
parents: 23715
diff changeset
430 { "octdatadir", octave::config::oct_data_dir () },
24876
a41e264609c0 Fix misconfigured OCTAVE_DOCDIR (bug #53006)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents: 24801
diff changeset
431 { "octdocdir", octave::config::oct_doc_dir () },
24899
1a46d174a483 include a proper definition of Octave's private font fallback directory
Mike Miller <mtmiller@octave.org>
parents: 24876
diff changeset
432 { "octetcdir", octave::config::oct_etc_dir () },
23717
06579337237b move configuration variables inside octave::config namespace
John W. Eaton <jwe@octave.org>
parents: 23715
diff changeset
433 { "octfiledir", octave::config::oct_file_dir () },
24899
1a46d174a483 include a proper definition of Octave's private font fallback directory
Mike Miller <mtmiller@octave.org>
parents: 24876
diff changeset
434 { "octfontsdir", octave::config::oct_fonts_dir () },
23717
06579337237b move configuration variables inside octave::config namespace
John W. Eaton <jwe@octave.org>
parents: 23715
diff changeset
435 { "octincludedir", octave::config::oct_include_dir () },
06579337237b move configuration variables inside octave::config namespace
John W. Eaton <jwe@octave.org>
parents: 23715
diff changeset
436 { "octlibdir", octave::config::oct_lib_dir () },
06579337237b move configuration variables inside octave::config namespace
John W. Eaton <jwe@octave.org>
parents: 23715
diff changeset
437 { "octtestsdir", octave::config::oct_tests_dir () },
23715
e8e27cd4156c * toplev.cc (F__octave_config_info__): Reorganize initialization.
John W. Eaton <jwe@octave.org>
parents: 23712
diff changeset
438 { "release_date", OCTAVE_RELEASE_DATE },
23717
06579337237b move configuration variables inside octave::config namespace
John W. Eaton <jwe@octave.org>
parents: 23715
diff changeset
439 { "startupfiledir", octave::config::startupfile_dir () },
23715
e8e27cd4156c * toplev.cc (F__octave_config_info__): Reorganize initialization.
John W. Eaton <jwe@octave.org>
parents: 23712
diff changeset
440 { "version", OCTAVE_VERSION }};
4357
d700cfed902a [project @ 2003-02-22 18:48:18 by jwe]
jwe
parents: 4356
diff changeset
441
23715
e8e27cd4156c * toplev.cc (F__octave_config_info__): Reorganize initialization.
John W. Eaton <jwe@octave.org>
parents: 23712
diff changeset
442 std::map<std::string, octave_value> build_env_map
e8e27cd4156c * toplev.cc (F__octave_config_info__): Reorganize initialization.
John W. Eaton <jwe@octave.org>
parents: 23712
diff changeset
443 = {{ "AMD_CPPFLAGS", octave::build_env::AMD_CPPFLAGS },
e8e27cd4156c * toplev.cc (F__octave_config_info__): Reorganize initialization.
John W. Eaton <jwe@octave.org>
parents: 23712
diff changeset
444 { "AMD_LDFLAGS", octave::build_env::AMD_LDFLAGS },
e8e27cd4156c * toplev.cc (F__octave_config_info__): Reorganize initialization.
John W. Eaton <jwe@octave.org>
parents: 23712
diff changeset
445 { "AMD_LIBS", octave::build_env::AMD_LIBS },
e8e27cd4156c * toplev.cc (F__octave_config_info__): Reorganize initialization.
John W. Eaton <jwe@octave.org>
parents: 23712
diff changeset
446 { "AR", octave::build_env::AR },
e8e27cd4156c * toplev.cc (F__octave_config_info__): Reorganize initialization.
John W. Eaton <jwe@octave.org>
parents: 23712
diff changeset
447 { "ARFLAGS", octave::build_env::ARFLAGS },
e8e27cd4156c * toplev.cc (F__octave_config_info__): Reorganize initialization.
John W. Eaton <jwe@octave.org>
parents: 23712
diff changeset
448 { "ARPACK_CPPFLAGS", octave::build_env::ARPACK_CPPFLAGS },
e8e27cd4156c * toplev.cc (F__octave_config_info__): Reorganize initialization.
John W. Eaton <jwe@octave.org>
parents: 23712
diff changeset
449 { "ARPACK_LDFLAGS", octave::build_env::ARPACK_LDFLAGS },
e8e27cd4156c * toplev.cc (F__octave_config_info__): Reorganize initialization.
John W. Eaton <jwe@octave.org>
parents: 23712
diff changeset
450 { "ARPACK_LIBS", octave::build_env::ARPACK_LIBS },
e8e27cd4156c * toplev.cc (F__octave_config_info__): Reorganize initialization.
John W. Eaton <jwe@octave.org>
parents: 23712
diff changeset
451 { "BLAS_LIBS", octave::build_env::BLAS_LIBS },
e8e27cd4156c * toplev.cc (F__octave_config_info__): Reorganize initialization.
John W. Eaton <jwe@octave.org>
parents: 23712
diff changeset
452 { "CAMD_CPPFLAGS", octave::build_env::CAMD_CPPFLAGS },
e8e27cd4156c * toplev.cc (F__octave_config_info__): Reorganize initialization.
John W. Eaton <jwe@octave.org>
parents: 23712
diff changeset
453 { "CAMD_LDFLAGS", octave::build_env::CAMD_LDFLAGS },
e8e27cd4156c * toplev.cc (F__octave_config_info__): Reorganize initialization.
John W. Eaton <jwe@octave.org>
parents: 23712
diff changeset
454 { "CAMD_LIBS", octave::build_env::CAMD_LIBS },
e8e27cd4156c * toplev.cc (F__octave_config_info__): Reorganize initialization.
John W. Eaton <jwe@octave.org>
parents: 23712
diff changeset
455 { "CARBON_LIBS", octave::build_env::CARBON_LIBS },
e8e27cd4156c * toplev.cc (F__octave_config_info__): Reorganize initialization.
John W. Eaton <jwe@octave.org>
parents: 23712
diff changeset
456 { "CC", octave::build_env::CC },
e8e27cd4156c * toplev.cc (F__octave_config_info__): Reorganize initialization.
John W. Eaton <jwe@octave.org>
parents: 23712
diff changeset
457 { "CCOLAMD_CPPFLAGS", octave::build_env::CCOLAMD_CPPFLAGS },
e8e27cd4156c * toplev.cc (F__octave_config_info__): Reorganize initialization.
John W. Eaton <jwe@octave.org>
parents: 23712
diff changeset
458 { "CCOLAMD_LDFLAGS", octave::build_env::CCOLAMD_LDFLAGS },
e8e27cd4156c * toplev.cc (F__octave_config_info__): Reorganize initialization.
John W. Eaton <jwe@octave.org>
parents: 23712
diff changeset
459 { "CCOLAMD_LIBS", octave::build_env::CCOLAMD_LIBS },
e8e27cd4156c * toplev.cc (F__octave_config_info__): Reorganize initialization.
John W. Eaton <jwe@octave.org>
parents: 23712
diff changeset
460 { "CFLAGS", octave::build_env::CFLAGS },
e8e27cd4156c * toplev.cc (F__octave_config_info__): Reorganize initialization.
John W. Eaton <jwe@octave.org>
parents: 23712
diff changeset
461 { "CHOLMOD_CPPFLAGS", octave::build_env::CHOLMOD_CPPFLAGS },
e8e27cd4156c * toplev.cc (F__octave_config_info__): Reorganize initialization.
John W. Eaton <jwe@octave.org>
parents: 23712
diff changeset
462 { "CHOLMOD_LDFLAGS", octave::build_env::CHOLMOD_LDFLAGS },
e8e27cd4156c * toplev.cc (F__octave_config_info__): Reorganize initialization.
John W. Eaton <jwe@octave.org>
parents: 23712
diff changeset
463 { "CHOLMOD_LIBS", octave::build_env::CHOLMOD_LIBS },
e8e27cd4156c * toplev.cc (F__octave_config_info__): Reorganize initialization.
John W. Eaton <jwe@octave.org>
parents: 23712
diff changeset
464 { "COLAMD_CPPFLAGS", octave::build_env::COLAMD_CPPFLAGS },
e8e27cd4156c * toplev.cc (F__octave_config_info__): Reorganize initialization.
John W. Eaton <jwe@octave.org>
parents: 23712
diff changeset
465 { "COLAMD_LDFLAGS", octave::build_env::COLAMD_LDFLAGS },
e8e27cd4156c * toplev.cc (F__octave_config_info__): Reorganize initialization.
John W. Eaton <jwe@octave.org>
parents: 23712
diff changeset
466 { "COLAMD_LIBS", octave::build_env::COLAMD_LIBS },
e8e27cd4156c * toplev.cc (F__octave_config_info__): Reorganize initialization.
John W. Eaton <jwe@octave.org>
parents: 23712
diff changeset
467 { "CPICFLAG", octave::build_env::CPICFLAG },
e8e27cd4156c * toplev.cc (F__octave_config_info__): Reorganize initialization.
John W. Eaton <jwe@octave.org>
parents: 23712
diff changeset
468 { "CPPFLAGS", octave::build_env::CPPFLAGS },
e8e27cd4156c * toplev.cc (F__octave_config_info__): Reorganize initialization.
John W. Eaton <jwe@octave.org>
parents: 23712
diff changeset
469 { "CURL_CPPFLAGS", octave::build_env::CURL_CPPFLAGS },
e8e27cd4156c * toplev.cc (F__octave_config_info__): Reorganize initialization.
John W. Eaton <jwe@octave.org>
parents: 23712
diff changeset
470 { "CURL_LDFLAGS", octave::build_env::CURL_LDFLAGS },
e8e27cd4156c * toplev.cc (F__octave_config_info__): Reorganize initialization.
John W. Eaton <jwe@octave.org>
parents: 23712
diff changeset
471 { "CURL_LIBS", octave::build_env::CURL_LIBS },
e8e27cd4156c * toplev.cc (F__octave_config_info__): Reorganize initialization.
John W. Eaton <jwe@octave.org>
parents: 23712
diff changeset
472 { "CXSPARSE_CPPFLAGS", octave::build_env::CXSPARSE_CPPFLAGS },
e8e27cd4156c * toplev.cc (F__octave_config_info__): Reorganize initialization.
John W. Eaton <jwe@octave.org>
parents: 23712
diff changeset
473 { "CXSPARSE_LDFLAGS", octave::build_env::CXSPARSE_LDFLAGS },
e8e27cd4156c * toplev.cc (F__octave_config_info__): Reorganize initialization.
John W. Eaton <jwe@octave.org>
parents: 23712
diff changeset
474 { "CXSPARSE_LIBS", octave::build_env::CXSPARSE_LIBS },
e8e27cd4156c * toplev.cc (F__octave_config_info__): Reorganize initialization.
John W. Eaton <jwe@octave.org>
parents: 23712
diff changeset
475 { "CXX", octave::build_env::CXX },
e8e27cd4156c * toplev.cc (F__octave_config_info__): Reorganize initialization.
John W. Eaton <jwe@octave.org>
parents: 23712
diff changeset
476 { "CXXCPP", octave::build_env::CXXCPP },
e8e27cd4156c * toplev.cc (F__octave_config_info__): Reorganize initialization.
John W. Eaton <jwe@octave.org>
parents: 23712
diff changeset
477 { "CXXFLAGS", octave::build_env::CXXFLAGS },
e8e27cd4156c * toplev.cc (F__octave_config_info__): Reorganize initialization.
John W. Eaton <jwe@octave.org>
parents: 23712
diff changeset
478 { "CXXPICFLAG", octave::build_env::CXXPICFLAG },
e8e27cd4156c * toplev.cc (F__octave_config_info__): Reorganize initialization.
John W. Eaton <jwe@octave.org>
parents: 23712
diff changeset
479 { "DEFS", octave::build_env::DEFS },
e8e27cd4156c * toplev.cc (F__octave_config_info__): Reorganize initialization.
John W. Eaton <jwe@octave.org>
parents: 23712
diff changeset
480 { "DL_LDFLAGS", octave::build_env::DL_LDFLAGS },
e8e27cd4156c * toplev.cc (F__octave_config_info__): Reorganize initialization.
John W. Eaton <jwe@octave.org>
parents: 23712
diff changeset
481 { "GCC_VERSION", octave::build_env::GCC_VERSION },
e8e27cd4156c * toplev.cc (F__octave_config_info__): Reorganize initialization.
John W. Eaton <jwe@octave.org>
parents: 23712
diff changeset
482 { "GXX_VERSION", octave::build_env::GXX_VERSION },
e8e27cd4156c * toplev.cc (F__octave_config_info__): Reorganize initialization.
John W. Eaton <jwe@octave.org>
parents: 23712
diff changeset
483 { "EXEEXT", octave::build_env::EXEEXT },
e8e27cd4156c * toplev.cc (F__octave_config_info__): Reorganize initialization.
John W. Eaton <jwe@octave.org>
parents: 23712
diff changeset
484 { "F77", octave::build_env::F77 },
e8e27cd4156c * toplev.cc (F__octave_config_info__): Reorganize initialization.
John W. Eaton <jwe@octave.org>
parents: 23712
diff changeset
485 { "F77_FLOAT_STORE_FLAG", octave::build_env::F77_FLOAT_STORE_FLAG },
e8e27cd4156c * toplev.cc (F__octave_config_info__): Reorganize initialization.
John W. Eaton <jwe@octave.org>
parents: 23712
diff changeset
486 { "F77_INTEGER_8_FLAG", octave::build_env::F77_INTEGER_8_FLAG },
e8e27cd4156c * toplev.cc (F__octave_config_info__): Reorganize initialization.
John W. Eaton <jwe@octave.org>
parents: 23712
diff changeset
487 { "FFLAGS", octave::build_env::FFLAGS },
e8e27cd4156c * toplev.cc (F__octave_config_info__): Reorganize initialization.
John W. Eaton <jwe@octave.org>
parents: 23712
diff changeset
488 { "FFTW3_CPPFLAGS", octave::build_env::FFTW3_CPPFLAGS },
e8e27cd4156c * toplev.cc (F__octave_config_info__): Reorganize initialization.
John W. Eaton <jwe@octave.org>
parents: 23712
diff changeset
489 { "FFTW3_LDFLAGS", octave::build_env::FFTW3_LDFLAGS },
e8e27cd4156c * toplev.cc (F__octave_config_info__): Reorganize initialization.
John W. Eaton <jwe@octave.org>
parents: 23712
diff changeset
490 { "FFTW3_LIBS", octave::build_env::FFTW3_LIBS },
e8e27cd4156c * toplev.cc (F__octave_config_info__): Reorganize initialization.
John W. Eaton <jwe@octave.org>
parents: 23712
diff changeset
491 { "FFTW3F_CPPFLAGS", octave::build_env::FFTW3F_CPPFLAGS },
e8e27cd4156c * toplev.cc (F__octave_config_info__): Reorganize initialization.
John W. Eaton <jwe@octave.org>
parents: 23712
diff changeset
492 { "FFTW3F_LDFLAGS", octave::build_env::FFTW3F_LDFLAGS },
e8e27cd4156c * toplev.cc (F__octave_config_info__): Reorganize initialization.
John W. Eaton <jwe@octave.org>
parents: 23712
diff changeset
493 { "FFTW3F_LIBS", octave::build_env::FFTW3F_LIBS },
e8e27cd4156c * toplev.cc (F__octave_config_info__): Reorganize initialization.
John W. Eaton <jwe@octave.org>
parents: 23712
diff changeset
494 { "FLIBS", octave::build_env::FLIBS },
e8e27cd4156c * toplev.cc (F__octave_config_info__): Reorganize initialization.
John W. Eaton <jwe@octave.org>
parents: 23712
diff changeset
495 { "FLTK_CPPFLAGS", octave::build_env::FLTK_CPPFLAGS },
e8e27cd4156c * toplev.cc (F__octave_config_info__): Reorganize initialization.
John W. Eaton <jwe@octave.org>
parents: 23712
diff changeset
496 { "FLTK_LDFLAGS", octave::build_env::FLTK_LDFLAGS },
e8e27cd4156c * toplev.cc (F__octave_config_info__): Reorganize initialization.
John W. Eaton <jwe@octave.org>
parents: 23712
diff changeset
497 { "FLTK_LIBS", octave::build_env::FLTK_LIBS },
e8e27cd4156c * toplev.cc (F__octave_config_info__): Reorganize initialization.
John W. Eaton <jwe@octave.org>
parents: 23712
diff changeset
498 { "FONTCONFIG_CPPFLAGS", octave::build_env::FONTCONFIG_CPPFLAGS },
e8e27cd4156c * toplev.cc (F__octave_config_info__): Reorganize initialization.
John W. Eaton <jwe@octave.org>
parents: 23712
diff changeset
499 { "FONTCONFIG_LIBS", octave::build_env::FONTCONFIG_LIBS },
e8e27cd4156c * toplev.cc (F__octave_config_info__): Reorganize initialization.
John W. Eaton <jwe@octave.org>
parents: 23712
diff changeset
500 { "FPICFLAG", octave::build_env::FPICFLAG },
e8e27cd4156c * toplev.cc (F__octave_config_info__): Reorganize initialization.
John W. Eaton <jwe@octave.org>
parents: 23712
diff changeset
501 { "FT2_CPPFLAGS", octave::build_env::FT2_CPPFLAGS },
e8e27cd4156c * toplev.cc (F__octave_config_info__): Reorganize initialization.
John W. Eaton <jwe@octave.org>
parents: 23712
diff changeset
502 { "FT2_LIBS", octave::build_env::FT2_LIBS },
e8e27cd4156c * toplev.cc (F__octave_config_info__): Reorganize initialization.
John W. Eaton <jwe@octave.org>
parents: 23712
diff changeset
503 { "GLPK_CPPFLAGS", octave::build_env::GLPK_CPPFLAGS },
e8e27cd4156c * toplev.cc (F__octave_config_info__): Reorganize initialization.
John W. Eaton <jwe@octave.org>
parents: 23712
diff changeset
504 { "GLPK_LDFLAGS", octave::build_env::GLPK_LDFLAGS },
e8e27cd4156c * toplev.cc (F__octave_config_info__): Reorganize initialization.
John W. Eaton <jwe@octave.org>
parents: 23712
diff changeset
505 { "GLPK_LIBS", octave::build_env::GLPK_LIBS },
e8e27cd4156c * toplev.cc (F__octave_config_info__): Reorganize initialization.
John W. Eaton <jwe@octave.org>
parents: 23712
diff changeset
506 { "GNUPLOT", octave::build_env::GNUPLOT },
e8e27cd4156c * toplev.cc (F__octave_config_info__): Reorganize initialization.
John W. Eaton <jwe@octave.org>
parents: 23712
diff changeset
507 { "HDF5_CPPFLAGS", octave::build_env::HDF5_CPPFLAGS },
e8e27cd4156c * toplev.cc (F__octave_config_info__): Reorganize initialization.
John W. Eaton <jwe@octave.org>
parents: 23712
diff changeset
508 { "HDF5_LDFLAGS", octave::build_env::HDF5_LDFLAGS },
e8e27cd4156c * toplev.cc (F__octave_config_info__): Reorganize initialization.
John W. Eaton <jwe@octave.org>
parents: 23712
diff changeset
509 { "HDF5_LIBS", octave::build_env::HDF5_LIBS },
e8e27cd4156c * toplev.cc (F__octave_config_info__): Reorganize initialization.
John W. Eaton <jwe@octave.org>
parents: 23712
diff changeset
510 { "LAPACK_LIBS", octave::build_env::LAPACK_LIBS },
e8e27cd4156c * toplev.cc (F__octave_config_info__): Reorganize initialization.
John W. Eaton <jwe@octave.org>
parents: 23712
diff changeset
511 { "LDFLAGS", octave::build_env::LDFLAGS },
e8e27cd4156c * toplev.cc (F__octave_config_info__): Reorganize initialization.
John W. Eaton <jwe@octave.org>
parents: 23712
diff changeset
512 { "LD_STATIC_FLAG", octave::build_env::LD_STATIC_FLAG },
e8e27cd4156c * toplev.cc (F__octave_config_info__): Reorganize initialization.
John W. Eaton <jwe@octave.org>
parents: 23712
diff changeset
513 { "LEX", octave::build_env::LEX },
e8e27cd4156c * toplev.cc (F__octave_config_info__): Reorganize initialization.
John W. Eaton <jwe@octave.org>
parents: 23712
diff changeset
514 { "LEXLIB", octave::build_env::LEXLIB },
e8e27cd4156c * toplev.cc (F__octave_config_info__): Reorganize initialization.
John W. Eaton <jwe@octave.org>
parents: 23712
diff changeset
515 { "LFLAGS", octave::build_env::LFLAGS },
e8e27cd4156c * toplev.cc (F__octave_config_info__): Reorganize initialization.
John W. Eaton <jwe@octave.org>
parents: 23712
diff changeset
516 { "LIBOCTAVE", octave::build_env::LIBOCTAVE },
e8e27cd4156c * toplev.cc (F__octave_config_info__): Reorganize initialization.
John W. Eaton <jwe@octave.org>
parents: 23712
diff changeset
517 { "LIBOCTINTERP", octave::build_env::LIBOCTINTERP },
e8e27cd4156c * toplev.cc (F__octave_config_info__): Reorganize initialization.
John W. Eaton <jwe@octave.org>
parents: 23712
diff changeset
518 { "LIBS", octave::build_env::LIBS },
e8e27cd4156c * toplev.cc (F__octave_config_info__): Reorganize initialization.
John W. Eaton <jwe@octave.org>
parents: 23712
diff changeset
519 { "LLVM_CPPFLAGS", octave::build_env::LLVM_CPPFLAGS },
e8e27cd4156c * toplev.cc (F__octave_config_info__): Reorganize initialization.
John W. Eaton <jwe@octave.org>
parents: 23712
diff changeset
520 { "LLVM_LDFLAGS", octave::build_env::LLVM_LDFLAGS },
e8e27cd4156c * toplev.cc (F__octave_config_info__): Reorganize initialization.
John W. Eaton <jwe@octave.org>
parents: 23712
diff changeset
521 { "LLVM_LIBS", octave::build_env::LLVM_LIBS },
e8e27cd4156c * toplev.cc (F__octave_config_info__): Reorganize initialization.
John W. Eaton <jwe@octave.org>
parents: 23712
diff changeset
522 { "LN_S", octave::build_env::LN_S },
e8e27cd4156c * toplev.cc (F__octave_config_info__): Reorganize initialization.
John W. Eaton <jwe@octave.org>
parents: 23712
diff changeset
523 { "MAGICK_CPPFLAGS", octave::build_env::MAGICK_CPPFLAGS },
e8e27cd4156c * toplev.cc (F__octave_config_info__): Reorganize initialization.
John W. Eaton <jwe@octave.org>
parents: 23712
diff changeset
524 { "MAGICK_LDFLAGS", octave::build_env::MAGICK_LDFLAGS },
e8e27cd4156c * toplev.cc (F__octave_config_info__): Reorganize initialization.
John W. Eaton <jwe@octave.org>
parents: 23712
diff changeset
525 { "MAGICK_LIBS", octave::build_env::MAGICK_LIBS },
e8e27cd4156c * toplev.cc (F__octave_config_info__): Reorganize initialization.
John W. Eaton <jwe@octave.org>
parents: 23712
diff changeset
526 { "MKOCTFILE_DL_LDFLAGS", octave::build_env::MKOCTFILE_DL_LDFLAGS },
e8e27cd4156c * toplev.cc (F__octave_config_info__): Reorganize initialization.
John W. Eaton <jwe@octave.org>
parents: 23712
diff changeset
527 { "OCTAVE_LINK_DEPS", octave::build_env::OCTAVE_LINK_DEPS },
e8e27cd4156c * toplev.cc (F__octave_config_info__): Reorganize initialization.
John W. Eaton <jwe@octave.org>
parents: 23712
diff changeset
528 { "OCTAVE_LINK_OPTS", octave::build_env::OCTAVE_LINK_OPTS },
e8e27cd4156c * toplev.cc (F__octave_config_info__): Reorganize initialization.
John W. Eaton <jwe@octave.org>
parents: 23712
diff changeset
529 { "OCT_LINK_DEPS", octave::build_env::OCT_LINK_DEPS },
e8e27cd4156c * toplev.cc (F__octave_config_info__): Reorganize initialization.
John W. Eaton <jwe@octave.org>
parents: 23712
diff changeset
530 { "OCT_LINK_OPTS", octave::build_env::OCT_LINK_OPTS },
e8e27cd4156c * toplev.cc (F__octave_config_info__): Reorganize initialization.
John W. Eaton <jwe@octave.org>
parents: 23712
diff changeset
531 { "OPENGL_LIBS", octave::build_env::OPENGL_LIBS },
e8e27cd4156c * toplev.cc (F__octave_config_info__): Reorganize initialization.
John W. Eaton <jwe@octave.org>
parents: 23712
diff changeset
532 { "PCRE_CPPFLAGS", octave::build_env::PCRE_CPPFLAGS },
e8e27cd4156c * toplev.cc (F__octave_config_info__): Reorganize initialization.
John W. Eaton <jwe@octave.org>
parents: 23712
diff changeset
533 { "PCRE_LDFLAGS", octave::build_env::PCRE_LDFLAGS },
e8e27cd4156c * toplev.cc (F__octave_config_info__): Reorganize initialization.
John W. Eaton <jwe@octave.org>
parents: 23712
diff changeset
534 { "PCRE_LIBS", octave::build_env::PCRE_LIBS },
e8e27cd4156c * toplev.cc (F__octave_config_info__): Reorganize initialization.
John W. Eaton <jwe@octave.org>
parents: 23712
diff changeset
535 { "PTHREAD_CFLAGS", octave::build_env::PTHREAD_CFLAGS },
e8e27cd4156c * toplev.cc (F__octave_config_info__): Reorganize initialization.
John W. Eaton <jwe@octave.org>
parents: 23712
diff changeset
536 { "PTHREAD_LIBS", octave::build_env::PTHREAD_LIBS },
e8e27cd4156c * toplev.cc (F__octave_config_info__): Reorganize initialization.
John W. Eaton <jwe@octave.org>
parents: 23712
diff changeset
537 { "QHULL_CPPFLAGS", octave::build_env::QHULL_CPPFLAGS },
e8e27cd4156c * toplev.cc (F__octave_config_info__): Reorganize initialization.
John W. Eaton <jwe@octave.org>
parents: 23712
diff changeset
538 { "QHULL_LDFLAGS", octave::build_env::QHULL_LDFLAGS },
e8e27cd4156c * toplev.cc (F__octave_config_info__): Reorganize initialization.
John W. Eaton <jwe@octave.org>
parents: 23712
diff changeset
539 { "QHULL_LIBS", octave::build_env::QHULL_LIBS },
e8e27cd4156c * toplev.cc (F__octave_config_info__): Reorganize initialization.
John W. Eaton <jwe@octave.org>
parents: 23712
diff changeset
540 { "QRUPDATE_CPPFLAGS", octave::build_env::QRUPDATE_CPPFLAGS },
e8e27cd4156c * toplev.cc (F__octave_config_info__): Reorganize initialization.
John W. Eaton <jwe@octave.org>
parents: 23712
diff changeset
541 { "QRUPDATE_LDFLAGS", octave::build_env::QRUPDATE_LDFLAGS },
e8e27cd4156c * toplev.cc (F__octave_config_info__): Reorganize initialization.
John W. Eaton <jwe@octave.org>
parents: 23712
diff changeset
542 { "QRUPDATE_LIBS", octave::build_env::QRUPDATE_LIBS },
e8e27cd4156c * toplev.cc (F__octave_config_info__): Reorganize initialization.
John W. Eaton <jwe@octave.org>
parents: 23712
diff changeset
543 { "QT_CPPFLAGS", octave::build_env::QT_CPPFLAGS },
e8e27cd4156c * toplev.cc (F__octave_config_info__): Reorganize initialization.
John W. Eaton <jwe@octave.org>
parents: 23712
diff changeset
544 { "QT_LDFLAGS", octave::build_env::QT_LDFLAGS },
e8e27cd4156c * toplev.cc (F__octave_config_info__): Reorganize initialization.
John W. Eaton <jwe@octave.org>
parents: 23712
diff changeset
545 { "QT_LIBS", octave::build_env::QT_LIBS },
25931
332be8be16eb dynamically load qt graphics
John W. Eaton <jwe@octave.org>
parents: 25882
diff changeset
546 { "QT_OPENGL_LIBS", octave::build_env::QT_OPENGL_LIBS },
23715
e8e27cd4156c * toplev.cc (F__octave_config_info__): Reorganize initialization.
John W. Eaton <jwe@octave.org>
parents: 23712
diff changeset
547 { "RANLIB", octave::build_env::RANLIB },
e8e27cd4156c * toplev.cc (F__octave_config_info__): Reorganize initialization.
John W. Eaton <jwe@octave.org>
parents: 23712
diff changeset
548 { "RDYNAMIC_FLAG", octave::build_env::RDYNAMIC_FLAG },
e8e27cd4156c * toplev.cc (F__octave_config_info__): Reorganize initialization.
John W. Eaton <jwe@octave.org>
parents: 23712
diff changeset
549 { "READLINE_LIBS", octave::build_env::READLINE_LIBS },
e8e27cd4156c * toplev.cc (F__octave_config_info__): Reorganize initialization.
John W. Eaton <jwe@octave.org>
parents: 23712
diff changeset
550 { "SHARED_LIBS", octave::build_env::SHARED_LIBS },
e8e27cd4156c * toplev.cc (F__octave_config_info__): Reorganize initialization.
John W. Eaton <jwe@octave.org>
parents: 23712
diff changeset
551 { "SH_LDFLAGS", octave::build_env::SH_LDFLAGS },
e8e27cd4156c * toplev.cc (F__octave_config_info__): Reorganize initialization.
John W. Eaton <jwe@octave.org>
parents: 23712
diff changeset
552 { "STATIC_LIBS", octave::build_env::STATIC_LIBS },
23990
6f56efc098bd check for suitesparse config library before other suitesparse libraries
John W. Eaton <jwe@octave.org>
parents: 23878
diff changeset
553 { "SUITESPARSECONFIG_LIBS", octave::build_env::SUITESPARSECONFIG_LIBS },
23715
e8e27cd4156c * toplev.cc (F__octave_config_info__): Reorganize initialization.
John W. Eaton <jwe@octave.org>
parents: 23712
diff changeset
554 { "TERM_LIBS", octave::build_env::TERM_LIBS },
e8e27cd4156c * toplev.cc (F__octave_config_info__): Reorganize initialization.
John W. Eaton <jwe@octave.org>
parents: 23712
diff changeset
555 { "UMFPACK_CPPFLAGS", octave::build_env::UMFPACK_CPPFLAGS },
e8e27cd4156c * toplev.cc (F__octave_config_info__): Reorganize initialization.
John W. Eaton <jwe@octave.org>
parents: 23712
diff changeset
556 { "UMFPACK_LDFLAGS", octave::build_env::UMFPACK_LDFLAGS },
e8e27cd4156c * toplev.cc (F__octave_config_info__): Reorganize initialization.
John W. Eaton <jwe@octave.org>
parents: 23712
diff changeset
557 { "UMFPACK_LIBS", octave::build_env::UMFPACK_LIBS },
e8e27cd4156c * toplev.cc (F__octave_config_info__): Reorganize initialization.
John W. Eaton <jwe@octave.org>
parents: 23712
diff changeset
558 { "WARN_CFLAGS", octave::build_env::WARN_CFLAGS },
e8e27cd4156c * toplev.cc (F__octave_config_info__): Reorganize initialization.
John W. Eaton <jwe@octave.org>
parents: 23712
diff changeset
559 { "WARN_CXXFLAGS", octave::build_env::WARN_CXXFLAGS },
e8e27cd4156c * toplev.cc (F__octave_config_info__): Reorganize initialization.
John W. Eaton <jwe@octave.org>
parents: 23712
diff changeset
560 { "X11_INCFLAGS", octave::build_env::X11_INCFLAGS },
e8e27cd4156c * toplev.cc (F__octave_config_info__): Reorganize initialization.
John W. Eaton <jwe@octave.org>
parents: 23712
diff changeset
561 { "X11_LIBS", octave::build_env::X11_LIBS },
e8e27cd4156c * toplev.cc (F__octave_config_info__): Reorganize initialization.
John W. Eaton <jwe@octave.org>
parents: 23712
diff changeset
562 { "XTRA_CFLAGS", octave::build_env::XTRA_CFLAGS },
e8e27cd4156c * toplev.cc (F__octave_config_info__): Reorganize initialization.
John W. Eaton <jwe@octave.org>
parents: 23712
diff changeset
563 { "XTRA_CXXFLAGS", octave::build_env::XTRA_CXXFLAGS },
e8e27cd4156c * toplev.cc (F__octave_config_info__): Reorganize initialization.
John W. Eaton <jwe@octave.org>
parents: 23712
diff changeset
564 { "YACC", octave::build_env::YACC },
e8e27cd4156c * toplev.cc (F__octave_config_info__): Reorganize initialization.
John W. Eaton <jwe@octave.org>
parents: 23712
diff changeset
565 { "YFLAGS", octave::build_env::YFLAGS },
e8e27cd4156c * toplev.cc (F__octave_config_info__): Reorganize initialization.
John W. Eaton <jwe@octave.org>
parents: 23712
diff changeset
566 { "Z_CPPFLAGS", octave::build_env::Z_CPPFLAGS },
e8e27cd4156c * toplev.cc (F__octave_config_info__): Reorganize initialization.
John W. Eaton <jwe@octave.org>
parents: 23712
diff changeset
567 { "Z_LDFLAGS", octave::build_env::Z_LDFLAGS },
e8e27cd4156c * toplev.cc (F__octave_config_info__): Reorganize initialization.
John W. Eaton <jwe@octave.org>
parents: 23712
diff changeset
568 { "Z_LIBS", octave::build_env::Z_LIBS },
e8e27cd4156c * toplev.cc (F__octave_config_info__): Reorganize initialization.
John W. Eaton <jwe@octave.org>
parents: 23712
diff changeset
569 { "config_opts", octave::build_env::config_opts }};
21226
a55b8ece1ecd reorganize octave_config_info again
John W. Eaton <jwe@octave.org>
parents: 21220
diff changeset
570
23715
e8e27cd4156c * toplev.cc (F__octave_config_info__): Reorganize initialization.
John W. Eaton <jwe@octave.org>
parents: 23712
diff changeset
571 config = octave_scalar_map (conf_info_map);
e8e27cd4156c * toplev.cc (F__octave_config_info__): Reorganize initialization.
John W. Eaton <jwe@octave.org>
parents: 23712
diff changeset
572 build_env = octave_scalar_map (build_env_map);
e8e27cd4156c * toplev.cc (F__octave_config_info__): Reorganize initialization.
John W. Eaton <jwe@octave.org>
parents: 23712
diff changeset
573 build_features = octave::build_env::features ();
21226
a55b8ece1ecd reorganize octave_config_info again
John W. Eaton <jwe@octave.org>
parents: 21220
diff changeset
574
4691
bdc51b369a78 [project @ 2004-01-10 18:16:02 by jwe]
jwe
parents: 4675
diff changeset
575 bool unix_system = true;
7013
f943e9635115 [project @ 2007-10-11 19:39:02 by jwe]
jwe
parents: 7010
diff changeset
576 bool mac_system = false;
4691
bdc51b369a78 [project @ 2004-01-10 18:16:02 by jwe]
jwe
parents: 4675
diff changeset
577 bool windows_system = false;
bdc51b369a78 [project @ 2004-01-10 18:16:02 by jwe]
jwe
parents: 4675
diff changeset
578
21979
d04da18a407a use OCTAVE_USE_WINDOWS_API more consistently
John W. Eaton <jwe@octave.org>
parents: 21966
diff changeset
579 #if defined (__WIN32__)
4691
bdc51b369a78 [project @ 2004-01-10 18:16:02 by jwe]
jwe
parents: 4675
diff changeset
580 windows_system = true;
20791
f7084eae3318 maint: Use Octave coding conventions for #if statements.
Rik <rik@octave.org>
parents: 20785
diff changeset
581 #if ! defined (__CYGWIN__)
4691
bdc51b369a78 [project @ 2004-01-10 18:16:02 by jwe]
jwe
parents: 4675
diff changeset
582 unix_system = false;
bdc51b369a78 [project @ 2004-01-10 18:16:02 by jwe]
jwe
parents: 4675
diff changeset
583 #endif
bdc51b369a78 [project @ 2004-01-10 18:16:02 by jwe]
jwe
parents: 4675
diff changeset
584 #endif
bdc51b369a78 [project @ 2004-01-10 18:16:02 by jwe]
jwe
parents: 4675
diff changeset
585
8574
83b8c739d626 toplev.cc: check OCTAVE_USE_OS_X_API instead of __APPLE__ && __MACH__
John W. Eaton <jwe@octave.org>
parents: 8377
diff changeset
586 #if defined (OCTAVE_USE_OS_X_API)
7010
f7d2f54008f5 [project @ 2007-10-11 17:50:34 by jwe]
jwe
parents: 7001
diff changeset
587 mac_system = true;
f7d2f54008f5 [project @ 2007-10-11 17:50:34 by jwe]
jwe
parents: 7001
diff changeset
588 #endif
f7d2f54008f5 [project @ 2007-10-11 17:50:34 by jwe]
jwe
parents: 7001
diff changeset
589
21226
a55b8ece1ecd reorganize octave_config_info again
John W. Eaton <jwe@octave.org>
parents: 21220
diff changeset
590 config.assign ("unix", octave_value (unix_system));
a55b8ece1ecd reorganize octave_config_info again
John W. Eaton <jwe@octave.org>
parents: 21220
diff changeset
591 config.assign ("mac", octave_value (mac_system));
a55b8ece1ecd reorganize octave_config_info again
John W. Eaton <jwe@octave.org>
parents: 21220
diff changeset
592 config.assign ("windows", octave_value (windows_system));
a55b8ece1ecd reorganize octave_config_info again
John W. Eaton <jwe@octave.org>
parents: 21220
diff changeset
593
21739
c4ab2e54f100 use namespace for oct_mach_info class
John W. Eaton <jwe@octave.org>
parents: 21724
diff changeset
594 octave::mach_info::float_format ff = octave::mach_info::native_float_format ();
21226
a55b8ece1ecd reorganize octave_config_info again
John W. Eaton <jwe@octave.org>
parents: 21220
diff changeset
595 config.assign ("float_format",
21739
c4ab2e54f100 use namespace for oct_mach_info class
John W. Eaton <jwe@octave.org>
parents: 21724
diff changeset
596 octave_value (octave::mach_info::float_format_as_string (ff)));
21226
a55b8ece1ecd reorganize octave_config_info again
John W. Eaton <jwe@octave.org>
parents: 21220
diff changeset
597
a55b8ece1ecd reorganize octave_config_info again
John W. Eaton <jwe@octave.org>
parents: 21220
diff changeset
598 config.assign ("words_big_endian",
21739
c4ab2e54f100 use namespace for oct_mach_info class
John W. Eaton <jwe@octave.org>
parents: 21724
diff changeset
599 octave_value (octave::mach_info::words_big_endian ()));
21226
a55b8ece1ecd reorganize octave_config_info again
John W. Eaton <jwe@octave.org>
parents: 21220
diff changeset
600
a55b8ece1ecd reorganize octave_config_info again
John W. Eaton <jwe@octave.org>
parents: 21220
diff changeset
601 config.assign ("words_little_endian",
21739
c4ab2e54f100 use namespace for oct_mach_info class
John W. Eaton <jwe@octave.org>
parents: 21724
diff changeset
602 octave_value (octave::mach_info::words_little_endian ()));
21226
a55b8ece1ecd reorganize octave_config_info again
John W. Eaton <jwe@octave.org>
parents: 21220
diff changeset
603
a55b8ece1ecd reorganize octave_config_info again
John W. Eaton <jwe@octave.org>
parents: 21220
diff changeset
604 config.assign ("build_environment", octave_value (build_env));
a55b8ece1ecd reorganize octave_config_info again
John W. Eaton <jwe@octave.org>
parents: 21220
diff changeset
605
a55b8ece1ecd reorganize octave_config_info again
John W. Eaton <jwe@octave.org>
parents: 21220
diff changeset
606 config.assign ("build_features", octave_value (build_features));
4691
bdc51b369a78 [project @ 2004-01-10 18:16:02 by jwe]
jwe
parents: 4675
diff changeset
607
4357
d700cfed902a [project @ 2003-02-22 18:48:18 by jwe]
jwe
parents: 4356
diff changeset
608 initialized = true;
d700cfed902a [project @ 2003-02-22 18:48:18 by jwe]
jwe
parents: 4356
diff changeset
609 }
2162
a940dcdfe9de [project @ 1996-05-13 10:31:51 by jwe]
jwe
parents: 2145
diff changeset
610
2689
8c7955a8d49f [project @ 1997-02-18 09:06:10 by jwe]
jwe
parents: 2675
diff changeset
611 int nargin = args.length ();
8c7955a8d49f [project @ 1997-02-18 09:06:10 by jwe]
jwe
parents: 2675
diff changeset
612
20799
c349d4c91ce2 eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20791
diff changeset
613 if (nargin > 1)
c349d4c91ce2 eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20791
diff changeset
614 print_usage ();
c349d4c91ce2 eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20791
diff changeset
615
20939
b17fda023ca6 maint: Use new C++ archetype in more files.
Rik <rik@octave.org>
parents: 20923
diff changeset
616 octave_value_list retval;
b17fda023ca6 maint: Use new C++ archetype in more files.
Rik <rik@octave.org>
parents: 20923
diff changeset
617
2689
8c7955a8d49f [project @ 1997-02-18 09:06:10 by jwe]
jwe
parents: 2675
diff changeset
618 if (nargin == 1)
8c7955a8d49f [project @ 1997-02-18 09:06:10 by jwe]
jwe
parents: 2675
diff changeset
619 {
21434
1da428cbf401 deprecate octave_config_info
John W. Eaton <jwe@octave.org>
parents: 21421
diff changeset
620 std::string arg = args(0).xstring_value ("__octave_config_info__: OPTION argument must be a string");
21226
a55b8ece1ecd reorganize octave_config_info again
John W. Eaton <jwe@octave.org>
parents: 21220
diff changeset
621
a55b8ece1ecd reorganize octave_config_info again
John W. Eaton <jwe@octave.org>
parents: 21220
diff changeset
622 octave_value info = find_config_info (config, arg);
2689
8c7955a8d49f [project @ 1997-02-18 09:06:10 by jwe]
jwe
parents: 2675
diff changeset
623
21226
a55b8ece1ecd reorganize octave_config_info again
John W. Eaton <jwe@octave.org>
parents: 21220
diff changeset
624 if (info.is_undefined ())
a55b8ece1ecd reorganize octave_config_info again
John W. Eaton <jwe@octave.org>
parents: 21220
diff changeset
625 info = find_config_info (build_env, arg);
20939
b17fda023ca6 maint: Use new C++ archetype in more files.
Rik <rik@octave.org>
parents: 20923
diff changeset
626
21226
a55b8ece1ecd reorganize octave_config_info again
John W. Eaton <jwe@octave.org>
parents: 21220
diff changeset
627 if (info.is_undefined ())
a55b8ece1ecd reorganize octave_config_info again
John W. Eaton <jwe@octave.org>
parents: 21220
diff changeset
628 info = find_config_info (build_features, arg);
5199
16a6247730d9 [project @ 2005-03-10 20:24:45 by jwe]
jwe
parents: 5189
diff changeset
629
21226
a55b8ece1ecd reorganize octave_config_info again
John W. Eaton <jwe@octave.org>
parents: 21220
diff changeset
630 if (info.is_undefined ())
21434
1da428cbf401 deprecate octave_config_info
John W. Eaton <jwe@octave.org>
parents: 21421
diff changeset
631 error ("__octave_config_info__: no info for '%s'", arg.c_str ());
20939
b17fda023ca6 maint: Use new C++ archetype in more files.
Rik <rik@octave.org>
parents: 20923
diff changeset
632
21226
a55b8ece1ecd reorganize octave_config_info again
John W. Eaton <jwe@octave.org>
parents: 21220
diff changeset
633 return info;
2689
8c7955a8d49f [project @ 1997-02-18 09:06:10 by jwe]
jwe
parents: 2675
diff changeset
634 }
20799
c349d4c91ce2 eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20791
diff changeset
635 else
21226
a55b8ece1ecd reorganize octave_config_info again
John W. Eaton <jwe@octave.org>
parents: 21220
diff changeset
636 retval = ovl (config);
2689
8c7955a8d49f [project @ 1997-02-18 09:06:10 by jwe]
jwe
parents: 2675
diff changeset
637
8c7955a8d49f [project @ 1997-02-18 09:06:10 by jwe]
jwe
parents: 2675
diff changeset
638 return retval;
2162
a940dcdfe9de [project @ 1996-05-13 10:31:51 by jwe]
jwe
parents: 2145
diff changeset
639 }
a940dcdfe9de [project @ 1996-05-13 10:31:51 by jwe]
jwe
parents: 2145
diff changeset
640
12846
9ce9e1e2d2c8 codesprint: new tests for toplev.cc
John W. Eaton <jwe@octave.org>
parents: 12483
diff changeset
641 /*
21434
1da428cbf401 deprecate octave_config_info
John W. Eaton <jwe@octave.org>
parents: 21421
diff changeset
642 %!assert (ischar (__octave_config_info__ ("version")))
22751
e078f5607762 Fix failing BIST test in toplev.cc (bug #49575).
Rik <rik@octave.org>
parents: 22501
diff changeset
643 %!assert (__octave_config_info__ ("version"), OCTAVE_VERSION ())
12846
9ce9e1e2d2c8 codesprint: new tests for toplev.cc
John W. Eaton <jwe@octave.org>
parents: 12483
diff changeset
644 %!test
21434
1da428cbf401 deprecate octave_config_info
John W. Eaton <jwe@octave.org>
parents: 21421
diff changeset
645 %! x = __octave_config_info__ ();
12846
9ce9e1e2d2c8 codesprint: new tests for toplev.cc
John W. Eaton <jwe@octave.org>
parents: 12483
diff changeset
646 %! assert (isstruct (x));
9ce9e1e2d2c8 codesprint: new tests for toplev.cc
John W. Eaton <jwe@octave.org>
parents: 12483
diff changeset
647 %! assert (! isempty (x));
22751
e078f5607762 Fix failing BIST test in toplev.cc (bug #49575).
Rik <rik@octave.org>
parents: 22501
diff changeset
648 %! assert (x.version, OCTAVE_VERSION ());
21603
37cbdf7bffa9 Add fftwf_version (bug #45659)
mmuetzel <markus.muetzel@gmx.de>
parents: 21600
diff changeset
649
21434
1da428cbf401 deprecate octave_config_info
John W. Eaton <jwe@octave.org>
parents: 21421
diff changeset
650 %!error __octave_config_info__ (1, 2)
12846
9ce9e1e2d2c8 codesprint: new tests for toplev.cc
John W. Eaton <jwe@octave.org>
parents: 12483
diff changeset
651 */
9ce9e1e2d2c8 codesprint: new tests for toplev.cc
John W. Eaton <jwe@octave.org>
parents: 12483
diff changeset
652
1683
5282f171363d [project @ 1995-12-30 03:46:07 by jwe]
jwe
parents:
diff changeset
653 #if defined (__GNUG__) && defined (DEBUG_NEW_DELETE)
2806
187d5321cfa3 [project @ 1997-03-11 05:13:15 by jwe]
jwe
parents: 2802
diff changeset
654
1683
5282f171363d [project @ 1995-12-30 03:46:07 by jwe]
jwe
parents:
diff changeset
655 int debug_new_delete = 0;
5282f171363d [project @ 1995-12-30 03:46:07 by jwe]
jwe
parents:
diff changeset
656
5282f171363d [project @ 1995-12-30 03:46:07 by jwe]
jwe
parents:
diff changeset
657 typedef void (*vfp)(void);
5282f171363d [project @ 1995-12-30 03:46:07 by jwe]
jwe
parents:
diff changeset
658 extern vfp __new_handler;
5282f171363d [project @ 1995-12-30 03:46:07 by jwe]
jwe
parents:
diff changeset
659
5282f171363d [project @ 1995-12-30 03:46:07 by jwe]
jwe
parents:
diff changeset
660 void *
29654
d13d090cb03a use std::size_t and std::ptrdiff_t in C++ code (bug #60471)
John W. Eaton <jwe@octave.org>
parents: 29358
diff changeset
661 __builtin_new (std::size_t sz)
1683
5282f171363d [project @ 1995-12-30 03:46:07 by jwe]
jwe
parents:
diff changeset
662 {
5282f171363d [project @ 1995-12-30 03:46:07 by jwe]
jwe
parents:
diff changeset
663 void *p;
5282f171363d [project @ 1995-12-30 03:46:07 by jwe]
jwe
parents:
diff changeset
664
20946
6eff66fb8a02 style fixes for comments
John W. Eaton <jwe@octave.org>
parents: 20940
diff changeset
665 // malloc (0) is unpredictable; avoid it.
1683
5282f171363d [project @ 1995-12-30 03:46:07 by jwe]
jwe
parents:
diff changeset
666 if (sz == 0)
5282f171363d [project @ 1995-12-30 03:46:07 by jwe]
jwe
parents:
diff changeset
667 sz = 1;
21942
aab79a1885cc limit gnulib headers to liboctave/wrappers directory
John W. Eaton <jwe@octave.org>
parents: 21921
diff changeset
668 p = std::malloc (sz);
1683
5282f171363d [project @ 1995-12-30 03:46:07 by jwe]
jwe
parents:
diff changeset
669 while (p == 0)
5282f171363d [project @ 1995-12-30 03:46:07 by jwe]
jwe
parents:
diff changeset
670 {
5282f171363d [project @ 1995-12-30 03:46:07 by jwe]
jwe
parents:
diff changeset
671 (*__new_handler) ();
21942
aab79a1885cc limit gnulib headers to liboctave/wrappers directory
John W. Eaton <jwe@octave.org>
parents: 21921
diff changeset
672 p = std::malloc (sz);
1683
5282f171363d [project @ 1995-12-30 03:46:07 by jwe]
jwe
parents:
diff changeset
673 }
5282f171363d [project @ 1995-12-30 03:46:07 by jwe]
jwe
parents:
diff changeset
674
5282f171363d [project @ 1995-12-30 03:46:07 by jwe]
jwe
parents:
diff changeset
675 if (debug_new_delete)
5629
489a475073d7 [project @ 2006-02-20 21:47:12 by jwe]
jwe
parents: 5510
diff changeset
676 std::cerr << "__builtin_new: " << p << std::endl;
1683
5282f171363d [project @ 1995-12-30 03:46:07 by jwe]
jwe
parents:
diff changeset
677
5282f171363d [project @ 1995-12-30 03:46:07 by jwe]
jwe
parents:
diff changeset
678 return p;
5282f171363d [project @ 1995-12-30 03:46:07 by jwe]
jwe
parents:
diff changeset
679 }
5282f171363d [project @ 1995-12-30 03:46:07 by jwe]
jwe
parents:
diff changeset
680
5282f171363d [project @ 1995-12-30 03:46:07 by jwe]
jwe
parents:
diff changeset
681 void
5282f171363d [project @ 1995-12-30 03:46:07 by jwe]
jwe
parents:
diff changeset
682 __builtin_delete (void *ptr)
5282f171363d [project @ 1995-12-30 03:46:07 by jwe]
jwe
parents:
diff changeset
683 {
5282f171363d [project @ 1995-12-30 03:46:07 by jwe]
jwe
parents:
diff changeset
684 if (debug_new_delete)
5629
489a475073d7 [project @ 2006-02-20 21:47:12 by jwe]
jwe
parents: 5510
diff changeset
685 std::cerr << "__builtin_delete: " << ptr << std::endl;
1683
5282f171363d [project @ 1995-12-30 03:46:07 by jwe]
jwe
parents:
diff changeset
686
23878
889b8262e661 maint: eliminate useless if (p) before free (p)
Mike Miller <mtmiller@octave.org>
parents: 23803
diff changeset
687 free (ptr);
1683
5282f171363d [project @ 1995-12-30 03:46:07 by jwe]
jwe
parents:
diff changeset
688 }
2806
187d5321cfa3 [project @ 1997-03-11 05:13:15 by jwe]
jwe
parents: 2802
diff changeset
689
1683
5282f171363d [project @ 1995-12-30 03:46:07 by jwe]
jwe
parents:
diff changeset
690 #endif