-
Notifications
You must be signed in to change notification settings - Fork 0
/
perl.h
2594 lines (2305 loc) · 66.5 KB
/
perl.h
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
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/* perl.h
*
* Copyright (c) 1987-1999, Larry Wall
*
* You may distribute under the terms of either the GNU General Public
* License or the Artistic License, as specified in the README file.
*
*/
#ifndef H_PERL
#define H_PERL 1
#define OVERLOAD
#ifdef PERL_FOR_X2P
/*
* This file is being used for x2p stuff.
* Above symbol is defined via -D in 'x2p/Makefile.SH'
* Decouple x2p stuff from some of perls more extreme eccentricities.
*/
#undef EMBED
#undef NO_EMBED
#define NO_EMBED
#undef MULTIPLICITY
#undef USE_STDIO
#define USE_STDIO
#endif /* PERL_FOR_X2P */
#ifdef PERL_OBJECT
/* PERL_OBJECT explained - DickH and DougL @ ActiveState.com
Defining PERL_OBJECT turns on creation of a C++ object that
contains all writable core perl global variables and functions.
Stated another way, all necessary global variables and functions
are members of a big C++ object. This object's class is CPerlObj.
This allows a Perl Host to have multiple, independent perl
interpreters in the same process space. This is very important on
Win32 systems as the overhead of process creation is quite high --
this could be even higher than the script compile and execute time
for small scripts.
The perl executable implementation on Win32 is composed of perl.exe
(the Perl Host) and perlX.dll. (the Perl Core). This allows the
same Perl Core to easily be embedded in other applications that use
the perl interpreter.
+-----------+
| Perl Host |
+-----------+
^
|
v
+-----------+ +-----------+
| Perl Core |<->| Extension |
+-----------+ +-----------+ ...
Defining PERL_OBJECT has the following effects:
PERL CORE
1. CPerlObj is defined (this is the PERL_OBJECT)
2. all static functions that needed to access either global
variables or functions needed are made member functions
3. all writable static variables are made member variables
4. all global variables and functions are defined as:
#define var CPerlObj::Perl_var
#define func CPerlObj::Perl_func
* these are in objpp.h
This necessitated renaming some local variables and functions that
had the same name as a global variable or function. This was
probably a _good_ thing anyway.
EXTENSIONS
1. Access to global variables and perl functions is through a
pointer to the PERL_OBJECT. This pointer type is CPerlObj*. This is
made transparent to extension developers by the following macros:
#define var pPerl->Perl_var
#define func pPerl->Perl_func
* these are done in objXSUB.h
This requires that the extension be compiled as C++, which means
that the code must be ANSI C and not K&R C. For K&R extensions,
please see the C API notes located in Win32/GenCAPI.pl. This script
creates a perlCAPI.lib that provides a K & R compatible C interface
to the PERL_OBJECT.
2. Local variables and functions cannot have the same name as perl's
variables or functions since the macros will redefine these. Look for
this if you get some strange error message and it does not look like
the code that you had written. This often happens with variables that
are local to a function.
PERL HOST
1. The perl host is linked with perlX.lib to get perl_alloc. This
function will return a pointer to CPerlObj (the PERL_OBJECT). It
takes pointers to the various PerlXXX_YYY interfaces (see iperlsys.h
for more information on this).
2. The perl host calls the same functions as normally would be
called in setting up and running a perl script, except that the
functions are now member functions of the PERL_OBJECT.
*/
class CPerlObj;
#define STATIC
#define CPERLscope(x) CPerlObj::x
#define CPERLproto CPerlObj *
#define _CPERLproto ,CPERLproto
#define CPERLarg CPerlObj *pPerl
#define CPERLarg_ CPERLarg,
#define _CPERLarg ,CPERLarg
#define PERL_OBJECT_THIS this
#define _PERL_OBJECT_THIS ,this
#define PERL_OBJECT_THIS_ this,
#define CALLRUNOPS (this->*PL_runops)
#define CALLREGCOMP (this->*PL_regcompp)
#define CALLREGEXEC (this->*PL_regexecp)
#else /* !PERL_OBJECT */
#define STATIC static
#define CPERLscope(x) x
#define CPERLproto
#define _CPERLproto
#define CPERLarg void
#define CPERLarg_
#define _CPERLarg
#define PERL_OBJECT_THIS
#define _PERL_OBJECT_THIS
#define PERL_OBJECT_THIS_
#define CALLRUNOPS PL_runops
#define CALLREGCOMP (*PL_regcompp)
#define CALLREGEXEC (*PL_regexecp)
#endif /* PERL_OBJECT */
#define VOIDUSED 1
#include "config.h"
#include "embed.h"
#undef START_EXTERN_C
#undef END_EXTERN_C
#undef EXTERN_C
#ifdef __cplusplus
# define START_EXTERN_C extern "C" {
# define END_EXTERN_C }
# define EXTERN_C extern "C"
#else
# define START_EXTERN_C
# define END_EXTERN_C
# define EXTERN_C
#endif
#ifdef OP_IN_REGISTER
# ifdef __GNUC__
# define stringify_immed(s) #s
# define stringify(s) stringify_immed(s)
#ifdef EMBED
register struct op *Perl_op asm(stringify(OP_IN_REGISTER));
#else
register struct op *op asm(stringify(OP_IN_REGISTER));
#endif
# endif
#endif
/*
* STMT_START { statements; } STMT_END;
* can be used as a single statement, as in
* if (x) STMT_START { ... } STMT_END; else ...
*
* Trying to select a version that gives no warnings...
*/
#if !(defined(STMT_START) && defined(STMT_END))
# if defined(__GNUC__) && !defined(__STRICT_ANSI__) && !defined(__cplusplus)
# define STMT_START (void)( /* gcc supports ``({ STATEMENTS; })'' */
# define STMT_END )
# else
/* Now which other defined()s do we need here ??? */
# if (VOIDFLAGS) && (defined(sun) || defined(__sun__))
# define STMT_START if (1)
# define STMT_END else (void)0
# else
# define STMT_START do
# define STMT_END while (0)
# endif
# endif
#endif
#define NOOP (void)0
#define WITH_THR(s) STMT_START { dTHR; s; } STMT_END
/*
* SOFT_CAST can be used for args to prototyped functions to retain some
* type checking; it only casts if the compiler does not know prototypes.
*/
#if defined(CAN_PROTOTYPE) && defined(DEBUGGING_COMPILE)
#define SOFT_CAST(type)
#else
#define SOFT_CAST(type) (type)
#endif
#ifndef BYTEORDER /* Should never happen -- byteorder is in config.h */
# define BYTEORDER 0x1234
#endif
/* Overall memory policy? */
#ifndef CONSERVATIVE
# define LIBERAL 1
#endif
#if 'A' == 65 && 'I' == 73 && 'J' == 74 && 'Z' == 90
#define ASCIIish
#else
#undef ASCIIish
#endif
/*
* The following contortions are brought to you on behalf of all the
* standards, semi-standards, de facto standards, not-so-de-facto standards
* of the world, as well as all the other botches anyone ever thought of.
* The basic theory is that if we work hard enough here, the rest of the
* code can be a lot prettier. Well, so much for theory. Sorry, Henry...
*/
/* define this once if either system, instead of cluttering up the src */
#if defined(MSDOS) || defined(atarist) || defined(WIN32)
#define DOSISH 1
#endif
#if defined(__STDC__) || defined(vax11c) || defined(_AIX) || defined(__stdc__) || defined(__cplusplus)
# define STANDARD_C 1
#endif
#if defined(__cplusplus) || defined(WIN32) || defined(__sgi) || defined(OS2) || defined(__DGUX)
# define DONT_DECLARE_STD 1
#endif
#if defined(HASVOLATILE) || defined(STANDARD_C)
# ifdef __cplusplus
# define VOL // to temporarily suppress warnings
# else
# define VOL volatile
# endif
#else
# define VOL
#endif
#define TAINT (PL_tainted = TRUE)
#define TAINT_NOT (PL_tainted = FALSE)
#define TAINT_IF(c) if (c) { PL_tainted = TRUE; }
#define TAINT_ENV() if (PL_tainting) { taint_env(); }
#define TAINT_PROPER(s) if (PL_tainting) { taint_proper(Nullch, s); }
/* XXX All process group stuff is handled in pp_sys.c. Should these
defines move there? If so, I could simplify this a lot. --AD 9/96.
*/
/* Process group stuff changed from traditional BSD to POSIX.
perlfunc.pod documents the traditional BSD-style syntax, so we'll
try to preserve that, if possible.
*/
#ifdef HAS_SETPGID
# define BSD_SETPGRP(pid, pgrp) setpgid((pid), (pgrp))
#else
# if defined(HAS_SETPGRP) && defined(USE_BSD_SETPGRP)
# define BSD_SETPGRP(pid, pgrp) setpgrp((pid), (pgrp))
# else
# ifdef HAS_SETPGRP2 /* DG/UX */
# define BSD_SETPGRP(pid, pgrp) setpgrp2((pid), (pgrp))
# endif
# endif
#endif
#if defined(BSD_SETPGRP) && !defined(HAS_SETPGRP)
# define HAS_SETPGRP /* Well, effectively it does . . . */
#endif
/* getpgid isn't POSIX, but at least Solaris and Linux have it, and it makes
our life easier :-) so we'll try it.
*/
#ifdef HAS_GETPGID
# define BSD_GETPGRP(pid) getpgid((pid))
#else
# if defined(HAS_GETPGRP) && defined(USE_BSD_GETPGRP)
# define BSD_GETPGRP(pid) getpgrp((pid))
# else
# ifdef HAS_GETPGRP2 /* DG/UX */
# define BSD_GETPGRP(pid) getpgrp2((pid))
# endif
# endif
#endif
#if defined(BSD_GETPGRP) && !defined(HAS_GETPGRP)
# define HAS_GETPGRP /* Well, effectively it does . . . */
#endif
/* These are not exact synonyms, since setpgrp() and getpgrp() may
have different behaviors, but perl.h used to define USE_BSDPGRP
(prior to 5.003_05) so some extension might depend on it.
*/
#if defined(USE_BSD_SETPGRP) || defined(USE_BSD_GETPGRP)
# ifndef USE_BSDPGRP
# define USE_BSDPGRP
# endif
#endif
#ifndef _TYPES_ /* If types.h defines this it's easy. */
# ifndef major /* Does everyone's types.h define this? */
# include <sys/types.h>
# endif
#endif
#ifdef __cplusplus
# ifndef I_STDARG
# define I_STDARG 1
# endif
#endif
#ifdef I_STDARG
# include <stdarg.h>
#else
# ifdef I_VARARGS
# include <varargs.h>
# endif
#endif
#include "iperlsys.h"
#ifdef USE_NEXT_CTYPE
#if NX_CURRENT_COMPILER_RELEASE >= 400
#include <objc/NXCType.h>
#else /* NX_CURRENT_COMPILER_RELEASE < 400 */
#include <appkit/NXCType.h>
#endif /* NX_CURRENT_COMPILER_RELEASE >= 400 */
#else /* !USE_NEXT_CTYPE */
#include <ctype.h>
#endif /* USE_NEXT_CTYPE */
#ifdef METHOD /* Defined by OSF/1 v3.0 by ctype.h */
#undef METHOD
#endif
#ifdef I_LOCALE
# include <locale.h>
#endif
#if !defined(NO_LOCALE) && defined(HAS_SETLOCALE)
# define USE_LOCALE
# if !defined(NO_LOCALE_COLLATE) && defined(LC_COLLATE) \
&& defined(HAS_STRXFRM)
# define USE_LOCALE_COLLATE
# endif
# if !defined(NO_LOCALE_CTYPE) && defined(LC_CTYPE)
# define USE_LOCALE_CTYPE
# endif
# if !defined(NO_LOCALE_NUMERIC) && defined(LC_NUMERIC)
# define USE_LOCALE_NUMERIC
# endif
#endif /* !NO_LOCALE && HAS_SETLOCALE */
#include <setjmp.h>
#ifdef I_SYS_PARAM
# ifdef PARAM_NEEDS_TYPES
# include <sys/types.h>
# endif
# include <sys/param.h>
#endif
/* Use all the "standard" definitions? */
#if defined(STANDARD_C) && defined(I_STDLIB)
# include <stdlib.h>
#endif
#define MEM_SIZE Size_t
/* This comes after <stdlib.h> so we don't try to change the standard
* library prototypes; we'll use our own in proto.h instead. */
#ifdef MYMALLOC
# ifdef HIDEMYMALLOC
# define malloc Mymalloc
# define calloc Mycalloc
# define realloc Myrealloc
# define free Myfree
Malloc_t Mymalloc _((MEM_SIZE nbytes));
Malloc_t Mycalloc _((MEM_SIZE elements, MEM_SIZE size));
Malloc_t Myrealloc _((Malloc_t where, MEM_SIZE nbytes));
Free_t Myfree _((Malloc_t where));
# endif
# ifdef EMBEDMYMALLOC
# define malloc Perl_malloc
# define calloc Perl_calloc
# define realloc Perl_realloc
/* VMS' external symbols are case-insensitive, and there's already a */
/* perl_free in perl.h */
#ifdef VMS
# define free Perl_myfree
#else
# define free Perl_free
#endif
Malloc_t Perl_malloc _((MEM_SIZE nbytes));
Malloc_t Perl_calloc _((MEM_SIZE elements, MEM_SIZE size));
Malloc_t Perl_realloc _((Malloc_t where, MEM_SIZE nbytes));
#ifdef VMS
Free_t Perl_myfree _((Malloc_t where));
#else
Free_t Perl_free _((Malloc_t where));
#endif
# endif
# undef safemalloc
# undef safecalloc
# undef saferealloc
# undef safefree
# define safemalloc malloc
# define safecalloc calloc
# define saferealloc realloc
# define safefree free
#endif /* MYMALLOC */
#if defined(STANDARD_C) && defined(I_STDDEF)
# include <stddef.h>
# define STRUCT_OFFSET(s,m) offsetof(s,m)
#else
# define STRUCT_OFFSET(s,m) (Size_t)(&(((s *)0)->m))
#endif
#if defined(I_STRING) || defined(__cplusplus)
# include <string.h>
#else
# include <strings.h>
#endif
#if !defined(HAS_STRCHR) && defined(HAS_INDEX) && !defined(strchr)
#define strchr index
#define strrchr rindex
#endif
#ifdef I_MEMORY
# include <memory.h>
#endif
#ifdef HAS_MEMCPY
# if !defined(STANDARD_C) && !defined(I_STRING) && !defined(I_MEMORY)
# ifndef memcpy
extern char * memcpy _((char*, char*, int));
# endif
# endif
#else
# ifndef memcpy
# ifdef HAS_BCOPY
# define memcpy(d,s,l) bcopy(s,d,l)
# else
# define memcpy(d,s,l) my_bcopy(s,d,l)
# endif
# endif
#endif /* HAS_MEMCPY */
#ifdef HAS_MEMSET
# if !defined(STANDARD_C) && !defined(I_STRING) && !defined(I_MEMORY)
# ifndef memset
extern char *memset _((char*, int, int));
# endif
# endif
#else
# define memset(d,c,l) my_memset(d,c,l)
#endif /* HAS_MEMSET */
#if !defined(HAS_MEMMOVE) && !defined(memmove)
# if defined(HAS_BCOPY) && defined(HAS_SAFE_BCOPY)
# define memmove(d,s,l) bcopy(s,d,l)
# else
# if defined(HAS_MEMCPY) && defined(HAS_SAFE_MEMCPY)
# define memmove(d,s,l) memcpy(d,s,l)
# else
# define memmove(d,s,l) my_bcopy(s,d,l)
# endif
# endif
#endif
#if defined(mips) && defined(ultrix) && !defined(__STDC__)
# undef HAS_MEMCMP
#endif
#if defined(HAS_MEMCMP) && defined(HAS_SANE_MEMCMP)
# if !defined(STANDARD_C) && !defined(I_STRING) && !defined(I_MEMORY)
# ifndef memcmp
extern int memcmp _((char*, char*, int));
# endif
# endif
# ifdef BUGGY_MSC
# pragma function(memcmp)
# endif
#else
# ifndef memcmp
# define memcmp my_memcmp
# endif
#endif /* HAS_MEMCMP && HAS_SANE_MEMCMP */
#ifndef memzero
# ifdef HAS_MEMSET
# define memzero(d,l) memset(d,0,l)
# else
# ifdef HAS_BZERO
# define memzero(d,l) bzero(d,l)
# else
# define memzero(d,l) my_bzero(d,l)
# endif
# endif
#endif
#ifndef HAS_BCMP
# ifndef bcmp
# define bcmp(s1,s2,l) memcmp(s1,s2,l)
# endif
#endif /* !HAS_BCMP */
#ifdef I_NETINET_IN
# include <netinet/in.h>
#endif
#ifdef I_ARPA_INET
# include <arpa/inet.h>
#endif
#if defined(SF_APPEND) && defined(USE_SFIO) && defined(I_SFIO)
/* <sfio.h> defines SF_APPEND and <sys/stat.h> might define SF_APPEND
* (the neo-BSD seem to do this). */
# undef SF_APPEND
#endif
#ifdef I_SYS_STAT
# include <sys/stat.h>
#endif
/* The stat macros for Amdahl UTS, Unisoft System V/88 (and derivatives
like UTekV) are broken, sometimes giving false positives. Undefine
them here and let the code below set them to proper values.
The ghs macro stands for GreenHills Software C-1.8.5 which
is the C compiler for sysV88 and the various derivatives.
This header file bug is corrected in gcc-2.5.8 and later versions.
--Kaveh Ghazi (ghazi@noc.rutgers.edu) 10/3/94. */
#if defined(uts) || (defined(m88k) && defined(ghs))
# undef S_ISDIR
# undef S_ISCHR
# undef S_ISBLK
# undef S_ISREG
# undef S_ISFIFO
# undef S_ISLNK
#endif
#ifdef I_TIME
# include <time.h>
#endif
#ifdef I_SYS_TIME
# ifdef I_SYS_TIME_KERNEL
# define KERNEL
# endif
# include <sys/time.h>
# ifdef I_SYS_TIME_KERNEL
# undef KERNEL
# endif
#endif
#if defined(HAS_TIMES) && defined(I_SYS_TIMES)
# include <sys/times.h>
#endif
#if defined(HAS_STRERROR) && (!defined(HAS_MKDIR) || !defined(HAS_RMDIR))
# undef HAS_STRERROR
#endif
#include <errno.h>
#ifdef HAS_SOCKET
# ifdef I_NET_ERRNO
# include <net/errno.h>
# endif
#endif
#ifdef VMS
# define SETERRNO(errcode,vmserrcode) \
STMT_START { \
set_errno(errcode); \
set_vaxc_errno(vmserrcode); \
} STMT_END
#else
# define SETERRNO(errcode,vmserrcode) (errno = (errcode))
#endif
#ifdef USE_THREADS
# define ERRSV (thr->errsv)
# define ERRHV (thr->errhv)
# define DEFSV THREADSV(0)
# define SAVE_DEFSV save_threadsv(0)
#else
# define ERRSV GvSV(PL_errgv)
# define ERRHV GvHV(PL_errgv)
# define DEFSV GvSV(PL_defgv)
# define SAVE_DEFSV SAVESPTR(GvSV(PL_defgv))
#endif /* USE_THREADS */
#ifndef errno
extern int errno; /* ANSI allows errno to be an lvalue expr */
#endif
#ifdef HAS_STRERROR
# ifdef VMS
char *strerror _((int,...));
# else
#ifndef DONT_DECLARE_STD
char *strerror _((int));
#endif
# endif
# ifndef Strerror
# define Strerror strerror
# endif
#else
# ifdef HAS_SYS_ERRLIST
extern int sys_nerr;
extern char *sys_errlist[];
# ifndef Strerror
# define Strerror(e) \
((e) < 0 || (e) >= sys_nerr ? "(unknown)" : sys_errlist[e])
# endif
# endif
#endif
#ifdef I_SYS_IOCTL
# ifndef _IOCTL_
# include <sys/ioctl.h>
# endif
#endif
#if defined(mc300) || defined(mc500) || defined(mc700) || defined(mc6000)
# ifdef HAS_SOCKETPAIR
# undef HAS_SOCKETPAIR
# endif
# ifdef I_NDBM
# undef I_NDBM
# endif
#endif
#if INTSIZE == 2
# define htoni htons
# define ntohi ntohs
#else
# define htoni htonl
# define ntohi ntohl
#endif
/* Configure already sets Direntry_t */
#if defined(I_DIRENT)
# include <dirent.h>
# if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
# include <sys/dir.h>
# endif
#else
# ifdef I_SYS_NDIR
# include <sys/ndir.h>
# else
# ifdef I_SYS_DIR
# ifdef hp9000s500
# include <ndir.h> /* may be wrong in the future */
# else
# include <sys/dir.h>
# endif
# endif
# endif
#endif
#ifdef FPUTS_BOTCH
/* work around botch in SunOS 4.0.1 and 4.0.2 */
# ifndef fputs
# define fputs(sv,fp) fprintf(fp,"%s",sv)
# endif
#endif
/*
* The following gobbledygook brought to you on behalf of __STDC__.
* (I could just use #ifndef __STDC__, but this is more bulletproof
* in the face of half-implementations.)
*/
#ifndef S_IFMT
# ifdef _S_IFMT
# define S_IFMT _S_IFMT
# else
# define S_IFMT 0170000
# endif
#endif
#ifndef S_ISDIR
# define S_ISDIR(m) ((m & S_IFMT) == S_IFDIR)
#endif
#ifndef S_ISCHR
# define S_ISCHR(m) ((m & S_IFMT) == S_IFCHR)
#endif
#ifndef S_ISBLK
# ifdef S_IFBLK
# define S_ISBLK(m) ((m & S_IFMT) == S_IFBLK)
# else
# define S_ISBLK(m) (0)
# endif
#endif
#ifndef S_ISREG
# define S_ISREG(m) ((m & S_IFMT) == S_IFREG)
#endif
#ifndef S_ISFIFO
# ifdef S_IFIFO
# define S_ISFIFO(m) ((m & S_IFMT) == S_IFIFO)
# else
# define S_ISFIFO(m) (0)
# endif
#endif
#ifndef S_ISLNK
# ifdef _S_ISLNK
# define S_ISLNK(m) _S_ISLNK(m)
# else
# ifdef _S_IFLNK
# define S_ISLNK(m) ((m & S_IFMT) == _S_IFLNK)
# else
# ifdef S_IFLNK
# define S_ISLNK(m) ((m & S_IFMT) == S_IFLNK)
# else
# define S_ISLNK(m) (0)
# endif
# endif
# endif
#endif
#ifndef S_ISSOCK
# ifdef _S_ISSOCK
# define S_ISSOCK(m) _S_ISSOCK(m)
# else
# ifdef _S_IFSOCK
# define S_ISSOCK(m) ((m & S_IFMT) == _S_IFSOCK)
# else
# ifdef S_IFSOCK
# define S_ISSOCK(m) ((m & S_IFMT) == S_IFSOCK)
# else
# define S_ISSOCK(m) (0)
# endif
# endif
# endif
#endif
#ifndef S_IRUSR
# ifdef S_IREAD
# define S_IRUSR S_IREAD
# define S_IWUSR S_IWRITE
# define S_IXUSR S_IEXEC
# else
# define S_IRUSR 0400
# define S_IWUSR 0200
# define S_IXUSR 0100
# endif
# define S_IRGRP (S_IRUSR>>3)
# define S_IWGRP (S_IWUSR>>3)
# define S_IXGRP (S_IXUSR>>3)
# define S_IROTH (S_IRUSR>>6)
# define S_IWOTH (S_IWUSR>>6)
# define S_IXOTH (S_IXUSR>>6)
#endif
#ifndef S_ISUID
# define S_ISUID 04000
#endif
#ifndef S_ISGID
# define S_ISGID 02000
#endif
#ifdef ff_next
# undef ff_next
#endif
#if defined(cray) || defined(gould) || defined(i860) || defined(pyr)
# define SLOPPYDIVIDE
#endif
#ifdef UV
#undef UV
#endif
/* XXX QUAD stuff is not currently supported on most systems.
Specifically, perl internals don't support long long. Among
the many problems is that some compilers support long long,
but the underlying library functions (such as sprintf) don't.
Some things do work (such as quad pack/unpack on convex);
also some systems use long long for the fpos_t typedef. That
seems to work too.
The IV type is supposed to be long enough to hold any integral
value or a pointer.
--Andy Dougherty August 1996
*/
#ifdef cray
# define Quad_t int
#else
# ifdef convex
# define Quad_t long long
# else
# if LONGSIZE == 8
# define Quad_t long
# endif
# endif
#endif
/* XXX Experimental set-up for long long. Just add -DUSE_LONG_LONG
to your ccflags. --Andy Dougherty 4/1998
*/
#ifdef USE_LONG_LONG
# if defined(HAS_LONG_LONG) && LONGLONGSIZE == 8
# define Quad_t long long
# endif
#endif
#ifdef Quad_t
# define HAS_QUAD
typedef Quad_t IV;
typedef unsigned Quad_t UV;
# define IV_MAX PERL_QUAD_MAX
# define IV_MIN PERL_QUAD_MIN
# define UV_MAX PERL_UQUAD_MAX
# define UV_MIN PERL_UQUAD_MIN
#else
typedef long IV;
typedef unsigned long UV;
# define IV_MAX PERL_LONG_MAX
# define IV_MIN PERL_LONG_MIN
# define UV_MAX PERL_ULONG_MAX
# define UV_MIN PERL_ULONG_MIN
#endif
/* Previously these definitions used hardcoded figures.
* It is hoped these formula are more portable, although
* no data one way or another is presently known to me.
* The "PERL_" names are used because these calculated constants
* do not meet the ANSI requirements for LONG_MAX, etc., which
* need to be constants acceptable to #if - kja
* define PERL_LONG_MAX 2147483647L
* define PERL_LONG_MIN (-LONG_MAX - 1)
* define PERL ULONG_MAX 4294967295L
*/
#ifdef I_LIMITS /* Needed for cast_xxx() functions below. */
# include <limits.h>
#else
#ifdef I_VALUES
# include <values.h>
#endif
#endif
/*
* Try to figure out max and min values for the integral types. THE CORRECT
* SOLUTION TO THIS MESS: ADAPT enquire.c FROM GCC INTO CONFIGURE. The
* following hacks are used if neither limits.h or values.h provide them:
* U<TYPE>_MAX: for types >= int: ~(unsigned TYPE)0
* for types < int: (unsigned TYPE)~(unsigned)0
* The argument to ~ must be unsigned so that later signed->unsigned
* conversion can't modify the value's bit pattern (e.g. -0 -> +0),
* and it must not be smaller than int because ~ does integral promotion.
* <type>_MAX: (<type>) (U<type>_MAX >> 1)
* <type>_MIN: -<type>_MAX - <is_twos_complement_architecture: (3 & -1) == 3>.
* The latter is a hack which happens to work on some machines but
* does *not* catch any random system, or things like integer types
* with NaN if that is possible.
*
* All of the types are explicitly cast to prevent accidental loss of
* numeric range, and in the hope that they will be less likely to confuse
* over-eager optimizers.
*
*/
#define PERL_UCHAR_MIN ((unsigned char)0)
#ifdef UCHAR_MAX
# define PERL_UCHAR_MAX ((unsigned char)UCHAR_MAX)
#else
# ifdef MAXUCHAR
# define PERL_UCHAR_MAX ((unsigned char)MAXUCHAR)
# else
# define PERL_UCHAR_MAX ((unsigned char)~(unsigned)0)
# endif
#endif
/*
* CHAR_MIN and CHAR_MAX are not included here, as the (char) type may be
* ambiguous. It may be equivalent to (signed char) or (unsigned char)
* depending on local options. Until Configure detects this (or at least
* detects whether the "signed" keyword is available) the CHAR ranges
* will not be included. UCHAR functions normally.
* - kja
*/
#define PERL_USHORT_MIN ((unsigned short)0)
#ifdef USHORT_MAX
# define PERL_USHORT_MAX ((unsigned short)USHORT_MAX)
#else
# ifdef MAXUSHORT
# define PERL_USHORT_MAX ((unsigned short)MAXUSHORT)
# else
# ifdef USHRT_MAX
# define PERL_USHORT_MAX ((unsigned short)USHRT_MAX)
# else
# define PERL_USHORT_MAX ((unsigned short)~(unsigned)0)
# endif
# endif
#endif
#ifdef SHORT_MAX
# define PERL_SHORT_MAX ((short)SHORT_MAX)
#else
# ifdef MAXSHORT /* Often used in <values.h> */
# define PERL_SHORT_MAX ((short)MAXSHORT)
# else
# ifdef SHRT_MAX
# define PERL_SHORT_MAX ((short)SHRT_MAX)
# else
# define PERL_SHORT_MAX ((short) (PERL_USHORT_MAX >> 1))
# endif
# endif
#endif
#ifdef SHORT_MIN
# define PERL_SHORT_MIN ((short)SHORT_MIN)
#else
# ifdef MINSHORT
# define PERL_SHORT_MIN ((short)MINSHORT)
# else
# ifdef SHRT_MIN
# define PERL_SHORT_MIN ((short)SHRT_MIN)
# else
# define PERL_SHORT_MIN (-PERL_SHORT_MAX - ((3 & -1) == 3))
# endif
# endif
#endif
#ifdef UINT_MAX
# define PERL_UINT_MAX ((unsigned int)UINT_MAX)
#else
# ifdef MAXUINT
# define PERL_UINT_MAX ((unsigned int)MAXUINT)
# else
# define PERL_UINT_MAX (~(unsigned int)0)
# endif
#endif
#define PERL_UINT_MIN ((unsigned int)0)
#ifdef INT_MAX
# define PERL_INT_MAX ((int)INT_MAX)
#else
# ifdef MAXINT /* Often used in <values.h> */
# define PERL_INT_MAX ((int)MAXINT)
# else
# define PERL_INT_MAX ((int)(PERL_UINT_MAX >> 1))
# endif
#endif
#ifdef INT_MIN
# define PERL_INT_MIN ((int)INT_MIN)
#else
# ifdef MININT
# define PERL_INT_MIN ((int)MININT)
# else
# define PERL_INT_MIN (-PERL_INT_MAX - ((3 & -1) == 3))
# endif
#endif
#ifdef ULONG_MAX
# define PERL_ULONG_MAX ((unsigned long)ULONG_MAX)
#else
# ifdef MAXULONG
# define PERL_ULONG_MAX ((unsigned long)MAXULONG)
# else
# define PERL_ULONG_MAX (~(unsigned long)0)
# endif
#endif
#define PERL_ULONG_MIN ((unsigned long)0L)
#ifdef LONG_MAX
# define PERL_LONG_MAX ((long)LONG_MAX)
#else
# ifdef MAXLONG /* Often used in <values.h> */