Change 12513 by jhi@alpha on 2001/10/19 21:09:27

        Subject: [PATCH Perl@12494] vmsish fix, ieee rand() cleanup
        From: [EMAIL PROTECTED] (Charles Lane)
        Date: Fri, 19 Oct 2001 17:45:23 EDT
        Message-Id: <[EMAIL PROTECTED]>

Affected files ...

... //depot/perl/configure.com#120 edit
... //depot/perl/dump.c#98 edit
... //depot/perl/ext/B/t/stash.t#3 edit
... //depot/perl/op.c#447 edit
... //depot/perl/op.h#99 edit
... //depot/perl/opcode.h#77 edit
... //depot/perl/opcode.pl#88 edit
... //depot/perl/perl.c#378 edit
... //depot/perl/perl.h#402 edit
... //depot/perl/perlvars.h#37 edit
... //depot/perl/pp.sym#23 edit
... //depot/perl/pp_ctl.c#294 edit
... //depot/perl/pp_proto.h#31 edit
... //depot/perl/pp_sys.c#262 edit
... //depot/perl/vms/ext/vmsish.pm#10 edit
... //depot/perl/vms/ext/vmsish.t#10 edit
... //depot/perl/vms/vms.c#86 edit
... //depot/perl/vms/vmsish.h#49 edit

Differences ...

==== //depot/perl/configure.com#120 (text) ====
Index: perl/configure.com
--- perl/configure.com.~1~      Fri Oct 19 15:15:05 2001
+++ perl/configure.com  Fri Oct 19 15:15:05 2001
@@ -4514,7 +4514,6 @@
 $! Check rand48 and its ilk
 $!
 $ echo4 "Looking for a random number function..."
-$ d_use_rand = "undef"
 $ OS
 $ WS "#if defined(__DECC) || defined(__DECCXX)"
 $ WS "#include <stdlib.h>"
@@ -4555,10 +4554,9 @@
 $   THEN
 $     echo4 "OK, found random()."
 $   ELSE
-$     drand01="(((float)rand())*PL_my_inv_rand_max)"
+$     drand01="(((float)rand())*MY_INV_RAND_MAX)"
 $     randseedtype = "unsigned"
 $     seedfunc = "srand"
-$     d_use_rand = "define"
 $     echo4 "Yick, looks like I have to use rand()."
 $   ENDIF
 $ ENDIF
@@ -5732,7 +5730,6 @@
 $! Alas this does not help to build Fcntl
 $!   WC "#define PERL_IGNORE_FPUSIG SIGFPE"
 $ ENDIF
-$ if d_use_rand .EQS. "define" then WC "#define Drand01_is_rand"
 $ CLOSE CONFIG
 $!
 $ echo4 "Doing variable substitutions on .SH files..."

==== //depot/perl/dump.c#98 (text) ====
Index: perl/dump.c
--- perl/dump.c.~1~     Fri Oct 19 15:15:05 2001
+++ perl/dump.c Fri Oct 19 15:15:05 2001
@@ -616,7 +616,13 @@
        }
        else if (o->op_type == OP_EXIT) {
            if (o->op_private & OPpEXIT_VMSISH)
-               sv_catpv(tmpsv, ",EXIST_VMSISH");
+               sv_catpv(tmpsv, ",EXIT_VMSISH");
+           if (o->op_private & OPpHUSH_VMSISH)
+               sv_catpv(tmpsv, ",HUSH_VMSISH");
+       }
+       else if (o->op_type == OP_DIE) {
+           if (o->op_private & OPpHUSH_VMSISH)
+               sv_catpv(tmpsv, ",HUSH_VMSISH");
        }
        if (o->op_flags & OPf_MOD && o->op_private & OPpLVAL_INTRO)
            sv_catpv(tmpsv, ",INTRO");

==== //depot/perl/ext/B/t/stash.t#3 (xtext) ====
Index: perl/ext/B/t/stash.t
--- perl/ext/B/t/stash.t.~1~    Fri Oct 19 15:15:05 2001
+++ perl/ext/B/t/stash.t        Fri Oct 19 15:15:05 2001
@@ -42,6 +42,7 @@
 if ($Is_VMS) {
     $a =~ s/-uFile,-uFile::Copy,//;
     $a =~ s/-uVMS,-uVMS::Filespec,//;
+    $a =~ s/-uvmsish,//;
     $a =~ s/-uSocket,//; # Socket is optional/compiler version dependent
 }
 

