This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
integrate changes#6252..6256,6259..6260
[perl5.git] / embed.pl
index eb7e38c..bf41a0a 100755 (executable)
--- a/embed.pl
+++ b/embed.pl
@@ -916,6 +916,9 @@ START_EXTERN_C
                        { return &(PL_##v); }
 #define PERLVARA(v,n,t)        PL_##v##_t* Perl_##v##_ptr(pTHXo)               \
                        { return &(PL_##v); }
+#undef PERLVARIC
+#define PERLVARIC(v,t,i)       const t* Perl_##v##_ptr(pTHXo)          \
+                       { return (const t *)&(PL_##v); }
 #include "perlvars.h"
 
 #undef PERLVAR
@@ -1078,12 +1081,12 @@ my %apidocs;
 my %gutsdocs;
 my %docfuncs;
 
-sub autodoc ($) { # parse a file and extract documentation info
-    my($fh) = @_;
-    my($in, $doc);
-
+sub autodoc ($$) { # parse a file and extract documentation info
+    my($fh,$file) = @_;
+    my($in, $doc, $line);
 FUNC:
     while (defined($in = <$fh>)) {
+       $line++;
        if ($in =~ /^=for\s+apidoc\s+(.*)\n/) {
            my $proto = $1;
            $proto = "||$proto" unless $proto =~ /\|/;
@@ -1091,24 +1094,33 @@ FUNC:
            my $docs = "";
 DOC:
            while (defined($doc = <$fh>)) {
+               $line++;
                last DOC if $doc =~ /^=\w+/;
+               if ($doc =~ m:^\*/$:) {
+                   warn "=cut missing? $file:$line:$doc";;
+                   last DOC;
+               }
                $docs .= $doc;
            }
            $docs = "\n$docs" if $docs and $docs !~ /^\n/;
            if ($flags =~ /m/) {
                if ($flags =~ /A/) {
-                   $apidocs{$name} = [$flags, $docs, $ret, @args];
+                   $apidocs{$name} = [$flags, $docs, $ret, $file, @args];
                }
                else {
-                   $gutsdocs{$name} = [$flags, $docs, $ret, @args];
+                   $gutsdocs{$name} = [$flags, $docs, $ret, $file, @args];
                }
            }
            else {
-               $docfuncs{$name} = [$flags, $docs, $ret, @args];
+               $docfuncs{$name} = [$flags, $docs, $ret, $file, @args];
            }
-           if ($doc =~ /^=for/) {
-               $in = $doc;
-               redo FUNC;
+           if (defined $doc) {
+               if ($doc =~ /^=for/) {
+                   $in = $doc;
+                   redo FUNC;
+               }
+           } else {
+               warn "$file:$line:$in";
            }
        }
     }
@@ -1116,7 +1128,7 @@ DOC:
 
 sub docout ($$$) { # output the docs for one function
     my($fh, $name, $docref) = @_;
-    my($flags, $docs, $ret, @args) = @$docref;
+    my($flags, $docs, $ret, $file, @args) = @$docref;
 
     $docs .= "NOTE: the perl_ form of this function is deprecated.\n\n" 
        if $flags =~ /p/;
@@ -1134,12 +1146,13 @@ sub docout ($$$) { # output the docs for one function
        print $fh "(" . join(", ", @args) . ")";
        print $fh "\n\n";
     }
+    print $fh "=for hackers\nFound in file $file\n\n";
 }
 
 my $file;
 for $file (glob('*.c'), glob('*.h')) {
     open F, "< $file" or die "Cannot open $file for docs: $!\n";
-    autodoc(\*F);
+    autodoc(\*F,$file);
     close F or die "Error closing $file: $!\n";
 }
 
@@ -1156,16 +1169,20 @@ walk_table {    # load documented functions into approriate hash
        if ($flags =~ /A/) {
            my $docref = delete $docfuncs{$func};
            warn "no docs for $func\n" unless $docref and @$docref;
-           $apidocs{$func} = [$docref->[0] . 'A', $docref->[1], $retval, @args];
+           $apidocs{$func} = [$docref->[0] . 'A', $docref->[1], $retval,
+                              $docref->[3], @args];
        } else {
            my $docref = delete $docfuncs{$func};
-           $gutsdocs{$func} = [$docref->[0], $docref->[1], $retval, @args];
+           $gutsdocs{$func} = [$docref->[0], $docref->[1], $retval,
+                               $docref->[3], @args];
        }
     }
     return "";
 } \*DOC;
 
 for (sort keys %docfuncs) {
+    # Have you used a full for apidoc or just a func name?  
+    # Have you used Ap instead of Am in the for apidoc?
     warn "Unable to place $_!\n";
 }
 
@@ -1511,7 +1528,7 @@ Ap        |char*  |vform          |const char* pat|va_list* args
 Ap     |void   |free_tmps
 p      |OP*    |gen_constant_list|OP* o
 #if !defined(HAS_GETENV_LEN)
-p      |char*  |getenv_len     |char* key|unsigned long *len
+p      |char*  |getenv_len     |const char* key|unsigned long *len
 #endif
 Ap     |void   |gp_free        |GV* gv
 Ap     |GP*    |gp_ref         |GP* gp
@@ -1567,6 +1584,7 @@ p |U32    |intro_my
 Ap     |char*  |instr          |const char* big|const char* little
 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
 Ap     |bool   |is_uni_alnum   |U32 c
 Ap     |bool   |is_uni_alnumc  |U32 c
 Ap     |bool   |is_uni_idfirst |U32 c
@@ -1602,6 +1620,7 @@ 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     |int    |is_utf8_char   |U8 *p
+Ap     |bool   |is_utf8_string |U8 *s|STRLEN len
 Ap     |bool   |is_utf8_alnum  |U8 *p
 Ap     |bool   |is_utf8_alnumc |U8 *p
 Ap     |bool   |is_utf8_idfirst|U8 *p
@@ -1885,6 +1904,7 @@ Ap        |void   |save_freesv    |SV* sv
 p      |void   |save_freeop    |OP* o
 Ap     |void   |save_freepv    |char* pv
 Ap     |void   |save_generic_svref|SV** sptr
+Ap     |void   |save_generic_pvref|char** str
 Ap     |void   |save_gp        |GV* gv|I32 empty
 Ap     |HV*    |save_hash      |GV* gv
 Ap     |void   |save_helem     |HV* hv|SV *key|SV **sptr
@@ -2043,6 +2063,8 @@ Ap        |U8*    |utf16_to_utf8  |U16* p|U8 *d|I32 bytelen
 Ap     |U8*    |utf16_to_utf8_reversed|U16* p|U8 *d|I32 bytelen
 Ap     |I32    |utf8_distance  |U8 *a|U8 *b
 Ap     |U8*    |utf8_hop       |U8 *s|I32 off
+Ap     |U8*    |utf8_to_bytes  |U8 *s|STRLEN len
+Ap     |U8*    |bytes_to_utf8  |U8 *s|STRLEN *len
 Ap     |UV     |utf8_to_uv     |U8 *s|I32* retlen
 Ap     |U8*    |uv_to_utf8     |U8 *d|UV uv
 p      |void   |vivify_defelem |SV* sv
@@ -2161,6 +2183,9 @@ Ap        |void*  |ptr_table_fetch|PTR_TBL_t *tbl|void *sv
 Ap     |void   |ptr_table_store|PTR_TBL_t *tbl|void *oldsv|void *newsv
 Ap     |void   |ptr_table_split|PTR_TBL_t *tbl
 #endif
+#if defined(HAVE_INTERP_INTERN)
+Ap     |void   |sys_intern_init
+#endif
 
 #if defined(PERL_OBJECT)
 protected:
@@ -2174,16 +2199,12 @@ s       |I32    |avhv_index     |AV* av|SV* sv|U32 hash
 #endif
 
 #if defined(PERL_IN_DOOP_C) || defined(PERL_DECL_PROT)
-s      |I32    |do_trans_CC_simple     |SV *sv
-s      |I32    |do_trans_CC_count      |SV *sv
-s      |I32    |do_trans_CC_complex    |SV *sv
-s      |I32    |do_trans_UU_simple     |SV *sv
-s      |I32    |do_trans_UU_count      |SV *sv
-s      |I32    |do_trans_UU_complex    |SV *sv
-s      |I32    |do_trans_UC_simple     |SV *sv
-s      |I32    |do_trans_CU_simple     |SV *sv
-s      |I32    |do_trans_UC_trivial    |SV *sv
-s      |I32    |do_trans_CU_trivial    |SV *sv
+s      |I32    |do_trans_simple        |SV *sv
+s      |I32    |do_trans_count         |SV *sv
+s      |I32    |do_trans_complex       |SV *sv
+s      |I32    |do_trans_simple_utf8   |SV *sv
+s      |I32    |do_trans_count_utf8    |SV *sv
+s      |I32    |do_trans_complex_utf8  |SV *sv
 #endif
 
 #if defined(PERL_IN_GV_C) || defined(PERL_DECL_PROT)
@@ -2461,6 +2482,7 @@ s |I32    |sublex_done
 s      |I32    |sublex_push
 s      |I32    |sublex_start
 s      |char * |filter_gets    |SV *sv|PerlIO *fp|STRLEN append
+s      |HV *   |find_in_my_stash|char *pkgname|I32 len
 s      |SV*    |new_constant   |char *s|STRLEN len|const char *key|SV *sv \
                                |SV *pv|const char *type
 s      |int    |ao             |int toketype
@@ -2489,6 +2511,8 @@ s |void   |xstat          |int
 #  endif
 #endif
 
+Arp    |SV*    |lock           |SV *sv
+
 #if defined(PERL_OBJECT)
 };
 #endif