_scm.h 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168
  1. /* classes: h_files */
  2. #ifndef SCM__SCM_H
  3. #define SCM__SCM_H
  4. /* Copyright (C) 1995,1996,2000,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. /**********************************************************************
  21. This file is Guile's central private header.
  22. When included by other files, this file should preceed any include
  23. other than __scm.h. See __scm.h for details regarding the purpose of
  24. and differences between _scm.h and __scm.h.
  25. **********************************************************************/
  26. #if defined(__ia64) && !defined(__ia64__)
  27. # define __ia64__
  28. #endif
  29. #if HAVE_CONFIG_H
  30. # include <config.h>
  31. #endif
  32. /* The size of `scm_t_bits'. */
  33. #define SIZEOF_SCM_T_BITS SIZEOF_VOID_P
  34. /* Undefine HAVE_STRUCT_TIMESPEC, because the libguile C code doesn't
  35. need it anymore, and because on MinGW:
  36. - the definition of struct timespec is provided (if at all) by
  37. pthread.h
  38. - pthread.h will _not_ define struct timespec if
  39. HAVE_STRUCT_TIMESPEC is 1, because then it thinks that it doesn't
  40. need to.
  41. The libguile C code doesn't need HAVE_STRUCT_TIMESPEC anymore,
  42. because the value of HAVE_STRUCT_TIMESPEC has already been
  43. incorporated in how scm_t_timespec is defined (in scmconfig.h), and
  44. the rest of the libguile C code now just uses scm_t_timespec.
  45. */
  46. #ifdef HAVE_STRUCT_TIMESPEC
  47. #undef HAVE_STRUCT_TIMESPEC
  48. #endif
  49. #include <errno.h>
  50. #include "libguile/__scm.h"
  51. /* Include headers for those files central to the implementation. The
  52. rest should be explicitly #included in the C files themselves. */
  53. #include "libguile/error.h" /* Everyone signals errors. */
  54. #include "libguile/print.h" /* Everyone needs to print. */
  55. #include "libguile/pairs.h" /* Everyone conses. */
  56. #include "libguile/list.h" /* Everyone makes lists. */
  57. #include "libguile/gc.h" /* Everyone allocates. */
  58. #include "libguile/gsubr.h" /* Everyone defines global functions. */
  59. #include "libguile/procs.h" /* Same. */
  60. #include "libguile/numbers.h" /* Everyone deals with fixnums. */
  61. #include "libguile/symbols.h" /* For length, chars, values, miscellany. */
  62. #include "libguile/boolean.h" /* Everyone wonders about the truth. */
  63. #include "libguile/threads.h" /* You are not alone. */
  64. #include "libguile/snarf.h" /* Everyone snarfs. */
  65. #include "libguile/variable.h"
  66. #include "libguile/modules.h"
  67. #include "libguile/inline.h"
  68. #ifndef SCM_SYSCALL
  69. #ifdef vms
  70. # ifndef __GNUC__
  71. # include <ssdef.h>
  72. # define SCM_SYSCALL(line) do{errno = 0;line;} \
  73. while(EVMSERR==errno && (vaxc$errno>>3)==(SS$_CONTROLC>>3))
  74. # endif /* ndef __GNUC__ */
  75. #endif /* def vms */
  76. #endif /* ndef SCM_SYSCALL */
  77. #ifndef SCM_SYSCALL
  78. # ifdef EINTR
  79. # if (EINTR > 0)
  80. # define SCM_SYSCALL(line) do{errno = 0;line;}while(EINTR==errno)
  81. # endif /* (EINTR > 0) */
  82. # endif /* def EINTR */
  83. #endif /* ndef SCM_SYSCALL */
  84. #ifndef SCM_SYSCALL
  85. # define SCM_SYSCALL(line) line;
  86. #endif /* ndef SCM_SYSCALL */
  87. #ifndef min
  88. #define min(A, B) ((A) <= (B) ? (A) : (B))
  89. #endif
  90. #ifndef max
  91. #define max(A, B) ((A) >= (B) ? (A) : (B))
  92. #endif
  93. #if GUILE_USE_64_CALLS && HAVE_STAT64
  94. #define CHOOSE_LARGEFILE(foo,foo64) foo64
  95. #else
  96. #define CHOOSE_LARGEFILE(foo,foo64) foo
  97. #endif
  98. /* These names are a bit long, but they make it clear what they represent. */
  99. #if SCM_HAVE_STRUCT_DIRENT64 == 1
  100. # define dirent_or_dirent64 CHOOSE_LARGEFILE(dirent,dirent64)
  101. #else
  102. # define dirent_or_dirent64 dirent
  103. #endif
  104. #define fstat_or_fstat64 CHOOSE_LARGEFILE(fstat,fstat64)
  105. #define ftruncate_or_ftruncate64 CHOOSE_LARGEFILE(ftruncate,ftruncate64)
  106. #define lseek_or_lseek64 CHOOSE_LARGEFILE(lseek,lseek64)
  107. #define lstat_or_lstat64 CHOOSE_LARGEFILE(lstat,lstat64)
  108. #define off_t_or_off64_t CHOOSE_LARGEFILE(off_t,off64_t)
  109. #define open_or_open64 CHOOSE_LARGEFILE(open,open64)
  110. #define readdir_or_readdir64 CHOOSE_LARGEFILE(readdir,readdir64)
  111. #if SCM_HAVE_READDIR64_R == 1
  112. # define readdir_r_or_readdir64_r CHOOSE_LARGEFILE(readdir_r,readdir64_r)
  113. #else
  114. # define readdir_r_or_readdir64_r readdir_r
  115. #endif
  116. #define stat_or_stat64 CHOOSE_LARGEFILE(stat,stat64)
  117. #define truncate_or_truncate64 CHOOSE_LARGEFILE(truncate,truncate64)
  118. #define scm_from_off_t_or_off64_t CHOOSE_LARGEFILE(scm_from_off_t,scm_from_int64)
  119. #define scm_from_ino_t_or_ino64_t CHOOSE_LARGEFILE(scm_from_ulong,scm_from_uint64)
  120. #define scm_from_blkcnt_t_or_blkcnt64_t CHOOSE_LARGEFILE(scm_from_ulong,scm_from_uint64)
  121. #define scm_to_off_t_or_off64_t CHOOSE_LARGEFILE(scm_to_off_t,scm_to_int64)
  122. #if SIZEOF_OFF_T == 4
  123. # define scm_to_off_t scm_to_int32
  124. # define scm_from_off_t scm_from_int32
  125. #elif SIZEOF_OFF_T == 8
  126. # define scm_to_off_t scm_to_int64
  127. # define scm_from_off_t scm_from_int64
  128. #else
  129. # error sizeof(off_t) is not 4 or 8.
  130. #endif
  131. #define scm_to_off64_t scm_to_int64
  132. #define scm_from_off64_t scm_from_int64
  133. #endif /* SCM__SCM_H */
  134. /*
  135. Local Variables:
  136. c-file-style: "gnu"
  137. End:
  138. */