source: branches/working-0711/ccl/lisp-kernel/lisptypes.h @ 7828

Last change on this file since 7828 was 7828, checked in by gb, 13 years ago

A little bit of Windows conditionalization.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 4.3 KB
Line 
1/*
2   Copyright (C) 1994-2001 Digitool, Inc
3   This file is part of OpenMCL. 
4
5   OpenMCL is licensed under the terms of the Lisp Lesser GNU Public
6   License , known as the LLGPL and distributed with OpenMCL as the
7   file "LICENSE".  The LLGPL consists of a preamble and the LGPL,
8   which is distributed with OpenMCL as the file "LGPL".  Where these
9   conflict, the preamble takes precedence. 
10
11   OpenMCL is referenced in the preamble as the "LIBRARY."
12
13   The LLGPL is also available online at
14   http://opensource.franz.com/preamble.html
15*/
16
17#ifndef __lisptypes__
18#define __lisptypes__
19
20#include <sys/types.h>
21#define WORD_SIZE 32
22#ifdef PPC64
23#undef WORD_SIZE
24#define WORD_SIZE 64
25#endif
26#ifdef X8664
27#undef WORD_SIZE
28#define WORD_SIZE 64
29#endif
30
31
32#include <stdint.h>
33
34#ifdef WIN64
35#include <windows.h>
36typedef long long s64_t;
37typedef unsigned long long u64_t;
38typedef signed long s32_t;
39typedef unsigned long u32_t;
40typedef signed short s16_t;
41typedef unsigned short u16_t;
42typedef signed char s8_t;
43typedef unsigned char u8_t;
44#else
45#ifdef SOLARIS
46/* Solaris doesn't laugh and play like the other children */
47typedef int64_t s64_t;
48typedef uint64_t u64_t;
49typedef int32_t s32_t;
50typedef uint32_t u32_t;
51typedef int16_t s16_t;
52typedef uint16_t u16_t;
53typedef int8_t s8_t;
54typedef uint8_t u8_t;
55#else
56typedef int64_t s64_t;
57typedef u_int64_t u64_t;
58typedef int32_t s32_t;
59typedef u_int32_t u32_t;
60typedef int16_t s16_t;
61typedef u_int16_t u16_t;
62typedef int8_t s8_t;
63typedef u_int8_t u8_t;
64#endif
65#endif
66
67#if WORD_SIZE == 64
68typedef u64_t LispObj;
69typedef u64_t natural;
70typedef s64_t signed_natural;
71typedef u64_t unsigned_of_pointer_size;
72#else
73typedef u32_t LispObj;
74typedef u32_t natural;
75typedef s32_t signed_natural;
76typedef u32_t unsigned_of_pointer_size;
77#endif
78
79
80#ifdef DARWIN
81#include <sys/signal.h>
82#include <sys/ucontext.h>
83
84#ifdef PPC
85#if WORD_SIZE == 64
86#ifdef _STRUCT_UCONTEXT64
87typedef _STRUCT_UCONTEXT64 ExceptionInformation;
88typedef _STRUCT_MCONTEXT64 *MCONTEXT_T;
89#else /* _STRUCT_UCONTEXT64 */
90typedef struct ucontext64 ExceptionInformation;
91typedef struct mcontext64 *MCONTEXT_T;
92#endif /* _STRUCT_UCONTEXT64 */
93#define UC_MCONTEXT(UC) UC->uc_mcontext64
94#else /* WORD_SIZE */
95#ifdef _STRUCT_UCONTEXT
96typedef _STRUCT_UCONTEXT ExceptionInformation;
97typedef _STRUCT_MCONTEXT *MCONTEXT_T;
98#else
99typedef struct ucontext ExceptionInformation;
100typedef struct mcontext *MCONTEXT_T;
101#endif
102#define UC_MCONTEXT(UC) UC->uc_mcontext
103#endif /* WORD_SIZE */
104#ifndef __DARWIN_UNIX03
105#define __DARWIN_UNIX03 0
106#endif
107#if !__DARWIN_UNIX03
108#define __ss ss
109#define __es es
110#define __fs fs
111#define __vs vs
112
113#define __r0 r0
114#define __r1 r1
115#define __r3 r3
116#define __r4 r4
117#define __r5 r5
118#define __r6 r6
119#define __r13 r13
120#define __srr0 srr0
121#define __srr1 srr1
122#define __lr lr
123#define __ctr ctr
124#define __xer xer
125#define __cr cr
126#define __dsisr dsisr
127#define __dar dar
128#define __exception exception
129#define __fpscr fpscr
130#define __fpregs fpregs
131#endif
132#endif /* PPC */
133
134#ifdef X8664
135/* Broken <i386/ucontext.h> in xcode 2.4 */
136#ifndef _STRUCT_MCONTEXT64 /* A guess at what'll be defined when this is fixed */
137struct mcontext64 {
138        x86_exception_state64_t __es;
139        x86_thread_state64_t    __ss;   
140        x86_float_state64_t     __fs;
141};
142
143typedef struct mcontext64 *MCONTEXT_T;
144typedef ucontext64_t ExceptionInformation;
145#define UC_MCONTEXT(UC) UC->uc_mcontext64
146#define __rax rax
147#define __fpu_mxcsr fpu_mxcsr
148#define __fpu_xmm0 fpu_xmm0
149#define __rsp rsp
150#define __faultvaddr faultvaddr
151#define __err err
152#define __rip rip
153#define __rsi rsi
154#define __rdi rdi
155#define __rdx rdx
156#define __rcx rcx
157#define __r8 r8
158#define __rflags rflags
159#else
160typedef mcontext_t MCONTEXT_T;
161typedef ucontext_t ExceptionInformation;
162#define UC_MCONTEXT(UC) UC->uc_mcontext
163#endif /* _STRUCT_MCONTEXT64 */
164#endif /* X86_64 */
165#endif /* #ifdef DARWIN */
166
167#ifdef LINUX
168typedef struct ucontext ExceptionInformation;
169#endif
170
171#ifdef FREEBSD
172typedef struct __ucontext ExceptionInformation;
173#endif
174
175#ifdef SOLARIS
176typedef struct ucontext ExceptionInformation;
177#endif
178
179#ifdef WIN64
180typedef EXCEPTION_POINTERS ExceptionInformation;
181#endif
182
183typedef u32_t lisp_char_code;
184
185typedef int OSStatus, OSErr;
186#define noErr ((OSErr) 0)
187typedef int Boolean;
188typedef void *LogicalAddress;
189typedef char *Ptr, *BytePtr, *StringPtr;
190typedef unsigned int UInt32;
191
192
193
194#define true 1
195#define false 0
196
197#endif /*__lisptypes__ */
Note: See TracBrowser for help on using the repository browser.