compat.h 4.2 KB

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