==== //depot/perl/op.c#447 (text) ====
Index: perl/op.c
--- perl/op.c.~1~       Fri Oct 19 15:15:05 2001
+++ perl/op.c   Fri Oct 19 15:15:05 2001
@@ -5432,6 +5432,15 @@
 }
 
 OP *
+Perl_ck_die(pTHX_ OP *o)
+{
+#ifdef VMS
+    if (VMSISH_HUSHED) o->op_private |= OPpHUSH_VMSISH;
+#endif
+    return ck_fun(o);
+}
+
+OP *
 Perl_ck_eof(pTHX_ OP *o)
 {
     I32 type = o->op_type;
@@ -5500,6 +5509,7 @@
        if (svp && *svp && SvTRUE(*svp))
            o->op_private |= OPpEXIT_VMSISH;
     }
+    if (VMSISH_HUSHED) o->op_private |= OPpHUSH_VMSISH;
 #endif
     return ck_fun(o);
 }

==== //depot/perl/op.h#99 (text) ====
Index: perl/op.h
--- perl/op.h.~1~       Fri Oct 19 15:15:05 2001
+++ perl/op.h   Fri Oct 19 15:15:05 2001
@@ -197,7 +197,8 @@
 #define OPpOPEN_OUT_RAW                64      /* binmode(F,":raw") on output fh */
 #define OPpOPEN_OUT_CRLF       128     /* binmode(F,":crlf") on output fh */
 
-/* Private for OP_EXIT */
+/* Private for OP_EXIT, HUSH also for OP_DIE */
+#define OPpHUSH_VMSISH         64      /* hush DCL exit msg vmsish mode*/
 #define OPpEXIT_VMSISH         128     /* exit(0) vs. exit(1) vmsish mode*/
 
 struct op {

==== //depot/perl/opcode.h#77 (text+w) ====
Index: perl/opcode.h
--- perl/opcode.h.~1~   Fri Oct 19 15:15:05 2001
+++ perl/opcode.h       Fri Oct 19 15:15:05 2001
@@ -1273,7 +1273,7 @@
        MEMBER_TO_FPTR(Perl_ck_null),   /* leavesublv */
        MEMBER_TO_FPTR(Perl_ck_fun),    /* caller */
        MEMBER_TO_FPTR(Perl_ck_fun),    /* warn */
-       MEMBER_TO_FPTR(Perl_ck_fun),    /* die */
+       MEMBER_TO_FPTR(Perl_ck_die),    /* die */
        MEMBER_TO_FPTR(Perl_ck_fun),    /* reset */
        MEMBER_TO_FPTR(Perl_ck_null),   /* lineseq */
        MEMBER_TO_FPTR(Perl_ck_null),   /* nextstate */

==== //depot/perl/opcode.pl#88 (xtext) ====
Index: perl/opcode.pl
--- perl/opcode.pl.~1~  Fri Oct 19 15:15:05 2001
+++ perl/opcode.pl      Fri Oct 19 15:15:05 2001
@@ -652,7 +652,7 @@
 leavesublv     lvalue subroutine return        ck_null         1       
 caller         caller                  ck_fun          t%      S?
 warn           warn                    ck_fun          imst@   L
-die            die                     ck_fun          dimst@  L
+die            die                     ck_die          dimst@  L
 reset          symbol reset            ck_fun          is%     S?
 
 lineseq                line sequence           ck_null         @       

==== //depot/perl/perl.c#378 (text) ====
Index: perl/perl.c
--- perl/perl.c.~1~     Fri Oct 19 15:15:05 2001
+++ perl/perl.c Fri Oct 19 15:15:05 2001
@@ -1492,6 +1492,9 @@
 #endif
 
     oldscope = PL_scopestack_ix;
+#ifdef VMS
+    VMSISH_HUSHED = 0;
+#endif
 
 #ifdef PERL_FLEXIBLE_EXCEPTIONS
  redo_body:

==== //depot/perl/perl.h#402 (text) ====
Index: perl/perl.h
--- perl/perl.h.~1~     Fri Oct 19 15:15:05 2001
+++ perl/perl.h Fri Oct 19 15:15:05 2001
@@ -425,7 +425,7 @@
 #  define MYSWAP
 #endif
 
-#if !defined(PERL_FOR_X2P) && !defined(WIN32)
+#if !defined(PERL_FOR_X2P) && !(defined(WIN32)||defined(VMS))
 #  include "embed.h"
 #endif
 
@@ -1754,6 +1754,7 @@
 #else
 # if defined(VMS)
 #   include "vmsish.h"
+#   include "embed.h"
 # else
 #   if defined(PLAN9)
 #     include "./plan9/plan9ish.h"

==== //depot/perl/perlvars.h#37 (text) ====
Index: perl/perlvars.h
--- perl/perlvars.h.~1~ Fri Oct 19 15:15:05 2001
+++ perl/perlvars.h     Fri Oct 19 15:15:05 2001
@@ -40,7 +40,3 @@
 PERLVAR(Gsharedsv_space, PerlInterpreter*) /* The shared sv space */
 PERLVAR(Gsharedsv_space_mutex, perl_mutex) /* Mutex protecting the shared sv space */
 #endif
-
-#if defined(VMS) && defined(Drand01_is_rand)
-PERLVAR(Gmy_inv_rand_max, float) /* nasty compiler bug workaround */
-#endif

==== //depot/perl/pp.sym#23 (text+w) ====
Index: perl/pp.sym
--- perl/pp.sym.~1~     Fri Oct 19 15:15:05 2001
+++ perl/pp.sym Fri Oct 19 15:15:05 2001
@@ -9,6 +9,7 @@
 Perl_ck_concat
 Perl_ck_defined
 Perl_ck_delete
+Perl_ck_die
 Perl_ck_eof
 Perl_ck_eval
 Perl_ck_exec

==== //depot/perl/pp_ctl.c#294 (text) ====
Index: perl/pp_ctl.c
--- perl/pp_ctl.c.~1~   Fri Oct 19 15:15:05 2001
+++ perl/pp_ctl.c       Fri Oct 19 15:15:05 2001
@@ -2593,6 +2593,7 @@
 #ifdef VMS
         if (anum == 1 && (PL_op->op_private & OPpEXIT_VMSISH))
            anum = 0;
+        VMSISH_HUSHED  = VMSISH_HUSHED || (PL_op->op_private & OPpHUSH_VMSISH);
 #endif
     }
     PL_exit_flags |= PERL_EXIT_EXPECTED;

