deadcode removal
[p5sagit/p5-mst-13.2.git] / embed.pl
index 1af25ad..ef8fc80 100755 (executable)
--- a/embed.pl
+++ b/embed.pl
@@ -257,16 +257,11 @@ sub objxsub_var ($$) {
     undefine("PL_$sym") . hide("PL_$sym", "(*Perl_${pfx}${sym}_ptr($arg))");
 }
 
-sub embedvar ($) {
-    my ($sym) = @_;
-#   hide($sym, "Perl_$sym");
-    return '';
-}
-
 sub multon ($$$) {
     my ($sym,$pre,$ptr) = @_;
     hide("PL_$sym", "($ptr$pre$sym)");
 }
+
 sub multoff ($$) {
     my ($sym,$pre) = @_;
     return hide("PL_$pre$sym", "PL_$sym");
@@ -285,6 +280,34 @@ print EM <<'END';
 
 /* NO_EMBED is no longer supported. i.e. EMBED is always active. */
 
+/* provide binary compatible (but inconsistent) names */
+#if defined(PERL_BINCOMPAT_5005)
+#  define  Perl_call_argv              perl_call_argv
+#  define  Perl_call_method            perl_call_method
+#  define  Perl_call_pv                        perl_call_pv
+#  define  Perl_call_sv                        perl_call_sv
+#  define  Perl_get_av                 perl_get_av
+#  define  Perl_get_cv                 perl_get_cv
+#  define  Perl_get_hv                 perl_get_hv
+#  define  Perl_get_sv                 perl_get_sv
+#  define  Perl_init_i18nl10n          perl_init_i18nl10n
+#  define  Perl_init_i18nl14n          perl_init_i18nl14n
+#  define  Perl_new_collate            perl_new_collate
+#  define  Perl_new_ctype              perl_new_ctype
+#  define  Perl_new_numeric            perl_new_numeric
+#  define  Perl_require_pv             perl_require_pv
+#  define  Perl_safesyscalloc          Perl_safecalloc
+#  define  Perl_safesysfree            Perl_safefree
+#  define  Perl_safesysmalloc          Perl_safemalloc
+#  define  Perl_safesysrealloc         Perl_saferealloc
+#  define  Perl_set_numeric_local      perl_set_numeric_local
+#  define  Perl_set_numeric_standard   perl_set_numeric_standard
+#  define  PERL_POLLUTE
+#  ifndef EMBEDMYMALLOC
+#    define  PERL_POLLUTE_MALLOC
+#  endif
+#endif
+
 /* Hide global symbols */
 
 #if !defined(PERL_OBJECT)
@@ -422,11 +445,12 @@ print EM <<'END';
    disable them.
  */
 
-#if !defined(PERL_CORE) && !defined(PERL_NOCOMPAT)
-
+#if !defined(PERL_CORE)
 #  define sv_setptrobj(rv,ptr,name)    sv_setref_iv(rv,name,(IV)ptr)
 #  define sv_setptrref(rv,ptr)         sv_setref_iv(rv,Nullch,(IV)ptr)
+#endif
 
+#if !defined(PERL_CORE) && !defined(PERL_NOCOMPAT) && !defined(PERL_BINCOMPAT_5005)
 
 /* Compatibility for various misnamed functions.  All functions
    in the API that begin with "perl_" (not "Perl_") take an explicit
@@ -504,42 +528,45 @@ print EM <<'END';
 
 /* (Doing namespace management portably in C is really gross.) */
 
-/* Put interpreter-specific symbols into a struct? */
-
-#ifdef MULTIPLICITY
-
-#ifndef USE_THREADS
-/* If we do not have threads then per-thread vars are per-interpreter */
-
-#ifdef PERL_IMPLICIT_CONTEXT
-
-/* everything has an implicit context pointer */
-
-END
-
-for $sym (sort keys %thread) {
-    print EM multon($sym,'T','my_perl->');
-}
-
-print EM <<'END';
+/*
+   The following combinations of MULTIPLICITY, USE_THREADS, PERL_OBJECT
+   and PERL_IMPLICIT_CONTEXT are supported:
+     1) none
+     2) MULTIPLICITY   # supported for compatibility
+     3) MULTIPLICITY && PERL_IMPLICIT_CONTEXT
+     4) USE_THREADS && PERL_IMPLICIT_CONTEXT
+     5) MULTIPLICITY && USE_THREADS && PERL_IMPLICIT_CONTEXT
+     6) PERL_OBJECT && PERL_IMPLICIT_CONTEXT
+
+   All other combinations of these flags are errors.
+
+   #3, #4, #5, and #6 are supported directly, while #2 is a special
+   case of #3 (supported by redefining vTHX appropriately).
+*/
 
-#else /* !PERL_IMPLICIT_CONTEXT */
+#if defined(MULTIPLICITY)
+/* cases 2, 3 and 5 above */
 
-/* traditional MULTIPLICITY (intepreter is in a global) */
+#  if defined(PERL_IMPLICIT_CONTEXT)
+#    define vTHX       aTHX
+#  else
+#    define vTHX       PERL_GET_INTERP
+#  endif
 
 END
 
-
 for $sym (sort keys %thread) {
-    print EM multon($sym,'T','PERL_GET_INTERP->');
+    print EM multon($sym,'T','vTHX->');
 }
 
 print EM <<'END';
 
-#endif /* !PERL_IMPLICIT_CONTEXT */
-#endif /* !USE_THREADS */
+#  if defined(PERL_OBJECT)
+#    include "error: PERL_OBJECT + MULTIPLICITY don't go together"
+#  endif
 
-/* These are always per-interpreter if there is more than one */
+#  if defined(USE_THREADS)
+/* case 5 above */
 
 END
 
@@ -549,66 +576,56 @@ for $sym (sort keys %intrp) {
 
 print EM <<'END';
 
-#else  /* !MULTIPLICITY */
+#  else                /* !USE_THREADS */
+/* cases 2 and 3 above */
 
 END
 
 for $sym (sort keys %intrp) {
-    print EM multoff($sym,'I');
+    print EM multon($sym,'I','vTHX->');
 }
 
 print EM <<'END';
 
-#ifndef USE_THREADS
+#  endif       /* USE_THREADS */
 
-END
-
-for $sym (sort keys %thread) {
-    print EM multoff($sym,'T');
-}
-
-print EM <<'END';
-
-#endif /* USE_THREADS */
-
-/* Hide what would have been interpreter-specific symbols? */
+#else  /* !MULTIPLICITY */
+/* cases 1, 4 and 6 above */
 
 END
 
 for $sym (sort keys %intrp) {
-    print EM embedvar($sym);
+    print EM multoff($sym,'I');
 }
 
 print EM <<'END';
 
-#ifndef USE_THREADS
+#  if defined(USE_THREADS)
+/* case 4 above */
 
 END
 
 for $sym (sort keys %thread) {
-    print EM embedvar($sym);
+    print EM multon($sym,'T','aTHX->');
 }
 
 print EM <<'END';
 
-#endif /* USE_THREADS */
-#endif /* MULTIPLICITY */
-
-/* Now same trickey for per-thread variables */
-
-#ifdef USE_THREADS
+#  else                /* !USE_THREADS */
+/* cases 1 and 6 above */
 
 END
 
 for $sym (sort keys %thread) {
-    print EM multon($sym,'T','thr->');
+    print EM multoff($sym,'T');
 }
 
 print EM <<'END';
 
-#endif /* USE_THREADS */
+#  endif       /* USE_THREADS */
+#endif /* MULTIPLICITY */
 
-#ifdef PERL_GLOBAL_STRUCT
+#if defined(PERL_GLOBAL_STRUCT)
 
 END
 
@@ -628,20 +645,8 @@ for $sym (sort keys %globvar) {
 
 print EM <<'END';
 
-END
-
-for $sym (sort keys %globvar) {
-    print EM embedvar($sym);
-}
-
-print EM <<'END';
-
 #endif /* PERL_GLOBAL_STRUCT */
 
-END
-
-print EM <<'END';
-
 #ifdef PERL_POLLUTE            /* disabled by default in 5.006 */
 
 END
@@ -655,7 +660,6 @@ print EM <<'END';
 #endif /* PERL_POLLUTE */
 END
 
-
 close(EM);
 
 unlink 'objXSUB.h';
@@ -752,8 +756,6 @@ print CAPIH <<'EOT';
 #  define aTHXo                        pPerl
 #  undef  aTHXo_
 #  define aTHXo_               aTHXo,
-#  undef  _aTHXo
-#  define _aTHXo               ,aTHXo
 #endif /* PERL_OBJECT */
 
 START_EXTERN_C
@@ -966,9 +968,9 @@ EOT
 __END__
 
 # Lines are of the form:
-#    flags|return_type|function_name|return_type|arg1|arg2|...|argN
+#    flags|return_type|function_name|arg1|arg2|...|argN
 #
-# They may continue on multiple lines when \w| begins the next line.
+# A line may be continued on another by ending it with a backslash.
 # Leading and trailing whitespace will be ignored in each component.
 #
 # flags are single letters with following meanings:
@@ -997,7 +999,6 @@ p   |bool   |Gv_AMupdate    |HV* stash
 p      |OP*    |append_elem    |I32 optype|OP* head|OP* tail
 p      |OP*    |append_list    |I32 optype|LISTOP* first|LISTOP* last
 p      |I32    |apply          |I32 type|SV** mark|SV** sp
-p      |void   |assertref      |OP* o
 p      |bool   |avhv_exists_ent|AV *ar|SV* keysv|U32 hash
 p      |SV**   |avhv_fetch_ent |AV *ar|SV* keysv|I32 lval|U32 hash
 p      |HE*    |avhv_iternext  |AV *ar
@@ -1023,7 +1024,7 @@ p |I32    |block_gimme
 p      |int    |block_start    |int full
 p      |void   |boot_core_UNIVERSAL
 p      |void   |call_list      |I32 oldscope|AV* av_list
-p      |I32    |cando          |I32 bit|I32 effective|Stat_t* statbufp
+p      |bool   |cando          |Mode_t mode|Uid_t effective|Stat_t* statbufp
 p      |U32    |cast_ulong     |NV f
 p      |I32    |cast_i32       |NV f
 p      |IV     |cast_iv        |NV f
@@ -1103,6 +1104,9 @@ p |void   |do_join        |SV* sv|SV* del|SV** mark|SV** sp
 p      |OP*    |do_kv
 p      |bool   |do_open        |GV* gv|char* name|I32 len|int as_raw \
                                |int rawmode|int rawperm|PerlIO* supplied_fp
+p      |bool   |do_open9       |GV *gv|char *name|I32 len|int as_raw \
+                               |int rawmode|int rawperm|PerlIO *supplied_fp \
+                               |SV *svs|I32 num
 p      |void   |do_pipe        |SV* sv|GV* rgv|GV* wgv
 p      |bool   |do_print       |SV* sv|PerlIO* fp
 p      |OP*    |do_readline
@@ -1112,6 +1116,7 @@ p |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
+p      |UV     |do_vecget      |SV* sv|I32 offset|I32 size
 p      |void   |do_vecset      |SV* sv
 p      |void   |do_vop         |I32 optype|SV* sv|SV* left|SV* right
 p      |OP*    |dofile         |OP* term
@@ -1191,11 +1196,12 @@ p       |HE*    |hv_store_ent   |HV* tb|SV* key|SV* val|U32 hash
 p      |void   |hv_undef       |HV* tb
 p      |I32    |ibcmp          |const char* a|const char* b|I32 len
 p      |I32    |ibcmp_locale   |const char* a|const char* b|I32 len
-p      |I32    |ingroup        |I32 testgid|I32 effective
+p      |bool   |ingroup        |Gid_t testgid|Uid_t effective
+p      |void   |init_debugger
 p      |void   |init_stacks
 p      |U32    |intro_my
 p      |char*  |instr          |const char* big|const char* little
-p      |bool   |io_close       |IO* io
+p      |bool   |io_close       |IO* io|bool not_implicit
 p      |OP*    |invert         |OP* cmd
 p      |bool   |is_uni_alnum   |U32 c
 p      |bool   |is_uni_alnumc  |U32 c
@@ -1464,7 +1470,7 @@ p |void   |set_numeric_local
 p      |void   |set_numeric_radix
 p      |void   |set_numeric_standard
 p      |void   |require_pv     |const char* pv
-p      |void   |pidgone        |int pid|int status
+p      |void   |pidgone        |Pid_t pid|int status
 p      |void   |pmflag         |U16* pmfl|int ch
 p      |OP*    |pmruntime      |OP* pm|OP* expr|OP* repl
 p      |OP*    |pmtrans        |OP* o|OP* expr|OP* repl
@@ -1542,10 +1548,10 @@ p       |OP*    |scalar         |OP* o
 p      |OP*    |scalarkids     |OP* o
 p      |OP*    |scalarseq      |OP* o
 p      |OP*    |scalarvoid     |OP* o
-p      |UV     |scan_bin       |char* start|I32 len|I32* retlen
-p      |UV     |scan_hex       |char* start|I32 len|I32* retlen
+p      |NV     |scan_bin       |char* start|I32 len|I32* retlen
+p      |NV     |scan_hex       |char* start|I32 len|I32* retlen
 p      |char*  |scan_num       |char* s
-p      |UV     |scan_oct       |char* start|I32 len|I32* retlen
+p      |NV     |scan_oct       |char* start|I32 len|I32* retlen
 p      |OP*    |scope          |OP* o
 p      |char*  |screaminstr    |SV* bigsv|SV* littlesv|I32 start_shift \
                                |I32 end_shift|I32 *state|I32 last
@@ -1670,7 +1676,7 @@ p |UV     |utf8_to_uv     |U8 *s|I32* retlen
 p      |U8*    |uv_to_utf8     |U8 *d|UV uv
 p      |void   |vivify_defelem |SV* sv
 p      |void   |vivify_ref     |SV* sv|U32 to_what
-p      |I32    |wait4pid       |int pid|int* statusp|int flags
+p      |I32    |wait4pid       |Pid_t pid|int* statusp|int flags
 p      |void   |warn           |const char* pat|...
 p      |void   |vwarn          |const char* pat|va_list* args
 p      |void   |warner         |U32 err|const char* pat|...
@@ -1799,6 +1805,7 @@ s |OP*    |no_fh_allowed  |OP *o
 s      |OP*    |scalarboolean  |OP *o
 s      |OP*    |too_few_arguments|OP *o|char* name
 s      |OP*    |too_many_arguments|OP *o|char* name
+s      |void   |op_clear       |OP* o
 s      |void   |null           |OP* o
 s      |PADOFFSET|pad_findlex  |char* name|PADOFFSET newoff|U32 seq \
                                |CV* startcv|I32 cx_ix|I32 saweval|U32 flags
@@ -1820,7 +1827,6 @@ s |void   |forbid_setid   |char *
 s      |void   |incpush        |char *|int
 s      |void   |init_interp
 s      |void   |init_ids
-s      |void   |init_debugger
 s      |void   |init_lexer
 s      |void   |init_main_stash
 s      |void   |init_perllib
@@ -1872,11 +1878,12 @@ s       |void   |qsortsv        |SV ** array|size_t num_elts|SVCOMPARE_t f
 
 #if defined(PERL_IN_PP_HOT_C) || defined(PERL_DECL_PROT)
 s      |CV*    |get_db_sub     |SV **svp|CV *cv
+s      |SV*    |method_common  |SV* meth|U32* hashp
 #endif
 
 #if defined(PERL_IN_PP_SYS_C) || defined(PERL_DECL_PROT)
 s      |OP*    |doform         |CV *cv|GV *gv|OP *retop
-s      |int    |emulate_eaccess|const char* path|int mode
+s      |int    |emulate_eaccess|const char* path|Mode_t mode
 #  if !defined(HAS_MKDIR) || !defined(HAS_RMDIR)
 s      |int    |dooneliner     |char *cmd|char *filename
 #  endif
@@ -1887,7 +1894,6 @@ s |regnode*|reg           |I32|I32 *
 s      |regnode*|reganode      |U8|U32
 s      |regnode*|regatom       |I32 *
 s      |regnode*|regbranch     |I32 *|I32
-s      |void   |regc           |U8|char *
 s      |void   |reguni         |UV|char *|I32*
 s      |regnode*|regclass
 s      |regnode*|regclassutf8
@@ -1901,9 +1907,10 @@ s        |char*|regwhite |char *|char *
 s      |char*|nextchar
 s      |regnode*|dumpuntil     |regnode *start|regnode *node \
                                |regnode *last|SV* sv|I32 l
-s      |void   |scan_commit    |scan_data_t *data
+s      |void   |scan_commit    |struct scan_data_t *data
 s      |I32    |study_chunk    |regnode **scanp|I32 *deltap \
-                               |regnode *last|scan_data_t *data|U32 flags
+                               |regnode *last|struct scan_data_t *data \
+                               |U32 flags
 s      |I32    |add_data       |I32 n|char *s
 rs     |void|re_croak2 |const char* pat1|const char* pat2|...
 s      |I32    |regpposixcc    |I32 value