summaryrefslogtreecommitdiff
path: root/src/pdflib/pdcore/pc_config.h
blob: 945c9d1d65d954686b3677c9a29f147da423e27b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
/*---------------------------------------------------------------------------*
 |              PDFlib - A library for generating PDF on the fly             |
 +---------------------------------------------------------------------------+
 | Copyright (c) 1997-2006 Thomas Merz and PDFlib GmbH. All rights reserved. |
 +---------------------------------------------------------------------------+
 |                                                                           |
 |    This software is subject to the PDFlib license. It is NOT in the       |
 |    public domain. Extended versions and commercial licenses are           |
 |    available, please check http://www.pdflib.com.                         |
 |                                                                           |
 *---------------------------------------------------------------------------*/

/* $Id: pc_config.h,v 1.1 2008/10/17 06:10:43 scuri Exp $
 *
 * PDFlib portability and configuration definitions
 *
 */

#ifndef PC_CONFIG_H
#define PC_CONFIG_H

/* ------------------------ feature configuration  ------------------- */

/* zlib compression support */
#define HAVE_LIBZ

/* ---------------------------- platform definitions ------------------------ */

/* #undef this if your platform doesn't support environment variables */
#define HAVE_ENVVARS

/* Compilers which are not strictly ANSI conforming can set PDF_VOLATILE
 * to an empty value.
 */
#ifndef PDF_VOLATILE
#define PDF_VOLATILE	volatile
#endif

/*
 * Byte order
 * WORDS_BIGENDIAN will be set by the configure script on most platforms.
 * Only on platforms where there is no configure script we must set the
 * endianness explicitly (most importantly CodeWarrior on the Mac)
 */
#undef PDC_ISBIGENDIAN
#if defined(WORDS_BIGENDIAN) || defined(__POWERPC__) || defined(__MC68K__)
#define PDC_ISBIGENDIAN 1
#if !defined(WORDS_BIGENDIAN)
#define WORDS_BIGENDIAN
#endif
#else
#define PDC_ISBIGENDIAN 0
#endif

/*
 * Define for compiler supporting file open function _wfopen
 * for Unicode filenames.
 */
#undef PDC_UNICODE_FILENAME

/*
 * Define whether function  char *strerror(int errnum)
 * is available in the C runtime system
 */
#define PDC_HAS_STRERROR


/* ---------------------------------- WIN32  -------------------------------- */

/* try to identify Windows compilers */

#if (defined _WIN32 || defined __WATCOMC__ || defined __BORLANDC__ ||	\
	(defined(__MWERKS__) && defined(__INTEL__))) && !defined WIN32
#define	WIN32
#endif	/* <Windows compiler>  && !defined WIN32 */

#ifdef	WIN32
#define WRITEMODE	"wb"
#define APPENDMODE	"ab"

#ifdef	_MSC_VER
#define _LARGEFILE_SOURCE
#endif

#undef PDC_PATHSEP
#define PDC_PATHSEP     "\\"

#if defined(_WIN32_WCE) && (_WIN32_WCE >= 300)
#define PDF_PLATFORM    "Windows CE"
#define WINCE
#undef HAVE_SETLOCALE
#undef HAVE_ENVVARS
#else
#if defined(WIN64)
#define PDF_PLATFORM    "Win64"
#else
#define PDF_PLATFORM    "Win32"
#endif
#endif

#define PDC_TMPDIR_ENV  "TMP"

/* file open function "_wfopen" for Unicode filenames is available.
**/
#if defined(_MSC_VER) && !defined(PDF_WIN98)
#define PDC_UNICODE_FILENAME
#endif

#endif	/* WIN32 */

/* some standard C library functions (eg. localtime()) are not reentrant
** and must be replaced with their "_r" equivalent (eg. localtime_r()).
*/
#if !defined(WIN32) && !defined(__MVS__) && !defined(OS_ZOS_SASC) &&\
 !(defined(__MWERKS__) && (defined(__POWERPC__) || defined(__MC68K__)))
#define PDC_NEEDS_R_FUNCTIONS
#endif

