~ubuntu-branches/ubuntu/wily/gargoyle-free/wily-proposed

« back to all changes in this revision

Viewing changes to tads/os.h

  • Committer: Bazaar Package Importer
  • Author(s): Sylvain Beucler
  • Date: 2009-09-11 20:09:43 UTC
  • Revision ID: james.westby@ubuntu.com-20090911200943-idgzoyupq6650zpn
Tags: upstream-2009-08-25
ImportĀ upstreamĀ versionĀ 2009-08-25

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/******************************************************************************
 
2
 *                                                                            *
 
3
 * Copyright (C) 2006-2009 by Tor Andersson.                                  *
 
4
 *                                                                            *
 
5
 * This file is part of Gargoyle.                                             *
 
6
 *                                                                            *
 
7
 * Gargoyle is free software; you can redistribute it and/or modify           *
 
8
 * it under the terms of the GNU General Public License as published by       *
 
9
 * the Free Software Foundation; either version 2 of the License, or          *
 
10
 * (at your option) any later version.                                        *
 
11
 *                                                                            *
 
12
 * Gargoyle is distributed in the hope that it will be useful,                *
 
13
 * but WITHOUT ANY WARRANTY; without even the implied warranty of             *
 
14
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the              *
 
15
 * GNU General Public License for more details.                               *
 
16
 *                                                                            *
 
17
 * You should have received a copy of the GNU General Public License          *
 
18
 * along with Gargoyle; if not, write to the Free Software                    *
 
19
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA *
 
20
 *                                                                            *
 
21
 *****************************************************************************/
 
22
 
 
23
/*
 
24
$Header: d:/cvsroot/tads/TADS2/OS.H,v 1.2 1999/05/17 02:52:12 MJRoberts Exp $
 
25
*/
 
26
 
 
27
/* 
 
28
 *   Copyright (c) 1991, 2002 Michael J. Roberts.  All Rights Reserved.
 
29
 *   
 
30
 *   Please see the accompanying license file, LICENSE.TXT, for information
 
31
 *   on using and copying this software.  
 
32
 */
 
33
/*
 
34
Name
 
35
  os.h - operating system definitions
 
36
Function
 
37
  Definitions that vary by operating system
 
38
Notes
 
39
  Do NOT put your system-specific definitions in this file, EXCEPT for
 
40
  your system-specific #include lines.
 
41
 
 
42
  We want to avoid piling up a huge tree of #ifdef's, since it's almost
 
43
  impossible to decipher such code.  Instead, we want to isolate all of
 
44
  the code for each platform in its own header file -- this way, it
 
45
  should be easy to figure out what code is compiled on each system.
 
46
 
 
47
  So, when porting this code to a new platform, you should first
 
48
  create an osxxx.h file for your platform (for example, on Windows,
 
49
  the file is oswin.h), then add to this file an ifdef'd include for
 
50
  your file, something like this:
 
51
 
 
52
    #ifdef _FROBNIX
 
53
    #include "osfrobnix.h"
 
54
    #endif
 
55
 
 
56
  These should generally be the ONLY lines in this file that pertain
 
57
  to your system.  Everything else for your system should be defined
 
58
  in your osxxx.h file.
 
59
 
 
60
  Also note that some definitions belong in your *hardware* file,
 
61
  rather than your operating system file.  Since many types of hardware
 
62
  have several operating systems, and many operating systems run on
 
63
  more than one type of hardware, definitions that pertain to a
 
64
  particular type of hardware should be isolated in a separate file.
 
65
  So, if you're adding a new hardware platform as well as (or instead
 
66
  of) a new operating system, you should create a new h_xxx.h file
 
67
  (in the "hardware" source subdirectory), and add an include line
 
68
  like this:
 
69
 
 
70
    #ifdef _M_BANANA_3000
 
71
    #include "h_b3000.h"
 
72
    #endif
 
73
 
 
74
  Note that you may have to adjust your makefile's CFLAGS so that
 
75
  the proper hardware and software configuration is selected via -D
 
76
  options (or your local equivalent).
 
77
Modified
 
78
  10/17/98 MJRoberts  - creation (from TADS 2 os.h, los.h, etc)
 
79
*/
 
80
 
 
81
#ifndef OS_INCLUDED
 
82
#define OS_INCLUDED
 
83
 
 
84
/*
 
85
 *   For C++ files, define externals with C linkage 
 
86
 */
 
87
#ifdef __cplusplus
 
