gh_predicates.c 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144
  1. /* Copyright (C) 1995,1996,1997, 2000 Free Software Foundation, Inc.
  2. * This program is free software; you can redistribute it and/or modify
  3. * it under the terms of the GNU General Public License as published by
  4. * the Free Software Foundation; either version 2, or (at your option)
  5. * any later version.
  6. *
  7. * This program 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
  10. * GNU General Public License for more details.
  11. *
  12. * You should have received a copy of the GNU General Public License
  13. * along with this software; see the file COPYING. If not, write to
  14. * the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
  15. * Boston, MA 02111-1307 USA
  16. *
  17. * As a special exception, the Free Software Foundation gives permission
  18. * for additional uses of the text contained in its release of GUILE.
  19. *
  20. * The exception is that, if you link the GUILE library with other files
  21. * to produce an executable, this does not by itself cause the
  22. * resulting executable to be covered by the GNU General Public License.
  23. * Your use of that executable is in no way restricted on account of
  24. * linking the GUILE library code into it.
  25. *
  26. * This exception does not however invalidate any other reasons why
  27. * the executable file might be covered by the GNU General Public License.
  28. *
  29. * This exception applies only to the code released by the
  30. * Free Software Foundation under the name GUILE. If you copy
  31. * code from other Free Software Foundation releases into a copy of
  32. * GUILE, as the General Public License permits, the exception does
  33. * not apply to the code that you add in this way. To avoid misleading
  34. * anyone as to the status of such modified files, you must delete
  35. * this exception notice from them.
  36. *
  37. * If you write modifications of your own for GUILE, it is your choice
  38. * whether to permit this exception to apply to your modifications.
  39. * If you do not wish that, delete this exception notice. */
  40. /* type predicates and equality predicates */
  41. #include <stdio.h>
  42. #include "libguile/gh.h"
  43. /* type predicates: tell you if an SCM object has a given type */
  44. int
  45. gh_boolean_p (SCM val)
  46. {
  47. return (SCM_NFALSEP (scm_boolean_p (val)));
  48. }
  49. int
  50. gh_symbol_p (SCM val)
  51. {
  52. return (SCM_NFALSEP (scm_symbol_p (val)));
  53. }
  54. int
  55. gh_char_p (SCM val)
  56. {
  57. return (SCM_NFALSEP (scm_char_p (val)));
  58. }
  59. int
  60. gh_vector_p (SCM val)
  61. {
  62. return (SCM_NFALSEP (scm_vector_p (val)));
  63. }
  64. int
  65. gh_pair_p (SCM val)
  66. {
  67. return (SCM_NFALSEP (scm_pair_p (val)));
  68. }
  69. int
  70. gh_number_p (SCM val)
  71. {
  72. return (SCM_NFALSEP (scm_number_p (val)));
  73. }
  74. int
  75. gh_string_p (SCM val)
  76. {
  77. return (SCM_NFALSEP (scm_string_p (val)));
  78. }
  79. int
  80. gh_procedure_p (SCM val)
  81. {
  82. return (SCM_NFALSEP (scm_procedure_p (val)));
  83. }
  84. int
  85. gh_list_p (SCM val)
  86. {
  87. return (SCM_NFALSEP (scm_list_p (val)));
  88. }
  89. int
  90. gh_inexact_p (SCM val)
  91. {
  92. return (SCM_NFALSEP (scm_inexact_p (val)));
  93. }
  94. int
  95. gh_exact_p (SCM val)
  96. {
  97. return (SCM_NFALSEP (scm_exact_p (val)));
  98. }
  99. /* the three types of equality */
  100. int
  101. gh_eq_p (SCM x, SCM y)
  102. {
  103. return (SCM_NFALSEP (scm_eq_p (x, y)));
  104. }
  105. int
  106. gh_eqv_p (SCM x, SCM y)
  107. {
  108. return (SCM_NFALSEP (scm_eqv_p (x, y)));
  109. }
  110. int
  111. gh_equal_p (SCM x, SCM y)
  112. {
  113. return (SCM_NFALSEP (scm_equal_p (x, y)));
  114. }
  115. /* equivalent to (string=? ...), but returns 0 or 1 rather than Scheme
  116. booleans */
  117. int
  118. gh_string_equal_p(SCM s1, SCM s2)
  119. {
  120. return (SCM_NFALSEP (scm_string_equal_p(s1, s2)));
  121. }
  122. /* equivalent to (null? ...), but returns 0 or 1 rather than Scheme
  123. booleans */
  124. int
  125. gh_null_p(SCM l)
  126. {
  127. return (SCM_NFALSEP(scm_null_p(l)));
  128. }
  129. /*
  130. Local Variables:
  131. c-file-style: "gnu"
  132. End:
  133. */