| 1 | /* Copyright (C) 1995,1996, 1999, 2000, 2001, 2006, 2008, 2010 Free Software Foundation, Inc. |
| 2 | * |
| 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. |
| 7 | * |
| 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. |
| 12 | * |
| 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 |
| 16 | * 02110-1301 USA |
| 17 | */ |
| 18 | |
| 19 | |
| 20 | \f |
| 21 | #ifdef HAVE_CONFIG_H |
| 22 | # include <config.h> |
| 23 | #endif |
| 24 | |
| 25 | #include <stdio.h> |
| 26 | #include "libguile/_scm.h" |
| 27 | #include "libguile/strings.h" |
| 28 | |
| 29 | #include "libguile/version.h" |
| 30 | \f |
| 31 | |
| 32 | #define SCM_TMP_MACRO_MKSTR(x) #x |
| 33 | |
| 34 | /* Return a Scheme string containing Guile's major version number. */ |
| 35 | |
| 36 | SCM_DEFINE (scm_major_version, "major-version", 0, 0, 0, |
| 37 | (), |
| 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 |
| 41 | { |
| 42 | return scm_number_to_string (scm_from_int (SCM_MAJOR_VERSION), |
| 43 | scm_from_int (10)); |
| 44 | } |
| 45 | #undef FUNC_NAME |
| 46 | |
| 47 | /* Return a Scheme string containing Guile's minor version number. */ |
| 48 | |
| 49 | SCM_DEFINE (scm_minor_version, "minor-version", 0, 0, 0, |
| 50 | (), |
| 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 |
| 54 | { |
| 55 | return scm_number_to_string (scm_from_int (SCM_MINOR_VERSION), |
| 56 | scm_from_int (10)); |
| 57 | } |
| 58 | #undef FUNC_NAME |
| 59 | |
| 60 | /* Return a Scheme string containing Guile's micro version number. */ |
| 61 | |
| 62 | SCM_DEFINE (scm_micro_version, "micro-version", 0, 0, 0, |
| 63 | (), |
| 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 |
| 67 | { |
| 68 | return scm_number_to_string (scm_from_int (SCM_MICRO_VERSION), |
| 69 | scm_from_int (10)); |
| 70 | } |
| 71 | #undef FUNC_NAME |
| 72 | |
| 73 | /* Return a Scheme string containing Guile's complete version. */ |
| 74 | |
| 75 | SCM_DEFINE (scm_version, "version", 0, 0, 0, |
| 76 | (), |
| 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" |
| 82 | "@lisp\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" |
| 87 | "@end lisp") |
| 88 | #define FUNC_NAME s_scm_version |
| 89 | { |
| 90 | return scm_from_locale_string (PACKAGE_VERSION); |
| 91 | } |
| 92 | #undef FUNC_NAME |
| 93 | |
| 94 | /* Return a Scheme string containing Guile's effective version. */ |
| 95 | |
| 96 | SCM_DEFINE (scm_effective_version, "effective-version", 0, 0, 0, |
| 97 | (), |
| 98 | "Return a string describing Guile's effective version number.\n" |
| 99 | "@lisp\n" |
| 100 | "(version) @result{} \"1.6.0\"\n" |
| 101 | "(effective-version) @result{} \"1.6\"\n" |
| 102 | "(major-version) @result{} \"1\"\n" |
| 103 | "(minor-version) @result{} \"6\"\n" |
| 104 | "(micro-version) @result{} \"0\"\n" |
| 105 | "@end lisp") |
| 106 | #define FUNC_NAME s_scm_effective_version |
| 107 | { |
| 108 | return scm_from_locale_string (SCM_EFFECTIVE_VERSION); |
| 109 | } |
| 110 | #undef FUNC_NAME |
| 111 | |
| 112 | \f |
| 113 | |
| 114 | |
| 115 | void |
| 116 | scm_init_version () |
| 117 | { |
| 118 | #include "libguile/version.x" |
| 119 | } |
| 120 | |
| 121 | /* |
| 122 | Local Variables: |
| 123 | c-file-style: "gnu" |
| 124 | End: |
| 125 | */ |