/* --------------------------------- Cygnus  -------------------------------- */

#ifdef __CYGWIN__
#define WRITEMODE	"wb"
#define APPENDMODE	"ab"
#ifdef DLL_EXPORT
    #define PDFLIB_EXPORTS
#endif

#endif /* __CYGWIN__ */

/* ---------------------------------- DJGPP  -------------------------------- */

#ifdef __DJGPP__
#define WRITEMODE	"wb"
#define APPENDMODE	"ab"
#define PDF_PLATFORM	"Win32/DJGPP"
#endif /* __DJGPP__ */

/* ----------------------------------- OS/2  -------------------------------- */

/*
 * Try to identify OS/2 compilers.
 */

#if (defined __OS2__ || defined __EMX__) && !defined OS2
#define OS2
#endif

#ifdef	OS2
#define WRITEMODE	"wb"
#define APPENDMODE	"ab"
#define PDF_PLATFORM	"OS/2"
#endif	/* OS2 */

/* --------------------------------- Mac OS X ------------------------------- */

/* try to identify the Mac OS X command line compiler */

#if (defined(__ppc__) && defined(__APPLE__)) \
    || (defined(__i386__) && defined(__APPLE__))

/* #define MACOSX CDPDF */

/* Mac OS X 10.2 (Jaguar) defines this, but we use it for Mac OS 9 below */
#undef MAC

#ifndef PDF_PLATFORM
#define PDF_PLATFORM    "Mac OS X"
#endif
#endif /* Mac OS X */

/* --------------------------------- Mac OS 9 ------------------------------- */

/* try to identify Mac OS 9 compilers */

#if (defined macintosh || defined __POWERPC__ || defined __CFM68K__) && \
	!defined MAC && !defined MACOSX && !defined __BEOS__
#define MAC
#endif

#undef MAC         /* CDPDF */
#undef MACOSX      /* CDPDF */

#ifdef	MAC
#define WRITEMODE	"wb"
#define APPENDMODE	"ab"
#define PDC_PATHSEP     ":"

#undef HAVE_ENVVARS

#define PDF_PLATFORM	"Mac OS 9"
#endif	/* MAC */

/* ------------------ Carbon Handling for both Mac OS 9 and X --------------- */

#if defined(MAC) || defined(MACOSX)
/*
 * By default we always build a carbonized version of the library,
 * but allow non-Carbon builds to be triggered by setting the
 * PDF_TARGET_API_MAC_CLASSIC symbol externally.
 */

#ifdef PDF_TARGET_API_MAC_CLASSIC
#undef PDF_TYPE1_HOSTFONT_SUPPORTED
#else
#define PDF_TARGET_API_MAC_CARBON
#endif

#if defined(PDF_TARGET_API_MAC_CARBON) && !defined(TARGET_API_MAC_CARBON)
#define TARGET_API_MAC_CARBON 1
#endif

#endif  /* MAC */

/* ----------------------------------- BeOS --------------------------------- */

#ifdef __BEOS__
#define PDF_PLATFORM	"BeOS"
#endif /* __BEOS__ */

/* --------------------------------- AS/400 --------------------------------- */

/* try to identify the AS/400 compiler */

#if	defined __ILEC400__ && !defined AS400
#define	AS400
#endif

#ifdef AS400

#pragma comment(copyright, \
	"(C) PDFlib GmbH, Muenchen, Germany (www.pdflib.com)")

#if (_OS400_TGTVRM__>440)
# ifndef _LARGE_FILE_API
   #error You need to compile this module with DEFINE(_LARGE_FILE_API)
# endif
# ifndef __TERASPACE__
   #error You need to compile this module with TERASPACE(*YES *TSIFC)
STGMDL(*TERASPACE)
# endif
#endif

#define READTMODE       "rb"
#define WRITEMODE	"wb"
#define APPENDMODE	"ab"

#define PDF_PLATFORM	"iSeries"

#define WORDS_BIGENDIAN
#undef PDC_ISBIGENDIAN
#define PDC_ISBIGENDIAN 1

#endif	/* AS400 */

