File: tailor.h

package info (click to toggle)
wcd 3.2.0-1
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k, lenny
  • size: 804 kB
  • ctags: 640
  • sloc: ansic: 8,260; makefile: 43; sh: 6; csh: 1
file content (267 lines) | stat: -rw-r--r-- 6,631 bytes parent folder | download | duplicates (2)
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
/* tailor.h

     Copyright (C) 1998 Erwin Waterlander.
	 Was original written by Mark Adler (Not copyrighted 1993)

This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.

*/


#ifndef _TAILOR_H
#define _TAILOR_H

/* Define MSDOS for Turbo C and Power C */
#ifdef __POWERC
#  define __TURBOC__
#  define MSDOS
#endif /* __POWERC */

#if (defined(__MSDOS__) && !defined(MSDOS))
#  define MSDOS
#endif

#if (defined(__WIN32__) && !defined(WIN32))
#  define WIN32
#endif

#ifdef ATARI_ST
#  undef MSDOS   /* avoid the MS-DOS specific includes */
#endif

/* Use prototypes and ANSI libraries if _STDC__, or Microsoft or Borland C,
 * or Silicon Graphics, or IBM C Set/2, or Watcom C, or GNU gcc under emx.
 */
#if defined(__STDC__) || defined(MSDOS) || defined(ATARI_ST) || defined(sgi)
#  ifndef PROTO
#    define PROTO
#  endif /* !PROTO */
#  define MODERN
#endif

#if defined(__IBMC__) || defined(__EMX__) || defined(__WATCOMC__)
#  ifndef PROTO
#    define PROTO
#  endif /* !PROTO */
#  define MODERN
#endif

#if defined(__BORLANDC__) || (defined(__alpha) && defined(VMS))
#  ifndef PROTO
#    define PROTO
#  endif /* !PROTO */
#  define MODERN
#endif

#ifdef __IBMC__
#  define S_IFMT 0xF000
#endif /* __IBMC__ */

#if defined(__EMX__) || defined(__WATCOMC__) || defined(__BORLANDC__)
#  if (defined(OS2) && !defined(__32BIT__))
#    define __32BIT__
#  endif
#endif

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

#if defined(__DJGPP__)   /* MS-DOS extender:  NOT Unix */
#  undef unix
#  undef __unix
#  undef __unix__
#endif

#if (defined(unix) || defined(__unix) || defined(__unix__))
#  ifndef UNIX
#    define UNIX
#  endif
#endif /* unix || __unix || __unix__ */

#if (defined(linux) || defined(_BSD_SOURCE))
#  ifndef UNIX
#    define UNIX
#  endif
#endif /* linux || _BSD_SOURCE  */

#if (defined(M_XENIX) || defined(COHERENT) || defined(__hpux))
#  ifndef UNIX
#    define UNIX
#  endif
#endif /* M_XENIX || COHERENT || __hpux */

#if defined(__convexc__) || defined(MINIX) || defined(sgi)
#  ifndef UNIX
#    define UNIX
#  endif
#endif /* __convexc__ || MINIX || sgi */

#ifdef __COMPILER_KCC__
#  define TOPS20
#  define NOPROTO
#endif

/* Turn off prototypes if requested */
#if (defined(NOPROTO) && defined(PROTO))
#  undef PROTO
#endif

/* Used to remove arguments in function prototypes for non-ANSI C */
#ifdef PROTO
#  define OF(a) a
#else /* !PROTO */
#  define OF(a) ()
#endif /* ?PROTO */

/* Avoid using const if compiler does not support it */
#ifndef MODERN  /* if this fails, try: ifndef__STDC__ */
#  define const
#endif

#ifdef MACOS
#  define DYN_ALLOC
#endif
#if (defined(MSDOS) && !defined(GO32) && !defined(WIN32))
#  ifdef __TURBOC__
#    include <alloc.h>
#    define DYN_ALLOC
     /* Turbo C 2.0 does not accept static allocations of large arrays */
     void far * fcalloc OF((unsigned items, unsigned size));
     void fcfree (void *ptr);
