compat.h 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162
  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
  8. * License as published by the Free Software Foundation; either
  9. * version 2.1 of 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 02110-1301 USA
  19. */
  20. #ifndef SCM_GC8MARKP
  21. # define SCM_GC8MARKP(X) SCM_GC_MARK_P(X)
  22. # define SCM_SETGC8MARK(X) SCM_SET_GC_MARK(X)
  23. #endif
  24. #ifndef SCM_GC_MARK_P
  25. # define SCM_GC_MARK_P(X) SCM_GCMARKP(X)
  26. # define SCM_SET_GC_MARK(X) SCM_SETGCMARK(X)
  27. #endif
  28. #ifndef SCM_ARRAY_FLAG_CONTIGUOUS
  29. # define SCM_ARRAY_FLAG_CONTIGUOUS SCM_ARRAY_CONTIGUOUS
  30. #endif
  31. #ifndef HAVE_SCM_T_BITS
  32. typedef scm_bits_t scm_t_bits;
  33. typedef scm_array scm_t_array;
  34. typedef scm_array_dim scm_t_array_dim;
  35. typedef scm_mutex_t scm_t_mutex;
  36. typedef scm_cond_t scm_t_cond;
  37. typedef scm_key_t scm_t_key;
  38. typedef scm_catch_body_t scm_t_catch_body;
  39. typedef scm_catch_handler_t scm_t_catch_handler;
  40. typedef scm_rstate scm_t_rstate;
  41. typedef scm_port scm_t_port;
  42. typedef scm_fport scm_t_fport;
  43. #endif
  44. #ifndef SCM_VALIDATE_DOUBLE_COPY
  45. #define SCM_VALIDATE_DOUBLE_COPY SCM_VALIDATE_NUMBER_COPY
  46. #endif
  47. #ifndef HAVE_SCM_C_DEFINE_MODULE
  48. #define scm_c_define_module(NAME,INIT,DATA) \
  49. scm_make_module (scm_read_0str ("(" NAME ")"))
  50. #endif
  51. #ifndef SCM_MAKE_CHAR
  52. #define SCM_MAKE_CHAR SCM_MAKICHR
  53. #define SCM_CHAR SCM_ICHR
  54. #define SCM_CHARP SCM_ICHRP
  55. #endif
  56. #ifndef SCM_ROSTRINGP
  57. #define SCM_ROSTRINGP(x) (SCM_STRINGP (x) || SCM_SYMBOLP (x))
  58. #define SCM_RWSTRINGP(x) SCM_STRINGP (x)
  59. #define SCM_ROCHARS(x) \
  60. (SCM_STRINGP (x) ? SCM_STRING_CHARS (x) : SCM_SYMBOL_CHARS (x))
  61. #define SCM_ROLENGTH(x) \
  62. (SCM_STRINGP (x) ? SCM_STRING_LENGTH (x) : SCM_SYMBOL_LENGTH (x))
  63. #endif
  64. #ifndef SCM_STRING_COERCE_0TERMINATION_X
  65. #ifdef SCM_COERCE_SUBSTR
  66. #define SCM_STRING_COERCE_0TERMINATION_X SCM_COERCE_SUBSTR
  67. #else
  68. #define SCM_STRING_COERCE_0TERMINATION_X(x) (x)
  69. #endif
  70. #endif
  71. #ifndef HAVE_SCM_C_READ_STRING
  72. #define scm_c_read_string scm_read_0str
  73. #define scm_c_eval_string scm_eval_0str
  74. #define scm_str2symbol(X) SCM_CAR (scm_intern0 (X))
  75. #define scm_mem2string(X, Y) scm_makfromstr ((X), (Y), 0)
  76. #endif
  77. #ifndef HAVE_SCM_MAKE_REAL
  78. #define scm_make_real(X) scm_makdbl ((X), 0.0)
  79. #endif
  80. #ifdef HAVE_SCM_NUM2DOUBLE
  81. #define scm_real2double scm_num2double
  82. #define SCM_REAL2DOUBLE SCM_NUM2DOUBLE
  83. #else
  84. #define scm_real2double(X, POS, WHERE) scm_num2dbl ((X), (WHERE))
  85. #define SCM_REAL2DOUBLE(X, POS) scm_num2dbl ((X), FUNC_NAME)
  86. #endif
  87. #ifndef SCM_VALIDATE_DOUBLE_DEF_COPY
  88. #define SCM_VALIDATE_DOUBLE_DEF_COPY SCM_VALIDATE_NUMBER_DEF_COPY
  89. #endif
  90. #ifndef HAVE_SCM_GC_PROTECT_OBJECT
  91. #define scm_gc_protect_object scm_protect_object
  92. #endif
  93. #ifndef HAVE_SCM_C_DEFINE_GSUBR
  94. #define scm_c_define_gsubr scm_make_gsubr
  95. #endif
  96. #ifndef SCM_STRING_CHARS
  97. #define SCM_STRING_CHARS SCM_CHARS
  98. #define SCM_STRING_UCHARS SCM_UCHARS
  99. #define SCM_STRING_LENGTH SCM_LENGTH
  100. #endif
  101. #ifndef SCM_SUBSTRP
  102. #define SCM_SUBSTRP(X) 0
  103. #endif
  104. #ifndef SCM_VECTOR_LENGTH
  105. #define SCM_VECTOR_LENGTH SCM_LENGTH
  106. #define SCM_UVECTOR_LENGTH SCM_LENGTH
  107. #endif
  108. #ifndef SCM_SET_VECTOR_LENGTH
  109. #define SCM_SET_VECTOR_LENGTH SCM_SETLENGTH
  110. #define SCM_SET_UVECTOR_LENGTH SCM_SETLENGTH
  111. #endif
  112. #ifndef SCM_VECTOR_BASE
  113. #define SCM_VECTOR_BASE SCM_CHARS
  114. #define SCM_UVECTOR_BASE SCM_CHARS
  115. #endif
  116. #ifndef SCM_SET_VECTOR_BASE
  117. #define SCM_SET_VECTOR_BASE SCM_SETCHARS
  118. #define SCM_SET_UVECTOR_BASE SCM_SETCHARS
  119. #endif
  120. #ifndef SCM_UVECTOR_MAX_LENGTH
  121. #define SCM_UVECTOR_MAX_LENGTH SCM_LENGTH_MAX
  122. #endif
  123. #ifndef HAVE_SCM_LIST_1
  124. #define scm_list_1 SCM_LIST1
  125. #define scm_list_2 SCM_LIST2
  126. #define scm_list_3 SCM_LIST3
  127. #define scm_list_4 SCM_LIST4
  128. #define scm_list_5 SCM_LIST5
  129. #define scm_list_n scm_listify
  130. #endif
  131. #ifndef SCM_SYMBOL_CHARS
  132. #define SCM_SYMBOL_CHARS SCM_CHARS
  133. #endif
  134. #endif /* COMPATH */