/* --------------------- S/390 with Unix System Services -------------------- */

#ifdef	OS390

#define WRITEMODE	"wb"
#define APPENDMODE	"ab"

#undef WORDS_BIGENDIAN
#define WORDS_BIGENDIAN
#undef PDC_ISBIGENDIAN
#define PDC_ISBIGENDIAN 1

#define PDC_NO_VSNPRINTF

#endif	/* OS390 */

/* -------------------------------- S/390 with MVS -------------------------- */

/* try to identify MVS (__MVS__ is #defined on USS and MVS!)
 * I370 is used by SAS C
 */

#if !defined(OS390) && (defined __MVS__ || defined I370) && !defined MVS
#define	MVS
#endif

#ifdef	MVS

#if defined(I370)
#define PDC_FILEQUOT    ""
#else
#define READBMODE       "rb,byteseek"
#define READBMODE_PLUS  "rb+,byteseek"
#define PDC_FILEQUOT    "'"
#endif
#define WRITEMODE       "wb"
#define WRITEMODE_V	"wb,recfm=v"
#define APPENDMODE	"ab"

#undef PDC_PATHSEP
#define PDC_PATHSEP     "("

#undef PDC_PATHTERM
#define PDC_PATHTERM    ")"

#define PDF_PLATFORM	"zSeries MVS"
#define PDF_OS390_MVS_RESOURCE

#define WORDS_BIGENDIAN
#undef PDC_ISBIGENDIAN
#define PDC_ISBIGENDIAN 1

#define PDC_NO_VSNPRINTF

#endif	/* MVS */

/* ------------------------------------ VMS --------------------------------- */

/* No special handling required */

#ifdef	VMS
/* Usually this will come from the build process */
#ifndef PDF_PLATFORM
#define PDF_PLATFORM	"VMS"
#endif
#define PDC_TMPDIR_ENV  "SYS$SCRATCH"
#define PDC_PATHSEP_LOG ":"

#define PDC_NO_VSNPRINTF

#endif	/* VMS */

/* --------------------------------- Defaults ------------------------------- */

/* CDPDF */
#ifndef PDF_PLATFORM
#define PDF_PLATFORM	"Default"
#endif  /* !PDF_PLATFORM */

/* boolean for function fileno() exists
*/
#ifndef PDC_FILENO_EXISTS
#define PDC_FILENO_EXISTS 1
#endif  /* !PDC_FILENO_EXISTS */

#ifndef READTMODE
#define READTMODE       "r"
#endif  /* !READTMODE */

#ifndef READBMODE
#define READBMODE       "rb"
#endif  /* !READBMODE */

#ifndef READBMODE_PLUS
#define READBMODE_PLUS  "rb+"
#endif  /* !READBMODE_PLUS */

#ifndef WRITEMODE
#define WRITEMODE	"wb"
#endif	/* !WRITEMODE */

#ifndef APPENDMODE
#define APPENDMODE	"ab"
#endif	/* !APPENDMODE */

#ifndef PDC_PATHSEP
#define PDC_PATHSEP     "/"
#endif  /* !PDC_PATHSEP */

#ifndef PDC_TMPDIR_ENV
#define PDC_TMPDIR_ENV  "TMPDIR"
#endif  /* !PDC_TMPDIR_ENV */

#ifdef	_DEBUG
#define DEBUG
#endif	/* _DEBUG */

#ifdef	DEBUG
#define	PDC_DEBUG
#endif	/* DEBUG */

#define PDC_SCHAR_MIN   (-128)
#define PDC_SCHAR_MAX   127
#define PDC_UCHAR_MAX   255
#define PDC_SHRT_MIN    (-32768)
#define PDC_SHRT_MAX    32767
#define PDC_USHRT_MAX   65535
#define PDC_INT_MIN     (-PDC_INT_MAX - 1)
#define PDC_INT_MAX     2147483647
#define PDC_UINT_MAX    4294967295U

#define PDC_OFFSET(type, field) ((unsigned int) &(((type *)NULL)->field))

#endif	/* PC_CONFIG_H */