version.c 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  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. #ifdef HAVE_CONFIG_H
  19. # include <config.h>
  20. #endif
  21. #include <stdio.h>
  22. #include "libguile/_scm.h"
  23. #include "libguile/strings.h"
  24. #include "libguile/version.h"
  25. #define SCM_TMP_MACRO_MKSTR(x) #x
  26. /* Return a Scheme string containing Guile's major version number. */
  27. SCM_DEFINE (scm_major_version, "major-version", 0, 0, 0,
  28. (),
  29. "Return a string containing Guile's major version number.\n"
  30. "E.g., the 1 in \"1.6.5\".")
  31. #define FUNC_NAME s_scm_major_version
  32. {
  33. return scm_number_to_string (scm_from_int (SCM_MAJOR_VERSION),
  34. scm_from_int (10));
  35. }
  36. #undef FUNC_NAME
  37. /* Return a Scheme string containing Guile's minor version number. */
  38. SCM_DEFINE (scm_minor_version, "minor-version", 0, 0, 0,
  39. (),
  40. "Return a string containing Guile's minor version number.\n"
  41. "E.g., the 6 in \"1.6.5\".")
  42. #define FUNC_NAME s_scm_minor_version
  43. {
  44. return scm_number_to_string (scm_from_int (SCM_MINOR_VERSION),
  45. scm_from_int (10));
  46. }
  47. #undef FUNC_NAME
  48. /* Return a Scheme string containing Guile's micro version number. */
  49. SCM_DEFINE (scm_micro_version, "micro-version", 0, 0, 0,
  50. (),
  51. "Return a string containing Guile's micro version number.\n"
  52. "E.g., the 5 in \"1.6.5\".")
  53. #define FUNC_NAME s_scm_micro_version
  54. {
  55. return scm_number_to_string (scm_from_int (SCM_MICRO_VERSION),
  56. scm_from_int (10));
  57. }
  58. #undef FUNC_NAME
  59. /* Return a Scheme string containing Guile's complete version. */
  60. SCM_DEFINE (scm_version, "version", 0, 0, 0,
  61. (),
  62. "@deffnx {Scheme Procedure} major-version\n"
  63. "@deffnx {Scheme Procedure} minor-version\n"
  64. "@deffnx {Scheme Procedure} micro-version\n"
  65. "Return a string describing Guile's version number, or its major, minor\n"
  66. "or micro version number, respectively.\n\n"
  67. "@lisp\n"
  68. "(version) @result{} \"1.6.0\"\n"
  69. "(major-version) @result{} \"1\"\n"
  70. "(minor-version) @result{} \"6\"\n"
  71. "(micro-version) @result{} \"0\"\n"
  72. "@end lisp")
  73. #define FUNC_NAME s_scm_version
  74. {
  75. return scm_from_locale_string (PACKAGE_VERSION);
  76. }
  77. #undef FUNC_NAME
  78. /* Return a Scheme string containing Guile's effective version. */
  79. SCM_DEFINE (scm_effective_version, "effective-version", 0, 0, 0,
  80. (),
  81. "Return a string describing Guile's effective version number.\n"
  82. "@lisp\n"
  83. "(version) @result{} \"1.6.0\"\n"
  84. "(effective-version) @result{} \"1.6\"\n"
  85. "(major-version) @result{} \"1\"\n"
  86. "(minor-version) @result{} \"6\"\n"
  87. "(micro-version) @result{} \"0\"\n"
  88. "@end lisp")
  89. #define FUNC_NAME s_scm_effective_version
  90. {
  91. return scm_from_locale_string (SCM_EFFECTIVE_VERSION);
  92. }
  93. #undef FUNC_NAME
  94. void
  95. scm_init_version ()
  96. {
  97. #include "libguile/version.x"
  98. }
  99. /*
  100. Local Variables:
  101. c-file-style: "gnu"
  102. End:
  103. */