#  else /* !__TURBOC__ */
#    include <malloc.h>
#    define farmalloc _fmalloc
#    define farfree   _ffree
#    define fcalloc(nitems,itemsize) halloc((long)(nitems),(itemsize))
#    define fcfree(ptr) hfree((void huge *)(ptr))
#  endif /* ?__TURBOC__ */
#else /* !MSDOS */
#  if defined(WIN32)
#    include <malloc.h>
#  endif
#  ifdef __WATCOMC__
#    undef huge
#    undef far
#    undef near
#  endif
#  ifndef __IBMC__
#    define huge
#    define far
#    define near
#  endif
#  define farmalloc malloc
#  define farfree   free
#  define fcalloc(items,size) calloc((unsigned)(items), (unsigned)(size))
#  define fcfree    free
#endif /* ?MSDOS */


#if (defined(OS2) && !defined(MSDOS))
/* MSDOS is defined anyway with MS C 16-bit. So the block above works.
 * For the 32-bit compilers, MSDOS must not be defined in the block above. */
#  define MSDOS
/* inherit MS-DOS file system etc. stuff */
#endif


/* Define MSVMS if MSDOS or VMS defined -- ATARI also does, Amiga could */
#if defined(MSDOS) || defined(VMS)
#  define MSVMS
#endif

/* Define void, voidp, and extent (size_t) */
#include <stdio.h>
#ifdef MODERN
#  if (!defined(M_XENIX) && !(defined(__GNUC__) && defined(sun)))
#    include <stddef.h>
#  endif /* !M_XENIX */
#  include <stdlib.h>
#  if defined(SYSV) || defined(__386BSD__)
#    include <unistd.h>
#  endif
   typedef size_t extent;
   typedef void voidp;
#else /* !MODERN */
   typedef unsigned int extent;
#  define void int
   typedef char voidp;
#endif /* ?MODERN */

/* Get types and stat */
#ifdef VMS
#  include <types.h>
#  include <stat.h>
#  define unlink delete
#  define NO_SYMLINK
#  define SSTAT vms_stat
#else /* !VMS */
#  ifdef MACOS
#    include <types.h>
#    include <stddef.h>
#    include <Files.h>
#    include <StandardFile.h>
#    include <Think.h>
#    include <LoMem.h>
#    include <Pascal.h>
#    include "macstat.h"
#    define NO_SYMLINK
#  else
#    ifdef ATARI_ST
#      include <ext.h>
#      include <tos.h>
#    else
#      ifdef AMIGA
#        if defined(LATTICE) || defined(__SASC)
#          include <sys/types.h>
#          include <sys/stat.h>
           extern int isatty(int);   /* SAS has no unistd.h */
#        endif
#        ifdef AZTEC_C
#          include "amiga/z-stat.h"
#          define RMDIR
#        endif
#      else /* !AMIGA */
#        include <sys/types.h>
#        include <sys/stat.h>
#    endif
#  endif
#  endif
#endif /* ?VMS */

#ifndef S_ISDIR
#  define S_ISDIR(m)  (((m) & S_IFMT) == S_IFDIR)
#endif

#include <ctype.h>

#ifndef _tolower
#  define _tolower(c) ((c) + 'a' - 'A')
#endif
#ifndef _toupper
#  define _toupper(c) ((c) + 'A' - 'a')
#endif

#if defined(UNIX) || defined(T20_VMS)   /* generally old systems */
/*  some compilers don't check if a character is already upper or lower
 *  case in the toupper/tolower functions, so we define our own here.
 */
#  define ToLower(c)    (isupper((int)c) ? _tolower(c) : (c))
#  define ToUpper(c)    (islower((int)c) ? _toupper(c) : (c))
#else
#  define ToLower      tolower          /* assumed "smart"; used in match() */
#endif

#endif /* end of tailor.h */