annotate libinterp/corefcn/toplev.cc @ 30564:796f54d4ddbf stable

update Octave Project Developers copyright for the new year In files that have the "Octave Project Developers" copyright notice, update for 2021. In all .txi and .texi files except gpl.txi and gpl.texi in the doc/liboctave and doc/interpreter directories, change the copyright to "Octave Project Developers", the same as used for other source files. Update copyright notices for 2022 (not done since 2019). For gpl.txi and gpl.texi, change the copyright notice to be "Free Software Foundation, Inc." and leave the date at 2007 only because this file only contains the text of the GPL, not anything created by the Octave Project Developers. Add Paul Thomas to contributors.in.
author John W. Eaton <jwe@octave.org>
date Tue, 28 Dec 2021 18:22:40 -0500
parents 7d6709900da7
children 83f9f8bda883
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 //
30564
796f54d4ddbf update Octave Project Developers copyright for the new year
John W. Eaton <jwe@octave.org>
parents: 29961
diff changeset
3 // Copyright (C) 1995-2022 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
29958
32c3a5805893 move DEFUN and DEFMETHOD functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 29949
diff changeset
75 OCTAVE_NAMESPACE_BEGIN
32c3a5805893 move DEFUN and DEFMETHOD functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 29949
diff changeset
76
29462
280defaf2023 pkg.m: Install local packages in version dependent path (bug #58299).
Markus Mützel <markus.muetzel@gmx.de>
parents: 29359
diff changeset
77 #define STRINGIFY(s) STRINGIFY1(s)
280defaf2023 pkg.m: Install local packages in version dependent path (bug #58299).
Markus Mützel <markus.muetzel@gmx.de>
parents: 29359
diff changeset
78 #define STRINGIFY1(s) #s
280defaf2023 pkg.m: Install local packages in version dependent path (bug #58299).
Markus Mützel <markus.muetzel@gmx.de>
parents: 29359
diff changeset
79
1957
0e6a0a271998 [project @ 1996-02-15 01:08:15 by jwe]
jwe
parents: 1907
diff changeset
80 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
81 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
82 @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
83 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
84 @end deftypefn */)
1683
5282f171363d [project @ 1995-12-30 03:46:07 by jwe]
jwe
parents:
diff changeset
85 {
17510
7542f4496974 eliminate some macros in version.h
John W. Eaton <jwe@octave.org>
parents: 17281
diff changeset
86 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
87 \n\
24534
194eb4bd202b maint: Update punctuation for GPL v3 license text.
Rik <rik@octave.org>
parents: 24009
diff changeset
88 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
89 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
90 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
91 (at your option) any later version.\n\
5282f171363d [project @ 1995-12-30 03:46:07 by jwe]
jwe
parents:
diff changeset
92 \n\
26177
f2d795f07c84 maint: Use standard copyright phrasing in all files.
Rik <rik@octave.org>
parents: 25931
diff changeset
93 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
94 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
95 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n\
5282f171363d [project @ 1995-12-30 03:46:07 by jwe]
jwe
parents:
diff changeset
96 GNU General Public License for more details.\n\
5282f171363d [project @ 1995-12-30 03:46:07 by jwe]
jwe
parents:
diff changeset
97 \n\
5282f171363d [project @ 1995-12-30 03:46:07 by jwe]
jwe
parents:
diff changeset
98 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
99 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
100 <https://www.gnu.org/licenses/>.\n\
1683
5282f171363d [project @ 1995-12-30 03:46:07 by jwe]
jwe
parents:
diff changeset
101 \n";
5282f171363d [project @ 1995-12-30 03:46:07 by jwe]
jwe
parents:
diff changeset
102
21078
49852ff04747 maint: Remove unnecessary declarations of retval.
Rik <rik@octave.org>
parents: 21055
diff changeset
103 return ovl ();
1683
5282f171363d [project @ 1995-12-30 03:46:07 by jwe]
jwe
parents:
diff changeset
104 }
5282f171363d [project @ 1995-12-30 03:46:07 by jwe]
jwe
parents:
diff changeset
105
5282f171363d [project @ 1995-12-30 03:46:07 by jwe]
jwe
parents:
diff changeset
106 // Execute a shell command.
5282f171363d [project @ 1995-12-30 03:46:07 by jwe]
jwe
parents:
diff changeset
107
2086
bfb775fb6fe8 [project @ 1996-04-25 05:55:19 by jwe]
jwe
parents: 2084
diff changeset
108 static octave_value_list
3523
b80bbb43a1a9 [project @ 2000-02-02 10:25:52 by jwe]
jwe
parents: 3503
diff changeset
109 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
110 {
2086
bfb775fb6fe8 [project @ 1996-04-25 05:55:19 by jwe]
jwe
parents: 2084
diff changeset
111 octave_value_list retval;
29961
7d6709900da7 eliminate octave:: namespace tags in DEFUN and DEFMETHOD and more
John W. Eaton <jwe@octave.org>
parents: 29958
diff changeset
112 unwind_protect frame;
2083
679d7262a525 [project @ 1996-04-25 04:29:27 by jwe]
jwe
parents: 2078
diff changeset
113
679d7262a525 [project @ 1996-04-25 04:29:27 by jwe]
jwe
parents: 2078
diff changeset
114 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
115 frame.add_delete (cmd);
2083
679d7262a525 [project @ 1996-04-25 04:29:27 by jwe]
jwe
parents: 2078
diff changeset
116
29961
7d6709900da7 eliminate octave:: namespace tags in DEFUN and DEFMETHOD and more
John W. Eaton <jwe@octave.org>
parents: 29958
diff changeset
117 child_list& kids
7d6709900da7 eliminate octave:: namespace tags in DEFUN and DEFMETHOD and more
John W. Eaton <jwe@octave.org>
parents: 29958
diff changeset
118 = __get_child_list__ ("run_command_and_return_output");
7d6709900da7 eliminate octave:: namespace tags in DEFUN and DEFMETHOD and more
John W. Eaton <jwe@octave.org>
parents: 29958
diff changeset
119 frame.add (&child_list::remove, kids, cmd->pid ());
3060
9c6cd52f3f5a [project @ 1997-06-25 18:30:40 by jwe]
jwe
parents: 3020
diff changeset
120
20962
3aa293be0e8d maint: Invert simple conditionals in if/else/error paradigm.
Rik <rik@octave.org>
parents: 20946
diff changeset
121 if (! *cmd)
3aa293be0e8d maint: Invert simple conditionals in if/else/error paradigm.
Rik <rik@octave.org>
parents: 20946
diff changeset
122 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
123
3aa293be0e8d maint: Invert simple conditionals in if/else/error paradigm.
Rik <rik@octave.org>
parents: 20946
diff changeset
124 int fid = cmd->file_number ();
3aa293be0e8d maint: Invert simple conditionals in if/else/error paradigm.
Rik <rik@octave.org>
parents: 20946
diff changeset
125
3aa293be0e8d maint: Invert simple conditionals in if/else/error paradigm.
Rik <rik@octave.org>
parents: 20946
diff changeset
126 std::ostringstream output_buf;
2095
36903d507b0e [project @ 1996-04-28 09:00:07 by jwe]
jwe
parents: 2086
diff changeset
127
20962
3aa293be0e8d maint: Invert simple conditionals in if/else/error paradigm.
Rik <rik@octave.org>
parents: 20946
diff changeset
128 char ch;
4494
93ad80b6eef6 [project @ 2003-09-03 20:27:00 by jwe]
jwe
parents: 4489
diff changeset
129
20962
3aa293be0e8d maint: Invert simple conditionals in if/else/error paradigm.
Rik <rik@octave.org>
parents: 20946
diff changeset
130 for (;;)
3aa293be0e8d maint: Invert simple conditionals in if/else/error paradigm.
Rik <rik@octave.org>
parents: 20946
diff changeset
131 {
3aa293be0e8d maint: Invert simple conditionals in if/else/error paradigm.
Rik <rik@octave.org>
parents: 20946
diff changeset
132 if (cmd->get (ch))
3aa293be0e8d maint: Invert simple conditionals in if/else/error paradigm.
Rik <rik@octave.org>
parents: 20946
diff changeset
133 output_buf.put (ch);
3aa293be0e8d maint: Invert simple conditionals in if/else/error paradigm.
Rik <rik@octave.org>
parents: 20946
diff changeset
134 else
10212
56f7734f5448 fix process creation failure handling in system()
Jaroslav Hajek <highegg@gmail.com>
parents: 10186
diff changeset
135 {
20962
3aa293be0e8d maint: Invert simple conditionals in if/else/error paradigm.
Rik <rik@octave.org>
parents: 20946
diff changeset
136 if (! cmd->eof () && errno == EAGAIN)
10212
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 cmd->clear ();
3147
894d516b4a00 [project @ 1998-02-06 06:00:08 by jwe]
jwe
parents: 3141
diff changeset
139
21899
7c053ad1c7ba hide sys/select header
John W. Eaton <jwe@octave.org>
parents: 21855
diff changeset
140 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
141 break;
56f7734f5448 fix process creation failure handling in system()
Jaroslav Hajek <highegg@gmail.com>
parents: 10186
diff changeset
142 }
20962
3aa293be0e8d maint: Invert simple conditionals in if/else/error paradigm.
Rik <rik@octave.org>
parents: 20946
diff changeset
143 else
3aa293be0e8d maint: Invert simple conditionals in if/else/error paradigm.
Rik <rik@octave.org>
parents: 20946
diff changeset
144 break;
10212
56f7734f5448 fix process creation failure handling in system()
Jaroslav Hajek <highegg@gmail.com>
parents: 10186
diff changeset
145 }
20962
3aa293be0e8d maint: Invert simple conditionals in if/else/error paradigm.
Rik <rik@octave.org>
parents: 20946
diff changeset
146 }
3147
894d516b4a00 [project @ 1998-02-06 06:00:08 by jwe]
jwe
parents: 3141
diff changeset
147
20962
3aa293be0e8d maint: Invert simple conditionals in if/else/error paradigm.
Rik <rik@octave.org>
parents: 20946
diff changeset
148 int cmd_status = cmd->close ();
2083
679d7262a525 [project @ 1996-04-25 04:29:27 by jwe]
jwe
parents: 2078
diff changeset
149
29961
7d6709900da7 eliminate octave:: namespace tags in DEFUN and DEFMETHOD and more
John W. Eaton <jwe@octave.org>
parents: 29958
diff changeset
150 if (sys::wifexited (cmd_status))
7d6709900da7 eliminate octave:: namespace tags in DEFUN and DEFMETHOD and more
John W. Eaton <jwe@octave.org>
parents: 29958
diff changeset
151 cmd_status = sys::wexitstatus (cmd_status);
20962
3aa293be0e8d maint: Invert simple conditionals in if/else/error paradigm.
Rik <rik@octave.org>
parents: 20946
diff changeset
152 else
3aa293be0e8d maint: Invert simple conditionals in if/else/error paradigm.
Rik <rik@octave.org>
parents: 20946
diff changeset
153 cmd_status = 127;
2083
679d7262a525 [project @ 1996-04-25 04:29:27 by jwe]
jwe
parents: 2078
diff changeset
154
20962
3aa293be0e8d maint: Invert simple conditionals in if/else/error paradigm.
Rik <rik@octave.org>
parents: 20946
diff changeset
155 retval = ovl (cmd_status, output_buf.str ());
2083
679d7262a525 [project @ 1996-04-25 04:29:27 by jwe]
jwe
parents: 2078
diff changeset
156
679d7262a525 [project @ 1996-04-25 04:29:27 by jwe]
jwe
parents: 2078
diff changeset
157 return retval;
679d7262a525 [project @ 1996-04-25 04:29:27 by jwe]
jwe
parents: 2078
diff changeset
158 }
679d7262a525 [project @ 1996-04-25 04:29:27 by jwe]
jwe
parents: 2078
diff changeset
159
25284
78fb24bdd8bb unblock async signals before executing subprocess (bug #53635)
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
160 // 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
161
78fb24bdd8bb unblock async signals before executing subprocess (bug #53635)
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
162 static void *
78fb24bdd8bb unblock async signals before executing subprocess (bug #53635)
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
163 get_signal_mask (void)
78fb24bdd8bb unblock async signals before executing subprocess (bug #53635)
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
164 {
78fb24bdd8bb unblock async signals before executing subprocess (bug #53635)
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
165 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
166
78fb24bdd8bb unblock async signals before executing subprocess (bug #53635)
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
167 octave_get_signal_mask (mask);
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 return mask;
78fb24bdd8bb unblock async signals before executing subprocess (bug #53635)
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
170 }
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 // 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
173
78fb24bdd8bb unblock async signals before executing subprocess (bug #53635)
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
174 static void
78fb24bdd8bb unblock async signals before executing subprocess (bug #53635)
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
175 restore_signal_mask (void *mask)
78fb24bdd8bb unblock async signals before executing subprocess (bug #53635)
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
176 {
78fb24bdd8bb unblock async signals before executing subprocess (bug #53635)
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
177 octave_set_signal_mask (mask);
78fb24bdd8bb unblock async signals before executing subprocess (bug #53635)
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
178
78fb24bdd8bb unblock async signals before executing subprocess (bug #53635)
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
179 octave_free_signal_mask (mask);
78fb24bdd8bb unblock async signals before executing subprocess (bug #53635)
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
180 }
78fb24bdd8bb unblock async signals before executing subprocess (bug #53635)
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
181
5285
fe5ee25a5e6c [project @ 2005-04-19 15:02:49 by jwe]
jwe
parents: 5275
diff changeset
182 enum system_exec_type { et_sync, et_async };
fe5ee25a5e6c [project @ 2005-04-19 15:02:49 by jwe]
jwe
parents: 5275
diff changeset
183
1957
0e6a0a271998 [project @ 1996-02-15 01:08:15 by jwe]
jwe
parents: 1907
diff changeset
184 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
185 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
186 @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
187 @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
188 @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
189 @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
190 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
191
28604
69cba42a01ca doc: Re-order system() docs to match order of parameters.
Rik <rik@octave.org>
parents: 27923
diff changeset
192 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
193 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
194 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
195 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
196 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
197 @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
198
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21949
diff changeset
199 @example
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21949
diff changeset
200 @group
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21949
diff changeset
201 [~, text] = system ("cmd");
24801
daf61c7dfcae Change default status of pager to "off" (bug #53217).
Rik <rik@octave.org>
parents: 24734
diff changeset
202 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
203 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
204 @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
205 @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
206
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21949
diff changeset
207 @noindent
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21949
diff changeset
208 or
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21949
diff changeset
209
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21949
diff changeset
210 @example
24801
daf61c7dfcae Change default status of pager to "off" (bug #53217).
Rik <rik@octave.org>
parents: 24734
diff changeset
211 @group
daf61c7dfcae Change default status of pager to "off" (bug #53217).
Rik <rik@octave.org>
parents: 24734
diff changeset
212 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
213 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
214 @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
215 @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
216
28604
69cba42a01ca doc: Re-order system() docs to match order of parameters.
Rik <rik@octave.org>
parents: 27923
diff changeset
217 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
218 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
219 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
220 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
221 @qcode{"sync"}.
69cba42a01ca doc: Re-order system() docs to match order of parameters.
Rik <rik@octave.org>
parents: 27923
diff changeset
222
69cba42a01ca doc: Re-order system() docs to match order of parameters.
Rik <rik@octave.org>
parents: 27923
diff changeset
223 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
224 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
225 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
226
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21949
diff changeset
227 @example
24009
eef8c31ffe97 Document that the shell for system() differs between OS (bug #49825).
Rik <rik@octave.org>
parents: 24007
diff changeset
228 [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
229 @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
230
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21949
diff changeset
231 @noindent
28604
69cba42a01ca doc: Re-order system() docs to match order of parameters.
Rik <rik@octave.org>
parents: 27923
diff changeset
232 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
233 @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
234
28604
69cba42a01ca doc: Re-order system() docs to match order of parameters.
Rik <rik@octave.org>
parents: 27923
diff changeset
235 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
236 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
237
eef8c31ffe97 Document that the shell for system() differs between OS (bug #49825).
Rik <rik@octave.org>
parents: 24007
diff changeset
238 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
239 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
240 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
241 @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
242 @end deftypefn */)
1683
5282f171363d [project @ 1995-12-30 03:46:07 by jwe]
jwe
parents:
diff changeset
243 {
5282f171363d [project @ 1995-12-30 03:46:07 by jwe]
jwe
parents:
diff changeset
244 int nargin = args.length ();
5282f171363d [project @ 1995-12-30 03:46:07 by jwe]
jwe
parents:
diff changeset
245
20799
c349d4c91ce2 eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20791
diff changeset
246 if (nargin == 0 || nargin > 3)
c349d4c91ce2 eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20791
diff changeset
247 print_usage ();
2083
679d7262a525 [project @ 1996-04-25 04:29:27 by jwe]
jwe
parents: 2078
diff changeset
248
20799
c349d4c91ce2 eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20791
diff changeset
249 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
250 if (nargin == 3)
c349d4c91ce2 eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20791
diff changeset
251 {
c349d4c91ce2 eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20791
diff changeset
252 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
253
20799
c349d4c91ce2 eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20791
diff changeset
254 if (type_str == "sync")
c349d4c91ce2 eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20791
diff changeset
255 type = et_sync;
c349d4c91ce2 eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20791
diff changeset
256 else if (type_str == "async")
c349d4c91ce2 eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20791
diff changeset
257 type = et_async;
c349d4c91ce2 eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20791
diff changeset
258 else
23803
90689bdbe048 Use C++11 raw string literals to avoid escaping double quotes.
Rik <rik@octave.org>
parents: 23721
diff changeset
259 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
260 }
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
261
20939
b17fda023ca6 maint: Use new C++ archetype in more files.
Rik <rik@octave.org>
parents: 20923
diff changeset
262 octave_value_list retval;
b17fda023ca6 maint: Use new C++ archetype in more files.
Rik <rik@octave.org>
parents: 20923
diff changeset
263
b17fda023ca6 maint: Use new C++ archetype in more files.
Rik <rik@octave.org>
parents: 20923
diff changeset
264 bool return_output = (nargin == 1 && nargout > 1);
b17fda023ca6 maint: Use new C++ archetype in more files.
Rik <rik@octave.org>
parents: 20923
diff changeset
265
20799
c349d4c91ce2 eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20791
diff changeset
266 if (nargin > 1)
c349d4c91ce2 eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20791
diff changeset
267 {
c349d4c91ce2 eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20791
diff changeset
268 try
c349d4c91ce2 eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20791
diff changeset
269 {
c349d4c91ce2 eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20791
diff changeset
270 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
271 }
29961
7d6709900da7 eliminate octave:: namespace tags in DEFUN and DEFMETHOD and more
John W. Eaton <jwe@octave.org>
parents: 29958
diff changeset
272 catch (execution_exception& ee)
20799
c349d4c91ce2 eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20791
diff changeset
273 {
29163
8f67ad8b3103 maint: Updating naming conventions for exceptions and use const where possible.
Rik <rik@octave.org>
parents: 29141
diff changeset
274 error (ee, "system: RETURN_OUTPUT must be boolean value true or false");
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 }
c349d4c91ce2 eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20791
diff changeset
277
c349d4c91ce2 eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20791
diff changeset
278 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
279 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
280
c349d4c91ce2 eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20791
diff changeset
281 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
282
21979
d04da18a407a use OCTAVE_USE_WINDOWS_API more consistently
John W. Eaton <jwe@octave.org>
parents: 21966
diff changeset
283 #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
284 // 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
285 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
286 cmd_str = '"' + cmd_str + '"';
7104
b26d0cd10a42 [project @ 2007-11-06 17:18:41 by jwe]
jwe
parents: 7017
diff changeset
287 #endif
b26d0cd10a42 [project @ 2007-11-06 17:18:41 by jwe]
jwe
parents: 7017
diff changeset
288
29961
7d6709900da7 eliminate octave:: namespace tags in DEFUN and DEFMETHOD and more
John W. Eaton <jwe@octave.org>
parents: 29958
diff changeset
289 unwind_action restore_mask
28850
445e5ac1f58d in unwind_action objects, capture variables in lambda expressions when possible
John W. Eaton <jwe@octave.org>
parents: 28823
diff changeset
290 ([] (void *mask) { restore_signal_mask (mask); }, get_signal_mask ());
25284
78fb24bdd8bb unblock async signals before executing subprocess (bug #53635)
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
291
78fb24bdd8bb unblock async signals before executing subprocess (bug #53635)
John W. Eaton <jwe@octave.org>
parents: 25054
diff changeset
292 octave_unblock_async_signals ();
26826
20881d195d20 fix handling of SIGTSTP (bug #51903)
John W. Eaton <jwe@octave.org>
parents: 26603
diff changeset
293 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
294
20799
c349d4c91ce2 eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20791
diff changeset
295 if (type == et_async)
22264
9b78fda78300 fix build failure for --without-z (bug #48757)
John W. Eaton <jwe@octave.org>
parents: 22094
diff changeset
296 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
297 else if (return_output)
c349d4c91ce2 eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20791
diff changeset
298 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
299 else
c349d4c91ce2 eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20791
diff changeset
300 {
29961
7d6709900da7 eliminate octave:: namespace tags in DEFUN and DEFMETHOD and more
John W. Eaton <jwe@octave.org>
parents: 29958
diff changeset
301 int status = sys::system (cmd_str);
2321
dac9933079e6 [project @ 1996-07-15 21:08:05 by jwe]
jwe
parents: 2299
diff changeset
302
20799
c349d4c91ce2 eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20791
diff changeset
303 // 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
304 // 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
305 // 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
306 // failure code.
20582
ba2b07c13913 use new string_value method to handle value extraction errors
John W. Eaton <jwe@octave.org>
parents: 20555
diff changeset
307
29961
7d6709900da7 eliminate octave:: namespace tags in DEFUN and DEFMETHOD and more
John W. Eaton <jwe@octave.org>
parents: 29958
diff changeset
308 if (sys::wifexited (status))
7d6709900da7 eliminate octave:: namespace tags in DEFUN and DEFMETHOD and more
John W. Eaton <jwe@octave.org>
parents: 29958
diff changeset
309 status = sys::wexitstatus (status);
20799
c349d4c91ce2 eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20791
diff changeset
310
c349d4c91ce2 eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20791
diff changeset
311 retval(0) = status;
1683
5282f171363d [project @ 1995-12-30 03:46:07 by jwe]
jwe
parents:
diff changeset
312 }
5282f171363d [project @ 1995-12-30 03:46:07 by jwe]
jwe
parents:
diff changeset
313
5282f171363d [project @ 1995-12-30 03:46:07 by jwe]
jwe
parents:
diff changeset
314 return retval;
5282f171363d [project @ 1995-12-30 03:46:07 by jwe]
jwe
parents:
diff changeset
315 }
5282f171363d [project @ 1995-12-30 03:46:07 by jwe]
jwe
parents:
diff changeset
316
12846
9ce9e1e2d2c8 codesprint: new tests for toplev.cc
John W. Eaton <jwe@octave.org>
parents: 12483
diff changeset
317 /*
9ce9e1e2d2c8 codesprint: new tests for toplev.cc
John W. Eaton <jwe@octave.org>
parents: 12483
diff changeset
318 %!test
14018
5d5685216876 Deprecate shell_cmd function and update system, dos, unix commands
Rik <octave@nomad.inbox5.com>
parents: 14016
diff changeset
319 %! cmd = ls_command ();
12846
9ce9e1e2d2c8 codesprint: new tests for toplev.cc
John W. Eaton <jwe@octave.org>
parents: 12483
diff changeset
320 %! [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
321 %! assert (status, 0);
12846
9ce9e1e2d2c8 codesprint: new tests for toplev.cc
John W. Eaton <jwe@octave.org>
parents: 12483
diff changeset
322 %! assert (ischar (output));
9ce9e1e2d2c8 codesprint: new tests for toplev.cc
John W. Eaton <jwe@octave.org>
parents: 12483
diff changeset
323 %! assert (! isempty (output));
14018
5d5685216876 Deprecate shell_cmd function and update system, dos, unix commands
Rik <octave@nomad.inbox5.com>
parents: 14016
diff changeset
324
5d5685216876 Deprecate shell_cmd function and update system, dos, unix commands
Rik <octave@nomad.inbox5.com>
parents: 14016
diff changeset
325 %!error system ()
5d5685216876 Deprecate shell_cmd function and update system, dos, unix commands
Rik <octave@nomad.inbox5.com>
parents: 14016
diff changeset
326 %!error system (1, 2, 3)
12846
9ce9e1e2d2c8 codesprint: new tests for toplev.cc
John W. Eaton <jwe@octave.org>
parents: 12483
diff changeset
327 */
9ce9e1e2d2c8 codesprint: new tests for toplev.cc
John W. Eaton <jwe@octave.org>
parents: 12483
diff changeset
328
21226
a55b8ece1ecd reorganize octave_config_info again
John W. Eaton <jwe@octave.org>
parents: 21220
diff changeset
329 static octave_value
a55b8ece1ecd reorganize octave_config_info again
John W. Eaton <jwe@octave.org>
parents: 21220
diff changeset
330 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
331 {
a55b8ece1ecd reorganize octave_config_info again
John W. Eaton <jwe@octave.org>
parents: 21220
diff changeset
332 if (m.isfield (key))
a55b8ece1ecd reorganize octave_config_info again
John W. Eaton <jwe@octave.org>
parents: 21220
diff changeset
333 {
a55b8ece1ecd reorganize octave_config_info again
John W. Eaton <jwe@octave.org>
parents: 21220
diff changeset
334 Cell c = m.contents (key);
a55b8ece1ecd reorganize octave_config_info again
John W. Eaton <jwe@octave.org>
parents: 21220
diff changeset
335
23577
80c42f4cca13 maint: Deprecate is_empty and replace with isempty.
Rik <rik@octave.org>
parents: 23487
diff changeset
336 if (! c.isempty ())
21226
a55b8ece1ecd reorganize octave_config_info again
John W. Eaton <jwe@octave.org>
parents: 21220
diff changeset
337 return c(0);
a55b8ece1ecd reorganize octave_config_info again
John W. Eaton <jwe@octave.org>
parents: 21220
diff changeset
338 }
a55b8ece1ecd reorganize octave_config_info again
John W. Eaton <jwe@octave.org>
parents: 21220
diff changeset
339
a55b8ece1ecd reorganize octave_config_info again
John W. Eaton <jwe@octave.org>
parents: 21220
diff changeset
340 return octave_value ();
a55b8ece1ecd reorganize octave_config_info again
John W. Eaton <jwe@octave.org>
parents: 21220
diff changeset
341 }
a55b8ece1ecd reorganize octave_config_info again
John W. Eaton <jwe@octave.org>
parents: 21220
diff changeset
342
21434
1da428cbf401 deprecate octave_config_info
John W. Eaton <jwe@octave.org>
parents: 21421
diff changeset
343 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
344 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
345 @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
346 @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
347 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
348 Octave.
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21949
diff changeset
349
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21949
diff changeset
350 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
351 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
352
112b20240c87 move docstrings in C++ files out of C strings and into comments
John W. Eaton <jwe@octave.org>
parents: 21949
diff changeset
353 @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
354 @end deftypefn */)
2162
a940dcdfe9de [project @ 1996-05-13 10:31:51 by jwe]
jwe
parents: 2145
diff changeset
355 {
23715
e8e27cd4156c * toplev.cc (F__octave_config_info__): Reorganize initialization.
John W. Eaton <jwe@octave.org>
parents: 23712
diff changeset
356 static octave_scalar_map config;
e8e27cd4156c * toplev.cc (F__octave_config_info__): Reorganize initialization.
John W. Eaton <jwe@octave.org>
parents: 23712
diff changeset
357 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
358 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
359
4357
d700cfed902a [project @ 2003-02-22 18:48:18 by jwe]
jwe
parents: 4356
diff changeset
360 static bool initialized = false;
2162
a940dcdfe9de [project @ 1996-05-13 10:31:51 by jwe]
jwe
parents: 2145
diff changeset
361
23715
e8e27cd4156c * toplev.cc (F__octave_config_info__): Reorganize initialization.
John W. Eaton <jwe@octave.org>
parents: 23712
diff changeset
362 if (! initialized)
e8e27cd4156c * toplev.cc (F__octave_config_info__): Reorganize initialization.
John W. Eaton <jwe@octave.org>
parents: 23712
diff changeset
363 {
e8e27cd4156c * toplev.cc (F__octave_config_info__): Reorganize initialization.
John W. Eaton <jwe@octave.org>
parents: 23712
diff changeset
364 std::map<std::string, octave_value> conf_info_map
29961
7d6709900da7 eliminate octave:: namespace tags in DEFUN and DEFMETHOD and more
John W. Eaton <jwe@octave.org>
parents: 29958
diff changeset
365 = {{ "DEFAULT_PAGER", config::default_pager () },
21226
a55b8ece1ecd reorganize octave_config_info again
John W. Eaton <jwe@octave.org>
parents: 21220
diff changeset
366
21229
a83e7a384ee0 create and install a subset of config.h in octave-config.h
John W. Eaton <jwe@octave.org>
parents: 21226
diff changeset
367 #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
368 { "ENABLE_64", true },
21226
a55b8ece1ecd reorganize octave_config_info again
John W. Eaton <jwe@octave.org>
parents: 21220
diff changeset
369 #else
23715
e8e27cd4156c * toplev.cc (F__octave_config_info__): Reorganize initialization.
John W. Eaton <jwe@octave.org>
parents: 23712
diff changeset
370 { "ENABLE_64", false },
21226
a55b8ece1ecd reorganize octave_config_info again
John W. Eaton <jwe@octave.org>
parents: 21220
diff changeset
371 #endif
a55b8ece1ecd reorganize octave_config_info again
John W. Eaton <jwe@octave.org>
parents: 21220
diff changeset
372
27534
f70d7a9ee3fd include ENABLE_COMMAND_LINE_PUSH_PARSER in build info struct
John W. Eaton <jwe@octave.org>
parents: 27486
diff changeset
373 #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
374 { "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
375 #else
f70d7a9ee3fd include ENABLE_COMMAND_LINE_PUSH_PARSER in build info struct
John W. Eaton <jwe@octave.org>
parents: 27486
diff changeset
376 { "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
377 #endif
f70d7a9ee3fd include ENABLE_COMMAND_LINE_PUSH_PARSER in build info struct
John W. Eaton <jwe@octave.org>
parents: 27486
diff changeset
378
21226
a55b8ece1ecd reorganize octave_config_info again
John W. Eaton <jwe@octave.org>
parents: 21220
diff changeset
379 #if defined (ENABLE_DOCS)
23715
e8e27cd4156c * toplev.cc (F__octave_config_info__): Reorganize initialization.
John W. Eaton <jwe@octave.org>
parents: 23712
diff changeset
380 { "ENABLE_DOCS", true },
21226
a55b8ece1ecd reorganize octave_config_info again
John W. Eaton <jwe@octave.org>
parents: 21220
diff changeset
381 #else
23715
e8e27cd4156c * toplev.cc (F__octave_config_info__): Reorganize initialization.
John W. Eaton <jwe@octave.org>
parents: 23712
diff changeset
382 { "ENABLE_DOCS", false },
21226
a55b8ece1ecd reorganize octave_config_info again
John W. Eaton <jwe@octave.org>
parents: 21220
diff changeset
383 #endif
a55b8ece1ecd reorganize octave_config_info again
John W. Eaton <jwe@octave.org>
parents: 21220
diff changeset
384
21229
a83e7a384ee0 create and install a subset of config.h in octave-config.h
John W. Eaton <jwe@octave.org>
parents: 21226
diff changeset
385 #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
386 { "ENABLE_FLOAT_TRUNCATE", true },
21226
a55b8ece1ecd reorganize octave_config_info again
John W. Eaton <jwe@octave.org>
parents: 21220
diff changeset
387 #else
23715
e8e27cd4156c * toplev.cc (F__octave_config_info__): Reorganize initialization.
John W. Eaton <jwe@octave.org>
parents: 23712
diff changeset
388 { "ENABLE_FLOAT_TRUNCATE", false },
21226
a55b8ece1ecd reorganize octave_config_info again
John W. Eaton <jwe@octave.org>
parents: 21220
diff changeset
389 #endif
a55b8ece1ecd reorganize octave_config_info again
John W. Eaton <jwe@octave.org>
parents: 21220
diff changeset
390
21229
a83e7a384ee0 create and install a subset of config.h in octave-config.h
John W. Eaton <jwe@octave.org>
parents: 21226
diff changeset
391 #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
392 { "ENABLE_OPENMP", true },
21226
a55b8ece1ecd reorganize octave_config_info again
John W. Eaton <jwe@octave.org>
parents: 21220
diff changeset
393 #else
23715
e8e27cd4156c * toplev.cc (F__octave_config_info__): Reorganize initialization.
John W. Eaton <jwe@octave.org>
parents: 23712
diff changeset
394 { "ENABLE_OPENMP", false },
21226
a55b8ece1ecd reorganize octave_config_info again
John W. Eaton <jwe@octave.org>
parents: 21220
diff changeset
395 #endif
a55b8ece1ecd reorganize octave_config_info again
John W. Eaton <jwe@octave.org>
parents: 21220
diff changeset
396
23715
e8e27cd4156c * toplev.cc (F__octave_config_info__): Reorganize initialization.
John W. Eaton <jwe@octave.org>
parents: 23712
diff changeset
397 { "api_version", OCTAVE_API_VERSION },
29961
7d6709900da7 eliminate octave:: namespace tags in DEFUN and DEFMETHOD and more
John W. Eaton <jwe@octave.org>
parents: 29958
diff changeset
398 { "archlibdir", config::arch_lib_dir () },
7d6709900da7 eliminate octave:: namespace tags in DEFUN and DEFMETHOD and more
John W. Eaton <jwe@octave.org>
parents: 29958
diff changeset
399 { "bindir", config::bin_dir () },
7d6709900da7 eliminate octave:: namespace tags in DEFUN and DEFMETHOD and more
John W. Eaton <jwe@octave.org>
parents: 29958
diff changeset
400 { "canonical_host_type", config::canonical_host_type () },
7d6709900da7 eliminate octave:: namespace tags in DEFUN and DEFMETHOD and more
John W. Eaton <jwe@octave.org>
parents: 29958
diff changeset
401 { "datadir", config::data_dir () },
7d6709900da7 eliminate octave:: namespace tags in DEFUN and DEFMETHOD and more
John W. Eaton <jwe@octave.org>
parents: 29958
diff changeset
402 { "datarootdir", config::dataroot_dir () },
7d6709900da7 eliminate octave:: namespace tags in DEFUN and DEFMETHOD and more
John W. Eaton <jwe@octave.org>
parents: 29958
diff changeset
403 { "fcnfiledir", config::fcn_file_dir () },
7d6709900da7 eliminate octave:: namespace tags in DEFUN and DEFMETHOD and more
John W. Eaton <jwe@octave.org>
parents: 29958
diff changeset
404 { "fftw_version", fftw_version () },
7d6709900da7 eliminate octave:: namespace tags in DEFUN and DEFMETHOD and more
John W. Eaton <jwe@octave.org>
parents: 29958
diff changeset
405 { "fftwf_version", fftwf_version () },
7d6709900da7 eliminate octave:: namespace tags in DEFUN and DEFMETHOD and more
John W. Eaton <jwe@octave.org>
parents: 29958
diff changeset
406 { "imagedir", config::image_dir () },
7d6709900da7 eliminate octave:: namespace tags in DEFUN and DEFMETHOD and more
John W. Eaton <jwe@octave.org>
parents: 29958
diff changeset
407 { "includedir", config::include_dir () },
7d6709900da7 eliminate octave:: namespace tags in DEFUN and DEFMETHOD and more
John W. Eaton <jwe@octave.org>
parents: 29958
diff changeset
408 { "infodir", config::info_dir () },
7d6709900da7 eliminate octave:: namespace tags in DEFUN and DEFMETHOD and more
John W. Eaton <jwe@octave.org>
parents: 29958
diff changeset
409 { "libdir", config::lib_dir () },
7d6709900da7 eliminate octave:: namespace tags in DEFUN and DEFMETHOD and more
John W. Eaton <jwe@octave.org>
parents: 29958
diff changeset
410 { "libexecdir", config::libexec_dir () },
23715
e8e27cd4156c * toplev.cc (F__octave_config_info__): Reorganize initialization.
John W. Eaton <jwe@octave.org>
parents: 23712
diff changeset
411 // 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
412 // 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
413 // 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
414 { "hg_id", liboctinterp_hg_id () },
29961
7d6709900da7 eliminate octave:: namespace tags in DEFUN and DEFMETHOD and more
John W. Eaton <jwe@octave.org>
parents: 29958
diff changeset
415 { "localapiarchlibdir", config::local_api_arch_lib_dir () },
7d6709900da7 eliminate octave:: namespace tags in DEFUN and DEFMETHOD and more
John W. Eaton <jwe@octave.org>
parents: 29958
diff changeset
416 { "localapifcnfiledir", config::local_api_fcn_file_dir () },
7d6709900da7 eliminate octave:: namespace tags in DEFUN and DEFMETHOD and more
John W. Eaton <jwe@octave.org>
parents: 29958
diff changeset
417 { "localapioctfiledir", config::local_api_oct_file_dir () },
7d6709900da7 eliminate octave:: namespace tags in DEFUN and DEFMETHOD and more
John W. Eaton <jwe@octave.org>
parents: 29958
diff changeset
418 { "localarchlibdir", config::local_arch_lib_dir () },
7d6709900da7 eliminate octave:: namespace tags in DEFUN and DEFMETHOD and more
John W. Eaton <jwe@octave.org>
parents: 29958
diff changeset
419 { "localfcnfiledir", config::local_fcn_file_dir () },
7d6709900da7 eliminate octave:: namespace tags in DEFUN and DEFMETHOD and more
John W. Eaton <jwe@octave.org>
parents: 29958
diff changeset
420 { "localoctfiledir", config::local_oct_file_dir () },
7d6709900da7 eliminate octave:: namespace tags in DEFUN and DEFMETHOD and more
John W. Eaton <jwe@octave.org>
parents: 29958
diff changeset
421 { "localstartupfiledir", config::local_startupfile_dir () },
7d6709900da7 eliminate octave:: namespace tags in DEFUN and DEFMETHOD and more
John W. Eaton <jwe@octave.org>
parents: 29958
diff changeset
422 { "localverarchlibdir", config::local_ver_arch_lib_dir () },
7d6709900da7 eliminate octave:: namespace tags in DEFUN and DEFMETHOD and more
John W. Eaton <jwe@octave.org>
parents: 29958
diff changeset
423 { "localverfcnfiledir", config::local_ver_fcn_file_dir () },
7d6709900da7 eliminate octave:: namespace tags in DEFUN and DEFMETHOD and more
John W. Eaton <jwe@octave.org>
parents: 29958
diff changeset
424 { "localveroctfiledir", config::local_ver_oct_file_dir () },
29462
280defaf2023 pkg.m: Install local packages in version dependent path (bug #58299).
Markus Mützel <markus.muetzel@gmx.de>
parents: 29359
diff changeset
425 { "major_version", STRINGIFY (OCTAVE_MAJOR_VERSION) },
29961
7d6709900da7 eliminate octave:: namespace tags in DEFUN and DEFMETHOD and more
John W. Eaton <jwe@octave.org>
parents: 29958
diff changeset
426 { "man1dir", config::man1_dir () },
7d6709900da7 eliminate octave:: namespace tags in DEFUN and DEFMETHOD and more
John W. Eaton <jwe@octave.org>
parents: 29958
diff changeset
427 { "man1ext", config::man1_ext () },
7d6709900da7 eliminate octave:: namespace tags in DEFUN and DEFMETHOD and more
John W. Eaton <jwe@octave.org>
parents: 29958
diff changeset
428 { "mandir", config::man_dir () },
29462
280defaf2023 pkg.m: Install local packages in version dependent path (bug #58299).
Markus Mützel <markus.muetzel@gmx.de>
parents: 29359
diff changeset
429 { "minor_version", STRINGIFY (OCTAVE_MINOR_VERSION) },
29961
7d6709900da7 eliminate octave:: namespace tags in DEFUN and DEFMETHOD and more
John W. Eaton <jwe@octave.org>
parents: 29958
diff changeset
430 { "octdatadir", config::oct_data_dir () },
7d6709900da7 eliminate octave:: namespace tags in DEFUN and DEFMETHOD and more
John W. Eaton <jwe@octave.org>
parents: 29958
diff changeset
431 { "octdocdir", config::oct_doc_dir () },
7d6709900da7 eliminate octave:: namespace tags in DEFUN and DEFMETHOD and more
John W. Eaton <jwe@octave.org>
parents: 29958
diff changeset
432 { "octetcdir", config::oct_etc_dir () },
7d6709900da7 eliminate octave:: namespace tags in DEFUN and DEFMETHOD and more
John W. Eaton <jwe@octave.org>
parents: 29958
diff changeset
433 { "octfiledir", config::oct_file_dir () },
7d6709900da7 eliminate octave:: namespace tags in DEFUN and DEFMETHOD and more
John W. Eaton <jwe@octave.org>
parents: 29958
diff changeset
434 { "octfontsdir", config::oct_fonts_dir () },
7d6709900da7 eliminate octave:: namespace tags in DEFUN and DEFMETHOD and more
John W. Eaton <jwe@octave.org>
parents: 29958
diff changeset
435 { "octincludedir", config::oct_include_dir () },
7d6709900da7 eliminate octave:: namespace tags in DEFUN and DEFMETHOD and more
John W. Eaton <jwe@octave.org>
parents: 29958
diff changeset
436 { "octlibdir", config::oct_lib_dir () },
7d6709900da7 eliminate octave:: namespace tags in DEFUN and DEFMETHOD and more
John W. Eaton <jwe@octave.org>
parents: 29958
diff changeset
437 { "octtestsdir", config::oct_tests_dir () },
29462
280defaf2023 pkg.m: Install local packages in version dependent path (bug #58299).
Markus Mützel <markus.muetzel@gmx.de>
parents: 29359
diff changeset
438 { "patch_version", STRINGIFY (OCTAVE_PATCH_VERSION) },
23715
e8e27cd4156c * toplev.cc (F__octave_config_info__): Reorganize initialization.
John W. Eaton <jwe@octave.org>
parents: 23712
diff changeset
439 { "release_date", OCTAVE_RELEASE_DATE },
29961
7d6709900da7 eliminate octave:: namespace tags in DEFUN and DEFMETHOD and more
John W. Eaton <jwe@octave.org>
parents: 29958
diff changeset
440 { "startupfiledir", config::startupfile_dir () },
23715
e8e27cd4156c * toplev.cc (F__octave_config_info__): Reorganize initialization.
John W. Eaton <jwe@octave.org>
parents: 23712
diff changeset
441 { "version", OCTAVE_VERSION }};
4357
d700cfed902a [project @ 2003-02-22 18:48:18 by jwe]
jwe
parents: 4356
diff changeset
442
23715
e8e27cd4156c * toplev.cc (F__octave_config_info__): Reorganize initialization.
John W. Eaton <jwe@octave.org>
parents: 23712
diff changeset
443 std::map<std::string, octave_value> build_env_map
29961
7d6709900da7 eliminate octave:: namespace tags in DEFUN and DEFMETHOD and more
John W. Eaton <jwe@octave.org>
parents: 29958
diff changeset
444 = {{ "AMD_CPPFLAGS", build_env::AMD_CPPFLAGS },
7d6709900da7 eliminate octave:: namespace tags in DEFUN and DEFMETHOD and more
John W. Eaton <jwe@octave.org>
parents: 29958
diff changeset
445 { "AMD_LDFLAGS", build_env::AMD_LDFLAGS },
7d6709900da7 eliminate octave:: namespace tags in DEFUN and DEFMETHOD and more
John W. Eaton <jwe@octave.org>
parents: 29958
diff changeset
446 { "AMD_LIBS", build_env::AMD_LIBS },
7d6709900da7 eliminate octave:: namespace tags in DEFUN and DEFMETHOD and more
John W. Eaton <jwe@octave.org>
parents: 29958
diff changeset
447 { "AR", build_env::AR },
7d6709900da7 eliminate octave:: namespace tags in DEFUN and DEFMETHOD and more
John W. Eaton <jwe@octave.org>
parents: 29958
diff changeset
448 { "ARFLAGS", build_env::ARFLAGS },
7d6709900da7 eliminate octave:: namespace tags in DEFUN and DEFMETHOD and more
John W. Eaton <jwe@octave.org>
parents: 29958
diff changeset
449 { "ARPACK_CPPFLAGS", build_env::ARPACK_CPPFLAGS },
7d6709900da7 eliminate octave:: namespace tags in DEFUN and DEFMETHOD and more
John W. Eaton <jwe@octave.org>
parents: 29958
diff changeset
450 { "ARPACK_LDFLAGS", build_env::ARPACK_LDFLAGS },
7d6709900da7 eliminate octave:: namespace tags in DEFUN and DEFMETHOD and more
John W. Eaton <jwe@octave.org>
parents: 29958
diff changeset
451 { "ARPACK_LIBS", build_env::ARPACK_LIBS },
7d6709900da7 eliminate octave:: namespace tags in DEFUN and DEFMETHOD and more
John W. Eaton <jwe@octave.org>
parents: 29958
diff changeset
452 { "BLAS_LIBS", build_env::BLAS_LIBS },
7d6709900da7 eliminate octave:: namespace tags in DEFUN and DEFMETHOD and more
John W. Eaton <jwe@octave.org>
parents: 29958
diff changeset
453 { "CAMD_CPPFLAGS", build_env::CAMD_CPPFLAGS },
7d6709900da7 eliminate octave:: namespace tags in DEFUN and DEFMETHOD and more
John W. Eaton <jwe@octave.org>
parents: 29958
diff changeset
454 { "CAMD_LDFLAGS", build_env::CAMD_LDFLAGS },
7d6709900da7 eliminate octave:: namespace tags in DEFUN and DEFMETHOD and more
John W. Eaton <jwe@octave.org>
parents: 29958
diff changeset
455 { "CAMD_LIBS", build_env::CAMD_LIBS },
7d6709900da7 eliminate octave:: namespace tags in DEFUN and DEFMETHOD and more
John W. Eaton <jwe@octave.org>
parents: 29958
diff changeset
456 { "CARBON_LIBS", build_env::CARBON_LIBS },
7d6709900da7 eliminate octave:: namespace tags in DEFUN and DEFMETHOD and more
John W. Eaton <jwe@octave.org>
parents: 29958
diff changeset
457 { "CC", build_env::CC },
7d6709900da7 eliminate octave:: namespace tags in DEFUN and DEFMETHOD and more
John W. Eaton <jwe@octave.org>
parents: 29958
diff changeset
458 { "CCOLAMD_CPPFLAGS", build_env::CCOLAMD_CPPFLAGS },
7d6709900da7 eliminate octave:: namespace tags in DEFUN and DEFMETHOD and more
John W. Eaton <jwe@octave.org>
parents: 29958
diff changeset
459 { "CCOLAMD_LDFLAGS", build_env::CCOLAMD_LDFLAGS },
7d6709900da7 eliminate octave:: namespace tags in DEFUN and DEFMETHOD and more
John W. Eaton <jwe@octave.org>
parents: 29958
diff changeset
460 { "CCOLAMD_LIBS", build_env::CCOLAMD_LIBS },
7d6709900da7 eliminate octave:: namespace tags in DEFUN and DEFMETHOD and more
John W. Eaton <jwe@octave.org>
parents: 29958
diff changeset
461 { "CFLAGS", build_env::CFLAGS },
7d6709900da7 eliminate octave:: namespace tags in DEFUN and DEFMETHOD and more
John W. Eaton <jwe@octave.org>
parents: 29958
diff changeset
462 { "CHOLMOD_CPPFLAGS", build_env::CHOLMOD_CPPFLAGS },
7d6709900da7 eliminate octave:: namespace tags in DEFUN and DEFMETHOD and more
John W. Eaton <jwe@octave.org>
parents: 29958
diff changeset
463 { "CHOLMOD_LDFLAGS", build_env::CHOLMOD_LDFLAGS },
7d6709900da7 eliminate octave:: namespace tags in DEFUN and DEFMETHOD and more
John W. Eaton <jwe@octave.org>
parents: 29958
diff changeset
464 { "CHOLMOD_LIBS", build_env::CHOLMOD_LIBS },
7d6709900da7 eliminate octave:: namespace tags in DEFUN and DEFMETHOD and more
John W. Eaton <jwe@octave.org>
parents: 29958
diff changeset
465 { "COLAMD_CPPFLAGS", build_env::COLAMD_CPPFLAGS },
7d6709900da7 eliminate octave:: namespace tags in DEFUN and DEFMETHOD and more
John W. Eaton <jwe@octave.org>
parents: 29958
diff changeset
466 { "COLAMD_LDFLAGS", build_env::COLAMD_LDFLAGS },
7d6709900da7 eliminate octave:: namespace tags in DEFUN and DEFMETHOD and more
John W. Eaton <jwe@octave.org>
parents: 29958
diff changeset
467 { "COLAMD_LIBS", build_env::COLAMD_LIBS },
7d6709900da7 eliminate octave:: namespace tags in DEFUN and DEFMETHOD and more
John W. Eaton <jwe@octave.org>
parents: 29958
diff changeset
468 { "CPICFLAG", build_env::CPICFLAG },
7d6709900da7 eliminate octave:: namespace tags in DEFUN and DEFMETHOD and more
John W. Eaton <jwe@octave.org>
parents: 29958
diff changeset
469 { "CPPFLAGS", build_env::CPPFLAGS },
7d6709900da7 eliminate octave:: namespace tags in DEFUN and DEFMETHOD and more
John W. Eaton <jwe@octave.org>
parents: 29958
diff changeset
470 { "CURL_CPPFLAGS", build_env::CURL_CPPFLAGS },
7d6709900da7 eliminate octave:: namespace tags in DEFUN and DEFMETHOD and more
John W. Eaton <jwe@octave.org>
parents: 29958
diff changeset
471 { "CURL_LDFLAGS", build_env::CURL_LDFLAGS },
7d6709900da7 eliminate octave:: namespace tags in DEFUN and DEFMETHOD and more
John W. Eaton <jwe@octave.org>
parents: 29958
diff changeset
472 { "CURL_LIBS", build_env::CURL_LIBS },
7d6709900da7 eliminate octave:: namespace tags in DEFUN and DEFMETHOD and more
John W. Eaton <jwe@octave.org>
parents: 29958
diff changeset
473 { "CXSPARSE_CPPFLAGS", build_env::CXSPARSE_CPPFLAGS },
7d6709900da7 eliminate octave:: namespace tags in DEFUN and DEFMETHOD and more
John W. Eaton <jwe@octave.org>
parents: 29958
diff changeset
474 { "CXSPARSE_LDFLAGS", build_env::CXSPARSE_LDFLAGS },
7d6709900da7 eliminate octave:: namespace tags in DEFUN and DEFMETHOD and more
John W. Eaton <jwe@octave.org>
parents: 29958
diff changeset
475 { "CXSPARSE_LIBS", build_env::CXSPARSE_LIBS },
7d6709900da7 eliminate octave:: namespace tags in DEFUN and DEFMETHOD and more
John W. Eaton <jwe@octave.org>
parents: 29958
diff changeset
476 { "CXX", build_env::CXX },
7d6709900da7 eliminate octave:: namespace tags in DEFUN and DEFMETHOD and more
John W. Eaton <jwe@octave.org>
parents: 29958
diff changeset
477 { "CXXCPP", build_env::CXXCPP },
7d6709900da7 eliminate octave:: namespace tags in DEFUN and DEFMETHOD and more
John W. Eaton <jwe@octave.org>
parents: 29958
diff changeset
478 { "CXXFLAGS", build_env::CXXFLAGS },
7d6709900da7 eliminate octave:: namespace tags in DEFUN and DEFMETHOD and more
John W. Eaton <jwe@octave.org>
parents: 29958
diff changeset
479 { "CXXPICFLAG", build_env::CXXPICFLAG },
7d6709900da7 eliminate octave:: namespace tags in DEFUN and DEFMETHOD and more
John W. Eaton <jwe@octave.org>
parents: 29958
diff changeset
480 { "DEFS", build_env::DEFS },
7d6709900da7 eliminate octave:: namespace tags in DEFUN and DEFMETHOD and more
John W. Eaton <jwe@octave.org>
parents: 29958
diff changeset
481 { "DL_LDFLAGS", build_env::DL_LDFLAGS },
7d6709900da7 eliminate octave:: namespace tags in DEFUN and DEFMETHOD and more
John W. Eaton <jwe@octave.org>
parents: 29958
diff changeset
482 { "GCC_VERSION", build_env::GCC_VERSION },
7d6709900da7 eliminate octave:: namespace tags in DEFUN and DEFMETHOD and more
John W. Eaton <jwe@octave.org>
parents: 29958
diff changeset
483 { "GXX_VERSION", build_env::GXX_VERSION },
7d6709900da7 eliminate octave:: namespace tags in DEFUN and DEFMETHOD and more
John W. Eaton <jwe@octave.org>
parents: 29958
diff changeset
484 { "EXEEXT", build_env::EXEEXT },
7d6709900da7 eliminate octave:: namespace tags in DEFUN and DEFMETHOD and more
John W. Eaton <jwe@octave.org>
parents: 29958
diff changeset
485 { "F77", build_env::F77 },
7d6709900da7 eliminate octave:: namespace tags in DEFUN and DEFMETHOD and more
John W. Eaton <jwe@octave.org>
parents: 29958
diff changeset
486 { "F77_FLOAT_STORE_FLAG", build_env::F77_FLOAT_STORE_FLAG },
7d6709900da7 eliminate octave:: namespace tags in DEFUN and DEFMETHOD and more
John W. Eaton <jwe@octave.org>
parents: 29958
diff changeset
487 { "F77_INTEGER_8_FLAG", build_env::F77_INTEGER_8_FLAG },
7d6709900da7 eliminate octave:: namespace tags in DEFUN and DEFMETHOD and more
John W. Eaton <jwe@octave.org>
parents: 29958
diff changeset
488 { "FFLAGS", build_env::FFLAGS },
7d6709900da7 eliminate octave:: namespace tags in DEFUN and DEFMETHOD and more
John W. Eaton <jwe@octave.org>
parents: 29958
diff changeset
489 { "FFTW3_CPPFLAGS", build_env::FFTW3_CPPFLAGS },
7d6709900da7 eliminate octave:: namespace tags in DEFUN and DEFMETHOD and more
John W. Eaton <jwe@octave.org>
parents: 29958
diff changeset
490 { "FFTW3_LDFLAGS", build_env::FFTW3_LDFLAGS },
7d6709900da7 eliminate octave:: namespace tags in DEFUN and DEFMETHOD and more
John W. Eaton <jwe@octave.org>
parents: 29958
diff changeset
491 { "FFTW3_LIBS", build_env::FFTW3_LIBS },
7d6709900da7 eliminate octave:: namespace tags in DEFUN and DEFMETHOD and more
John W. Eaton <jwe@octave.org>
parents: 29958
diff changeset
492 { "FFTW3F_CPPFLAGS", build_env::FFTW3F_CPPFLAGS },
7d6709900da7 eliminate octave:: namespace tags in DEFUN and DEFMETHOD and more
John W. Eaton <jwe@octave.org>
parents: 29958
diff changeset
493 { "FFTW3F_LDFLAGS", build_env::FFTW3F_LDFLAGS },
7d6709900da7 eliminate octave:: namespace tags in DEFUN and DEFMETHOD and more
John W. Eaton <jwe@octave.org>
parents: 29958
diff changeset
494 { "FFTW3F_LIBS", build_env::FFTW3F_LIBS },
7d6709900da7 eliminate octave:: namespace tags in DEFUN and DEFMETHOD and more
John W. Eaton <jwe@octave.org>
parents: 29958
diff changeset
495 { "FLIBS", build_env::FLIBS },
7d6709900da7 eliminate octave:: namespace tags in DEFUN and DEFMETHOD and more
John W. Eaton <jwe@octave.org>
parents: 29958
diff changeset
496 { "FLTK_CPPFLAGS", build_env::FLTK_CPPFLAGS },
7d6709900da7 eliminate octave:: namespace tags in DEFUN and DEFMETHOD and more
John W. Eaton <jwe@octave.org>
parents: 29958
diff changeset
497 { "FLTK_LDFLAGS", build_env::FLTK_LDFLAGS },
7d6709900da7 eliminate octave:: namespace tags in DEFUN and DEFMETHOD and more
John W. Eaton <jwe@octave.org>
parents: 29958
diff changeset
498 { "FLTK_LIBS", build_env::FLTK_LIBS },
7d6709900da7 eliminate octave:: namespace tags in DEFUN and DEFMETHOD and more
John W. Eaton <jwe@octave.org>
parents: 29958
diff changeset
499 { "FONTCONFIG_CPPFLAGS", build_env::FONTCONFIG_CPPFLAGS },
7d6709900da7 eliminate octave:: namespace tags in DEFUN and DEFMETHOD and more
John W. Eaton <jwe@octave.org>
parents: 29958
diff changeset
500 { "FONTCONFIG_LIBS", build_env::FONTCONFIG_LIBS },
7d6709900da7 eliminate octave:: namespace tags in DEFUN and DEFMETHOD and more
John W. Eaton <jwe@octave.org>
parents: 29958
diff changeset
501 { "FPICFLAG", build_env::FPICFLAG },
7d6709900da7 eliminate octave:: namespace tags in DEFUN and DEFMETHOD and more
John W. Eaton <jwe@octave.org>
parents: 29958
diff changeset
502 { "FT2_CPPFLAGS", build_env::FT2_CPPFLAGS },
7d6709900da7 eliminate octave:: namespace tags in DEFUN and DEFMETHOD and more
John W. Eaton <jwe@octave.org>
parents: 29958
diff changeset
503 { "FT2_LIBS", build_env::FT2_LIBS },
7d6709900da7 eliminate octave:: namespace tags in DEFUN and DEFMETHOD and more
John W. Eaton <jwe@octave.org>
parents: 29958
diff changeset
504 { "GLPK_CPPFLAGS", build_env::GLPK_CPPFLAGS },
7d6709900da7 eliminate octave:: namespace tags in DEFUN and DEFMETHOD and more
John W. Eaton <jwe@octave.org>
parents: 29958
diff changeset
505 { "GLPK_LDFLAGS", build_env::GLPK_LDFLAGS },
7d6709900da7 eliminate octave:: namespace tags in DEFUN and DEFMETHOD and more
John W. Eaton <jwe@octave.org>
parents: 29958
diff changeset
506 { "GLPK_LIBS", build_env::GLPK_LIBS },
7d6709900da7 eliminate octave:: namespace tags in DEFUN and DEFMETHOD and more
John W. Eaton <jwe@octave.org>
parents: 29958
diff changeset
507 { "GNUPLOT", build_env::GNUPLOT },
7d6709900da7 eliminate octave:: namespace tags in DEFUN and DEFMETHOD and more
John W. Eaton <jwe@octave.org>
parents: 29958
diff changeset
508 { "HDF5_CPPFLAGS", build_env::HDF5_CPPFLAGS },
7d6709900da7 eliminate octave:: namespace tags in DEFUN and DEFMETHOD and more
John W. Eaton <jwe@octave.org>
parents: 29958
diff changeset
509 { "HDF5_LDFLAGS", build_env::HDF5_LDFLAGS },
7d6709900da7 eliminate octave:: namespace tags in DEFUN and DEFMETHOD and more
John W. Eaton <jwe@octave.org>
parents: 29958
diff changeset
510 { "HDF5_LIBS", build_env::HDF5_LIBS },
7d6709900da7 eliminate octave:: namespace tags in DEFUN and DEFMETHOD and more
John W. Eaton <jwe@octave.org>
parents: 29958
diff changeset
511 { "LAPACK_LIBS", build_env::LAPACK_LIBS },
7d6709900da7 eliminate octave:: namespace tags in DEFUN and DEFMETHOD and more
John W. Eaton <jwe@octave.org>
parents: 29958
diff changeset
512 { "LDFLAGS", build_env::LDFLAGS },
7d6709900da7 eliminate octave:: namespace tags in DEFUN and DEFMETHOD and more
John W. Eaton <jwe@octave.org>
parents: 29958
diff changeset
513 { "LD_STATIC_FLAG", build_env::LD_STATIC_FLAG },
7d6709900da7 eliminate octave:: namespace tags in DEFUN and DEFMETHOD and more
John W. Eaton <jwe@octave.org>
parents: 29958
diff changeset
514 { "LEX", build_env::LEX },
7d6709900da7 eliminate octave:: namespace tags in DEFUN and DEFMETHOD and more
John W. Eaton <jwe@octave.org>
parents: 29958
diff changeset
515 { "LEXLIB", build_env::LEXLIB },
7d6709900da7 eliminate octave:: namespace tags in DEFUN and DEFMETHOD and more
John W. Eaton <jwe@octave.org>
parents: 29958
diff changeset
516 { "LFLAGS", build_env::LFLAGS },
7d6709900da7 eliminate octave:: namespace tags in DEFUN and DEFMETHOD and more
John W. Eaton <jwe@octave.org>
parents: 29958
diff changeset
517 { "LIBOCTAVE", build_env::LIBOCTAVE },
7d6709900da7 eliminate octave:: namespace tags in DEFUN and DEFMETHOD and more
John W. Eaton <jwe@octave.org>
parents: 29958
diff changeset
518 { "LIBOCTINTERP", build_env::LIBOCTINTERP },
7d6709900da7 eliminate octave:: namespace tags in DEFUN and DEFMETHOD and more
John W. Eaton <jwe@octave.org>
parents: 29958
diff changeset
519 { "LIBS", build_env::LIBS },
7d6709900da7 eliminate octave:: namespace tags in DEFUN and DEFMETHOD and more
John W. Eaton <jwe@octave.org>
parents: 29958
diff changeset
520 { "LN_S", build_env::LN_S },
7d6709900da7 eliminate octave:: namespace tags in DEFUN and DEFMETHOD and more
John W. Eaton <jwe@octave.org>
parents: 29958
diff changeset
521 { "MAGICK_CPPFLAGS", build_env::MAGICK_CPPFLAGS },
7d6709900da7 eliminate octave:: namespace tags in DEFUN and DEFMETHOD and more
John W. Eaton <jwe@octave.org>
parents: 29958
diff changeset
522 { "MAGICK_LDFLAGS", build_env::MAGICK_LDFLAGS },
7d6709900da7 eliminate octave:: namespace tags in DEFUN and DEFMETHOD and more
John W. Eaton <jwe@octave.org>
parents: 29958
diff changeset
523 { "MAGICK_LIBS", build_env::MAGICK_LIBS },
7d6709900da7 eliminate octave:: namespace tags in DEFUN and DEFMETHOD and more
John W. Eaton <jwe@octave.org>
parents: 29958
diff changeset
524 { "MKOCTFILE_DL_LDFLAGS", build_env::MKOCTFILE_DL_LDFLAGS },
7d6709900da7 eliminate octave:: namespace tags in DEFUN and DEFMETHOD and more
John W. Eaton <jwe@octave.org>
parents: 29958
diff changeset
525 { "OCTAVE_LINK_DEPS", build_env::OCTAVE_LINK_DEPS },
7d6709900da7 eliminate octave:: namespace tags in DEFUN and DEFMETHOD and more
John W. Eaton <jwe@octave.org>
parents: 29958
diff changeset
526 { "OCTAVE_LINK_OPTS", build_env::OCTAVE_LINK_OPTS },
7d6709900da7 eliminate octave:: namespace tags in DEFUN and DEFMETHOD and more
John W. Eaton <jwe@octave.org>
parents: 29958
diff changeset
527 { "OCT_LINK_DEPS", build_env::OCT_LINK_DEPS },
7d6709900da7 eliminate octave:: namespace tags in DEFUN and DEFMETHOD and more
John W. Eaton <jwe@octave.org>
parents: 29958
diff changeset
528 { "OCT_LINK_OPTS", build_env::OCT_LINK_OPTS },
7d6709900da7 eliminate octave:: namespace tags in DEFUN and DEFMETHOD and more
John W. Eaton <jwe@octave.org>
parents: 29958
diff changeset
529 { "OPENGL_LIBS", build_env::OPENGL_LIBS },
7d6709900da7 eliminate octave:: namespace tags in DEFUN and DEFMETHOD and more
John W. Eaton <jwe@octave.org>
parents: 29958
diff changeset
530 { "PCRE_CPPFLAGS", build_env::PCRE_CPPFLAGS },
7d6709900da7 eliminate octave:: namespace tags in DEFUN and DEFMETHOD and more
John W. Eaton <jwe@octave.org>
parents: 29958
diff changeset
531 { "PCRE_LDFLAGS", build_env::PCRE_LDFLAGS },
7d6709900da7 eliminate octave:: namespace tags in DEFUN and DEFMETHOD and more
John W. Eaton <jwe@octave.org>
parents: 29958
diff changeset
532 { "PCRE_LIBS", build_env::PCRE_LIBS },
7d6709900da7 eliminate octave:: namespace tags in DEFUN and DEFMETHOD and more
John W. Eaton <jwe@octave.org>
parents: 29958
diff changeset
533 { "PTHREAD_CFLAGS", build_env::PTHREAD_CFLAGS },
7d6709900da7 eliminate octave:: namespace tags in DEFUN and DEFMETHOD and more
John W. Eaton <jwe@octave.org>
parents: 29958
diff changeset
534 { "PTHREAD_LIBS", build_env::PTHREAD_LIBS },
7d6709900da7 eliminate octave:: namespace tags in DEFUN and DEFMETHOD and more
John W. Eaton <jwe@octave.org>
parents: 29958
diff changeset
535 { "QHULL_CPPFLAGS", build_env::QHULL_CPPFLAGS },
7d6709900da7 eliminate octave:: namespace tags in DEFUN and DEFMETHOD and more
John W. Eaton <jwe@octave.org>
parents: 29958
diff changeset
536 { "QHULL_LDFLAGS", build_env::QHULL_LDFLAGS },
7d6709900da7 eliminate octave:: namespace tags in DEFUN and DEFMETHOD and more
John W. Eaton <jwe@octave.org>
parents: 29958
diff changeset
537 { "QHULL_LIBS", build_env::QHULL_LIBS },
7d6709900da7 eliminate octave:: namespace tags in DEFUN and DEFMETHOD and more
John W. Eaton <jwe@octave.org>
parents: 29958
diff changeset
538 { "QRUPDATE_CPPFLAGS", build_env::QRUPDATE_CPPFLAGS },
7d6709900da7 eliminate octave:: namespace tags in DEFUN and DEFMETHOD and more
John W. Eaton <jwe@octave.org>
parents: 29958
diff changeset
539 { "QRUPDATE_LDFLAGS", build_env::QRUPDATE_LDFLAGS },
7d6709900da7 eliminate octave:: namespace tags in DEFUN and DEFMETHOD and more
John W. Eaton <jwe@octave.org>
parents: 29958
diff changeset
540 { "QRUPDATE_LIBS", build_env::QRUPDATE_LIBS },
7d6709900da7 eliminate octave:: namespace tags in DEFUN and DEFMETHOD and more
John W. Eaton <jwe@octave.org>
parents: 29958
diff changeset
541 { "QT_CPPFLAGS", build_env::QT_CPPFLAGS },
7d6709900da7 eliminate octave:: namespace tags in DEFUN and DEFMETHOD and more
John W. Eaton <jwe@octave.org>
parents: 29958
diff changeset
542 { "QT_LDFLAGS", build_env::QT_LDFLAGS },
7d6709900da7 eliminate octave:: namespace tags in DEFUN and DEFMETHOD and more
John W. Eaton <jwe@octave.org>
parents: 29958
diff changeset
543 { "QT_LIBS", build_env::QT_LIBS },
7d6709900da7 eliminate octave:: namespace tags in DEFUN and DEFMETHOD and more
John W. Eaton <jwe@octave.org>
parents: 29958
diff changeset
544 { "QT_OPENGL_LIBS", build_env::QT_OPENGL_LIBS },
7d6709900da7 eliminate octave:: namespace tags in DEFUN and DEFMETHOD and more
John W. Eaton <jwe@octave.org>
parents: 29958
diff changeset
545 { "RANLIB", build_env::RANLIB },
7d6709900da7 eliminate octave:: namespace tags in DEFUN and DEFMETHOD and more
John W. Eaton <jwe@octave.org>
parents: 29958
diff changeset
546 { "RDYNAMIC_FLAG", build_env::RDYNAMIC_FLAG },
7d6709900da7 eliminate octave:: namespace tags in DEFUN and DEFMETHOD and more
John W. Eaton <jwe@octave.org>
parents: 29958
diff changeset
547 { "READLINE_LIBS", build_env::READLINE_LIBS },
7d6709900da7 eliminate octave:: namespace tags in DEFUN and DEFMETHOD and more
John W. Eaton <jwe@octave.org>
parents: 29958
diff changeset
548 { "SHARED_LIBS", build_env::SHARED_LIBS },
7d6709900da7 eliminate octave:: namespace tags in DEFUN and DEFMETHOD and more
John W. Eaton <jwe@octave.org>
parents: 29958
diff changeset
549 { "SH_LDFLAGS", build_env::SH_LDFLAGS },
7d6709900da7 eliminate octave:: namespace tags in DEFUN and DEFMETHOD and more
John W. Eaton <jwe@octave.org>
parents: 29958
diff changeset
550 { "STATIC_LIBS", build_env::STATIC_LIBS },
7d6709900da7 eliminate octave:: namespace tags in DEFUN and DEFMETHOD and more
John W. Eaton <jwe@octave.org>
parents: 29958
diff changeset
551 { "SUITESPARSECONFIG_LIBS", build_env::SUITESPARSECONFIG_LIBS },
7d6709900da7 eliminate octave:: namespace tags in DEFUN and DEFMETHOD and more
John W. Eaton <jwe@octave.org>
parents: 29958
diff changeset
552 { "TERM_LIBS", build_env::TERM_LIBS },
7d6709900da7 eliminate octave:: namespace tags in DEFUN and DEFMETHOD and more
John W. Eaton <jwe@octave.org>
parents: 29958
diff changeset
553 { "UMFPACK_CPPFLAGS", build_env::UMFPACK_CPPFLAGS },
7d6709900da7 eliminate octave:: namespace tags in DEFUN and DEFMETHOD and more
John W. Eaton <jwe@octave.org>
parents: 29958
diff changeset
554 { "UMFPACK_LDFLAGS", build_env::UMFPACK_LDFLAGS },
7d6709900da7 eliminate octave:: namespace tags in DEFUN and DEFMETHOD and more
John W. Eaton <jwe@octave.org>
parents: 29958
diff changeset
555 { "UMFPACK_LIBS", build_env::UMFPACK_LIBS },
7d6709900da7 eliminate octave:: namespace tags in DEFUN and DEFMETHOD and more
John W. Eaton <jwe@octave.org>
parents: 29958
diff changeset
556 { "WARN_CFLAGS", build_env::WARN_CFLAGS },
7d6709900da7 eliminate octave:: namespace tags in DEFUN and DEFMETHOD and more
John W. Eaton <jwe@octave.org>
parents: 29958
diff changeset
557 { "WARN_CXXFLAGS", build_env::WARN_CXXFLAGS },
7d6709900da7 eliminate octave:: namespace tags in DEFUN and DEFMETHOD and more
John W. Eaton <jwe@octave.org>
parents: 29958
diff changeset
558 { "X11_INCFLAGS", build_env::X11_INCFLAGS },
7d6709900da7 eliminate octave:: namespace tags in DEFUN and DEFMETHOD and more
John W. Eaton <jwe@octave.org>
parents: 29958
diff changeset
559 { "X11_LIBS", build_env::X11_LIBS },
7d6709900da7 eliminate octave:: namespace tags in DEFUN and DEFMETHOD and more
John W. Eaton <jwe@octave.org>
parents: 29958
diff changeset
560 { "XTRA_CFLAGS", build_env::XTRA_CFLAGS },
7d6709900da7 eliminate octave:: namespace tags in DEFUN and DEFMETHOD and more
John W. Eaton <jwe@octave.org>
parents: 29958
diff changeset
561 { "XTRA_CXXFLAGS", build_env::XTRA_CXXFLAGS },
7d6709900da7 eliminate octave:: namespace tags in DEFUN and DEFMETHOD and more
John W. Eaton <jwe@octave.org>
parents: 29958
diff changeset
562 { "YACC", build_env::YACC },
7d6709900da7 eliminate octave:: namespace tags in DEFUN and DEFMETHOD and more
John W. Eaton <jwe@octave.org>
parents: 29958
diff changeset
563 { "YFLAGS", build_env::YFLAGS },
7d6709900da7 eliminate octave:: namespace tags in DEFUN and DEFMETHOD and more
John W. Eaton <jwe@octave.org>
parents: 29958
diff changeset
564 { "Z_CPPFLAGS", build_env::Z_CPPFLAGS },
7d6709900da7 eliminate octave:: namespace tags in DEFUN and DEFMETHOD and more
John W. Eaton <jwe@octave.org>
parents: 29958
diff changeset
565 { "Z_LDFLAGS", build_env::Z_LDFLAGS },
7d6709900da7 eliminate octave:: namespace tags in DEFUN and DEFMETHOD and more
John W. Eaton <jwe@octave.org>
parents: 29958
diff changeset
566 { "Z_LIBS", build_env::Z_LIBS },
7d6709900da7 eliminate octave:: namespace tags in DEFUN and DEFMETHOD and more
John W. Eaton <jwe@octave.org>
parents: 29958
diff changeset
567 { "config_opts", build_env::config_opts }};
21226
a55b8ece1ecd reorganize octave_config_info again
John W. Eaton <jwe@octave.org>
parents: 21220
diff changeset
568
23715
e8e27cd4156c * toplev.cc (F__octave_config_info__): Reorganize initialization.
John W. Eaton <jwe@octave.org>
parents: 23712
diff changeset
569 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
570 build_env = octave_scalar_map (build_env_map);
29961
7d6709900da7 eliminate octave:: namespace tags in DEFUN and DEFMETHOD and more
John W. Eaton <jwe@octave.org>
parents: 29958
diff changeset
571 build_features = build_env::features ();
21226
a55b8ece1ecd reorganize octave_config_info again
John W. Eaton <jwe@octave.org>
parents: 21220
diff changeset
572
4691
bdc51b369a78 [project @ 2004-01-10 18:16:02 by jwe]
jwe
parents: 4675
diff changeset
573 bool unix_system = true;
7013
f943e9635115 [project @ 2007-10-11 19:39:02 by jwe]
jwe
parents: 7010
diff changeset
574 bool mac_system = false;
4691
bdc51b369a78 [project @ 2004-01-10 18:16:02 by jwe]
jwe
parents: 4675
diff changeset
575 bool windows_system = false;
bdc51b369a78 [project @ 2004-01-10 18:16:02 by jwe]
jwe
parents: 4675
diff changeset
576
21979
d04da18a407a use OCTAVE_USE_WINDOWS_API more consistently
John W. Eaton <jwe@octave.org>
parents: 21966
diff changeset
577 #if defined (__WIN32__)
4691
bdc51b369a78 [project @ 2004-01-10 18:16:02 by jwe]
jwe
parents: 4675
diff changeset
578 windows_system = true;
20791
f7084eae3318 maint: Use Octave coding conventions for #if statements.
Rik <rik@octave.org>
parents: 20785
diff changeset
579 #if ! defined (__CYGWIN__)
4691
bdc51b369a78 [project @ 2004-01-10 18:16:02 by jwe]
jwe
parents: 4675
diff changeset
580 unix_system = false;
bdc51b369a78 [project @ 2004-01-10 18:16:02 by jwe]
jwe
parents: 4675
diff changeset
581 #endif
bdc51b369a78 [project @ 2004-01-10 18:16:02 by jwe]
jwe
parents: 4675
diff changeset
582 #endif
bdc51b369a78 [project @ 2004-01-10 18:16:02 by jwe]
jwe
parents: 4675
diff changeset
583
8574
83b8c739d626 toplev.cc: check OCTAVE_USE_OS_X_API instead of __APPLE__ && __MACH__
John W. Eaton <jwe@octave.org>
parents: 8377
diff changeset
584 #if defined (OCTAVE_USE_OS_X_API)
7010
f7d2f54008f5 [project @ 2007-10-11 17:50:34 by jwe]
jwe
parents: 7001
diff changeset
585 mac_system = true;
f7d2f54008f5 [project @ 2007-10-11 17:50:34 by jwe]
jwe
parents: 7001
diff changeset
586 #endif
f7d2f54008f5 [project @ 2007-10-11 17:50:34 by jwe]
jwe
parents: 7001
diff changeset
587
21226
a55b8ece1ecd reorganize octave_config_info again
John W. Eaton <jwe@octave.org>
parents: 21220
diff changeset
588 config.assign ("unix", octave_value (unix_system));
a55b8ece1ecd reorganize octave_config_info again
John W. Eaton <jwe@octave.org>
parents: 21220
diff changeset
589 config.assign ("mac", octave_value (mac_system));
a55b8ece1ecd reorganize octave_config_info again
John W. Eaton <jwe@octave.org>
parents: 21220
diff changeset
590 config.assign ("windows", octave_value (windows_system));
a55b8ece1ecd reorganize octave_config_info again
John W. Eaton <jwe@octave.org>
parents: 21220
diff changeset
591
29961
7d6709900da7 eliminate octave:: namespace tags in DEFUN and DEFMETHOD and more
John W. Eaton <jwe@octave.org>
parents: 29958
diff changeset
592 mach_info::float_format ff = mach_info::native_float_format ();
21226
a55b8ece1ecd reorganize octave_config_info again
John W. Eaton <jwe@octave.org>
parents: 21220
diff changeset
593 config.assign ("float_format",
29961
7d6709900da7 eliminate octave:: namespace tags in DEFUN and DEFMETHOD and more
John W. Eaton <jwe@octave.org>
parents: 29958
diff changeset
594 octave_value (mach_info::float_format_as_string (ff)));
21226
a55b8ece1ecd reorganize octave_config_info again
John W. Eaton <jwe@octave.org>
parents: 21220
diff changeset
595
a55b8ece1ecd reorganize octave_config_info again
John W. Eaton <jwe@octave.org>
parents: 21220
diff changeset
596 config.assign ("words_big_endian",
29961
7d6709900da7 eliminate octave:: namespace tags in DEFUN and DEFMETHOD and more
John W. Eaton <jwe@octave.org>
parents: 29958
diff changeset
597 octave_value (mach_info::words_big_endian ()));
21226
a55b8ece1ecd reorganize octave_config_info again
John W. Eaton <jwe@octave.org>
parents: 21220
diff changeset
598
a55b8ece1ecd reorganize octave_config_info again
John W. Eaton <jwe@octave.org>
parents: 21220
diff changeset
599 config.assign ("words_little_endian",
29961
7d6709900da7 eliminate octave:: namespace tags in DEFUN and DEFMETHOD and more
John W. Eaton <jwe@octave.org>
parents: 29958
diff changeset
600 octave_value (mach_info::words_little_endian ()));
21226
a55b8ece1ecd reorganize octave_config_info again
John W. Eaton <jwe@octave.org>
parents: 21220
diff changeset
601
a55b8ece1ecd reorganize octave_config_info again
John W. Eaton <jwe@octave.org>
parents: 21220
diff changeset
602 config.assign ("build_environment", octave_value (build_env));
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_features", octave_value (build_features));
4691
bdc51b369a78 [project @ 2004-01-10 18:16:02 by jwe]
jwe
parents: 4675
diff changeset
605
4357
d700cfed902a [project @ 2003-02-22 18:48:18 by jwe]
jwe
parents: 4356
diff changeset
606 initialized = true;
d700cfed902a [project @ 2003-02-22 18:48:18 by jwe]
jwe
parents: 4356
diff changeset
607 }
2162
a940dcdfe9de [project @ 1996-05-13 10:31:51 by jwe]
jwe
parents: 2145
diff changeset
608
2689
8c7955a8d49f [project @ 1997-02-18 09:06:10 by jwe]
jwe
parents: 2675
diff changeset
609 int nargin = args.length ();
8c7955a8d49f [project @ 1997-02-18 09:06:10 by jwe]
jwe
parents: 2675
diff changeset
610
20799
c349d4c91ce2 eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20791
diff changeset
611 if (nargin > 1)
c349d4c91ce2 eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20791
diff changeset
612 print_usage ();
c349d4c91ce2 eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20791
diff changeset
613
20939
b17fda023ca6 maint: Use new C++ archetype in more files.
Rik <rik@octave.org>
parents: 20923
diff changeset
614 octave_value_list retval;
b17fda023ca6 maint: Use new C++ archetype in more files.
Rik <rik@octave.org>
parents: 20923
diff changeset
615
2689
8c7955a8d49f [project @ 1997-02-18 09:06:10 by jwe]
jwe
parents: 2675
diff changeset
616 if (nargin == 1)
8c7955a8d49f [project @ 1997-02-18 09:06:10 by jwe]
jwe
parents: 2675
diff changeset
617 {
21434
1da428cbf401 deprecate octave_config_info
John W. Eaton <jwe@octave.org>
parents: 21421
diff changeset
618 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
619
a55b8ece1ecd reorganize octave_config_info again
John W. Eaton <jwe@octave.org>
parents: 21220
diff changeset
620 octave_value info = find_config_info (config, arg);
2689
8c7955a8d49f [project @ 1997-02-18 09:06:10 by jwe]
jwe
parents: 2675
diff changeset
621
21226
a55b8ece1ecd reorganize octave_config_info again
John W. Eaton <jwe@octave.org>
parents: 21220
diff changeset
622 if (info.is_undefined ())
a55b8ece1ecd reorganize octave_config_info again
John W. Eaton <jwe@octave.org>
parents: 21220
diff changeset
623 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
624
21226
a55b8ece1ecd reorganize octave_config_info again
John W. Eaton <jwe@octave.org>
parents: 21220
diff changeset
625 if (info.is_undefined ())
a55b8ece1ecd reorganize octave_config_info again
John W. Eaton <jwe@octave.org>
parents: 21220
diff changeset
626 info = find_config_info (build_features, arg);
5199
16a6247730d9 [project @ 2005-03-10 20:24:45 by jwe]
jwe
parents: 5189
diff changeset
627
21226
a55b8ece1ecd reorganize octave_config_info again
John W. Eaton <jwe@octave.org>
parents: 21220
diff changeset
628 if (info.is_undefined ())
21434
1da428cbf401 deprecate octave_config_info
John W. Eaton <jwe@octave.org>
parents: 21421
diff changeset
629 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
630
21226
a55b8ece1ecd reorganize octave_config_info again
John W. Eaton <jwe@octave.org>
parents: 21220
diff changeset
631 return info;
2689
8c7955a8d49f [project @ 1997-02-18 09:06:10 by jwe]
jwe
parents: 2675
diff changeset
632 }
20799
c349d4c91ce2 eliminate return statements after calls to print_usage
John W. Eaton <jwe@octave.org>
parents: 20791
diff changeset
633 else
21226
a55b8ece1ecd reorganize octave_config_info again
John W. Eaton <jwe@octave.org>
parents: 21220
diff changeset
634 retval = ovl (config);
2689
8c7955a8d49f [project @ 1997-02-18 09:06:10 by jwe]
jwe
parents: 2675
diff changeset
635
8c7955a8d49f [project @ 1997-02-18 09:06:10 by jwe]
jwe
parents: 2675
diff changeset
636 return retval;
2162
a940dcdfe9de [project @ 1996-05-13 10:31:51 by jwe]
jwe
parents: 2145
diff changeset
637 }
a940dcdfe9de [project @ 1996-05-13 10:31:51 by jwe]
jwe
parents: 2145
diff changeset
638
12846
9ce9e1e2d2c8 codesprint: new tests for toplev.cc
John W. Eaton <jwe@octave.org>
parents: 12483
diff changeset
639 /*
21434
1da428cbf401 deprecate octave_config_info
John W. Eaton <jwe@octave.org>
parents: 21421
diff changeset
640 %!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
641 %!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
642 %!test
21434
1da428cbf401 deprecate octave_config_info
John W. Eaton <jwe@octave.org>
parents: 21421
diff changeset
643 %! x = __octave_config_info__ ();
12846
9ce9e1e2d2c8 codesprint: new tests for toplev.cc
John W. Eaton <jwe@octave.org>
parents: 12483
diff changeset
644 %! assert (isstruct (x));
9ce9e1e2d2c8 codesprint: new tests for toplev.cc
John W. Eaton <jwe@octave.org>
parents: 12483
diff changeset
645 %! assert (! isempty (x));
22751
e078f5607762 Fix failing BIST test in toplev.cc (bug #49575).
Rik <rik@octave.org>
parents: 22501
diff changeset
646 %! assert (x.version, OCTAVE_VERSION ());
21603
37cbdf7bffa9 Add fftwf_version (bug #45659)
mmuetzel <markus.muetzel@gmx.de>
parents: 21600
diff changeset
647
21434
1da428cbf401 deprecate octave_config_info
John W. Eaton <jwe@octave.org>
parents: 21421
diff changeset
648 %!error __octave_config_info__ (1, 2)
12846
9ce9e1e2d2c8 codesprint: new tests for toplev.cc
John W. Eaton <jwe@octave.org>
parents: 12483
diff changeset
649 */
9ce9e1e2d2c8 codesprint: new tests for toplev.cc
John W. Eaton <jwe@octave.org>
parents: 12483
diff changeset
650
29958
32c3a5805893 move DEFUN and DEFMETHOD functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 29949
diff changeset
651 OCTAVE_NAMESPACE_END
32c3a5805893 move DEFUN and DEFMETHOD functions inside octave namespace
John W. Eaton <jwe@octave.org>
parents: 29949
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