source: trunk/source/lisp-kernel/lisptypes.h @ 13067

Last change on this file since 13067 was 13067, checked in by rme, 10 years ago

Update copyright notices.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 4.8 KB
Line 
1/*
2   Copyright (C) 2009 Clozure Associates
3   Copyright (C) 1994-2001 Digitool, Inc
4   This file is part of Clozure CL. 
5
6   Clozure CL is licensed under the terms of the Lisp Lesser GNU Public
7   License , known as the LLGPL and distributed with Clozure CL as the
8   file "LICENSE".  The LLGPL consists of a preamble and the LGPL,
9   which is distributed with Clozure CL as the file "LGPL".  Where these
10   conflict, the preamble takes precedence. 
11
12   Clozure CL is referenced in the preamble as the "LIBRARY."
13
14   The LLGPL is also available online at
15   http://opensource.franz.com/preamble.html
16*/
17
18#ifndef __lisptypes__
19#define __lisptypes__
20
21#include <sys/types.h>
22#define WORD_SIZE 32
23#ifdef PPC64
24#undef WORD_SIZE
25#define WORD_SIZE 64
26#endif
27#ifdef X8664
28#undef WORD_SIZE
29#define WORD_SIZE 64
30#endif
31
32
33#ifdef WINDOWS
34#include <windows.h>
35typedef long long s64_t;
36typedef unsigned long long u64_t;
37typedef signed long s32_t;
38typedef unsigned long u32_t;
39typedef signed short s16_t;
40typedef unsigned short u16_t;
41typedef signed char s8_t;
42typedef unsigned char u8_t;
43#else
44
45#include <stdint.h>
46
47#ifdef SOLARIS
48/* Solaris doesn't laugh and play like the other children */
49typedef int64_t s64_t;
50typedef uint64_t u64_t;
51typedef int32_t s32_t;
52typedef uint32_t u32_t;
53typedef int16_t s16_t;
54typedef uint16_t u16_t;
55typedef int8_t s8_t;
56typedef uint8_t u8_t;
57#else
58typedef int64_t s64_t;
59typedef u_int64_t u64_t;
60typedef int32_t s32_t;
61typedef u_int32_t u32_t;
62typedef int16_t s16_t;
63typedef u_int16_t u16_t;
64typedef int8_t s8_t;
65typedef u_int8_t u8_t;
66#endif
67#endif
68
69#if WORD_SIZE == 64
70typedef u64_t LispObj;
71typedef u64_t natural;
72typedef s64_t signed_natural;
73typedef u64_t unsigned_of_pointer_size;
74#else
75typedef u32_t LispObj;
76typedef u32_t natural;
77typedef s32_t signed_natural;
78typedef u32_t unsigned_of_pointer_size;
79#endif
80
81
82#ifdef DARWIN
83#include <sys/signal.h>
84#include <sys/ucontext.h>
85
86#ifdef PPC
87#if WORD_SIZE == 64
88#ifdef _STRUCT_UCONTEXT64
89typedef _STRUCT_UCONTEXT64 ExceptionInformation;
90typedef _STRUCT_MCONTEXT64 *MCONTEXT_T;
91#else /* _STRUCT_UCONTEXT64 */
92typedef struct ucontext64 ExceptionInformation;
93typedef struct mcontext64 *MCONTEXT_T;
94#endif /* _STRUCT_UCONTEXT64 */
95#define UC_MCONTEXT(UC) UC->uc_mcontext64
96#else /* WORD_SIZE */
97#ifdef _STRUCT_UCONTEXT
98typedef _STRUCT_UCONTEXT ExceptionInformation;
99typedef _STRUCT_MCONTEXT *MCONTEXT_T;
100#else
101typedef struct ucontext ExceptionInformation;
102typedef struct mcontext *MCONTEXT_T;
103#endif
104#define UC_MCONTEXT(UC) UC->uc_mcontext
105#endif /* WORD_SIZE */
106
107
108
109#endif /* PPC */
110
111#ifdef X8664
112/* Broken <i386/ucontext.h> in xcode 2.4 */
113#ifndef _STRUCT_MCONTEXT64 /* A guess at what'll be defined when this is fixed */
114struct mcontext64 {
115        x86_exception_state64_t __es;
116        x86_thread_state64_t    __ss;   
117        x86_float_state64_t     __fs;
118};
119
120typedef struct mcontext64 *MCONTEXT_T;
121typedef ucontext64_t ExceptionInformation;
122#define UC_MCONTEXT(UC) UC->uc_mcontext64
123#define __rax rax
124#define __fpu_mxcsr fpu_mxcsr
125#define __fpu_xmm0 fpu_xmm0
126#define __rsp rsp
127#define __faultvaddr faultvaddr
128#define __err err
129#define __rip rip
130#define __rsi rsi
131#define __rdi rdi
132#define __rdx rdx
133#define __rcx rcx
134#define __r8 r8
135#define __rflags rflags
136#else
137typedef mcontext_t MCONTEXT_T;
138typedef ucontext_t ExceptionInformation;
139#define UC_MCONTEXT(UC) UC->uc_mcontext
140#endif /* _STRUCT_MCONTEXT64 */
141#endif /* X86_64 */
142
143#ifdef X8632
144/* Assume rational <i386/ucontext.h> */
145/* Sadly, we can't make that assumption, since Apple renamed things
146   for Leopard. Yow!  Are we standards-compliant yet ? */
147/* In the long term, we probably want to use the leopard-compliant
148   names (with leading __ prefixes).  In the shorter term, we want
149   kernels compiled on Leopard to run on Tiger (and not reference
150   foo$UNIX2003 and similar nonsense, and that means getting the old
151   names (without leading __ prefixes.)  Confused yet ? */
152
153/* #if STILL_SUPPORT_TIGER */
154#define __ss ss
155#define __ds ds
156#define __es es
157#define __cs cs
158#define __fs fs
159#define __gs gs
160#define __eax eax
161#define __esp esp
162#define __eip eip
163#define __eflags eflags
164#define __fpu_xmm0 fpu_xmm0
165#define __fpu_mxcsr fpu_mxcsr
166#define __fpu_stmm0 fpu_stmm0
167#define __err err
168#define __faultvaddr faultvaddr
169/* #endif STILL_SUPPORT_TIGER */
170
171#define UC_MCONTEXT(UC) UC->uc_mcontext
172typedef mcontext_t MCONTEXT_T;
173typedef ucontext_t ExceptionInformation;
174#endif
175
176#endif /* #ifdef DARWIN */
177
178#ifdef LINUX
179typedef struct ucontext ExceptionInformation;
180#endif
181
182#ifdef FREEBSD
183typedef struct __ucontext ExceptionInformation;
184#endif
185
186#ifdef SOLARIS
187typedef struct ucontext ExceptionInformation;
188#endif
189
190#ifdef WINDOWS
191typedef CONTEXT ExceptionInformation;
192#endif
193
194typedef u32_t lisp_char_code;
195
196typedef int OSStatus, OSErr;
197#define noErr ((OSErr) 0)
198typedef int Boolean;
199typedef void *LogicalAddress;
200typedef char *Ptr, *BytePtr, *StringPtr;
201typedef unsigned int UInt32;
202
203
204
205#define true 1
206#define false 0
207
208#endif /*__lisptypes__ */
Note: See TracBrowser for help on using the repository browser.