📄 perl.h
字号:
# define DEBUG_S(a) if (PL_debug & (1<<16)) a
# else
# define DEBUG_S(a)
# endif
#else
#define DEB(a)
#define DEBUG(a)
#define DEBUG_p(a)
#define DEBUG_s(a)
#define DEBUG_l(a)
#define DEBUG_t(a)
#define DEBUG_o(a)
#define DEBUG_c(a)
#define DEBUG_P(a)
#define DEBUG_m(a)
#define DEBUG_f(a)
#define DEBUG_r(a)
#define DEBUG_x(a)
#define DEBUG_u(a)
#define DEBUG_S(a)
#define DEBUG_H(a)
#define DEBUG_X(a)
#define DEBUG_D(a)
#define DEBUG_S(a)
#endif
#define YYMAXDEPTH 300
#ifndef assert /* <assert.h> might have been included somehow */
#define assert(what) DEB( { \
if (!(what)) { \
croak("Assertion failed: file \"%s\", line %d", \
__FILE__, __LINE__); \
PerlProc_exit(1); \
}})
#endif
struct ufuncs {
I32 (*uf_val)_((IV, SV*));
I32 (*uf_set)_((IV, SV*));
IV uf_index;
};
/* Fix these up for __STDC__ */
#ifndef DONT_DECLARE_STD
char *mktemp _((char*));
double atof _((const char*));
#endif
#ifndef STANDARD_C
/* All of these are in stdlib.h or time.h for ANSI C */
Time_t time();
struct tm *gmtime(), *localtime();
#ifdef OEMVS
char *(strchr)(), *(strrchr)();
char *(strcpy)(), *(strcat)();
#else
char *strchr(), *strrchr();
char *strcpy(), *strcat();
#endif
#endif /* ! STANDARD_C */
#ifdef I_MATH
# include <math.h>
#else
START_EXTERN_C
double exp _((double));
double log _((double));
double log10 _((double));
double sqrt _((double));
double frexp _((double,int*));
double ldexp _((double,int));
double modf _((double,double*));
double sin _((double));
double cos _((double));
double atan2 _((double,double));
double pow _((double,double));
END_EXTERN_C
#endif
#ifndef __cplusplus
# ifdef __NeXT__ /* or whatever catches all NeXTs */
char *crypt (); /* Maybe more hosts will need the unprototyped version */
# else
# if !defined(WIN32) || !defined(HAVE_DES_FCRYPT)
char *crypt _((const char*, const char*));
# endif /* !WIN32 && !HAVE_CRYPT_SOURCE */
# endif /* !__NeXT__ */
# ifndef DONT_DECLARE_STD
# ifndef getenv
char *getenv _((const char*));
# endif /* !getenv */
Off_t lseek _((int,Off_t,int));
# endif /* !DONT_DECLARE_STD */
char *getlogin _((void));
#endif /* !__cplusplus */
#ifdef UNLINK_ALL_VERSIONS /* Currently only makes sense for VMS */
#define UNLINK unlnk
I32 unlnk _((char*));
#else
#define UNLINK PerlLIO_unlink
#endif
#ifndef HAS_SETREUID
# ifdef HAS_SETRESUID
# define setreuid(r,e) setresuid(r,e,(Uid_t)-1)
# define HAS_SETREUID
# endif
#endif
#ifndef HAS_SETREGID
# ifdef HAS_SETRESGID
# define setregid(r,e) setresgid(r,e,(Gid_t)-1)
# define HAS_SETREGID
# endif
#endif
typedef Signal_t (*Sighandler_t) _((int));
#ifdef HAS_SIGACTION
typedef struct sigaction Sigsave_t;
#else
typedef Sighandler_t Sigsave_t;
#endif
#define SCAN_DEF 0
#define SCAN_TR 1
#define SCAN_REPL 2
#ifdef DEBUGGING
# ifndef register
# define register
# endif
# define PAD_SV(po) pad_sv(po)
# define RUNOPS_DEFAULT runops_debug
#else
# define PAD_SV(po) PL_curpad[po]
# define RUNOPS_DEFAULT runops_standard
#endif
#ifdef MYMALLOC
# define MALLOC_INIT MUTEX_INIT(&PL_malloc_mutex)
# define MALLOC_TERM MUTEX_DESTROY(&PL_malloc_mutex)
#else
# define MALLOC_INIT
# define MALLOC_TERM
#endif
/*
* These need prototyping here because <proto.h> isn't
* included until after runops is initialised.
*/
#ifndef PERL_OBJECT
typedef int runops_proc_t _((void));
int runops_standard _((void));
#ifdef DEBUGGING
int runops_debug _((void));
#endif
#endif /* PERL_OBJECT */
/* _ (for $_) must be first in the following list (DEFSV requires it) */
#define THREADSV_NAMES "_123456789&`'+/.,\\\";^-%=|~:\001\005!@"
/* VMS doesn't use environ array and NeXT has problems with crt0.o globals */
#if !defined(VMS) && !(defined(NeXT) && defined(__DYNAMIC__))
#if !defined(DONT_DECLARE_STD) \
|| (defined(__svr4__) && defined(__GNUC__) && defined(sun)) \
|| defined(__sgi) || defined(__DGUX)
extern char ** environ; /* environment variables supplied via exec */
#endif
#else
# if defined(NeXT) && defined(__DYNAMIC__)
# include <mach-o/dyld.h>
EXT char *** environ_pointer;
# define environ (*environ_pointer)
# endif
#endif /* environ processing */
/* for tmp use in stupid debuggers */
EXT int * di;
EXT short * ds;
EXT char * dc;
/* handy constants */
EXTCONST char warn_uninit[]
INIT("Use of uninitialized value");
EXTCONST char warn_nosemi[]
INIT("Semicolon seems to be missing");
EXTCONST char warn_reserved[]
INIT("Unquoted string \"%s\" may clash with future reserved word");
EXTCONST char warn_nl[]
INIT("Unsuccessful %s on filename containing newline");
EXTCONST char no_wrongref[]
INIT("Can't use %s ref as %s ref");
EXTCONST char no_symref[]
INIT("Can't use string (\"%.32s\") as %s ref while \"strict refs\" in use");
EXTCONST char no_usym[]
INIT("Can't use an undefined value as %s reference");
EXTCONST char no_aelem[]
INIT("Modification of non-creatable array value attempted, subscript %d");
EXTCONST char no_helem[]
INIT("Modification of non-creatable hash value attempted, subscript \"%s\"");
EXTCONST char no_modify[]
INIT("Modification of a read-only value attempted");
EXTCONST char no_mem[]
INIT("Out of memory!\n");
EXTCONST char no_security[]
INIT("Insecure dependency in %s%s");
EXTCONST char no_sock_func[]
INIT("Unsupported socket function \"%s\" called");
EXTCONST char no_dir_func[]
INIT("Unsupported directory function \"%s\" called");
EXTCONST char no_func[]
INIT("The %s function is unimplemented");
EXTCONST char no_myglob[]
INIT("\"my\" variable %s can't be in a package");
#ifdef DOINIT
EXT char *sig_name[] = { SIG_NAME };
EXT int sig_num[] = { SIG_NUM };
EXT SV * psig_ptr[sizeof(sig_num)/sizeof(*sig_num)];
EXT SV * psig_name[sizeof(sig_num)/sizeof(*sig_num)];
#else
EXT char *sig_name[];
EXT int sig_num[];
EXT SV * psig_ptr[];
EXT SV * psig_name[];
#endif
/* fast case folding tables */
#ifdef DOINIT
#ifdef EBCDIC
EXT unsigned char fold[] = { /* fast EBCDIC case folding table */
0, 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, 'A', 'B', 'C', 'D', 'E', 'F', 'G',
'H', 'I', 138, 139, 140, 141, 142, 143,
144, 'J', 'K', 'L', 'M', 'N', 'O', 'P',
'Q', 'R', 154, 155, 156, 157, 158, 159,
160, 161, 'S', 'T', 'U', 'V', 'W', 'X',
'Y', 'Z', 170, 171, 172, 173, 174, 175,
176, 177, 178, 179, 180, 181, 182, 183,
184, 185, 186, 187, 188, 189, 190, 191,
192, 'a', 'b', 'c', 'd', 'e', 'f', 'g',
'h', 'i', 202, 203, 204, 205, 206, 207,
208, 'j', 'k', 'l', 'm', 'n', 'o', 'p',
'q', 'r', 218, 219, 220, 221, 222, 223,
224, 225, 's', 't', 'u', 'v', 'w', 'x',
'y', 'z', 234, 235, 236, 237, 238, 239,
240, 241, 242, 243, 244, 245, 246, 247,
248, 249, 250, 251, 252, 253, 254, 255
};
#else /* ascii rather than ebcdic */
EXTCONST unsigned char fold[] = {
0, 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, 'a', 'b', 'c', 'd', 'e', 'f', 'g',
'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o',
'p', 'q', 'r', 's', 't', 'u', 'v', 'w',
'x', 'y', 'z', 91, 92, 93, 94, 95,
96, 'A', 'B', 'C', 'D', 'E', 'F', 'G',
'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O',
'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W',
'X', 'Y', 'Z', 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
};
#endif /* !EBCDIC */
#else
EXTCONST unsigned char fold[];
#endif
#ifdef DOINIT
EXT unsigned char fold_locale[] = {
0, 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, 'a', 'b', 'c', 'd', 'e', 'f', 'g',
'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o',
'p', 'q', 'r', 's', 't', 'u', 'v', 'w',
'x', 'y', 'z', 91, 92, 93, 94, 95,
96, 'A', 'B', 'C', 'D', 'E', 'F', 'G',
'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O',
'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W',
'X', 'Y', 'Z', 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
};
#else
EXT unsigned char fold_locale[];
#endif
#ifdef DOINIT
#ifdef EBCDIC
EXT unsigned char freq[] = {/* EBCDIC frequencies for mixed English/C */
1, 2, 84, 151, 154, 155, 156, 157,
165, 246, 250, 3, 158, 7, 18, 29,
40, 51, 62, 73, 85, 96, 107, 118,
129, 140, 147, 148, 149, 150, 152, 153,
255, 6, 8, 9, 10, 11, 12, 13,
14, 15, 24, 25, 26, 27, 28, 226,
29, 30, 31, 32, 33, 43, 44, 45,
46, 47, 48, 49, 50, 76, 77, 78,
79, 80, 81, 82, 83, 84, 85, 86,
87, 94, 95, 234, 181, 233, 187, 190,
180, 96, 97, 98, 99, 100, 101, 102,
104, 112, 182, 174, 236, 232, 229, 103,
228, 226, 114, 115, 116, 117, 118, 119,
120, 121, 122, 235, 176, 230, 194, 162,
130, 131, 132, 133, 134, 135, 136, 137,
138, 139, 201, 205, 163, 217, 220, 224,
5, 248, 227, 244, 242, 255, 241, 231,
240, 253, 16, 197, 19, 20, 21, 187,
23, 169, 210, 245, 237, 249, 247, 239,
168, 252, 34, 196, 36, 37, 38, 39,
41, 42, 251, 254, 238, 223, 221, 213,
225, 177, 52, 53, 54, 55, 56, 57,
58, 59, 60, 61, 63, 64, 65, 66,
67, 68, 69, 70, 71, 72, 74, 75,
205, 208, 186, 202, 200, 218, 198, 179,
178, 214, 88, 89, 90, 91, 92, 93,
217, 166, 170, 207, 199, 209, 206, 204,
160, 212, 105, 106, 108, 109, 110, 111,
203, 113, 216, 215, 192, 175, 193, 243,
172, 161, 123, 124, 125, 126, 127, 128,
222, 219, 211, 195, 188, 193, 185, 184,
191, 183, 141, 142, 143, 144, 145, 146
};
#else /* ascii rather than ebcdic */
EXTCONST unsigned char freq[] = { /* letter frequencies for mixed English/C */
1, 2, 84, 151, 154, 155, 156, 157,
165, 246, 250, 3, 158, 7, 18, 29,
40, 51, 62, 73, 85, 96, 107, 118,
129, 140, 147, 148, 149, 150, 152, 153,
255, 182, 224, 205, 174, 176, 180, 217,
233, 232, 236, 187, 235, 228, 234, 226,
222, 219, 211, 195, 188, 193, 185, 184,
191, 183, 201, 229, 181, 220, 194, 162,
163, 208, 186, 202, 200, 218, 198, 179,
178, 214, 166, 170, 207, 199, 209, 206,
204, 160, 212, 216, 215, 192, 175, 173,
243, 172, 161, 190, 203, 189, 164, 230,
167, 248, 227, 244, 242, 255, 241, 231,
240, 253, 169, 210, 245, 237, 249, 247,
239, 168, 252, 251, 254, 238, 223, 221,
213, 225, 177, 197, 171, 196, 159, 4,
5, 6, 8, 9, 10, 11, 12, 13,
14, 15, 16, 17, 19, 20, 21, 22,
23, 24, 25, 26, 27, 28, 30, 31,
32, 33, 34, 35, 36, 37, 38, 39,
41, 42, 43, 44, 45, 46, 47, 48,
49, 50, 52, 53, 54, 55, 56, 57,
58, 59, 60, 61, 63, 64, 65, 66,
67, 68, 69, 70, 71, 72, 74, 75,
76, 77, 78, 79, 80, 81, 82, 83,
86, 87, 88, 89, 90, 91, 92, 93,
94, 95, 97, 98, 99, 100, 101, 102,
103, 104, 105, 106, 108, 109, 110, 111,
112, 113, 114, 115, 116, 117, 119, 120,
121, 122, 123, 124, 125, 126, 127, 128,
130, 131, 132, 133, 134, 135, 136, 137,
138, 139, 141, 142, 143, 144, 145, 146
};
#endif
#else
EXTCONST unsigned char freq[];
#endif
#ifdef DEBUGGING
#ifdef DOINIT
EXTCONST char* block_type[] = {
"NULL",
"SUB",
"EVAL",
"LOOP",
"SUBST",
"BLOCK",
};
#else
EXTCONST char* block_type[];
#endif
#endif
/*****************************************************************************/
/* This lexer/parser stuff is currently global since yacc is hard to reenter */
/*****************************************************************************/
/* XXX This needs to be revisited, since BEGIN makes yacc re-enter... */
#include "perly.h"
#define LEX_NOTPARSING 11 /* borrowed from toke.c */
typedef enum {
XOPERATOR,
XTERM,
XREF,
XSTATE,
XBLOCK,
XTERMBLOCK
} expectation;
enum { /* pass one of these to get_vtbl */
want_vtbl_sv,
want_vtbl_env,
want_vtbl_envelem,
want_vtbl_sig,
want_vtbl_sigelem,
want_vtbl_pack,
want_vtbl_packelem,
want_vtbl_dbline,
want_vtbl_isa,
want_vtbl_isaelem,
want_vtbl_arylen,
want_vtbl_glob,
want_vtbl_mglob,
want_vtbl_nkeys,
want_vtbl_taint,
want_vtbl_substr,
want_vtbl_vec,
want_vtbl_pos,
want_vtbl_bm,
want_vtbl_fm,
want_vtbl_uvar,
want_vtbl_defelem,
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -