Integrate changes #9511,9514,9517 from maintperl into mainline.
authorJarkko Hietaniemi <jhi@iki.fi>
Mon, 2 Apr 2001 22:22:34 +0000 (22:22 +0000)
committerJarkko Hietaniemi <jhi@iki.fi>
Mon, 2 Apr 2001 22:22:34 +0000 (22:22 +0000)
README.win32 tweaks; add a note about alternative location for
getting a gcc-2.95.2 that will build perl properly on windows

add some notes about gutsy threading matters

many of the utilities interpolate literal paths within doublequotes
(fails on dosish platforms where path contains backslashes)

p4raw-link: @9517 on //depot/maint-5.6/perl: 541b948d383abe4f534f846ff692d582506919cf
p4raw-link: @9514 on //depot/maint-5.6/perl: c8c8f510c2814a9e3cbdb8e7ca306018e0f7c510
p4raw-link: @9511 on //depot/maint-5.6/perl: 58a9db026b6f67b774654d285ac34aceada86380

p4raw-id: //depot/perl@9518
p4raw-integrated: from //depot/maint-5.6/perl@9510 'copy in'
utils/perldoc.PL x2p/find2perl.PL (@9312..) 'merge in'
README.win32 (@9227..) x2p/s2p.PL (@9312..) pod/perlguts.pod
(@9507..)

README.win32
pod/perlguts.pod
utils/perldoc.PL
x2p/find2perl.PL
x2p/s2p.PL

index 7d5ebd0..195170d 100644 (file)
@@ -79,14 +79,14 @@ Fetch and install dmake somewhere on your path (follow the instructions
 in the README.NOW file).
 
 There exists a minor coexistence problem with dmake and Borland C++
-compilers. Namely, if a distribution have C files named with a mixed
+compilers.  Namely, if a distribution has C files named with mixed
 case letters, they will be compiled into appropriate .obj-files named
-with all lowercase letters, and every time when dmake will be invoked
+with all lowercase letters, and every time dmake is invoked
 to bring files up to date, it will try to recompile such files again.
-For example, Tk distribution have a lot of such files, resulting in
-multiple recompiling everytime dmake is invoked. To avoid this, you
-may use the script "sncfnmcs.pl" after successful build.  It is
-available in the win32 subdirectory.
+For example, Tk distribution has a lot of such files, resulting in
+needless recompiles everytime dmake is invoked.  To avoid this, you
+may use the script "sncfnmcs.pl" after successful build.  It is
+available in the win32 subdirectory of the Perl source distribution.
 
 =item Command Shell
 
@@ -131,17 +131,41 @@ GCC-2.95.2 binaries can be downloaded from:
 
     ftp://ftp.xraylith.wisc.edu/pub/khan/gnu-win32/mingw32/
 
+You also need dmake.  See L</"Make"> above on how to get it.
+
 The GCC-2.95.2 bundle comes with Mingw32 libraries and headers.
 
 Make sure you install the binaries that work with MSVCRT.DLL as indicated
 in the README for the GCC bundle.  You may need to set up a few environment
 variables (usually ran from a batch file).
 
-The version of gcc-2.95.2-msvcrt.exe released 7 November 1999 left out
-a fix for certain command line quotes, so be sure to download and install
-fixes/quote-fix-msvcrt.exe too.
+There are a couple of problems with the version of gcc-2.95.2-msvcrt.exe
+released 7 November 1999:
 
-You also need dmake.  See L</"Make"> above on how to get it.
+=over
+
+=item *
+
+It left out a fix for certain command line quotes.  To fix this, be sure
+to download and install the file fixes/quote-fix-msvcrt.exe from the above
+ftp location.
+
+=item *
+
+The definition of the fpos_t type in stdio.h may be wrong.  If your
+stdio.h has this problem, you will see an exception when running the
+test t/lib/io_xs.t.  To fix this, change the typedef for fpos_t from
+"long" to "long long" in the file i386-mingw32msvc/include/stdio.h,
+and rebuild.
+
+=back
+
+A potentially simpler to install (but probably soon-to-be-outdated) bundle
+of the above package with the mentioned fixes already applied is available
+here:
+
+    http://downloads.ActiveState.com/pub/staff/gsar/gcc-2.95.2-msvcrt.zip
+    ftp://ftp.ActiveState.com/pub/staff/gsar/gcc-2.95.2-msvcrt.zip
 
 =back
 
@@ -224,13 +248,13 @@ default path.  You will need to copy the DLLs reported by the messages
 from where Borland chose to install it, into the Windows system directory
 (usually somewhere like C:\WINNT\SYSTEM32) and rerun the test.
 
