3 /* Copyright (c) 1994-2012 by Marc Feeley, All Rights Reserved. */
9 /*---------------------------------------------------------------------------*/
11 /* Determine subsystems to debug. */
14 #define ___DEBUG_TTY_not
15 #define ___DEBUG_ALLOC_MEM_TRACE_not
18 /*---------------------------------------------------------------------------*/
20 /* Determine which line editing features to enable. */
22 #define USE_LINEEDITOR
23 #define LINEEDITOR_WITH_NONBLOCKING_IO
24 #define LINEEDITOR_SUPPORT_F5_TO_F12
25 #define LINEEDITOR_SUPPORT_ALTERNATE_ESCAPES
26 #define LINEEDITOR_WITH_LOCAL_CLIPBOARD
27 #define LINEEDITOR_REPORT_CHAR_ENCODING_ERRORS
30 /*---------------------------------------------------------------------------*/
32 /* Determine if we are using POSIX or WIN32. */
41 * Heuristic: if waitpid is available then this is probably a POSIX system.
52 * If this is not a WIN32 or POSIX system, the OS is generic.
55 #define USE_GENERIC_OS
60 /*---------------------------------------------------------------------------*/
63 * We assume that the following basic features are available
64 * regardless of the operating-system... otherwise we are in real
74 * The following basic features are used if they are available.
90 /* Operating-system specific features we require */
96 /* Select features based on availability */
101 #ifdef HAVE__NSGETENVIRON
109 #ifdef HAVE_SOCKETPAIR
110 #define USE_socketpair
168 #define USE_NETWORKING
171 #if defined(HAVE_STAT64) && defined(HAVE_STRUCT_STAT64) && !(defined(__MACOSX__) || (defined(__APPLE__) && defined(__MACH__)))
173 #define ___struct_stat struct stat64
174 #define ___stat stat64
175 #define ___lstat lstat64
176 #define ___fstat fstat64
180 #define ___struct_stat struct stat
182 #define ___lstat lstat
183 #define ___fstat fstat
187 #define USE_NONBLOCKING_FILE_IO
189 #ifdef HAVE_TARGETCONDITIONALS_H
190 #include <TargetConditionals.h>
191 #ifdef TARGET_OS_IPHONE
192 #if TARGET_OS_IPHONE == 1
193 #undef USE_NONBLOCKING_FILE_IO
210 #ifdef HAVE_TCGETATTR
211 #define USE_tcgetattr
229 * This code is now commented out as it seems to be causing trouble on
230 * CYGWIN and the problem it was trying to solve no longer seems to
231 * exist (perhaps the bug in CYGWIN has since been repaired).
236 * Cygwin's timer implementation does not support ITIMER_VIRTUAL and
237 * ITIMER_REAL causes dynamic loading to fail. Why? I don't know!
238 * Use WIN32's CreateThread instead.
240 #undef HAVE_SETITIMER
241 #define HAVE_CREATETHREAD 1
242 #define USE_GetLastError
243 #define HAVE_WINDOWS_H 1
244 #define INCLUDE_windows_h
255 * WIN32 does not support "Unix style" nonblocking I/O. This can be
256 * simulated using pumps.
261 #undef LINEEDITOR_WITH_LOCAL_CLIPBOARD
265 #define USE_CreateDirectory
266 #define USE_CreateProcess
267 #define USE_DeleteFile
268 #define USE_FindFirstFile
269 #define USE_FormatMessage
270 #define USE_GetCurrentProcessId
271 #define USE_GetEnvironmentStrings
272 #define USE_GetEnvironmentVariable
273 #define USE_GetFileAttributesEx
274 #define USE_GetLastError
276 #define USE_RemoveDirectory
277 #define USE_SetCurrentDirectory
278 #define USE_SetEnvironmentVariable
279 #define USE_WSAGetLastError
280 #define USE_GetConsoleWindow
281 #define USE_GetModuleFileName
282 #define USE_VirtualAlloc
285 #define HAVE_CREATETHREAD 1
286 #define HAVE_GETPROCESSTIMES 1
287 #define HAVE_GETSYSTEMTIME 1
288 #define HAVE_LOADLIBRARY 1
289 #define HAVE_MSGWAITFORMULTIPLEOBJECTS 1
292 #define HAVE_GETHOSTNAME 1
293 #define HAVE_GETPEERNAME 1
294 #define HAVE_GETSOCKNAME 1
295 #undef HAVE_INET_PTON
296 #define HAVE_GETADDRINFO 1
297 #define HAVE_GETHOSTBYNAME 1
298 #define HAVE_GETHOSTBYADDR 1
299 #define HAVE_GETSERVBYNAME 1
300 #define HAVE_GETSERVBYPORT 1
301 #define HAVE_GETPROTOBYNAME 1
302 #define HAVE_GETPROTOBYNUMBER 1
303 #define HAVE_GETNETBYNAME 1
305 #define HAVE_WINDOWS_H 1
306 #define INCLUDE_windows_h
307 #define HAVE_WINSOCK2_H 1
308 #define INCLUDE_winsock2_h
309 #define HAVE_WS2TCPIP_H 1
310 #define INCLUDE_ws2tcpip_h
311 #define USE_NETWORKING
316 #define HAVE_TCHAR_H 1
317 #define INCLUDE_tchar_h
319 #define HAVE_ERRNO_H 1
322 #define HAVE_STDINT_H 1
323 #define INCLUDE_stdint_h
329 /*---------------------------------------------------------------------------*/
331 /* Determine which function for getting real time is most precise. */
333 #ifdef HAVE_CLOCK_GETTIME
334 #define USE_clock_gettime
339 #ifdef HAVE_GETSYSTEMTIME
340 #define USE_GetSystemTime
342 #ifdef HAVE_GETTIMEOFDAY
343 #define USE_gettimeofday
358 /* Determine which function for sleeping is most precise. */
360 #ifdef HAVE_NANOSLEEP
361 #define USE_nanosleep
373 /* Determine which function for getting process time is most precise. */
375 #ifdef HAVE_GETPROCESSTIMES
376 #define USE_GetProcessTimes
378 #ifdef HAVE_GETRUSAGE
379 #define USE_getrusage
387 #ifdef HAVE_DOSQUERYSYSINFO
388 #define USE_DosQuerySysInfo
396 /* Determine which heartbeat timer interface to use. */
398 #ifdef HAVE_SETITIMER
399 #define USE_setitimer
401 #ifdef HAVE_DOS_SETVECT
402 #define USE_dos_setvect
404 #ifdef HAVE_DOSSTARTTIMER
405 #define USE_DosStartTimer
410 #ifdef HAVE_CREATETHREAD
411 #define USE_CreateThread
419 /* Determine which signal interface to use. */
421 #ifdef HAVE_SIGACTION
422 #define USE_sigaction
423 #ifndef HAVE_SIGEMPTYSET
426 #ifndef HAVE_SIGADDSET
429 #ifndef HAVE_SIGPROCMASK
434 #ifndef USE_sigaction
441 /* Determine which dynamic loading interface to use. */
446 #ifdef HAVE_LOADLIBRARY
447 #define USE_LoadLibrary
449 #ifdef HAVE_DOSLOADMODULE
450 #define USE_DosLoadModule
455 #ifdef HAVE_GETDISKFRAGMENT
456 #define USE_GetDiskFragment
461 #ifdef HAVE_NSLINKMODULE
462 #define USE_NSLinkModule
472 /* Determine which function to use for miscellaneous networking features. */
474 #ifdef HAVE_GETHOSTNAME
475 #define USE_gethostname
478 #ifdef HAVE_GETPEERNAME
479 #define USE_getpeername
482 #ifdef HAVE_GETSOCKNAME
483 #define USE_getsockname
486 #ifdef HAVE_INET_PTON
487 #define USE_inet_pton
490 #ifdef HAVE_GETADDRINFO
491 #define USE_getaddrinfo
494 #ifdef HAVE_GETHOSTBYNAME
495 #define USE_gethostbyname
498 #ifdef HAVE_GETHOSTBYADDR
499 #define USE_gethostbyaddr
502 #ifdef HAVE_GETSERVBYNAME
503 #define USE_getservbyname
506 #ifdef HAVE_GETSERVBYPORT
507 #define USE_getservbyport
510 #ifdef HAVE_GETPROTOBYNAME
511 #define USE_getprotobyname
514 #ifdef HAVE_GETPROTOBYNUMBER
515 #define USE_getprotobynumber
518 #ifdef HAVE_GETNETBYNAME
519 #define USE_getnetbyname
523 /* Determine which select interface to use. */
528 #ifdef HAVE_MSGWAITFORMULTIPLEOBJECTS
529 #define USE_MsgWaitForMultipleObjects
534 /* Determine which curses interface should be used. */
539 * We use our own curses implementation to avoid depending on the OS's
540 * curses library, which is difficult to link to on some systems.
560 /* Determine which pty interface should be used. */
574 /* Determine which error interface should be used. */
576 #ifdef HAVE_HSTRERROR
577 #define USE_hstrerror
581 /* Determine which floating point configuration interface should be used. */
583 #ifdef HAVE_GET_FPC_CSR
584 #define USE_get_fpc_csr
588 /*---------------------------------------------------------------------------*/
590 /* Determine which header files to include. */
593 #undef INCLUDE_stdlib_h
594 #define INCLUDE_stdlib_h
600 extern char **environ
;
603 #ifdef HAVE__NSGETENVIRON
604 #define environ (*_NSGetEnviron())
605 #undef INCLUDE_crt_externs_h
606 #define INCLUDE_crt_externs_h
612 #undef INCLUDE_stdlib_h
613 #define INCLUDE_stdlib_h
617 #undef INCLUDE_stdlib_h
618 #define INCLUDE_stdlib_h
622 #undef INCLUDE_stdlib_h
623 #define INCLUDE_stdlib_h
627 #undef INCLUDE_sys_types_h
628 #define INCLUDE_sys_types_h
629 #undef INCLUDE_sys_stat_h
630 #define INCLUDE_sys_stat_h
631 #undef INCLUDE_fcntl_h
632 #define INCLUDE_fcntl_h
636 #undef INCLUDE_sys_types_h
637 #define INCLUDE_sys_types_h
638 #undef INCLUDE_dirent_h
639 #define INCLUDE_dirent_h
643 #undef INCLUDE_sys_types_h
644 #define INCLUDE_sys_types_h
645 #undef INCLUDE_sys_stat_h
646 #define INCLUDE_sys_stat_h
647 #undef INCLUDE_unistd_h
648 #define INCLUDE_unistd_h
652 #undef INCLUDE_sys_ioctl_h
653 #define INCLUDE_sys_ioctl_h
657 #undef INCLUDE_sys_types_h
658 #define INCLUDE_sys_types_h
660 #define INCLUDE_pwd_h
664 #undef INCLUDE_sys_types_h
665 #define INCLUDE_sys_types_h
667 #define INCLUDE_grp_h
671 #undef INCLUDE_errno_h
672 #define INCLUDE_errno_h
676 #undef INCLUDE_string_h
677 #define INCLUDE_string_h
681 #undef INCLUDE_string_h
682 #define INCLUDE_string_h
686 #undef INCLUDE_netdb_h
687 #define INCLUDE_netdb_h
691 #undef INCLUDE_time_h
692 #define INCLUDE_time_h
696 #undef INCLUDE_sys_types_h
697 #define INCLUDE_sys_types_h
698 #undef INCLUDE_sys_timeb_h
699 #define INCLUDE_sys_timeb_h
702 #ifdef USE_gettimeofday
703 #undef INCLUDE_sys_time_h
704 #define INCLUDE_sys_time_h
708 #undef INCLUDE_sys_time_h
709 #define INCLUDE_sys_time_h
713 #undef INCLUDE_time_h
714 #define INCLUDE_time_h
718 #undef INCLUDE_unistd_h
719 #define INCLUDE_unistd_h
723 #undef INCLUDE_sys_times_h
724 #define INCLUDE_sys_times_h
727 #ifdef USE_clock_gettime
728 #undef INCLUDE_time_h
729 #define INCLUDE_time_h
733 #undef INCLUDE_sys_timers_h
734 #define INCLUDE_sys_timers_h
738 #undef INCLUDE_sys_time_h
739 #define INCLUDE_sys_time_h
740 #undef INCLUDE_sys_resource_h
741 #define INCLUDE_sys_resource_h
742 #undef INCLUDE_unistd_h
743 #define INCLUDE_unistd_h
747 #undef INCLUDE_dlfcn_h
748 #define INCLUDE_dlfcn_h
757 #undef INCLUDE_sys_dxe_h
758 #define INCLUDE_sys_dxe_h
761 #ifdef USE_NSLinkModule
762 #undef INCLUDE_mach_o_dyld_h
763 #define INCLUDE_mach_o_dyld_h
767 #undef INCLUDE_signal_h
768 #define INCLUDE_signal_h
772 #undef INCLUDE_signal_h
773 #define INCLUDE_signal_h
777 #undef INCLUDE_sys_types_h
778 #define INCLUDE_sys_types_h
779 #undef INCLUDE_sys_socket_h
780 #define INCLUDE_sys_socket_h
784 #undef INCLUDE_unistd_h
785 #define INCLUDE_unistd_h
789 #undef INCLUDE_sys_types_h
790 #define INCLUDE_sys_types_h
791 #undef INCLUDE_sys_wait_h
792 #define INCLUDE_sys_wait_h
796 #undef INCLUDE_sys_types_h
797 #define INCLUDE_sys_types_h
798 #undef INCLUDE_sys_mman_h
799 #define INCLUDE_sys_mman_h
802 #ifdef USE_gethostname
803 #undef INCLUDE_unistd_h
804 #define INCLUDE_unistd_h
807 #ifdef USE_getpeername
808 #undef INCLUDE_sys_socket_h
809 #define INCLUDE_sys_socket_h
812 #ifdef USE_getsockname
813 #undef INCLUDE_sys_socket_h
814 #define INCLUDE_sys_socket_h
817 #ifdef HAVE_INET_PTON
818 #undef INCLUDE_sys_types_h
819 #define INCLUDE_sys_types_h
820 #undef INCLUDE_sys_socket_h
821 #define INCLUDE_sys_socket_h
822 #undef INCLUDE_netinet_in_h
823 #define INCLUDE_netinet_in_h
824 #undef INCLUDE_arpa_inet_h
825 #define INCLUDE_arpa_inet_h
828 #ifdef USE_getaddrinfo
829 #undef INCLUDE_sys_types_h
830 #define INCLUDE_sys_types_h
831 #undef INCLUDE_sys_socket_h
832 #define INCLUDE_sys_socket_h
833 #undef INCLUDE_netdb_h
834 #define INCLUDE_netdb_h
837 #ifdef USE_gethostbyname
838 #undef INCLUDE_sys_socket_h
839 #define INCLUDE_sys_socket_h
840 #undef INCLUDE_netinet_in_h
841 #define INCLUDE_netinet_in_h
842 #undef INCLUDE_netdb_h
843 #define INCLUDE_netdb_h
846 #ifdef USE_gethostbyaddr
847 #undef INCLUDE_sys_socket_h
848 #define INCLUDE_sys_socket_h
849 #undef INCLUDE_netinet_in_h
850 #define INCLUDE_netinet_in_h
851 #undef INCLUDE_netdb_h
852 #define INCLUDE_netdb_h
855 #ifdef USE_getservbyname
856 #undef INCLUDE_sys_socket_h
857 #define INCLUDE_sys_socket_h
858 #undef INCLUDE_netinet_in_h
859 #define INCLUDE_netinet_in_h
860 #undef INCLUDE_netdb_h
861 #define INCLUDE_netdb_h
864 #ifdef USE_getservbyport
865 #undef INCLUDE_sys_socket_h
866 #define INCLUDE_sys_socket_h
867 #undef INCLUDE_netinet_in_h
868 #define INCLUDE_netinet_in_h
869 #undef INCLUDE_netdb_h
870 #define INCLUDE_netdb_h
873 #ifdef USE_getprotobyname
874 #undef INCLUDE_sys_socket_h
875 #define INCLUDE_sys_socket_h
876 #undef INCLUDE_netinet_in_h
877 #define INCLUDE_netinet_in_h
878 #undef INCLUDE_netdb_h
879 #define INCLUDE_netdb_h
882 #ifdef USE_getprotobynumber
883 #undef INCLUDE_sys_socket_h
884 #define INCLUDE_sys_socket_h
885 #undef INCLUDE_netinet_in_h
886 #define INCLUDE_netinet_in_h
887 #undef INCLUDE_netdb_h
888 #define INCLUDE_netdb_h
891 #ifdef USE_getnetbyname
892 #undef INCLUDE_sys_socket_h
893 #define INCLUDE_sys_socket_h
894 #undef INCLUDE_netinet_in_h
895 #define INCLUDE_netinet_in_h
896 #undef INCLUDE_netdb_h
897 #define INCLUDE_netdb_h
902 #define INCLUDE_grp_h
906 #undef INCLUDE_sys_stat_h
907 #define INCLUDE_sys_stat_h
911 #undef INCLUDE_float_h
912 #define INCLUDE_float_h
915 #ifdef USE__FPU_SETCW
916 #undef INCLUDE_fpu_control_h
917 #define INCLUDE_fpu_control_h
920 #ifdef USE_get_fpc_csr
921 #undef INCLUDE_sys_fpu_h
922 #define INCLUDE_sys_fpu_h
926 #undef INCLUDE_tfork_h
927 #define INCLUDE_tfork_h
928 #undef INCLUDE_sys_wait_h
929 #define INCLUDE_sys_wait_h
934 #define INCLUDE_pty_h
935 #undef INCLUDE_util_h
936 #define INCLUDE_util_h
940 #undef INCLUDE_stdlib_h
941 #define INCLUDE_stdlib_h
942 #undef INCLUDE_stropts_h
943 #define INCLUDE_stropts_h
947 #undef INCLUDE_stdlib_h
948 #define INCLUDE_stdlib_h
949 #undef INCLUDE_stropts_h
950 #define INCLUDE_stropts_h
954 #undef INCLUDE_termios_h
955 #define INCLUDE_termios_h
956 #undef INCLUDE_unistd_h
957 #define INCLUDE_unistd_h
961 #undef INCLUDE_curses_h
962 #define INCLUDE_curses_h
966 #undef INCLUDE_curses_h
967 #define INCLUDE_curses_h
970 /*---------------------------------------------------------------------------*/
972 /* Inclusion of header files. */
974 #ifdef INCLUDE_errno_h
980 #ifdef INCLUDE_unistd_h
992 #ifdef INCLUDE_dirent_h
998 #ifdef INCLUDE_dlfcn_h
1010 #ifdef INCLUDE_sys_dxe_h
1011 #ifdef HAVE_SYS_DXE_H
1012 #include <sys/dxe.h>
1016 #ifdef INCLUDE_mach_o_dyld_h
1017 #ifdef HAVE_MACH_O_DYLD_H
1018 #include <mach-o/dyld.h>
1022 #ifdef INCLUDE_sys_types_h
1023 #ifdef HAVE_SYS_TYPES_H
1024 #include <sys/types.h>
1028 #ifdef INCLUDE_sys_time_h
1029 #ifdef HAVE_SYS_TIME_H
1030 #include <sys/time.h>
1034 #ifdef INCLUDE_sys_times_h
1035 #ifdef HAVE_SYS_TIMES_H
1036 #include <sys/times.h>
1040 #ifdef INCLUDE_sys_timeb_h
1041 #ifdef HAVE_SYS_TIMEB_H
1042 #include <sys/timeb.h>
1046 #ifdef INCLUDE_sys_timers_h
1047 #ifdef HAVE_SYS_TIMERS_H
1048 #include <sys/timers.h>
1052 #ifdef INCLUDE_time_h
1058 #ifdef INCLUDE_sys_resource_h
1059 #ifdef HAVE_SYS_RESOURCE_H
1060 #include <sys/resource.h>
1064 #ifdef INCLUDE_sys_stat_h
1065 #ifdef HAVE_SYS_STAT_H
1066 /* the following defines are useful on Linux to map stat to stat64 */
1067 #define __USE_LARGEFILE64
1068 #define __USE_FILE_OFFSET64
1069 #include <sys/stat.h>
1073 #ifdef INCLUDE_sys_wait_h
1074 #ifdef HAVE_SYS_WAIT_H
1075 #include <sys/wait.h>
1079 #ifdef INCLUDE_sys_mman_h
1080 #ifdef HAVE_SYS_MMAN_H
1081 #include <sys/mman.h>
1085 #ifdef INCLUDE_stat_h
1091 #ifdef INCLUDE_signal_h
1092 #ifdef HAVE_SIGNAL_H
1097 #ifdef INCLUDE_netdb_h
1106 /* HP-UX weirdness */
1108 #ifndef NETDB_SUCCESS
1109 #define NETDB_SUCCESS 0
1111 #ifndef NETDB_INTERNAL
1113 #define NETDB_INTERNAL NO_RECOVERY
1120 #ifdef INCLUDE_grp_h
1126 #ifdef INCLUDE_windows_h
1127 #ifdef HAVE_WINDOWS_H
1128 #include <windows.h>
1132 #ifdef INCLUDE_winsock2_h
1133 #ifdef HAVE_WINSOCK2_H
1134 #include <winsock2.h>
1138 #ifdef INCLUDE_ws2tcpip_h
1139 #ifdef HAVE_WS2TCPIP_H
1140 #include <ws2tcpip.h>
1150 #ifdef INCLUDE_tchar_h
1156 #ifdef INCLUDE_float_h
1162 #ifdef INCLUDE_fpu_control_h
1163 #ifdef HAVE_FPU_CONTROL_H
1164 #include <fpu_control.h>
1167 * Some Linux distributions don't have the file "fpu_control.h".
1168 * Instead of including that file we explicitly define the macros we
1171 #ifndef _FPU_CONTROL_H
1172 #define _FPU_CONTROL_H
1173 #define _FPU_MASK_IM 0x01
1174 #define _FPU_MASK_DM 0x02
1175 #define _FPU_MASK_ZM 0x04
1176 #define _FPU_MASK_OM 0x08
1177 #define _FPU_MASK_UM 0x10
1178 #define _FPU_MASK_PM 0x20
1179 #define _FPU_DOUBLE 0x200
1180 #define _FPU_RC_NEAREST 0x0
1181 typedef unsigned int fpu_control_t
__attribute__ ((__mode__ (__HI__
)));
1182 #define _FPU_SETCW(cw) __asm__ ("fldcw %0" : : "m" (*&cw))
1187 #ifdef INCLUDE_os2_h
1193 #ifdef INCLUDE_dos_h
1199 #ifdef INCLUDE_direct_h
1200 #ifdef HAVE_DIRECT_H
1205 #ifdef INCLUDE_Retrace_h
1206 #ifdef HAVE_RETRACE_H
1207 #include <Retrace.h>
1211 #ifdef INCLUDE_Files_h
1217 #ifdef INCLUDE_Finder_h
1218 #ifdef HAVE_FINDER_H
1223 #ifdef INCLUDE_Errors_h
1224 #ifdef HAVE_ERRORS_H
1229 #ifdef INCLUDE_Folders_h
1230 #ifdef HAVE_FOLDERS_H
1231 #include <Folders.h>
1235 #ifdef INCLUDE_OSUtils_h
1236 #ifdef HAVE_OSUTILS_H
1237 #include <OSUtils.h>
1241 #ifdef INCLUDE_Power_h
1247 #ifdef INCLUDE_CodeFragments_h
1248 #ifdef HAVE_CODEFRAGMENTS_H
1249 #include <CodeFragments.h>
1253 #ifdef INCLUDE_SIOUX_h
1259 #ifdef INCLUDE_mac_gui_h
1260 #ifdef HAVE_MAC_GUI_H
1261 #include "mac_gui.h"
1265 #ifdef INCLUDE_unix_h
1271 #ifdef INCLUDE_wdefwin_h
1272 #ifdef HAVE_WDEFWIN_H
1273 #include <wdefwin.h>
1277 #ifdef INCLUDE_tfork_h
1283 #ifdef INCLUDE_curses_h
1284 #ifdef HAVE_CURSES_H
1289 #ifdef INCLUDE_ncurses_h
1290 #ifdef HAVE_NCURSES_H
1291 #include <ncurses.h>
1295 #ifdef INCLUDE_netinet_in_h
1296 #ifdef HAVE_NETINET_IN_H
1297 #include <netinet/in.h>
1301 #ifdef INCLUDE_arpa_inet_h
1302 #ifdef HAVE_ARPA_INET_H
1303 #include <arpa/inet.h>
1307 #ifdef INCLUDE_termios_h
1308 #ifdef HAVE_TERMIOS_H
1309 #include <termios.h>
1313 #ifdef INCLUDE_term_h
1319 #ifdef INCLUDE_pty_h
1325 #ifdef INCLUDE_stropts_h
1326 #ifdef HAVE_STROPTS_H
1327 #include <stropts.h>
1331 #ifdef INCLUDE_libutil_h
1332 #ifdef HAVE_LIBUTIL_H
1333 #include <libutil.h>
1337 #ifdef INCLUDE_util_h
1343 #ifdef INCLUDE_sys_fpu_h
1344 #ifdef HAVE_SYS_FPU_H
1345 #include <sys/fpu.h>
1349 #ifdef INCLUDE_fenv_h
1355 #ifdef INCLUDE_fcntl_h
1361 #ifdef INCLUDE_sys_ioctl_h
1362 #ifdef HAVE_SYS_IOCTL_H
1363 #include <sys/ioctl.h>
1367 #ifdef INCLUDE_sys_socket_h
1368 #ifdef HAVE_SYS_SOCKET_H
1369 #include <sys/socket.h>
1373 #ifdef INCLUDE_stdint_h
1374 #ifdef HAVE_STDINT_H
1379 #ifdef INCLUDE_stdlib_h
1380 #ifdef HAVE_STDLIB_H
1385 #ifdef INCLUDE_string_h
1386 #ifdef HAVE_STRING_H
1391 #ifdef INCLUDE_strings_h
1392 #ifdef HAVE_STRINGS_H
1393 #include <strings.h>
1397 #ifdef INCLUDE_memory_h
1398 #ifdef HAVE_MEMORY_H
1403 #ifdef INCLUDE_crt_externs_h
1404 #ifdef HAVE_CRT_EXTERNS_H
1405 #include <crt_externs.h>
1410 * Use the process-time timer unless only the real-time timer is
1411 * available (e.g. DJGPP). Note that on some systems (e.g. MkLinux)
1412 * ITIMER_VIRTUAL is an enum type, not a macro.
1415 #if defined(__CYGWIN__) || defined(__MACOSX__) || (defined(__APPLE__) && defined(__MACH__))
1416 /* ITIMER_VIRTUAL is broken under CYGWIN and MacOS X... use ITIMER_REAL */
1417 #undef ITIMER_VIRTUAL
1420 #ifdef ITIMER_VIRTUAL
1421 #define HEARTBEAT_ITIMER ITIMER_VIRTUAL
1422 #define HEARTBEAT_SIG SIGVTALRM
1425 #define HEARTBEAT_ITIMER ITIMER_REAL
1426 #define HEARTBEAT_SIG SIGALRM
1428 #define HEARTBEAT_ITIMER ITIMER_VIRTUAL
1429 #define HEARTBEAT_SIG SIGVTALRM
1434 /*---------------------------------------------------------------------------*/
1436 #define ___CHAR_TYPE(ce) \
1437 ce(___ISO_8859_1,char,___UCS_2,___UCS_4,___WCHAR,char)
1439 #define ___STRING_TYPE(ce) \
1440 ce(___ISO_8859_1STRING,___UTF_8STRING,___UCS_2STRING,___UCS_4STRING,___WCHARSTRING,char*)
1443 ce(___CHAR_ENCODING_ISO_8859_1, \
1444 ___CHAR_ENCODING_UTF_8, \
1445 ___CHAR_ENCODING_UCS_2, \
1446 ___CHAR_ENCODING_UCS_4, \
1447 ___CHAR_ENCODING_WCHAR, \
1448 ___CHAR_ENCODING_NATIVE)
1451 extern ___SCMOBJ ___setup_os_interrupt_handling ___PVOID
;
1453 extern void ___cleanup_os_interrupt_handling ___PVOID
;
1455 extern void ___disable_os_interrupts ___PVOID
;
1457 extern void ___enable_os_interrupts ___PVOID
;
1460 /*---------------------------------------------------------------------------*/
1462 /* Virtual memory statistics. */
1464 extern void ___vm_stats
1470 /* Formatting of source code position. */
1472 extern char *___format_filepos
1479 /* System type information. */
1481 extern char **___os_system_type ___PVOID
;
1482 extern char *___os_system_type_string ___PVOID
;
1483 extern char *___os_configure_command_string ___PVOID
;
1486 /* C compilation environment information. */
1488 extern char *___os_obj_extension_string ___PVOID
;
1489 extern char *___os_exe_extension_string ___PVOID
;
1490 extern char *___os_bat_extension_string ___PVOID
;
1493 /* OS initialization/finalization. */
1495 extern ___SCMOBJ ___setup_os ___PVOID
;
1496 extern void ___cleanup_os ___PVOID
;
1499 /* Utilities for machine encoding of characters. */
1502 * For now an ISO-8859-1 encoding of characters is assumed for
1503 * 'unsigned char'. This means that the mapping to and from the
1504 * Unicode character set is the identity function. To support other
1505 * machine representations, e.g. EBCDIC, these macros would have to
1506 * actually translate the characters.
1509 #define UCS_4_to_uchar(u)u
1510 #define uchar_to_UCS_4(c)c
1513 /*---------------------------------------------------------------------------*/