ROOT
git-r3/HEAD
Reference Guide
Loading...
Searching...
No Matches
Tailor.h
Go to the documentation of this file.
1
/* @(#)root/zip:$Id$ */
2
3
/*************************************************************************
4
* Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. *
5
* All rights reserved. *
6
* *
7
* For the licensing terms see $ROOTSYS/LICENSE. *
8
* For the list of contributors see $ROOTSYS/README/CREDITS. *
9
*************************************************************************/
10
/* tailor.h -- Not copyrighted 1993 Mark Adler */
11
12
/* Define MSDOS for Turbo C and Power C */
13
#ifdef WIN32
14
#define MSDOS
15
#endif
16
#ifdef __POWERC
17
# define __TURBOC__
18
# define MSDOS
19
#endif
/* __POWERC */
20
21
#if (defined(__MSDOS__) && !defined(MSDOS))
22
# define MSDOS
23
#endif
24
25
#ifdef ATARI_ST
26
# undef MSDOS
/* avoid the MS-DOS specific includes */
27
#endif
28
29
/* Use prototypes and ANSI libraries if _STDC__, or Microsoft or Borland C,
30
* or Silicon Graphics, or IBM C Set/2, or Watcom C, or GNU gcc under emx.
31
*/
32
#if defined(__STDC__) || defined(MSDOS) || defined(ATARI_ST) || defined(sgi)
33
# ifndef PROTO
34
# define PROTO
35
# endif
/* !PROTO */
36
# define MODERN
37
#endif
38
39
#if defined(__IBMC__) || defined(__EMX__) || defined(__WATCOMC__) || defined(__MWERKS__)
40
# ifndef PROTO
41
# define PROTO
42
# endif
/* !PROTO */
43
# define MODERN
44
#endif
45
46
#if defined(__BORLANDC__) || (defined(__alpha) && defined(VMS))
47
# ifndef PROTO
48
# define PROTO
49
# endif
/* !PROTO */
50
# define MODERN
51
#endif
52
53
#if defined(__EMX__) || defined(__WATCOMC__) || defined(__BORLANDC__)
54
# if (defined(OS2) && !defined(__32BIT__))
55
# define __32BIT__
56
# endif
57
#endif
58
59
#if (defined(__OS2__) && !defined(OS2))
60
# define OS2
61
#endif
62
63
#ifdef __convexc__
64
# define CONVEX
65
#endif
/* __convexc__ */
66
67
#ifdef __COMPILER_KCC__
68
# define TOPS20
69
# define NOPROTO
70
# define NO_SYMLINK
71
# define NO_TERMIO
72
# define DIRENT
73
# define BIG_MEM
74
extern
int
isatty();
75
# define R__window_size winsiz
76
#endif
77
78
/* Turn off prototypes if requested */
79
#if (defined(NOPROTO) && defined(PROTO))
80
# undef PROTO
81
#endif
82
83
/* Used to remove arguments in function prototypes for non-ANSI C */
84
#ifdef PROTO
85
# define OF(a) a
86
#else
/* !PROTO */
87
# define OF(a) ()
88
#endif
/* ?PROTO */
89
90
/* Avoid using const if compiler does not support it */
91
#ifndef MODERN
/* if this fails, try: ifndef__STDC__ */
92
# define const
93
#endif
94
95
#if defined(MACOS) || defined(__MWERKS__)
96
# define DYN_ALLOC
97
#endif
98
#if (defined(MSDOS) && !defined(__GO32__) && !defined(WIN32))
99
# ifdef __TURBOC__
100
# include <alloc.h>
101
# define DYN_ALLOC
102
/* Turbo C 2.0 does not accept static allocations of large arrays */
103
void
far
*
fcalloc
OF
((
unsigned
items,
unsigned
size
));
104
void
fcfree
(
void
*ptr);
105
# else
/* !__TURBOC__ */
106
# include <malloc.h>
107
# define farmalloc _fmalloc
108
# define farfree _ffree
109
# define fcalloc(nitems,itemsize) halloc((long)(nitems),(itemsize))
110
# define fcfree(ptr) hfree((void huge *)(ptr))
111
# endif
/* ?__TURBOC__ */
112
#else
/* !MSDOS */
113
# if defined(WIN32)
114
# include <malloc.h>
115
# endif
116
# ifdef __WATCOMC__
117
# undef huge
118
# undef far
119
# undef near
120
# else
121
# define huge
122
# define far
123
# define near
124
# endif
125
# define farmalloc malloc
126
# define farfree free
127
# define fcalloc(items,size) calloc((unsigned)(items), (unsigned)(size))
128
# define fcfree free
129
# if (!defined(PROTO) && !defined(TOPS20))
130
extern
char
*
calloc
();
/* essential for 16 bit systems (AT&T 6300) */
131
# endif
132
#endif
/* ?MSDOS */
133
134
135
#if (defined(OS2) && !defined(MSDOS))
136
/* MSDOS is defined anyway with MS C 16-bit. So the block above works.
137
* For the 32-bit compilers, MSDOS must not be defined in the block above. */
138
# define MSDOS
139
/* inherit MS-DOS file system etc. stuff */
140
#endif
141
142
143
/* Define MSVMS if MSDOS or VMS defined -- ATARI also does, Amiga could */
144
#if defined(MSDOS) || defined(VMS)
145
# define MSVMS
146
#endif
147
148
/* case mapping functions. case_map is used to ignore case in comparisons,
149
* to_up is used to force upper case even on Unix (for dosify option).
150
*/
151
/* || defined(AMIGA) is removed from the next line because the line
152
is too long for PATCHY */
153
#if defined(MSDOS) || defined(VMS) || defined(OS2) || defined(WIN32)
154
# define case_map(c) upper[(c) & 0xff]
155
# define to_up(c) upper[(c) & 0xff]
156
#else
157
# define case_map(c) (c)
158
# define to_up(c) ((c) >= 'a' && (c) <= 'z' ? (c)-'a'+'A' : (c))
159
#endif
160
161
/* Define void, voidp, and extent (size_t) */
162
#include <stdio.h>
163
#include <string.h>
164
#ifdef MODERN
165
# if (!defined(M_XENIX) && !(defined(__GNUC__) && defined(sun)))
166
# include <stddef.h>
167
# endif
/* !M_XENIX */
168
# include <stdlib.h>
169
# if defined(SYSV) || defined(__386BSD__)
170
# include <unistd.h>
171
# endif
172
typedef
size_t
extent
;
173
/* This definition of voidp is in conflict with the zlib one (zconf.h)
174
voidp is used only in zlib code.
175
typedef void voidp;
176
*/
177
#else
/* !MODERN */
178
typedef
unsigned
int
extent
;
179
# define void int
180
/* This definition of voidp is in conflict with the zlib one (zconf.h)
181
voidp is used only in zlib code.
182
typedef char voidp;
183
*/
184
#endif
/* ?MODERN */
185
186
/* Get types and stat */
187
#ifdef VMS
188
# include <
types.h
>
189
# include <stat.h>
190
# define unlink delete
191
# define NO_SYMLINK
192
# define SSTAT vms_stat
193
#else
/* !VMS */
194
# if defined(MACOS)
195
# include <
types.h
>
196
# include <stddef.h>
197
# include <Files.h>
198
# include <StandardFile.h>
199
# include <Think.h>
200
# include <LoMem.h>
201
# include <Pascal.h>
202
# include "macstat.h"
203
# define NO_SYMLINK
204
# elif defined (__MWERKS__)
205
# include <stddef.h>
206
# include <stat.h>
207
# define NO_SYMLINK
208
# else
209
# ifdef ATARI_ST
210
# include <ext.h>
211
# include <tos.h>
212
# else
213
# ifdef AMIGA
214
int
wild
OF
((
char
*));
215
/* default to MEDIUM_MEM, but allow makefile override */
216
# if ( (!defined(BIG_MEM)) && (!defined(SMALL_MEM)))
217
# define MEDIUM_MEM
218
# endif
219
# if defined(LATTICE) || defined(__SASC)
220
# include <sys/types.h>
221
# include <sys/stat.h>
222
extern
int
isatty(
int
);
/* SAS has no unistd.h */
223
# endif
224
# ifdef AZTEC_C
225
# include "amiga/z-stat.h"
226
# define RMDIR
227
# endif
228
# else
/* !AMIGA */
229
# include <sys/types.h>
230
# include <sys/stat.h>
231
# endif
232
# endif
233
# endif
234
#endif
/* ?VMS */
235
236
/* Some systems define S_IFLNK but do not support symbolic links */
237
#if defined (S_IFLNK) && defined(NO_SYMLINK)
238
# undef S_IFLNK
239
#endif
240
241
242
/* For Pyramid */
243
#ifdef pyr
244
# define strrchr rindex
245
# define ZMEM
246
#endif
/* pyr */
247
248
249
/* File operations--use "b" for binary if allowed or fixed length 512 on VMS */
250
#ifdef VMS
251
# define FOPR "r","ctx=stm"
252
# define FOPM "r+","ctx=stm","rfm=fix","mrs=512"
253
# define FOPW "w","ctx=stm","rfm=fix","mrs=512"
254
#else
/* !VMS */
255
# if defined(MODERN)
256
# define FOPR "rb"
257
# define FOPM "r+b"
258
# ifdef TOPS20
/* TOPS20 MODERN? You kidding? */
259
# define FOPW "w8"
260
# else
261
# define FOPW "wb"
262
# endif
263
# else
/* !MODERN */
264
# ifdef AMIGA
265
# define FOPR "rb"
266
# define FOPM "rb+"
267
# define FOPW "wb"
268
# else
/* !AMIGA */
269
# define FOPR "r"
270
# define FOPM "r+"
271
# define FOPW "w"
272
# endif
/* ?AMIGA */
273
# endif
/* ?MODERN */
274
#endif
/* VMS */
275
276
/* Open the old zip file in exclusive mode if possible (to avoid adding
277
* zip file to itself).
278
*/
279
#ifdef OS2
280
# define FOPR_EX FOPM
281
#else
282
# define FOPR_EX FOPR
283
#endif
284
285
/* Define this symbol if your target allows access to unaligned data.
286
* This is not mandatory, just a speed optimization. The compressed
287
* output is strictly identical.
288
*/
289
#if (defined(MSDOS) && !defined(WIN32)) || defined(i386)
290
# define UNALIGNED_OK
291
#endif
292
#if defined(mc68020) || defined(vax)
293
# define UNALIGNED_OK
294
#endif
295
296
/* Under MSDOS we may run out of memory when processing a large number
297
* of files. Compile with MEDIUM_MEM to reduce the memory requirements or
298
* with SMALL_MEM to use as little memory as possible.
299
*/
300
#ifdef SMALL_MEM
301
# define CBSZ 2048
/* buffer size for copying files */
302
# define ZBSZ 2048
/* buffer size for temporary zip file */
303
#else
304
# ifdef MEDIUM_MEM
305
# define CBSZ 8192
306
# define ZBSZ 8192
307
# else
308
# ifdef OS2
309
# ifdef __32BIT__
310
# define CBSZ 0x40000
311
# define ZBSZ 0x40000
312
# else
313
# define CBSZ 0xE000
314
# define ZBSZ 0x7F00
/* Some libraries do not allow a buffer size > 32K */
315
# endif
316
# else
317
# ifdef TOPS20
318
# define CBSZ 524288
319
# define ZBSZ 524288
320
# else
321
# define CBSZ 16384
322
# define ZBSZ 16384
323
# endif
324
# endif
325
# endif
326
#endif
327
328
#if (defined(BIG_MEM) || defined(MMAP)) && !defined(DYN_ALLOC)
329
# define DYN_ALLOC
330
#endif
331
332
#ifdef __human68k__
333
# include <sys/xglob.h>
334
# define MSVMS
335
# define SSTAT h68_stat
336
int
h68_stat
OF
((
char
*,
struct
stat *));
337
# define OS_CODE 0x300
/* pretend it's Unix */
338
#endif
339
340
#ifdef ATARI_ST
341
# define MSDOS
/* what? should be fixed */
342
# define MSVMS
343
# ifndef O_BINARY
344
# define O_BINARY 0
345
# endif
346
# ifndef S_IFMT
347
# define S_IFMT (S_IFCHR|S_IFREG|S_IFDIR)
348
# endif
349
350
#ifdef __IBMC__
351
# ifndef S_IFMT
352
# define S_IFMT 0xF000
353
# endif
354
#endif
/* __IBMC__ */
355
356
/* a whole bunch of functions needs Tos '\\' filenames
357
* instead of '/', the translation functions are in fileio.c:
358
*/
359
# define unlink st_unlink
360
# define chmod st_chmod
361
# define mktemp st_mktemp
362
# define fopen st_fopen
363
# define open st_open
364
# define SSTAT st_stat
365
# define findfirst st_findfirst
366
# define link st_rename
367
# define rmdir st_rmdir
368
369
int
st_unlink
OF
((
char
*));
370
int
st_chmod
OF
((
char
*,
int
));
371
char
*st_mktemp
OF
((
char
*));
372
FILE *st_fopen
OF
((
char
*,
char
*));
373
int
st_open
OF
((
char
*,
int
));
374
int
st_stat
OF
((
char
*,
struct
stat *));
375
int
st_findfirst
OF
((
char
*,
struct
ffblk *,
int
));
376
int
st_rename
OF
((
char
*,
char
*));
377
int
st_rmdir
OF
((
char
*));
378
#endif
/* ATARI */
379
380
#ifndef SSTAT
381
# define SSTAT stat
382
#endif
383
#ifdef S_IFLNK
384
# define LSTAT lstat
385
#else
386
# define LSTAT SSTAT
387
#endif
388
389
390
/* The following OS codes are defined in pkzip appnote.txt */
391
#ifdef AMIGA
392
# define OS_CODE 0x100
393
#endif
394
#ifdef VMS
395
# define OS_CODE 0x200
396
#endif
397
/* unix 3 */
398
/* vms/cms 4 */
399
#ifdef ATARI_ST
400
# define OS_CODE 0x500
401
#endif
402
#ifdef OS2
403
# define OS_CODE 0x600
404
#endif
405
#if defined(MACOS) || defined(__MWERKS__)
406
# define OS_CODE 0x700
407
#endif
408
/* z system 8 */
409
/* cp/m 9 */
410
#ifdef TOPS20
411
# define OS_CODE 0xa00
412
#endif
413
#ifdef WIN32
414
# define OS_CODE 0xb00
415
#endif
416
/* qdos 12 */
417
418
#if defined(MSDOS) && !defined(OS_CODE)
419
# define OS_CODE 0x000
420
#endif
421
#ifndef OS_CODE
422
# define OS_CODE 0x300
/* assume Unix */
423
# ifndef R__UNIX
424
# define R__UNIX
425
# endif
426
#endif
427
428
429
/* end of tailor.h */
430
size
size_t size(const MatrixT &matrix)
retrieve the size of a square matrix
far
#define far
Definition
Tailor.h:122
calloc
char * calloc()
fcfree
#define fcfree
Definition
Tailor.h:128
fcalloc
#define fcalloc(items, size)
Definition
Tailor.h:127
OF
#define OF(a)
Definition
Tailor.h:87
extent
unsigned int extent
Definition
Tailor.h:178
types.h
core
zip
src
Tailor.h
ROOTgit-r3/HEAD - Reference Guide Generated on
(GVA Time) using Doxygen 1.16.1