This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
If the scalar has just been upgraded to SVt_RV, there's no way SvPVX
[perl5.git] / perlapi.c
1 /*  -*- buffer-read-only: t -*-
2  *
3  *    perlapi.c
4  *
5  *    Copyright (C) 1993, 1994, 1995, 1996, 1997, 1998, 1999,
6  *    2000, 2001, 2002, 2003, 2004, 2005, 2006, by Larry Wall and others
7  *
8  *    You may distribute under the terms of either the GNU General Public
9  *    License or the Artistic License, as specified in the README file.
10  *
11  * !!!!!!!   DO NOT EDIT THIS FILE   !!!!!!!
12  * This file is built by embed.pl from data in embed.fnc, embed.pl,
13  * pp.sym, intrpvar.h, perlvars.h and thrdvar.h.
14  * Any changes made here will be lost!
15  *
16  * Edit those files and run 'make regen_headers' to effect changes.
17  *
18  *
19  * Up to the threshold of the door there mounted a flight of twenty-seven
20  * broad stairs, hewn by some unknown art of the same black stone.  This
21  * was the only entrance to the tower.
22  *
23  */
24
25 #include "EXTERN.h"
26 #include "perl.h"
27 #include "perlapi.h"
28
29 #if defined (MULTIPLICITY)
30
31 /* accessor functions for Perl variables (provides binary compatibility) */
32 START_EXTERN_C
33
34 #undef PERLVAR
35 #undef PERLVARA
36 #undef PERLVARI
37 #undef PERLVARIC
38 #undef PERLVARISC
39
40 #define PERLVAR(v,t)    t* Perl_##v##_ptr(pTHX)                         \
41                         { dVAR; PERL_UNUSED_CONTEXT; return &(aTHX->v); }
42 #define PERLVARA(v,n,t) PL_##v##_t* Perl_##v##_ptr(pTHX)                \
43                         { dVAR; PERL_UNUSED_CONTEXT; return &(aTHX->v); }
44
45 #define PERLVARI(v,t,i) PERLVAR(v,t)
46 #define PERLVARIC(v,t,i) PERLVAR(v, const t)
47 #define PERLVARISC(v,i) PL_##v##_t* Perl_##v##_ptr(pTHX)                \
48                         { dVAR; PERL_UNUSED_CONTEXT; return &(aTHX->v); }
49
50 #include "thrdvar.h"
51 #include "intrpvar.h"
52
53 #undef PERLVAR
54 #undef PERLVARA
55 #define PERLVAR(v,t)    t* Perl_##v##_ptr(pTHX)                         \
56                         { dVAR; PERL_UNUSED_CONTEXT; return &(PL_##v); }
57 #define PERLVARA(v,n,t) PL_##v##_t* Perl_##v##_ptr(pTHX)                \
58                         { dVAR; PERL_UNUSED_CONTEXT; return &(PL_##v); }
59 #undef PERLVARIC
60 #undef PERLVARISC
61 #define PERLVARIC(v,t,i)        \
62                         const t* Perl_##v##_ptr(pTHX)           \
63                         { PERL_UNUSED_CONTEXT; return (const t *)&(PL_##v); }
64 #define PERLVARISC(v,i) PL_##v##_t* Perl_##v##_ptr(pTHX)        \
65                         { dVAR; PERL_UNUSED_CONTEXT; return &(PL_##v); }
66 #include "perlvars.h"
67
68 #undef PERLVAR
69 #undef PERLVARA
70 #undef PERLVARI
71 #undef PERLVARIC
72 #undef PERLVARISC
73
74 #ifndef PERL_GLOBAL_STRUCT
75 /* A few evil special cases.  Could probably macrofy this. */
76 #undef PL_ppaddr
77 #undef PL_check
78 #undef PL_fold_locale
79 Perl_ppaddr_t** Perl_Gppaddr_ptr(pTHX) {
80     static const Perl_ppaddr_t* const ppaddr_ptr = PL_ppaddr;
81     PERL_UNUSED_CONTEXT;
82     return (Perl_ppaddr_t**)&ppaddr_ptr;
83 }
84 Perl_check_t**  Perl_Gcheck_ptr(pTHX) {
85     static const Perl_check_t* const check_ptr  = PL_check;
86     PERL_UNUSED_CONTEXT;
87     return (Perl_check_t**)&check_ptr;
88 }
89 unsigned char** Perl_Gfold_locale_ptr(pTHX) {
90     static const unsigned char* const fold_locale_ptr = PL_fold_locale;
91     PERL_UNUSED_CONTEXT;
92     return (unsigned char**)&fold_locale_ptr;
93 }
94 #endif
95
96 END_EXTERN_C
97
98 #endif /* MULTIPLICITY */
99
100 /* ex: set ro: */