-
Notifications
You must be signed in to change notification settings - Fork 0
/
perl.h
6076 lines (5413 loc) · 175 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) 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001
* 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 by Larry Wall and others
*
* 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
#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 MULTIPLICITY
#undef USE_STDIO
#define USE_STDIO
#endif /* PERL_FOR_X2P */
#if defined(DGUX)
#include <sys/fcntl.h>
#endif
#ifdef VOIDUSED
# undef VOIDUSED
#endif
#define VOIDUSED 1
#ifdef PERL_MICRO
# include "uconfig.h"
#else
# ifndef USE_CROSS_COMPILE
# include "config.h"
# else
# include "xconfig.h"
# endif
#endif
/* This logic needs to come after reading config.h, but before including
proto.h */
#ifdef IAMSUID
# ifndef DOSUID
# define DOSUID
# endif
#endif
#ifdef SETUID_SCRIPTS_ARE_SECURE_NOW
# ifdef DOSUID
# undef DOSUID
# endif
# ifdef IAMSUID
# undef IAMSUID
# define SETUID_SCRIPTS_ARE_SECURE_NOW_AND_IAMSUID
# endif
#endif
/* See L<perlguts/"The Perl API"> for detailed notes on
* PERL_IMPLICIT_CONTEXT and PERL_IMPLICIT_SYS */
/* Note that from here --> to <-- the same logic is
* repeated in makedef.pl, so be certain to update
* both places when editing. */
#ifdef PERL_IMPLICIT_SYS
/* PERL_IMPLICIT_SYS implies PerlMemShared != PerlMem
so use slab allocator to avoid lots of MUTEX overhead
*/
# ifndef PL_OP_SLAB_ALLOC
# define PL_OP_SLAB_ALLOC
# endif
#endif
#ifdef USE_ITHREADS
# if !defined(MULTIPLICITY)
# define MULTIPLICITY
# endif
#endif
#ifdef PERL_GLOBAL_STRUCT_PRIVATE
# ifndef PERL_GLOBAL_STRUCT
# define PERL_GLOBAL_STRUCT
# endif
#endif
#ifdef PERL_GLOBAL_STRUCT
# ifndef MULTIPLICITY
# define MULTIPLICITY
# endif
#endif
#ifdef MULTIPLICITY
# ifndef PERL_IMPLICIT_CONTEXT
# define PERL_IMPLICIT_CONTEXT
# endif
#endif
#if defined(__SYMBIAN32__) || (defined(__VC32__) && defined(WINS))
# ifndef SYMBIAN
# define SYMBIAN
# endif
#endif
#ifdef __SYMBIAN32__
# include "symbian/symbian_proto.h"
#endif
/* Any stack-challenged places. The limit varies (and often
* is configurable), but using more than a kilobyte of stack
* is usually dubious in these systems. */
#if defined(EPOC) || defined(__SYMBIAN32__)
/* EPOC/Symbian: need to work around the SDK features. *
* On WINS: MS VC5 generates calls to _chkstk, *
* if a "large" stack frame is allocated. *
* gcc on MARM does not generate calls like these. */
# define USE_HEAP_INSTEAD_OF_STACK
#endif
#/* Use the reentrant APIs like localtime_r and getpwent_r */
/* Win32 has naturally threadsafe libraries, no need to use any _r variants. */
#if defined(USE_ITHREADS) && !defined(USE_REENTRANT_API) && !defined(NETWARE) && !defined(WIN32) && !defined(PERL_DARWIN)
# define USE_REENTRANT_API
#endif
/* <--- here ends the logic shared by perl.h and makedef.pl */
/*
* PERL_DARWIN for MacOSX (__APPLE__ exists but is not officially sanctioned)
* (The -DPERL_DARWIN comes from the hints/darwin.sh.)
* __bsdi__ for BSD/OS
*/
#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(PERL_DARWIN) || defined(__bsdi__) || defined(BSD41) || defined(BSD42) || defined(BSD43) || defined(BSD44)
# ifndef BSDish
# define BSDish
# endif
#endif
#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 extern
#endif
#ifdef PERL_GLOBAL_STRUCT
# ifndef PERL_GET_VARS
# ifdef PERL_GLOBAL_STRUCT_PRIVATE
EXTERN_C struct perl_vars* Perl_GetVarsPrivate();
# define PERL_GET_VARS() Perl_GetVarsPrivate() /* see miniperlmain.c */
# ifndef PERLIO_FUNCS_CONST
# define PERLIO_FUNCS_CONST /* Can't have these lying around. */
# endif
# else
# define PERL_GET_VARS() PL_VarsPtr
# endif
# endif
#endif
#define pVAR register struct perl_vars* my_vars PERL_UNUSED_DECL
#ifdef PERL_GLOBAL_STRUCT
# define dVAR pVAR = (struct perl_vars*)PERL_GET_VARS()
#else
# define dVAR dNOOP
#endif
#ifdef PERL_IMPLICIT_CONTEXT
# ifndef MULTIPLICITY
# define MULTIPLICITY
# endif
# define tTHX PerlInterpreter*
# define pTHX register tTHX my_perl PERL_UNUSED_DECL
# define aTHX my_perl
# ifdef PERL_GLOBAL_STRUCT
# define dTHXa(a) dVAR; pTHX = (tTHX)a
# else
# define dTHXa(a) pTHX = (tTHX)a
# endif
# ifdef PERL_GLOBAL_STRUCT
# define dTHX dVAR; pTHX = PERL_GET_THX
# else
# define dTHX pTHX = PERL_GET_THX
# endif
# define pTHX_ pTHX,
# define aTHX_ aTHX,
# define pTHX_1 2
# define pTHX_2 3
# define pTHX_3 4
# define pTHX_4 5
# define pTHX_5 6
# define pTHX_6 7
# define pTHX_7 8
# define pTHX_8 9
# define pTHX_9 10
# if defined(DEBUGGING) && !defined(PERL_TRACK_MEMPOOL)
# define PERL_TRACK_MEMPOOL
# endif
#else
# undef PERL_TRACK_MEMPOOL
#endif
#define STATIC static
#define CPERLscope(x) x
#define CPERLarg void
#define CPERLarg_
#define _CPERLarg
#define PERL_OBJECT_THIS
#define _PERL_OBJECT_THIS
#define PERL_OBJECT_THIS_
#define CALL_FPTR(fptr) (*fptr)
#define CALLRUNOPS CALL_FPTR(PL_runops)
#define CALLREGCOMP(sv, flags) Perl_pregcomp(aTHX_ (sv),(flags))
#define CALLREGCOMP_ENG(prog, sv, flags) \
CALL_FPTR(((prog)->comp))(aTHX_ sv, flags)
#define CALLREGEXEC(prog,stringarg,strend,strbeg,minend,screamer,data,flags) \
CALL_FPTR(RX_ENGINE(prog)->exec)(aTHX_ (prog),(stringarg),(strend), \
(strbeg),(minend),(screamer),(data),(flags))
#define CALLREG_INTUIT_START(prog,sv,strpos,strend,flags,data) \
CALL_FPTR(RX_ENGINE(prog)->intuit)(aTHX_ (prog), (sv), (strpos), \
(strend),(flags),(data))
#define CALLREG_INTUIT_STRING(prog) \
CALL_FPTR(RX_ENGINE(prog)->checkstr)(aTHX_ (prog))
#define CALLREG_AS_STR(mg,lp,flags,haseval) \
Perl_reg_stringify(aTHX_ (mg), (lp), (flags), (haseval))
#define CALLREG_STRINGIFY(mg,lp,flags) CALLREG_AS_STR(mg,lp,flags,0)
#define CALLREGFREE(prog) \
Perl_pregfree(aTHX_ (prog))
#define CALLREGFREE_PVT(prog) \
if(prog) CALL_FPTR(RX_ENGINE(prog)->free)(aTHX_ (prog))
#define CALLREG_NUMBUF_FETCH(rx,paren,usesv) \
CALL_FPTR(RX_ENGINE(rx)->numbered_buff_FETCH)(aTHX_ (rx),(paren),(usesv))
#define CALLREG_NUMBUF_STORE(rx,paren,value) \
CALL_FPTR(RX_ENGINE(rx)->numbered_buff_STORE)(aTHX_ (rx),(paren),(value))
#define CALLREG_NUMBUF_LENGTH(rx,sv,paren) \
CALL_FPTR(RX_ENGINE(rx)->numbered_buff_LENGTH)(aTHX_ (rx),(sv),(paren))
#define CALLREG_NAMED_BUFF_FETCH(rx, key, flags) \
CALL_FPTR(RX_ENGINE(rx)->named_buff)(aTHX_ (rx), (key), NULL, ((flags) | RXapif_FETCH))
#define CALLREG_NAMED_BUFF_STORE(rx, key, value, flags) \
CALL_FPTR(RX_ENGINE(rx)->named_buff)(aTHX_ (rx), (key), (value), ((flags) | RXapif_STORE))
#define CALLREG_NAMED_BUFF_DELETE(rx, key, flags) \
CALL_FPTR(RX_ENGINE(rx)->named_buff)(aTHX_ (rx),(key), NULL, ((flags) | RXapif_DELETE))
#define CALLREG_NAMED_BUFF_CLEAR(rx, flags) \
CALL_FPTR(RX_ENGINE(rx)->named_buff)(aTHX_ (rx), NULL, NULL, ((flags) | RXapif_CLEAR))
#define CALLREG_NAMED_BUFF_EXISTS(rx, key, flags) \
CALL_FPTR(RX_ENGINE(rx)->named_buff)(aTHX_ (rx), (key), NULL, ((flags) | RXapif_EXISTS))
#define CALLREG_NAMED_BUFF_FIRSTKEY(rx, flags) \
CALL_FPTR(RX_ENGINE(rx)->named_buff_iter)(aTHX_ (rx), NULL, ((flags) | RXapif_FIRSTKEY))
#define CALLREG_NAMED_BUFF_NEXTKEY(rx, lastkey, flags) \
CALL_FPTR(RX_ENGINE(rx)->named_buff_iter)(aTHX_ (rx), (lastkey), ((flags) | RXapif_NEXTKEY))
#define CALLREG_NAMED_BUFF_SCALAR(rx, flags) \
CALL_FPTR(RX_ENGINE(rx)->named_buff)(aTHX_ (rx), NULL, NULL, ((flags) | RXapif_SCALAR))
#define CALLREG_NAMED_BUFF_COUNT(rx) \
CALL_FPTR(RX_ENGINE(rx)->named_buff)(aTHX_ (rx), NULL, NULL, RXapif_REGNAMES_COUNT)
#define CALLREG_NAMED_BUFF_ALL(rx, flags) \
CALL_FPTR(RX_ENGINE(rx)->named_buff)(aTHX_ (rx), NULL, NULL, flags)
#define CALLREG_PACKAGE(rx) \
CALL_FPTR(RX_ENGINE(rx)->qr_package)(aTHX_ (rx))
#if defined(USE_ITHREADS)
#define CALLREGDUPE(prog,param) \
Perl_re_dup(aTHX_ (prog),(param))
#define CALLREGDUPE_PVT(prog,param) \
(prog ? CALL_FPTR(RX_ENGINE(prog)->dupe)(aTHX_ (prog),(param)) \
: (REGEXP *)NULL)
#endif
/*
* Because of backward compatibility reasons the PERL_UNUSED_DECL
* cannot be changed from postfix to PERL_UNUSED_DECL(x). Sigh.
*
* Note that there are C compilers such as MetroWerks CodeWarrior
* which do not have an "inlined" way (like the gcc __attribute__) of
* marking unused variables (they need e.g. a #pragma) and therefore
* cpp macros like PERL_UNUSED_DECL cannot work for this purpose, even
* if it were PERL_UNUSED_DECL(x), which it cannot be (see above).
*
*/
#if defined(__SYMBIAN32__) && defined(__GNUC__)
# ifdef __cplusplus
# define PERL_UNUSED_DECL
# else
# define PERL_UNUSED_DECL __attribute__((unused))
# endif
#endif
#ifndef PERL_UNUSED_DECL
# if defined(HASATTRIBUTE_UNUSED) && !defined(__cplusplus)
# define PERL_UNUSED_DECL __attribute__unused__
# else
# define PERL_UNUSED_DECL
# endif
#endif
/* gcc -Wall:
* for silencing unused variables that are actually used most of the time,
* but we cannot quite get rid of, such as "ax" in PPCODE+noargs xsubs
*/
#ifndef PERL_UNUSED_ARG
# if defined(lint) && defined(S_SPLINT_S) /* www.splint.org */
# include <note.h>
# define PERL_UNUSED_ARG(x) NOTE(ARGUNUSED(x))
# else
# define PERL_UNUSED_ARG(x) ((void)x)
# endif
#endif
#ifndef PERL_UNUSED_VAR
# define PERL_UNUSED_VAR(x) ((void)x)
#endif
#ifdef USE_ITHREADS
# define PERL_UNUSED_CONTEXT PERL_UNUSED_ARG(my_perl)
#else
# define PERL_UNUSED_CONTEXT
#endif
#define NOOP /*EMPTY*/(void)0
#if !defined(HASATTRIBUTE_UNUSED) && defined(__cplusplus)
#define dNOOP /*EMPTY*/(void)0 /* Older g++ has no __attribute((unused))__ */
#else
#define dNOOP extern int /*@unused@*/ Perl___notused PERL_UNUSED_DECL
#endif
#ifndef pTHX
/* Don't bother defining tTHX and sTHX; using them outside
* code guarded by PERL_IMPLICIT_CONTEXT is an error.
*/
# define pTHX void
# define pTHX_
# define aTHX
# define aTHX_
# define dTHXa(a) dNOOP
# define dTHX dNOOP
# define pTHX_1 1
# define pTHX_2 2
# define pTHX_3 3
# define pTHX_4 4
# define pTHX_5 5
# define pTHX_6 6
# define pTHX_7 7
# define pTHX_8 8
# define pTHX_9 9
#endif
#ifndef dVAR
# define dVAR dNOOP
#endif
/* these are only defined for compatibility; should not be used internally */
#if !defined(pTHXo) && !defined(PERL_CORE)
# define pTHXo pTHX
# define pTHXo_ pTHX_
# define aTHXo aTHX
# define aTHXo_ aTHX_
# define dTHXo dTHX
# define dTHXoa(x) dTHXa(x)
#endif
#ifndef pTHXx
# define pTHXx register PerlInterpreter *my_perl
# define pTHXx_ pTHXx,
# define aTHXx my_perl
# define aTHXx_ aTHXx,
# define dTHXx dTHX
#endif
/* Under PERL_IMPLICIT_SYS (used in Windows for fork emulation)
* PerlIO_foo() expands to PL_StdIO->pFOO(PL_StdIO, ...).
* dTHXs is therefore needed for all functions using PerlIO_foo(). */
#ifdef PERL_IMPLICIT_SYS
# ifdef PERL_GLOBAL_STRUCT_PRIVATE
# define dTHXs dVAR; dTHX
# else
# define dTHXs dTHX
# endif
#else
# ifdef PERL_GLOBAL_STRUCT_PRIVATE
# define dTHXs dVAR
# else
# define dTHXs dNOOP
# endif
#endif
/* Some platforms require marking function declarations
* for them to be exportable. Used in perlio.h, proto.h
* is handled either by the makedef.pl or by defining the
* PERL_CALLCONV to be something special. See also the
* definition of XS() in XSUB.h. */
#ifndef PERL_EXPORT_C
# ifdef __cplusplus
# define PERL_EXPORT_C extern "C"
# else
# define PERL_EXPORT_C extern
# endif
#endif
#ifndef PERL_XS_EXPORT_C
# ifdef __cplusplus
# define PERL_XS_EXPORT_C extern "C"
# else
# define PERL_XS_EXPORT_C
# endif
#endif
#ifdef OP_IN_REGISTER
# ifdef __GNUC__
# define stringify_immed(s) #s
# define stringify(s) stringify_immed(s)
register struct op *Perl_op asm(stringify(OP_IN_REGISTER));
# endif
#endif
/* gcc (-ansi) -pedantic doesn't allow gcc statement expressions,
* g++ allows them but seems to have problems with them
* (insane errors ensue).
* g++ does not give insane errors now (RMB 2008-01-30, gcc 4.2.2).
*/
#if defined(PERL_GCC_PEDANTIC) || \
(defined(__GNUC__) && defined(__cplusplus) && \
((__GNUC__ < 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ < 2))))
# ifndef PERL_GCC_BRACE_GROUPS_FORBIDDEN
# define PERL_GCC_BRACE_GROUPS_FORBIDDEN
# endif
#endif
#if defined(__GNUC__) && !defined(PERL_GCC_BRACE_GROUPS_FORBIDDEN) && !defined(__cplusplus)
# ifndef PERL_USE_GCC_BRACE_GROUPS
# define PERL_USE_GCC_BRACE_GROUPS
# 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))
# ifdef PERL_USE_GCC_BRACE_GROUPS
# 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__)) && !defined(__GNUC__)
# 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 WITH_THX(s) STMT_START { dTHX; s; } STMT_END
#define WITH_THR(s) WITH_THX(s)
#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) || defined(NETWARE)
#define DOSISH 1
#endif
#if defined(__STDC__) || defined(_AIX) || defined(__stdc__) || defined(__cplusplus) || defined(EPOC) || defined(NETWARE) || defined(__SYMBIAN32__)
# define STANDARD_C 1
#endif
#if defined(__cplusplus) || defined(WIN32) || defined(__sgi) || defined(__EMX__) || defined(__DGUX) || defined(EPOC) || defined(__QNX__) || defined(NETWARE) || defined(PERL_MICRO)
# define DONT_DECLARE_STD 1
#endif
#if defined(HASVOLATILE) || defined(STANDARD_C)
# define VOL volatile
#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(NULL, 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
/* HP-UX 10.X CMA (Common Multithreaded Architecure) insists that
pthread.h must be included before all other header files.
*/
#if defined(USE_ITHREADS) && defined(PTHREAD_H_FIRST) && defined(I_PTHREAD)
# include <pthread.h>
#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
#ifdef USE_NEXT_CTYPE
#if NX_CURRENT_COMPILER_RELEASE >= 500
# include <bsd/ctypes.h>
#else
# 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 */
#endif /* NX_CURRENT_COMPILER_RELEASE >= 500 */
#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 PERL_MICRO
# define NO_LOCALE
#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
/* If this causes problems, set i_unistd=undef in the hint file. */
#ifdef I_UNISTD
# include <unistd.h>
#endif
/* for WCOREDUMP */
#ifdef I_SYS_WAIT
# include <sys/wait.h>
#endif
#ifdef __SYMBIAN32__
# undef _SC_ARG_MAX /* Symbian has _SC_ARG_MAX but no sysconf() */
#endif
#if defined(HAS_SYSCALL) && !defined(HAS_SYSCALL_PROTO) && !defined(PERL_MICRO)
EXTERN_C int syscall(int, ...);
#endif
#if defined(HAS_USLEEP) && !defined(HAS_USLEEP_PROTO) && !defined(PERL_MICRO)
EXTERN_C int usleep(unsigned int);
#endif
/* Funky places that do not have socket stuff. */
#if defined(__LIBCATAMOUNT__)
# define MYSWAP
#endif
#ifdef PERL_MICRO /* Last chance to export Perl_my_swap */
# define MYSWAP
#endif
#ifdef PERL_CORE
/* macros for correct constant construction */
# if INTSIZE >= 2
# define U16_CONST(x) ((U16)x##U)
# else
# define U16_CONST(x) ((U16)x##UL)
# endif
# if INTSIZE >= 4
# define U32_CONST(x) ((U32)x##U)
# else
# define U32_CONST(x) ((U32)x##UL)
# endif
# ifdef HAS_QUAD
# if INTSIZE >= 8
# define U64_CONST(x) ((U64)x##U)
# elif LONGSIZE >= 8
# define U64_CONST(x) ((U64)x##UL)
# elif QUADKIND == QUAD_IS_LONG_LONG
# define U64_CONST(x) ((U64)x##ULL)
# else /* best guess we can make */
# define U64_CONST(x) ((U64)x##UL)
# endif
# endif
/* byte-swapping functions for big-/little-endian conversion */
# define _swab_16_(x) ((U16)( \
(((U16)(x) & U16_CONST(0x00ff)) << 8) | \
(((U16)(x) & U16_CONST(0xff00)) >> 8) ))
# define _swab_32_(x) ((U32)( \
(((U32)(x) & U32_CONST(0x000000ff)) << 24) | \
(((U32)(x) & U32_CONST(0x0000ff00)) << 8) | \
(((U32)(x) & U32_CONST(0x00ff0000)) >> 8) | \
(((U32)(x) & U32_CONST(0xff000000)) >> 24) ))
# ifdef HAS_QUAD
# define _swab_64_(x) ((U64)( \
(((U64)(x) & U64_CONST(0x00000000000000ff)) << 56) | \
(((U64)(x) & U64_CONST(0x000000000000ff00)) << 40) | \
(((U64)(x) & U64_CONST(0x0000000000ff0000)) << 24) | \
(((U64)(x) & U64_CONST(0x00000000ff000000)) << 8) | \
(((U64)(x) & U64_CONST(0x000000ff00000000)) >> 8) | \
(((U64)(x) & U64_CONST(0x0000ff0000000000)) >> 24) | \
(((U64)(x) & U64_CONST(0x00ff000000000000)) >> 40) | \
(((U64)(x) & U64_CONST(0xff00000000000000)) >> 56) ))
# endif
/*----------------------------------------------------------------------------*/
# if BYTEORDER == 0x1234 || BYTEORDER == 0x12345678 /* little-endian */
/*----------------------------------------------------------------------------*/
# define my_htole16(x) (x)
# define my_letoh16(x) (x)
# define my_htole32(x) (x)
# define my_letoh32(x) (x)
# define my_htobe16(x) _swab_16_(x)
# define my_betoh16(x) _swab_16_(x)
# define my_htobe32(x) _swab_32_(x)
# define my_betoh32(x) _swab_32_(x)
# ifdef HAS_QUAD
# define my_htole64(x) (x)
# define my_letoh64(x) (x)
# define my_htobe64(x) _swab_64_(x)
# define my_betoh64(x) _swab_64_(x)
# endif
# define my_htoles(x) (x)
# define my_letohs(x) (x)
# define my_htolei(x) (x)
# define my_letohi(x) (x)
# define my_htolel(x) (x)
# define my_letohl(x) (x)
# if SHORTSIZE == 1
# define my_htobes(x) (x)
# define my_betohs(x) (x)
# elif SHORTSIZE == 2
# define my_htobes(x) _swab_16_(x)
# define my_betohs(x) _swab_16_(x)
# elif SHORTSIZE == 4
# define my_htobes(x) _swab_32_(x)
# define my_betohs(x) _swab_32_(x)
# elif SHORTSIZE == 8
# define my_htobes(x) _swab_64_(x)
# define my_betohs(x) _swab_64_(x)
# else
# define PERL_NEED_MY_HTOBES
# define PERL_NEED_MY_BETOHS
# endif
# if INTSIZE == 1
# define my_htobei(x) (x)
# define my_betohi(x) (x)
# elif INTSIZE == 2
# define my_htobei(x) _swab_16_(x)
# define my_betohi(x) _swab_16_(x)
# elif INTSIZE == 4
# define my_htobei(x) _swab_32_(x)
# define my_betohi(x) _swab_32_(x)
# elif INTSIZE == 8
# define my_htobei(x) _swab_64_(x)
# define my_betohi(x) _swab_64_(x)
# else
# define PERL_NEED_MY_HTOBEI
# define PERL_NEED_MY_BETOHI
# endif
# if LONGSIZE == 1
# define my_htobel(x) (x)
# define my_betohl(x) (x)
# elif LONGSIZE == 2
# define my_htobel(x) _swab_16_(x)
# define my_betohl(x) _swab_16_(x)
# elif LONGSIZE == 4
# define my_htobel(x) _swab_32_(x)
# define my_betohl(x) _swab_32_(x)
# elif LONGSIZE == 8
# define my_htobel(x) _swab_64_(x)
# define my_betohl(x) _swab_64_(x)
# else
# define PERL_NEED_MY_HTOBEL
# define PERL_NEED_MY_BETOHL
# endif
# define my_htolen(p,n) NOOP
# define my_letohn(p,n) NOOP
# define my_htoben(p,n) my_swabn(p,n)
# define my_betohn(p,n) my_swabn(p,n)
/*----------------------------------------------------------------------------*/
# elif BYTEORDER == 0x4321 || BYTEORDER == 0x87654321 /* big-endian */
/*----------------------------------------------------------------------------*/
# define my_htobe16(x) (x)
# define my_betoh16(x) (x)
# define my_htobe32(x) (x)
# define my_betoh32(x) (x)
# define my_htole16(x) _swab_16_(x)
# define my_letoh16(x) _swab_16_(x)
# define my_htole32(x) _swab_32_(x)
# define my_letoh32(x) _swab_32_(x)
# ifdef HAS_QUAD
# define my_htobe64(x) (x)
# define my_betoh64(x) (x)
# define my_htole64(x) _swab_64_(x)
# define my_letoh64(x) _swab_64_(x)
# endif
# define my_htobes(x) (x)
# define my_betohs(x) (x)
# define my_htobei(x) (x)
# define my_betohi(x) (x)
# define my_htobel(x) (x)
# define my_betohl(x) (x)
# if SHORTSIZE == 1
# define my_htoles(x) (x)
# define my_letohs(x) (x)
# elif SHORTSIZE == 2
# define my_htoles(x) _swab_16_(x)
# define my_letohs(x) _swab_16_(x)
# elif SHORTSIZE == 4
# define my_htoles(x) _swab_32_(x)
# define my_letohs(x) _swab_32_(x)
# elif SHORTSIZE == 8
# define my_htoles(x) _swab_64_(x)
# define my_letohs(x) _swab_64_(x)
# else
# define PERL_NEED_MY_HTOLES
# define PERL_NEED_MY_LETOHS
# endif
# if INTSIZE == 1
# define my_htolei(x) (x)
# define my_letohi(x) (x)
# elif INTSIZE == 2
# define my_htolei(x) _swab_16_(x)
# define my_letohi(x) _swab_16_(x)
# elif INTSIZE == 4
# define my_htolei(x) _swab_32_(x)
# define my_letohi(x) _swab_32_(x)
# elif INTSIZE == 8
# define my_htolei(x) _swab_64_(x)
# define my_letohi(x) _swab_64_(x)
# else
# define PERL_NEED_MY_HTOLEI
# define PERL_NEED_MY_LETOHI
# endif
# if LONGSIZE == 1
# define my_htolel(x) (x)
# define my_letohl(x) (x)
# elif LONGSIZE == 2
# define my_htolel(x) _swab_16_(x)
# define my_letohl(x) _swab_16_(x)
# elif LONGSIZE == 4
# define my_htolel(x) _swab_32_(x)
# define my_letohl(x) _swab_32_(x)
# elif LONGSIZE == 8
# define my_htolel(x) _swab_64_(x)
# define my_letohl(x) _swab_64_(x)
# else
# define PERL_NEED_MY_HTOLEL
# define PERL_NEED_MY_LETOHL
# endif
# define my_htolen(p,n) my_swabn(p,n)
# define my_letohn(p,n) my_swabn(p,n)
# define my_htoben(p,n) NOOP
# define my_betohn(p,n) NOOP
/*----------------------------------------------------------------------------*/
# else /* all other byte-orders */
/*----------------------------------------------------------------------------*/
# define PERL_NEED_MY_HTOLE16
# define PERL_NEED_MY_LETOH16
# define PERL_NEED_MY_HTOBE16
# define PERL_NEED_MY_BETOH16
# define PERL_NEED_MY_HTOLE32
# define PERL_NEED_MY_LETOH32
# define PERL_NEED_MY_HTOBE32
# define PERL_NEED_MY_BETOH32
# ifdef HAS_QUAD
# define PERL_NEED_MY_HTOLE64
# define PERL_NEED_MY_LETOH64
# define PERL_NEED_MY_HTOBE64
# define PERL_NEED_MY_BETOH64
# endif
# define PERL_NEED_MY_HTOLES
# define PERL_NEED_MY_LETOHS
# define PERL_NEED_MY_HTOBES
# define PERL_NEED_MY_BETOHS
# define PERL_NEED_MY_HTOLEI
# define PERL_NEED_MY_LETOHI
# define PERL_NEED_MY_HTOBEI
# define PERL_NEED_MY_BETOHI
# define PERL_NEED_MY_HTOLEL
# define PERL_NEED_MY_LETOHL
# define PERL_NEED_MY_HTOBEL
# define PERL_NEED_MY_BETOHL
/*----------------------------------------------------------------------------*/
# endif /* end of byte-order macros */
/*----------------------------------------------------------------------------*/
/* The old value was hard coded at 1008. (4096-16) seems to be a bit faster,
at least on FreeBSD. YMMV, so experiment. */
#ifndef PERL_ARENA_SIZE
#define PERL_ARENA_SIZE 4080
#endif
/* Maximum level of recursion */
#ifndef PERL_SUB_DEPTH_WARN
#define PERL_SUB_DEPTH_WARN 100
#endif
#endif /* PERL_CORE */
/* We no longer default to creating a new SV for GvSV.
Do this before embed. */
#ifndef PERL_CREATE_GVSV
# ifndef PERL_DONT_CREATE_GVSV
# define PERL_DONT_CREATE_GVSV
# endif
#endif
#if !defined(HAS_WAITPID) && !defined(HAS_WAIT4) || defined(HAS_WAITPID_RUNTIME)
#define PERL_USES_PL_PIDSTATUS
#endif
#if !defined(OS2) && !defined(WIN32) && !defined(DJGPP) && !defined(EPOC) && !defined(__SYMBIAN32__) && !defined(MACOS_TRADITIONAL)
#define PERL_DEFAULT_DO_EXEC3_IMPLEMENTATION
#endif
/* Cannot include embed.h here on Win32 as win32.h has not
yet been included and defines some config variables e.g. HAVE_INTERP_INTERN
*/
#if !defined(PERL_FOR_X2P) && !(defined(WIN32)||defined(VMS))
# include "embed.h"
# ifndef PERL_MAD
# undef op_getmad
# define op_getmad(arg,pegop,slot) NOOP
# endif
#endif
#define MEM_SIZE Size_t
/* Round all values passed to malloc up, by default to a multiple of
sizeof(size_t)
*/
#ifndef PERL_STRLEN_ROUNDUP_QUANTUM
#define PERL_STRLEN_ROUNDUP_QUANTUM Size_t_size
#endif
#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
#ifndef __SYMBIAN32__
# if defined(I_STRING) || defined(__cplusplus)
# include <string.h>
# else
# include <strings.h>
# endif
#endif