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

« back to all changes in this revision

Viewing changes to tads/tads2/msdos/osdos.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
/* $Header: d:/cvsroot/tads/TADS2/msdos/OSDOS.H,v 1.4 1999/07/11 00:46:37 MJRoberts Exp $ */
 
2
 
 
3
/* 
 
4
 *   Copyright (c) 1998, 2002 Michael J. Roberts.  All Rights Reserved.
 
5
 *   
 
6
 *   Please see the accompanying license file, LICENSE.TXT, for information
 
7
 *   on using and copying this software.  
 
8
 */
 
9
/*
 
10
Name
 
11
  osdos.h - MS-DOS system definitions
 
12
Function
 
13
  
 
14
Notes
 
15
  
 
16
Modified
 
17
  10/17/98 MJRoberts  - Creation
 
18
*/
 
19
 
 
20
#ifndef OSDOS_H
 
21
#define OSDOS_H
 
22
 
 
23
#ifdef __cplusplus
 
24
extern "C" {
 
25
#endif
 
26
 
 
27
/* include general DOS/Windows definitions */
 
28
#include "osdosbas.h"
 
29
 
 
30
/* ------------------------------------------------------------------------ */
 
31
/*
 
32
 *   System name and long desription (for banner)
 
33
 */
 
34
#ifdef DJGPP
 
35
# define OS_SYSTEM_NAME  "DJGPP"
 
36
#else
 
37
# define OS_SYSTEM_NAME  "MSDOS"
 
38
#endif
 
39
 
 
40
#define OS_SYSTEM_LDESC "MS-DOS"
 
41
 
 
42
 
 
43
/* ------------------------------------------------------------------------ */
 
44
/*
 
45
 *   File Opening - use stdio
 
46
 */
 
47
 
 
48
/* newline sequence - DOS/Windows use CR-LF */
 
49
#define OS_NEWLINE_SEQ  "\r\n"
 
50
 
 
51
/* open text file for reading; returns NULL on error */
 
52
/* osfildef *osfoprt(const char *fname, os_filetype_t typ); */
 
53
#define osfoprt(fname, typ) fopen(fname, "r")
 
54
 
 
55
/* open text file for 'volatile' reading; returns NULL on error */
 
56
/* osfildef *osfoprtv(const char *fname, os_filetype_t typ); */
 
57
#define osfoprtv(fname, typ) osfoprt(fname, typ)
 
58
 
 
59
/* open text file for writing; returns NULL on error */
 
60
/* osfildef *osfopwt(const char *fname, os_filetype_t typ); */
 
61
#define osfopwt(fname, typ) fopen(fname, "w")
 
62
 
 
63
/* open text file for reading/writing; don't truncate */
 
64
osfildef *osfoprwt(const char *fname, os_filetype_t typ);
 
65
 
 
66
/* open text file for reading/writing; truncate; returns NULL on error */
 
67
/* osfildef *osfoprwtt(const char *fname, os_filetype_t typ); */
 
68
#define osfoprwtt(fname, typ) fopen(fname, "w+")
 
69
 
 
70
/* open binary file for writing; returns NULL on error */
 
71
/* osfildef *osfopwb(const char *fname, os_filetype_t typ); */
 
72
#define osfopwb(fname, typ) fopen(fname, "wb")
 
73
 
 
74
/* open SOURCE file for reading - use appropriate text/binary mode */
 
75
/* osfildef *osfoprs(const char *fname, os_filetype_t typ); */
 
76
#define osfoprs(fname, typ) fopen(fname, "rb")
 
77
 
 
78
/* open binary file for reading; returns NULL on erorr */
 
79
/* osfildef *osfoprb(const char *fname, os_filetype_t typ); */
 
80
#define osfoprb(fname, typ) fopen(fname, "rb")
 
81
 
 
82
/* open binary file for 'volatile' reading; returns NULL on erorr */
 
83
/* osfildef *osfoprbv(const char *fname, os_filetype_t typ); */
 
84
#define osfoprbv(fname, typ) osfoprb(fname, typ)
 
85
 
 
86
/* open binary file for reading/writing; don't truncate */
 
87
osfildef *osfoprwb(const char *fname, os_filetype_t typ);
 
88
 
 
89
/* open binary file for reading/writing; truncate; returns NULL on error */
 
90
/* osfildef *osfoprwtb(const char *fname, os_filetype_t typ); */
 
91
#define osfoprwtb(fname, typ) fopen(fname, "w+b")
 
92
 
 
93
 
 
94
 
 
95
/* ------------------------------------------------------------------------ */
 
96
/*
 
97
 *   Set "busy" cursor on/off.  For systems with a mouse cursor, set the
 
98
 *   cursor to an appropriate shape to notify the user that the system is
 
99
 *   busy.  Does nothing on DOS.
 
100
 */
 
101
/* void os_csr_busy(int show_as_busy); */
 
102
#define os_csr_busy(show_as_busy)
 
103
 
 
104
 
 
105
/* ------------------------------------------------------------------------ */
 
106
/*
 
107
 *   If error messages are to be included in the executable, define
 
108
 *   ERR_LINK_MESSAGES.  Otherwise, they'll be read from an external
 
109
 *   file that is to be opened with oserrop().
 
110
 */
 
111
#ifdef DJGPP
 
112
#define ERR_LINK_MESSAGES
 
113
#endif
 
114
 
 
115
 
 
116
/* ------------------------------------------------------------------------ */
 
117
/* 
 
118
 *   Update progress display with linfdef info, if appropriate.  This can
 
119
 *   be used to provide a status display during compilation.  Most
 
120
 *   command-line implementations will just ignore this notification; this
 
121
 *   can be used for GUI compiler implementations to provide regular
 
122
 *   display updates during compilation to show the progress so far.  
 
123
 */
 
124
#define os_progress(fname, linenum)
 
125
 
 
126
 
 
127
/* ------------------------------------------------------------------------ */
 
128
/*
 
129
 *   Single/double quote matching macros.  Used to allow systems with
 
130
 *   extended character codes with weird quote characters (such as Mac) to
 
131
 *   match the weird characters. 
 
132
 */
 
133
#define os_squote(c) ((c) == '\'')
 
134
#define os_dquote(c) ((c) == '"')
 
135
#define os_qmatch(a, b) ((a) == (b))
 
136
 
 
137
 
 
138
/* ------------------------------------------------------------------------ */
 
139
/*
 
140
 *   on 16-bit protected-mode DOS, we need to check manually for break, so
 
141
 *   do this in os_yield; on other DOS versions, we don't need to do
 
142
 *   anything in os_yield 
 
143
 */
 
144
#ifdef MSDOS
 
145
# ifndef __DPMI16__
 
146
#  define os_yield()  FALSE
 
147
# endif
 
148
#endif
 
149
 
 
150
 
 
151
/* ------------------------------------------------------------------------ */
 
152
/* 
 
153
 *   theoretical maximum osmalloc size is all of memory 
 
154
 */
 
155
#ifdef __32BIT__
 
156
# define OSMALMAX 0xffffffffL
 
157
#else /* !__32BIT__ */
 
158
# define OSMALMAX 0xffffL
 
159
#endif /* __32BIT__ */
 
160
 
 
161
 
 
162
/* ------------------------------------------------------------------------ */
 
163
/*
 
164
 *   Usage lines - for protected mode, we use different names for the
 
165
 *   executables, so reflect that in the usage lines.  This isn't needed
 
166
 *   for the real-mode DOS versions, since they use the deault command
 
167
 *   names.  
 
168
 */
 
169
#ifdef __DPMI16__
 
170
# define OS_TC_USAGE  "usage: tcx [options] file"
 
171
# define OS_TR_USGAE  "usage: trx [options] file"
 
172
# define OS_TDB_USAGE  "usage: tdbx [options] file"
 
173
#endif
 
174
 
 
175
/* add the special TR option messages */
 
176
#define ERR_TRUS_OS_FIRST    ERR_TRUS_DOS_1
 
177
#define ERR_TRUS_OS_LAST     ERR_TRUS_DOS_L
 
178
 
 
179
/*
 
180
 *   If we're in 16-bit mode, either real or protected, reduce the default
 
181
 *   stack size, since the real system stack is very constrained for these
 
182
 *   executables.  (The interpreter consumes system stack in proportion to
 
183
 *   TADS stack space, so limiting the TADS stack will help ensure we
 
184
 *   don't overflow system stack.)  
 
185
 */
 
186
#ifndef __32BIT__
 
187
# define TRD_STKSIZ   100
 
188
# define TRD_STKSIZ_MSG  "  -ms size      stack size (default 100 elements)"
 
189
#endif
 
190
 
 
191
 
 
192
#ifdef DJGPP
 
193
# define OS_TC_USAGE  "usage: tadsc [options] file"
 
194
# define OS_TR_USAGE  "usage: tadsr [options] file"
 
195
 
 
196
/*
 
197
 *   Make default buffer sizes huge, since we can be fairly liberal with
 
198
 *   memory on DJGPP 
 
199
 */
 
200
#include "osbigmem.h"
 
201
 
 
202
/*
 
203
 *   Swapping off by default, since DJGPP has virtual memory 
 
204
 */
 
205
# define OS_DEFAULT_SWAP_ENABLED  0
 
206
 
 
207
/*
 
208
 *   argv[0] required by dbgu.c 
 
209
 */
 
210
extern char *__dos_argv0;                                    /* from crt0.h */
 
211
# define ARG0 __dos_argv0
 
212
 
 
213
# ifndef TADS_OEM_NAME
 
214
#  define TADS_OEM_VERSION  "0"
 
215
#  define OS_SYSTEM_PATCHSUBLVL  "0"
 
216
#  define TADS_OEM_NAME  "jim.dunleavy@erha.ie"
 
217
# endif
 
218
#endif /* DJGPP */
 
219
 
 
220
 
 
221
#ifdef __cplusplus
 
222
}
 
223
#endif
 
224
 
 
225
#endif /* OSDOS_H */
 
226