This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
For miniperl, disable PERL_UNICODE and -C.
[perl5.git] / perlapi.c
CommitLineData
37442d52
RGS
1/* -*- buffer-read-only: t -*-
2 *
d6376244
JH
3 * perlapi.c
4 *
2419183b 5 * Copyright (C) 1993, 1994, 1995, 1996, 1997, 1998, 1999,
83706693 6 * 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, by Larry Wall and others
d6376244
JH
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 *
d6376244 11 * !!!!!!! DO NOT EDIT THIS FILE !!!!!!!
f5e3445d 12 * This file is built by embed.pl from data in embed.fnc, embed.pl,
907b3e23 13 * pp.sym, intrpvar.h, and perlvars.h.
f5e3445d
RGS
14 * Any changes made here will be lost!
15 *
16 * Edit those files and run 'make regen_headers' to effect changes.
6296ff16
JH
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
64f0785e
RGS
21 * was the only entrance to the tower; ...
22 *
23 * [p.577 of _The Lord of the Rings_, III/x: "The Voice of Saruman"]
6296ff16 24 *
d6376244 25 */
51371543
GS
26
27#include "EXTERN.h"
28#include "perl.h"
29#include "perlapi.h"
30
acfe0abc 31#if defined (MULTIPLICITY)
51371543
GS
32
33/* accessor functions for Perl variables (provides binary compatibility) */
34START_EXTERN_C
35
36#undef PERLVAR
37#undef PERLVARA
38#undef PERLVARI
39#undef PERLVARIC
27da23d5 40#undef PERLVARISC
6f4183fe 41
6f4183fe 42#define PERLVAR(v,t) t* Perl_##v##_ptr(pTHX) \
96a5add6 43 { dVAR; PERL_UNUSED_CONTEXT; return &(aTHX->v); }
6f4183fe 44#define PERLVARA(v,n,t) PL_##v##_t* Perl_##v##_ptr(pTHX) \
96a5add6 45 { dVAR; PERL_UNUSED_CONTEXT; return &(aTHX->v); }
6f4183fe 46
51371543 47#define PERLVARI(v,t,i) PERLVAR(v,t)
c5be433b 48#define PERLVARIC(v,t,i) PERLVAR(v, const t)
27da23d5 49#define PERLVARISC(v,i) PL_##v##_t* Perl_##v##_ptr(pTHX) \
96a5add6 50 { dVAR; PERL_UNUSED_CONTEXT; return &(aTHX->v); }
51371543 51
51371543 52#include "intrpvar.h"
c5be433b
GS
53
54#undef PERLVAR
55#undef PERLVARA
acfe0abc 56#define PERLVAR(v,t) t* Perl_##v##_ptr(pTHX) \
96a5add6 57 { dVAR; PERL_UNUSED_CONTEXT; return &(PL_##v); }
acfe0abc 58#define PERLVARA(v,n,t) PL_##v##_t* Perl_##v##_ptr(pTHX) \
96a5add6 59 { dVAR; PERL_UNUSED_CONTEXT; return &(PL_##v); }
34f7a5fe 60#undef PERLVARIC
27da23d5
JH
61#undef PERLVARISC
62#define PERLVARIC(v,t,i) \
63 const t* Perl_##v##_ptr(pTHX) \
96a5add6 64 { PERL_UNUSED_CONTEXT; return (const t *)&(PL_##v); }
27da23d5 65#define PERLVARISC(v,i) PL_##v##_t* Perl_##v##_ptr(pTHX) \
96a5add6 66 { dVAR; PERL_UNUSED_CONTEXT; return &(PL_##v); }
51371543
GS
67#include "perlvars.h"
68
69#undef PERLVAR
70#undef PERLVARA
71#undef PERLVARI
72#undef PERLVARIC
27da23d5
JH
73#undef PERLVARISC
74
75#ifndef PERL_GLOBAL_STRUCT
76/* A few evil special cases. Could probably macrofy this. */
77#undef PL_ppaddr
78#undef PL_check
79#undef PL_fold_locale
80Perl_ppaddr_t** Perl_Gppaddr_ptr(pTHX) {
88e01c9d 81 static Perl_ppaddr_t* const ppaddr_ptr = PL_ppaddr;
96a5add6 82 PERL_UNUSED_CONTEXT;
27da23d5
JH
83 return (Perl_ppaddr_t**)&ppaddr_ptr;
84}
85Perl_check_t** Perl_Gcheck_ptr(pTHX) {
88e01c9d 86 static Perl_check_t* const check_ptr = PL_check;
96a5add6 87 PERL_UNUSED_CONTEXT;
27da23d5
JH
88 return (Perl_check_t**)&check_ptr;
89}
90unsigned char** Perl_Gfold_locale_ptr(pTHX) {
88e01c9d 91 static unsigned char* const fold_locale_ptr = PL_fold_locale;
96a5add6 92 PERL_UNUSED_CONTEXT;
27da23d5
JH
93 return (unsigned char**)&fold_locale_ptr;
94}
95#endif
51371543 96
51371543
GS
97END_EXTERN_C
98
acfe0abc 99#endif /* MULTIPLICITY */
37442d52
RGS
100
101/* ex: set ro: */