source: trunk/essentials/dev-lang/perl/pad.h@ 3310

Last change on this file since 3310 was 3181, checked in by bird, 19 years ago

perl 5.8.8

File size: 8.6 KB
Line 
1/* pad.h
2 *
3 * Copyright (C) 2002, 2003, 2005, by Larry Wall and others
4 *
5 * You may distribute under the terms of either the GNU General Public
6 * License or the Artistic License, as specified in the README file.
7 *
8 * This file defines the types and macros associated with the API for
9 * manipulating scratchpads, which are used by perl to store lexical
10 * variables, op targets and constants.
11 */
12
13
14
15
16/* a padlist is currently just an AV; but that might change,
17 * so hide the type. Ditto a pad. */
18
19typedef AV PADLIST;
20typedef AV PAD;
21
22
23/* offsets within a pad */
24
25#if PTRSIZE == 4
26typedef U32TYPE PADOFFSET;
27#else
28# if PTRSIZE == 8
29typedef U64TYPE PADOFFSET;
30# endif
31#endif
32#define NOT_IN_PAD ((PADOFFSET) -1)
33
34
35/* flags for the pad_new() function */
36
37#define padnew_CLONE 1 /* this pad is for a cloned CV */
38#define padnew_SAVE 2 /* save old globals */
39#define padnew_SAVESUB 4 /* also save extra stuff for start of sub */
40
41/* values for the pad_tidy() function */
42
43typedef enum {
44 padtidy_SUB, /* tidy up a pad for a sub, */
45 padtidy_SUBCLONE, /* a cloned sub, */
46 padtidy_FORMAT /* or a format */
47} padtidy_type;
48
49/* ASSERT_CURPAD_LEGAL and ASSERT_CURPAD_ACTIVE respectively determine
50 * whether PL_comppad and PL_curpad are consistent and whether they have
51 * active values */
52
53#ifdef DEBUGGING
54# define ASSERT_CURPAD_LEGAL(label) \
55 if (PL_comppad ? (AvARRAY(PL_comppad) != PL_curpad) : (PL_curpad != 0)) \
56 Perl_croak(aTHX_ "panic: illegal pad in %s: 0x%"UVxf"[0x%"UVxf"]",\
57 label, PTR2UV(PL_comppad), PTR2UV(PL_curpad));
58
59
60# define ASSERT_CURPAD_ACTIVE(label) \
61 if (!PL_comppad || (AvARRAY(PL_comppad) != PL_curpad)) \
62 Perl_croak(aTHX_ "panic: invalid pad in %s: 0x%"UVxf"[0x%"UVxf"]",\
63 label, PTR2UV(PL_comppad), PTR2UV(PL_curpad));
64#else
65# define ASSERT_CURPAD_LEGAL(label)
66# define ASSERT_CURPAD_ACTIVE(label)
67#endif
68