1 |
cebix |
1.1 |
/* |
2 |
|
|
* sysdeps.h - System dependent definitions for Linux |
3 |
|
|
* |
4 |
|
|
* SheepShaver (C) 1997-2002 Christian Bauer and Marc Hellwig |
5 |
|
|
* |
6 |
|
|
* This program is free software; you can redistribute it and/or modify |
7 |
|
|
* it under the terms of the GNU General Public License as published by |
8 |
|
|
* the Free Software Foundation; either version 2 of the License, or |
9 |
|
|
* (at your option) any later version. |
10 |
|
|
* |
11 |
|
|
* This program 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 |
14 |
|
|
* GNU General Public License for more details. |
15 |
|
|
* |
16 |
|
|
* You should have received a copy of the GNU General Public License |
17 |
|
|
* along with this program; if not, write to the Free Software |
18 |
|
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
19 |
|
|
*/ |
20 |
|
|
|
21 |
|
|
#ifndef SYSDEPS_H |
22 |
|
|
#define SYSDEPS_H |
23 |
|
|
|
24 |
|
|
#ifndef __STDC__ |
25 |
|
|
#error "Your compiler is not ANSI. Get a real one." |
26 |
|
|
#endif |
27 |
|
|
|
28 |
|
|
#include "config.h" |
29 |
|
|
#include "user_strings_unix.h" |
30 |
|
|
|
31 |
|
|
#ifndef STDC_HEADERS |
32 |
|
|
#error "You don't have ANSI C header files." |
33 |
|
|
#endif |
34 |
|
|
|
35 |
|
|
#ifdef HAVE_UNISTD_H |
36 |
|
|
# include <sys/types.h> |
37 |
|
|
# include <unistd.h> |
38 |
|
|
#endif |
39 |
|
|
|
40 |
|
|
#include <netinet/in.h> |
41 |
|
|
#include <assert.h> |
42 |
|
|
#include <stdio.h> |
43 |
|
|
#include <stdlib.h> |
44 |
|
|
#include <string.h> |
45 |
|
|
#include <signal.h> |
46 |
|
|
|
47 |
|
|
#ifdef HAVE_FCNTL_H |
48 |
|
|
# include <fcntl.h> |
49 |
|
|
#endif |
50 |
|
|
|
51 |
|
|
#ifdef TIME_WITH_SYS_TIME |
52 |
|
|
# include <sys/time.h> |
53 |
|
|
# include <time.h> |
54 |
|
|
#else |
55 |
|
|
# ifdef HAVE_SYS_TIME_H |
56 |
|
|
# include <sys/time.h> |
57 |
|
|
# else |
58 |
|
|
# include <time.h> |
59 |
|
|
# endif |
60 |
|
|
#endif |
61 |
|
|
|
62 |
|
|
// Are we using a PPC emulator or the real thing? |
63 |
|
|
#ifdef __powerpc__ |
64 |
|
|
#define EMULATED_PPC 0 |
65 |
|
|
#else |
66 |
|
|
#define EMULATED_PPC 1 |
67 |
|
|
#endif |
68 |
|
|
|
69 |
|
|
#define POWERPC_ROM 1 |
70 |
|
|
|
71 |
|
|
// Data types |
72 |
|
|
typedef unsigned char uint8; |
73 |
|
|
typedef signed char int8; |
74 |
|
|
#if SIZEOF_SHORT == 2 |
75 |
|
|
typedef unsigned short uint16; |
76 |
|
|
typedef short int16; |
77 |
|
|
#elif SIZEOF_INT == 2 |
78 |
|
|
typedef unsigned int uint16; |
79 |
|
|
typedef int int16; |
80 |
|
|
#else |
81 |
|
|
#error "No 2 byte type, you lose." |
82 |
|
|
#endif |
83 |
|
|
#if SIZEOF_INT == 4 |
84 |
|
|
typedef unsigned int uint32; |
85 |
|
|
typedef int int32; |
86 |
|
|
#elif SIZEOF_LONG == 4 |
87 |
|
|
typedef unsigned long uint32; |
88 |
|
|
typedef long int32; |
89 |
|
|
#else |
90 |
|
|
#error "No 4 byte type, you lose." |
91 |
|
|
#endif |
92 |
|
|
#if SIZEOF_LONG == 8 |
93 |
|
|
typedef unsigned long uint64; |
94 |
|
|
typedef long int64; |
95 |
|
|
#elif SIZEOF_LONG_LONG == 8 |
96 |
|
|
typedef unsigned long long uint64; |
97 |
|
|
typedef long long int64; |
98 |
|
|
#else |
99 |
|
|
#error "No 8 byte type, you lose." |
100 |
|
|
#endif |
101 |
|
|
|
102 |
|
|
// Time data type for Time Manager emulation |
103 |
|
|
#ifdef HAVE_CLOCK_GETTIME |
104 |
|
|
typedef struct timespec tm_time_t; |
105 |
|
|
#else |
106 |
|
|
typedef struct timeval tm_time_t; |
107 |
|
|
#endif |
108 |
|
|
|
109 |
cebix |
1.2 |
// Setup pthread attributes |
110 |
|
|
extern void Set_pthread_attr(pthread_attr_t *attr, int priority); |
111 |
|
|
|
112 |
cebix |
1.1 |
// Various definitions |
113 |
|
|
typedef struct rgb_color { |
114 |
|
|
uint8 red; |
115 |
|
|
uint8 green; |
116 |
|
|
uint8 blue; |
117 |
|
|
uint8 alpha; |
118 |
|
|
} rgb_color; |
119 |
|
|
|
120 |
|
|
// Macro for calling MacOS routines |
121 |
|
|
#define CallMacOS(type, tvect) call_macos((uint32)tvect) |
122 |
|
|
#define CallMacOS1(type, tvect, arg1) call_macos1((uint32)tvect, (uint32)arg1) |
123 |
|
|
#define CallMacOS2(type, tvect, arg1, arg2) call_macos2((uint32)tvect, (uint32)arg1, (uint32)arg2) |
124 |
|
|
#define CallMacOS3(type, tvect, arg1, arg2, arg3) call_macos3((uint32)tvect, (uint32)arg1, (uint32)arg2, (uint32)arg3) |
125 |
|
|
#define CallMacOS4(type, tvect, arg1, arg2, arg3, arg4) call_macos4((uint32)tvect, (uint32)arg1, (uint32)arg2, (uint32)arg3, (uint32)arg4) |
126 |
|
|
#define CallMacOS5(type, tvect, arg1, arg2, arg3, arg4, arg5) call_macos5((uint32)tvect, (uint32)arg1, (uint32)arg2, (uint32)arg3, (uint32)arg4, (uint32)arg5) |
127 |
|
|
#define CallMacOS6(type, tvect, arg1, arg2, arg3, arg4, arg5, arg6) call_macos6((uint32)tvect, (uint32)arg1, (uint32)arg2, (uint32)arg3, (uint32)arg4, (uint32)arg5, (uint32)arg6) |
128 |
|
|
#define CallMacOS7(type, tvect, arg1, arg2, arg3, arg4, arg5, arg6, arg7) call_macos7((uint32)tvect, (uint32)arg1, (uint32)arg2, (uint32)arg3, (uint32)arg4, (uint32)arg5, (uint32)arg6, (uint32)arg7) |
129 |
|
|
|
130 |
|
|
extern "C" uint32 call_macos(uint32 tvect); |
131 |
|
|
extern "C" uint32 call_macos1(uint32 tvect, uint32 arg1); |
132 |
|
|
extern "C" uint32 call_macos2(uint32 tvect, uint32 arg1, uint32 arg2); |
133 |
|
|
extern "C" uint32 call_macos3(uint32 tvect, uint32 arg1, uint32 arg2, uint32 arg3); |
134 |
|
|
extern "C" uint32 call_macos4(uint32 tvect, uint32 arg1, uint32 arg2, uint32 arg3, uint32 arg4); |
135 |
|
|
extern "C" uint32 call_macos5(uint32 tvect, uint32 arg1, uint32 arg2, uint32 arg3, uint32 arg4, uint32 arg5); |
136 |
|
|
extern "C" uint32 call_macos6(uint32 tvect, uint32 arg1, uint32 arg2, uint32 arg3, uint32 arg4, uint32 arg5, uint32 arg6); |
137 |
|
|
extern "C" uint32 call_macos7(uint32 tvect, uint32 arg1, uint32 arg2, uint32 arg3, uint32 arg4, uint32 arg5, uint32 arg6, uint32 arg7); |
138 |
|
|
|
139 |
|
|
#endif |