applied patch, modified logic to avoid reentering lexer at compile-time
authorGraham Barr <gbarr@pobox.com>
Fri, 19 Jun 1998 11:31:04 +0000 (06:31 -0500)
committerGurusamy Sarathy <gsar@cpan.org>
Sun, 21 Jun 1998 06:51:38 +0000 (06:51 +0000)
Message-ID: <19980619113104.S9711@asic.sc.ti.com>
Subject: Re: [PATCH perl5.004_67] Add Errno in ext/

p4raw-id: //depot/perl@1173

Configure
MANIFEST
Makefile.SH
ext/util/make_ext
gv.c
lib/English.pm

index 307f250..8dd8d9a 100755 (executable)
--- a/Configure
+++ b/Configure
@@ -147,6 +147,7 @@ dynamic_ext=''
 extensions=''
 known_extensions=''
 static_ext=''
+nonxs_ext=''
 useopcode=''
 useposix=''
 d_bsd=''
@@ -10867,6 +10868,7 @@ cd $rsrc/ext
 : If we are using the old config.sh, known_extensions may contain
 : old or inaccurate or duplicate values.
 known_extensions=''
+nonxs_extensions=''
 : We do not use find because it might not be available.
 : We do not just use MANIFEST because the user may have dropped
 : some additional extensions into the source tree and expect them
@@ -10879,17 +10881,27 @@ for xxx in * ; do
                else
                        if $test -d $xxx; then
                                cd $xxx
+                               zzz=$known_extensions
                                for yyy in * ; do
                                if $test -f $yyy/$yyy.xs; then
                                        known_extensions="$known_extensions $xxx/$yyy"
                                fi
                                done
                                cd ..
+                               if $test "$zzz" = "$known_extensions"; then
+                                       if $test -f $xxx/Makefile.PL; then
+                                               known_extensions="$known_extensions $xxx"
+                                               nonxs_extensions="$nonxs_extensions $xxx"
+                                       fi
+                               fi
                        fi
                fi 
                ;;
        esac
 done
+set X $nonxs_extensions
+shift
+nonxs_extensions="$*"
 set X $known_extensions
 shift
 known_extensions="$*"
@@ -10939,7 +10951,11 @@ for xxx in $known_extensions ; do
                true|$define|y) avail_ext="$avail_ext $xxx" ;;
                esac
                ;;
-       *)      avail_ext="$avail_ext $xxx"
+       *)
+               case " $nonxs_extensions " in
+               *" $xxx "*) ;;
+               *) avail_ext="$avail_ext $xxx" ;;
+               esac
                ;;
        esac
 done
@@ -10948,6 +10964,19 @@ set X $avail_ext
 shift
 avail_ext="$*"
 
+: Now see which nonxs extensions are supported on this system.
+nonxs_ext=''
+for xxx in $nonxs_extensions ; do
+       case "$xxx" in
+       *)      nonxs_ext="$nonxs_ext $xxx"
+               ;;
+       esac
+done
+
+set X $nonxs_ext
+shift
+nonxs_ext="$*"
+
 case $usedl in
 $define)
        $cat <<EOM
@@ -10978,6 +11007,7 @@ EOM
                esac
                ;;
        esac
+       : Exclude those that are not xs extensions
        case "$dflt" in
        '')     dflt=none;;
        esac
@@ -10993,7 +11023,7 @@ EOM
                : Exclude those already listed in dynamic linking
                dflt=''
                for xxx in $avail_ext; do
-                       case " $dynamic_ext " in
+                       case " $dynamic_ext $nonxs_ext " in
                        *" $xxx "*) ;;
                        *) dflt="$dflt $xxx" ;;
                        esac
@@ -11574,6 +11604,7 @@ path_sep='$path_sep'
 perl='$perl'
 perladmin='$perladmin'
 perlpath='$perlpath'
+nonxs_ext='$nonxs_ext'
 pg='$pg'
 phostname='$phostname'
 pidtype='$pidtype'
index 7443f5c..fa7a24b 100644 (file)
--- a/MANIFEST
+++ b/MANIFEST
@@ -189,6 +189,8 @@ ext/DynaLoader/dl_next.xs   Next implementation
 ext/DynaLoader/dl_none.xs      Stub implementation
 ext/DynaLoader/dl_vms.xs       VMS implementation
 ext/DynaLoader/dlutils.c       Dynamic loader utilities for dl_*.xs files
+ext/Errno/Errno_pm.PL          Errno perl module create script
+ext/Errno/Makefile.PL          Errno extension makefile writer
 ext/Fcntl/Fcntl.pm             Fcntl extension Perl module
 ext/Fcntl/Fcntl.xs             Fcntl extension external subroutines
 ext/Fcntl/Makefile.PL          Fcntl extension makefile writer
@@ -779,6 +781,7 @@ t/lib/dirhand.t             See if DirHandle works
 t/lib/dosglob.t                See if File::DosGlob works
 t/lib/english.t                See if English works
 t/lib/env.t            See if Env works
+t/lib/errno.t          See if Errno works
 t/lib/filecache.t      See if FileCache works
 t/lib/filecopy.t       See if File::Copy works
 t/lib/filefind.t       See if File::Find works
index 4f78f57..5150a22 100644 (file)
@@ -85,6 +85,12 @@ for f in $static_ext; do
        static_list="$static_list lib/auto/$f/$base\$(LIB_EXT)"
 done
 
+nonxs_list=' '
+for f in $nonxs_ext; do
+    base=`echo "$f" | sed 's/.*\///'`
+    nonxs_list="$nonxs_list ext/$f/pm_to_blib"
+done
+
 echo "Extracting Makefile (with variable substitutions)"
 $spitshell >Makefile <<!GROK!THIS!
 # Makefile.SH
@@ -140,7 +146,8 @@ LDLIBPTH = $ldlibpth
 
 dynamic_ext = $dynamic_list
 static_ext = $static_list
-ext = \$(dynamic_ext) \$(static_ext)
+nonxs_ext = $nonxs_list
+ext = \$(dynamic_ext) \$(static_ext) \$(nonxs_ext)
 DYNALOADER = lib/auto/DynaLoader/DynaLoader\$(LIB_EXT)
 
 libs = $libs $cryptlib
@@ -230,7 +237,7 @@ lintflags = -hbvxac
 .c$(OBJ_EXT):
        $(CCCMD) $(PLDLFLAGS) $*.c
 
-all: $(FIRSTMAKEFILE) miniperl $(private) $(plextract) $(public) $(dynamic_ext)
+all: $(FIRSTMAKEFILE) miniperl $(private) $(plextract) $(public) $(dynamic_ext) $(nonxs_ext)
        @echo " "; echo "       Everything is up to date."
 
 compile: all
@@ -454,9 +461,9 @@ regen_headers:      FORCE
        perl bytecode.pl
 
 # Extensions:
-# Names added to $(dynamic_ext) or $(static_ext) will automatically
-# get built.  There should ordinarily be no need to change any of
-# this part of makefile.
+# Names added to $(dynamic_ext) or $(static_ext) or $(nonxs_ext) will
+# automatically get built.  There should ordinarily be no need to change
+# any of this part of makefile.
 #
 # The dummy dependency is a place holder in case $(dynamic_ext) or
 # $(static_ext) is empty.
@@ -472,6 +479,9 @@ d_dummy $(dynamic_ext):     miniperl preplibrary $(DYNALOADER) FORCE
 s_dummy $(static_ext): miniperl preplibrary $(DYNALOADER) FORCE
        @$(LDLIBPTH) sh ext/util/make_ext static $@ MAKE=$(MAKE) LIBPERL_A=$(LIBPERL)
 
+n_dummy $(nonxs_ext):  miniperl preplibrary $(DYNALOADER) FORCE
+       @$(LDLIBPTH) sh ext/util/make_ext nonxs $@ MAKE=$(MAKE) LIBPERL_A=$(LIBPERL)
+
 clean:         _tidy _mopup
 
 realclean:     _cleaner _mopup
@@ -494,7 +504,7 @@ _tidy:
        -cd pod; $(MAKE) clean
        -cd utils; $(MAKE) clean
        -cd x2p; $(MAKE) clean
-       -@for x in $(DYNALOADER) $(dynamic_ext) $(static_ext) ; do \
+       -@for x in $(DYNALOADER) $(dynamic_ext) $(static_ext) $(nonxs_ext) ; do \
        sh ext/util/make_ext clean $$x MAKE=$(MAKE) ; \
        done
        rm -f testcompile compilelog
@@ -505,7 +515,7 @@ _cleaner:
        -cd pod; $(MAKE) realclean
        -cd utils; $(MAKE) realclean
        -cd x2p; $(MAKE) realclean
-       -@for x in $(DYNALOADER) $(dynamic_ext) $(static_ext) ; do \
+       -@for x in $(DYNALOADER) $(dynamic_ext) $(static_ext) $(nonxs_ext) ; do \
        sh ext/util/make_ext realclean $$x MAKE=$(MAKE) ; \
        done
        rm -f *.orig */*.orig *~ */*~ core t/core t/c t/perl
@@ -552,7 +562,7 @@ depend: makedepend
 makedepend: makedepend.SH config.sh
        sh ./makedepend.SH
 
-test-prep: miniperl perl preplibrary utilities $(dynamic_ext)
+test-prep: miniperl perl preplibrary utilities $(dynamic_ext) $(nonxs_ext)
        cd t && (rm -f perl$(EXE_EXT); $(LNS) ../perl$(EXE_EXT) perl$(EXE_EXT))
 
 test check: test-prep
index 70a5d2e..54caf7d 100644 (file)
@@ -61,6 +61,8 @@ fi
 case "$extspec" in
 lib*)  # Remove lib/auto prefix and /*.* suffix
        pname=`echo "$extspec" | sed -e 's:^lib/auto/::' -e 's:/[^/]*\.[^/]*$::' ` ;;
+ext*)  # Remove ext/ prefix and /pm_to_blib suffix
+       pname=`echo "$extspec" | sed -e 's:^ext/::' -e 's:/pm_to_blib$::' ` ;;
 *::*)  # Convert :: to /
        pname=`echo "$extspec" | sed -e 's/::/\//g' ` ;;
 *)     pname="$extspec" ;;
@@ -93,6 +95,10 @@ dynamic)    makeargs="LINKTYPE=dynamic";
            target=all
            ;;
 
+nonxs)      makeargs="";
+           target=all
+           ;;
+
 *clean) # If Makefile has been moved to Makefile.old by a make clean
            # then use Makefile.old for realclean rather than rebuild it
            if test ! -f $makefile -a -f Makefile.old; then
diff --git a/gv.c b/gv.c
index 561db93..0a36370 100644 (file)
--- a/gv.c
+++ b/gv.c
@@ -711,9 +711,9 @@ gv_fetchpv(char *nambeg, I32 add, I32 sv_type)
        goto magicalize;
 
     case '!':
-       if(len > 1)
+       if (len > 1)
            break;
-       if(sv_type > SVt_PV) {
+       if (sv_type > SVt_PV && curcop != &compiling) {
            HV* stash = gv_stashpvn("Errno",5,FALSE);
            if(!stash || !(gv_fetchmethod(stash, "TIEHASH"))) {
                dSP;
index 1cbacd1..bbb6bd7 100644 (file)
@@ -137,8 +137,8 @@ sub import {
 # Error status.
 
        *CHILD_ERROR                            = *?    ;
-       *OS_ERROR                               = \$!   ;
-           *ERRNO                              = \$!   ;
+       *OS_ERROR                               = *!    ;
+           *ERRNO                              = *!    ;
        *EXTENDED_OS_ERROR                      = *^E   ;
        *EVAL_ERROR                             = *@    ;