version.c 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  1. /* Copyright 1995-1996,1999-2001,2006,2008,2010,2018
  2. Free Software Foundation, Inc.
  3. This file is part of Guile.
  4. Guile is free software: you can redistribute it and/or modify it
  5. under the terms of the GNU Lesser General Public License as published
  6. by the Free Software Foundation, either version 3 of the License, or
  7. (at your option) any later version.
  8. Guile is distributed in the hope that it will be useful, but WITHOUT
  9. ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  10. FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
  11. License for more details.
  12. You should have received a copy of the GNU Lesser General Public
  13. License along with Guile. If not, see
  14. <https://www.gnu.org/licenses/>. */
  15. #ifdef HAVE_CONFIG_H
  16. # include <config.h>
  17. #endif
  18. #include <stdio.h>
  19. #include "gsubr.h"
  20. #include "numbers.h"
  21. #include "strings.h"
  22. #include "version.h"
  23. #define SCM_TMP_MACRO_MKSTR(x) #x
  24. /* Return a Scheme string containing Guile's major version number. */
  25. SCM_DEFINE (scm_major_version, "major-version", 0, 0, 0,
  26. (),
  27. "Return a string containing Guile's major version number.\n"
  28. "E.g., the 1 in \"1.6.5\".")
  29. #define FUNC_NAME s_scm_major_version
  30. {
  31. return scm_number_to_string (scm_from_int (SCM_MAJOR_VERSION),
  32. scm_from_int (10));
  33. }
  34. #undef FUNC_NAME
  35. /* Return a Scheme string containing Guile's minor version number. */
  36. SCM_DEFINE (scm_minor_version, "minor-version", 0, 0, 0,
  37. (),
  38. "Return a string containing Guile's minor version number.\n"
  39. "E.g., the 6 in \"1.6.5\".")
  40. #define FUNC_NAME s_scm_minor_version
  41. {
  42. return scm_number_to_string (scm_from_int (SCM_MINOR_VERSION),
  43. scm_from_int (10));
  44. }
  45. #undef FUNC_NAME
  46. /* Return a Scheme string containing Guile's micro version number. */
  47. SCM_DEFINE (scm_micro_version, "micro-version", 0, 0, 0,
  48. (),
  49. "Return a string containing Guile's micro version number.\n"
  50. "E.g., the 5 in \"1.6.5\".")
  51. #define FUNC_NAME s_scm_micro_version
  52. {
  53. return scm_number_to_string (scm_from_int (SCM_MICRO_VERSION),
  54. scm_from_int (10));
  55. }
  56. #undef FUNC_NAME
  57. /* Return a Scheme string containing Guile's complete version. */
  58. SCM_DEFINE (scm_version, "version", 0, 0, 0,
  59. (),
  60. "@deffnx {Scheme Procedure} major-version\n"
  61. "@deffnx {Scheme Procedure} minor-version\n"
  62. "@deffnx {Scheme Procedure} micro-version\n"
  63. "Return a string describing Guile's version number, or its major, minor\n"
  64. "or micro version number, respectively.\n\n"
  65. "@lisp\n"
  66. "(version) @result{} \"1.6.0\"\n"
  67. "(major-version) @result{} \"1\"\n"
  68. "(minor-version) @result{} \"6\"\n"
  69. "(micro-version) @result{} \"0\"\n"
  70. "@end lisp")
  71. #define FUNC_NAME s_scm_version
  72. {
  73. return scm_from_locale_string (PACKAGE_VERSION);
  74. }
  75. #undef FUNC_NAME
  76. /* Return a Scheme string containing Guile's effective version. */
  77. SCM_DEFINE (scm_effective_version, "effective-version", 0, 0, 0,
  78. (),
  79. "Return a string describing Guile's effective version number.\n"
  80. "@lisp\n"
  81. "(version) @result{} \"1.6.0\"\n"
  82. "(effective-version) @result{} \"1.6\"\n"
  83. "(major-version) @result{} \"1\"\n"
  84. "(minor-version) @result{} \"6\"\n"
  85. "(micro-version) @result{} \"0\"\n"
  86. "@end lisp")
  87. #define FUNC_NAME s_scm_effective_version
  88. {
  89. return scm_from_locale_string (SCM_EFFECTIVE_VERSION);
  90. }
  91. #undef FUNC_NAME
  92. void
  93. scm_init_version ()
  94. {
  95. #include "version.x"
  96. }