From 9cfe5470b44e33f00045a3b9c3128c6ade6e813f Mon Sep 17 00:00:00 2001 From: Rafael Garcia-Suarez Date: Fri, 29 Nov 2002 12:11:28 +0000 Subject: [PATCH] Document the hint constants and where they're used. p4raw-id: //depot/perl@18217 --- ext/re/re.pm | 4 ++-- lib/File/Basename.pm | 2 +- lib/charnames.pm | 2 +- lib/filetest.pm | 2 +- lib/open.pm | 2 +- lib/overload.pm | 12 ++++++------ lib/vmsish.pm | 2 ++ perl.h | 23 +++++++++++++---------- 8 files changed, 27 insertions(+), 22 deletions(-) diff --git a/ext/re/re.pm b/ext/re/re.pm index 95e2540..6720a7b 100644 --- a/ext/re/re.pm +++ b/ext/re/re.pm @@ -77,8 +77,8 @@ See L. # N.B. File::Basename contains a literal for 'taint' as a fallback. If # taint is changed here, File::Basename must be updated as well. my %bitmask = ( -taint => 0x00100000, -eval => 0x00200000, +taint => 0x00100000, # HINT_RE_TAINT +eval => 0x00200000, # HINT_RE_EVAL ); sub setcolor { diff --git a/lib/File/Basename.pm b/lib/File/Basename.pm index 1c9a419..ed59e9a 100644 --- a/lib/File/Basename.pm +++ b/lib/File/Basename.pm @@ -130,7 +130,7 @@ directory name to be F<.>). # not be available. BEGIN { unless (eval { require re; }) - { eval ' sub re::import { $^H |= 0x00100000; } ' } + { eval ' sub re::import { $^H |= 0x00100000; } ' } # HINT_RE_TAINT import re 'taint'; } diff --git a/lib/charnames.pm b/lib/charnames.pm index c9a8ea5..7b39cee 100644 --- a/lib/charnames.pm +++ b/lib/charnames.pm @@ -6,7 +6,7 @@ use File::Spec; our $VERSION = '1.02'; use bytes (); # for $bytes::hint_bits -$charnames::hint_bits = 0x20000; +$charnames::hint_bits = 0x20000; # HINT_LOCALIZE_HH my %alias1 = ( # Icky 3.2 names with parentheses. diff --git a/lib/filetest.pm b/lib/filetest.pm index 7eb58a6..8aa4a77 100644 --- a/lib/filetest.pm +++ b/lib/filetest.pm @@ -50,7 +50,7 @@ operators is a filename, not when it is a filehandle. =cut -$filetest::hint_bits = 0x00400000; +$filetest::hint_bits = 0x00400000; # HINT_FILETEST_ACCESS sub import { if ( $_[1] eq 'access' ) { diff --git a/lib/open.pm b/lib/open.pm index 007b667..d771fcb 100644 --- a/lib/open.pm +++ b/lib/open.pm @@ -1,7 +1,7 @@ package open; use warnings; use Carp; -$open::hint_bits = 0x20000; +$open::hint_bits = 0x20000; # HINT_LOCALIZE_HH our $VERSION = '1.01'; diff --git a/lib/overload.pm b/lib/overload.pm index 99af00f..81c8598 100644 --- a/lib/overload.pm +++ b/lib/overload.pm @@ -2,7 +2,7 @@ package overload; our $VERSION = '1.00'; -$overload::hint_bits = 0x20000; +$overload::hint_bits = 0x20000; # HINT_LOCALIZE_HH sub nil {} @@ -108,11 +108,11 @@ sub mycan { # Real can would leave stubs. } %constants = ( - 'integer' => 0x1000, - 'float' => 0x2000, - 'binary' => 0x4000, - 'q' => 0x8000, - 'qr' => 0x10000, + 'integer' => 0x1000, # HINT_NEW_INTEGER + 'float' => 0x2000, # HINT_NEW_FLOAT + 'binary' => 0x4000, # HINT_NEW_BINARY + 'q' => 0x8000, # HINT_NEW_STRING + 'qr' => 0x10000, # HINT_NEW_RE ); %ops = ( with_assign => "+ - * / % ** << >> x .", diff --git a/lib/vmsish.pm b/lib/vmsish.pm index c2d97c1..82b52ab 100644 --- a/lib/vmsish.pm +++ b/lib/vmsish.pm @@ -117,6 +117,8 @@ sub bits { my $bits = 0; my $sememe; foreach $sememe (@_) { + # Those hints are defined in vms/vmsish.h : + # HINT_M_VMSISH_STATUS and HINT_M_VMSISH_TIME $bits |= 0x40000000, next if $sememe eq 'status' || $sememe eq '$?'; $bits |= 0x80000000, next if $sememe eq 'time'; } diff --git a/perl.h b/perl.h index 4436d1a..bb2dc39 100644 --- a/perl.h +++ b/perl.h @@ -3210,17 +3210,19 @@ enum { /* pass one of these to get_vtbl */ /* Note: the lowest 8 bits are reserved for stuffing into op->op_private */ #define HINT_PRIVATE_MASK 0x000000ff -#define HINT_INTEGER 0x00000001 -#define HINT_STRICT_REFS 0x00000002 -#define HINT_LOCALE 0x00000004 -#define HINT_BYTES 0x00000008 +#define HINT_INTEGER 0x00000001 /* integer pragma */ +#define HINT_STRICT_REFS 0x00000002 /* strict pragma */ +#define HINT_LOCALE 0x00000004 /* locale pragma */ +#define HINT_BYTES 0x00000008 /* bytes pragma */ /* #define HINT_notused10 0x00000010 */ /* Note: 20,40,80 used for NATIVE_HINTS */ + /* currently defined by vms/vmsish.h */ #define HINT_BLOCK_SCOPE 0x00000100 -#define HINT_STRICT_SUBS 0x00000200 -#define HINT_STRICT_VARS 0x00000400 +#define HINT_STRICT_SUBS 0x00000200 /* strict pragma */ +#define HINT_STRICT_VARS 0x00000400 /* strict pragma */ +/* The HINT_NEW_* constants are used by the overload pragma */ #define HINT_NEW_INTEGER 0x00001000 #define HINT_NEW_FLOAT 0x00002000 #define HINT_NEW_BINARY 0x00004000 @@ -3228,12 +3230,13 @@ enum { /* pass one of these to get_vtbl */ #define HINT_NEW_RE 0x00010000 #define HINT_LOCALIZE_HH 0x00020000 /* %^H needs to be copied */ -#define HINT_RE_TAINT 0x00100000 -#define HINT_RE_EVAL 0x00200000 +#define HINT_RE_TAINT 0x00100000 /* re pragma */ +#define HINT_RE_EVAL 0x00200000 /* re pragma */ -#define HINT_FILETEST_ACCESS 0x00400000 -#define HINT_UTF8 0x00800000 +#define HINT_FILETEST_ACCESS 0x00400000 /* filetest pragma */ +#define HINT_UTF8 0x00800000 /* utf8 pragma */ +/* The following are stored in $sort::hints, not in PL_hints */ #define HINT_SORT_SORT_BITS 0x000000FF /* allow 256 different ones */ #define HINT_SORT_QUICKSORT 0x00000001 #define HINT_SORT_MERGESORT 0x00000002 -- 1.8.3.1