This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Integrate mainline some more
[perl5.git] / embed.pl
index e4dae1b..629772a 100755 (executable)
--- a/embed.pl
+++ b/embed.pl
@@ -114,6 +114,7 @@ sub write_protos {
     }
     else {
        my ($flags,$retval,$func,@args) = @_;
+       $ret .= '/* ' if $flags =~ /m/;
        if ($flags =~ /s/) {
            $retval = "STATIC $retval";
            $func = "S_$func";
@@ -145,7 +146,9 @@ sub write_protos {
                                    $prefix, $args - 1, $prefix, $args;
            $ret .= "\n#endif\n";
        }
-       $ret .= ";\n";
+       $ret .= ";";
+       $ret .= ' */' if $flags =~ /m/;
+       $ret .= "\n";
     }
     $ret;
 }
@@ -155,7 +158,7 @@ sub write_global_sym {
     my $ret = "";
     if (@_ > 1) {
        my ($flags,$retval,$func,@args) = @_;
-       if ($flags =~ /A/ && $flags !~ /x/) { # public API, so export
+       if ($flags =~ /A/ && $flags !~ /[xm]/) { # public API, so export
            $func = "Perl_$func" if $flags =~ /p/;
            $ret = "$func\n";
        }
@@ -343,15 +346,13 @@ walk_table {
     }
     else {
        my ($flags,$retval,$func,@args) = @_;
-       unless ($flags =~ /o/) {
-            $ret .= "#ifdef CRIPPLED_CC\n" if $flags =~ /C/;
+       unless ($flags =~ /[om]/) {
            if ($flags =~ /s/) {
                $ret .= hide($func,"S_$func");
            }
            elsif ($flags =~ /p/) {
                $ret .= hide($func,"Perl_$func");
            }
-            $ret .= "#endif\n" if $flags =~ /C/;
        }
     }
     $ret;
@@ -378,7 +379,7 @@ walk_table {
     }
     else {
        my ($flags,$retval,$func,@args) = @_;
-       unless ($flags =~ /o/) {
+       unless ($flags =~ /[om]/) {
            my $args = scalar @args;
            if ($args and $args[$args-1] =~ /\.\.\./) {
                # we're out of luck for varargs functions under CPP
@@ -1054,7 +1055,7 @@ __END__
 :
 : flags are single letters with following meanings:
 :      A               member of public API
-:      C               wrap compatibility macro in #ifdef DCRIPPLED_CC
+:      m               Implemented as a macro - no export, no proto, no #define
 :      d               function has documentation with its source
 :      s               static function, should have an S_ prefix in source
 :                              file
@@ -1246,7 +1247,7 @@ p |bool   |do_print       |SV* sv|PerlIO* fp
 p      |OP*    |do_readline
 p      |I32    |do_chomp       |SV* sv
 p      |bool   |do_seek        |GV* gv|Off_t pos|int whence
-     |void   |do_sprintf     |SV* sv|I32 len|SV** sarg
+Ap     |void   |do_sprintf     |SV* sv|I32 len|SV** sarg
 p      |Off_t  |do_sysseek     |GV* gv|Off_t pos|int whence
 p      |Off_t  |do_tell        |GV* gv
 p      |I32    |do_trans       |SV* sv
@@ -1332,7 +1333,9 @@ Apd       |HE*    |hv_store_ent   |HV* tb|SV* key|SV* val|U32 hash
 Apd    |void   |hv_undef       |HV* tb
 Ap     |I32    |ibcmp          |const char* a|const char* b|I32 len
 Ap     |I32    |ibcmp_locale   |const char* a|const char* b|I32 len
+Ap     |I32    |ibcmp_utf8     |const char* a|bool ua|const char* b|bool ub|I32 len
 p      |bool   |ingroup        |Gid_t testgid|Uid_t effective
+p      |void   |init_argv_symbols|int|char **
 p      |void   |init_debugger
 Ap     |void   |init_stacks
 Ap     |void   |init_tm        |struct tm *ptm
@@ -1342,40 +1345,38 @@ p       |bool   |io_close       |IO* io|bool not_implicit
 p      |OP*    |invert         |OP* cmd
 dp     |bool   |is_gv_magical  |char *name|STRLEN len|U32 flags
 p      |I32    |is_lvalue_sub
-Ap     |bool   |is_uni_alnum   |U32 c
-Ap     |bool   |is_uni_alnumc  |U32 c
-Ap     |bool   |is_uni_idfirst |U32 c
-Ap     |bool   |is_uni_alpha   |U32 c
-Ap     |bool   |is_uni_ascii   |U32 c
-Ap     |bool   |is_uni_space   |U32 c
-Ap     |bool   |is_uni_cntrl   |U32 c
-Ap     |bool   |is_uni_graph   |U32 c
-Ap     |bool   |is_uni_digit   |U32 c
-Ap     |bool   |is_uni_upper   |U32 c
-Ap     |bool   |is_uni_lower   |U32 c
-Ap     |bool   |is_uni_print   |U32 c
-Ap     |bool   |is_uni_punct   |U32 c
-Ap     |bool   |is_uni_xdigit  |U32 c
-Ap     |U32    |to_uni_upper   |U32 c
-Ap     |U32    |to_uni_title   |U32 c
-Ap     |U32    |to_uni_lower   |U32 c
-Ap     |bool   |is_uni_alnum_lc|U32 c
-Ap     |bool   |is_uni_alnumc_lc|U32 c
-Ap     |bool   |is_uni_idfirst_lc|U32 c
-Ap     |bool   |is_uni_alpha_lc|U32 c
-Ap     |bool   |is_uni_ascii_lc|U32 c
-Ap     |bool   |is_uni_space_lc|U32 c
-Ap     |bool   |is_uni_cntrl_lc|U32 c
-Ap     |bool   |is_uni_graph_lc|U32 c
-Ap     |bool   |is_uni_digit_lc|U32 c
-Ap     |bool   |is_uni_upper_lc|U32 c
-Ap     |bool   |is_uni_lower_lc|U32 c
-Ap     |bool   |is_uni_print_lc|U32 c
-Ap     |bool   |is_uni_punct_lc|U32 c
-Ap     |bool   |is_uni_xdigit_lc|U32 c
-Ap     |U32    |to_uni_upper_lc|U32 c
-Ap     |U32    |to_uni_title_lc|U32 c
-Ap     |U32    |to_uni_lower_lc|U32 c
+Ap     |bool   |is_uni_alnum   |UV c
+Ap     |bool   |is_uni_alnumc  |UV c
+Ap     |bool   |is_uni_idfirst |UV c
+Ap     |bool   |is_uni_alpha   |UV c
+Ap     |bool   |is_uni_ascii   |UV c
+Ap     |bool   |is_uni_space   |UV c
+Ap     |bool   |is_uni_cntrl   |UV c
+Ap     |bool   |is_uni_graph   |UV c
+Ap     |bool   |is_uni_digit   |UV c
+Ap     |bool   |is_uni_upper   |UV c
+Ap     |bool   |is_uni_lower   |UV c
+Ap     |bool   |is_uni_print   |UV c
+Ap     |bool   |is_uni_punct   |UV c
+Ap     |bool   |is_uni_xdigit  |UV c
+Ap     |UV     |to_uni_upper   |UV c|U8 *p|STRLEN *lenp
+Ap     |UV     |to_uni_title   |UV c|U8 *p|STRLEN *lenp
+Ap     |UV     |to_uni_lower   |UV c|U8 *p|STRLEN *lenp
+Ap     |UV     |to_uni_fold    |UV c|U8 *p|STRLEN *lenp
+Ap     |bool   |is_uni_alnum_lc|UV c
+Ap     |bool   |is_uni_alnumc_lc|UV c
+Ap     |bool   |is_uni_idfirst_lc|UV c
+Ap     |bool   |is_uni_alpha_lc|UV c
+Ap     |bool   |is_uni_ascii_lc|UV c
+Ap     |bool   |is_uni_space_lc|UV c
+Ap     |bool   |is_uni_cntrl_lc|UV c
+Ap     |bool   |is_uni_graph_lc|UV c
+Ap     |bool   |is_uni_digit_lc|UV c
+Ap     |bool   |is_uni_upper_lc|UV c
+Ap     |bool   |is_uni_lower_lc|UV c
+Ap     |bool   |is_uni_print_lc|UV c
+Ap     |bool   |is_uni_punct_lc|UV c
+Ap     |bool   |is_uni_xdigit_lc|UV c
 Apd    |STRLEN |is_utf8_char   |U8 *p
 Apd    |bool   |is_utf8_string |U8 *s|STRLEN len
 Ap     |bool   |is_utf8_alnum  |U8 *p
@@ -1472,6 +1473,7 @@ p |char*  |mem_collxfrm   |const char* s|STRLEN len|STRLEN* xlen
 Afp    |SV*    |mess           |const char* pat|...
 Ap     |SV*    |vmess          |const char* pat|va_list* args
 p      |void   |qerror         |SV* err
+Apd     |void   |sortsv         |SV ** array|size_t num_elts|SVCOMPARE_t cmp
 Apd    |int    |mg_clear       |SV* sv
 Apd    |int    |mg_copy        |SV* sv|SV* nsv|const char* key|I32 klen
 Apd    |MAGIC* |mg_find        |SV* sv|int type
@@ -1573,6 +1575,7 @@ Ap        |OP*    |newWHILEOP     |I32 flags|I32 debuggable|LOOP* loop \
                                |I32 whileline|OP* expr|OP* block|OP* cont
 
 Ap     |PERL_SI*|new_stackinfo|I32 stitems|I32 cxitems
+Apd    |char*  |new_vstring    |char *vstr|SV *sv
 p      |PerlIO*|nextargv       |GV* gv
 Ap     |char*  |ninstr         |const char* big|const char* bigend \
                                |const char* little|const char* lend
@@ -1711,7 +1714,6 @@ Ap        |char*  |screaminstr    |SV* bigsv|SV* littlesv|I32 start_shift \
 p      |I32    |setenv_getix   |char* nam
 #endif
 p      |void   |setdefout      |GV* gv
-Ap     |char*  |sharepvn       |const char* sv|I32 len|U32 hash
 p      |HEK*   |share_hek      |const char* sv|I32 len|U32 hash
 np     |Signal_t |sighandler   |int sig
 Ap     |SV**   |stack_grow     |SV** sp|SV**p|int n
@@ -1723,10 +1725,10 @@ Apd     |IO*    |sv_2io         |SV* sv
 Apd    |IV     |sv_2iv         |SV* sv
 Apd    |SV*    |sv_2mortal     |SV* sv
 Apd    |NV     |sv_2nv         |SV* sv
-ACp    |char*  |sv_2pv         |SV* sv|STRLEN* lp
+A    |char*  |sv_2pv         |SV* sv|STRLEN* lp
 Apd    |char*  |sv_2pvutf8     |SV* sv|STRLEN* lp
 Apd    |char*  |sv_2pvbyte     |SV* sv|STRLEN* lp
-ACp    |char*  |sv_pvn_nomg    |SV* sv|STRLEN* lp
+A    |char*  |sv_pvn_nomg    |SV* sv|STRLEN* lp
 Apd    |UV     |sv_2uv         |SV* sv
 Apd    |IV     |sv_iv          |SV* sv
 Apd    |UV     |sv_uv          |SV* sv
@@ -1741,8 +1743,8 @@ Apd       |SV*    |sv_bless       |SV* sv|HV* stash
 Afpd   |void   |sv_catpvf      |SV* sv|const char* pat|...
 Ap     |void   |sv_vcatpvf     |SV* sv|const char* pat|va_list* args
 Apd    |void   |sv_catpv       |SV* sv|const char* ptr
-ACpd   |void   |sv_catpvn      |SV* sv|const char* ptr|STRLEN len
-ACpd   |void   |sv_catsv       |SV* dsv|SV* ssv
+Amd    |void   |sv_catpvn      |SV* sv|const char* ptr|STRLEN len
+Amd    |void   |sv_catsv       |SV* dsv|SV* ssv
 Apd    |void   |sv_chop        |SV* sv|char* ptr
 pd     |I32    |sv_clean_all
 pd     |void   |sv_clean_objs
@@ -1777,9 +1779,10 @@ Apd      |SV*    |sv_newref      |SV* sv
 Ap     |char*  |sv_peek        |SV* sv
 Apd    |void   |sv_pos_u2b     |SV* sv|I32* offsetp|I32* lenp
 Apd    |void   |sv_pos_b2u     |SV* sv|I32* offsetp
-ACpd   |char*  |sv_pvn_force   |SV* sv|STRLEN* lp
+Amd    |char*  |sv_pvn_force   |SV* sv|STRLEN* lp
 Apd    |char*  |sv_pvutf8n_force|SV* sv|STRLEN* lp
 Apd    |char*  |sv_pvbyten_force|SV* sv|STRLEN* lp
+Apd    |char*  |sv_recode_to_utf8      |SV* sv|SV *encoding
 Apd    |char*  |sv_reftype     |SV* sv|int ob
 Apd    |void   |sv_replace     |SV* sv|SV* nsv
 Apd    |void   |sv_report_used
@@ -1798,7 +1801,7 @@ Apd       |SV*    |sv_setref_pvn  |SV* rv|const char* classname|char* pv \
                                |STRLEN n
 Apd    |void   |sv_setpv       |SV* sv|const char* ptr
 Apd    |void   |sv_setpvn      |SV* sv|const char* ptr|STRLEN len
-ACpd   |void   |sv_setsv       |SV* dsv|SV* ssv
+Amd    |void   |sv_setsv       |SV* dsv|SV* ssv
 Apd    |void   |sv_taint       |SV* sv
 Apd    |bool   |sv_tainted     |SV* sv
 Apd    |int    |sv_unmagic     |SV* sv|int type
@@ -1819,9 +1822,12 @@ Ap       |SV*    |swash_init     |char* pkg|char* name|SV* listsv \
 Ap     |UV     |swash_fetch    |SV *sv|U8 *ptr|bool do_utf8
 Ap     |void   |taint_env
 Ap     |void   |taint_proper   |const char* f|const char* s
-Ap     |UV     |to_utf8_lower  |U8 *p
-Ap     |UV     |to_utf8_upper  |U8 *p
-Ap     |UV     |to_utf8_title  |U8 *p
+Apd    |UV     |to_utf8_case   |U8 *p|U8* ustrp|STRLEN *lenp \
+                               |SV **swash|char *normal|char *special
+Ap     |UV     |to_utf8_lower  |U8 *p|U8* ustrp|STRLEN *lenp
+Ap     |UV     |to_utf8_upper  |U8 *p|U8* ustrp|STRLEN *lenp
+Ap     |UV     |to_utf8_title  |U8 *p|U8* ustrp|STRLEN *lenp
+Ap     |UV     |to_utf8_fold   |U8 *p|U8* ustrp|STRLEN *lenp
 #if defined(UNLINK_ALL_VERSIONS)
 Ap     |I32    |unlnk          |char* f
 #endif
@@ -1845,6 +1851,9 @@ Adp       |UV     |utf8n_to_uvchr |U8 *s|STRLEN curlen|STRLEN* retlen|U32 flags
 Adp    |UV     |utf8n_to_uvuni |U8 *s|STRLEN curlen|STRLEN* retlen|U32 flags
 Apd    |U8*    |uvchr_to_utf8  |U8 *d|UV uv
 Apd    |U8*    |uvuni_to_utf8  |U8 *d|UV uv
+Ap     |char*  |pv_uni_display |SV *dsv|U8 *spv|STRLEN len \
+                               |STRLEN pvlim|UV flags
+Ap     |char*  |sv_uni_display |SV *dsv|SV *ssv|STRLEN pvlim|UV flags
 p      |void   |vivify_defelem |SV* sv
 p      |void   |vivify_ref     |SV* sv|U32 to_what
 p      |I32    |wait4pid       |Pid_t pid|int* statusp|int flags
@@ -1903,7 +1912,6 @@ Apd       |void   |sv_usepvn_mg   |SV *sv|char *ptr|STRLEN len
 Ap     |MGVTBL*|get_vtbl       |int vtbl_id
 p      |char*  |pv_display     |SV *dsv|char *pv|STRLEN cur|STRLEN len \
                                |STRLEN pvlim
-p      |char*  |sv_uni_display |SV *dsv|SV *ssv|STRLEN pvlim
 Afp    |void   |dump_indent    |I32 level|PerlIO *file|const char* pat|...
 Ap     |void   |dump_vindent   |I32 level|PerlIO *file|const char* pat \
                                |va_list *args
@@ -1930,7 +1938,7 @@ Apd       |char*  |sv_2pvbyte_nolen|SV* sv
 Apd    |char*  |sv_pv          |SV *sv
 Apd    |char*  |sv_pvutf8      |SV *sv
 Apd    |char*  |sv_pvbyte      |SV *sv
-ACpd   |STRLEN |sv_utf8_upgrade|SV *sv
+Amd    |STRLEN |sv_utf8_upgrade|SV *sv
 ApdM   |bool   |sv_utf8_downgrade|SV *sv|bool fail_ok
 Apd    |void   |sv_utf8_encode |SV *sv
 ApdM   |bool   |sv_utf8_decode |SV *sv
@@ -1945,17 +1953,17 @@ Ap      |void   |newMYSUB       |I32 floor|OP *o|OP *proto|OP *attrs|OP *block
 p      |OP *   |my_attrs       |OP *o|OP *attrs
 p      |void   |boot_core_xsutils
 #if defined(USE_ITHREADS)
-Ap     |PERL_CONTEXT*|cx_dup   |PERL_CONTEXT* cx|I32 ix|I32 max|clone_params* param
-Ap     |PERL_SI*|si_dup        |PERL_SI* si|clone_params* param
-Ap     |ANY*   |ss_dup         |PerlInterpreter* proto_perl|clone_params* param
+Ap     |PERL_CONTEXT*|cx_dup   |PERL_CONTEXT* cx|I32 ix|I32 max|CLONE_PARAMS* param
+Ap     |PERL_SI*|si_dup        |PERL_SI* si|CLONE_PARAMS* param
+Ap     |ANY*   |ss_dup         |PerlInterpreter* proto_perl|CLONE_PARAMS* param
 Ap     |void*  |any_dup        |void* v|PerlInterpreter* proto_perl
-Ap     |HE*    |he_dup         |HE* e|bool shared|clone_params* param
-Ap     |REGEXP*|re_dup         |REGEXP* r|clone_params* param
-Ap     |PerlIO*|fp_dup         |PerlIO* fp|char type
+Ap     |HE*    |he_dup         |HE* e|bool shared|CLONE_PARAMS* param
+Ap     |REGEXP*|re_dup         |REGEXP* r|CLONE_PARAMS* param
+Ap     |PerlIO*|fp_dup         |PerlIO* fp|char type|CLONE_PARAMS* param
 Ap     |DIR*   |dirp_dup       |DIR* dp
-Ap     |GP*    |gp_dup         |GP* gp|clone_params* param
-Ap     |MAGIC* |mg_dup         |MAGIC* mg|clone_params* param
-Ap     |SV*    |sv_dup         |SV* sstr|clone_params* param
+Ap     |GP*    |gp_dup         |GP* gp|CLONE_PARAMS* param
+Ap     |MAGIC* |mg_dup         |MAGIC* mg|CLONE_PARAMS* param
+Ap     |SV*    |sv_dup         |SV* sstr|CLONE_PARAMS* param
 #if defined(HAVE_INTERP_INTERN)
 Ap     |void   |sys_intern_dup |struct interp_intern* src \
                                |struct interp_intern* dst
@@ -2107,7 +2115,6 @@ s |I32    |dopoptosub_at  |PERL_CONTEXT* cxstk|I32 startingblock
 s      |void   |save_lines     |AV *array|SV *sv
 s      |OP*    |doeval         |int gimme|OP** startop
 s      |PerlIO *|doopen_pmc    |const char *name|const char *mode
-s      |void   |qsortsv        |SV ** array|size_t num_elts|SVCOMPARE_t f
 #endif
 
 #if defined(PERL_IN_PP_HOT_C) || defined(PERL_DECL_PROT)
@@ -2181,11 +2188,9 @@ s        |U8*    |reghopmaybe3   |U8 *pos|I32 off|U8 *lim
 s      |char*  |find_byclass   |regexp * prog|regnode *c|char *s|char *strend|char *startpos|I32 norun
 #endif
 
-#if defined(PERL_IN_RUN_C) || defined(PERL_DECL_PROT)
-#   ifdef DEBUGGING
+#if defined(PERL_IN_DUMP_C) || defined(PERL_DECL_PROT)
 s      |CV*    |deb_curcv      |I32 ix
 s      |void   |debprof        |OP *o
-#   endif
 #endif
 
 #if defined(PERL_IN_SCOPE_C) || defined(PERL_DECL_PROT)