compat.h 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163
  1. /* classes: h_files */
  2. #ifndef COMPATH
  3. #define COMPATH
  4. /* Copyright (C) 2001, 2002, 2006, 2008 Free Software Foundation, Inc.
  5. *
  6. * This library is free software; you can redistribute it and/or
  7. * modify it under the terms of the GNU Lesser General Public License
  8. * as published by the Free Software Foundation; either version 3 of
  9. * the License, or (at your option) any later version.
  10. *
  11. * This library is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  14. * Lesser General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU Lesser General Public
  17. * License along with this library; if not, write to the Free Software
  18. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
  19. * 02110-1301 USA
  20. */
  21. #ifndef SCM_GC8MARKP
  22. # define SCM_GC8MARKP(X) SCM_GC_MARK_P(X)
  23. # define SCM_SETGC8MARK(X) SCM_SET_GC_MARK(X)
  24. #endif
  25. #ifndef SCM_GC_MARK_P
  26. # define SCM_GC_MARK_P(X) SCM_GCMARKP(X)
  27. # define SCM_SET_GC_MARK(X) SCM_SETGCMARK(X)
  28. #endif
  29. #ifndef SCM_ARRAY_FLAG_CONTIGUOUS
  30. # define SCM_ARRAY_FLAG_CONTIGUOUS SCM_ARRAY_CONTIGUOUS
  31. #endif
  32. #ifndef HAVE_SCM_T_BITS
  33. typedef scm_bits_t scm_t_bits;
  34. typedef scm_array scm_t_array;
  35. typedef scm_array_dim scm_t_array_dim;
  36. typedef scm_mutex_t scm_t_mutex;
  37. typedef scm_cond_t scm_t_cond;
  38. typedef scm_key_t scm_t_key;
  39. typedef scm_catch_body_t scm_t_catch_body;
  40. typedef scm_catch_handler_t scm_t_catch_handler;
  41. typedef scm_rstate scm_t_rstate;
  42. typedef scm_port scm_t_port;
  43. typedef scm_fport scm_t_fport;
  44. #endif
  45. #ifndef SCM_VALIDATE_DOUBLE_COPY
  46. #define SCM_VALIDATE_DOUBLE_COPY SCM_VALIDATE_NUMBER_COPY
  47. #endif
  48. #ifndef HAVE_SCM_C_DEFINE_MODULE
  49. #define scm_c_define_module(NAME,INIT,DATA) \
  50. scm_make_module (scm_read_0str ("(" NAME ")"))
  51. #endif
  52. #ifndef SCM_MAKE_CHAR
  53. #define SCM_MAKE_CHAR SCM_MAKICHR
  54. #define SCM_CHAR SCM_ICHR
  55. #define SCM_CHARP SCM_ICHRP
  56. #endif
  57. #ifndef SCM_ROSTRINGP
  58. #define SCM_ROSTRINGP(x) (SCM_STRINGP (x) || SCM_SYMBOLP (x))
  59. #define SCM_RWSTRINGP(x) SCM_STRINGP (x)
  60. #define SCM_ROCHARS(x) \
  61. (SCM_STRINGP (x) ? SCM_STRING_CHARS (x) : SCM_SYMBOL_CHARS (x))
  62. #define SCM_ROLENGTH(x) \
  63. (SCM_STRINGP (x) ? SCM_STRING_LENGTH (x) : SCM_SYMBOL_LENGTH (x))
  64. #endif
  65. #ifndef SCM_STRING_COERCE_0TERMINATION_X
  66. #ifdef SCM_COERCE_SUBSTR
  67. #define SCM_STRING_COERCE_0TERMINATION_X SCM_COERCE_SUBSTR
  68. #else
  69. #define SCM_STRING_COERCE_0TERMINATION_X(x) (x)
  70. #endif
  71. #endif
  72. #ifndef HAVE_SCM_C_READ_STRING
  73. #define scm_c_read_string scm_read_0str
  74. #define scm_c_eval_string scm_eval_0str
  75. #define scm_str2symbol(X) SCM_CAR (scm_intern0 (X))
  76. #define scm_mem2string(X, Y) scm_makfromstr ((X), (Y), 0)
  77. #endif
  78. #ifndef HAVE_SCM_MAKE_REAL
  79. #define scm_make_real(X) scm_makdbl ((X), 0.0)
  80. #endif
  81. #ifdef HAVE_SCM_NUM2DOUBLE
  82. #define scm_real2double scm_num2double
  83. #define SCM_REAL2DOUBLE SCM_NUM2DOUBLE
  84. #else
  85. #define scm_real2double(X, POS, WHERE) scm_num2dbl ((X), (WHERE))
  86. #define SCM_REAL2DOUBLE(X, POS) scm_num2dbl ((X), FUNC_NAME)
  87. #endif
  88. #ifndef SCM_VALIDATE_DOUBLE_DEF_COPY
  89. #define SCM_VALIDATE_DOUBLE_DEF_COPY SCM_VALIDATE_NUMBER_DEF_COPY
  90. #endif
  91. #ifndef HAVE_SCM_GC_PROTECT_OBJECT
  92. #define scm_gc_protect_object scm_protect_object
  93. #endif
  94. #ifndef HAVE_SCM_C_DEFINE_GSUBR
  95. #define scm_c_define_gsubr scm_make_gsubr
  96. #endif
  97. #ifndef SCM_STRING_CHARS
  98. #define SCM_STRING_CHARS SCM_CHARS
  99. #define SCM_STRING_UCHARS SCM_UCHARS
  100. #define SCM_STRING_LENGTH SCM_LENGTH
  101. #endif
  102. #ifndef SCM_SUBSTRP
  103. #define SCM_SUBSTRP(X) 0
  104. #endif
  105. #ifndef SCM_VECTOR_LENGTH
  106. #define SCM_VECTOR_LENGTH SCM_LENGTH
  107. #define SCM_UVECTOR_LENGTH SCM_LENGTH
  108. #endif
  109. #ifndef SCM_SET_VECTOR_LENGTH
  110. #define SCM_SET_VECTOR_LENGTH SCM_SETLENGTH
  111. #define SCM_SET_UVECTOR_LENGTH SCM_SETLENGTH
  112. #endif
  113. #ifndef SCM_VECTOR_BASE
  114. #define SCM_VECTOR_BASE SCM_CHARS
  115. #define SCM_UVECTOR_BASE SCM_CHARS
  116. #endif
  117. #ifndef SCM_SET_VECTOR_BASE
  118. #define SCM_SET_VECTOR_BASE SCM_SETCHARS
  119. #define SCM_SET_UVECTOR_BASE SCM_SETCHARS
  120. #endif
  121. #ifndef SCM_UVECTOR_MAX_LENGTH
  122. #define SCM_UVECTOR_MAX_LENGTH SCM_LENGTH_MAX
  123. #endif
  124. #ifndef HAVE_SCM_LIST_1
  125. #define scm_list_1 SCM_LIST1
  126. #define scm_list_2 SCM_LIST2
  127. #define scm_list_3 SCM_LIST3
  128. #define scm_list_4 SCM_LIST4
  129. #define scm_list_5 SCM_LIST5
  130. #define scm_list_n scm_listify
  131. #endif
  132. #ifndef SCM_SYMBOL_CHARS
  133. #define SCM_SYMBOL_CHARS SCM_CHARS
  134. #endif
  135. #endif /* COMPATH */