Even more Todo.
[p5sagit/p5-mst-13.2.git] / vms / gen_shrfls.pl
index 9d5748d..3e70372 100644 (file)
@@ -33,7 +33,7 @@
 #     library has everything old one did
 #     (i.e. /Define=DEBUGGING,EMBED,MULTIPLICITY)?
 #
-# Author: Charles Bailey  bailey@genetics.upenn.edu
+# Author: Charles Bailey  bailey@newman.upenn.edu
 
 require 5.000;
 
@@ -64,11 +64,23 @@ $docc = ($cc_cmd !~ /^~~/);
 print "\$docc = $docc\n" if $debug;
 
 if ($docc) {
+  if (-f 'perl.h') { $dir = '[]'; }
+  elsif (-f '[-]perl.h') { $dir = '[-]'; }
+  else { die "$0: Can't find perl.h\n"; }
+
+  # Go see if debugging is enabled in config.h
+  $config = $dir . "config.h";
+  open CONFIG, "< $config";
+  while(<CONFIG>) {
+    $debugging_enabled++ if /define\s+DEBUGGING/;
+    $use_mymalloc++ if /define\s+MYMALLOC/;
+  }
+  
   # put quotes back onto defines - they were removed by DCL on the way in
   if (($prefix,$defines,$suffix) =
          ($cc_cmd =~ m#(.*)/Define=(.*?)([/\s].*)#i)) {
     $defines =~ s/^\((.*)\)$/$1/;
-    $debugging_enabled = $defines =~ /\bDEBUGGING\b/;
+    $debugging_enabled ||= $defines =~ /\bDEBUGGING\b/;
     @defines = split(/,/,$defines);
     $cc_cmd = "$prefix/Define=(" . join(',',grep($_ = "\"$_\"",@defines)) 
               . ')' . $suffix;
@@ -88,9 +100,6 @@ if ($docc) {
   print "\$isvaxc: $isvaxc\n" if $debug;
   print "\$debugging_enabled: $debugging_enabled\n" if $debug;
 
-  if (-f 'perl.h') { $dir = '[]'; }
-  elsif (-f '[-]perl.h') { $dir = '[-]'; }
-  else { die "$0: Can't find perl.h\n"; }
 }
 else { 
   ($junk,$junk,$cpp_file,$cc_cmd) = split(/~~/,$cc_cmd,4);
@@ -188,6 +197,14 @@ sub scan_func {
   }
 }
 
+# Go add some right up front if we need 'em
+if ($use_mymalloc) {
+  $fcns{'Perl_malloc'}++;
+  $fcns{'Perl_calloc'}++;
+  $fcns{'Perl_realloc'}++;
+  $fcns{'Perl_mfree'}++;
+}
+
 $used_expectation_enum = $used_opcode_enum = 0; # avoid warnings
 if ($docc) {
   open(CPP,"${cc_cmd}/NoObj/PreProc=Sys\$Output ${dir}perl.h|")
@@ -244,22 +261,17 @@ LINE: while (<CPP>) {
 }
 close CPP;
 
-
-# Kluge to determine whether we need to add EMBED prefix to
-# symbols read from local list.  vmsreaddirversions() is a VMS-
-# specific function whose Perl_ prefix is added in vmsish.h
-# if EMBED is #defined.
-$embed = exists($fcns{'Perl_vmsreaddirversions'}) ? 'Perl_' : '';
 while (<DATA>) {
   next if /^#/;
   s/\s+#.*\n//;
   next if /^\s*$/;
   ($key,$array) = split('=',$_);
-  $key = "$embed$key";
+  if ($array eq 'vars') { $key = "PL_$key";   }
+  else                  { $key = "Perl_$key"; }
   print "Adding $key to \%$array list\n" if $debug > 1;
   ${$array}{$key}++;
 }
-if ($debugging_enabled and ($isvaxc or $isgcc)) { $vars{'colors'}++ }
+if ($debugging_enabled and $isgcc) { $vars{'colors'}++ }
 foreach (split /\s+/, $extnames) {
   my($pkgname) = $_;
   $pkgname =~ s/::/__/g;
@@ -282,14 +294,6 @@ if ($isvaxc) {
     print STDERR "Unrecognized enum constant \"$_\" ignored\n";
   }
 }
-elsif ($isgcc) {
-  # gcc creates this as a SHR,WRT psect in globals.c, but we
-  # don't see it in the perl.h scan, since it's only declared
-  # if DOINIT is #defined.  Bleah.  It's cheaper to just add
-  # it by hand than to add /Define=DOINIT to the preprocessing
-  # run and wade through all the extra junk.
-  $vars{"${embed}Error"}++;
-}
 
 # Eventually, we'll check against existing copies here, so we can add new
 # symbols to an existing options file in an upwardly-compatible manner.
@@ -409,26 +413,6 @@ exec "\$ \@$drvrname" if $isvax;
 __END__
 
 # Oddball cases, so we can keep the perl.h scan above simple
-rcsid=vars      # declared in perl.c
 regkind=vars    # declared in regcomp.h
 simple=vars     # declared in regcomp.h
 varies=vars     # declared in regcomp.h
-watchaddr=vars  # declared in run.c
-watchok=vars    # declared in run.c
-yychar=vars     # generated by byacc in perly.c
-yycheck=vars    # generated by byacc in perly.c
-yydebug=vars    # generated by byacc in perly.c
-yydefred=vars   # generated by byacc in perly.c
-yydgoto=vars    # generated by byacc in perly.c
-yyerrflag=vars  # generated by byacc in perly.c
-yygindex=vars   # generated by byacc in perly.c
-yylen=vars      # generated by byacc in perly.c
-yylhs=vars      # generated by byacc in perly.c
-yylval=vars     # generated by byacc in perly.c
-yyname=vars     # generated by byacc in perly.c
-yynerrs=vars    # generated by byacc in perly.c
-yyrindex=vars   # generated by byacc in perly.c
-yyrule=vars     # generated by byacc in perly.c
-yysindex=vars   # generated by byacc in perly.c
-yytable=vars    # generated by byacc in perly.c
-yyval=vars      # generated by byacc in perly.c