pairs.h 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. /* classes: h_files */
  2. #ifndef SCM_PAIRS_H
  3. #define SCM_PAIRS_H
  4. /* Copyright (C) 1995,1996,2000,2001 Free Software Foundation, Inc.
  5. *
  6. * This program is free software; you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License as published by
  8. * the Free Software Foundation; either version 2, or (at your option)
  9. * any later version.
  10. *
  11. * This program 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
  14. * GNU General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU General Public License
  17. * along with this software; see the file COPYING. If not, write to
  18. * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
  19. * Boston, MA 02110-1301 USA
  20. *
  21. * As a special exception, the Free Software Foundation gives permission
  22. * for additional uses of the text contained in its release of GUILE.
  23. *
  24. * The exception is that, if you link the GUILE library with other files
  25. * to produce an executable, this does not by itself cause the
  26. * resulting executable to be covered by the GNU General Public License.
  27. * Your use of that executable is in no way restricted on account of
  28. * linking the GUILE library code into it.
  29. *
  30. * This exception does not however invalidate any other reasons why
  31. * the executable file might be covered by the GNU General Public License.
  32. *
  33. * This exception applies only to the code released by the
  34. * Free Software Foundation under the name GUILE. If you copy
  35. * code from other Free Software Foundation releases into a copy of
  36. * GUILE, as the General Public License permits, the exception does
  37. * not apply to the code that you add in this way. To avoid misleading
  38. * anyone as to the status of such modified files, you must delete
  39. * this exception notice from them.
  40. *
  41. * If you write modifications of your own for GUILE, it is your choice
  42. * whether to permit this exception to apply to your modifications.
  43. * If you do not wish that, delete this exception notice. */
  44. #include "libguile/__scm.h"
  45. #if (SCM_DEBUG_PAIR_ACCESSES == 1)
  46. # include "libguile/struct.h"
  47. # define SCM_VALIDATE_PAIR(cell, expr) \
  48. ((!SCM_ECONSP (cell) ? scm_error_pair_access (cell), 0 : 0), (expr))
  49. #else
  50. # define SCM_VALIDATE_PAIR(cell, expr) (expr)
  51. #endif
  52. #define SCM_NULLP(x) (SCM_EQ_P ((x), SCM_EOL))
  53. #define SCM_NNULLP(x) (!SCM_NULLP (x))
  54. #define SCM_CAR(x) (SCM_VALIDATE_PAIR (x, SCM_CELL_OBJECT_0 (x)))
  55. #define SCM_CDR(x) (SCM_VALIDATE_PAIR (x, SCM_CELL_OBJECT_1 (x)))
  56. #define SCM_SETCAR(x, v) (SCM_VALIDATE_PAIR (x, SCM_SET_CELL_OBJECT_0 ((x), (v))))
  57. #define SCM_SETCDR(x, v) (SCM_VALIDATE_PAIR (x, SCM_SET_CELL_OBJECT_1 ((x), (v))))
  58. #define SCM_CAAR(OBJ) SCM_CAR (SCM_CAR (OBJ))
  59. #define SCM_CDAR(OBJ) SCM_CDR (SCM_CAR (OBJ))
  60. #define SCM_CADR(OBJ) SCM_CAR (SCM_CDR (OBJ))
  61. #define SCM_CDDR(OBJ) SCM_CDR (SCM_CDR (OBJ))
  62. #define SCM_CAAAR(OBJ) SCM_CAR (SCM_CAR (SCM_CAR (OBJ)))
  63. #define SCM_CDAAR(OBJ) SCM_CDR (SCM_CAR (SCM_CAR (OBJ)))
  64. #define SCM_CADAR(OBJ) SCM_CAR (SCM_CDR (SCM_CAR (OBJ)))
  65. #define SCM_CDDAR(OBJ) SCM_CDR (SCM_CDR (SCM_CAR (OBJ)))
  66. #define SCM_CAADR(OBJ) SCM_CAR (SCM_CAR (SCM_CDR (OBJ)))
  67. #define SCM_CDADR(OBJ) SCM_CDR (SCM_CAR (SCM_CDR (OBJ)))
  68. #define SCM_CADDR(OBJ) SCM_CAR (SCM_CDR (SCM_CDR (OBJ)))
  69. #define SCM_CDDDR(OBJ) SCM_CDR (SCM_CDR (SCM_CDR (OBJ)))
  70. #define SCM_CAAAAR(OBJ) SCM_CAR (SCM_CAR (SCM_CAR (SCM_CAR (OBJ))))
  71. #define SCM_CDAAAR(OBJ) SCM_CDR (SCM_CAR (SCM_CAR (SCM_CAR (OBJ))))
  72. #define SCM_CADAAR(OBJ) SCM_CAR (SCM_CDR (SCM_CAR (SCM_CAR (OBJ))))
  73. #define SCM_CDDAAR(OBJ) SCM_CDR (SCM_CDR (SCM_CAR (SCM_CAR (OBJ))))
  74. #define SCM_CAADAR(OBJ) SCM_CAR (SCM_CAR (SCM_CDR (SCM_CAR (OBJ))))
  75. #define SCM_CDADAR(OBJ) SCM_CDR (SCM_CAR (SCM_CDR (SCM_CAR (OBJ))))
  76. #define SCM_CADDAR(OBJ) SCM_CAR (SCM_CDR (SCM_CDR (SCM_CAR (OBJ))))
  77. #define SCM_CDDDAR(OBJ) SCM_CDR (SCM_CDR (SCM_CDR (SCM_CAR (OBJ))))
  78. #define SCM_CAAADR(OBJ) SCM_CAR (SCM_CAR (SCM_CAR (SCM_CDR (OBJ))))
  79. #define SCM_CDAADR(OBJ) SCM_CDR (SCM_CAR (SCM_CAR (SCM_CDR (OBJ))))
  80. #define SCM_CADADR(OBJ) SCM_CAR (SCM_CDR (SCM_CAR (SCM_CDR (OBJ))))
  81. #define SCM_CDDADR(OBJ) SCM_CDR (SCM_CDR (SCM_CAR (SCM_CDR (OBJ))))
  82. #define SCM_CAADDR(OBJ) SCM_CAR (SCM_CAR (SCM_CDR (SCM_CDR (OBJ))))
  83. #define SCM_CDADDR(OBJ) SCM_CDR (SCM_CAR (SCM_CDR (SCM_CDR (OBJ))))
  84. #define SCM_CADDDR(OBJ) SCM_CAR (SCM_CDR (SCM_CDR (SCM_CDR (OBJ))))
  85. #define SCM_CDDDDR(OBJ) SCM_CDR (SCM_CDR (SCM_CDR (SCM_CDR (OBJ))))
  86. #if (SCM_DEBUG_PAIR_ACCESSES == 1)
  87. extern void scm_error_pair_access (SCM);
  88. #endif
  89. extern SCM scm_cons (SCM x, SCM y);
  90. extern SCM scm_cons2 (SCM w, SCM x, SCM y);
  91. extern SCM scm_pair_p (SCM x);
  92. extern SCM scm_set_car_x (SCM pair, SCM value);
  93. extern SCM scm_set_cdr_x (SCM pair, SCM value);
  94. extern void scm_init_pairs (void);
  95. #endif /* SCM_PAIRS_H */
  96. /*
  97. Local Variables:
  98. c-file-style: "gnu"
  99. End:
  100. */