[win32] Revert to keeping (some) constant strings as globals
Gurusamy Sarathy [Tue, 2 Dec 1997 07:28:23 +0000 (07:28 +0000)]
p4raw-id: //depot/win32/perl@349

embed.h
embed.pl
embedvar.h
global.sym
miniperlmain.c
perl.h
perlvars.h
win32/makedef.pl
win32/perllib.c

diff --git a/embed.h b/embed.h
index bd483e3..60000ef 100644 (file)
--- a/embed.h
+++ b/embed.h
@@ -22,8 +22,6 @@
 #define AMG_names              Perl_AMG_names
 #define Error                  Perl_Error
 #define Gv_AMupdate            Perl_Gv_AMupdate
-#define No                     Perl_No
-#define Yes                    Perl_Yes
 #define abs_amg                        Perl_abs_amg
 #define add_amg                        Perl_add_amg
 #define add_ass_amg            Perl_add_ass_amg
 #define gv_stashpv             Perl_gv_stashpv
 #define gv_stashpvn            Perl_gv_stashpvn
 #define gv_stashsv             Perl_gv_stashsv
-#define hexdigit               Perl_hexdigit
 #define hv_clear               Perl_hv_clear
 #define hv_delayfree_ent       Perl_hv_delayfree_ent
 #define hv_delete              Perl_hv_delete
 #define pad_reset              Perl_pad_reset
 #define pad_sv                 Perl_pad_sv
 #define pad_swipe              Perl_pad_swipe
-#define patleave               Perl_patleave
 #define peep                   Perl_peep
 #define pidgone                        Perl_pidgone
 #define pmflag                 Perl_pmflag
 #define unsharepvn             Perl_unsharepvn
 #define utilize                        Perl_utilize
 #define varies                 Perl_varies
-#define vert                   Perl_vert
 #define vivify_defelem         Perl_vivify_defelem
 #define vivify_ref             Perl_vivify_ref
 #define vtbl_amagic            Perl_vtbl_amagic
