deprecated.h 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154
  1. /* This file contains definitions for deprecated features. When you
  2. deprecate something, move it here when that is feasible.
  3. */
  4. #ifndef SCM_DEPRECATED_H
  5. #define SCM_DEPRECATED_H
  6. /* Copyright (C) 2003,2004, 2005, 2006, 2007, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
  7. *
  8. * This library is free software; you can redistribute it and/or
  9. * modify it under the terms of the GNU Lesser General Public License
  10. * as published by the Free Software Foundation; either version 3 of
  11. * the License, or (at your option) any later version.
  12. *
  13. * This library is distributed in the hope that it will be useful, but
  14. * WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  16. * Lesser General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU Lesser General Public
  19. * License along with this library; if not, write to the Free Software
  20. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
  21. * 02110-1301 USA
  22. */
  23. #include "libguile/__scm.h"
  24. #include "libguile/strings.h"
  25. #include "libguile/eval.h"
  26. #include "libguile/throw.h"
  27. #include "libguile/iselect.h"
  28. #if (SCM_ENABLE_DEPRECATED == 1)
  29. /* Deprecated 13-05-2011 because it's better just to scm_dynwind_begin.
  30. That also avoids the temptation to stuff pointers in an SCM. */
  31. typedef SCM (*scm_t_inner) (void *);
  32. SCM_DEPRECATED SCM scm_internal_dynamic_wind (scm_t_guard before,
  33. scm_t_inner inner,
  34. scm_t_guard after,
  35. void *inner_data,
  36. void *guard_data);
  37. /* Deprecated 15-05-2011 because it's better to be explicit with the
  38. `return'. Code is more readable that way. */
  39. #define SCM_WTA_DISPATCH_0(gf, subr) \
  40. return scm_wta_dispatch_0 ((gf), (subr))
  41. #define SCM_WTA_DISPATCH_1(gf, a1, pos, subr) \
  42. return scm_wta_dispatch_1 ((gf), (a1), (pos), (subr))
  43. #define SCM_WTA_DISPATCH_2(gf, a1, a2, pos, subr) \
  44. return scm_wta_dispatch_2 ((gf), (a1), (a2), (pos), (subr))
  45. #define SCM_WTA_DISPATCH_N(gf, args, pos, subr) \
  46. return scm_wta_dispatch_n ((gf), (args), (pos), (subr))
  47. /* Deprecated 15-05-2011 because this idiom is not very readable. */
  48. #define SCM_GASSERT0(cond, gf, subr) \
  49. if (SCM_UNLIKELY (!(cond))) \
  50. return scm_wta_dispatch_0 ((gf), (subr))
  51. #define SCM_GASSERT1(cond, gf, a1, pos, subr) \
  52. if (SCM_UNLIKELY (!(cond))) \
  53. return scm_wta_dispatch_1 ((gf), (a1), (pos), (subr))
  54. #define SCM_GASSERT2(cond, gf, a1, a2, pos, subr) \
  55. if (SCM_UNLIKELY (!(cond))) \
  56. return scm_wta_dispatch_2 ((gf), (a1), (a2), (pos), (subr))
  57. #define SCM_GASSERTn(cond, gf, args, pos, subr) \
  58. if (SCM_UNLIKELY (!(cond))) \
  59. return scm_wta_dispatch_n ((gf), (args), (pos), (subr))
  60. /* Deprecated 15-05-2011 because this is a one-off macro that does
  61. strange things. */
  62. #define SCM_WTA_DISPATCH_1_SUBR(subr, a1, pos) \
  63. return (SCM_UNPACK ((*SCM_SUBR_GENERIC (subr))) \
  64. ? scm_call_1 ((*SCM_SUBR_GENERIC (subr)), (a1)) \
  65. : (scm_i_wrong_type_arg_symbol (SCM_SUBR_NAME (subr), (pos), (a1)), SCM_UNSPECIFIED))
  66. #define SCM_LIST0 SCM_EOL
  67. #define SCM_LIST1(e0) scm_cons ((e0), SCM_EOL)
  68. #define SCM_LIST2(e0, e1) scm_cons2 ((e0), (e1), SCM_EOL)
  69. #define SCM_LIST3(e0, e1, e2) scm_cons ((e0), SCM_LIST2 ((e1), (e2)))
  70. #define SCM_LIST4(e0, e1, e2, e3)\
  71. scm_cons2 ((e0), (e1), SCM_LIST2 ((e2), (e3)))
  72. #define SCM_LIST5(e0, e1, e2, e3, e4)\
  73. scm_cons ((e0), SCM_LIST4 ((e1), (e2), (e3), (e4)))
  74. #define SCM_LIST6(e0, e1, e2, e3, e4, e5)\
  75. scm_cons2 ((e0), (e1), SCM_LIST4 ((e2), (e3), (e4), (e5)))
  76. #define SCM_LIST7(e0, e1, e2, e3, e4, e5, e6)\
  77. scm_cons ((e0), SCM_LIST6 ((e1), (e2), (e3), (e4), (e5), (e6)))
  78. #define SCM_LIST8(e0, e1, e2, e3, e4, e5, e6, e7)\
  79. scm_cons2 ((e0), (e1), SCM_LIST6 ((e2), (e3), (e4), (e5), (e6), (e7)))
  80. #define SCM_LIST9(e0, e1, e2, e3, e4, e5, e6, e7, e8)\
  81. scm_cons ((e0),\
  82. SCM_LIST8 ((e1), (e2), (e3), (e4), (e5), (e6), (e7), (e8)))
  83. #define SCM_CHAR_CODE_LIMIT SCM_CHAR_CODE_LIMIT__GONE__REPLACE_WITH__256L
  84. #define SCM_OPDIRP SCM_OPDIRP__GONE__REPLACE_WITH__SCM_DIRP_and_SCM_DIR_OPEN_P
  85. #define SCM_PROCEDURE SCM_PROCEDURE__GONE__REPLACE_WITH__scm_procedure
  86. #define SCM_PROCEDURE_WITH_SETTER_P SCM_PROCEDURE_WITH_SETTER_P__GONE__REPLACE_WITH__scm_is_true__scm_procedure_with_setter_p
  87. #define SCM_SETTER SCM_SETTER__GONE__REPLACE_WITH__scm_setter
  88. #define SCM_THREAD_SWITCHING_CODE SCM_THREAD_SWITCHING_CODE__GONE__REMOVE_FROM_YOUR_CODE
  89. #define SCM_VALIDATE_NUMBER_COPY SCM_VALIDATE_NUMBER_COPY__GONE__REPLACE_WITH__SCM_VALIDATE_DOUBLE_COPY
  90. #define SCM_VALIDATE_NUMBER_DEF_COPY SCM_VALIDATE_NUMBER_DEF_COPY__GONE__REPLACE_WITH__SCM_UNBNDP_and_SCM_VALIDATE_DOUBLE_COPY
  91. #define SCM_VALIDATE_OPDIR SCM_VALIDATE_OPDIR__GONE
  92. #define SCM_VALIDATE_STRING_COPY SCM_VALIDATE_STRING_COPY__GONE
  93. #define SCM_VALIDATE_SUBSTRING_SPEC_COPY SCM_VALIDATE_SUBSTRING_SPEC_COPY__GONE
  94. #define scm_array scm_array__GONE__REPLACE_WITH__scm_t_array
  95. #define scm_array_dim scm_array_dim__GONE__REPLACE_WITH__scm_t_array_dim
  96. #define scm_async_click scm_async_click__GONE__REPLACE_WITH__scm_async_tick
  97. #define scm_call_generic_0 scm_call_generic_0__GONE__REPLACE_WITH__scm_call_0
  98. #define scm_call_generic_1 scm_call_generic_1__GONE__REPLACE_WITH__scm_call_1
  99. #define scm_call_generic_2 scm_call_generic_2__GONE__REPLACE_WITH__scm_call_2
  100. #define scm_call_generic_3 scm_call_generic_3__GONE__REPLACE_WITH__scm_call_3
  101. #define scm_apply_generic scm_apply_generic__GONE__REPLACE_WITH__scm_apply_0
  102. #define scm_fport scm_fport__GONE__REPLACE_WITH__scm_t_fport
  103. #define scm_listify scm_listify__GONE__REPLACE_WITH__scm_list_n
  104. #define scm_option scm_option__GONE__REPLACE_WITH__scm_t_option
  105. #define scm_port scm_port__GONE__REPLACE_WITH__scm_t_port
  106. #define scm_port_rw_active scm_port_rw_active__GONE__REPLACE_WITH__scm_t_port_rw_active
  107. #define scm_ptob_descriptor scm_ptob_descriptor__GONE__REPLACE_WITH__scm_t_ptob_descriptor
  108. #define scm_rng scm_rng__GONE__REPLACE_WITH__scm_t_rng
  109. #define scm_rstate scm_rstate__GONE__REPLACE_WITH__scm_t_rstate
  110. #define scm_sizet scm_sizet__GONE__REPLACE_WITH__size_t
  111. #define scm_srcprops scm_srcprops__GONE__REPLACE_WITH__scm_t_srcprops
  112. #define scm_srcprops_chunk scm_srcprops_chunk__GONE__REPLACE_WITH__scm_t_srcprops_chunk
  113. #define scm_struct_i_flags scm_struct_i_flags__GONE__REPLACE_WITH__scm_vtable_index_flags
  114. #define scm_struct_i_free scm_struct_i_free__GONE__REPLACE_WITH__scm_vtable_index_instance_finalize
  115. #define scm_subr_entry scm_subr_entry__GONE__REPLACE_WITH__scm_t_subr_entry
  116. #define scm_substring_move_left_x scm_substring_move_left_x__GONE__REPLACE_WITH__scm_substring_move_x
  117. #define scm_substring_move_right_x scm_substring_move_right_x__GONE__REPLACE_WITH__scm_substring_move_x
  118. #define scm_vtable_index_printer scm_vtable_index_printer__GONE__REPLACE_WITH__scm_vtable_index_instance_printer
  119. #define scm_vtable_index_vtable scm_vtable_index_vtable__GONE__REPLACE_WITH__scm_vtable_index_self
  120. typedef scm_i_t_array scm_i_t_array__GONE__REPLACE_WITH__scm_t_array;
  121. #ifndef BUILDING_LIBGUILE
  122. #define SCM_ASYNC_TICK SCM_ASYNC_TICK__GONE__REPLACE_WITH__scm_async_tick
  123. #endif
  124. /* Deprecated 26-05-2011, as the GC_STUBBORN API doesn't do anything any
  125. more. */
  126. SCM_API SCM scm_immutable_cell (scm_t_bits car, scm_t_bits cdr);
  127. SCM_API SCM scm_immutable_double_cell (scm_t_bits car, scm_t_bits cbr,
  128. scm_t_bits ccr, scm_t_bits cdr);
  129. void scm_i_init_deprecated (void);
  130. #endif
  131. #endif /* SCM_DEPRECATED_H */