GNU Octave  8.1.0
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
version.cc
Go to the documentation of this file.
1 ////////////////////////////////////////////////////////////////////////
2 //
3 // Copyright (C) 2013-2023 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 "Additional information about Octave is available at "
52  + format_url (html, "https://www.octave.org") + ".";
53 }
54 
55 std::string
57 {
58  return "Please contribute if you find this software useful.\n\
59 For more information, visit "
60  + format_url (html, "https://www.octave.org/get-involved.html");
61 }
62 
63 std::string
65 {
66  return "Read " + format_url (html, "https://www.octave.org/bugs.html")
67  + " to learn how to submit bug reports.";
68 }
69 
70 std::string
72 {
73  // The GNU coding standards say that on the first line printed by
74  // --version, the version number should follow the last space on the
75  // line.
76 
77  return "GNU Octave, version " OCTAVE_VERSION "\n" OCTAVE_COPYRIGHT;
78 }
79 
80 std::string
82  (bool html, const std::string& extra_info)
83 {
84  std::string br = (html ? "<br>\n" : "\n");
85  std::string sep = (html ? "\n</p>\n<p>\n" : "\n\n");
86 
88  + br
89  + "This is free software; see the source code for copying conditions."
90  + br
91  + octave_warranty_statement (extra_info)
92  + sep
93  + R"(Octave was configured for ")"
94  + OCTAVE_CANONICAL_HOST_TYPE
95  + R"(".)";
96 }
97 
98 std::string
100  (bool html, const std::string& extra_info)
101 {
102  std::string sep = (html ? "\n</p>\n<p>\n" : "\n\n");
103 
104  std::string msg;
105 
106  if (html)
107  msg = "<p>\n";
108 
110  + sep
111  + octave_www_statement (html)
112  + sep
113  + octave_contrib_statement (html)
114  + sep
115  + octave_bugs_statement (html)
116  + (html ? "\n</p>" : "");
117 
118  return msg;
119 }
120 
121 std::string
123 {
124  std::string msg
126  (html, " For details, type 'warranty'.");
127 
128  msg += (html ? "<p>\n" : "\n");
129 
130  msg += "For information about changes from previous versions, type 'news'.";
131 
132  msg += (html ? "\n</p>" : "");
133 
134  return msg;
135 }
#define OCTAVE_VERSION
Definition: main.in.cc:63
std::string octave_name_version_copyright_copying_and_warranty(bool html, const std::string &extra_info)
Definition: version.cc:82
std::string octave_bugs_statement(bool html)
Definition: version.cc:64
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:100
static std::string format_url(bool html, const std::string &url)
Definition: version.cc:43
static std::string octave_warranty_statement(const std::string &extra_info="")
Definition: version.cc:35
std::string octave_startup_message(bool html)
Definition: version.cc:122
std::string octave_contrib_statement(bool html)
Definition: version.cc:56
std::string octave_name_version_and_copyright(void)
Definition: version.cc:71