Skip to content

Commit

Permalink
Expose some symbols from builtin.c to make them callable from op.c
Browse files Browse the repository at this point in the history
  • Loading branch information
leonerd committed Jan 17, 2024
1 parent e0993ac commit fb8fa88
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 6 deletions.
13 changes: 7 additions & 6 deletions builtin.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
*/

#include "EXTERN.h"
#define PERL_IN_BUILTIN_C
#include "perl.h"

#include "XSUB.h"
Expand Down Expand Up @@ -39,8 +40,8 @@ static void S_warn_experimental_builtin(pTHX_ const char *name)
/* These three utilities might want to live elsewhere to be reused from other
* code sometime
*/
#define prepare_export_lexical() S_prepare_export_lexical(aTHX)
static void S_prepare_export_lexical(pTHX)
void
Perl_prepare_export_lexical(pTHX)
{
assert(PL_compcv);

Expand All @@ -59,8 +60,8 @@ static void S_export_lexical(pTHX_ SV *name, SV *sv)
PL_curpad[off] = SvREFCNT_inc(sv);
}

#define finish_export_lexical() S_finish_export_lexical(aTHX)
static void S_finish_export_lexical(pTHX)
void
Perl_finish_export_lexical(pTHX)
{
intro_my();

Expand Down Expand Up @@ -596,8 +597,8 @@ static void S_import_sym(pTHX_ SV *sym)
export_lexical(ampname, (SV *)cv);
}

#define import_builtin_bundle(ver) S_import_builtin_bundle(aTHX_ ver)
static void S_import_builtin_bundle(pTHX_ U16 ver)
void
Perl_import_builtin_bundle(pTHX_ U16 ver)
{
for(int i = 0; builtins[i].name; i++) {
if(builtins[i].since_ver <= ver)
Expand Down
6 changes: 6 additions & 0 deletions embed.fnc
Original file line number Diff line number Diff line change
Expand Up @@ -4076,6 +4076,12 @@ i |bool |PerlEnv_putenv |NN char *str
#if defined(PERL_IN_AV_C)
S |MAGIC *|get_aux_mg |NN AV *av
#endif
#if defined(PERL_IN_BUILTIN_C) || defined(PERL_IN_OP_C)
p |void |finish_export_lexical
p |void |import_builtin_bundle \
|U16 ver
p |void |prepare_export_lexical
#endif
#if defined(PERL_IN_CLASS_C) || defined(PERL_IN_OP_C) || \
defined(PERL_IN_PAD_C) || defined(PERL_IN_PERLY_C) || \
defined(PERL_IN_TOKE_C)
Expand Down
5 changes: 5 additions & 0 deletions embed.h
Original file line number Diff line number Diff line change
Expand Up @@ -1199,6 +1199,11 @@
# if defined(PERL_IN_AV_C)
# define get_aux_mg(a) S_get_aux_mg(aTHX_ a)
# endif
# if defined(PERL_IN_BUILTIN_C) || defined(PERL_IN_OP_C)
# define finish_export_lexical() Perl_finish_export_lexical(aTHX)
# define import_builtin_bundle(a) Perl_import_builtin_bundle(aTHX_ a)
# define prepare_export_lexical() Perl_prepare_export_lexical(aTHX)
# endif
# if defined(PERL_IN_CLASS_C) || defined(PERL_IN_GLOBALS_C) || \
defined(PERL_IN_OP_C) || defined(PERL_IN_PEEP_C)
# define ck_anoncode(a) Perl_ck_anoncode(aTHX_ a)
Expand Down
17 changes: 17 additions & 0 deletions proto.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit fb8fa88

Please sign in to comment.