88
extern "C" {
 
89
#endif
 
90
 
 
91
 
 
92
/* ------------------------------------------------------------------------ */
 
93
/*
 
94
 *   Include the appropriate hardware-specific header. 
 
95
 */
 
96
 
 
97
#ifdef __ppc__
 
98
#define _M_PPC
 
99
#else
 
100
#ifdef __x86_64__
 
101
#define _M_IX86_64
 
102
#else
 
103
#define _M_IX86
 
104
#endif
 
105
#endif
 
106
 
 
107
/*
 
108
 *   Intel x86 processors - 32-bit
 
109
 */
 
110
#ifdef _M_IX86
 
111
#include "h_ix86.h"
 
112
#endif
 
113
 
 
114
/*
 
115
 *   Intel x86 processors - 64-bit 
 
116
 */
 
117
#ifdef _M_IX86_64
 
118
#include "h_ix86_64.h"
 
119
#endif
 
120
 
 
121
/*
 
122
 *   PowerPC CPU's 
 
123
 */
 
124
#ifdef _M_PPC
 
125
#include "h_ppc.h"
 
126
#endif
 
127
 
 
128
/*
 
129
 *   Qt.  This isn't *truly* a hardware platform, but it looks like one to
 
130
 *   us, because it provides its own hardware virtualization scheme.  Rather
 
131
 *   than trying to figure out what sort of physical hardware we're
 
132
 *   targeting, we can simply define our hardware virtualization macros and
 
133
 *   functions in terms of Qt's hardware virtualization APIs, and let Qt take
 
134
 *   care of providing the target-specific implementation of those APIs.  
 
135
 */
 
136
#ifdef _M_QT
 
137
#include "h_qt.h"
 
138
#endif
 
139
 
 
140
/* add others here */
 
141
 
 
142
/* ------------------------------------------------------------------------ */
 
143
/*
 
144
 *   Include the portable OS interface type definitions.  These types can
 
145
 *   be used within OS-specific headers, so this type definitions header
 
146
 *   must be included before any of the OS-specific headers.  
 
147
 */
 
148
#include "osifctyp.h"
 
149
 
 
150
 
 
151
/* ------------------------------------------------------------------------ */
 
152
/*
 
153
 *   Include the appropriate OS-specific header.  We switch on system type
 
154
 *   here to avoid a big pile of ifdef's for each system scattered among
 
155
 *   all of the headers, and instead just select one big file for each
 
156
 *   system-specific definitions.  
 
157
 */
 
158
 
 
159
#ifdef GARGOYLE
 
160
#include "osansi.h"
 
161
#else
 
162
 
 
163
#ifdef _WIN32
 
164
# include "oswin.h"
 
165
#endif
 
166
#ifdef __MSDOS__
 
167
# ifdef __WIN32__
 
168
/* Windows-specific definitions are in oswin.h */
 
169
#  include "oswin.h"
 
170
# else
 
171
#  ifdef MSOS2
 
172
/* OS/2-specific definnitions are in osos2.h */
 
173
#   include "osos2.h"
 
174
#  else
 
175
/* DOS-specific definitions are in osdos.h */
 
176
#   include "osdos.h"
 
177
#  endif
 
178
# endif
 
179
#endif
 
180
 
 
181
#ifdef MAC_OS
 
182
/* macintosh definitions (Mac OS <=9) are in osmac.h */
 
183
#include "osmac.h"
 
184
#endif
 
185
 
 
186
#ifdef MAC_OS_X
 
187
/* macintosh OS X definitions are in osmacosx.h */
 
188
#include "osmacosx.h"
 
189
#endif
 
190
 
 
191
#ifdef UNIX
 
192
/* unix definitions are in osunixt.h */
 
193
#include "osunixt.h"
 
194
#endif
 
195
 
 
196
#ifdef ATARI
 
197
/* Atari ST definitions are in osatari.h */
 
198
#include "osatari.h"
 
199
#endif
 
200
 
 
201
#ifdef GLK
 
202
/* glk definitions are in os_glk.h */
 
203
#include "os_glk.h"
 
204
#endif
 
205
 
 
206
#ifdef __BEOS__
 
207
#include "osbeos.h"
 
208
#endif
 
209
 
 
210
#ifdef TROLLTECH_QT
 
211
/* Qt-specific definitions are in osqt.h */
 
212
#include "osqt.h"
 
213
#endif
 
214
 
 
215
#ifdef FROBTADS
 
216
/* 
 
217
 *   FrobTADS definitions are in osfrobtads.h.  (FrobTADS isn't really an OS,
 
218
 *   but from our perspective it looks like one, since it implements the
 
219
 *   various osifc entrypoints.  FrobTADS further virtualizes access to
 
220
 *   several Curses-style terminal i/o APIs, but we don't care about that; we
 
221
 *   just care that it provides our osifc implementations.)  
 
222
 */
 
223
#include "osfrobtads.h"
 
224
#endif
 
225
 
 
226
#endif /* SPATTERLIGHT */
 
227
 
 
228
/* **************** add other systems here **************** */
 
229
 
 
230
 
 
231
/*
 
232
 *   Done with C linkage section (osifc.h has its own)
 
233
 */
 
234
#ifdef __cplusplus
 
235
}
 
236
#endif
 
237
 
 
238
 
 
239
/* ------------------------------------------------------------------------ */
 
240
/*
 
241
 *   Include the generic interface definitions for routines that must be
 
242
 *   implemented separately on each platform.
 
243
 *   
 
244
 *   Note that we include this file *after* including the system-specific
 
245
 *   osxxx.h header -- this allows definitions in the osxxx.h header to
 
246
 *   override certain defaults in osifc.h by #defining symbols to indicate
 
247
 *   to osifc.h that it should not include the defaults.  Refer to osifc.h
 
248
 *   for details of such overridable definitions.  
 
249
 */
 
250
#include "osifc.h"
 
251
 
 
252
 
 
253
/* ------------------------------------------------------------------------ */
 
254
/*
 
255
 *   If the system "long description" (for the banner) isn't defined,
 
256
 *   make it the same as the platform ID string.  
 
257
 */
 
258
#ifndef OS_SYSTEM_LDESC
 
259
# define OS_SYSTEM_LDESC  OS_SYSTEM_NAME
 
260
#endif
 
261
 
 
262
#endif /* OS_INCLUDED */
 
263