-If you're using Borland compiler versions 5.2 and below, you're risking
-to face a problem with finding incorrect header files. Don't be surprised
-when during compiling perl extension "Tk" you will fail because both perl
-and tk contain a header file with same name - "patchlevel.h".  The latest
-Borland compilers are free of this misbehaviour, and they even invented
-option -VI- for backward (bugward) compatibility as "Use old Borland
-search algorithm  to locate header files".
+If you're using Borland compiler versions 5.2 and below, you may run into
+problems finding the correct header files when building extensions.  For
+example, building the "Tk" extension may fail because both perl and Tk
+contain a header file called "patchlevel.h".  The latest Borland compiler
+(v5.5) is free of this misbehaviour, and it even supports an
+option -VI- for backward (bugward) compatibility for using the old Borland
+search algorithm  to locate header files.
 
 Please report any other failures as described under L<BUGS AND CAVEATS>.
 
@@ -687,6 +711,6 @@ Support for fork() emulation was added in 5.6 (ActiveState Tool Corp).
 
 Win9x support was added in 5.6 (Benjamin Stuhl).
 
-Last updated: 22 November 2000
+Last updated: 1 April 2001
 
 =cut
index e18abba..dad868a 100644 (file)
@@ -1664,8 +1664,8 @@ interpreter.
 Three macros control the major Perl build flavors: MULTIPLICITY,
 USE_THREADS and PERL_OBJECT.  The MULTIPLICITY build has a C structure
 that packages all the interpreter state, there is a similar thread-specific
-data structure under USE_THREADS, and the PERL_OBJECT build has a C++
-class to maintain interpreter state.  In all three cases,
+data structure under USE_THREADS, and the (now deprecated) PERL_OBJECT
+build has a C++ class to maintain interpreter state.  In all three cases,
 PERL_IMPLICIT_CONTEXT is also normally defined, and enables the
 support for passing in a "hidden" first argument that represents all three
 data structures.
@@ -1708,10 +1708,11 @@ C<pTHX_> is one of a number of macros (in perl.h) that hide the
 details of the interpreter's context.  THX stands for "thread", "this",
 or "thingy", as the case may be.  (And no, George Lucas is not involved. :-)
 The first character could be 'p' for a B<p>rototype, 'a' for B<a>rgument,
-or 'd' for B<d>eclaration.
+or 'd' for B<d>eclaration, so we have C<pTHX>, C<aTHX> and C<dTHX>, and
+their variants.
 
-When Perl is built without PERL_IMPLICIT_CONTEXT, there is no first
-argument containing the interpreter's context.  The trailing underscore
+When Perl is built without options that set PERL_IMPLICIT_CONTEXT, there is no
+first argument containing the interpreter's context.  The trailing underscore
 in the pTHX_ macro indicates that the macro expansion needs a comma
 after the context argument because other arguments follow it.  If
 PERL_IMPLICIT_CONTEXT is not defined, pTHX_ will be ignored, and the
@@ -1720,7 +1721,7 @@ macro without the trailing underscore is used when there are no additional
 explicit arguments.
 
 When a core function calls another, it must pass the context.  This
-is normally hidden via macros.  Consider C<sv_setsv>.  It expands
+is normally hidden via macros.  Consider C<sv_setsv>.  It expands into
 something like this:
 
     ifdef PERL_IMPLICIT_CONTEXT
@@ -1747,8 +1748,8 @@ Under PERL_OBJECT in the core, that will translate to either:
                                        # see objXSUB.h
 
 Under PERL_OBJECT in extensions (aka PERL_CAPI), or under
-MULTIPLICITY/USE_THREADS w/ PERL_IMPLICIT_CONTEXT in both core
-and extensions, it will be:
+MULTIPLICITY/USE_THREADS with PERL_IMPLICIT_CONTEXT in both core
+and extensions, it will become:
 
     Perl_sv_setsv(aTHX_ foo, bar);     # the canonical Perl "API"
                                        # for all build flavors
@@ -1770,6 +1771,14 @@ You can ignore [pad]THX[xo] when browsing the Perl headers/sources.
 Those are strictly for use within the core.  Extensions and embedders
 need only be aware of [pad]THX.
 
