_scm.h 5.6 KB

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