gh_predicates.c 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  1. /* Copyright (C) 1995,1996,1997, 2000, 2001, 2006, 2008 Free Software Foundation, Inc.
  2. * This library is free software; you can redistribute it and/or
  3. * modify it under the terms of the GNU Lesser General Public
  4. * License as published by the Free Software Foundation; either
  5. * version 2.1 of the License, or (at your option) any later version.
  6. *
  7. * This library is distributed in the hope that it will be useful,
  8. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  10. * Lesser General Public License for more details.
  11. *
  12. * You should have received a copy of the GNU Lesser General Public
  13. * License along with this library; if not, write to the Free Software
  14. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  15. */
  16. #ifdef HAVE_CONFIG_H
  17. # include <config.h>
  18. #endif
  19. /* type predicates and equality predicates */
  20. #include "libguile/gh.h"
  21. #if SCM_ENABLE_DEPRECATED
  22. /* type predicates: tell you if an SCM object has a given type */
  23. int
  24. gh_boolean_p (SCM val)
  25. {
  26. return (scm_is_true (scm_boolean_p (val)));
  27. }
  28. int
  29. gh_symbol_p (SCM val)
  30. {
  31. return (scm_is_true (scm_symbol_p (val)));
  32. }
  33. int
  34. gh_char_p (SCM val)
  35. {
  36. return (scm_is_true (scm_char_p (val)));
  37. }
  38. int
  39. gh_vector_p (SCM val)
  40. {
  41. return (scm_is_true (scm_vector_p (val)));
  42. }
  43. int
  44. gh_pair_p (SCM val)
  45. {
  46. return (scm_is_true (scm_pair_p (val)));
  47. }
  48. int
  49. gh_number_p (SCM val)
  50. {
  51. return (scm_is_true (scm_number_p (val)));
  52. }
  53. int
  54. gh_string_p (SCM val)
  55. {
  56. return (scm_is_true (scm_string_p (val)));
  57. }
  58. int
  59. gh_procedure_p (SCM val)
  60. {
  61. return (scm_is_true (scm_procedure_p (val)));
  62. }
  63. int
  64. gh_list_p (SCM val)
  65. {
  66. return (scm_is_true (scm_list_p (val)));
  67. }
  68. int
  69. gh_inexact_p (SCM val)
  70. {
  71. return (scm_is_true (scm_inexact_p (val)));
  72. }
  73. int
  74. gh_exact_p (SCM val)
  75. {
  76. return (scm_is_true (scm_exact_p (val)));
  77. }
  78. /* the three types of equality */
  79. int
  80. gh_eq_p (SCM x, SCM y)
  81. {
  82. return (scm_is_true (scm_eq_p (x, y)));
  83. }
  84. int
  85. gh_eqv_p (SCM x, SCM y)
  86. {
  87. return (scm_is_true (scm_eqv_p (x, y)));
  88. }
  89. int
  90. gh_equal_p (SCM x, SCM y)
  91. {
  92. return (scm_is_true (scm_equal_p (x, y)));
  93. }
  94. /* equivalent to (string=? ...), but returns 0 or 1 rather than Scheme
  95. booleans */
  96. int
  97. gh_string_equal_p(SCM s1, SCM s2)
  98. {
  99. return (scm_is_true (scm_string_equal_p(s1, s2)));
  100. }
  101. /* equivalent to (null? ...), but returns 0 or 1 rather than Scheme
  102. booleans */
  103. int
  104. gh_null_p(SCM l)
  105. {
  106. return (scm_is_true(scm_null_p(l)));
  107. }
  108. #endif /* SCM_ENABLE_DEPRECATED */
  109. /*
  110. Local Variables:
  111. c-file-style: "gnu"
  112. End:
  113. */