+=head2 So what happened to dTHR?
+
+C<dTHR> was introduced in perl 5.005 to support the older thread model.
+The older thread model now uses the C<THX> mechanism to pass context
+pointers around, so C<dTHR> is not useful any more.  Perl 5.6.0 and
+later still have it for backward source compatibility, but it is defined
+to be a no-op.
+
 =head2 How do I use all this in extensions?
 
 When Perl is built with PERL_IMPLICIT_CONTEXT, extensions that call
@@ -1877,15 +1886,34 @@ Never add a comma after C<pTHX> yourself--always use the form of the
 macro with the underscore for functions that take explicit arguments,
 or the form without the argument for functions with no explicit arguments.
 
+=head2 Should I do anything special if I call perl from multiple threads?
+
+If you create interpreters in one thread and then proceed to call them in
+another, you need to make sure perl's own Thread Local Storage (TLS) slot is
+initialized correctly in each of those threads.
+
+The C<perl_alloc> and C<perl_clone> API functions will automatically set
+the TLS slot to the interpreter they created, so that there is no need to do
+anything special if the interpreter is always accessed in the same thread that
+created it, and that thread did not create or call any other interpreters
+afterwards.  If that is not the case, you have to set the TLS slot of the
+thread before calling any functions in the Perl API on that particular
+interpreter.  This is done by calling the C<PERL_SET_CONTEXT> macro in that
+thread as the first thing you do:
+
+       /* do this before doing anything else with some_perl */
+       PERL_SET_CONTEXT(some_perl);
+
+       ... other Perl API calls on some_perl go here ...
+
 =head2 Future Plans and PERL_IMPLICIT_SYS
 
 Just as PERL_IMPLICIT_CONTEXT provides a way to bundle up everything
 that the interpreter knows about itself and pass it around, so too are
 there plans to allow the interpreter to bundle up everything it knows
 about the environment it's running on.  This is enabled with the
-PERL_IMPLICIT_SYS macro.  Currently it only works with PERL_OBJECT,
-but is mostly there for MULTIPLICITY and USE_THREADS (see inside
-iperlsys.h).
+PERL_IMPLICIT_SYS macro.  Currently it only works with PERL_OBJECT
+and USE_THREADS on Windows (see inside iperlsys.h).
 
 This allows the ability to provide an extra pointer (called the "host"
 environment) for all the system calls.  This makes it possible for
@@ -1945,7 +1973,8 @@ Other available flags are:
 
 =item s
 
-This is a static function and is defined as C<S_whatever>.
+This is a static function and is defined as C<S_whatever>, and usually
+called within the sources as C<whatever(...)>.
 
 =item n
 
@@ -1963,7 +1992,7 @@ The argument list should end with C<...>, like this:
 
     Afprd   |void   |croak          |const char* pat|...
 
-=item m
+=item M
 
 This function is part of the experimental development API, and may change 
 or disappear without notice.
index aa61a97..8bd6577 100644 (file)
@@ -37,7 +37,7 @@ use strict;
 INIT { eval { umask(0077) } }   # doubtless someone has no mask
 
 my \@pagers = ();
-push \@pagers, "$Config{'pager'}" if -x "$Config{'pager'}";
+push \@pagers, q[$Config{'pager'}] if -x q[$Config{'pager'}];
 my \$bindir = '$Config{scriptdir}';
 
 !GROK!THIS!
index 4d74d06..b89f01e 100644 (file)
@@ -29,7 +29,7 @@ print OUT <<"!GROK!THIS!";
 $Config{startperl}
     eval 'exec $Config{perlpath} -S \$0 \${1+"\$@"}'
       if \$running_under_some_shell;
-my \$perlpath = "$Config{perlpath}";
+my \$perlpath = '$Config{perlpath}';
 !GROK!THIS!
 
 # In the following, perl variables are not expanded during extraction.
@@ -334,10 +334,8 @@ END
 if (exists $init{doexec}) {
     print <<'END';
 
-BEGIN {
-    require Cwd;
-    my $cwd = Cwd::cwd();
-}
+use Cwd ();
+my $cwd = Cwd::cwd();
 
 sub doexec {
     my $ok = shift;
index 21a5ee8..6d9f8ee 100644 (file)
@@ -29,8 +29,8 @@ print OUT <<"!GROK!THIS!";
 $Config{startperl}
     eval 'exec $Config{perlpath} -S \$0 \${1+"\$@"}'
        if \$running_under_some_shell;
-my \$startperl = "$Config{startperl}";
-my \$perlpath  = "$Config{perlpath}";
+my \$startperl = '$Config{startperl}';
+my \$perlpath = '$Config{perlpath}';
 !GROK!THIS!
 
 # In the following, perl variables are not expanded during extraction.