1 /* Copyright (C) 1995,1996, 1999, 2000, 2001, 2006, 2008 Free Software Foundation, Inc.
3 * This library is free software; you can redistribute it and/or
4 * modify it under the terms of the GNU Lesser General Public License
5 * as published by the Free Software Foundation; either version 3 of
6 * the License, or (at your option) any later version.
8 * This library is distributed in the hope that it will be useful, but
9 * WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 * Lesser General Public License for more details.
13 * You should have received a copy of the GNU Lesser General Public
14 * License along with this library; if not, write to the Free Software
15 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
26 #include "libguile/_scm.h"
27 #include "libguile/strings.h"
29 #include "libguile/version.h"
32 #define SCM_TMP_MACRO_MKSTR(x) #x
34 /* Return a Scheme string containing Guile's major version number. */
36 SCM_DEFINE (scm_major_version
, "major-version", 0, 0, 0,
38 "Return a string containing Guile's major version number.\n"
39 "E.g., the 1 in \"1.6.5\".")
40 #define FUNC_NAME s_scm_major_version
42 return scm_number_to_string (scm_from_int (SCM_MAJOR_VERSION
),
47 /* Return a Scheme string containing Guile's minor version number. */
49 SCM_DEFINE (scm_minor_version
, "minor-version", 0, 0, 0,
51 "Return a string containing Guile's minor version number.\n"
52 "E.g., the 6 in \"1.6.5\".")
53 #define FUNC_NAME s_scm_minor_version
55 return scm_number_to_string (scm_from_int (SCM_MINOR_VERSION
),
60 /* Return a Scheme string containing Guile's micro version number. */
62 SCM_DEFINE (scm_micro_version
, "micro-version", 0, 0, 0,
64 "Return a string containing Guile's micro version number.\n"
65 "E.g., the 5 in \"1.6.5\".")
66 #define FUNC_NAME s_scm_micro_version
68 return scm_number_to_string (scm_from_int (SCM_MICRO_VERSION
),
73 /* Return a Scheme string containing Guile's complete version. */
75 SCM_DEFINE (scm_version
, "version", 0, 0, 0,
77 "@deffnx {Scheme Procedure} major-version\n"
78 "@deffnx {Scheme Procedure} minor-version\n"
79 "@deffnx {Scheme Procedure} micro-version\n"
80 "Return a string describing Guile's version number, or its major, minor\n"
81 "or micro version number, respectively.\n\n"
83 "(version) @result{} \"1.6.0\"\n"
84 "(major-version) @result{} \"1\"\n"
85 "(minor-version) @result{} \"6\"\n"
86 "(micro-version) @result{} \"0\"\n"
88 #define FUNC_NAME s_scm_version
91 char version_str
[3 * 4 + 3];
93 #if SCM_MAJOR_VERSION > 9999 \
94 || SCM_MINOR_VERSION > 9999 \
95 || SCM_MICRO_VERSION > 9999
96 # error version string may overflow buffer
98 sprintf (version_str
, "%d.%d.%d",
102 return scm_from_locale_string (version_str
);
106 /* Return a Scheme string containing Guile's effective version. */
108 SCM_DEFINE (scm_effective_version
, "effective-version", 0, 0, 0,
110 "Return a string describing Guile's effective version number.\n"
112 "(version) @result{} \"1.6.0\"\n"
113 "(effective-version) @result{} \"1.6\"\n"
114 "(major-version) @result{} \"1\"\n"
115 "(minor-version) @result{} \"6\"\n"
116 "(micro-version) @result{} \"0\"\n"
118 #define FUNC_NAME s_scm_effective_version
121 char version_str
[2 * 4 + 3];
123 #if (SCM_MAJOR_VERSION > 9999 || SCM_MINOR_VERSION > 9999)
124 # error version string may overflow buffer
126 sprintf (version_str
, "%d.%d", SCM_MAJOR_VERSION
, SCM_MINOR_VERSION
);
127 return scm_from_locale_string (version_str
);
137 #include "libguile/version.x"