GNU Octave  9.1.0
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
version.cc
Go to the documentation of this file.
1 ////////////////////////////////////////////////////////////////////////
2 //
3 // Copyright (C) 2013-2024 The Octave Project Developers
4 //
5 // See the file COPYRIGHT.md in the top-level directory of this
6 // distribution or <https://octave.org/copyright/>.
7 //
8 // This file is part of Octave.
9 //
10 // Octave is free software: you can redistribute it and/or modify it
11 // under the terms of the GNU General Public License as published by
12 // the Free Software Foundation, either version 3 of the License, or
13 // (at your option) any later version.
14 //
15 // Octave is distributed in the hope that it will be useful, but
16 // WITHOUT ANY WARRANTY; without even the implied warranty of
17 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 // GNU General Public License for more details.
19 //
20 // You should have received a copy of the GNU General Public License
21 // along with Octave; see the file COPYING. If not, see
22 // <https://www.gnu.org/licenses/>.
23 //
24 ////////////////////////////////////////////////////////////////////////
25 
26 #if defined (HAVE_CONFIG_H)
27 # include "config.h"
28 #endif
29 
30 #include <string>
31 
32 #include "version.h"
33 
34 static std::string
35 octave_warranty_statement (const std::string& extra_info = "")
36 {
37  return "There is ABSOLUTELY NO WARRANTY; not even for MERCHANTABILITY or\n\
38 FITNESS FOR A PARTICULAR PURPOSE."
39  + extra_info;
40 }
41 
42 static std::string
43 format_url (bool html, const std::string& url)
44 {
45  return html ? R"(<a href=")" + url + R"(">)" + url + "</a>" : url;
46 }
47 
48 std::string
50 {
51  return "Home page: "
52  + format_url (html, "https://octave.org");
53 }
54 
55 std::string
57 {
58  return "Improve Octave: "
59  + format_url (html, "https://octave.org/get-involved");
60 }
61 
62 std::string
64 {
65  return "Support resources: "
66  + format_url (html, "https://octave.org/support");
67 }
68 
69 std::string
71 {
72  // The GNU coding standards say that on the first line printed by
73  // --version, the version number should follow the last space on the
74  // line.
75  std::string br = (html ? "<br>\n" : "\n");
76 
77  return "GNU Octave, version " OCTAVE_VERSION
78  + br
80 }
81 
82 std::string
84  (bool html, const std::string& extra_info)
85 {
86  std::string br = (html ? "<br>\n" : "\n");
87  std::string sep = (html ? "\n</p>\n<p>\n" : "\n\n");
88 
90  + br
91  + "This is free software; see the source code for copying conditions."
92  + br
93  + octave_warranty_statement (extra_info)
94  + sep
95  + R"(Octave was configured for ")"
97  + R"(".)";
98 }
99 
100 std::string
102  (bool html, const std::string& extra_info)
103 {
104  std::string sep = (html ? "\n</p>\n<p>\n" : "\n");
105  std::string msg =
106  (html ? "<p>\n" : "")
108  + (html ? "" : "\n") + sep
109  + octave_www_statement (html) + sep
110  + octave_bugs_statement (html) + sep
111  + octave_contrib_statement (html) + sep
112  + (html ? "\n</p>" : "");
113 
114  return msg;
115 }
116 
117 std::string
119 {
120  std::string msg
122  (html, " For details, type 'warranty'.");
123 
124  msg += (html ? "<p>\n" : "\n");
125 
126  msg += "For changes from previous versions, type 'news'.";
127 
128  msg += (html ? "\n</p>" : "");
129 
130  return msg;
131 }
#define OCTAVE_VERSION
Definition: main.cc:63
std::string octave_name_version_and_copyright(bool html)
Definition: version.cc:70
std::string octave_name_version_copyright_copying_and_warranty(bool html, const std::string &extra_info)
Definition: version.cc:84
std::string octave_bugs_statement(bool html)
Definition: version.cc:63
std::string octave_www_statement(bool html)
Definition: version.cc:49
std::string octave_name_version_copyright_copying_warranty_and_bugs(bool html, const std::string &extra_info)
Definition: version.cc:102
std::string octave_startup_message(bool html)
Definition: version.cc:118
std::string octave_contrib_statement(bool html)
Definition: version.cc:56
#define OCTAVE_CANONICAL_HOST_TYPE
Definition: version.h:53
#define OCTAVE_COPYRIGHT
Definition: version.h:55