index 127774e..6c4177d 100755 (executable)
--- a/embed.pl
+++ b/embed.pl
@@ -28,7 +28,7 @@ sub readvars(\%$$) {
        or die "embed.pl: Can't open $file: $!\n";
     while (<FILE>) {
        s/[ \t]*#.*//;          # Delete comments.
-       if (/PERLVARI?\($pre(\w+)/) {
+       if (/PERLVARI?C?\($pre(\w+)/) {
            $$syms{$1} = 1;
        }
     }
@@ -279,4 +279,4 @@ print EM <<'END';
 
 END
 
-close(EM);
\ No newline at end of file
+close(EM);
index 8a3ea52..f2f7f69 100644 (file)
 
 #ifdef PERL_GLOBAL_STRUCT
 
+#define No                     (Perl_Vars.GNo)
+#define Yes                    (Perl_Vars.GYes)
 #define amagic_generation      (Perl_Vars.Gamagic_generation)
 #define an                     (Perl_Vars.Gan)
 #define bufend                 (Perl_Vars.Gbufend)
 #define expect                 (Perl_Vars.Gexpect)
 #define gid                    (Perl_Vars.Ggid)
 #define he_root                        (Perl_Vars.Ghe_root)
+#define hexdigit               (Perl_Vars.Ghexdigit)
 #define hints                  (Perl_Vars.Ghints)
 #define in_my                  (Perl_Vars.Gin_my)
 #define in_my_stash            (Perl_Vars.Gin_my_stash)
 #define pad_reset_pending      (Perl_Vars.Gpad_reset_pending)
 #define padix                  (Perl_Vars.Gpadix)
 #define padix_floor            (Perl_Vars.Gpadix_floor)
+#define patleave               (Perl_Vars.Gpatleave)
 #define pidstatus              (Perl_Vars.Gpidstatus)
 #define profiledata            (Perl_Vars.Gprofiledata)
 #define rsfp                   (Perl_Vars.Grsfp)
 
 #else /* !PERL_GLOBAL_STRUCT */
 
+#define GNo                    No
+#define GYes                   Yes
 #define Gamagic_generation     amagic_generation
 #define Gan                    an
 #define Gbufend                        bufend
 #define Gexpect                        expect
 #define Ggid                   gid
 #define Ghe_root               he_root
+#define Ghexdigit              hexdigit
 #define Ghints                 hints
 #define Gin_my                 in_my
 #define Gin_my_stash           in_my_stash
 #define Gpad_reset_pending     pad_reset_pending
 #define Gpadix                 padix
 #define Gpadix_floor           padix_floor
+#define Gpatleave              patleave
 #define Gpidstatus             pidstatus
 #define Gprofiledata           profiledata
 #define Grsfp                  rsfp
 
 #ifdef EMBED
 
+#define No                     Perl_No
+#define Yes                    Perl_Yes
 #define amagic_generation      Perl_amagic_generation
 #define an                     Perl_an
 #define bufend                 Perl_bufend
 #define expect                 Perl_expect
 #define gid                    Perl_gid
 #define he_root                        Perl_he_root
+#define hexdigit               Perl_hexdigit
 #define hints                  Perl_hints
 #define in_my                  Perl_in_my
 #define in_my_stash            Perl_in_my_stash
 #define pad_reset_pending      Perl_pad_reset_pending
 #define padix                  Perl_padix
 #define padix_floor            Perl_padix_floor
+#define patleave               Perl_patleave
 #define pidstatus              Perl_pidstatus
 #define profiledata            Perl_profiledata
 #define rsfp                   Perl_rsfp
index dfb2f3a..8b8c922 100644 (file)
@@ -4,8 +4,6 @@
 
 AMG_names
 Error
-No
-Yes
 abs_amg
 add_amg
 add_ass_amg
@@ -39,7 +37,6 @@ get_op_descs
 get_op_names
 ge_amg
 gt_amg
-hexdigit
 init_thread_intern
 inc_amg
 io_close
@@ -77,7 +74,6 @@ numer_amg
 op_desc
 op_name
 opargs
-patleave
 pow_amg
 pow_ass_amg
 ppaddr
@@ -113,7 +109,6 @@ string_amg
 subtr_amg
 subtr_ass_amg
 varies
-vert
 vivify_defelem
 vivify_ref
 vtbl_amagic
index 9b45889..b6c5c65 100644 (file)
@@ -28,9 +28,11 @@ char **env;
 #ifdef PERL_GLOBAL_STRUCT
 #define PERLVAR(var,type) /**/
 #define PERLVARI(var,type,init) Perl_Vars.var = init;
+#define PERLVARIC(var,type,init) Perl_Vars.var = init;
 #include "perlvars.h"
 #undef PERLVAR
 #undef PERLVARI
+#undef PERLVARC
 #endif
 
     PERL_SYS_INIT(&argc,&argv);
diff --git a/perl.h b/perl.h
index 3d8e423..4381e2d 100644 (file)
--- a/perl.h
+++ b/perl.h
@@ -1394,12 +1394,6 @@ EXT short *      ds;
 EXT char *     dc;
 
 /* handy constants */
-#define        Perl_Yes        "1"
-#define Perl_No                ""
-#define Perl_hexdigit  "0123456789abcdef0123456789ABCDEFx"
-#define Perl_patleave  "\\.^$@dDwWsSbB+*?|()-nrtfeaxc0123456789[{]}"
-#define Perl_vert      "|"
-
 EXTCONST char warn_uninit[]
   INIT("Use of uninitialized value");
 EXTCONST char warn_nosemi[]
@@ -1616,6 +1610,7 @@ typedef enum {
 /* Set up PERLVAR macros for populating structs */
 #define PERLVAR(var,type) type var;
 #define PERLVARI(var,type,init) type var;
+#define PERLVARIC(var,type,init) type var;
 
 #ifdef PERL_GLOBAL_STRUCT
 struct perl_vars {
@@ -1669,6 +1664,7 @@ struct perl_thread {
 /* Done with PERLVAR macros for now ... */
 #undef PERLVAR
 #undef PERLVARI
+#undef PERLVARIC
 
 typedef struct perl_thread *Thread;
 
@@ -1695,6 +1691,7 @@ typedef struct perl_thread *Thread;
 
 #define PERLVAR(var,type) EXT type var;
 #define PERLVARI(var,type,init) EXT type var INIT(init);
+#define PERLVARIC(var,type,init) EXTCONST type var INIT(init);
 
 #ifndef PERL_GLOBAL_STRUCT
 #include "perlvars.h"
index b5488ab..b58ea16 100644 (file)
@@ -157,3 +157,9 @@ PERLVARI(Gnumeric_local,    bool,   TRUE)   /* Assume local numerics */
 
 #endif /* !USE_LOCALE_NUMERIC */
 
+/* constants (these are not literals to facilitate pointer comparisons) */
+PERLVARIC(GYes,                char *, "1");
+PERLVARIC(GNo,         char *, "");
+PERLVARIC(Ghexdigit,   char *, "0123456789abcdef0123456789ABCDEFx");
+PERLVARIC(Gpatleave,   char *, "\\.^$@dDwWsSbB+*?|()-nrtfeaxc0123456789[{]}");
+
index eb33f66..3b983d5 100644 (file)
@@ -168,11 +168,6 @@ Perl_wait4pid
 Perl_watch
 Perl_yyname
 Perl_yyrule
-Perl_Yes
-Perl_No
-Perl_hexdigit
-Perl_patleave
-Perl_vert
 allgvs
 curblock
 curcsv
index b1002eb..b73a12e 100644 (file)
@@ -18,9 +18,11 @@ RunPerl(int argc, char **argv, char **env, void *iosubsystem)
 #ifdef PERL_GLOBAL_STRUCT
 #define PERLVAR(var,type) /**/
 #define PERLVARI(var,type,init) Perl_Vars.var = init;
+#define PERLVARIC(var,type,init) Perl_Vars.var = init;
 #include "perlvars.h"
 #undef PERLVAR
 #undef PERLVARI
+#undef PERLVARIC
 #endif
 
     PERL_SYS_INIT(&argc,&argv);