GNU Octave 11.1.0
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
 
Loading...
Searching...
No Matches
version.cc
Go to the documentation of this file.
1////////////////////////////////////////////////////////////////////////
2//
3// Copyright (C) 2013-2026 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
34static std::string
35format_url (bool html, const std::string& url)
36{
37 if (html)
38 return R"(<a href=")" + url + R"(">)" + url + "</a>";
39 else
40 return "<" + url + ">";
41}
42
43std::string
45{
46 return "Home page: "
47 + format_url (html, "https://octave.org");
48}
49
50std::string
52{
53 return "Support resources: "
54 + format_url (html, "https://octave.org/support");
55}
56
57std::string
59{
60 return "Improve Octave: "
61 + format_url (html, "https://octave.org/get-involved");
62}
63
64std::string
66{
67 // The GNU coding standards say that the first line printed by --version
68 // should place the version number following the last space on the line.
69 std::string br = (html ? "<br>\n" : "\n");
70
71 return "GNU Octave (" OCTAVE_CANONICAL_HOST_TYPE ") version " OCTAVE_VERSION + br
72 + OCTAVE_COPYRIGHT;
73}
74
75std::string
77{
78 std::string br = (html ? "<br>\n" : "\n");
79
80 return octave_name_version_copyright (html) + br
81 + "License GPLv3+: GNU GPL version 3 or later "
82 + format_url (html, "https://gnu.org/licenses/gpl.html");
83}
84
85static std::string
86octave_warranty_statement (bool html, const std::string& extra_info = "")
87{
88 std::string br = (html ? "\n" : "\n");
89
90 return "There is NO WARRANTY, to the extent permitted by law."
91 + extra_info;
92}
93
94std::string
96 (bool html, const std::string& extra_info)
97{
98 std::string br = (html ? "<br>\n" : "\n");
99 std::string sep = (html ? "\n</p>\n<p>\n" : "\n\n");
100
102 + sep
103 + "This is free software; see the source code for copying conditions." + br
104 + octave_warranty_statement (html, extra_info) ;
105}
106
107std::string
109 (bool html, const std::string& extra_info)
110{
111 std::string sep = (html ? "\n</p>\n<p>\n" : "\n");
112 std::string msg =
113 (html ? "<p>\n" : "")
115 + (html ? "" : "\n") + sep
116 + octave_www_statement (html) + sep
117 + octave_bugs_statement (html) + sep
118 + octave_contrib_statement (html) + sep
119 + (html ? "\n</p>" : "");
120
121 return msg;
122}
123
124std::string
126{
127 std::string msg
129 (html, " For details, type 'warranty'.");
130
131 msg += (html ? "<p>\n" : "\n");
132 msg += "For changes from previous versions, type 'news'.";
133 msg += (html ? "\n</p>" : "");
134
135 return msg;
136}
#define OCTAVE_VERSION
Definition main.in.cc:63
std::string octave_name_version_copyright_license_copying_warranty(bool html, const std::string &extra_info)
Definition version.cc:96
std::string octave_bugs_statement(bool html)
Definition version.cc:51
std::string octave_www_statement(bool html)
Definition version.cc:44
std::string octave_name_version_copyright_license_copying_warranty_bugs(bool html, const std::string &extra_info)
Definition version.cc:109
std::string octave_name_version_copyright(bool html)
Definition version.cc:65
std::string octave_startup_message(bool html)
Definition version.cc:125
std::string octave_contrib_statement(bool html)
Definition version.cc:58
std::string octave_name_version_copyright_license(bool html)
Definition version.cc:76