1 /* lt-defs.h	-- Henry Thompson
2  *
3  * $Header: /disk/b/cvsroot/ltg/LTXML/include/lt-defs.h,v 1.26 2005/10/22 19:57:28 ht Exp $
4  */
5 
6 #ifndef _LT_DEFS_H
7 #define _LT_DEFS_H
8 
9 #ifdef __BORLAND__
10 #define WIN32			/* Not tested on Borland */
11 #endif
12 
13 #if defined(WIN32) && ! defined(__CYGWIN__) /* I don't think CYGWIN defines WIN32 anymore */
14 #undef  HAVE_POPEN
15 #define HAVE_SYSTEM_P 1
16 #define HAVE_SYS_ERRLIST_DECL
17 #define sys_errlist _sys_errlist
18 #define NO_MAPMEM 1
19 #define caddr_t void*
20 #include <stdio.h>
21 #include <stdlib.h>
22 #include <io.h>
23 
24 #define SOCKETS_IMPLEMENTED
25 
26 #define getcwd _getcwd
27 #ifdef __GNUC__
28 /* we must be running after a configure */
29 #include "xmlconfig.h"
30 #else
31 #define off_t long
32 #define _OFF_T_DEFINED
33 #define STDC_HEADERS
34 #define FREE_VOID
35 #define HAVE_FILEUTIL_P
36 #define HAVE_FILEUTIL2_P
37 #define HAVE_FTRUNCATE_P
38 #define HAVE_GETCWD
39 #define X_OK 01   /* for access() */
40 #endif
41 #else
42 
43 #ifdef macintosh
44 
45  /* we adopt the Solaris convention for return values from lseek and co */
46 
47  #define off_t long
48 
49  /* Define if you have the ANSI C header files.  */
50  #define STDC_HEADERS 1
51  #define HAVE_FILEUTIL_P 1
52  #define HAVE_FILEUTIL2_P 1
53  #define HAVE_SYSTEM_P 1
54  #define HAVE_SYS_ERRLIST_DECL 1
55  #define FREE_VOID 1
56  #define HAVE_FTRUNCATE_P 1
57  /* Define if you have the fdopen function.  */
58  #define HAVE_FDOPEN 1
59 
60  /* Define if you have the fileno function.  */
61  #define HAVE_FILENO 1
62 
63  /* Define if you have the ftruncate function.  */
64  #define HAVE_FTRUNCATE 1
65 
66  /* Define if you have the getcwd function.  */
67  #define HAVE_GETCWD 1
68 
69  #define HAVE_GETWD 1
70   #ifdef HAVE_POPEN
71   #undef HAVE_POPEN
72   #endif
73  #define HAVE_PUTW 1
74  #define HAVE_STDLIB_H 1
75  #define HAVE_UNISTD_H 1
76  #define NO_MAPMEM 1
77 #else
78  /* neither mac nor WIN32 */
79  #define SOCKETS_IMPLEMENTED
80  #include <sys/types.h>
81  #include "xmlconfig.h"
82  #undef NO_MAPMEM
83  #ifdef __CYGWIN__
84   #define HAVE_SYS_ERRLIST_DECL
85   #define sys_errlist _sys_errlist
86  #endif
87 #endif /* macintosh */
88 #endif
89 
90 #ifdef HAVE_UNISTD_H
91 #include <unistd.h>
92 #endif
93 
94 #ifdef HAVE_STDARG_H
95 #include <stdarg.h>
96 #endif
97 
98  /* for DLL export under NT */
99 #define EXPRT
100 #define IMPRT
101 #define STD_API
102 #define WIN_IMP
103 
104 #if defined(WIN32) && ! defined(__CYGWIN__)
105  #ifdef __BORLAND__
106   #undef EXPRT
107   #undef IMPRT
108   #define EXPRT _export
109   #define IMPRT _import
110  #else
111   #undef STD_API
112   #ifdef _BUILD_STD
113    #define STD_API __declspec(dllexport)
114   #else
115    #define STD_API __declspec(dllimport)
116   #endif
117   #undef WIN_IMP
118   #define WIN_IMP __declspec(dllimport)
119  #endif
120 #endif
121 
122 /* Nothing works without this! */
123 #include "charset.h"
124 
125 #ifndef _dmck_defined_Bool_
126 typedef enum  {False=0, True=1} Bool;  /*andrei wants this */
127 #define _dmck_defined_Bool_ 1
128 #endif
129 
130 #ifndef HAVE_SYS_ERRLIST_DECL
131 extern char *sys_errlist[];
132 #endif
133 
134 #ifndef HAVE_FILEUTIL_P
135 /* non-ANSI file utilities from stdio.h */
136 #include <stdio.h>
137 extern int      putw(int, FILE *);
138 extern FILE     *popen(const char *, const char *);
139 extern int      pclose(FILE *);
140 extern void perror(const char *);
141 #ifndef fileno
142 extern int      fileno(FILE *);
143 #endif
144 extern FILE     *fdopen(int, const char *);
145 #endif
146 
147 #ifndef HAVE_FILEUTIL2_P
148 /* Another batch of non-ansi templates (needed on sunos) */
149 #include <stdio.h> /* Safe to include twice ? */
150 extern int fclose (FILE *);
151 extern int fflush (FILE *);
152 extern int fprintf (FILE *, const char *, ...); /* arghh */
153 extern int _flsbuf (unsigned int, FILE *);
154 extern int _filbuf (FILE *);
155 extern int fputs (const char *, FILE *);
156 extern int fseek (FILE *, long int, int);
157 extern int ungetc (int, FILE *);
158 extern __SIZE_TYPE__ fwrite (const void *, __SIZE_TYPE__ , __SIZE_TYPE__ , FILE *);
159 extern int putw(int w, FILE *stream);
160 #ifndef vfprintf
161 extern int vfprintf (FILE *, const char *, va_list);
162 #endif
163 #endif /* HAVE_FILEUTIL2_P */
164 
165 #ifndef HAVE_SYSTEM_P
166 extern int system(const char *string);
167 #endif
168 
169 #ifndef boolean
170 #define boolean int
171 #ifndef macintosh
172 #define TRUE 1
173 #define FALSE 0
174 #endif
175 #endif
176 
177 #ifndef NULL
178 #define NULL 0
179 #endif
180 
181 #ifndef HAVE_FTRUNCATE_P
182 extern int ftruncate(int, off_t);
183 #endif
184 
185 #define WHITESPACE " \n\t"
186 
187 #ifndef MAXFILENAMELEN
188 #define MAXFILENAMELEN 1000
189 #endif
190 
191 #ifdef MAXPATHLEN
192 #define CWDBS MAXPATHLEN+1
193 #else
194 #define CWDBS 1025
195 #endif
196 
197 #ifdef HAVE_UNISTD_H
198 
199  #define GETWD(buf) getcwd(buf,CWDBS)
200 
201 #else
202 
203  #ifdef HAVE_GETCWD
204  #define GETWD(buf) getcwd(buf,CWDBS)
205  #else
206  #ifdef HAVE_GETWD
207  extern char *getwd(char*);
208  #define GETWD(buf) getwd(buf)
209  #endif
210  #endif /* HAVE_GETCWD */
211 #endif /* HAVE_UNISTD_H */
212 
213 #endif
214