1 /* $Id$
2  *  DJGPP version of GNU C on DOS compiler-specific declarations
3  *
4  * HUSKYLIB: common defines, types and functions for HUSKY
5  *
6  * This is part of The HUSKY Fidonet Software project:
7  * see http://husky.sourceforge.net for details
8  *
9  *
10  * HUSKYLIB is free software; you can redistribute it and/or
11  * modify it under the terms of the GNU Lesser General Public
12  * License as published by the Free Software Foundation; either
13  * version 2 of the License, or (at your option) any later version.
14  *
15  * HUSKYLIB is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
18  * General Public License for more details.
19  *
20  * You should have received a copy of the GNU Lesser General Public
21  * License along with this library; see file COPYING. If not, write to the
22  * Free Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23  *
24  * See also http://www.gnu.org, license may be found here.
25  */
26 
27 /* DJGPP for MS-DOS (DPMI, GNU C) */
28 
29 #ifndef HUSKY_DJGPP_H
30 #define HUSKY_DJGPP_H
31 
32 #ifndef __GNUC__
33   #error This file may be used only with GNU C !
34 #endif
35 
36 #ifndef __DJGPP__
37   #error This file may be used only with DJGPP version of GNU C on DOS !
38 #endif
39 
40 
41 #ifndef __LITTLE_ENDIAN__
42 #  define __LITTLE_ENDIAN__  /* using to select functions/macroses for read & write binary values */
43 #endif
44 
45 #  ifndef __FLAT__
46 #    define __FLAT__  /* DOS flat memory */
47 #  endif
48 
49 #  if defined(__UNIX__) || defined(__unix__) || defined(unix)
50      /* GCC predefined - buggi */
51 #    undef __unix__
52 #    undef unix
53 #    undef _unix
54 #    undef __UNIX__
55 #    undef UNIX
56 #    undef _UNIX
57 #  endif
58 
59 #  define _stdc
60 #  define _intr
61 #  define _intcast
62 #  define _veccast
63 #  define _fast
64 #  define _loadds
65 
66 #  define cdecl
67 #  define pascal
68 #  define near
69 /*#  undef  far*/
70 #  define far
71 #  define _XPENTRY
72 
73 #  define farread read
74 #  define farwrite write
75 
76 #  define mymkdir(a) mkdir((a), 0)
77 
78 #  if defined(__dj_include_fcntl_h_) && !defined( SH_DENYNONE)
79 #    ifdef  SH_DENYNO
80 #      define SH_DENYNONE SH_DENYNO
81 #    else
82 #      define SH_DENYNONE 0
83 #    endif
84 #  endif
85 
86 #  include <unistd.h>
87 #  include <io.h>
88 #  define mysleep(x) sleep(x)
89 #  define HAS_sleep     1
90 
91 #  define HAS_spawnvp   1   /* spawnvp() in process.h */
92 #  define HAS_strftime  1   /* strftime() in time.h  */
93 #  define HAS_mktime    1   /* mktime() in time.h */
94 #  define HAS_popen_close 1 /* popen(); pclose() */
95 #  define HAS_sopen     4   /* sopen() : in io.h, 4 parameters */
96 
97 #  define HAS_DIR_H     1   /* use "#include <dir.h>" for findfirst() etc. */
98 #  define HAS_DIRENT_H  1   /* use "#include <dirent.h>" for DIR, opendir() etc. */
99 #  define HAS_DIRECT_H  1   /* use "#include <direct.h>" for DIR, opendir() etc. */
100 #  define HAS_DOS_H     1
101 #  define HAS_DPMI_H    1
102 #  define HAS_IO_H      1   /* use "#include <io.h> */
103 #  define HAS_SHARE_H   1   /* may use "#include <share.h> */
104 #  define HAS_UNISTD_H  1   /* use "#include <unistd.h> */
105 #  define HAS_SIGNAL_H  1   /* <signal.h> */
106 #  define HAS_PROCESS_H 1   /* may use "#include <process.h> */
107 #  define HAS_UTIME_H   1
108 
109 #  define USE_STAT_MACROS
110 
111 #  define HAS_SYS_PARAM_H /* may use "#include <sys/param.h> */
112 
113 #  ifndef LONG_MAX
114 #    include <limits.h>
115 #  endif
116 
117 typedef unsigned bit;
118 
119 typedef unsigned char byte;
120 typedef signed char sbyte;
121 
122 typedef unsigned short word;
123 typedef signed short sword;
124 
125 typedef unsigned long dword;
126 typedef signed long sdword;
127 
128 typedef signed short sshort;
129 typedef unsigned short ushort;
130 
131 typedef signed long slong;
132 typedef unsigned long ulong;
133 
134 
135 typedef   signed char        hCHAR;              /*  1 byte */
136 typedef   signed char       hSCHAR;              /*  1 byte */
137 typedef unsigned char       hUCHAR;              /*  1 byte */
138 
139 typedef   signed char        hINT8;              /*  1 byte */
140 typedef   signed char       hSINT8;              /*  1 byte */
141 typedef unsigned char       hUINT8;              /*  1 byte */
142 
143 typedef   signed short      hINT16;              /*  2 bytes */
144 typedef   signed short     hSINT16;              /*  2 bytes */
145 typedef unsigned short     hUINT16;              /*  2 bytes */
146 
147 typedef   signed int        hINT32;              /*  4 bytes */
148 typedef   signed int       hSINT32;              /*  4 bytes */
149 typedef unsigned int       hUINT32;              /*  4 bytes */
150 
151 /* Not all GCC support this, test please (Stas Degteff) */
152 typedef   signed long long  hINT64;              /*  8 bytes */
153 typedef   signed long long hSINT64;              /*  8 bytes */
154 typedef unsigned long long hUINT64;              /*  8 bytes */
155 #define HAS_INT64
156 
157 #endif
158