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