This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
add missing bincompat symbols to export list
[perl5.git] / makedef.pl
index eb599c9..e63034b 100644 (file)
@@ -11,7 +11,11 @@ my $PLATFORM;
 my $CCTYPE;
 
 my %bincompat5005 =
-      (Perl_call_argv          =>      "perl_call_argv",
+      (
+       Perl_call_atexit                =>      "perl_atexit",
+       Perl_eval_sv            =>      "perl_eval_sv",
+       Perl_eval_pv            =>      "perl_eval_pv",
+       Perl_call_argv          =>      "perl_call_argv",
        Perl_call_method                =>      "perl_call_method",
        Perl_call_pv            =>      "perl_call_pv",
        Perl_call_sv            =>      "perl_call_sv",
@@ -34,7 +38,8 @@ my %bincompat5005 =
        Perl_malloc             =>      "malloc",
        Perl_mfree              =>      "free",
        Perl_realloc            =>      "realloc",
-       Perl_calloc             =>      "calloc",);
+       Perl_calloc             =>      "calloc",
+      );
 
 my $bincompat5005 = join("|", keys %bincompat5005);
 
@@ -91,41 +96,51 @@ unless ($PLATFORM eq 'win32') {
 open(CFG,$config_h) || die "Cannot open $config_h: $!\n";
 while (<CFG>) {
     $define{$1} = 1 if /^\s*#\s*define\s+(MYMALLOC)\b/;
-    $define{$1} = 1 if /^\s*#\s*define\s+(USE_THREADS)\b/;
+    $define{$1} = 1 if /^\s*#\s*define\s+(USE_5005THREADS)\b/;
+    $define{$1} = 1 if /^\s*#\s*define\s+(USE_ITHREADS)\b/;
     $define{$1} = 1 if /^\s*#\s*define\s+(USE_PERLIO)\b/;
     $define{$1} = 1 if /^\s*#\s*define\s+(MULTIPLICITY)\b/;
+    $define{$1} = 1 if /^\s*#\s*define\s+(PERL_IMPLICIT_SYS)\b/;
     $define{$1} = 1 if /^\s*#\s*define\s+(PERL_BINCOMPAT_5005)\b/;
 }
 close(CFG);
 
+# perl.h logic duplication begins
+
+if ($define{USE_ITHREADS}) {
+    if (!$define{MULTIPLICITY} && !$define{PERL_OBJECT}) {
+        $define{MULTIPLICITY} = 1;
+    }
+}
+
+$define{PERL_IMPLICIT_CONTEXT} ||=
+    $define{USE_ITHREADS} ||
+    $define{USE_5005THREADS}  ||
+    $define{MULTIPLICITY} ;
+
+if ($define{PERL_CAPI}) {
+    delete $define{PERL_OBJECT};
+    $define{MULTIPLICITY} = 1; 
+    $define{PERL_IMPLICIT_CONTEXT} = 1;
+    $define{PERL_IMPLICIT_SYS}     = 1;
+}
+
+if ($define{PERL_OBJECT}) {
+    $define{PERL_IMPLICIT_CONTEXT} = 1;
+    $define{PERL_IMPLICIT_SYS}     = 1;
+}
+
+# perl.h logic duplication ends
+
 if ($PLATFORM eq 'win32') {
     warn join(' ',keys %define)."\n";
-    if ($define{PERL_OBJECT}) {
-       print "LIBRARY Perl56\n";
-       print "DESCRIPTION 'Perl interpreter'\n";
-       print "EXPORTS\n";
-#    output_symbol("perl_alloc");
+    print "LIBRARY Perl56\n";
+    print "DESCRIPTION 'Perl interpreter'\n";
+    print "EXPORTS\n";
+    if ($define{PERL_IMPLICIT_SYS}) {
        output_symbol("perl_get_host_info");
        output_symbol("perl_alloc_override");
-#    output_symbol("perl_construct");
-#    output_symbol("perl_destruct");
-#    output_symbol("perl_free");
-#    output_symbol("perl_parse");
-#    output_symbol("perl_run");
-#    output_symbol("RunPerl");
-#    exit(0);
     }
-    else {
-       if ($CCTYPE ne 'GCC') {
-           print "LIBRARY Perl\n";
-           print "DESCRIPTION 'Perl interpreter, export autogenerated'\n";
-       }
-       else {
-           $define{'PERL_GLOBAL_STRUCT'} = 1;
-           $define{'MULTIPLICITY'} = 1;
-       }
-       print "EXPORTS\n";
-    } 
 }
 elsif ($PLATFORM eq 'os2') {
     ($v = $]) =~ s/(\d\.\d\d\d)(\d\d)$/$1_$2/;
@@ -168,7 +183,7 @@ sub emit_symbols {
     foreach my $symbol (@$list) {
        my $skipsym = $symbol;
        # XXX hack
-       if ($define{PERL_OBJECT}) {
+       if ($define{PERL_OBJECT} || $define{MULTIPLICITY}) {
            $skipsym =~ s/^Perl_[GIT](\w+)_ptr$/PL_$1/;
        }
        emit_symbol($symbol) unless exists $skip{$skipsym};
@@ -244,6 +259,7 @@ elsif ($PLATFORM eq 'aix') {
                     Perl_safexrealloc
                     Perl_same_dirent
                     Perl_unlnk
+                    Perl_sys_intern_dup
                     PL_cryptseen
                     PL_opsave
                     PL_statusvalue_vms
@@ -259,6 +275,7 @@ elsif ($PLATFORM eq 'os2') {
                    dlopen
                    dlsym
                    dlerror
+                   dlclose
                    my_tmpfile
                    my_tmpnam
                    my_flock
@@ -330,24 +347,39 @@ else {
                    )];
 }
 
+unless ($define{'PERL_FLEXIBLE_EXCEPTIONS'}) {
+    skip_symbols [qw(
+                   PL_protect
+                   Perl_default_protect
+                   Perl_vdefault_protect
+                   )];
+}
+
 if ($define{'MYMALLOC'}) {
     emit_symbols [qw(
                    Perl_dump_mstats
+                   Perl_get_mstats
                    Perl_malloc
                    Perl_mfree
                    Perl_realloc
                    Perl_calloc
                    )];
-    if ($define{'USE_THREADS'} || $define{'USE_ITHREADS'}) {
+    if ($define{'USE_5005THREADS'} || $define{'USE_ITHREADS'}) {
        emit_symbols [qw(
                        PL_malloc_mutex
                        )];
     }
+    else {
+       skip_symbols [qw(
+                       PL_malloc_mutex
+                       )];
+    }
 }
 else {
     skip_symbols [qw(
                    PL_malloc_mutex
                    Perl_dump_mstats
+                   Perl_get_mstats
                    Perl_malloc
                    Perl_mfree
                    Perl_realloc
@@ -356,9 +388,14 @@ else {
                    )];
 }
 
-unless ($define{'USE_THREADS'}) {
+unless ($define{'USE_5005THREADS'} || $define{'USE_ITHREADS'}) {
     skip_symbols [qw(
                    PL_thr_key
+                   )];
+}
+
+unless ($define{'USE_5005THREADS'}) {
+    skip_symbols [qw(
                    PL_sv_mutex
                    PL_strtab_mutex
                    PL_svref_mutex
@@ -373,8 +410,6 @@ unless ($define{'USE_THREADS'}) {
                    PL_threadsv_names
                    PL_thrsv
                    PL_vtbl_mutex
-                   Perl_getTHR
-                   Perl_setTHR
                    Perl_condpair_magic
                    Perl_new_struct_thread
                    Perl_per_thread_magicals
@@ -388,6 +423,7 @@ unless ($define{'USE_THREADS'}) {
 unless ($define{'USE_ITHREADS'}) {
     skip_symbols [qw(
                    PL_ptr_table
+                   PL_op_mutex
                    Perl_dirp_dup
                    Perl_cx_dup
                    Perl_si_dup
@@ -415,6 +451,7 @@ unless ($define{'PERL_IMPLICIT_CONTEXT'}) {
                    Perl_die_nocontext
                    Perl_deb_nocontext
                    Perl_form_nocontext
+                   Perl_load_module_nocontext
                    Perl_mess_nocontext
                    Perl_warn_nocontext
                    Perl_warner_nocontext
@@ -451,16 +488,11 @@ sub readvar {
     return \@syms;
 }
 
-if ($define{'USE_THREADS'} || $define{'MULTIPLICITY'}) {
+if ($define{'USE_5005THREADS'}) {
     my $thrd = readvar($thrdvar_h);
     skip_symbols $thrd;
 }
 
-if ($define{'MULTIPLICITY'}) {
-    my $interp = readvar($intrpvar_h);
-    skip_symbols $interp;
-}
-
 if ($define{'PERL_GLOBAL_STRUCT'}) {
     my $global = readvar($perlvars_h);
     skip_symbols $global;
@@ -470,7 +502,7 @@ if ($define{'PERL_GLOBAL_STRUCT'}) {
 
 # functions from *.sym files
 
-my @syms = ($global_sym, $pp_sym, $globvar_sym);
+my @syms = ($global_sym, $globvar_sym); # $pp_sym is not part of the API
 
 if ($define{'USE_PERLIO'}) {
      push @syms, $perlio_sym;
@@ -492,11 +524,16 @@ for my $syms (@syms) {
 
 # variables
 
-if ($define{'PERL_OBJECT'}) {
+if ($define{'PERL_OBJECT'} || $define{'MULTIPLICITY'}) {
     for my $f ($perlvars_h, $intrpvar_h, $thrdvar_h) {
        my $glob = readvar($f, sub { "Perl_" . $_[1] . $_[2] . "_ptr" });
        emit_symbols $glob;
     }
+    # XXX AIX seems to want the perlvars.h symbols, for some reason
+    if ($PLATFORM eq 'aix') {
+       my $glob = readvar($perlvars_h);
+       emit_symbols $glob;
+    }
 }
 else {
     unless ($define{'PERL_GLOBAL_STRUCT'}) {
@@ -507,7 +544,7 @@ else {
        my $glob = readvar($intrpvar_h);
        emit_symbols $glob;
     } 
-    unless ($define{'MULTIPLICITY'} || $define{'USE_THREADS'}) {
+    unless ($define{'MULTIPLICITY'} || $define{'USE_5005THREADS'}) {
        my $glob = readvar($thrdvar_h);
        emit_symbols $glob;
     } 
@@ -531,14 +568,10 @@ while (<DATA>) {
 if ($PLATFORM eq 'win32') {
     foreach my $symbol (qw(
                            boot_DynaLoader
-                           Perl_getTHR
                            Perl_init_os_extras
-                           Perl_setTHR
                            Perl_thread_create
                            Perl_win32_init
                            RunPerl
-                           GetPerlInterpreter
-                           SetPerlInterpreter
                            win32_errno
                            win32_environ
                            win32_stdin