Mercurial > octave
annotate src/octave-config.in.cc @ 30192:8c8031be8072
Windows: Don't get pointers to C strings while vector is still unstable.
* src/main-cli.cc, src/main-gui.cc, src/main.in.cc, src/octave-config.in.cc,
src/octave-svgconvert.cc: The memory used by a vector is not guaranteed to be
stable when elements are added with push_back. Wait until vector is complete
before getting the pointers to the corresponding C strings.
author | Markus Mützel <markus.muetzel@gmx.de> |
---|---|
date | Thu, 16 Sep 2021 21:51:03 +0200 |
parents | b6f80b1d448f |
children | d4d83344d653 |
rev | line source |
---|---|
18360
f1ee47866e6b
use common code to get OCTAVE_HOME in main, octave-config and mkoctfile
John W. Eaton <jwe@octave.org>
parents:
18357
diff
changeset
|
1 // %NO_EDIT_WARNING% |
8920 | 2 |
27923
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
3 //////////////////////////////////////////////////////////////////////// |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
4 // |
29358
0a5b15007766
update Octave Project Developers copyright for the new year
John W. Eaton <jwe@octave.org>
parents:
27934
diff
changeset
|
5 // Copyright (C) 2008-2021 The Octave Project Developers |
27923
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
6 // |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
7 // 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
|
8 // distribution or <https://octave.org/copyright/>. |
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 // This file is part of Octave. |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
11 // |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
12 // 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
|
13 // 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
|
14 // 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
|
15 // (at your option) any later version. |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
16 // |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
17 // 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
|
18 // 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
|
19 // 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
|
20 // GNU General Public License for more details. |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
21 // |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
22 // 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
|
23 // 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
|
24 // <https://www.gnu.org/licenses/>. |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
25 // |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
26 //////////////////////////////////////////////////////////////////////// |
8920 | 27 |
8091
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
28 #if defined (HAVE_CONFIG_H) |
21301
40de9f8f23a6
Use '#include "config.h"' rather than <config.h>.
Rik <rik@octave.org>
parents:
21202
diff
changeset
|
29 # include "config.h" |
8091
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
30 #endif |
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
31 |
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
32 #include <string> |
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
33 #include <map> |
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
34 #include <iostream> |
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
35 #include <algorithm> |
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
36 #include <cstdlib> |
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
37 |
29540
b6f80b1d448f
Windows: Support non-ASCII characters in command line arguments.
Markus Mützel <markus.muetzel@gmx.de>
parents:
29358
diff
changeset
|
38 #if defined (OCTAVE_USE_WINDOWS_API) |
b6f80b1d448f
Windows: Support non-ASCII characters in command line arguments.
Markus Mützel <markus.muetzel@gmx.de>
parents:
29358
diff
changeset
|
39 # include <vector> |
b6f80b1d448f
Windows: Support non-ASCII characters in command line arguments.
Markus Mützel <markus.muetzel@gmx.de>
parents:
29358
diff
changeset
|
40 # include <locale> |
b6f80b1d448f
Windows: Support non-ASCII characters in command line arguments.
Markus Mützel <markus.muetzel@gmx.de>
parents:
29358
diff
changeset
|
41 # include <codecvt> |
b6f80b1d448f
Windows: Support non-ASCII characters in command line arguments.
Markus Mützel <markus.muetzel@gmx.de>
parents:
29358
diff
changeset
|
42 #endif |
b6f80b1d448f
Windows: Support non-ASCII characters in command line arguments.
Markus Mützel <markus.muetzel@gmx.de>
parents:
29358
diff
changeset
|
43 |
21724
aba2e6293dd8
use "#if ..." consistently instead of "#ifdef" and "#ifndef"
John W. Eaton <jwe@octave.org>
parents:
21301
diff
changeset
|
44 #if ! defined (OCTAVE_PREFIX) |
21202
f7121e111991
maint: indent #ifdef blocks in liboctave and src directories.
Rik <rik@octave.org>
parents:
19986
diff
changeset
|
45 # define OCTAVE_PREFIX %OCTAVE_PREFIX% |
8091
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
46 #endif |
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
47 |
23712
b95c430c0649
revamp insertion of config variables into binaries and eliminate some macros
John W. Eaton <jwe@octave.org>
parents:
23220
diff
changeset
|
48 #if ! defined (OCTAVE_EXEC_PREFIX) |
b95c430c0649
revamp insertion of config variables into binaries and eliminate some macros
John W. Eaton <jwe@octave.org>
parents:
23220
diff
changeset
|
49 # define OCTAVE_EXEC_PREFIX %OCTAVE_EXEC_PREFIX% |
b95c430c0649
revamp insertion of config variables into binaries and eliminate some macros
John W. Eaton <jwe@octave.org>
parents:
23220
diff
changeset
|
50 #endif |
b95c430c0649
revamp insertion of config variables into binaries and eliminate some macros
John W. Eaton <jwe@octave.org>
parents:
23220
diff
changeset
|
51 |
23801
9d67bd90681b
cross tools: define OCTAVE_UNUSED if not defined
John D <john.donoghue@ieee.org>
parents:
23712
diff
changeset
|
52 #ifndef OCTAVE_UNUSED |
9d67bd90681b
cross tools: define OCTAVE_UNUSED if not defined
John D <john.donoghue@ieee.org>
parents:
23712
diff
changeset
|
53 # define OCTAVE_UNUSED |
9d67bd90681b
cross tools: define OCTAVE_UNUSED if not defined
John D <john.donoghue@ieee.org>
parents:
23712
diff
changeset
|
54 #endif |
9d67bd90681b
cross tools: define OCTAVE_UNUSED if not defined
John D <john.donoghue@ieee.org>
parents:
23712
diff
changeset
|
55 |
18360
f1ee47866e6b
use common code to get OCTAVE_HOME in main, octave-config and mkoctfile
John W. Eaton <jwe@octave.org>
parents:
18357
diff
changeset
|
56 #include "shared-fcns.h" |
f1ee47866e6b
use common code to get OCTAVE_HOME in main, octave-config and mkoctfile
John W. Eaton <jwe@octave.org>
parents:
18357
diff
changeset
|
57 |
8091
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
58 static std::map<std::string,std::string> vars; |
18360
f1ee47866e6b
use common code to get OCTAVE_HOME in main, octave-config and mkoctfile
John W. Eaton <jwe@octave.org>
parents:
18357
diff
changeset
|
59 |
8091
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
60 static std::string usage_msg = "usage: octave-config [options]"; |
18360
f1ee47866e6b
use common code to get OCTAVE_HOME in main, octave-config and mkoctfile
John W. Eaton <jwe@octave.org>
parents:
18357
diff
changeset
|
61 |
8091
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
62 static std::string help_msg = |
27934
49a0d90cd2a3
maint: Use Octave coding conventions in src/ directory.
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
63 "\n" |
49a0d90cd2a3
maint: Use Octave coding conventions in src/ directory.
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
64 "Options:\n" |
49a0d90cd2a3
maint: Use Octave coding conventions in src/ directory.
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
65 "\n" |
49a0d90cd2a3
maint: Use Octave coding conventions in src/ directory.
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
66 " -h, -?, --help Print this message.\n" |
49a0d90cd2a3
maint: Use Octave coding conventions in src/ directory.
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
67 "\n" |
49a0d90cd2a3
maint: Use Octave coding conventions in src/ directory.
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
68 " --m-site-dir Print the name of the directory where Octave\n" |
49a0d90cd2a3
maint: Use Octave coding conventions in src/ directory.
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
69 " expects to find locally installed .m files.\n" |
49a0d90cd2a3
maint: Use Octave coding conventions in src/ directory.
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
70 "\n" |
49a0d90cd2a3
maint: Use Octave coding conventions in src/ directory.
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
71 " --oct-site-dir Print the name of the directory where Octave\n" |
49a0d90cd2a3
maint: Use Octave coding conventions in src/ directory.
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
72 " expects to find locally installed .oct files.\n" |
49a0d90cd2a3
maint: Use Octave coding conventions in src/ directory.
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
73 "\n" |
49a0d90cd2a3
maint: Use Octave coding conventions in src/ directory.
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
74 " -p VAR, --print VAR Print the value of the given configuration\n" |
49a0d90cd2a3
maint: Use Octave coding conventions in src/ directory.
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
75 " variable VAR. Recognized variables are:\n" |
49a0d90cd2a3
maint: Use Octave coding conventions in src/ directory.
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
76 "\n" |
49a0d90cd2a3
maint: Use Octave coding conventions in src/ directory.
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
77 " API_VERSION LOCALFCNFILEDIR\n" |
49a0d90cd2a3
maint: Use Octave coding conventions in src/ directory.
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
78 " ARCHLIBDIR LOCALOCTFILEDIR\n" |
49a0d90cd2a3
maint: Use Octave coding conventions in src/ directory.
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
79 " BINDIR LOCALSTARTUPFILEDIR\n" |
49a0d90cd2a3
maint: Use Octave coding conventions in src/ directory.
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
80 " CANONICAL_HOST_TYPE LOCALVERARCHLIBDIR\n" |
49a0d90cd2a3
maint: Use Octave coding conventions in src/ directory.
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
81 " DATADIR LOCALVERFCNFILEDIR\n" |
49a0d90cd2a3
maint: Use Octave coding conventions in src/ directory.
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
82 " DATAROOTDIR LOCALVEROCTFILEDIR\n" |
49a0d90cd2a3
maint: Use Octave coding conventions in src/ directory.
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
83 " DEFAULT_PAGER MAN1DIR\n" |
49a0d90cd2a3
maint: Use Octave coding conventions in src/ directory.
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
84 " EXEC_PREFIX MAN1EXT\n" |
49a0d90cd2a3
maint: Use Octave coding conventions in src/ directory.
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
85 " EXEEXT MANDIR\n" |
49a0d90cd2a3
maint: Use Octave coding conventions in src/ directory.
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
86 " FCNFILEDIR OCTAVE_EXEC_HOME\n" |
49a0d90cd2a3
maint: Use Octave coding conventions in src/ directory.
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
87 " IMAGEDIR OCTAVE_HOME\n" |
49a0d90cd2a3
maint: Use Octave coding conventions in src/ directory.
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
88 " INCLUDEDIR OCTDATADIR\n" |
49a0d90cd2a3
maint: Use Octave coding conventions in src/ directory.
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
89 " INFODIR OCTDOCDIR\n" |
49a0d90cd2a3
maint: Use Octave coding conventions in src/ directory.
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
90 " INFOFILE OCTFILEDIR\n" |
49a0d90cd2a3
maint: Use Octave coding conventions in src/ directory.
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
91 " LIBDIR OCTFONTSDIR\n" |
49a0d90cd2a3
maint: Use Octave coding conventions in src/ directory.
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
92 " LIBEXECDIR OCTINCLUDEDIR\n" |
49a0d90cd2a3
maint: Use Octave coding conventions in src/ directory.
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
93 " LOCALAPIARCHLIBDIR OCTLIBDIR\n" |
49a0d90cd2a3
maint: Use Octave coding conventions in src/ directory.
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
94 " LOCALAPIFCNFILEDIR STARTUPFILEDIR\n" |
49a0d90cd2a3
maint: Use Octave coding conventions in src/ directory.
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
95 " LOCALAPIOCTFILEDIR VERSION\n" |
49a0d90cd2a3
maint: Use Octave coding conventions in src/ directory.
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
96 " LOCALARCHLIBDIR\n" |
49a0d90cd2a3
maint: Use Octave coding conventions in src/ directory.
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
97 "\n" |
49a0d90cd2a3
maint: Use Octave coding conventions in src/ directory.
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
98 " -v, --version Print the Octave version number.\n" |
49a0d90cd2a3
maint: Use Octave coding conventions in src/ directory.
Rik <rik@octave.org>
parents:
27923
diff
changeset
|
99 "\n"; |
8091
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
100 |
8092
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
101 static void |
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
102 initialize (void) |
8091
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
103 { |
23712
b95c430c0649
revamp insertion of config variables into binaries and eliminate some macros
John W. Eaton <jwe@octave.org>
parents:
23220
diff
changeset
|
104 set_octave_home (); |
b95c430c0649
revamp insertion of config variables into binaries and eliminate some macros
John W. Eaton <jwe@octave.org>
parents:
23220
diff
changeset
|
105 |
b95c430c0649
revamp insertion of config variables into binaries and eliminate some macros
John W. Eaton <jwe@octave.org>
parents:
23220
diff
changeset
|
106 vars["OCTAVE_HOME"] = Voctave_home; |
b95c430c0649
revamp insertion of config variables into binaries and eliminate some macros
John W. Eaton <jwe@octave.org>
parents:
23220
diff
changeset
|
107 vars["OCTAVE_EXEC_HOME"] = Voctave_exec_home; |
8091
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
108 |
8092
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
109 vars["API_VERSION"] = %OCTAVE_API_VERSION%; |
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
110 vars["CANONICAL_HOST_TYPE"] = %OCTAVE_CANONICAL_HOST_TYPE%; |
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
111 vars["DEFAULT_PAGER"] = %OCTAVE_DEFAULT_PAGER%; |
23712
b95c430c0649
revamp insertion of config variables into binaries and eliminate some macros
John W. Eaton <jwe@octave.org>
parents:
23220
diff
changeset
|
112 vars["EXEEXT"] = %OCTAVE_EXEEXT%; |
18357
159ddd7ce1b3
octave-config: Rebase dir variables to OCTAVE_HOME only when it is defined
Mike Miller <mtmiller@ieee.org>
parents:
18349
diff
changeset
|
113 vars["MAN1EXT"] = %OCTAVE_MAN1EXT%; |
159ddd7ce1b3
octave-config: Rebase dir variables to OCTAVE_HOME only when it is defined
Mike Miller <mtmiller@ieee.org>
parents:
18349
diff
changeset
|
114 vars["VERSION"] = %OCTAVE_VERSION%; |
159ddd7ce1b3
octave-config: Rebase dir variables to OCTAVE_HOME only when it is defined
Mike Miller <mtmiller@ieee.org>
parents:
18349
diff
changeset
|
115 |
23712
b95c430c0649
revamp insertion of config variables into binaries and eliminate some macros
John W. Eaton <jwe@octave.org>
parents:
23220
diff
changeset
|
116 vars["ARCHLIBDIR"] = prepend_octave_exec_home (%OCTAVE_ARCHLIBDIR%); |
b95c430c0649
revamp insertion of config variables into binaries and eliminate some macros
John W. Eaton <jwe@octave.org>
parents:
23220
diff
changeset
|
117 vars["BINDIR"] = prepend_octave_exec_home (%OCTAVE_BINDIR%); |
b95c430c0649
revamp insertion of config variables into binaries and eliminate some macros
John W. Eaton <jwe@octave.org>
parents:
23220
diff
changeset
|
118 vars["DATADIR"] = prepend_octave_home (%OCTAVE_DATADIR%); |
b95c430c0649
revamp insertion of config variables into binaries and eliminate some macros
John W. Eaton <jwe@octave.org>
parents:
23220
diff
changeset
|
119 vars["DATAROOTDIR"] = prepend_octave_home (%OCTAVE_DATAROOTDIR%); |
b95c430c0649
revamp insertion of config variables into binaries and eliminate some macros
John W. Eaton <jwe@octave.org>
parents:
23220
diff
changeset
|
120 vars["FCNFILEDIR"] = prepend_octave_home (%OCTAVE_FCNFILEDIR%); |
b95c430c0649
revamp insertion of config variables into binaries and eliminate some macros
John W. Eaton <jwe@octave.org>
parents:
23220
diff
changeset
|
121 vars["IMAGEDIR"] = prepend_octave_home (%OCTAVE_IMAGEDIR%); |
b95c430c0649
revamp insertion of config variables into binaries and eliminate some macros
John W. Eaton <jwe@octave.org>
parents:
23220
diff
changeset
|
122 vars["INCLUDEDIR"] = prepend_octave_home (%OCTAVE_INCLUDEDIR%); |
b95c430c0649
revamp insertion of config variables into binaries and eliminate some macros
John W. Eaton <jwe@octave.org>
parents:
23220
diff
changeset
|
123 vars["INFODIR"] = prepend_octave_home (%OCTAVE_INFODIR%); |
b95c430c0649
revamp insertion of config variables into binaries and eliminate some macros
John W. Eaton <jwe@octave.org>
parents:
23220
diff
changeset
|
124 vars["INFOFILE"] = prepend_octave_home (%OCTAVE_INFOFILE%); |
b95c430c0649
revamp insertion of config variables into binaries and eliminate some macros
John W. Eaton <jwe@octave.org>
parents:
23220
diff
changeset
|
125 vars["LIBDIR"] = prepend_octave_exec_home (%OCTAVE_LIBDIR%); |
b95c430c0649
revamp insertion of config variables into binaries and eliminate some macros
John W. Eaton <jwe@octave.org>
parents:
23220
diff
changeset
|
126 vars["LIBEXECDIR"] = prepend_octave_exec_home (%OCTAVE_LIBEXECDIR%); |
b95c430c0649
revamp insertion of config variables into binaries and eliminate some macros
John W. Eaton <jwe@octave.org>
parents:
23220
diff
changeset
|
127 vars["LOCALAPIARCHLIBDIR"] = prepend_octave_exec_home (%OCTAVE_LOCALAPIARCHLIBDIR%); |
b95c430c0649
revamp insertion of config variables into binaries and eliminate some macros
John W. Eaton <jwe@octave.org>
parents:
23220
diff
changeset
|
128 vars["LOCALAPIFCNFILEDIR"] = prepend_octave_home (%OCTAVE_LOCALAPIFCNFILEDIR%); |
b95c430c0649
revamp insertion of config variables into binaries and eliminate some macros
John W. Eaton <jwe@octave.org>
parents:
23220
diff
changeset
|
129 vars["LOCALAPIOCTFILEDIR"] = prepend_octave_exec_home (%OCTAVE_LOCALAPIOCTFILEDIR%); |
b95c430c0649
revamp insertion of config variables into binaries and eliminate some macros
John W. Eaton <jwe@octave.org>
parents:
23220
diff
changeset
|
130 vars["LOCALARCHLIBDIR"] = prepend_octave_exec_home (%OCTAVE_LOCALARCHLIBDIR%); |
b95c430c0649
revamp insertion of config variables into binaries and eliminate some macros
John W. Eaton <jwe@octave.org>
parents:
23220
diff
changeset
|
131 vars["LOCALFCNFILEDIR"] = prepend_octave_home (%OCTAVE_LOCALFCNFILEDIR%); |
b95c430c0649
revamp insertion of config variables into binaries and eliminate some macros
John W. Eaton <jwe@octave.org>
parents:
23220
diff
changeset
|
132 vars["LOCALOCTFILEDIR"] = prepend_octave_exec_home (%OCTAVE_LOCALOCTFILEDIR%); |
b95c430c0649
revamp insertion of config variables into binaries and eliminate some macros
John W. Eaton <jwe@octave.org>
parents:
23220
diff
changeset
|
133 vars["LOCALSTARTUPFILEDIR"] = prepend_octave_home (%OCTAVE_LOCALSTARTUPFILEDIR%); |
b95c430c0649
revamp insertion of config variables into binaries and eliminate some macros
John W. Eaton <jwe@octave.org>
parents:
23220
diff
changeset
|
134 vars["LOCALVERARCHLIBDIR"] = prepend_octave_exec_home (%OCTAVE_LOCALVERARCHLIBDIR%); |
b95c430c0649
revamp insertion of config variables into binaries and eliminate some macros
John W. Eaton <jwe@octave.org>
parents:
23220
diff
changeset
|
135 vars["LOCALVERFCNFILEDIR"] = prepend_octave_home (%OCTAVE_LOCALVERFCNFILEDIR%); |
b95c430c0649
revamp insertion of config variables into binaries and eliminate some macros
John W. Eaton <jwe@octave.org>
parents:
23220
diff
changeset
|
136 vars["LOCALVEROCTFILEDIR"] = prepend_octave_exec_home (%OCTAVE_LOCALVEROCTFILEDIR%); |
b95c430c0649
revamp insertion of config variables into binaries and eliminate some macros
John W. Eaton <jwe@octave.org>
parents:
23220
diff
changeset
|
137 vars["MAN1DIR"] = prepend_octave_home (%OCTAVE_MAN1DIR%); |
b95c430c0649
revamp insertion of config variables into binaries and eliminate some macros
John W. Eaton <jwe@octave.org>
parents:
23220
diff
changeset
|
138 vars["MANDIR"] = prepend_octave_home (%OCTAVE_MANDIR%); |
b95c430c0649
revamp insertion of config variables into binaries and eliminate some macros
John W. Eaton <jwe@octave.org>
parents:
23220
diff
changeset
|
139 vars["OCTDATADIR"] = prepend_octave_home (%OCTAVE_OCTDATADIR%); |
24875
7c7b60dd4d4c
Generate Qt compressed help and collection files for the manual (bug #53006)
Pantxo Diribarne <pantxo.diribarne@gmail.com>
parents:
24534
diff
changeset
|
140 vars["OCTDOCDIR"] = prepend_octave_home (%OCTAVE_OCTDOCDIR%); |
23712
b95c430c0649
revamp insertion of config variables into binaries and eliminate some macros
John W. Eaton <jwe@octave.org>
parents:
23220
diff
changeset
|
141 vars["OCTFILEDIR"] = prepend_octave_exec_home (%OCTAVE_OCTFILEDIR%); |
24899
1a46d174a483
include a proper definition of Octave's private font fallback directory
Mike Miller <mtmiller@octave.org>
parents:
24875
diff
changeset
|
142 vars["OCTFONTSDIR"] = prepend_octave_home (%OCTAVE_OCTFONTSDIR%); |
23712
b95c430c0649
revamp insertion of config variables into binaries and eliminate some macros
John W. Eaton <jwe@octave.org>
parents:
23220
diff
changeset
|
143 vars["OCTINCLUDEDIR"] = prepend_octave_home (%OCTAVE_OCTINCLUDEDIR%); |
b95c430c0649
revamp insertion of config variables into binaries and eliminate some macros
John W. Eaton <jwe@octave.org>
parents:
23220
diff
changeset
|
144 vars["OCTLIBDIR"] = prepend_octave_exec_home (%OCTAVE_OCTLIBDIR%); |
b95c430c0649
revamp insertion of config variables into binaries and eliminate some macros
John W. Eaton <jwe@octave.org>
parents:
23220
diff
changeset
|
145 vars["STARTUPFILEDIR"] = prepend_octave_home (%OCTAVE_STARTUPFILEDIR%); |
8091
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
146 } |
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
147 |
29540
b6f80b1d448f
Windows: Support non-ASCII characters in command line arguments.
Markus Mützel <markus.muetzel@gmx.de>
parents:
29358
diff
changeset
|
148 #if defined (OCTAVE_USE_WINDOWS_API) && defined (_UNICODE) |
b6f80b1d448f
Windows: Support non-ASCII characters in command line arguments.
Markus Mützel <markus.muetzel@gmx.de>
parents:
29358
diff
changeset
|
149 extern "C" |
b6f80b1d448f
Windows: Support non-ASCII characters in command line arguments.
Markus Mützel <markus.muetzel@gmx.de>
parents:
29358
diff
changeset
|
150 int |
b6f80b1d448f
Windows: Support non-ASCII characters in command line arguments.
Markus Mützel <markus.muetzel@gmx.de>
parents:
29358
diff
changeset
|
151 wmain (int argc, wchar_t **wargv) |
b6f80b1d448f
Windows: Support non-ASCII characters in command line arguments.
Markus Mützel <markus.muetzel@gmx.de>
parents:
29358
diff
changeset
|
152 { |
b6f80b1d448f
Windows: Support non-ASCII characters in command line arguments.
Markus Mützel <markus.muetzel@gmx.de>
parents:
29358
diff
changeset
|
153 static char **argv = new char * [argc + 1]; |
b6f80b1d448f
Windows: Support non-ASCII characters in command line arguments.
Markus Mützel <markus.muetzel@gmx.de>
parents:
29358
diff
changeset
|
154 std::vector<std::string> argv_str; |
b6f80b1d448f
Windows: Support non-ASCII characters in command line arguments.
Markus Mützel <markus.muetzel@gmx.de>
parents:
29358
diff
changeset
|
155 |
b6f80b1d448f
Windows: Support non-ASCII characters in command line arguments.
Markus Mützel <markus.muetzel@gmx.de>
parents:
29358
diff
changeset
|
156 // convert wide character strings to multibyte UTF-8 strings |
b6f80b1d448f
Windows: Support non-ASCII characters in command line arguments.
Markus Mützel <markus.muetzel@gmx.de>
parents:
29358
diff
changeset
|
157 std::wstring_convert<std::codecvt_utf8<wchar_t>, wchar_t> wchar_conv; |
b6f80b1d448f
Windows: Support non-ASCII characters in command line arguments.
Markus Mützel <markus.muetzel@gmx.de>
parents:
29358
diff
changeset
|
158 for (int i_arg = 0; i_arg < argc; i_arg++) |
30192
8c8031be8072
Windows: Don't get pointers to C strings while vector is still unstable.
Markus Mützel <markus.muetzel@gmx.de>
parents:
29540
diff
changeset
|
159 argv_str.push_back (wchar_conv.to_bytes (wargv[i_arg])); |
8c8031be8072
Windows: Don't get pointers to C strings while vector is still unstable.
Markus Mützel <markus.muetzel@gmx.de>
parents:
29540
diff
changeset
|
160 |
8c8031be8072
Windows: Don't get pointers to C strings while vector is still unstable.
Markus Mützel <markus.muetzel@gmx.de>
parents:
29540
diff
changeset
|
161 // Get pointers to C strings not before vector is stable. |
8c8031be8072
Windows: Don't get pointers to C strings while vector is still unstable.
Markus Mützel <markus.muetzel@gmx.de>
parents:
29540
diff
changeset
|
162 for (int i_arg = 0; i_arg < argc; i_arg++) |
8c8031be8072
Windows: Don't get pointers to C strings while vector is still unstable.
Markus Mützel <markus.muetzel@gmx.de>
parents:
29540
diff
changeset
|
163 argv[i_arg] = &argv_str[i_arg][0]; |
29540
b6f80b1d448f
Windows: Support non-ASCII characters in command line arguments.
Markus Mützel <markus.muetzel@gmx.de>
parents:
29358
diff
changeset
|
164 argv[argc] = nullptr; |
b6f80b1d448f
Windows: Support non-ASCII characters in command line arguments.
Markus Mützel <markus.muetzel@gmx.de>
parents:
29358
diff
changeset
|
165 |
b6f80b1d448f
Windows: Support non-ASCII characters in command line arguments.
Markus Mützel <markus.muetzel@gmx.de>
parents:
29358
diff
changeset
|
166 #else |
8092
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
167 int |
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
168 main (int argc, char **argv) |
8091
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
169 { |
29540
b6f80b1d448f
Windows: Support non-ASCII characters in command line arguments.
Markus Mützel <markus.muetzel@gmx.de>
parents:
29358
diff
changeset
|
170 #endif |
8092
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
171 initialize (); |
8091
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
172 |
8092
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
173 if (argc == 1) |
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
174 { |
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
175 std::cout << usage_msg << std::endl; |
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
176 return 1; |
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
177 } |
8091
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
178 |
8092
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
179 for (int i = 1; i < argc; i++) |
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
180 { |
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
181 std::string arg (argv[i]); |
8091
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
182 |
8092
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
183 if (arg == "-h" || arg == "-?" || arg == "--help") |
17789
f2b047f9b605
Use GNU style coding conventions for code in src/.
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
184 { |
f2b047f9b605
Use GNU style coding conventions for code in src/.
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
185 std::cout << usage_msg << std::endl; |
f2b047f9b605
Use GNU style coding conventions for code in src/.
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
186 std::cout << help_msg; |
f2b047f9b605
Use GNU style coding conventions for code in src/.
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
187 return 0; |
f2b047f9b605
Use GNU style coding conventions for code in src/.
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
188 } |
8092
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
189 else if (arg == "--m-site-dir") |
17789
f2b047f9b605
Use GNU style coding conventions for code in src/.
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
190 std::cout << vars["LOCALVERFCNFILEDIR"] << std::endl; |
8092
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
191 else if (arg == "--oct-site-dir") |
17789
f2b047f9b605
Use GNU style coding conventions for code in src/.
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
192 std::cout << vars["LOCALVEROCTFILEDIR"] << std::endl; |
8092
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
193 else if (arg == "-v" || arg == "--version") |
17789
f2b047f9b605
Use GNU style coding conventions for code in src/.
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
194 std::cout << vars["VERSION"] << std::endl; |
8092
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
195 else if (arg == "-p" || arg == "--print") |
17789
f2b047f9b605
Use GNU style coding conventions for code in src/.
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
196 { |
f2b047f9b605
Use GNU style coding conventions for code in src/.
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
197 if (i < argc-1) |
f2b047f9b605
Use GNU style coding conventions for code in src/.
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
198 { |
f2b047f9b605
Use GNU style coding conventions for code in src/.
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
199 arg = argv[++i]; |
f2b047f9b605
Use GNU style coding conventions for code in src/.
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
200 std::cout << vars[arg] << std::endl; |
f2b047f9b605
Use GNU style coding conventions for code in src/.
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
201 } |
f2b047f9b605
Use GNU style coding conventions for code in src/.
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
202 else |
f2b047f9b605
Use GNU style coding conventions for code in src/.
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
203 { |
f2b047f9b605
Use GNU style coding conventions for code in src/.
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
204 std::cerr << "octave-config: " << arg |
f2b047f9b605
Use GNU style coding conventions for code in src/.
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
205 << " options requires argument" << std::endl; |
f2b047f9b605
Use GNU style coding conventions for code in src/.
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
206 return 1; |
f2b047f9b605
Use GNU style coding conventions for code in src/.
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
207 } |
f2b047f9b605
Use GNU style coding conventions for code in src/.
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
208 } |
8092
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
209 else |
17789
f2b047f9b605
Use GNU style coding conventions for code in src/.
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
210 { |
f2b047f9b605
Use GNU style coding conventions for code in src/.
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
211 std::cerr << "octave-config: unrecognized argument " << arg |
f2b047f9b605
Use GNU style coding conventions for code in src/.
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
212 << std::endl; |
f2b047f9b605
Use GNU style coding conventions for code in src/.
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
213 return 1; |
f2b047f9b605
Use GNU style coding conventions for code in src/.
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
214 } |
8092
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
215 } |
13141
e81ddf9cacd5
maint: untabify and remove trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
12733
diff
changeset
|
216 |
8092
6a292b0fa88c
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: style fixes
John W. Eaton <jwe@octave.org>
parents:
8091
diff
changeset
|
217 return 0; |
8091
4e7527a7b3f9
mkoctfile.cc.in, octave-config.cc.in, octave-bug.cc.in: new files
Michael Goffioul
parents:
diff
changeset
|
218 } |