==== //depot/perl/pp_proto.h#31 (text+w) ====
Index: perl/pp_proto.h
--- perl/pp_proto.h.~1~ Fri Oct 19 15:15:05 2001
+++ perl/pp_proto.h     Fri Oct 19 15:15:05 2001
@@ -8,6 +8,7 @@
 PERL_CKDEF(Perl_ck_concat)
 PERL_CKDEF(Perl_ck_defined)
 PERL_CKDEF(Perl_ck_delete)
+PERL_CKDEF(Perl_ck_die)
 PERL_CKDEF(Perl_ck_eof)
 PERL_CKDEF(Perl_ck_eval)
 PERL_CKDEF(Perl_ck_exec)

==== //depot/perl/pp_sys.c#262 (text) ====
Index: perl/pp_sys.c
--- perl/pp_sys.c.~1~   Fri Oct 19 15:15:05 2001
+++ perl/pp_sys.c       Fri Oct 19 15:15:05 2001
@@ -433,6 +433,9 @@
     SV *tmpsv;
     STRLEN len;
     bool multiarg = 0;
+#ifdef VMS
+    VMSISH_HUSHED  = VMSISH_HUSHED || (PL_op->op_private & OPpHUSH_VMSISH);
+#endif
     if (SP - MARK != 1) {
        dTARGET;
        do_join(TARG, &PL_sv_no, MARK, SP);

==== //depot/perl/vms/ext/vmsish.pm#10 (text) ====
Index: perl/vms/ext/vmsish.pm
--- perl/vms/ext/vmsish.pm.~1~  Fri Oct 19 15:15:05 2001
+++ perl/vms/ext/vmsish.pm      Fri Oct 19 15:15:05 2001
@@ -11,7 +11,10 @@
     use vmsish 'status';       # or '$?'
     use vmsish 'exit';
     use vmsish 'time';
+
     use vmsish 'hushed';
+    no vmsish 'hushed';
+    vmsish::hushed($hush);
 
     use vmsish;
     no vmsish 'time';
@@ -44,13 +47,59 @@
 
 =item C<vmsish hushed>
 
-This suppresses printing of VMS status messages to SYS$OUTPUT and SYS$ERROR
-if Perl terminates with an error status.  This primarily effects error
-exits from things like Perl compiler errors or "standard Perl" runtime errors,
-where text error messages are also generated by Perl.
+This suppresses printing of VMS status messages to SYS$OUTPUT and
+SYS$ERROR if Perl terminates with an error status.  and allows
+programs that are expecting "unix-style" Perl to avoid having to parse
+VMS error messages.  It does not supress any messages from Perl
+itself, just the messages generated by DCL after Perl exits.  The DCL
+symbol $STATUS will still have the termination status, but with a
+high-order bit set:
+
+EXAMPLE:
+    $ perl -e"exit 44;"                             Non-hushed error exit
+    %SYSTEM-F-ABORT, abort                          DCL message
+    $ show sym $STATUS
+      $STATUS == "%X0000002C"
+
+    $ perl -e"use vmsish qw(hushed); exit 44;"      Hushed error exit
+    $ show sym $STATUS
+      $STATUS == "%X1000002C"
+
+The 'hushed' flag has a global scope during compilation: the exit() or
+die() commands that are compiled after 'vmsish hushed' will be hushed
+when they are executed.  Doing a "no vmsish 'hushed'" turns off the
+hushed flag.
+
+The status of the hushed flag also affects output of VMS error
+messages from compilation errors.   Again, you still get the Perl
+error message (and the code in $STATUS)
+
+EXAMPLE:
+    use vmsish 'hushed';    # turn on hushed flag
+    use Carp;          # Carp compiled hushed
+    exit 44;           # will be hushed
+    croak('I die');    # will be hushed
+    no vmsish 'hushed';     # turn off hushed flag
+    exit 44;           # will not be hushed
+    croak('I die2'):   # WILL be hushed, croak was compiled hushed
+
+You can also control the 'hushed' flag at run-time, using the built-in
+routine vmsish::hushed().  Without argument, it returns the hushed status.
+Since vmsish::hushed is built-in, you do not need to "use vmsish" to call
+it.
+
+EXAMPLE:
+    if ($quiet_exit) {
+        vmsish::hushed(1);
+    } 
+    print "Sssshhhh...I'm hushed...\n" if vmsish::hushed();
+    exit 44;
+
+Note that an exit() or die() that is compiled 'hushed' because of "use
+vmsish" is not un-hushed by calling vmsish::hushed(0) at runtime.
 
-The error exits from inside the core are generally more serious, and are
-not supressed.
+The messages from error exits from inside the Perl core are generally
+more serious, and are not supressed.
 
 =back
 
@@ -67,7 +116,6 @@
     my $bits = 0;
     my $sememe;
     foreach $sememe (@_) {
-        $bits |= 0x20000000, next if $sememe eq 'hushed';
         $bits |= 0x40000000, next if $sememe eq 'status' || $sememe eq '$?';
        $bits |= 0x80000000, next if $sememe eq 'time';
     }
@@ -76,21 +124,23 @@
 
 sub import {
     shift;
-    $^H |= bits(@_ ? @_ : qw(status time hushed));
+    $^H |= bits(@_ ? @_ : qw(status time));
     my $sememe;
 
-    foreach $sememe (@_ ? @_ : qw(exit)) {
+    foreach $sememe (@_ ? @_ : qw(exit hushed)) {
         $^H{'vmsish_exit'}   = 1 if $sememe eq 'exit';
+        vmsish::hushed(1) if $sememe eq 'hushed';
     }
 }
 
 sub unimport {
     shift;
-    $^H &= ~ bits(@_ ? @_ : qw(status time hushed));
+    $^H &= ~ bits(@_ ? @_ : qw(status time));
     my $sememe;
 
-    foreach $sememe (@_ ? @_ : qw(exit)) {
+    foreach $sememe (@_ ? @_ : qw(exit hushed)) {
         $^H{'vmsish_exit'}   = 0 if $sememe eq 'exit';
+        vmsish::hushed(0) if $sememe eq 'hushed';
     }
 }
 

==== //depot/perl/vms/ext/vmsish.t#10 (text) ====
Index: perl/vms/ext/vmsish.t
--- perl/vms/ext/vmsish.t.~1~   Fri Oct 19 15:15:05 2001
+++ perl/vms/ext/vmsish.t       Fri Oct 19 15:15:05 2001
@@ -3,31 +3,27 @@
 
 my $Invoke_Perl = qq(MCR $^X "-I[-.lib]");
 
-print "1..17\n";
+require "test.pl";
+plan(tests => 24);
 
 #========== vmsish status ==========
 `$Invoke_Perl -e 1`;  # Avoid system() from a pipe from harness.  Mutter.
-if ($?) { print "not ok 1 # POSIX status is $?\n"; }
-else    { print "ok 1\n"; }
+is($?,0,"simple Perl invokation: POSIX success status");
 {
   use vmsish qw(status);
-  if (not ($? & 1)) { print "not ok 2 # vmsish status is $?\n"; }
-  else              { print "ok 2\n"; }
+  is(($? & 1),1, "importing vmsish [vmsish status]");
   {
-    no vmsish '$?'; # check unimport function
-    if ($?) { print "not ok 3 # POSIX status is $?\n"; }
-    else    { print "ok 3\n"; }
+    no vmsish qw(status); # check unimport function
+    is($?,0, "unimport vmsish [POSIX STATUS]");
   }
   # and lexical scoping
-  if (not ($? & 1)) { print "not ok 4 # vmsish status is $?\n"; }
-  else              { print "ok 4\n"; }
+  is(($? & 1),1,"lex scope of vmsish [vmsish status]");
 }
-if ($?) { print "not ok 5 # POSIX status is $?\n"; }
-else    { print "ok 5\n";                          }
+is($?,0,"outer lex scope of vmsish [POSIX status]");
+
 {
   use vmsish qw(exit);  # check import function
-  if ($?) { print "not ok 6 # POSIX status is $?\n"; }
-  else    { print "ok 6\n"; }
+  is($?,0,"importing vmsish exit [POSIX status]");
 }
 
 #========== vmsish exit, messages ==========
@@ -35,39 +31,54 @@
   use vmsish qw(status);
 
   $msg = do_a_perl('-e "exit 1"');
-  if ($msg !~ /ABORT/) {
     $msg =~ s/\n/\\n/g; # keep output on one line
-    print "not ok 7 # subprocess output: |$msg|\n";
-  }
-  else { print "ok 7\n"; }
-  if ($? & 1) { print "not ok 8 # subprocess VMS status: $?\n"; }
-  else        { print "ok 8\n"; }
+  like($msg,'ABORT', "POSIX ERR exit, DCL error message check");
+  is($?&1,0,"vmsish status check, POSIX ERR exit");
 
   $msg = do_a_perl('-e "use vmsish qw(exit); exit 1"');
-  if (length $msg) {
     $msg =~ s/\n/\\n/g; # keep output on one line
-    print "not ok 9 # subprocess output: |$msg|\n";
-  }
-  else { print "ok 9\n"; }
-  if (not ($? & 1)) { print "not ok 10 # subprocess VMS status: $?\n"; }
-  else              { print "ok 10\n"; }
+  ok(length($msg)==0,"vmsish OK exit, DCL error message check");
+  is($?&1,1, "vmsish status check, vmsish OK exit");
 
   $msg = do_a_perl('-e "use vmsish qw(exit); exit 44"');
-  if ($msg !~ /ABORT/) {
     $msg =~ s/\n/\\n/g; # keep output on one line
-    print "not ok 11 # subprocess output: |$msg|\n";
-  }
-  else { print "ok 11\n"; }
-  if ($? & 1) { print "not ok 12 # subprocess VMS status: $?\n"; }
-  else        { print "ok 12\n"; }
+  like($msg, 'ABORT', "vmsish ERR exit, DCL error message check");
+  is($?&1,0,"vmsish ERR exit, vmsish status check");
+
+  $msg = do_a_perl('-e "use vmsish qw(hushed); exit 1"');
+  $msg =~ s/\n/\\n/g; # keep output on one line
+  ok(($msg !~ /ABORT/),"POSIX ERR exit, vmsish hushed, DCL error message check");
 
   $msg = do_a_perl('-e "use vmsish qw(exit hushed); exit 44"');
-  if ($msg =~ /ABORT/) {
     $msg =~ s/\n/\\n/g; # keep output on one line
-    print "not ok 13 # subprocess output: |$msg|\n";
-  }
-  else { print "ok 13\n"; }
+  ok(($msg !~ /ABORT/),"vmsish ERR exit, vmsish hushed, DCL error message check");
+
+  $msg = do_a_perl('-e "use vmsish qw(exit hushed); no vmsish qw(hushed); exit 44"');
+  $msg =~ s/\n/\\n/g; # keep output on one line
+  like($msg,'ABORT',"vmsish ERR exit, no vmsish hushed, DCL error message check");
+
+  $msg = do_a_perl('-e "use vmsish qw(hushed); die(qw(blah));"');
+  $msg =~ s/\n/\\n/g; # keep output on one line
+  ok(($msg !~ /ABORT/),"die, vmsish hushed, DCL error message check");
+
+  $msg = do_a_perl('-e "use vmsish qw(hushed); use Carp; croak(qw(blah));"');
+  $msg =~ s/\n/\\n/g; # keep output on one line
+  ok(($msg !~ /ABORT/),"croak, vmsish hushed, DCL error message check");
+
+  $msg = do_a_perl('-e "use vmsish qw(exit); vmsish::hushed(1); exit 44;"');
+  $msg =~ s/\n/\\n/g; # keep output on one line
+  ok(($msg !~ /ABORT/),"vmsish ERR exit, vmsish hushed at runtime, DCL error message 
+check");
 
+  local *TEST;
+  open(TEST,'>vmsish_test.pl') || die('not ok ?? : unable to open "vmsish_test.pl" 
+for writing');  
+  print TEST "#! perl\n";
+  print TEST "use vmsish qw(hushed);\n";
+  print TEST "\$obvious = (\$compile(\$error;\n";
+  close TEST;
+  $msg = do_a_perl('vmsish_test.pl');
+  $msg =~ s/\n/\\n/g; # keep output on one line
+  ok(($msg !~ /ABORT/),"compile ERR exit, vmsish hushed, DCL error message check");
+  unlink 'vmsish_test.pl';
 }
 
 
@@ -84,7 +95,7 @@
     gmtime(0); # Force reset of tz offset
   }
   {
-     use vmsish qw(time);
+     use_ok('vmsish qw(time)');
      $vmstime   = time;
      @vmslocal  = localtime($vmstime);
      @vmsgmtime = gmtime($vmstime);
@@ -101,33 +112,21 @@
   # since it's unlikely local time will differ from UTC by so small
   # an amount, and it renders the test resistant to delays from
   # things like stat() on a file mounted over a slow network link.
-  if ($utctime - $vmstime + $offset > 10) {
-    print "not ok 14  # (time) UTC: $utctime  VMS: $vmstime\n";
-  }
-  else { print "ok 14\n"; }
+  ok($utctime - $vmstime +$offset <= 10,"(time) UTC:$utctime VMS:$vmstime");
 
   $utcval = $utclocal[5] * 31536000 + $utclocal[7] * 86400 +
             $utclocal[2] * 3600     + $utclocal[1] * 60 + $utclocal[0];
   $vmsval = $vmslocal[5] * 31536000 + $vmslocal[7] * 86400 +
             $vmslocal[2] * 3600     + $vmslocal[1] * 60 + $vmslocal[0];
-  if ($vmsval - $utcval + $offset > 10) {
-    print "not ok 15  # (localtime)\n# UTC: @utclocal\n# VMS: @vmslocal\n";
-  }
-  else { print "ok 15\n"; }
+  ok($vmsval - $utcval + $offset <= 10, "(localtime)\n# UTC: @utclocal\n# VMS: 
+@vmslocal");
 
   $utcval = $utcgmtime[5] * 31536000 + $utcgmtime[7] * 86400 +
             $utcgmtime[2] * 3600     + $utcgmtime[1] * 60 + $utcgmtime[0];
   $vmsval = $vmsgmtime[5] * 31536000 + $vmsgmtime[7] * 86400 +
             $vmsgmtime[2] * 3600     + $vmsgmtime[1] * 60 + $vmsgmtime[0];
-  if ($vmsval - $utcval + $offset > 10) {
-    print "not ok 16  # (gmtime)\n# UTC: @utcgmtime\n# VMS: @vmsgmtime\n";
-  }
-  else { print "ok 16\n"; }
+  ok($vmsval - $utcval + $offset <= 10, "(gmtime)\n# UTC: @utcgmtime\n# VMS: 
+@vmsgmtime");
 
-  if ($vmsmtime - $utcmtime + $offset > 10) {
-    print "not ok 17  # (stat) UTC: $utcmtime  VMS: $vmsmtime\n";
-  }
-  else { print "ok 17\n"; }
+  ok($vmsmtime - $utcmtime + $offset <= 10,"(stat) UTC: $utcmtime  VMS: $vmsmtime");
 }
 
 #====== need this to make sure error messages come out, even if

==== //depot/perl/vms/vms.c#86 (text) ====
Index: perl/vms/vms.c
--- perl/vms/vms.c.~1~  Fri Oct 19 15:15:05 2001
+++ perl/vms/vms.c      Fri Oct 19 15:15:05 2001
@@ -6911,6 +6911,44 @@
 }
 
 void
+hushexit_fromperl(pTHX_ CV *cv)
+{
+    dXSARGS;
+
+    if (items > 0) {
+        VMSISH_HUSHED = SvTRUE(ST(0));
+    }
+    ST(0) = boolSV(VMSISH_HUSHED);
+    XSRETURN(1);
+}
+
+void  
+Perl_sys_intern_dup(pTHX_ struct interp_intern *src, 
+                          struct interp_intern *dst)
+{
+    memcpy(dst,src,sizeof(struct interp_intern));
+}
+
+void  
+Perl_sys_intern_clear(pTHX)
+{
+}
+
+void  
+Perl_sys_intern_init(pTHX)
+{
+    int ix = RAND_MAX;
+    float x;
+
+    VMSISH_HUSHED = 0;
+
+    x = (float)ix;
+    MY_INV_RAND_MAX = 1./x;
+}
+
+
+
+void
 init_os_extras()
 {
   dTHX;
@@ -6932,18 +6970,10 @@
   newXSproto("VMS::Filespec::candelete",candelete_fromperl,file,"$");
   newXSproto("DynaLoader::mod2fname", mod2fname, file, "$");
   newXS("File::Copy::rmscopy",rmscopy_fromperl,file);
+  newXSproto("vmsish::hushed",hushexit_fromperl,file,";$");
 
   store_pipelocs(aTHX);
 
-#ifdef Drand01_is_rand
-/* this hackery brought to you by a bug in DECC for /ieee=denorm */
-  { 
-    int ix = RAND_MAX;
-    float x = (float)ix;
-    PL_my_inv_rand_max = 1./x;
-  }
-#endif
-
   return;
 }
   

==== //depot/perl/vms/vmsish.h#49 (text) ====
Index: perl/vms/vmsish.h
--- perl/vms/vmsish.h.~1~       Fri Oct 19 15:15:05 2001
+++ perl/vms/vmsish.h   Fri Oct 19 15:15:05 2001
@@ -285,16 +285,24 @@
 #define COMPLEX_STATUS 1       /* We track both "POSIX" and VMS values */
 
 #define HINT_V_VMSISH          24
-#define HINT_M_VMSISH_HUSHED   0x20000000 /* stifle error msgs on exit */
 #define HINT_M_VMSISH_STATUS   0x40000000 /* system, $? return VMS status */
 #define HINT_M_VMSISH_TIME     0x80000000 /* times are local, not UTC */
 #define NATIVE_HINTS           (PL_hints >> HINT_V_VMSISH)  /* used in op.c */
 
 #define TEST_VMSISH(h) (PL_curcop->op_private & ((h) >> HINT_V_VMSISH))
-#define VMSISH_HUSHED  TEST_VMSISH(HINT_M_VMSISH_HUSHED)
 #define VMSISH_STATUS  TEST_VMSISH(HINT_M_VMSISH_STATUS)
 #define VMSISH_TIME    TEST_VMSISH(HINT_M_VMSISH_TIME)
 
+/* VMS-specific data storage */
+
+#define HAVE_INTERP_INTERN
+struct interp_intern {
+    int    hushed;
+    float  inv_rand_max;
+};
+#define VMSISH_HUSHED     (PL_sys_intern.hushed)
+#define MY_INV_RAND_MAX   (PL_sys_intern.inv_rand_max)
+
 /* Flags for vmstrnenv() */
 #define PERL__TRNENV_SECURE 0x01
 
End of Patch.

Reply via email to