w32tex
About: TeX Live provides a comprehensive TeX system including all the major TeX-related programs, macro packages, and fonts that are free software. Windows sources.
  Fossies Dox: w32tex-src.tar.xz  ("unofficial" and yet experimental doxygen-generated source code documentation)  

private.h
Go to the documentation of this file.
1 #ifndef PRIVATE_H
2 
3 #define PRIVATE_H
4 
5 /*
6 ** This file is in the public domain, so clarified as of
7 ** 1996-06-05 by Arthur David Olson.
8 */
9 
10 /*
11 ** This header is for use ONLY with the time conversion code.
12 ** There is no guarantee that it will remain unchanged,
13 ** or that it will remain at all.
14 ** Do NOT copy it to any system include directory.
15 ** Thank you!
16 */
17 
18 #define GRANDPARENTED "Local time zone must be set--see zic manual page"
19 
20 /*
21 ** Defaults for preprocessor symbols.
22 ** You can override these in your C compiler options, e.g. `-DHAVE_ADJTIME=0'.
23 */
24 
25 #ifndef HAVE_ADJTIME
26 #define HAVE_ADJTIME 1
27 #endif /* !defined HAVE_ADJTIME */
28 
29 #ifndef HAVE_GETTEXT
30 #define HAVE_GETTEXT 0
31 #endif /* !defined HAVE_GETTEXT */
32 
33 #ifndef HAVE_INCOMPATIBLE_CTIME_R
34 #define HAVE_INCOMPATIBLE_CTIME_R 0
35 #endif /* !defined INCOMPATIBLE_CTIME_R */
36 
37 #ifndef HAVE_LINK
38 #define HAVE_LINK 1
39 #endif /* !defined HAVE_LINK */
40 
41 #ifndef HAVE_SETTIMEOFDAY
42 #define HAVE_SETTIMEOFDAY 3
43 #endif /* !defined HAVE_SETTIMEOFDAY */
44 
45 #ifndef HAVE_SYMLINK
46 #define HAVE_SYMLINK 1
47 #endif /* !defined HAVE_SYMLINK */
48 
49 #ifndef HAVE_SYS_STAT_H
50 #define HAVE_SYS_STAT_H 1
51 #endif /* !defined HAVE_SYS_STAT_H */
52 
53 #ifndef HAVE_SYS_WAIT_H
54 #define HAVE_SYS_WAIT_H 1
55 #endif /* !defined HAVE_SYS_WAIT_H */
56 
57 #ifndef HAVE_UNISTD_H
58 #define HAVE_UNISTD_H 1
59 #endif /* !defined HAVE_UNISTD_H */
60 
61 #ifndef HAVE_UTMPX_H
62 #define HAVE_UTMPX_H 0
63 #endif /* !defined HAVE_UTMPX_H */
64 
65 #ifndef LOCALE_HOME
66 #define LOCALE_HOME "/usr/lib/locale"
67 #endif /* !defined LOCALE_HOME */
68 
69 #if HAVE_INCOMPATIBLE_CTIME_R
70 #define asctime_r _incompatible_asctime_r
71 #define ctime_r _incompatible_ctime_r
72 #endif /* HAVE_INCOMPATIBLE_CTIME_R */
73 
74 /*
75 ** Nested includes
76 */
77 
78 #include "sys/types.h" /* for time_t */
79 #include "stdio.h"
80 #include "errno.h"
81 #include "string.h"
82 #include "limits.h" /* for CHAR_BIT et al. */
83 #include "time.h"
84 #include "stdlib.h"
85 
86 #if HAVE_GETTEXT
87 #include "libintl.h"
88 #endif /* HAVE_GETTEXT */
89 
90 #if HAVE_SYS_WAIT_H
91 #include <sys/wait.h> /* for WIFEXITED and WEXITSTATUS */
92 #endif /* HAVE_SYS_WAIT_H */
93 
94 #ifndef WIFEXITED
95 #define WIFEXITED(status) (((status) & 0xff) == 0)
96 #endif /* !defined WIFEXITED */
97 #ifndef WEXITSTATUS
98 #define WEXITSTATUS(status) (((status) >> 8) & 0xff)
99 #endif /* !defined WEXITSTATUS */
100 
101 #if HAVE_UNISTD_H
102 #include "unistd.h" /* for F_OK, R_OK, and other POSIX goodness */
103 #endif /* HAVE_UNISTD_H */
104 
105 #ifndef F_OK
106 #define F_OK 0
107 #endif /* !defined F_OK */
108 #ifndef R_OK
109 #define R_OK 4
110 #endif /* !defined R_OK */
111 
112 /* Unlike <ctype.h>'s isdigit, this also works if c < 0 | c > UCHAR_MAX. */
113 #define is_digit(c) ((unsigned)(c) - '0' <= 9)
114 
115 /*
116 ** Define HAVE_STDINT_H's default value here, rather than at the
117 ** start, since __GLIBC__'s value depends on previously-included
118 ** files.
119 ** (glibc 2.1 and later have stdint.h, even with pre-C99 compilers.)
120 */
121 #ifndef HAVE_STDINT_H
122 #define HAVE_STDINT_H \
123  (199901 <= __STDC_VERSION__ || \
124  2 < (__GLIBC__ + (0 < __GLIBC_MINOR__)))
125 #endif /* !defined HAVE_STDINT_H */
126 
127 #if HAVE_STDINT_H
128 #include "stdint.h"
129 #endif /* !HAVE_STDINT_H */
130 
131 #ifndef HAVE_INTTYPES_H
132 # define HAVE_INTTYPES_H HAVE_STDINT_H
133 #endif
134 #if HAVE_INTTYPES_H
135 # include <inttypes.h>
136 #endif
137 
138 #ifndef INT_FAST64_MAX
139 /* Pre-C99 GCC compilers define __LONG_LONG_MAX__ instead of LLONG_MAX. */
140 #if defined LLONG_MAX || defined __LONG_LONG_MAX__
141 typedef long long int_fast64_t;
142 # ifdef LLONG_MAX
143 # define INT_FAST64_MIN LLONG_MIN
144 # define INT_FAST64_MAX LLONG_MAX
145 # else
146 # define INT_FAST64_MIN __LONG_LONG_MIN__
147 # define INT_FAST64_MAX __LONG_LONG_MAX__
148 # endif
149 # define SCNdFAST64 "lld"
150 #else /* ! (defined LLONG_MAX || defined __LONG_LONG_MAX__) */
151 #if (LONG_MAX >> 31) < 0xffffffff
152 Please use a compiler that supports a 64-bit integer type (or wider);
153 you may need to compile with "-DHAVE_STDINT_H".
154 #endif /* (LONG_MAX >> 31) < 0xffffffff */
155 typedef long int_fast64_t;
156 # define INT_FAST64_MIN LONG_MIN
157 # define INT_FAST64_MAX LONG_MAX
158 # define SCNdFAST64 "ld"
159 #endif /* ! (defined LLONG_MAX || defined __LONG_LONG_MAX__) */
160 #endif /* !defined INT_FAST64_MAX */
161 
162 #ifndef INT_FAST32_MAX
163 # if INT_MAX >> 31 == 0
164 typedef long int_fast32_t;
165 # else
166 typedef int int_fast32_t;
167 # endif
168 #endif
169 
170 #ifndef INTMAX_MAX
171 # if defined LLONG_MAX || defined __LONG_LONG_MAX__
172 typedef long long intmax_t;
173 # define strtoimax strtoll
174 # define PRIdMAX "lld"
175 # ifdef LLONG_MAX
176 # define INTMAX_MAX LLONG_MAX
177 # define INTMAX_MIN LLONG_MIN
178 # else
179 # define INTMAX_MAX __LONG_LONG_MAX__
180 # define INTMAX_MIN __LONG_LONG_MIN__
181 # endif
182 # else
183 typedef long intmax_t;
184 # define strtoimax strtol
185 # define PRIdMAX "ld"
186 # define INTMAX_MAX LONG_MAX
187 # define INTMAX_MIN LONG_MIN
188 # endif
189 #endif
190 
191 #ifndef UINTMAX_MAX
192 # if defined ULLONG_MAX || defined __LONG_LONG_MAX__
193 typedef unsigned long long uintmax_t;
194 # define PRIuMAX "llu"
195 # else
196 typedef unsigned long uintmax_t;
197 # define PRIuMAX "lu"
198 # endif
199 #endif
200 
201 #ifndef INT32_MAX
202 #define INT32_MAX 0x7fffffff
203 #endif /* !defined INT32_MAX */
204 #ifndef INT32_MIN
205 #define INT32_MIN (-1 - INT32_MAX)
206 #endif /* !defined INT32_MIN */
207 
208 #ifndef SIZE_MAX
209 #define SIZE_MAX ((size_t) -1)
210 #endif
211 
212 #if 2 < __GNUC__ + (96 <= __GNUC_MINOR__)
213 # define ATTRIBUTE_CONST __attribute__ ((const))
214 # define ATTRIBUTE_PURE __attribute__ ((__pure__))
215 # define ATTRIBUTE_FORMAT(spec) __attribute__ ((__format__ spec))
216 #else
217 # define ATTRIBUTE_CONST /* empty */
218 # define ATTRIBUTE_PURE /* empty */
219 # define ATTRIBUTE_FORMAT(spec) /* empty */
220 #endif
221 
222 #if !defined _Noreturn && __STDC_VERSION__ < 201112
223 # if 2 < __GNUC__ + (8 <= __GNUC_MINOR__)
224 # define _Noreturn __attribute__ ((__noreturn__))
225 # else
226 # define _Noreturn
227 # endif
228 #endif
229 
230 #if __STDC_VERSION__ < 199901 && !defined restrict
231 # define restrict /* empty */
232 #endif
233 
234 /*
235 ** Workarounds for compilers/systems.
236 */
237 
238 /*
239 ** Some time.h implementations don't declare asctime_r.
240 ** Others might define it as a macro.
241 ** Fix the former without affecting the latter.
242 */
243 
244 #ifndef asctime_r
245 extern char * asctime_r(struct tm const *, char *);
246 #endif
247 
248 /*
249 ** Compile with -Dtime_tz=T to build the tz package with a private
250 ** time_t type equivalent to T rather than the system-supplied time_t.
251 ** This debugging feature can test unusual design decisions
252 ** (e.g., time_t wider than 'long', or unsigned time_t) even on
253 ** typical platforms.
254 */
255 #ifdef time_tz
256 static time_t sys_time(time_t *x) { return time(x); }
257 
258 # undef ctime
259 # define ctime tz_ctime
260 # undef ctime_r
261 # define ctime_r tz_ctime_r
262 # undef difftime
263 # define difftime tz_difftime
264 # undef gmtime
265 # define gmtime tz_gmtime
266 # undef gmtime_r
267 # define gmtime_r tz_gmtime_r
268 # undef localtime
269 # define localtime tz_localtime
270 # undef localtime_r
271 # define localtime_r tz_localtime_r
272 # undef mktime
273 # define mktime tz_mktime
274 # undef time
275 # define time tz_time
276 # undef time_t
277 # define time_t tz_time_t
278 
279 typedef time_tz time_t;
280 
281 char *ctime(time_t const *);
282 char *ctime_r(time_t const *, char *);
283 double difftime(time_t, time_t);
284 struct tm *gmtime(time_t const *);
285 struct tm *gmtime_r(time_t const *restrict, struct tm *restrict);
286 struct tm *localtime(time_t const *);
287 struct tm *localtime_r(time_t const *restrict, struct tm *restrict);
288 time_t mktime(struct tm *);
289 
290 static time_t
291 time(time_t *p)
292 {
293  time_t r = sys_time(0);
294  if (p)
295  *p = r;
296  return r;
297 }
298 #endif
299 
300 /*
301 ** Private function declarations.
302 */
303 
304 char * icatalloc(char * old, const char * new);
305 char * icpyalloc(const char * string);
306 const char * scheck(const char * string, const char * format);
307 
308 /*
309 ** Finally, some convenience items.
310 */
311 
312 #ifndef TRUE
313 #define TRUE 1
314 #endif /* !defined TRUE */
315 
316 #ifndef FALSE
317 #define FALSE 0
318 #endif /* !defined FALSE */
319 
320 #ifndef TYPE_BIT
321 #define TYPE_BIT(type) (sizeof (type) * CHAR_BIT)
322 #endif /* !defined TYPE_BIT */
323 
324 #ifndef TYPE_SIGNED
325 #define TYPE_SIGNED(type) (((type) -1) < 0)
326 #endif /* !defined TYPE_SIGNED */
327 
328 /* The minimum and maximum finite time values. */
329 static time_t const time_t_min =
331  ? (time_t) -1 << (CHAR_BIT * sizeof (time_t) - 1)
332  : 0);
333 static time_t const time_t_max =
335  ? - (~ 0 < 0) - ((time_t) -1 << (CHAR_BIT * sizeof (time_t) - 1))
336  : -1);
337 
338 #ifndef INT_STRLEN_MAXIMUM
339 /*
340 ** 302 / 1000 is log10(2.0) rounded up.
341 ** Subtract one for the sign bit if the type is signed;
342 ** add one for integer division truncation;
343 ** add one more for a minus sign if the type is signed.
344 */
345 #define INT_STRLEN_MAXIMUM(type) \
346  ((TYPE_BIT(type) - TYPE_SIGNED(type)) * 302 / 1000 + \
347  1 + TYPE_SIGNED(type))
348 #endif /* !defined INT_STRLEN_MAXIMUM */
349 
350 /*
351 ** INITIALIZE(x)
352 */
353 
354 #ifndef GNUC_or_lint
355 #ifdef lint
356 #define GNUC_or_lint
357 #endif /* defined lint */
358 #ifndef lint
359 #ifdef __GNUC__
360 #define GNUC_or_lint
361 #endif /* defined __GNUC__ */
362 #endif /* !defined lint */
363 #endif /* !defined GNUC_or_lint */
364 
365 #ifndef INITIALIZE
366 #ifdef GNUC_or_lint
367 #define INITIALIZE(x) ((x) = 0)
368 #endif /* defined GNUC_or_lint */
369 #ifndef GNUC_or_lint
370 #define INITIALIZE(x)
371 #endif /* !defined GNUC_or_lint */
372 #endif /* !defined INITIALIZE */
373 
374 /*
375 ** For the benefit of GNU folk...
376 ** `_(MSGID)' uses the current locale's message library string for MSGID.
377 ** The default is to use gettext if available, and use MSGID otherwise.
378 */
379 
380 #ifndef _
381 #if HAVE_GETTEXT
382 #define _(msgid) gettext(msgid)
383 #else /* !HAVE_GETTEXT */
384 #define _(msgid) msgid
385 #endif /* !HAVE_GETTEXT */
386 #endif /* !defined _ */
387 
388 #ifndef TZ_DOMAIN
389 #define TZ_DOMAIN "tz"
390 #endif /* !defined TZ_DOMAIN */
391 
392 #if HAVE_INCOMPATIBLE_CTIME_R
393 #undef asctime_r
394 #undef ctime_r
395 char *asctime_r(struct tm const *, char *);
396 char *ctime_r(time_t const *, char *);
397 #endif /* HAVE_INCOMPATIBLE_CTIME_R */
398 
399 #ifndef YEARSPERREPEAT
400 #define YEARSPERREPEAT 400 /* years before a Gregorian repeat */
401 #endif /* !defined YEARSPERREPEAT */
402 
403 /*
404 ** The Gregorian year averages 365.2425 days, which is 31556952 seconds.
405 */
406 
407 #ifndef AVGSECSPERYEAR
408 #define AVGSECSPERYEAR 31556952L
409 #endif /* !defined AVGSECSPERYEAR */
410 
411 #ifndef SECSPERREPEAT
412 #define SECSPERREPEAT ((int_fast64_t) YEARSPERREPEAT * (int_fast64_t) AVGSECSPERYEAR)
413 #endif /* !defined SECSPERREPEAT */
414 
415 #ifndef SECSPERREPEAT_BITS
416 #define SECSPERREPEAT_BITS 34 /* ceil(log2(SECSPERREPEAT)) */
417 #endif /* !defined SECSPERREPEAT_BITS */
418 
419 /*
420 ** UNIX was a registered trademark of The Open Group in 2003.
421 */
422 
423 #endif /* !defined PRIVATE_H */
#define CHAR_BIT
Definition: ChkTeX.h:91
static char * compiler
Definition: aptex-src.c:45
static integer sys_time
Definition: aptex.h:382
#define localtime_r(T, BUF)
#define gmtime_r(T, BUF)
#define a(n)
Definition: gpos-common.c:148
small capitals from c petite p
Definition: afcover.h:72
#define need(s, l, m, n)
long time_t
Definition: types.h:18
#define restrict
Definition: private.h:231
Please use a compiler that supports a bit integer type(or wider)
static time_t const time_t_min
Definition: private.h:329
long int_fast32_t
Definition: private.h:164
unsigned long uintmax_t
Definition: private.h:196
long intmax_t
Definition: private.h:183
char * icatalloc(char *old, const char *new)
Definition: ialloc.c:11
const char * scheck(const char *string, const char *format)
Definition: scheck.c:11
you may need to compile with DHAVE_STDINT_H typedef long int_fast64_t
Definition: private.h:155
char * icpyalloc(const char *string)
Definition: ialloc.c:29
static time_t const time_t_max
Definition: private.h:333
char * asctime_r(struct tm const *, char *)
#define TYPE_SIGNED(type)
Definition: private.h:325
#define time_t
Definition: includes.h:70
struct tm * localtime(const time_t *const timep)
Definition: localtime.c:1332
static struct tm tm
Definition: localtime.c:216
time_t mktime(struct tm *const tmp)
Definition: localtime.c:1932
char * ctime_r(const time_t *const timep, char *buf)
Definition: localtime.c:1557
struct tm * gmtime(const time_t *const timep)
Definition: localtime.c:1379
float x
Definition: cordic.py:15
unsigned char bit
Definition: pbm.h:9
static int format
Definition: pbmclean.c:15
int integer
Definition: pbmtopk.c:38
set set set set set set set macro pixldst1 abits if abits op else op endif endm macro pixldst2 abits if abits op else op endif endm macro pixldst4 abits if abits op else op endif endm macro pixldst0 abits op endm macro pixldst3 mem_operand op endm macro pixldst30 mem_operand op endm macro pixldst abits if abits elseif abits elseif abits elseif abits elseif abits pixldst0 abits else pixldst0 abits pixldst0 abits pixldst0 abits pixldst0 abits endif elseif abits else pixldst0 abits pixldst0 abits endif elseif abits else error unsupported bpp *numpix else pixst endif endm macro pixld1_s mem_operand if asr adds SRC_WIDTH_FIXED bpl add asl mov asr adds SRC_WIDTH_FIXED bpl add asl mov asr adds SRC_WIDTH_FIXED bpl add asl mov asr adds SRC_WIDTH_FIXED bpl add asl elseif asr adds SRC_WIDTH_FIXED bpl add asl mov asr adds SRC_WIDTH_FIXED bpl add asl else error unsupported endif endm macro pixld2_s mem_operand if mov asr add asl add asl mov asr sub UNIT_X add asl mov asr add asl add asl mov asr add UNIT_X add asl else pixld1_s mem_operand pixld1_s mem_operand endif endm macro pixld0_s mem_operand if asr adds SRC_WIDTH_FIXED bpl add asl elseif asr adds SRC_WIDTH_FIXED bpl add asl endif endm macro pixld_s_internal mem_operand if mem_operand pixld2_s mem_operand pixdeinterleave basereg elseif mem_operand elseif mem_operand elseif mem_operand elseif mem_operand pixld0_s mem_operand else pixld0_s mem_operand pixld0_s mem_operand pixld0_s mem_operand pixld0_s mem_operand endif elseif mem_operand else pixld0_s mem_operand pixld0_s mem_operand endif elseif mem_operand else error unsupported mem_operand if bpp mem_operand endif endm macro vuzp8 reg2 vuzp d d &reg2 endm macro vzip8 reg2 vzip d d &reg2 endm macro pixdeinterleave basereg basereg basereg basereg basereg endif endm macro pixinterleave basereg basereg basereg basereg basereg endif endm macro PF boost_increment endif if endif PF tst PF addne PF subne PF cmp ORIG_W if endif if endif if endif PF subge ORIG_W PF subges if endif if endif if endif endif endm macro cache_preload_simple endif if dst_r_bpp pld[DST_R, #(PREFETCH_DISTANCE_SIMPLE *dst_r_bpp/8)] endif if mask_bpp pld endif[MASK, #(PREFETCH_DISTANCE_SIMPLE *mask_bpp/8)] endif endif endm macro fetch_mask_pixblock pixld mask_basereg pixblock_size MASK endm macro ensure_destination_ptr_alignment process_pixblock_tail_head if beq irp skip1 beq endif SRC MASK if dst_r_bpp DST_R else add endif PF add sub src_basereg pixdeinterleave mask_basereg pixdeinterleave dst_r_basereg process_pixblock_head pixblock_size cache_preload_simple process_pixblock_tail pixinterleave dst_w_basereg irp beq endif process_pixblock_tail_head tst beq irp if pixblock_size chunk_size tst beq pixld_src SRC pixld MASK if DST_R else pixld DST_R endif if
real to[600]
Definition: pmxab.c:87
int r
Definition: ppmqvga.c:68
time_t time()
char * ctime()
C_Op * compile(Source *s)