4 * This symbol, if defined, indicates that the ioctl() routine is
5 * available to set I/O characteristics
10 * This symbol, if defined, indicates that the routine utime() is
11 * available to update the access and modification times of files.
13 #define HAS_UTIME /**/
20 * This symbol, if defined, indicates that the program should
21 * use the routine my_binmode(FILE *fp, char iotype) to insure
22 * that a file is in "binary" mode -- that is, that no translation
23 * of bytes occurs on read or write operations.
28 * This symbol is defined if this system has a stat structure declaring
31 #define USE_STAT_RDEV /**/
34 * This symbol, if defined, indicates that error messages should be
35 * should be generated in a format that allows the use of the Acme
36 * GUI/editor's autofind feature.
41 * This symbol, if defined, contains a "magic" string which may be used
42 * as the first line of a Perl program designed to be executed directly
43 * by name, instead of the standard Unix #!. If ALTERNATE_SHEBANG
44 * begins with a character other then #, then Perl will only treat
45 * it as a command line if if finds the string "perl" in the first
46 * word; otherwise it's treated as the first line of code in the script.
47 * (IOW, Perl won't hand off to another interpreter via an alternate
48 * shebang sequence that might be legal Perl code.)
50 /* #define ALTERNATE_SHEBANG "#!" / **/
53 # define SIGABRT SIGILL
56 # define SIGILL 6 /* blech */
58 #define ABORT() kill(getpid(),SIGABRT);
60 #define BIT_BUCKET "/dev/nul" /* Will this work? */
62 #if defined(I_SYS_UN) && !defined(TCPIPV4)
63 /* It is not working without TCPIPV4 defined. */
69 #define PERL_SYS_INIT(argcp, argvp) STMT_START { \
70 _response(argcp, argvp); \
71 _wildcard(argcp, argvp); \
72 Perl_OS2_init(); } STMT_END
74 #define PERL_SYS_TERM()
76 /* #define PERL_SYS_TERM() STMT_START { \
77 if (Perl_HAB_set) WinTerminate(Perl_hab); } STMT_END */
79 #define dXSUB_SYS int fake = OS2_XS_init()
82 /* # define HAS_FORK */
83 /* # define HIDEMYMALLOC */
84 /* # define PERL_SBRK_VIA_MALLOC */ /* gets off-page sbrk... */
85 #else /* !PERL_IS_AOUT */
88 # define USE_PERL_SBRK
93 # define SYSTEM_ALLOC(a) sys_alloc(a)
95 void *sys_alloc(int size);
97 #endif /* !PERL_IS_AOUT */
98 #if !defined(PERL_CORE) && !defined(PerlIO) /* a2p */
102 #define TMPPATH tmppath
103 #define TMPPATH1 "plXXXXXX"
104 extern char *tmppath;
105 PerlIO *my_syspopen(char *cmd, char *mode);
106 /* Cannot prototype with I32 at this point. */
107 int my_syspclose(PerlIO *f);
108 FILE *my_tmpfile (void);
109 char *my_tmpnam (char *);
111 #define tmpfile my_tmpfile
112 #define tmpnam my_tmpnam
113 #define isatty _isterm
115 #define srand srandom
118 * fwrite1() should be a routine with the same calling sequence as fwrite(),
119 * but which outputs all of the bytes requested as a single stream (unlike
120 * fwrite() itself, which on some systems outputs several distinct records
121 * if the number_of_items parameter is >1).
123 #define fwrite1 fwrite
125 #define my_getenv(var) getenv(var)
127 void *emx_calloc (size_t, size_t);
128 void emx_free (void *);
129 void *emx_malloc (size_t);
130 void *emx_realloc (void *, size_t);
132 /*****************************************************************************/
134 #include <stdlib.h> /* before the following definitions */
135 #include <unistd.h> /* before the following definitions */
137 #define chdir _chdir2
138 #define getcwd _getcwd2
140 /* This guy is needed for quick stdstd */
142 #if defined(USE_STDIO_PTR) && defined(STDIO_PTR_LVALUE) && defined(STDIO_CNT_LVALUE)
143 # define _filbuf _fill
144 /* Perl uses ungetc only with successful return */
145 # define ungetc(c,fp) \
146 (FILE_ptr(fp) > FILE_base(fp) && c == (int)*(FILE_ptr(fp) - 1) \
147 ? (--FILE_ptr(fp), ++FILE_cnt(fp), (int)c) : ungetc(c,fp))
150 #define OP_BINARY O_BINARY
152 #define OS2_STAT_HACK 1
155 #define Stat(fname,bufptr) os2_stat((fname),(bufptr))
156 #define Fstat(fd,bufptr) fstat((fd),(bufptr))
157 #define Fflush(fp) fflush(fp)
161 #define S_IFBLK 0120000
162 #define S_ISBLK(mode) (((mode) & S_IFMT) == S_IFBLK)
166 #define Stat(fname,bufptr) stat((fname),(bufptr))
167 #define Fstat(fd,bufptr) fstat((fd),(bufptr))
168 #define Fflush(fp) fflush(fp)
172 /* With SD386 it is impossible to debug register variables. */
173 #if !defined(PERL_IS_AOUT) && defined(DEBUGGING) && !defined(register)
177 /* Our private OS/2 specific data. */
179 typedef struct OS2_Perl_data {
184 unsigned long severity;
187 extern OS2_Perl_data_t OS2_Perl_data;
189 #define Perl_hab ((HAB)OS2_Perl_data.phab)
190 #define Perl_rc (OS2_Perl_data.rc)
191 #define Perl_severity (OS2_Perl_data.severity)
192 #define errno_isOS2 12345678
193 #define OS2_Perl_flags (OS2_Perl_data.flags)
194 #define Perl_HAB_set_f 1
195 #define Perl_HAB_set (OS2_Perl_flags & Perl_HAB_set_f)
196 #define set_Perl_HAB_f (OS2_Perl_flags |= Perl_HAB_set_f)
197 #define set_Perl_HAB(h) (set_Perl_HAB_f, Perl_hab = h)
198 #define OS2_XS_init() (*OS2_Perl_data.xs_init)()
199 /* The expressions below return true on error. */
200 /* INCL_DOSERRORS needed. rc should be declared outside. */
201 #define CheckOSError(expr) (!(rc = (expr)) ? 0 : (FillOSError(rc), 1))
202 /* INCL_WINERRORS needed. */
203 #define SaveWinError(expr) ((expr) ? : (FillWinError, 0))
204 #define CheckWinError(expr) ((expr) ? 0: (FillWinError, 1))
205 #define FillOSError(rc) (Perl_rc = rc, \
206 errno = errno_isOS2, \
207 Perl_severity = SEVERITY_ERROR)
208 #define FillWinError (Perl_rc = WinGetLastError(Perl_hab), \
209 errno = errno_isOS2, \
210 Perl_severity = ERRORIDSEV(Perl_rc), \
211 Perl_rc = ERRORIDERROR(Perl_rc))
212 #define Acquire_hab() if (!Perl_HAB_set) { \
213 Perl_hab = WinInitialize(0); \
214 if (!Perl_hab) die("WinInitialize failed"); \
218 #define STATIC_FILE_LENGTH 127
220 #define PERLLIB_MANGLE(s, n) perllib_mangle((s), (n))
221 char *perllib_mangle(char *, unsigned int);
223 char *os2error(int rc);
225 /* ************************************************************ */
226 #define Dos32QuerySysState DosQuerySysState
227 #define QuerySysState(flags, pid, buf, bufsz) \
228 Dos32QuerySysState(flags, 0, pid, 0, buf, bufsz)
230 #define QSS_PROCESS 1
232 #define QSS_SEMAPHORES 2
233 #define QSS_FILE 8 /* Buggy until fixpack18 */
234 #define QSS_SHARED 16
238 APIRET APIENTRY Dos32QuerySysState(ULONG func,ULONG arg1,ULONG pid,
239 ULONG _res_,PVOID buf,ULONG bufsz);
244 } QGLOBAL, *PQGLOBAL;
255 UCHAR _reserved1_; /* padding to ULONG */
256 USHORT _reserved2_; /* padding to ULONG */
257 } QTHREAD, *PQTHREAD;
272 typedef struct qfile {
300 } QPROCESS, *PQPROCESS;
302 typedef struct sema {
319 } QSEMSTRUC, *PQSEMSTRUC;
324 } QSEMOWNER32, *PQSEMOWNER32;
329 PVOID semrecs; /* array of associated sema's */
333 USHORT _reserved_; /* padding to ULONG */
334 } QSEMSMUX32, *PQSEMSMUX32;
342 } QSEMEV32, *PQSEMEV32;
351 USHORT _reserved_; /* padding to ULONG */
352 } QSEMMUX32, *PQSEMMUX32;
354 typedef struct semstr32 {
359 } QSEMSTRUC32, *PQSEMSTRUC32;
361 typedef struct shrmem {
367 } QSHRMEM, *PQSHRMEM;
369 typedef struct module {
378 } QMODULE, *PQMODULE;
384 PQSEMSTRUC32 sem32data;
389 } QTOPLEVEL, *PQTOPLEVEL;
390 /* ************************************************************ */
392 PQTOPLEVEL get_sysinfo(ULONG pid, ULONG flags);
394 #endif /* _OS2EMX_H */