This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
[perl #113718] Add inline.h
[perl5.git] / regen / embed.pl
CommitLineData
5f05dabc 1#!/usr/bin/perl -w
6294c161
DM
2#
3# Regenerate (overwriting only if changed):
4#
5# embed.h
6# embedvar.h
6294c161
DM
7# perlapi.c
8# perlapi.h
9# proto.h
10#
11# from information stored in
12#
13# embed.fnc
14# intrpvar.h
15# perlvars.h
897d3989 16# regen/opcodes
6294c161 17#
6294c161
DM
18# Accepts the standard regen_lib -q and -v args.
19#
20# This script is normally invoked from regen.pl.
e50aee73 21
916e4025 22require 5.004; # keep this compatible, an old perl is all we may have before
954c1994 23 # we build the new one
5f05dabc 24
88e01c9d
AL
25use strict;
26
36bb303b
NC
27BEGIN {
28 # Get function prototypes
af001346 29 require 'regen/regen_lib.pl';
cdde42af 30 require 'regen/embed_lib.pl';
36bb303b
NC
31}
32
88e01c9d 33my $SPLINT = 0; # Turn true for experimental splint support http://www.splint.org
916e4025 34my $unflagged_pointers;
88e01c9d 35
cea2e8a9 36#
346f75ff 37# See database of global and static function prototypes in embed.fnc
cea2e8a9
GS
38# This is used to generate prototype headers under various configurations,
39# export symbols lists for different platforms, and macros to provide an
40# implicit interpreter context argument.
41#
42
5f8dc073 43sub open_print_header {
56fd1190 44 my ($file, $quote) = @_;
4373e329 45
5f8dc073
NC
46 return open_new($file, '>',
47 { file => $file, style => '*', by => 'regen/embed.pl',
48 from => ['data in embed.fnc', 'regen/embed.pl',
49 'regen/opcodes', 'intrpvar.h', 'perlvars.h'],
50 final => "\nEdit those files and run 'make regen_headers' to effect changes.\n",
51 copyright => [1993 .. 2009], quote => $quote });
52}
7f1be197 53
5ccbf88e
NC
54my ($embed, $core, $ext, $api) = setup_embed();
55
cea2e8a9 56# generate proto.h
9516dc40 57{
5f8dc073
NC
58 my $pr = open_print_header("proto.h");
59 print $pr "START_EXTERN_C\n";
f8394530 60 my $ret;
9516dc40 61
5ccbf88e 62 foreach (@$embed) {
9516dc40
NC
63 if (@$_ == 1) {
64 print $pr "$_->[0]\n";
65 next;
66 }
67
68 my ($flags,$retval,$plain_func,@args) = @$_;
4373e329
AL
69 my @nonnull;
70 my $has_context = ( $flags !~ /n/ );
88e01c9d
AL
71 my $never_returns = ( $flags =~ /r/ );
72 my $commented_out = ( $flags =~ /m/ );
aa4ca557 73 my $binarycompat = ( $flags =~ /b/ );
88e01c9d
AL
74 my $is_malloc = ( $flags =~ /a/ );
75 my $can_ignore = ( $flags !~ /R/ ) && !$is_malloc;
7918f24d
NC
76 my @names_of_nn;
77 my $func;
88e01c9d
AL
78
79 my $splint_flags = "";
80 if ( $SPLINT && !$commented_out ) {
81 $splint_flags .= '/*@noreturn@*/ ' if $never_returns;
82 if ($can_ignore && ($retval ne 'void') && ($retval !~ /\*/)) {
83 $retval .= " /*\@alt void\@*/";
84 }
85 }
86
71556506
KW
87 if ($flags =~ /([si])/) {
88 my $type = ($1 eq 's') ? "STATIC" : "PERL_STATIC_INLINE";
89 warn "$func: i and s flags are mutually exclusive"
90 if $flags =~ /s/ && $flags =~ /i/;
91 $retval = "$type $splint_flags$retval";
7918f24d 92 $func = "S_$plain_func";
cea2e8a9 93 }
0cb96387 94 else {
718fae11
JD
95 if ($never_returns) {
96 $retval = "PERL_CALLCONV_NO_RET $splint_flags$retval";
97 }
98 else {
99 $retval = "PERL_CALLCONV $splint_flags$retval";
100 }
101 if ($flags =~ /[bp]/) {
7918f24d 102 $func = "Perl_$plain_func";
718fae11
JD
103 }
104 else {
7918f24d 105 $func = $plain_func;
0cb96387 106 }
cea2e8a9 107 }
f8394530 108 $ret = "$retval\t$func(";
4373e329
AL
109 if ( $has_context ) {
110 $ret .= @args ? "pTHX_ " : "pTHX";
cea2e8a9
GS
111 }
112 if (@args) {
4373e329
AL
113 my $n;
114 for my $arg ( @args ) {
115 ++$n;
7827dc65
AL
116 if ( $arg =~ /\*/ && $arg !~ /\b(NN|NULLOK)\b/ ) {
117 warn "$func: $arg needs NN or NULLOK\n";
7827dc65
AL
118 ++$unflagged_pointers;
119 }
88e01c9d
AL
120 my $nn = ( $arg =~ s/\s*\bNN\b\s+// );
121 push( @nonnull, $n ) if $nn;
122
123 my $nullok = ( $arg =~ s/\s*\bNULLOK\b\s+// ); # strip NULLOK with no effect
c48640ec
AL
124
125 # Make sure each arg has at least a type and a var name.
126 # An arg of "int" is valid C, but want it to be "int foo".
127 my $temp_arg = $arg;
128 $temp_arg =~ s/\*//g;
129 $temp_arg =~ s/\s*\bstruct\b\s*/ /g;
7918f24d
NC
130 if ( ($temp_arg ne "...")
131 && ($temp_arg !~ /\w+\s+(\w+)(?:\[\d+\])?\s*$/) ) {
132 warn "$func: $arg ($n) doesn't have a name\n";
c48640ec 133 }
88e01c9d
AL
134 if ( $SPLINT && $nullok && !$commented_out ) {
135 $arg = '/*@null@*/ ' . $arg;
136 }
aa4ca557 137 if (defined $1 && $nn && !($commented_out && !$binarycompat)) {
7918f24d
NC
138 push @names_of_nn, $1;
139 }
4373e329 140 }
cea2e8a9
GS
141 $ret .= join ", ", @args;
142 }
143 else {
4373e329 144 $ret .= "void" if !$has_context;
cea2e8a9
GS
145 }
146 $ret .= ")";
f54cb97a
AL
147 my @attrs;
148 if ( $flags =~ /r/ ) {
abb2c242 149 push @attrs, "__attribute__noreturn__";
f54cb97a 150 }
a5c26493
RGS
151 if ( $flags =~ /D/ ) {
152 push @attrs, "__attribute__deprecated__";
153 }
88e01c9d 154 if ( $is_malloc ) {
abb2c242 155 push @attrs, "__attribute__malloc__";
f54cb97a 156 }
88e01c9d 157 if ( !$can_ignore ) {
abb2c242 158 push @attrs, "__attribute__warn_unused_result__";
f54cb97a
AL
159 }
160 if ( $flags =~ /P/ ) {
abb2c242 161 push @attrs, "__attribute__pure__";
f54cb97a 162 }
1c846c1f 163 if( $flags =~ /f/ ) {
cdfeb707
RB
164 my $prefix = $has_context ? 'pTHX_' : '';
165 my $args = scalar @args;
166 my $pat = $args - 1;
167 my $macro = @nonnull && $nonnull[-1] == $pat
168 ? '__attribute__format__'
169 : '__attribute__format__null_ok__';
170 push @attrs, sprintf "%s(__printf__,%s%d,%s%d)", $macro,
171 $prefix, $pat, $prefix, $args;
894356b3 172 }
4373e329 173 if ( @nonnull ) {
3d42dc86 174 my @pos = map { $has_context ? "pTHX_$_" : $_ } @nonnull;
abb2c242 175 push @attrs, map { sprintf( "__attribute__nonnull__(%s)", $_ ) } @pos;
f54cb97a
AL
176 }
177 if ( @attrs ) {
178 $ret .= "\n";
179 $ret .= join( "\n", map { "\t\t\t$_" } @attrs );
4373e329 180 }
af3c7592 181 $ret .= ";";
88e01c9d 182 $ret = "/* $ret */" if $commented_out;
7918f24d
NC
183 if (@names_of_nn) {
184 $ret .= "\n#define PERL_ARGS_ASSERT_\U$plain_func\E\t\\\n\t"
185 . join '; ', map "assert($_)", @names_of_nn;
186 }
f54cb97a 187 $ret .= @attrs ? "\n\n" : "\n";
9516dc40
NC
188
189 print $pr $ret;
cea2e8a9 190 }
9516dc40 191
897d3989
NC
192 print $pr <<'EOF';
193#ifdef PERL_CORE
194# include "pp_proto.h"
195#endif
196END_EXTERN_C
897d3989 197EOF
9516dc40 198
ce716c52 199 read_only_bottom_close_and_rename($pr);
cea2e8a9
GS
200}
201
7827dc65 202warn "$unflagged_pointers pointer arguments to clean up\n" if $unflagged_pointers;
cea2e8a9 203
adf34b4b
NC
204sub readvars {
205 my ($file, $pre) = @_;
d4cce5f1 206 local (*FILE, $_);
adf34b4b 207 my %seen;
d4cce5f1
NIS
208 open(FILE, "< $file")
209 or die "embed.pl: Can't open $file: $!\n";
210 while (<FILE>) {
211 s/[ \t]*#.*//; # Delete comments.
115ff745 212 if (/PERLVARA?I?C?\($pre,\s*(\w+)/) {
adf34b4b
NC
213 warn "duplicate symbol $1 while processing $file line $.\n"
214 if $seen{$1}++;
d4cce5f1
NIS
215 }
216 }
217 close(FILE);
adf34b4b 218 return sort keys %seen;
d4cce5f1
NIS
219}
220
adf34b4b
NC
221my @intrp = readvars 'intrpvar.h','I';
222my @globvar = readvars 'perlvars.h','G';
d4cce5f1 223
125218eb
NC
224sub hide {
225 my ($from, $to, $indent) = @_;
226 $indent = '' unless defined $indent;
227 my $t = int(length("$indent$from") / 8);
228 "#${indent}define $from" . "\t" x ($t < 3 ? 3 - $t : 1) . "$to\n";
5f05dabc 229}
c6af7a1a 230
d4cce5f1
NIS
231sub multon ($$$) {
232 my ($sym,$pre,$ptr) = @_;
3280af22 233 hide("PL_$sym", "($ptr$pre$sym)");
5f05dabc 234}
54aff467 235
5f8dc073 236my $em = open_print_header('embed.h');
e50aee73 237
5f8dc073 238print $em <<'END';
e50aee73
AD
239/* (Doing namespace management portably in C is really gross.) */
240
d51482e4
JH
241/* By defining PERL_NO_SHORT_NAMES (not done by default) the short forms
242 * (like warn instead of Perl_warn) for the API are not defined.
243 * Not defining the short forms is a good thing for cleaner embedding. */
244
245#ifndef PERL_NO_SHORT_NAMES
820c3be9 246
22c35a8c 247/* Hide global symbols */
5f05dabc 248
e50aee73
AD
249END
250
cea2e8a9
GS
251my @az = ('a'..'z');
252
e8a67806
NC
253sub embed_h {
254 my ($guard, $funcs) = @_;
255 print $em "$guard\n" if $guard;
256
2a4d8072 257 my $lines;
e8a67806
NC
258 foreach (@$funcs) {
259 if (@$_ == 1) {
260 my $cond = $_->[0];
261 # Indent the conditionals if we are wrapped in an #if/#endif pair.
262 $cond =~ s/#(.*)/# $1/ if $guard;
2a4d8072 263 $lines .= "$cond\n";
e8a67806
NC
264 next;
265 }
266 my $ret = "";
267 my ($flags,$retval,$func,@args) = @$_;
af3c7592 268 unless ($flags =~ /[om]/) {
cea2e8a9 269 my $args = scalar @args;
7a5a24f7 270 if ($flags =~ /n/) {
cea2e8a9 271 if ($flags =~ /s/) {
f8394530 272 $ret = hide($func,"S_$func");
cea2e8a9
GS
273 }
274 elsif ($flags =~ /p/) {
f8394530 275 $ret = hide($func,"Perl_$func");
cea2e8a9
GS
276 }
277 }
7a5a24f7 278 elsif ($args and $args[$args-1] =~ /\.\.\./) {
e64ca59f
NC
279 if ($flags =~ /p/) {
280 # we're out of luck for varargs functions under CPP
281 # So we can only do these macros for no implicit context:
282 $ret = "#ifndef PERL_IMPLICIT_CONTEXT\n"
283 . hide($func,"Perl_$func") . "#endif\n";
284 }
7a5a24f7 285 }
cea2e8a9
GS
286 else {
287 my $alist = join(",", @az[0..$args-1]);
288 $ret = "#define $func($alist)";
289 my $t = int(length($ret) / 8);
290 $ret .= "\t" x ($t < 4 ? 4 - $t : 1);
71556506 291 if ($flags =~ /[si]/) {
cea2e8a9
GS
292 $ret .= "S_$func(aTHX";
293 }
294 elsif ($flags =~ /p/) {
295 $ret .= "Perl_$func(aTHX";
296 }
297 $ret .= "_ " if $alist;
298 $ret .= $alist . ")\n";
299 }
300 }
2a4d8072 301 $lines .= $ret;
cea2e8a9 302 }
2a4d8072
NC
303 # Prune empty #if/#endif pairs.
304 while ($lines =~ s/#\s*if[^\n]+\n#\s*endif\n//) {
305 }
b2e549c0
NC
306 # Merge adjacent blocks.
307 while ($lines =~ s/(#ifndef PERL_IMPLICIT_CONTEXT
308[^\n]+
309)#endif
310#ifndef PERL_IMPLICIT_CONTEXT
311/$1/) {
312 }
313
2a4d8072 314 print $em $lines;
e8a67806 315 print $em "#endif\n" if $guard;
da4ddda1
NC
316}
317
5ccbf88e
NC
318embed_h('', $api);
319embed_h('#if defined(PERL_CORE) || defined(PERL_EXT)', $ext);
320embed_h('#ifdef PERL_CORE', $core);
e8a67806 321
424a4936 322print $em <<'END';
e50aee73 323
d51482e4 324#endif /* #ifndef PERL_NO_SHORT_NAMES */
35209cc8 325
cea2e8a9
GS
326/* Compatibility stubs. Compile extensions with -DPERL_NOCOMPAT to
327 disable them.
328 */
329
538feb02 330#if !defined(PERL_CORE)
5bc28da9 331# define sv_setptrobj(rv,ptr,name) sv_setref_iv(rv,name,PTR2IV(ptr))
a0714e2c 332# define sv_setptrref(rv,ptr) sv_setref_iv(rv,NULL,PTR2IV(ptr))
538feb02 333#endif
cea2e8a9 334
08e5223a 335#if !defined(PERL_CORE) && !defined(PERL_NOCOMPAT)
cea2e8a9
GS
336
337/* Compatibility for various misnamed functions. All functions
338 in the API that begin with "perl_" (not "Perl_") take an explicit
339 interpreter context pointer.
340 The following are not like that, but since they had a "perl_"
341 prefix in previous versions, we provide compatibility macros.
342 */
65cec589 343# define perl_atexit(a,b) call_atexit(a,b)
7b53c8ee
NC
344END
345
3a54c8e7
NC
346foreach (@$embed) {
347 my ($flags, $retval, $func, @args) = @$_;
348 next unless $func;
349 next unless $flags =~ /O/;
7b53c8ee
NC
350
351 my $alist = join ",", @az[0..$#args];
352 my $ret = "# define perl_$func($alist)";
353 my $t = (length $ret) >> 3;
354 $ret .= "\t" x ($t < 5 ? 5 - $t : 1);
3a54c8e7
NC
355 print $em "$ret$func($alist)\n";
356}
7b53c8ee 357
eacd26c2
NC
358my @nocontext;
359{
360 my (%has_va, %has_nocontext);
5ccbf88e 361 foreach (@$embed) {
eacd26c2
NC
362 next unless @$_ > 1;
363 ++$has_va{$_->[2]} if $_->[-1] =~ /\.\.\./;
364 ++$has_nocontext{$1} if $_->[2] =~ /(.*)_nocontext/;
365 }
366
367 @nocontext = sort grep {
368 $has_nocontext{$_}
369 && !/printf/ # Not clear to me why these are skipped but they are.
370 } keys %has_va;
371}
372
7b53c8ee 373print $em <<'END';
cea2e8a9
GS
374
375/* varargs functions can't be handled with CPP macros. :-(
376 This provides a set of compatibility functions that don't take
377 an extra argument but grab the context pointer using the macro
378 dTHX.
379 */
d51482e4 380#if defined(PERL_IMPLICIT_CONTEXT) && !defined(PERL_NO_SHORT_NAMES)
125218eb
NC
381END
382
eacd26c2 383foreach (@nocontext) {
125218eb
NC
384 print $em hide($_, "Perl_${_}_nocontext", " ");
385}
386
387print $em <<'END';
cea2e8a9
GS
388#endif
389
390#endif /* !defined(PERL_CORE) && !defined(PERL_NOCOMPAT) */
391
392#if !defined(PERL_IMPLICIT_CONTEXT)
393/* undefined symbols, point them back at the usual ones */
125218eb
NC
394END
395
eacd26c2 396foreach (@nocontext) {
125218eb
NC
397 print $em hide("Perl_${_}_nocontext", "Perl_$_", " ");
398}
399
400print $em <<'END';
cea2e8a9 401#endif
d4cce5f1
NIS
402END
403
ce716c52 404read_only_bottom_close_and_rename($em);
d4cce5f1 405
5f8dc073 406$em = open_print_header('embedvar.h');
d4cce5f1 407
5f8dc073 408print $em <<'END';
d4cce5f1
NIS
409/* (Doing namespace management portably in C is really gross.) */
410
54aff467 411/*
3db8f154
MB
412 The following combinations of MULTIPLICITY and PERL_IMPLICIT_CONTEXT
413 are supported:
54aff467
GS
414 1) none
415 2) MULTIPLICITY # supported for compatibility
416 3) MULTIPLICITY && PERL_IMPLICIT_CONTEXT
54aff467
GS
417
418 All other combinations of these flags are errors.
419
3db8f154 420 only #3 is supported directly, while #2 is a special
54aff467
GS
421 case of #3 (supported by redefining vTHX appropriately).
422*/
cea2e8a9 423
54aff467 424#if defined(MULTIPLICITY)
3db8f154 425/* cases 2 and 3 above */
cea2e8a9 426
54aff467
GS
427# if defined(PERL_IMPLICIT_CONTEXT)
428# define vTHX aTHX
429# else
430# define vTHX PERL_GET_INTERP
431# endif
cea2e8a9 432
e50aee73
AD
433END
434
adf34b4b
NC
435my $sym;
436
437for $sym (@intrp) {
424a4936 438 print $em multon($sym,'I','vTHX->');
d4cce5f1
NIS
439}
440
424a4936 441print $em <<'END';
d4cce5f1 442
54aff467 443#endif /* MULTIPLICITY */
d4cce5f1 444
54aff467 445#if defined(PERL_GLOBAL_STRUCT)
22239a37
NIS
446
447END
448
adf34b4b 449for $sym (@globvar) {
0447859b 450 print $em "#ifdef OS2\n" if $sym eq 'sh_path';
424a4936
NC
451 print $em multon($sym, 'G','my_vars->');
452 print $em multon("G$sym",'', 'my_vars->');
0447859b 453 print $em "#endif\n" if $sym eq 'sh_path';
22239a37
NIS
454}
455
424a4936 456print $em <<'END';
22239a37 457
22239a37 458#endif /* PERL_GLOBAL_STRUCT */
84fee439
NIS
459END
460
ce716c52 461read_only_bottom_close_and_rename($em);
c6af7a1a 462
5f8dc073 463my $capih = open_print_header('perlapi.h');
51371543 464
5f8dc073 465print $capih <<'EOT';
51371543 466/* declare accessor functions for Perl variables */
6f4183fe
GS
467#ifndef __perlapi_h__
468#define __perlapi_h__
51371543 469
87b9e160 470#if defined (MULTIPLICITY) && defined (PERL_GLOBAL_STRUCT)
c5be433b 471
51371543
GS
472START_EXTERN_C
473
474#undef PERLVAR
475#undef PERLVARA
476#undef PERLVARI
477#undef PERLVARIC
115ff745
NC
478#define PERLVAR(p,v,t) EXTERN_C t* Perl_##p##v##_ptr(pTHX);
479#define PERLVARA(p,v,n,t) typedef t PL_##v##_t[n]; \
480 EXTERN_C PL_##v##_t* Perl_##p##v##_ptr(pTHX);
481#define PERLVARI(p,v,t,i) PERLVAR(p,v,t)
482#define PERLVARIC(p,v,t,i) PERLVAR(p,v, const t)
51371543 483
51371543
GS
484#include "perlvars.h"
485
486#undef PERLVAR
487#undef PERLVARA
488#undef PERLVARI
489#undef PERLVARIC
27da23d5 490
51371543
GS
491END_EXTERN_C
492
682fc664 493#if defined(PERL_CORE)
6f4183fe 494
87b9e160 495/* accessor functions for Perl "global" variables */
682fc664
GS
496
497/* these need to be mentioned here, or most linkers won't put them in
498 the perl executable */
499
500#ifndef PERL_NO_FORCE_LINK
501
502START_EXTERN_C
503
504#ifndef DOINIT
27da23d5 505EXTCONST void * const PL_force_link_funcs[];
682fc664 506#else
27da23d5 507EXTCONST void * const PL_force_link_funcs[] = {
682fc664
GS
508#undef PERLVAR
509#undef PERLVARA
510#undef PERLVARI
511#undef PERLVARIC
115ff745
NC
512#define PERLVAR(p,v,t) (void*)Perl_##p##v##_ptr,
513#define PERLVARA(p,v,n,t) PERLVAR(p,v,t)
514#define PERLVARI(p,v,t,i) PERLVAR(p,v,t)
515#define PERLVARIC(p,v,t,i) PERLVAR(p,v,t)
682fc664 516
3c0f78ca
JH
517/* In Tru64 (__DEC && __osf__) the cc option -std1 causes that one
518 * cannot cast between void pointers and function pointers without
519 * info level warnings. The PL_force_link_funcs[] would cause a few
520 * hundred of those warnings. In code one can circumnavigate this by using
521 * unions that overlay the different pointers, but in declarations one
522 * cannot use this trick. Therefore we just disable the warning here
523 * for the duration of the PL_force_link_funcs[] declaration. */
524
525#if defined(__DECC) && defined(__osf__)
526#pragma message save
527#pragma message disable (nonstandcast)
528#endif
529
682fc664
GS
530#include "perlvars.h"
531
3c0f78ca
JH
532#if defined(__DECC) && defined(__osf__)
533#pragma message restore
534#endif
535
682fc664
GS
536#undef PERLVAR
537#undef PERLVARA
538#undef PERLVARI
539#undef PERLVARIC
540};
541#endif /* DOINIT */
542
acfe0abc 543END_EXTERN_C
682fc664
GS
544
545#endif /* PERL_NO_FORCE_LINK */
546
547#else /* !PERL_CORE */
51371543
GS
548
549EOT
550
adf34b4b 551foreach $sym (@globvar) {
5f9c6535
NC
552 print $capih
553 "#undef PL_$sym\n" . hide("PL_$sym", "(*Perl_G${sym}_ptr(NULL))");
6f4183fe
GS
554}
555
424a4936 556print $capih <<'EOT';
6f4183fe
GS
557
558#endif /* !PERL_CORE */
87b9e160 559#endif /* MULTIPLICITY && PERL_GLOBAL_STRUCT */
6f4183fe
GS
560
561#endif /* __perlapi_h__ */
6f4183fe 562EOT
ce716c52
NC
563
564read_only_bottom_close_and_rename($capih);
51371543 565
5f8dc073 566my $capi = open_print_header('perlapi.c', <<'EOQ');
56fd1190 567 *
892eaa71
NC
568 *
569 * Up to the threshold of the door there mounted a flight of twenty-seven
570 * broad stairs, hewn by some unknown art of the same black stone. This
571 * was the only entrance to the tower; ...
572 *
573 * [p.577 of _The Lord of the Rings_, III/x: "The Voice of Saruman"]
574 *
575 */
56fd1190 576EOQ
892eaa71 577
5f8dc073 578print $capi <<'EOT';
51371543
GS
579#include "EXTERN.h"
580#include "perl.h"
581#include "perlapi.h"
582
87b9e160 583#if defined (MULTIPLICITY) && defined (PERL_GLOBAL_STRUCT)
51371543 584
87b9e160 585/* accessor functions for Perl "global" variables */
51371543
GS
586START_EXTERN_C
587
51371543 588#undef PERLVARI
115ff745 589#define PERLVARI(p,v,t,i) PERLVAR(p,v,t)
c5be433b
GS
590
591#undef PERLVAR
592#undef PERLVARA
115ff745 593#define PERLVAR(p,v,t) t* Perl_##p##v##_ptr(pTHX) \
96a5add6 594 { dVAR; PERL_UNUSED_CONTEXT; return &(PL_##v); }
115ff745 595#define PERLVARA(p,v,n,t) PL_##v##_t* Perl_##p##v##_ptr(pTHX) \
96a5add6 596 { dVAR; PERL_UNUSED_CONTEXT; return &(PL_##v); }
34f7a5fe 597#undef PERLVARIC
115ff745
NC
598#define PERLVARIC(p,v,t,i) \
599 const t* Perl_##p##v##_ptr(pTHX) \
96a5add6 600 { PERL_UNUSED_CONTEXT; return (const t *)&(PL_##v); }
51371543
GS
601#include "perlvars.h"
602
603#undef PERLVAR
604#undef PERLVARA
605#undef PERLVARI
606#undef PERLVARIC
27da23d5 607
acfe0abc 608END_EXTERN_C
6f4183fe 609
87b9e160 610#endif /* MULTIPLICITY && PERL_GLOBAL_STRUCT */
51371543
GS
611EOT
612
ce716c52 613read_only_bottom_close_and_rename($capi);
acfe0abc 614
1b6737cc 615# ex: set ts=8 sts=4 sw=4 noet: