From: Jarkko Hietaniemi Date: Fri, 30 Jun 2000 02:18:52 +0000 (+0000) Subject: Integrate with Sarathy. X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=72503137b2e9ea029110e27e896f6f1ccd8c0e8a;p=p5sagit%2Fp5-mst-13.2.git Integrate with Sarathy. p4raw-id: //depot/cfgperl@6288 --- diff --git a/ext/Opcode/Opcode.xs b/ext/Opcode/Opcode.xs index 581cbc9..e191ec7 100644 --- a/ext/Opcode/Opcode.xs +++ b/ext/Opcode/Opcode.xs @@ -250,7 +250,7 @@ PPCODE: save_aptr(&PL_endav); PL_endav = (AV*)sv_2mortal((SV*)newAV()); /* ignore END blocks for now */ - save_hptr(&PL_defstash); /* save current default stack */ + save_hptr(&PL_defstash); /* save current default stash */ /* the assignment to global defstash changes our sense of 'main' */ PL_defstash = gv_stashpv(Package, GV_ADDWARN); /* should exist already */ save_hptr(&PL_curstash); @@ -263,6 +263,10 @@ PPCODE: sv_free((SV*)GvHV(gv)); GvHV(gv) = (HV*)SvREFCNT_inc(PL_defstash); + /* %INC must be clean for use/require in compartment */ + save_hash(PL_incgv); + GvHV(PL_incgv) = (HV*)SvREFCNT_inc(GvHV(gv_HVadd(gv_fetchpv("INC",TRUE,SVt_PVHV)))); + PUSHMARK(SP); perl_call_sv(codesv, GIMME|G_EVAL|G_KEEPERR); /* use callers context */ SPAGAIN; /* for the PUTBACK added by xsubpp */ diff --git a/lib/File/Spec.pm b/lib/File/Spec.pm index 35f099a..40503c4 100644 --- a/lib/File/Spec.pm +++ b/lib/File/Spec.pm @@ -3,7 +3,7 @@ package File::Spec; use strict; use vars qw(@ISA $VERSION); -$VERSION = 0.810_01; +$VERSION = 0.82 ; my %module = (MacOS => 'Mac', MSWin32 => 'Win32', diff --git a/lib/File/Spec/Mac.pm b/lib/File/Spec/Mac.pm index 0732327..857ca1b 100644 --- a/lib/File/Spec/Mac.pm +++ b/lib/File/Spec/Mac.pm @@ -3,6 +3,9 @@ package File::Spec::Mac; use strict; use vars qw(@ISA); require File::Spec::Unix; + +$VERSION = '1.2'; + @ISA = qw(File::Spec::Unix); =head1 NAME @@ -189,12 +192,16 @@ folder named "HD" in the current working directory on a drive named "HD"), relative wins. Use ":" in the appropriate place in the path if you want to distinguish unambiguously. +As a special case, the file name '' is always considered to be absolute. + =cut sub file_name_is_absolute { my ($self,$file) = @_; if ($file =~ /:/) { return ($file !~ m/^:/s); + } elsif ( $file eq '' ) { + return 1 ; } else { return (! -e ":$file"); } @@ -304,6 +311,12 @@ sub catpath { =item abs2rel +See L for general documentation. + +Unlike Cabs2rel()>, this function will make +checks against the local filesystem if necessary. See +L for details. + =cut sub abs2rel { @@ -341,27 +354,11 @@ sub abs2rel { =item rel2abs -Converts a relative path to an absolute path. - - $abs_path = File::Spec->rel2abs( $destination ) ; - $abs_path = File::Spec->rel2abs( $destination, $base ) ; - -If $base is not present or '', then L is used. If $base is relative, -then it is converted to absolute form using L. This means that it -is taken to be relative to L. - -On systems with the concept of a volume, this assumes that both paths -are on the $base volume, and ignores the $destination volume. - -On systems that have a grammar that indicates filenames, this ignores the -$base filename as well. Otherwise all path components are assumed to be -directories. - -If $path is absolute, it is cleaned up and returned using L. - -Based on code written by Shigio Yamaguchi. +See L for general documentation. -No checks against the filesystem are made. +Unlike Crel2abs()>, this function will make +checks against the local filesystem if necessary. See +L for details. =cut diff --git a/lib/File/Spec/Unix.pm b/lib/File/Spec/Unix.pm index 1a986eb..5d94328 100644 --- a/lib/File/Spec/Unix.pm +++ b/lib/File/Spec/Unix.pm @@ -1,6 +1,9 @@ package File::Spec::Unix; use strict; +use vars qw($VERSION); + +$VERSION = '1.2'; use Cwd; @@ -162,7 +165,12 @@ sub case_tolerant { =item file_name_is_absolute -Takes as argument a path and returns true, if it is an absolute path. +Takes as argument a path and returns true if it is an absolute path. + +This does not consult the local filesystem on Unix, Win32, or OS/2. It +does sometimes on MacOS (see L). +It does consult the working environment for VMS (see +L). =cut @@ -308,8 +316,8 @@ sub catpath { Takes a destination path and an optional base path returns a relative path from the base path to the destination path: - $rel_path = File::Spec->abs2rel( $destination ) ; - $rel_path = File::Spec->abs2rel( $destination, $base ) ; + $rel_path = File::Spec->abs2rel( $path ) ; + $rel_path = File::Spec->abs2rel( $path, $base ) ; If $base is not present or '', then L is used. If $base is relative, then it is converted to absolute form using L. This means that it @@ -325,9 +333,13 @@ directories. If $path is relative, it is converted to absolute form using L. This means that it is taken to be relative to L. -Based on code written by Shigio Yamaguchi. +No checks against the filesystem are made on most systems. On MacOS, +the filesystem may be consulted (see +L). On VMS, there is +interaction with the working environment, as logicals and +macros are expanded. -No checks against the filesystem are made. +Based on code written by Shigio Yamaguchi. =cut @@ -385,15 +397,15 @@ sub abs2rel { Converts a relative path to an absolute path. - $abs_path = File::Spec->rel2abs( $destination ) ; - $abs_path = File::Spec->rel2abs( $destination, $base ) ; + $abs_path = File::Spec->rel2abs( $path ) ; + $abs_path = File::Spec->rel2abs( $path, $base ) ; If $base is not present or '', then L is used. If $base is relative, then it is converted to absolute form using L. This means that it is taken to be relative to L. On systems with the concept of a volume, this assumes that both paths -are on the $base volume, and ignores the $destination volume. +are on the $base volume, and ignores the $path volume. On systems that have a grammar that indicates filenames, this ignores the $base filename as well. Otherwise all path components are assumed to be @@ -401,9 +413,13 @@ directories. If $path is absolute, it is cleaned up and returned using L. -Based on code written by Shigio Yamaguchi. +No checks against the filesystem are made on most systems. On MacOS, +the filesystem may be consulted (see +L). On VMS, there is +interaction with the working environment, as logicals and +macros are expanded. -No checks against the filesystem are made. +Based on code written by Shigio Yamaguchi. =cut diff --git a/lib/File/Spec/Win32.pm b/lib/File/Spec/Win32.pm index bd21914..1c2b44f 100644 --- a/lib/File/Spec/Win32.pm +++ b/lib/File/Spec/Win32.pm @@ -4,6 +4,9 @@ use strict; use Cwd; use vars qw(@ISA); require File::Spec::Unix; + +$VERSION = '1.2'; + @ISA = qw(File::Spec::Unix); =head1 NAME @@ -240,34 +243,6 @@ sub catpath { } -=item abs2rel - -Takes a destination path and an optional base path returns a relative path -from the base path to the destination path: - - $rel_path = File::Spec->abs2rel( $destination ) ; - $rel_path = File::Spec->abs2rel( $destination, $base ) ; - -If $base is not present or '', then L is used. If $base is relative, -then it is converted to absolute form using L. This means that it -is taken to be relative to L. - -On systems with the concept of a volume, this assumes that both paths -are on the $destination volume, and ignores the $base volume. - -On systems that have a grammar that indicates filenames, this ignores the -$base filename as well. Otherwise all path components are assumed to be -directories. - -If $path is relative, it is converted to absolute form using L. -This means that it is taken to be relative to L. - -Based on code written by Shigio Yamaguchi. - -No checks against the filesystem are made. - -=cut - sub abs2rel { my($self,$path,$base) = @_; @@ -337,31 +312,6 @@ sub abs2rel { ) ; } -=item rel2abs - -Converts a relative path to an absolute path. - - $abs_path = File::Spec->rel2abs( $destination ) ; - $abs_path = File::Spec->rel2abs( $destination, $base ) ; - -If $base is not present or '', then L is used. If $base is relative, -then it is converted to absolute form using L. This means that it -is taken to be relative to L. - -Assumes that both paths are on the $base volume, and ignores the -$destination volume. - -On systems that have a grammar that indicates filenames, this ignores the -$base filename as well. Otherwise all path components are assumed to be -directories. - -If $path is absolute, it is cleaned up and returned using L. - -Based on code written by Shigio Yamaguchi. - -No checks against the filesystem are made. - -=cut sub rel2abs($$;$;) { my ($self,$path,$base ) = @_; diff --git a/pod/perlembed.pod b/pod/perlembed.pod index c4df676..dce785e 100644 --- a/pod/perlembed.pod +++ b/pod/perlembed.pod @@ -894,21 +894,14 @@ That's where the glue code can be inserted to create the initial contact between Perl and linked C/C++ routines. Let's take a look some pieces of I to see how Perl does this: + static void xs_init (pTHX); - #ifdef __cplusplus - # define EXTERN_C extern "C" - #else - # define EXTERN_C extern - #endif - - static void xs_init (void); - - EXTERN_C void boot_DynaLoader (CV* cv); - EXTERN_C void boot_Socket (CV* cv); + EXTERN_C void boot_DynaLoader (pTHX_ CV* cv); + EXTERN_C void boot_Socket (pTHX_ CV* cv); EXTERN_C void - xs_init() + xs_init(pTHX) { char *file = __FILE__; /* DynaLoader is a special case */ @@ -955,21 +948,13 @@ B can also automate writing the I glue code. Consult L, L, and L for more details. -=head1 Embedding Perl under Win32 - -At the time of this writing (5.004), there are two versions of Perl -which run under Win32. (The two versions are merging in 5.005.) -Interfacing to ActiveState's Perl library is quite different from the -examples in this documentation, as significant changes were made to -the internal Perl API. However, it is possible to embed ActiveState's -Perl runtime. For details, see the Perl for Win32 FAQ at -http://www.perl.com/CPAN/doc/FAQs/win32/perlwin32faq.html. +=head1 Embedding Perl under Windows -With the "official" Perl version 5.004 or higher, all the examples -within this documentation will compile and run untouched, although -the build process is slightly different between Unix and Win32. +In general, all of the source code shown here should work unmodified under +Windows. -For starters, backticks don't work under the Win32 native command shell. +However, there are some caveats about the command-line examples shown. +For starters, backticks won't work under the Win32 native command shell. The ExtUtils::Embed kit on CPAN ships with a script called B, which generates a simple makefile to build a program from a single C source file. It can be used like this: