Index: gnu/usr.bin/perl/AUTHORS =================================================================== RCS file: /mnt/memory/perl/importit/cvs/src/gnu/usr.bin/perl/AUTHORS,v retrieving revision 1.1.1.13 diff -u -p -u -p -r1.1.1.13 AUTHORS --- gnu/usr.bin/perl/AUTHORS 24 Mar 2014 14:58:42 -0000 1.1.1.13 +++ gnu/usr.bin/perl/AUTHORS 16 Nov 2014 03:22:23 -0000 @@ -18,11 +18,12 @@ A. Sinan Unur Aaron Crane Aaron B. Dossett Aaron J. Mackey -Aaron Trevena -Augustina Blair +Aaron Trevena +Augustina Blair Abe Timmerman Abhijit Menon-Sen Abigail +Abir Viqar Achim Bohnet Adam Flott Adam Kennedy @@ -37,8 +38,9 @@ Alan Burlison Alan Grover Alan Grow -Alan Haggai Alavi +Alan Haggai Alavi Alan Harder +Alan Hourihane Alan Modra Alan Ferrency Alastair Douglas @@ -46,8 +48,10 @@ Albert Chin-A-Young Alberto Simões Alessandro Forghieri +Alexandre (Midnite) Jousset Alexander Alekseev Alexander Hartmaier +Alexander Voronov Alexei Alexandrov Alex Davies Alex Gough @@ -81,6 +85,7 @@ Andrew Bettison Andrew Burt Andrew Cohen andrew deryabin +Andrew Fresh Andrew Hamm Andrew M. Langmead Andrew Pimlott @@ -100,14 +105,14 @@ Anton Berezin Anton Nikishaev Anton Tagunov Archer Sully -Aristotle Pagaltzis +Aristotle Pagaltzis Arjen Laarhoven -Arkturuz +Arkturuz Arne Ahrend Arnold D. Robbins Art Green Art Haas -Arthur Axel 'fREW' Schmidt +Arthur Axel 'fREW' Schmidt Artiom Morozov Artur Bergman Arvan @@ -137,6 +142,7 @@ Bill Glicker Billy Constantine Blair Zajac Brandon Black +Brian Childs Bo Borgerson Bo Johansson Bo Lindbergh @@ -153,6 +159,7 @@ Brad Hughes Brad Lanam Bradley Dean Bram +Brendan Byrd Brendan O'Dea Brent B. Powers Breno G. de Oliveira @@ -163,13 +170,14 @@ Brian Carlson brian d foy Brian Fraser +Brian Gottreu Brian Greenfield Brian Grossman Brian Harrison Brian Jepson Brian Katzung Brian McCauley -Brian Phillips +Brian Phillips Brian Reichert Brian S. Cashman Brian Strand @@ -183,7 +191,7 @@ Calle Dybedahl Campo Weijerman Carl Eklof Carl M. Fongheiser -Carl Hayter +Carl Hayter Carl Witty Cary D. Renzema Casey R. Tweten @@ -218,6 +226,7 @@ Chris Williams Christian Burger Christian Hansen Christian Kirsch +Christian Millour Christian Winter Christoph Lamprecht Christophe Grosjean @@ -242,6 +251,7 @@ Craig DeForest Curtis Poe Curtis Jewell +Dabrien 'Dabe' Murphy Dagfinn Ilmari Mannsåker Dale Amon Damian Conway @@ -312,12 +322,13 @@ David Nicol David R. Favor David Sparks David Starks-Browning +David Steinbrunner David Sundstrom David M. Syzdek David Wheeler Davin Milun Dean Roehrich -Dee Newcum +Dee Newcum deekoo Dennis Kaarsemaker Dennis Marsa @@ -343,6 +354,7 @@ Drew Stephens Duncan Findlay E. Choroba +Ed Avis Ed Mooring Ed Santiago Eddy Tan @@ -367,9 +379,10 @@ Eryq Etienne Grossman Eugene Alterman Evan Miller +Evan Zacks Fabien Tassin Father Chrysostomos -Felipe Gasper +Felipe Gasper Felix Gallo Fergal Daly Fingle Nark @@ -380,7 +393,7 @@ Frank Crawford Frank Ridderbusch Frank Tobin Frank Wiegand -Franklin Chen +Franklin Chen Franz Fasching François Désarménien Frederic Briere @@ -393,6 +406,7 @@ Garry T. Williams Gary Clark Gary L. Armstrong Gary Ng <71564.1743@compuserve.com> +Gavin Shelley Gene Sullivan Geoffrey T. Dairiki Geoffrey F. Green @@ -404,10 +418,11 @@ Gerard Goossen Gerben Wierda Gerd Knops Gerrit P. Haase +Gideon Israel Dsouza Giles Lean Gisle Aas Glenn Linderman -Gordon Lack +Gordon Lack Gordon J. Miller Goro Fuji Grace Lee @@ -432,6 +447,7 @@ Gurusamy Sarathy Gustaf Neumann Guy Decoux Gwyn Judd +Heiko Eissfeldt H.J. Lu H.Merijn Brand Hal Morris @@ -447,11 +463,14 @@ Harmen Harmon S. Nine Harri Pasanen Harry Edmon +Hauke D Helmut Jarausch Henrik Tougaard Herbert Breunung Hernan Perez Masci Hershel Walters +Hio +Hiroo Hayashi Hojung Youn Holger Bechtold Hongwen Qiu @@ -532,7 +551,7 @@ Jeremy Madea Jerome Abela Jerrad Pierce Jerry D. Hedden -Jess Robinson +Jess Robinson Jesse Glick Jesse Luehrs Jesse Vincent @@ -568,6 +587,7 @@ John Bley John Borwick John Cerney John D Groenveld +John Gardiner Myers John Goodyear John Hasstedt John Hawkinson @@ -579,7 +599,7 @@ John L. Allen John Macdonald John Malmberg John Nolan -John P. Linderman +John P. Linderman John Peacock John Pfuntner John Poltorak @@ -623,17 +643,20 @@ John E. Malmberg Jörg Walter José Pedro Oliveira Ka-Ping Yee +kafka +Kang-min Liu Kaoru Maeda Karen Etheridge Karl Glazebrook Karl Heuer Karl Simon Berg -Karl Williamson +Karl Williamson Karsten Sperling Karthik Rajagopalan Kaveh Ghazi Kay Röpke KAWAI Takanori +Keedi Kim Keith Neufeld Keith Thompson Ken Estes @@ -650,6 +673,8 @@ Kent Fredric Keong Lim Kevin Brintnall Kevin Chase +kevin dawson +Kevin Falcone Kevin J. Woolley Kevin O'Gorman Kevin Ruscoe @@ -688,7 +713,7 @@ Lionel Cons Louis Strous Luc St-Louis Luca Fini -Lucas Holt +Lucas Holt Lukas Mai Luke Closs Luke Ross @@ -700,10 +725,12 @@ Major Sébastien Malcolm Beattie Manuel Valente -Marc Green +Marc Green Marc Lehmann Marc Paquette +Marc Simpson Marcel Grünauer +Marco Peereboom Marcus Holland-Moritz Markus Jansen Marek Rouchal @@ -743,6 +770,7 @@ Martin Husemann Martin J. Bligh Martin Jost Martin Lichtin +Martin McGrath Martin Plechsmid Martin Pool Martti Rahkila @@ -777,6 +805,7 @@ Max Maischein Merijn Broeren Michael A Chase Michael Breen +Michael Bunk Michael Carman Michael Cook Michael Cummings @@ -789,13 +818,14 @@ Michael H. Moran Michael King Michael Lemke Michael Mahan -Michael Parker +Michael Parker Michael Schroeder Michael Somos Michael Stevens Michael Witten Michele Sardo Mik Firestone +Mike Doherty Mike Fletcher Mike Giroux Mike Guy @@ -814,24 +844,28 @@ Milosz Tanski Milton L. Hankins Moritz Lenz Moshe Kaminsky -Mottaqui Karim taqqui.karim@gmail.com +Mottaqui Karim Mr. Nobody Murray Nesbitt +Nathan Glenn Nathan Kurz Nathan Torkington +Nathan Trapuzzano Neale Ferguson Neil Bowers Neil Watkiss +Neil Williams Nicholas Clark Nicholas Oxhøj Nicholas Perez -Nick Cleaton +Nick Cleaton Nick Duffek Nick Gianniotis Nick Ing-Simmons -Nick Johnston +Nick Johnston Nick Williams Nicolas Kaiser +Niels Thykier Nigel Sandever Niko Tyni Nikola Knezevic @@ -851,8 +885,10 @@ Oleg Nesterov Olivier Blin Olli Savia Ollivier Robert +Olivier Mengué Olivier Thauvin Osvaldo Villalon +Owain G. Ainsworth Owen Taylor parv Papp Zoltan @@ -861,7 +897,7 @@ Patrick Donelan Patrick Dugnolle Patrick Hayes Patrick O'Brien -Patrik Hägglund +Patrik Hägglund Pau Amma Paul A Sand Paul Boven @@ -885,7 +921,7 @@ Pavel Kaňkovský Pavel Zakouril Pedro Felipe Horrillo Guerra Per Einar Ellefsen -Perlover +Perlover Peter BARABAS Pete Peterson Peter Chines @@ -897,18 +933,21 @@ Peter J. Farley III Peter Jaspers-Fayer Peter John Acklam -Peter Martini +Peter Martini Peter O'Gorman Peter Prymmer -Peter Rabbitson +Peter Rabbitson Peter Scott Peter Valdemar Mørch Peter van Heusden Peter Wolfe -Peter E. Yee +Peter E. Yee +Petr Písař Petter Reinholdtsen Phil Lobbes Phil Monsen +Philip Boulain +Philip Guenther Philip Hazel Philip M. Gollucci Philip Newton @@ -918,6 +957,7 @@ Piers Cawley Pino Toscano Piotr Fusik Piotr Klaban +Piotr Roszatycki Pradeep Hodigere Prymmer/Kahn Quentin Fennessy @@ -990,6 +1030,7 @@ Ruslan Zakirov Russ Allbery Russell Fulton Russell Mosemann +Russel O'Connor Ryan Herbert Salvador Fandiño Salvador Ortiz Garcia @@ -998,7 +1039,7 @@ Sam Tregar Sam Vilain Samuel Thibault Samuli Kärkkäinen -Sawyer X +Sawyer X Schuyler Erle Scott A Crosby Scott Bronson @@ -1019,7 +1060,7 @@ Sebastien Barre Sebastian Steinlechner Sérgio Durigan Júnior -Sergey Alekseev +Sergey Alekseev Shawn Shawn M Moore Sherm Pendley @@ -1034,7 +1075,7 @@ Simon Glover Simon Leinen Simon Parsons Simon Schubert -Sinan Unur +Sinan Unur Sisyphus Slaven Rezic Smylers @@ -1075,7 +1116,7 @@ Steven N. Hirsch Steven Schubiger Stian Seeberg -Sullivan Beck +Sullivan Beck Sven Strickroth Sven Verdoolaege SynaptiCAD, Inc. @@ -1109,11 +1150,13 @@ Tim Witham Timothe Litt Timur I. Bakeyev Tkil -Tobias Leich +Tobias Leich +Toby Inkster Todd C. Miller -Todd Rinaldo +Todd Rinaldo Todd T. Fries Todd Vierling +Tokuhiro Matsuno Tom Bates Tom Brown Tom Dinger @@ -1143,15 +1186,19 @@ Ulrich Pfeifer Vadim Konovalov Valeriy E. Ushakov Vernon Lyon +Victor Efimov +Viktor Turskyi Ville Skyttä Vincent Pit Vishal Bhatia Vlad Harchev Vladimir Alexiev +Vladimir Marek Vladimir Timofeev Volker Schatz W. Geoffrey Rommel W. Phillip Moore +Wallace Reis Walt Mankowski Walter Briscoe Warren Hyde @@ -1182,6 +1229,6 @@ Yuval Kogman Zachary Miller Zefram -Zsbán Ambrus +Zsbán Ambrus Zbynek Vyskovsky Ævar Arnfjörð Bjarmason Index: gnu/usr.bin/perl/Configure =================================================================== RCS file: /mnt/memory/perl/importit/cvs/src/gnu/usr.bin/perl/Configure,v retrieving revision 1.28 diff -u -p -u -p -r1.28 Configure --- gnu/usr.bin/perl/Configure 26 Mar 2014 16:36:32 -0000 1.28 +++ gnu/usr.bin/perl/Configure 16 Nov 2014 03:22:23 -0000 @@ -28,7 +28,7 @@ # See Porting/pumpkin.pod for more information on metaconfig. # -# Generated on Wed May 8 15:28:09 CEST 2013 [metaconfig 3.5 PL0] +# Generated on Wed Jun 4 08:58:13 CEST 2014 [metaconfig 3.5 PL0] # (with additional metaconfig patches by perlbug@perl.org) cat >c1$$ <&1 >/dev/null ; then +if test -d c:/. || ( uname -a | grep -i 'os\(/\|\)2' 2>&1 ) 2>&1 >/dev/null ; then if test -n "$OS2_SHELL"; then p_=\; PATH=`cmd /c "echo %PATH%" | tr '\\\\' / ` @@ -99,7 +99,7 @@ if test -d c:/. || ( uname -a | grep -i is_os2=yes elif test -n "$DJGPP"; then case "X${MACHTYPE:-nonesuchmach}" in - *cygwin) ;; + *cygwin|*msys) ;; *) p_=\; ;; esac fi @@ -206,8 +206,16 @@ ccsymbols='' cppccsymbols='' cppsymbols='' from='' +hostgenerate='' +hostosname='' +hostperl='' run='' targetarch='' +targetdir='' +targetenv='' +targethost='' +targetmkdir='' +targetport='' to='' usecrosscompile='' extern_C='' @@ -312,6 +320,7 @@ RCSfile='' Revision='' Source='' State='' +sysroot='' _a='' _exe='' _o='' @@ -580,6 +589,7 @@ d_localtime_r='' d_localtime_r_needs_tzset='' localtime_r_proto='' d_locconv='' +d_lc_monetary_2008='' d_lockf='' d_longdbl='' longdblsize='' @@ -706,8 +716,6 @@ d_setservent_r='' setservent_r_proto='' d_setsid='' d_setvbuf='' -d_sfio='' -usesfio='' d_shm='' d_shmat='' d_shmatprototype='' @@ -887,7 +895,6 @@ i_rpcsvcdbm='' d_dirnamlen='' direntrytype='' i_dirent='' -i_dld='' i_dlfcn='' i_fcntl='' i_float='' @@ -932,7 +939,6 @@ d_pwgecos='' d_pwpasswd='' d_pwquota='' i_pwd='' -i_sfio='' i_shadow='' i_socks='' i_stdbool='' @@ -1003,6 +1009,7 @@ libperl='' shrpenv='' useshrplib='' glibpth='' +incpth='' libpth='' loclibpth='' plibpth='' @@ -1161,6 +1168,7 @@ scriptdirexp='' selectminbits='' selecttype='' sh='' +targetsh='' sig_count='' sig_name='' sig_name_init='' @@ -1197,6 +1205,7 @@ sitescript='' sitescriptexp='' sizesize='' sizetype='' +d_libname_unique='' so='' socksizetype='' sharpbang='' @@ -1284,8 +1293,6 @@ installvendorscript='' vendorscript='' vendorscriptexp='' versiononly='' -defvoidused='' -voidflags='' yacc='' yaccflags='' CONFIG='' @@ -1315,6 +1322,9 @@ elif test -f "/system/gnu_library/bin/ar elif test -n "$DJGPP"; then : DOS DJGPP _exe=".exe" +elif test -f /kern/cookiejar; then +: MiNT + _exe="" elif test -d c:/. -o -n "$is_os2" ; then : OS/2 or cygwin _exe=".exe" @@ -1363,9 +1373,6 @@ libswanted='' ignore_versioned_solibs='' : set usethreads on the Configure command line to enable threads. usereentrant='undef' -: full support for void wanted by default -defvoidused=15 - ccname='' ccversion='' perllibs='' @@ -1381,7 +1388,7 @@ libswanted_uselargefiles='' : set usesocks on the Configure command line to enable socks. : List of libraries we want. : If anyone needs extra -lxxx, put those in a hint file. -libswanted="sfio socket bind inet nsl nm ndbm gdbm dbm db malloc dl dld ld sun" +libswanted="socket bind inet nsl nm ndbm gdbm dbm db malloc dl ld sun" libswanted="$libswanted m crypt sec util c cposix posix ucb bsd BSD" : We probably want to search /usr/shlib before most other libraries. : This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist. @@ -1435,6 +1442,10 @@ EOM ;; esac +: When cross-compiling we need to separate the sh-to-run-Configure-with from the sh-to-use-in-Perl +: default both to the same thing, cross-compilers can then set targetsh differently if they like +targetsh=$sh + : see if sh knows # comments if `$sh -c '#' >/dev/null 2>&1`; then shsharp=true @@ -2306,6 +2317,48 @@ EOH esac fi +: Set 'sysroot' to change the logical root directory to your headers and libraries see man gcc +: This is primarily meant for cross-compile environments, and may fail to be useful in other cases +if test "X$sysroot" = X; then + sysroot="" +else + case "$cc" in + *gcc*|*g++*) + echo "Using $sysroot to find your headers and libraries, adding to ccflags" + # _sysroot is used in places where we need --sysroot=foo + # but using the rest of the flags could cause issues. + _sysroot="--sysroot=$sysroot"; + case "$ccflags" in + *sysroot*) ;; + 'undef'|*) + ccflags="$ccflags $_sysroot" + esac + case "$ldflags" in + *sysroot*) ;; + 'undef'|*) + ldflags="$ldflags $_sysroot" + esac + case "$cppflags" in + *sysroot*) ;; + 'undef'|*) + cppflags="$cppflags $_sysroot" + esac + # lddlflags updated below in lddlflags section; + # same with cccdlflags + ;; + esac + + # Adjust some defaults to also use $sysroot + for var in xlibpth loclibpth locincpth glibpth; do + eval xxx=\$$var + eval $var='' + for path in $xxx; do + eval $var=\"\$$var $sysroot$path\" + done + done + +fi + : find out where common programs are echo " " echo "Locating common programs..." >&4 @@ -2394,7 +2447,7 @@ uname zip " pth=`echo $PATH | sed -e "s/$p_/ /g"` -pth="$pth /lib /usr/lib" +pth="$pth $sysroot/lib $sysroot/usr/lib" for file in $loclist; do eval xxx=\$$file case "$xxx" in @@ -2466,7 +2519,7 @@ egrep) esac case "$less" in '') ;; -*) if $less -R /dev/null; then +*) if $less -R /dev/null 2>&1; then echo "Substituting less -R for less." less="$less -R" _less=$less @@ -2779,71 +2832,101 @@ $define|true|[yY]*) esac : Check for Cross-Compilation +if $test "X$targethost" = "X"; then + targethost="" +fi +if $test "X$targetenv" = "X"; then + targetenv="" +fi case "$usecrosscompile" in $define|true|[yY]*) $echo "Cross-compiling..." - croak='' - case "$cc" in - *-*-gcc) # A cross-compiling gcc, probably. - targetarch=`$echo $cc|$sed 's/-gcc$//'` - ar=$targetarch-ar + croak='' + case "$cc" in + *-gcc*|*-g++*) # A cross-compiling gcc, probably. + # arm-linux-androideabi-gcc -> arm-linux-androideabi + # x86_64-w64-mingw32-gcc.exe -> x86_64-w64-mingw32 + targetarch=`$echo $cc|$sed 's/-g[c\+][c\+].*$//'` + ar=`$echo $cc|$sed 's/-g[c\+][c\+]/-ar/'` # leave out ld, choosing it is more complex - nm=$targetarch-nm - ranlib=$targetarch-ranlib - $echo 'extern int foo;' > try.c - set X `$cc -v -E try.c 2>&1 | $awk '/^#include &4 - for i in $*; do - j="`$echo $i|$sed 's,/include$,/lib,'`" - if $test -d $j; then - libpth="$libpth $j" - fi - done - libpth="`$echo $libpth|$sed 's/^ //'`" - echo "Guessing libpth '$libpth'." >&4 - fi - $rm -f try.c - ;; + nm=`$echo $cc|$sed 's/-g[c\+][c\+]/-nm/'` + ranlib=`$echo $cc|$sed 's/-g[c\+][c\+]/-ranlib/'` + # We are in a weird spot. Just before us, some values + # were 'saved', to be restored after the hints are + # run. This means that the changes we made to ar, + # nm and ranlib will get reverted. + # To avoid that, we hijack the saving mechanism and + # have it save our new values. + for file in ar nm ranlib; do + eval xxx=\$$file + eval $file=$xxx$_exe + eval _$file=$xxx + done + ;; esac case "$targetarch" in '') echo "Targetarch not defined." >&4; croak=y ;; - *) echo "Using targetarch $targetarch." >&4 ;; - esac - case "$incpth" in - '') echo "Incpth not defined." >&4; croak=y ;; - *) echo "Using incpth '$incpth'." >&4 ;; - esac - case "$libpth" in - '') echo "Libpth not defined." >&4; croak=y ;; - *) echo "Using libpth '$libpth'." >&4 ;; - esac - case "$usrinc" in - '') for i in $incpth; do - if $test -f $i/errno.h -a -f $i/stdio.h -a -f $i/time.h; then - usrinc=$i - echo "Guessing usrinc $usrinc." >&4 - break - fi - done - case "$usrinc" in - '') echo "Usrinc not defined." >&4; croak=y ;; - esac - ;; - *) echo "Using usrinc $usrinc." >&4 ;; + *) echo "Using targetarch $targetarch." >&4 ;; esac case "$targethost" in '') echo "Targethost not defined." >&4; croak=y ;; - *) echo "Using targethost $targethost." >&4 + *) echo "Using targethost $targethost." >&4 esac locincpth=' ' loclibpth=' ' case "$croak" in y) echo "Cannot continue, aborting." >&4; exit 1 ;; esac + : compile a host miniperl and generate_uudmap, unless we got passed them + if $test "X$hostperl" = X; then + echo "Building host miniperl and generate_uudmap binaries" >&4 + before_host=`pwd` + cd .. + cd $src + src=`pwd` + rm -rf $src/host + mkdir $src/host + cd $src/host + $src/Configure -des -Dusedevel -Dmksymlinks + $make miniperl + case "$hostgenerate" in + '') $make generate_uudmap + hostgenerate=$src/host/generate_uudmap + ;; + "$undef") hostgenerate='' + ;; + esac + hostperl=$src/host/miniperl + cd $before_host + fi + hostosname=`$hostperl -le 'print $^O'` + ;; +*) + usecrosscompile="$undef" + ;; +esac + +: Define -Dtargethost=somecomputer to run compiled tests on another machine +case "$targethost" in + '') echo "Checking for cross-compile" >&4 + case "$usecrosscompile$multiarch" in + *$define*) echo "Skipping the try tests in the rest of Configure as no targethost was defined when cross-compiling" >&4 + if [ -f Makefile ]; then + echo " " + echo "Now you must ensure config.sh, config.h and the generated headers exist and run a $make." + else + echo "Configure done." + fi + exit 0 + ;; + *) echo "No targethost for running compiler tests against defined, running locally" >&4 + run='' + to=: + from=: + ;; + esac + ;; + *) echo "Using targethost $targethost." >&4 case "$src" in /*) run=$src/Cross/run targetmkdir=$src/Cross/mkdir @@ -2866,18 +2949,23 @@ $define|true|[yY]*) case "$targetfrom" in '') targetfrom=scp ;; esac - run=$run-$targetrun - to=$to-$targetto - from=$from-$targetfrom + run=$run-$targetrun + to=$to-$targetto + from=$from-$targetfrom case "$targetdir" in '') targetdir=/tmp - echo "Guessing targetdir $targetdir." >&4 - ;; + echo "Guessing targetdir $targetdir." >&4 + ;; esac case "$targetuser" in '') targetuser=root - echo "Guessing targetuser $targetuser." >&4 - ;; + echo "Guessing targetuser $targetuser." >&4 + ;; + esac + case "$targetport" in + '') targetport=22 + echo "Guessing targetport $targetport." >&4 + ;; esac case "$targetfrom" in scp) q=-q ;; @@ -2887,6 +2975,7 @@ $define|true|[yY]*) ssh|rsh) cat >$run <&4 exit 1 ;; @@ -2914,7 +3010,7 @@ EOF */Cross/mkdir) cat >$targetmkdir </dev/null || exit 1 ;; *) $targetmkdir $targetdir/\`dirname \$f\` - $targetto $q \$f $targetuser@$targethost:$targetdir/\$f || exit 1 + $targetto -P $targetport -r $q \$f $targetuser@$targethost:$targetdir/\$f 2>/dev/null || exit 1 ;; esac done @@ -2971,7 +3067,7 @@ EOF for f in \$@ do $rm -f \$f - $targetfrom $q $targetuser@$targethost:$targetdir/\$f . || exit 1 + $targetfrom -P $targetport $q $targetuser@$targethost:$targetdir/\$f . || exit 1 done exit 0 EOF @@ -3017,7 +3113,7 @@ EOF *) run='' to=: from=: - usecrosscompile='undef' + usecrosscompile="$undef" targetarch='' ;; esac @@ -3248,6 +3344,9 @@ EOM *) osvers=$tmp;; esac ;; + bitrig) osname=bitrig + osvers="$3" + ;; bsd386) osname=bsd386 osvers=`$uname -r` ;; @@ -3291,6 +3390,7 @@ EOM case "$3" in *) osvers="$3" ;; esac + $test -f /system/lib/libandroid.so && osname=linux-android ;; MiNT) osname=mint ;; @@ -3440,8 +3540,42 @@ EOM case "$targetarch" in '') ;; *) hostarch=$osname - osname=`echo $targetarch|sed 's,^[^-]*-,,'` - osvers='' + case "$targetarch" in + nto*|*-nto-*) + # Will load qnx.sh, which should change osname to nto + osname=qnx + osvers='' + ;; + *linux-android*) + # Catch arm-linux-androideabi, mipsel-linux-android, + # and i686-linux-android + osname=linux-android + osvers='' + ;; + *linux*) + # Something like arm-linux-gnueabihf is really just + # plain linux. + osname=linux + osvers='' + ;; + *solaris*|*sunos*) + osname=solaris + # XXX perhaps we should just assume + # osvers to be 2, or maybe take the value + # from targetarch. Using $run before the + # hints are run is somewhat icky. + set X `$run $uname -a 2>/dev/null` + shift + case "$3" in + 5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;; + *) osvers="$3" ;; + esac + ;; + *) + osname=`echo $targetarch|sed 's,^[^-]*-,,'` + osvers='' + ;; + esac ;; esac @@ -4148,13 +4282,11 @@ $define|true|[yY]*) dflt='y';; esac cat <xenix echo exit 1 >venix echo exit 1 >os2 d_bsd="$undef" -$cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null -if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1 +$cat $sysroot/usr/include/signal.h $sysroot/usr/include/sys/signal.h >foo 2>/dev/null +if test -f /osf_boot || $contains 'OSF/1' $sysroot/usr/include/ctype.h >/dev/null 2>&1 then echo "Looks kind of like an OSF/1 system, but we'll see..." echo exit 0 >osf1 @@ -4513,10 +4637,27 @@ case "$gccversion" in $rm -f try try.* esac +# gcc 4.9 by default does some optimizations that break perl. +# see ticket 121505. +# +# The -fwrapv disables those optimizations (and probably others,) so +# for gcc 4.9 (and later, since the optimizations probably won't go +# away), add -fwrapv unless the user requests -fno-wrapv, which +# disables -fwrapv, or if the user requests -fsanitize=undefined, +# which turns the overflows -fwrapv ignores into runtime errors. +case "$gccversion" in +4.[3-9].*|4.[1-9][0-9]*|[5-9].*|[1-9][0-9]*) + case "$ccflags" in + *-fno-wrapv*|*-fsanitize=undefined*|*-fwrapv*) ;; + *) ccflags="$ccflags -fwrapv" ;; + esac +esac + : What should the include directory be ? +: Use sysroot if set, so findhdr looks in the right place. echo " " $echo $n "Hmm... $c" -dflt='/usr/include' +dflt="$sysroot/usr/include" incpath='' mips_type='' if $test -f /bin/mips && /bin/mips; then @@ -4526,7 +4667,7 @@ if $test -f /bin/mips && /bin/mips; then /bsd43 #endif EOCP - if cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then + if $cc $cppflags -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then dflt='/bsd43/usr/include' incpath='/bsd43' mips_type='BSD 4.3' @@ -4574,7 +4715,7 @@ if test ! -f cppstdin; then # locations but we'll cheat by using the -M flag. echo 'cat >.$$.c; rm -f .$$.u; '"$cc"' ${1+"$@"} -M -c .$$.c 2>/dev/null; test -s .$$.u && awk '"'"'$2 ~ /\.h$/ { print "# 0 \""$2"\"" }'"'"' .$$.u; rm -f .$$.o .$$.u; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' > cppstdin else - echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin + echo 'cat >.$$.c; '"$cc $cppflags"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin fi else echo "Keeping your $hint cppstdin wrapper." @@ -4617,37 +4758,37 @@ elif echo 'Maybe "'"$cc"' -E" will work. $cc -E testcpp.out 2>&1; \ $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then echo "Yup, it does." - x_cpp="$cc -E" + x_cpp="$cc $cppflags -E" x_minus=''; elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \ $cc -E - testcpp.out 2>&1; \ $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then echo "Yup, it does." - x_cpp="$cc -E" + x_cpp="$cc $cppflags -E" x_minus='-'; elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \ $cc -P testcpp.out 2>&1; \ $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then echo "Yipee, that works!" - x_cpp="$cc -P" + x_cpp="$cc $cppflags -P" x_minus=''; elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \ $cc -P - testcpp.out 2>&1; \ $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then echo "At long last!" - x_cpp="$cc -P" + x_cpp="$cc $cppflags -P" x_minus='-'; elif echo 'No such luck, maybe "'$cpp'" will work...'; \ $cpp testcpp.out 2>&1; \ $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then echo "It works!" - x_cpp="$cpp" + x_cpp="$cpp $cppflags" x_minus=''; elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \ $cpp - testcpp.out 2>&1; \ $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then echo "Hooray, it works! I was beginning to wonder." - x_cpp="$cpp" + x_cpp="$cpp $cppflags" x_minus='-'; elif echo 'Uh-uh. Time to get fancy. Trying a wrapper...'; \ $wrapper testcpp.out 2>&1; \ @@ -4707,11 +4848,90 @@ case "$cppstdin" in esac $rm -f testcpp.c testcpp.out +: Adjust cppfilter for path component separator +case "$osname" in +vos) cppfilter="tr '\\\\>' '/' |" ;; # path component separator is > +os2) cppfilter="sed -e 's|\\\\\\\\|/|g' |" ;; # path component separator is \ +*) cppfilter='' ;; +esac + +: Use gcc to determine libpth and incpth +# If using gcc or clang, we can get better values for libpth, incpth +# and usrinc directly from the compiler. +# Note that ccname for clang is also gcc. +case "$ccname" in + gcc) + $echo 'extern int foo;' > try.c + set X `$cppstdin -v try.c 2>&1 | $awk '/^#include &4; croak=y ;; + *) echo "Using incpth '$incpth'." >&4 ;; + esac + case "$libpth" in + '') echo "Libpth not defined." >&4; croak=y ;; + *) echo "Using libpth '$libpth'." >&4 ;; + esac + case "$usrinc" in + '') echo "Usrinc not defined." >&4; croak=y ;; + *) echo "Using usrinc $usrinc." >&4 ;; + esac + case "$croak" in + y) + if test "X$sysroot" = X; then + echo "Cannot continue, aborting." >&4; exit 1 + else + echo "Cross-compiling using sysroot $sysroot, failing to guess inc/lib paths is not fatal" >&4 + fi + ;; + esac + ;; + esac + ;; +esac + +: Default value for incpth is just usrinc +case "$incpth" in +'') incpth="$usrinc";; +esac + : Set private lib path case "$plibpth" in '') if ./mips; then - plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib" - fi;; + plibpth="$incpath/usr/lib $sysroot/usr/local/lib $sysroot/usr/ccs/lib" + fi;; esac case "$libpth" in ' ') dlist='';; @@ -4720,7 +4940,6 @@ case "$libpth" in esac : Now check and see which directories actually exist, avoiding duplicates -libpth='' for xxx in $dlist do if $test -d $xxx; then @@ -4738,6 +4957,14 @@ know not to be holding relevant librarie Say "none" for none. EOM + +if test "X$sysroot" != X; then + $cat <> try.msg - case " $libs " in - *" -lsfio "*) - cat >> try.msg <<'EOQS' -If $libs contains -lsfio, and sfio is mis-configured, then it -sometimes (apparently) runs and exits with a 0 status, but with no -output! It may have to do with sfio's use of _exit vs. exit. - -EOQS - rp="You have a big problem. Shall I abort Configure" - dflt=y - ;; - esac - ;; + *) echo 'The program compiled OK, but produced no output.' >> try.msg ;; esac else echo "The program compiled OK, but exited with status $?." >>try.msg @@ -5452,17 +5686,12 @@ case $fieldn in esac echo "Your cpp writes the filename in the $pos field of the line." -case "$osname" in -vos) cppfilter="tr '\\\\>' '/' |" ;; # path component separator is > -os2) cppfilter="sed -e 's|\\\\\\\\|/|g' |" ;; # path component separator is \ -*) cppfilter='' ;; -esac : locate header file $cat >findhdr <&4 + cat >try.c < +typedef $uquadtype myULL; +int main (void) +{ + struct { + double d; + myULL u; + } *p, test[] = { + {4294967303.15, 4294967303ULL}, + {4294967294.2, 4294967294ULL}, + {4294967295.7, 4294967295ULL}, + {0.0, 0ULL} + }; + for (p = test; p->u; p++) { + myULL x = (myULL)p->d; + if (x != p->u) { + printf("buggy\n"); + return 0; + } + } + printf("ok\n"); + return 0; +} +EOCP + set try + if eval $compile_ok; then + libcquad=`$run ./try` + echo "Your C library's 64-bit functions are $libcquad." + else + echo "(I can't seem to compile the test program.)" + echo "Assuming that your C library's 64-bit functions are ok." + libcquad="ok" + fi + $rm_try + + case "$libcquad" in + buggy*) + cat >&4 <&4 -case "$voidflags" in -'') - $cat >try.c < -#endif -#if TRY & 1 -void sub() { -#else -sub() { -#endif - extern void moo(); /* function returning void */ - void (*goo)(); /* ptr to func returning void */ -#if TRY & 8 - void *hue; /* generic ptr */ -#endif -#if TRY & 2 - void (*foo[10])(); -#endif - -#if TRY & 4 - if(goo == moo) { - exit(0); - } -#endif - exit(0); -} -int main() { sub(); } -EOCP - if $cc $ccflags -c -DTRY=$defvoidused try.c >.out 2>&1 ; then - voidflags=$defvoidused - echo "Good. It appears to support void to the level $package wants.">&4 - if $contains warning .out >/dev/null 2>&1; then - echo "However, you might get some warnings that look like this:" - $cat .out - fi - else -echo "Hmm, your compiler has some difficulty with void. Checking further..." >&4 - if $cc $ccflags -c -DTRY=1 try.c >/dev/null 2>&1; then - echo "It supports 1..." - if $cc $ccflags -c -DTRY=3 try.c >/dev/null 2>&1; then - echo "It also supports 2..." - if $cc $ccflags -c -DTRY=7 try.c >/dev/null 2>&1; then - voidflags=7 - echo "And it supports 4 but not 8 definitely." - else - echo "It doesn't support 4..." - if $cc $ccflags -c -DTRY=11 try.c >/dev/null 2>&1; then - voidflags=11 - echo "But it supports 8." - else - voidflags=3 - echo "Neither does it support 8." - fi - fi - else - echo "It does not support 2..." - if $cc $ccflags -c -DTRY=13 try.c >/dev/null 2>&1; then - voidflags=13 - echo "But it supports 4 and 8." - else - if $cc $ccflags -c -DTRY=5 try.c >/dev/null 2>&1; then - voidflags=5 - echo "And it supports 4 but has not heard about 8." - else - echo "However it supports 8 but not 4." - fi - fi - fi - else - echo "There is no support at all for void." - voidflags=0 - fi - fi -esac -case "$voidflags" in -"$defvoidused") ;; -*) $cat >&4 <<'EOM' - Support flag bits are: - 1: basic void declarations. - 2: arrays of pointers to functions returning void. - 4: operations between pointers to and addresses of void functions. - 8: generic void pointers. -EOM - dflt="$voidflags"; - rp="Your void support flags add up to what?" - . ./myread - voidflags="$ans" - ;; -esac -$rm_try - : check for length of pointer echo " " case "$ptrsize" in '') echo "Checking to see how big your pointers are..." >&4 - if test "$voidflags" -gt 7; then - echo '#define VOID_PTR char *' > try.c - else - echo '#define VOID_PTR void *' > try.c - fi $cat >>try.c < #$i_stdlib I_STDLIB @@ -6748,7 +6929,7 @@ case "$ptrsize" in #endif int main() { - printf("%d\n", (int)sizeof(VOID_PTR)); + printf("%d\n", (int)sizeof(void *)); exit(0); } EOCP @@ -6960,7 +7141,7 @@ case "$ans" in [yY]*) fn=d~+ rp='Installation prefix to use for vendor-supplied add-ons?' case "$vendorprefix" in - '') dflt='' ;; + '') dflt="$prefix" ;; *) dflt=$vendorprefix ;; esac . ./getfile @@ -7551,8 +7732,8 @@ unknown) $sort | $sed -e 's/^.* //'` eval set \$$# done - $test -r $1 || set /usr/ccs/lib/libc.$so - $test -r $1 || set /lib/libsys_s$_a + $test -r $1 || set $sysroot/usr/ccs/lib/libc.$so + $test -r $1 || set $sysroot/lib/libsys_s$_a ;; *) set blurfl @@ -7776,10 +7957,6 @@ esac esac $rm -f libnames libpath -: see if dld is available -set dld.h i_dld -eval $inhdr - : Check if we are using C++ echo " " echo "Checking for C++..." >&4 @@ -7829,13 +8006,13 @@ yes) if $contains $tlook $tf >/dev/null 2>&1; then tval=true; elif $test "$mistrustnm" = compile -o "$mistrustnm" = run; then - echo "$extern_C void *$1$tdc; void *(*(p()))$tdc { return &$1; } int main() { if(p()) return(0); else return(1); }"> try.c; + echo "$extern_C void *$1$tdc; void *(*(p()))$tdc { return &$1; } int main() { if(p() && p() != (void *)main) return(0); else return(1); }"> try.c; $cc -o try $optimize $ccflags $ldflags try.c >/dev/null 2>&1 $libs && tval=true; $test "$mistrustnm" = run -a -x try && { $run ./try$_exe >/dev/null 2>&1 || tval=false; }; $rm_try; fi; else - echo "$extern_C void *$1$tdc; void *(*(p()))$tdc { return &$1; } int main() { if(p()) return(0); else return(1); }"> try.c; + echo "$extern_C void *$1$tdc; void *(*(p()))$tdc { return &$1; } int main() { if(p() && p() != (void *)main) return(0); else return(1); }"> try.c; $cc -o try $optimize $ccflags $ldflags try.c $libs >/dev/null 2>&1 && tval=true; $rm_try; fi; @@ -7901,22 +8078,19 @@ eval $inhdr echo " " dldir="ext/DynaLoader" case "$usedl" in -$define|y|true) + $define|y|true) dflt='y' usedl="$define" ;; -$undef|n|false) + $undef|n|false) dflt='n' usedl="$undef" ;; -*) + *) dflt='n' case "$d_dlopen" in $define) dflt='y' ;; esac - case "$i_dld" in - $define) dflt='y' ;; - esac : Does a dl_xxx.xs file exist for this operating system $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y' ;; @@ -7926,23 +8100,20 @@ rp="Do you wish to use dynamic loading?" usedl="$ans" bin_ELF="$undef" case "$ans" in -y*) usedl="$define" + y*) usedl="$define" case "$dlsrc" in - '') - if $test -f $rsrc/$dldir/dl_${osname}.xs ; then - dflt="$dldir/dl_${osname}.xs" + '') if $test -f $rsrc/$dldir/dl_${osname}.xs ; then + dflt="$dldir/dl_${osname}.xs" elif $test "$d_dlopen" = "$define" ; then - dflt="$dldir/dl_dlopen.xs" - elif $test "$i_dld" = "$define" ; then - dflt="$dldir/dl_dld.xs" + dflt="$dldir/dl_dlopen.xs" else - dflt='' + dflt='' fi ;; - *) dflt="$dldir/$dlsrc" + *) dflt="$dldir/$dlsrc" ;; esac - echo "The following dynamic loading files are available:" + echo "The following dynamic loading files are available:" : Can not go over to $dldir because getfile has path hard-coded in. tdir=`pwd`; cd "$rsrc"; $ls -C $dldir/dl*.xs; cd "$tdir" rp="Source file to use for dynamic loading" @@ -7960,8 +8131,8 @@ compile modules that will be used to cre To use no flags, say "none". EOM - case "$cccdlflags" in - '') case "$gccversion" in + case "$cccdlflags" in + '') case "$gccversion" in '') case "$osname" in hpux) dflt='+z' ;; next) dflt='none' ;; @@ -7970,24 +8141,47 @@ EOM sunos) dflt='-pic' ;; *) dflt='none' ;; esac - ;; + ;; *) case "$osname" in - darwin) dflt='none' ;; - linux*|svr4*|esix*|solaris|nonstopux) dflt='-fPIC' ;; + darwin) dflt='none' ;; + *linux*|svr4*|esix*|solaris|nonstopux) dflt='-fPIC' ;; *) dflt='-fpic' ;; esac ;; - esac ;; - ' ') dflt='none' ;; - *) dflt="$cccdlflags" ;; - esac - rp="Any special flags to pass to $cc -c to compile shared library modules?" - . ./myread - case "$ans" in - none) cccdlflags=' ' ;; - *) cccdlflags="$ans" ;; - esac + esac ;; + ' ') dflt='none' ;; + *) dflt="$cccdlflags" ;; + esac - cat << EOM + case "$dflt" in + none) dflt='' ;; + esac + + # If -Dsysroot was specified, now's the time to add it + # to cccdlflags + if test "X$sysroot" != X; then + case "$gccversion" in + '') ;; + *) case "$dflt" in + *sysroot*) ;; + 'undef'|*) + dflt="$dflt --sysroot=$sysroot" ;; + esac + ;; + esac + fi + + case "$dflt" in + '') dflt='none';; + esac + + rp="Any special flags to pass to $cc -c to compile shared library modules?" + . ./myread + case "$ans" in + none) cccdlflags=' ' ;; + *) cccdlflags="$ans" ;; + esac + + cat << EOM Some systems use ld to create libraries that can be dynamically loaded, while other systems (such as those using ELF) use $cc. @@ -8007,41 +8201,40 @@ EOM #include #endif int main() { - char b[4]; - int i = open("a.out",O_RDONLY); - if(i == -1) - exit(1); /* fail */ - if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F') - exit(0); /* succeed (yes, it is ELF) */ - else - exit(1); /* fail */ + char b[4]; + int i = open("a.out",O_RDONLY); + if(i == -1) + exit(1); /* fail */ + if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F') + exit(0); /* succeed (yes, it is ELF) */ + exit(1); /* fail */ } EOM if $cc $ccflags $ldflags try.c >/dev/null 2>&1 && $run ./a.out; then - bin_ELF="$define" + bin_ELF="$define" fi $rm_try case "$ld" in - '') if $test $bin_ELF = "$define"; then - cat <try.c <try.c <try.h <try.h </dev/null 2>&1 \ - && $test -s a.out ; then - echo "ld supports scripting" >&4 - ld_can_script="$define" - else - echo "ld does not support scripting" >&4 - fi - $rm_try - ;; + if $cc $cccdlflags $ccdlflags $ccflags \ + $ldflags $lddlflags -o a.out try.c \ + -Wl,--version-script=try.h >/dev/null 2>&1 \ + && $test -s a.out ; then + echo "ld supports scripting" >&4 + ld_can_script="$define" + else + echo "ld does not support scripting" >&4 + fi + $rm_try + ;; esac : Do we want a shared libperl? @@ -8261,7 +8464,7 @@ true) dflt=libperl.5.$so # XXX How handle the --version stuff for MAB? ;; - linux*|gnu*) # ld won't link with a bare -lperl otherwise. + *linux*|gnu*) # ld won't link with a bare -lperl otherwise. dflt=libperl.$so ;; cygwin*) # ld links now against the dll directly @@ -8349,7 +8552,7 @@ if "$useshrplib"; then solaris) xxx="-R $shrpdir" ;; - freebsd|mirbsd|netbsd|openbsd|interix|dragonfly) + freebsd|mirbsd|netbsd|openbsd|interix|dragonfly|bitrig) xxx="-Wl,-R$shrpdir" ;; bsdos|linux|irix*|dec_osf|gnu*) @@ -11335,57 +11538,57 @@ sockethdr='' echo " " $echo $n "Hmm... $c" >&4 if set socket val -f d_socket; eval $csym; $val; then + echo "Looks like you have Berkeley networking support." >&4 + d_socket="$define" + if set setsockopt val -f; eval $csym; $val; then + d_oldsock="$undef" + else + echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4 + d_oldsock="$define" + fi +else + if $contains socklib libc.list >/dev/null 2>&1; then echo "Looks like you have Berkeley networking support." >&4 d_socket="$define" - if set setsockopt val -f; eval $csym; $val; then - d_oldsock="$undef" - else - echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4 - d_oldsock="$define" - fi -else - if $contains socklib libc.list >/dev/null 2>&1; then - echo "Looks like you have Berkeley networking support." >&4 - d_socket="$define" - : we will have to assume that it supports the 4.2 BSD interface - d_oldsock="$undef" - else - echo "You don't have Berkeley networking in libc$_a..." >&4 - if test "X$d_socket" = "X$define"; then - echo "...but you seem to believe that you have sockets." >&4 - else - for net in net socket - do - if test -f /usr/lib/lib$net$_a; then - ( ($nm $nm_opt /usr/lib/lib$net$_a | eval $nm_extract) || \ - $ar t /usr/lib/lib$net$_a) 2>/dev/null >> libc.list - if $contains socket libc.list >/dev/null 2>&1; then - d_socket="$define" - socketlib="-l$net" - case "$net" in - net) - echo "...but the Wollongong group seems to have hacked it in." >&4 - sockethdr="-I/usr/netinclude" - ;; - esac - echo "Found Berkeley sockets interface in lib$net." >&4 - if $contains setsockopt libc.list >/dev/null 2>&1; then - d_oldsock="$undef" - else - echo "...using the old BSD 4.1c interface, rather than 4.2." >&4 - d_oldsock="$define" - fi - break - fi - fi - done - if test "X$d_socket" != "X$define"; then - echo "or anywhere else I see." >&4 - d_socket="$undef" - d_oldsock="$undef" + : we will have to assume that it supports the 4.2 BSD interface + d_oldsock="$undef" + else + echo "You don't have Berkeley networking in libc$_a..." >&4 + if test "X$d_socket" = "X$define"; then + echo "...but you seem to believe that you have sockets." >&4 + else + for net in net socket + do + if test -f $sysroot/usr/lib/lib$net$_a; then + ( ($nm $nm_opt $sysroot/usr/lib/lib$net$_a | eval $nm_extract) || \ + $ar t $sysroot/usr/lib/lib$net$_a) 2>/dev/null >> libc.list + if $contains socket libc.list >/dev/null 2>&1; then + d_socket="$define" + socketlib="-l$net" + case "$net" in + net) + echo "...but the Wollongong group seems to have hacked it in." >&4 + sockethdr="-I$sysroot/usr/netinclude" + ;; + esac + echo "Found Berkeley sockets interface in lib$net." >&4 + if $contains setsockopt libc.list >/dev/null 2>&1; then + d_oldsock="$undef" + else + echo "...using the old BSD 4.1c interface, rather than 4.2." >&4 + d_oldsock="$define" fi + break + fi fi + done + if test "X$d_socket" != "X$define"; then + echo "or anywhere else I see." >&4 + d_socket="$undef" + d_oldsock="$undef" + fi fi + fi fi : see if socketpair exists @@ -11405,7 +11608,7 @@ return (sa.sa_len); EOF val="$undef" set try; if eval $compile; then - val="$define" + val="$define" fi set d_sockaddr_sa_len; eval $setvar $rm_try @@ -11423,7 +11626,7 @@ return (sin6.sin6_family); EOF val="$undef" set try; if eval $compile; then - val="$define" + val="$define" fi set d_sockaddr_in6; eval $setvar $rm_try @@ -11441,7 +11644,7 @@ return (sin6.sin6_scope_id); EOF val="$undef" set try; if eval $compile; then - val="$define" + val="$define" fi set d_sin6_scope_id; eval $setvar $rm_try @@ -11495,7 +11698,7 @@ return (mreq.ipv6mr_interface); EOF val="$undef" set try; if eval $compile; then - val="$define" + val="$define" fi set d_ipv6_mreq; eval $setvar $rm_try @@ -11521,20 +11724,20 @@ $rm_try echo " " echo "Checking the availability of certain socket constants..." >&4 for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do - enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'` - $cat >try.c <try.c < #include int main() { int i = $ENUM; } EOF - val="$undef" - set try; if eval $compile; then - val="$define" - fi - set d_${enum}; eval $setvar - $rm_try + val="$undef" + set try; if eval $compile; then + val="$define" + fi + set d_${enum}; eval $setvar + $rm_try done : see if this is a sys/uio.h system @@ -12872,7 +13075,7 @@ EOCP echo "$startsh" >mtry echo "$run ./try >try.out 2>try.ret 4>try.err || exit 4" >>mtry chmod +x mtry - ./mtry >/dev/null 2>&1 + $run ./mtry >/dev/null 2>&1 case $? in 0) eagain=`$cat try.out`;; 1) echo "Could not perform non-blocking setting!";; @@ -15395,6 +15598,27 @@ $rm_try set localeconv d_locconv eval $inlibc +: see if localtime_r calls tzset +case "$d_locconv:$d_lc_monetary_2008" in +define:) + $cat >try.c < +int main() { + struct lconv *lc = localeconv(); + char int_p_cs_precedes = lc->int_p_cs_precedes; + return 0; +} +EOCP + set try + if eval $compile; then + d_lc_monetary_2008="$define" + else + d_lc_monetary_2008="$undef" + fi; + $rm_try + ;; +esac + : see if lockf exists set lockf d_lockf eval $inlibc @@ -15782,7 +16006,7 @@ int main() { #endif #ifdef INT16 int16_t i = INT16_MAX; - uint16_t i = UINT16_MAX; + uint16_t u = UINT16_MAX; printf("int16_t\n"); #endif #ifdef INT32 @@ -17499,71 +17723,6 @@ eval $inlibc set setvbuf d_setvbuf eval $inlibc -: see if sfio.h is available -set sfio.h i_sfio -eval $inhdr - -: see if sfio library is available -case "$i_sfio" in -$define) - val='' - set sfreserve val - eval $inlibc - ;; -*) - val="$undef" - ;; -esac -: Ok, but do we want to use it. -case "$val" in -$define) - case "$usesfio" in - true|$define|[yY]*) dflt='y';; - *) dflt='n';; - esac - echo "$package can use the sfio library, but it is experimental." - rp="You seem to have sfio available, do you want to try using it?" - . ./myread - case "$ans" in - y|Y) echo "Ok, turning on sfio then." - val="$define" - ;; - *) echo "Ok, avoiding sfio this time. I'll use stdio instead." - val="$undef" - ;; - esac - ;; -*) case "$usesfio" in - true|$define|[yY]*) - echo "Sorry, cannot find sfio on this machine." >&4 - echo "Ignoring your setting of usesfio=$usesfio." >&4 - val="$undef" - ;; - esac - ;; -esac -set d_sfio -eval $setvar -case "$d_sfio" in -$define) usesfio='true';; -*) usesfio='false';; -esac -case "$d_sfio" in -$define) ;; -*) : Remove sfio from list of libraries to use - case "$libs" in - *-lsfio*) - echo "Removing unneeded -lsfio from library list" >&4 - set `echo X $libs | $sed -e 's/-lsfio / /' -e 's/-lsfio$//'` - shift - libs="$*" - echo "libs = $libs" >&4 - ;; - esac -;; -esac - - : see if shmctl exists set shmctl d_shmctl eval $inlibc @@ -17623,13 +17782,13 @@ freebsd) h_shm=false val="$undef" set shmctl d_shmctl - evat $setvar + eval $setvar set shmget d_shmget - evat $setvar + eval $setvar set shmat d_shmat - evat $setvar + eval $setvar set shmdt d_shmdt - evat $setvar + eval $setvar ;; esac ;; @@ -18793,10 +18952,10 @@ esac : check for ordering of bytes in a UV echo " " -case "$usecrosscompile$multiarch" in +case "$multiarch" in *$define*) $cat <&4 - if $test "X$uselongdouble" = Xdefine -a "X$d_longdbl" = Xdefine; then - $cat >try.c <<'EOCP' +case "$alignbytes" in + '') echo "Checking alignment constraints..." >&4 + if $test "X$uselongdouble" = Xdefine -a "X$d_longdbl" = Xdefine; then + $cat >try.c <<'EOCP' typedef long double NV; EOCP - else - $cat >try.c <<'EOCP' + else + $cat >try.c <<'EOCP' typedef double NV; EOCP - fi - $cat >>try.c <<'EOCP' + fi + $cat >>try.c <<'EOCP' #include struct foobar { - char foo; - NV bar; + char foo; + NV bar; } try_algn; int main() { @@ -19129,35 +19277,32 @@ int main() return(0); } EOCP - set try - if eval $compile_ok; then - dflt=`$run ./try` - else - dflt='8' - echo "(I can't seem to compile the test program...)" + set try + if eval $compile_ok; then + dflt=`$run ./try` + else + dflt='8' + echo "(I can't seem to compile the test program...)" + fi + case "$multiarch" in + *$define*) + : The usual safe value is 8, but Darwin with -Duselongdouble + : needs 16. Hence, we will take 8 as a minimum, but allow + : Configure to pick a larger value if needed. + if $test "$dflt" -lt 8; then + dflt='8' + echo "Setting alignment to 8 for multiarch support.">&4 fi - case "$multiarch" in - *$define*) - : The usual safe value is 8, but Darwin with -Duselongdouble - : needs 16. Hence, we will take 8 as a minimum, but allow - : Configure to pick a larger value if needed. - if $test "$dflt" -lt 8; then - dflt='8' - echo "Setting alignment to 8 for multiarch support.">&4 - fi - ;; - esac - ;; - *) dflt="$alignbytes" ;; esac - rp="Doubles must be aligned on a how-many-byte boundary?" - . ./myread - alignbytes="$ans" - $rm_try + ;; + *) dflt="$alignbytes" ;; esac - +rp="Doubles must be aligned on a how-many-byte boundary?" +. ./myread +alignbytes="$ans" +$rm_try : set the base revision baserev=5.0 @@ -19464,26 +19609,7 @@ esac : How can we generate normalized random numbers ? echo " " -echo "Looking for a random number function..." >&4 -case "$randfunc" in -'') - if set drand48 val -f; eval $csym; $val; then - dflt="drand48" - echo "Good, found drand48()." >&4 - elif set random val -f; eval $csym; $val; then - dflt="random" - echo "OK, found random()." >&4 - else - dflt="rand" - echo "Yuck, looks like I have to use rand()." >&4 - fi - echo " " - ;; -*) - dflt="$randfunc" - ;; -esac -cont=true +echo "Using our internal random number implementation..." >&4 case "$ccflags" in *-Dmy_rand=*|*-Dmy_srand=*) @@ -19494,103 +19620,11 @@ case "$ccflags" in ;; esac -while $test "$cont"; do - rp="Use which function to generate random numbers?" - . ./myread - if $test "$ans" = "$dflt"; then - : null - else - randbits='' - fi - randfunc="$ans" - if set $ans val -f; eval $csym; $val; then - cont='' - else - dflt=y - rp="I cannot find function $ans. Use that name anyway?" - . ./myread - dflt=rand - case "$ans" in - [yY]*) cont='';; - esac - fi - case "$cont" in - '') - case "$randfunc" in - drand48) - drand01="drand48()" - seedfunc="srand48" - randbits=48 - randseedtype=long - ;; - rand|random) - case "$randbits" in - '') -echo "Checking to see how many bits your $randfunc() function produces..." >&4 - $cat >try.c < -#ifdef I_UNISTD -# include -#endif -#ifdef I_STDLIB -# include -#endif -int main() -{ - int i; - unsigned long tmp; - unsigned long max = 0L; - - for (i = 1000; i; i--) { - tmp = (unsigned long) $randfunc(); - if (tmp > max) max = tmp; - } - for (i = 0; max; i++) - max /= 2; - printf("%d\n",i); -} -EOCP - set try - if eval $compile_ok; then - dflt=`try` - else - dflt='?' - echo "(I can't seem to compile the test program...)" - fi - ;; - *) - dflt="$randbits" - ;; - esac - rp="How many bits does your $randfunc() function produce?" - . ./myread - randbits="$ans" - $rm_try - drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))" - seedfunc="s$randfunc" - randseedtype=unsigned - ;; - *) - dflt="31" - rp="How many bits does your $randfunc() function produce?" - . ./myread - randbits="$ans" - seedfunc="s$randfunc" - drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))" - if set $seedfunc val -f; eval $csym; $val; then - echo "(Using $seedfunc() to seed random generator)" - else - echo "(Warning: no $seedfunc() to seed random generator)" - seedfunc=rand - fi - randseedtype=unsigned - ;; - esac - ;; - esac -done +randfunc=Perl_drand48 +drand01="Perl_drand48()" +seedfunc="Perl_drand48_init" +randbits=48 +randseedtype=U32 : Check how to flush echo " " @@ -19674,7 +19708,7 @@ if $test "X$fflushNULL" = X -o "X$fflush output='' set try -DTRY_FPUTC if eval $compile; then - $run ./try 2>/dev/null + $run ./try 2>/dev/null code="$?" $from try.out if $test ! -s try.out -a "X$code" = X42; then @@ -19685,7 +19719,7 @@ if $test "X$fflushNULL" = X -o "X$fflush '') set try -DTRY_FPRINTF if eval $compile; then - $run ./try 2>/dev/null + $run ./try 2>/dev/null code="$?" $from try.out if $test ! -s try.out -a "X$code" = X42; then @@ -19699,7 +19733,7 @@ fi case "$fflushNULL" in '') set try -DTRY_FFLUSH_NULL $output if eval $compile; then - $run ./try 2>/dev/null + $run ./try 2>/dev/null code="$?" $from try.out if $test -s try.out -a "X$code" = X42; then @@ -19730,37 +19764,44 @@ main(int argc, char **argv) int i; char *bp = buf; while (1) { - while ((i = getc(stdin)) != -1 - && (*bp++ = i) != '\n' - && bp < &buf[1024]) - /* DO NOTHING */ ; - *bp = '\0'; - fprintf(stdout, "%s", buf); - fflush(NULL); - if (i == -1) + while ((i = getc(stdin)) != -1 + && (*bp++ = i) != '\n' + && bp < &buf[1024]) + /* DO NOTHING */ ; + *bp = '\0'; + fprintf(stdout, "%s", buf); + fflush(NULL); + if (i == -1) return 0; - bp = buf; + bp = buf; } } EOCP - fflushNULL="$define" - set tryp - if eval $compile; then - $rm -f tryp.out - $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out - if cmp tryp.c tryp.out >/dev/null 2>&1; then - $cat >&4 </dev/null > tryp.out + else + $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out + fi + if cmp tryp.c tryp.out >/dev/null 2>&1; then + $cat >&4 <&4 <&4 </dev/null > tryp.out + if $test "X$targethost" != X; then + $to tryp.c + $to tryp + $run "cat tryp.c | ./tryp " 2>/dev/null > tryp.out + else + $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out + fi if cmp tryp.c tryp.out >/dev/null 2>&1; then $cat >&4 <' | $cppstdin $cppminus $cppflags 2>/dev/null | @@ -22020,7 +22067,7 @@ XPG3 XPG3_EXTENDED XPG4 XPG4_EXTENDED z8000 EOSH # Maybe put other stuff here too. -cat <>Cppsym.know +./tr '-' '_' <>Cppsym.know $osname EOSH ./tr '[a-z]' '[A-Z]' < Cppsym.know > Cppsym.a @@ -22178,50 +22225,50 @@ val="$undef" val2="$undef" val3="$undef" if $test `./findhdr termios.h`; then - set tcsetattr i_termios - eval $inlibc - val3="$i_termios" + set tcsetattr i_termios + eval $inlibc + val3="$i_termios" fi echo " " case "$val3" in -"$define") echo "You have POSIX termios.h... good!" >&4;; -*) if ./Cppsym pyr; then - case "`/bin/universe`" in + "$define") echo "You have POSIX termios.h... good!" >&4;; + *) if ./Cppsym pyr; then + case "`$run /bin/universe`" in ucb) if $test `./findhdr sgtty.h`; then - val2="$define" - echo " found." >&4 - else - echo "System is pyramid with BSD universe." - ./warn " not found--you could have problems." - fi;; - *) if $test `./findhdr termio.h`; then - val="$define" - echo " found." >&4 - else - echo "System is pyramid with USG universe." - ./warn " not found--you could have problems." - fi;; - esac - elif ./usg; then - if $test `./findhdr termio.h`; then - echo " found." >&4 - val="$define" - elif $test `./findhdr sgtty.h`; then - echo " found." >&4 val2="$define" - else - ./warn "Neither nor found--cross fingers!" - fi - else - if $test `./findhdr sgtty.h`; then echo " found." >&4 - val2="$define" - elif $test `./findhdr termio.h`; then - echo " found." >&4 + else + echo "System is pyramid with BSD universe." + ./warn " not found--you could have problems." + fi;; + *) if $test `./findhdr termio.h`; then val="$define" - else - ./warn "Neither nor found--cross fingers!" - fi + echo " found." >&4 + else + echo "System is pyramid with USG universe." + ./warn " not found--you could have problems." + fi;; + esac + elif ./usg; then + if $test `./findhdr termio.h`; then + echo " found." >&4 + val="$define" + elif $test `./findhdr sgtty.h`; then + echo " found." >&4 + val2="$define" + else + ./warn "Neither nor found--cross fingers!" + fi + else + if $test `./findhdr sgtty.h`; then + echo " found." >&4 + val2="$define" + elif $test `./findhdr termio.h`; then + echo " found." >&4 + val="$define" + else + ./warn "Neither nor found--cross fingers!" + fi fi;; esac set i_termio; eval $setvar @@ -22364,10 +22411,10 @@ esac : Check extensions echo " " echo "Looking for extensions..." >&4 -: If we are using the old config.sh, known_extensions may contain -: old or inaccurate or duplicate values. -known_extensions='' +: If we are using the old config.sh, nonxs_extensions and xs_extensions may +: contain old or inaccurate or duplicate values. nonxs_extensions='' +xs_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 @@ -22384,51 +22431,38 @@ find_extensions=' DynaLoader|dynaload) ;; *) this_ext=`echo $xxx | $sed -e s/-/\\\//g`; - leaf=`echo $xxx | $sed -e s/.*-//`; - if $test -d File; then - if $test -f $xxx/$leaf.xs -o -f $xxx/$leaf.c; then - known_extensions="$known_extensions $1$this_ext"; - elif $test -f $xxx/Makefile.PL; then - nonxs_extensions="$nonxs_extensions $1$this_ext"; - else - if $test -d $xxx -a $# -lt 10; then - set $1$xxx/ $*; - cd "$xxx"; - eval $find_extensions; - cd ..; - shift; - fi; - fi; - else - echo " $known_extensions $nonxs_extensions" > $tdir/$$.tmp; - if $contains " $this_ext " $tdir/$$.tmp; then - echo >&4; - echo "Duplicate directories detected for extension $xxx" >&4; - echo "Configure cannot correctly recover from this - shall I abort?" >&4; - case "$knowitall" in - "") dflt=y;; - *) dflt=n;; - esac; - . ../UU/myread; - case "$ans" in - n*|N*) ;; - *) echo >&4; - echo "Ok. Stopping Configure." >&4; - echo "Please remove the duplicate directory (e.g. using git clean) and then re-run Configure" >&4; - exit 1;; - esac; - echo "Ok. You will need to correct config.sh before running make." >&4; - fi; - $ls -1 $xxx > $tdir/$$.tmp; - if $contains "\.xs$" $tdir/$$.tmp > /dev/null 2>&1; then - known_extensions="$known_extensions $this_ext"; - elif $contains "\.c$" $tdir/$$.tmp > /dev/null 2>&1; then - known_extensions="$known_extensions $this_ext"; - elif $test -d $xxx; then - nonxs_extensions="$nonxs_extensions $this_ext"; - fi; - $rm -f $tdir/$$.tmp; - fi + case "$this_ext" in + Scalar/List/Utils) this_ext="List/Util" ;; + PathTools) this_ext="Cwd" ;; + esac; + echo " $xs_extensions $nonxs_extensions" > $tdir/$$.tmp; + if $contains " $this_ext " $tdir/$$.tmp; then + echo >&4; + echo "Duplicate directories detected for extension $xxx" >&4; + echo "Configure cannot correctly recover from this - shall I abort?" >&4; + case "$knowitall" in + "") dflt=y;; + *) dflt=n;; + esac; + . ../UU/myread; + case "$ans" in + n*|N*) ;; + *) echo >&4; + echo "Ok. Stopping Configure." >&4; + echo "Please remove the duplicate directory (e.g. using git clean) and then re-run Configure" >&4; + exit 1;; + esac; + echo "Ok. You will need to correct config.sh before running make." >&4; + fi; + $ls -1 $xxx > $tdir/$$.tmp; + if $contains "\.xs$" $tdir/$$.tmp > /dev/null 2>&1; then + xs_extensions="$xs_extensions $this_ext"; + elif $contains "\.c$" $tdir/$$.tmp > /dev/null 2>&1; then + xs_extensions="$xs_extensions $this_ext"; + elif $test -d $xxx; then + nonxs_extensions="$nonxs_extensions $this_ext"; + fi; + $rm -f $tdir/$$.tmp; ;; esac; done' @@ -22445,27 +22479,18 @@ cd "$rsrc/ext" set X shift eval $find_extensions -if $test -d File-Glob; then - : All ext/ flattened -else - # Special case: Add in modules that nest beyond the first level. - # Currently threads/shared and Hash/Util/FieldHash, since they are - # not picked up by the recursive find above (and adding in general - # recursive finding breaks SDBM_File/sdbm). - # A.D. 20011025 (SDBM), ajgough 20071008 (FieldHash) - known_extensions="$known_extensions threads/shared Hash/Util/FieldHash" -fi -set X $known_extensions +set X $xs_extensions shift -known_extensions=`echo "$*" | tr ' ' $trnl | $sort | tr $trnl ' '` +xs_extensions=`echo "$*" | tr ' ' $trnl | $sort | tr $trnl ' '` set X $nonxs_extensions shift nonxs_extensions=`echo "$*" | tr ' ' $trnl | $sort | tr $trnl ' '` cd "$tdir" +known_extensions=`echo $nonxs_extensions $xs_extensions | tr ' ' $trnl | $sort | tr $trnl ' '` : Now see which are supported on this system. avail_ext='' -for xxx in $known_extensions ; do +for xxx in $xs_extensions ; do case "$xxx" in DB_File|db_file) case "$i_db" in @@ -22632,6 +22657,8 @@ for xxx in $nonxs_extensions ; do case "$xxx" in CVS|RCS|SCCS|.svn) ;; + VMS*) + ;; *) nonxs_ext="$nonxs_ext $xxx" ;; esac @@ -22770,6 +22797,7 @@ case " $static_ext " in cd "$rsrc/cpan" for xxx in `ls Encode/*/Makefile.PL|awk -F/ '{print $2}'`; do static_ext="$static_ext Encode/$xxx" + known_extensions="$known_extensions Encode/$xxx" done cd "$tdir" ;; @@ -23182,11 +23210,13 @@ d_killpg='$d_killpg' d_lchown='$d_lchown' d_ldbl_dig='$d_ldbl_dig' d_libm_lib_version='$d_libm_lib_version' +d_libname_unique='$d_libname_unique' d_link='$d_link' d_localtime64='$d_localtime64' d_localtime_r='$d_localtime_r' d_localtime_r_needs_tzset='$d_localtime_r_needs_tzset' d_locconv='$d_locconv' +d_lc_monetary_2008='$d_lc_monetary_2008' d_lockf='$d_lockf' d_longdbl='$d_longdbl' d_longlong='$d_longlong' @@ -23323,7 +23353,6 @@ d_setsent='$d_setsent' d_setservent_r='$d_setservent_r' d_setsid='$d_setsid' d_setvbuf='$d_setvbuf' -d_sfio='$d_sfio' d_shm='$d_shm' d_shmat='$d_shmat' d_shmatprototype='$d_shmatprototype' @@ -23435,7 +23464,6 @@ db_prefixtype='$db_prefixtype' db_version_major='$db_version_major' db_version_minor='$db_version_minor' db_version_patch='$db_version_patch' -defvoidused='$defvoidused' direntrytype='$direntrytype' dlext='$dlext' dlsrc='$dlsrc' @@ -23512,6 +23540,9 @@ h_fcntl='$h_fcntl' h_sysfile='$h_sysfile' hint='$hint' hostcat='$hostcat' +hostgenerate='$hostgenerate' +hostosname='$hostosname' +hostperl='$hostperl' html1dir='$html1dir' html1direxp='$html1direxp' html3dir='$html3dir' @@ -23531,7 +23562,6 @@ i_crypt='$i_crypt' i_db='$i_db' i_dbm='$i_dbm' i_dirent='$i_dirent' -i_dld='$i_dld' i_dlfcn='$i_dlfcn' i_fcntl='$i_fcntl' i_float='$i_float' @@ -23563,7 +23593,6 @@ i_prot='$i_prot' i_pthread='$i_pthread' i_pwd='$i_pwd' i_rpcsvcdbm='$i_rpcsvcdbm' -i_sfio='$i_sfio' i_sgtty='$i_sgtty' i_shadow='$i_shadow' i_socks='$i_socks' @@ -23616,6 +23645,7 @@ ignore_versioned_solibs='$ignore_version inc_version_list='$inc_version_list' inc_version_list_init='$inc_version_list_init' incpath='$incpath' +incpth='$incpth' inews='$inews' initialinstalllocation='$initialinstalllocation' installarchlib='$installarchlib' @@ -23883,9 +23913,16 @@ strings='$strings' submit='$submit' subversion='$subversion' sysman='$sysman' +sysroot='$sysroot' tail='$tail' tar='$tar' targetarch='$targetarch' +targetdir='$targetdir' +targetenv='$targetenv' +targethost='$targethost' +targetmkdir='$targetmkdir' +targetport='$targetport' +targetsh='$targetsh' tbl='$tbl' tee='$tee' test='$test' @@ -23936,7 +23973,6 @@ useperlio='$useperlio' useposix='$useposix' usereentrant='$usereentrant' userelocatableinc='$userelocatableinc' -usesfio='$usesfio' useshrplib='$useshrplib' usesitecustomize='$usesitecustomize' usesocks='$usesocks' @@ -23976,7 +24012,6 @@ version='$version' version_patchlevel_string='$version_patchlevel_string' versiononly='$versiononly' vi='$vi' -voidflags='$voidflags' xlibpth='$xlibpth' yacc='$yacc' yaccflags='$yaccflags' Index: gnu/usr.bin/perl/DynaLoader.sed =================================================================== RCS file: /mnt/memory/perl/importit/cvs/src/gnu/usr.bin/perl/DynaLoader.sed,v retrieving revision 1.3 diff -u -p -u -p -r1.3 DynaLoader.sed --- gnu/usr.bin/perl/DynaLoader.sed 24 Mar 2014 15:05:12 -0000 1.3 +++ gnu/usr.bin/perl/DynaLoader.sed 16 Nov 2014 03:22:23 -0000 @@ -1,6 +1,6 @@ s@"dlutils.c"@"ext/DynaLoader/dlutils.c"@ /^#ifndef RTLD_LAZY/{N;N;c\ -#define VERSION "1.18"\ -#define XS_VERSION "1.18"\ +#define VERSION "1.19"\ +#define XS_VERSION "1.19"\ #define DLOPEN_WONT_DO_RELATIVE_PATHS } Index: gnu/usr.bin/perl/INSTALL =================================================================== RCS file: /mnt/memory/perl/importit/cvs/src/gnu/usr.bin/perl/INSTALL,v retrieving revision 1.15 diff -u -p -u -p -r1.15 INSTALL --- gnu/usr.bin/perl/INSTALL 24 Mar 2014 15:05:12 -0000 1.15 +++ gnu/usr.bin/perl/INSTALL 16 Nov 2014 03:22:23 -0000 @@ -563,7 +563,7 @@ The directories set up by Configure fall =item Directories for the perl distribution -By default, Configure will use the following directories for 5.18.2. +By default, Configure will use the following directories for 5.20.1. $version is the full perl version number, including subversion, e.g. 5.12.3, and $archname is a string like sun4-sunos, determined by Configure. The full definitions of all Configure @@ -1090,6 +1090,17 @@ system. =back +=head2 Specifying a logical root directory + +If you are cross-compiling, or are using a compiler which has it's own +headers and libraries in a nonstandard location, and your compiler +understands the C<--sysroot> option, you can use the C<-Dsysroot> option to +specify the logical root directory under which all libraries and headers +are searched for. This patch adjusts Configure to search under $sysroot, instead of /. + +--sysroot is added to ccflags and friends so that make in +ExtUtils::MakeMaker, and other extensions, will use it. + =head2 Overriding an old config.sh If you want to use an old config.sh produced by a previous run of @@ -1596,14 +1607,31 @@ and start from the very beginning. This what you are doing, accept the default list of libraries suggested by Configure. +If the libs variable is missing -lm, there is a chance that libm.so.1 +is available, but the required (symbolic) link to libm.so is missing. +(same could be the case for other libraries like libcrypt.so). You +should check your installation for packages that create that link, and +if no package is installed that supplies that link or you cannot install +them, make the symbolic link yourself e.g.: + + $ rpm -qf /usr/lib64/libm.so + glibc-devel-2.15-22.17.1.x86_64 + $ ls -lgo /usr/lib64/libm.so + lrwxrwxrwx 1 16 Jan 7 2013 /usr/lib64/libm.so -> /lib64/libm.so.6 + + or + + $ sudo ln -s /lib64/libm.so.6 /lib64/libm.so + If the libs variable looks correct, you might have the L<"nm extraction"> problem discussed above. If you still have missing routines or undefined symbols, you probably -need to add some library or other, or you need to undefine some feature -that Configure thought was there but is defective or incomplete. If -you used a hint file, see if it has any relevant advice. You can also -look through through config.h for likely suspects. +need to add some library or other, make a symbolic link like described +above, or you need to undefine some feature that Configure thought was +there but is defective or incomplete. If you used a hint file, see if +it has any relevant advice. You can also look through through config.h +for likely suspects. =item toke.c @@ -1748,19 +1776,20 @@ to avoid the BIND. =head2 Cross-compilation Perl can be cross-compiled. It is just not trivial, cross-compilation -rarely is. Perl is routinely cross-compiled for many platforms (as of -June 2005 at least PocketPC aka WinCE, Open Zaurus, Symbian, and -the IBM OS/400). These platforms are known as the B platforms, -while the systems where the compilation takes place are the B -platforms. +rarely is. Perl is routinely cross-compiled for several platforms: as of +January 2014, these include Android, Blackberry 10, PocketPC aka +WinCE, ARM Linux, and Solaris. Previous versions of +Perl also provided support for Open Zaurus, Symbian, and +the IBM OS/400, but it's unknown if those ports are still functional. +These platforms are known as the B platforms, while the systems where the compilation takes place are the B platforms. What makes the situation difficult is that first of all, cross-compilation environments vary significantly in how they are set up and used, and secondly because the primary way of configuring Perl (using the rather large Unix-tool-dependent Configure script) is not awfully well suited for cross-compilation. However, starting from -version 5.8.0, the Configure script also knows one way of supporting -cross-compilation support, so please keep reading. +version 5.18.0, the Configure script also knows two ways of supporting +cross-compilation, so please keep reading. See the following files for more information about compiling Perl for the particular platforms: @@ -1769,19 +1798,23 @@ the particular platforms: =item WinCE/PocketPC -README.ce +L -=item Open Zaurus +=item Android -Cross/README +L<"Cross-compilation" in README.android or perlandroid|perlandroid/Cross-compilation> -=item Symbian +=item Blackberry -README.symbian +L<"Cross-compilation" in README.qnx or perlqnx|perlqnx/Cross-compilation> -=item OS/400 +=item Solaris -README.os400 +L<"CROSS-COMPILATION" in README.solaris or perlsolaris|perlsolaris/CROSS-COMPILATION> + +=item Linux + +This document; See below. =back @@ -1796,28 +1829,25 @@ For some cross-compilation environments C<-Dinstallprefix=...> might be handy, see L. -About the cross-compilation support of Configure: what is known to -work is running Configure in a cross-compilation environment and -building the miniperl executable. What is known not to work is -building the perl executable because that would require building -extensions: Dynaloader statically and File::Glob dynamically, for -extensions one needs MakeMaker and MakeMaker is not yet -cross-compilation aware, and neither is the main Makefile. - -The cross-compilation setup of Configure has successfully been used in -at least two Linux cross-compilation environments. The setups were -both such that the host system was Intel Linux with a gcc built for -cross-compiling into ARM Linux, and there was a SSH connection to the -target system. +About the cross-compilation support of Configure: There's two forms. +The more common one requires some way of transferring and running executables +in the target system, such as an ssh connection; this is the +C<./Configure -Dusecrosscompile -Dtargethost=...> route. The second method +doesn't need access to the target system, but requires you to provide +a config.sh, and and a canned Makefile; the rest of this section describes +the former. + +This cross-compilation setup of Configure has successfully been used in +a wide variety of setups, such as a 64-bit OS X host for an Android ARM target, or +an amd64 Linux host targeting x86 Solaris, or even Windows. To run Configure in cross-compilation mode the basic switch that -has to be used is C<-Dusecrosscompile>. +has to be used is C<-Dusecrosscompile>: sh ./Configure -des -Dusecrosscompile -D... This will make the cpp symbol USE_CROSS_COMPILE and the %Config -symbol C available, and C will be used -for cross-compilation. +symbol C available. During the Configure and build, certain helper scripts will be created into the Cross/ subdirectory. The scripts are used to execute a @@ -1840,28 +1870,49 @@ You can also specify a username to use f -Dtargetuser=luser -but in case you don't, "root" will be used. +but in case you don't, "root" will be used. Similarly, you can specify +a non-standard (i.e. not 22) port for the connection, if applicable, through -Because this is a cross-compilation effort, you will also need to specify -which target environment and which compilation environment to use. -This includes the compiler, the header files, and the libraries. -In the below we use the usual settings for the iPAQ cross-compilation -environment: + -Dtargetport=2222 + +If the name of C has the usual GNU C semantics for cross +compilers, that is, CPU-OS-gcc, the target architecture (C), +plus names of the C, C, and C will also be automatically +chosen to be CPU-OS-ar and so on. +(The C requires more thought and will be chosen later by Configure +as appropriate). This will also aid in guessing the proper +operating system name for the target, which has other repercussions, like +better defaults and possibly critical fixes for the platform. If Configure +isn't guessing the OS name properly, you may need to either add a hint file +redirecting Configure's guess, or modify Configure to make the correct choice. + +If your compiler doesn't follow that convention, you will also need to +specify which target environment to use, as well as C and friends: -Dtargetarch=arm-linux - -Dcc=arm-linux-gcc + -Dcc=mycrossgcc + -Dar=... + +Additionally, a cross-compilation toolchain will usually install it's own +logical system root somewhere -- that is, it'll create a directory somewhere +which includes subdirectories like 'include' or 'lib'. For example, you +may end up with C, where +C holds the binaries for cross-compilation, +C has the headers, and +C has the library files. +If this is the case, and you are using a compiler that understands +C<--sysroot>, like gcc or clang, you'll want to specify the +C<-Dsysroot> option for Configure: + + -Dsysroot=/skiff/local/arm-linux + +However, if your don't have a suitable directory to pass to C<-Dsysroot>, +you will also need to specify which target environment to use: + -Dusrinc=/skiff/local/arm-linux/include -Dincpth=/skiff/local/arm-linux/include -Dlibpth=/skiff/local/arm-linux/lib -If the name of the C has the usual GNU C semantics for cross -compilers, that is, CPU-OS-gcc, the names of the C, C, and -C will also be automatically chosen to be CPU-OS-ar and so on. -(The C requires more thought and will be chosen later by Configure -as appropriate.) Also, in this case the incpth, libpth, and usrinc -will be guessed by Configure (unless explicitly set to something else, -in which case Configure's guesses with be appended). - In addition to the default execution/transfer methods you can also choose B for execution, and B or B for transfer, for example: @@ -1872,13 +1923,11 @@ Putting it all together: sh ./Configure -des -Dusecrosscompile \ -Dtargethost=so.me.ho.st \ - -Dtargetdir=/tar/get/dir \ + -Dtargetdir=/tar/get/dir \ -Dtargetuser=root \ -Dtargetarch=arm-linux \ -Dcc=arm-linux-gcc \ - -Dusrinc=/skiff/local/arm-linux/include \ - -Dincpth=/skiff/local/arm-linux/include \ - -Dlibpth=/skiff/local/arm-linux/lib \ + -Dsysroot=/skiff/local/arm-linux \ -D... or if you are happy with the defaults: @@ -1894,9 +1943,33 @@ F: sh ./Configure -des -Dusecrosscompile \ -Dtargethost=so.me.ho.st \ -Dcc=/usr/local/arm/2.95.5/bin/arm-linux-gcc \ - -Dincpth=/usr/local/arm/2.95.5/include \ - -Dusrinc=/usr/local/arm/2.95.5/include \ - -Dlibpth=/usr/local/arm/2.95.5/lib + -Dsysroot=/usr/local/arm/2.95.5 + +There is also a C option for Configure which can be used +to modify the environment of the target just before testing begins +during 'make test'. For example, if the target system has a nonstandard +/tmp location, you could do this: + + -Dtargetenv="export TMPDIR=/other/tmp;" + +If you are planning on cross-compiling to several platforms, or some other +thing that would involve running Configure several times, there are two +options that can be used to speed things up considerably. +As a bit of background, when you +call Configure with C<-Dusecrosscompile>, it begins by actually partially +building a miniperl on the host machine, as well as the generate_uudmap +binary, and we end up using that during the build. +So instead of building that new perl every single time, you can build it just +once in a separate directory, and then pass the resulting binaries to +Configure like this: + + -Dhostperl=/path/to/second/build/dir/miniperl + -Dhostgenerate=/path/to/second/build/dir/generate_uudmap + +Much less commonly, if you are cross-compiling from an ASCII host to an +EBCDIC target, or vise versa, you'll have to pass C<-Uhostgenerate> to +Configure, to signify that you want to build a generate_uudmap binary +that, during make, will be run on the target system. =head1 make test @@ -2137,9 +2210,6 @@ make install will install the following: different versions of perl. cpan The CPAN shell. - cpan2dist The CPANPLUS distribution creator. - cpanp The CPANPLUS shell. - cpanp-run-perl A helper for cpanp. enc2xs Encoding module generator. find2perl find-to-perl translator. h2ph Extract constants and simple macros from C @@ -2154,7 +2224,6 @@ make install will install the following: utility iconv. pl2pm Convert Perl 4 .pl files to Perl 5 .pm modules. pod2html, Converters from perl's pod documentation format - pod2latex, to other useful formats. pod2man, pod2text, pod2usage @@ -2275,7 +2344,9 @@ or make realclean The only difference between the two is that make distclean also removes -your old config.sh and Policy.sh files. +your old config.sh and Policy.sh files. (A plain 'make clean' will not +delete the makefiles used for rebuilding perl, and will also not delete +a number of library and utility files extracted during the build process.) If you are upgrading from a previous version of perl, or if you change systems or compilers or make other significant changes, or if @@ -2346,7 +2417,7 @@ http://www.chiark.greenend.org.uk/~sgtat =head1 Coexistence with earlier versions of perl 5 -Perl 5.18.2 is not binary compatible with earlier versions of Perl. +Perl 5.20.1 is not binary compatible with earlier versions of Perl. In other words, you will have to recompile your XS modules. In general, you can usually safely upgrade from one version of Perl (e.g. @@ -2420,9 +2491,9 @@ won't interfere with another version. ( libraries after 5.6.0, but not for executables. TODO?) One convenient way to do this is by using a separate prefix for each version, such as - sh Configure -Dprefix=/opt/perl5.18.2 + sh Configure -Dprefix=/opt/perl5.20.1 -and adding /opt/perl5.18.2/bin to the shell PATH variable. Such users +and adding /opt/perl5.20.1/bin to the shell PATH variable. Such users may also wish to add a symbolic link /usr/local/bin/perl so that scripts can still start with #!/usr/local/bin/perl. @@ -2435,13 +2506,13 @@ seriously consider using a separate dire subversions may not have all the compatibility wrinkles ironed out yet. -=head2 Upgrading from 5.17.11 or earlier +=head2 Upgrading from 5.19.0 or earlier -B Perl modules having binary parts (meaning that a C compiler is used) will have to be recompiled to be -used with 5.18.2. If you find you do need to rebuild an extension with -5.18.2, you may safely do so without disturbing the older +used with 5.20.1. If you find you do need to rebuild an extension with +5.20.1, you may safely do so without disturbing the older installations. (See L<"Coexistence with earlier versions of perl 5"> above.) @@ -2474,15 +2545,15 @@ Firstly, the bare minimum to run this sc print("$f\n"); } -in Linux with perl-5.18.2 is as follows (under $Config{prefix}): +in Linux with perl-5.20.1 is as follows (under $Config{prefix}): ./bin/perl - ./lib/perl5/5.18.2/strict.pm - ./lib/perl5/5.18.2/warnings.pm - ./lib/perl5/5.18.2/i686-linux/File/Glob.pm - ./lib/perl5/5.18.2/feature.pm - ./lib/perl5/5.18.2/XSLoader.pm - ./lib/perl5/5.18.2/i686-linux/auto/File/Glob/Glob.so + ./lib/perl5/5.20.1/strict.pm + ./lib/perl5/5.20.1/warnings.pm + ./lib/perl5/5.20.1/i686-linux/File/Glob.pm + ./lib/perl5/5.20.1/feature.pm + ./lib/perl5/5.20.1/XSLoader.pm + ./lib/perl5/5.20.1/i686-linux/auto/File/Glob/Glob.so Secondly, for perl-5.10.1, the Debian perl-base package contains 591 files, (of which 510 are for lib/unicore) totaling about 3.5MB in its i386 version. Index: gnu/usr.bin/perl/MANIFEST =================================================================== RCS file: /mnt/memory/perl/importit/cvs/src/gnu/usr.bin/perl/MANIFEST,v retrieving revision 1.30 diff -u -p -u -p -r1.30 MANIFEST --- gnu/usr.bin/perl/MANIFEST 26 Oct 2014 22:04:16 -0000 1.30 +++ gnu/usr.bin/perl/MANIFEST 16 Nov 2014 03:22:23 -0000 @@ -3,6 +3,7 @@ AUTHORS Contact info for contributors autodoc.pl Creates pod/perlintern.pod and pod/perlapi.pod av.c Array value code av.h Array value header +caretx.c C file to create $^X cflags.SH A script that emits C compilation flags per file Changes Describe how to peruse changes between releases charclass_invlists.h Compiled-in inversion lists @@ -14,36 +15,6 @@ configure.com Configure-equivalent for configure.gnu Crude emulation of GNU configure cop.h Control operator header Copying The GNU General Public License -cpan/Archive-Extract/lib/Archive/Extract.pm Archive::Extract -cpan/Archive-Extract/t/01_Archive-Extract.t Archive::Extract tests -cpan/Archive-Extract/t/src/double_dir.zip Archive::Extract tests -cpan/Archive-Extract/t/src/x.bz2 Archive::Extract tests -cpan/Archive-Extract/t/src/x.ear Archive::Extract tests -cpan/Archive-Extract/t/src/x.gz Archive::Extract tests -cpan/Archive-Extract/t/src/x.jar Archive::Extract tests -cpan/Archive-Extract/t/src/x.lzma Archive::Extract tests -cpan/Archive-Extract/t/src/x.par Archive::Extract tests -cpan/Archive-Extract/t/src/x.tar Archive::Extract tests -cpan/Archive-Extract/t/src/x.tar.gz Archive::Extract tests -cpan/Archive-Extract/t/src/x.tar.xz Archive::Extract tests -cpan/Archive-Extract/t/src/x.tgz Archive::Extract tests -cpan/Archive-Extract/t/src/x.txz Archive::Extract tests -cpan/Archive-Extract/t/src/x.war Archive::Extract tests -cpan/Archive-Extract/t/src/x.xz Archive::Extract tests -cpan/Archive-Extract/t/src/x.Z Archive::Extract tests -cpan/Archive-Extract/t/src/x.zip Archive::Extract tests -cpan/Archive-Extract/t/src/y.ear Archive::Extract tests -cpan/Archive-Extract/t/src/y.jar Archive::Extract tests -cpan/Archive-Extract/t/src/y.par Archive::Extract tests -cpan/Archive-Extract/t/src/y.tar Archive::Extract tests -cpan/Archive-Extract/t/src/y.tar.bz2 Archive::Extract tests -cpan/Archive-Extract/t/src/y.tar.gz Archive::Extract tests -cpan/Archive-Extract/t/src/y.tar.xz Archive::Extract tests -cpan/Archive-Extract/t/src/y.tbz Archive::Extract tests -cpan/Archive-Extract/t/src/y.tgz Archive::Extract tests -cpan/Archive-Extract/t/src/y.txz Archive::Extract tests -cpan/Archive-Extract/t/src/y.war Archive::Extract tests -cpan/Archive-Extract/t/src/y.zip Archive::Extract tests cpan/Archive-Tar/bin/ptar the ptar utility cpan/Archive-Tar/bin/ptardiff the ptardiff utility cpan/Archive-Tar/bin/ptargrep the ptardiff utility @@ -73,8 +44,11 @@ cpan/autodie/lib/autodie/exception.pm E cpan/autodie/lib/autodie/exception/system.pm Exception class for autodying system() cpan/autodie/lib/autodie/hints.pm Hinting interface for autodie cpan/autodie/lib/autodie.pm Functions succeed or die with lexical scope +cpan/autodie/lib/autodie/skip.pm cpan/autodie/lib/Fatal.pm Make errors in functions/builtins fatal cpan/autodie/t/00-load.t autodie - basic load +cpan/autodie/t/args.t +cpan/autodie/t/autodie_skippy.pm cpan/autodie/t/autodie.t autodie - Basic functionality cpan/autodie/t/autodie_test_module.pm autodie - test helper cpan/autodie/t/backcompat.t autodie - More Fatal backcompat @@ -82,8 +56,11 @@ cpan/autodie/t/basic_exceptions.t autodi cpan/autodie/t/binmode.t autodie - Binmode testing cpan/autodie/t/blog_hints.t autodie - Tests fro PJF's blog cpan/autodie/t/caller.t autodie - Caller diagnostics +cpan/autodie/t/chmod.t +cpan/autodie/t/chown.t cpan/autodie/t/context_lexical.t autodie - Context clobbering lexically cpan/autodie/t/context.t autodie - Context clobbering tests +cpan/autodie/t/core-trampoline-slurp.t cpan/autodie/t/crickey.t autodie - Like an Australian cpan/autodie/t/dbmopen.t autodie - dbm tests cpan/autodie/t/eval_error.t @@ -103,6 +80,7 @@ cpan/autodie/t/hints_provider_isa.t auto cpan/autodie/t/hints.t autodie - Test hints interface cpan/autodie/t/internal-backcompat.t autodie - Back-compatibility tests cpan/autodie/t/internal.t autodie - internal interface tests +cpan/autodie/t/kill.t cpan/autodie/t/lethal.t autodie - lethal is the one true name cpan/autodie/t/lib/autodie/test/au/exception.pm autodie - Australian helper cpan/autodie/t/lib/autodie/test/au.pm autodie - Australian helper @@ -121,17 +99,24 @@ cpan/autodie/t/lib/pujHa/ghach/Dotlh.pm cpan/autodie/t/lib/pujHa/ghach.pm autodie - Like a Klingon cpan/autodie/t/lib/Some/Module.pm autodie - blog_hints.t helper cpan/autodie/t/mkdir.t autodie - filesystem tests +cpan/autodie/t/no_carp.t cpan/autodie/t/open.t autodie - Testing open cpan/autodie/t/recv.t autodie - send/recv tests cpan/autodie/t/repeat.t autodie - repeat autodie leak tests +cpan/autodie/t/rt-74246.t cpan/autodie/t/scope_leak.t autodie - file scope leak tests +cpan/autodie/t/skip.t cpan/autodie/t/string-eval-basic.t autodie - Basic string eval test cpan/autodie/t/string-eval-leak.t autodie - String eval leak test cpan/autodie/t/sysopen.t autodie - sysopen tests +cpan/autodie/t/touch_me +cpan/autodie/t/truncate_me cpan/autodie/t/truncate.t autodie - File truncation tests cpan/autodie/t/unlink.t autodie - Unlink system tests. cpan/autodie/t/user-context.t autodie - Context changes for usersubs cpan/autodie/t/usersub.t autodie - user subroutine tests +cpan/autodie/t/utf8_open.t +cpan/autodie/t/utime.t cpan/autodie/t/version.t autodie - versioning tests cpan/autodie/t/version_tag.t cpan/AutoLoader/lib/AutoLoader.pm Autoloader base class @@ -140,32 +125,6 @@ cpan/AutoLoader/t/01AutoLoader.t See if cpan/AutoLoader/t/02AutoSplit.t See if AutoSplit works cpan/B-Debug/Debug.pm Compiler Debug backend cpan/B-Debug/t/debug.t See if B::Debug works -cpan/B-Lint/lib/B/Lint/Debug.pm Adds debugging stringification to B:: -cpan/B-Lint/lib/B/Lint.pm Compiler Lint backend -cpan/B-Lint/t/lint.t See if B::Lint works -cpan/B-Lint/t/pluglib/B/Lint/Plugin/Test.pm See if B::Lint works -cpan/CGI/Changes Changelog for CGI.pm -cpan/CGI/examples/caution.xbm CGI example -cpan/CGI/examples/clickable_image.cgi CGI example -cpan/CGI/examples/cookie.cgi CGI example -cpan/CGI/examples/crash.cgi CGI example -cpan/CGI/examples/customize.cgi CGI example -cpan/CGI/examples/diff_upload.cgi CGI example -cpan/CGI/examples/dna.small.gif Small image for CGI examples -cpan/CGI/examples/file_upload.cgi CGI example -cpan/CGI/examples/frameset.cgi CGI example -cpan/CGI/examples/index.html Index page for CGI examples -cpan/CGI/examples/internal_links.cgi CGI example -cpan/CGI/examples/javascript.cgi CGI example -cpan/CGI/examples/make_links.pl CGI example -cpan/CGI/examples/monty.cgi CGI example -cpan/CGI/examples/multiple_forms.cgi CGI example -cpan/CGI/examples/nph-clock.cgi CGI example -cpan/CGI/examples/nph-multipart.cgi CGI example -cpan/CGI/examples/popup.cgi CGI example -cpan/CGI/examples/save_state.cgi CGI example -cpan/CGI/examples/tryit.cgi CGI example -cpan/CGI/examples/wilogo.gif CGI example cpan/CGI/lib/CGI/Apache.pm Support for Apache's Perl module cpan/CGI/lib/CGI/Carp.pm Log server errors with helpful context cpan/CGI/lib/CGI/Cookie.pm Interface to Netscape Cookies @@ -228,34 +187,30 @@ cpan/Compress-Raw-Bzip2/bzip2-src/huffma cpan/Compress-Raw-Bzip2/bzip2-src/LICENSE cpan/Compress-Raw-Bzip2/bzip2-src/randtable.c cpan/Compress-Raw-Bzip2/Bzip2.xs -cpan/Compress-Raw-Bzip2/Changes cpan/Compress-Raw-Bzip2/fallback/constants.h cpan/Compress-Raw-Bzip2/fallback/constants.xs cpan/Compress-Raw-Bzip2/lib/Compress/Raw/Bzip2.pm cpan/Compress-Raw-Bzip2/Makefile.PL cpan/Compress-Raw-Bzip2/private/MakeUtil.pm -cpan/Compress-Raw-Bzip2/README cpan/Compress-Raw-Bzip2/t/000prereq.t cpan/Compress-Raw-Bzip2/t/01bzip2.t cpan/Compress-Raw-Bzip2/t/09limitoutput.t +cpan/Compress-Raw-Bzip2/t/19nonpv.t cpan/Compress-Raw-Bzip2/t/99pod.t cpan/Compress-Raw-Bzip2/t/compress/CompTestUtils.pm cpan/Compress-Raw-Bzip2/typemap -cpan/Compress-Raw-Zlib/Changes Compress::Raw::Zlib cpan/Compress-Raw-Zlib/config.in Compress::Raw::Zlib -cpan/Compress-Raw-Zlib/examples/filtdef Compress::Raw::Zlib -cpan/Compress-Raw-Zlib/examples/filtinf Compress::Raw::Zlib cpan/Compress-Raw-Zlib/fallback/constants.h Compress::Raw::Zlib cpan/Compress-Raw-Zlib/fallback/constants.xs Compress::Raw::Zlib cpan/Compress-Raw-Zlib/lib/Compress/Raw/Zlib.pm Compress::Raw::Zlib cpan/Compress-Raw-Zlib/Makefile.PL Compress::Raw::Zlib cpan/Compress-Raw-Zlib/private/MakeUtil.pm Compress::Raw::Zlib -cpan/Compress-Raw-Zlib/README Compress::Raw::Zlib cpan/Compress-Raw-Zlib/t/01version.t Compress::Raw::Zlib cpan/Compress-Raw-Zlib/t/02zlib.t Compress::Raw::Zlib cpan/Compress-Raw-Zlib/t/07bufsize.t Compress::Raw::Zlib cpan/Compress-Raw-Zlib/t/09limitoutput.t Compress::Raw::Zlib cpan/Compress-Raw-Zlib/t/18lvalue.t Compress::Raw::Zlib +cpan/Compress-Raw-Zlib/t/19nonpv.t cpan/Compress-Raw-Zlib/t/compress/CompTestUtils.pm cpan/Compress-Raw-Zlib/typemap Compress::Raw::Zlib cpan/Compress-Raw-Zlib/zlib-src/adler32.c Compress::Raw::Zlib @@ -280,12 +235,18 @@ cpan/Compress-Raw-Zlib/zlib-src/zlib.h cpan/Compress-Raw-Zlib/zlib-src/zutil.c Compress::Raw::Zlib cpan/Compress-Raw-Zlib/zlib-src/zutil.h Compress::Raw::Zlib cpan/Compress-Raw-Zlib/Zlib.xs Compress::Raw::Zlib -cpan/Config-Perl-V/t/00_pod.t Config::Perl::V -cpan/Config-Perl-V/t/01_pod.t Config::Perl::V cpan/Config-Perl-V/t/10_base.t Config::Perl::V -cpan/Config-Perl-V/t/20_plv.t Config::Perl::V +cpan/Config-Perl-V/t/20_plv56.t Config::Perl::V +cpan/Config-Perl-V/t/21_plv58.t Config::Perl::V +cpan/Config-Perl-V/t/22_plv510.t Config::Perl::V +cpan/Config-Perl-V/t/23_plv512.t Config::Perl::V +cpan/Config-Perl-V/t/24_plv514.t Config::Perl::V +cpan/Config-Perl-V/t/25_plv5162.t Config::Perl::V +cpan/Config-Perl-V/t/25_plv516.t Config::Perl::V +cpan/Config-Perl-V/t/26_plv5182.t Config::Perl::V +cpan/Config-Perl-V/t/26_plv518.t Config::Perl::V +cpan/Config-Perl-V/t/27_plv5200.t Config::Perl::V cpan/Config-Perl-V/V.pm Config::Perl::V -cpan/CPAN/Changes CPAN.pm Changes file cpan/CPAN/lib/App/Cpan.pm helper package for CPAN.pm cpan/CPAN/lib/CPAN/API/HOWTO.pod recipe book for programming with CPAN.pm cpan/CPAN/lib/CPAN/Author.pm helper package for CPAN.pm @@ -323,7 +284,6 @@ cpan/CPAN/lib/CPAN/Shell.pm cpan/CPAN/lib/CPAN/Tarzip.pm helper package for CPAN.pm cpan/CPAN/lib/CPAN/URL.pm cpan/CPAN/lib/CPAN/Version.pm Simple math with different flavors of version strings -cpan/CPAN-Meta/Changes cpan/CPAN-Meta/lib/CPAN/Meta/Converter.pm cpan/CPAN-Meta/lib/CPAN/Meta/Feature.pm cpan/CPAN-Meta/lib/CPAN/Meta/History.pm @@ -331,7 +291,6 @@ cpan/CPAN-Meta/lib/CPAN/Meta.pm cpan/CPAN-Meta/lib/CPAN/Meta/Prereqs.pm cpan/CPAN-Meta/lib/CPAN/Meta/Spec.pm cpan/CPAN-Meta/lib/CPAN/Meta/Validator.pm -cpan/CPAN-Meta-Requirements/Changes cpan/CPAN-Meta-Requirements/lib/CPAN/Meta/Requirements.pm cpan/CPAN-Meta-Requirements/t/accepts.t cpan/CPAN-Meta-Requirements/t/bad_version_hook.t @@ -342,47 +301,54 @@ cpan/CPAN-Meta-Requirements/t/merge.t cpan/CPAN-Meta/t/converter-bad.t cpan/CPAN-Meta/t/converter-fail.t cpan/CPAN-Meta/t/converter.t -cpan/CPAN-Meta/t/data-bad/107650337-META.yml -cpan/CPAN-Meta/t/data-bad/1122575719-META.yml -cpan/CPAN-Meta/t/data-bad/1206545041-META.yml -cpan/CPAN-Meta/t/data-bad/1598804075-META.yml -cpan/CPAN-Meta/t/data-bad/1927486199-META.yml -cpan/CPAN-Meta/t/data-bad/1985684504-META.yml -cpan/CPAN-Meta/t/data-bad/1985980974-META.yml -cpan/CPAN-Meta/t/data-bad/2031017050-META.yml -cpan/CPAN-Meta/t/data-bad/284247103-META.yml -cpan/CPAN-Meta/t/data-bad/344981821-META.yml -cpan/CPAN-Meta/t/data-bad/35478989-META.yml -cpan/CPAN-Meta/t/data-bad/476602558-META.yml -cpan/CPAN-Meta/t/data-bad/98042513-META.yml -cpan/CPAN-Meta/t/data-bad/META-1_0.yml -cpan/CPAN-Meta/t/data-bad/META-1_1.yml -cpan/CPAN-Meta/t/data-bad/META-1_2.yml -cpan/CPAN-Meta/t/data-bad/META-1_3.yml -cpan/CPAN-Meta/t/data-bad/META-1_4.yml -cpan/CPAN-Meta/t/data-bad/META-2.json -cpan/CPAN-Meta/t/data-bad/restrictive-2.json -cpan/CPAN-Meta/t/data-bad/version-ranges-2.json cpan/CPAN-Meta/t/data-fail/META-1_0.yml cpan/CPAN-Meta/t/data-fail/META-1_1.yml cpan/CPAN-Meta/t/data-fail/META-1_2.yml cpan/CPAN-Meta/t/data-fail/META-1_3.yml cpan/CPAN-Meta/t/data-fail/META-1_4.yml cpan/CPAN-Meta/t/data-fail/META-2.json -cpan/CPAN-Meta/t/data/gpl-1_4.yml -cpan/CPAN-Meta/t/data/META-1_0.yml -cpan/CPAN-Meta/t/data/META-1_1.yml -cpan/CPAN-Meta/t/data/META-1_2.yml -cpan/CPAN-Meta/t/data/META-1_3.yml -cpan/CPAN-Meta/t/data/META-1_4.yml -cpan/CPAN-Meta/t/data/META-2.json -cpan/CPAN-Meta/t/data/resources.yml -cpan/CPAN-Meta/t/data/restricted-2.json -cpan/CPAN-Meta/t/data/restrictive-1_4.yml -cpan/CPAN-Meta/t/data/unicode.yml -cpan/CPAN-Meta/t/data/version-not-normal.json -cpan/CPAN-Meta/t/data/version-ranges-1_4.yml -cpan/CPAN-Meta/t/data/version-ranges-2.json +cpan/CPAN-Meta/t/data-fixable/107650337-META.yml +cpan/CPAN-Meta/t/data-fixable/1598804075-META.yml +cpan/CPAN-Meta/t/data-fixable/1927486199-META.yml +cpan/CPAN-Meta/t/data-fixable/1985980974-META.yml +cpan/CPAN-Meta/t/data-fixable/2031017050-META.yml +cpan/CPAN-Meta/t/data-fixable/284247103-META.yml +cpan/CPAN-Meta/t/data-fixable/344981821-META.yml +cpan/CPAN-Meta/t/data-fixable/35478989-META.yml +cpan/CPAN-Meta/t/data-fixable/98042513-META.yml +cpan/CPAN-Meta/t/data-fixable/invalid-meta-spec-version.json +cpan/CPAN-Meta/t/data-fixable/invalid-meta-spec-version.yml +cpan/CPAN-Meta/t/data-fixable/META-1_2.yml +cpan/CPAN-Meta/t/data-fixable/META-1_3.yml +cpan/CPAN-Meta/t/data-fixable/META-1_4.yml +cpan/CPAN-Meta/t/data-fixable/META-2.json +cpan/CPAN-Meta/t/data-fixable/meta-spec-version-trailing-zeros.json +cpan/CPAN-Meta/t/data-fixable/meta-spec-version-trailing-zeros.yml +cpan/CPAN-Meta/t/data-fixable/restrictive-2.json +cpan/CPAN-Meta/t/data-fixable/version-ranges-2.json +cpan/CPAN-Meta/t/data-test/gpl-1_4.yml +cpan/CPAN-Meta/t/data-test/META-1_0.yml +cpan/CPAN-Meta/t/data-test/META-1_1.yml +cpan/CPAN-Meta/t/data-test/META-1_2.yml +cpan/CPAN-Meta/t/data-test/META-1_3.yml +cpan/CPAN-Meta/t/data-test/META-1_4.yml +cpan/CPAN-Meta/t/data-test/META-2.json +cpan/CPAN-Meta/t/data-test/META-2.meta +cpan/CPAN-Meta/t/data-test/provides-version-missing.json +cpan/CPAN-Meta/t/data-test/resources.yml +cpan/CPAN-Meta/t/data-test/restricted-2.json +cpan/CPAN-Meta/t/data-test/restrictive-1_4.yml +cpan/CPAN-Meta/t/data-test/unicode.yml +cpan/CPAN-Meta/t/data-test/version-not-normal.json +cpan/CPAN-Meta/t/data-test/version-ranges-1_4.yml +cpan/CPAN-Meta/t/data-test/version-ranges-2.json +cpan/CPAN-Meta/t/data-valid/1122575719-META.yml +cpan/CPAN-Meta/t/data-valid/1206545041-META.yml +cpan/CPAN-Meta/t/data-valid/1985684504-META.yml +cpan/CPAN-Meta/t/data-valid/476602558-META.yml +cpan/CPAN-Meta/t/data-valid/META-1_0.yml +cpan/CPAN-Meta/t/data-valid/META-1_1.yml +cpan/CPAN-Meta/t/data-valid/scalar-meta-spec.yml cpan/CPAN-Meta/t/load-bad.t cpan/CPAN-Meta/t/meta-obj.t cpan/CPAN-Meta/t/no-index.t @@ -394,140 +360,64 @@ cpan/CPAN-Meta/t/save-load.t cpan/CPAN-Meta/t/strings.t cpan/CPAN-Meta/t/validator.t cpan/CPAN-Meta-YAML/lib/CPAN/Meta/YAML.pm CPAN-Meta-YAML files +cpan/CPAN-Meta-YAML/t/01_api.t cpan/CPAN-Meta-YAML/t/01_compile.t CPAN-Meta-YAML files -cpan/CPAN-Meta-YAML/t/02_basic.t CPAN-Meta-YAML files -cpan/CPAN-Meta-YAML/t/03_regression.t CPAN-Meta-YAML files -cpan/CPAN-Meta-YAML/t/05_export.t CPAN-Meta-YAML files -cpan/CPAN-Meta-YAML/t/11_meta_yml.t CPAN-Meta-YAML files -cpan/CPAN-Meta-YAML/t/12_plagger.t CPAN-Meta-YAML files -cpan/CPAN-Meta-YAML/t/13_perl_smith.t CPAN-Meta-YAML files -cpan/CPAN-Meta-YAML/t/14_yaml_org.t CPAN-Meta-YAML files -cpan/CPAN-Meta-YAML/t/15_multibyte.t CPAN-Meta-YAML files -cpan/CPAN-Meta-YAML/t/16_nullrefs.t CPAN-Meta-YAML files -cpan/CPAN-Meta-YAML/t/17_toolbar.t CPAN-Meta-YAML files -cpan/CPAN-Meta-YAML/t/18_tap.t CPAN-Meta-YAML files -cpan/CPAN-Meta-YAML/t/19_errors.t CPAN-Meta-YAML files +cpan/CPAN-Meta-YAML/t/10_read.t +cpan/CPAN-Meta-YAML/t/11_read_string.t +cpan/CPAN-Meta-YAML/t/12_write.t +cpan/CPAN-Meta-YAML/t/13_write_string.t cpan/CPAN-Meta-YAML/t/20_subclass.t CPAN-Meta-YAML files -cpan/CPAN-Meta-YAML/t/21_bom.t CPAN-Meta-YAML files -cpan/CPAN-Meta-YAML/t/22_comments.t CPAN-Meta-YAML files -cpan/CPAN-Meta-YAML/t/data/HTML-WebDAO.yml CPAN-Meta-YAML files +cpan/CPAN-Meta-YAML/t/21_yamlpm_compat.t +cpan/CPAN-Meta-YAML/t/30_yaml_spec_tml.t +cpan/CPAN-Meta-YAML/t/31_local_tml.t +cpan/CPAN-Meta-YAML/t/32_world_tml.t +cpan/CPAN-Meta-YAML/t/data/ascii.yml +cpan/CPAN-Meta-YAML/t/data/latin1.yml cpan/CPAN-Meta-YAML/t/data/multibyte.yml CPAN-Meta-YAML files -cpan/CPAN-Meta-YAML/t/data/one.yml CPAN-Meta-YAML files -cpan/CPAN-Meta-YAML/t/data/sample.yml CPAN-Meta-YAML files -cpan/CPAN-Meta-YAML/t/data/Spreadsheet-Read.yml CPAN-Meta-YAML files -cpan/CPAN-Meta-YAML/t/data/Template-Provider-Unicode-Japanese.yml CPAN-Meta-YAML files -cpan/CPAN-Meta-YAML/t/data/toolbar.yml CPAN-Meta-YAML files -cpan/CPAN-Meta-YAML/t/data/two.yml CPAN-Meta-YAML files cpan/CPAN-Meta-YAML/t/data/utf_16_le_bom.yml CPAN-Meta-YAML files -cpan/CPAN-Meta-YAML/t/data/vanilla.yml CPAN-Meta-YAML files -cpan/CPAN-Meta-YAML/t/lib/Test.pm CPAN-Meta-YAML files +cpan/CPAN-Meta-YAML/t/data/utf_8_bom.yml +cpan/CPAN-Meta-YAML/t/lib/TestBridge.pm +cpan/CPAN-Meta-YAML/t/lib/TestML/Tiny.pm +cpan/CPAN-Meta-YAML/t/lib/TestUtils.pm +cpan/CPAN-Meta-YAML/t/README.md +cpan/CPAN-Meta-YAML/t/tml +cpan/CPAN-Meta-YAML/t/tml-local/dump-error/circular.tml +cpan/CPAN-Meta-YAML/t/tml-local/load-error/document.tml +cpan/CPAN-Meta-YAML/t/tml-local/load-error/scalar.tml +cpan/CPAN-Meta-YAML/t/tml-local/load-error/tag.tml +cpan/CPAN-Meta-YAML/t/tml-local/perl-to-yaml/quoting.tml +cpan/CPAN-Meta-YAML/t/tml-local/yaml-roundtrip/collection.tml +cpan/CPAN-Meta-YAML/t/tml-local/yaml-roundtrip/comment.tml +cpan/CPAN-Meta-YAML/t/tml-local/yaml-roundtrip/document.tml +cpan/CPAN-Meta-YAML/t/tml-local/yaml-roundtrip/mapping.tml +cpan/CPAN-Meta-YAML/t/tml-local/yaml-roundtrip/quoting.tml +cpan/CPAN-Meta-YAML/t/tml-local/yaml-roundtrip/scalar.tml +cpan/CPAN-Meta-YAML/t/tml-local/yaml-roundtrip/sequence.tml +cpan/CPAN-Meta-YAML/t/tml-spec/basic-data.tml +cpan/CPAN-Meta-YAML/t/tml-spec/unicode.tml +cpan/CPAN-Meta-YAML/t/tml-world/Acme-Time-Baby.tml +cpan/CPAN-Meta-YAML/t/tml-world/Data-Swap.tml +cpan/CPAN-Meta-YAML/t/tml-world/Games-Nintendo-Wii-Mii.tml +cpan/CPAN-Meta-YAML/t/tml-world/HTML-WebDAO.tml +cpan/CPAN-Meta-YAML/t/tml-world/ITS-SIN-FIDS-Content-XML.tml +cpan/CPAN-Meta-YAML/t/tml-world/Plagger.tml +cpan/CPAN-Meta-YAML/t/tml-world/Spreadsheet-Read.tml +cpan/CPAN-Meta-YAML/t/tml-world/Template-Provider-Unicode-Japanese.tml +cpan/CPAN-Meta-YAML/t/tml-world/toolbar.tml +cpan/CPAN-Meta-YAML/t/tml-world/Vanilla-Perl.tml +cpan/CPAN-Meta-YAML/t/tml-world/yaml_org.tml +cpan/CPAN-Meta-YAML/t/tml-world/YAML-Tiny-META.tml cpan/CPAN/PAUSE2003.pub CPAN public key cpan/CPAN/PAUSE2005.pub CPAN public key cpan/CPAN/PAUSE2007.pub CPAN public key cpan/CPAN/PAUSE2009.pub CPAN public key cpan/CPAN/PAUSE2011.pub -cpan/CPANPLUS/bin/cpan2dist the cpan2dist utility -cpan/CPANPLUS/bin/cpanp the cpanp utility -cpan/CPANPLUS/bin/cpanp-run-perl the cpanp-run-perl utility -cpan/CPANPLUS-Dist-Build/lib/CPANPLUS/Dist/Build/Constants.pm CPANPLUS::Dist::Build -cpan/CPANPLUS-Dist-Build/lib/CPANPLUS/Dist/Build.pm CPANPLUS::Dist::Build -cpan/CPANPLUS-Dist-Build/t/01_CPANPLUS-Dist-Build-Constants.t CPANPLUS::Dist::Build tests -cpan/CPANPLUS-Dist-Build/t/02_CPANPLUS-Dist-Build.t CPANPLUS::Dist::Build tests -cpan/CPANPLUS-Dist-Build/t/dummy-CPAN/authors/01mailrc.txt.gz -cpan/CPANPLUS-Dist-Build/t/dummy-CPAN/modules/02packages.details.txt.gz -cpan/CPANPLUS-Dist-Build/t/dummy-CPAN/modules/03modlist.data.gz -cpan/CPANPLUS-Dist-Build/t/dummy-perl/.hidden CPANPLUS::Dist::Build tests -cpan/CPANPLUS-Dist-Build/t/inc/conf.pl CPANPLUS::Dist::Build tests -cpan/CPANPLUS-Dist-Build/t/src/noxs/Foo-Bar-0.01.tar.gz CPANPLUS::Dist::Build tests -cpan/CPANPLUS-Dist-Build/t/src/xs/Foo-Bar-0.01.tar.gz CPANPLUS::Dist::Build tests -cpan/CPANPLUS/lib/CPANPLUS/Backend.pm CPANPLUS -cpan/CPANPLUS/lib/CPANPLUS/Backend/RV.pm CPANPLUS -cpan/CPANPLUS/lib/CPANPLUS/Config/HomeEnv.pm -cpan/CPANPLUS/lib/CPANPLUS/Config.pm CPANPLUS -cpan/CPANPLUS/lib/CPANPLUS/Configure.pm CPANPLUS -cpan/CPANPLUS/lib/CPANPLUS/Configure/Setup.pm CPANPLUS -cpan/CPANPLUS/lib/CPANPLUS/Dist/Autobundle.pm CPANPLUS -cpan/CPANPLUS/lib/CPANPLUS/Dist/Base.pm CPANPLUS -cpan/CPANPLUS/lib/CPANPLUS/Dist/MM.pm CPANPLUS -cpan/CPANPLUS/lib/CPANPLUS/Dist.pm CPANPLUS -cpan/CPANPLUS/lib/CPANPLUS/Dist/Sample.pm CPANPLUS -cpan/CPANPLUS/lib/CPANPLUS/Error.pm CPANPLUS -cpan/CPANPLUS/lib/CPANPLUS/FAQ.pod CPANPLUS -cpan/CPANPLUS/lib/CPANPLUS/Hacking.pod CPANPLUS -cpan/CPANPLUS/lib/CPANPLUS/Internals/Constants.pm CPANPLUS -cpan/CPANPLUS/lib/CPANPLUS/Internals/Constants/Report.pm CPANPLUS -cpan/CPANPLUS/lib/CPANPLUS/Internals/Extract.pm CPANPLUS -cpan/CPANPLUS/lib/CPANPLUS/Internals/Fetch.pm CPANPLUS -cpan/CPANPLUS/lib/CPANPLUS/Internals.pm CPANPLUS -cpan/CPANPLUS/lib/CPANPLUS/Internals/Report.pm CPANPLUS -cpan/CPANPLUS/lib/CPANPLUS/Internals/Search.pm CPANPLUS -cpan/CPANPLUS/lib/CPANPLUS/Internals/Source/Memory.pm CPANPLUS -cpan/CPANPLUS/lib/CPANPLUS/Internals/Source.pm CPANPLUS -cpan/CPANPLUS/lib/CPANPLUS/Internals/Source/SQLite.pm CPANPLUS -cpan/CPANPLUS/lib/CPANPLUS/Internals/Source/SQLite/Tie.pm CPANPLUS -cpan/CPANPLUS/lib/CPANPLUS/Internals/Utils/Autoflush.pm CPANPLUS -cpan/CPANPLUS/lib/CPANPLUS/Internals/Utils.pm CPANPLUS -cpan/CPANPLUS/lib/CPANPLUS/Module/Author/Fake.pm CPANPLUS -cpan/CPANPLUS/lib/CPANPLUS/Module/Author.pm CPANPLUS -cpan/CPANPLUS/lib/CPANPLUS/Module/Checksums.pm CPANPLUS -cpan/CPANPLUS/lib/CPANPLUS/Module/Fake.pm CPANPLUS -cpan/CPANPLUS/lib/CPANPLUS/Module.pm CPANPLUS -cpan/CPANPLUS/lib/CPANPLUS/Module/Signature.pm CPANPLUS -cpan/CPANPLUS/lib/CPANPLUS.pm CPANPLUS -cpan/CPANPLUS/lib/CPANPLUS/Selfupdate.pm CPANPLUS -cpan/CPANPLUS/lib/CPANPLUS/Shell/Classic.pm CPANPLUS -cpan/CPANPLUS/lib/CPANPLUS/Shell/Default/Plugins/CustomSource.pm CPANPLUS -cpan/CPANPLUS/lib/CPANPLUS/Shell/Default/Plugins/HOWTO.pod CPANPLUS -cpan/CPANPLUS/lib/CPANPLUS/Shell/Default/Plugins/Remote.pm CPANPLUS -cpan/CPANPLUS/lib/CPANPLUS/Shell/Default/Plugins/Source.pm CPANPLUS -cpan/CPANPLUS/lib/CPANPLUS/Shell/Default.pm CPANPLUS -cpan/CPANPLUS/lib/CPANPLUS/Shell.pm CPANPLUS -cpan/CPANPLUS/Makefile.PL -cpan/CPANPLUS/t/00_CPANPLUS-Internals-Utils.t CPANPLUS tests -cpan/CPANPLUS/t/01_CPANPLUS-Configure.t CPANPLUS tests -cpan/CPANPLUS/t/02_CPANPLUS-Internals.t CPANPLUS tests -cpan/CPANPLUS/t/03_CPANPLUS-Internals-Source.t CPANPLUS tests -cpan/CPANPLUS/t/04_CPANPLUS-Module.t CPANPLUS tests -cpan/CPANPLUS/t/05_CPANPLUS-Internals-Fetch.t CPANPLUS tests -cpan/CPANPLUS/t/06_CPANPLUS-Internals-Constants.t CPANPLUS tests -cpan/CPANPLUS/t/07_CPANPLUS-Internals-Extract.t CPANPLUS tests -cpan/CPANPLUS/t/08_CPANPLUS-Backend.t CPANPLUS tests -cpan/CPANPLUS/t/09_CPANPLUS-Internals-Search.t CPANPLUS tests -cpan/CPANPLUS/t/10_CPANPLUS-Error.t CPANPLUS tests -cpan/CPANPLUS/t/15_CPANPLUS-Shell.t CPANPLUS tests -cpan/CPANPLUS/t/19_CPANPLUS-Dist.t CPANPLUS tests -cpan/CPANPLUS/t/20_CPANPLUS-Dist-MM.t CPANPLUS tests -cpan/CPANPLUS/t/21_CPANPLUS-Dist-No-Build.t CPANPLUS tests -cpan/CPANPLUS/t/25_CPANPLUS.t CPANPLUS tests -cpan/CPANPLUS/t/30_CPANPLUS-Internals-Selfupdate.t CPANPLUS tests -cpan/CPANPLUS/t/40_CPANPLUS-Internals-Report.t CPANPLUS tests -cpan/CPANPLUS/t/dummy-CPAN/authors/01mailrc.txt.gz CPANPLUS tests -cpan/CPANPLUS/t/dummy-CPAN/authors/id/EUNOXS/Bundle-Foo-Bar-0.01.tar.gz CPANPLUS tests -cpan/CPANPLUS/t/dummy-CPAN/authors/id/EUNOXS/CHECKSUMS CPANPLUS tests -cpan/CPANPLUS/t/dummy-CPAN/authors/id/EUNOXS/Foo-Bar-0.01.meta CPANPLUS tests -cpan/CPANPLUS/t/dummy-CPAN/authors/id/EUNOXS/Foo-Bar-0.01.readme CPANPLUS tests -cpan/CPANPLUS/t/dummy-CPAN/authors/id/EUNOXS/Foo-Bar-0.01.tar.gz CPANPLUS tests -cpan/CPANPLUS/t/dummy-CPAN/authors/id/EUNOXS/perl5.005_03.tar.gz CPANPLUS tests -cpan/CPANPLUS/t/dummy-CPAN/authors/id/EUXS/CHECKSUMS CPANPLUS tests -cpan/CPANPLUS/t/dummy-CPAN/authors/id/EUXS/Foo-Bar-0.01.readme CPANPLUS tests -cpan/CPANPLUS/t/dummy-CPAN/authors/id/EUXS/Foo-Bar-0.01.tar.gz CPANPLUS tests -cpan/CPANPLUS/t/dummy-CPAN/authors/id/MBNOXS/CHECKSUMS CPANPLUS tests -cpan/CPANPLUS/t/dummy-CPAN/authors/id/MBNOXS/Foo-Bar-0.01.readme CPANPLUS tests -cpan/CPANPLUS/t/dummy-CPAN/authors/id/MBNOXS/Foo-Bar-0.01.tar.gz CPANPLUS tests -cpan/CPANPLUS/t/dummy-CPAN/authors/id/MBXS/CHECKSUMS CPANPLUS tests -cpan/CPANPLUS/t/dummy-CPAN/authors/id/MBXS/Foo-Bar-0.01.readme CPANPLUS tests -cpan/CPANPLUS/t/dummy-CPAN/authors/id/MBXS/Foo-Bar-0.01.tar.gz CPANPLUS tests -cpan/CPANPLUS/t/dummy-CPAN/autobundle/Snapshot.pm CPANPLUS tests -cpan/CPANPLUS/t/dummy-CPAN/modules/02packages.details.txt.gz CPANPLUS tests -cpan/CPANPLUS/t/dummy-CPAN/modules/03modlist.data.gz CPANPLUS tests -cpan/CPANPLUS/t/inc/conf.pl CPANPLUS tests cpan/CPAN/scripts/cpan easily interact with CPAN from the command line cpan/CPAN/t/01loadme.t See if CPAN the module works cpan/CPAN/t/02nox.t See if CPAN::Nox works cpan/CPAN/t/03pkgs.t See if CPAN::Version works cpan/CPAN/t/10version.t See if CPAN the module works cpan/CPAN/t/11mirroredby.t See if CPAN::Mirrored::By works -cpan/DB_File/Changes Berkeley DB extension change log cpan/DB_File/config.in Part of Berkeley DB configuration cpan/DB_File/DB_File_BS Berkeley DB extension mkbootstrap fodder cpan/DB_File/DB_File.pm Berkeley DB extension Perl module @@ -542,7 +432,6 @@ cpan/DB_File/t/db-recno.t See if DB_File cpan/DB_File/typemap Berkeley DB extension interface types cpan/DB_File/version.c Berkeley DB extension interface version check cpan/Devel-PPPort/apicheck_c.PL Devel::PPPort apicheck generator -cpan/Devel-PPPort/Changes Devel::PPPort changes cpan/Devel-PPPort/devel/buildperl.pl Devel::PPPort perl version builder cpan/Devel-PPPort/devel/devtools.pl Devel::PPPort development utilities cpan/Devel-PPPort/devel/mkapidoc.sh Devel::PPPort apidoc collector @@ -552,7 +441,6 @@ cpan/Devel-PPPort/devel/regenerate Devel cpan/Devel-PPPort/devel/scanprov Devel::PPPort provided API scanner cpan/Devel-PPPort/HACKERS Devel::PPPort hackers documentation cpan/Devel-PPPort/Makefile.PL Devel::PPPort makefile writer -cpan/Devel-PPPort/MANIFEST.SKIP Devel::PPPort Manifest skip specs cpan/Devel-PPPort/mktests.PL Devel::PPPort test file writer cpan/Devel-PPPort/module2.c Devel::PPPort test file cpan/Devel-PPPort/module3.c Devel::PPPort test file @@ -604,6 +492,8 @@ cpan/Devel-PPPort/parts/base/5012000 Dev cpan/Devel-PPPort/parts/base/5012001 Devel::PPPort baseline todo file cpan/Devel-PPPort/parts/base/5012002 Devel::PPPort baseline todo file cpan/Devel-PPPort/parts/base/5012003 Devel::PPPort baseline todo file +cpan/Devel-PPPort/parts/base/5012004 Devel::PPPort baseline todo file +cpan/Devel-PPPort/parts/base/5012005 Devel::PPPort baseline todo file cpan/Devel-PPPort/parts/base/5013000 Devel::PPPort baseline todo file cpan/Devel-PPPort/parts/base/5013001 Devel::PPPort baseline todo file cpan/Devel-PPPort/parts/base/5013002 Devel::PPPort baseline todo file @@ -617,6 +507,42 @@ cpan/Devel-PPPort/parts/base/5013009 Dev cpan/Devel-PPPort/parts/base/5013010 Devel::PPPort baseline todo file cpan/Devel-PPPort/parts/base/5013011 Devel::PPPort baseline todo file cpan/Devel-PPPort/parts/base/5014000 Devel::PPPort baseline todo file +cpan/Devel-PPPort/parts/base/5014001 Devel::PPPort baseline todo file +cpan/Devel-PPPort/parts/base/5014002 Devel::PPPort baseline todo file +cpan/Devel-PPPort/parts/base/5014003 Devel::PPPort baseline todo file +cpan/Devel-PPPort/parts/base/5014004 Devel::PPPort baseline todo file +cpan/Devel-PPPort/parts/base/5015000 Devel::PPPort baseline todo file +cpan/Devel-PPPort/parts/base/5015001 Devel::PPPort baseline todo file +cpan/Devel-PPPort/parts/base/5015002 Devel::PPPort baseline todo file +cpan/Devel-PPPort/parts/base/5015003 Devel::PPPort baseline todo file +cpan/Devel-PPPort/parts/base/5015004 Devel::PPPort baseline todo file +cpan/Devel-PPPort/parts/base/5015005 Devel::PPPort baseline todo file +cpan/Devel-PPPort/parts/base/5015006 Devel::PPPort baseline todo file +cpan/Devel-PPPort/parts/base/5015007 Devel::PPPort baseline todo file +cpan/Devel-PPPort/parts/base/5015008 Devel::PPPort baseline todo file +cpan/Devel-PPPort/parts/base/5015009 Devel::PPPort baseline todo file +cpan/Devel-PPPort/parts/base/5016000 Devel::PPPort baseline todo file +cpan/Devel-PPPort/parts/base/5016001 Devel::PPPort baseline todo file +cpan/Devel-PPPort/parts/base/5016002 Devel::PPPort baseline todo file +cpan/Devel-PPPort/parts/base/5016003 Devel::PPPort baseline todo file +cpan/Devel-PPPort/parts/base/5017000 Devel::PPPort baseline todo file +cpan/Devel-PPPort/parts/base/5017001 Devel::PPPort baseline todo file +cpan/Devel-PPPort/parts/base/5017002 Devel::PPPort baseline todo file +cpan/Devel-PPPort/parts/base/5017003 Devel::PPPort baseline todo file +cpan/Devel-PPPort/parts/base/5017004 Devel::PPPort baseline todo file +cpan/Devel-PPPort/parts/base/5017005 Devel::PPPort baseline todo file +cpan/Devel-PPPort/parts/base/5017006 Devel::PPPort baseline todo file +cpan/Devel-PPPort/parts/base/5017007 Devel::PPPort baseline todo file +cpan/Devel-PPPort/parts/base/5017008 Devel::PPPort baseline todo file +cpan/Devel-PPPort/parts/base/5017009 Devel::PPPort baseline todo file +cpan/Devel-PPPort/parts/base/5017010 Devel::PPPort baseline todo file +cpan/Devel-PPPort/parts/base/5017011 Devel::PPPort baseline todo file +cpan/Devel-PPPort/parts/base/5018000 Devel::PPPort baseline todo file +cpan/Devel-PPPort/parts/base/5018001 Devel::PPPort baseline todo file +cpan/Devel-PPPort/parts/base/5019000 Devel::PPPort baseline todo file +cpan/Devel-PPPort/parts/base/5019001 Devel::PPPort baseline todo file +cpan/Devel-PPPort/parts/base/5019002 Devel::PPPort baseline todo file +cpan/Devel-PPPort/parts/base/5019003 Devel::PPPort baseline todo file cpan/Devel-PPPort/parts/embed.fnc Devel::PPPort Perl API listing cpan/Devel-PPPort/parts/inc/call Devel::PPPort include cpan/Devel-PPPort/parts/inc/cop Devel::PPPort include @@ -683,7 +609,7 @@ cpan/Devel-PPPort/parts/todo/5008005 Dev cpan/Devel-PPPort/parts/todo/5008006 Devel::PPPort todo file cpan/Devel-PPPort/parts/todo/5008007 Devel::PPPort todo file cpan/Devel-PPPort/parts/todo/5008008 Devel::PPPort todo file -cpan/Devel-PPPort/parts/todo/5008009 Devel::PPPort baseline todo file +cpan/Devel-PPPort/parts/todo/5008009 Devel::PPPort todo file cpan/Devel-PPPort/parts/todo/5009000 Devel::PPPort todo file cpan/Devel-PPPort/parts/todo/5009001 Devel::PPPort todo file cpan/Devel-PPPort/parts/todo/5009002 Devel::PPPort todo file @@ -691,35 +617,72 @@ cpan/Devel-PPPort/parts/todo/5009003 Dev cpan/Devel-PPPort/parts/todo/5009004 Devel::PPPort todo file cpan/Devel-PPPort/parts/todo/5009005 Devel::PPPort todo file cpan/Devel-PPPort/parts/todo/5010000 Devel::PPPort todo file -cpan/Devel-PPPort/parts/todo/5010001 Devel::PPPort baseline todo file +cpan/Devel-PPPort/parts/todo/5010001 Devel::PPPort todo file cpan/Devel-PPPort/parts/todo/5011000 Devel::PPPort todo file -cpan/Devel-PPPort/parts/todo/5011001 Devel::PPPort baseline todo file -cpan/Devel-PPPort/parts/todo/5011002 Devel::PPPort baseline todo file -cpan/Devel-PPPort/parts/todo/5011003 Devel::PPPort baseline todo file -cpan/Devel-PPPort/parts/todo/5011004 Devel::PPPort baseline todo file -cpan/Devel-PPPort/parts/todo/5011005 Devel::PPPort baseline todo file -cpan/Devel-PPPort/parts/todo/5012000 Devel::PPPort baseline todo file -cpan/Devel-PPPort/parts/todo/5012001 Devel::PPPort baseline todo file -cpan/Devel-PPPort/parts/todo/5012002 Devel::PPPort baseline todo file -cpan/Devel-PPPort/parts/todo/5012003 Devel::PPPort baseline todo file -cpan/Devel-PPPort/parts/todo/5013000 Devel::PPPort baseline todo file -cpan/Devel-PPPort/parts/todo/5013001 Devel::PPPort baseline todo file -cpan/Devel-PPPort/parts/todo/5013002 Devel::PPPort baseline todo file -cpan/Devel-PPPort/parts/todo/5013003 Devel::PPPort baseline todo file -cpan/Devel-PPPort/parts/todo/5013004 Devel::PPPort baseline todo file -cpan/Devel-PPPort/parts/todo/5013005 Devel::PPPort baseline todo file -cpan/Devel-PPPort/parts/todo/5013006 Devel::PPPort baseline todo file -cpan/Devel-PPPort/parts/todo/5013007 Devel::PPPort baseline todo file -cpan/Devel-PPPort/parts/todo/5013008 Devel::PPPort baseline todo file -cpan/Devel-PPPort/parts/todo/5013009 Devel::PPPort baseline todo file -cpan/Devel-PPPort/parts/todo/5013010 Devel::PPPort baseline todo file -cpan/Devel-PPPort/parts/todo/5013011 Devel::PPPort baseline todo file -cpan/Devel-PPPort/parts/todo/5014000 Devel::PPPort baseline todo file +cpan/Devel-PPPort/parts/todo/5011001 Devel::PPPort todo file +cpan/Devel-PPPort/parts/todo/5011002 Devel::PPPort todo file +cpan/Devel-PPPort/parts/todo/5011003 Devel::PPPort todo file +cpan/Devel-PPPort/parts/todo/5011004 Devel::PPPort todo file +cpan/Devel-PPPort/parts/todo/5011005 Devel::PPPort todo file +cpan/Devel-PPPort/parts/todo/5012000 Devel::PPPort todo file +cpan/Devel-PPPort/parts/todo/5012001 Devel::PPPort todo file +cpan/Devel-PPPort/parts/todo/5012002 Devel::PPPort todo file +cpan/Devel-PPPort/parts/todo/5012003 Devel::PPPort todo file +cpan/Devel-PPPort/parts/todo/5012004 Devel::PPPort todo file +cpan/Devel-PPPort/parts/todo/5012005 Devel::PPPort todo file +cpan/Devel-PPPort/parts/todo/5013000 Devel::PPPort todo file +cpan/Devel-PPPort/parts/todo/5013001 Devel::PPPort todo file +cpan/Devel-PPPort/parts/todo/5013002 Devel::PPPort todo file +cpan/Devel-PPPort/parts/todo/5013003 Devel::PPPort todo file +cpan/Devel-PPPort/parts/todo/5013004 Devel::PPPort todo file +cpan/Devel-PPPort/parts/todo/5013005 Devel::PPPort todo file +cpan/Devel-PPPort/parts/todo/5013006 Devel::PPPort todo file +cpan/Devel-PPPort/parts/todo/5013007 Devel::PPPort todo file +cpan/Devel-PPPort/parts/todo/5013008 Devel::PPPort todo file +cpan/Devel-PPPort/parts/todo/5013009 Devel::PPPort todo file +cpan/Devel-PPPort/parts/todo/5013010 Devel::PPPort todo file +cpan/Devel-PPPort/parts/todo/5013011 Devel::PPPort todo file +cpan/Devel-PPPort/parts/todo/5014000 Devel::PPPort todo file +cpan/Devel-PPPort/parts/todo/5014001 Devel::PPPort todo file +cpan/Devel-PPPort/parts/todo/5014002 Devel::PPPort todo file +cpan/Devel-PPPort/parts/todo/5014003 Devel::PPPort todo file +cpan/Devel-PPPort/parts/todo/5014004 Devel::PPPort todo file +cpan/Devel-PPPort/parts/todo/5015000 Devel::PPPort todo file +cpan/Devel-PPPort/parts/todo/5015001 Devel::PPPort todo file +cpan/Devel-PPPort/parts/todo/5015002 Devel::PPPort todo file +cpan/Devel-PPPort/parts/todo/5015003 Devel::PPPort todo file +cpan/Devel-PPPort/parts/todo/5015004 Devel::PPPort todo file +cpan/Devel-PPPort/parts/todo/5015005 Devel::PPPort todo file +cpan/Devel-PPPort/parts/todo/5015006 Devel::PPPort todo file +cpan/Devel-PPPort/parts/todo/5015007 Devel::PPPort todo file +cpan/Devel-PPPort/parts/todo/5015008 Devel::PPPort todo file +cpan/Devel-PPPort/parts/todo/5015009 Devel::PPPort todo file +cpan/Devel-PPPort/parts/todo/5016000 Devel::PPPort todo file +cpan/Devel-PPPort/parts/todo/5016001 Devel::PPPort todo file +cpan/Devel-PPPort/parts/todo/5016002 Devel::PPPort todo file +cpan/Devel-PPPort/parts/todo/5016003 Devel::PPPort todo file +cpan/Devel-PPPort/parts/todo/5017000 Devel::PPPort todo file +cpan/Devel-PPPort/parts/todo/5017001 Devel::PPPort todo file +cpan/Devel-PPPort/parts/todo/5017002 Devel::PPPort todo file +cpan/Devel-PPPort/parts/todo/5017003 Devel::PPPort todo file +cpan/Devel-PPPort/parts/todo/5017004 Devel::PPPort todo file +cpan/Devel-PPPort/parts/todo/5017005 Devel::PPPort todo file +cpan/Devel-PPPort/parts/todo/5017006 Devel::PPPort todo file +cpan/Devel-PPPort/parts/todo/5017007 Devel::PPPort todo file +cpan/Devel-PPPort/parts/todo/5017008 Devel::PPPort todo file +cpan/Devel-PPPort/parts/todo/5017009 Devel::PPPort todo file +cpan/Devel-PPPort/parts/todo/5017010 Devel::PPPort todo file +cpan/Devel-PPPort/parts/todo/5017011 Devel::PPPort todo file +cpan/Devel-PPPort/parts/todo/5018000 Devel::PPPort todo file +cpan/Devel-PPPort/parts/todo/5018001 Devel::PPPort todo file +cpan/Devel-PPPort/parts/todo/5019000 Devel::PPPort todo file +cpan/Devel-PPPort/parts/todo/5019001 Devel::PPPort todo file +cpan/Devel-PPPort/parts/todo/5019002 Devel::PPPort todo file +cpan/Devel-PPPort/parts/todo/5019003 Devel::PPPort todo file cpan/Devel-PPPort/ppport_h.PL Devel::PPPort ppport.h writer cpan/Devel-PPPort/PPPort_pm.PL Devel::PPPort PPPort.pm writer cpan/Devel-PPPort/PPPort.xs Devel::PPPort dummy PPPort.xs cpan/Devel-PPPort/PPPort_xs.PL Devel::PPPort RealPPPort.xs writer -cpan/Devel-PPPort/README Devel::PPPort Readme cpan/Devel-PPPort/soak Devel::PPPort Test Harness to run under various Perls cpan/Devel-PPPort/t/call.t Devel::PPPort test file cpan/Devel-PPPort/t/cop.t Devel::PPPort test file @@ -738,7 +701,6 @@ cpan/Devel-PPPort/t/newCONSTSUB.t Devel: cpan/Devel-PPPort/t/newRV.t Devel::PPPort test file cpan/Devel-PPPort/t/newSVpv.t Devel::PPPort test file cpan/Devel-PPPort/t/newSV_type.t Devel::PPPort test file -cpan/Devel-PPPort/TODO Devel::PPPort Todo cpan/Devel-PPPort/t/podtest.t Devel::PPPort test file cpan/Devel-PPPort/t/ppphtest.t Devel::PPPort test file cpan/Devel-PPPort/t/pvs.t Devel::PPPort test file @@ -757,18 +719,15 @@ cpan/Devel-PPPort/t/uv.t Devel::PPPort cpan/Devel-PPPort/t/variables.t Devel::PPPort test file cpan/Devel-PPPort/t/warn.t Devel::PPPort test file cpan/Devel-PPPort/typemap Devel::PPPort Typemap -cpan/Digest/Changes Digest changelog cpan/Digest/Digest/base.pm Digest extensions cpan/Digest/Digest/file.pm Digest extensions cpan/Digest/Digest.pm Digest extensions -cpan/Digest-MD5/Changes Digest::MD5 extension changes cpan/Digest-MD5/hints/dec_osf.pl Hints for named architecture cpan/Digest-MD5/hints/irix_6.pl Hints for named architecture cpan/Digest-MD5/hints/MacOS.pl Hints for named architecture cpan/Digest-MD5/Makefile.PL Digest::MD5 extension makefile writer cpan/Digest-MD5/MD5.pm Digest::MD5 extension cpan/Digest-MD5/MD5.xs Digest::MD5 extension -cpan/Digest-MD5/README Digest::MD5 extension Readme cpan/Digest-MD5/t/align.t See if Digest::MD5 extension works cpan/Digest-MD5/t/badfile.t See if Digest::MD5 extension works cpan/Digest-MD5/t/bits.t See if Digest::MD5 extension works @@ -778,10 +737,8 @@ cpan/Digest-MD5/t/md5-aaa.t See if Dige cpan/Digest-MD5/t/threads.t See if Digest::MD5 extension works cpan/Digest-MD5/t/utf8.t See if Digest::MD5 extension works cpan/Digest-MD5/typemap Digest::MD5 extension -cpan/Digest-SHA/Changes Digest::SHA changes cpan/Digest-SHA/lib/Digest/SHA.pm Digest::SHA extension cpan/Digest-SHA/Makefile.PL Digest::SHA Makefile.PL -cpan/Digest-SHA/README Digest::SHA README cpan/Digest-SHA/shasum shasum script cpan/Digest-SHA/SHA.xs Digest::SHA extension cpan/Digest-SHA/src/sha64bit.c Digest::SHA extension @@ -791,7 +748,6 @@ cpan/Digest-SHA/src/sha.h Digest::SHA e cpan/Digest-SHA/t/allfcns.t See if Digest::SHA works cpan/Digest-SHA/t/base64.t See if Digest::SHA works cpan/Digest-SHA/t/bitbuf.t See if Digest::SHA works -cpan/Digest-SHA/t/dumpload.t See if Digest::SHA works cpan/Digest-SHA/t/fips180-4.t See if Digest::SHA works cpan/Digest-SHA/t/fips198.t See if Digest::SHA works cpan/Digest-SHA/t/gglong.t See if Digest::SHA works @@ -807,6 +763,7 @@ cpan/Digest-SHA/t/sha224.t See if Diges cpan/Digest-SHA/t/sha256.t See if Digest::SHA works cpan/Digest-SHA/t/sha384.t See if Digest::SHA works cpan/Digest-SHA/t/sha512.t See if Digest::SHA works +cpan/Digest-SHA/t/state.t See if Digest::SHA works cpan/Digest-SHA/t/unicode.t cpan/Digest-SHA/t/woodbury.t See if Digest::SHA works cpan/Digest-SHA/typemap Typemap for Digest::SHA @@ -815,7 +772,6 @@ cpan/Digest/t/digest.t See if Digest ex cpan/Digest/t/file.t See if Digest extensions work cpan/Digest/t/lib/Digest/Dummy.pm See if Digest extensions work cpan/Digest/t/security.t See if Digest extensions work -cpan/Encode/AUTHORS List of authors cpan/Encode/bin/enc2xs Encode module generator cpan/Encode/bin/piconv iconv by perl cpan/Encode/bin/ucm2table Table Generator for testing @@ -824,7 +780,6 @@ cpan/Encode/bin/ucmsort A UCM sort util cpan/Encode/bin/unidump Unicode Dump like hexdump(1) cpan/Encode/Byte/Byte.pm Encode extension cpan/Encode/Byte/Makefile.PL Encode extension -cpan/Encode/Changes Change Log cpan/Encode/CN/CN.pm Encode extension cpan/Encode/CN/Makefile.PL Encode extension cpan/Encode/EBCDIC/EBCDIC.pm Encode extension @@ -862,10 +817,6 @@ cpan/Encode/lib/Encode/PerlIO.pod Docume cpan/Encode/lib/Encode/Supported.pod Documents for supported encodings cpan/Encode/lib/Encode/Unicode/UTF7.pm Encode extension cpan/Encode/Makefile.PL Encode extension makefile writer -cpan/Encode/MANIFEST Encode MANIFEST -cpan/Encode/META.json Encode META.json -cpan/Encode/META.yml Encode META.yml -cpan/Encode/README Encode extension cpan/Encode/Symbol/Makefile.PL Encode extension cpan/Encode/Symbol/Symbol.pm Encode extension cpan/Encode/t/Aliases.t test script @@ -876,6 +827,8 @@ cpan/Encode/t/big5-eten.utf test data cpan/Encode/t/big5-hkscs.enc test data cpan/Encode/t/big5-hkscs.utf test data cpan/Encode/t/CJKT.t test script +cpan/Encode/t/cow.t +cpan/Encode/t/decode.t cpan/Encode/t/enc_data.t test script for utf8 DATA cpan/Encode/t/enc_eucjp.t test script cpan/Encode/t/enc_module.enc test data for t/enc_module.t @@ -908,6 +861,7 @@ cpan/Encode/t/Mod_EUCJP.pm module that cpan/Encode/t/perlio.t test script cpan/Encode/t/piconv.t Test for piconv.t cpan/Encode/t/rt.pl test script +cpan/Encode/t/taint.t cpan/Encode/t/unibench.pl benchmark script cpan/Encode/t/Unicode.t test script cpan/Encode/t/utf8ref.t test script @@ -1020,12 +974,13 @@ cpan/Encode/ucm/viscii.ucm Unicode Char cpan/Encode/Unicode/Makefile.PL Encode extension cpan/Encode/Unicode/Unicode.pm Encode extension cpan/Encode/Unicode/Unicode.xs Encode extension -cpan/encoding-warnings/Changes Changelog for encoding::warnings cpan/encoding-warnings/lib/encoding/warnings.pm warn on implicit encoding conversions cpan/encoding-warnings/t/1-warning.t tests for encoding::warnings cpan/encoding-warnings/t/2-fatal.t tests for encoding::warnings cpan/encoding-warnings/t/3-normal.t tests for encoding::warnings cpan/encoding-warnings/t/4-lexical.t tests for encoding::warnings +cpan/experimental/lib/experimental.pm +cpan/experimental/t/basic.t cpan/ExtUtils-Constant/lib/ExtUtils/Constant/Base.pm generate XS code to import C header constants cpan/ExtUtils-Constant/lib/ExtUtils/Constant.pm generate XS code to import C header constants cpan/ExtUtils-Constant/lib/ExtUtils/Constant/ProxySubs.pm generate XS code for proxy constants @@ -1033,7 +988,6 @@ cpan/ExtUtils-Constant/lib/ExtUtils/Cons cpan/ExtUtils-Constant/lib/ExtUtils/Constant/XS.pm generate XS code to import C header constants cpan/ExtUtils-Constant/t/Constant.t See if ExtUtils::Constant works cpan/ExtUtils-MakeMaker/bin/instmodsh Give information about installed extensions -cpan/ExtUtils-MakeMaker/Changes MakeMaker change log cpan/ExtUtils-MakeMaker/lib/ExtUtils/Command/MM.pm Calling MM functions from the cmd line cpan/ExtUtils-MakeMaker/lib/ExtUtils/Liblist/Kid.pm Does the real work of the above cpan/ExtUtils-MakeMaker/lib/ExtUtils/Liblist.pm Locates libraries @@ -1062,11 +1016,6 @@ cpan/ExtUtils-MakeMaker/lib/ExtUtils/MM_ cpan/ExtUtils-MakeMaker/lib/ExtUtils/MM_Win95.pm MakeMaker methods for Win95 cpan/ExtUtils-MakeMaker/lib/ExtUtils/MY.pm MakeMaker user override class cpan/ExtUtils-MakeMaker/lib/ExtUtils/testlib.pm Fixes up @INC to use just-built extension -cpan/ExtUtils-MakeMaker/MANIFEST ExtUtils::MakeMaker MANIFEST -cpan/ExtUtils-MakeMaker/NOTES Notes about MakeMaker internals -cpan/ExtUtils-MakeMaker/PATCHING Suggestions for patching MakeMaker -cpan/ExtUtils-MakeMaker/README MakeMaker README -cpan/ExtUtils-MakeMaker/README.packaging MakeMaker packaging README cpan/ExtUtils-MakeMaker/t/00compile.t See if MakeMaker modules compile cpan/ExtUtils-MakeMaker/t/01perl_bugs.t cpan/ExtUtils-MakeMaker/t/arch_check.t Test MakeMaker's arch_check() @@ -1118,7 +1067,6 @@ cpan/ExtUtils-MakeMaker/t/MM_OS2.t Se cpan/ExtUtils-MakeMaker/t/MM_Unix.t See if ExtUtils::MM_UNIX works cpan/ExtUtils-MakeMaker/t/MM_VMS.t See if ExtUtils::MM_VMS works cpan/ExtUtils-MakeMaker/t/MM_Win32.t See if ExtUtils::MM_Win32 works -cpan/ExtUtils-MakeMaker/TODO Things TODO in MakeMaker cpan/ExtUtils-MakeMaker/t/oneliner.t See if MM can generate perl one-liners cpan/ExtUtils-MakeMaker/t/parse_abstract.t See if parse_abstract works cpan/ExtUtils-MakeMaker/t/parse_version.t See if parse_version works @@ -1144,8 +1092,6 @@ cpan/ExtUtils-MakeMaker/t/VERSION_FROM.t cpan/ExtUtils-MakeMaker/t/WriteEmptyMakefile.t See if WriteEmptyMakefile works cpan/ExtUtils-MakeMaker/t/writemakefile_args.t See if WriteMakefile works cpan/ExtUtils-MakeMaker/t/xs.t Part of MakeMaker's test suite -cpan/File-CheckTree/lib/File/CheckTree.pm Perl module supporting wholesale file mode validation -cpan/File-CheckTree/t/CheckTree.t See if File::CheckTree works cpan/File-Fetch/lib/File/Fetch.pm File::Fetch cpan/File-Fetch/t/01_File-Fetch.t File::Fetch tests cpan/File-Fetch/t/null_subclass.t @@ -1167,9 +1113,7 @@ cpan/Filter-Util-Call/Call.pm Filter::Ut cpan/Filter-Util-Call/Call.xs Filter::Util::Call extension external subroutines cpan/Filter-Util-Call/filter-util.pl See if Filter::Util::Call works cpan/Filter-Util-Call/t/call.t See if Filter::Util::Call works -cpan/Getopt-Long/CHANGES Getopt::Long changes cpan/Getopt-Long/lib/Getopt/Long.pm Fetch command options (GetOptions) -cpan/Getopt-Long/README Getopt::Long README cpan/Getopt-Long/t/gol-basic.t See if Getopt::Long works cpan/Getopt-Long/t/gol-linkage.t See if Getopt::Long works cpan/Getopt-Long/t/gol-oo.t See if Getopt::Long works @@ -1180,13 +1124,13 @@ cpan/HTTP-Tiny/t/000_load.t cpan/HTTP-Tiny/t/001_api.t cpan/HTTP-Tiny/t/002_croakage.t cpan/HTTP-Tiny/t/003_agent.t -cpan/HTTP-Tiny/t/00-compile.t cpan/HTTP-Tiny/t/010_url.t cpan/HTTP-Tiny/t/020_headers.t cpan/HTTP-Tiny/t/030_response.t cpan/HTTP-Tiny/t/040_content.t cpan/HTTP-Tiny/t/050_chunked_body.t cpan/HTTP-Tiny/t/060_http_date.t +cpan/HTTP-Tiny/t/070_cookie_jar.t cpan/HTTP-Tiny/t/100_get.t cpan/HTTP-Tiny/t/101_head.t cpan/HTTP-Tiny/t/102_put.t @@ -1195,12 +1139,31 @@ cpan/HTTP-Tiny/t/104_post.t cpan/HTTP-Tiny/t/110_mirror.t cpan/HTTP-Tiny/t/130_redirect.t cpan/HTTP-Tiny/t/140_proxy.t +cpan/HTTP-Tiny/t/141_no_proxy.t cpan/HTTP-Tiny/t/150_post_form.t +cpan/HTTP-Tiny/t/160_cookies.t +cpan/HTTP-Tiny/t/161_basic_auth.t +cpan/HTTP-Tiny/t/162_proxy_auth.t +cpan/HTTP-Tiny/t/170_keepalive.t +cpan/HTTP-Tiny/t/BrokenCookieJar.pm +cpan/HTTP-Tiny/t/cases/auth-01.txt +cpan/HTTP-Tiny/t/cases/auth-02.txt +cpan/HTTP-Tiny/t/cases/auth-03.txt +cpan/HTTP-Tiny/t/cases/auth-04.txt +cpan/HTTP-Tiny/t/cases/auth-05.txt +cpan/HTTP-Tiny/t/cases/cookies-01.txt +cpan/HTTP-Tiny/t/cases/cookies-02.txt +cpan/HTTP-Tiny/t/cases/cookies-03.txt +cpan/HTTP-Tiny/t/cases/cookies-04.txt +cpan/HTTP-Tiny/t/cases/cookies-05.txt +cpan/HTTP-Tiny/t/cases/cookies-06.txt +cpan/HTTP-Tiny/t/cases/cookies-07.txt cpan/HTTP-Tiny/t/cases/delete-01.txt cpan/HTTP-Tiny/t/cases/form-01.txt cpan/HTTP-Tiny/t/cases/form-02.txt cpan/HTTP-Tiny/t/cases/form-03.txt cpan/HTTP-Tiny/t/cases/form-04.txt +cpan/HTTP-Tiny/t/cases/form-05.txt cpan/HTTP-Tiny/t/cases/get-01.txt cpan/HTTP-Tiny/t/cases/get-02.txt cpan/HTTP-Tiny/t/cases/get-03.txt @@ -1223,12 +1186,18 @@ cpan/HTTP-Tiny/t/cases/get-19.txt cpan/HTTP-Tiny/t/cases/get-20.txt cpan/HTTP-Tiny/t/cases/get-21.txt cpan/HTTP-Tiny/t/cases/head-01.txt +cpan/HTTP-Tiny/t/cases/keepalive-01.txt +cpan/HTTP-Tiny/t/cases/keepalive-02.txt +cpan/HTTP-Tiny/t/cases/keepalive-03.txt +cpan/HTTP-Tiny/t/cases/keepalive-04.txt +cpan/HTTP-Tiny/t/cases/keepalive-05.txt cpan/HTTP-Tiny/t/cases/mirror-01.txt cpan/HTTP-Tiny/t/cases/mirror-02.txt cpan/HTTP-Tiny/t/cases/mirror-03.txt cpan/HTTP-Tiny/t/cases/mirror-04.txt cpan/HTTP-Tiny/t/cases/mirror-05.txt cpan/HTTP-Tiny/t/cases/post-01.txt +cpan/HTTP-Tiny/t/cases/proxy-auth-01.txt cpan/HTTP-Tiny/t/cases/put-01.txt cpan/HTTP-Tiny/t/cases/put-02.txt cpan/HTTP-Tiny/t/cases/put-03.txt @@ -1243,22 +1212,9 @@ cpan/HTTP-Tiny/t/cases/redirect-06.txt cpan/HTTP-Tiny/t/cases/redirect-07.txt cpan/HTTP-Tiny/t/cases/redirect-08.txt cpan/HTTP-Tiny/t/cases/redirect-09.txt +cpan/HTTP-Tiny/t/SimpleCookieJar.pm cpan/HTTP-Tiny/t/Util.pm cpan/IO-Compress/bin/zipdetails IO::Compress -cpan/IO-Compress/Changes IO::Compress -cpan/IO-Compress/examples/compress-zlib/filtdef IO::Compress -cpan/IO-Compress/examples/compress-zlib/filtinf IO::Compress -cpan/IO-Compress/examples/compress-zlib/gzcat IO::Compress -cpan/IO-Compress/examples/compress-zlib/gzgrep IO::Compress -cpan/IO-Compress/examples/compress-zlib/gzstream IO::Compress -cpan/IO-Compress/examples/io/anycat IO::Compress -cpan/IO-Compress/examples/io/bzip2/bzcat IO::Compress -cpan/IO-Compress/examples/io/bzip2/bzgrep IO::Compress -cpan/IO-Compress/examples/io/bzip2/bzstream IO::Compress -cpan/IO-Compress/examples/io/gzip/gzappend IO::Compress -cpan/IO-Compress/examples/io/gzip/gzcat IO::Compress -cpan/IO-Compress/examples/io/gzip/gzgrep IO::Compress -cpan/IO-Compress/examples/io/gzip/gzstream IO::Compress cpan/IO-Compress/lib/Compress/Zlib.pm IO::Compress cpan/IO-Compress/lib/File/GlobMapper.pm IO::Compress cpan/IO-Compress/lib/IO/Compress/Adapter/Bzip2.pm IO::Compress @@ -1287,9 +1243,7 @@ cpan/IO-Compress/lib/IO/Uncompress/Gunzi cpan/IO-Compress/lib/IO/Uncompress/Inflate.pm IO::Compress cpan/IO-Compress/lib/IO/Uncompress/RawInflate.pm IO::Compress cpan/IO-Compress/lib/IO/Uncompress/Unzip.pm IO::Compress -cpan/IO-Compress/Makefile.PL IO::Compress cpan/IO-Compress/private/MakeUtil.pm IO::Compress -cpan/IO-Compress/README IO::Compress cpan/IO-Compress/t/000prereq.t IO::Compress cpan/IO-Compress/t/001bzip2.t IO::Compress cpan/IO-Compress/t/001zlib-generic-deflate.t IO::Compress @@ -1304,8 +1258,6 @@ cpan/IO-Compress/t/002any-zip.t IO::C cpan/IO-Compress/t/004gziphdr.t IO::Compress cpan/IO-Compress/t/005defhdr.t IO::Compress cpan/IO-Compress/t/006zip.t IO::Compress -cpan/IO-Compress/t/010examples-bzip2.t IO::Compress -cpan/IO-Compress/t/010examples-zlib.t IO::Compress cpan/IO-Compress/t/01misc.t IO::Compress cpan/IO-Compress/t/020isize.t IO::Compress cpan/IO-Compress/t/050interop-gzip.t IO::Compress @@ -1386,11 +1338,41 @@ cpan/IO-Compress/t/compress/truncate.pl cpan/IO-Compress/t/compress/zlib-generic.pl Compress::Zlib cpan/IO-Compress/t/cz-01version.t IO::Compress cpan/IO-Compress/t/cz-03zlib-v1.t IO::Compress -cpan/IO-Compress/t/cz-05examples.t IO::Compress cpan/IO-Compress/t/cz-06gzsetp.t IO::Compress cpan/IO-Compress/t/cz-08encoding.t IO::Compress cpan/IO-Compress/t/cz-14gzopen.t IO::Compress cpan/IO-Compress/t/globmapper.t IO::Compress +cpan/IO-Socket-IP/Build.PL IO::Socket::IP +cpan/IO-Socket-IP/Changes IO::Socket::IP +cpan/IO-Socket-IP/lib/IO/Socket/IP.pm IO::Socket::IP +cpan/IO-Socket-IP/LICENSE IO::Socket::IP +cpan/IO-Socket-IP/Makefile.PL IO::Socket::IP +cpan/IO-Socket-IP/MANIFEST IO::Socket::IP +cpan/IO-Socket-IP/META.json IO::Socket::IP +cpan/IO-Socket-IP/META.yml IO::Socket::IP +cpan/IO-Socket-IP/README IO::Socket::IP +cpan/IO-Socket-IP/t/00use.t IO::Socket::IP tests +cpan/IO-Socket-IP/t/01local-client-v4.t IO::Socket::IP tests +cpan/IO-Socket-IP/t/02local-server-v4.t IO::Socket::IP tests +cpan/IO-Socket-IP/t/03local-cross-v4.t IO::Socket::IP tests +cpan/IO-Socket-IP/t/04local-client-v6.t IO::Socket::IP tests +cpan/IO-Socket-IP/t/05local-server-v6.t IO::Socket::IP tests +cpan/IO-Socket-IP/t/06local-cross-v6.t IO::Socket::IP tests +cpan/IO-Socket-IP/t/10args.t IO::Socket::IP tests +cpan/IO-Socket-IP/t/11sockopts.t IO::Socket::IP tests +cpan/IO-Socket-IP/t/12port-fallback.t IO::Socket::IP tests +cpan/IO-Socket-IP/t/13addrinfo.t IO::Socket::IP tests +cpan/IO-Socket-IP/t/14fileno.t IO::Socket::IP tests +cpan/IO-Socket-IP/t/15io-socket.t IO::Socket::IP tests +cpan/IO-Socket-IP/t/16v6only.t IO::Socket::IP tests +cpan/IO-Socket-IP/t/17gai-flags.t IO::Socket::IP tests +cpan/IO-Socket-IP/t/18fdopen.t IO::Socket::IP tests +cpan/IO-Socket-IP/t/19no-addrs.t IO::Socket::IP tests +cpan/IO-Socket-IP/t/20subclass.t IO::Socket::IP tests +cpan/IO-Socket-IP/t/21as-inet.t IO::Socket::IP tests +cpan/IO-Socket-IP/t/30nonblocking-connect.t IO::Socket::IP tests +cpan/IO-Socket-IP/t/31nonblocking-connect-internet.t IO::Socket::IP tests +cpan/IO-Socket-IP/t/99pod.t IO::Socket::IP tests cpan/IO-Zlib/t/basic.t Tests for IO::Zlib cpan/IO-Zlib/t/external.t Tests for IO::Zlib cpan/IO-Zlib/t/getc.t Tests for IO::Zlib @@ -1404,10 +1386,10 @@ cpan/IO-Zlib/Zlib.pm IO::Zlib cpan/IPC-Cmd/lib/IPC/Cmd.pm IPC::Cmd cpan/IPC-Cmd/t/01_IPC-Cmd.t IPC::Cmd tests cpan/IPC-Cmd/t/02_Interactive.t IPC::Cmd tests +cpan/IPC-Cmd/t/03_run-forked.t IPC::Cmd tests cpan/IPC-Cmd/t/src/child.pl IPC::Cmd tests cpan/IPC-Cmd/t/src/output.pl IPC::Cmd tests cpan/IPC-Cmd/t/src/x.tgz IPC::Cmd tests -cpan/IPC-SysV/Changes IPC::SysV changes cpan/IPC-SysV/hints/cygwin.pl Hint for IPC::SysV for named architecture cpan/IPC-SysV/hints/next_3.pl Hint for IPC::SysV for named architecture cpan/IPC-SysV/lib/IPC/Msg.pm IPC::SysV extension Perl module @@ -1415,13 +1397,10 @@ cpan/IPC-SysV/lib/IPC/Semaphore.pm IPC:: cpan/IPC-SysV/lib/IPC/SharedMem.pm IPC::SysV extension Perl module cpan/IPC-SysV/lib/IPC/SysV.pm IPC::SysV extension Perl module cpan/IPC-SysV/Makefile.PL IPC::SysV makefile writer -cpan/IPC-SysV/MANIFEST.SKIP IPC::SysV manifest skip specs -cpan/IPC-SysV/README IPC::SysV README cpan/IPC-SysV/regen.pl IPC::SysV file regeneration script cpan/IPC-SysV/SysV.xs IPC::SysV extension Perl module cpan/IPC-SysV/t/ipcsysv.t IPC::SysV test file cpan/IPC-SysV/t/msg.t IPC::SysV test file -cpan/IPC-SysV/TODO IPC::SysV todo file cpan/IPC-SysV/t/podcov.t IPC::SysV test file cpan/IPC-SysV/t/pod.t IPC::SysV test file cpan/IPC-SysV/t/sem.t IPC::SysV test file @@ -1465,15 +1444,7 @@ cpan/JSON-PP/t/114_decode_prefix.t cpan/JSON-PP/t/115_tie_ixhash.t cpan/JSON-PP/t/116_incr_parse_fixed.t cpan/JSON-PP/t/_unicode_handling.pm -cpan/libnet/Changes libnet cpan/libnet/Config.eg libnet -cpan/libnet/demos/ftp libnet -cpan/libnet/demos/inetd libnet -cpan/libnet/demos/nntp libnet -cpan/libnet/demos/nntp.mirror libnet -cpan/libnet/demos/pop3 libnet -cpan/libnet/demos/smtp.self libnet -cpan/libnet/demos/time libnet cpan/libnet/Hostname.pm.eg libnet cpan/libnet/Makefile.PL cpan/libnet/Net/Cmd.pm libnet @@ -1491,7 +1462,6 @@ cpan/libnet/Net/NNTP.pm libnet cpan/libnet/Net/POP3.pm libnet cpan/libnet/Net/SMTP.pm libnet cpan/libnet/Net/Time.pm libnet -cpan/libnet/README libnet cpan/libnet/t/config.t libnet cpan/libnet/t/datasend.t libnet cpan/libnet/t/ftp.t libnet @@ -1502,39 +1472,6 @@ cpan/libnet/t/nntp.t libnet cpan/libnet/t/require.t libnet cpan/libnet/t/smtp.t libnet cpan/libnet/t/time.t libnet -cpan/List-Util/Changes Util extension -cpan/List-Util/lib/List/Util.pm List::Util -cpan/List-Util/lib/List/Util/XS.pm List::Util -cpan/List-Util/lib/Scalar/Util.pm Scalar::Util -cpan/List-Util/ListUtil.xs Util extension -cpan/List-Util/Makefile.PL Util extension -cpan/List-Util/multicall.h Util extension -cpan/List-Util/README Util extension -cpan/List-Util/t/00version.t Scalar::Util -cpan/List-Util/t/blessed.t Scalar::Util -cpan/List-Util/t/dualvar.t Scalar::Util -cpan/List-Util/t/first.t List::Util -cpan/List-Util/t/getmagic-once.t -cpan/List-Util/t/isvstring.t Scalar::Util -cpan/List-Util/t/lln.t Scalar::Util -cpan/List-Util/t/maxstr.t List::Util -cpan/List-Util/t/max.t List::Util -cpan/List-Util/t/minstr.t List::Util -cpan/List-Util/t/min.t List::Util -cpan/List-Util/t/multicall-refcount.t -cpan/List-Util/t/openhan.t Scalar::Util -cpan/List-Util/t/proto.t Scalar::Util -cpan/List-Util/t/readonly.t Scalar::Util -cpan/List-Util/t/reduce.t List::Util -cpan/List-Util/t/refaddr.t Scalar::Util -cpan/List-Util/t/reftype.t Scalar::Util -cpan/List-Util/t/shuffle.t List::Util -cpan/List-Util/t/stack-corruption.t List::Util -cpan/List-Util/t/sum0.t -cpan/List-Util/t/sum.t List::Util -cpan/List-Util/t/tainted.t Scalar::Util -cpan/List-Util/t/weak.t Scalar::Util -cpan/Locale-Codes/ChangeLog Locale::Codes cpan/Locale-Codes/lib/Locale/Codes/API.pod Locale::Codes documentation cpan/Locale-Codes/lib/Locale/Codes/Changes.pod Locale::Codes documentation cpan/Locale-Codes/lib/Locale/Codes/Constants.pm Locale::Codes @@ -1577,8 +1514,6 @@ cpan/Locale-Codes/lib/Locale/Language.pm cpan/Locale-Codes/lib/Locale/Language.pod Locale::Codes documentation cpan/Locale-Codes/lib/Locale/Script.pm Locale::Codes cpan/Locale-Codes/lib/Locale/Script.pod Locale::Codes documentation -cpan/Locale-Codes/LICENSE Locale::Codes -cpan/Locale-Codes/README.first Locale::Codes cpan/Locale-Codes/t/alias_code_old.t Locale::Codes tests cpan/Locale-Codes/t/alias_code.t Locale::Codes tests cpan/Locale-Codes/t/code2country_old.t Locale::Codes tests @@ -1616,22 +1551,8 @@ cpan/Locale-Maketext-Simple/t/po_with_i_ cpan/Locale-Maketext-Simple/t/po_with_i_default/i_default.po Locale::Simple tests cpan/Locale-Maketext-Simple/t/po_without_i_default/en.po Locale::Simple tests cpan/Locale-Maketext-Simple/t/po_without_i_default/fr.po Locale::Simple tests -cpan/Log-Message/lib/Log/Message/Config.pm Log::Message -cpan/Log-Message/lib/Log/Message/Handlers.pm Log::Message -cpan/Log-Message/lib/Log/Message/Item.pm Log::Message -cpan/Log-Message/lib/Log/Message.pm Log::Message -cpan/Log-Message-Simple/lib/Log/Message/Simple.pm Log::Simple -cpan/Log-Message-Simple/t/01_use.t Log::Simple tests -cpan/Log-Message-Simple/t/02_imports.t Log::Simple tests -cpan/Log-Message-Simple/t/03_functions.t Log::Simple tests -cpan/Log-Message/t/01_Log-Message-Config.t Log::Message tests -cpan/Log-Message/t/02_Log-Message.t Log::Message tests -cpan/Log-Message/t/conf/config_file Log::Message tests -cpan/Log-Message/t/conf/LoadMe.pl Log::Message tests -cpan/Math-Complex/ChangeLog Math-Complex change log cpan/Math-Complex/lib/Math/Complex.pm A Complex package cpan/Math-Complex/lib/Math/Trig.pm A simple interface to complex trigonometry -cpan/Math-Complex/Makefile.PL Math-Complex building cpan/Math-Complex/t/Complex.t See if Math::Complex works cpan/Math-Complex/t/Trig.t See if Math::Trig works cpan/Math-Complex/t/underbar.t See if Math::Complex works @@ -1653,7 +1574,6 @@ cpan/Memoize/t/expmod_n.t Memoize expir cpan/Memoize/t/expmod_t.t Memoize expiry manager (timed) tests cpan/Memoize/t/flush.t Memoize 'flush_cache' function tests cpan/Memoize/t/normalize.t Memoize 'normalizer' feature tests -cpan/Memoize/TODO Memoize to-do list cpan/Memoize/t/prototype.t Memoize prototyped function handling tests cpan/Memoize/t/speed.t "Makes functions faster" advertisement test cpan/Memoize/t/tiefeatures.t Memoize FAULT / MERGE / HASH options test @@ -1665,16 +1585,12 @@ cpan/Memoize/t/tie.t Memoize tied file cpan/Memoize/t/unmemoize.t Memoize 'unmemoize' function test cpan/MIME-Base64/Base64.pm MIME::Base64 extension cpan/MIME-Base64/Base64.xs MIME::Base64 extension -cpan/MIME-Base64/Changes MIME::Base64 extension -cpan/MIME-Base64/Makefile.PL MIME::Base64 extension cpan/MIME-Base64/QuotedPrint.pm MIME::Base64 extension -cpan/MIME-Base64/README README for MIME::Base64 cpan/MIME-Base64/t/base64.t See whether MIME::Base64 works cpan/MIME-Base64/t/length.t See whether MIME::QuotedPrint works cpan/MIME-Base64/t/quoted-print.t See whether MIME::QuotedPrint works cpan/MIME-Base64/t/unicode.t See whether MIME::Base64 works cpan/Module-Build/bin/config_data -cpan/Module-Build/Changes cpan/Module-Build/lib/inc/latest.pm cpan/Module-Build/lib/inc/latest/private.pm cpan/Module-Build/lib/Module/Build/API.pod @@ -1689,15 +1605,11 @@ cpan/Module-Build/lib/Module/Build/Dumpe cpan/Module-Build/lib/Module/Build/ModuleInfo.pm cpan/Module-Build/lib/Module/Build/Notes.pm cpan/Module-Build/lib/Module/Build/Platform/aix.pm -cpan/Module-Build/lib/Module/Build/Platform/Amiga.pm cpan/Module-Build/lib/Module/Build/Platform/cygwin.pm cpan/Module-Build/lib/Module/Build/Platform/darwin.pm cpan/Module-Build/lib/Module/Build/Platform/Default.pm -cpan/Module-Build/lib/Module/Build/Platform/EBCDIC.pm cpan/Module-Build/lib/Module/Build/Platform/MacOS.pm -cpan/Module-Build/lib/Module/Build/Platform/MPEiX.pm cpan/Module-Build/lib/Module/Build/Platform/os2.pm -cpan/Module-Build/lib/Module/Build/Platform/RiscOS.pm cpan/Module-Build/lib/Module/Build/Platform/Unix.pm cpan/Module-Build/lib/Module/Build/Platform/VMS.pm cpan/Module-Build/lib/Module/Build/Platform/VOS.pm @@ -1710,6 +1622,8 @@ cpan/Module-Build/lib/Module/Build/YAML. cpan/Module-Build/t/00-compile.t cpan/Module-Build/t/actions/installdeps.t cpan/Module-Build/t/actions/manifest_skip.t +cpan/Module-Build/t/add_property_array.t +cpan/Module-Build/t/add_property_hash.t cpan/Module-Build/t/add_property.t cpan/Module-Build/t/basic.t cpan/Module-Build/t/bundled/Software/License.pm @@ -1730,6 +1644,7 @@ cpan/Module-Build/t/lib/MBTest.pm cpan/Module-Build/t/lib/Module/Signature.pm cpan/Module-Build/t/lib/Software/License/VaporWare.pm cpan/Module-Build/t/manifypods.t +cpan/Module-Build/t/manifypods_with_utf8.t cpan/Module-Build/t/metadata2.t cpan/Module-Build/t/metadata.t cpan/Module-Build/t/mymeta.t @@ -1753,9 +1668,11 @@ cpan/Module-Build/t/runthrough.t cpan/Module-Build/t/sample.t cpan/Module-Build/t/script_dist.t cpan/Module-Build/t/test_file_exts.t +cpan/Module-Build/t/test_reqs.t cpan/Module-Build/t/test_types.t cpan/Module-Build/t/test_type.t cpan/Module-Build/t/tilde.t +cpan/Module-Build/t/unit_run_test_harness.t cpan/Module-Build/t/use_tap_harness.t cpan/Module-Build/t/versions.t cpan/Module-Build/t/write_default_maniskip.t @@ -1764,11 +1681,13 @@ cpan/Module-Load-Conditional/lib/Module/ cpan/Module-Load-Conditional/t/01_Module_Load_Conditional.t Module::Conditional tests cpan/Module-Load-Conditional/t/test_lib/a/X.pm Module::Conditional tests cpan/Module-Load-Conditional/t/test_lib/b/X.pm Module::Conditional tests +cpan/Module-Load-Conditional/t/to_load/AutoLoad.pm Module::Conditional tests cpan/Module-Load-Conditional/t/to_load/Commented.pm Module::Conditional tests cpan/Module-Load-Conditional/t/to_load/InPod.pm Module::Load::Conditional tests cpan/Module-Load-Conditional/t/to_load/LoadIt.pm Module::Conditional tests cpan/Module-Load-Conditional/t/to_load/LoadMe.pl Module::Conditional tests cpan/Module-Load-Conditional/t/to_load/MustBe/Loaded.pm Module::Load::Conditional tests +cpan/Module-Load-Conditional/t/to_load/NotAutoLoad.pm Module::Conditional tests cpan/Module-Load-Conditional/t/to_load/NotMain.pm Module::Conditional tests cpan/Module-Load-Conditional/t/to_load/NotX.pm Module::Conditional tests cpan/Module-Load-Conditional/t/to_load/ToBeLoaded Module::Conditional tests @@ -1776,6 +1695,7 @@ cpan/Module-Loaded/lib/Module/Loaded.pm cpan/Module-Loaded/t/01_Module-Loaded.t Module::Loaded tests cpan/Module-Load/lib/Module/Load.pm Module::Load cpan/Module-Load/t/01_Module-Load.t Module::Load tests +cpan/Module-Load/t/02_Module-Load.t Module::Load tests cpan/Module-Load/t/to_load/config_file Module::Load tests cpan/Module-Load/t/to_load/LoadIt.pm Module::Load tests cpan/Module-Load/t/to_load/LoadMe.pl Module::Load tests @@ -1783,90 +1703,21 @@ cpan/Module-Load/t/to_load/Must/Be/Loade cpan/Module-Load/t/to_load/TestModule.pm Module::Load tests cpan/Module-Load/t/to_load/ToBeLoaded Module::Load tests cpan/Module-Metadata/lib/Module/Metadata.pm +cpan/Module-Metadata/t/contains_pod.t cpan/Module-Metadata/t/encoding.t +cpan/Module-Metadata/t/endpod.t cpan/Module-Metadata/t/lib/0_1/Foo.pm cpan/Module-Metadata/t/lib/0_2/Foo.pm cpan/Module-Metadata/t/lib/BOMTest/UTF16BE.pm cpan/Module-Metadata/t/lib/BOMTest/UTF16LE.pm cpan/Module-Metadata/t/lib/BOMTest/UTF8.pm cpan/Module-Metadata/t/lib/DistGen.pm +cpan/Module-Metadata/t/lib/ENDPOD.pm cpan/Module-Metadata/t/lib/MBTest.pm cpan/Module-Metadata/t/lib/Tie/CPHash.pm cpan/Module-Metadata/t/metadata.t +cpan/Module-Metadata/t/taint.t cpan/Module-Metadata/t/version.t -cpan/Module-Pluggable/lib/Devel/InnerPackage.pm Find inner packages -cpan/Module-Pluggable/lib/Module/Pluggable/Object.pm Module::Pluggable -cpan/Module-Pluggable/lib/Module/Pluggable.pm Module::Pluggable -cpan/Module-Pluggable/Makefile.PL Module::Pluggable -cpan/Module-Pluggable/t/01use.t Module::Pluggable tests -cpan/Module-Pluggable/t/02alsoworks.t Module::Pluggable tests -cpan/Module-Pluggable/t/02works.t Module::Pluggable tests -cpan/Module-Pluggable/t/02works_taint.t Module::Pluggable tests -cpan/Module-Pluggable/t/03diffname.t Module::Pluggable tests -cpan/Module-Pluggable/t/04acmedir_single.t Module::Pluggable tests -cpan/Module-Pluggable/t/04acmedir.t Module::Pluggable tests -cpan/Module-Pluggable/t/04acmepath_single.t Module::Pluggable tests -cpan/Module-Pluggable/t/04acmepath.t Module::Pluggable tests -cpan/Module-Pluggable/t/05postpath.t Module::Pluggable tests -cpan/Module-Pluggable/t/06multipath.t Module::Pluggable tests -cpan/Module-Pluggable/t/07instantiate.t Module::Pluggable tests -cpan/Module-Pluggable/t/08nothing.t Module::Pluggable tests -cpan/Module-Pluggable/t/09require.t Module::Pluggable tests -cpan/Module-Pluggable/t/10innerpack_inner.t Module::Pluggable tests -cpan/Module-Pluggable/t/10innerpack_noinner.t Module::Pluggable tests -cpan/Module-Pluggable/t/10innerpack_onefile.t Module::Pluggable tests -cpan/Module-Pluggable/t/10innerpack_override.t Module::Pluggable tests -cpan/Module-Pluggable/t/10innerpack_super.t Module::Pluggable tests -cpan/Module-Pluggable/t/10innerpack.t Module::Pluggable tests -cpan/Module-Pluggable/t/11usetwice.t Module::Pluggable tests -cpan/Module-Pluggable/t/12onlyarray.t Module::Pluggable tests -cpan/Module-Pluggable/t/12onlyregex.t Module::Pluggable tests -cpan/Module-Pluggable/t/12onlyrequire.t Module::Pluggable tests -cpan/Module-Pluggable/t/12only.t Module::Pluggable tests -cpan/Module-Pluggable/t/13exceptarray.t Module::Pluggable tests -cpan/Module-Pluggable/t/13exceptregex.t Module::Pluggable tests -cpan/Module-Pluggable/t/13except.t Module::Pluggable tests -cpan/Module-Pluggable/t/14package.t Module::Pluggable tests -cpan/Module-Pluggable/t/15topicsafe.t Module::Pluggable tests -cpan/Module-Pluggable/t/16different_extension.t Module::Pluggable tests -cpan/Module-Pluggable/t/17devel_inner_package.t Module::Pluggable tests -cpan/Module-Pluggable/t/18skipped_package.t Module::Pluggable tests -cpan/Module-Pluggable/t/19can_ok_clobber.t Module::Pluggable tests -cpan/Module-Pluggable/t/20dodgy_files.t Module::Pluggable tests -cpan/Module-Pluggable/t/21editor_junk.t Module::Pluggable tests -cpan/Module-Pluggable/t/22trigger.t Module::Pluggable tests -cpan/Module-Pluggable/t/23depth.t Module::Pluggable tests -cpan/Module-Pluggable/t/24local_inc_object.t Module::Pluggable tests -cpan/Module-Pluggable/t/24local_inc_package.t Module::Pluggable tests -cpan/Module-Pluggable/t/acme/Acme/MyTest/Plugin/Foo.pm Module::Pluggable tests -cpan/Module-Pluggable/t/lib/Acme/Foo-Bar.pm Module::Pluggable tests -cpan/Module-Pluggable/t/lib/Acme/MyTest/Plugin/Foo.pm Module::Pluggable tests -cpan/Module-Pluggable/t/lib/EditorJunk/Plugin/Bar.pm Module::Pluggable tests -cpan/Module-Pluggable/t/lib/EditorJunk/Plugin/Bar.pm.swo Module::Pluggable tests -cpan/Module-Pluggable/t/lib/EditorJunk/Plugin/Bar.pm.swp Module::Pluggable tests -cpan/Module-Pluggable/t/lib/EditorJunk/Plugin/Foo.pm Module::Pluggable tests -cpan/Module-Pluggable/t/lib/ExtTest/Plugin/Bar.plugin Module::Pluggable tests -cpan/Module-Pluggable/t/lib/ExtTest/Plugin/Foo.plugin Module::Pluggable tests -cpan/Module-Pluggable/t/lib/ExtTest/Plugin/Quux/Foo.plugin Module::Pluggable tests -cpan/Module-Pluggable/t/lib/InnerTest/Plugin/Foo.pm Module::Pluggable tests -cpan/Module-Pluggable/t/lib/MyOtherTest/Plugin/Bar.pm Module::Pluggable tests -cpan/Module-Pluggable/t/lib/MyOtherTest/Plugin/Foo.pm Module::Pluggable tests -cpan/Module-Pluggable/t/lib/MyOtherTest/Plugin/Quux/Foo.pm Module::Pluggable tests -cpan/Module-Pluggable/t/lib/MyOtherTest/Plugin/Quux.pm Module::Pluggable tests -cpan/Module-Pluggable/t/lib/MyTest/Extend/Plugin/Bar.pm Module::Pluggable tests -cpan/Module-Pluggable/t/lib/MyTest/Plugin/Bar.pm Module::Pluggable tests -cpan/Module-Pluggable/t/lib/MyTest/Plugin/Foo.pm Module::Pluggable tests -cpan/Module-Pluggable/t/lib/MyTest/Plugin/Quux/Foo.pm Module::Pluggable tests -cpan/Module-Pluggable/t/lib/No/Middle.pm Module::Pluggable tests -cpan/Module-Pluggable/t/lib/OddTest/Plugin/Foo.pm Module::Pluggable tests -cpan/Module-Pluggable/t/lib/TA/C/A/I.pm Module::Pluggable tests -cpan/Module-Pluggable/t/lib/Text/Abbrev.pm Module::Pluggable tests -cpan/Module-Pluggable/t/lib/TriggerTest/Plugin/After.pm Module::Pluggable tests -cpan/Module-Pluggable/t/lib/TriggerTest/Plugin/CallbackAllow.pm Module::Pluggable tests -cpan/Module-Pluggable/t/lib/TriggerTest/Plugin/CallbackDeny.pm Module::Pluggable tests -cpan/Module-Pluggable/t/lib/TriggerTest/Plugin/Deny.pm Module::Pluggable tests -cpan/Module-Pluggable/t/lib/TriggerTest/Plugin/Error.pm Module::Pluggable tests -cpan/Module-Pluggable/t/lib/Zot/.Zork.pm Module::Pluggable tests cpan/NEXT/lib/NEXT.pm Pseudo-class NEXT for method redispatch cpan/NEXT/t/actual.t NEXT cpan/NEXT/t/actuns.t NEXT @@ -1874,14 +1725,6 @@ cpan/NEXT/t/dynamically_scoped_regex_var cpan/NEXT/t/next.t NEXT cpan/NEXT/t/stringify.t NEXT cpan/NEXT/t/unseen.t NEXT -cpan/Object-Accessor/lib/Object/Accessor.pm Object::Accessor -cpan/Object-Accessor/t/00_Object-Accessor.t Object::Accessor tests -cpan/Object-Accessor/t/01_Object-Accessor-Subclassed.t Object::Accessor tests -cpan/Object-Accessor/t/02_Object-Accessor-allow.t Object::Accessor tests -cpan/Object-Accessor/t/03_Object-Accessor-local.t Object::Accessor tests -cpan/Object-Accessor/t/04_Object-Accessor-lvalue.t Object::Accessor tests -cpan/Object-Accessor/t/05_Object-Accessor-callback.t Object::Accessor tests -cpan/Object-Accessor/t/06_Object-Accessor-alias.t Object::Accessor tests cpan/OpenBSD-MkTemp/lib/OpenBSD/MkTemp.pm OpenBSD::MkTemp cpan/OpenBSD-MkTemp/MkTemp.xs OpenBSD::MkTemp cpan/OpenBSD-MkTemp/README OpenBSD::MkTemp Readme @@ -1903,15 +1746,17 @@ cpan/parent/t/parent-classfromfile.t te cpan/parent/t/parent-pmc.t tests for parent.pm cpan/parent/t/parent-returns-false.t tests for parent.pm cpan/parent/t/parent.t tests for parent.pm -cpan/Parse-CPAN-Meta/Changes cpan/Parse-CPAN-Meta/lib/Parse/CPAN/Meta.pm -cpan/Parse-CPAN-Meta/t/01_compile.t cpan/Parse-CPAN-Meta/t/02_api.t cpan/Parse-CPAN-Meta/t/03_functions.t cpan/Parse-CPAN-Meta/t/04_export.t cpan/Parse-CPAN-Meta/t/05_errors.t -cpan/Parse-CPAN-Meta/t/data/VR-META.json -cpan/Parse-CPAN-Meta/t/data/VR-META.yml +cpan/Parse-CPAN-Meta/t/data/BadMETA.yml +cpan/Parse-CPAN-Meta/t/data/bareyaml.meta +cpan/Parse-CPAN-Meta/t/data/json.meta +cpan/Parse-CPAN-Meta/t/data/META-VR.json +cpan/Parse-CPAN-Meta/t/data/META-VR.yml +cpan/Parse-CPAN-Meta/t/data/yaml.meta cpan/Parse-CPAN-Meta/t/lib/Parse/CPAN/Meta/Test.pm cpan/perlfaq/lib/perlfaq1.pod General Questions About Perl cpan/perlfaq/lib/perlfaq2.pod Obtaining and Learning about Perl @@ -1940,16 +1785,10 @@ cpan/Pod-Checker/t/pod/poderrs.xr cpan/Pod-Checker/t/pod/selfcheck.t cpan/Pod-Checker/t/pod/testcmp.pl cpan/Pod-Checker/t/pod/testpchk.pl -cpan/Pod-Escapes/ChangeLog ChangeLog for Pod::Escapes cpan/Pod-Escapes/lib/Pod/Escapes.pm Pod::Escapes -cpan/Pod-Escapes/README README for Pod::Escapes cpan/Pod-Escapes/t/01_about_verbose.t test Pod::Escapes cpan/Pod-Escapes/t/10_main.t test Pod::Escapes cpan/Pod-Escapes/t/15_name2charnum.t test Pod::Escapes -cpan/Pod-LaTeX/lib/Pod/LaTeX.pm Convert POD data to LaTeX -cpan/Pod-LaTeX/pod2latex.PL Precursor for translator to turn pod into LaTeX -cpan/Pod-LaTeX/t/pod2latex.t See if Pod::LaTeX works -cpan/Pod-LaTeX/t/user.t See if Pod::LaTeX works cpan/podlators/lib/Pod/Man.pm Convert POD data to *roff cpan/podlators/lib/Pod/ParseLink.pm Perl an L<> formatting code in POD text cpan/podlators/lib/Pod/Text/Color.pm Convert POD data to color ASCII text @@ -1968,6 +1807,7 @@ cpan/podlators/t/basic.txt podlators t cpan/podlators/t/color.t podlators test cpan/podlators/t/devise-date.t podlators test cpan/podlators/t/filehandle.t podlators test +cpan/podlators/t/man-empty.t podlators test cpan/podlators/t/man-heading.t podlators test cpan/podlators/t/man-options.t podlators test cpan/podlators/t/man-perlio.t podlators test @@ -1979,6 +1819,7 @@ cpan/podlators/t/pod-parser.t podlator cpan/podlators/t/pod-spelling.t podlators test cpan/podlators/t/pod.t podlators test cpan/podlators/t/termcap.t podlators test +cpan/podlators/t/text-empty.t podlators test cpan/podlators/t/text-encoding.t podlators test cpan/podlators/t/text-options.t podlators test cpan/podlators/t/text-perlio.t podlators test @@ -2030,7 +1871,6 @@ cpan/Pod-Parser/t/pod/twice.t Test Pod cpan/Pod-Perldoc/corpus/no-head.pod test file for Pod-Perldoc cpan/Pod-Perldoc/corpus/perlfunc.pod test file for Pod-Perldoc cpan/Pod-Perldoc/corpus/utf8.pod test file for Pod-Perldoc -cpan/Pod-Perldoc/lib/perldoc.pod Look up Perl documentation in Pod format cpan/Pod-Perldoc/lib/Pod/Perldoc/BaseTo.pm utility module for perldoc cpan/Pod-Perldoc/lib/Pod/Perldoc/GetOptsOO.pm options parsing for perldoc cpan/Pod-Perldoc/lib/Pod/Perldoc.pm guts of the 'perldoc' utility @@ -2044,10 +1884,11 @@ cpan/Pod-Perldoc/lib/Pod/Perldoc/ToTerm. cpan/Pod-Perldoc/lib/Pod/Perldoc/ToText.pm convert POD to plain text cpan/Pod-Perldoc/lib/Pod/Perldoc/ToTk.pm convert POD via Tk::Pod cpan/Pod-Perldoc/lib/Pod/Perldoc/ToXml.pm convert POD to XML +cpan/Pod-Perldoc/Makefile.PL +cpan/Pod-Perldoc/perldoc.pod cpan/Pod-Perldoc/t/load.t test file for Pod-Perldoc cpan/Pod-Perldoc/t/man/_get_columns.t test file for Pod-Perldoc cpan/Pod-Perldoc/t/pod.t test file for Pod-Perldoc -cpan/Pod-Simple/ChangeLog Pod::Simple ChangeLog cpan/Pod-Simple/lib/Pod/Simple/BlackBox.pm Pod::Simple::BlackBox cpan/Pod-Simple/lib/Pod/Simple/Checker.pm check the Pod syntax of a document cpan/Pod-Simple/lib/Pod/Simple/Debug.pm put Pod::Simple into trace/debug mode @@ -2078,7 +1919,6 @@ cpan/Pod-Simple/lib/Pod/Simple/Transcode cpan/Pod-Simple/lib/Pod/Simple/TranscodeSmart.pm Pod::Simple::TranscodeSmart cpan/Pod-Simple/lib/Pod/Simple/XHTML.pm turn Pod into XHTML cpan/Pod-Simple/lib/Pod/Simple/XMLOutStream.pm turn Pod into XML -cpan/Pod-Simple/README Pod::Simple README file cpan/Pod-Simple/t/00about.t Pod::Simple test file cpan/Pod-Simple/t/20_skip.t Pod::Simple test file cpan/Pod-Simple/t/accept01.t Pod::Simple test file @@ -2252,6 +2092,39 @@ cpan/Pod-Usage/t/pod/testcmp.pl cpan/Pod-Usage/t/pod/testp2pt.pl cpan/Pod-Usage/t/pod/usage2.pod cpan/Pod-Usage/t/pod/usage.pod +cpan/Scalar-List-Utils/lib/List/Util.pm List::Util +cpan/Scalar-List-Utils/lib/List/Util/XS.pm List::Util +cpan/Scalar-List-Utils/lib/Scalar/Util.pm Scalar::Util +cpan/Scalar-List-Utils/ListUtil.xs Util extension +cpan/Scalar-List-Utils/Makefile.PL Util extension +cpan/Scalar-List-Utils/multicall.h Util extension +cpan/Scalar-List-Utils/t/00version.t Scalar::Util +cpan/Scalar-List-Utils/t/any-all.t List::Util +cpan/Scalar-List-Utils/t/blessed.t Scalar::Util +cpan/Scalar-List-Utils/t/dualvar.t Scalar::Util +cpan/Scalar-List-Utils/t/first.t List::Util +cpan/Scalar-List-Utils/t/getmagic-once.t +cpan/Scalar-List-Utils/t/isvstring.t Scalar::Util +cpan/Scalar-List-Utils/t/lln.t Scalar::Util +cpan/Scalar-List-Utils/t/maxstr.t List::Util +cpan/Scalar-List-Utils/t/max.t List::Util +cpan/Scalar-List-Utils/t/minstr.t List::Util +cpan/Scalar-List-Utils/t/min.t List::Util +cpan/Scalar-List-Utils/t/multicall-refcount.t +cpan/Scalar-List-Utils/t/openhan.t Scalar::Util +cpan/Scalar-List-Utils/t/pair.t +cpan/Scalar-List-Utils/t/product.t List::Util +cpan/Scalar-List-Utils/t/proto.t Scalar::Util +cpan/Scalar-List-Utils/t/readonly.t Scalar::Util +cpan/Scalar-List-Utils/t/reduce.t List::Util +cpan/Scalar-List-Utils/t/refaddr.t Scalar::Util +cpan/Scalar-List-Utils/t/reftype.t Scalar::Util +cpan/Scalar-List-Utils/t/shuffle.t List::Util +cpan/Scalar-List-Utils/t/stack-corruption.t List::Util +cpan/Scalar-List-Utils/t/sum0.t +cpan/Scalar-List-Utils/t/sum.t List::Util +cpan/Scalar-List-Utils/t/tainted.t Scalar::Util +cpan/Scalar-List-Utils/t/weak.t Scalar::Util cpan/Socket/Makefile.PL Socket extension makefile writer cpan/Socket/Socket.pm Socket extension Perl module cpan/Socket/Socket.xs Socket extension external subroutines @@ -2263,13 +2136,10 @@ cpan/Socket/t/sockaddr.t cpan/Socket/t/socketpair.t See if socketpair works cpan/Socket/t/Socket.t See if Socket works cpan/Socket/typemap -cpan/Sys-Syslog/Changes Changelog for Sys::Syslog cpan/Sys-Syslog/fallback/const-c.inc Sys::Syslog constants fallback file cpan/Sys-Syslog/fallback/const-xs.inc Sys::Syslog constants fallback file cpan/Sys-Syslog/fallback/syslog.h Sys::Syslog header fallback file cpan/Sys-Syslog/Makefile.PL Sys::Syslog extension makefile writer -cpan/Sys-Syslog/README README for Sys::Syslog -cpan/Sys-Syslog/README.win32 README for Sys::Syslog on Windows cpan/Sys-Syslog/Syslog.pm Sys::Syslog extension Perl module cpan/Sys-Syslog/Syslog.xs Sys::Syslog extension external subroutines cpan/Sys-Syslog/t/00-load.t test for Sys::Syslog @@ -2282,8 +2152,6 @@ cpan/Sys-Syslog/win32/PerlLog.mc Sys::Sy cpan/Sys-Syslog/win32/PerlLog_RES.uu Sys::Syslog extension Win32 related file cpan/Sys-Syslog/win32/Win32.pm Sys::Syslog extension Win32 related file cpan/Term-ANSIColor/ANSIColor.pm Perl module supporting termcap usage -cpan/Term-ANSIColor/ChangeLog Term::ANSIColor -cpan/Term-ANSIColor/README Term::ANSIColor cpan/Term-ANSIColor/t/aliases-func.t cpan/Term-ANSIColor/t/basic256.t cpan/Term-ANSIColor/t/basic.t Tests for Term::ANSIColor @@ -2292,13 +2160,7 @@ cpan/Term-ANSIColor/t/stringify.t Tests cpan/Term-ANSIColor/t/taint.t cpan/Term-Cap/Cap.pm Perl module supporting termcap usage cpan/Term-Cap/test.pl See if Term::Cap works -cpan/Term-UI/lib/Term/UI/History.pm Term::UI -cpan/Term-UI/lib/Term/UI.pm Term::UI -cpan/Term-UI/t/00_load.t Term::UI tests -cpan/Term-UI/t/01_history.t Term::UI tests -cpan/Term-UI/t/02_ui.t Term::UI tests cpan/Test-Harness/bin/prove The prove harness utility -cpan/Test-Harness/Changes Test::Harness change log cpan/Test-Harness/lib/App/Prove.pm Gubbins for the prove utility cpan/Test-Harness/lib/App/Prove/State.pm Gubbins for the prove utility cpan/Test-Harness/lib/App/Prove/State/Result.pm Gubbins for the prove utility @@ -2313,6 +2175,7 @@ cpan/Test-Harness/lib/TAP/Formatter/File cpan/Test-Harness/lib/TAP/Formatter/File/Session.pm A parser for Test Anything Protocol cpan/Test-Harness/lib/TAP/Formatter/Session.pm A parser for Test Anything Protocol cpan/Test-Harness/lib/TAP/Harness/Beyond.pod +cpan/Test-Harness/lib/TAP/Harness/Env.pm A parser for Test Anything Protocol cpan/Test-Harness/lib/TAP/Harness.pm A parser for Test Anything Protocol cpan/Test-Harness/lib/TAP/Object.pm A parser for Test Anything Protocol cpan/Test-Harness/lib/TAP/Parser/Aggregator.pm A parser for Test Anything Protocol @@ -2344,13 +2207,9 @@ cpan/Test-Harness/lib/TAP/Parser/SourceH cpan/Test-Harness/lib/TAP/Parser/SourceHandler.pm A parser for Test Anything Protocol cpan/Test-Harness/lib/TAP/Parser/SourceHandler/RawTAP.pm cpan/Test-Harness/lib/TAP/Parser/Source.pm A parser for Test Anything Protocol -cpan/Test-Harness/lib/TAP/Parser/Utils.pm A parser for Test Anything Protocol cpan/Test-Harness/lib/TAP/Parser/YAMLish/Reader.pm A parser for Test Anything Protocol cpan/Test-Harness/lib/TAP/Parser/YAMLish/Writer.pm A parser for Test Anything Protocol cpan/Test-Harness/lib/Test/Harness.pm A test harness -cpan/Test-Harness/MANIFEST -cpan/Test-Harness/MANIFEST.CUMMULATIVE -cpan/Test-Harness/t/000-load.t Test::Harness test cpan/Test-Harness/t/aggregator.t Test::Harness test cpan/Test-Harness/t/bailout.t Test::Harness test cpan/Test-Harness/t/base.t Test::Harness test @@ -2400,7 +2259,6 @@ cpan/Test-Harness/t/multiplexer.t Test cpan/Test-Harness/t/nested.t Test::Harness test cpan/Test-Harness/t/nofork-mux.t Test::Harness test cpan/Test-Harness/t/nofork.t Test::Harness test -cpan/Test-Harness/t/nowarn.t cpan/Test-Harness/t/object.t Test::Harness test cpan/Test-Harness/t/parser-config.t Test::Harness test cpan/Test-Harness/t/parser-subclass.t Test::Harness test @@ -2499,14 +2357,10 @@ cpan/Test-Harness/t/subclass_tests/perl_ cpan/Test-Harness/t/taint.t Test::Harness test cpan/Test-Harness/t/testargs.t Test::Harness test cpan/Test-Harness/t/unicode.t Test::Harness test -cpan/Test-Harness/t/utils.t Test::Harness test cpan/Test-Harness/t/yamlish-output.t Test::Harness test cpan/Test-Harness/t/yamlish.t Test::Harness test cpan/Test-Harness/t/yamlish-writer.t Test::Harness test cpan/Test/lib/Test.pm A simple framework for writing test scripts -cpan/Test-Simple/Changes Test::Simple changes -cpan/Test-Simple/examples/indent.pl Test::Simple examples -cpan/Test-Simple/examples/subtest.t Test::Simple examples cpan/Test-Simple/lib/Test/Builder/Module.pm Base class for test modules cpan/Test-Simple/lib/Test/Builder.pm For writing new test libraries cpan/Test-Simple/lib/Test/Builder/Tester/Color.pm Turn on color in Test::Builder::Tester @@ -2514,7 +2368,6 @@ cpan/Test-Simple/lib/Test/Builder/Tester cpan/Test-Simple/lib/Test/More.pm More utilities for writing tests cpan/Test-Simple/lib/Test/Simple.pm Basic utility for writing tests cpan/Test-Simple/lib/Test/Tutorial.pod A tutorial on writing tests -cpan/Test-Simple/README Test::Simple README cpan/Test-Simple/t/00test_harness_check.t Test::Simple test cpan/Test-Simple/t/bad_plan.t Test::Builder plan() test cpan/Test-Simple/t/bail_out.t Test::Builder BAIL_OUT test @@ -2584,7 +2437,9 @@ cpan/Test-Simple/t/lib/Test/Simple/sampl cpan/Test-Simple/t/lib/Test/Simple/sample_tests/extras.plx for exit.t cpan/Test-Simple/t/lib/Test/Simple/sample_tests/five_fail.plx for exit.t cpan/Test-Simple/t/lib/Test/Simple/sample_tests/last_minute_death.plx for exit.t +cpan/Test-Simple/t/lib/Test/Simple/sample_tests/missing_done_testing.plx for exit.t cpan/Test-Simple/t/lib/Test/Simple/sample_tests/one_fail.plx for exit.t +cpan/Test-Simple/t/lib/Test/Simple/sample_tests/one_fail_without_plan.plx for exit.t cpan/Test-Simple/t/lib/Test/Simple/sample_tests/pre_plan_death.plx for exit.t cpan/Test-Simple/t/lib/Test/Simple/sample_tests/require.plx for exit.t cpan/Test-Simple/t/lib/Test/Simple/sample_tests/success.plx for exit.t @@ -2598,7 +2453,6 @@ cpan/Test-Simple/t/new_ok.t Test::Mor cpan/Test-Simple/t/no_plan.t Test::Simple test, forgot the plan cpan/Test-Simple/t/no_tests.t Test::More test cpan/Test-Simple/t/note.t Test::More test -cpan/Test-Simple/TODO Test::Simple TODO cpan/Test-Simple/t/overload.t Test::Simple test cpan/Test-Simple/t/overload_threads.t Test::Simple test cpan/Test-Simple/t/plan_bad.t Test::Simple test @@ -2613,6 +2467,7 @@ cpan/Test-Simple/t/simple.t Test::Sim cpan/Test-Simple/t/skipall.t Test::More test, skip all tests cpan/Test-Simple/t/skip.t Test::More test, SKIP tests cpan/Test-Simple/t/subtest/args.t Test::More test +cpan/Test-Simple/t/subtest/bail_out.t Test::More test cpan/Test-Simple/t/subtest/basic.t Test::More test cpan/Test-Simple/t/subtest/die.t Test::More test cpan/Test-Simple/t/subtest/do.t Test::More test @@ -2624,6 +2479,7 @@ cpan/Test-Simple/t/subtest/line_numbers. cpan/Test-Simple/t/subtest/plan.t Test::Builder tests cpan/Test-Simple/t/subtest/predicate.t Test::Builder tests cpan/Test-Simple/t/subtest/singleton.t Test::More test +cpan/Test-Simple/t/subtest/threads.t Test::More test cpan/Test-Simple/t/subtest/todo.t Test::Builder tests cpan/Test-Simple/t/subtest/wstat.t Test::More test cpan/Test-Simple/t/tbm_doesnt_set_exported_to.t Test::Builder::Module test @@ -2634,6 +2490,9 @@ cpan/Test-Simple/t/Tester/tbt_04line_num cpan/Test-Simple/t/Tester/tbt_05faildiag.t Test::Builder::Tester test cpan/Test-Simple/t/Tester/tbt_06errormess.t Test::Builder::Tester test cpan/Test-Simple/t/Tester/tbt_07args.t Test::Builder::Tester test +cpan/Test-Simple/t/Tester/tbt_08subtest.t Test::Builder::Tester test +cpan/Test-Simple/t/Tester/tbt_09do_script.pl Test::Builder::Tester test +cpan/Test-Simple/t/Tester/tbt_09do.t Test::Builder::Tester test cpan/Test-Simple/t/threads.t Test::Builder thread-safe checks cpan/Test-Simple/t/thread_taint.t Test::Simple test cpan/Test-Simple/t/todo.t Test::More test, TODO tests @@ -2651,9 +2510,7 @@ cpan/Test/t/qr.t See if Test works cpan/Test/t/skip.t See if Test works cpan/Test/t/success.t See if Test works cpan/Test/t/todo.t See if Test works -cpan/Text-Balanced/Changes Text::Balanced cpan/Text-Balanced/lib/Text/Balanced.pm Text::Balanced -cpan/Text-Balanced/README Text::Balanced cpan/Text-Balanced/t/01_compile.t See if Text::Balanced works cpan/Text-Balanced/t/02_extbrk.t See if Text::Balanced works cpan/Text-Balanced/t/03_extcbk.t See if Text::Balanced works @@ -2666,12 +2523,6 @@ cpan/Text-Balanced/t/09_gentag.t See if cpan/Text-ParseWords/lib/Text/ParseWords.pm Perl module to split words on arbitrary delimiter cpan/Text-ParseWords/t/ParseWords.t See if Text::ParseWords works cpan/Text-ParseWords/t/taint.t See if Text::ParseWords works with tainting -cpan/Text-Soundex/Changes Changelog for Text::Soundex -cpan/Text-Soundex/README README for Text::Soundex -cpan/Text-Soundex/Soundex.pm Text::Soundex extension Perl module -cpan/Text-Soundex/Soundex.xs Text::Soundex extension external subroutines -cpan/Text-Soundex/t/Soundex.t test for Text::Soundex -cpan/Text-Tabs/CHANGELOG ChangeLog for Tabs+Wrap cpan/Text-Tabs/lib/Text/Tabs.pm Do expand and unexpand cpan/Text-Tabs/lib/Text/Wrap.pm Paragraph formatter cpan/Text-Tabs/t/37000.t See if Text::Tabs is working @@ -2695,7 +2546,6 @@ cpan/Tie-RefHash/t/rebless.t Test for Ti cpan/Tie-RefHash/t/refhash.t Test for Tie::RefHash and Tie::RefHash::Nestable cpan/Tie-RefHash/t/storable.t Test for Tie::RefHash with storable cpan/Tie-RefHash/t/threaded.t Test for Tie::RefHash with threads -cpan/Time-HiRes/Changes Time::HiRes extension cpan/Time-HiRes/fallback/const-c.inc Time::HiRes extension cpan/Time-HiRes/fallback/const-xs.inc Time::HiRes extension cpan/Time-HiRes/hints/aix.pl Hint for Time::HiRes for named architecture @@ -2724,11 +2574,8 @@ cpan/Time-HiRes/t/Watchdog.pm Test for cpan/Time-HiRes/typemap Time::HiRes extension cpan/Time-Local/lib/Time/Local.pm Reverse translation of localtime, gmtime cpan/Time-Local/t/Local.t See if Time::Local works -cpan/Time-Piece/Changes Time::Piece extension -cpan/Time-Piece/Makefile.PL Time::Piece extension cpan/Time-Piece/Piece.pm Time::Piece extension cpan/Time-Piece/Piece.xs Time::Piece extension -cpan/Time-Piece/README Time::Piece extension cpan/Time-Piece/Seconds.pm Time::Piece extension cpan/Time-Piece/t/01base.t Test for Time::Piece cpan/Time-Piece/t/02core.t Test for Time::Piece @@ -2737,7 +2584,6 @@ cpan/Time-Piece/t/04mjd.t Test for Time: cpan/Time-Piece/t/05overload.t Test for Time::Piece cpan/Time-Piece/t/06subclass.t Test for Time::Piece cpan/Time-Piece/t/07arith.t Test for Time::Piece -cpan/Unicode-Collate/Changes Unicode::Collate cpan/Unicode-Collate/Collate/allkeys.txt Unicode::Collate cpan/Unicode-Collate/Collate/CJK/Big5.pm Unicode::Collate cpan/Unicode-Collate/Collate/CJK/GB2312.pm Unicode::Collate @@ -2834,7 +2680,6 @@ cpan/Unicode-Collate/Collate.pm Unicod cpan/Unicode-Collate/Collate.xs Unicode::Collate cpan/Unicode-Collate/Makefile.PL Unicode::Collate cpan/Unicode-Collate/mkheader Unicode::Collate -cpan/Unicode-Collate/README Unicode::Collate cpan/Unicode-Collate/t/altern.t Unicode::Collate cpan/Unicode-Collate/t/backwds.t Unicode::Collate cpan/Unicode-Collate/t/cjk_b5.t Unicode::Collate @@ -2962,12 +2807,10 @@ cpan/Unicode-Collate/t/trailwt.t Unicod cpan/Unicode-Collate/t/variable.t Unicode::Collate cpan/Unicode-Collate/t/version.t Unicode::Collate cpan/Unicode-Collate/t/view.t Unicode::Collate -cpan/Unicode-Normalize/Changes Unicode::Normalize cpan/Unicode-Normalize/Makefile.PL Unicode::Normalize cpan/Unicode-Normalize/mkheader Unicode::Normalize cpan/Unicode-Normalize/Normalize.pm Unicode::Normalize cpan/Unicode-Normalize/Normalize.xs Unicode::Normalize -cpan/Unicode-Normalize/README Unicode::Normalize cpan/Unicode-Normalize/t/fcdc.t Unicode::Normalize cpan/Unicode-Normalize/t/form.t Unicode::Normalize cpan/Unicode-Normalize/t/func.t Unicode::Normalize @@ -2980,20 +2823,33 @@ cpan/Unicode-Normalize/t/proto.t Unicode cpan/Unicode-Normalize/t/split.t Unicode::Normalize cpan/Unicode-Normalize/t/test.t Unicode::Normalize cpan/Unicode-Normalize/t/tie.t Unicode::Normalize +cpan/version/lib/version/Internals.pod Description of the internals of version objects +cpan/version/lib/version.pm Support for version objects +cpan/version/lib/version.pod Documentation of the version module +cpan/version/lib/version/regex.pm Regex for matching version objects +cpan/version/lib/version/vpp.pm Pure Perl implementation of XS code +cpan/version/t/00impl-pp.t Tests for version objects +cpan/version/t/01base.t Tests for version objects +cpan/version/t/02derived.t Tests for version objects +cpan/version/t/03require.t Tests for version objects +cpan/version/t/04strict_lax.t Tests for version objects +cpan/version/t/05sigdie.t Tests for version objects +cpan/version/t/06noop.t Tests for version objects +cpan/version/t/07locale.t Tests for version objects +cpan/version/t/08_corelist.t Tests for version objects +cpan/version/t/09_list_util.t Tests for version objects +cpan/version/t/coretests.pm Tests for version objects cpan/Win32API-File/buffers.h Win32API::File extension cpan/Win32API-File/cFile.h Win32API::File extension cpan/Win32API-File/cFile.pc Win32API::File extension -cpan/Win32API-File/Changes Win32API::File extension changes cpan/Win32API-File/const2perl.h Win32API::File extension cpan/Win32API-File/ExtUtils/Myconst2perl.pm Win32API::File extension cpan/Win32API-File/File.pm Win32API::File extension cpan/Win32API-File/File.xs Win32API::File extension cpan/Win32API-File/Makefile.PL Win32API::File extension makefile write -cpan/Win32API-File/README Win32API::File extension Readme cpan/Win32API-File/t/file.t See if Win32API::File extension works cpan/Win32API-File/t/tie.t See if Win32API::File extension works cpan/Win32API-File/typemap Win32API::File extension interface types -cpan/Win32/Changes Changes for Win32 extension module cpan/Win32/longpath.inc Win32 extension long path support cpan/Win32/Makefile.PL Win32 extension makefile writer cpan/Win32/t/CodePage.t See if Win32 extension works @@ -3058,21 +2914,22 @@ dist/base/lib/base.pm Establish IS-A re dist/base/lib/fields.pm Set up object field names for pseudo-hash-using classes dist/base/MANIFEST base.pm manifest dist/base/META.yml base.pm META.yml file +dist/base/t/base-open-chunk.t See if base works +dist/base/t/base-open-line.t See if base works dist/base/t/base.t See if base works dist/base/t/compile-time.t See if base works +dist/base/t/core-global.t See if base works around CORE::GLOBAL::require dist/base/t/fields-5_6_0.t See if fields work dist/base/t/fields-5_8_0.t See if fields work dist/base/t/fields-base.t See if fields work dist/base/t/fields.t See if fields work dist/base/t/isa.t See if base's behaviour doesn't change +dist/base/t/lib/Broken.pm Test module for base.pm dist/base/t/lib/Dummy.pm Test module for base.pm dist/base/t/lib/HasSigDie.pm Module for testing base.pm dist/base/t/sigdie.t See if base works with SIGDIE dist/base/t/version.t See if base works with versions dist/base/t/warnings.t See if base works with warnings -dist/B-Deparse/Deparse.pm Compiler Deparse backend -dist/B-Deparse/t/core.t See if B::Deparse knows when to use CORE:: -dist/B-Deparse/t/deparse.t See if B::Deparse works dist/bignum/lib/bigint.pm bigint dist/bignum/lib/bignum.pm bignum dist/bignum/lib/bigrat.pm bigrat @@ -3103,7 +2960,14 @@ dist/bignum/t/scope_r.t See if no bigr dist/Carp/lib/Carp/Heavy.pm Error message retired workhorse dist/Carp/lib/Carp.pm Error message extension dist/Carp/Makefile.PL makefile writer for Carp +dist/Carp/t/arg_regexp.t See if Carp formats regexp args OK in stack traces +dist/Carp/t/arg_string.t See if Carp formats string args OK in stack traces +dist/Carp/t/baduni.t See if Carp handles non-char Unicode +dist/Carp/t/baduni_warnings.t See if Carp handles non-char Unicode when loaded via warnings.pm +dist/Carp/t/Carp_overload.t See if Carp handles overloads dist/Carp/t/Carp.t See if Carp works +dist/Carp/t/errno.t See if Carp preserves $! and $^E +dist/Carp/t/heavy_mismatch.t See if Carp::Heavy catches version mismatch dist/Carp/t/heavy.t See if Carp::Heavy works dist/Carp/t/stash_deletion.t See if Carp handles stash deletion dist/Carp/t/swash.t See if Carp avoids breaking swash loading @@ -3113,26 +2977,6 @@ dist/Carp/t/with_warnings.t See if Carp dist/constant/lib/constant.pm For "use constant" dist/constant/t/constant.t See if compile-time constants work dist/constant/t/utf8.t Test Unicode constants under utf8 pragma -dist/Cwd/Cwd.pm Various cwd routines (getcwd, fastcwd, chdir) -dist/Cwd/Cwd.xs Cwd extension external subroutines -dist/Cwd/lib/File/Spec/Cygwin.pm portable operations on Cygwin file names -dist/Cwd/lib/File/Spec/Epoc.pm portable operations on EPOC file names -dist/Cwd/lib/File/Spec/Functions.pm Function interface to File::Spec object methods -dist/Cwd/lib/File/Spec/Mac.pm portable operations on Mac file names -dist/Cwd/lib/File/Spec/OS2.pm portable operations on OS2 file names -dist/Cwd/lib/File/Spec.pm portable operations on file names -dist/Cwd/lib/File/Spec/Unix.pm portable operations on Unix file names -dist/Cwd/lib/File/Spec/VMS.pm portable operations on VMS file names -dist/Cwd/lib/File/Spec/Win32.pm portable operations on Win32 and NetWare file names -dist/Cwd/t/crossplatform.t See if File::Spec works crossplatform -dist/Cwd/t/cwd.t See if Cwd works -dist/Cwd/t/Functions.t See if File::Spec::Functions works -dist/Cwd/t/rel2abs2rel.t See if File::Spec->rel2abs/abs2rel works -dist/Cwd/t/Spec.t See if File::Spec works -dist/Cwd/t/Spec-taint.t See if File::Spec works with taint -dist/Cwd/t/taint.t See if Cwd works with taint -dist/Cwd/t/tmpdir.t See if File::Spec->tmpdir() works -dist/Cwd/t/win32.t See if Cwd works on Win32 dist/Data-Dumper/Changes Data pretty printer, changelog dist/Data-Dumper/Dumper.pm Data pretty printer, module dist/Data-Dumper/Dumper.xs Data pretty printer, externals @@ -3155,7 +2999,6 @@ dist/Data-Dumper/t/perl-74170.t Regressi dist/Data-Dumper/t/purity_deepcopy_maxdepth.t See if three Data::Dumper functions work dist/Data-Dumper/t/qr.t See if Data::Dumper works with qr|/| dist/Data-Dumper/t/quotekeys.t See if Data::Dumper::Quotekeys works -dist/Data-Dumper/t/recurse.t See if Data::Dumper::Maxrecurse works dist/Data-Dumper/t/seen.t See if Data::Dumper::Seen works dist/Data-Dumper/t/sortkeys.t See if Data::Dumper::Sortkeys works dist/Data-Dumper/t/sparseseen.t See if Data::Dumper::Sparseseen works @@ -3169,9 +3012,14 @@ dist/Dumpvalue/t/Dumpvalue.t See if Dump dist/Env/lib/Env.pm Map environment into ordinary variables dist/Env/t/array.t See if Env works for arrays dist/Env/t/env.t See if Env works +dist/Exporter/lib/Exporter/Heavy.pm Complicated routines for Exporter +dist/Exporter/lib/Exporter.pm Exporter base class +dist/Exporter/t/Exporter.t See if Exporter works +dist/Exporter/t/warn.t See if Exporter respects warning handlers dist/ExtUtils-CBuilder/Changes EU-CB change log dist/ExtUtils-CBuilder/lib/ExtUtils/CBuilder/Base.pm Base class for ExtUtils::CBuilder methods dist/ExtUtils-CBuilder/lib/ExtUtils/CBuilder/Platform/aix.pm CBuilder methods for AIX +dist/ExtUtils-CBuilder/lib/ExtUtils/CBuilder/Platform/android.pm CBuilder methods for Android dist/ExtUtils-CBuilder/lib/ExtUtils/CBuilder/Platform/cygwin.pm CBuilder methods for cygwin dist/ExtUtils-CBuilder/lib/ExtUtils/CBuilder/Platform/darwin.pm CBuilder methods for darwin dist/ExtUtils-CBuilder/lib/ExtUtils/CBuilder/Platform/dec_osf.pm CBuilder methods for OSF @@ -3215,6 +3063,7 @@ dist/ExtUtils-Manifest/t/Manifest.t S dist/ExtUtils-ParseXS/Changes ExtUtils::ParseXS change log dist/ExtUtils-ParseXS/lib/ExtUtils/ParseXS/Constants.pm ExtUtils::ParseXS guts dist/ExtUtils-ParseXS/lib/ExtUtils/ParseXS/CountLines.pm ExtUtils::ParseXS guts +dist/ExtUtils-ParseXS/lib/ExtUtils/ParseXS/Eval.pm ExtUtils::ParseXS guts dist/ExtUtils-ParseXS/lib/ExtUtils/ParseXS.pm converts Perl XS code into C code dist/ExtUtils-ParseXS/lib/ExtUtils/ParseXS.pod ExtUtils::ParseXS documentation dist/ExtUtils-ParseXS/lib/ExtUtils/ParseXS/Utilities.pm ExtUtils::ParseXS guts @@ -3230,14 +3079,12 @@ dist/ExtUtils-ParseXS/lib/perlxstypemap. dist/ExtUtils-ParseXS/t/001-basic.t See if ExtUtils::ParseXS works dist/ExtUtils-ParseXS/t/002-more.t Extended ExtUtils::ParseXS testing dist/ExtUtils-ParseXS/t/003-usage.t ExtUtils::ParseXS tests -dist/ExtUtils-ParseXS/t/004-nolinenumbers.t ExtUtils::ParseXS tests dist/ExtUtils-ParseXS/t/101-standard_typemap_locations.t ExtUtils::ParseXS tests dist/ExtUtils-ParseXS/t/102-trim_whitespace.t ExtUtils::ParseXS tests dist/ExtUtils-ParseXS/t/103-tidy_type.t ExtUtils::ParseXS tests dist/ExtUtils-ParseXS/t/104-map_type.t ExtUtils::ParseXS tests dist/ExtUtils-ParseXS/t/105-valid_proto_string.t ExtUtils::ParseXS tests dist/ExtUtils-ParseXS/t/106-process_typemaps.t ExtUtils::ParseXS tests -dist/ExtUtils-ParseXS/t/107-make_targetable.t ExtUtils::ParseXS tests dist/ExtUtils-ParseXS/t/108-map_type.t ExtUtils::ParseXS tests dist/ExtUtils-ParseXS/t/109-standard_XS_defs.t ExtUtils::ParseXS tests dist/ExtUtils-ParseXS/t/110-assign_func_args.t ExtUtils::ParseXS tests @@ -3253,6 +3100,8 @@ dist/ExtUtils-ParseXS/t/512-t-file.t dist/ExtUtils-ParseXS/t/513-t-merge.t ExtUtils::Typemaps tests dist/ExtUtils-ParseXS/t/514-t-embed.t ExtUtils::Typemaps tests dist/ExtUtils-ParseXS/t/515-t-cmd.t ExtUtils::Typemaps tests +dist/ExtUtils-ParseXS/t/516-t-clone.t ExtUtils::Typemaps tests +dist/ExtUtils-ParseXS/t/517-t-targetable.t ExtUtils::Typemaps tests dist/ExtUtils-ParseXS/t/600-t-compat.t ExtUtils::Typemaps tests dist/ExtUtils-ParseXS/t/data/b.typemap ExtUtils::Typemaps test data dist/ExtUtils-ParseXS/t/data/combined.typemap ExtUtils::Typemaps test data @@ -3366,6 +3215,7 @@ dist/Locale-Maketext/t/50_super.t See dist/Locale-Maketext/t/60_super.t See if Locale::Maketext works dist/Locale-Maketext/t/70_fail_auto.t See if Locale::Maketext works dist/Locale-Maketext/t/90_utf8.t See if Locale::Maketext works +dist/Locale-Maketext/t/91_backslash.t See if Locale::Maketext works dist/Math-BigInt-FastCalc/FastCalc.xs Math::BigInt::FastCalc extension dist/Math-BigInt-FastCalc/lib/Math/BigInt/FastCalc.pm Math::BigInt::FastCalc extension dist/Math-BigInt-FastCalc/t/bigintfc.t Math::BigInt::FastCalc extension @@ -3460,9 +3310,10 @@ dist/Module-CoreList/Makefile.PL Module dist/Module-CoreList/MANIFEST Module::CoreList dist/Module-CoreList/README Module::CoreList dist/Module-CoreList/t/corelist.t Module::CoreList tests +dist/Module-CoreList/t/corevers.t Module::CoreList tests dist/Module-CoreList/t/deprecated.t Module::CoreList tests dist/Module-CoreList/t/find_modules.t Module::CoreList tests -dist/Module-CoreList/t/is_core.t Module::CoreList tests +dist/Module-CoreList/t/is_core.t Module::CoreList tests dist/Module-CoreList/t/pod.t Module::CoreList tests dist/Module-CoreList/t/utils.t Module::CoreList tests dist/Net-Ping/Changes Net::Ping @@ -3483,6 +3334,27 @@ dist/Net-Ping/t/450_service.t Ping Net: dist/Net-Ping/t/500_ping_icmp.t Ping Net::Ping dist/Net-Ping/t/510_ping_udp.t Ping Net::Ping dist/Net-Ping/t/520_icmp_ttl.t Ping Net::Ping +dist/PathTools/Cwd.pm Various cwd routines (getcwd, fastcwd, chdir) +dist/PathTools/Cwd.xs Cwd extension external subroutines +dist/PathTools/lib/File/Spec/Cygwin.pm portable operations on Cygwin file names +dist/PathTools/lib/File/Spec/Epoc.pm portable operations on EPOC file names +dist/PathTools/lib/File/Spec/Functions.pm Function interface to File::Spec object methods +dist/PathTools/lib/File/Spec/Mac.pm portable operations on Mac file names +dist/PathTools/lib/File/Spec/OS2.pm portable operations on OS2 file names +dist/PathTools/lib/File/Spec.pm portable operations on file names +dist/PathTools/lib/File/Spec/Unix.pm portable operations on Unix file names +dist/PathTools/lib/File/Spec/VMS.pm portable operations on VMS file names +dist/PathTools/lib/File/Spec/Win32.pm portable operations on Win32 and NetWare file names +dist/PathTools/Makefile.PL makefile writer for Cwd +dist/PathTools/t/crossplatform.t See if File::Spec works crossplatform +dist/PathTools/t/cwd.t See if Cwd works +dist/PathTools/t/Functions.t See if File::Spec::Functions works +dist/PathTools/t/rel2abs2rel.t See if File::Spec->rel2abs/abs2rel works +dist/PathTools/t/Spec.t See if File::Spec works +dist/PathTools/t/Spec-taint.t See if File::Spec works with taint +dist/PathTools/t/taint.t See if Cwd works with taint +dist/PathTools/t/tmpdir.t See if File::Spec->tmpdir() works +dist/PathTools/t/win32.t See if Cwd works on Win32 dist/Safe/Changes Changes for Safe.pm dist/Safe/Makefile.PL Makefile.PL for Safe.pm dist/Safe/MANIFEST MANIFEST for Safe.pm @@ -3521,6 +3393,7 @@ dist/Storable/Storable.pm Storable exte dist/Storable/Storable.xs Storable extension dist/Storable/t/attach_errors.t Trigger and test STORABLE_attach errors dist/Storable/t/attach_singleton.t Test STORABLE_attach for the Singleton pattern +dist/Storable/t/attach.t Check STORABLE_attach doesn't create objects unnecessarily dist/Storable/t/blessed.t See if Storable works dist/Storable/t/canonical.t See if Storable works dist/Storable/t/circular_hook.t Test thaw hook called depth-first for circular refs @@ -3529,6 +3402,7 @@ dist/Storable/t/compat01.t See if Stora dist/Storable/t/compat06.t See if Storable works dist/Storable/t/croak.t See if Storable works dist/Storable/t/dclone.t See if Storable works +dist/Storable/t/destroy.t Test Storable in global destructon dist/Storable/t/downgrade.t See if Storable works dist/Storable/t/file_magic.t See if file_magic function works dist/Storable/t/forgive.t See if Storable works @@ -3539,6 +3413,7 @@ dist/Storable/t/HAS_OVERLOAD.pm For aut dist/Storable/t/integer.t See if Storable works dist/Storable/t/interwork56.t Test compatibility kludge for 64bit data under 5.6.x dist/Storable/t/just_plain_nasty.t See if Storable works +dist/Storable/t/leaks.t See if Storable leaks (skips in core) dist/Storable/t/lock.t See if Storable works dist/Storable/t/make_56_interwork.pl Make test data for interwork56.t dist/Storable/t/make_downgrade.pl Make test data for downgrade.t @@ -3556,6 +3431,7 @@ dist/Storable/t/testlib.pl more helper dist/Storable/t/threads.t Does Storable work with threads? dist/Storable/t/tied_hook.t See if Storable works dist/Storable/t/tied_items.t See if Storable works +dist/Storable/t/tied_store.t See if Storable works dist/Storable/t/tied.t See if Storable works dist/Storable/t/utf8hash.t See if Storable works dist/Storable/t/utf8.t See if Storable works @@ -3742,15 +3618,14 @@ ext/B/t/walkoptree.t See if B::walkoptre ext/B/t/xref.t See if B::Xref works ext/B/typemap Compiler backend interface types ext/Devel-Peek/Changes Data debugging tool, changelog -ext/Devel-Peek/Makefile.PL Data debugging tool, makefile writer ext/Devel-Peek/Peek.pm Data debugging tool, module and pod ext/Devel-Peek/Peek.xs Data debugging tool, externals ext/Devel-Peek/t/Peek.t See if Devel::Peek works ext/DynaLoader/dl_aix.xs AIX implementation -ext/DynaLoader/dl_dld.xs GNU dld style implementation ext/DynaLoader/dl_dllload.xs S/390 dllload() style implementation ext/DynaLoader/dl_dlopen.xs BSD/SunOS4&5 dlopen() style implementation ext/DynaLoader/dl_dyld.xs NeXT/Apple dyld implementation +ext/DynaLoader/dl_freemint.xs GNU dld style implementation for FreeMINT ext/DynaLoader/dl_hpux.xs HP-UX implementation ext/DynaLoader/dl_next.xs NeXT implementation ext/DynaLoader/dl_none.xs Stub implementation @@ -3760,6 +3635,7 @@ ext/DynaLoader/dl_vms.xs VMS implementat ext/DynaLoader/dl_win32.xs Win32 implementation ext/DynaLoader/DynaLoader_pm.PL Dynamic Loader perl module ext/DynaLoader/hints/aix.pl Hint for DynaLoader for named architecture +ext/DynaLoader/hints/android.pl Hint for DynaLoader for named architecture ext/DynaLoader/hints/gnukfreebsd.pl Hint for DynaLoader for named architecture ext/DynaLoader/hints/gnuknetbsd.pl Hint for DynaLoader for named architecture ext/DynaLoader/hints/linux.pl Hint for DynaLoader for named architecture @@ -3773,6 +3649,7 @@ ext/Errno/ChangeLog Errno changes ext/Errno/Errno_pm.PL Errno perl module create script ext/Errno/Makefile.PL Errno extension makefile writer ext/Errno/t/Errno.t See if Errno works +ext/ExtUtils-Miniperl/lib/ExtUtils/Miniperl.pm Writes {mini,}perlmain.c ext/Fcntl/Fcntl.pm Fcntl extension Perl module ext/Fcntl/Fcntl.xs Fcntl extension external subroutines ext/Fcntl/Makefile.PL Fcntl extension makefile writer @@ -3791,6 +3668,10 @@ ext/FileCache/t/07noimport.t See if File ext/File-DosGlob/DosGlob.xs Win32 DOS-globbing module ext/File-DosGlob/lib/File/DosGlob.pm Win32 DOS-globbing module ext/File-DosGlob/t/DosGlob.t See if File::DosGlob works +ext/File-Find/lib/File/Find.pm Routines to do a find +ext/File-Find/t/find.t See if File::Find works +ext/File-Find/t/lib/Testing.pm Functions used in testing File-find +ext/File-Find/t/taint.t See if File::Find works with taint ext/File-Glob/bsd_glob.c File::Glob extension run time code ext/File-Glob/bsd_glob.h File::Glob extension header file ext/File-Glob/Changes File::Glob extension changelog @@ -3845,6 +3726,7 @@ ext/NDBM_File/hints/gnukfreebsd.pl Hint ext/NDBM_File/hints/gnuknetbsd.pl Hint for NDBM_File for named architecture ext/NDBM_File/hints/gnu.pl Hint for NDBM_File for named architecture ext/NDBM_File/hints/linux.pl Hint for NDBM_File for named architecture +ext/NDBM_File/hints/MSWin32.pl Hint for NDBM_File for named architecture ext/NDBM_File/hints/sco.pl Hint for NDBM_File for named architecture ext/NDBM_File/hints/solaris.pl Hint for NDBM_File for named architecture ext/NDBM_File/hints/svr4.pl Hint for NDBM_File for named architecture @@ -3859,7 +3741,8 @@ ext/ODBM_File/hints/gnukfreebsd.pl Hint ext/ODBM_File/hints/gnuknetbsd.pl Hint for NDBM_File for named architecture ext/ODBM_File/hints/gnu.pl Hint for ODBM_File for named architecture ext/ODBM_File/hints/hpux.pl Hint for ODBM_File for named architecture -ext/ODBM_File/hints/linux.pl Hint for NDBM_File for named architecture +ext/ODBM_File/hints/linux.pl Hint for ODBM_File for named architecture +ext/ODBM_File/hints/MSWin32.pl Hint for ODBM_File for named architecture ext/ODBM_File/hints/sco.pl Hint for ODBM_File for named architecture ext/ODBM_File/hints/solaris.pl Hint for ODBM_File for named architecture ext/ODBM_File/hints/svr4.pl Hint for ODBM_File for named architecture @@ -3876,7 +3759,6 @@ ext/Opcode/t/Opcode.t See if Opcode wor ext/Opcode/t/ops.t See if Opcode works ext/PerlIO-encoding/encoding.pm PerlIO::encoding ext/PerlIO-encoding/encoding.xs PerlIO::encoding -ext/PerlIO-encoding/MANIFEST PerlIO::encoding list of files ext/PerlIO-encoding/t/encoding.t See if PerlIO encoding conversion works ext/PerlIO-encoding/t/fallback.t See if PerlIO fallbacks work ext/PerlIO-encoding/t/nolooping.t Tests for PerlIO::encoding @@ -3895,6 +3777,7 @@ ext/Pod-Functions/Makefile.PL Makefile ext/Pod-Functions/t/Functions.t See if Pod::Functions works ext/Pod-Html/bin/pod2html Translator to turn pod into HTML ext/Pod-Html/lib/Pod/Html.pm Convert POD data to HTML +ext/Pod-Html/t/anchorify.t ext/Pod-Html/t/cache.pod ext/Pod-Html/t/cache.t ext/Pod-Html/t/crossref2.t @@ -4000,6 +3883,8 @@ ext/SDBM_File/sdbm/sdbm.c SDBM kit ext/SDBM_File/sdbm/sdbm.h SDBM kit ext/SDBM_File/sdbm/tune.h SDBM kit ext/SDBM_File/sdbm/util.c SDBM kit +ext/SDBM_File/t/constants.t See if SDBM_File constants work +ext/SDBM_File/t/prep.t See if SDBM_File with extra argument works ext/SDBM_File/t/sdbm.t See if SDBM_File works ext/SDBM_File/typemap SDBM extension interface types ext/Sys-Hostname/Hostname.pm Sys::Hostname extension Perl module @@ -4015,6 +3900,8 @@ ext/VMS-DCLsym/DCLsym.pm Perl access to ext/VMS-DCLsym/DCLsym.xs Perl access to CLI symbols ext/VMS-DCLsym/Makefile.PL MakeMaker driver for VMS::DCLsym ext/VMS-DCLsym/t/vms_dclsym.t regression tests for VMS::DCLsym +ext/VMS-Filespec/lib/VMS/Filespec.pm VMS-Unix file syntax interconversion +ext/VMS-Filespec/t/filespec.t See if VMS::Filespec functions work ext/VMS-Stdio/0README.txt ReadMe file for VMS::Stdio ext/VMS-Stdio/Makefile.PL MakeMaker driver for VMS::Stdio ext/VMS-Stdio/Stdio.pm VMS options to stdio routines @@ -4030,10 +3917,8 @@ ext/XS-APItest/core.c Test API function ext/XS-APItest/core_or_not.inc Code common to core.c and notcore.c ext/XS-APItest/exception.c XS::APItest extension ext/XS-APItest/Makefile.PL XS::APItest extension -ext/XS-APItest/MANIFEST XS::APItest extension ext/XS-APItest/notcore.c Test API functions when PERL_CORE is not defined ext/XS-APItest/numeric.xs XS::APItest wrappers for numeric.c -ext/XS-APItest/README XS::APItest extension ext/XS-APItest/t/addissub.t test op check wrapping ext/XS-APItest/t/arrayexpr.t test recursive descent expression parsing ext/XS-APItest/t/autoload.t Test XS AUTOLOAD routines @@ -4045,7 +3930,7 @@ ext/XS-APItest/t/Block.pm Helper for ./b ext/XS-APItest/t/call_checker.t test call checker plugin API ext/XS-APItest/t/caller.t XS::APItest: tests for caller_cx ext/XS-APItest/t/callregexec.t XS::APItest: tests for CALLREGEXEC() -ext/XS-APItest/t/call.t XS::APItest extension +ext/XS-APItest/t/call.t Test calling perl from C ext/XS-APItest/t/check_warnings.t test scope of "Too late for CHECK" ext/XS-APItest/t/cleanup.t test stack behaviour on unwinding ext/XS-APItest/t/clone-with-stack.t test clone with CLONEf_COPY_STACKS works @@ -4105,6 +3990,7 @@ ext/XS-APItest/t/stmtasexpr.t test recur ext/XS-APItest/t/stmtsasexpr.t test recursive descent statement-sequence parsing ext/XS-APItest/t/stuff_modify_bug.t test for eval side-effecting source string ext/XS-APItest/t/stuff_svcur_bug.t test for a bug in lex_stuff_pvn +ext/XS-APItest/t/subcall.t Test XSUB calls ext/XS-APItest/t/sviscow.t Test SvIsCOW ext/XS-APItest/t/svpeek.t XS::APItest extension ext/XS-APItest/t/svpv_magic.t Test behaviour of SvPVbyte/utf8 & get magic @@ -4131,11 +4017,9 @@ ext/XS-Typemap/t/Typemap.t test that typ ext/XS-Typemap/Typemap.pm XS::Typemap extension ext/XS-Typemap/Typemap.xs XS::Typemap extension fakesdio.h stdio in terms of PerlIO -fakethr.h Fake threads header feature.h Feature header form.h Public declarations for formats generate_uudmap.c Generate uudmap.h, the uuencode decoding map -genpacksizetables.pl Generate the size tables for pack/unpack git_version.h Pre-generated git_version.h for OpenBSD globals.c File to declare global symbols (for shared library) globvar.sym Global variables that need hiding when embedded @@ -4158,8 +4042,6 @@ haiku/Haiku/Haiku.xs Haiku extension ex haiku/haikuish.h Header for the Haiku port haiku/Haiku/Makefile.PL Haiku extension makefile writer handy.h Handy definitions -hints/3b1cc Hints for named architecture -hints/3b1.sh Hints for named architecture hints/aix_3.sh Hints for named architecture hints/aix_4.sh Hints for named architecture hints/aix.sh Hints for named architecture @@ -4167,6 +4049,7 @@ hints/altos486.sh Hints for named archi hints/amigaos.sh Hints for named architecture hints/atheos.sh Hints for named architecture hints/aux_3.sh Hints for named architecture +hints/bitrig.sh Hints for named architecture hints/broken-db.msg Warning message for systems with broken DB library hints/bsdos.sh Hints for named architecture hints/catamount.sh Hints for named architecture @@ -4176,7 +4059,6 @@ hints/cygwin.sh Hints for named archit hints/darwin.sh Hints for named architecture hints/dcosx.sh Hints for named architecture hints/dec_osf.sh Hints for named architecture -hints/dgux.sh Hints for named architecture hints/dos_djgpp.sh Hints for named architecture hints/dragonfly.sh Hints for named architecture hints/dynixptx.sh Hints for named architecture @@ -4185,6 +4067,7 @@ hints/epix.sh Hints for named architec hints/esix4.sh Hints for named architecture hints/fps.sh Hints for named architecture hints/freebsd.sh Hints for named architecture +hints/freemint.sh Hints for named architecture hints/genix.sh Hints for named architecture hints/gnukfreebsd.sh Hints for named architecture hints/gnuknetbsd.sh Hints for named architecture @@ -4201,6 +4084,7 @@ hints/irix_6_1.sh Hints for named archi hints/irix_6.sh Hints for named architecture hints/isc_2.sh Hints for named architecture hints/isc.sh Hints for named architecture +hints/linux-android.sh Hints for named architecture hints/linux.sh Hints for named architecture hints/lynxos.sh Hints for named architecture hints/midnightbsd.sh Hints for named architecture @@ -4239,7 +4123,6 @@ hints/svr4.sh Hints for named architec hints/svr5.sh Hints for named architecture hints/t001.c Test case for gcc bug hints/ti1500.sh Hints for named architecture -hints/titanos.sh Hints for named architecture hints/ultrix_4.sh Hints for named architecture hints/umips.sh Hints for named architecture hints/unicosmk.sh Hints for named architecture @@ -4266,6 +4149,9 @@ keywords.h The keyword numbers l1_char_class_tab.h 256 word bit table of character classes (for handy.h) lib/AnyDBM_File.pm Perl module to emulate dbmopen lib/AnyDBM_File.t See if AnyDBM_File works +lib/B/Deparse-core.t See if B::Deparse knows when to use CORE:: +lib/B/Deparse.pm Compiler Deparse backend +lib/B/Deparse.t See if B::Deparse works lib/Benchmark.pm Measure execution time lib/Benchmark.t See if Benchmark works lib/blib.pm For "use blib" @@ -4283,7 +4169,6 @@ lib/Config/Extensions.t See if Config:: lib/Config_git.pl Pre-generated Config_git.pl for OpenBSD lib/Config.t See if Config works lib/CORE.pod document the CORE namespace -lib/DBM_Filter/Changes DBM Filter Change history lib/DBM_Filter/compress.pm DBM Filter to compress keys/values lib/DBM_Filter/encode.pm DBM Filter for encoding lib/DBM_Filter/int32.pm DBM Filter for creating int32 keys/values @@ -4309,9 +4194,6 @@ lib/dumpvar.pl A variable dumper lib/dumpvar.t A variable dumper tester lib/English.pm Readable aliases for short variables lib/English.t See if English works -lib/Exporter/Heavy.pm Complicated routines for Exporter -lib/Exporter.pm Exporter base class -lib/Exporter.t See if Exporter works lib/ExtUtils/Embed.pm Utilities for embedding Perl in C programs lib/ExtUtils/t/Embed.t See if ExtUtils::Embed and embedding works lib/ExtUtils/typemap Extension interface types @@ -4325,9 +4207,6 @@ lib/File/Compare.pm Emulation of cmp co lib/File/Compare.t See if File::Compare works lib/File/Copy.pm Emulation of cp command lib/File/Copy.t See if File::Copy works -lib/File/Find.pm Routines to do a find -lib/File/Find/t/find.t See if File::Find works -lib/File/Find/t/taint.t See if File::Find works with taint lib/FileHandle.pm Backward-compatible front end to IO extension lib/FileHandle.t See if FileHandle works lib/File/stat-7896.t A test for ID 20011110.104 @@ -4376,6 +4255,7 @@ lib/perl5db/t/eval-line-bug Tests for th lib/perl5db/t/fact Tests for the Perl debugger lib/perl5db/t/filename-line-breakpoint Tests for the Perl debugger lib/perl5db/t/load-modules Tests for the Perl debugger +lib/perl5db/t/lsub-n Test script used by perl5db.t lib/perl5db/t/lvalue-bug Tests for the Perl debugger lib/perl5db/t/MyModule.pm Tests for the Perl debugger lib/perl5db/t/proxy-constants Tests for the Perl debugger @@ -4447,6 +4327,7 @@ lib/unicore/auxiliary/GCBTest.txt Unic lib/unicore/auxiliary/GraphemeBreakProperty.txt Unicode character database lib/unicore/auxiliary/SentenceBreakProperty.txt Unicode character database lib/unicore/auxiliary/WordBreakProperty.txt Unicode character database +lib/unicore/BidiBrackets.txt Unicode character database lib/unicore/BidiMirroring.txt Unicode character database lib/unicore/Blocks.txt Unicode character database lib/unicore/CaseFolding.txt Unicode character database @@ -4479,7 +4360,6 @@ lib/unicore/Jamo.txt Unicode characte lib/unicore/lib/Age/NA.pl Unicode character database lib/unicore/lib/Age/V11.pl Unicode character database lib/unicore/lib/Age/V20.pl Unicode character database -lib/unicore/lib/Age/V21.pl Unicode character database lib/unicore/lib/Age/V30.pl Unicode character database lib/unicore/lib/Age/V31.pl Unicode character database lib/unicore/lib/Age/V32.pl Unicode character database @@ -4490,8 +4370,6 @@ lib/unicore/lib/Age/V51.pl Unicode cha lib/unicore/lib/Age/V52.pl Unicode character database lib/unicore/lib/Age/V60.pl Unicode character database lib/unicore/lib/Age/V61.pl Unicode character database -lib/unicore/lib/Age/V62.pl Unicode character database -lib/unicore/lib/AHex/Y.pl Unicode character database lib/unicore/lib/Alpha/Y.pl Unicode character database lib/unicore/lib/Bc/AL.pl Unicode character database lib/unicore/lib/Bc/AN.pl Unicode character database @@ -4502,294 +4380,26 @@ lib/unicore/lib/Bc/EN.pl Unicode chara lib/unicore/lib/Bc/ES.pl Unicode character database lib/unicore/lib/Bc/ET.pl Unicode character database lib/unicore/lib/Bc/L.pl Unicode character database -lib/unicore/lib/Bc/LRE.pl Unicode character database -lib/unicore/lib/Bc/LRO.pl Unicode character database lib/unicore/lib/Bc/NSM.pl Unicode character database lib/unicore/lib/Bc/ON.pl Unicode character database -lib/unicore/lib/Bc/PDF.pl Unicode character database -lib/unicore/lib/Bc/RLE.pl Unicode character database -lib/unicore/lib/Bc/RLO.pl Unicode character database lib/unicore/lib/Bc/R.pl Unicode character database -lib/unicore/lib/Bc/S.pl Unicode character database lib/unicore/lib/Bc/WS.pl Unicode character database lib/unicore/lib/BidiC/Y.pl Unicode character database lib/unicore/lib/BidiM/Y.pl Unicode character database -lib/unicore/lib/Blk/AegeanNu.pl Unicode character database -lib/unicore/lib/Blk/Alchemic.pl Unicode character database -lib/unicore/lib/Blk/Alphabet.pl Unicode character database -lib/unicore/lib/Blk/Ancient2.pl Unicode character database -lib/unicore/lib/Blk/AncientG.pl Unicode character database -lib/unicore/lib/Blk/AncientS.pl Unicode character database -lib/unicore/lib/Blk/ArabicEx.pl Unicode character database -lib/unicore/lib/Blk/ArabicMa.pl Unicode character database -lib/unicore/lib/Blk/ArabicP2.pl Unicode character database -lib/unicore/lib/Blk/ArabicPF.pl Unicode character database -lib/unicore/lib/Blk/Arabic.pl Unicode character database -lib/unicore/lib/Blk/ArabicSu.pl Unicode character database -lib/unicore/lib/Blk/Armenian.pl Unicode character database -lib/unicore/lib/Blk/Arrows.pl Unicode character database -lib/unicore/lib/Blk/ASCII.pl Unicode character database -lib/unicore/lib/Blk/Avestan.pl Unicode character database -lib/unicore/lib/Blk/Balinese.pl Unicode character database -lib/unicore/lib/Blk/Bamum.pl Unicode character database -lib/unicore/lib/Blk/BamumSup.pl Unicode character database -lib/unicore/lib/Blk/Batak.pl Unicode character database -lib/unicore/lib/Blk/Bengali.pl Unicode character database -lib/unicore/lib/Blk/BlockEle.pl Unicode character database -lib/unicore/lib/Blk/Bopomof2.pl Unicode character database -lib/unicore/lib/Blk/Bopomofo.pl Unicode character database -lib/unicore/lib/Blk/BoxDrawi.pl Unicode character database -lib/unicore/lib/Blk/Brahmi.pl Unicode character database -lib/unicore/lib/Blk/Braille.pl Unicode character database -lib/unicore/lib/Blk/Buginese.pl Unicode character database -lib/unicore/lib/Blk/Buhid.pl Unicode character database -lib/unicore/lib/Blk/Byzantin.pl Unicode character database -lib/unicore/lib/Blk/Carian.pl Unicode character database -lib/unicore/lib/Blk/Chakma.pl Unicode character database -lib/unicore/lib/Blk/Cham.pl Unicode character database -lib/unicore/lib/Blk/Cherokee.pl Unicode character database -lib/unicore/lib/Blk/CJKComp2.pl Unicode character database -lib/unicore/lib/Blk/CJKComp3.pl Unicode character database -lib/unicore/lib/Blk/CJKComp4.pl Unicode character database -lib/unicore/lib/Blk/CJKCompa.pl Unicode character database -lib/unicore/lib/Blk/CJKExtA.pl Unicode character database -lib/unicore/lib/Blk/CJKExtB.pl Unicode character database -lib/unicore/lib/Blk/CJKExtC.pl Unicode character database -lib/unicore/lib/Blk/CJKExtD.pl Unicode character database -lib/unicore/lib/Blk/CJK.pl Unicode character database -lib/unicore/lib/Blk/CJKRadic.pl Unicode character database -lib/unicore/lib/Blk/CJKStrok.pl Unicode character database -lib/unicore/lib/Blk/CJKSymbo.pl Unicode character database -lib/unicore/lib/Blk/CompatJa.pl Unicode character database -lib/unicore/lib/Blk/ControlP.pl Unicode character database -lib/unicore/lib/Blk/Coptic.pl Unicode character database -lib/unicore/lib/Blk/Counting.pl Unicode character database -lib/unicore/lib/Blk/Cuneifo2.pl Unicode character database -lib/unicore/lib/Blk/Cuneifor.pl Unicode character database -lib/unicore/lib/Blk/Currency.pl Unicode character database -lib/unicore/lib/Blk/CypriotS.pl Unicode character database -lib/unicore/lib/Blk/Cyrilli2.pl Unicode character database -lib/unicore/lib/Blk/Cyrilli3.pl Unicode character database -lib/unicore/lib/Blk/Cyrilli4.pl Unicode character database -lib/unicore/lib/Blk/Cyrillic.pl Unicode character database -lib/unicore/lib/Blk/Deseret.pl Unicode character database -lib/unicore/lib/Blk/Devanag2.pl Unicode character database -lib/unicore/lib/Blk/Devanaga.pl Unicode character database -lib/unicore/lib/Blk/Diacrit2.pl Unicode character database -lib/unicore/lib/Blk/Diacrit3.pl Unicode character database -lib/unicore/lib/Blk/Diacriti.pl Unicode character database -lib/unicore/lib/Blk/Dingbats.pl Unicode character database -lib/unicore/lib/Blk/Domino.pl Unicode character database -lib/unicore/lib/Blk/Egyptian.pl Unicode character database -lib/unicore/lib/Blk/Emoticon.pl Unicode character database -lib/unicore/lib/Blk/Enclose2.pl Unicode character database -lib/unicore/lib/Blk/Enclose3.pl Unicode character database -lib/unicore/lib/Blk/Enclose4.pl Unicode character database -lib/unicore/lib/Blk/Enclosed.pl Unicode character database -lib/unicore/lib/Blk/Ethiopi2.pl Unicode character database -lib/unicore/lib/Blk/Ethiopi3.pl Unicode character database -lib/unicore/lib/Blk/Ethiopi4.pl Unicode character database -lib/unicore/lib/Blk/Ethiopic.pl Unicode character database -lib/unicore/lib/Blk/Geometri.pl Unicode character database -lib/unicore/lib/Blk/Georgia2.pl Unicode character database -lib/unicore/lib/Blk/Georgian.pl Unicode character database -lib/unicore/lib/Blk/Glagolit.pl Unicode character database -lib/unicore/lib/Blk/Gothic.pl Unicode character database -lib/unicore/lib/Blk/GreekExt.pl Unicode character database -lib/unicore/lib/Blk/Greek.pl Unicode character database -lib/unicore/lib/Blk/Gujarati.pl Unicode character database -lib/unicore/lib/Blk/Gurmukhi.pl Unicode character database -lib/unicore/lib/Blk/HalfAndF.pl Unicode character database -lib/unicore/lib/Blk/HalfMark.pl Unicode character database -lib/unicore/lib/Blk/Hangul.pl Unicode character database -lib/unicore/lib/Blk/Hanunoo.pl Unicode character database -lib/unicore/lib/Blk/Hebrew.pl Unicode character database -lib/unicore/lib/Blk/HighPUSu.pl Unicode character database -lib/unicore/lib/Blk/HighSurr.pl Unicode character database -lib/unicore/lib/Blk/Hiragana.pl Unicode character database -lib/unicore/lib/Blk/IDC.pl Unicode character database -lib/unicore/lib/Blk/Imperial.pl Unicode character database -lib/unicore/lib/Blk/IndicNum.pl Unicode character database -lib/unicore/lib/Blk/Inscrip2.pl Unicode character database -lib/unicore/lib/Blk/Inscript.pl Unicode character database -lib/unicore/lib/Blk/IPAExt.pl Unicode character database -lib/unicore/lib/Blk/JamoExtA.pl Unicode character database -lib/unicore/lib/Blk/JamoExtB.pl Unicode character database -lib/unicore/lib/Blk/Jamo.pl Unicode character database -lib/unicore/lib/Blk/Javanese.pl Unicode character database -lib/unicore/lib/Blk/Kaithi.pl Unicode character database -lib/unicore/lib/Blk/KanaSup.pl Unicode character database -lib/unicore/lib/Blk/Kanbun.pl Unicode character database -lib/unicore/lib/Blk/Kangxi.pl Unicode character database -lib/unicore/lib/Blk/Kannada.pl Unicode character database -lib/unicore/lib/Blk/Katakan2.pl Unicode character database -lib/unicore/lib/Blk/Katakana.pl Unicode character database -lib/unicore/lib/Blk/KayahLi.pl Unicode character database -lib/unicore/lib/Blk/Kharosht.pl Unicode character database -lib/unicore/lib/Blk/Khmer.pl Unicode character database -lib/unicore/lib/Blk/KhmerSym.pl Unicode character database -lib/unicore/lib/Blk/Lao.pl Unicode character database -lib/unicore/lib/Blk/Latin1.pl Unicode character database -lib/unicore/lib/Blk/LatinEx2.pl Unicode character database -lib/unicore/lib/Blk/LatinEx3.pl Unicode character database -lib/unicore/lib/Blk/LatinEx4.pl Unicode character database -lib/unicore/lib/Blk/LatinEx5.pl Unicode character database -lib/unicore/lib/Blk/LatinExt.pl Unicode character database -lib/unicore/lib/Blk/Lepcha.pl Unicode character database -lib/unicore/lib/Blk/Letterli.pl Unicode character database -lib/unicore/lib/Blk/Limbu.pl Unicode character database -lib/unicore/lib/Blk/LinearBI.pl Unicode character database -lib/unicore/lib/Blk/LinearBS.pl Unicode character database -lib/unicore/lib/Blk/Lisu.pl Unicode character database -lib/unicore/lib/Blk/LowSurro.pl Unicode character database -lib/unicore/lib/Blk/Lycian.pl Unicode character database -lib/unicore/lib/Blk/Lydian.pl Unicode character database -lib/unicore/lib/Blk/Mahjong.pl Unicode character database -lib/unicore/lib/Blk/Malayala.pl Unicode character database -lib/unicore/lib/Blk/Mandaic.pl Unicode character database -lib/unicore/lib/Blk/MathAlph.pl Unicode character database -lib/unicore/lib/Blk/MathOper.pl Unicode character database -lib/unicore/lib/Blk/MeeteiM2.pl Unicode character database -lib/unicore/lib/Blk/MeeteiMa.pl Unicode character database -lib/unicore/lib/Blk/Meroiti2.pl Unicode character database -lib/unicore/lib/Blk/Meroitic.pl Unicode character database -lib/unicore/lib/Blk/Miao.pl Unicode character database -lib/unicore/lib/Blk/MiscArro.pl Unicode character database -lib/unicore/lib/Blk/MiscMat2.pl Unicode character database -lib/unicore/lib/Blk/MiscMath.pl Unicode character database -lib/unicore/lib/Blk/MiscPict.pl Unicode character database -lib/unicore/lib/Blk/MiscSymb.pl Unicode character database -lib/unicore/lib/Blk/MiscTech.pl Unicode character database -lib/unicore/lib/Blk/Modifie2.pl Unicode character database -lib/unicore/lib/Blk/Modifier.pl Unicode character database -lib/unicore/lib/Blk/Mongolia.pl Unicode character database -lib/unicore/lib/Blk/Music.pl Unicode character database -lib/unicore/lib/Blk/MyanmarE.pl Unicode character database -lib/unicore/lib/Blk/Myanmar.pl Unicode character database lib/unicore/lib/Blk/NB.pl Unicode character database -lib/unicore/lib/Blk/NewTaiLu.pl Unicode character database -lib/unicore/lib/Blk/NKo.pl Unicode character database -lib/unicore/lib/Blk/NumberFo.pl Unicode character database -lib/unicore/lib/Blk/OCR.pl Unicode character database -lib/unicore/lib/Blk/Ogham.pl Unicode character database -lib/unicore/lib/Blk/OlChiki.pl Unicode character database -lib/unicore/lib/Blk/OldItali.pl Unicode character database -lib/unicore/lib/Blk/OldPersi.pl Unicode character database -lib/unicore/lib/Blk/OldSouth.pl Unicode character database -lib/unicore/lib/Blk/OldTurki.pl Unicode character database -lib/unicore/lib/Blk/Oriya.pl Unicode character database -lib/unicore/lib/Blk/Osmanya.pl Unicode character database -lib/unicore/lib/Blk/PhagsPa.pl Unicode character database -lib/unicore/lib/Blk/Phaistos.pl Unicode character database -lib/unicore/lib/Blk/Phoenici.pl Unicode character database -lib/unicore/lib/Blk/Phoneti2.pl Unicode character database -lib/unicore/lib/Blk/Phonetic.pl Unicode character database -lib/unicore/lib/Blk/PlayingC.pl Unicode character database -lib/unicore/lib/Blk/PUA.pl Unicode character database -lib/unicore/lib/Blk/Punctuat.pl Unicode character database -lib/unicore/lib/Blk/Rejang.pl Unicode character database -lib/unicore/lib/Blk/Rumi.pl Unicode character database -lib/unicore/lib/Blk/Runic.pl Unicode character database -lib/unicore/lib/Blk/Samarita.pl Unicode character database -lib/unicore/lib/Blk/Saurasht.pl Unicode character database -lib/unicore/lib/Blk/Sharada.pl Unicode character database -lib/unicore/lib/Blk/Shavian.pl Unicode character database -lib/unicore/lib/Blk/Sinhala.pl Unicode character database -lib/unicore/lib/Blk/SmallFor.pl Unicode character database -lib/unicore/lib/Blk/SoraSomp.pl Unicode character database -lib/unicore/lib/Blk/Specials.pl Unicode character database -lib/unicore/lib/Blk/Sundane2.pl Unicode character database -lib/unicore/lib/Blk/Sundanes.pl Unicode character database -lib/unicore/lib/Blk/SupArro2.pl Unicode character database -lib/unicore/lib/Blk/SupArrow.pl Unicode character database -lib/unicore/lib/Blk/SuperAnd.pl Unicode character database -lib/unicore/lib/Blk/SupMathO.pl Unicode character database -lib/unicore/lib/Blk/SupPUAA.pl Unicode character database -lib/unicore/lib/Blk/SupPUAB.pl Unicode character database -lib/unicore/lib/Blk/SupPunct.pl Unicode character database -lib/unicore/lib/Blk/SylotiNa.pl Unicode character database -lib/unicore/lib/Blk/Syriac.pl Unicode character database -lib/unicore/lib/Blk/Tagalog.pl Unicode character database -lib/unicore/lib/Blk/Tagbanwa.pl Unicode character database -lib/unicore/lib/Blk/Tags.pl Unicode character database -lib/unicore/lib/Blk/TaiLe.pl Unicode character database -lib/unicore/lib/Blk/TaiTham.pl Unicode character database -lib/unicore/lib/Blk/TaiViet.pl Unicode character database -lib/unicore/lib/Blk/TaiXuanJ.pl Unicode character database -lib/unicore/lib/Blk/Takri.pl Unicode character database -lib/unicore/lib/Blk/Tamil.pl Unicode character database -lib/unicore/lib/Blk/Telugu.pl Unicode character database -lib/unicore/lib/Blk/Thaana.pl Unicode character database -lib/unicore/lib/Blk/Thai.pl Unicode character database -lib/unicore/lib/Blk/Tibetan.pl Unicode character database -lib/unicore/lib/Blk/Tifinagh.pl Unicode character database -lib/unicore/lib/Blk/Transpor.pl Unicode character database -lib/unicore/lib/Blk/UCASExt.pl Unicode character database -lib/unicore/lib/Blk/UCAS.pl Unicode character database -lib/unicore/lib/Blk/Ugaritic.pl Unicode character database -lib/unicore/lib/Blk/Vai.pl Unicode character database -lib/unicore/lib/Blk/VedicExt.pl Unicode character database -lib/unicore/lib/Blk/Vertical.pl Unicode character database -lib/unicore/lib/Blk/VS.pl Unicode character database -lib/unicore/lib/Blk/VSSup.pl Unicode character database -lib/unicore/lib/Blk/Yijing.pl Unicode character database -lib/unicore/lib/Blk/YiRadica.pl Unicode character database -lib/unicore/lib/Blk/YiSyllab.pl Unicode character database +lib/unicore/lib/Bpt/C.pl Unicode character database +lib/unicore/lib/Bpt/N.pl Unicode character database +lib/unicore/lib/Bpt/O.pl Unicode character database lib/unicore/lib/Cased/Y.pl Unicode character database -lib/unicore/lib/Ccc/AL.pl Unicode character database lib/unicore/lib/Ccc/A.pl Unicode character database lib/unicore/lib/Ccc/AR.pl Unicode character database -lib/unicore/lib/Ccc/ATA.pl Unicode character database lib/unicore/lib/Ccc/ATAR.pl Unicode character database -lib/unicore/lib/Ccc/ATB.pl Unicode character database -lib/unicore/lib/Ccc/BL.pl Unicode character database lib/unicore/lib/Ccc/B.pl Unicode character database lib/unicore/lib/Ccc/BR.pl Unicode character database -lib/unicore/lib/Ccc/CCC103.pl Unicode character database -lib/unicore/lib/Ccc/CCC107.pl Unicode character database -lib/unicore/lib/Ccc/CCC10.pl Unicode character database -lib/unicore/lib/Ccc/CCC118.pl Unicode character database -lib/unicore/lib/Ccc/CCC11.pl Unicode character database -lib/unicore/lib/Ccc/CCC122.pl Unicode character database -lib/unicore/lib/Ccc/CCC129.pl Unicode character database -lib/unicore/lib/Ccc/CCC12.pl Unicode character database -lib/unicore/lib/Ccc/CCC130.pl Unicode character database -lib/unicore/lib/Ccc/CCC132.pl Unicode character database -lib/unicore/lib/Ccc/CCC13.pl Unicode character database -lib/unicore/lib/Ccc/CCC14.pl Unicode character database -lib/unicore/lib/Ccc/CCC15.pl Unicode character database -lib/unicore/lib/Ccc/CCC16.pl Unicode character database -lib/unicore/lib/Ccc/CCC17.pl Unicode character database -lib/unicore/lib/Ccc/CCC18.pl Unicode character database -lib/unicore/lib/Ccc/CCC19.pl Unicode character database -lib/unicore/lib/Ccc/CCC20.pl Unicode character database -lib/unicore/lib/Ccc/CCC21.pl Unicode character database -lib/unicore/lib/Ccc/CCC22.pl Unicode character database -lib/unicore/lib/Ccc/CCC23.pl Unicode character database -lib/unicore/lib/Ccc/CCC24.pl Unicode character database -lib/unicore/lib/Ccc/CCC25.pl Unicode character database -lib/unicore/lib/Ccc/CCC26.pl Unicode character database -lib/unicore/lib/Ccc/CCC27.pl Unicode character database -lib/unicore/lib/Ccc/CCC28.pl Unicode character database -lib/unicore/lib/Ccc/CCC29.pl Unicode character database -lib/unicore/lib/Ccc/CCC30.pl Unicode character database -lib/unicore/lib/Ccc/CCC31.pl Unicode character database -lib/unicore/lib/Ccc/CCC32.pl Unicode character database -lib/unicore/lib/Ccc/CCC33.pl Unicode character database -lib/unicore/lib/Ccc/CCC34.pl Unicode character database -lib/unicore/lib/Ccc/CCC35.pl Unicode character database -lib/unicore/lib/Ccc/CCC36.pl Unicode character database -lib/unicore/lib/Ccc/CCC84.pl Unicode character database -lib/unicore/lib/Ccc/CCC91.pl Unicode character database -lib/unicore/lib/Ccc/DA.pl Unicode character database lib/unicore/lib/Ccc/DB.pl Unicode character database -lib/unicore/lib/Ccc/IS.pl Unicode character database -lib/unicore/lib/Ccc/KV.pl Unicode character database -lib/unicore/lib/Ccc/L.pl Unicode character database lib/unicore/lib/Ccc/NK.pl Unicode character database lib/unicore/lib/Ccc/NR.pl Unicode character database lib/unicore/lib/Ccc/OV.pl Unicode character database -lib/unicore/lib/Ccc/R.pl Unicode character database lib/unicore/lib/Ccc/VR.pl Unicode character database lib/unicore/lib/CE/Y.pl Unicode character database lib/unicore/lib/CI/Y.pl Unicode character database @@ -4808,19 +4418,16 @@ lib/unicore/lib/Dt/Com.pl Unicode char lib/unicore/lib/Dt/Enc.pl Unicode character database lib/unicore/lib/Dt/Fin.pl Unicode character database lib/unicore/lib/Dt/Font.pl Unicode character database -lib/unicore/lib/Dt/Fra.pl Unicode character database lib/unicore/lib/Dt/Init.pl Unicode character database lib/unicore/lib/Dt/Iso.pl Unicode character database lib/unicore/lib/Dt/Med.pl Unicode character database lib/unicore/lib/Dt/Nar.pl Unicode character database lib/unicore/lib/Dt/Nb.pl Unicode character database lib/unicore/lib/Dt/NonCanon.pl Unicode character database -lib/unicore/lib/Dt/Sml.pl Unicode character database lib/unicore/lib/Dt/Sqr.pl Unicode character database lib/unicore/lib/Dt/Sub.pl Unicode character database lib/unicore/lib/Dt/Sup.pl Unicode character database lib/unicore/lib/Dt/Vert.pl Unicode character database -lib/unicore/lib/Dt/Wide.pl Unicode character database lib/unicore/lib/Ea/A.pl Unicode character database lib/unicore/lib/Ea/H.pl Unicode character database lib/unicore/lib/Ea/Na.pl Unicode character database @@ -4828,22 +4435,20 @@ lib/unicore/lib/Ea/N.pl Unicode charac lib/unicore/lib/Ea/W.pl Unicode character database lib/unicore/lib/Ext/Y.pl Unicode character database lib/unicore/lib/GCB/CN.pl Unicode character database -lib/unicore/lib/GCB/CR.pl Unicode character database lib/unicore/lib/GCB/EX.pl Unicode character database -lib/unicore/lib/GCB/LF.pl Unicode character database +lib/unicore/lib/GCB/LV.pl Unicode character database +lib/unicore/lib/GCB/LVT.pl Unicode character database lib/unicore/lib/GCB/SM.pl Unicode character database lib/unicore/lib/GCB/XX.pl Unicode character database -lib/unicore/lib/Gc/Cc.pl Unicode character database lib/unicore/lib/Gc/Cf.pl Unicode character database lib/unicore/lib/Gc/Cn.pl Unicode character database -lib/unicore/lib/Gc/Co.pl Unicode character database lib/unicore/lib/Gc/C.pl Unicode character database -lib/unicore/lib/Gc/Cs.pl Unicode character database lib/unicore/lib/Gc/LC.pl Unicode character database lib/unicore/lib/Gc/Ll.pl Unicode character database lib/unicore/lib/Gc/Lm.pl Unicode character database lib/unicore/lib/Gc/Lo.pl Unicode character database lib/unicore/lib/Gc/L.pl Unicode character database +lib/unicore/lib/Gc/Lt.pl Unicode character database lib/unicore/lib/Gc/Lu.pl Unicode character database lib/unicore/lib/Gc/Mc.pl Unicode character database lib/unicore/lib/Gc/Me.pl Unicode character database @@ -4865,9 +4470,7 @@ lib/unicore/lib/Gc/Sk.pl Unicode chara lib/unicore/lib/Gc/Sm.pl Unicode character database lib/unicore/lib/Gc/So.pl Unicode character database lib/unicore/lib/Gc/S.pl Unicode character database -lib/unicore/lib/Gc/Zl.pl Unicode character database lib/unicore/lib/Gc/Z.pl Unicode character database -lib/unicore/lib/Gc/Zp.pl Unicode character database lib/unicore/lib/Gc/Zs.pl Unicode character database lib/unicore/lib/GrBase/Y.pl Unicode character database lib/unicore/lib/Hex/Y.pl Unicode character database @@ -4875,8 +4478,6 @@ lib/unicore/lib/Hst/NA.pl Unicode char lib/unicore/lib/Hyphen/Y.pl Unicode character database lib/unicore/lib/IDC/Y.pl Unicode character database lib/unicore/lib/Ideo/Y.pl Unicode character database -lib/unicore/lib/IDSB/Y.pl Unicode character database -lib/unicore/lib/IDST/Y.pl Unicode character database lib/unicore/lib/IDS/Y.pl Unicode character database lib/unicore/lib/In/2_0.pl Unicode character database lib/unicore/lib/In/2_1.pl Unicode character database @@ -4891,65 +4492,22 @@ lib/unicore/lib/In/5_2.pl Unicode char lib/unicore/lib/In/6_0.pl Unicode character database lib/unicore/lib/In/6_1.pl Unicode character database lib/unicore/lib/In/6_2.pl Unicode character database +lib/unicore/lib/In/6_3.pl Unicode character database lib/unicore/lib/Jg/Ain.pl Unicode character database -lib/unicore/lib/Jg/Alaph.pl Unicode character database lib/unicore/lib/Jg/Alef.pl Unicode character database lib/unicore/lib/Jg/Beh.pl Unicode character database -lib/unicore/lib/Jg/Beth.pl Unicode character database -lib/unicore/lib/Jg/Burushas.pl Unicode character database -lib/unicore/lib/Jg/DalathRi.pl Unicode character database lib/unicore/lib/Jg/Dal.pl Unicode character database -lib/unicore/lib/Jg/E.pl Unicode character database lib/unicore/lib/Jg/FarsiYeh.pl Unicode character database lib/unicore/lib/Jg/Feh.pl Unicode character database -lib/unicore/lib/Jg/Fe.pl Unicode character database -lib/unicore/lib/Jg/FinalSem.pl Unicode character database lib/unicore/lib/Jg/Gaf.pl Unicode character database -lib/unicore/lib/Jg/Gamal.pl Unicode character database lib/unicore/lib/Jg/Hah.pl Unicode character database -lib/unicore/lib/Jg/HamzaOnH.pl Unicode character database -lib/unicore/lib/Jg/HehGoal.pl Unicode character database -lib/unicore/lib/Jg/Heh.pl Unicode character database -lib/unicore/lib/Jg/He.pl Unicode character database -lib/unicore/lib/Jg/Heth.pl Unicode character database -lib/unicore/lib/Jg/Kaf.pl Unicode character database -lib/unicore/lib/Jg/Kaph.pl Unicode character database -lib/unicore/lib/Jg/Khaph.pl Unicode character database -lib/unicore/lib/Jg/KnottedH.pl Unicode character database -lib/unicore/lib/Jg/Lamadh.pl Unicode character database lib/unicore/lib/Jg/Lam.pl Unicode character database -lib/unicore/lib/Jg/Meem.pl Unicode character database -lib/unicore/lib/Jg/Mim.pl Unicode character database lib/unicore/lib/Jg/NoJoinin.pl Unicode character database -lib/unicore/lib/Jg/Noon.pl Unicode character database -lib/unicore/lib/Jg/Nun.pl Unicode character database -lib/unicore/lib/Jg/Nya.pl Unicode character database -lib/unicore/lib/Jg/Pe.pl Unicode character database lib/unicore/lib/Jg/Qaf.pl Unicode character database -lib/unicore/lib/Jg/Qaph.pl Unicode character database lib/unicore/lib/Jg/Reh.pl Unicode character database -lib/unicore/lib/Jg/Reversed.pl Unicode character database -lib/unicore/lib/Jg/Rohingya.pl Unicode character database -lib/unicore/lib/Jg/Sadhe.pl Unicode character database -lib/unicore/lib/Jg/Sad.pl Unicode character database lib/unicore/lib/Jg/Seen.pl Unicode character database -lib/unicore/lib/Jg/Semkath.pl Unicode character database -lib/unicore/lib/Jg/Shin.pl Unicode character database -lib/unicore/lib/Jg/SwashKaf.pl Unicode character database -lib/unicore/lib/Jg/SyriacWa.pl Unicode character database -lib/unicore/lib/Jg/Tah.pl Unicode character database -lib/unicore/lib/Jg/Taw.pl Unicode character database -lib/unicore/lib/Jg/TehMarbu.pl Unicode character database -lib/unicore/lib/Jg/Teth.pl Unicode character database lib/unicore/lib/Jg/Waw.pl Unicode character database -lib/unicore/lib/Jg/YehBarre.pl Unicode character database lib/unicore/lib/Jg/Yeh.pl Unicode character database -lib/unicore/lib/Jg/YehWithT.pl Unicode character database -lib/unicore/lib/Jg/YudhHe.pl Unicode character database -lib/unicore/lib/Jg/Yudh.pl Unicode character database -lib/unicore/lib/Jg/Zain.pl Unicode character database -lib/unicore/lib/Jg/Zhain.pl Unicode character database -lib/unicore/lib/JoinC/Y.pl Unicode character database lib/unicore/lib/Jt/C.pl Unicode character database lib/unicore/lib/Jt/D.pl Unicode character database lib/unicore/lib/Jt/R.pl Unicode character database @@ -4957,35 +4515,22 @@ lib/unicore/lib/Jt/T.pl Unicode charac lib/unicore/lib/Jt/U.pl Unicode character database lib/unicore/lib/Lb/AI.pl Unicode character database lib/unicore/lib/Lb/AL.pl Unicode character database -lib/unicore/lib/Lb/B2.pl Unicode character database lib/unicore/lib/Lb/BA.pl Unicode character database lib/unicore/lib/Lb/BB.pl Unicode character database -lib/unicore/lib/Lb/BK.pl Unicode character database -lib/unicore/lib/Lb/CB.pl Unicode character database lib/unicore/lib/Lb/CJ.pl Unicode character database lib/unicore/lib/Lb/CL.pl Unicode character database lib/unicore/lib/Lb/CM.pl Unicode character database -lib/unicore/lib/Lb/CP.pl Unicode character database lib/unicore/lib/Lb/EX.pl Unicode character database lib/unicore/lib/Lb/GL.pl Unicode character database -lib/unicore/lib/Lb/HL.pl Unicode character database -lib/unicore/lib/Lb/HY.pl Unicode character database lib/unicore/lib/Lb/ID.pl Unicode character database -lib/unicore/lib/Lb/IN.pl Unicode character database lib/unicore/lib/Lb/IS.pl Unicode character database -lib/unicore/lib/Lb/NL.pl Unicode character database lib/unicore/lib/Lb/NS.pl Unicode character database lib/unicore/lib/Lb/OP.pl Unicode character database lib/unicore/lib/Lb/PO.pl Unicode character database lib/unicore/lib/Lb/PR.pl Unicode character database lib/unicore/lib/Lb/QU.pl Unicode character database lib/unicore/lib/Lb/SA.pl Unicode character database -lib/unicore/lib/Lb/SG.pl Unicode character database -lib/unicore/lib/Lb/SP.pl Unicode character database -lib/unicore/lib/Lb/SY.pl Unicode character database -lib/unicore/lib/Lb/WJ.pl Unicode character database lib/unicore/lib/Lb/XX.pl Unicode character database -lib/unicore/lib/Lb/ZW.pl Unicode character database lib/unicore/lib/LOE/Y.pl Unicode character database lib/unicore/lib/Lower/Y.pl Unicode character database lib/unicore/lib/Math/Y.pl Unicode character database @@ -5002,165 +4547,69 @@ lib/unicore/lib/Nt/Di.pl Unicode chara lib/unicore/lib/Nt/None.pl Unicode character database lib/unicore/lib/Nt/Nu.pl Unicode character database lib/unicore/lib/Nv/0.pl Unicode character database -lib/unicore/lib/Nv/10000000.pl Unicode character database -lib/unicore/lib/Nv/10000002.pl Unicode character database -lib/unicore/lib/Nv/100000.pl Unicode character database lib/unicore/lib/Nv/10000.pl Unicode character database lib/unicore/lib/Nv/1000.pl Unicode character database lib/unicore/lib/Nv/100.pl Unicode character database lib/unicore/lib/Nv/10.pl Unicode character database -lib/unicore/lib/Nv/1_10.pl Unicode character database -lib/unicore/lib/Nv/11_2.pl Unicode character database -lib/unicore/lib/Nv/1_16.pl Unicode character database lib/unicore/lib/Nv/11.pl Unicode character database lib/unicore/lib/Nv/12.pl Unicode character database lib/unicore/lib/Nv/1_2.pl Unicode character database -lib/unicore/lib/Nv/_1_2.pl Unicode character database -lib/unicore/lib/Nv/13_2.pl Unicode character database lib/unicore/lib/Nv/13.pl Unicode character database lib/unicore/lib/Nv/1_3.pl Unicode character database lib/unicore/lib/Nv/14.pl Unicode character database lib/unicore/lib/Nv/1_4.pl Unicode character database -lib/unicore/lib/Nv/15_2.pl Unicode character database lib/unicore/lib/Nv/15.pl Unicode character database -lib/unicore/lib/Nv/1_5.pl Unicode character database lib/unicore/lib/Nv/16.pl Unicode character database -lib/unicore/lib/Nv/1_6.pl Unicode character database -lib/unicore/lib/Nv/17_2.pl Unicode character database lib/unicore/lib/Nv/17.pl Unicode character database -lib/unicore/lib/Nv/1_7.pl Unicode character database lib/unicore/lib/Nv/18.pl Unicode character database lib/unicore/lib/Nv/1_8.pl Unicode character database lib/unicore/lib/Nv/19.pl Unicode character database -lib/unicore/lib/Nv/1_9.pl Unicode character database lib/unicore/lib/Nv/1.pl Unicode character database -lib/unicore/lib/Nv/_1.pl Unicode character database -lib/unicore/lib/Nv/20000.pl Unicode character database -lib/unicore/lib/Nv/2000.pl Unicode character database -lib/unicore/lib/Nv/200.pl Unicode character database lib/unicore/lib/Nv/20.pl Unicode character database -lib/unicore/lib/Nv/216000.pl Unicode character database -lib/unicore/lib/Nv/21.pl Unicode character database -lib/unicore/lib/Nv/22.pl Unicode character database -lib/unicore/lib/Nv/23.pl Unicode character database lib/unicore/lib/Nv/2_3.pl Unicode character database -lib/unicore/lib/Nv/24.pl Unicode character database -lib/unicore/lib/Nv/25.pl Unicode character database -lib/unicore/lib/Nv/2_5.pl Unicode character database -lib/unicore/lib/Nv/26.pl Unicode character database -lib/unicore/lib/Nv/27.pl Unicode character database -lib/unicore/lib/Nv/28.pl Unicode character database -lib/unicore/lib/Nv/29.pl Unicode character database lib/unicore/lib/Nv/2.pl Unicode character database -lib/unicore/lib/Nv/30000.pl Unicode character database -lib/unicore/lib/Nv/3000.pl Unicode character database -lib/unicore/lib/Nv/300.pl Unicode character database lib/unicore/lib/Nv/30.pl Unicode character database -lib/unicore/lib/Nv/3_16.pl Unicode character database -lib/unicore/lib/Nv/31.pl Unicode character database -lib/unicore/lib/Nv/32.pl Unicode character database -lib/unicore/lib/Nv/3_2.pl Unicode character database -lib/unicore/lib/Nv/33.pl Unicode character database -lib/unicore/lib/Nv/34.pl Unicode character database lib/unicore/lib/Nv/3_4.pl Unicode character database -lib/unicore/lib/Nv/35.pl Unicode character database -lib/unicore/lib/Nv/3_5.pl Unicode character database -lib/unicore/lib/Nv/36.pl Unicode character database -lib/unicore/lib/Nv/37.pl Unicode character database -lib/unicore/lib/Nv/38.pl Unicode character database -lib/unicore/lib/Nv/3_8.pl Unicode character database -lib/unicore/lib/Nv/39.pl Unicode character database lib/unicore/lib/Nv/3.pl Unicode character database -lib/unicore/lib/Nv/40000.pl Unicode character database -lib/unicore/lib/Nv/4000.pl Unicode character database -lib/unicore/lib/Nv/400.pl Unicode character database lib/unicore/lib/Nv/40.pl Unicode character database -lib/unicore/lib/Nv/41.pl Unicode character database -lib/unicore/lib/Nv/42.pl Unicode character database -lib/unicore/lib/Nv/432000.pl Unicode character database -lib/unicore/lib/Nv/43.pl Unicode character database -lib/unicore/lib/Nv/44.pl Unicode character database -lib/unicore/lib/Nv/45.pl Unicode character database -lib/unicore/lib/Nv/4_5.pl Unicode character database -lib/unicore/lib/Nv/46.pl Unicode character database -lib/unicore/lib/Nv/47.pl Unicode character database -lib/unicore/lib/Nv/48.pl Unicode character database -lib/unicore/lib/Nv/49.pl Unicode character database lib/unicore/lib/Nv/4.pl Unicode character database lib/unicore/lib/Nv/50000.pl Unicode character database lib/unicore/lib/Nv/5000.pl Unicode character database lib/unicore/lib/Nv/500.pl Unicode character database lib/unicore/lib/Nv/50.pl Unicode character database -lib/unicore/lib/Nv/5_2.pl Unicode character database -lib/unicore/lib/Nv/5_6.pl Unicode character database -lib/unicore/lib/Nv/5_8.pl Unicode character database lib/unicore/lib/Nv/5.pl Unicode character database -lib/unicore/lib/Nv/60000.pl Unicode character database -lib/unicore/lib/Nv/6000.pl Unicode character database -lib/unicore/lib/Nv/600.pl Unicode character database lib/unicore/lib/Nv/60.pl Unicode character database lib/unicore/lib/Nv/6.pl Unicode character database -lib/unicore/lib/Nv/70000.pl Unicode character database -lib/unicore/lib/Nv/7000.pl Unicode character database -lib/unicore/lib/Nv/700.pl Unicode character database lib/unicore/lib/Nv/70.pl Unicode character database -lib/unicore/lib/Nv/7_2.pl Unicode character database -lib/unicore/lib/Nv/7_8.pl Unicode character database lib/unicore/lib/Nv/7.pl Unicode character database -lib/unicore/lib/Nv/80000.pl Unicode character database -lib/unicore/lib/Nv/8000.pl Unicode character database -lib/unicore/lib/Nv/800.pl Unicode character database lib/unicore/lib/Nv/80.pl Unicode character database lib/unicore/lib/Nv/8.pl Unicode character database -lib/unicore/lib/Nv/90000.pl Unicode character database -lib/unicore/lib/Nv/9000.pl Unicode character database -lib/unicore/lib/Nv/900.pl Unicode character database lib/unicore/lib/Nv/90.pl Unicode character database -lib/unicore/lib/Nv/9_2.pl Unicode character database lib/unicore/lib/Nv/9.pl Unicode character database lib/unicore/lib/PatSyn/Y.pl Unicode character database lib/unicore/lib/PatWS/Y.pl Unicode character database lib/unicore/lib/Perl/Alnum.pl Unicode character database -lib/unicore/lib/Perl/Any.pl Unicode character database lib/unicore/lib/Perl/Assigned.pl Unicode character database lib/unicore/lib/Perl/Blank.pl Unicode character database lib/unicore/lib/Perl/Graph.pl Unicode character database lib/unicore/lib/Perl/_PerlAny.pl Unicode character database lib/unicore/lib/Perl/_PerlCh2.pl Unicode character database lib/unicore/lib/Perl/_PerlCha.pl Unicode character database +lib/unicore/lib/Perl/_PerlFol.pl Unicode character database lib/unicore/lib/Perl/_PerlIDC.pl Unicode character database lib/unicore/lib/Perl/_PerlIDS.pl Unicode character database +lib/unicore/lib/Perl/_PerlPr2.pl Unicode character database +lib/unicore/lib/Perl/_PerlPro.pl Unicode character database lib/unicore/lib/Perl/_PerlQuo.pl Unicode character database -lib/unicore/lib/Perl/PerlSpac.pl Unicode character database lib/unicore/lib/Perl/PerlWord.pl Unicode character database -lib/unicore/lib/Perl/PosixAln.pl Unicode character database -lib/unicore/lib/Perl/PosixAlp.pl Unicode character database -lib/unicore/lib/Perl/PosixBla.pl Unicode character database -lib/unicore/lib/Perl/PosixCnt.pl Unicode character database -lib/unicore/lib/Perl/PosixDig.pl Unicode character database -lib/unicore/lib/Perl/PosixGra.pl Unicode character database -lib/unicore/lib/Perl/PosixLow.pl Unicode character database -lib/unicore/lib/Perl/PosixPri.pl Unicode character database lib/unicore/lib/Perl/PosixPun.pl Unicode character database -lib/unicore/lib/Perl/PosixUpp.pl Unicode character database lib/unicore/lib/Perl/Print.pl Unicode character database -lib/unicore/lib/Perl/SpacePer.pl Unicode character database -lib/unicore/lib/Perl/Title.pl Unicode character database -lib/unicore/lib/Perl/VertSpac.pl Unicode character database lib/unicore/lib/Perl/Word.pl Unicode character database lib/unicore/lib/Perl/_XExtend.pl Unicode character database -lib/unicore/lib/Perl/_XGCBL.pl Unicode character database -lib/unicore/lib/Perl/_XGCBLV.pl Unicode character database -lib/unicore/lib/Perl/_XGCBLVT.pl Unicode character database -lib/unicore/lib/Perl/_XGCBT.pl Unicode character database -lib/unicore/lib/Perl/_XGCBV.pl Unicode character database -lib/unicore/lib/Perl/_XLVLVTV.pl Unicode character database lib/unicore/lib/Perl/XPosixPu.pl Unicode character database lib/unicore/lib/Perl/_XRegula.pl Unicode character database -lib/unicore/lib/Perl/_XRI.pl Unicode character database lib/unicore/lib/Perl/_XSpecia.pl Unicode character database lib/unicore/lib/QMark/Y.pl Unicode character database -lib/unicore/lib/Radical/Y.pl Unicode character database lib/unicore/lib/SB/AT.pl Unicode character database lib/unicore/lib/SB/CL.pl Unicode character database lib/unicore/lib/SB/EX.pl Unicode character database @@ -5169,105 +4618,48 @@ lib/unicore/lib/SB/LE.pl Unicode chara lib/unicore/lib/SB/LO.pl Unicode character database lib/unicore/lib/SB/NU.pl Unicode character database lib/unicore/lib/SB/SC.pl Unicode character database -lib/unicore/lib/SB/SE.pl Unicode character database lib/unicore/lib/SB/Sp.pl Unicode character database lib/unicore/lib/SB/ST.pl Unicode character database lib/unicore/lib/SB/UP.pl Unicode character database lib/unicore/lib/SB/XX.pl Unicode character database lib/unicore/lib/Sc/Arab.pl Unicode character database -lib/unicore/lib/Sc/Armi.pl Unicode character database lib/unicore/lib/Sc/Armn.pl Unicode character database -lib/unicore/lib/Sc/Avst.pl Unicode character database -lib/unicore/lib/Sc/Bali.pl Unicode character database -lib/unicore/lib/Sc/Bamu.pl Unicode character database -lib/unicore/lib/Sc/Batk.pl Unicode character database lib/unicore/lib/Sc/Beng.pl Unicode character database -lib/unicore/lib/Sc/Bopo.pl Unicode character database -lib/unicore/lib/Sc/Brah.pl Unicode character database -lib/unicore/lib/Sc/Bugi.pl Unicode character database -lib/unicore/lib/Sc/Buhd.pl Unicode character database -lib/unicore/lib/Sc/Cakm.pl Unicode character database -lib/unicore/lib/Sc/Cans.pl Unicode character database -lib/unicore/lib/Sc/Cari.pl Unicode character database lib/unicore/lib/Sc/Cham.pl Unicode character database -lib/unicore/lib/Sc/Cher.pl Unicode character database -lib/unicore/lib/Sc/Copt.pl Unicode character database lib/unicore/lib/Sc/Cprt.pl Unicode character database lib/unicore/lib/Sc/Cyrl.pl Unicode character database lib/unicore/lib/Sc/Deva.pl Unicode character database -lib/unicore/lib/Sc/Egyp.pl Unicode character database lib/unicore/lib/Sc/Ethi.pl Unicode character database lib/unicore/lib/Sc/Geor.pl Unicode character database -lib/unicore/lib/Sc/Glag.pl Unicode character database -lib/unicore/lib/Sc/Goth.pl Unicode character database lib/unicore/lib/Sc/Grek.pl Unicode character database lib/unicore/lib/Sc/Gujr.pl Unicode character database lib/unicore/lib/Sc/Guru.pl Unicode character database lib/unicore/lib/Sc/Hang.pl Unicode character database -lib/unicore/lib/Sc/Hano.pl Unicode character database lib/unicore/lib/Sc/Han.pl Unicode character database lib/unicore/lib/Sc/Hebr.pl Unicode character database lib/unicore/lib/Sc/Hira.pl Unicode character database -lib/unicore/lib/Sc/Ital.pl Unicode character database -lib/unicore/lib/Sc/Java.pl Unicode character database lib/unicore/lib/Sc/Kana.pl Unicode character database lib/unicore/lib/Sc/Khar.pl Unicode character database lib/unicore/lib/Sc/Khmr.pl Unicode character database lib/unicore/lib/Sc/Knda.pl Unicode character database -lib/unicore/lib/Sc/Kthi.pl Unicode character database lib/unicore/lib/Sc/Lana.pl Unicode character database lib/unicore/lib/Sc/Lao.pl Unicode character database lib/unicore/lib/Sc/Latn.pl Unicode character database -lib/unicore/lib/Sc/Lepc.pl Unicode character database lib/unicore/lib/Sc/Limb.pl Unicode character database lib/unicore/lib/Sc/Linb.pl Unicode character database -lib/unicore/lib/Sc/Lyci.pl Unicode character database -lib/unicore/lib/Sc/Lydi.pl Unicode character database -lib/unicore/lib/Sc/Mand.pl Unicode character database -lib/unicore/lib/Sc/Merc.pl Unicode character database -lib/unicore/lib/Sc/Miao.pl Unicode character database lib/unicore/lib/Sc/Mlym.pl Unicode character database lib/unicore/lib/Sc/Mong.pl Unicode character database -lib/unicore/lib/Sc/Mtei.pl Unicode character database -lib/unicore/lib/Sc/Mymr.pl Unicode character database -lib/unicore/lib/Sc/Nko.pl Unicode character database -lib/unicore/lib/Sc/Ogam.pl Unicode character database -lib/unicore/lib/Sc/Orkh.pl Unicode character database lib/unicore/lib/Sc/Orya.pl Unicode character database -lib/unicore/lib/Sc/Osma.pl Unicode character database -lib/unicore/lib/Sc/Phag.pl Unicode character database -lib/unicore/lib/Sc/Phli.pl Unicode character database -lib/unicore/lib/Sc/Phnx.pl Unicode character database -lib/unicore/lib/Sc/Prti.pl Unicode character database -lib/unicore/lib/Sc/Rjng.pl Unicode character database -lib/unicore/lib/Sc/Runr.pl Unicode character database -lib/unicore/lib/Sc/Samr.pl Unicode character database -lib/unicore/lib/Sc/Saur.pl Unicode character database -lib/unicore/lib/Sc/Shrd.pl Unicode character database lib/unicore/lib/Sc/Sinh.pl Unicode character database -lib/unicore/lib/Sc/Sora.pl Unicode character database -lib/unicore/lib/Sc/Sund.pl Unicode character database -lib/unicore/lib/Sc/Sylo.pl Unicode character database -lib/unicore/lib/Sc/Syrc.pl Unicode character database -lib/unicore/lib/Sc/Tagb.pl Unicode character database -lib/unicore/lib/Sc/Takr.pl Unicode character database -lib/unicore/lib/Sc/Tale.pl Unicode character database lib/unicore/lib/Sc/Talu.pl Unicode character database lib/unicore/lib/Sc/Taml.pl Unicode character database -lib/unicore/lib/Sc/Tavt.pl Unicode character database lib/unicore/lib/Sc/Telu.pl Unicode character database -lib/unicore/lib/Sc/Tfng.pl Unicode character database -lib/unicore/lib/Sc/Tglg.pl Unicode character database -lib/unicore/lib/Sc/Thaa.pl Unicode character database -lib/unicore/lib/Sc/Thai.pl Unicode character database lib/unicore/lib/Sc/Tibt.pl Unicode character database -lib/unicore/lib/Sc/Ugar.pl Unicode character database -lib/unicore/lib/Sc/Vai.pl Unicode character database lib/unicore/lib/Scx/Arab.pl Unicode character database lib/unicore/lib/Scx/Armn.pl Unicode character database lib/unicore/lib/Scx/Beng.pl Unicode character database lib/unicore/lib/Scx/Bopo.pl Unicode character database -lib/unicore/lib/Scx/Buhd.pl Unicode character database +lib/unicore/lib/Scx/Cakm.pl Unicode character database lib/unicore/lib/Scx/Cprt.pl Unicode character database lib/unicore/lib/Scx/Cyrl.pl Unicode character database lib/unicore/lib/Scx/Deva.pl Unicode character database @@ -5276,45 +4668,37 @@ lib/unicore/lib/Scx/Grek.pl Unicode ch lib/unicore/lib/Scx/Gujr.pl Unicode character database lib/unicore/lib/Scx/Guru.pl Unicode character database lib/unicore/lib/Scx/Hang.pl Unicode character database -lib/unicore/lib/Scx/Hano.pl Unicode character database lib/unicore/lib/Scx/Han.pl Unicode character database lib/unicore/lib/Scx/Hira.pl Unicode character database lib/unicore/lib/Scx/Kana.pl Unicode character database -lib/unicore/lib/Scx/Kthi.pl Unicode character database lib/unicore/lib/Scx/Latn.pl Unicode character database lib/unicore/lib/Scx/Linb.pl Unicode character database -lib/unicore/lib/Scx/Mand.pl Unicode character database lib/unicore/lib/Scx/Mong.pl Unicode character database lib/unicore/lib/Scx/Orya.pl Unicode character database -lib/unicore/lib/Sc/Xpeo.pl Unicode character database -lib/unicore/lib/Scx/Phag.pl Unicode character database -lib/unicore/lib/Sc/Xsux.pl Unicode character database lib/unicore/lib/Scx/Syrc.pl Unicode character database lib/unicore/lib/Scx/Tagb.pl Unicode character database lib/unicore/lib/Scx/Takr.pl Unicode character database -lib/unicore/lib/Scx/Tglg.pl Unicode character database lib/unicore/lib/Scx/Thaa.pl Unicode character database lib/unicore/lib/Scx/Yi.pl Unicode character database lib/unicore/lib/Scx/Zinh.pl Unicode character database lib/unicore/lib/Scx/Zyyy.pl Unicode character database -lib/unicore/lib/Sc/Yi.pl Unicode character database lib/unicore/lib/Sc/Zinh.pl Unicode character database lib/unicore/lib/Sc/Zyyy.pl Unicode character database lib/unicore/lib/Sc/Zzzz.pl Unicode character database lib/unicore/lib/SD/Y.pl Unicode character database +lib/unicore/lib/Space/Y.pl Unicode character database lib/unicore/lib/STerm/Y.pl Unicode character database lib/unicore/lib/Term/Y.pl Unicode character database lib/unicore/lib/UIdeo/Y.pl Unicode character database lib/unicore/lib/Upper/Y.pl Unicode character database -lib/unicore/lib/VS/Y.pl Unicode character database lib/unicore/lib/WB/EX.pl Unicode character database lib/unicore/lib/WB/FO.pl Unicode character database +lib/unicore/lib/WB/HL.pl Unicode character database lib/unicore/lib/WB/KA.pl Unicode character database lib/unicore/lib/WB/LE.pl Unicode character database lib/unicore/lib/WB/MB.pl Unicode character database lib/unicore/lib/WB/ML.pl Unicode character database lib/unicore/lib/WB/MN.pl Unicode character database -lib/unicore/lib/WB/NL.pl Unicode character database lib/unicore/lib/WB/NU.pl Unicode character database lib/unicore/lib/WB/XX.pl Unicode character database lib/unicore/lib/XIDC/Y.pl Unicode character database @@ -5343,6 +4727,8 @@ lib/unicore/TestProp.pl Unicode charac lib/unicore/To/Age.pl Unicode character database lib/unicore/To/Bc.pl Unicode character database lib/unicore/To/Bmg.pl Unicode character database +lib/unicore/To/Bpb.pl Unicode character database +lib/unicore/To/Bpt.pl Unicode character database lib/unicore/To/Cf.pl Unicode character database lib/unicore/To/Digit.pl Unicode character database lib/unicore/To/Ea.pl Unicode character database @@ -5388,17 +4774,6 @@ lib/utf8.t See if utf8 operations work lib/vars_carp.t See if "use vars" doesn't load Carp.pm per default lib/vars.pm Declare pseudo-imported global variables lib/vars.t See if "use vars" works -lib/version/Internals.pod Description of the internals of version objects -lib/version.pm Support for version objects -lib/version.pod Documentation of the version module -lib/version/t/01base.t Tests for version objects` -lib/version/t/02derived.t Tests for version objects -lib/version/t/03require.t Tests for version objects -lib/version/t/04strict_lax.t Tests for version objects -lib/version/t/05sigdie.t Tests for version objects -lib/version/t/06noop.t Tests for version objects -lib/version/t/07locale.t Tests for version objects -lib/version/t/coretests.pm Tests for version objects lib/vmsish.pm Control VMS-specific behavior of Perl core lib/vmsish.t Tests for vmsish.pm lib/warnings.pm For "use warnings" @@ -5431,7 +4806,6 @@ mg.h Magic header mg_names.c Generated magic names used by dump.c mg_raw.h Generated magic data used by generate_uudmap.c mg_vtable.h Generated magic vtable data -minimod.pl Writes lib/ExtUtils/Miniperl.pm miniperlmain.c Basic perl w/o dynamic loading or extensions mkppport A script that distributes ppport.h mkppport.lst List of extensions that need a ppport.h @@ -5561,6 +4935,7 @@ os2/perlrexx.c Support perl interprete os2/perlrexx.cmd Test perl interpreter embedded in REXX overload.c generated overload enum (public) overload.h generated overload name table (implementation) +packsizetables.c The generated packprops array used in pp_pack.c pad.c Scratchpad functions pad.h Scratchpad headers parser.h parser object header @@ -5575,8 +4950,6 @@ perlio.h PerlIO abstraction perliol.h PerlIO Layer definition perlio.sym Symbols for PerlIO abstraction perlsdio.h Fake stdio using perlio -perlsfio.h Prototype sfio mapping for PerlIO -perlsh A poor man's perl shell perlvars.h Global variables perly.act parser actions; derived from perly.y perly.c parser code (NOT derived from perly.y) @@ -5621,6 +4994,8 @@ pod/perl5162delta.pod Perl changes in v pod/perl5163delta.pod Perl changes in version 5.16.3 pod/perl5180delta.pod Perl changes in version 5.18.0 pod/perl5181delta.pod Perl changes in version 5.18.1 +pod/perl5182delta.pod Perl changes in version 5.18.2 +pod/perl5200delta.pod Perl changes in version 5.20.0 pod/perl561delta.pod Perl changes in version 5.6.1 pod/perl56delta.pod Perl changes in version 5.6 pod/perl581delta.pod Perl changes in version 5.8.1 @@ -5790,8 +5165,6 @@ Porting/release_schedule.pod Schedule fo Porting/rt_list_patches A tool to help you apply patches from RT Porting/sort_perldiag.pl Keep our diagnostics orderly Porting/sync-with-cpan Sync with CPAN -Porting/testall.atom Cumulative profile with Third Degree -Porting/thirdclean Cleanup Third Degree reports Porting/timecheck2.c Test program for the 2038 fix Porting/timecheck.c Test program for the 2038 fix Porting/todo.pod Perl things to do @@ -5811,11 +5184,11 @@ qnx/qnx.c QNX silent matherr callback README The Instructions README.aix Perl notes for AIX README.amiga Perl notes for AmigaOS +README.android Perl notes for Android README.bs2000 Perl notes for POSIX-BC BS2000 README.ce Perl notes for WinCE README.cn Perl for Simplified Chinese (in EUC-CN) README.cygwin Perl notes for Cygwin -README.dgux Perl notes for DG/UX README.dos Perl notes for DOS README.freebsd Perl notes for FreeBSD README.haiku Perl notes for Haiku @@ -5838,6 +5211,7 @@ README.qnx Perl notes for QNX README.riscos Perl notes for RISC OS README.solaris Perl notes for Solaris README.symbian Perl notes for Symbian +README.synology Perl notes for Synology README.tru64 Perl notes for Tru64 README.tw Perl for Traditional Chinese (in Big5) README.vms Notes about installing the VMS port @@ -5852,8 +5226,11 @@ regcomp.sym Data for regnodes.h regen/embed_lib.pl Reads embed.fnc and regen/opcodes regen/embed.pl Produces {embed,embedvar,proto}.h regen/feature.pl Generates feature.pm +regen/genpacksizetables.pl Generate the size tables for pack/unpack regen/keywords.pl Program to write keywords.h +regen/lib_cleanup.pl Generate lib/.gitignore from MANIFEST regen/mg_vtable.pl generate mg_vtable.h +regen/miniperlmain.pl generate miniperlmain.c regen/mk_invlists.pl Generates charclass_invlists.h regen/mk_PL_charclass.pl Populate the PL_charclass table regen/opcode.pl Opcode header generator @@ -5938,7 +5315,9 @@ t/base/rs.t See if record-read works t/base/term.t See if various terms work t/base/while.t See if while work t/benchmark/rt26188-speed-up-keys-on-empty-hash.t Benchmark if keys on empty hashes is fast enough +t/bigmem/pos.t Check that pos() handles large offsets t/bigmem/read.t Check read() handles large offsets +t/bigmem/regexp.t Test regular expressions with large strings t/bigmem/vec.t Check vec() handles large offsets t/cmd/elsif.t See if else-if works t/cmd/for.t See if for loops work @@ -5979,11 +5358,13 @@ time64.h 64 bit clean time.h (header) t/io/argv.t See if ARGV stuff works t/io/binmode.t See if binmode() works t/io/bom.t See if scripts can start with a byte order mark +t/io/closepid.t See if close works for subprocesses t/io/crlf.t See if :crlf works t/io/crlf_through.t See if pipe passes data intact with :crlf t/io/data.t See if DATA works t/io/defout.t See if PL_defoutgv works t/io/dup.t See if >& works right +t/io/eintr_print.t Test that print is not returning EINTR t/io/eintr.t See if code called during EINTR is safe t/io/errnosig.t Test case for restoration $! when leaving signal handlers t/io/errno.t See if $! is correctly set @@ -6005,7 +5386,9 @@ t/io/print.t See if print commands wor t/io/pvbm.t See if PVBMs break IO commands t/io/read.t See if read works t/io/say.t See if say works +t/io/sem.t See if SysV semaphores work t/io/shm.t See if SysV shared memory works +t/io/socket.t See if socket functions work t/io/tell.t See if file seeking works t/io/through.t See if pipe passes data intact t/io/utf8.t See if file seeking works @@ -6019,6 +5402,7 @@ t/lib/compmod.pl Helper for 1_compile.t t/lib/Count.pm Helper for t/op/method.t t/lib/croak/mg Test croak calls from mg.c t/lib/croak/op Test croak calls from op.c +t/lib/croak/pp Test croak calls from pp.c t/lib/croak/pp_ctl Test croak calls from pp_ctl.c t/lib/croak/pp_hot Test croak calls from pp_hot.c t/lib/croak.t Test calls to Perl_croak() in the C source. @@ -6030,6 +5414,7 @@ t/lib/deprecate/Optionally.pm Optionally t/lib/deprecate.t Test deprecate.pm t/lib/Devel/nodb.pm Module for t/run/switchd.t t/lib/Devel/switchd_empty.pm Module for t/run/switchd.t +t/lib/Devel/switchd_goto.pm Module for t/run/switchd.t t/lib/Devel/switchd.pm Module for t/run/switchd.t t/lib/feature/bundle Tests for feature bundles t/lib/feature/implicit Tests for implicit loading of feature.pm @@ -6070,13 +5455,13 @@ t/lib/warnings/doio Tests for doio.c fo t/lib/warnings/doop Tests for doop.c for warnings.t t/lib/warnings/gv Tests for gv.c for warnings.t t/lib/warnings/hv Tests for hv.c for warnings.t +t/lib/warnings/irs Tests for $/ for warnings.t t/lib/warnings/malloc Tests for malloc.c for warnings.t t/lib/warnings/mg Tests for mg.c for warnings.t t/lib/warnings/op Tests for op.c for warnings.t t/lib/warnings/pad Tests for pad.c for warnings.t t/lib/warnings/perl Tests for perl.c for warnings.t t/lib/warnings/perlio Tests for perlio.c for warnings.t -t/lib/warnings/perly Tests for perly.y for warnings.t t/lib/warnings/pp Tests for pp.c for warnings.t t/lib/warnings/pp_ctl Tests for pp_ctl.c for warnings.t t/lib/warnings/pp_hot Tests for pp_hot.c for warnings.t @@ -6091,6 +5476,7 @@ t/lib/warnings/toke Tests for toke.c fo t/lib/warnings/universal Tests for universal.c for warnings.t t/lib/warnings/utf8 Tests for utf8.c for warnings.t t/lib/warnings/util Tests for util.c for warnings.t +t/loc_tools.pl Common functions for finding platform's locales t/mro/basic_01_c3.t mro tests t/mro/basic_01_c3_utf8.t utf8 mro tests t/mro/basic_01_dfs.t mro tests @@ -6174,6 +5560,7 @@ t/op/array_base.t Tests for the remnant t/op/array.t See if array operations work t/op/assignwarn.t See if OP= operators warn correctly for undef targets t/op/attrhand.t See if attribute handlers work +t/op/attrproto.t See if the prototype attribute works t/op/attrs.t See if attributes on declarations work t/op/auto.t See if autoincrement et all work t/op/avhv.t See if pseudo-hashes work @@ -6251,7 +5638,10 @@ t/op/index.t See if index works t/op/index_thr.t See if index works in another thread t/op/int.t See if int works t/op/join.t See if join works -t/op/kill0.t See if kill(0, $pid) works +t/op/kill0_child Process tree script that is kill()ed +t/op/kill0.t See if kill works +t/op/kvaslice.t See if index/value array slices work +t/op/kvhslice.t See if key/value hash slices work t/op/lc.t See if lc, uc, lcfirst, ucfirst, quotemeta work t/op/leaky-magic.t See whether vars' magic leaks into packages t/op/length.t See if length works @@ -6259,7 +5649,7 @@ t/op/lex_assign.t See if ops involving t/op/lexsub.t See if lexical subroutines work t/op/lex.t Tests too complex for t/base/lex.t t/op/lfs.t See if large files work for perlio -t/op/list.t See if array lists work +t/op/list.t See if lists and list slices work t/op/localref.t See if local ${deref} works t/op/local.t See if local works t/op/lock.t Tests for lock args & retval (no threads) @@ -6283,6 +5673,7 @@ t/op/override.t See if operator overri t/op/packagev.t See if package VERSION work t/op/pack.t See if pack and unpack work t/op/pos.t See if pos works +t/op/postfixderef.t See if ->$* ->@[ et al work t/op/pow.t See if ** works t/op/print.t See if print works t/op/protowarn.t See if the illegalproto warnings work @@ -6302,10 +5693,12 @@ t/op/require_37033.t See if require alw t/op/require_errors.t See if errors from require are reported correctly t/op/reset.t See if reset operator works t/op/reverse.t See if reverse operator works +t/op/rt119311.t Test bug #119311 (die/DESTROY/recursion) t/op/runlevel.t See if die() works from perl_call_*() t/op/select.t See if 0- and 1-argument select works t/op/setpgrpstack.t See if setpgrp works t/op/sigdispatch.t See if signals are always dispatched +t/op/signatures.t See if sub signatures work t/op/sigsystem.t See if system and SIGCHLD handlers play together nicely t/op/sleep.t See if sleep works t/op/smartkve.t See if smart deref for keys/values/each works @@ -6355,6 +5748,7 @@ t/op/utfhash.t See if utf8 keys in has t/op/utftaint.t See if utf8 and taint work together t/op/vec.t See if vectors work t/op/ver.t See if v-strings and the %v format flag work +t/op/waitpid.t See if waitpid works t/op/wantarray.t See if wantarray works t/op/warn.t See if warn works t/op/while.t See if while loops work @@ -6367,6 +5761,8 @@ t/porting/bincompat.t Check that {non_, t/porting/checkcase.t Check whether we are case-insensitive-fs-friendly t/porting/checkcfgvar.t Check that all config.sh-like files are good t/porting/cmp_version.t Test whether all changed module files have their VERSION bumped +t/porting/copyright.t Check that copyright years match +t/porting/corelist.t Check that Module-CoreList has perl versions for the current perl t/porting/customized.dat Data file for porting/customized.t t/porting/customized.t Check all CUSTOMIZED files are as they should be t/porting/diag.t Test completeness of perldiag.pod @@ -6383,7 +5779,9 @@ t/porting/pending-author.t Check if any t/porting/perlfunc.t Test that Functions_pm.PL can parse perlfunc.pod t/porting/podcheck.t Test the POD of shipped modules is well formed t/porting/pod_rules.t Check that various pod lists are consistent +t/porting/readme.t Check that all files in Porting/ are mentioned in Porting/README.pod t/porting/regen.t Check that regen.pl doesn't need running +t/porting/ss_dup.t Check that sv.c:ss_dup handle everything t/porting/test_bootstrap.t Test that the instructions for test bootstrapping aren't accidentally overlooked. t/porting/utils.t Check that utility scripts still compile t/README Instructions for regression tests @@ -6443,6 +5841,8 @@ t/run/dtrace.pl For dtrace.t t/run/dtrace.t Test for DTrace probes t/run/exit.t Test perl's exit status. t/run/flib/broken.pm Bad .pm file for switchM.t +t/run/flib/t2.pm Test for .pmcs with -I/dir/ +t/run/flib/t2.pmc Test for .pmcs with -I/dir/ t/run/fresh_perl.t Tests that require a fresh perl. t/run/locale.t Tests related to locale handling t/run/mad.t Test vs MAD environment @@ -6456,6 +5856,7 @@ t/run/switchd-78586.t See whether bug 7 t/run/switchd.t Test the -d switch t/run/switches.t Tests for the other switches (-0, -l, -c, -s, -M, -m, -V, -v, -h, -z, -i) t/run/switchF1.t Pathological tests for the -F switch +t/run/switchF2.t Pathological tests for the -F switch t/run/switchF.t Test the -F switch t/run/switchI.t Test the -I switch t/run/switchM.t Test the -M switch @@ -6509,9 +5910,12 @@ t/uni/upper.t See if Unicode casing wo t/uni/variables.t See that the rules for variable names work t/uni/write.t See if Unicode formats work t/win32/fs.t Test Win32 link for compatibility +t/win32/popen.t Test for stdout races in backticks, etc t/win32/runenv.t Test if Win* perl honors its env variables +t/win32/signal.t Test Win32 signal emulation t/win32/system.t See if system works in Win* t/win32/system_tests Test runner for system.t +t/x2p/find2perl.t Test find2perl t/x2p/s2p.t See if s2p/psed work uconfig64.sh Configuration script for microperl for LP64 uconfig.h Configuration header for microperl @@ -6527,10 +5931,7 @@ util.h Dummy header utils/c2ph.PL program to translate dbx stabs to perl utils/config_data.PL Module::Build tool utils/corelist.PL Module::CoreList -utils/cpan2dist.PL the cpan2dist utility utils/cpan.PL easily interact with CPAN from the command line -utils/cpanp.PL the cpanp utility -utils/cpanp-run-perl.PL the cpanp-run-perl utility utils/enc2xs.PL Encode module generator utils/h2ph.PL A thing to turn C .h files into perl .ph files utils/h2xs.PL Program to make .xs files from C header files @@ -6538,8 +5939,7 @@ utils/instmodsh.PL Give information abo utils/json_pp.PL JSON::PP command line utility utils/libnetcfg.PL libnet utils.lst Lists utilities bundled with Perl -utils/Makefile Pregenerated from utils/Makefile.SH -utils/Makefile.SH Extract the utility scripts +utils/Makefile.PL Extract the utility scripts utils/perlbug.PL A simple tool to submit a bug report utils/perldoc.PL A simple tool to find & display perl's documentation utils/perlivp.PL installation verification procedure @@ -6555,8 +5955,6 @@ utils/splain.PL Stand-alone version of utils/xsubpp.PL External subroutine preprocessor utils/zipdetails.PL display the internal structure of zip files vms/descrip_mms.template Template MM[SK] description file for build -vms/ext/Filespec.pm VMS-Unix file syntax interconversion -vms/ext/filespec.t See if VMS::Filespec functions work vms/genopt.com hack to write options files in case of broken makes vms/gen_shrfls.pl generate options files and glue for shareable image vms/make_command.com record MM[SK] command used to build Perl @@ -6573,6 +5971,9 @@ vos/configure_full_perl.sh VOS shell scr vos/make_full_perl.sh VOS shell script to build and test "full" perl vos/vos.c VOS emulations for missing POSIX functions vos/vosish.h VOS-specific header file +vutil.c Version object C functions +vutil.h Version object headers +vxs.inc Version object XS methods warnings.h The warning numbers win32/bin/exetype.pl Set executable type to CONSOLE or WINDOWS win32/bin/perlglob.pl Win32 globbing @@ -6585,6 +5986,7 @@ win32/ce-helpers/compile.bat WinCE port win32/ce-helpers/comp.pl WinCE port win32/ce-helpers/makedist.pl WinCE port win32/ce-helpers/registry.bat WinCE port +win32/ce-helpers/sdsdkenv.bat WinCE port win32/config.ce WinCE port win32/config.gc Win32 base line config.sh (MinGW build) win32/config_H.ce WinCE port @@ -6600,6 +6002,7 @@ win32/FindExt.pm Scan for extensions win32/include/arpa/inet.h Win32 port win32/include/dirent.h Win32 port win32/include/netdb.h Win32 port +win32/include/sys/errno2.h Win32 port win32/include/sys/socket.h Win32 port win32/list_static_libs.pl prints libraries for static linking win32/Makefile Win32 makefile for NMAKE (Visual C++ build) @@ -6635,7 +6038,6 @@ x2p/a2p.h Global declarations x2p/a2p.pod Pod for awk to perl translator x2p/a2p.y A yacc grammar for awk x2p/a2py.c Awk compiler, sort of -x2p/cflags.SH A script that emits C compilation flags per file x2p/EXTERN.h Same as above x2p/find2perl.PL A find to perl translator x2p/hash.c Hashes again Index: gnu/usr.bin/perl/META.json =================================================================== RCS file: /mnt/memory/perl/importit/cvs/src/gnu/usr.bin/perl/META.json,v retrieving revision 1.1.1.1 diff -u -p -u -p -r1.1.1.1 META.json --- gnu/usr.bin/perl/META.json 24 Mar 2014 14:58:45 -0000 1.1.1.1 +++ gnu/usr.bin/perl/META.json 16 Nov 2014 03:22:23 -0000 @@ -4,7 +4,7 @@ "perl5-porters@perl.org" ], "dynamic_config" : 1, - "generated_by" : "CPAN::Meta version 2.120921", + "generated_by" : "CPAN::Meta version 2.140640", "license" : [ "perl_5" ], @@ -21,11 +21,11 @@ "dist/bignum", "dist/Carp", "dist/constant", - "dist/Cwd", "dist/Data-Dumper", "dist/Devel-SelfStubber", "dist/Dumpvalue", "dist/Env", + "dist/Exporter", "dist/ExtUtils-CBuilder", "dist/ExtUtils-Command", "dist/ExtUtils-Install", @@ -33,7 +33,6 @@ "dist/ExtUtils-ParseXS", "dist/Filter-Simple", "dist/I18N-Collate", - "dist/I18N-LangTags", "dist/if", "dist/IO/", "dist/lib/", @@ -43,6 +42,7 @@ "dist/Math-BigRat", "dist/Module-CoreList", "dist/Net-Ping", + "dist/PathTools", "dist/Safe", "dist/Search-Dict", "dist/SelfLoader", @@ -56,7 +56,6 @@ "dist/threads-shared", "dist/Tie-File", "dist/XSLoader", - "lib/version", "mad", "win32" ], @@ -105,23 +104,21 @@ "dist/lib/lib_pm.PL", "dist/lib/Makefile.PL", "dist/lib/t/01lib.t", - "lib/Exporter.pm", - "lib/Exporter.t", - "lib/Exporter/Heavy.pm", "lib/unicore/mktables", - "lib/version.pm", - "lib/version.pod", "pod/perlfilter.pod", "pod/perlpodstyle.pod", "Porting/Maintainers.pm", "Porting/perldelta_template.pod", - "TestInit.pm" + "TestInit.pm", + "vutil.c", + "vutil.h", + "vxs.inc" ] }, "release_status" : "stable", "resources" : { "bugtracker" : { - "web" : "http://rt.perl.org/perlbug/" + "web" : "https://rt.perl.org/" }, "homepage" : "http://www.perl.org/", "license" : [ @@ -131,5 +128,5 @@ "url" : "http://perl5.git.perl.org/" } }, - "version" : "5.018002" + "version" : "5.020001" } Index: gnu/usr.bin/perl/META.yml =================================================================== RCS file: /mnt/memory/perl/importit/cvs/src/gnu/usr.bin/perl/META.yml,v retrieving revision 1.1.1.10 diff -u -p -u -p -r1.1.1.10 META.yml --- gnu/usr.bin/perl/META.yml 24 Mar 2014 14:58:45 -0000 1.1.1.10 +++ gnu/usr.bin/perl/META.yml 16 Nov 2014 03:22:23 -0000 @@ -4,11 +4,11 @@ author: - perl5-porters@perl.org build_requires: {} dynamic_config: 1 -generated_by: 'CPAN::Meta version 2.120921, CPAN::Meta::Converter version 2.120921' +generated_by: 'CPAN::Meta version 2.140640, CPAN::Meta::Converter version 2.140640' license: perl meta-spec: url: http://module-build.sourceforge.net/META-spec-v1.4.html - version: 1.4 + version: '1.4' name: perl no_index: directory: @@ -19,11 +19,11 @@ no_index: - dist/bignum - dist/Carp - dist/constant - - dist/Cwd - dist/Data-Dumper - dist/Devel-SelfStubber - dist/Dumpvalue - dist/Env + - dist/Exporter - dist/ExtUtils-CBuilder - dist/ExtUtils-Command - dist/ExtUtils-Install @@ -31,7 +31,6 @@ no_index: - dist/ExtUtils-ParseXS - dist/Filter-Simple - dist/I18N-Collate - - dist/I18N-LangTags - dist/if - dist/IO/ - dist/lib/ @@ -41,6 +40,7 @@ no_index: - dist/Math-BigRat - dist/Module-CoreList - dist/Net-Ping + - dist/PathTools - dist/Safe - dist/Search-Dict - dist/SelfLoader @@ -54,7 +54,6 @@ no_index: - dist/threads-shared - dist/Tie-File - dist/XSLoader - - lib/version - mad - win32 file: @@ -102,20 +101,18 @@ no_index: - dist/lib/lib_pm.PL - dist/lib/Makefile.PL - dist/lib/t/01lib.t - - lib/Exporter.pm - - lib/Exporter.t - - lib/Exporter/Heavy.pm - lib/unicore/mktables - - lib/version.pm - - lib/version.pod - pod/perlfilter.pod - pod/perlpodstyle.pod - Porting/Maintainers.pm - Porting/perldelta_template.pod - TestInit.pm + - vutil.c + - vutil.h + - vxs.inc resources: - bugtracker: http://rt.perl.org/perlbug/ + bugtracker: https://rt.perl.org/ homepage: http://www.perl.org/ license: http://dev.perl.org/licenses/ repository: http://perl5.git.perl.org/ -version: 5.018002 +version: '5.020001' Index: gnu/usr.bin/perl/Makefile.SH =================================================================== RCS file: /mnt/memory/perl/importit/cvs/src/gnu/usr.bin/perl/Makefile.SH,v retrieving revision 1.24 diff -u -p -u -p -r1.24 Makefile.SH --- gnu/usr.bin/perl/Makefile.SH 24 Mar 2014 15:05:12 -0000 1.24 +++ gnu/usr.bin/perl/Makefile.SH 16 Nov 2014 03:22:23 -0000 @@ -20,16 +20,7 @@ case $PERL_CONFIG_SH in ;; esac -case $CROSS_NAME in -'') - Makefile=Makefile - ;; -*) - # if cross-compilation, the Makefile named accordingly - Makefile=Makefile-cross-$CROSS_NAME - . Cross/config-${CROSS_NAME}.sh - ;; -esac +Makefile=Makefile : This forces SH files to create target in same directory as SH file. : This is so that make depend always knows where to find SH derivatives. @@ -77,7 +68,7 @@ true) sunos*) linklibperl="-lperl" ;; - netbsd*|freebsd[234]*|openbsd*|dragonfly*) + netbsd*|freebsd[234]*|openbsd*|dragonfly*|bitrig*) linklibperl="-L. -lperl" ;; interix*) @@ -302,7 +293,12 @@ STATIC_LDFLAGS = $static_ldflags LDLIBPTH = $ldlibpth # Sometimes running an executable is an adventure. -RUN = $run +RUN = + +# When cross-compiling we want to use a (mini)perl built for the host, not the target +HOST_PERL = $hostperl +HOST_GENERATE = $hostgenerate +SYSTEM_PERL = $perl # These variables may need to be manually set for non-Unix systems. AR = $full_ar @@ -315,12 +311,28 @@ PATH_SEP = $p_ # Macros to invoke a copy of miniperl during the build. Targets which # are built using these macros should depend on \$(MINIPERL_EXE) MINIPERL_EXE = miniperl\$(EXE_EXT) -MINIPERL = \$(LDLIBPTH) \$(RUN) ./miniperl\$(EXE_EXT) -Ilib +MINIPERL = \$(LDLIBPTH) ./miniperl\$(EXE_EXT) -Ilib + +!GROK!THIS! +case "$usecrosscompile$perl" in +define?*) + $spitshell >>$Makefile <>$Makefile <>$Makefile <>$Makefile <<'!NO!SUBS!' -CCCMD = `sh $(shellflags) cflags "optimize='$(OPTIMIZE)'" $@` +CCCMD = sh $(shellflags) cflags "optimize='$(OPTIMIZE)'" $@ -CCCMDSRC = `sh $(shellflags) cflags "optimize='$(OPTIMIZE)'" $<` +CCCMDSRC = sh $(shellflags) cflags "optimize='$(OPTIMIZE)'" $< CONFIGPM_FROM_CONFIG_SH = lib/Config.pm lib/Config_heavy.pl CONFIGPM = $(CONFIGPM_FROM_CONFIG_SH) lib/Config_git.pl @@ -420,39 +430,28 @@ CONFIGPOD = lib/Config.pod CONFIGH = config.h !NO!SUBS! - ;; -*) - # if cross-compilation -$spitshell >>$Makefile <>$Makefile <<'!NO!SUBS!' +$spitshell >>$Makefile <>$Makefile <<'!NO!SUBS!' addedbyconf = UU $(shextract) pstruct @@ -476,7 +475,7 @@ h = $(h1) $(h2) $(h3) $(h4) $(h5) $(h6) c1 = av.c scope.c op.c doop.c doio.c dump.c gv.c hv.c mg.c reentr.c mro.c perl.c c2 = perly.c pp.c pp_hot.c pp_ctl.c pp_sys.c regcomp.c regexec.c utf8.c sv.c c3 = taint.c toke.c util.c deb.c run.c universal.c pad.c globals.c keywords.c -c4 = perlio.c perlapi.c numeric.c mathoms.c locale.c pp_pack.c pp_sort.c +c4 = perlio.c perlapi.c numeric.c mathoms.c locale.c pp_pack.c pp_sort.c caretx.c c5 = $(madlysrc) $(mallocsrc) c = $(c1) $(c2) $(c3) $(c4) $(c5) miniperlmain.c opmini.c perlmini.c @@ -485,19 +484,17 @@ obj0 = op$(OBJ_EXT) perl$(OBJ_EXT) obj0mini = perlmini$(OBJ_EXT) opmini$(OBJ_EXT) miniperlmain$(OBJ_EXT) obj1 = $(madlyobj) $(mallocobj) gv$(OBJ_EXT) toke$(OBJ_EXT) perly$(OBJ_EXT) pad$(OBJ_EXT) regcomp$(OBJ_EXT) dump$(OBJ_EXT) util$(OBJ_EXT) mg$(OBJ_EXT) reentr$(OBJ_EXT) mro$(OBJ_EXT) keywords$(OBJ_EXT) obj2 = hv$(OBJ_EXT) av$(OBJ_EXT) run$(OBJ_EXT) pp_hot$(OBJ_EXT) sv$(OBJ_EXT) pp$(OBJ_EXT) scope$(OBJ_EXT) pp_ctl$(OBJ_EXT) pp_sys$(OBJ_EXT) -obj3 = doop$(OBJ_EXT) doio$(OBJ_EXT) regexec$(OBJ_EXT) utf8$(OBJ_EXT) taint$(OBJ_EXT) deb$(OBJ_EXT) universal$(OBJ_EXT) globals$(OBJ_EXT) perlio$(OBJ_EXT) perlapi$(OBJ_EXT) numeric$(OBJ_EXT) mathoms$(OBJ_EXT) locale$(OBJ_EXT) pp_pack$(OBJ_EXT) pp_sort$(OBJ_EXT) +obj3 = doop$(OBJ_EXT) doio$(OBJ_EXT) regexec$(OBJ_EXT) utf8$(OBJ_EXT) taint$(OBJ_EXT) deb$(OBJ_EXT) universal$(OBJ_EXT) globals$(OBJ_EXT) perlio$(OBJ_EXT) perlapi$(OBJ_EXT) numeric$(OBJ_EXT) mathoms$(OBJ_EXT) locale$(OBJ_EXT) pp_pack$(OBJ_EXT) pp_sort$(OBJ_EXT) caretx$(OBJ_EXT) minindt_obj = $(obj0mini) $(obj1) $(obj2) $(obj3) $(ARCHOBJS) mini_obj = $(minindt_obj) $(MINIDTRACE_O) ndt_obj = $(obj0) $(obj1) $(obj2) $(obj3) $(ARCHOBJS) obj = $(ndt_obj) $(DTRACE_O) -perltoc_pod_prereqs = extra.pods pod/perl5182delta.pod pod/perlapi.pod pod/perlintern.pod pod/perlmodlib.pod +perltoc_pod_prereqs = extra.pods pod/perl5201delta.pod pod/perlapi.pod pod/perlintern.pod pod/perlmodlib.pod generated_pods = pod/perltoc.pod $(perltoc_pod_prereqs) generated_headers = uudmap.h bitcount.h mg_data.h -Icwd = -Idist/Cwd -Idist/Cwd/lib -Idist/Carp/lib - lintflags = \ -b \ -n \ @@ -557,13 +554,16 @@ splintflags = \ splintfiles = $(c1) .c$(OBJ_EXT): - $(CCCMD) $(PLDLFLAGS) $*.c + @echo `$(CCCMD)` $(PLDLFLAGS) $*.c + @`$(CCCMD)` $(PLDLFLAGS) $*.c .c.i: - $(CCCMDSRC) -E $*.c > $*.i + @echo `$(CCCMDSRC)` -E $*.c \> $*.i + @`$(CCCMDSRC)` -E $*.c > $*.i .c.s: - $(CCCMDSRC) -S $*.c + @echo `$(CCCMDSRC)` -S $*.c + @`$(CCCMDSRC)` -S $*.c all: $(FIRSTMAKEFILE) $(MINIPERL_EXE) $(generated_pods) $(private) $(unidatafiles) $(public) $(dynamic_ext) $(nonxs_ext) extras.make @echo " "; @@ -590,18 +590,21 @@ perl$(OBJ_EXT): git_version.h case "$usedl$static_cwd" in defineundef) util_deps='$(MINIPERL_EXE) $(CONFIGPM) lib/auto/Cwd/Cwd$(DLSUFFIX) FORCE' - x2p_deps='$(MINIPERL_EXE) $(CONFIGPM) $(dynamic_ext) FORCE' + x2p_deps="\$(MINIPERL_EXE) \$(CONFIGPM) \$(dynamic_ext) x2p/$firstmakefile FORCE" ;; definedefine) util_deps='$(PERL_EXE) $(CONFIGPM) FORCE' - x2p_deps='$(PERL_EXE) $(CONFIGPM) $(dynamic_ext) FORCE' + x2p_deps="\$(PERL_EXE) \$(CONFIGPM) \$(dynamic_ext) x2p/$firstmakefile FORCE" ;; *) util_deps='$(PERL_EXE) $(CONFIGPM) FORCE' - x2p_deps='$(PERL_EXE) $(CONFIGPM) FORCE' + x2p_deps="\$(PERL_EXE) \$(CONFIGPM) x2p/$firstmakefile FORCE" ;; esac $spitshell >>$Makefile <>$Makefile <>$Makefile <>$Makefile <<'!NO!SUBS!' generate_uudmap$(HOST_EXE_EXT): generate_uudmap$(OBJ_EXT) $(CC) -o generate_uudmap$(EXE_EXT) $(LDFLAGS) generate_uudmap$(OBJ_EXT) $(libs) -miniperlmain$(OBJ_EXT): miniperlmain.c patchlevel.h - $(CCCMD) $(PLDLFLAGS) $*.c +!NO!SUBS! +;; +*) +$spitshell >>$Makefile <<'!NO!SUBS!' +bitcount.h: generate_uudmap$(HOST_EXE_EXT) + ./generate_uudmap$(HOST_EXE_EXT) $(generated_headers) -perlmain.c: $(MINIPERL_EXE) lib/ExtUtils/Miniperl.pm - $(MINIPERL) -Ilib -MExtUtils::Miniperl -e 'writemain(@ARGV)' DynaLoader $(static_ext) > perlmain.c +generate_uudmap$(HOST_EXE_EXT): generate_uudmap$(OBJ_EXT) + -@rm generate_uudmap$(HOST_EXE_EXT) + $(LNS) $(HOST_GENERATE) generate_uudmap$(HOST_EXE_EXT) -perlmain$(OBJ_EXT): perlmain.c - $(CCCMD) $(PLDLFLAGS) $*.c +!NO!SUBS! +;; +esac + + +$spitshell >>$Makefile <<'!NO!SUBS!' +perlmain.c: $(MINIPERL_EXE) ext/ExtUtils-Miniperl/pm_to_blib + $(MINIPERL) -Ilib -MExtUtils::Miniperl -e 'writemain(\"perlmain.c", @ARGV)' DynaLoader $(static_ext) # The file ext.libs is a list of libraries that must be linked in # for static extensions, e.g. -lm -lgdbm, etc. The individual @@ -720,11 +753,11 @@ CCDLFLAGS = `echo $ccdlflags|sed -e 's@ LIBPERL_NONSHR = libperl_nonshr$(LIB_EXT) MINIPERL_NONSHR = miniperl_nonshr$(EXE_EXT) -#$(LIBPERL_NONSHR): $(obj) -# $(RMS) $(LIBPERL_NONSHR) -# $(AR) rcu $(LIBPERL_NONSHR) $(obj) +$(LIBPERL_NONSHR): $(obj) + $(RMS) $(LIBPERL_NONSHR) + $(AR) rcu $(LIBPERL_NONSHR) $(obj) -$(MINIPERL_NONSHR): miniperlmain$(OBJ_EXT) opmini$(OBJ_EXT) perlmini$(OBJ_EXT) +$(MINIPERL_NONSHR): $(LIBPERL_NONSHR) miniperlmain$(OBJ_EXT) opmini$(OBJ_EXT) perlmini$(OBJ_EXT) $(CC) $(LDFLAGS) -o $(MINIPERL_NONSHR) miniperlmain$(OBJ_EXT) \ opmini$(OBJ_EXT) perlmini$(OBJ_EXT) $(LIBPERL_NONSHR) $(LIBS) @@ -808,33 +841,33 @@ $(MINIDTRACE_O): perldtrace.d $(minindt_ ;; esac $spitshell >>$Makefile <<'!NO!SUBS!' -#$(LIBPERL): $& $(obj) $(DYNALOADER) $(LIBPERLEXPORT) -#!NO!SUBS! -# case "$useshrplib" in -# true) -# $spitshell >>$Makefile <<'!NO!SUBS!' -# rm -f $@ -# $(LD) -o $@ $(SHRPLDFLAGS) $(obj) $(DYNALOADER) $(libs) -#!NO!SUBS! -# case "$osname" in -# aix) -# $spitshell >>$Makefile <<'!NO!SUBS!' -# rm -f libperl$(OBJ_EXT) -# mv $@ libperl$(OBJ_EXT) -# $(AR) qv $(LIBPERL) libperl$(OBJ_EXT) -#!NO!SUBS! -# ;; -# esac -# ;; -# *) -# $spitshell >>$Makefile <<'!NO!SUBS!' -# rm -f $(LIBPERL) -# $(AR) rcu $(LIBPERL) $(obj) $(DYNALOADER) -# @$(ranlib) $(LIBPERL) -#!NO!SUBS! -# ;; -# esac -# $spitshell >>$Makefile <<'!NO!SUBS!' +$(LIBPERL): $& $(obj) $(DYNALOADER) $(LIBPERLEXPORT) +!NO!SUBS! + case "$useshrplib" in + true) + $spitshell >>$Makefile <<'!NO!SUBS!' + rm -f $@ + $(LD) -o $@ $(SHRPLDFLAGS) $(obj) $(DYNALOADER) $(libs) +!NO!SUBS! + case "$osname" in + aix) + $spitshell >>$Makefile <<'!NO!SUBS!' + rm -f libperl$(OBJ_EXT) + mv $@ libperl$(OBJ_EXT) + $(AR) qv $(LIBPERL) libperl$(OBJ_EXT) +!NO!SUBS! + ;; + esac + ;; + *) + $spitshell >>$Makefile <<'!NO!SUBS!' + rm -f $(LIBPERL) + $(AR) rcu $(LIBPERL) $(obj) $(DYNALOADER) + @$(ranlib) $(LIBPERL) +!NO!SUBS! + ;; + esac + $spitshell >>$Makefile <<'!NO!SUBS!' # How to build executables. @@ -846,21 +879,32 @@ $(MINIDTRACE_O): perldtrace.d $(minindt_ # build problems but that's not obvious to the novice. # The Module used here must not depend on Config or any extensions. +# The seemingly cranky ordering of having $(MINIPERL_EXE) depend on +# lib/buildcustomize.pl despite the reality that lib/buildcustomize.pl needs +# miniperl to exist first permits us to +# a) have one rule generate both miniperl and lib/buildcustomize.pl +# (so that lib/buildcustomise.pl is always available. This simplifies things) +# b) have the rest of the Makefile depend on the more obvious $(MINIPERL_EXE) + +$(MINIPERL_EXE): lib/buildcustomize.pl + !NO!SUBS! case "${osname}${osvers}" in aix*) $spitshell >>$Makefile <<'!NO!SUBS!' -$(MINIPERL_EXE): $& $(mini_obj) +lib/buildcustomize.pl: $& $(mini_obj) $(CC) -o $(MINIPERL_EXE) $(CLDFLAGS) $(mini_obj) $(libs) - $(LDLIBPTH) $(RUN) ./miniperl$(HOST_EXE_EXT) -w -Ilib -MExporter -e '' || $(MAKE) minitest + $(LDLIBPTH) ./miniperl$(HOST_EXE_EXT) -w -Ilib -Idist/Exporter/lib -MExporter -e '' || sh -c 'echo >&2 Failed to build miniperl. Please run make minitest; exit 1' + $(MINIPERL) -f write_buildcustomize.pl !NO!SUBS! ;; next4*) $spitshell >>$Makefile <<'!NO!SUBS!' -$(MINIPERL_EXE): $& $(mini_obj) - $(CC) -o $(MINIPERL_EXE) $(mini_obj) $(libs) - $(LDLIBPTH) $(RUN) ./miniperl$(HOST_EXE_EXT) -w -Ilib -MExporter -e '' || $(MAKE) minitest +lib/buildcustomize.pl: $& $(mini_obj) write ldcustomize.pl + $(CC) -o $(MINIPERL_EXE) $(mini_obj libs) + $(LDLIBPTH) ./miniperl$(HOST _EXT) -w -Ilib -Idist/Exporter/lib -MExporter -e '' || sh -c 'echo >&2 Failed to build miniperl. Please run make minitest; exit 1' + $(MINIPERL) -f write_buildcustomize.pl !NO!SUBS! ;; darwin*) @@ -877,132 +921,38 @@ NAMESPACEFLAGS = -force_flat_namespace ;; esac $spitshell >>$Makefile <<'!NO!SUBS!' -$(MINIPERL_EXE): $& $(mini_obj) +lib/buildcustomize.pl: $& $(mini_obj) write_buildcustomize.pl -@rm -f miniperl.xok $(CC) $(CLDFLAGS) $(NAMESPACEFLAGS) -o $(MINIPERL_EXE) \ $(mini_obj) $(libs) - $(LDLIBPTH) $(RUN) ./miniperl$(HOST_EXE_EXT) -w -Ilib -MExporter -e '' || $(MAKE) minitest + $(LDLIBPTH) ./miniperl$(HOST_EXE_EXT) -w -Ilib -Idist/Exporter/lib -MExporter -e '' || sh -c 'echo >&2 Failed to build miniperl. Please run make minitest; exit 1' + $(MINIPERL) -f write_buildcustomize.pl !NO!SUBS! ;; *) - $spitshell >>$Makefile <<'!NO!SUBS!' -$(MINIPERL_EXE): $& $(mini_obj) + if test "X$hostperl" != X; then + $spitshell >>$Makefile <' || $(MAKE) minitest + -@rm \$(MINIPERL_EXE) + \$(LNS) \$(HOST_PERL) \$(MINIPERL_EXE) + \$(LDLIBPTH) ./miniperl\$(HOST_EXE_EXT) -w -Ilib -Idist/Exporter/lib -MExporter -e '' || sh -c 'echo >&2 Failed to build miniperl. Please run make minitest; exit 1' + \$(MINIPERL) -f write_buildcustomize.pl 'osname' "$osname" +!GROK!THIS! + else + $spitshell >>$Makefile <<'!NO!SUBS!' +lib/buildcustomize.pl: $& $(mini_obj) write_buildcustomize.pl + $(MINIPERL) -f write_buildcustomize.pl !NO!SUBS! + fi ;; esac $spitshell >>$Makefile <<'!NO!SUBS!' -$(PERL_EXE): $& perlmain$(OBJ_EXT) $(static_ext) ext.libs $(PERLEXPORT) +$(PERL_EXE): $& perlmain$(OBJ_EXT) $(LIBPERL) $(static_ext) ext.libs $(PERLEXPORT) write_buildcustomize.pl -@rm -f miniperl.xok - $(SHRPENV) $(LDLIBPTH) $(CC) -o perl$(PERL_SUFFIX) $(PERL_PROFILE_LDFLAGS) $(CLDFLAGS) $(CCDLFLAGS) perlmain$(OBJ_EXT) $(static_ext) $(LLIBPERL) `cat ext.libs` $(libs) - -# Purify/Quantify Perls. - -pure$(PERL_EXE): $& perlmain$(OBJ_EXT) $(static_ext) ext.libs $(PERLEXPORT) - $(SHRPENV) $(LDLIBPTH) purify $(CC) -o pureperl $(CLDFLAGS) $(CCDLFLAGS) perlmain$(OBJ_EXT) $(static_ext) $(LLIBPERL) `cat ext.libs` $(libs) - -purecov$(PERL_EXE): $& perlmain$(OBJ_EXT) $(static_ext) ext.libs $(PERLEXPORT) - $(SHRPENV) $(LDLIBPTH) purecov $(CC) -o purecovperl $(CLDFLAGS) $(CCDLFLAGS) perlmain$(OBJ_EXT) $(static_ext) $(LLIBPERL) `cat ext.libs` $(libs) - -quant$(PERL_EXE): $& perlmain$(OBJ_EXT) $(static_ext) ext.libs $(PERLEXPORT) - $(SHRPENV) $(LDLIBPTH) quantify $(CC) -o quantperl $(CLDFLAGS) $(CCDLFLAGS) perlmain$(OBJ_EXT) $(static_ext) $(LLIBPERL) `cat ext.libs` $(libs) - -!NO!SUBS! - -case "${osname}${osvers}" in -linux*|darwin*) - $spitshell >>$Makefile <<'!NO!SUBS!' -# Valgrind perl (currently Linux, Darwin only) - -perl.valgrind.config: config.sh - @echo "To build perl.valgrind you must Configure -Doptimize=-g -Uusemymalloc, checking..." - @$(MAKE) perl.config.dashg - @echo "Checking usemymalloc='n' in config.sh..." - @grep "^usemymalloc=" config.sh - @grep "^usemymalloc='n'" config.sh >/dev/null || exit 1 - @echo "And of course you have to have valgrind..." - $(VALGRIND) $(VG_TEST) || exit 1 -!NO!SUBS! - ;; -esac - -$spitshell >>$Makefile <<'!NO!SUBS!' - -# Third Degree Perl (Tru64 only) - -perl.config.dashg: - @echo "Checking optimize='-g' in config.sh..." - @grep "^optimize=" config.sh - @egrep "^optimize='(.*-g.*)'" config.sh >/dev/null || exit 1 - -perl.third.config: config.sh - @echo "To build perl.third you must Configure -Doptimize=-g -Uusemymalloc, checking..." - @$(MAKE) perl.config.dashg - @echo "Checking usemymalloc='n' in config.sh..." - @grep "^usemymalloc=" config.sh - @grep "^usemymalloc='n'" config.sh >/dev/null || exit 1 - -perl.third: /usr/bin/atom perl.third.config perl - atom -tool third -L. -all -gp -toolargs="-invalid -uninit heap+stack+copy -min 0" perl - @echo "Now you may run perl.third and then study perl.3log." - -# Pixie Perls (Tru64 and IRIX only) - -perl.pixie.config: config.sh - @echo "To build perl.pixie you must Configure -Doptimize=-g, checking..." - @$(MAKE) perl.config.dashg - -perl.pixie.atom: /usr/bin/atom perl - atom -tool pixie -L. -all -toolargs="-quiet" perl - -perl.pixie.irix: perl - pixie perl - -perl.pixie: /usr/bin/pixie perl.pixie.config perl - if test -x /usr/bin/atom; then \ - $(MAKE) perl.pixie.atom; \ - else \ - $(MAKE) perl.pixie.irix; \ - fi - @echo "Now you may run perl.pixie and then run pixie." - -# Gprof Perl - -perl.config.dashpg: - @echo "Checking optimize='-pg' in config.sh..." - @grep "^optimize=" config.sh - @grep "^optimize='.*-pg.*'" config.sh >/dev/null || exit 1 - -perl.gprof.config: config.sh - @echo "To build perl.gprof you must Configure -Doptimize=-pg, checking..." - @$(MAKE) perl.config.dashpg - -perl.gprof: /usr/bin/gprof perl.gprof.config - @-rm -f perl - $(MAKE) PERL_SUFFIX=.gprof PERL_PROFILE_LDFLAGS=-pg perl - @echo "Now you may run perl.gprof and then run gprof perl.gprof." - -# Gcov Perl - -perl.config.gcov: - @echo "To build perl.gcov you must use gcc 3.0 or newer, checking..." - @echo "Checking gccversion in config.sh..." - @grep "^gccversion=" config.sh - @grep "^gccversion='[3-9]\." config.sh >/dev/null || exit 1 - @echo "To build perl.gcov you must Configure -Dccflags=-fprofile-arcs -ftest-coverage, checking..." - @echo "Checking ccflags='-fprofile-arcs -ftest-coverage' in config.sh..." - @grep "^ccflags=" config.sh - @grep "^ccflags='.*-fprofile-arcs -ftest-coverage.*'" config.sh >/dev/null || exit 1 - -perl.gcov: perl.config.gcov - @-rm -f perl - $(MAKE) PERL_SUFFIX=.gcov PERL_PROFILE_LDFLAGS='' perl - @echo "Now you may run perl.gcov and then run gcov some.c." + $(SHRPENV) $(CC) -o perl $(CLDFLAGS) $(CCDLFLAGS) perlmain$(OBJ_EXT) $(static_ext) $(LLIBPERL) `cat ext.libs` $(libs) # Microperl. This is just a convenience thing if one happens to # build also the full Perl and therefore the real big Makefile: @@ -1033,7 +983,7 @@ makeppport: \$(MINIPERL_EXE) \$(CONFIGPM $spitshell >>$Makefile <<'!NO!SUBS!' .PHONY: makeppport makeppport: $(MINIPERL_EXE) $(CONFIGPM) $(nonxs_ext) - $(MINIPERL) $(Icwd) mkppport + $(MINIPERL) mkppport !NO!SUBS! ;; @@ -1049,23 +999,16 @@ $(CONFIGPM_FROM_CONFIG_SH): $(CONFIGPOD) $(CONFIGPOD): config.sh $(MINIPERL_EXE) configpm Porting/Glossary lib/Config_git.pl $(MINIPERL) configpm -lib/ExtUtils/Miniperl.pm: miniperlmain.c $(MINIPERL_EXE) minimod.pl $(CONFIGPM) - $(MINIPERL) minimod.pl > lib/ExtUtils/Miniperl.pm - -lib/buildcustomize.pl: $(MINIPERL_EXE) write_buildcustomize.pl - $(MINIPERL) write_buildcustomize.pl >lib/buildcustomize.pl - unidatafiles $(unidatafiles) pod/perluniprops.pod: uni.data uni.data: $(MINIPERL_EXE) $(CONFIGPM) lib/unicore/mktables $(nonxs_ext) -# $(MINIPERL) $(Icwd) lib/unicore/mktables -C lib/unicore -P pod -maketest -makelist -p touch uni.data -# $(PERL_EXE) and ext because buildtoc uses Text::Wrap uses re +# $(PERL_EXE) and ext because pod_lib.pl needs Digest::MD5 # But also this ensures that all extensions are built before we try to scan # them, which picks up Devel::PPPort's documentation. pod/perltoc.pod: $(perltoc_pod_prereqs) $(PERL_EXE) $(ext) pod/buildtoc - $(RUN_PERL) -f -Ilib pod/buildtoc -q + $(RUN_PERL) -f pod/buildtoc -q pod/perlapi.pod: pod/perlintern.pod @@ -1073,11 +1016,11 @@ pod/perlintern.pod: $(MINIPERL_EXE) auto $(MINIPERL) autodoc.pl pod/perlmodlib.pod: $(MINIPERL_EXE) pod/perlmodlib.PL MANIFEST - $(MINIPERL) $(Icwd) pod/perlmodlib.PL -q + $(MINIPERL) pod/perlmodlib.PL -q -pod/perl5182delta.pod: pod/perldelta.pod - $(RMS) pod/perl5182delta.pod - $(LNS) perldelta.pod pod/perl5182delta.pod +pod/perl5201delta.pod: pod/perldelta.pod + $(RMS) pod/perl5201delta.pod + $(LNS) perldelta.pod pod/perl5201delta.pod extra.pods: $(MINIPERL_EXE) -@test ! -f extra.pods || rm -f `cat extra.pods` @@ -1089,40 +1032,77 @@ extra.pods: $(MINIPERL_EXE) done extras.make: $(PERL_EXE) - -@test ! -s extras.lst || PATH="`pwd`:${PATH}" PERL5LIB="`pwd`/lib" $(RUN_PERL) -Ilib -MCPAN -e '@ARGV&&make(@ARGV)' `cat extras.lst` + -@test ! -s extras.lst || PATH="`pwd`:${PATH}" PERL5LIB="`pwd`/lib" $(RUN_PERL) -MCPAN -e '@ARGV&&make(@ARGV)' `cat extras.lst` extras.test: $(PERL_EXE) - -@test ! -s extras.lst || PATH="`pwd`:${PATH}" PERL5LIB="`pwd`/lib" $(RUN_PERL) -Ilib -MCPAN -e '@ARGV&&test(@ARGV)' `cat extras.lst` + -@test ! -s extras.lst || PATH="`pwd`:${PATH}" PERL5LIB="`pwd`/lib" $(RUN_PERL) -MCPAN -e '@ARGV&&test(@ARGV)' `cat extras.lst` extras.install: $(PERL_EXE) - -@test ! -s extras.lst || PATH="`pwd`:${PATH}" PERL5LIB="`pwd`/lib" $(RUN_PERL) -Ilib -MCPAN -e '@ARGV&&install(@ARGV)' `cat extras.lst` + -@test ! -s extras.lst || PATH="`pwd`:${PATH}" PERL5LIB="`pwd`/lib" $(RUN_PERL) -MCPAN -e '@ARGV&&install(@ARGV)' `cat extras.lst` .PHONY: install install-strip install-all install-verbose install-silent \ no-install install.perl install.man install.html -install_strip install-strip: - $(MAKE) STRIPFLAGS=-s install DESTDIR="$(DESTDIR)" +# Set this to an empty string to avoid an attempt of rebuild before install +INSTALL_DEPENDENCE = all + +no_install no-install: install-notify -install install_all install-all: - $(MAKE) install.perl install.man STRIPFLAGS=$(STRIPFLAGS) DESTDIR="$(DESTDIR)" +install: install-all +!NO!SUBS! -install_verbose install-verbose: - $(MAKE) install.perl install.man STRIPFLAGS=$(STRIPFLAGS) INSTALLFLAGS=-V DESTDIR="$(DESTDIR)" -install_silent install-silent: - $(MAKE) install.perl install.man STRIPFLAGS=$(STRIPFLAGS) INSTALLFLAGS=-S DESTDIR="$(DESTDIR)" +for name in all notify silent strip verbose; do + flags="--$name"; + flags=`echo $flags | sed -e 's/--all//'` + if test "X$hostperl" != X; then + $spitshell >>$Makefile <>$Makefile <>$Makefile +done + +if test "X$hostperl" != X; then + $spitshell >>$Makefile <<'!NO!SUBS!' install.perl: $(INSTALL_DEPENDENCE) installperl - $(RUN_PERL) installperl --destdir=$(DESTDIR) $(INSTALLFLAGS) $(STRIPFLAGS) + $(HOST_PERL) installperl --destdir=$(DESTDIR) $(INSTALLFLAGS) $(STRIPFLAGS) -@test ! -s extras.lst || $(MAKE) extras.install install.man: all installman + $(HOST_PERL) installman --destdir=$(DESTDIR) $(INSTALLFLAGS) + +# XXX Experimental. Hardwired values, but useful for testing. +# Eventually Configure could ask for some of these values. +install.html: all installhtml + -@test -f README.vms && cd vms && $(LNS) ../README.vms README_vms.pod && cd .. + $(HOST_PERL) installhtml \ + --podroot=. --podpath=. --recurse \ + --htmldir=$(privlib)/html \ + --htmlroot=$(privlib)/html \ + --splithead=pod/perlipc \ + --splititem=pod/perlfunc \ + --ignore=Porting/Maintainers.pm,Porting/pumpkin.pod,Porting/repository.pod \ + --verbose +!NO!SUBS! +else + $spitshell >>$Makefile <<'!NO!SUBS!' +install.perl: $(INSTALL_DEPENDENCE) installperl + $(RUN_PERL) installperl --destdir=$(DESTDIR) $(INSTALLFLAGS) $(STRIPFLAGS) + -@test ! -s extras.lst || PATH="`pwd`:\${PATH}" PERL5LIB="`pwd`/lib" \$(RUN_PERL) -Ilib -MCPAN -e '@ARGV&&install(@ARGV)' `cat extras.lst` + +install.man: all installman $(RUN_PERL) installman --destdir=$(DESTDIR) $(INSTALLFLAGS) # XXX Experimental. Hardwired values, but useful for testing. @@ -1137,7 +1117,10 @@ install.html: all installhtml --splititem=pod/perlfunc \ --ignore=Porting/Maintainers.pm,Porting/pumpkin.pod,Porting/repository.pod \ --verbose +!NO!SUBS! +fi +$spitshell >>$Makefile <<'!NO!SUBS!' # I now supply perly.c with the kits, so the following section is # used only if you force bison to run by saying @@ -1198,10 +1181,10 @@ regen_headers regen-headers: FORCE regen_meta regen-meta: META.yml META.json META.yml: FORCE - PATH="`pwd`:${PATH}" PERL5LIB="`pwd`/lib" $(RUN_PERL) -Ilib Porting/makemeta -y + PATH="`pwd`:${PATH}" PERL5LIB="`pwd`/lib" $(RUN_PERL) Porting/makemeta -y META.json: FORCE - PATH="`pwd`:${PATH}" PERL5LIB="`pwd`/lib" $(RUN_PERL) -Ilib Porting/makemeta -j + PATH="`pwd`:${PATH}" PERL5LIB="`pwd`/lib" $(RUN_PERL) Porting/makemeta -j regen_all regen-all: regen regen_meta @@ -1246,7 +1229,7 @@ $spitshell >>$Makefile <<'!NO!SUBS!' .PHONY: printconfig printconfig: - @eval `$(RUN_PERL) -Ilib -V:$(CONFIGVAR)`; echo $$$(CONFIGVAR) + @eval `$(RUN_PERL) -V:$(CONFIGVAR)`; echo $$$(CONFIGVAR) .PHONY: clean _tidy _mopup _cleaner1 _cleaner2 \ realclean _realcleaner clobber _clobber \ @@ -1258,7 +1241,8 @@ realclean: _realcleaner _mopup @echo "Note that '$(MAKE) realclean' does not delete config.sh or Policy.sh" _clobber: - -@rm -f Cross/run-* Cross/to-* Cross/from-* + -@rm -f Cross/run-* Cross/to-* Cross/from-* Cross/mkdir + -rm -rf host rm -f t/test_state rm -f config.sh cppstdin Policy.sh extras.lst @@ -1278,13 +1262,10 @@ _mopup: -@test -f vms/README_vms.pod && rm -f vms/README_vms.pod -rm -f perl.exp ext.libs $(generated_pods) uni.data opmini.o perlmini.o pod/roffitall -rm -f perl.export perl.dll perl.libexp perl.map perl.def - -rm -f perl.loadmap miniperl.loadmap perl.prelmap miniperl.prelmap - -rm -f perl.third lib*.so.perl.third perl.3log t/perl.third t/perl.3log - -rm -f perl.pixie lib*.so.perl.pixie lib*.so.Addrs - -rm -f perl.Addrs perl.Counts t/perl.Addrs t/perl.Counts *perl.xok + -rm -f *perl.xok -rm -f cygwin.c libperl*.def libperl*.dll cygperl*.dll *.exe.stackdump -rm -f $(PERL_EXE) $(MINIPERL_EXE) $(LIBPERL) libperl.* microperl - -rm -f $(DTRACE_H) runtests + -rm -f $(DTRACE_H) # Do not 'make _tidy' directly. _tidy: @@ -1308,7 +1289,7 @@ _cleaner1: sh $(CLEAN).sh ; \ fi rm -f realclean.sh veryclean.sh - -for file in `find cpan dist ext -name ppport.h` ; do rm -f $$file; done + -rm -f `grep -v ^# mkppport.lst | grep . | sed -e 's/$$/\/ppport.h/'` # Dear POSIX, thanks for making the default to xargs to be # run once if nothhing is passed in. It is such a great help. @@ -1319,9 +1300,8 @@ _cleaner2: rm -f core *perl.core t/core t/*perl.core core.* t/core.* rm -f t/$(PERL_EXE) t/rantests rm -rf t/tmp* - rm -f so_locations $(LIBPERL_NONSHR) $(MINIPERL_NONSHR) rm -rf $(addedbyconf) - rm -f $(FIRSTMAKEFILE) $(FIRSTMAKEFILE).old makefile.old + rm -f $(FIRSTMAKEFILE) $(FIRSTMAKEFILE).old makefile.old utils/Makefile rm -f $(private) rm -rf $(unidatafiles) $(unidatadirs) rm -rf lib/auto @@ -1329,46 +1309,45 @@ _cleaner2: rm -f h2ph.man pstruct rm -rf .config rm -f preload - rm -rf lib/Encode lib/Compress lib/Hash lib/re - rm -rf lib/TAP lib/Module/Pluggable lib/App - rm -rf lib/mro - rm -rf lib/IO/Compress lib/IO/Uncompress - rm -f lib/ExtUtils/ParseXS/t/XSTest.c - rm -f lib/ExtUtils/ParseXS/t/XSTest$(OBJ_EXT) - rm -f lib/ExtUtils/ParseXS/t/XSTest$(DLSUFFIX) - rm -fr lib/B - rm -fr lib/CPAN lib/CPANPLUS - rm -fr lib/ExtUtils/CBuilder rm -f pod2htmd.tmp rm -rf pod/perlfunc pod/perlipc - -rmdir cpan/CPANPLUS-Dist-Build/t/dummy-cpanplus cpan/CPANPLUS/t/dummy-cpanplus cpan/CPANPLUS/t/dummy-localmirror -rmdir ext/B/lib - -rmdir lib/Archive/Tar lib/Archive lib/Attribute - -rmdir lib/CGI lib/Carp - -rmdir lib/Data lib/Devel lib/Digest - -rmdir lib/ExtUtils/Command lib/ExtUtils/Constant lib/ExtUtils/Liblist lib/ExtUtils/MakeMaker - -rmdir lib/File/Spec lib/Filter/Util lib/Filter - -rmdir lib/I18N/LangTags lib/IO/Socket lib/IO lib/IPC - -rmdir lib/List/Util lib/List - -rmdir lib/Locale/Maketext lib/Locale - -rmdir lib/Log/Message lib/Log - -rmdir lib/Math/Big* lib/Math - -rmdir lib/Memoize lib/MIME - -rmdir lib/Module/Build/Platform lib/Module/Build lib/Module/Load lib/Module - -rmdir lib/Net/FTP lib/Object - -rmdir lib/Parse/CPAN lib/Parse - -rmdir lib/PerlIO/via lib/PerlIO - -rmdir lib/Package lib/Params - -rmdir lib/Pod/Perldoc lib/Pod/Simple lib/Pod/Text - -rmdir lib/Sys lib/Scalar/Util lib/Scalar - -rmdir lib/Term/UI lib/Thread lib/Tie/Hash - -rmdir lib/Test/Builder/Tester lib/Test/Builder lib/Test - -rmdir lib/Unicode/Collate - -rmdir lib/XS/APItest lib/XS - -rmdir lib/inc/latest lib/inc - -rmdir lib/autodie/exception lib/autodie lib/encoding lib/threads - -rm -f lib/ExtUtils/CBuilder/t/libcompilet.dll.a - -rm -f lib/ExtUtils/ParseXS/t/libXSTest.dll.a + rm -f so_locations $(LIBPERL_NONSHR) $(MINIPERL_NONSHR) + -rmdir lib/version lib/threads lib/inc/latest lib/inc lib/encoding + -rmdir lib/autodie/exception lib/autodie lib/XS lib/Win32API lib/VMS + -rmdir lib/Unicode/Collate/Locale lib/Unicode/Collate/CJK + -rmdir lib/Unicode/Collate lib/Tie/Hash lib/Thread lib/Text + -rmdir lib/Test/Builder/Tester lib/Test/Builder lib/Test lib/Term + -rmdir lib/TAP/Parser/YAMLish lib/TAP/Parser/SourceHandler + -rmdir lib/TAP/Parser/Scheduler lib/TAP/Parser/Result + -rmdir lib/TAP/Parser/Iterator lib/TAP/Parser lib/TAP/Harness + -rmdir lib/TAP/Formatter/File lib/TAP/Formatter/Console + -rmdir lib/TAP/Formatter lib/TAP lib/Sys/Syslog lib/Sys lib/Search + -rmdir lib/Scalar lib/Pod/Text lib/Pod/Simple lib/Pod/Perldoc + -rmdir lib/PerlIO/via lib/PerlIO lib/Perl lib/Parse/CPAN lib/Parse + -rmdir lib/Params lib/Package lib/OpenBSD lib/Net/FTP lib/Module/Load + -rmdir lib/Module/CoreList lib/Module/Build/Platform lib/Module/Build + -rmdir lib/Module lib/Memoize lib/Math/BigInt lib/Math/BigFloat + -rmdir lib/Math lib/MIME lib/Locale/Maketext lib/Locale/Codes + -rmdir lib/Locale lib/List/Util lib/List lib/JSON/PP lib/JSON lib/IPC + -rmdir lib/IO/Uncompress/Adapter lib/IO/Uncompress lib/IO/Socket + -rmdir lib/IO/Compress/Zlib lib/IO/Compress/Zip lib/IO/Compress/Gzip + -rmdir lib/IO/Compress/Base lib/IO/Compress/Adapter lib/IO/Compress + -rmdir lib/IO lib/I18N/LangTags lib/I18N lib/Hash/Util lib/Hash + -rmdir lib/HTTP lib/Filter/Util lib/Filter lib/File/Spec + -rmdir lib/ExtUtils/Typemaps lib/ExtUtils/ParseXS + -rmdir lib/ExtUtils/MakeMaker lib/ExtUtils/Liblist + -rmdir lib/ExtUtils/Constant lib/ExtUtils/Command + -rmdir lib/ExtUtils/CBuilder/Platform/Windows + -rmdir lib/ExtUtils/CBuilder/Platform lib/ExtUtils/CBuilder + -rmdir lib/Exporter lib/Encode/Unicode lib/Encode/MIME/Header + -rmdir lib/Encode/MIME lib/Encode/KR lib/Encode/JP lib/Encode/CN + -rmdir lib/Encode lib/Digest lib/Devel lib/Data lib/Config/Perl + -rmdir lib/Compress/Raw lib/Compress lib/Carp lib/CPAN/Meta + -rmdir lib/CPAN/LWP lib/CPAN/Kwalify lib/CPAN/HTTP lib/CPAN/FTP + -rmdir lib/CPAN/Exception lib/CPAN/API lib/CPAN lib/CGI lib/Attribute + -rmdir lib/Archive/Tar lib/Archive lib/App/Prove/State/Result + -rmdir lib/App/Prove/State lib/App/Prove lib/App _realcleaner: @$(LDLIBPTH) $(MAKE) _cleaner1 CLEAN=distclean @@ -1396,33 +1375,30 @@ MAKEDEPEND = Makefile makedepend $(FIRSTMAKEFILE): README $(MAKEDEPEND) $(MAKE) depend MAKEDEPEND= +!NO!SUBS! -config.h: config_h.SH config.sh - $(SHELL) config_h.SH +for f in $SH; do + file=`SH_to_target $f` + $spitshell >>$Makefile <>$Makefile <<'!NO!SUBS!' -runtests: runtests.SH config.sh - sh ./runtests.SH +.PHONY: depend +depend: makedepend + sh ./makedepend MAKE=$(MAKE) cflags .PHONY: test check test_prep test_prep_nodll test_prep_pre \ test_prep_reonly test_tty test-tty test_notty test-notty \ - utest ucheck test.utf8 check.utf8 test.torture torturetest \ - test.utf16 check.utf16 utest.utf16 ucheck.utf16 \ - test.third check.third utest.third ucheck.third test_notty.third \ - test.deparse test_notty.deparse test_harness test_harness_notty \ - minitest coretest test.taintwarn test-reonly _test + test_harness test_harness_notty minitest test-reonly _test _test: echo >&2 The _test target is deprecated. Please upgrade your smoker - PERL=./perl $(RUN_TESTS) choose + $(RUN_TESTS) choose # Cannot delegate rebuilding of t/perl to make # to allow interlaced test and minitest @@ -1430,48 +1406,104 @@ _test: # Architecture-neutral stuff: test_prep_pre: preplibrary utilities $(nonxs_ext) +!NO!SUBS! +case "$targethost" in +'') $spitshell >>$Makefile <<'!NO!SUBS!' test_prep test-prep: test_prep_pre $(MINIPERL_EXE) $(unidatafiles) $(PERL_EXE) \ $(dynamic_ext) $(TEST_PERL_DLL) runtests x2p/s2p x2p/find2perl \ $(generated_pods) cd t && (rm -f $(PERL_EXE); $(LNS) ../$(PERL_EXE) $(PERL_EXE)) +!NO!SUBS! +;; +*) $spitshell >>$Makefile <>$Makefile <<'!NO!SUBS!' test_prep_reonly: $(MINIPERL_EXE) $(PERL_EXE) $(dynamic_ext_re) $(TEST_PERL_DLL) $(MINIPERL) make_ext.pl $(dynamic_ext_re) MAKE=$(MAKE) LIBPERL_A=$(LIBPERL) LINKTYPE=dynamic cd t && (rm -f $(PERL_EXE); $(LNS) ../$(PERL_EXE) $(PERL_EXE)) +!NO!SUBS! + +case "$targethost" in +'') $spitshell >>$Makefile <<'!NO!SUBS!' test check: test_prep $(RUN_TESTS) choose +!NO!SUBS! +;; +*) $spitshell >>$Makefile <>$Makefile <<'!NO!SUBS!' test_tty test-tty: test_prep $(RUN_TESTS) tty test_notty test-notty: test_prep $(RUN_TESTS) no-tty -utest ucheck test.utf8 check.utf8: test_prep - TEST_ARGS=-utf8 $(RUN_TESTS) choose - -coretest: test_prep - TEST_ARGS=-core $(RUN_TESTS) choose - -# Torture testing - -test.torture torturetest: test_prep - TEST_ARGS=-torture $(RUN_TESTS) choose - -# Targets for UTF16 testing: - -minitest.utf16: minitest.prep - - cd t && (rm -f $(PERL_EXE); $(LNS) ../$(MINIPERL_EXE) $(PERL_EXE)) \ - && $(RUN_PERL) TEST -utf16 base/*.t comp/*.t cmd/*.t run/*.t io/*.t opbasic/*.t op/*.t uni/*.t >$Makefile <<'!NO!SUBS!' # Targets for valgrind testing: -test_prep.valgrind: test_prep perl.valgrind - -test.valgrind check.valgrind: test_prep perl.valgrind.config +test.valgrind check.valgrind: test_prep + @echo "Checking usemymalloc='n' in config.sh..." + @grep "^usemymalloc=" config.sh + @grep "^usemymalloc='n'" config.sh >/dev/null || exit 1 + @echo "And of course you have to have valgrind..." + $(VALGRIND) $(VG_TEST) || exit 1 PERL_VALGRIND=1 VALGRIND='$(VALGRIND)' $(RUN_TESTS) choose - -utest.valgrind ucheck.valgrind: test_prep.valgrind perl.valgrind.config - PERL_VALGRIND=1 TEST_ARGS=-utf8 $(RUN_TESTS) choose - -test_notty.valgrind: test_prep.valgrind perl.valgrind.config - PERL_VALGRIND=1 $(RUN_TESTS) no-tty !NO!SUBS! ;; esac $spitshell >>$Makefile <<'!NO!SUBS!' -# Targets for Third Degree testing. - -test_prep.third: test_prep perl.third - cd t && (rm -f ./perl.third$(EXE_EXT); $(LNS) ../perl.third$(EXE_EXT) perl.third(EXE_EXT)) - -test.third check.third: test_prep.third perl.third - PERL=./perl.third PERL_3LOG=1 $(RUN_TESTS) choose - -utest.third ucheck.third: test_prep.third perl.third - PERL=./perl.third PERL_3LOG=1 TEST_ARGS=-utf8 $(RUN_TESTS) choose - -test_notty.third: test_prep.third perl.third - PERL=./perl.third PERL_3LOG=1 $(RUN_TESTS) choose - -# Targets for Deparse testing. - -test.deparse: test_prep - TEST_ARGS=-deparse $(RUN_TESTS) choose - -test_notty.deparse: test_prep - TEST_ARGS=-deparse $(RUN_TESTS) no-tty - -# Targets to run the test suite with -t - -test.taintwarn: test_prep - TEST_ARGS=-taintwarn $(RUN_TESTS) choose - -minitest.prep: +# Can't depend on lib/Config.pm because that might be where miniperl +# is crashing. +minitest: $(MINIPERL_EXE) -@test -f lib/Config.pm || $(MAKE) lib/Config.pm $(unidatafiles) @echo " " @echo "You may see some irrelevant test failures if you have been unable" @echo "to build lib/Config.pm, or the Unicode data files." @echo " " - -# Can't depend on lib/Config.pm because that might be where miniperl -# is crashing. -minitest: $(MINIPERL_EXE) minitest.prep - cd t && (rm -f $(PERL_EXE); $(LNS) ../$(MINIPERL_EXE) $(PERL_EXE)) \ && $(RUN_PERL) TEST base/*.t comp/*.t cmd/*.t run/*.t io/*.t re/*.t opbasic/*.t op/*.t uni/*.t .clist @@ -1591,12 +1591,6 @@ clist: $(c) hlist: $(h) echo $(h) | tr ' ' $(TRNL) >.hlist -shlist: $(sh) - echo $(sh) | tr ' ' $(TRNL) >.shlist - -Makefile: Makefile.SH ./config.sh - $(SHELL) Makefile.SH - .PHONY: distcheck distcheck: FORCE perl '-MExtUtils::Manifest=&fullcheck' -e 'fullcheck()' @@ -1611,12 +1605,6 @@ ctags: !NO!SUBS! $eunicefix Makefile -case `pwd` in -*SH) - $rm -f ../Makefile - $ln Makefile ../Makefile - ;; -esac $rm -f $firstmakefile # Now do any special processing required before building. Index: gnu/usr.bin/perl/Makefile.bsd-wrapper =================================================================== RCS file: /mnt/memory/perl/importit/cvs/src/gnu/usr.bin/perl/Makefile.bsd-wrapper,v retrieving revision 1.95 diff -u -p -u -p -r1.95 Makefile.bsd-wrapper --- gnu/usr.bin/perl/Makefile.bsd-wrapper 29 May 2014 05:43:06 -0000 1.95 +++ gnu/usr.bin/perl/Makefile.bsd-wrapper 16 Nov 2014 03:22:23 -0000 @@ -1,6 +1,6 @@ -# $OpenBSD: Makefile.bsd-wrapper,v 1.95 2014/05/29 05:43:06 guenther Exp $ +# $OpenBSD: Makefile.bsd-wrapper,v 1.93 2013/08/13 05:52:09 guenther Exp $ # -# Build wrapper for Perl 5.16.2 +# Build wrapper for Perl 5.20.1-RC2 # # For ``NOMAN'' @@ -52,7 +52,7 @@ STRIPFLAGS='-s' GEN_AFTER= bitcount.h config.h mg_data.h uudmap.h cflags makedepend \ myconfig Makefile Policy.sh pod/Makefile \ - x2p/Makefile x2p/cflags + x2p/Makefile GENERATED= config.sh ${GEN_AFTER} @@ -68,7 +68,7 @@ man.build: perl.build beforedepend: config.sh config.h bitcount.h mg_data.h uudmap.h Makefile makedepend x2p/Makefile cd ${.OBJDIR} && exec ${MAKE} depend -perl.build: perl.lib +perl.build: perl.lib DynaLoader.c cd ${.OBJDIR} && exec ${MAKE} config.sh: ${.CURDIR}/config.over @@ -91,7 +91,7 @@ bitcount.h: generate_uudmap ./generate_uudmap uudmap.h bitcount.h mg_data.h generate_uudmap: generate_uudmap.o - ${CC} -o generate_uudmap generate_uudmap.o + ${CC} ${CPPFLAGS} ${CFLAGS} -o generate_uudmap generate_uudmap.o pod/Makefile: cd ${.OBJDIR}/pod && exec /bin/sh Makefile.SH @@ -99,9 +99,6 @@ pod/Makefile: x2p/Makefile: cd ${.OBJDIR}/x2p && exec /bin/sh Makefile.SH -x2p/cflags: - cd ${.OBJDIR}/x2p && exec /bin/sh cflags.SH - # Never try to regenerate perly.c or perly.h perly.c perly.h: perly.y -@true @@ -118,7 +115,7 @@ install: install.lib install.perl manins install.perl: cd ${.OBJDIR}; INSTALL=${INSTALL} INSTALL_COPY=${INSTALL_COPY} \ STRIPFLAGS=${STRIPFLAGS} INSTALLFLAGS=-o NOLIBINSTALL=1 \ - LD_LIBRARY_PATH=${.OBJDIR} exec ./perl installperl --destdir=${DESTDIR} -o STRIPFLAGS=${STRIPFLAGS} + LD_LIBRARY_PATH=${.OBJDIR} exec ./perl installperl --destdir=${DESTDIR} -o ${STRIPFLAGS} test: -@if [ -e Makefile ]; then ${MAKE} test; fi @@ -160,8 +157,8 @@ CFLAGS+= -fno-tree-ter .endif # The DynaLoader extension is now compiled statically into libperl -miniperl: ${GENERATED} ${SRCS1:S/.c/.o/g} opmini.o miniperl.o miniperlmain.o - ${CC} -o miniperl ${SRCS1:S/.c/.o/g} opmini.o miniperl.o miniperlmain.o ${LDFLAGS} -lm -lpthread +miniperl: ${GENERATED} ${SRCS1:S/.c/.o/g} caretx.o opmini.o perlmini.o miniperlmain.o + ${CC} ${CPPFLAGS} ${CFLAGS} -o $@ ${SRCS1:S/.c/.o/g} caretx.o opmini.o perlmini.o miniperlmain.o ${LDFLAGS} -lm -lutil opmini.c: op.c rm -f opmini.c @@ -170,8 +167,11 @@ opmini.c: op.c opmini.o: opmini.c ${CC} ${CPPFLAGS} ${CFLAGS} -DPERL_EXTERNAL_GLOB -c $> -o $@ -miniperl.o: perl.c - ${CC} ${CPPFLAGS} ${CFLAGS} -DPERL_EXTERNAL_GLOB -DPERL_IS_MINIPERL -c $> -o $@ +caretx.o: caretx.c + ${CC} ${CPPFLAGS} ${CFLAGS} -DPERL_EXTERNAL_GLOB -c $> -o $@ + +perlmini.o: perlmini.c + ${CC} ${CPPFLAGS} ${CFLAGS} -DPERL_EXTERNAL_GLOB -DPERL_IS_MINIPERL -c $> -o $@ lib/Config.pm: miniperl config.sh cd ${.OBJDIR} && exec ${MAKE} preplibrary Index: gnu/usr.bin/perl/Makefile.bsd-wrapper1 =================================================================== RCS file: /mnt/memory/perl/importit/cvs/src/gnu/usr.bin/perl/Makefile.bsd-wrapper1,v retrieving revision 1.21 diff -u -p -u -p -r1.21 Makefile.bsd-wrapper1 --- gnu/usr.bin/perl/Makefile.bsd-wrapper1 3 Apr 2014 18:27:25 -0000 1.21 +++ gnu/usr.bin/perl/Makefile.bsd-wrapper1 16 Nov 2014 03:22:23 -0000 @@ -38,8 +38,6 @@ _quick3p= config_data 1 utils/config_data \ corelist 1 utils/corelist \ cpan 1 utils/cpan \ - cpan2dist 1 utils/cpan2dist \ - cpanp 1 utils/cpanp \ enc2xs 1 utils/enc2xs \ find2perl 1 x2p/find2perl \ function 1 cpan/Pod-Perldoc/corpus/perlfunc.pod \ @@ -71,6 +69,8 @@ _quick3p= perl5180delta 1 pod/perl5180delta.pod \ perl5181delta 1 pod/perl5181delta.pod \ perl5182delta 1 pod/perl5182delta.pod \ + perl5200delta 1 pod/perl5200delta.pod \ + perl5201delta 1 pod/perl5201delta.pod \ perl561delta 1 pod/perl561delta.pod \ perl56delta 1 pod/perl56delta.pod \ perl581delta 1 pod/perl581delta.pod \ @@ -84,6 +84,7 @@ _quick3p= perl589delta 1 pod/perl589delta.pod \ perl58delta 1 pod/perl58delta.pod \ perl5db 1 lib/perl5db.pl \ + perlandroid 1 pod/perlandroid.pod \ perlapi 1 pod/perlapi.pod \ perlapio 1 pod/perlapio.pod \ perlartistic 1 pod/perlartistic.pod \ @@ -175,6 +176,7 @@ _quick3p= perlstyle 1 pod/perlstyle.pod \ perlsub 1 pod/perlsub.pod \ perlsyn 1 pod/perlsyn.pod \ + perlsynology 1 pod/perlsynology.pod \ perlthrtut 1 pod/perlthrtut.pod \ perltie 1 pod/perltie.pod \ perltoc 1 pod/perltoc.pod \ @@ -196,7 +198,6 @@ _quick3p= piconv 1 utils/piconv \ pl2pm 1 utils/pl2pm \ pod2html 1 utils/pod2html \ - pod2latex 1 cpan/Pod-LaTeX/blib/script/pod2latex \ pod2man 1 cpan/podlators/blib/script/pod2man \ pod2text 1 cpan/podlators/blib/script/pod2text \ pod2usage 1 cpan/Pod-Usage/blib/script/pod2usage \ @@ -206,6 +207,7 @@ _quick3p= prove 1 utils/prove \ psed 1 x2p/psed \ splain 1 utils/splain \ + Test::Harness::Beyond 1 lib/TAP/Harness/Beyond.pod \ xsubpp 1 utils/xsubpp \ AnyDBM_File 3p lib/AnyDBM_File.pm \ App::Cpan 3p lib/App/Cpan.pm \ @@ -213,7 +215,6 @@ _quick3p= App::Prove::State 3p lib/App/Prove/State.pm \ App::Prove::State::Result 3p lib/App/Prove/State/Result.pm \ App::Prove::State::Result::Test 3p lib/App/Prove/State/Result/Test.pm \ - Archive::Extract 3p lib/Archive/Extract.pm \ Archive::Tar 3p lib/Archive/Tar.pm \ Archive::Tar::File 3p lib/Archive/Tar/File.pm \ arybase 3p lib/arybase.pm \ @@ -223,6 +224,7 @@ _quick3p= autodie::exception 3p lib/autodie/exception.pm \ autodie::exception::system 3p lib/autodie/exception/system.pm \ autodie::hints 3p lib/autodie/hints.pm \ + autodie::skip 3p lib/autodie/skip.pm \ AutoLoader 3p lib/AutoLoader.pm \ AutoSplit 3p lib/AutoSplit.pm \ autouse 3p lib/autouse.pm \ @@ -230,8 +232,6 @@ _quick3p= B::Concise 3p lib/B/Concise.pm \ B::Debug 3p lib/B/Debug.pm \ B::Deparse 3p lib/B/Deparse.pm \ - B::Lint 3p lib/B/Lint.pm \ - B::Lint::Debug 3p lib/B/Lint/Debug.pm \ B::Showlex 3p lib/B/Showlex.pm \ B::Terse 3p lib/B/Terse.pm \ B::Xref 3p lib/B/Xref.pm \ @@ -284,44 +284,6 @@ _quick3p= CPAN::Queue 3p lib/CPAN/Queue.pm \ CPAN::Tarzip 3p lib/CPAN/Tarzip.pm \ CPAN::Version 3p lib/CPAN/Version.pm \ - CPANPLUS 3p lib/CPANPLUS.pm \ - CPANPLUS::Backend 3p lib/CPANPLUS/Backend.pm \ - CPANPLUS::Backend::RV 3p lib/CPANPLUS/Backend/RV.pm \ - CPANPLUS::Config 3p lib/CPANPLUS/Config.pm \ - CPANPLUS::Config::HomeEnv 3p lib/CPANPLUS/Config/HomeEnv.pm \ - CPANPLUS::Configure 3p lib/CPANPLUS/Configure.pm \ - CPANPLUS::Dist 3p lib/CPANPLUS/Dist.pm \ - CPANPLUS::Dist::Autobundle 3p lib/CPANPLUS/Dist/Autobundle.pm \ - CPANPLUS::Dist::Base 3p lib/CPANPLUS/Dist/Base.pm \ - CPANPLUS::Dist::Build 3p lib/CPANPLUS/Dist/Build.pm \ - CPANPLUS::Dist::Build::Constants 3p lib/CPANPLUS/Dist/Build/Constants.pm \ - CPANPLUS::Dist::MM 3p lib/CPANPLUS/Dist/MM.pm \ - CPANPLUS::Dist::Sample 3p lib/CPANPLUS/Dist/Sample.pm \ - CPANPLUS::Error 3p lib/CPANPLUS/Error.pm \ - CPANPLUS::FAQ 3p lib/CPANPLUS/FAQ.pod \ - CPANPLUS::Hacking 3p lib/CPANPLUS/Hacking.pod \ - CPANPLUS::Internals 3p lib/CPANPLUS/Internals.pm \ - CPANPLUS::Internals::Extract 3p lib/CPANPLUS/Internals/Extract.pm \ - CPANPLUS::Internals::Fetch 3p lib/CPANPLUS/Internals/Fetch.pm \ - CPANPLUS::Internals::Report 3p lib/CPANPLUS/Internals/Report.pm \ - CPANPLUS::Internals::Search 3p lib/CPANPLUS/Internals/Search.pm \ - CPANPLUS::Internals::Source 3p lib/CPANPLUS/Internals/Source.pm \ - CPANPLUS::Internals::Source::Memory 3p lib/CPANPLUS/Internals/Source/Memory.pm \ - CPANPLUS::Internals::Source::SQLite 3p lib/CPANPLUS/Internals/Source/SQLite.pm \ - CPANPLUS::Internals::Utils 3p lib/CPANPLUS/Internals/Utils.pm \ - CPANPLUS::Module 3p lib/CPANPLUS/Module.pm \ - CPANPLUS::Module::Author 3p lib/CPANPLUS/Module/Author.pm \ - CPANPLUS::Module::Author::Fake 3p lib/CPANPLUS/Module/Author/Fake.pm \ - CPANPLUS::Module::Checksums 3p lib/CPANPLUS/Module/Checksums.pm \ - CPANPLUS::Module::Fake 3p lib/CPANPLUS/Module/Fake.pm \ - CPANPLUS::Selfupdate 3p lib/CPANPLUS/Selfupdate.pm \ - CPANPLUS::Shell 3p lib/CPANPLUS/Shell.pm \ - CPANPLUS::Shell::Classic 3p lib/CPANPLUS/Shell/Classic.pm \ - CPANPLUS::Shell::Default 3p lib/CPANPLUS/Shell/Default.pm \ - CPANPLUS::Shell::Default::Plugins::CustomSource 3p lib/CPANPLUS/Shell/Default/Plugins/CustomSource.pm \ - CPANPLUS::Shell::Default::Plugins::HOWTO 3p lib/CPANPLUS/Shell/Default/Plugins/HOWTO.pod \ - CPANPLUS::Shell::Default::Plugins::Remote 3p lib/CPANPLUS/Shell/Default/Plugins/Remote.pm \ - CPANPLUS::Shell::Default::Plugins::Source 3p lib/CPANPLUS/Shell/Default/Plugins/Source.pm \ Cwd 3p lib/Cwd.pm \ Data::Dumper 3p lib/Data/Dumper.pm \ DB 3p lib/DB.pm \ @@ -333,7 +295,6 @@ _quick3p= DBM_Filter::null 3p lib/DBM_Filter/null.pm \ DBM_Filter::utf8 3p lib/DBM_Filter/utf8.pm \ deprecate 3p lib/deprecate.pm \ - Devel::InnerPackage 3p lib/Devel/InnerPackage.pm \ Devel::Peek 3p lib/Devel/Peek.pm \ Devel::PPPort 3p lib/Devel/PPPort.pm \ Devel::SelfStubber 3p lib/Devel/SelfStubber.pm \ @@ -377,6 +338,7 @@ _quick3p= English 3p lib/English.pm \ Env 3p lib/Env.pm \ Errno 3p lib/Errno.pm \ + experimental 3p lib/experimental.pm \ Exporter 3p lib/Exporter.pm \ Exporter::Heavy 3p lib/Exporter/Heavy.pm \ ExtUtils::CBuilder 3p lib/ExtUtils/CBuilder.pm \ @@ -420,6 +382,7 @@ _quick3p= ExtUtils::Packlist 3p lib/ExtUtils/Packlist.pm \ ExtUtils::ParseXS 3p lib/ExtUtils/ParseXS.pod \ ExtUtils::ParseXS::Constants 3p lib/ExtUtils/ParseXS/Constants.pm \ + ExtUtils::ParseXS::Eval 3p lib/ExtUtils/ParseXS/Eval.pm \ ExtUtils::ParseXS::Utilities 3p lib/ExtUtils/ParseXS/Utilities.pm \ ExtUtils::testlib 3p lib/ExtUtils/testlib.pm \ ExtUtils::Typemaps 3p lib/ExtUtils/Typemaps.pm \ @@ -433,7 +396,6 @@ _quick3p= feature 3p lib/feature.pm \ fields 3p lib/fields.pm \ File::Basename 3p lib/File/Basename.pm \ - File::CheckTree 3p lib/File/CheckTree.pm \ File::Compare 3p lib/File/Compare.pm \ File::Copy 3p lib/File/Copy.pm \ File::DosGlob 3p lib/File/DosGlob.pm \ @@ -490,6 +452,7 @@ _quick3p= IO::Select 3p lib/IO/Select.pm \ IO::Socket 3p lib/IO/Socket.pm \ IO::Socket::INET 3p lib/IO/Socket/INET.pm \ + IO::Socket::IP 3p lib/IO/Socket/IP.pm \ IO::Socket::UNIX 3p lib/IO/Socket/UNIX.pm \ IO::Uncompress::AnyInflate 3p lib/IO/Uncompress/AnyInflate.pm \ IO::Uncompress::AnyUncompress 3p lib/IO/Uncompress/AnyUncompress.pm \ @@ -519,26 +482,13 @@ _quick3p= Locale::Codes::Changes 3p lib/Locale/Codes/Changes.pod \ Locale::Codes::Constants 3p lib/Locale/Codes/Constants.pod \ Locale::Codes::Country 3p lib/Locale/Codes/Country.pod \ - Locale::Codes::Country_Codes 3p lib/Locale/Codes/Country_Codes.pm \ - Locale::Codes::Country_Retired 3p lib/Locale/Codes/Country_Retired.pm \ Locale::Codes::Currency 3p lib/Locale/Codes/Currency.pod \ - Locale::Codes::Currency_Codes 3p lib/Locale/Codes/Currency_Codes.pm \ - Locale::Codes::Currency_Retired 3p lib/Locale/Codes/Currency_Retired.pm \ Locale::Codes::LangExt 3p lib/Locale/Codes/LangExt.pod \ - Locale::Codes::LangExt_Codes 3p lib/Locale/Codes/LangExt_Codes.pm \ - Locale::Codes::LangExt_Retired 3p lib/Locale/Codes/LangExt_Retired.pm \ Locale::Codes::LangFam 3p lib/Locale/Codes/LangFam.pod \ - Locale::Codes::LangFam_Codes 3p lib/Locale/Codes/LangFam_Codes.pm \ Locale::Codes::LangFam_Retired 3p lib/Locale/Codes/LangFam_Retired.pm \ Locale::Codes::Language 3p lib/Locale/Codes/Language.pod \ - Locale::Codes::Language_Codes 3p lib/Locale/Codes/Language_Codes.pm \ - Locale::Codes::Language_Retired 3p lib/Locale/Codes/Language_Retired.pm \ Locale::Codes::LangVar 3p lib/Locale/Codes/LangVar.pod \ - Locale::Codes::LangVar_Codes 3p lib/Locale/Codes/LangVar_Codes.pm \ - Locale::Codes::LangVar_Retired 3p lib/Locale/Codes/LangVar_Retired.pm \ Locale::Codes::Script 3p lib/Locale/Codes/Script.pod \ - Locale::Codes::Script_Codes 3p lib/Locale/Codes/Script_Codes.pm \ - Locale::Codes::Script_Retired 3p lib/Locale/Codes/Script_Retired.pm \ Locale::Country 3p lib/Locale/Country.pod \ Locale::Currency 3p lib/Locale/Currency.pod \ Locale::Language 3p lib/Locale/Language.pod \ @@ -549,11 +499,6 @@ _quick3p= Locale::Maketext::Simple 3p lib/Locale/Maketext/Simple.pm \ Locale::Maketext::TPJ13 3p lib/Locale/Maketext/TPJ13.pod \ Locale::Script 3p lib/Locale/Script.pod \ - Log::Message 3p lib/Log/Message.pm \ - Log::Message::Config 3p lib/Log/Message/Config.pm \ - Log::Message::Handlers 3p lib/Log/Message/Handlers.pm \ - Log::Message::Item 3p lib/Log/Message/Item.pm \ - Log::Message::Simple 3p lib/Log/Message/Simple.pm \ Math::BigFloat 3p lib/Math/BigFloat.pm \ Math::BigInt 3p lib/Math/BigInt.pm \ Math::BigInt::Calc 3p lib/Math/BigInt/Calc.pm \ @@ -593,8 +538,6 @@ _quick3p= Module::Load::Conditional 3p lib/Module/Load/Conditional.pm \ Module::Loaded 3p lib/Module/Loaded.pm \ Module::Metadata 3p lib/Module/Metadata.pm \ - Module::Pluggable 3p lib/Module/Pluggable.pm \ - Module::Pluggable::Object 3p lib/Module/Pluggable/Object.pm \ mro 3p lib/mro.pm \ NDBM_File 3p lib/NDBM_File.pm \ Net::Cmd 3p lib/Net/Cmd.pm \ @@ -613,7 +556,6 @@ _quick3p= Net::Time 3p lib/Net/Time.pm \ NEXT 3p lib/NEXT.pm \ O 3p lib/O.pm \ - Object::Accessor 3p lib/Object/Accessor.pm \ ODBM_File 3p lib/ODBM_File.pm \ Opcode 3p lib/Opcode.pm \ open 3p lib/open.pm \ @@ -638,7 +580,6 @@ _quick3p= Pod::Functions 3p lib/Pod/Functions.pm \ Pod::Html 3p lib/Pod/Html.pm \ Pod::InputObjects 3p lib/Pod/InputObjects.pm \ - Pod::LaTeX 3p lib/Pod/LaTeX.pm \ Pod::Man 3p lib/Pod/Man.pm \ Pod::ParseLink 3p lib/Pod/ParseLink.pm \ Pod::Parser 3p lib/Pod/Parser.pm \ @@ -711,6 +652,7 @@ _quick3p= TAP::Formatter::File::Session 3p lib/TAP/Formatter/File/Session.pm \ TAP::Formatter::Session 3p lib/TAP/Formatter/Session.pm \ TAP::Harness 3p lib/TAP/Harness.pm \ + TAP::Harness::Env 3p lib/TAP/Harness/Env.pm \ TAP::Object 3p lib/TAP/Object.pm \ TAP::Parser 3p lib/TAP/Parser.pm \ TAP::Parser::Aggregator 3p lib/TAP/Parser/Aggregator.pm \ @@ -741,15 +683,12 @@ _quick3p= TAP::Parser::SourceHandler::Handle 3p lib/TAP/Parser/SourceHandler/Handle.pm \ TAP::Parser::SourceHandler::Perl 3p lib/TAP/Parser/SourceHandler/Perl.pm \ TAP::Parser::SourceHandler::RawTAP 3p lib/TAP/Parser/SourceHandler/RawTAP.pm \ - TAP::Parser::Utils 3p lib/TAP/Parser/Utils.pm \ TAP::Parser::YAMLish::Reader 3p lib/TAP/Parser/YAMLish/Reader.pm \ TAP::Parser::YAMLish::Writer 3p lib/TAP/Parser/YAMLish/Writer.pm \ Term::ANSIColor 3p lib/Term/ANSIColor.pm \ Term::Cap 3p lib/Term/Cap.pm \ Term::Complete 3p lib/Term/Complete.pm \ Term::ReadLine 3p lib/Term/ReadLine.pm \ - Term::UI 3p lib/Term/UI.pm \ - Term::UI::History 3p lib/Term/UI/History.pm \ Test 3p lib/Test.pm \ Test::Builder 3p lib/Test/Builder.pm \ Test::Builder::Module 3p lib/Test/Builder/Module.pm \ @@ -762,7 +701,6 @@ _quick3p= Text::Abbrev 3p lib/Text/Abbrev.pm \ Text::Balanced 3p lib/Text/Balanced.pm \ Text::ParseWords 3p lib/Text/ParseWords.pm \ - Text::Soundex 3p lib/Text/Soundex.pm \ Text::Tabs 3p lib/Text/Tabs.pm \ Text::Wrap 3p lib/Text/Wrap.pm \ Thread 3p lib/Thread.pm \ Index: gnu/usr.bin/perl/README =================================================================== RCS file: /mnt/memory/perl/importit/cvs/src/gnu/usr.bin/perl/README,v retrieving revision 1.14 diff -u -p -u -p -r1.14 README --- gnu/usr.bin/perl/README 24 Mar 2014 15:05:12 -0000 1.14 +++ gnu/usr.bin/perl/README 16 Nov 2014 03:22:23 -0000 @@ -1,6 +1,6 @@ Perl is Copyright (C) 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, -2013 by Larry Wall and others. All rights reserved. +2013, 2014 by Larry Wall and others. All rights reserved. Index: gnu/usr.bin/perl/README.android =================================================================== RCS file: gnu/usr.bin/perl/README.android diff -N gnu/usr.bin/perl/README.android --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ gnu/usr.bin/perl/README.android 16 Nov 2014 03:22:23 -0000 @@ -0,0 +1,201 @@ +If you read this file _as_is_, just ignore the funny characters you +see. It is written in the POD format (see pod/perlpod.pod) which is +specially designed to be readable as is. + +=head1 NAME + +perlandroid - Perl under Android + +=head1 SYNOPSIS + +The first portions of this documents contains instructions +to cross-compile Perl for Android 2.0 and later, using the +binaries provided by Google. The latter portion describes how to build +perl native using one of the toolchains available on the Play Store. + +=head1 DESCRIPTION + +This document describes how to set up your host environment when +attempting to build Perl for Android. + +=head1 Cross-compilation + +These instructions assume an Unixish build environment on your host system; +they've been tested on Linux and OS X, and may work on Cygwin and MSYS. +While Google also provides an NDK for Windows, these steps won't work +native there, although it may be possible to cross-compile through different +means. + +If your host system's architecture is 32 bits, remember to change the +C's below to C's. On a similar vein, the examples below +use the 4.8 toolchain; if you want to use something older or newer (for +example, the 4.4.3 toolchain included in the 8th revision of the NDK), just +change those to the relevant version. + +=head2 Get the Android Native Development Kit (NDK) + +You can download the NDK from L. +You'll want the normal, non-legacy version. + +=head2 Determine the architecture you'll be cross-compiling for + +There's three possible options: arm-linux-androideabi for ARM, +mipsel-linux-android for MIPS, and simply x86 for x86. +As of 2014, most Android devices run on ARM, so that is generally a safe bet. + +With those two in hand, you should add + +$ANDROID_NDK/toolchains/$TARGETARCH-4.8/prebuilt/`uname | tr '[A-Z]' '[a-z]'`-x86_64/bin + +to your PATH, where $ANDROID_NDK is the location where you unpacked the +NDK, and $TARGETARCH is your target's architecture. + +=head2 Set up a standalone toolchain + +This creates a working sysroot that we can feed to Configure later. + + $ export ANDROID_TOOLCHAIN=/tmp/my-toolchain-$TARGETARCH + $ export SYSROOT=$ANDROID_TOOLCHAIN/sysroot + $ $ANDROID_NDK/build/tools/make-standalone-toolchain.sh \ + --platform=android-9 \ + --install-dir=$ANDROID_TOOLCHAIN \ + --system=`uname | tr '[A-Z]' '[a-z]'`-x86_64 \ + --toolchain=$TARGETARCH-4.8 + +=head2 adb or ssh? + +adb is the Android Debug Bridge. For our purposes, it's basically a way +of establishing an ssh connection to an Android device without having to +install anything on the device itself, as long as the device is either on +the same local network as the host, or it is connected to the host through +USB. +Perl can be cross-compiled using either adb or a normal ssh connection; +in general, if you can connect your device to the host using a USB port, +or if you don't feel like installing an sshd app on your device, +you may want to use adb, although you may be forced to switch to ssh if +your device is not rooted and you're unlucky -- more on that later. +Alternatively, if you're cross-compiling to an emulator, you'll have to +use adb. + +=head3 adb + +To use adb, download the Android SDK from L. +The "SDK Tools Only" version should suffice -- if you downloaded the ADT +Bundle, you can find the sdk under $ADT_BUNDLE/sdk/. + +Add $ANDROID_SDK/platform-tools to your PATH, which should give you access +to adb. You'll now have to find your device's name using 'adb devices', +and later pass that to Configure through '-Dtargethost=$DEVICE'. + +However, before calling Configure, you need to check if using adb is a +viable choice in the first place. Because Android doesn't have a /tmp, +nor does it allow executables in the sdcard, we need to find somewhere in +the device for Configure to put some files in, as well as for the tests +to run in. If your device is rooted, then you're good. Try running these: + + $ export TARGETDIR=/mnt/asec/perl + $ adb -s $DEVICE shell "echo sh -c '\"mkdir $TARGETDIR\"' | su --" + +Which will create the directory we need, and you can move on to the next +step. /mnt/asec is mounted as a tmpfs in Android, but it's only +accessible to root. + +If your device is not rooted, you may still be in luck. Try running this: + + $ export TARGETDIR=/data/local/tmp/perl + $ adb -s $DEVICE shell "mkdir $TARGETDIR" + +If the command works, you can move to the next step, but beware: +B. + +If neither of those work, then you can't use adb to cross-compile to your +device. Either try rooting it, or go for the ssh route. + +=head3 ssh + +To use ssh, you'll need to install and run a sshd app and set it up +properly. There are several paid and free apps that do this rather +easily, so you should be able to spot one on the store. +Remember that Perl requires a passwordless connection, so set up a +public key. + +Note that several apps spew crap to stderr every time you +connect, which can throw off Configure. You may need to monkeypatch +the part of Configure that creates 'run-ssh' to have it discard stderr. + +Since you're using ssh, you'll have to pass some extra arguments to +Configure: -Dtargetrun=ssh -Dtargethost=$TARGETHOST -Dtargetuser=$TARGETUSER -Dtargetport=$TARGETPORT + +=head2 Configure and beyond + +With all of the previous done, you're now ready to call Configure. + +If using adb, a "basic" Configure line will look like this: + +$ ./Configure -des -Dusedevel -Dusecrosscompile -Dtargetrun=adb \ + -Dcc=$TARGETARCH-gcc \ + -Dsysroot=$SYSROOT \ + -Dtargetdir=$TARGETDIR \ + -Dtargethost=$DEVICE + +If using ssh, it's not too different -- we just change targetrun to ssh, +and pass in targetuser and targetport. It ends up looking like this: + +$ ./Configure -des -Dusedevel -Dusecrosscompile -Dtargetrun=ssh \ + -Dcc=$TARGETARCH-gcc \ + -Dsysroot=$SYSROOT \ + -Dtargetdir=$TARGETDIR \ + -Dtargethost="$TARGETHOST" \ + -Dtargetuser=$TARGETUSER \ + -Dtargetport=$TARGETPORT + +Now you're ready to run make and make test! + +As a final word of warning, if you're using adb, make test may appear to +hang; this is because it doesn't output anything until it finishes +running all tests. You can check its progress by logging into the +device, moving to $TARGETDIR, and looking at the file output.stdout. + +=head3 Notes + +=over + +=item * + +If you are targetting x86 Android, you will have to change $TARGETARCH-gcc +to i686-linux-android-gcc. + +=item * + +On some older low-end devices -- think early 2.2 era -- some tests, +particularly t/re/uniprops, may crash the phone, causing it to turn +itself off once, and then back on again. + +=back + +=head1 Native Builds + +While Google doesn't provide a native toolchain for Android, +you can still get one from the Play Store; for example, there's the CCTools +app which you can get for free. +Keep in mind that you want a full +toolchain; some apps tend to default to installing only a barebones +version without some important utilities, like ar or nm. + +Once you have the toolchain set up properly, the only +remaining hurdle is actually locating where in the device it was installed +in. For example, CCTools installs its toolchain in +/data/data/com.pdaxrom.cctools/root/cctools. With the path in hand, +compiling perl is little more than: + + export SYSROOT= + export LD_LIBRARY_PATH="$SYSROOT/lib:`pwd`:`pwd`/lib:`pwd`/lib/auto:$LD_LIBRARY_PATH" + sh Configure -des -Dsysroot=$SYSROOT -Alibpth="/system/lib /vendor/lib" + +=head1 AUTHOR + +Brian Fraser + +=cut Index: gnu/usr.bin/perl/README.ce =================================================================== RCS file: /mnt/memory/perl/importit/cvs/src/gnu/usr.bin/perl/README.ce,v retrieving revision 1.1.1.6 diff -u -p -u -p -r1.1.1.6 README.ce --- gnu/usr.bin/perl/README.ce 25 Mar 2013 20:06:36 -0000 1.1.1.6 +++ gnu/usr.bin/perl/README.ce 16 Nov 2014 03:22:23 -0000 @@ -8,6 +8,16 @@ perlce - Perl for WinCE =head1 Building Perl for WinCE +=head2 WARNING + +B<< Much of this document has become very out of date and needs updating, +rewriting or deleting. The build process was overhauled during the 5.19 +development track and the current instructions as of that time are given +in L; the previous build instructions, which +are largely superseded but may still contain some useful information, are +left in L but really need removing after anything +of use has been extracted from them. >> + =head2 DESCRIPTION This file gives the instructions for building Perl5.8 and above for @@ -56,7 +66,138 @@ compile. =back -=head2 BUILD +=head2 CURRENT BUILD INSTRUCTIONS + +(These instructions assume the host is 32-bit Windows. If you're on 64-bit +Windows then change "C:\Program Files" to "C:\Program Files (x86)" throughout.) + +1. Install EVC4 from + + http://download.microsoft.com/download/c/3/f/c3f8b58b-9753-4c2e-8b96-2dfe3476a2f7/eVC4.exe + +Use the key mentioned at + + http://download.cnet.com/Microsoft-eMbedded-Visual-C/3000-2212_4-10108490.html?tag=bc + +The installer is ancient and has a few bugs on the paths it uses. You +will have to fix them later. Basically, some things go into "C:/Program +Files/Windows CE Tools", others go into "C:/Windows CE Tools" regardless +of the path you gave to the installer (the default will be "C:/Windows +CE Tools"). Reboots will be required for the installer to proceed. Also +.c and .h associations with Visual Studio might get overridden when +installing EVC4. You have been warned. + +2. Download celib from GitHub (using "Download ZIP") at + + https://github.com/bulk88/celib + +Extract it to a spaceless path but not into the perl build source. +I call this directory "celib-palm-3.0" but in the GitHub +snapshot it will be called "celib-master". Make a copy of the +"wince-arm-pocket-wce300-release" folder and rename the copy to +"wince-arm-pocket-wce400". This is a hack so we can build a CE 4.0 +binary by linking in CE 3.0 ARM asm; the linker doesn't care. Windows +Mobile/WinCE are backwards compatible with machine code like Desktop Windows. + +3. Download console-1.3-src.tar.gz from + + http://sourceforge.net/projects/perlce/files/PerlCE%20support%20files/console/ + +Extract it to a spaceless path but not into the perl build source. +Don't extract it into the same directory as celib. Make a copy of the +"wince-arm-pocket-wce300" folder and rename the copy to +"wince-arm-pocket-wce400". This is a hack so we can build a CE 4.0 +binary by linking in CE 3.0 ARM asm; the linker doesn't care. Windows +Mobile/WinCE are backwards compatible with machine code like Desktop Windows. + +4. Open a command prompt, run your regular batch file to set the environment +for desktop Visual C building, goto the perl source directory, cd into win32/, +fill out Makefile, and do a "nmake all" to build a Desktop Perl. + +5. Open win32/Makefile.ce in a text editor and do something similar to the +following patch. + + -CELIBDLLDIR = h:\src\wince\celib-palm-3.0 + -CECONSOLEDIR = h:\src\wince\w32console + +CELIBDLLDIR = C:\sources\celib-palm-3.0 + +CECONSOLEDIR = C:\sources\w32console + +Also change + + !if "$(MACHINE)" == "" + MACHINE=wince-arm-hpc-wce300 + #MACHINE=wince-arm-hpc-wce211 + #MACHINE=wince-sh3-hpc-wce211 + #MACHINE=wince-mips-hpc-wce211 + #MACHINE=wince-sh3-hpc-wce200 + #MACHINE=wince-mips-hpc-wce200 + #MACHINE=wince-arm-pocket-wce300 + #MACHINE=wince-mips-pocket-wce300 + #MACHINE=wince-sh3-pocket-wce300 + #MACHINE=wince-x86em-pocket-wce300 + #MACHINE=wince-mips-palm-wce211 + #MACHINE=wince-sh3-palm-wce211 + #MACHINE=wince-x86em-palm-wce211 + #MACHINE=wince-x86-hpc-wce300 + #MACHINE=wince-arm-pocket-wce400 + !endif + +to + + !if "$(MACHINE)" == "" + #MACHINE=wince-arm-hpc-wce300 + #MACHINE=wince-arm-hpc-wce211 + #MACHINE=wince-sh3-hpc-wce211 + #MACHINE=wince-mips-hpc-wce211 + #MACHINE=wince-sh3-hpc-wce200 + #MACHINE=wince-mips-hpc-wce200 + #MACHINE=wince-arm-pocket-wce300 + #MACHINE=wince-mips-pocket-wce300 + #MACHINE=wince-sh3-pocket-wce300 + #MACHINE=wince-x86em-pocket-wce300 + #MACHINE=wince-mips-palm-wce211 + #MACHINE=wince-sh3-palm-wce211 + #MACHINE=wince-x86em-palm-wce211 + #MACHINE=wince-x86-hpc-wce300 + MACHINE=wince-arm-pocket-wce400 + !endif + +so wince-arm-pocket-wce400 is the MACHINE type. + +6. Use a text editor to open "C:\Program Files\Microsoft eMbedded C++ +4.0\EVC\WCE400\BIN\WCEARMV4.BAT". Look for + + if "%SDKROOT%"=="" set SDKROOT=... + +On a new install it is "C:\Windows CE Tools". Goto +"C:\Windows CE Tools" in a file manager and see if "C:\Windows CE +Tools\wce400\STANDARDSDK\Include\Armv4" exists on your disk. If not +the SDKROOT need to be changed to "C:\Program Files\Windows CE Tools". + +Goto celib-palm-3.0\inc\cewin32.h, search for + + typedef struct _ABC { + +and uncomment the struct. + +7. Open another command prompt, ensure PLATFORM is not set to anything +already unless you know what you're doing (so that the correct default +value is set by the next command), and run "C:\Program Files\Microsoft +eMbedded C++ 4.0\EVC\WCE400\BIN\WCEARMV4.BAT" + +8. In the WinCE command prompt you made with WCEARMV4.BAT, goto the perl +source directory, cd into win32/ and run "nmake -f Makefile.ce". + +9. The ARM perl interpreter (perl519.dll and perl.exe) will be in something +like "C:\perl519\src\win32\wince-arm-pocket-wce400", with the XS DLLs in +"C:\perl519\src\xlib\wince-arm-hpc-wce400\auto". + +To prove success on the host machine, run +"dumpbin /headers wince-arm-pocket-wce400\perl.exe" from the win32/ folder +and look for "machine (ARM)" in the FILE HEADER VALUES and +"subsystem (Windows CE GUI)" in the OPTIONAL HEADER VALUES. + +=head2 OLD BUILD INSTRUCTIONS This section describes the steps to be performed to build PerlCE. You may find additional information about building perl for WinCE @@ -120,8 +261,10 @@ has proper "MACHINE" parameter set, to, compile.bat compile.bat dist - compile.bat CROSS_NAME=mips-wce300-thr "USE_ITHREADS=define" "USE_IMP_SYS=define" "USE_MULTI=define" - compile.bat CROSS_NAME=mips-wce300-thr "USE_ITHREADS=define" "USE_IMP_SYS=define" "USE_MULTI=define" dist + compile.bat CROSS_NAME=mips-wce300-thr "USE_ITHREADS=define" ^ + "USE_IMP_SYS=define" "USE_MULTI=define" + compile.bat CROSS_NAME=mips-wce300-thr "USE_ITHREADS=define" ^ + "USE_IMP_SYS=define" "USE_MULTI=define" dist If all goes okay and no errors during a build, you'll get two independent distributions: C and C. @@ -302,5 +445,9 @@ Many thanks and obligations to Rainer! =item Vadim Konovalov made further support of WinCE port. + +=item Daniel Dragan + +updated the build process during the 5.19 development track. =back Index: gnu/usr.bin/perl/README.cygwin =================================================================== RCS file: /mnt/memory/perl/importit/cvs/src/gnu/usr.bin/perl/README.cygwin,v retrieving revision 1.1.1.10 diff -u -p -u -p -r1.1.1.10 README.cygwin --- gnu/usr.bin/perl/README.cygwin 24 Mar 2014 14:58:47 -0000 1.1.1.10 +++ gnu/usr.bin/perl/README.cygwin 16 Nov 2014 03:22:23 -0000 @@ -390,7 +390,7 @@ Cygwin processes have their own pid, whi underlying windows pid. Most posix compliant Proc functions expect the cygwin pid, but several Win32::Process functions expect the winpid. E.g. C<$$> is the cygwin pid of F, which is not -the winpid. Use C and C +the winpid. Use C and C to translate between them. =item * Cygwin vs. Windows errors @@ -409,7 +409,8 @@ looks like like the following: or: - 183 [main] perl 3588 C:\cygwin\bin\perl.exe: *** fatal error - unable to remap C:\cygwin\bin\cygsvn_subr-1-0.dll to same address as parent(0x6FB30000) != 0x6FE60000 + 183 [main] perl 3588 C:\cygwin\bin\perl.exe: *** fatal error - unable to remap + C:\cygwin\bin\cygsvn_subr-1-0.dll to same address as parent(0x6FB30000) != 0x6FE60000 46 [main] perl 3488 fork: child 3588 - died waiting for dll loading, errno11 See L @@ -664,15 +665,6 @@ be kept as clean as possible. ext/Win32CORE/Win32CORE.pm - History of Win32CORE under Cygwin lib/CGI.pm - binmode and path separator - lib/CPANPLUS/Dist/MM.pm - Commented out code that fails under Win32/Cygwin - lib/CPANPLUS/Internals/Constants/Report.pm - - OS classifications - lib/CPANPLUS/Internals/Constants.pm - - Constants for Cygwin - lib/CPANPLUS/Internals/Report.pm - - Example of Cygwin report - lib/CPANPLUS/Module.pm - - Abort if running on old Cygwin version lib/Cwd.pm - hook to internal Cwd::cwd lib/ExtUtils/CBuilder/Platform/cygwin.pm - use gcc for ld, and link to libperl.dll.a @@ -728,8 +720,6 @@ be kept as clean as possible. lib/AnyDBM_File.t lib/Archive/Extract/t/01_Archive-Extract.t lib/Archive/Tar/t/02_methods.t - lib/CPANPLUS/t/05_CPANPLUS-Internals-Fetch.t - lib/CPANPLUS/t/20_CPANPLUS-Dist-MM.t lib/ExtUtils/t/Embed.t lib/ExtUtils/t/eu_command.t lib/ExtUtils/t/MM_Cygwin.t Index: gnu/usr.bin/perl/README.dgux =================================================================== RCS file: gnu/usr.bin/perl/README.dgux diff -N gnu/usr.bin/perl/README.dgux --- gnu/usr.bin/perl/README.dgux 25 Mar 2013 20:06:36 -0000 1.1.1.3 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,117 +0,0 @@ -If you read this file _as_is_, just ignore the funny characters you -see. It is written in the POD format (see perlpod manpage) which is -specially designed to be readable as is. - -=head1 NAME - -perldgux - Perl under DG/UX. - -=head1 SYNOPSIS - -One can read this document in the following formats: - - man perldgux - view perl perldgux - explorer perldgux.html - info perldgux - -to list some (not all may be available simultaneously), or it may -be read I: as F. - -=cut - -Contents - - perldgux - Perl under DG/UX. - - NAME - SYNOPSIS - DESCRIPTION - BUILD - - Non-threaded Case - - Threaded Case - - Testing - - Installing the built perl - AUTHOR - SEE ALSO - -=head1 DESCRIPTION - -Perl 5.7/8.x for DG/UX ix86 R4.20MU0x - -=head1 BUILDING PERL ON DG/UX - -=head2 Non-threaded Perl on DG/UX - -Just run ./Configure script from the top directory. -Then give "make" to compile. - -=head2 Threaded Perl on DG/UX - -If you are using as compiler GCC-2.95.x rev(DG/UX) -an easy solution for configuring perl in your DG/UX -machine is to run the command: - -./Configure -Dusethreads -Duseithreads -Dusedevel -des - -This will automatically accept all the defaults and -in particular /usr/local/ as installation directory. -Note that GCC-2.95.x rev(DG/UX) knows the switch --pthread which allows it to link correctly DG/UX's --lthread library. - -If you want to change the installation directory or -have a standard DG/UX with C compiler GCC-2.7.2.x -then you have no choice than to do an interactive -build by issuing the command: - -./Configure -Dusethreads -Duseithreads - -In particular with GCC-2.7.2.x accept all the defaults -and *watch* out for the message: - - Any additional ld flags (NOT including libraries)? [ -pthread] - -Instead of -pthread put here -lthread. CGCC-2.7.2.x -that comes with the DG/UX OS does NOT know the -pthread -switch. So your build will fail if you choose the defaults. -After configuration is done correctly give "make" to compile. - -=head2 Testing Perl on DG/UX - -Issuing a "make test" will run all the tests. -If the test lib/ftmp-security gives you as a result -something like - - lib/ftmp-security....File::Temp::_gettemp: - Parent directory (/tmp/) is not safe (sticky bit not set - when world writable?) at lib/ftmp-security.t line 100 - -don't panic and just set the sticky bit in your /tmp -directory by doing the following as root: - -cd / -chmod +t /tmp (=set the sticky bit to /tmp). - -Then rerun the tests. This time all must be OK. - -=head2 Installing the built perl on DG/UX - -Run the command "make install" - -=head1 AUTHOR - -Takis Psarogiannakopoulos -University of Cambridge -Centre for Mathematical Sciences -Department of Pure Mathematics -Wilberforce road -Cambridge CB3 0WB , UK -email - -=head1 SEE ALSO - -perl(1). - -=cut - Index: gnu/usr.bin/perl/README.haiku =================================================================== RCS file: /mnt/memory/perl/importit/cvs/src/gnu/usr.bin/perl/README.haiku,v retrieving revision 1.1.1.4 diff -u -p -u -p -r1.1.1.4 README.haiku --- gnu/usr.bin/perl/README.haiku 24 Mar 2014 14:58:47 -0000 1.1.1.4 +++ gnu/usr.bin/perl/README.haiku 16 Nov 2014 03:22:23 -0000 @@ -22,9 +22,9 @@ The build procedure is completely standa Make perl executable and create a symlink for libperl: chmod a+x /boot/common/bin/perl - cd /boot/common/lib; ln -s perl5/5.18.2/BePC-haiku/CORE/libperl.so . + cd /boot/common/lib; ln -s perl5/5.20.1/BePC-haiku/CORE/libperl.so . -Replace C<5.18.2> with your respective version of Perl. +Replace C<5.20.1> with your respective version of Perl. =head1 KNOWN PROBLEMS Index: gnu/usr.bin/perl/README.ko =================================================================== RCS file: /mnt/memory/perl/importit/cvs/src/gnu/usr.bin/perl/README.ko,v retrieving revision 1.1.1.5 diff -u -p -u -p -r1.1.1.5 README.ko --- gnu/usr.bin/perl/README.ko 24 Mar 2014 14:58:47 -0000 1.1.1.5 +++ gnu/usr.bin/perl/README.ko 16 Nov 2014 03:22:23 -0000 @@ -1,201 +1,339 @@ =encoding utf8 -이 문서를 perldoc을 써서 보지 않고 직접 보는 경우에는 각 부분의 -역할을 표시하기 위해 쓰인 =head, =item, 'L' 등은 무시하십시오. -이 문서는 따로 perldoc을 쓰지 않고 보더라도 읽는데 별 지장이 -없는 POD 형식으로 짜여 있습니다. 더 자세한 것은 perlpod -매뉴얼을 참고하십시오. +이 파일을 내용 그대로 읽고 있다면 우스꽝스러운 문자는 무시해주세요. +이 문서는 POD로 읽을 수 있도록 POD 형식(F 문서를 +확인하세요)으로 작성되어 있습니다. + =head1 NAME -perlko - Perl과 한국어 인코딩 +perlko - 한국어 Perl 안내서 =head1 DESCRIPTION -Perl의 세계에 오신 것을 환영합니다 ! +Perl의 세계에 오신 것을 환영합니다! + +Perl은 가끔 B<'Practical Extraction and Report Language'>라고 하기도 합니다만 +다른 널리 알려진 것들 중에서 B<'Pathologically Eclectic Rubbish Lister'>라고 +하기도 합니다. 사실 이것은 끼워 맞춘 것이며 Perl이 이것들의 첫 글자를 +가져와서 이름을 붙인 것은 아닙니다. Perl의 창시자 Larry가 첫 번째 이름을 +먼저 생각했고 널리 알려진 것을 나중에 지었기 때문입니다. 그렇기 때문에 +B<'Perl'>은 모두 대문자가 아닙니다. 널리 알려진 어떤 것을 가지고 논쟁하는 +것은 의미가 없습니다. Larry는 두 개 다 지지합니다. + +가끔 p가 소문자로 작성된 B<'perl'>을 볼 것입니다. P가 대문자로 되어 있는 +B<'Perl'>은 언어를 참조할 때 쓰이며 B<'perl'>처럼 p가 소문자인 경우는 여러분의 +프로그램을 컴파일하고 돌릴 때 사용되는 해석기를 지칭할 때 사용됩니다. + + +=head1 Perl에 관하여 + +Perl은 본래 문자열 생성을 위해 만들졌지만 지금은 시스템 관리와 웹 개발, +네트워크 프로그래밍, GUI 개발 등을 포함한 여러 분야에서 널리 사용되는 +범용 프로그래밍 언어입니다. + +이 언어는 아름다움(아주 작고, 우아하고, 아주 적고)보다 +실용적(사용하기 쉽고, 효율적이며, 가능한 최대한)인 것을 지향하고 있습니다. +사용하기 쉽고, 절차적 프로그래밍과 객체 지향 프로그래밍을 모두 지원하고, +강력한 문자열 처리 기능을 내장하고, 세상에서 가장 인상적인 제 3자의 모듈 +모음처를 가지고 있다는 것은 Perl의 가장 중요한 특징입니다. + +Perl의 언어적 특징은 F 문서에서 소개합니다. + +이번 릴리스에서 가장 중요한 변화는 F에서 논의합니다. + +또한 다양한 출판사가 출판한 많은 Perl 책은 다양한 주제를 다루고 있습니다. +자세한 정보는 F 문서를 확인하세요. + + +=head1 설치 + +여러분이 비교적 현대의 운영체제를 사용하고 있고 현재 버전의 Perl을 +지역적으로 설치하고 싶다면 다음 명령을 실행하세요. + + ./Configure -des -Dprefix=$HOME/localperl + make test + make install + +앞의 명령은 여러분의 플랫폼에 맞게 환경을 설정하고 컴파일을 수행한 후, +회기 테스트를 수행한뒤, 홈 디렉터리 하부의 F 디렉터리에 perl을 +설치합니다. + +여러분이 어떠한 문제든 겪게 되거나 사용자 정의 버전 Perl을 설치할 필요가 있다면 +현재 배포판에 들어있는 F 파일 안의 자세한 설명을 읽어야 합니다. +추가적으로 일반적이지 않은 다양한 플랫폼에서 Perl을 빌드하고 사용하는 +방법에 대한 도움말과 귀띔이 적혀있는 많은 수의 F 파일이 있습니다. + +일단 Perl을 설치하고 나면 C 도구를 이용해 풍부한 문서를 사용할 +수 있습니다. 시작하기 위해서 다음 명령을 실행하세요. + perldoc perl -Perl은 5.8.0판부터 유니코드/ISO 10646에 대한 광범위한 지원을 합니다. + +=head1 실행에 어려움을 겪는다면 + +Perl은 뜨개질에서 부터 로켓 과학까지 모든 분야에서 사용할 수 있는 크고 +복잡한 시스템입니다. 여러분이 어려움에 부딪혔을때 그 문제는 이미 다른 +사람이 해결했을 가능성이 높습니다. 문서를 모두 확인했는데도 버그가 +확실하다면 C 도구를 이용해서 저희에게 버그를 보고해주세요. +C에 대한 더 자세한 정보는 C 또는 C를 +명령줄에서 실행해서 확인할 수 있습니다. + +Perl을 사용 가능하게 만들었다 하더라도 Perl은 계속해서 진화하기 때문에 +여러분이 맞닥뜨린 버그를 수정했거나 여러분이 유용하다고 생각할법한 +새로운 기능이 추가된 좀 더 최신 버전이 있을 수 있습니다. + +여러분은 항상 최신 버전의 perl을 CPAN (Comprehensive Perl Archive Network) +사이트 L 에서 찾을 수 있습니다. + +perl 소스에 간단한 패치를 등록하고 싶다면 F 문서의 +B<"SUPER QUICK PATCH GUIDE">를 살펴보세요. + +그냥 개인적으로 참고하세요. +제가 이것처럼 멋진 물건을 만든다는 것을 여러분이 알기를 바랍니다. +그것은 제 이야기의 B<"저자(Author)">를 기쁘게하기 때문입니다. +이것이 여러분을 귀찮게 한다면 여러분의 B<"저작(Authorship)">에 +대한 생각을 정정해야 할 수도 있습니다. 하지만 어쨌거나 여러분은 +Perl을 사용하는데는 문제가 없답니다. :-) + +- B<"저자">로부터. + + +=head1 인코딩 + +Perl은 5.8.0판부터 유니코드/ISO 10646에 대해 광범위하게 지원합니다. 유니코드 지원의 일환으로 한중일을 비롯한 세계 각국에서 유니코드 이전에 쓰고 있었고 지금도 널리 쓰이고 있는 수많은 인코딩을 -지원합니다. 유니코드는 전 세계에서 쓰이는 모든 언어를 위한 표기 체계 - -유럽의 라틴 알파벳, 키릴 알파벳, 그리스 알파벳, 인도와 동남 아시아의 +지원합니다. 유니코드는 전 세계에서 쓰이는 모든 언어를 위한 +표기 체계(유럽의 라틴 알파벳, 키릴 알파벳, 그리스 알파벳, 인도와 동남 아시아의 브라미 계열 스크립트, 아랍 문자, 히브리 문자, 한중일의 한자, 한국어의 한글, -일본어의 가나, 북미 인디안의 표기 체계 등-를 수용하는 것을 목표로 하고 +일본어의 가나, 북미 인디안의 표기 체계 등)를 수용하는 것을 목표로 하고 있기 때문에 기존에 쓰이던 각 언어 및 국가 그리고 운영 체계에 고유한 문자 집합과 인코딩에 쓸 수 있는 모든 글자는 물론이고 기존 문자 집합에서 지원하고 있지 않던 아주 많은 글자를 포함하고 있습니다. - -Perl은 내부적으로 유니코드를 문자 표현을 위해 사용합니다. 보다 구체적으로 -말하면 Perl 스크립트 안에서 UTF-8 문자열을 쓸 수 있고, +Perl은 내부적으로 유니코드를 문자 표현을 위해 사용합니다. +보다 구체적으로 말하면 Perl 스크립트 안에서 UTF-8 문자열을 쓸 수 있고, 각종 함수와 연산자(예를 들어, 정규식, index, substr)가 바이트 단위 -대신 유니코드 글자 단위로 동작합니다. (더 자세한 것은 -perlunicode 매뉴얼을 참고하십시오.) 유니코드가 널리 보급되기 전에 -널리 쓰이고 있었고, 여전히 널리 쓰이고 있는 각국/각 언어별 인코딩으로 -입출력을 하고 이들 인코딩으로 된 데이터와 문서를 다루는 것을 돕기 위해 -'Encode'가 쓰였습니다. 무엇보다 'Encode'를 써서 수많은 인코딩 사이의 -변환을 쉽게 할 수 있습니다. +대신 유니코드 글자 단위로 동작합니다. +더 자세한 것은 F 문서를 참고하세요. +유니코드가 널리 보급되기 전에 널리 쓰이고 있었고, 여전히 널리 쓰이고 있는 +각국/각 언어별 인코딩으로 입출력을 하고 이들 인코딩으로 된 데이터와 문서를 +다루는 것을 돕기 위해 L 모듈이 쓰이고 있습니다. +무엇보다 L 모듈을 사용하면 수많은 인코딩 사이의 변환을 쉽게 할 수 있습니다. + + +=head2 Encode 모듈 -'Encode'는 다음과 같은 한국어 인코딩을 지원합니다. +=head3 지원 인코딩 + +L 모듈은 다음과 같은 한국어 인코딩을 지원합니다. =over 4 -=item * euc-kr +=item * C -US-ASCII와 KS X 1001을 같이 쓰는 멀티바이트 인코딩 (흔히 완성형이라고 -불림.) KS X 2901과 RFC 1557 참고. +US-ASCII와 KS X 1001을 같이 쓰는 멀티바이트 인코딩으로 흔히 +완성형이라고 불림. KS X 2901과 RFC 1557 참고. -=item * cp949 +=item * C -MS-Windows 9x/ME에서 쓰이는 확장 완성형. euc-kr에 8,822자의 -한글 음절을 더한 것임. alias는 uhc, windows-949, x-windows-949, +MS-Windows 9x/ME에서 쓰이는 확장 완성형. euc-kr에 8,822자의 +한글 음절을 더한 것임. alias는 uhc, windows-949, x-windows-949, ks_c_5601-1987. 맨 마지막 이름은 적절하지 않은 이름이지만, Microsoft 제품에서 CP949의 의미로 쓰이고 있음. -=item * johab +=item * C -KS X 1001:1998 부록 3에서 규정한 조합형. 문자 레퍼토리는 cp949와 -마찬가지로 US-ASCII와 KS X 1001에 8,822자의 한글 음절을 더한 것임. -인코딩 방식은 전혀 다름. +KS X 1001:1998 부록 3에서 규정한 조합형. 문자 레퍼토리는 cp949와 마찬가지로 +US-ASCII와 KS X 1001에 8,822자의 한글 음절을 더한 것으로 인코딩 방식은 전혀 다름. -=item * iso-2022-kr +=item * C RFC 1557에서 규정한 한국어 인터넷 메일 교환용 인코딩으로 US-ASCII와 KS X 1001을 레퍼토리로 하는 점에서 euc-kr과 같지만 인코딩 방식이 다름. 1997-8년 경까지 쓰였으나 더 이상 메일 교환에 쓰이지 않음. -=item * ksc5601-raw +=item * C -KS X 1001(KS C 5601)을 GL(즉, MSB를 0으로 한 경우) 에 놓았을 때의 -인코딩. US-ASCII와 결합하지 않고 단독으로 쓰이는 일은 X11 등에서 글꼴 -인코딩 (ksc5601.1987-0. '0'은 GL을 의미함.)으로 쓰이는 것을 제외하고는 -거의 없음. KS C 5601은 1997년 KS X 1001로 이름을 바꾸었음. 1998년에는 두 -글자 (유로화 부호와 등록 상표 부호)가 더해졌음. +KS X 1001(KS C 5601)을 GL(즉, MSB를 0으로 한 경우)에 놓았을 때의 인코딩. +US-ASCII와 결합하지 않고 단독으로 쓰이는 일은 X11 등에서 글꼴 +인코딩(ksc5601.1987-0. '0'은 GL을 의미함)으로 쓰이는 것을 제외하고는 +거의 없음. KS C 5601은 1997년 KS X 1001로 이름을 바꾸었음. 1998년에는 두 +글자(유로화 부호와 등록 상표 부호)가 더해졌음. =back -몇 가지 사용 예제를 아래에 보입니다. +=head3 변환 예제 -예를 들어, euc-kr 인코딩으로 된 파일을 UTF-8로 변환하려면 다음과 -같이 하면 됩니다. +예를 들어, euc-kr 인코딩으로 된 파일을 UTF-8로 변환하려면 +명령줄에서 다음처럼 실행합니다. + perl -Mencoding=euc-kr,STDOUT,utf8 -pe1 < file.euc-kr > file.utf8 - perl -Mencoding=euc-kr,STDOUT,utf8 -pe1 < file.euckr > file.utf8 +반대로 변환할 경우 다음처럼 실행합니다. -역변환은 다음과 같이 할 수 있습니다. + perl -Mencoding=utf8,STDOUT,euc-kr -pe1 < file.utf8 > file.euc-kr - perl -Mencoding=utf8,STDOUT,euc-kr -pe1 < file.utf8 > file.euckr +이런 변환을 좀더 편리하게 할 수 있도록 도와주는 F가 Perl에 +기본으로 들어있습니다. 이 유틸리티는 L 모듈을 이용한 순수 Perl +유틸리티로 이름에서 알 수 있듯이 Unix의 C를 모델로 한 것입니다. +사용법은 다음과 같습니다. -이런 변환을 좀더 편리하게 할 수 있도록 Encode 모듈을 써서 -순수하게 Perl로만 쓰인 piconv가 Perl에 들어 있습니다. -그 이름에서 알 수 있듯이 piconv는 Unix에 있는 iconv를 -모델로 한 것입니다. 그 사용법은 아래와 같습니다. + piconv -f euc-kr -t utf8 < file.euc-kr > file.utf8 + piconv -f utf8 -t euc-kr < file.utf8 > file.euc-kr - piconv -f euc-kr -t utf8 < file.euckr > file.utf8 - piconv -f utf8 -t euc-kr < file.utf8 > file.euckr +=head3 모범 사례 -또, 'PerlIO::encoding' 모듈을 써서 한국어 인코딩을 쓰면서 글자 단위 -(바이트 단위가 아니라) 처리를 쉽게 할 수 있습니다. +Perl은 기본적으로 내부에서 UTF-8을 사용하며 Encode 모듈을 통해 +다양한 인코딩을 지원하지만 항상 다음 규칙을 지킴으로써 인코딩과 +관련한 다양하게 발생할 수 있는 문제의 가능성을 줄이는 것을 추천합니다. - #!/path/to/perl +=over 4 - use encoding 'euc-kr', STDIN => 'euc-kr', - STDOUT-> 'euc-kr', STDERR=>'euc-kr'; +=item * 소스 코드는 항상 UTF-8 인코딩으로 저장 - print length("가나"); # 2 (큰 따옴표는 글자 단위 처리를 지시) - print length('가나'); # 4 (작은 따옴표는 바이트 단위 처리를 지시) - print index("한강, 대동강", "염"); # -1 ('염'이 없음) - print index('한강, 대동강', '염'); # 7 (8번째와 9번째 바이트가 '염'의 - 코드값과 일치함.) +=item * 소스 코드 상단에 C 프라그마 사용 +=item * 소스 코드, 터미널, 운영체제, 데이터 인코딩을 분리해서 이해 -=head2 더 자세히 알고 싶으면... +=item * 입출력 파일 핸들에 명시적인 인코딩을 사용 -Perl을 설치하면 대단히 자세한 문서가 같이 따라 오며, 이 문서를 통해 -Perl 전반 뿐 아니라 유니코드 지원, Encode의 사용법 등에 많은 것을 -배울 수 있습니다. 아직 이 문서는 현재 모두 영어로 쓰여 있습니다. +=item * 중복(double) 인코딩을 주의 +=back -=head2 Perl 관련 자료 -위에서 언급한 문서 외에도 다음과 같은 자료가 있습니다. 이 목록은 결코 -완전한 것이 아니고 일부 대표적인 것만 모은 것입니다. +=head3 유니코드 및 한국어 인코딩 관련 자료 =over 4 -=item L +=item * L + +=item * L - O'Reilly의 Perl 웹 페이지 +=item * L -=item L +=item * L - Comprehensive Perl Archive Network +=item * L -=item L +=item * L - Perl 메일링 리스트. 많은 리스트 가운데 - perl-unicode에서 'Encode'에 대해 논의함. +유니코드 컨소시엄 + +=item * L + +기본적으로 Unicode와 같은 ISO 표준인 ISO/IEC 10646 UCS(Universal +Character Set)을 만드는 ISO/IEC JTC1/SC2/WG2의 웹 페이지 + +=item * L + +유닉스/리눅스 사용자를 위한 UTF-8 및 유니코드 관련 FAQ + +=item * L + +유닉스/리눅스 사용자를 위한 UTF-8 및 유니코드 관련 FAQ의 한국어 번역 =back -=head2 Perl을 더 깊게 공부하는데 도움을 줄 수 있는 한국어 관련 사이트 + +=head1 Perl 관련 자료 + +다음은 공식적인 Perl 관련 자료중 일부입니다. =over 4 -=item L +=item * L - Perl 한국 사용자 모임 +Perl 공식 홈페이지 -=item L +=item * L - 한국어 Perl 뉴스 그룹 +O'Reilly의 Perl 웹 페이지 -=item L +=item * L - O'Reilly에서 나온 한국어 Perl 서적 목록 +CPAN - Comprehensive Perl Archive Network, 통합적 Perl 파일 보관 네트워크 -=item L +=item * L - Perl 기초 강좌 및 소스, 최근 동향, 관련 해외 사이트 링크 +메타 CPAN -=item L +=item * L - Perl에 관련된 CGI, DB, 연동 등에 대한 정보 및 뉴스 제공 +Perl 메일링 리스트 -=back +=item * L -=head2 유니코드 및 한국어 인코딩 관련 자료 +Perl 메타 블로그 + +=item * L + +Perl 수도승들을 위한 수도원 + +=item * L + +아시아 지역 Perl 몽거스 모임 + +=item * L + +Perl 크리스마스 달력 + +=back + + +다음은 Perl을 더 깊게 공부하는데 도움을 줄 수 있는 한국어 관련 사이트입니다. =over 4 -=item L +=item * L - 유니코드 컨소시엄. +한국 Perl 커뮤니티 공식 포털 -=item L +=item * L -기본적으로 Unicode와 같은 ISO 표준인 ISO/IEC 10646 UCS(Universal -Character Set)을 만드는 ISO/IEC JTC1/SC2/WG2의 웹 페이지. +Perl 문서 한글화 프로젝트 + +=item * L + +네이버 Perl 카페 + +=item * L + +한국 Perl 사용자 모임 + +=item * L -=item L +Seoul.pm Perl 크리스마스 달력 (2010 ~ 2012) - 유닉스/리눅스에서 유니코드와 UTF-8 사용에 대한 문답집(FAQ) +=item * L -=item L +GYPARK(Geunyoung Park)의 Perl 관련 한글 문서 저장소 - 유닉스/리눅스에서 유니코드와 UTF-8 사용에 대한 문답집(FAQ)의 한국어 번역 +=item * L + +Seoul.pm - 서울 Perl 몽거스 =back -=head1 SEE ALSO -L, L, L, L, L +=head1 라이센스 + +F 파일의 B<'LICENSING'> 항목을 참고하세요. =head1 AUTHORS -Jarkko Hietaniemi Ejhi@iki.fiE -신정식 Ejshin@mailaps.orgE +=over + +=item * Jarkko Hietaniemi Ejhi@iki.fiE + +=item * 신정식 Ejshin@mailaps.orgE + +=item * 김도형 Ekeedi@cpan.orgE + +=back + =cut Index: gnu/usr.bin/perl/README.macosx =================================================================== RCS file: /mnt/memory/perl/importit/cvs/src/gnu/usr.bin/perl/README.macosx,v retrieving revision 1.1.1.6 diff -u -p -u -p -r1.1.1.6 README.macosx --- gnu/usr.bin/perl/README.macosx 24 Mar 2014 14:58:47 -0000 1.1.1.6 +++ gnu/usr.bin/perl/README.macosx 16 Nov 2014 03:22:23 -0000 @@ -10,9 +10,9 @@ perlmacosx - Perl under Mac OS X This document briefly describes Perl under Mac OS X. - curl http://www.cpan.org/src/perl-5.18.2.tar.gz > perl-5.18.0.tar.gz - tar -xzf perl-5.18.2.tar.gz - cd perl-5.18.2 + curl -O http://www.cpan.org/src/perl-5.20.1.tar.gz + tar -xzf perl-5.20.1.tar.gz + cd perl-5.20.1 ./Configure -des -Dprefix=/usr/local/ make make test @@ -20,7 +20,7 @@ This document briefly describes Perl und =head1 DESCRIPTION -The latest Perl release (5.18.2 as of this writing) builds without changes +The latest Perl release (5.20.1 as of this writing) builds without changes under all versions of Mac OS X from 10.3 "Panther" onwards. In order to build your own version of Perl you will need 'make', Index: gnu/usr.bin/perl/README.netware =================================================================== RCS file: /mnt/memory/perl/importit/cvs/src/gnu/usr.bin/perl/README.netware,v retrieving revision 1.1.1.5 diff -u -p -u -p -r1.1.1.5 README.netware --- gnu/usr.bin/perl/README.netware 25 Mar 2013 20:06:36 -0000 1.1.1.5 +++ gnu/usr.bin/perl/README.netware 16 Nov 2014 03:22:23 -0000 @@ -174,13 +174,13 @@ typing I, will copy the f Example: You can execute the following on the command prompt. - perl -Ic:/perl/5.6.1/lib/NetWare-x86-multi-thread -Ic:\perl\5.6.1\lib MakeFile.pl - INSTALLSITELIB=i:\perl\lib + perl -Ic:/perl/5.6.1/lib/NetWare-x86-multi-thread -Ic:\perl\5.6.1\lib MakeFile.pl + INSTALLSITELIB=i:\perl\lib or - perl -Ic:/perl/5.8.0/lib/NetWare-x86-multi-thread -Ic:\perl\5.8.0\lib MakeFile.pl - INSTALLSITELIB=i:\perl\lib + perl -Ic:/perl/5.8.0/lib/NetWare-x86-multi-thread -Ic:\perl\5.8.0\lib MakeFile.pl + INSTALLSITELIB=i:\perl\lib =item * Index: gnu/usr.bin/perl/README.os2 =================================================================== RCS file: /mnt/memory/perl/importit/cvs/src/gnu/usr.bin/perl/README.os2,v retrieving revision 1.15 diff -u -p -u -p -r1.15 README.os2 --- gnu/usr.bin/perl/README.os2 24 Mar 2014 15:05:13 -0000 1.15 +++ gnu/usr.bin/perl/README.os2 16 Nov 2014 03:22:23 -0000 @@ -404,11 +404,12 @@ there is an executable file F other words, C is essentially searched twice: once by the OS for an executable, then by Perl for scripts. -Note also that executable files on OS/2 can have an arbitrary extension, -but F<.exe> will be automatically appended if no dot is present in the name. -The workaround is as simple as that: since F and F denote the -same file (at list on FAT and HPFS file systems), to start an executable residing in file F (no -extension) give an argument C (dot appended) to system(). +Note also that executable files on OS/2 can have an arbitrary extension, but +F<.exe> will be automatically appended if no dot is present in the name. The +workaround is as simple as that: since F and F denote the same +file (at list on FAT and HPFS file systems), to start an executable residing in +file F (no extension) give an argument C (dot +appended) to system(). Perl will start PM programs from VIO (=text-mode) Perl process in a separate PM session; @@ -618,7 +619,7 @@ C in F, =item Additional Perl modules - unzip perl_ste.zip -d f:/perllib/lib/site_perl/5.18.2/ + unzip perl_ste.zip -d f:/perllib/lib/site_perl/5.20.1/ Same remark as above applies. Additionally, if this directory is not one of directories on @INC (and @INC is influenced by C), you @@ -1015,12 +1016,12 @@ The reasons for most important skipped t =over 4 -=item 18 +=item Z<>18 Checks C and C of C - unfortunately, HPFS provides only 2sec time granularity (for compatibility with FAT?). -=item 25 +=item Z<>25 Checks C on a filehandle just opened for write - I do not know why this should or should not work. @@ -1409,7 +1410,8 @@ For best results compile the C file belo DLL. However, a lot of functionality will work even if the executable is not an EMX applications, e.g., if compiled with - gcc -Wall -DDOSISH -DOS2=1 -O2 -s -Zomf -Zsys perl-starter.c -DPERL_DLL_BASENAME=\"perl312F\" -Zstack 8192 -Zlinker /PM:VIO + gcc -Wall -DDOSISH -DOS2=1 -O2 -s -Zomf -Zsys perl-starter.c \ + -DPERL_DLL_BASENAME=\"perl312F\" -Zstack 8192 -Zlinker /PM:VIO Here is the sample C file: Index: gnu/usr.bin/perl/README.qnx =================================================================== RCS file: /mnt/memory/perl/importit/cvs/src/gnu/usr.bin/perl/README.qnx,v retrieving revision 1.5 diff -u -p -u -p -r1.5 README.qnx --- gnu/usr.bin/perl/README.qnx 25 Mar 2013 20:40:43 -0000 1.5 +++ gnu/usr.bin/perl/README.qnx 16 Nov 2014 03:22:23 -0000 @@ -137,6 +137,67 @@ This is due to a bug in the C library's printf("'%e'", 0. ) produces '0.000000e+0', but ANSI requires '0.000000e+00'. QNX has acknowledged the bug. +=head2 Cross-compilation + +Perl supports cross-compiling to QNX NTO through the +Native Development Kit (NDK) for the Blackberry 10. This means that you +can cross-compile for both ARM and x86 versions of the platform. + +=head3 Setting up a cross-compilation environment + +You can download the NDK from +L. + +See +L +for instructions to set up your device prior to attempting anything else. + +Once you've installed the NDK and set up your device, all that's +left to do is setting up the device and the cross-compilation +environment. Blackberry provides a script, C (occasionally +named something like C) which can be used +to do this. However, there's a bit of a snag that we have to work through: +The script modifies PATH so that 'gcc' or 'ar' point to their +cross-compilation equivalents, which screws over the build process. + +So instead you'll want to do something like this: + + $ orig_path=$PATH + $ source $location_of_bbndk/bbndk-env*.sh + $ export PATH="$orig_path:$PATH" + +Besides putting the cross-compiler and the rest of the toolchain in your +PATH, this will also provide the QNX_TARGET variable, which +we will pass to Configure through -Dsysroot. + +=head3 Preparing the target system + +It's quite possible that the target system doesn't have a readily +available /tmp, so it's generall safer to do something like this: + + $ ssh $TARGETUSER@$TARGETHOST 'rm -rf perl; mkdir perl; mkdir perl/tmp' + $ export TARGETDIR=`ssh $TARGETUSER@$TARGETHOST pwd`/perl + $ export TARGETENV="export TMPDIR=$TARGETDIR/tmp; " + +Later on, we'll pass this to Configure through -Dtargetenv + +=head3 Calling Configure + +If you are targetting an ARM device -- which currently includes the vast +majority of phones and tablets -- you'll want to pass +-Dcc=arm-unknown-nto-qnx8.0.0eabi-gcc to Configure. Alternatively, if you +are targetting an x86 device, or using the simulator provided with the NDK, +you should specify -Dcc=ntox86-gcc instead. + +A sample Configure invocation looks something like this: + + ./Configure -des -Dusecrosscompile \ + -Dsysroot=$QNX_TARGET \ + -Dtargetdir=$TARGETDIR \ + -Dtargetenv="$TARGETENV" \ + -Dcc=ntox86-gcc \ + -Dtarghost=... # Usual cross-compilation options + =head1 AUTHOR Norton T. Allen (allen@huarp.harvard.edu) Index: gnu/usr.bin/perl/README.solaris =================================================================== RCS file: /mnt/memory/perl/importit/cvs/src/gnu/usr.bin/perl/README.solaris,v retrieving revision 1.7 diff -u -p -u -p -r1.7 README.solaris --- gnu/usr.bin/perl/README.solaris 25 Mar 2013 20:40:43 -0000 1.7 +++ gnu/usr.bin/perl/README.solaris 16 Nov 2014 03:22:23 -0000 @@ -530,6 +530,20 @@ to catch all tmpfs situations. See L. +=head1 CROSS-COMPILATION + +Nothing too unusual here. You can easily do this if you have a +cross-compiler available; A usual Configure invocation when targetting a +Solaris x86 looks something like this: + + sh ./Configure -des -Dusecrosscompile \ + -Dcc=i386-pc-solaris2.11-gcc \ + -Dsysroot=$SYSROOT \ + -Alddlflags=" -Wl,-z,notext" \ + -Dtargethost=... # The usual cross-compilation options + +The lddlflags addition is the only abnormal bit. + =head1 PREBUILT BINARIES OF PERL FOR SOLARIS. You can pick up prebuilt binaries for Solaris from Index: gnu/usr.bin/perl/README.synology =================================================================== RCS file: gnu/usr.bin/perl/README.synology diff -N gnu/usr.bin/perl/README.synology --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ gnu/usr.bin/perl/README.synology 16 Nov 2014 03:22:23 -0000 @@ -0,0 +1,262 @@ +If you read this file _as_is_, just ignore the funny characters you see. +It is written in the POD format (see pod/perlpod.pod) which is specially +designed to be readable as is. But if you have been into Perl you +probably already know this. + +=head1 NAME + +perlsynology - Perl 5 on Synology DSM systems + +=head1 DESCRIPTION + +Synology manufactures a vast number of Network Attached Storage (NAS) +devices that are very popular in large organisations as well as small +businesses and homes. + +The NAS systems are equipped with Synology Disk Storage Manager (DSM), +which is a trimmed-down Linux system enhanced with several tools for +managing the NAS. There are several flavours of hardware: Marvell +Armada (ARMv5te, ARMv7l), Intel Atom (i686, x86_64), Freescale QorIQ +(PPC), and more. For a full list see the +L. + +Since it is based on Linux, the NAS can run many popular Linux +software packages, including Perl. In fact, Synology provides a +ready-to-install package for Perl, albeit version 5.8.6 which should +be considered very old. + +There is an active user community that provides many software packages +for the Synology DSM systems; at the time of writing this document +they provide Perl version 5.8.8. + +This document describes various features of Synology DSM operating +system that will affect how Perl 5 (hereafter just Perl) is +configured, compiled and/or runs. It has been compiled and verified by +Johan Vromans for the Synology DS413 (QorIQ), with feedback from +H.Merijn Brand (DS213, ARMv5te). + +=head2 Setting up the build environment + +As DSM is a trimmed-down Linux system, it lacks many of the tools and +libraries commonly found on Linux. The basic tools like sh, cp, rm, +etc. are implemented using +L. + +=over 4 + +=item * + +Using your favourite browser open the DSM management page and start +the Package Center. + +=item * + +If you want to smoke test Perl, install C. + +=item * + +In Settings, add the following Package Sources: + + http://www.cphub.net + http://packages.quadrat4.de + +=item * + +Still in Settings, in Channel Update, select Beta Channel. + +=item * + +Press Refresh. In the left panel the item "Community" will appear. +Click it. Select "Bootstrap Installer Beta" and install it. + +=item * + +Likewise, install "iPKGui Beta". + +The application window should now show an icon for iPKGui. + +=item * + +Start iPKGui. Install the packages C, C and C. + +If you want to smoke test Perl, install C. + +=back + +The next step is to add some symlinks to system libraries. For +example, the development software expect a library C that +normally is a symlink to C. Synology only provides the +latter and not the symlink. + +Here the actual architecture of the Synology system matters. You have +to find out where the gcc libraries have been installed. Look in /opt +for a directory similar to arm-none-linux-gnueab or +powerpc-linux-gnuspe. In the instructions below I'll use +powerpc-linux-gnuspe as an example. + +=over 4 + +=item * + +On the DSM management page start the Control Panel. + +=item * + +Click Terminal, and enable SSH service. + +=item * + +Close Terminal and the Control Panel. + +=item * + +Open a shell on the Synology using ssh and become root. + +=item * + +Execute the following commands: + + cd /lib + ln -s libm.so.6 libm.so + ln -s libcrypt.so.1 libcrypt.so + ln -s libdl.so.2 libdl.so + cd /opt/powerpc-linux-gnuspe/lib + ln -s /lib/libdl.so.2 libdl.so + +=back + +B When you perform a system software upgrade, these links +will disappear and need to be re-established. + +=head2 Compiling Perl 5 + +When the build environment has been set up, building and testing Perl +is straightforward. The only thing you need to do is download the +sources as usual, and add a file Policy.sh as follows: + + # Administrivia. + perladmin="your.email@goes.here" + + # Install Perl in a tree in /opt/perl instead of /opt/bin. + prefix=/opt/perl + + # Select the compiler. Note that there is no 'cc' alias or link. + cc=gcc + + # Build flags. + ccflags="-DDEBUGGING" + + # Library and include paths. + libpth="/lib" + locincpth="/opt/include" + loclibpth="/lib" + +You may want to create the destination directory and give it the right +permissions before installing, thus eliminating the need to build Perl +as a super user. + +In the directory where you unpacked the sources, issue the familiar +commands: + + ./Configure -des + make + make test + make install + +=head2 Known problems + +=head3 Configure + +No known problems yet + +=head3 Build + +=over 4 + +=item Error message "No error definitions found". + +This error is generated when it is not possible to find the local +definitions for error codes, due to the uncommon structure of the +Synology file system. + +This error was fixed in the Perl development git for version 5.19, +commit 7a8f1212e5482613c8a5b0402528e3105b26ff24. + +=back + +=head3 Failing tests + +=over 4 + +=item C + +One subtest fails due to the uncommon structure of the Synology file +system. The file C is missing. + +B Do not symlink C to C or +some system components will start to fail. + +=back + +=head2 Smoke testing Perl 5 + +If building completes successfully, you can set up smoke testing as +described in the Test::Smoke documentation. + +For smoke testing you need a running Perl. You can either install the +Synology supplied package for Perl 5.8.6, or build and install your +own, much more recent version. + +Note that I could not run successful smokes when initiated by the +Synology Task Scheduler. I resorted to initiating the smokes via a +cron job run on another system, using ssh: + + ssh nas1 wrk/Test-Smoke/smoke/smokecurrent.sh + +=head3 Local patches + +When local patches are applied with smoke testing, the test driver +will automatically request regeneration of certain tables after the +patches are applied. The Synology supplied Perl 5.8.6 (at least on the +DS413) B of generating these tables. It will generate +opcodes with bogus values, causing the build to fail. + +You can prevent regeneration by adding the setting + + 'flags' => 0, + +to the smoke config, or by adding another patch that inserts + + exit 0 if $] == 5.008006; + +in the beginning of the C program. + +=head2 Adding libraries + +The above procedure describes a basic environment and hence results in +a basic Perl. If you want to add additional libraries to Perl, you may +need some extra settings. + +For example, the basic Perl does not have any of the DB libraries (db, +dbm, ndbm, gdsm). You can add these using iPKGui, however, you need to +set environment variable LD_LIBRARY_PATH to the appropriate value: + + LD_LIBRARY_PATH=/lib:/opt/lib + export LD_LIBRARY_PATH + +This setting needs to be in effect while Perl is built, but also when +the programs are run. + +=head1 REVISION + +November 2013, for Synology DSM 4.3.3810. + +=head1 AUTHOR + +Johan Vromans + +=head1 THANKS + +H. Merijn Brand + +=cut Index: gnu/usr.bin/perl/README.tru64 =================================================================== RCS file: /mnt/memory/perl/importit/cvs/src/gnu/usr.bin/perl/README.tru64,v retrieving revision 1.1.1.4 diff -u -p -u -p -r1.1.1.4 README.tru64 --- gnu/usr.bin/perl/README.tru64 25 Mar 2013 20:06:37 -0000 1.1.1.4 +++ gnu/usr.bin/perl/README.tru64 16 Nov 2014 03:22:23 -0000 @@ -120,13 +120,15 @@ since pointers are automatically 64-bit When compiling Perl in Tru64 you may (depending on the compiler release) see two warnings like this - cc: Warning: numeric.c, line 104: In this statement, floating-point overflow occurs in evaluating the expression "1.8e308". (floatoverfl) + cc: Warning: numeric.c, line 104: In this statement, floating-point + overflow occurs in evaluating the expression "1.8e308". (floatoverfl) return HUGE_VAL; -----------^ and when compiling the POSIX extension - cc: Warning: const-c.inc, line 2007: In this statement, floating-point overflow occurs in evaluating the expression "1.8e308". (floatoverfl) + cc: Warning: const-c.inc, line 2007: In this statement, floating-point + overflow occurs in evaluating the expression "1.8e308". (floatoverfl) return HUGE_VAL; -------------------^ Index: gnu/usr.bin/perl/README.tw =================================================================== RCS file: /mnt/memory/perl/importit/cvs/src/gnu/usr.bin/perl/README.tw,v retrieving revision 1.1.1.6 diff -u -p -u -p -r1.1.1.6 README.tw --- gnu/usr.bin/perl/README.tw 24 Mar 2014 14:58:47 -0000 1.1.1.6 +++ gnu/usr.bin/perl/README.tw 16 Nov 2014 03:22:23 -0000 @@ -31,26 +31,22 @@ Encode 延伸模組支援下列正體中 舉例來說, 將 Big5 編碼的檔案轉成 Unicode, 祗需鍵入下列指令: - perl -Mencoding=big5,STDOUT,utf8 -pe1 < file.big5 > file.utf8 + perl -MEncode -pe '$_= encode( utf8 => decode( big5 => $_ ) )' \ + < file.big5 > file.utf8 Perl 也內附了 "piconv", 一支完全以 Perl 寫成的字符轉換工具程式, 用法如下: piconv -f big5 -t utf8 < file.big5 > file.utf8 piconv -f utf8 -t big5 < file.utf8 > file.big5 -另外, 利用 encoding 模組, 你可以輕易寫出以字符為單位的程式碼, 如下所示: +另外,若程式碼本身以 utf8 編碼儲存,配合使用 utf8 模組,可讓程式碼中字串以及其運 +算皆以字符為單位,而不以位元為單位,如下所示: #!/usr/bin/env perl - # 啟動 big5 字串解析; 標準輸出入及標準錯誤都設為 big5 編碼 - use encoding 'big5', STDIN => 'big5', STDOUT => 'big5'; - print length("駱駝"); # 2 (雙引號表示字符) - print length('駱駝'); # 4 (單引號表示位元組) - print index("諄諄教誨", "彖帢"); # -1 (不包含此子字串) - print index('諄諄教誨', '彖帢'); # 1 (從第二個位元組開始) - -在最後一列例子裡, "諄" 的第二個位元組與 "諄" 的第一個位元組結合成 Big5 -碼的 "彖"; "諄" 的第二個位元組則與 "教" 的第一個位元組結合成 "帢". -這解決了以前 Big5 碼比對處理上常見的問題. + use utf8; + print length("駱駝"); # 2 (不是 6) + print index("諄諄教誨", "教誨"); # 2 (從 0 起算第 2 個字符) + =head2 額外的中文編碼 @@ -155,7 +151,7 @@ L =head1 SEE ALSO -L, L, L, L, L +L, L, L, L =head1 AUTHORS Index: gnu/usr.bin/perl/README.vms =================================================================== RCS file: /mnt/memory/perl/importit/cvs/src/gnu/usr.bin/perl/README.vms,v retrieving revision 1.16 diff -u -p -u -p -r1.16 README.vms --- gnu/usr.bin/perl/README.vms 24 Mar 2014 15:05:13 -0000 1.16 +++ gnu/usr.bin/perl/README.vms 16 Nov 2014 03:22:23 -0000 @@ -142,11 +142,11 @@ You may need to set up a foreign symbol choice. Once you have done so, use a command like the following to unpack the archive: - vmstar -xvf perl-5^.18^.2.tar + vmstar -xvf perl-5^.20^.1.tar Then set default to the top-level source directory like so: - set default [.perl-5^.18^.2] + set default [.perl-5^.20^.1] and proceed with configuration as described in the next section. Index: gnu/usr.bin/perl/README.win32 =================================================================== RCS file: /mnt/memory/perl/importit/cvs/src/gnu/usr.bin/perl/README.win32,v retrieving revision 1.14 diff -u -p -u -p -r1.14 README.win32 --- gnu/usr.bin/perl/README.win32 24 Mar 2014 15:05:13 -0000 1.14 +++ gnu/usr.bin/perl/README.win32 16 Nov 2014 03:22:23 -0000 @@ -40,7 +40,8 @@ system). Currently, this port is capabl following compilers on the Intel x86 architecture: Microsoft Visual C++ version 6.0 or later - Gcc by mingw.org gcc version 3.2 or later + Intel C++ Compiler (experimental) + Gcc by mingw.org gcc version 3.4.5 or later Gcc by mingw-w64.sf.net gcc version 4.4.3 or later Note that the last two of these are actually competing projects both @@ -62,10 +63,10 @@ that are also supported by perl's makefi =back The Microsoft Visual C++ compilers are also now being given away free. They are -available as "Visual C++ Toolkit 2003" or "Visual C++ 2005/2008/2010/2012 Express +available as "Visual C++ Toolkit 2003" or "Visual C++ 2005-2013 Express Edition" (and also as part of the ".NET Framework SDK") and are the same compilers that ship with "Visual C++ .NET 2003 Professional" or "Visual C++ -2005/2008/2010/2012 Professional" respectively. +2005-2013 Professional" respectively. This port can also be built on IA64/AMD64 using: @@ -131,9 +132,9 @@ and edit win32/config.vc to change "make latter step is only essential if you want to use dmake as your default make for building extensions using MakeMaker. -=item Microsoft Visual C++ 2008/2010/2012 Express Edition +=item Microsoft Visual C++ 2008-2013 Express Edition -These free versions of Visual C++ 2008/2010/2012 Professional contain the same +These free versions of Visual C++ 2008-2013 Professional contain the same compilers and linkers that ship with the full versions, and also contain everything necessary to build Perl, rather than requiring a separate download of the Windows SDK like previous versions did. @@ -143,14 +144,14 @@ L You also need dmake. See L above on how to get it. +=item Intel C++ Compiler + +Experimental support for using Intel C++ Compiler has been added. Edit +win32/Makefile and pick the correct CCTYPE for the Visual C that Intel C was +installed into. Also uncomment __ICC to enable Intel C on Visual C support. +To set up the build enviroment, from the Start Menu run +IA-32 Visual Studio 20__ mode or Intel 64 Visual Studio 20__ mode as +appropriate. Then run nmake as usually in that prompt box. + +Only Intel C++ Compiler v12.1 has been tested. Other versions probably will +work. + =back =head2 Building @@ -360,6 +373,9 @@ the linker reports an internal error. If you want build some core extensions statically into perl's dll, specify them in the STATIC_EXT macro. +NOTE: The USE_64_BIT_INT build option is not supported with the 32-bit +Visual C++ 6.0 compiler. + Be sure to read the instructions near the top of the makefiles carefully. =item * @@ -367,7 +383,7 @@ Be sure to read the instructions near th Type "dmake" (or "nmake" if you are using that make). This should build everything. Specifically, it will create perl.exe, -perl518.dll at the perl toplevel, and various other extension dll's +perl520.dll at the perl toplevel, and various other extension dll's under the lib\auto directory. If the build fails for any reason, make sure you have done the previous steps correctly. @@ -380,6 +396,19 @@ the testsuite (many tests will be skippe There should be no test failures. +If you build with Visual C++ 2013 then three tests currently may fail with +Daylight Saving Time related problems: F, +F and F. The failures are +caused by bugs in the CRT in VC++ 2013 which will be fixed in future releases +of VC++, as explained by Microsoft here: +L. In the meantime, +if you need fixed C and C functions then have a look at the +CPAN distribution Win32::UTCFileTime. + +If you build with certain versions (e.g. 4.8.1) of gcc from www.mingw.org then +F may fail test 17 due to a known bug in those gcc builds: +see L. + Some test failures may occur if you use a command shell other than the native "cmd.exe", or if you are building from a path that contains spaces. So don't do that. @@ -387,10 +416,6 @@ spaces. So don't do that. If you are running the tests from a emacs shell window, you may see failures in op/stat.t. Run "dmake test-notty" in that case. -If you run the tests on a FAT partition, you may see some failures for -C related tests (I, I ...). Testing on -NTFS avoids these errors. - Furthermore, you should make sure that during C you do not have any GNU tool packages in your path: some toolkits like Unixutils include some tools (C for instance) which override the Windows @@ -890,6 +915,6 @@ Win9x support was added in 5.6 (Benjamin Support for 64-bit Windows added in 5.8 (ActiveState Corp). -Last updated: 02 January 2012 +Last updated: 22 October 2013 =cut Index: gnu/usr.bin/perl/XSUB.h =================================================================== RCS file: /mnt/memory/perl/importit/cvs/src/gnu/usr.bin/perl/XSUB.h,v retrieving revision 1.15 diff -u -p -u -p -r1.15 XSUB.h --- gnu/usr.bin/perl/XSUB.h 24 Mar 2014 15:05:13 -0000 1.15 +++ gnu/usr.bin/perl/XSUB.h 16 Nov 2014 03:22:23 -0000 @@ -22,7 +22,7 @@ class name for a C++ XS constructor. Th =for apidoc Amn|(whatever)|RETVAL Variable which is setup by C to hold the return value for an -XSUB. This is always the proper type for the XSUB. See +XSUB. This is always the proper type for the XSUB. See L. =for apidoc Amn|(whatever)|THIS @@ -48,7 +48,7 @@ Used to access elements on the XSUB's st =for apidoc AmU||XS Macro to declare an XSUB and its C parameter list. This is handled by -C. It is the same as using the more explicit XS_EXTERNAL macro. +C. It is the same as using the more explicit XS_EXTERNAL macro. =for apidoc AmU||XS_INTERNAL Macro to declare an XSUB and its C parameter list without exporting the symbols. @@ -80,12 +80,12 @@ Sets up the C variable for an XSUB w handled automatically by C. =for apidoc Ams||dUNDERBAR -Sets up any variable needed by the C macro. It used to define -C, but it is currently a noop. However, it is strongly advised +Sets up any variable needed by the C macro. It used to define +C, but it is currently a noop. However, it is strongly advised to still use it for ensuring past and future compatibility. =for apidoc AmU||UNDERBAR -The SV* corresponding to the $_ variable. Works even if there +The SV* corresponding to the $_ variable. Works even if there is a lexical $_ in scope. =cut Index: gnu/usr.bin/perl/autodoc.pl =================================================================== RCS file: /mnt/memory/perl/importit/cvs/src/gnu/usr.bin/perl/autodoc.pl,v retrieving revision 1.1.1.10 diff -u -p -u -p -r1.1.1.10 autodoc.pl --- gnu/usr.bin/perl/autodoc.pl 24 Mar 2014 14:58:42 -0000 1.1.1.10 +++ gnu/usr.bin/perl/autodoc.pl 16 Nov 2014 03:22:23 -0000 @@ -13,8 +13,7 @@ # Has an optional arg, which is the directory to chdir to before reading # MANIFEST and *.[ch]. # -# This script is normally invoked as part of 'make all', but is also -# called from from regen.pl. +# This script is invoked as part of 'make all' # # '=head1' are the only headings looked for. If the next line after the # heading begins with a word character, it is considered to be the first line @@ -25,6 +24,14 @@ use strict; +if (@ARGV) { + my $workdir = shift; + chdir $workdir + or die "Couldn't chdir to '$workdir': $!"; +} +require 'regen/regen_lib.pl'; +require 'regen/embed_lib.pl'; + # # See database of global and static function prototypes in embed.fnc # This is used to generate prototype headers under various configurations, @@ -113,6 +120,7 @@ DOC: if ($docref and %$docref) { $embed_where = $docref->{flags} =~ /A/ ? 'api' : 'guts'; $embed_may_change = $docref->{flags} =~ /M/; + $flags .= 'D' if $docref->{flags} =~ /D/; } else { $missing{$name} = $file; } @@ -171,8 +179,15 @@ sub docout ($$$) { # output the docs for my($flags, $docs, $ret, $file, @args) = @$docref; $name =~ s/\s*$//; - $docs .= "NOTE: this function is experimental and may change or be -removed without notice.\n\n" if $flags =~ /x/; + if ($flags =~ /D/) { + $docs = "\n\nDEPRECATED! It is planned to remove this function from a +future release of Perl. Do not use it for new code; remove it from +existing code.\n\n$docs"; + } + else { + $docs = "\n\nNOTE: this function is experimental and may change or be +removed without notice.\n\n$docs" if $flags =~ /x/; + } $docs .= "NOTE: the perl_ form of this function is deprecated.\n\n" if $flags =~ /p/; $docs .= "NOTE: this function must be explicitly called as Perl_$name with an aTHX_ parameter.\n\n" @@ -236,17 +251,11 @@ removed without notice.\n\n" if $flags = sub output { my ($podname, $header, $dochash, $missing, $footer) = @_; - my $filename = "pod/$podname.pod"; - open my $fh, '>', $filename or die "Can't open $filename: $!"; - - print $fh <<"_EOH_", $header; --*- buffer-read-only: t -*- + my $fh = open_new("pod/$podname.pod", undef, + {by => "$0 extracting documentation", + from => 'the C source files'}, 1); -!!!!!!! DO NOT EDIT THIS FILE !!!!!!! -This file is built by $0 extracting documentation from the C source -files. - -_EOH_ + print $fh $header; my $key; # case insensitive sort, with fallback for determinacy @@ -273,13 +282,14 @@ _EOH_ print $fh "\n=head1 Undocumented functions\n\n"; print $fh $podname eq 'perlapi' ? <<'_EOB_' : <<'_EOB_'; The following functions have been flagged as part of the public API, -but are currently undocumented. Use them at your own risk, as the +but are currently undocumented. Use them at your own risk, as the interfaces are subject to change. Functions that are not listed in this document are not intended for public use, and should NOT be used under any circumstances. If you use one of the undocumented functions below, you may wish to consider -creating and submitting documentation for it. If your patch is accepted, this +creating and submitting documentation +for it. If your patch is accepted, this will indicate that the interface is stable (unless it is explicitly marked otherwise). @@ -298,41 +308,15 @@ _EOB_ } print $fh "=back\n\n"; } + print $fh $footer, "=cut\n"; -print $fh $footer, <<'_EOF_'; -=cut - - ex: set ro: -_EOF_ - - close $fh or die "Can't close $filename: $!"; + read_only_bottom_close_and_rename($fh); } -if (@ARGV) { - my $workdir = shift; - chdir $workdir - or die "Couldn't chdir to '$workdir': $!"; -} - -open IN, "embed.fnc" or die $!; - -while () { - chomp; - next if /^:/; - while (s|\\\s*$||) { - $_ .= ; - chomp; - } - s/\s+$//; - next if /^\s*(#|$)/; - - my ($flags, $retval, $func, @args) = split /\s*\|\s*/, $_; - - next unless $func; - - s/\b(NN|NULLOK)\b\s+//g for @args; - $func =~ s/\t//g; # clean up fields from embed.pl - $retval =~ s/\t//; +foreach (@{(setup_embed())[0]}) { + next if @$_ < 2; + my ($flags, $retval, $func, @args) = @$_; + s/\b(?:NN|NULLOK)\b\s+//g for @args; $funcflags{$func} = { flags => $flags, @@ -341,21 +325,19 @@ while () { }; } -my $file; # glob() picks up docs from extra .c or .h files that may be in unclean # development trees. -my $MANIFEST = do { - local ($/, *FH); - open FH, "MANIFEST" or die "Can't open MANIFEST: $!"; - ; -}; +open my $fh, '<', 'MANIFEST' + or die "Can't open MANIFEST: $!"; +while (my $line = <$fh>) { + next unless my ($file) = $line =~ /^(\S+\.[ch])\t/; -for $file (($MANIFEST =~ /^(\S+\.c)\t/gm), ($MANIFEST =~ /^(\S+\.h)\t/gm)) { open F, "< $file" or die "Cannot open $file for docs: $!\n"; $curheader = "Functions in file $file\n"; autodoc(\*F,$file); close F or die "Error closing $file: $!\n"; } +close $fh or die "Error whilst reading MANIFEST: $!"; for (sort keys %funcflags) { next unless $funcflags{$_}{flags} =~ /d/; @@ -374,8 +356,9 @@ foreach (sort keys %missing) { # walk table providing an array of components in each line to # subroutine, printing the result -# List of funcs in the public API that aren't also marked as experimental. -my @missing_api = grep $funcflags{$_}{flags} =~ /A/ && $funcflags{$_}{flags} !~ /M/ && !$docs{api}{$_}, keys %funcflags; +# List of funcs in the public API that aren't also marked as experimental nor +# deprecated. +my @missing_api = grep $funcflags{$_}{flags} =~ /A/ && $funcflags{$_}{flags} !~ /[MD]/ && !$docs{api}{$_}, keys %funcflags; output('perlapi', <<'_EOB_', $docs{api}, \@missing_api, <<'_EOE_'); =head1 NAME @@ -388,13 +371,15 @@ This file contains the documentation of F, specifically a listing of functions, macros, flags, and variables that may be used by extension writers. L is a list of functions which have yet to be documented. The interfaces of -those are subject to change without notice. Any functions not listed here are +those are subject to change without notice. Anything not listed here is not part of the public API, and should not be used by extension writers at all. For these reasons, blindly using functions listed in proto.h is to be avoided when writing extensions. Note that all Perl API global variables must be referenced with the C -prefix. Some macros are provided for compatibility with the older, +prefix. Again, those not listed here are not to be used by extension writers, +and can be changed or removed without notice; same with macros. +Some macros are provided for compatibility with the older, unadorned names, but this support may be disabled in a future release. Perl was originally written to handle US-ASCII only (that is characters @@ -454,7 +439,7 @@ X X! END @@ -462,7 +447,7 @@ END =head1 AUTHORS The autodocumentation system was originally added to the Perl core by -Benjamin Stuhl. Documentation is by whoever was kind enough to +Benjamin Stuhl. Documentation is by whoever was kind enough to document their functions. =head1 SEE ALSO Index: gnu/usr.bin/perl/av.c =================================================================== RCS file: /mnt/memory/perl/importit/cvs/src/gnu/usr.bin/perl/av.c,v retrieving revision 1.15 diff -u -p -u -p -r1.15 av.c --- gnu/usr.bin/perl/av.c 24 Mar 2014 15:05:13 -0000 1.15 +++ gnu/usr.bin/perl/av.c 16 Nov 2014 03:22:23 -0000 @@ -27,7 +27,7 @@ void Perl_av_reify(pTHX_ AV *av) { dVAR; - I32 key; + SSize_t key; PERL_ARGS_ASSERT_AV_REIFY; assert(SvTYPE(av) == SVt_PVAV); @@ -40,16 +40,15 @@ Perl_av_reify(pTHX_ AV *av) #endif key = AvMAX(av) + 1; while (key > AvFILLp(av) + 1) - AvARRAY(av)[--key] = &PL_sv_undef; + AvARRAY(av)[--key] = NULL; while (key) { SV * const sv = AvARRAY(av)[--key]; - assert(sv); if (sv != &PL_sv_undef) - SvREFCNT_inc_simple_void_NN(sv); + SvREFCNT_inc_simple_void(sv); } key = AvARRAY(av) - AvALLOC(av); while (key) - AvALLOC(av)[--key] = &PL_sv_undef; + AvALLOC(av)[--key] = NULL; AvREIFY_off(av); AvREAL_on(av); } @@ -64,7 +63,7 @@ extended. */ void -Perl_av_extend(pTHX_ AV *av, I32 key) +Perl_av_extend(pTHX_ AV *av, SSize_t key) { dVAR; MAGIC *mg; @@ -76,7 +75,7 @@ Perl_av_extend(pTHX_ AV *av, I32 key) if (mg) { SV *arg1 = sv_newmortal(); sv_setiv(arg1, (IV)(key + 1)); - Perl_magic_methcall(aTHX_ MUTABLE_SV(av), mg, "EXTEND", G_DISCARD, 1, + Perl_magic_methcall(aTHX_ MUTABLE_SV(av), mg, SV_CONST(EXTEND), G_DISCARD, 1, arg1); return; } @@ -85,7 +84,7 @@ Perl_av_extend(pTHX_ AV *av, I32 key) /* The guts of av_extend. *Not* for general use! */ void -Perl_av_extend_guts(pTHX_ AV *av, I32 key, SSize_t *maxp, SV ***allocp, +Perl_av_extend_guts(pTHX_ AV *av, SSize_t key, SSize_t *maxp, SV ***allocp, SV ***arrayp) { dVAR; @@ -94,8 +93,8 @@ Perl_av_extend_guts(pTHX_ AV *av, I32 ke if (key > *maxp) { SV** ary; - I32 tmp; - I32 newmax; + SSize_t tmp; + SSize_t newmax; if (av && *allocp != *arrayp) { ary = *allocp + AvFILLp(av) + 1; @@ -105,7 +104,7 @@ Perl_av_extend_guts(pTHX_ AV *av, I32 ke *arrayp = *allocp; if (AvREAL(av)) { while (tmp) - ary[--tmp] = &PL_sv_undef; + ary[--tmp] = NULL; } if (key > *maxp - 10) { newmax = key + *maxp; @@ -113,11 +112,6 @@ Perl_av_extend_guts(pTHX_ AV *av, I32 ke } } else { -#ifdef PERL_MALLOC_WRAP - static const char oom_array_extend[] = - "Out of memory during array extend"; /* Duplicated in pp_hot.c */ -#endif - if (*allocp) { #ifdef Perl_safesysmalloc_size @@ -126,7 +120,7 @@ Perl_av_extend_guts(pTHX_ AV *av, I32 ke based on calling Perl_safesysmalloc_size() immediately after allocation, I'm not convinced that it is a great idea here. In an array we have to loop round setting everything to - &PL_sv_undef, which means writing to memory, potentially lots + NULL, which means writing to memory, potentially lots of it, whereas for the SV buffer case we don't touch the "bonus" memory. So there there is no cost in telling the world about it, whereas here we have to do work before we can @@ -142,8 +136,23 @@ Perl_av_extend_guts(pTHX_ AV *av, I32 ke #endif newmax = key + *maxp / 5; resize: - MEM_WRAP_CHECK_1(newmax+1, SV*, oom_array_extend); + { +#ifdef PERL_MALLOC_WRAP /* Duplicated in pp_hot.c */ + static const char oom_array_extend[] = + "Out of memory during array extend"; +#endif + MEM_WRAP_CHECK_1(newmax+1, SV*, oom_array_extend); + } +#ifdef STRESS_REALLOC + { + SV ** const old_alloc = *allocp; + Newx(*allocp, newmax+1, SV*); + Copy(old_alloc, *allocp, *maxp + 1, SV*); + Safefree(old_alloc); + } +#else Renew(*allocp,newmax+1, SV*); +#endif #ifdef Perl_safesysmalloc_size resized: #endif @@ -157,15 +166,21 @@ Perl_av_extend_guts(pTHX_ AV *av, I32 ke } else { newmax = key < 3 ? 3 : key; - MEM_WRAP_CHECK_1(newmax+1, SV*, oom_array_extend); + { +#ifdef PERL_MALLOC_WRAP /* Duplicated in pp_hot.c */ + static const char oom_array_extend[] = + "Out of memory during array extend"; +#endif + MEM_WRAP_CHECK_1(newmax+1, SV*, oom_array_extend); + } Newx(*allocp, newmax+1, SV*); ary = *allocp + 1; tmp = newmax; - *allocp[0] = &PL_sv_undef; /* For the stacks */ + *allocp[0] = NULL; /* For the stacks */ } if (av && AvREAL(av)) { while (tmp) - ary[--tmp] = &PL_sv_undef; + ary[--tmp] = NULL; } *arrayp = *allocp; @@ -191,7 +206,7 @@ The rough perl equivalent is C<$myarray[ */ static bool -S_adjust_index(pTHX_ AV *av, const MAGIC *mg, I32 *keyp) +S_adjust_index(pTHX_ AV *av, const MAGIC *mg, SSize_t *keyp) { bool adjust_index = 1; if (mg) { @@ -202,7 +217,8 @@ S_adjust_index(pTHX_ AV *av, const MAGIC SV * const * const negative_indices_glob = hv_fetchs(SvSTASH(SvRV(ref)), NEGATIVE_INDICES_VAR, 0); - if (negative_indices_glob && SvTRUE(GvSV(*negative_indices_glob))) + if (negative_indices_glob && isGV(*negative_indices_glob) + && SvTRUE(GvSV(*negative_indices_glob))) adjust_index = 0; } } @@ -216,7 +232,7 @@ S_adjust_index(pTHX_ AV *av, const MAGIC } SV** -Perl_av_fetch(pTHX_ AV *av, I32 key, I32 lval) +Perl_av_fetch(pTHX_ AV *av, SSize_t key, I32 lval) { dVAR; @@ -250,7 +266,7 @@ Perl_av_fetch(pTHX_ AV *av, I32 key, I32 return NULL; } - if (key > AvFILLp(av) || AvARRAY(av)[key] == &PL_sv_undef) { + if (key > AvFILLp(av) || !AvARRAY(av)[key]) { emptyness: return lval ? av_store(av,key,newSV(0)) : NULL; } @@ -258,7 +274,7 @@ Perl_av_fetch(pTHX_ AV *av, I32 key, I32 if (AvREIFY(av) && (!AvARRAY(av)[key] /* eg. @_ could have freed elts */ || SvIS_FREED(AvARRAY(av)[key]))) { - AvARRAY(av)[key] = &PL_sv_undef; /* 1/2 reify */ + AvARRAY(av)[key] = NULL; /* 1/2 reify */ goto emptyness; } return &AvARRAY(av)[key]; @@ -270,7 +286,7 @@ Perl_av_fetch(pTHX_ AV *av, I32 key, I32 Stores an SV in an array. The array index is specified as C. The return value will be NULL if the operation failed or if the value did not need to be actually stored within the array (as in the case of tied -arrays). Otherwise, it can be dereferenced +arrays). Otherwise, it can be dereferenced to get the C that was stored there (= C)). @@ -287,7 +303,7 @@ more information on how to use this func */ SV** -Perl_av_store(pTHX_ AV *av, I32 key, SV *val) +Perl_av_store(pTHX_ AV *av, SSize_t key, SV *val) { dVAR; SV** ary; @@ -299,9 +315,6 @@ Perl_av_store(pTHX_ AV *av, I32 key, SV (unicode_alternate may be NULL). */ - if (!val) - val = &PL_sv_undef; - if (SvRMAGICAL(av)) { const MAGIC * const tied_magic = mg_find((const SV *)av, PERL_MAGIC_tied); if (tied_magic) { @@ -309,7 +322,7 @@ Perl_av_store(pTHX_ AV *av, I32 key, SV if (!S_adjust_index(aTHX_ av, tied_magic, &key)) return 0; } - if (val != &PL_sv_undef) { + if (val) { mg_copy(MUTABLE_SV(av), val, 0, key); } return NULL; @@ -336,7 +349,7 @@ Perl_av_store(pTHX_ AV *av, I32 key, SV if (av == PL_curstack && key > PL_stack_sp - PL_stack_base) PL_stack_sp = PL_stack_base + key; /* XPUSH in disguise */ do { - ary[++AvFILLp(av)] = &PL_sv_undef; + ary[++AvFILLp(av)] = NULL; } while (AvFILLp(av) < key); } AvFILLp(av) = key; @@ -349,7 +362,7 @@ Perl_av_store(pTHX_ AV *av, I32 key, SV bool set = TRUE; for (; mg; mg = mg->mg_moremagic) { if (!isUPPER(mg->mg_type)) continue; - if (val != &PL_sv_undef) { + if (val) { sv_magic(val, MUTABLE_SV(av), toLOWER(mg->mg_type), 0, key); } if (PL_delaymagic && mg->mg_type == PERL_MAGIC_isa) { @@ -376,7 +389,7 @@ Perl equivalent: C 0 ? i : 0; + const SSize_t slide = i > 0 ? i : 0; num += slide; av_extend(av, i + num); AvFILLp(av) += num; ary = AvARRAY(av); Move(ary, ary + num, i + 1, SV*); do { - ary[--num] = &PL_sv_undef; + ary[--num] = NULL; } while (num); /* Make extra elements into a buffer */ AvMAX(av) -= slide; @@ -697,9 +710,9 @@ Perl_av_unshift(pTHX_ AV *av, I32 num) /* =for apidoc av_shift -Shifts an SV off the beginning of the -array. Returns C<&PL_sv_undef> if the -array is empty. +Removes one SV from the start of the array, reducing its size by one and +returning the SV (transferring control of one reference count) to the +caller. Returns C<&PL_sv_undef> if the array is empty. Perl equivalent: C @@ -719,7 +732,7 @@ Perl_av_shift(pTHX_ AV *av) if (SvREADONLY(av)) Perl_croak_no_modify(); if ((mg = SvTIED_mg((const SV *)av, PERL_MAGIC_tied))) { - retval = Perl_magic_methcall(aTHX_ MUTABLE_SV(av), mg, "SHIFT", 0, 0); + retval = Perl_magic_methcall(aTHX_ MUTABLE_SV(av), mg, SV_CONST(SHIFT), 0, 0); if (retval) retval = newSVsv(retval); return retval; @@ -728,13 +741,13 @@ Perl_av_shift(pTHX_ AV *av) return &PL_sv_undef; retval = *AvARRAY(av); if (AvREAL(av)) - *AvARRAY(av) = &PL_sv_undef; + *AvARRAY(av) = NULL; AvARRAY(av) = AvARRAY(av) + 1; AvMAX(av)--; AvFILLp(av)--; if (SvSMAGICAL(av)) mg_set(MUTABLE_SV(av)); - return retval; + return retval ? retval : &PL_sv_undef; } /* @@ -747,16 +760,21 @@ The Perl equivalent for this is C<$#myar (A slightly shorter form is C.) +=for apidoc av_tindex + +Same as L. + =for apidoc av_len -Same as L. Returns the highest index in the array. Note that the -return value is +1 what its name implies it returns; and hence differs in -meaning from what the similarly named L returns. +Same as L. Note that, unlike what the name implies, it returns +the highest index in the array, so to get the size of the array you need to use +S>. This is unlike L, which returns what you would +expect. =cut */ -I32 +SSize_t Perl_av_len(pTHX_ AV *av) { PERL_ARGS_ASSERT_AV_LEN; @@ -770,16 +788,16 @@ Perl_av_len(pTHX_ AV *av) Set the highest index in the array to the given number, equivalent to Perl's C<$#array = $fill;>. -The number of elements in the an array will be C after +The number of elements in the array will be C after av_fill() returns. If the array was previously shorter, then the -additional elements appended are set to C. If the array +additional elements appended are set to NULL. If the array was longer, then the excess elements are freed. C is the same as C. =cut */ void -Perl_av_fill(pTHX_ AV *av, I32 fill) +Perl_av_fill(pTHX_ AV *av, SSize_t fill) { dVAR; MAGIC *mg; @@ -792,23 +810,23 @@ Perl_av_fill(pTHX_ AV *av, I32 fill) if ((mg = SvTIED_mg((const SV *)av, PERL_MAGIC_tied))) { SV *arg1 = sv_newmortal(); sv_setiv(arg1, (IV)(fill + 1)); - Perl_magic_methcall(aTHX_ MUTABLE_SV(av), mg, "STORESIZE", G_DISCARD, + Perl_magic_methcall(aTHX_ MUTABLE_SV(av), mg, SV_CONST(STORESIZE), G_DISCARD, 1, arg1); return; } if (fill <= AvMAX(av)) { - I32 key = AvFILLp(av); + SSize_t key = AvFILLp(av); SV** const ary = AvARRAY(av); if (AvREAL(av)) { while (key > fill) { SvREFCNT_dec(ary[key]); - ary[key--] = &PL_sv_undef; + ary[key--] = NULL; } } else { while (key < fill) - ary[++key] = &PL_sv_undef; + ary[++key] = NULL; } AvFILLp(av) = fill; @@ -816,7 +834,7 @@ Perl_av_fill(pTHX_ AV *av, I32 fill) mg_set(MUTABLE_SV(av)); } else - (void)av_store(av,fill,&PL_sv_undef); + (void)av_store(av,fill,NULL); } /* @@ -831,7 +849,7 @@ C version. =cut */ SV * -Perl_av_delete(pTHX_ AV *av, I32 key, I32 flags) +Perl_av_delete(pTHX_ AV *av, SSize_t key, I32 flags) { dVAR; SV *sv; @@ -877,13 +895,13 @@ Perl_av_delete(pTHX_ AV *av, I32 key, I3 av_reify(av); sv = AvARRAY(av)[key]; if (key == AvFILLp(av)) { - AvARRAY(av)[key] = &PL_sv_undef; + AvARRAY(av)[key] = NULL; do { AvFILLp(av)--; - } while (--key >= 0 && AvARRAY(av)[key] == &PL_sv_undef); + } while (--key >= 0 && !AvARRAY(av)[key]); } else - AvARRAY(av)[key] = &PL_sv_undef; + AvARRAY(av)[key] = NULL; if (SvSMAGICAL(av)) mg_set(MUTABLE_SV(av)); } @@ -902,14 +920,14 @@ Perl_av_delete(pTHX_ AV *av, I32 key, I3 Returns true if the element indexed by C has been initialized. This relies on the fact that uninitialized array elements are set to -C<&PL_sv_undef>. +NULL. Perl equivalent: C. =cut */ bool -Perl_av_exists(pTHX_ AV *av, I32 key) +Perl_av_exists(pTHX_ AV *av, SSize_t key) { dVAR; PERL_ARGS_ASSERT_AV_EXISTS; @@ -955,8 +973,7 @@ Perl_av_exists(pTHX_ AV *av, I32 key) return FALSE; } - if (key <= AvFILLp(av) && AvARRAY(av)[key] != &PL_sv_undef - && AvARRAY(av)[key]) + if (key <= AvFILLp(av) && AvARRAY(av)[key]) { return TRUE; } Index: gnu/usr.bin/perl/av.h =================================================================== RCS file: /mnt/memory/perl/importit/cvs/src/gnu/usr.bin/perl/av.h,v retrieving revision 1.12 diff -u -p -u -p -r1.12 av.h --- gnu/usr.bin/perl/av.h 24 Mar 2014 15:05:13 -0000 1.12 +++ gnu/usr.bin/perl/av.h 16 Nov 2014 03:22:23 -0000 @@ -73,6 +73,9 @@ Same as C. #define AvREIFY_on(av) (SvFLAGS(av) |= SVpav_REIFY) #define AvREIFY_off(av) (SvFLAGS(av) &= ~SVpav_REIFY) #define AvREIFY_only(av) (AvREAL_off(av), SvFLAGS(av) |= SVpav_REIFY) +#define AvPAD_NAMELIST(av) (SvFLAGS(av) & SVpad_NAMELIST) +#define AvPAD_NAMELIST_on(av) (SvFLAGS(av) |= SVpad_NAMELIST) + #define AvREALISH(av) (SvFLAGS(av) & (SVpav_REAL|SVpav_REIFY)) Index: gnu/usr.bin/perl/caretx.c =================================================================== RCS file: gnu/usr.bin/perl/caretx.c diff -N gnu/usr.bin/perl/caretx.c --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ gnu/usr.bin/perl/caretx.c 16 Nov 2014 03:22:23 -0000 @@ -0,0 +1,140 @@ +/* caretx.c + * + * Copyright (C) 2013 + * by Larry Wall and others + * + * You may distribute under the terms of either the GNU General Public + * License or the Artistic License, as specified in the README file. + * + */ + +/* + * 'I do not know clearly,' said Frodo; 'but the path climbs, I think, + * up into the mountains on the northern side of that vale where the old + * city stands. It goes up to a high cleft and so down to -- that which + * is beyond.' + * 'Do you know the name of that high pass?' said Faramir. + * + * [p.691 of _The Lord of the Rings_, IV/xi: "The Forbidden Pool"] + */ + +/* This file contains a single function, set_caret_X, to set the $^X + * variable. It's only used in perl.c, but has various OS dependencies, + * so its been moved to its own file to reduce header pollution. + * See RT 120314 for details. + */ + +#if defined(PERL_IS_MINIPERL) && !defined(USE_SITECUSTOMIZE) +# define USE_SITECUSTOMIZE +#endif + +#include "EXTERN.h" +#include "perl.h" +#include "XSUB.h" + +#ifdef NETWARE +#include "nwutil.h" +#endif + +#ifdef USE_KERN_PROC_PATHNAME +# include +#endif + +#ifdef USE_NSGETEXECUTABLEPATH +# include +#endif + +/* Note: Functions in this file must not have bool parameters. When + PERL_BOOL_AS_CHAR is #defined, mach-o/dyld.h overrides it in this file + by #including stdbool.h, so the function parameters here would conflict + with those in proto.h. +*/ + +void +Perl_set_caret_X(pTHX) { + dVAR; + GV* tmpgv = gv_fetchpvs("\030", GV_ADD|GV_NOTQUAL, SVt_PV); /* $^X */ + if (tmpgv) { + SV *const caret_x = GvSV(tmpgv); +#if defined(OS2) + sv_setpv(caret_x, os2_execname(aTHX)); +#else +# ifdef USE_KERN_PROC_PATHNAME + size_t size = 0; + int mib[4]; + mib[0] = CTL_KERN; + mib[1] = KERN_PROC; + mib[2] = KERN_PROC_PATHNAME; + mib[3] = -1; + + if (sysctl(mib, 4, NULL, &size, NULL, 0) == 0 + && size > 0 && size < MAXPATHLEN * MAXPATHLEN) { + sv_grow(caret_x, size); + + if (sysctl(mib, 4, SvPVX(caret_x), &size, NULL, 0) == 0 + && size > 2) { + SvPOK_only(caret_x); + SvCUR_set(caret_x, size - 1); + SvTAINT(caret_x); + return; + } + } +# elif defined(USE_NSGETEXECUTABLEPATH) + char buf[1]; + uint32_t size = sizeof(buf); + + _NSGetExecutablePath(buf, &size); + if (size < MAXPATHLEN * MAXPATHLEN) { + sv_grow(caret_x, size); + if (_NSGetExecutablePath(SvPVX(caret_x), &size) == 0) { + char *const tidied = realpath(SvPVX(caret_x), NULL); + if (tidied) { + sv_setpv(caret_x, tidied); + free(tidied); + } else { + SvPOK_only(caret_x); + SvCUR_set(caret_x, size); + } + return; + } + } +# elif defined(HAS_PROCSELFEXE) + char buf[MAXPATHLEN]; + int len = readlink(PROCSELFEXE_PATH, buf, sizeof(buf) - 1); + + /* On Playstation2 Linux V1.0 (kernel 2.2.1) readlink(/proc/self/exe) + includes a spurious NUL which will cause $^X to fail in system + or backticks (this will prevent extensions from being built and + many tests from working). readlink is not meant to add a NUL. + Normal readlink works fine. + */ + if (len > 0 && buf[len-1] == '\0') { + len--; + } + + /* FreeBSD's implementation is acknowledged to be imperfect, sometimes + returning the text "unknown" from the readlink rather than the path + to the executable (or returning an error from the readlink). Any + valid path has a '/' in it somewhere, so use that to validate the + result. See http://www.freebsd.org/cgi/query-pr.cgi?pr=35703 + */ + if (len > 0 && memchr(buf, '/', len)) { + sv_setpvn(caret_x, buf, len); + return; + } +# endif + /* Fallback to this: */ + sv_setpv(caret_x, PL_origargv[0]); +#endif + } +} + +/* + * Local variables: + * c-indentation-style: bsd + * c-basic-offset: 4 + * indent-tabs-mode: nil + * End: + * + * ex: set ts=8 sts=4 sw=4 et: + */ Index: gnu/usr.bin/perl/cflags.SH =================================================================== RCS file: /mnt/memory/perl/importit/cvs/src/gnu/usr.bin/perl/cflags.SH,v retrieving revision 1.13 diff -u -p -u -p -r1.13 cflags.SH --- gnu/usr.bin/perl/cflags.SH 24 Mar 2014 15:05:13 -0000 1.13 +++ gnu/usr.bin/perl/cflags.SH 16 Nov 2014 03:22:23 -0000 @@ -1,5 +1,17 @@ #!/bin/sh +# Generate the cflags script, which is used to determine what cflags +# to pass to the compiler. +# We create a temporary test c program and repeatedly compile it with +# various candidate flags, and from the compiler output, determine what +# flags are supported. +# From this we initialise the following variables in the cflags script: +# +# $warn +# $stdflags +# $extra +# $_exe + case $PERL_CONFIG_SH in '') if test -f config.sh; then TOP=.; @@ -13,8 +25,8 @@ case $PERL_CONFIG_SH in . $TOP/config.sh ;; esac -: This forces SH files to create target in same directory as SH file. -: This is so that make depend always knows where to find SH derivatives. +# This forces SH files to create target in same directory as SH file. +# This is so that make depend always knows where to find SH derivatives. case "$0" in */*) cd `expr X$0 : 'X\(.*\)/'` ;; esac @@ -142,7 +154,7 @@ Intel*) ;; # # Is that you, Intel C++? case " $ccflags " in *" $opt "*) ;; # Skip if already there. *) rm -f _cflags$_exe - case "`$cc -DPERL_NO_INLINE_FUNCTIONS $cflags $warn $stdflags $opt _cflags.c -o _cflags$_exe 2>&1`" in + case "`$cc -DPERL_NO_INLINE_FUNCTIONS $ccflags $warn $stdflags $opt _cflags.c -o _cflags$_exe 2>&1`" in *"unrecognized"*) ;; *"implicit declaration"*) ;; # Was something useful hidden? *"Invalid"*) ;; @@ -202,14 +214,19 @@ esac extra='' echo "Extracting cflags (with variable substitutions)" -: This section of the file will have variable substitutions done on it. -: Move anything that needs config subs from !NO!SUBS! section to !GROK!THIS!. -: Protect any dollar signs and backticks that you do not want interpreted -: by putting a backslash in front. You may delete these comments. +# This section of the file will have variable substitutions done on it. +# Move anything that needs config subs from !NO!SUBS! section to !GROK!THIS!. +# Protect any dollar signs and backticks that you do not want interpreted +# by putting a backslash in front. You may delete these comments. rm -f cflags $spitshell >cflags <>cflags <<'!NO!SUBS!' case $PERL_CONFIG_SH in '') @@ -237,8 +254,13 @@ case $PERL_CONFIG_SH in ;; esac -: syntax: cflags [optimize=XXX] [file[.suffix]] -: displays the compiler command line for file +# syntax: cflags [optimize=XXX] [file[.suffix]] ... +# displays the proposed compiler command line for each 'file' +# +# with no file, dispalys it for all *.c files. +# The optimise=XXX arg (if present) is evalled, setting the default +# value of the $optimise variable, which is output on the command line +# (but which may be overridden for specific files below) case "X$1" in Xoptimize=*|X"optimize=*") @@ -247,11 +269,6 @@ Xoptimize=*|X"optimize=*") ;; esac -also=': ' -case $# in -1) also='echo 1>&2 " CCCMD = "' -esac - case $# in 0) set *.c; echo "The current C flags are:" ;; esac @@ -265,31 +282,31 @@ for file do *) echo $n " $file.c $c" ;; esac - : allow variables like toke_cflags to be evaluated + # allow variables like toke_cflags to be evaluated if echo $file | grep -v / >/dev/null then eval 'eval ${'"${file}_cflags"'-""}' fi - : or customize here + # or customize here case "$file" in *) ;; - *) : Customization examples follow: ;; + # Customization examples follow: av) ccflags=`echo $ccflags | sed -e s/-pipe//` ;; deb) ccflags="$ccflags -fno-jump-tables" ;; hv) warn=`echo $warn | sed -e s/-Wextra//` ;; toke) optimize=-O0 ;; esac - : The examples are intentionally unreachable as the '*)' case always - : matches. To use them, move before the '*)' and edit as appropriate. - : It is not a good idea to set ccflags to an absolute value here, as it - : often contains general -D defines which are needed for correct - : compilation. It is better to edit ccflags as shown, using interpolation - : to add flags, or sed to remove flags. + # The examples are intentionally unreachable as the '*)' case always + # matches. To use them, move before the '*)' and edit as appropriate. + # It is not a good idea to set ccflags to an absolute value here, as it + # often contains general -D defines which are needed for correct + # compilation. It is better to edit ccflags as shown, using interpolation + # to add flags, or sed to remove flags. case "$cc" in @@ -306,7 +323,7 @@ for file do cppflags=`echo $cppflags|sed 's/-Wdeclaration-after-statement/ /'` case "$cc" in - *clang) + *clang*) # clang complains a lot about -Wunused-value which are not fixable warn="$warn -Wno-unused-value" ;; @@ -327,12 +344,20 @@ for file do esac done ;; + *) + # clang may not be called clang + case "`$cc -v 2>&1`" in + *clang*) + case "$warn" in + *-Wno-unused-value) ;; + *) warn="$warn -Wno-unused-value" + esac + esac esac - : Can we perhaps use $ansi2knr here + # Can we perhaps use $ansi2knr here echo "$cc -c -DPERL_CORE $ccflags $stdflags $optimize $warn $extra" - eval "$also "'"$cc -DPERL_CORE -c $ccflags $stdflags $optimize $warn $extra"' . $TOP/config.sh Index: gnu/usr.bin/perl/charclass_invlists.h =================================================================== RCS file: /mnt/memory/perl/importit/cvs/src/gnu/usr.bin/perl/charclass_invlists.h,v retrieving revision 1.1.1.2 diff -u -p -u -p -r1.1.1.2 charclass_invlists.h --- gnu/usr.bin/perl/charclass_invlists.h 24 Mar 2014 14:58:43 -0000 1.1.1.2 +++ gnu/usr.bin/perl/charclass_invlists.h 16 Nov 2014 03:22:23 -0000 @@ -9,28 +9,25 @@ #ifndef PERL_IN_XSUB_RE -static UV Latin1_invlist[] = { +static const UV Latin1_invlist[] = { 2, /* Number of elements */ - 0, /* Current iteration position */ - 0, /* Cache of previous search index result */ - 290655244, /* Version and data structure type */ - 0, /* 0 if this is the first element of the list proper; - 1 if the next element is the first */ - 256, - 0 + 148565664, /* Version and data structure type */ + 0, /* 0 if the list starts at 0; + 1 if it starts at the element beyond 0 */ + 0, + 256 }; #endif #ifndef PERL_IN_XSUB_RE -static UV AboveLatin1_invlist[] = { - 1, /* Number of elements */ - 0, /* Current iteration position */ - 0, /* Cache of previous search index result */ - 290655244, /* Version and data structure type */ - 1, /* 0 if this is the first element of the list proper; - 1 if the next element is the first */ +static const UV AboveLatin1_invlist[] = { + 2, /* Number of elements */ + 148565664, /* Version and data structure type */ + 1, /* 0 if the list starts at 0; + 1 if it starts at the element beyond 0 */ + 0, 256 }; @@ -38,28 +35,25 @@ static UV AboveLatin1_invlist[] = { #ifndef PERL_IN_XSUB_RE -static UV ASCII_invlist[] = { +static const UV ASCII_invlist[] = { 2, /* Number of elements */ - 0, /* Current iteration position */ - 0, /* Cache of previous search index result */ - 290655244, /* Version and data structure type */ - 0, /* 0 if this is the first element of the list proper; - 1 if the next element is the first */ - 128, - 0 + 148565664, /* Version and data structure type */ + 0, /* 0 if the list starts at 0; + 1 if it starts at the element beyond 0 */ + 0, + 128 }; #endif #ifndef PERL_IN_XSUB_RE -static UV L1Cased_invlist[] = { - 16, /* Number of elements */ - 0, /* Current iteration position */ - 0, /* Cache of previous search index result */ - 290655244, /* Version and data structure type */ - 1, /* 0 if this is the first element of the list proper; - 1 if the next element is the first */ +static const UV Cased_invlist[] = { + 239, /* Number of elements */ + 148565664, /* Version and data structure type */ + 1, /* 0 if the list starts at 0; + 1 if it starts at the element beyond 0 */ + 0, 65, 91, 97, @@ -75,20 +69,241 @@ static UV L1Cased_invlist[] = { 216, 247, 248, - 443 + 443, + 444, + 448, + 452, + 660, + 661, + 697, + 704, + 706, + 736, + 741, + 837, + 838, + 880, + 884, + 886, + 888, + 890, + 894, + 902, + 903, + 904, + 907, + 908, + 909, + 910, + 930, + 931, + 1014, + 1015, + 1154, + 1162, + 1320, + 1329, + 1367, + 1377, + 1416, + 4256, + 4294, + 4295, + 4296, + 4301, + 4302, + 7424, + 7616, + 7680, + 7958, + 7960, + 7966, + 7968, + 8006, + 8008, + 8014, + 8016, + 8024, + 8025, + 8026, + 8027, + 8028, + 8029, + 8030, + 8031, + 8062, + 8064, + 8117, + 8118, + 8125, + 8126, + 8127, + 8130, + 8133, + 8134, + 8141, + 8144, + 8148, + 8150, + 8156, + 8160, + 8173, + 8178, + 8181, + 8182, + 8189, + 8305, + 8306, + 8319, + 8320, + 8336, + 8349, + 8450, + 8451, + 8455, + 8456, + 8458, + 8468, + 8469, + 8470, + 8473, + 8478, + 8484, + 8485, + 8486, + 8487, + 8488, + 8489, + 8490, + 8494, + 8495, + 8501, + 8505, + 8506, + 8508, + 8512, + 8517, + 8522, + 8526, + 8527, + 8544, + 8576, + 8579, + 8581, + 9398, + 9450, + 11264, + 11311, + 11312, + 11359, + 11360, + 11493, + 11499, + 11503, + 11506, + 11508, + 11520, + 11558, + 11559, + 11560, + 11565, + 11566, + 42560, + 42606, + 42624, + 42648, + 42786, + 42888, + 42891, + 42895, + 42896, + 42900, + 42912, + 42923, + 43000, + 43003, + 64256, + 64263, + 64275, + 64280, + 65313, + 65339, + 65345, + 65371, + 66560, + 66640, + 119808, + 119893, + 119894, + 119965, + 119966, + 119968, + 119970, + 119971, + 119973, + 119975, + 119977, + 119981, + 119982, + 119994, + 119995, + 119996, + 119997, + 120004, + 120005, + 120070, + 120071, + 120075, + 120077, + 120085, + 120086, + 120093, + 120094, + 120122, + 120123, + 120127, + 120128, + 120133, + 120134, + 120135, + 120138, + 120145, + 120146, + 120486, + 120488, + 120513, + 120514, + 120539, + 120540, + 120571, + 120572, + 120597, + 120598, + 120629, + 120630, + 120655, + 120656, + 120687, + 120688, + 120713, + 120714, + 120745, + 120746, + 120771, + 120772, + 120780 }; #endif #ifndef PERL_IN_XSUB_RE -static UV VertSpace_invlist[] = { - 6, /* Number of elements */ - 0, /* Current iteration position */ - 0, /* Cache of previous search index result */ - 290655244, /* Version and data structure type */ - 1, /* 0 if this is the first element of the list proper; - 1 if the next element is the first */ +static const UV VertSpace_invlist[] = { + 7, /* Number of elements */ + 148565664, /* Version and data structure type */ + 1, /* 0 if the list starts at 0; + 1 if it starts at the element beyond 0 */ + 0, 10, 14, 133, @@ -101,30 +316,12 @@ static UV VertSpace_invlist[] = { #ifndef PERL_IN_XSUB_RE -static UV PerlSpace_invlist[] = { - 4, /* Number of elements */ - 0, /* Current iteration position */ - 0, /* Cache of previous search index result */ - 290655244, /* Version and data structure type */ - 1, /* 0 if this is the first element of the list proper; - 1 if the next element is the first */ - 9, - 14, - 32, - 33 -}; - -#endif - -#ifndef PERL_IN_XSUB_RE - -static UV XPerlSpace_invlist[] = { - 22, /* Number of elements */ - 0, /* Current iteration position */ - 0, /* Cache of previous search index result */ - 290655244, /* Version and data structure type */ - 1, /* 0 if this is the first element of the list proper; - 1 if the next element is the first */ +static const UV XPerlSpace_invlist[] = { + 21, /* Number of elements */ + 148565664, /* Version and data structure type */ + 1, /* 0 if the list starts at 0; + 1 if it starts at the element beyond 0 */ + 0, 9, 14, 32, @@ -135,8 +332,6 @@ static UV XPerlSpace_invlist[] = { 161, 5760, 5761, - 6158, - 6159, 8192, 8203, 8232, @@ -153,32 +348,12 @@ static UV XPerlSpace_invlist[] = { #ifndef PERL_IN_XSUB_RE -static UV PosixAlnum_invlist[] = { - 6, /* Number of elements */ - 0, /* Current iteration position */ - 0, /* Cache of previous search index result */ - 290655244, /* Version and data structure type */ - 1, /* 0 if this is the first element of the list proper; - 1 if the next element is the first */ - 48, - 58, - 65, - 91, - 97, - 123 -}; - -#endif - -#ifndef PERL_IN_XSUB_RE - -static UV L1PosixAlnum_invlist[] = { - 18, /* Number of elements */ - 0, /* Current iteration position */ - 0, /* Cache of previous search index result */ - 290655244, /* Version and data structure type */ - 1, /* 0 if this is the first element of the list proper; - 1 if the next element is the first */ +static const UV XPosixAlnum_invlist[] = { + 1133, /* Number of elements */ + 148565664, /* Version and data structure type */ + 1, /* 0 if the list starts at 0; + 1 if it starts at the element beyond 0 */ + 0, 48, 58, 65, @@ -196,37 +371,1133 @@ static UV L1PosixAlnum_invlist[] = { 216, 247, 248, - 706 -}; - -#endif - -#ifndef PERL_IN_XSUB_RE - -static UV PosixAlpha_invlist[] = { - 4, /* Number of elements */ - 0, /* Current iteration position */ - 0, /* Cache of previous search index result */ - 290655244, /* Version and data structure type */ - 1, /* 0 if this is the first element of the list proper; - 1 if the next element is the first */ - 65, - 91, - 97, - 123 + 706, + 710, + 722, + 736, + 741, + 748, + 749, + 750, + 751, + 837, + 838, + 880, + 885, + 886, + 888, + 890, + 894, + 902, + 903, + 904, + 907, + 908, + 909, + 910, + 930, + 931, + 1014, + 1015, + 1154, + 1162, + 1320, + 1329, + 1367, + 1369, + 1370, + 1377, + 1416, + 1456, + 1470, + 1471, + 1472, + 1473, + 1475, + 1476, + 1478, + 1479, + 1480, + 1488, + 1515, + 1520, + 1523, + 1552, + 1563, + 1568, + 1624, + 1625, + 1642, + 1646, + 1748, + 1749, + 1757, + 1761, + 1769, + 1773, + 1789, + 1791, + 1792, + 1808, + 1856, + 1869, + 1970, + 1984, + 2027, + 2036, + 2038, + 2042, + 2043, + 2048, + 2072, + 2074, + 2093, + 2112, + 2137, + 2208, + 2209, + 2210, + 2221, + 2276, + 2282, + 2288, + 2303, + 2304, + 2364, + 2365, + 2381, + 2382, + 2385, + 2389, + 2404, + 2406, + 2416, + 2417, + 2424, + 2425, + 2432, + 2433, + 2436, + 2437, + 2445, + 2447, + 2449, + 2451, + 2473, + 2474, + 2481, + 2482, + 2483, + 2486, + 2490, + 2493, + 2501, + 2503, + 2505, + 2507, + 2509, + 2510, + 2511, + 2519, + 2520, + 2524, + 2526, + 2527, + 2532, + 2534, + 2546, + 2561, + 2564, + 2565, + 2571, + 2575, + 2577, + 2579, + 2601, + 2602, + 2609, + 2610, + 2612, + 2613, + 2615, + 2616, + 2618, + 2622, + 2627, + 2631, + 2633, + 2635, + 2637, + 2641, + 2642, + 2649, + 2653, + 2654, + 2655, + 2662, + 2678, + 2689, + 2692, + 2693, + 2702, + 2703, + 2706, + 2707, + 2729, + 2730, + 2737, + 2738, + 2740, + 2741, + 2746, + 2749, + 2758, + 2759, + 2762, + 2763, + 2765, + 2768, + 2769, + 2784, + 2788, + 2790, + 2800, + 2817, + 2820, + 2821, + 2829, + 2831, + 2833, + 2835, + 2857, + 2858, + 2865, + 2866, + 2868, + 2869, + 2874, + 2877, + 2885, + 2887, + 2889, + 2891, + 2893, + 2902, + 2904, + 2908, + 2910, + 2911, + 2916, + 2918, + 2928, + 2929, + 2930, + 2946, + 2948, + 2949, + 2955, + 2958, + 2961, + 2962, + 2966, + 2969, + 2971, + 2972, + 2973, + 2974, + 2976, + 2979, + 2981, + 2984, + 2987, + 2990, + 3002, + 3006, + 3011, + 3014, + 3017, + 3018, + 3021, + 3024, + 3025, + 3031, + 3032, + 3046, + 3056, + 3073, + 3076, + 3077, + 3085, + 3086, + 3089, + 3090, + 3113, + 3114, + 3124, + 3125, + 3130, + 3133, + 3141, + 3142, + 3145, + 3146, + 3149, + 3157, + 3159, + 3160, + 3162, + 3168, + 3172, + 3174, + 3184, + 3202, + 3204, + 3205, + 3213, + 3214, + 3217, + 3218, + 3241, + 3242, + 3252, + 3253, + 3258, + 3261, + 3269, + 3270, + 3273, + 3274, + 3277, + 3285, + 3287, + 3294, + 3295, + 3296, + 3300, + 3302, + 3312, + 3313, + 3315, + 3330, + 3332, + 3333, + 3341, + 3342, + 3345, + 3346, + 3387, + 3389, + 3397, + 3398, + 3401, + 3402, + 3405, + 3406, + 3407, + 3415, + 3416, + 3424, + 3428, + 3430, + 3440, + 3450, + 3456, + 3458, + 3460, + 3461, + 3479, + 3482, + 3506, + 3507, + 3516, + 3517, + 3518, + 3520, + 3527, + 3535, + 3541, + 3542, + 3543, + 3544, + 3552, + 3570, + 3572, + 3585, + 3643, + 3648, + 3655, + 3661, + 3662, + 3664, + 3674, + 3713, + 3715, + 3716, + 3717, + 3719, + 3721, + 3722, + 3723, + 3725, + 3726, + 3732, + 3736, + 3737, + 3744, + 3745, + 3748, + 3749, + 3750, + 3751, + 3752, + 3754, + 3756, + 3757, + 3770, + 3771, + 3774, + 3776, + 3781, + 3782, + 3783, + 3789, + 3790, + 3792, + 3802, + 3804, + 3808, + 3840, + 3841, + 3872, + 3882, + 3904, + 3912, + 3913, + 3949, + 3953, + 3970, + 3976, + 3992, + 3993, + 4029, + 4096, + 4151, + 4152, + 4153, + 4155, + 4170, + 4176, + 4195, + 4197, + 4201, + 4206, + 4231, + 4238, + 4239, + 4240, + 4250, + 4252, + 4254, + 4256, + 4294, + 4295, + 4296, + 4301, + 4302, + 4304, + 4347, + 4348, + 4681, + 4682, + 4686, + 4688, + 4695, + 4696, + 4697, + 4698, + 4702, + 4704, + 4745, + 4746, + 4750, + 4752, + 4785, + 4786, + 4790, + 4792, + 4799, + 4800, + 4801, + 4802, + 4806, + 4808, + 4823, + 4824, + 4881, + 4882, + 4886, + 4888, + 4955, + 4959, + 4960, + 4992, + 5008, + 5024, + 5109, + 5121, + 5741, + 5743, + 5760, + 5761, + 5787, + 5792, + 5867, + 5870, + 5873, + 5888, + 5901, + 5902, + 5908, + 5920, + 5940, + 5952, + 5972, + 5984, + 5997, + 5998, + 6001, + 6002, + 6004, + 6016, + 6068, + 6070, + 6089, + 6103, + 6104, + 6108, + 6109, + 6112, + 6122, + 6160, + 6170, + 6176, + 6264, + 6272, + 6315, + 6320, + 6390, + 6400, + 6429, + 6432, + 6444, + 6448, + 6457, + 6470, + 6510, + 6512, + 6517, + 6528, + 6572, + 6576, + 6602, + 6608, + 6618, + 6656, + 6684, + 6688, + 6751, + 6753, + 6773, + 6784, + 6794, + 6800, + 6810, + 6823, + 6824, + 6912, + 6964, + 6965, + 6980, + 6981, + 6988, + 6992, + 7002, + 7040, + 7082, + 7084, + 7142, + 7143, + 7154, + 7168, + 7222, + 7232, + 7242, + 7245, + 7294, + 7401, + 7405, + 7406, + 7412, + 7413, + 7415, + 7424, + 7616, + 7680, + 7958, + 7960, + 7966, + 7968, + 8006, + 8008, + 8014, + 8016, + 8024, + 8025, + 8026, + 8027, + 8028, + 8029, + 8030, + 8031, + 8062, + 8064, + 8117, + 8118, + 8125, + 8126, + 8127, + 8130, + 8133, + 8134, + 8141, + 8144, + 8148, + 8150, + 8156, + 8160, + 8173, + 8178, + 8181, + 8182, + 8189, + 8305, + 8306, + 8319, + 8320, + 8336, + 8349, + 8450, + 8451, + 8455, + 8456, + 8458, + 8468, + 8469, + 8470, + 8473, + 8478, + 8484, + 8485, + 8486, + 8487, + 8488, + 8489, + 8490, + 8494, + 8495, + 8506, + 8508, + 8512, + 8517, + 8522, + 8526, + 8527, + 8544, + 8585, + 9398, + 9450, + 11264, + 11311, + 11312, + 11359, + 11360, + 11493, + 11499, + 11503, + 11506, + 11508, + 11520, + 11558, + 11559, + 11560, + 11565, + 11566, + 11568, + 11624, + 11631, + 11632, + 11648, + 11671, + 11680, + 11687, + 11688, + 11695, + 11696, + 11703, + 11704, + 11711, + 11712, + 11719, + 11720, + 11727, + 11728, + 11735, + 11736, + 11743, + 11744, + 11776, + 11823, + 11824, + 12293, + 12296, + 12321, + 12330, + 12337, + 12342, + 12344, + 12349, + 12353, + 12439, + 12445, + 12448, + 12449, + 12539, + 12540, + 12544, + 12549, + 12590, + 12593, + 12687, + 12704, + 12731, + 12784, + 12800, + 13312, + 19894, + 19968, + 40909, + 40960, + 42125, + 42192, + 42238, + 42240, + 42509, + 42512, + 42540, + 42560, + 42607, + 42612, + 42620, + 42623, + 42648, + 42655, + 42736, + 42775, + 42784, + 42786, + 42889, + 42891, + 42895, + 42896, + 42900, + 42912, + 42923, + 43000, + 43010, + 43011, + 43014, + 43015, + 43019, + 43020, + 43048, + 43072, + 43124, + 43136, + 43204, + 43216, + 43226, + 43250, + 43256, + 43259, + 43260, + 43264, + 43307, + 43312, + 43347, + 43360, + 43389, + 43392, + 43443, + 43444, + 43456, + 43471, + 43482, + 43520, + 43575, + 43584, + 43598, + 43600, + 43610, + 43616, + 43639, + 43642, + 43643, + 43648, + 43711, + 43712, + 43713, + 43714, + 43715, + 43739, + 43742, + 43744, + 43760, + 43762, + 43766, + 43777, + 43783, + 43785, + 43791, + 43793, + 43799, + 43808, + 43815, + 43816, + 43823, + 43968, + 44011, + 44016, + 44026, + 44032, + 55204, + 55216, + 55239, + 55243, + 55292, + 63744, + 64110, + 64112, + 64218, + 64256, + 64263, + 64275, + 64280, + 64285, + 64297, + 64298, + 64311, + 64312, + 64317, + 64318, + 64319, + 64320, + 64322, + 64323, + 64325, + 64326, + 64434, + 64467, + 64830, + 64848, + 64912, + 64914, + 64968, + 65008, + 65020, + 65136, + 65141, + 65142, + 65277, + 65296, + 65306, + 65313, + 65339, + 65345, + 65371, + 65382, + 65471, + 65474, + 65480, + 65482, + 65488, + 65490, + 65496, + 65498, + 65501, + 65536, + 65548, + 65549, + 65575, + 65576, + 65595, + 65596, + 65598, + 65599, + 65614, + 65616, + 65630, + 65664, + 65787, + 65856, + 65909, + 66176, + 66205, + 66208, + 66257, + 66304, + 66335, + 66352, + 66379, + 66432, + 66462, + 66464, + 66500, + 66504, + 66512, + 66513, + 66518, + 66560, + 66718, + 66720, + 66730, + 67584, + 67590, + 67592, + 67593, + 67594, + 67638, + 67639, + 67641, + 67644, + 67645, + 67647, + 67670, + 67840, + 67862, + 67872, + 67898, + 67968, + 68024, + 68030, + 68032, + 68096, + 68100, + 68101, + 68103, + 68108, + 68116, + 68117, + 68120, + 68121, + 68148, + 68192, + 68221, + 68352, + 68406, + 68416, + 68438, + 68448, + 68467, + 68608, + 68681, + 69632, + 69702, + 69734, + 69744, + 69762, + 69817, + 69840, + 69865, + 69872, + 69882, + 69888, + 69939, + 69942, + 69952, + 70016, + 70080, + 70081, + 70085, + 70096, + 70106, + 71296, + 71350, + 71360, + 71370, + 73728, + 74607, + 74752, + 74851, + 77824, + 78895, + 92160, + 92729, + 93952, + 94021, + 94032, + 94079, + 94099, + 94112, + 110592, + 110594, + 119808, + 119893, + 119894, + 119965, + 119966, + 119968, + 119970, + 119971, + 119973, + 119975, + 119977, + 119981, + 119982, + 119994, + 119995, + 119996, + 119997, + 120004, + 120005, + 120070, + 120071, + 120075, + 120077, + 120085, + 120086, + 120093, + 120094, + 120122, + 120123, + 120127, + 120128, + 120133, + 120134, + 120135, + 120138, + 120145, + 120146, + 120486, + 120488, + 120513, + 120514, + 120539, + 120540, + 120571, + 120572, + 120597, + 120598, + 120629, + 120630, + 120655, + 120656, + 120687, + 120688, + 120713, + 120714, + 120745, + 120746, + 120771, + 120772, + 120780, + 120782, + 120832, + 126464, + 126468, + 126469, + 126496, + 126497, + 126499, + 126500, + 126501, + 126503, + 126504, + 126505, + 126515, + 126516, + 126520, + 126521, + 126522, + 126523, + 126524, + 126530, + 126531, + 126535, + 126536, + 126537, + 126538, + 126539, + 126540, + 126541, + 126544, + 126545, + 126547, + 126548, + 126549, + 126551, + 126552, + 126553, + 126554, + 126555, + 126556, + 126557, + 126558, + 126559, + 126560, + 126561, + 126563, + 126564, + 126565, + 126567, + 126571, + 126572, + 126579, + 126580, + 126584, + 126585, + 126589, + 126590, + 126591, + 126592, + 126602, + 126603, + 126620, + 126625, + 126628, + 126629, + 126634, + 126635, + 126652, + 131072, + 173783, + 173824, + 177973, + 177984, + 178206, + 194560, + 195102 }; #endif #ifndef PERL_IN_XSUB_RE -static UV L1PosixAlpha_invlist[] = { - 16, /* Number of elements */ - 0, /* Current iteration position */ - 0, /* Cache of previous search index result */ - 290655244, /* Version and data structure type */ - 1, /* 0 if this is the first element of the list proper; - 1 if the next element is the first */ +static const UV XPosixAlpha_invlist[] = { + 1081, /* Number of elements */ + 148565664, /* Version and data structure type */ + 1, /* 0 if the list starts at 0; + 1 if it starts at the element beyond 0 */ + 0, 65, 91, 97, @@ -242,37 +1513,1083 @@ static UV L1PosixAlpha_invlist[] = { 216, 247, 248, - 706 -}; - -#endif - -#ifndef PERL_IN_XSUB_RE - -static UV PosixBlank_invlist[] = { - 4, /* Number of elements */ - 0, /* Current iteration position */ - 0, /* Cache of previous search index result */ - 290655244, /* Version and data structure type */ - 1, /* 0 if this is the first element of the list proper; - 1 if the next element is the first */ - 9, - 10, - 32, - 33 + 706, + 710, + 722, + 736, + 741, + 748, + 749, + 750, + 751, + 837, + 838, + 880, + 885, + 886, + 888, + 890, + 894, + 902, + 903, + 904, + 907, + 908, + 909, + 910, + 930, + 931, + 1014, + 1015, + 1154, + 1162, + 1320, + 1329, + 1367, + 1369, + 1370, + 1377, + 1416, + 1456, + 1470, + 1471, + 1472, + 1473, + 1475, + 1476, + 1478, + 1479, + 1480, + 1488, + 1515, + 1520, + 1523, + 1552, + 1563, + 1568, + 1624, + 1625, + 1632, + 1646, + 1748, + 1749, + 1757, + 1761, + 1769, + 1773, + 1776, + 1786, + 1789, + 1791, + 1792, + 1808, + 1856, + 1869, + 1970, + 1994, + 2027, + 2036, + 2038, + 2042, + 2043, + 2048, + 2072, + 2074, + 2093, + 2112, + 2137, + 2208, + 2209, + 2210, + 2221, + 2276, + 2282, + 2288, + 2303, + 2304, + 2364, + 2365, + 2381, + 2382, + 2385, + 2389, + 2404, + 2417, + 2424, + 2425, + 2432, + 2433, + 2436, + 2437, + 2445, + 2447, + 2449, + 2451, + 2473, + 2474, + 2481, + 2482, + 2483, + 2486, + 2490, + 2493, + 2501, + 2503, + 2505, + 2507, + 2509, + 2510, + 2511, + 2519, + 2520, + 2524, + 2526, + 2527, + 2532, + 2544, + 2546, + 2561, + 2564, + 2565, + 2571, + 2575, + 2577, + 2579, + 2601, + 2602, + 2609, + 2610, + 2612, + 2613, + 2615, + 2616, + 2618, + 2622, + 2627, + 2631, + 2633, + 2635, + 2637, + 2641, + 2642, + 2649, + 2653, + 2654, + 2655, + 2672, + 2678, + 2689, + 2692, + 2693, + 2702, + 2703, + 2706, + 2707, + 2729, + 2730, + 2737, + 2738, + 2740, + 2741, + 2746, + 2749, + 2758, + 2759, + 2762, + 2763, + 2765, + 2768, + 2769, + 2784, + 2788, + 2817, + 2820, + 2821, + 2829, + 2831, + 2833, + 2835, + 2857, + 2858, + 2865, + 2866, + 2868, + 2869, + 2874, + 2877, + 2885, + 2887, + 2889, + 2891, + 2893, + 2902, + 2904, + 2908, + 2910, + 2911, + 2916, + 2929, + 2930, + 2946, + 2948, + 2949, + 2955, + 2958, + 2961, + 2962, + 2966, + 2969, + 2971, + 2972, + 2973, + 2974, + 2976, + 2979, + 2981, + 2984, + 2987, + 2990, + 3002, + 3006, + 3011, + 3014, + 3017, + 3018, + 3021, + 3024, + 3025, + 3031, + 3032, + 3073, + 3076, + 3077, + 3085, + 3086, + 3089, + 3090, + 3113, + 3114, + 3124, + 3125, + 3130, + 3133, + 3141, + 3142, + 3145, + 3146, + 3149, + 3157, + 3159, + 3160, + 3162, + 3168, + 3172, + 3202, + 3204, + 3205, + 3213, + 3214, + 3217, + 3218, + 3241, + 3242, + 3252, + 3253, + 3258, + 3261, + 3269, + 3270, + 3273, + 3274, + 3277, + 3285, + 3287, + 3294, + 3295, + 3296, + 3300, + 3313, + 3315, + 3330, + 3332, + 3333, + 3341, + 3342, + 3345, + 3346, + 3387, + 3389, + 3397, + 3398, + 3401, + 3402, + 3405, + 3406, + 3407, + 3415, + 3416, + 3424, + 3428, + 3450, + 3456, + 3458, + 3460, + 3461, + 3479, + 3482, + 3506, + 3507, + 3516, + 3517, + 3518, + 3520, + 3527, + 3535, + 3541, + 3542, + 3543, + 3544, + 3552, + 3570, + 3572, + 3585, + 3643, + 3648, + 3655, + 3661, + 3662, + 3713, + 3715, + 3716, + 3717, + 3719, + 3721, + 3722, + 3723, + 3725, + 3726, + 3732, + 3736, + 3737, + 3744, + 3745, + 3748, + 3749, + 3750, + 3751, + 3752, + 3754, + 3756, + 3757, + 3770, + 3771, + 3774, + 3776, + 3781, + 3782, + 3783, + 3789, + 3790, + 3804, + 3808, + 3840, + 3841, + 3904, + 3912, + 3913, + 3949, + 3953, + 3970, + 3976, + 3992, + 3993, + 4029, + 4096, + 4151, + 4152, + 4153, + 4155, + 4160, + 4176, + 4195, + 4197, + 4201, + 4206, + 4231, + 4238, + 4239, + 4252, + 4254, + 4256, + 4294, + 4295, + 4296, + 4301, + 4302, + 4304, + 4347, + 4348, + 4681, + 4682, + 4686, + 4688, + 4695, + 4696, + 4697, + 4698, + 4702, + 4704, + 4745, + 4746, + 4750, + 4752, + 4785, + 4786, + 4790, + 4792, + 4799, + 4800, + 4801, + 4802, + 4806, + 4808, + 4823, + 4824, + 4881, + 4882, + 4886, + 4888, + 4955, + 4959, + 4960, + 4992, + 5008, + 5024, + 5109, + 5121, + 5741, + 5743, + 5760, + 5761, + 5787, + 5792, + 5867, + 5870, + 5873, + 5888, + 5901, + 5902, + 5908, + 5920, + 5940, + 5952, + 5972, + 5984, + 5997, + 5998, + 6001, + 6002, + 6004, + 6016, + 6068, + 6070, + 6089, + 6103, + 6104, + 6108, + 6109, + 6176, + 6264, + 6272, + 6315, + 6320, + 6390, + 6400, + 6429, + 6432, + 6444, + 6448, + 6457, + 6480, + 6510, + 6512, + 6517, + 6528, + 6572, + 6576, + 6602, + 6656, + 6684, + 6688, + 6751, + 6753, + 6773, + 6823, + 6824, + 6912, + 6964, + 6965, + 6980, + 6981, + 6988, + 7040, + 7082, + 7084, + 7088, + 7098, + 7142, + 7143, + 7154, + 7168, + 7222, + 7245, + 7248, + 7258, + 7294, + 7401, + 7405, + 7406, + 7412, + 7413, + 7415, + 7424, + 7616, + 7680, + 7958, + 7960, + 7966, + 7968, + 8006, + 8008, + 8014, + 8016, + 8024, + 8025, + 8026, + 8027, + 8028, + 8029, + 8030, + 8031, + 8062, + 8064, + 8117, + 8118, + 8125, + 8126, + 8127, + 8130, + 8133, + 8134, + 8141, + 8144, + 8148, + 8150, + 8156, + 8160, + 8173, + 8178, + 8181, + 8182, + 8189, + 8305, + 8306, + 8319, + 8320, + 8336, + 8349, + 8450, + 8451, + 8455, + 8456, + 8458, + 8468, + 8469, + 8470, + 8473, + 8478, + 8484, + 8485, + 8486, + 8487, + 8488, + 8489, + 8490, + 8494, + 8495, + 8506, + 8508, + 8512, + 8517, + 8522, + 8526, + 8527, + 8544, + 8585, + 9398, + 9450, + 11264, + 11311, + 11312, + 11359, + 11360, + 11493, + 11499, + 11503, + 11506, + 11508, + 11520, + 11558, + 11559, + 11560, + 11565, + 11566, + 11568, + 11624, + 11631, + 11632, + 11648, + 11671, + 11680, + 11687, + 11688, + 11695, + 11696, + 11703, + 11704, + 11711, + 11712, + 11719, + 11720, + 11727, + 11728, + 11735, + 11736, + 11743, + 11744, + 11776, + 11823, + 11824, + 12293, + 12296, + 12321, + 12330, + 12337, + 12342, + 12344, + 12349, + 12353, + 12439, + 12445, + 12448, + 12449, + 12539, + 12540, + 12544, + 12549, + 12590, + 12593, + 12687, + 12704, + 12731, + 12784, + 12800, + 13312, + 19894, + 19968, + 40909, + 40960, + 42125, + 42192, + 42238, + 42240, + 42509, + 42512, + 42528, + 42538, + 42540, + 42560, + 42607, + 42612, + 42620, + 42623, + 42648, + 42655, + 42736, + 42775, + 42784, + 42786, + 42889, + 42891, + 42895, + 42896, + 42900, + 42912, + 42923, + 43000, + 43010, + 43011, + 43014, + 43015, + 43019, + 43020, + 43048, + 43072, + 43124, + 43136, + 43204, + 43250, + 43256, + 43259, + 43260, + 43274, + 43307, + 43312, + 43347, + 43360, + 43389, + 43392, + 43443, + 43444, + 43456, + 43471, + 43472, + 43520, + 43575, + 43584, + 43598, + 43616, + 43639, + 43642, + 43643, + 43648, + 43711, + 43712, + 43713, + 43714, + 43715, + 43739, + 43742, + 43744, + 43760, + 43762, + 43766, + 43777, + 43783, + 43785, + 43791, + 43793, + 43799, + 43808, + 43815, + 43816, + 43823, + 43968, + 44011, + 44032, + 55204, + 55216, + 55239, + 55243, + 55292, + 63744, + 64110, + 64112, + 64218, + 64256, + 64263, + 64275, + 64280, + 64285, + 64297, + 64298, + 64311, + 64312, + 64317, + 64318, + 64319, + 64320, + 64322, + 64323, + 64325, + 64326, + 64434, + 64467, + 64830, + 64848, + 64912, + 64914, + 64968, + 65008, + 65020, + 65136, + 65141, + 65142, + 65277, + 65313, + 65339, + 65345, + 65371, + 65382, + 65471, + 65474, + 65480, + 65482, + 65488, + 65490, + 65496, + 65498, + 65501, + 65536, + 65548, + 65549, + 65575, + 65576, + 65595, + 65596, + 65598, + 65599, + 65614, + 65616, + 65630, + 65664, + 65787, + 65856, + 65909, + 66176, + 66205, + 66208, + 66257, + 66304, + 66335, + 66352, + 66379, + 66432, + 66462, + 66464, + 66500, + 66504, + 66512, + 66513, + 66518, + 66560, + 66718, + 67584, + 67590, + 67592, + 67593, + 67594, + 67638, + 67639, + 67641, + 67644, + 67645, + 67647, + 67670, + 67840, + 67862, + 67872, + 67898, + 67968, + 68024, + 68030, + 68032, + 68096, + 68100, + 68101, + 68103, + 68108, + 68116, + 68117, + 68120, + 68121, + 68148, + 68192, + 68221, + 68352, + 68406, + 68416, + 68438, + 68448, + 68467, + 68608, + 68681, + 69632, + 69702, + 69762, + 69817, + 69840, + 69865, + 69888, + 69939, + 70016, + 70080, + 70081, + 70085, + 71296, + 71350, + 73728, + 74607, + 74752, + 74851, + 77824, + 78895, + 92160, + 92729, + 93952, + 94021, + 94032, + 94079, + 94099, + 94112, + 110592, + 110594, + 119808, + 119893, + 119894, + 119965, + 119966, + 119968, + 119970, + 119971, + 119973, + 119975, + 119977, + 119981, + 119982, + 119994, + 119995, + 119996, + 119997, + 120004, + 120005, + 120070, + 120071, + 120075, + 120077, + 120085, + 120086, + 120093, + 120094, + 120122, + 120123, + 120127, + 120128, + 120133, + 120134, + 120135, + 120138, + 120145, + 120146, + 120486, + 120488, + 120513, + 120514, + 120539, + 120540, + 120571, + 120572, + 120597, + 120598, + 120629, + 120630, + 120655, + 120656, + 120687, + 120688, + 120713, + 120714, + 120745, + 120746, + 120771, + 120772, + 120780, + 126464, + 126468, + 126469, + 126496, + 126497, + 126499, + 126500, + 126501, + 126503, + 126504, + 126505, + 126515, + 126516, + 126520, + 126521, + 126522, + 126523, + 126524, + 126530, + 126531, + 126535, + 126536, + 126537, + 126538, + 126539, + 126540, + 126541, + 126544, + 126545, + 126547, + 126548, + 126549, + 126551, + 126552, + 126553, + 126554, + 126555, + 126556, + 126557, + 126558, + 126559, + 126560, + 126561, + 126563, + 126564, + 126565, + 126567, + 126571, + 126572, + 126579, + 126580, + 126584, + 126585, + 126589, + 126590, + 126591, + 126592, + 126602, + 126603, + 126620, + 126625, + 126628, + 126629, + 126634, + 126635, + 126652, + 131072, + 173783, + 173824, + 177973, + 177984, + 178206, + 194560, + 195102 }; #endif #ifndef PERL_IN_XSUB_RE -static UV XPosixBlank_invlist[] = { - 18, /* Number of elements */ - 0, /* Current iteration position */ - 0, /* Cache of previous search index result */ - 290655244, /* Version and data structure type */ - 1, /* 0 if this is the first element of the list proper; - 1 if the next element is the first */ +static const UV XPosixBlank_invlist[] = { + 17, /* Number of elements */ + 148565664, /* Version and data structure type */ + 1, /* 0 if the list starts at 0; + 1 if it starts at the element beyond 0 */ + 0, 9, 10, 32, @@ -281,8 +2598,6 @@ static UV XPosixBlank_invlist[] = { 161, 5760, 5761, - 6158, - 6159, 8192, 8203, 8239, @@ -297,109 +2612,1223 @@ static UV XPosixBlank_invlist[] = { #ifndef PERL_IN_XSUB_RE -static UV PosixCntrl_invlist[] = { +static const UV XPosixCntrl_invlist[] = { 4, /* Number of elements */ - 0, /* Current iteration position */ - 0, /* Cache of previous search index result */ - 290655244, /* Version and data structure type */ - 0, /* 0 if this is the first element of the list proper; - 1 if the next element is the first */ + 148565664, /* Version and data structure type */ + 0, /* 0 if the list starts at 0; + 1 if it starts at the element beyond 0 */ + 0, 32, 127, - 128, - 0 + 160 }; #endif #ifndef PERL_IN_XSUB_RE -static UV XPosixCntrl_invlist[] = { - 4, /* Number of elements */ - 0, /* Current iteration position */ - 0, /* Cache of previous search index result */ - 290655244, /* Version and data structure type */ - 0, /* 0 if this is the first element of the list proper; - 1 if the next element is the first */ - 32, - 127, - 160, - 0 -}; - -#endif - -#ifndef PERL_IN_XSUB_RE - -static UV PosixDigit_invlist[] = { - 2, /* Number of elements */ - 0, /* Current iteration position */ - 0, /* Cache of previous search index result */ - 290655244, /* Version and data structure type */ - 1, /* 0 if this is the first element of the list proper; - 1 if the next element is the first */ +static const UV XPosixDigit_invlist[] = { + 85, /* Number of elements */ + 148565664, /* Version and data structure type */ + 1, /* 0 if the list starts at 0; + 1 if it starts at the element beyond 0 */ + 0, 48, - 58 -}; - -#endif - -#ifndef PERL_IN_XSUB_RE - -static UV PosixGraph_invlist[] = { - 2, /* Number of elements */ - 0, /* Current iteration position */ - 0, /* Cache of previous search index result */ - 290655244, /* Version and data structure type */ - 1, /* 0 if this is the first element of the list proper; - 1 if the next element is the first */ - 33, - 127 + 58, + 1632, + 1642, + 1776, + 1786, + 1984, + 1994, + 2406, + 2416, + 2534, + 2544, + 2662, + 2672, + 2790, + 2800, + 2918, + 2928, + 3046, + 3056, + 3174, + 3184, + 3302, + 3312, + 3430, + 3440, + 3664, + 3674, + 3792, + 3802, + 3872, + 3882, + 4160, + 4170, + 4240, + 4250, + 6112, + 6122, + 6160, + 6170, + 6470, + 6480, + 6608, + 6618, + 6784, + 6794, + 6800, + 6810, + 6992, + 7002, + 7088, + 7098, + 7232, + 7242, + 7248, + 7258, + 42528, + 42538, + 43216, + 43226, + 43264, + 43274, + 43472, + 43482, + 43600, + 43610, + 44016, + 44026, + 65296, + 65306, + 66720, + 66730, + 69734, + 69744, + 69872, + 69882, + 69942, + 69952, + 70096, + 70106, + 71360, + 71370, + 120782, + 120832 }; #endif #ifndef PERL_IN_XSUB_RE -static UV L1PosixGraph_invlist[] = { - 4, /* Number of elements */ - 0, /* Current iteration position */ - 0, /* Cache of previous search index result */ - 290655244, /* Version and data structure type */ - 1, /* 0 if this is the first element of the list proper; - 1 if the next element is the first */ +static const UV XPosixGraph_invlist[] = { + 1089, /* Number of elements */ + 148565664, /* Version and data structure type */ + 1, /* 0 if the list starts at 0; + 1 if it starts at the element beyond 0 */ + 0, 33, 127, 161, - 888 -}; - -#endif - -#ifndef PERL_IN_XSUB_RE - -static UV PosixLower_invlist[] = { - 2, /* Number of elements */ - 0, /* Current iteration position */ - 0, /* Cache of previous search index result */ - 290655244, /* Version and data structure type */ - 1, /* 0 if this is the first element of the list proper; - 1 if the next element is the first */ - 97, - 123 + 888, + 890, + 895, + 900, + 907, + 908, + 909, + 910, + 930, + 931, + 1320, + 1329, + 1367, + 1369, + 1376, + 1377, + 1416, + 1417, + 1419, + 1423, + 1424, + 1425, + 1480, + 1488, + 1515, + 1520, + 1525, + 1536, + 1541, + 1542, + 1565, + 1566, + 1806, + 1807, + 1867, + 1869, + 1970, + 1984, + 2043, + 2048, + 2094, + 2096, + 2111, + 2112, + 2140, + 2142, + 2143, + 2208, + 2209, + 2210, + 2221, + 2276, + 2303, + 2304, + 2424, + 2425, + 2432, + 2433, + 2436, + 2437, + 2445, + 2447, + 2449, + 2451, + 2473, + 2474, + 2481, + 2482, + 2483, + 2486, + 2490, + 2492, + 2501, + 2503, + 2505, + 2507, + 2511, + 2519, + 2520, + 2524, + 2526, + 2527, + 2532, + 2534, + 2556, + 2561, + 2564, + 2565, + 2571, + 2575, + 2577, + 2579, + 2601, + 2602, + 2609, + 2610, + 2612, + 2613, + 2615, + 2616, + 2618, + 2620, + 2621, + 2622, + 2627, + 2631, + 2633, + 2635, + 2638, + 2641, + 2642, + 2649, + 2653, + 2654, + 2655, + 2662, + 2678, + 2689, + 2692, + 2693, + 2702, + 2703, + 2706, + 2707, + 2729, + 2730, + 2737, + 2738, + 2740, + 2741, + 2746, + 2748, + 2758, + 2759, + 2762, + 2763, + 2766, + 2768, + 2769, + 2784, + 2788, + 2790, + 2802, + 2817, + 2820, + 2821, + 2829, + 2831, + 2833, + 2835, + 2857, + 2858, + 2865, + 2866, + 2868, + 2869, + 2874, + 2876, + 2885, + 2887, + 2889, + 2891, + 2894, + 2902, + 2904, + 2908, + 2910, + 2911, + 2916, + 2918, + 2936, + 2946, + 2948, + 2949, + 2955, + 2958, + 2961, + 2962, + 2966, + 2969, + 2971, + 2972, + 2973, + 2974, + 2976, + 2979, + 2981, + 2984, + 2987, + 2990, + 3002, + 3006, + 3011, + 3014, + 3017, + 3018, + 3022, + 3024, + 3025, + 3031, + 3032, + 3046, + 3067, + 3073, + 3076, + 3077, + 3085, + 3086, + 3089, + 3090, + 3113, + 3114, + 3124, + 3125, + 3130, + 3133, + 3141, + 3142, + 3145, + 3146, + 3150, + 3157, + 3159, + 3160, + 3162, + 3168, + 3172, + 3174, + 3184, + 3192, + 3200, + 3202, + 3204, + 3205, + 3213, + 3214, + 3217, + 3218, + 3241, + 3242, + 3252, + 3253, + 3258, + 3260, + 3269, + 3270, + 3273, + 3274, + 3278, + 3285, + 3287, + 3294, + 3295, + 3296, + 3300, + 3302, + 3312, + 3313, + 3315, + 3330, + 3332, + 3333, + 3341, + 3342, + 3345, + 3346, + 3387, + 3389, + 3397, + 3398, + 3401, + 3402, + 3407, + 3415, + 3416, + 3424, + 3428, + 3430, + 3446, + 3449, + 3456, + 3458, + 3460, + 3461, + 3479, + 3482, + 3506, + 3507, + 3516, + 3517, + 3518, + 3520, + 3527, + 3530, + 3531, + 3535, + 3541, + 3542, + 3543, + 3544, + 3552, + 3570, + 3573, + 3585, + 3643, + 3647, + 3676, + 3713, + 3715, + 3716, + 3717, + 3719, + 3721, + 3722, + 3723, + 3725, + 3726, + 3732, + 3736, + 3737, + 3744, + 3745, + 3748, + 3749, + 3750, + 3751, + 3752, + 3754, + 3756, + 3757, + 3770, + 3771, + 3774, + 3776, + 3781, + 3782, + 3783, + 3784, + 3790, + 3792, + 3802, + 3804, + 3808, + 3840, + 3912, + 3913, + 3949, + 3953, + 3992, + 3993, + 4029, + 4030, + 4045, + 4046, + 4059, + 4096, + 4294, + 4295, + 4296, + 4301, + 4302, + 4304, + 4681, + 4682, + 4686, + 4688, + 4695, + 4696, + 4697, + 4698, + 4702, + 4704, + 4745, + 4746, + 4750, + 4752, + 4785, + 4786, + 4790, + 4792, + 4799, + 4800, + 4801, + 4802, + 4806, + 4808, + 4823, + 4824, + 4881, + 4882, + 4886, + 4888, + 4955, + 4957, + 4989, + 4992, + 5018, + 5024, + 5109, + 5120, + 5760, + 5761, + 5789, + 5792, + 5873, + 5888, + 5901, + 5902, + 5909, + 5920, + 5943, + 5952, + 5972, + 5984, + 5997, + 5998, + 6001, + 6002, + 6004, + 6016, + 6110, + 6112, + 6122, + 6128, + 6138, + 6144, + 6159, + 6160, + 6170, + 6176, + 6264, + 6272, + 6315, + 6320, + 6390, + 6400, + 6429, + 6432, + 6444, + 6448, + 6460, + 6464, + 6465, + 6468, + 6510, + 6512, + 6517, + 6528, + 6572, + 6576, + 6602, + 6608, + 6619, + 6622, + 6684, + 6686, + 6751, + 6752, + 6781, + 6783, + 6794, + 6800, + 6810, + 6816, + 6830, + 6912, + 6988, + 6992, + 7037, + 7040, + 7156, + 7164, + 7224, + 7227, + 7242, + 7245, + 7296, + 7360, + 7368, + 7376, + 7415, + 7424, + 7655, + 7676, + 7958, + 7960, + 7966, + 7968, + 8006, + 8008, + 8014, + 8016, + 8024, + 8025, + 8026, + 8027, + 8028, + 8029, + 8030, + 8031, + 8062, + 8064, + 8117, + 8118, + 8133, + 8134, + 8148, + 8150, + 8156, + 8157, + 8176, + 8178, + 8181, + 8182, + 8191, + 8203, + 8232, + 8234, + 8239, + 8240, + 8287, + 8288, + 8293, + 8294, + 8306, + 8308, + 8335, + 8336, + 8349, + 8352, + 8379, + 8400, + 8433, + 8448, + 8586, + 8592, + 9204, + 9216, + 9255, + 9280, + 9291, + 9312, + 9984, + 9985, + 11085, + 11088, + 11098, + 11264, + 11311, + 11312, + 11359, + 11360, + 11508, + 11513, + 11558, + 11559, + 11560, + 11565, + 11566, + 11568, + 11624, + 11631, + 11633, + 11647, + 11671, + 11680, + 11687, + 11688, + 11695, + 11696, + 11703, + 11704, + 11711, + 11712, + 11719, + 11720, + 11727, + 11728, + 11735, + 11736, + 11743, + 11744, + 11836, + 11904, + 11930, + 11931, + 12020, + 12032, + 12246, + 12272, + 12284, + 12289, + 12352, + 12353, + 12439, + 12441, + 12544, + 12549, + 12590, + 12593, + 12687, + 12688, + 12731, + 12736, + 12772, + 12784, + 12831, + 12832, + 13055, + 13056, + 19894, + 19904, + 40909, + 40960, + 42125, + 42128, + 42183, + 42192, + 42540, + 42560, + 42648, + 42655, + 42744, + 42752, + 42895, + 42896, + 42900, + 42912, + 42923, + 43000, + 43052, + 43056, + 43066, + 43072, + 43128, + 43136, + 43205, + 43214, + 43226, + 43232, + 43260, + 43264, + 43348, + 43359, + 43389, + 43392, + 43470, + 43471, + 43482, + 43486, + 43488, + 43520, + 43575, + 43584, + 43598, + 43600, + 43610, + 43612, + 43644, + 43648, + 43715, + 43739, + 43767, + 43777, + 43783, + 43785, + 43791, + 43793, + 43799, + 43808, + 43815, + 43816, + 43823, + 43968, + 44014, + 44016, + 44026, + 44032, + 55204, + 55216, + 55239, + 55243, + 55292, + 57344, + 64110, + 64112, + 64218, + 64256, + 64263, + 64275, + 64280, + 64285, + 64311, + 64312, + 64317, + 64318, + 64319, + 64320, + 64322, + 64323, + 64325, + 64326, + 64450, + 64467, + 64832, + 64848, + 64912, + 64914, + 64968, + 65008, + 65022, + 65024, + 65050, + 65056, + 65063, + 65072, + 65107, + 65108, + 65127, + 65128, + 65132, + 65136, + 65141, + 65142, + 65277, + 65279, + 65280, + 65281, + 65471, + 65474, + 65480, + 65482, + 65488, + 65490, + 65496, + 65498, + 65501, + 65504, + 65511, + 65512, + 65519, + 65529, + 65534, + 65536, + 65548, + 65549, + 65575, + 65576, + 65595, + 65596, + 65598, + 65599, + 65614, + 65616, + 65630, + 65664, + 65787, + 65792, + 65795, + 65799, + 65844, + 65847, + 65931, + 65936, + 65948, + 66000, + 66046, + 66176, + 66205, + 66208, + 66257, + 66304, + 66335, + 66336, + 66340, + 66352, + 66379, + 66432, + 66462, + 66463, + 66500, + 66504, + 66518, + 66560, + 66718, + 66720, + 66730, + 67584, + 67590, + 67592, + 67593, + 67594, + 67638, + 67639, + 67641, + 67644, + 67645, + 67647, + 67670, + 67671, + 67680, + 67840, + 67868, + 67871, + 67898, + 67903, + 67904, + 67968, + 68024, + 68030, + 68032, + 68096, + 68100, + 68101, + 68103, + 68108, + 68116, + 68117, + 68120, + 68121, + 68148, + 68152, + 68155, + 68159, + 68168, + 68176, + 68185, + 68192, + 68224, + 68352, + 68406, + 68409, + 68438, + 68440, + 68467, + 68472, + 68480, + 68608, + 68681, + 69216, + 69247, + 69632, + 69710, + 69714, + 69744, + 69760, + 69826, + 69840, + 69865, + 69872, + 69882, + 69888, + 69941, + 69942, + 69956, + 70016, + 70089, + 70096, + 70106, + 71296, + 71352, + 71360, + 71370, + 73728, + 74607, + 74752, + 74851, + 74864, + 74868, + 77824, + 78895, + 92160, + 92729, + 93952, + 94021, + 94032, + 94079, + 94095, + 94112, + 110592, + 110594, + 118784, + 119030, + 119040, + 119079, + 119081, + 119262, + 119296, + 119366, + 119552, + 119639, + 119648, + 119666, + 119808, + 119893, + 119894, + 119965, + 119966, + 119968, + 119970, + 119971, + 119973, + 119975, + 119977, + 119981, + 119982, + 119994, + 119995, + 119996, + 119997, + 120004, + 120005, + 120070, + 120071, + 120075, + 120077, + 120085, + 120086, + 120093, + 120094, + 120122, + 120123, + 120127, + 120128, + 120133, + 120134, + 120135, + 120138, + 120145, + 120146, + 120486, + 120488, + 120780, + 120782, + 120832, + 126464, + 126468, + 126469, + 126496, + 126497, + 126499, + 126500, + 126501, + 126503, + 126504, + 126505, + 126515, + 126516, + 126520, + 126521, + 126522, + 126523, + 126524, + 126530, + 126531, + 126535, + 126536, + 126537, + 126538, + 126539, + 126540, + 126541, + 126544, + 126545, + 126547, + 126548, + 126549, + 126551, + 126552, + 126553, + 126554, + 126555, + 126556, + 126557, + 126558, + 126559, + 126560, + 126561, + 126563, + 126564, + 126565, + 126567, + 126571, + 126572, + 126579, + 126580, + 126584, + 126585, + 126589, + 126590, + 126591, + 126592, + 126602, + 126603, + 126620, + 126625, + 126628, + 126629, + 126634, + 126635, + 126652, + 126704, + 126706, + 126976, + 127020, + 127024, + 127124, + 127136, + 127151, + 127153, + 127167, + 127169, + 127184, + 127185, + 127200, + 127232, + 127243, + 127248, + 127279, + 127280, + 127340, + 127344, + 127387, + 127462, + 127491, + 127504, + 127547, + 127552, + 127561, + 127568, + 127570, + 127744, + 127777, + 127792, + 127798, + 127799, + 127869, + 127872, + 127892, + 127904, + 127941, + 127942, + 127947, + 127968, + 127985, + 128000, + 128063, + 128064, + 128065, + 128066, + 128248, + 128249, + 128253, + 128256, + 128318, + 128320, + 128324, + 128336, + 128360, + 128507, + 128577, + 128581, + 128592, + 128640, + 128710, + 128768, + 128884, + 131072, + 173783, + 173824, + 177973, + 177984, + 178206, + 194560, + 195102, + 917505, + 917506, + 917536, + 917632, + 917760, + 918000, + 983040, + 1048574, + 1048576, + 1114110 }; #endif #ifndef PERL_IN_XSUB_RE -static UV L1PosixLower_invlist[] = { - 12, /* Number of elements */ - 0, /* Current iteration position */ - 0, /* Cache of previous search index result */ - 290655244, /* Version and data structure type */ - 1, /* 0 if this is the first element of the list proper; - 1 if the next element is the first */ +static const UV XPosixLower_invlist[] = { + 1237, /* Number of elements */ + 148565664, /* Version and data structure type */ + 1, /* 0 if the list starts at 0; + 1 if it starts at the element beyond 0 */ + 0, 97, 123, 170, @@ -411,73 +3840,2337 @@ static UV L1PosixLower_invlist[] = { 223, 247, 248, - 256 -}; - -#endif - -#ifndef PERL_IN_XSUB_RE - -static UV PosixPrint_invlist[] = { - 2, /* Number of elements */ - 0, /* Current iteration position */ - 0, /* Cache of previous search index result */ - 290655244, /* Version and data structure type */ - 1, /* 0 if this is the first element of the list proper; - 1 if the next element is the first */ - 32, - 127 + 256, + 257, + 258, + 259, + 260, + 261, + 262, + 263, + 264, + 265, + 266, + 267, + 268, + 269, + 270, + 271, + 272, + 273, + 274, + 275, + 276, + 277, + 278, + 279, + 280, + 281, + 282, + 283, + 284, + 285, + 286, + 287, + 288, + 289, + 290, + 291, + 292, + 293, + 294, + 295, + 296, + 297, + 298, + 299, + 300, + 301, + 302, + 303, + 304, + 305, + 306, + 307, + 308, + 309, + 310, + 311, + 313, + 314, + 315, + 316, + 317, + 318, + 319, + 320, + 321, + 322, + 323, + 324, + 325, + 326, + 327, + 328, + 330, + 331, + 332, + 333, + 334, + 335, + 336, + 337, + 338, + 339, + 340, + 341, + 342, + 343, + 344, + 345, + 346, + 347, + 348, + 349, + 350, + 351, + 352, + 353, + 354, + 355, + 356, + 357, + 358, + 359, + 360, + 361, + 362, + 363, + 364, + 365, + 366, + 367, + 368, + 369, + 370, + 371, + 372, + 373, + 374, + 375, + 376, + 378, + 379, + 380, + 381, + 382, + 385, + 387, + 388, + 389, + 390, + 392, + 393, + 396, + 398, + 402, + 403, + 405, + 406, + 409, + 412, + 414, + 415, + 417, + 418, + 419, + 420, + 421, + 422, + 424, + 425, + 426, + 428, + 429, + 430, + 432, + 433, + 436, + 437, + 438, + 439, + 441, + 443, + 445, + 448, + 454, + 455, + 457, + 458, + 460, + 461, + 462, + 463, + 464, + 465, + 466, + 467, + 468, + 469, + 470, + 471, + 472, + 473, + 474, + 475, + 476, + 478, + 479, + 480, + 481, + 482, + 483, + 484, + 485, + 486, + 487, + 488, + 489, + 490, + 491, + 492, + 493, + 494, + 495, + 497, + 499, + 500, + 501, + 502, + 505, + 506, + 507, + 508, + 509, + 510, + 511, + 512, + 513, + 514, + 515, + 516, + 517, + 518, + 519, + 520, + 521, + 522, + 523, + 524, + 525, + 526, + 527, + 528, + 529, + 530, + 531, + 532, + 533, + 534, + 535, + 536, + 537, + 538, + 539, + 540, + 541, + 542, + 543, + 544, + 545, + 546, + 547, + 548, + 549, + 550, + 551, + 552, + 553, + 554, + 555, + 556, + 557, + 558, + 559, + 560, + 561, + 562, + 563, + 570, + 572, + 573, + 575, + 577, + 578, + 579, + 583, + 584, + 585, + 586, + 587, + 588, + 589, + 590, + 591, + 660, + 661, + 697, + 704, + 706, + 736, + 741, + 837, + 838, + 881, + 882, + 883, + 884, + 887, + 888, + 890, + 894, + 912, + 913, + 940, + 975, + 976, + 978, + 981, + 984, + 985, + 986, + 987, + 988, + 989, + 990, + 991, + 992, + 993, + 994, + 995, + 996, + 997, + 998, + 999, + 1000, + 1001, + 1002, + 1003, + 1004, + 1005, + 1006, + 1007, + 1012, + 1013, + 1014, + 1016, + 1017, + 1019, + 1021, + 1072, + 1120, + 1121, + 1122, + 1123, + 1124, + 1125, + 1126, + 1127, + 1128, + 1129, + 1130, + 1131, + 1132, + 1133, + 1134, + 1135, + 1136, + 1137, + 1138, + 1139, + 1140, + 1141, + 1142, + 1143, + 1144, + 1145, + 1146, + 1147, + 1148, + 1149, + 1150, + 1151, + 1152, + 1153, + 1154, + 1163, + 1164, + 1165, + 1166, + 1167, + 1168, + 1169, + 1170, + 1171, + 1172, + 1173, + 1174, + 1175, + 1176, + 1177, + 1178, + 1179, + 1180, + 1181, + 1182, + 1183, + 1184, + 1185, + 1186, + 1187, + 1188, + 1189, + 1190, + 1191, + 1192, + 1193, + 1194, + 1195, + 1196, + 1197, + 1198, + 1199, + 1200, + 1201, + 1202, + 1203, + 1204, + 1205, + 1206, + 1207, + 1208, + 1209, + 1210, + 1211, + 1212, + 1213, + 1214, + 1215, + 1216, + 1218, + 1219, + 1220, + 1221, + 1222, + 1223, + 1224, + 1225, + 1226, + 1227, + 1228, + 1229, + 1230, + 1232, + 1233, + 1234, + 1235, + 1236, + 1237, + 1238, + 1239, + 1240, + 1241, + 1242, + 1243, + 1244, + 1245, + 1246, + 1247, + 1248, + 1249, + 1250, + 1251, + 1252, + 1253, + 1254, + 1255, + 1256, + 1257, + 1258, + 1259, + 1260, + 1261, + 1262, + 1263, + 1264, + 1265, + 1266, + 1267, + 1268, + 1269, + 1270, + 1271, + 1272, + 1273, + 1274, + 1275, + 1276, + 1277, + 1278, + 1279, + 1280, + 1281, + 1282, + 1283, + 1284, + 1285, + 1286, + 1287, + 1288, + 1289, + 1290, + 1291, + 1292, + 1293, + 1294, + 1295, + 1296, + 1297, + 1298, + 1299, + 1300, + 1301, + 1302, + 1303, + 1304, + 1305, + 1306, + 1307, + 1308, + 1309, + 1310, + 1311, + 1312, + 1313, + 1314, + 1315, + 1316, + 1317, + 1318, + 1319, + 1320, + 1377, + 1416, + 7424, + 7616, + 7681, + 7682, + 7683, + 7684, + 7685, + 7686, + 7687, + 7688, + 7689, + 7690, + 7691, + 7692, + 7693, + 7694, + 7695, + 7696, + 7697, + 7698, + 7699, + 7700, + 7701, + 7702, + 7703, + 7704, + 7705, + 7706, + 7707, + 7708, + 7709, + 7710, + 7711, + 7712, + 7713, + 7714, + 7715, + 7716, + 7717, + 7718, + 7719, + 7720, + 7721, + 7722, + 7723, + 7724, + 7725, + 7726, + 7727, + 7728, + 7729, + 7730, + 7731, + 7732, + 7733, + 7734, + 7735, + 7736, + 7737, + 7738, + 7739, + 7740, + 7741, + 7742, + 7743, + 7744, + 7745, + 7746, + 7747, + 7748, + 7749, + 7750, + 7751, + 7752, + 7753, + 7754, + 7755, + 7756, + 7757, + 7758, + 7759, + 7760, + 7761, + 7762, + 7763, + 7764, + 7765, + 7766, + 7767, + 7768, + 7769, + 7770, + 7771, + 7772, + 7773, + 7774, + 7775, + 7776, + 7777, + 7778, + 7779, + 7780, + 7781, + 7782, + 7783, + 7784, + 7785, + 7786, + 7787, + 7788, + 7789, + 7790, + 7791, + 7792, + 7793, + 7794, + 7795, + 7796, + 7797, + 7798, + 7799, + 7800, + 7801, + 7802, + 7803, + 7804, + 7805, + 7806, + 7807, + 7808, + 7809, + 7810, + 7811, + 7812, + 7813, + 7814, + 7815, + 7816, + 7817, + 7818, + 7819, + 7820, + 7821, + 7822, + 7823, + 7824, + 7825, + 7826, + 7827, + 7828, + 7829, + 7838, + 7839, + 7840, + 7841, + 7842, + 7843, + 7844, + 7845, + 7846, + 7847, + 7848, + 7849, + 7850, + 7851, + 7852, + 7853, + 7854, + 7855, + 7856, + 7857, + 7858, + 7859, + 7860, + 7861, + 7862, + 7863, + 7864, + 7865, + 7866, + 7867, + 7868, + 7869, + 7870, + 7871, + 7872, + 7873, + 7874, + 7875, + 7876, + 7877, + 7878, + 7879, + 7880, + 7881, + 7882, + 7883, + 7884, + 7885, + 7886, + 7887, + 7888, + 7889, + 7890, + 7891, + 7892, + 7893, + 7894, + 7895, + 7896, + 7897, + 7898, + 7899, + 7900, + 7901, + 7902, + 7903, + 7904, + 7905, + 7906, + 7907, + 7908, + 7909, + 7910, + 7911, + 7912, + 7913, + 7914, + 7915, + 7916, + 7917, + 7918, + 7919, + 7920, + 7921, + 7922, + 7923, + 7924, + 7925, + 7926, + 7927, + 7928, + 7929, + 7930, + 7931, + 7932, + 7933, + 7934, + 7935, + 7944, + 7952, + 7958, + 7968, + 7976, + 7984, + 7992, + 8000, + 8006, + 8016, + 8024, + 8032, + 8040, + 8048, + 8062, + 8064, + 8072, + 8080, + 8088, + 8096, + 8104, + 8112, + 8117, + 8118, + 8120, + 8126, + 8127, + 8130, + 8133, + 8134, + 8136, + 8144, + 8148, + 8150, + 8152, + 8160, + 8168, + 8178, + 8181, + 8182, + 8184, + 8305, + 8306, + 8319, + 8320, + 8336, + 8349, + 8458, + 8459, + 8462, + 8464, + 8467, + 8468, + 8495, + 8496, + 8500, + 8501, + 8505, + 8506, + 8508, + 8510, + 8518, + 8522, + 8526, + 8527, + 8560, + 8576, + 8580, + 8581, + 9424, + 9450, + 11312, + 11359, + 11361, + 11362, + 11365, + 11367, + 11368, + 11369, + 11370, + 11371, + 11372, + 11373, + 11377, + 11378, + 11379, + 11381, + 11382, + 11390, + 11393, + 11394, + 11395, + 11396, + 11397, + 11398, + 11399, + 11400, + 11401, + 11402, + 11403, + 11404, + 11405, + 11406, + 11407, + 11408, + 11409, + 11410, + 11411, + 11412, + 11413, + 11414, + 11415, + 11416, + 11417, + 11418, + 11419, + 11420, + 11421, + 11422, + 11423, + 11424, + 11425, + 11426, + 11427, + 11428, + 11429, + 11430, + 11431, + 11432, + 11433, + 11434, + 11435, + 11436, + 11437, + 11438, + 11439, + 11440, + 11441, + 11442, + 11443, + 11444, + 11445, + 11446, + 11447, + 11448, + 11449, + 11450, + 11451, + 11452, + 11453, + 11454, + 11455, + 11456, + 11457, + 11458, + 11459, + 11460, + 11461, + 11462, + 11463, + 11464, + 11465, + 11466, + 11467, + 11468, + 11469, + 11470, + 11471, + 11472, + 11473, + 11474, + 11475, + 11476, + 11477, + 11478, + 11479, + 11480, + 11481, + 11482, + 11483, + 11484, + 11485, + 11486, + 11487, + 11488, + 11489, + 11490, + 11491, + 11493, + 11500, + 11501, + 11502, + 11503, + 11507, + 11508, + 11520, + 11558, + 11559, + 11560, + 11565, + 11566, + 42561, + 42562, + 42563, + 42564, + 42565, + 42566, + 42567, + 42568, + 42569, + 42570, + 42571, + 42572, + 42573, + 42574, + 42575, + 42576, + 42577, + 42578, + 42579, + 42580, + 42581, + 42582, + 42583, + 42584, + 42585, + 42586, + 42587, + 42588, + 42589, + 42590, + 42591, + 42592, + 42593, + 42594, + 42595, + 42596, + 42597, + 42598, + 42599, + 42600, + 42601, + 42602, + 42603, + 42604, + 42605, + 42606, + 42625, + 42626, + 42627, + 42628, + 42629, + 42630, + 42631, + 42632, + 42633, + 42634, + 42635, + 42636, + 42637, + 42638, + 42639, + 42640, + 42641, + 42642, + 42643, + 42644, + 42645, + 42646, + 42647, + 42648, + 42787, + 42788, + 42789, + 42790, + 42791, + 42792, + 42793, + 42794, + 42795, + 42796, + 42797, + 42798, + 42799, + 42802, + 42803, + 42804, + 42805, + 42806, + 42807, + 42808, + 42809, + 42810, + 42811, + 42812, + 42813, + 42814, + 42815, + 42816, + 42817, + 42818, + 42819, + 42820, + 42821, + 42822, + 42823, + 42824, + 42825, + 42826, + 42827, + 42828, + 42829, + 42830, + 42831, + 42832, + 42833, + 42834, + 42835, + 42836, + 42837, + 42838, + 42839, + 42840, + 42841, + 42842, + 42843, + 42844, + 42845, + 42846, + 42847, + 42848, + 42849, + 42850, + 42851, + 42852, + 42853, + 42854, + 42855, + 42856, + 42857, + 42858, + 42859, + 42860, + 42861, + 42862, + 42863, + 42873, + 42874, + 42875, + 42876, + 42877, + 42879, + 42880, + 42881, + 42882, + 42883, + 42884, + 42885, + 42886, + 42887, + 42888, + 42892, + 42893, + 42894, + 42895, + 42897, + 42898, + 42899, + 42900, + 42913, + 42914, + 42915, + 42916, + 42917, + 42918, + 42919, + 42920, + 42921, + 42922, + 43000, + 43003, + 64256, + 64263, + 64275, + 64280, + 65345, + 65371, + 66600, + 66640, + 119834, + 119860, + 119886, + 119893, + 119894, + 119912, + 119938, + 119964, + 119990, + 119994, + 119995, + 119996, + 119997, + 120004, + 120005, + 120016, + 120042, + 120068, + 120094, + 120120, + 120146, + 120172, + 120198, + 120224, + 120250, + 120276, + 120302, + 120328, + 120354, + 120380, + 120406, + 120432, + 120458, + 120486, + 120514, + 120539, + 120540, + 120546, + 120572, + 120597, + 120598, + 120604, + 120630, + 120655, + 120656, + 120662, + 120688, + 120713, + 120714, + 120720, + 120746, + 120771, + 120772, + 120778, + 120779, + 120780 }; #endif #ifndef PERL_IN_XSUB_RE -static UV L1PosixPrint_invlist[] = { - 4, /* Number of elements */ - 0, /* Current iteration position */ - 0, /* Cache of previous search index result */ - 290655244, /* Version and data structure type */ - 1, /* 0 if this is the first element of the list proper; - 1 if the next element is the first */ +static const UV XPosixPrint_invlist[] = { + 1083, /* Number of elements */ + 148565664, /* Version and data structure type */ + 1, /* 0 if the list starts at 0; + 1 if it starts at the element beyond 0 */ + 0, 32, 127, 160, - 888 -}; - -#endif - -#ifndef PERL_IN_XSUB_RE - -static UV PosixPunct_invlist[] = { - 8, /* Number of elements */ - 0, /* Current iteration position */ - 0, /* Cache of previous search index result */ - 290655244, /* Version and data structure type */ - 1, /* 0 if this is the first element of the list proper; - 1 if the next element is the first */ - 33, - 48, - 58, - 65, - 91, - 97, - 123, - 127 + 888, + 890, + 895, + 900, + 907, + 908, + 909, + 910, + 930, + 931, + 1320, + 1329, + 1367, + 1369, + 1376, + 1377, + 1416, + 1417, + 1419, + 1423, + 1424, + 1425, + 1480, + 1488, + 1515, + 1520, + 1525, + 1536, + 1541, + 1542, + 1565, + 1566, + 1806, + 1807, + 1867, + 1869, + 1970, + 1984, + 2043, + 2048, + 2094, + 2096, + 2111, + 2112, + 2140, + 2142, + 2143, + 2208, + 2209, + 2210, + 2221, + 2276, + 2303, + 2304, + 2424, + 2425, + 2432, + 2433, + 2436, + 2437, + 2445, + 2447, + 2449, + 2451, + 2473, + 2474, + 2481, + 2482, + 2483, + 2486, + 2490, + 2492, + 2501, + 2503, + 2505, + 2507, + 2511, + 2519, + 2520, + 2524, + 2526, + 2527, + 2532, + 2534, + 2556, + 2561, + 2564, + 2565, + 2571, + 2575, + 2577, + 2579, + 2601, + 2602, + 2609, + 2610, + 2612, + 2613, + 2615, + 2616, + 2618, + 2620, + 2621, + 2622, + 2627, + 2631, + 2633, + 2635, + 2638, + 2641, + 2642, + 2649, + 2653, + 2654, + 2655, + 2662, + 2678, + 2689, + 2692, + 2693, + 2702, + 2703, + 2706, + 2707, + 2729, + 2730, + 2737, + 2738, + 2740, + 2741, + 2746, + 2748, + 2758, + 2759, + 2762, + 2763, + 2766, + 2768, + 2769, + 2784, + 2788, + 2790, + 2802, + 2817, + 2820, + 2821, + 2829, + 2831, + 2833, + 2835, + 2857, + 2858, + 2865, + 2866, + 2868, + 2869, + 2874, + 2876, + 2885, + 2887, + 2889, + 2891, + 2894, + 2902, + 2904, + 2908, + 2910, + 2911, + 2916, + 2918, + 2936, + 2946, + 2948, + 2949, + 2955, + 2958, + 2961, + 2962, + 2966, + 2969, + 2971, + 2972, + 2973, + 2974, + 2976, + 2979, + 2981, + 2984, + 2987, + 2990, + 3002, + 3006, + 3011, + 3014, + 3017, + 3018, + 3022, + 3024, + 3025, + 3031, + 3032, + 3046, + 3067, + 3073, + 3076, + 3077, + 3085, + 3086, + 3089, + 3090, + 3113, + 3114, + 3124, + 3125, + 3130, + 3133, + 3141, + 3142, + 3145, + 3146, + 3150, + 3157, + 3159, + 3160, + 3162, + 3168, + 3172, + 3174, + 3184, + 3192, + 3200, + 3202, + 3204, + 3205, + 3213, + 3214, + 3217, + 3218, + 3241, + 3242, + 3252, + 3253, + 3258, + 3260, + 3269, + 3270, + 3273, + 3274, + 3278, + 3285, + 3287, + 3294, + 3295, + 3296, + 3300, + 3302, + 3312, + 3313, + 3315, + 3330, + 3332, + 3333, + 3341, + 3342, + 3345, + 3346, + 3387, + 3389, + 3397, + 3398, + 3401, + 3402, + 3407, + 3415, + 3416, + 3424, + 3428, + 3430, + 3446, + 3449, + 3456, + 3458, + 3460, + 3461, + 3479, + 3482, + 3506, + 3507, + 3516, + 3517, + 3518, + 3520, + 3527, + 3530, + 3531, + 3535, + 3541, + 3542, + 3543, + 3544, + 3552, + 3570, + 3573, + 3585, + 3643, + 3647, + 3676, + 3713, + 3715, + 3716, + 3717, + 3719, + 3721, + 3722, + 3723, + 3725, + 3726, + 3732, + 3736, + 3737, + 3744, + 3745, + 3748, + 3749, + 3750, + 3751, + 3752, + 3754, + 3756, + 3757, + 3770, + 3771, + 3774, + 3776, + 3781, + 3782, + 3783, + 3784, + 3790, + 3792, + 3802, + 3804, + 3808, + 3840, + 3912, + 3913, + 3949, + 3953, + 3992, + 3993, + 4029, + 4030, + 4045, + 4046, + 4059, + 4096, + 4294, + 4295, + 4296, + 4301, + 4302, + 4304, + 4681, + 4682, + 4686, + 4688, + 4695, + 4696, + 4697, + 4698, + 4702, + 4704, + 4745, + 4746, + 4750, + 4752, + 4785, + 4786, + 4790, + 4792, + 4799, + 4800, + 4801, + 4802, + 4806, + 4808, + 4823, + 4824, + 4881, + 4882, + 4886, + 4888, + 4955, + 4957, + 4989, + 4992, + 5018, + 5024, + 5109, + 5120, + 5789, + 5792, + 5873, + 5888, + 5901, + 5902, + 5909, + 5920, + 5943, + 5952, + 5972, + 5984, + 5997, + 5998, + 6001, + 6002, + 6004, + 6016, + 6110, + 6112, + 6122, + 6128, + 6138, + 6144, + 6159, + 6160, + 6170, + 6176, + 6264, + 6272, + 6315, + 6320, + 6390, + 6400, + 6429, + 6432, + 6444, + 6448, + 6460, + 6464, + 6465, + 6468, + 6510, + 6512, + 6517, + 6528, + 6572, + 6576, + 6602, + 6608, + 6619, + 6622, + 6684, + 6686, + 6751, + 6752, + 6781, + 6783, + 6794, + 6800, + 6810, + 6816, + 6830, + 6912, + 6988, + 6992, + 7037, + 7040, + 7156, + 7164, + 7224, + 7227, + 7242, + 7245, + 7296, + 7360, + 7368, + 7376, + 7415, + 7424, + 7655, + 7676, + 7958, + 7960, + 7966, + 7968, + 8006, + 8008, + 8014, + 8016, + 8024, + 8025, + 8026, + 8027, + 8028, + 8029, + 8030, + 8031, + 8062, + 8064, + 8117, + 8118, + 8133, + 8134, + 8148, + 8150, + 8156, + 8157, + 8176, + 8178, + 8181, + 8182, + 8191, + 8192, + 8232, + 8234, + 8293, + 8294, + 8306, + 8308, + 8335, + 8336, + 8349, + 8352, + 8379, + 8400, + 8433, + 8448, + 8586, + 8592, + 9204, + 9216, + 9255, + 9280, + 9291, + 9312, + 9984, + 9985, + 11085, + 11088, + 11098, + 11264, + 11311, + 11312, + 11359, + 11360, + 11508, + 11513, + 11558, + 11559, + 11560, + 11565, + 11566, + 11568, + 11624, + 11631, + 11633, + 11647, + 11671, + 11680, + 11687, + 11688, + 11695, + 11696, + 11703, + 11704, + 11711, + 11712, + 11719, + 11720, + 11727, + 11728, + 11735, + 11736, + 11743, + 11744, + 11836, + 11904, + 11930, + 11931, + 12020, + 12032, + 12246, + 12272, + 12284, + 12288, + 12352, + 12353, + 12439, + 12441, + 12544, + 12549, + 12590, + 12593, + 12687, + 12688, + 12731, + 12736, + 12772, + 12784, + 12831, + 12832, + 13055, + 13056, + 19894, + 19904, + 40909, + 40960, + 42125, + 42128, + 42183, + 42192, + 42540, + 42560, + 42648, + 42655, + 42744, + 42752, + 42895, + 42896, + 42900, + 42912, + 42923, + 43000, + 43052, + 43056, + 43066, + 43072, + 43128, + 43136, + 43205, + 43214, + 43226, + 43232, + 43260, + 43264, + 43348, + 43359, + 43389, + 43392, + 43470, + 43471, + 43482, + 43486, + 43488, + 43520, + 43575, + 43584, + 43598, + 43600, + 43610, + 43612, + 43644, + 43648, + 43715, + 43739, + 43767, + 43777, + 43783, + 43785, + 43791, + 43793, + 43799, + 43808, + 43815, + 43816, + 43823, + 43968, + 44014, + 44016, + 44026, + 44032, + 55204, + 55216, + 55239, + 55243, + 55292, + 57344, + 64110, + 64112, + 64218, + 64256, + 64263, + 64275, + 64280, + 64285, + 64311, + 64312, + 64317, + 64318, + 64319, + 64320, + 64322, + 64323, + 64325, + 64326, + 64450, + 64467, + 64832, + 64848, + 64912, + 64914, + 64968, + 65008, + 65022, + 65024, + 65050, + 65056, + 65063, + 65072, + 65107, + 65108, + 65127, + 65128, + 65132, + 65136, + 65141, + 65142, + 65277, + 65279, + 65280, + 65281, + 65471, + 65474, + 65480, + 65482, + 65488, + 65490, + 65496, + 65498, + 65501, + 65504, + 65511, + 65512, + 65519, + 65529, + 65534, + 65536, + 65548, + 65549, + 65575, + 65576, + 65595, + 65596, + 65598, + 65599, + 65614, + 65616, + 65630, + 65664, + 65787, + 65792, + 65795, + 65799, + 65844, + 65847, + 65931, + 65936, + 65948, + 66000, + 66046, + 66176, + 66205, + 66208, + 66257, + 66304, + 66335, + 66336, + 66340, + 66352, + 66379, + 66432, + 66462, + 66463, + 66500, + 66504, + 66518, + 66560, + 66718, + 66720, + 66730, + 67584, + 67590, + 67592, + 67593, + 67594, + 67638, + 67639, + 67641, + 67644, + 67645, + 67647, + 67670, + 67671, + 67680, + 67840, + 67868, + 67871, + 67898, + 67903, + 67904, + 67968, + 68024, + 68030, + 68032, + 68096, + 68100, + 68101, + 68103, + 68108, + 68116, + 68117, + 68120, + 68121, + 68148, + 68152, + 68155, + 68159, + 68168, + 68176, + 68185, + 68192, + 68224, + 68352, + 68406, + 68409, + 68438, + 68440, + 68467, + 68472, + 68480, + 68608, + 68681, + 69216, + 69247, + 69632, + 69710, + 69714, + 69744, + 69760, + 69826, + 69840, + 69865, + 69872, + 69882, + 69888, + 69941, + 69942, + 69956, + 70016, + 70089, + 70096, + 70106, + 71296, + 71352, + 71360, + 71370, + 73728, + 74607, + 74752, + 74851, + 74864, + 74868, + 77824, + 78895, + 92160, + 92729, + 93952, + 94021, + 94032, + 94079, + 94095, + 94112, + 110592, + 110594, + 118784, + 119030, + 119040, + 119079, + 119081, + 119262, + 119296, + 119366, + 119552, + 119639, + 119648, + 119666, + 119808, + 119893, + 119894, + 119965, + 119966, + 119968, + 119970, + 119971, + 119973, + 119975, + 119977, + 119981, + 119982, + 119994, + 119995, + 119996, + 119997, + 120004, + 120005, + 120070, + 120071, + 120075, + 120077, + 120085, + 120086, + 120093, + 120094, + 120122, + 120123, + 120127, + 120128, + 120133, + 120134, + 120135, + 120138, + 120145, + 120146, + 120486, + 120488, + 120780, + 120782, + 120832, + 126464, + 126468, + 126469, + 126496, + 126497, + 126499, + 126500, + 126501, + 126503, + 126504, + 126505, + 126515, + 126516, + 126520, + 126521, + 126522, + 126523, + 126524, + 126530, + 126531, + 126535, + 126536, + 126537, + 126538, + 126539, + 126540, + 126541, + 126544, + 126545, + 126547, + 126548, + 126549, + 126551, + 126552, + 126553, + 126554, + 126555, + 126556, + 126557, + 126558, + 126559, + 126560, + 126561, + 126563, + 126564, + 126565, + 126567, + 126571, + 126572, + 126579, + 126580, + 126584, + 126585, + 126589, + 126590, + 126591, + 126592, + 126602, + 126603, + 126620, + 126625, + 126628, + 126629, + 126634, + 126635, + 126652, + 126704, + 126706, + 126976, + 127020, + 127024, + 127124, + 127136, + 127151, + 127153, + 127167, + 127169, + 127184, + 127185, + 127200, + 127232, + 127243, + 127248, + 127279, + 127280, + 127340, + 127344, + 127387, + 127462, + 127491, + 127504, + 127547, + 127552, + 127561, + 127568, + 127570, + 127744, + 127777, + 127792, + 127798, + 127799, + 127869, + 127872, + 127892, + 127904, + 127941, + 127942, + 127947, + 127968, + 127985, + 128000, + 128063, + 128064, + 128065, + 128066, + 128248, + 128249, + 128253, + 128256, + 128318, + 128320, + 128324, + 128336, + 128360, + 128507, + 128577, + 128581, + 128592, + 128640, + 128710, + 128768, + 128884, + 131072, + 173783, + 173824, + 177973, + 177984, + 178206, + 194560, + 195102, + 917505, + 917506, + 917536, + 917632, + 917760, + 918000, + 983040, + 1048574, + 1048576, + 1114110 }; #endif #ifndef PERL_IN_XSUB_RE -static UV L1PosixPunct_invlist[] = { - 20, /* Number of elements */ - 0, /* Current iteration position */ - 0, /* Cache of previous search index result */ - 290655244, /* Version and data structure type */ - 1, /* 0 if this is the first element of the list proper; - 1 if the next element is the first */ +static const UV XPosixPunct_invlist[] = { + 273, /* Number of elements */ + 148565664, /* Version and data structure type */ + 1, /* 0 if the list starts at 0; + 1 if it starts at the element beyond 0 */ + 0, 33, 48, 58, @@ -497,37 +6190,271 @@ static UV L1PosixPunct_invlist[] = { 187, 188, 191, - 192 -}; - -#endif - -#ifndef PERL_IN_XSUB_RE - -static UV PosixSpace_invlist[] = { - 4, /* Number of elements */ - 0, /* Current iteration position */ - 0, /* Cache of previous search index result */ - 290655244, /* Version and data structure type */ - 1, /* 0 if this is the first element of the list proper; - 1 if the next element is the first */ - 9, - 14, - 32, - 33 + 192, + 894, + 895, + 903, + 904, + 1370, + 1376, + 1417, + 1419, + 1470, + 1471, + 1472, + 1473, + 1475, + 1476, + 1478, + 1479, + 1523, + 1525, + 1545, + 1547, + 1548, + 1550, + 1563, + 1564, + 1566, + 1568, + 1642, + 1646, + 1748, + 1749, + 1792, + 1806, + 2039, + 2042, + 2096, + 2111, + 2142, + 2143, + 2404, + 2406, + 2416, + 2417, + 2800, + 2801, + 3572, + 3573, + 3663, + 3664, + 3674, + 3676, + 3844, + 3859, + 3860, + 3861, + 3898, + 3902, + 3973, + 3974, + 4048, + 4053, + 4057, + 4059, + 4170, + 4176, + 4347, + 4348, + 4960, + 4969, + 5120, + 5121, + 5741, + 5743, + 5787, + 5789, + 5867, + 5870, + 5941, + 5943, + 6100, + 6103, + 6104, + 6107, + 6144, + 6155, + 6468, + 6470, + 6686, + 6688, + 6816, + 6823, + 6824, + 6830, + 7002, + 7009, + 7164, + 7168, + 7227, + 7232, + 7294, + 7296, + 7360, + 7368, + 7379, + 7380, + 8208, + 8232, + 8240, + 8260, + 8261, + 8274, + 8275, + 8287, + 8317, + 8319, + 8333, + 8335, + 8968, + 8972, + 9001, + 9003, + 10088, + 10102, + 10181, + 10183, + 10214, + 10224, + 10627, + 10649, + 10712, + 10716, + 10748, + 10750, + 11513, + 11517, + 11518, + 11520, + 11632, + 11633, + 11776, + 11823, + 11824, + 11836, + 12289, + 12292, + 12296, + 12306, + 12308, + 12320, + 12336, + 12337, + 12349, + 12350, + 12448, + 12449, + 12539, + 12540, + 42238, + 42240, + 42509, + 42512, + 42611, + 42612, + 42622, + 42623, + 42738, + 42744, + 43124, + 43128, + 43214, + 43216, + 43256, + 43259, + 43310, + 43312, + 43359, + 43360, + 43457, + 43470, + 43486, + 43488, + 43612, + 43616, + 43742, + 43744, + 43760, + 43762, + 44011, + 44012, + 64830, + 64832, + 65040, + 65050, + 65072, + 65107, + 65108, + 65122, + 65123, + 65124, + 65128, + 65129, + 65130, + 65132, + 65281, + 65284, + 65285, + 65291, + 65292, + 65296, + 65306, + 65308, + 65311, + 65313, + 65339, + 65342, + 65343, + 65344, + 65371, + 65372, + 65373, + 65374, + 65375, + 65382, + 65792, + 65795, + 66463, + 66464, + 66512, + 66513, + 67671, + 67672, + 67871, + 67872, + 67903, + 67904, + 68176, + 68185, + 68223, + 68224, + 68409, + 68416, + 69703, + 69710, + 69819, + 69821, + 69822, + 69826, + 69952, + 69956, + 70085, + 70089, + 74864, + 74868 }; #endif #ifndef PERL_IN_XSUB_RE -static UV XPosixSpace_invlist[] = { - 22, /* Number of elements */ - 0, /* Current iteration position */ - 0, /* Cache of previous search index result */ - 290655244, /* Version and data structure type */ - 1, /* 0 if this is the first element of the list proper; - 1 if the next element is the first */ +static const UV XPosixSpace_invlist[] = { + 21, /* Number of elements */ + 148565664, /* Version and data structure type */ + 1, /* 0 if the list starts at 0; + 1 if it starts at the element beyond 0 */ + 0, 9, 14, 32, @@ -538,8 +6465,6 @@ static UV XPosixSpace_invlist[] = { 161, 5760, 5761, - 6158, - 6159, 8192, 8203, 8232, @@ -556,68 +6481,1244 @@ static UV XPosixSpace_invlist[] = { #ifndef PERL_IN_XSUB_RE -static UV PosixUpper_invlist[] = { - 2, /* Number of elements */ - 0, /* Current iteration position */ - 0, /* Cache of previous search index result */ - 290655244, /* Version and data structure type */ - 1, /* 0 if this is the first element of the list proper; - 1 if the next element is the first */ - 65, - 91 -}; - -#endif - -#ifndef PERL_IN_XSUB_RE - -static UV L1PosixUpper_invlist[] = { - 6, /* Number of elements */ - 0, /* Current iteration position */ - 0, /* Cache of previous search index result */ - 290655244, /* Version and data structure type */ - 1, /* 0 if this is the first element of the list proper; - 1 if the next element is the first */ +static const UV XPosixUpper_invlist[] = { + 1221, /* Number of elements */ + 148565664, /* Version and data structure type */ + 1, /* 0 if the list starts at 0; + 1 if it starts at the element beyond 0 */ + 0, 65, 91, 192, 215, 216, - 223 -}; - -#endif - -#ifndef PERL_IN_XSUB_RE - -static UV PosixWord_invlist[] = { - 8, /* Number of elements */ - 0, /* Current iteration position */ - 0, /* Cache of previous search index result */ - 290655244, /* Version and data structure type */ - 1, /* 0 if this is the first element of the list proper; - 1 if the next element is the first */ - 48, - 58, - 65, - 91, - 95, - 96, - 97, - 123 + 223, + 256, + 257, + 258, + 259, + 260, + 261, + 262, + 263, + 264, + 265, + 266, + 267, + 268, + 269, + 270, + 271, + 272, + 273, + 274, + 275, + 276, + 277, + 278, + 279, + 280, + 281, + 282, + 283, + 284, + 285, + 286, + 287, + 288, + 289, + 290, + 291, + 292, + 293, + 294, + 295, + 296, + 297, + 298, + 299, + 300, + 301, + 302, + 303, + 304, + 305, + 306, + 307, + 308, + 309, + 310, + 311, + 313, + 314, + 315, + 316, + 317, + 318, + 319, + 320, + 321, + 322, + 323, + 324, + 325, + 326, + 327, + 328, + 330, + 331, + 332, + 333, + 334, + 335, + 336, + 337, + 338, + 339, + 340, + 341, + 342, + 343, + 344, + 345, + 346, + 347, + 348, + 349, + 350, + 351, + 352, + 353, + 354, + 355, + 356, + 357, + 358, + 359, + 360, + 361, + 362, + 363, + 364, + 365, + 366, + 367, + 368, + 369, + 370, + 371, + 372, + 373, + 374, + 375, + 376, + 378, + 379, + 380, + 381, + 382, + 385, + 387, + 388, + 389, + 390, + 392, + 393, + 396, + 398, + 402, + 403, + 405, + 406, + 409, + 412, + 414, + 415, + 417, + 418, + 419, + 420, + 421, + 422, + 424, + 425, + 426, + 428, + 429, + 430, + 432, + 433, + 436, + 437, + 438, + 439, + 441, + 444, + 445, + 452, + 453, + 455, + 456, + 458, + 459, + 461, + 462, + 463, + 464, + 465, + 466, + 467, + 468, + 469, + 470, + 471, + 472, + 473, + 474, + 475, + 476, + 478, + 479, + 480, + 481, + 482, + 483, + 484, + 485, + 486, + 487, + 488, + 489, + 490, + 491, + 492, + 493, + 494, + 495, + 497, + 498, + 500, + 501, + 502, + 505, + 506, + 507, + 508, + 509, + 510, + 511, + 512, + 513, + 514, + 515, + 516, + 517, + 518, + 519, + 520, + 521, + 522, + 523, + 524, + 525, + 526, + 527, + 528, + 529, + 530, + 531, + 532, + 533, + 534, + 535, + 536, + 537, + 538, + 539, + 540, + 541, + 542, + 543, + 544, + 545, + 546, + 547, + 548, + 549, + 550, + 551, + 552, + 553, + 554, + 555, + 556, + 557, + 558, + 559, + 560, + 561, + 562, + 563, + 570, + 572, + 573, + 575, + 577, + 578, + 579, + 583, + 584, + 585, + 586, + 587, + 588, + 589, + 590, + 591, + 880, + 881, + 882, + 883, + 886, + 887, + 902, + 903, + 904, + 907, + 908, + 909, + 910, + 912, + 913, + 930, + 931, + 940, + 975, + 976, + 978, + 981, + 984, + 985, + 986, + 987, + 988, + 989, + 990, + 991, + 992, + 993, + 994, + 995, + 996, + 997, + 998, + 999, + 1000, + 1001, + 1002, + 1003, + 1004, + 1005, + 1006, + 1007, + 1012, + 1013, + 1015, + 1016, + 1017, + 1019, + 1021, + 1072, + 1120, + 1121, + 1122, + 1123, + 1124, + 1125, + 1126, + 1127, + 1128, + 1129, + 1130, + 1131, + 1132, + 1133, + 1134, + 1135, + 1136, + 1137, + 1138, + 1139, + 1140, + 1141, + 1142, + 1143, + 1144, + 1145, + 1146, + 1147, + 1148, + 1149, + 1150, + 1151, + 1152, + 1153, + 1162, + 1163, + 1164, + 1165, + 1166, + 1167, + 1168, + 1169, + 1170, + 1171, + 1172, + 1173, + 1174, + 1175, + 1176, + 1177, + 1178, + 1179, + 1180, + 1181, + 1182, + 1183, + 1184, + 1185, + 1186, + 1187, + 1188, + 1189, + 1190, + 1191, + 1192, + 1193, + 1194, + 1195, + 1196, + 1197, + 1198, + 1199, + 1200, + 1201, + 1202, + 1203, + 1204, + 1205, + 1206, + 1207, + 1208, + 1209, + 1210, + 1211, + 1212, + 1213, + 1214, + 1215, + 1216, + 1218, + 1219, + 1220, + 1221, + 1222, + 1223, + 1224, + 1225, + 1226, + 1227, + 1228, + 1229, + 1230, + 1232, + 1233, + 1234, + 1235, + 1236, + 1237, + 1238, + 1239, + 1240, + 1241, + 1242, + 1243, + 1244, + 1245, + 1246, + 1247, + 1248, + 1249, + 1250, + 1251, + 1252, + 1253, + 1254, + 1255, + 1256, + 1257, + 1258, + 1259, + 1260, + 1261, + 1262, + 1263, + 1264, + 1265, + 1266, + 1267, + 1268, + 1269, + 1270, + 1271, + 1272, + 1273, + 1274, + 1275, + 1276, + 1277, + 1278, + 1279, + 1280, + 1281, + 1282, + 1283, + 1284, + 1285, + 1286, + 1287, + 1288, + 1289, + 1290, + 1291, + 1292, + 1293, + 1294, + 1295, + 1296, + 1297, + 1298, + 1299, + 1300, + 1301, + 1302, + 1303, + 1304, + 1305, + 1306, + 1307, + 1308, + 1309, + 1310, + 1311, + 1312, + 1313, + 1314, + 1315, + 1316, + 1317, + 1318, + 1319, + 1329, + 1367, + 4256, + 4294, + 4295, + 4296, + 4301, + 4302, + 7680, + 7681, + 7682, + 7683, + 7684, + 7685, + 7686, + 7687, + 7688, + 7689, + 7690, + 7691, + 7692, + 7693, + 7694, + 7695, + 7696, + 7697, + 7698, + 7699, + 7700, + 7701, + 7702, + 7703, + 7704, + 7705, + 7706, + 7707, + 7708, + 7709, + 7710, + 7711, + 7712, + 7713, + 7714, + 7715, + 7716, + 7717, + 7718, + 7719, + 7720, + 7721, + 7722, + 7723, + 7724, + 7725, + 7726, + 7727, + 7728, + 7729, + 7730, + 7731, + 7732, + 7733, + 7734, + 7735, + 7736, + 7737, + 7738, + 7739, + 7740, + 7741, + 7742, + 7743, + 7744, + 7745, + 7746, + 7747, + 7748, + 7749, + 7750, + 7751, + 7752, + 7753, + 7754, + 7755, + 7756, + 7757, + 7758, + 7759, + 7760, + 7761, + 7762, + 7763, + 7764, + 7765, + 7766, + 7767, + 7768, + 7769, + 7770, + 7771, + 7772, + 7773, + 7774, + 7775, + 7776, + 7777, + 7778, + 7779, + 7780, + 7781, + 7782, + 7783, + 7784, + 7785, + 7786, + 7787, + 7788, + 7789, + 7790, + 7791, + 7792, + 7793, + 7794, + 7795, + 7796, + 7797, + 7798, + 7799, + 7800, + 7801, + 7802, + 7803, + 7804, + 7805, + 7806, + 7807, + 7808, + 7809, + 7810, + 7811, + 7812, + 7813, + 7814, + 7815, + 7816, + 7817, + 7818, + 7819, + 7820, + 7821, + 7822, + 7823, + 7824, + 7825, + 7826, + 7827, + 7828, + 7829, + 7838, + 7839, + 7840, + 7841, + 7842, + 7843, + 7844, + 7845, + 7846, + 7847, + 7848, + 7849, + 7850, + 7851, + 7852, + 7853, + 7854, + 7855, + 7856, + 7857, + 7858, + 7859, + 7860, + 7861, + 7862, + 7863, + 7864, + 7865, + 7866, + 7867, + 7868, + 7869, + 7870, + 7871, + 7872, + 7873, + 7874, + 7875, + 7876, + 7877, + 7878, + 7879, + 7880, + 7881, + 7882, + 7883, + 7884, + 7885, + 7886, + 7887, + 7888, + 7889, + 7890, + 7891, + 7892, + 7893, + 7894, + 7895, + 7896, + 7897, + 7898, + 7899, + 7900, + 7901, + 7902, + 7903, + 7904, + 7905, + 7906, + 7907, + 7908, + 7909, + 7910, + 7911, + 7912, + 7913, + 7914, + 7915, + 7916, + 7917, + 7918, + 7919, + 7920, + 7921, + 7922, + 7923, + 7924, + 7925, + 7926, + 7927, + 7928, + 7929, + 7930, + 7931, + 7932, + 7933, + 7934, + 7935, + 7944, + 7952, + 7960, + 7966, + 7976, + 7984, + 7992, + 8000, + 8008, + 8014, + 8025, + 8026, + 8027, + 8028, + 8029, + 8030, + 8031, + 8032, + 8040, + 8048, + 8120, + 8124, + 8136, + 8140, + 8152, + 8156, + 8168, + 8173, + 8184, + 8188, + 8450, + 8451, + 8455, + 8456, + 8459, + 8462, + 8464, + 8467, + 8469, + 8470, + 8473, + 8478, + 8484, + 8485, + 8486, + 8487, + 8488, + 8489, + 8490, + 8494, + 8496, + 8500, + 8510, + 8512, + 8517, + 8518, + 8544, + 8560, + 8579, + 8580, + 9398, + 9424, + 11264, + 11311, + 11360, + 11361, + 11362, + 11365, + 11367, + 11368, + 11369, + 11370, + 11371, + 11372, + 11373, + 11377, + 11378, + 11379, + 11381, + 11382, + 11390, + 11393, + 11394, + 11395, + 11396, + 11397, + 11398, + 11399, + 11400, + 11401, + 11402, + 11403, + 11404, + 11405, + 11406, + 11407, + 11408, + 11409, + 11410, + 11411, + 11412, + 11413, + 11414, + 11415, + 11416, + 11417, + 11418, + 11419, + 11420, + 11421, + 11422, + 11423, + 11424, + 11425, + 11426, + 11427, + 11428, + 11429, + 11430, + 11431, + 11432, + 11433, + 11434, + 11435, + 11436, + 11437, + 11438, + 11439, + 11440, + 11441, + 11442, + 11443, + 11444, + 11445, + 11446, + 11447, + 11448, + 11449, + 11450, + 11451, + 11452, + 11453, + 11454, + 11455, + 11456, + 11457, + 11458, + 11459, + 11460, + 11461, + 11462, + 11463, + 11464, + 11465, + 11466, + 11467, + 11468, + 11469, + 11470, + 11471, + 11472, + 11473, + 11474, + 11475, + 11476, + 11477, + 11478, + 11479, + 11480, + 11481, + 11482, + 11483, + 11484, + 11485, + 11486, + 11487, + 11488, + 11489, + 11490, + 11491, + 11499, + 11500, + 11501, + 11502, + 11506, + 11507, + 42560, + 42561, + 42562, + 42563, + 42564, + 42565, + 42566, + 42567, + 42568, + 42569, + 42570, + 42571, + 42572, + 42573, + 42574, + 42575, + 42576, + 42577, + 42578, + 42579, + 42580, + 42581, + 42582, + 42583, + 42584, + 42585, + 42586, + 42587, + 42588, + 42589, + 42590, + 42591, + 42592, + 42593, + 42594, + 42595, + 42596, + 42597, + 42598, + 42599, + 42600, + 42601, + 42602, + 42603, + 42604, + 42605, + 42624, + 42625, + 42626, + 42627, + 42628, + 42629, + 42630, + 42631, + 42632, + 42633, + 42634, + 42635, + 42636, + 42637, + 42638, + 42639, + 42640, + 42641, + 42642, + 42643, + 42644, + 42645, + 42646, + 42647, + 42786, + 42787, + 42788, + 42789, + 42790, + 42791, + 42792, + 42793, + 42794, + 42795, + 42796, + 42797, + 42798, + 42799, + 42802, + 42803, + 42804, + 42805, + 42806, + 42807, + 42808, + 42809, + 42810, + 42811, + 42812, + 42813, + 42814, + 42815, + 42816, + 42817, + 42818, + 42819, + 42820, + 42821, + 42822, + 42823, + 42824, + 42825, + 42826, + 42827, + 42828, + 42829, + 42830, + 42831, + 42832, + 42833, + 42834, + 42835, + 42836, + 42837, + 42838, + 42839, + 42840, + 42841, + 42842, + 42843, + 42844, + 42845, + 42846, + 42847, + 42848, + 42849, + 42850, + 42851, + 42852, + 42853, + 42854, + 42855, + 42856, + 42857, + 42858, + 42859, + 42860, + 42861, + 42862, + 42863, + 42873, + 42874, + 42875, + 42876, + 42877, + 42879, + 42880, + 42881, + 42882, + 42883, + 42884, + 42885, + 42886, + 42887, + 42891, + 42892, + 42893, + 42894, + 42896, + 42897, + 42898, + 42899, + 42912, + 42913, + 42914, + 42915, + 42916, + 42917, + 42918, + 42919, + 42920, + 42921, + 42922, + 42923, + 65313, + 65339, + 66560, + 66600, + 119808, + 119834, + 119860, + 119886, + 119912, + 119938, + 119964, + 119965, + 119966, + 119968, + 119970, + 119971, + 119973, + 119975, + 119977, + 119981, + 119982, + 119990, + 120016, + 120042, + 120068, + 120070, + 120071, + 120075, + 120077, + 120085, + 120086, + 120093, + 120120, + 120122, + 120123, + 120127, + 120128, + 120133, + 120134, + 120135, + 120138, + 120145, + 120172, + 120198, + 120224, + 120250, + 120276, + 120302, + 120328, + 120354, + 120380, + 120406, + 120432, + 120458, + 120488, + 120513, + 120546, + 120571, + 120604, + 120629, + 120662, + 120687, + 120720, + 120745, + 120778, + 120779 }; #endif #ifndef PERL_IN_XSUB_RE -static UV L1PosixWord_invlist[] = { - 20, /* Number of elements */ - 0, /* Current iteration position */ - 0, /* Cache of previous search index result */ - 290655244, /* Version and data structure type */ - 1, /* 0 if this is the first element of the list proper; - 1 if the next element is the first */ +static const UV XPosixWord_invlist[] = { + 1131, /* Number of elements */ + 148565664, /* Version and data structure type */ + 1, /* 0 if the list starts at 0; + 1 if it starts at the element beyond 0 */ + 0, 48, 58, 65, @@ -637,62 +7738,1391 @@ static UV L1PosixWord_invlist[] = { 216, 247, 248, - 706 + 706, + 710, + 722, + 736, + 741, + 748, + 749, + 750, + 751, + 768, + 885, + 886, + 888, + 890, + 894, + 902, + 903, + 904, + 907, + 908, + 909, + 910, + 930, + 931, + 1014, + 1015, + 1154, + 1155, + 1320, + 1329, + 1367, + 1369, + 1370, + 1377, + 1416, + 1425, + 1470, + 1471, + 1472, + 1473, + 1475, + 1476, + 1478, + 1479, + 1480, + 1488, + 1515, + 1520, + 1523, + 1552, + 1563, + 1568, + 1642, + 1646, + 1748, + 1749, + 1757, + 1759, + 1769, + 1770, + 1789, + 1791, + 1792, + 1808, + 1867, + 1869, + 1970, + 1984, + 2038, + 2042, + 2043, + 2048, + 2094, + 2112, + 2140, + 2208, + 2209, + 2210, + 2221, + 2276, + 2303, + 2304, + 2404, + 2406, + 2416, + 2417, + 2424, + 2425, + 2432, + 2433, + 2436, + 2437, + 2445, + 2447, + 2449, + 2451, + 2473, + 2474, + 2481, + 2482, + 2483, + 2486, + 2490, + 2492, + 2501, + 2503, + 2505, + 2507, + 2511, + 2519, + 2520, + 2524, + 2526, + 2527, + 2532, + 2534, + 2546, + 2561, + 2564, + 2565, + 2571, + 2575, + 2577, + 2579, + 2601, + 2602, + 2609, + 2610, + 2612, + 2613, + 2615, + 2616, + 2618, + 2620, + 2621, + 2622, + 2627, + 2631, + 2633, + 2635, + 2638, + 2641, + 2642, + 2649, + 2653, + 2654, + 2655, + 2662, + 2678, + 2689, + 2692, + 2693, + 2702, + 2703, + 2706, + 2707, + 2729, + 2730, + 2737, + 2738, + 2740, + 2741, + 2746, + 2748, + 2758, + 2759, + 2762, + 2763, + 2766, + 2768, + 2769, + 2784, + 2788, + 2790, + 2800, + 2817, + 2820, + 2821, + 2829, + 2831, + 2833, + 2835, + 2857, + 2858, + 2865, + 2866, + 2868, + 2869, + 2874, + 2876, + 2885, + 2887, + 2889, + 2891, + 2894, + 2902, + 2904, + 2908, + 2910, + 2911, + 2916, + 2918, + 2928, + 2929, + 2930, + 2946, + 2948, + 2949, + 2955, + 2958, + 2961, + 2962, + 2966, + 2969, + 2971, + 2972, + 2973, + 2974, + 2976, + 2979, + 2981, + 2984, + 2987, + 2990, + 3002, + 3006, + 3011, + 3014, + 3017, + 3018, + 3022, + 3024, + 3025, + 3031, + 3032, + 3046, + 3056, + 3073, + 3076, + 3077, + 3085, + 3086, + 3089, + 3090, + 3113, + 3114, + 3124, + 3125, + 3130, + 3133, + 3141, + 3142, + 3145, + 3146, + 3150, + 3157, + 3159, + 3160, + 3162, + 3168, + 3172, + 3174, + 3184, + 3202, + 3204, + 3205, + 3213, + 3214, + 3217, + 3218, + 3241, + 3242, + 3252, + 3253, + 3258, + 3260, + 3269, + 3270, + 3273, + 3274, + 3278, + 3285, + 3287, + 3294, + 3295, + 3296, + 3300, + 3302, + 3312, + 3313, + 3315, + 3330, + 3332, + 3333, + 3341, + 3342, + 3345, + 3346, + 3387, + 3389, + 3397, + 3398, + 3401, + 3402, + 3407, + 3415, + 3416, + 3424, + 3428, + 3430, + 3440, + 3450, + 3456, + 3458, + 3460, + 3461, + 3479, + 3482, + 3506, + 3507, + 3516, + 3517, + 3518, + 3520, + 3527, + 3530, + 3531, + 3535, + 3541, + 3542, + 3543, + 3544, + 3552, + 3570, + 3572, + 3585, + 3643, + 3648, + 3663, + 3664, + 3674, + 3713, + 3715, + 3716, + 3717, + 3719, + 3721, + 3722, + 3723, + 3725, + 3726, + 3732, + 3736, + 3737, + 3744, + 3745, + 3748, + 3749, + 3750, + 3751, + 3752, + 3754, + 3756, + 3757, + 3770, + 3771, + 3774, + 3776, + 3781, + 3782, + 3783, + 3784, + 3790, + 3792, + 3802, + 3804, + 3808, + 3840, + 3841, + 3864, + 3866, + 3872, + 3882, + 3893, + 3894, + 3895, + 3896, + 3897, + 3898, + 3902, + 3912, + 3913, + 3949, + 3953, + 3973, + 3974, + 3992, + 3993, + 4029, + 4038, + 4039, + 4096, + 4170, + 4176, + 4254, + 4256, + 4294, + 4295, + 4296, + 4301, + 4302, + 4304, + 4347, + 4348, + 4681, + 4682, + 4686, + 4688, + 4695, + 4696, + 4697, + 4698, + 4702, + 4704, + 4745, + 4746, + 4750, + 4752, + 4785, + 4786, + 4790, + 4792, + 4799, + 4800, + 4801, + 4802, + 4806, + 4808, + 4823, + 4824, + 4881, + 4882, + 4886, + 4888, + 4955, + 4957, + 4960, + 4992, + 5008, + 5024, + 5109, + 5121, + 5741, + 5743, + 5760, + 5761, + 5787, + 5792, + 5867, + 5870, + 5873, + 5888, + 5901, + 5902, + 5909, + 5920, + 5941, + 5952, + 5972, + 5984, + 5997, + 5998, + 6001, + 6002, + 6004, + 6016, + 6100, + 6103, + 6104, + 6108, + 6110, + 6112, + 6122, + 6155, + 6158, + 6160, + 6170, + 6176, + 6264, + 6272, + 6315, + 6320, + 6390, + 6400, + 6429, + 6432, + 6444, + 6448, + 6460, + 6470, + 6510, + 6512, + 6517, + 6528, + 6572, + 6576, + 6602, + 6608, + 6618, + 6656, + 6684, + 6688, + 6751, + 6752, + 6781, + 6783, + 6794, + 6800, + 6810, + 6823, + 6824, + 6912, + 6988, + 6992, + 7002, + 7019, + 7028, + 7040, + 7156, + 7168, + 7224, + 7232, + 7242, + 7245, + 7294, + 7376, + 7379, + 7380, + 7415, + 7424, + 7655, + 7676, + 7958, + 7960, + 7966, + 7968, + 8006, + 8008, + 8014, + 8016, + 8024, + 8025, + 8026, + 8027, + 8028, + 8029, + 8030, + 8031, + 8062, + 8064, + 8117, + 8118, + 8125, + 8126, + 8127, + 8130, + 8133, + 8134, + 8141, + 8144, + 8148, + 8150, + 8156, + 8160, + 8173, + 8178, + 8181, + 8182, + 8189, + 8204, + 8206, + 8255, + 8257, + 8276, + 8277, + 8305, + 8306, + 8319, + 8320, + 8336, + 8349, + 8400, + 8433, + 8450, + 8451, + 8455, + 8456, + 8458, + 8468, + 8469, + 8470, + 8473, + 8478, + 8484, + 8485, + 8486, + 8487, + 8488, + 8489, + 8490, + 8494, + 8495, + 8506, + 8508, + 8512, + 8517, + 8522, + 8526, + 8527, + 8544, + 8585, + 9398, + 9450, + 11264, + 11311, + 11312, + 11359, + 11360, + 11493, + 11499, + 11508, + 11520, + 11558, + 11559, + 11560, + 11565, + 11566, + 11568, + 11624, + 11631, + 11632, + 11647, + 11671, + 11680, + 11687, + 11688, + 11695, + 11696, + 11703, + 11704, + 11711, + 11712, + 11719, + 11720, + 11727, + 11728, + 11735, + 11736, + 11743, + 11744, + 11776, + 11823, + 11824, + 12293, + 12296, + 12321, + 12336, + 12337, + 12342, + 12344, + 12349, + 12353, + 12439, + 12441, + 12443, + 12445, + 12448, + 12449, + 12539, + 12540, + 12544, + 12549, + 12590, + 12593, + 12687, + 12704, + 12731, + 12784, + 12800, + 13312, + 19894, + 19968, + 40909, + 40960, + 42125, + 42192, + 42238, + 42240, + 42509, + 42512, + 42540, + 42560, + 42611, + 42612, + 42622, + 42623, + 42648, + 42655, + 42738, + 42775, + 42784, + 42786, + 42889, + 42891, + 42895, + 42896, + 42900, + 42912, + 42923, + 43000, + 43048, + 43072, + 43124, + 43136, + 43205, + 43216, + 43226, + 43232, + 43256, + 43259, + 43260, + 43264, + 43310, + 43312, + 43348, + 43360, + 43389, + 43392, + 43457, + 43471, + 43482, + 43520, + 43575, + 43584, + 43598, + 43600, + 43610, + 43616, + 43639, + 43642, + 43644, + 43648, + 43715, + 43739, + 43742, + 43744, + 43760, + 43762, + 43767, + 43777, + 43783, + 43785, + 43791, + 43793, + 43799, + 43808, + 43815, + 43816, + 43823, + 43968, + 44011, + 44012, + 44014, + 44016, + 44026, + 44032, + 55204, + 55216, + 55239, + 55243, + 55292, + 63744, + 64110, + 64112, + 64218, + 64256, + 64263, + 64275, + 64280, + 64285, + 64297, + 64298, + 64311, + 64312, + 64317, + 64318, + 64319, + 64320, + 64322, + 64323, + 64325, + 64326, + 64434, + 64467, + 64830, + 64848, + 64912, + 64914, + 64968, + 65008, + 65020, + 65024, + 65040, + 65056, + 65063, + 65075, + 65077, + 65101, + 65104, + 65136, + 65141, + 65142, + 65277, + 65296, + 65306, + 65313, + 65339, + 65343, + 65344, + 65345, + 65371, + 65382, + 65471, + 65474, + 65480, + 65482, + 65488, + 65490, + 65496, + 65498, + 65501, + 65536, + 65548, + 65549, + 65575, + 65576, + 65595, + 65596, + 65598, + 65599, + 65614, + 65616, + 65630, + 65664, + 65787, + 65856, + 65909, + 66045, + 66046, + 66176, + 66205, + 66208, + 66257, + 66304, + 66335, + 66352, + 66379, + 66432, + 66462, + 66464, + 66500, + 66504, + 66512, + 66513, + 66518, + 66560, + 66718, + 66720, + 66730, + 67584, + 67590, + 67592, + 67593, + 67594, + 67638, + 67639, + 67641, + 67644, + 67645, + 67647, + 67670, + 67840, + 67862, + 67872, + 67898, + 67968, + 68024, + 68030, + 68032, + 68096, + 68100, + 68101, + 68103, + 68108, + 68116, + 68117, + 68120, + 68121, + 68148, + 68152, + 68155, + 68159, + 68160, + 68192, + 68221, + 68352, + 68406, + 68416, + 68438, + 68448, + 68467, + 68608, + 68681, + 69632, + 69703, + 69734, + 69744, + 69760, + 69819, + 69840, + 69865, + 69872, + 69882, + 69888, + 69941, + 69942, + 69952, + 70016, + 70085, + 70096, + 70106, + 71296, + 71352, + 71360, + 71370, + 73728, + 74607, + 74752, + 74851, + 77824, + 78895, + 92160, + 92729, + 93952, + 94021, + 94032, + 94079, + 94095, + 94112, + 110592, + 110594, + 119141, + 119146, + 119149, + 119155, + 119163, + 119171, + 119173, + 119180, + 119210, + 119214, + 119362, + 119365, + 119808, + 119893, + 119894, + 119965, + 119966, + 119968, + 119970, + 119971, + 119973, + 119975, + 119977, + 119981, + 119982, + 119994, + 119995, + 119996, + 119997, + 120004, + 120005, + 120070, + 120071, + 120075, + 120077, + 120085, + 120086, + 120093, + 120094, + 120122, + 120123, + 120127, + 120128, + 120133, + 120134, + 120135, + 120138, + 120145, + 120146, + 120486, + 120488, + 120513, + 120514, + 120539, + 120540, + 120571, + 120572, + 120597, + 120598, + 120629, + 120630, + 120655, + 120656, + 120687, + 120688, + 120713, + 120714, + 120745, + 120746, + 120771, + 120772, + 120780, + 120782, + 120832, + 126464, + 126468, + 126469, + 126496, + 126497, + 126499, + 126500, + 126501, + 126503, + 126504, + 126505, + 126515, + 126516, + 126520, + 126521, + 126522, + 126523, + 126524, + 126530, + 126531, + 126535, + 126536, + 126537, + 126538, + 126539, + 126540, + 126541, + 126544, + 126545, + 126547, + 126548, + 126549, + 126551, + 126552, + 126553, + 126554, + 126555, + 126556, + 126557, + 126558, + 126559, + 126560, + 126561, + 126563, + 126564, + 126565, + 126567, + 126571, + 126572, + 126579, + 126580, + 126584, + 126585, + 126589, + 126590, + 126591, + 126592, + 126602, + 126603, + 126620, + 126625, + 126628, + 126629, + 126634, + 126635, + 126652, + 131072, + 173783, + 173824, + 177973, + 177984, + 178206, + 194560, + 195102, + 917760, + 918000 }; #endif #ifndef PERL_IN_XSUB_RE -static UV PosixXDigit_invlist[] = { - 6, /* Number of elements */ - 0, /* Current iteration position */ - 0, /* Cache of previous search index result */ - 290655244, /* Version and data structure type */ - 1, /* 0 if this is the first element of the list proper; - 1 if the next element is the first */ +static const UV XPosixXDigit_invlist[] = { + 13, /* Number of elements */ + 148565664, /* Version and data structure type */ + 1, /* 0 if the list starts at 0; + 1 if it starts at the element beyond 0 */ + 0, 48, 58, 65, 71, 97, - 103 + 103, + 65296, + 65306, + 65313, + 65319, + 65345, + 65351 }; #endif #ifndef PERL_IN_XSUB_RE -static UV XPosixXDigit_invlist[] = { - 12, /* Number of elements */ - 0, /* Current iteration position */ - 0, /* Cache of previous search index result */ - 290655244, /* Version and data structure type */ - 1, /* 0 if this is the first element of the list proper; - 1 if the next element is the first */ - 48, - 58, +static const UV _Perl_Any_Folds_invlist[] = { + 229, /* Number of elements */ + 148565664, /* Version and data structure type */ + 1, /* 0 if the list starts at 0; + 1 if it starts at the element beyond 0 */ + 0, 65, - 71, + 91, 97, - 103, - 65296, - 65306, + 123, + 181, + 182, + 192, + 215, + 216, + 247, + 248, + 305, + 306, + 312, + 313, + 397, + 398, + 411, + 412, + 426, + 428, + 442, + 444, + 446, + 447, + 448, + 452, + 545, + 546, + 564, + 570, + 597, + 598, + 600, + 601, + 602, + 603, + 604, + 608, + 609, + 611, + 612, + 613, + 615, + 616, + 618, + 619, + 620, + 623, + 624, + 625, + 627, + 629, + 630, + 637, + 638, + 640, + 641, + 643, + 644, + 648, + 653, + 658, + 659, + 700, + 701, + 702, + 703, + 768, + 770, + 775, + 777, + 778, + 779, + 780, + 781, + 787, + 788, + 817, + 818, + 834, + 835, + 837, + 838, + 880, + 884, + 886, + 888, + 891, + 894, + 902, + 903, + 904, + 907, + 908, + 909, + 910, + 930, + 931, + 978, + 981, + 1011, + 1012, + 1014, + 1015, + 1020, + 1021, + 1154, + 1162, + 1320, + 1329, + 1367, + 1377, + 1416, + 4256, + 4294, + 4295, + 4296, + 4301, + 4302, + 7545, + 7546, + 7549, + 7550, + 7680, + 7836, + 7838, + 7839, + 7840, + 7958, + 7960, + 7966, + 7968, + 8006, + 8008, + 8014, + 8016, + 8024, + 8025, + 8026, + 8027, + 8028, + 8029, + 8030, + 8031, + 8062, + 8064, + 8117, + 8118, + 8125, + 8126, + 8127, + 8130, + 8133, + 8134, + 8141, + 8144, + 8148, + 8150, + 8156, + 8160, + 8173, + 8178, + 8181, + 8182, + 8189, + 8486, + 8487, + 8490, + 8492, + 8498, + 8499, + 8526, + 8527, + 8544, + 8576, + 8579, + 8581, + 9398, + 9450, + 11264, + 11311, + 11312, + 11359, + 11360, + 11377, + 11378, + 11380, + 11381, + 11383, + 11390, + 11492, + 11499, + 11503, + 11506, + 11508, + 11520, + 11558, + 11559, + 11560, + 11565, + 11566, + 42560, + 42606, + 42624, + 42648, + 42786, + 42800, + 42802, + 42864, + 42873, + 42888, + 42891, + 42894, + 42896, + 42900, + 42912, + 42923, + 64256, + 64263, + 64275, + 64280, 65313, - 65319, + 65339, 65345, - 65351 + 65371, + 66560, + 66640 }; #endif -static UV NonL1_Perl_Non_Final_Folds_invlist[] = { - 44, /* Number of elements */ - 0, /* Current iteration position */ - 0, /* Cache of previous search index result */ - 290655244, /* Version and data structure type */ - 1, /* 0 if this is the first element of the list proper; - 1 if the next element is the first */ +static const UV NonL1_Perl_Non_Final_Folds_invlist[] = { + 45, /* Number of elements */ + 148565664, /* Version and data structure type */ + 1, /* 0 if the list starts at 0; + 1 if it starts at the element beyond 0 */ + 0, 700, 701, 776, @@ -741,13 +9171,12 @@ static UV NonL1_Perl_Non_Final_Folds_inv #ifndef PERL_IN_XSUB_RE -static UV _Perl_Multi_Char_Folds_invlist[] = { - 58, /* Number of elements */ - 0, /* Current iteration position */ - 0, /* Cache of previous search index result */ - 290655244, /* Version and data structure type */ - 1, /* 0 if this is the first element of the list proper; - 1 if the next element is the first */ +static const UV _Perl_Folds_To_Multi_Char_invlist[] = { + 59, /* Number of elements */ + 148565664, /* Version and data structure type */ + 1, /* 0 if the list starts at 0; + 1 if it starts at the element beyond 0 */ + 0, 223, 224, 304, @@ -806,6 +9235,2180 @@ static UV _Perl_Multi_Char_Folds_invlist 64263, 64275, 64280 +}; + +#endif + +#ifndef PERL_IN_XSUB_RE + +static const UV UpperLatin1_invlist[] = { + 3, /* Number of elements */ + 148565664, /* Version and data structure type */ + 1, /* 0 if the list starts at 0; + 1 if it starts at the element beyond 0 */ + 0, + 128, + 256 +}; + +#endif + +#ifndef PERL_IN_XSUB_RE + +static const UV _Perl_IDStart_invlist[] = { + 995, /* Number of elements */ + 148565664, /* Version and data structure type */ + 1, /* 0 if the list starts at 0; + 1 if it starts at the element beyond 0 */ + 0, + 65, + 91, + 95, + 96, + 97, + 123, + 170, + 171, + 181, + 182, + 186, + 187, + 192, + 215, + 216, + 247, + 248, + 706, + 710, + 722, + 736, + 741, + 748, + 749, + 750, + 751, + 880, + 885, + 886, + 888, + 891, + 894, + 902, + 903, + 904, + 907, + 908, + 909, + 910, + 930, + 931, + 1014, + 1015, + 1154, + 1162, + 1320, + 1329, + 1367, + 1369, + 1370, + 1377, + 1416, + 1488, + 1515, + 1520, + 1523, + 1568, + 1611, + 1646, + 1648, + 1649, + 1748, + 1749, + 1750, + 1765, + 1767, + 1774, + 1776, + 1786, + 1789, + 1791, + 1792, + 1808, + 1809, + 1810, + 1840, + 1869, + 1958, + 1969, + 1970, + 1994, + 2027, + 2036, + 2038, + 2042, + 2043, + 2048, + 2070, + 2074, + 2075, + 2084, + 2085, + 2088, + 2089, + 2112, + 2137, + 2208, + 2209, + 2210, + 2221, + 2308, + 2362, + 2365, + 2366, + 2384, + 2385, + 2392, + 2402, + 2417, + 2424, + 2425, + 2432, + 2437, + 2445, + 2447, + 2449, + 2451, + 2473, + 2474, + 2481, + 2482, + 2483, + 2486, + 2490, + 2493, + 2494, + 2510, + 2511, + 2524, + 2526, + 2527, + 2530, + 2544, + 2546, + 2565, + 2571, + 2575, + 2577, + 2579, + 2601, + 2602, + 2609, + 2610, + 2612, + 2613, + 2615, + 2616, + 2618, + 2649, + 2653, + 2654, + 2655, + 2674, + 2677, + 2693, + 2702, + 2703, + 2706, + 2707, + 2729, + 2730, + 2737, + 2738, + 2740, + 2741, + 2746, + 2749, + 2750, + 2768, + 2769, + 2784, + 2786, + 2821, + 2829, + 2831, + 2833, + 2835, + 2857, + 2858, + 2865, + 2866, + 2868, + 2869, + 2874, + 2877, + 2878, + 2908, + 2910, + 2911, + 2914, + 2929, + 2930, + 2947, + 2948, + 2949, + 2955, + 2958, + 2961, + 2962, + 2966, + 2969, + 2971, + 2972, + 2973, + 2974, + 2976, + 2979, + 2981, + 2984, + 2987, + 2990, + 3002, + 3024, + 3025, + 3077, + 3085, + 3086, + 3089, + 3090, + 3113, + 3114, + 3124, + 3125, + 3130, + 3133, + 3134, + 3160, + 3162, + 3168, + 3170, + 3205, + 3213, + 3214, + 3217, + 3218, + 3241, + 3242, + 3252, + 3253, + 3258, + 3261, + 3262, + 3294, + 3295, + 3296, + 3298, + 3313, + 3315, + 3333, + 3341, + 3342, + 3345, + 3346, + 3387, + 3389, + 3390, + 3406, + 3407, + 3424, + 3426, + 3450, + 3456, + 3461, + 3479, + 3482, + 3506, + 3507, + 3516, + 3517, + 3518, + 3520, + 3527, + 3585, + 3633, + 3634, + 3635, + 3648, + 3655, + 3713, + 3715, + 3716, + 3717, + 3719, + 3721, + 3722, + 3723, + 3725, + 3726, + 3732, + 3736, + 3737, + 3744, + 3745, + 3748, + 3749, + 3750, + 3751, + 3752, + 3754, + 3756, + 3757, + 3761, + 3762, + 3763, + 3773, + 3774, + 3776, + 3781, + 3782, + 3783, + 3804, + 3808, + 3840, + 3841, + 3904, + 3912, + 3913, + 3949, + 3976, + 3981, + 4096, + 4139, + 4159, + 4160, + 4176, + 4182, + 4186, + 4190, + 4193, + 4194, + 4197, + 4199, + 4206, + 4209, + 4213, + 4226, + 4238, + 4239, + 4256, + 4294, + 4295, + 4296, + 4301, + 4302, + 4304, + 4347, + 4348, + 4681, + 4682, + 4686, + 4688, + 4695, + 4696, + 4697, + 4698, + 4702, + 4704, + 4745, + 4746, + 4750, + 4752, + 4785, + 4786, + 4790, + 4792, + 4799, + 4800, + 4801, + 4802, + 4806, + 4808, + 4823, + 4824, + 4881, + 4882, + 4886, + 4888, + 4955, + 4992, + 5008, + 5024, + 5109, + 5121, + 5741, + 5743, + 5760, + 5761, + 5787, + 5792, + 5867, + 5870, + 5873, + 5888, + 5901, + 5902, + 5906, + 5920, + 5938, + 5952, + 5970, + 5984, + 5997, + 5998, + 6001, + 6016, + 6068, + 6103, + 6104, + 6108, + 6109, + 6176, + 6264, + 6272, + 6313, + 6314, + 6315, + 6320, + 6390, + 6400, + 6429, + 6480, + 6510, + 6512, + 6517, + 6528, + 6572, + 6593, + 6600, + 6656, + 6679, + 6688, + 6741, + 6823, + 6824, + 6917, + 6964, + 6981, + 6988, + 7043, + 7073, + 7086, + 7088, + 7098, + 7142, + 7168, + 7204, + 7245, + 7248, + 7258, + 7294, + 7401, + 7405, + 7406, + 7410, + 7413, + 7415, + 7424, + 7616, + 7680, + 7958, + 7960, + 7966, + 7968, + 8006, + 8008, + 8014, + 8016, + 8024, + 8025, + 8026, + 8027, + 8028, + 8029, + 8030, + 8031, + 8062, + 8064, + 8117, + 8118, + 8125, + 8126, + 8127, + 8130, + 8133, + 8134, + 8141, + 8144, + 8148, + 8150, + 8156, + 8160, + 8173, + 8178, + 8181, + 8182, + 8189, + 8305, + 8306, + 8319, + 8320, + 8336, + 8349, + 8450, + 8451, + 8455, + 8456, + 8458, + 8468, + 8469, + 8470, + 8473, + 8478, + 8484, + 8485, + 8486, + 8487, + 8488, + 8489, + 8490, + 8494, + 8495, + 8506, + 8508, + 8512, + 8517, + 8522, + 8526, + 8527, + 8544, + 8585, + 11264, + 11311, + 11312, + 11359, + 11360, + 11493, + 11499, + 11503, + 11506, + 11508, + 11520, + 11558, + 11559, + 11560, + 11565, + 11566, + 11568, + 11624, + 11631, + 11632, + 11648, + 11671, + 11680, + 11687, + 11688, + 11695, + 11696, + 11703, + 11704, + 11711, + 11712, + 11719, + 11720, + 11727, + 11728, + 11735, + 11736, + 11743, + 12293, + 12296, + 12321, + 12330, + 12337, + 12342, + 12344, + 12349, + 12353, + 12439, + 12445, + 12448, + 12449, + 12539, + 12540, + 12544, + 12549, + 12590, + 12593, + 12687, + 12704, + 12731, + 12784, + 12800, + 13312, + 19894, + 19968, + 40909, + 40960, + 42125, + 42192, + 42238, + 42240, + 42509, + 42512, + 42528, + 42538, + 42540, + 42560, + 42607, + 42623, + 42648, + 42656, + 42736, + 42775, + 42784, + 42786, + 42889, + 42891, + 42895, + 42896, + 42900, + 42912, + 42923, + 43000, + 43010, + 43011, + 43014, + 43015, + 43019, + 43020, + 43043, + 43072, + 43124, + 43138, + 43188, + 43250, + 43256, + 43259, + 43260, + 43274, + 43302, + 43312, + 43335, + 43360, + 43389, + 43396, + 43443, + 43471, + 43472, + 43520, + 43561, + 43584, + 43587, + 43588, + 43596, + 43616, + 43639, + 43642, + 43643, + 43648, + 43696, + 43697, + 43698, + 43701, + 43703, + 43705, + 43710, + 43712, + 43713, + 43714, + 43715, + 43739, + 43742, + 43744, + 43755, + 43762, + 43765, + 43777, + 43783, + 43785, + 43791, + 43793, + 43799, + 43808, + 43815, + 43816, + 43823, + 43968, + 44003, + 44032, + 55204, + 55216, + 55239, + 55243, + 55292, + 63744, + 64110, + 64112, + 64218, + 64256, + 64263, + 64275, + 64280, + 64285, + 64286, + 64287, + 64297, + 64298, + 64311, + 64312, + 64317, + 64318, + 64319, + 64320, + 64322, + 64323, + 64325, + 64326, + 64434, + 64467, + 64606, + 64612, + 64830, + 64848, + 64912, + 64914, + 64968, + 65008, + 65018, + 65137, + 65138, + 65139, + 65140, + 65143, + 65144, + 65145, + 65146, + 65147, + 65148, + 65149, + 65150, + 65151, + 65277, + 65313, + 65339, + 65345, + 65371, + 65382, + 65438, + 65440, + 65471, + 65474, + 65480, + 65482, + 65488, + 65490, + 65496, + 65498, + 65501, + 65536, + 65548, + 65549, + 65575, + 65576, + 65595, + 65596, + 65598, + 65599, + 65614, + 65616, + 65630, + 65664, + 65787, + 65856, + 65909, + 66176, + 66205, + 66208, + 66257, + 66304, + 66335, + 66352, + 66379, + 66432, + 66462, + 66464, + 66500, + 66504, + 66512, + 66513, + 66518, + 66560, + 66718, + 67584, + 67590, + 67592, + 67593, + 67594, + 67638, + 67639, + 67641, + 67644, + 67645, + 67647, + 67670, + 67840, + 67862, + 67872, + 67898, + 67968, + 68024, + 68030, + 68032, + 68096, + 68097, + 68112, + 68116, + 68117, + 68120, + 68121, + 68148, + 68192, + 68221, + 68352, + 68406, + 68416, + 68438, + 68448, + 68467, + 68608, + 68681, + 69635, + 69688, + 69763, + 69808, + 69840, + 69865, + 69891, + 69927, + 70019, + 70067, + 70081, + 70085, + 71296, + 71339, + 73728, + 74607, + 74752, + 74851, + 77824, + 78895, + 92160, + 92729, + 93952, + 94021, + 94032, + 94033, + 94099, + 94112, + 110592, + 110594, + 119808, + 119893, + 119894, + 119965, + 119966, + 119968, + 119970, + 119971, + 119973, + 119975, + 119977, + 119981, + 119982, + 119994, + 119995, + 119996, + 119997, + 120004, + 120005, + 120070, + 120071, + 120075, + 120077, + 120085, + 120086, + 120093, + 120094, + 120122, + 120123, + 120127, + 120128, + 120133, + 120134, + 120135, + 120138, + 120145, + 120146, + 120486, + 120488, + 120513, + 120514, + 120539, + 120540, + 120571, + 120572, + 120597, + 120598, + 120629, + 120630, + 120655, + 120656, + 120687, + 120688, + 120713, + 120714, + 120745, + 120746, + 120771, + 120772, + 120780, + 126464, + 126468, + 126469, + 126496, + 126497, + 126499, + 126500, + 126501, + 126503, + 126504, + 126505, + 126515, + 126516, + 126520, + 126521, + 126522, + 126523, + 126524, + 126530, + 126531, + 126535, + 126536, + 126537, + 126538, + 126539, + 126540, + 126541, + 126544, + 126545, + 126547, + 126548, + 126549, + 126551, + 126552, + 126553, + 126554, + 126555, + 126556, + 126557, + 126558, + 126559, + 126560, + 126561, + 126563, + 126564, + 126565, + 126567, + 126571, + 126572, + 126579, + 126580, + 126584, + 126585, + 126589, + 126590, + 126591, + 126592, + 126602, + 126603, + 126620, + 126625, + 126628, + 126629, + 126634, + 126635, + 126652, + 131072, + 173783, + 173824, + 177973, + 177984, + 178206, + 194560, + 195102 +}; + +#endif + +#ifndef PERL_IN_XSUB_RE + +static const UV _Perl_IDCont_invlist[] = { + 1143, /* Number of elements */ + 148565664, /* Version and data structure type */ + 1, /* 0 if the list starts at 0; + 1 if it starts at the element beyond 0 */ + 0, + 48, + 58, + 65, + 91, + 95, + 96, + 97, + 123, + 170, + 171, + 181, + 182, + 186, + 187, + 192, + 215, + 216, + 247, + 248, + 706, + 710, + 722, + 736, + 741, + 748, + 749, + 750, + 751, + 768, + 885, + 886, + 888, + 891, + 894, + 902, + 903, + 904, + 907, + 908, + 909, + 910, + 930, + 931, + 1014, + 1015, + 1154, + 1155, + 1160, + 1162, + 1320, + 1329, + 1367, + 1369, + 1370, + 1377, + 1416, + 1425, + 1470, + 1471, + 1472, + 1473, + 1475, + 1476, + 1478, + 1479, + 1480, + 1488, + 1515, + 1520, + 1523, + 1552, + 1563, + 1568, + 1642, + 1646, + 1748, + 1749, + 1757, + 1759, + 1769, + 1770, + 1789, + 1791, + 1792, + 1808, + 1867, + 1869, + 1970, + 1984, + 2038, + 2042, + 2043, + 2048, + 2094, + 2112, + 2140, + 2208, + 2209, + 2210, + 2221, + 2276, + 2303, + 2304, + 2404, + 2406, + 2416, + 2417, + 2424, + 2425, + 2432, + 2433, + 2436, + 2437, + 2445, + 2447, + 2449, + 2451, + 2473, + 2474, + 2481, + 2482, + 2483, + 2486, + 2490, + 2492, + 2501, + 2503, + 2505, + 2507, + 2511, + 2519, + 2520, + 2524, + 2526, + 2527, + 2532, + 2534, + 2546, + 2561, + 2564, + 2565, + 2571, + 2575, + 2577, + 2579, + 2601, + 2602, + 2609, + 2610, + 2612, + 2613, + 2615, + 2616, + 2618, + 2620, + 2621, + 2622, + 2627, + 2631, + 2633, + 2635, + 2638, + 2641, + 2642, + 2649, + 2653, + 2654, + 2655, + 2662, + 2678, + 2689, + 2692, + 2693, + 2702, + 2703, + 2706, + 2707, + 2729, + 2730, + 2737, + 2738, + 2740, + 2741, + 2746, + 2748, + 2758, + 2759, + 2762, + 2763, + 2766, + 2768, + 2769, + 2784, + 2788, + 2790, + 2800, + 2817, + 2820, + 2821, + 2829, + 2831, + 2833, + 2835, + 2857, + 2858, + 2865, + 2866, + 2868, + 2869, + 2874, + 2876, + 2885, + 2887, + 2889, + 2891, + 2894, + 2902, + 2904, + 2908, + 2910, + 2911, + 2916, + 2918, + 2928, + 2929, + 2930, + 2946, + 2948, + 2949, + 2955, + 2958, + 2961, + 2962, + 2966, + 2969, + 2971, + 2972, + 2973, + 2974, + 2976, + 2979, + 2981, + 2984, + 2987, + 2990, + 3002, + 3006, + 3011, + 3014, + 3017, + 3018, + 3022, + 3024, + 3025, + 3031, + 3032, + 3046, + 3056, + 3073, + 3076, + 3077, + 3085, + 3086, + 3089, + 3090, + 3113, + 3114, + 3124, + 3125, + 3130, + 3133, + 3141, + 3142, + 3145, + 3146, + 3150, + 3157, + 3159, + 3160, + 3162, + 3168, + 3172, + 3174, + 3184, + 3202, + 3204, + 3205, + 3213, + 3214, + 3217, + 3218, + 3241, + 3242, + 3252, + 3253, + 3258, + 3260, + 3269, + 3270, + 3273, + 3274, + 3278, + 3285, + 3287, + 3294, + 3295, + 3296, + 3300, + 3302, + 3312, + 3313, + 3315, + 3330, + 3332, + 3333, + 3341, + 3342, + 3345, + 3346, + 3387, + 3389, + 3397, + 3398, + 3401, + 3402, + 3407, + 3415, + 3416, + 3424, + 3428, + 3430, + 3440, + 3450, + 3456, + 3458, + 3460, + 3461, + 3479, + 3482, + 3506, + 3507, + 3516, + 3517, + 3518, + 3520, + 3527, + 3530, + 3531, + 3535, + 3541, + 3542, + 3543, + 3544, + 3552, + 3570, + 3572, + 3585, + 3643, + 3648, + 3663, + 3664, + 3674, + 3713, + 3715, + 3716, + 3717, + 3719, + 3721, + 3722, + 3723, + 3725, + 3726, + 3732, + 3736, + 3737, + 3744, + 3745, + 3748, + 3749, + 3750, + 3751, + 3752, + 3754, + 3756, + 3757, + 3770, + 3771, + 3774, + 3776, + 3781, + 3782, + 3783, + 3784, + 3790, + 3792, + 3802, + 3804, + 3808, + 3840, + 3841, + 3864, + 3866, + 3872, + 3882, + 3893, + 3894, + 3895, + 3896, + 3897, + 3898, + 3902, + 3912, + 3913, + 3949, + 3953, + 3973, + 3974, + 3992, + 3993, + 4029, + 4038, + 4039, + 4096, + 4170, + 4176, + 4254, + 4256, + 4294, + 4295, + 4296, + 4301, + 4302, + 4304, + 4347, + 4348, + 4681, + 4682, + 4686, + 4688, + 4695, + 4696, + 4697, + 4698, + 4702, + 4704, + 4745, + 4746, + 4750, + 4752, + 4785, + 4786, + 4790, + 4792, + 4799, + 4800, + 4801, + 4802, + 4806, + 4808, + 4823, + 4824, + 4881, + 4882, + 4886, + 4888, + 4955, + 4957, + 4960, + 4992, + 5008, + 5024, + 5109, + 5121, + 5741, + 5743, + 5760, + 5761, + 5787, + 5792, + 5867, + 5870, + 5873, + 5888, + 5901, + 5902, + 5909, + 5920, + 5941, + 5952, + 5972, + 5984, + 5997, + 5998, + 6001, + 6002, + 6004, + 6016, + 6100, + 6103, + 6104, + 6108, + 6110, + 6112, + 6122, + 6155, + 6158, + 6160, + 6170, + 6176, + 6264, + 6272, + 6315, + 6320, + 6390, + 6400, + 6429, + 6432, + 6444, + 6448, + 6460, + 6470, + 6510, + 6512, + 6517, + 6528, + 6572, + 6576, + 6602, + 6608, + 6618, + 6656, + 6684, + 6688, + 6751, + 6752, + 6781, + 6783, + 6794, + 6800, + 6810, + 6823, + 6824, + 6912, + 6988, + 6992, + 7002, + 7019, + 7028, + 7040, + 7156, + 7168, + 7224, + 7232, + 7242, + 7245, + 7294, + 7376, + 7379, + 7380, + 7415, + 7424, + 7655, + 7676, + 7958, + 7960, + 7966, + 7968, + 8006, + 8008, + 8014, + 8016, + 8024, + 8025, + 8026, + 8027, + 8028, + 8029, + 8030, + 8031, + 8062, + 8064, + 8117, + 8118, + 8125, + 8126, + 8127, + 8130, + 8133, + 8134, + 8141, + 8144, + 8148, + 8150, + 8156, + 8160, + 8173, + 8178, + 8181, + 8182, + 8189, + 8255, + 8257, + 8276, + 8277, + 8305, + 8306, + 8319, + 8320, + 8336, + 8349, + 8400, + 8413, + 8417, + 8418, + 8421, + 8433, + 8450, + 8451, + 8455, + 8456, + 8458, + 8468, + 8469, + 8470, + 8473, + 8478, + 8484, + 8485, + 8486, + 8487, + 8488, + 8489, + 8490, + 8494, + 8495, + 8506, + 8508, + 8512, + 8517, + 8522, + 8526, + 8527, + 8544, + 8585, + 11264, + 11311, + 11312, + 11359, + 11360, + 11493, + 11499, + 11508, + 11520, + 11558, + 11559, + 11560, + 11565, + 11566, + 11568, + 11624, + 11631, + 11632, + 11647, + 11671, + 11680, + 11687, + 11688, + 11695, + 11696, + 11703, + 11704, + 11711, + 11712, + 11719, + 11720, + 11727, + 11728, + 11735, + 11736, + 11743, + 11744, + 11776, + 12293, + 12296, + 12321, + 12336, + 12337, + 12342, + 12344, + 12349, + 12353, + 12439, + 12441, + 12443, + 12445, + 12448, + 12449, + 12539, + 12540, + 12544, + 12549, + 12590, + 12593, + 12687, + 12704, + 12731, + 12784, + 12800, + 13312, + 19894, + 19968, + 40909, + 40960, + 42125, + 42192, + 42238, + 42240, + 42509, + 42512, + 42540, + 42560, + 42608, + 42612, + 42622, + 42623, + 42648, + 42655, + 42738, + 42775, + 42784, + 42786, + 42889, + 42891, + 42895, + 42896, + 42900, + 42912, + 42923, + 43000, + 43048, + 43072, + 43124, + 43136, + 43205, + 43216, + 43226, + 43232, + 43256, + 43259, + 43260, + 43264, + 43310, + 43312, + 43348, + 43360, + 43389, + 43392, + 43457, + 43471, + 43482, + 43520, + 43575, + 43584, + 43598, + 43600, + 43610, + 43616, + 43639, + 43642, + 43644, + 43648, + 43715, + 43739, + 43742, + 43744, + 43760, + 43762, + 43767, + 43777, + 43783, + 43785, + 43791, + 43793, + 43799, + 43808, + 43815, + 43816, + 43823, + 43968, + 44011, + 44012, + 44014, + 44016, + 44026, + 44032, + 55204, + 55216, + 55239, + 55243, + 55292, + 63744, + 64110, + 64112, + 64218, + 64256, + 64263, + 64275, + 64280, + 64285, + 64297, + 64298, + 64311, + 64312, + 64317, + 64318, + 64319, + 64320, + 64322, + 64323, + 64325, + 64326, + 64434, + 64467, + 64606, + 64612, + 64830, + 64848, + 64912, + 64914, + 64968, + 65008, + 65018, + 65024, + 65040, + 65056, + 65063, + 65075, + 65077, + 65101, + 65104, + 65137, + 65138, + 65139, + 65140, + 65143, + 65144, + 65145, + 65146, + 65147, + 65148, + 65149, + 65150, + 65151, + 65277, + 65296, + 65306, + 65313, + 65339, + 65343, + 65344, + 65345, + 65371, + 65382, + 65471, + 65474, + 65480, + 65482, + 65488, + 65490, + 65496, + 65498, + 65501, + 65536, + 65548, + 65549, + 65575, + 65576, + 65595, + 65596, + 65598, + 65599, + 65614, + 65616, + 65630, + 65664, + 65787, + 65856, + 65909, + 66045, + 66046, + 66176, + 66205, + 66208, + 66257, + 66304, + 66335, + 66352, + 66379, + 66432, + 66462, + 66464, + 66500, + 66504, + 66512, + 66513, + 66518, + 66560, + 66718, + 66720, + 66730, + 67584, + 67590, + 67592, + 67593, + 67594, + 67638, + 67639, + 67641, + 67644, + 67645, + 67647, + 67670, + 67840, + 67862, + 67872, + 67898, + 67968, + 68024, + 68030, + 68032, + 68096, + 68100, + 68101, + 68103, + 68108, + 68116, + 68117, + 68120, + 68121, + 68148, + 68152, + 68155, + 68159, + 68160, + 68192, + 68221, + 68352, + 68406, + 68416, + 68438, + 68448, + 68467, + 68608, + 68681, + 69632, + 69703, + 69734, + 69744, + 69760, + 69819, + 69840, + 69865, + 69872, + 69882, + 69888, + 69941, + 69942, + 69952, + 70016, + 70085, + 70096, + 70106, + 71296, + 71352, + 71360, + 71370, + 73728, + 74607, + 74752, + 74851, + 77824, + 78895, + 92160, + 92729, + 93952, + 94021, + 94032, + 94079, + 94095, + 94112, + 110592, + 110594, + 119141, + 119146, + 119149, + 119155, + 119163, + 119171, + 119173, + 119180, + 119210, + 119214, + 119362, + 119365, + 119808, + 119893, + 119894, + 119965, + 119966, + 119968, + 119970, + 119971, + 119973, + 119975, + 119977, + 119981, + 119982, + 119994, + 119995, + 119996, + 119997, + 120004, + 120005, + 120070, + 120071, + 120075, + 120077, + 120085, + 120086, + 120093, + 120094, + 120122, + 120123, + 120127, + 120128, + 120133, + 120134, + 120135, + 120138, + 120145, + 120146, + 120486, + 120488, + 120513, + 120514, + 120539, + 120540, + 120571, + 120572, + 120597, + 120598, + 120629, + 120630, + 120655, + 120656, + 120687, + 120688, + 120713, + 120714, + 120745, + 120746, + 120771, + 120772, + 120780, + 120782, + 120832, + 126464, + 126468, + 126469, + 126496, + 126497, + 126499, + 126500, + 126501, + 126503, + 126504, + 126505, + 126515, + 126516, + 126520, + 126521, + 126522, + 126523, + 126524, + 126530, + 126531, + 126535, + 126536, + 126537, + 126538, + 126539, + 126540, + 126541, + 126544, + 126545, + 126547, + 126548, + 126549, + 126551, + 126552, + 126553, + 126554, + 126555, + 126556, + 126557, + 126558, + 126559, + 126560, + 126561, + 126563, + 126564, + 126565, + 126567, + 126571, + 126572, + 126579, + 126580, + 126584, + 126585, + 126589, + 126590, + 126591, + 126592, + 126602, + 126603, + 126620, + 126625, + 126628, + 126629, + 126634, + 126635, + 126652, + 131072, + 173783, + 173824, + 177973, + 177984, + 178206, + 194560, + 195102, + 917760, + 918000 }; #endif Index: gnu/usr.bin/perl/config.over =================================================================== RCS file: /mnt/memory/perl/importit/cvs/src/gnu/usr.bin/perl/config.over,v retrieving revision 1.17 diff -u -p -u -p -r1.17 config.over --- gnu/usr.bin/perl/config.over 24 Mar 2014 15:05:13 -0000 1.17 +++ gnu/usr.bin/perl/config.over 16 Nov 2014 03:22:23 -0000 @@ -1,7 +1,7 @@ # # Override default paths when building in the OpenBSD src tree # -# $OpenBSD: config.over,v 1.17 2014/03/24 15:05:13 afresh1 Exp $ +# $OpenBSD: config.over,v 1.16 2013/03/25 20:44:46 sthen Exp $ # # We use a different architecture name than the default Index: gnu/usr.bin/perl/config_h.SH =================================================================== RCS file: /mnt/memory/perl/importit/cvs/src/gnu/usr.bin/perl/config_h.SH,v retrieving revision 1.15 diff -u -p -u -p -r1.15 config_h.SH --- gnu/usr.bin/perl/config_h.SH 24 Mar 2014 15:05:13 -0000 1.15 +++ gnu/usr.bin/perl/config_h.SH 16 Nov 2014 03:22:23 -0000 @@ -261,6 +261,12 @@ sed <$CONFIG_H -e 's!^#und */ #$d_locconv HAS_LOCALECONV /**/ +/* HAS_LC_MONETARY_2008: + * This symbol, if defined, indicates that the localeconv routine is + * available and has the additional members added in POSIX 1003.1-2008. + */ +#$d_lc_monetary_2008 HAS_LC_MONETARY_2008 /**/ + /* HAS_LOCKF: * This symbol, if defined, indicates that the lockf routine is * available to do file locking. @@ -738,12 +744,6 @@ sed <$CONFIG_H -e 's!^#und */ #$i_niin I_NETINET_IN /**/ -/* I_SFIO: - * This symbol, if defined, indicates to the C program that it should - * include . - */ -#$i_sfio I_SFIO /**/ - /* I_STDDEF: * This symbol, if defined, indicates that exists and should * be included. @@ -846,26 +846,6 @@ sed <$CONFIG_H -e 's!^#und */ #$i_syswait I_SYS_WAIT /**/ -/* I_TERMIO: - * This symbol, if defined, indicates that the program should include - * rather than . There are also differences in - * the ioctl() calls that depend on the value of this symbol. - */ -/* I_TERMIOS: - * This symbol, if defined, indicates that the program should include - * the POSIX termios.h rather than sgtty.h or termio.h. - * There are also differences in the ioctl() calls that depend on the - * value of this symbol. - */ -/* I_SGTTY: - * This symbol, if defined, indicates that the program should include - * rather than . There are also differences in - * the ioctl() calls that depend on the value of this symbol. - */ -#$i_termio I_TERMIO /**/ -#$i_termios I_TERMIOS /**/ -#$i_sgtty I_SGTTY /**/ - /* I_UNISTD: * This symbol, if defined, indicates to the C program that it should * include . @@ -927,18 +907,6 @@ sed <$CONFIG_H -e 's!^#und #define OSNAME "$osname" /**/ #define OSVERS "$osvers" /**/ -/* USE_CROSS_COMPILE: - * This symbol, if defined, indicates that Perl is being cross-compiled. - */ -/* PERL_TARGETARCH: - * This symbol, if defined, indicates the target architecture - * Perl has been cross-compiled to. Undefined if not a cross-compile. - */ -#ifndef USE_CROSS_COMPILE -#$usecrosscompile USE_CROSS_COMPILE /**/ -#define PERL_TARGETARCH "$targetarch" /**/ -#endif - /* MULTIARCH: * This symbol, if defined, signifies that the build * process will produce some binary files that are going to be @@ -1028,7 +996,7 @@ sed <$CONFIG_H -e 's!^#und * so the default case (for NeXT) is big endian to catch them. * This might matter for NeXT 3.0. */ -#if defined(USE_CROSS_COMPILE) || defined(MULTIARCH) +#if defined(MULTIARCH) # ifdef __LITTLE_ENDIAN__ # if LONGSIZE == 4 # define BYTEORDER 0x1234 @@ -3167,7 +3135,7 @@ sed <$CONFIG_H -e 's!^#und * /bin/pdksh, /bin/ash, /bin/bash, or even something such as * D:/bin/sh.exe. */ -#define SH_PATH "$sh" /**/ +#define SH_PATH "$targetsh" /**/ /* SIG_NAME: * This symbol contains a list of signal names in order of @@ -3365,29 +3333,36 @@ sed <$CONFIG_H -e 's!^#und #$d_vendorlib PERL_VENDORLIB_EXP "$vendorlibexp" /**/ #$d_vendorlib PERL_VENDORLIB_STEM "$vendorlib_stem" /**/ -/* VOIDFLAGS: - * This symbol indicates how much support of the void type is given by this - * compiler. What various bits mean: - * - * 1 = supports declaration of void - * 2 = supports arrays of pointers to functions returning void - * 4 = supports comparisons between pointers to void functions and - * addresses of void functions - * 8 = supports declaration of generic void pointers - * - * The package designer should define VOIDUSED to indicate the requirements - * of the package. This can be done either by #defining VOIDUSED before - * including config.h, or by defining defvoidused in Myinit.U. If the - * latter approach is taken, only those flags will be tested. If the - * level of void support necessary is not present, defines void to int. - */ -#ifndef VOIDUSED -#define VOIDUSED $defvoidused -#endif -#define VOIDFLAGS $voidflags -#if (VOIDFLAGS & VOIDUSED) != VOIDUSED -#define void int /* is void to be avoided? */ -#define M_VOID /* Xenix strikes again */ +/* I_TERMIO: + * This symbol, if defined, indicates that the program should include + * rather than . There are also differences in + * the ioctl() calls that depend on the value of this symbol. + */ +/* I_TERMIOS: + * This symbol, if defined, indicates that the program should include + * the POSIX termios.h rather than sgtty.h or termio.h. + * There are also differences in the ioctl() calls that depend on the + * value of this symbol. + */ +/* I_SGTTY: + * This symbol, if defined, indicates that the program should include + * rather than . There are also differences in + * the ioctl() calls that depend on the value of this symbol. + */ +#$i_termio I_TERMIO /**/ +#$i_termios I_TERMIOS /**/ +#$i_sgtty I_SGTTY /**/ + +/* USE_CROSS_COMPILE: + * This symbol, if defined, indicates that Perl is being cross-compiled. + */ +/* PERL_TARGETARCH: + * This symbol, if defined, indicates the target architecture + * Perl has been cross-compiled to. Undefined if not a cross-compile. + */ +#ifndef USE_CROSS_COMPILE +#$usecrosscompile USE_CROSS_COMPILE /**/ +#define PERL_TARGETARCH "$targetarch" /**/ #endif /* PERL_USE_DEVEL: @@ -3952,12 +3927,6 @@ sed <$CONFIG_H -e 's!^#und */ #$d_setproctitle HAS_SETPROCTITLE /**/ -/* USE_SFIO: - * This symbol, if defined, indicates that sfio should - * be used. - */ -#$d_sfio USE_SFIO /**/ - /* HAS_SIGNBIT: * This symbol, if defined, indicates that the signbit routine is * available to check if the given number has the sign bit set. @@ -4223,8 +4192,10 @@ sed <$CONFIG_H -e 's!^#und #$usedl USE_DYNAMIC_LOADING /**/ /* FFLUSH_NULL: - * This symbol, if defined, tells that fflush(NULL) does flush - * all pending stdio output. + * This symbol, if defined, tells that fflush(NULL) correctly + * flushes all pending stdio output without side effects. In + * particular, on some platforms calling fflush(NULL) *still* + * corrupts STDIN if it is a pipe. */ /* FFLUSH_ALL: * This symbol, if defined, tells that to flush Index: gnu/usr.bin/perl/configpm =================================================================== RCS file: /mnt/memory/perl/importit/cvs/src/gnu/usr.bin/perl/configpm,v retrieving revision 1.17 diff -u -p -u -p -r1.17 configpm --- gnu/usr.bin/perl/configpm 24 Mar 2014 15:05:13 -0000 1.17 +++ gnu/usr.bin/perl/configpm 16 Nov 2014 03:22:23 -0000 @@ -11,7 +11,6 @@ # lib/Config.pm # lib/Config_heavy.pl # lib/Config.pod -# lib/Cross.pm (optionally) # # # from the contents of the static files @@ -23,7 +22,6 @@ # # config.sh # -# Note that output directory is xlib/[cross-name]/ for cross-compiling # # It will only update Config.pm and Config_heavy.pl if the contents of # either file would be different. Note that *both* files are updated in @@ -32,7 +30,6 @@ sub usage { die < '', # --cross=PLATFORM - crosscompiling for PLATFORM 'glossary' => 1, # --no-glossary - no glossary file inclusion, # for compactness 'chdir' => '', # --chdir=dir - change directory before writing files @@ -134,19 +129,10 @@ if ($Opts{chdir}) { my ($Config_SH, $Config_PM, $Config_heavy, $Config_POD); my $Glossary = 'Porting/Glossary'; -if ($Opts{cross}) { - # creating cross-platform config file - mkdir "xlib"; - mkdir "xlib/$Opts{cross}"; - $Config_PM = "xlib/$Opts{cross}/Config.pm"; - $Config_POD = "xlib/$Opts{cross}/Config.pod"; - $Config_SH = "Cross/config-$Opts{cross}.sh"; -} -else { - $Config_PM = "lib/Config.pm"; - $Config_POD = "lib/Config.pod"; - $Config_SH = "config.sh"; -} +$Config_PM = "lib/Config.pm"; +$Config_POD = "lib/Config.pod"; +$Config_SH = "config.sh"; + ($Config_heavy = $Config_PM) =~ s/\.pm$/_heavy.pl/; die "Can't automatically determine name for Config_heavy.pl from '$Config_PM'" if $Config_heavy eq $Config_PM; @@ -154,76 +140,6 @@ die "Can't automatically determine name my $config_txt; my $heavy_txt; -my $from = $^O eq 'VMS' ? 'PERLSHR image' : 'binary (from libperl)'; -my $env_cygwin = $^O eq 'cygwin' - ? 'push @env, "CYGWIN=\"$ENV{CYGWIN}\"" if $ENV{CYGWIN};' . "\n" : ""; -$heavy_txt .= sprintf <<'ENDOFBEG', $^O, $^O, $from, $^O, $env_cygwin; -# This file was created by configpm when Perl was built. Any changes -# made to this file will be lost the next time perl is built. - -package Config; -use strict; -use warnings; -use vars '%%Config'; - -sub bincompat_options { - return split ' ', (Internals::V())[0]; -} - -sub non_bincompat_options { - return split ' ', (Internals::V())[1]; -} - -sub compile_date { - return (Internals::V())[2] -} - -sub local_patches { - my (undef, undef, undef, @patches) = Internals::V(); - return @patches; -} - -sub _V { - die "Perl lib was built for '%s' but is being run on '$^O'" - unless "%s" eq $^O; - - my ($bincompat, $non_bincompat, $date, @patches) = Internals::V(); - - my $opts = join ' ', sort split ' ', "$bincompat $non_bincompat"; - - # wrap at 76 columns. - - $opts =~ s/(?=.{53})(.{1,53}) /$1\n /mg; - - print Config::myconfig(); - print "\nCharacteristics of this %s: \n"; - - print " Compile-time options: $opts\n"; - - if (@patches) { - print " Locally applied patches:\n"; - print "\t$_\n" foreach @patches; - } - - print " Built under %s\n"; - - print " $date\n" if defined $date; - - my @env = map { "$_=\"$ENV{$_}\"" } sort grep {/^PERL/} keys %%ENV; -%s - if (@env) { - print " \%%ENV:\n"; - print " $_\n" foreach @env; - } - print " \@INC:\n"; - print " $_\n" foreach @INC; -} - -sub header_files { -ENDOFBEG - -$heavy_txt .= $header_files . "\n}\n\n"; - my $export_funcs = <<'EOT'; my %Export_Cache = (myconfig => 1, config_sh => 1, config_vars => 1, config_re => 1, compile_date => 1, local_patches => 1, @@ -286,12 +202,11 @@ sub import { return; } -die "Perl lib version (%s) doesn't match executable '$0' version ($])" +die "$0: Perl lib version (%s) doesn't match executable '$^X' version ($])" unless $^V; $^V eq %s - or die "Perl lib version (%s) doesn't match executable '$0' version (" . - sprintf("v%%vd",$^V) . ")"; + or die sprintf "%%s: Perl lib version (%s) doesn't match executable '$^X' version (%%vd)", $0, $^V; ENDOFBEG @@ -393,7 +308,7 @@ $fetch_string .= <<'EOT'; EOT } else { - # We only have ' delimted. + # We only have ' delimited. $fetch_string .= <<'EOT'; return undef unless $Config_SH_expanded =~ /\n$key=\'(.*?)\'\n/s; @@ -534,6 +449,78 @@ sub relocate_inc { } EOT +my $osname = fetch_string({}, 'osname'); +my $from = $osname eq 'VMS' ? 'PERLSHR image' : 'binary (from libperl)'; +my $env_cygwin = $osname eq 'cygwin' + ? 'push @env, "CYGWIN=\"$ENV{CYGWIN}\"" if $ENV{CYGWIN};' . "\n" : ""; + +$heavy_txt .= sprintf <<'ENDOFBEG', $osname, $osname, $from, $osname, $env_cygwin; +# This file was created by configpm when Perl was built. Any changes +# made to this file will be lost the next time perl is built. + +package Config; +use strict; +use warnings; +use vars '%%Config'; + +sub bincompat_options { + return split ' ', (Internals::V())[0]; +} + +sub non_bincompat_options { + return split ' ', (Internals::V())[1]; +} + +sub compile_date { + return (Internals::V())[2] +} + +sub local_patches { + my (undef, undef, undef, @patches) = Internals::V(); + return @patches; +} + +sub _V { + die "Perl lib was built for '%s' but is being run on '$^O'" + unless "%s" eq $^O; + + my ($bincompat, $non_bincompat, $date, @patches) = Internals::V(); + + my $opts = join ' ', sort split ' ', "$bincompat $non_bincompat"; + + # wrap at 76 columns. + + $opts =~ s/(?=.{53})(.{1,53}) /$1\n /mg; + + print Config::myconfig(); + print "\nCharacteristics of this %s: \n"; + + print " Compile-time options: $opts\n"; + + if (@patches) { + print " Locally applied patches:\n"; + print "\t$_\n" foreach @patches; + } + + print " Built under %s\n"; + + print " $date\n" if defined $date; + + my @env = map { "$_=\"$ENV{$_}\"" } sort grep {/^PERL/} keys %%ENV; +%s + if (@env) { + print " \%%ENV:\n"; + print " $_\n" foreach @env; + } + print " \@INC:\n"; + print " $_\n" foreach @INC; +} + +sub header_files { +ENDOFBEG + +$heavy_txt .= $header_files . "\n}\n\n"; + if (%need_relocation) { my $relocations_in_common; # otherlibdirs only features in the hash @@ -995,6 +982,7 @@ if ($Opts{glossary}) { my %seen = (); my $text = 0; $/ = ''; +my $errors= 0; sub process { if (s/\A(\w*)\s+\(([\w.]+)\):\s*\n(\t?)/=item C<$1>\n\nFrom F<$2>:\n\n/m) { @@ -1019,7 +1007,9 @@ EOF } elsif (!$text || !/\A\t/) { warn "Expected a Configure variable header", - ($text ? " or another paragraph of description" : () ); + ($text ? " or another paragraph of description" : () ), + ", instead we got:\n$_"; + $errors++; } s/n't/n\00t/g; # leave can't, won't etc untouched s/^\t\s+(.*)/\n$1/gm; # Indented lines ===> new paragraph @@ -1028,7 +1018,7 @@ EOF s{([\'\"])([^\'\"\s]+)\1}(C<$2>)g; # "date" command s{\'([A-Za-z_\- *=/]+)\'}(C<$1>)g; # 'ln -s' s{ - (?lib/Cross.pm" or die "Can not open >lib/Cross.pm: $!"; - my $cross = <<'EOS'; -# typical invocation: -# perl -MCross Makefile.PL -# perl -MCross=wince -V:cc -package Cross; - -sub import { - my ($package,$platform) = @_; - unless (defined $platform) { - # if $platform is not specified, then use last one when - # 'configpm; was invoked with --cross option - $platform = '***replace-marker***'; - } - @INC = map {/\blib\b/?(do{local $_=$_;s/\blib\b/xlib\/$platform/;$_},$_):($_)} @INC; - $::Cross::platform = $platform; -} - -1; -EOS - $cross =~ s/\*\*\*replace-marker\*\*\*/$Opts{cross}/g; - print CROSS $cross; - close CROSS; - print "written lib/Cross.pm\n"; - unshift(@INC,"xlib/$Opts{cross}"); -} - # Now do some simple tests on the Config.pm file we have created unshift(@INC,'lib'); -unshift(@INC,'xlib/symbian') if $Opts{cross}; require $Config_PM; require $Config_heavy; import Config; Index: gnu/usr.bin/perl/configure.com =================================================================== RCS file: /mnt/memory/perl/importit/cvs/src/gnu/usr.bin/perl/configure.com,v retrieving revision 1.1.1.14 diff -u -p -u -p -r1.1.1.14 configure.com --- gnu/usr.bin/perl/configure.com 24 Mar 2014 14:58:44 -0000 1.1.1.14 +++ gnu/usr.bin/perl/configure.com 16 Nov 2014 03:22:23 -0000 @@ -118,11 +118,9 @@ $!: Private path used by Configure to fi $!: is prepended to libpth. This variable takes care of special !sfn $!: machines, like the mips. Usually, it should be empty. !sfn $!plibpth='' !sfn -$!: full support for void wanted by default !sfn -$!defvoidused=15 !sfn $!: List of libraries we want. !sfn $!libswanted='net socket inet nsl nm ndbm gdbm dbm db malloc dl' !sfn -$!libswanted="$libswanted dld ld sun m c cposix posix ndir dir crypt" !sfn +$!libswanted="$libswanted ld sun m c cposix posix ndir dir crypt" !sfn $!libswanted="$libswanted ucb bsd BSD PW x" !sfn $!: We probably want to search /usr/shlib before most other libraries. !sfn $!: This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist. !sfn @@ -1980,7 +1978,6 @@ $ use_vmsdebug_perl = ans $ IF use_vmsdebug_perl $ THEN $ usevmsdebug = "define" -$ macros = macros + """__DEBUG__=1""," $ ELSE $ usevmsdebug = "undef" $ ENDIF @@ -2006,29 +2003,23 @@ $! Ask about threads, if appropriate $ IF ccname .EQS. "DEC" .OR. ccname .EQS. "CXX" $ THEN $ echo "" -$ echo "Perl can be built to take advantage of threads on some systems." +$ echo "Perl can be built to offer a form of threading support on some systems." $ echo "To do so, configure.com can be run with -""Dusethreads""." $ echo "" $ echo "Note that Perl built with threading support runs slightly slower" -$ echo "and uses more memory than plain Perl. The current implementation" -$ echo "is believed to be stable, but it is fairly new, and so should be" -$ echo "treated with caution." +$ echo "and uses slightly more memory than plain Perl." $ echo "" $ bool_dflt = "n" $ if f$type(usethreads) .nes. "" $ then $ if usethreads .or. usethreads .eqs. "define" then bool_dflt="y" $ endif -$! Catch cases where user specified ithreads or 5005threads but +$! Catch cases where user specified ithreads but $! forgot -Dusethreads $ if f$type(useithreads) .nes. "" $ then $ if useithreads .or. useithreads .eqs. "define" then bool_dflt="y" $ endif -$ if f$type(use5005threads) .nes. "" -$ then -$ if use5005threads .or. use5005threads .eqs. "define" then bool_dflt="y" -$ endif $ echo "If this doesn't make any sense to you, just accept the default '" + bool_dflt + "'." $ rp = "Build a threading Perl? [''bool_dflt'] " $ GOSUB myread @@ -2036,15 +2027,6 @@ $ if ans $ THEN $ usethreads = "define" $ use_threads="T" -$ ! Shall we do the 5.005-type threads, or IThreads? -$ echo "Since release 5.6, Perl has had two different threading implementations," -$ echo "the newer interpreter-based version (ithreads) with one interpreter per" -$ echo "thread, and the older 5.005 version (5005threads)." -$ echo "The 5005threads version is effectively unmaintained and will probably be" -$ echo "removed in Perl 5.10, so there should be no need to build a Perl using it" -$ echo "unless needed for backwards compatibility with some existing 5.005threads" -$ echo "code." -$ echo "" $ bool_dflt = "y" $ if f$type(useithreads) .nes. "" $ then @@ -2052,17 +2034,16 @@ $ if useithreads .eqs. "undef" t $ endif $ if f$type(use5005threads) .nes. "" $ then -$ if use5005threads .or. use5005threads .eqs. "define" then bool_dflt="n" +$ if use5005threads .or. use5005threads .eqs. "define" +$ then +$ echo "5.005 threads are no longer supported" +$ exit 44 +$ endif $ endif $ rp = "Use the newer interpreter-based ithreads? [''bool_dflt'] " $ GOSUB myread $ use_ithreads=ans -$ if use_ithreads -$ THEN -$ use_5005_threads="N" -$ ELSE -$ use_5005_threads="Y" -$ ENDIF +$ use_5005_threads="N" $ ! Are they on VMS 7.1 or greater? $ IF "''f$extract(1,3, f$getsyi(""version""))'" .GES. "7.1" $ THEN @@ -2473,7 +2454,7 @@ $ ENDIF $ ! more redundant scrubbing of values $ prefix = prefix - "000000." $ IF F$LOCATE(".]",prefix) .EQ. F$LENGTH(prefix) THEN prefix = prefix - "]" + ".]" -$ src = prefix +$ src = prefix - "_ROOT." $!: determine root of directory hierarchy where package will be installed. $ dflt = prefix $ IF .NOT.silent @@ -2801,7 +2782,7 @@ $ if ans.eqs."TWO_POT" then use_two_po $ if ans.eqs."PACK_MALLOC" then use_pack_malloc = "Y" $ ENDIF $! -$ known_extensions = "" +$ xs_extensions = "" $ xxx = "" $ OPEN/READ CONFIG 'manifestfound' $ext_loop: @@ -2845,7 +2826,7 @@ $ goto replace_dash_with_slash $ $ end_replace_dash_with_slash: $ -$ xxx = known_extensions +$ xxx = xs_extensions $ gosub may_already_have_extension $ IF $STATUS .EQ. 1 $ THEN @@ -2883,7 +2864,10 @@ $ xxx = F$EXTRACT(F$LENGTH(extspec) + 1, $ ENDIF $! $ found_new_extension: -$ IF F$SEARCH("[-.ext.''extension_dir_name']*.xs") .EQS. "" .AND. F$SEARCH("[-.dist.''extension_dir_name']*.xs") .EQS. "" .AND. F$SEARCH("[-.cpan.''extension_dir_name']*.xs") .EQS. "" +$ IF F$SEARCH("[-.ext.''extension_dir_name']*.xs") .EQS. "" - + .AND. F$SEARCH("[-.dist.''extension_dir_name']*.xs") .EQS. "" - + .AND. F$SEARCH("[-.cpan.''extension_dir_name']*.xs") .EQS. "" - + .AND. extension_dir_name .NES. "VMS-Filespec" $ THEN $! Bit if a hack to get around the 1K buffer on older systems. $ IF F$LENGTH(nonxs_ext) .GT. 950 @@ -2893,7 +2877,7 @@ $ ELSE $ nonxs_ext = nonxs_ext + " ''extspec'" $ ENDIF $ ELSE -$ known_extensions = known_extensions + " ''extspec'" +$ xs_extensions = xs_extensions + " ''extspec'" $ ENDIF $ goto ext_loop $end_ext: @@ -2903,8 +2887,8 @@ $ DELETE/SYMBOL idx $ DELETE/SYMBOL extspec $ DELETE/SYMBOL extlen $ DELETE/SYMBOL extension_dir_name -$ known_extensions = F$EDIT(known_extensions,"TRIM,COMPRESS") -$ dflt = known_extensions +$ xs_extensions = F$EDIT(xs_extensions,"TRIM,COMPRESS") +$ dflt = xs_extensions $ IF ccname .NES. "DEC" .AND. ccname .NES. "CXX" $ THEN $ dflt = dflt - "POSIX" ! not with VAX C or GCC @@ -3404,24 +3388,13 @@ $ ENDIF $! $! Now some that we build up $! +$ use5005threads = "undef" +$ d_old_pthread_create_joinable = "undef" +$ old_pthread_create_joinable = " " $ IF use_threads $ THEN -$ IF use_5005_threads -$ THEN -$ d_old_pthread_create_joinable = "undef" -$ old_pthread_create_joinable = " " -$ use5005threads = "define" -$ useithreads = "undef" -$ ELSE -$ d_old_pthread_create_joinable = "undef" -$ old_pthread_create_joinable = " " -$ use5005threads = "undef" -$ useithreads = "define" -$ ENDIF +$ useithreads = "define" $ ELSE -$ d_old_pthread_create_joinable = "undef" -$ old_pthread_create_joinable = " " -$ use5005threads = "undef" $ useithreads = "undef" $ ENDIF $! @@ -4481,36 +4454,43 @@ $ tmp = "setvbuf" $ GOSUB inlibc $ d_setvbuf = tmp $! -$! see if sfio.h is available -$! see if sfio library is available -$! Ok, but do we want to use it. -$! IF F$TYPE(usesfio) .EQS. "" THEN usesfio = "undef" -$! IF val .EQS. "define" -$! THEN -$! IF usesfio .EQS. "define" -$! THEN dflt = "y" -$! ELSE dflt = "n" -$! ENDIF -$! echo "''package' can use the sfio library, but it is experimental." -$! rp="You seem to have sfio available, do you want to try using it? [''dflt'] " -$! GOSUB myread -$! IF ans .EQS. "" THEN ans = dflt -$! IF ans -$! THEN -$! echo "Ok, turning on sfio then." -$! val="define" -$! ELSE -$! echo "Ok, avoiding sfio this time. I'll use stdio instead." -$! val="undef" -$! ENDIF -$! ELSE -$! IF usesfio .EQS. "define" -$! THEN -$! echo4 "Sorry, cannot find sfio on this machine." -$! echo4 "Ignoring your setting of usesfio=''usesfio'." -$! val="undef" -$! ENDIF -$! ENDIF +$! Check for the shm* routines. +$! +$ OS +$ WS "#if defined(__DECC) || defined(__DECCXX)" +$ WS "#include " +$ WS "#endif" +$ WS "#include " +$ WS "#include " +$ WS "#include " +$ WS "int shmget(key_t key, size_t size, int shmflg);" +$ WS "void* shmat(int shmid,const void *shmaddr,int shmflg);" +$ WS "int shmctl(int shmid, int cmd, struct shmid_ds *buf);" +$ WS "int shmdt(const void *shmaddr);" +$ WS "int main() {" +$ WS "int shm_id = shmget(IPC_PRIVATE, 8, S_IRWXU);" +$ WS "if (shm_id == -1) printf(""0\n""); else printf (""1\n"");" +$ WS "}" +$ CS +$ GOSUB compile +$ IF tmp .EQS. "1" +$ THEN +$ d_shm = "define" +$ d_shmat = "define" +$ d_shmatprototype = "define" +$ d_shmctl = "define" +$ d_shmdt = "define" +$ d_shmget = "define" +$ shmattype = "void *" +$ ELSE +$ d_shm = "undef" +$ d_shmat = "undef" +$ d_shmatprototype = "undef" +$ d_shmctl = "undef" +$ d_shmdt = "undef" +$ d_shmget = "undef" +$ shmattype = "undef" +$ ENDIF $! $! Check for setenv $! @@ -4557,6 +4537,29 @@ $ ELSE $ i_niin="undef" $ ENDIF $! +$! Check for +$! +$ IF Has_Dec_C_Sockets +$ THEN +$ tmp = "arpa/inet.h" +$ GOSUB inhdr +$ i_arpainet = tmp +$ ELSE +$ i_arpainet="undef" +$ ENDIF +$! +$! Check for +$! +$ IF Has_Dec_C_Sockets +$ THEN +$ tmp = "sys/un.h" +$ GOSUB inhdr +$ i_sysun = tmp +$ ELSE +$ i_sysun="undef" +$ ENDIF +$! +$! $! Check for $! $ IF Has_Dec_C_Sockets @@ -5251,70 +5254,27 @@ $! VMS V8 powered options $! We know that it is only available for 8.2 and later on 64 bit platforms. $! $ d_fstatvfs = "undef" -$! d_statvfs = "undef" +$ d_statvfs = "undef" $ i_sysstatvfs = "undef" $ if (vms_ver .GES. "8.2") .AND. (F$ELEMENT(0, "-", archname) .NES. "VMS_VAX") $ then $ echo "Found 64 bit OpenVMS ''vms_ver' -- will build with 8.2 routines" $ d_fstatvfs = "define" -$! d_statvfs = "define" +$ d_statvfs = "define" $ i_sysstatvfs = "define" $ endif $! $! Check rand48 and its ilk $! -$ echo4 "Looking for a random number function..." -$ OS -$ WS "#if defined(__DECC) || defined(__DECCXX)" -$ WS "#include " -$ WS "#endif" -$ WS "#include " -$ WS "int main()" -$ WS "{" -$ WS "srand48(12L);" -$ WS "exit(0);" -$ WS "}" -$ CS -$ GOSUB link_ok -$ IF compile_status .EQ. good_compile .AND. link_status .EQ. good_link -$ THEN -$ drand01 = "drand48()" -$ randbits = "48" -$ randfunc = "drand48" -$ randseedtype = "long int" -$ seedfunc = "srand48" -$ echo4 "Good, found drand48()." -$ d_drand48proto = "define" -$ ELSE -$ d_drand48proto = "undef" -$ drand01="random()" -$ randbits = "31" -$ randfunc = "random" -$ randseedtype = "unsigned" -$ seedfunc = "srandom" -$ OS -$ WS "#if defined(__DECC) || defined(__DECCXX)" -$ WS "#include " -$ WS "#endif" -$ WS "#include " -$ WS "int main()" -$ WS "{" -$ WS "srandom(12);" -$ WS "exit(0);" -$ WS "}" -$ CS -$ GOSUB link_ok -$ IF compile_status .EQ. good_compile .AND. link_status .EQ. good_link -$ THEN -$ echo4 "OK, found random()." -$ ELSE -$ drand01="(((float)rand())*MY_INV_RAND_MAX)" -$ randfunc = "rand" -$ randseedtype = "unsigned" -$ seedfunc = "srand" -$ echo4 "Yick, looks like I have to use rand()." -$ ENDIF -$ ENDIF +$ echo4 "Using our internal random number implementation..." +$! +$ randfunc = "Perl_drand48" +$ drand01 = "Perl_drand48()" +$ seedfunc = "Perl_drand48_init" +$ randbits = "48" +$ randseedtype = "U32" +$ d_drand48proto = "define" +$! $! Done with compiler checks. Clean up. $ IF F$SEARCH("try.c") .NES."" THEN DELETE/NOLOG/NOCONFIRM try.c;* $ IF F$SEARCH("try.obj").NES."" THEN DELETE/NOLOG/NOCONFIRM try.obj;* @@ -5447,6 +5407,7 @@ $ d_wctomb="define" $ i_locale="define" $ i_langinfo="define" $ d_locconv="define" +$ d_lc_monetary_2008="define" $ d_nl_langinfo="define" $ d_setlocale="define" $ vms_cc_type="decc" @@ -5467,6 +5428,7 @@ $ d_wctomb="undef" $ i_locale="undef" $ i_langinfo="undef" $ d_locconv="undef" +$ d_lc_monetary_2008="undef" $ d_nl_langinfo="undef" $ d_setlocale="undef" $ ENDIF @@ -5763,7 +5725,8 @@ $ d_signbit = "undef" $ echo4 "Nope." $ ENDIF $! -$ echo4 "Checking if kill() uses SYS$FORCEX or can't be called from a signal handler..." +$ echo4 "Checking if kill() uses SYS$FORCEX, can't be called from a signal handler," +$ echo4 "or fails to handle a signal value of zero..." $ kill_by_sigprc = "undef" $ OS $ WS "#include " @@ -5777,12 +5740,13 @@ $ WS " signal(1,handler1);" $ WS " signal(2,handler2);" $ WS " kill(getpid(),1);" $ WS " sleep(1);" -$ WS " printf(""\n"");" +$ WS " kill(getpid(),0);" +$ WS " printf(""3\n"");" $ WS "}" $ CS $ ON ERROR THEN CONTINUE $ GOSUB compile -$ IF tmp .NES. "012" +$ IF tmp .NES. "0123" $ THEN $ echo4 "Yes, it has at least one of those limitations." $ echo4 "Checking whether we can use SYS$SIGPRC instead..." @@ -5974,7 +5938,7 @@ $ WC "d_printf_format_null='undef'" $ WC "d_bcmp='" + d_bcmp + "'" $ WC "d_bcopy='" + d_bcopy + "'" $ WC "d_bincompat3='undef'" -$! WC "d_bsdpgrp='undef'" +$ WC "d_bsd='undef'" $ WC "d_bsdgetpgrp='undef'" $ WC "d_bsdsetpgrp='undef'" $ WC "d_builtin_choose_expr='undef'" ! GCC only @@ -5987,6 +5951,7 @@ $ WC "d_chown='define'" $ WC "d_chroot='undef'" $ WC "d_chsize='undef'" $ WC "d_class='undef'" +$ WC "d_closedir='define'" $ WC "d_cmsghdr_s='undef'" $ WC "d_const='define'" $ WC "d_copysignl='define'" @@ -6004,7 +5969,14 @@ $ WC "d_difftime64='undef'" $ WC "d_dir_dd_fd='undef'" $ WC "d_dirfd='undef'" $ WC "d_dirnamlen='define'" -$ WC "d_dlerror='undef'" +$ IF ("''F$EXTRACT(1,3, F$GETSYI(""VERSION""))'".GES."7.2") +$ THEN +$ WC "d_dlerror='define'" +$ WC "d_dlopen='define'" +$ ELSE +$ WC "d_dlerror='undef'" +$ WC "d_dlopen='undef'" +$ ENDIF $ WC "d_dlsymun='undef'" $ WC "d_dosuid='undef'" $ WC "d_drand48proto='" + d_drand48proto + "'" @@ -6024,6 +5996,8 @@ $ WC "d_fchown='undef'" $ WC "d_fcntl='" + d_fcntl + "'" $ WC "d_fcntl_can_lock='" + d_fcntl_can_lock + "'" $ WC "d_fd_set='" + d_fd_set + "'" +$ WC "d_fd_macros='define'" +$ WC "d_fds_bits='define'" $ WC "d_fgetpos='define'" $ WC "d_finite='undef'" $ WC "d_finitel='undef'" @@ -6045,10 +6019,16 @@ $ WC "d_fstatfs='undef'" $ WC "d_fstatvfs='" + d_fstatvfs + "'" $ WC "d_fsync='undef'" $ WC "d_ftello='" + d_ftello + "'" +$ WC "d_ftime='define'" $ WC "d_futimes='undef'" $ WC "d_gdbmndbm_h_uses_prototypes='undef'" $ WC "d_gdbm_ndbm_h_uses_prototypes='undef'" -$ WC "d_getaddrinfo='undef'" +$ IF vms_ver .GES. "7.3" +$ THEN +$ WC "d_getaddrinfo='define'" +$ ELSE +$ WC "d_getaddrinfo='undef'" +$ ENDIF $ WC "d_getcwd='define'" $ WC "d_getespwnam='undef'" $ WC "d_getfsstat='undef'" @@ -6063,7 +6043,12 @@ $ WC "d_getitimer='" + d_getitimer + "'" $ WC "d_getlogin='define'" $ WC "d_getmnt='undef'" $ WC "d_getmntent='undef'" -$ WC "d_getnameinfo='undef'" +$ IF vms_ver .GES. "7.3" +$ THEN +$ WC "d_getnameinfo='define'" +$ ELSE +$ WC "d_getnameinfo='undef'" +$ ENDIF $ WC "d_getnbyaddr='" + d_getnbyaddr + "'" $ WC "d_getnbyname='" + d_getnbyname + "'" $ WC "d_getnent='" + d_getnent + "'" @@ -6094,9 +6079,9 @@ $ WC "d_htonl='" + d_htonl + "'" $ WC "d_ilogbl='undef'" $ WC "d_inc_version_list='undef'" $ WC "d_index='" + d_index + "'" -$ WC "d_inetaton='undef'" -$ WC "d_inetntop='undef'" -$ WC "d_inetpton='undef'" +$ WC "d_inetaton='define'" +$ WC "d_inetntop='define'" +$ WC "d_inetpton='define'" $ WC "d_int64_t='" + d_int64_t + "'" $ WC "d_ip_mreq='define'" $ WC "d_ip_mreq_source='undef'" @@ -6116,6 +6101,7 @@ $ WC "d_link='" + d_link + "'" $ WC "d_llseek='undef'" $ WC "d_localtime64='undef'" $ WC "d_locconv='" + d_locconv + "'" +$ WC "d_lc_monetary_2008='" + d_lc_monetary_2008 + "'" $ WC "d_lockf='undef'" $ WC "d_longdbl='" + d_longdbl + "'" $ WC "d_longlong='" + d_longlong + "'" @@ -6146,6 +6132,10 @@ $ WC "d_modflproto='" + d_modflproto + " $ WC "d_modfl_pow32_bug='undef'" $ WC "d_mprotect='" + d_mprotect + "'" $ WC "d_msg='undef'" +$ WC "d_msgctl='undef'" +$ WC "d_msgget='undef'" +$ WC "d_msgrcv='undef'" +$ WC "d_msgsnd='undef'" $ WC "d_msg_ctrunc='undef'" $ WC "d_msg_dontroute='undef'" $ WC "d_msg_oob='undef'" @@ -6156,6 +6146,7 @@ $ WC "d_msync='" + d_msync + "'" $ WC "d_munmap='" + d_munmap + "'" $ WC "d_mymalloc='" + d_mymalloc + "'" $ WC "d_nanosleep='" + d_nanosleep + "'" +$ WC "d_ndbm='undef'" $ WC "d_ndbm_h_uses_prototypes='undef'" $ WC "d_nice='define'" $ WC "d_nl_langinfo='" + d_nl_langinfo + "'" @@ -6167,6 +6158,7 @@ $ WC "d_off64_t='" + d_off64_t + "'" $ WC "d_old_pthread_create_joinable='" + d_old_pthread_create_joinable + "'" $ WC "d_oldarchlib='define'" $ WC "d_oldpthreads='" + d_oldpthreads + "'" +$ WC "d_oldsock='undef'" $ WC "d_open3='define'" $ WC "d_pathconf='" + d_pathconf + "'" $ WC "d_pause='define'" @@ -6174,6 +6166,7 @@ $ WC "d_perl_otherlibdirs='undef'" $ WC "d_phostname='" + d_phostname + "'" $ WC "d_pipe='define'" $ WC "d_poll='" + d_poll + "'" +$ WC "d_portable='define'" $ WC "d_procselfexe='undef'" $ WC "d_pseudofork='undef'" $ WC "d_pthread_atfork='undef'" @@ -6210,12 +6203,14 @@ $ WC "d_select='" + d_select + "'" $ IF ("''F$EXTRACT(1,3, F$GETSYI(""VERSION""))'".GES."8.4") $ THEN $ WC "d_sem='define'" +$ WC "d_semctl='define'" $ WC "d_semctl_semid_ds='define'" $ WC "d_semctl_semun='define'" $ WC "d_semget='define'" $ WC "d_semop='define'" $ ELSE $ WC "d_sem='undef'" +$ WC "d_semctl='undef'" $ WC "d_semctl_semid_ds='undef'" $ WC "d_semctl_semun='undef'" $ WC "d_semget='undef'" @@ -6248,9 +6243,12 @@ $ WC "d_setruid='undef'" $ WC "d_setsent='" + d_setsent + "'" $ WC "d_setsid='" + d_setsid + "'" $ WC "d_setvbuf='" + d_setvbuf + "'" -$ WC "d_sfio='undef'" -$ WC "d_shm='undef'" -$ WC "d_shmatprototype='undef'" +$ WC "d_shm='" + d_shm + "'" +$ WC "d_shmat='" + d_shmat + "'" +$ WC "d_shmatprototype='" + d_shmatprototype + "'" +$ WC "d_shmctl='" + d_shmctl + "'" +$ WC "d_shmdt='" + d_shmdt + "'" +$ WC "d_shmget='" + d_shmget + "'" $ WC "d_sigaction='" + d_sigaction + "'" $ WC "d_signbit='" + d_signbit + "'" $ WC "d_sigprocmask='" + d_sigprocmask + "'" @@ -6284,6 +6282,7 @@ $ WC "d_stdio_stream_array='undef'" $ WC "d_stdiobase='" + d_stdiobase + "'" $ WC "d_stdstdio='" + d_stdstdio + "'" $ WC "d_faststdio='" + d_faststdio + "'" +$ WC "d_statvfs='" + d_statvfs + "'" $ WC "d_strchr='define'" $ WC "d_strcoll='" + d_strcoll + "'" $ WC "d_strctcpy='define'" @@ -6306,6 +6305,7 @@ $ WC "d_symlink='" + d_symlink + "'" $ WC "d_syscall='undef'" $ WC "d_syscallproto='undef'" $ WC "d_sysconf='" + d_sysconf + "'" +$ WC "d_sysernlst='undef'" $ WC "d_syserrlst='undef'" $ WC "d_system='define'" $ WC "d_tcgetpgrp='undef'" @@ -6338,12 +6338,16 @@ $ WC "d_usleep='" + d_usleep + "'" $ WC "d_usleepproto='" + d_usleep + "'" $ WC "d_ustat='undef'" $ WC "d_vendorarch='undef'" +$ WC "d_vendorbin='undef'" $ WC "d_vendorlib='undef'" +$ WC "d_vendorscript='undef'" $ WC "d_vfork='define'" $ WC "d_vms_case_sensitive_symbols='" + d_vms_be_case_sensitive + "'" ! VMS $ WC "d_vms_do_sockets='" + d_vms_do_sockets + "'" ! VMS $ WC "d_vms_shorten_long_symbols='" + d_vms_shorten_long_symbols + "'" ! VMS $ WC "d_void_closedir='define'" +$ WC "d_voidsig='undef'" +$ WC "d_voidtty='" + "'" $ WC "d_volatile='define'" $ WC "d_vprintf='define'" $ WC "d_vsnprintf='" + d_vsnprintf + "'" @@ -6352,13 +6356,13 @@ $ WC "d_waitpid='define'" $ WC "d_wcstombs='" + d_wcstombs + "'" $ WC "d_wctomb='" + d_wctomb + "'" $ WC "d_writev='undef'" +$ WC "d_xenix='undef'" $ WC "db_hashtype=' '" $ WC "db_prefixtype=' '" $ WC "db_version_major='" + "'" $ WC "db_version_minor='" + "'" $ WC "db_version_patch='" + "'" $ WC "dbgprefix='" + dbgprefix + "'" -$ WC "defvoidused='15'" $ WC "devtype='" + devtype + "'" $ WC "direntrytype='struct dirent'" $ WC "dlext='" + dlext + "'" @@ -6395,6 +6399,8 @@ $ WC "gidsign='1'" $ WC "gidsize='4'" $ WC "gidtype='" + gidtype + "'" $ WC "groupstype='Gid_t'" +$ WC "h_fcntl='false'" +$ WC "h_sysfile='false'" $ WC "hint='none'" $ WC "hintfile='" + "'" $ WC "i16size='" + i16size + "'" @@ -6405,8 +6411,9 @@ $ WC "i64size='" + i64size + "'" $ WC "i64type='" + i64type + "'" $ WC "i8size='" + i8size + "'" $ WC "i8type='" + i8type + "'" -$ WC "i_arpainet='undef'" +$ WC "i_arpainet='" + i_arpainet + "'" $ WC "i_assert='define'" +$ WC "i_bsdioctl='undef'" $ WC "i_crypt='undef'" $ WC "i_db='undef'" $ WC "i_dbm='undef'" @@ -6428,6 +6435,7 @@ $ WC "i_limits='define'" $ WC "i_locale='" + i_locale + "'" $ WC "i_machcthr='undef'" $ WC "i_machcthreads='undef'" +$ WC "i_malloc='undef'" $ WC "i_mallocmalloc='undef'" $ WC "i_math='define'" $ WC "i_memory='undef'" @@ -6442,7 +6450,6 @@ $ WC "i_prot='undef'" $ WC "i_pthread='define'" $ WC "i_pwd='undef'" $ WC "i_rpcsvcdbm='undef'" -$ WC "i_sfio='undef'" $ WC "i_sgtty='undef'" $ WC "i_shadow='" + i_shadow + "'" $ WC "i_socks='" + i_socks + "'" @@ -6460,6 +6467,8 @@ $ WC "i_sunmath='undef'" $ WC "i_sysaccess='" + i_sysaccess + "'" $ WC "i_sysdir='undef'" $ WC "i_sysfile='" + i_sysfile + "'" +$ WC "i_sysfilio='undef'" +$ WC "i_sysin='undef'" $ WC "i_sysioctl='" + i_sysioctl + "'" $ WC "i_syslog='" + i_syslog + "'" $ WC "i_sysmman='undef'" @@ -6480,7 +6489,7 @@ $ WC "i_systimek='undef'" $ WC "i_systimes='undef'" $ WC "i_systypes='define'" $ WC "i_sysuio='" + i_sysuio + "'" -$ WC "i_sysun='undef'" +$ WC "i_sysun='" + i_sysun + "'" $ WC "i_sysutsname='" + i_sysutsname + "'" $ WC "i_sysvfs='undef'" $ WC "i_syswait='undef'" @@ -6492,6 +6501,7 @@ $ WC "i_ustat='undef'" $ WC "i_utime='" + i_utime + "'" $ WC "i_values='undef'" $ WC "i_varargs='undef'" +$ WC "i_varhdr='stdarg.h'" $ WC "i_vfork='undef'" $ WC "inc_version_list='0'" $ WC "inc_version_list_init='0'" @@ -6512,15 +6522,15 @@ $ WC "ivdformat='" + ivdformat + "'" $ WC "ivsize='" + ivsize + "'" $ WC "ivtype='" + ivtype + "'" $! -$! The known_extensions symbol may be quite long +$! The xs_extensions symbol may be quite long $! -$ tmp = "known_extensions='" + known_extensions + "'" -$ WC/symbol tmp -$ DELETE/SYMBOL tmp +$ WC/symbol "known_extensions='", xs_extensions, " ", nonxs_ext, " ", nonxs_ext2, "'" $ WC "ld='" + ld + "'" +$ WC "ld_can_script='undef'" $ WC "lddlflags='/Share'" $ WC "ldflags='" + ldflags + "'" $ WC "ldflags_uselargefiles='" + "'" +$ WC "ldlibpthname='" + "'" $ WC "lib_ext='" + lib_ext + "'" $ WC "libc='" + libc + "'" $ WC "libpth='/sys$share /sys$library'" @@ -6627,7 +6637,7 @@ $ WC "selectminbits='32'" $ WC "selecttype='" + selecttype + "'" $ WC "sh='MCR'" $ WC "sharpbang='#!'" -$ WC "shmattype='" + " '" +$ WC "shmattype='" + shmattype + "'" $ WC "shortsize='" + shortsize + "'" $ IF (f$length(sig_name) .GE. 244) $ THEN @@ -6678,6 +6688,7 @@ $ WC "stdio_ptr='((*fp)->_ptr)'" $ WC "stdio_stream_array=' " + "'" $ WC "subversion='" + subversion + "'" $ WC "targetarch='" + "'" +$ WC "targetsh='MCR'" $ WC "timetype='" + timetype + "'" $ WC "u16size='" + u16size + "'" $ WC "u16type='" + u16type + "'" @@ -6749,7 +6760,6 @@ $ WC "version_patchlevel_string='" + ver $ WC "vms_cc_type='" + vms_cc_type + "'" ! VMS specific $ WC "vms_prefix='" + vms_prefix + "'" ! VMS specific $ WC "vms_ver='" + vms_ver + "'" ! VMS specific -$ WC "voidflags='15'" $! $! ## The UNIXy POSIXy reentrantey thingys ## $! See "Appendix B, Version-Dependency Tables" in the C RTL @@ -7029,6 +7039,13 @@ $ ENDIF $ ELSE $ LARGEFILE_REPLACE = "LARGEFILE=" $ ENDIF +$ IF use_vmsdebug_perl +$ THEN +$ DEBUG_REPLACE = "USEVMSDEBUG=__DEBUG__=1" +$ ELSE +$ DEBUG_REPLACE = "USEVMSDEBUG=" +$ ENDIF +$ PREFIX_REPLACE = "PREFIX=PREFIX=''prefix'" $! $! In order not to stress the tiny command buffer on pre-7.3-2 systems, $! we put the following substitutions in a file and pass the file to @@ -7050,6 +7067,8 @@ $ WC "PV=''version'" $ WC "FLAGS=FLAGS=''extra_flags'" $ WC "''LARGEFILE_REPLACE'" $ WC "ARCHNAME=ARCHNAME=''archname'" +$ WC "''DEBUG_REPLACE'" +$ WC "''PREFIX_REPLACE'" $ close CONFIG $! $ echo4 "Extracting ''defmakefile' (with variable substitutions)" @@ -7217,25 +7236,20 @@ $ ELSE $ WRITE CONFIG "$! This perl configured & administered by ''perladmin'" $ ENDIF $ WRITE CONFIG "$!" -$! HP hack to make distributing binaries easier -$!---------------------------------------------- -$ pcsi_producer = f$trnlnm("PCSI_PRODUCER") -$ if pcsi_producer .eqs. "" -$ then -$ WRITE CONFIG "$ define/translation=concealed ''vms_prefix' ''prefix'" -$ else -$ WRITE CONFIG "$ myproc = f$environment(""PROCEDURE"")" -$ WRITE CONFIG "$ myroot_dev = f$parse(myproc,,,""DEVICE"",""NO_CONCEAL"")" -$ WRITE CONFIG "$ myroot_dir = f$parse(myproc,,,""DIRECTORY"",""NO_CONCEAL"")" -$ WRITE CONFIG "$ myroot_dir = myroot_dir - ""][000000."" - ""><000000.""" -$ WRITE CONFIG "$ myroot_dir = myroot_dir - ""][000000]"" - ""><000000>""" -$ WRITE CONFIG "$ myroot_dir = myroot_dir - ""]["" - ""><""" -$ WRITE CONFIG "$ myroot_dir = myroot_dir - "".]"" - "".>"" - ""["" - ""]"" - ""<"" - "">""" -$ WRITE CONFIG "$ if f$trnlnm(""HP_BUILD_PERL_BIN_KIT"",""LNM$PROCESS_TABLE"") .EQS. """"" -$ WRITE CONFIG "$ then" -$ WRITE CONFIG "$ define/translation=concealed ''vms_prefix' 'myroot_dev'['myroot_dir'.]" -$ WRITE CONFIG "$ endif" -$ endif +$ WRITE CONFIG "$ if P1 .EQS. """"" +$ WRITE CONFIG "$ then" +$ WRITE CONFIG "$ myproc = f$environment(""PROCEDURE"")" +$ WRITE CONFIG "$ myroot_dev = f$parse(myproc,,,""DEVICE"",""NO_CONCEAL"")" +$ WRITE CONFIG "$ myroot_dir = f$parse(myproc,,,""DIRECTORY"",""NO_CONCEAL"")" +$ WRITE CONFIG "$ myroot_dir = myroot_dir - ""][000000."" - ""><000000.""" +$ WRITE CONFIG "$ myroot_dir = myroot_dir - ""][000000]"" - ""><000000>""" +$ WRITE CONFIG "$ myroot_dir = myroot_dir - ""]["" - ""><""" +$ WRITE CONFIG "$ myroot_dir = myroot_dir - "".]"" - "".>"" - ""["" - ""]"" - ""<"" - "">""" +$ WRITE CONFIG "$ root_spec = myroot_dev + ""["" + myroot_dir + "".]""" +$ WRITE CONFIG "$ else" +$ WRITE CONFIG "$ root_spec = P1" +$ WRITE CONFIG "$ endif" +$ WRITE CONFIG "$ define/translation=concealed ''vms_prefix' 'root_spec'" $ WRITE CONFIG "$ ext = "".exe""" $ IF sharedperl $ THEN @@ -7281,10 +7295,6 @@ $ WRITE CONFIG "$ c2ph == """ + pe $ WRITE CONFIG "$ config_data== """ + perl_setup_perl + " ''vms_prefix':[utils]config_data.com""" $ WRITE CONFIG "$ corelist == """ + perl_setup_perl + " ''vms_prefix':[utils]corelist.com""" $ WRITE CONFIG "$ cpan == """ + perl_setup_perl + " ''vms_prefix':[utils]cpan.com""" -$ WRITE CONFIG "$ cpan2dist == """ + perl_setup_perl + " ''vms_prefix':[utils]cpan2dist.com""" -$! FIXME: "-" is an operator and illegal in a symbol name -- cpanp-run-perl can't work -$!$ WRITE CONFIG "$ cpanp-run-perl == """ + perl_setup_perl + " ''vms_prefix':[utils]cpanp-run-perl.com""" -$ WRITE CONFIG "$ cpanp == """ + perl_setup_perl + " ''vms_prefix':[utils]cpanp.com""" $ WRITE CONFIG "$ enc2xs == """ + perl_setup_perl + " ''vms_prefix':[utils]enc2xs.com""" $ WRITE CONFIG "$ find2perl == """ + perl_setup_perl + " ''vms_prefix':[utils]find2perl.com""" $ WRITE CONFIG "$ h2ph == """ + perl_setup_perl + " ''vms_prefix':[utils]h2ph.com""" @@ -7297,7 +7307,6 @@ $ WRITE CONFIG "$ perlivp == """ + pe $ WRITE CONFIG "$ piconv == """ + perl_setup_perl + " ''vms_prefix':[utils]piconv.com""" $ WRITE CONFIG "$ pl2pm == """ + perl_setup_perl + " ''vms_prefix':[utils]pl2pm.com""" $ WRITE CONFIG "$ pod2html == """ + perl_setup_perl + " ''vms_prefix':[utils]pod2html.com""" -$ WRITE CONFIG "$ pod2latex == """ + perl_setup_perl + " ''vms_prefix':[utils]pod2latex.com""" $ WRITE CONFIG "$ pod2text == """ + perl_setup_perl + " ''vms_prefix':[utils]pod2text.com""" $ WRITE CONFIG "$!pod2man == """ + perl_setup_perl + " ''vms_prefix':[utils]pod2man.com""" $ WRITE CONFIG "$ pod2usage == """ + perl_setup_perl + " ''vms_prefix':[utils]pod2usage.com""" Index: gnu/usr.bin/perl/cop.h =================================================================== RCS file: /mnt/memory/perl/importit/cvs/src/gnu/usr.bin/perl/cop.h,v retrieving revision 1.15 diff -u -p -u -p -r1.15 cop.h --- gnu/usr.bin/perl/cop.h 24 Mar 2014 15:05:13 -0000 1.15 +++ gnu/usr.bin/perl/cop.h 16 Nov 2014 03:22:23 -0000 @@ -31,21 +31,13 @@ struct jmpenv { struct jmpenv * je_prev; - Sigjmp_buf je_buf; /* only for use if !je_throw */ + Sigjmp_buf je_buf; /* uninit if je_prev is NULL */ int je_ret; /* last exception thrown */ bool je_mustcatch; /* need to call longjmp()? */ }; typedef struct jmpenv JMPENV; -#ifdef OP_IN_REGISTER -#define OP_REG_TO_MEM PL_opsave = op -#define OP_MEM_TO_REG op = PL_opsave -#else -#define OP_REG_TO_MEM NOOP -#define OP_MEM_TO_REG NOOP -#endif - /* * How to build the first jmpenv. * @@ -58,10 +50,11 @@ typedef struct jmpenv JMPENV; #define JMPENV_BOOTSTRAP \ STMT_START { \ - Zero(&PL_start_env, 1, JMPENV); \ + PERL_POISON_EXPR(PoisonNew(&PL_start_env, 1, JMPENV));\ + PL_top_env = &PL_start_env; \ + PL_start_env.je_prev = NULL; \ PL_start_env.je_ret = -1; \ PL_start_env.je_mustcatch = TRUE; \ - PL_top_env = &PL_start_env; \ } STMT_END /* @@ -107,9 +100,7 @@ typedef struct jmpenv JMPENV; Perl_deb(aTHX_ "JUMPENV_PUSH level=%d at %s:%d\n", \ i, __FILE__, __LINE__);}) \ cur_env.je_prev = PL_top_env; \ - OP_REG_TO_MEM; \ cur_env.je_ret = PerlProc_setjmp(cur_env.je_buf, SCOPE_SAVES_SIGNAL_MASK); \ - OP_MEM_TO_REG; \ PL_top_env = &cur_env; \ cur_env.je_mustcatch = FALSE; \ (v) = cur_env.je_ret; \ @@ -133,7 +124,6 @@ typedef struct jmpenv JMPENV; while (p) { i++; p = p->je_prev; } \ Perl_deb(aTHX_ "JUMPENV_JUMP(%d) level=%d at %s:%d\n", \ (int)v, i, __FILE__, __LINE__);}) \ - OP_REG_TO_MEM; \ if (PL_top_env->je_prev) \ PerlProc_longjmp(PL_top_env->je_buf, (v)); \ if ((v) == 2) \ @@ -410,7 +400,7 @@ struct cop { # ifdef NETWARE # define CopFILE_set(c,pv) ((c)->cop_file = savepv(pv)) -# define CopFILE_setn(c,pv,l) ((c)->cop_file = savepv((pv),(l))) +# define CopFILE_setn(c,pv,l) ((c)->cop_file = savepvn((pv),(l))) # else # define CopFILE_set(c,pv) ((c)->cop_file = savesharedpv(pv)) # define CopFILE_setn(c,pv,l) ((c)->cop_file = savesharedpvn((pv),(l))) @@ -444,8 +434,8 @@ struct cop { # else # define CopFILEAVx(c) (GvAV(CopFILEGV(c))) # endif -# define CopFILE(c) (CopFILEGV(c) && GvSV(CopFILEGV(c)) \ - ? SvPVX(GvSV(CopFILEGV(c))) : NULL) +# define CopFILE(c) (CopFILEGV(c) \ + ? GvNAME(CopFILEGV(c))+2 : NULL) # define CopSTASH(c) ((c)->cop_stash) # define CopSTASH_set(c,hv) ((c)->cop_stash = (hv)) # define CopFILE_free(c) (SvREFCNT_dec(CopFILEGV(c)),(CopFILEGV(c) = NULL)) @@ -648,6 +638,7 @@ struct block_format { #define POPSUB(cx,sv) \ STMT_START { \ + const I32 olddepth = cx->blk_sub.olddepth; \ RETURN_PROBE(CvNAMED(cx->blk_sub.cv) \ ? HEK_KEY(CvNAME_HEK(cx->blk_sub.cv)) \ : GvENAME(CvGV(cx->blk_sub.cv)), \ @@ -671,7 +662,8 @@ struct block_format { } \ } \ sv = MUTABLE_SV(cx->blk_sub.cv); \ - if (sv && (CvDEPTH((const CV*)sv) = cx->blk_sub.olddepth)) \ + LEAVE_SCOPE(PL_scopestack[cx->blk_oldscopesp-1]); \ + if (sv && (CvDEPTH((const CV*)sv) = olddepth)) \ sv = NULL; \ } STMT_END @@ -681,11 +673,15 @@ struct block_format { } STMT_END #define POPFORMAT(cx) \ - setdefout(cx->blk_format.dfoutgv); \ - CvDEPTH(cx->blk_format.cv)--; \ - if (!CvDEPTH(cx->blk_format.cv)) \ + STMT_START { \ + CV * const cv = cx->blk_format.cv; \ + GV * const dfuot = cx->blk_format.dfoutgv; \ + setdefout(dfuot); \ + LEAVE_SCOPE(PL_scopestack[cx->blk_oldscopesp-1]); \ + if (!--CvDEPTH(cv)) \ SvREFCNT_dec_NN(cx->blk_format.cv); \ - SvREFCNT_dec_NN(cx->blk_format.dfoutgv); + SvREFCNT_dec_NN(dfuot); \ + } STMT_END /* eval context */ struct block_eval { @@ -1058,6 +1054,7 @@ L. #define G_WRITING_TO_STDERR 1024 /* Perl_write_to_stderr() is calling Perl_magic_methcall(). */ #define G_RE_REPARSING 0x800 /* compiling a run-time /(?{..})/ */ +#define G_METHOD_NAMED 4096 /* calling named method, eg without :: or ' */ /* flag bits for PL_in_eval */ #define EVAL_NULL 0 /* not in an eval */ @@ -1166,14 +1163,14 @@ typedef struct stackinfo PERL_SI; =head1 Multicall Functions =for apidoc Ams||dMULTICALL -Declare local variables for a multicall. See L. +Declare local variables for a multicall. See L. =for apidoc Ams||PUSH_MULTICALL Opening bracket for a lightweight callback. See L. =for apidoc Ams||MULTICALL -Make a lightweight callback. See L. +Make a lightweight callback. See L. =for apidoc Ams||POP_MULTICALL Closing bracket for a lightweight callback. Index: gnu/usr.bin/perl/cv.h =================================================================== RCS file: /mnt/memory/perl/importit/cvs/src/gnu/usr.bin/perl/cv.h,v retrieving revision 1.14 diff -u -p -u -p -r1.14 cv.h --- gnu/usr.bin/perl/cv.h 24 Mar 2014 15:05:13 -0000 1.14 +++ gnu/usr.bin/perl/cv.h 16 Nov 2014 03:22:24 -0000 @@ -26,10 +26,10 @@ Null CV pointer. =head1 CV Manipulation Functions This section documents functions to manipulate CVs which are code-values, -or subroutines. For more information, see L. +or subroutines. For more information, see L. =for apidoc Am|HV*|CvSTASH|CV* cv -Returns the stash of the CV. A stash is the symbol table hash, containing +Returns the stash of the CV. A stash is the symbol table hash, containing the package-scoped variables in the package where the subroutine was defined. For more information, see L. @@ -49,7 +49,7 @@ See L. #define CvROOT(sv) ((XPVCV*)MUTABLE_PTR(SvANY(sv)))->xcv_root_u.xcv_root #define CvXSUB(sv) ((XPVCV*)MUTABLE_PTR(SvANY(sv)))->xcv_root_u.xcv_xsub #define CvXSUBANY(sv) ((XPVCV*)MUTABLE_PTR(SvANY(sv)))->xcv_start_u.xcv_xsubany -#define CvGV(sv) S_CvGV((CV *)(sv)) +#define CvGV(sv) S_CvGV((const CV *)(sv)) #define CvGV_set(cv,gv) Perl_cvgv_set(aTHX_ cv, gv) #define CvFILE(sv) ((XPVCV*)MUTABLE_PTR(SvANY(sv)))->xcv_file #ifdef USE_ITHREADS @@ -189,7 +189,7 @@ See L. #define XS_DYNAMIC_FILENAME 0x01 /* The filename isn't static */ PERL_STATIC_INLINE GV * -S_CvGV(CV *sv) +S_CvGV(const CV *sv) { return CvNAMED(sv) ? 0 @@ -218,19 +218,19 @@ CvNAME_HEK(CV *sv) =for apidoc m|bool|CvWEAKOUTSIDE|CV *cv Each CV has a pointer, C, to its lexically enclosing -CV (if any). Because pointers to anonymous sub prototypes are +CV (if any). Because pointers to anonymous sub prototypes are stored in C<&> pad slots, it is a possible to get a circular reference, -with the parent pointing to the child and vice-versa. To avoid the +with the parent pointing to the child and vice-versa. To avoid the ensuing memory leak, we do not increment the reference count of the CV pointed to by C in the I that the parent -has a C<&> pad slot pointing back to us. In this case, we set the -C flag in the child. This allows us to determine under what +has a C<&> pad slot pointing back to us. In this case, we set the +C flag in the child. This allows us to determine under what circumstances we should decrement the refcount of the parent when freeing the child. There is a further complication with non-closure anonymous subs (i.e. those -that do not refer to any lexicals outside that sub). In this case, the -anonymous prototype is shared rather than being cloned. This has the +that do not refer to any lexicals outside that sub). In this case, the +anonymous prototype is shared rather than being cloned. This has the consequence that the parent may be freed while there are still active children, eg @@ -246,16 +246,16 @@ and the freed BEGIN is accessed. To avoid this, whenever a CV and its associated pad is freed, any C<&> entries in the pad are explicitly removed from the pad, and if the refcount of the pointed-to anon sub is still positive, then that -child's C is set to point to its grandparent. This will only +child's C is set to point to its grandparent. This will only occur in the single specific case of a non-closure anon prototype having one or more active references (such as C<$a> above). One other thing to consider is that a CV may be merely undefined -rather than freed, eg C. In this case, its refcount may +rather than freed, eg C. In this case, its refcount may not have reached zero, but we still delete its pad and its C etc. Since various children may still have their C pointing at this undefined CV, we keep its own C for the time being, so that -the chain of lexical scopes is unbroken. For example, the following +the chain of lexical scopes is unbroken. For example, the following should print 123: my $x = 123; Index: gnu/usr.bin/perl/deb.c =================================================================== RCS file: /mnt/memory/perl/importit/cvs/src/gnu/usr.bin/perl/deb.c,v retrieving revision 1.13 diff -u -p -u -p -r1.13 deb.c --- gnu/usr.bin/perl/deb.c 24 Mar 2014 15:05:13 -0000 1.13 +++ gnu/usr.bin/perl/deb.c 16 Nov 2014 03:22:24 -0000 @@ -217,7 +217,9 @@ Perl_deb_stack_all(pTHX) for (;;) { const size_t si_name_ix = si->si_type+1; /* -1 is a valid index */ - const char * const si_name = (si_name_ix >= sizeof(si_names)) ? "????" : si_names[si_name_ix]; + const char * const si_name = + si_name_ix < C_ARRAY_LENGTH(si_names) ? + si_names[si_name_ix] : "????"; I32 ix; PerlIO_printf(Perl_debug_log, "STACK %"IVdf": %s\n", (IV)si_ix, si_name); Index: gnu/usr.bin/perl/doio.c =================================================================== RCS file: /mnt/memory/perl/importit/cvs/src/gnu/usr.bin/perl/doio.c,v retrieving revision 1.17 diff -u -p -u -p -r1.17 doio.c --- gnu/usr.bin/perl/doio.c 24 Mar 2014 15:05:13 -0000 1.17 +++ gnu/usr.bin/perl/doio.c 16 Nov 2014 03:22:24 -0000 @@ -60,81 +60,106 @@ #include -bool -Perl_do_openn(pTHX_ GV *gv, const char *oname, I32 len, int as_raw, - int rawmode, int rawperm, PerlIO *supplied_fp, SV **svp, - I32 num_svs) +static IO * +S_openn_setup(pTHX_ GV *gv, char *mode, PerlIO **saveifp, PerlIO **saveofp, + int *savefd, char *savetype) { dVAR; IO * const io = GvIOn(gv); - PerlIO *saveifp = NULL; - PerlIO *saveofp = NULL; - int savefd = -1; - char savetype = IoTYPE_CLOSED; - int writing = 0; - PerlIO *fp; - int fd; - int result; - bool was_fdopen = FALSE; - bool in_raw = 0, in_crlf = 0, out_raw = 0, out_crlf = 0; - char *type = NULL; - char mode[PERL_MODE_MAX]; /* file mode ("r\0", "rb\0", "ab\0" etc.) */ - SV *namesv; - PERL_ARGS_ASSERT_DO_OPENN; + PERL_ARGS_ASSERT_OPENN_SETUP; + + *saveifp = NULL; + *saveofp = NULL; + *savefd = -1; + *savetype = IoTYPE_CLOSED; Zero(mode,sizeof(mode),char); PL_forkprocess = 1; /* assume true if no fork */ - /* Collect default raw/crlf info from the op */ - if (PL_op && PL_op->op_type == OP_OPEN) { - /* set up IO layers */ - const U8 flags = PL_op->op_private; - in_raw = (flags & OPpOPEN_IN_RAW); - in_crlf = (flags & OPpOPEN_IN_CRLF); - out_raw = (flags & OPpOPEN_OUT_RAW); - out_crlf = (flags & OPpOPEN_OUT_CRLF); - } - /* If currently open - close before we re-open */ if (IoIFP(io)) { - fd = PerlIO_fileno(IoIFP(io)); if (IoTYPE(io) == IoTYPE_STD) { /* This is a clone of one of STD* handles */ - result = 0; - } - else if (fd >= 0 && fd <= PL_maxsysfd) { - /* This is one of the original STD* handles */ - saveifp = IoIFP(io); - saveofp = IoOFP(io); - savetype = IoTYPE(io); - savefd = fd; - result = 0; - } - else if (IoTYPE(io) == IoTYPE_PIPE) - result = PerlProc_pclose(IoIFP(io)); - else if (IoIFP(io) != IoOFP(io)) { - if (IoOFP(io)) { - result = PerlIO_close(IoOFP(io)); - PerlIO_close(IoIFP(io)); /* clear stdio, fd already closed */ - } - else - result = PerlIO_close(IoIFP(io)); - } - else - result = PerlIO_close(IoIFP(io)); - if (result == EOF && fd > PL_maxsysfd) { - /* Why is this not Perl_warn*() call ? */ - PerlIO_printf(Perl_error_log, - "Warning: unable to close filehandle %"HEKf" properly.\n", - HEKfARG(GvENAME_HEK(gv)) - ); } + else { + const int old_fd = PerlIO_fileno(IoIFP(io)); + + if (old_fd >= 0 && old_fd <= PL_maxsysfd) { + /* This is one of the original STD* handles */ + *saveifp = IoIFP(io); + *saveofp = IoOFP(io); + *savetype = IoTYPE(io); + *savefd = old_fd; + } + else { + int result; + + if (IoTYPE(io) == IoTYPE_PIPE) + result = PerlProc_pclose(IoIFP(io)); + else if (IoIFP(io) != IoOFP(io)) { + if (IoOFP(io)) { + result = PerlIO_close(IoOFP(io)); + PerlIO_close(IoIFP(io)); /* clear stdio, fd already closed */ + } + else + result = PerlIO_close(IoIFP(io)); + } + else + result = PerlIO_close(IoIFP(io)); + + if (result == EOF && old_fd > PL_maxsysfd) { + /* Why is this not Perl_warn*() call ? */ + PerlIO_printf(Perl_error_log, + "Warning: unable to close filehandle %"HEKf" properly.\n", + HEKfARG(GvENAME_HEK(gv)) + ); + } + } + } IoOFP(io) = IoIFP(io) = NULL; } + return io; +} + +bool +Perl_do_openn(pTHX_ GV *gv, const char *oname, I32 len, int as_raw, + int rawmode, int rawperm, PerlIO *supplied_fp, SV **svp, + I32 num_svs) +{ + PERL_ARGS_ASSERT_DO_OPENN; if (as_raw) { /* sysopen style args, i.e. integer mode and permissions */ + + if (num_svs != 0) { + Perl_croak(aTHX_ "panic: sysopen with multiple args, num_svs=%ld", + (long) num_svs); + } + return do_open_raw(gv, oname, len, rawmode, rawperm); + } + return do_open6(gv, oname, len, supplied_fp, svp, num_svs); +} + +bool +Perl_do_open_raw(pTHX_ GV *gv, const char *oname, STRLEN len, + int rawmode, int rawperm) +{ + dVAR; + PerlIO *saveifp; + PerlIO *saveofp; + int savefd; + char savetype; + char mode[PERL_MODE_MAX]; /* file mode ("r\0", "rb\0", "ab\0" etc.) */ + IO * const io = openn_setup(gv, mode, &saveifp, &saveofp, &savefd, &savetype); + int writing = 0; + PerlIO *fp; + + PERL_ARGS_ASSERT_DO_OPEN_RAW; + + /* For ease of blame back to 5.000, keep the existing indenting. */ + { + /* sysopen style args, i.e. integer mode and permissions */ STRLEN ix = 0; const int appendtrunc = 0 @@ -147,11 +172,8 @@ Perl_do_openn(pTHX_ GV *gv, const char * ; const int modifyingmode = O_WRONLY|O_RDWR|O_CREAT|appendtrunc; int ismodifying; + SV *namesv; - if (num_svs != 0) { - Perl_croak(aTHX_ "panic: sysopen with multiple args, num_svs=%ld", - (long) num_svs); - } /* It's not always O_RDONLY 0 @@ -183,17 +205,48 @@ Perl_do_openn(pTHX_ GV *gv, const char * IoTYPE(io) = PerlIO_intmode2str(rawmode, &mode[ix], &writing); namesv = newSVpvn_flags(oname, len, SVs_TEMP); - num_svs = 1; - svp = &namesv; - type = NULL; - fp = PerlIO_openn(aTHX_ type, mode, -1, rawmode, rawperm, NULL, num_svs, svp); + fp = PerlIO_openn(aTHX_ NULL, mode, -1, rawmode, rawperm, NULL, 1, &namesv); } - else { + return openn_cleanup(gv, io, fp, mode, oname, saveifp, saveofp, savefd, + savetype, writing, 0, NULL); +} + +bool +Perl_do_open6(pTHX_ GV *gv, const char *oname, STRLEN len, + PerlIO *supplied_fp, SV **svp, U32 num_svs) +{ + dVAR; + PerlIO *saveifp; + PerlIO *saveofp; + int savefd; + char savetype; + char mode[PERL_MODE_MAX]; /* file mode ("r\0", "rb\0", "ab\0" etc.) */ + IO * const io = openn_setup(gv, mode, &saveifp, &saveofp, &savefd, &savetype); + int writing = 0; + PerlIO *fp; + bool was_fdopen = FALSE; + char *type = NULL; + + PERL_ARGS_ASSERT_DO_OPEN6; + + /* For ease of blame back to 5.000, keep the existing indenting. */ + { /* Regular (non-sys) open */ char *name; STRLEN olen = len; char *tend; int dodup = 0; + bool in_raw = 0, in_crlf = 0, out_raw = 0, out_crlf = 0; + + /* Collect default raw/crlf info from the op */ + if (PL_op && PL_op->op_type == OP_OPEN) { + /* set up IO layers */ + const U8 flags = PL_op->op_private; + in_raw = (flags & OPpOPEN_IN_RAW); + in_crlf = (flags & OPpOPEN_IN_CRLF); + out_raw = (flags & OPpOPEN_OUT_RAW); + out_crlf = (flags & OPpOPEN_OUT_CRLF); + } type = savepvn(oname, len); tend = type+len; @@ -206,6 +259,8 @@ Perl_do_openn(pTHX_ GV *gv, const char * *--tend = '\0'; if (num_svs) { + const char *p; + STRLEN nlen = 0; /* New style explicit name, type is just mode and layer info */ #ifdef USE_STDIO if (SvROK(*svp) && !strchr(oname,'&')) { @@ -213,11 +268,19 @@ Perl_do_openn(pTHX_ GV *gv, const char * Perl_warner(aTHX_ packWARN(WARN_IO), "Can't open a reference"); SETERRNO(EINVAL, LIB_INVARG); + fp = NULL; goto say_false; } #endif /* USE_STDIO */ - name = (SvOK(*svp) || SvGMAGICAL(*svp)) ? - savesvpv (*svp) : savepvs (""); + p = (SvOK(*svp) || SvGMAGICAL(*svp)) ? SvPV(*svp, nlen) : NULL; + + if (p && !IS_SAFE_PATHNAME(p, nlen, "open")) { + fp = NULL; + goto say_false; + } + + name = p ? savepvn(p, nlen) : savepvs(""); + SAVEFREEPV(name); } else { @@ -253,6 +316,7 @@ Perl_do_openn(pTHX_ GV *gv, const char * if (ckWARN(WARN_PIPE)) Perl_warner(aTHX_ packWARN(WARN_PIPE), "Missing command in piped open"); errno = EPIPE; + fp = NULL; goto say_false; } if (!(*name == '-' && name[1] == '\0') || num_svs) @@ -278,6 +342,7 @@ Perl_do_openn(pTHX_ GV *gv, const char * if (num_svs) { if (*type) { if (PerlIO_apply_layers(aTHX_ fp, mode, type) != 0) { + fp = NULL; goto say_false; } } @@ -314,6 +379,7 @@ Perl_do_openn(pTHX_ GV *gv, const char * } else { PerlIO *that_fp = NULL; + int wanted_fd; if (num_svs > 1) { /* diag_listed_as: More than one argument to '%s' open */ Perl_croak(aTHX_ "More than one argument to '%c&' open",IoTYPE(io)); @@ -324,11 +390,11 @@ Perl_do_openn(pTHX_ GV *gv, const char * SvIOK(*svp) || (SvPOKp(*svp) && looks_like_number(*svp)) )) { - fd = SvUV(*svp); + wanted_fd = SvUV(*svp); num_svs = 0; } else if (isDIGIT(*type)) { - fd = atoi(type); + wanted_fd = atoi(type); } else { const IO* thatio; @@ -344,6 +410,7 @@ Perl_do_openn(pTHX_ GV *gv, const char * #ifdef EINVAL SETERRNO(EINVAL,SS_IVCHAN); #endif + fp = NULL; goto say_false; } if ((that_fp = IoIFP(thatio))) { @@ -352,19 +419,12 @@ Perl_do_openn(pTHX_ GV *gv, const char * * be optimized away on most platforms; * only Solaris and Linux seem to flush * on that. --jhi */ -#ifdef USE_SFIO - /* sfio fails to clear error on next - sfwrite, contrary to documentation. - -- Nicholas Clark */ - if (PerlIO_seek(that_fp, 0, SEEK_CUR) == -1) - PerlIO_clearerr(that_fp); -#endif /* On the other hand, do all platforms * take gracefully to flushing a read-only * filehandle? Perhaps we should do * fsetpos(src)+fgetpos(dst)? --nik */ PerlIO_flush(that_fp); - fd = PerlIO_fileno(that_fp); + wanted_fd = PerlIO_fileno(that_fp); /* When dup()ing STDIN, STDOUT or STDERR * explicitly set appropriate access mode */ if (that_fp == PerlIO_stdout() @@ -378,7 +438,7 @@ Perl_do_openn(pTHX_ GV *gv, const char * IoTYPE(io) = IoTYPE_SOCKET; } else - fd = -1; + wanted_fd = -1; } if (!num_svs) type = NULL; @@ -387,12 +447,12 @@ Perl_do_openn(pTHX_ GV *gv, const char * } else { if (dodup) - fd = PerlLIO_dup(fd); + wanted_fd = PerlLIO_dup(wanted_fd); else was_fdopen = TRUE; - if (!(fp = PerlIO_openn(aTHX_ type,mode,fd,0,0,NULL,num_svs,svp))) { - if (dodup && fd >= 0) - PerlLIO_close(fd); + if (!(fp = PerlIO_openn(aTHX_ type,mode,wanted_fd,0,0,NULL,num_svs,svp))) { + if (dodup && wanted_fd >= 0) + PerlLIO_close(wanted_fd); } } } @@ -410,13 +470,14 @@ Perl_do_openn(pTHX_ GV *gv, const char * } } else { - if (!num_svs) { - namesv = newSVpvn_flags(type, tend - type, SVs_TEMP); - num_svs = 1; - svp = &namesv; + if (num_svs) { + fp = PerlIO_openn(aTHX_ type,mode,-1,0,0,NULL,num_svs,svp); + } + else { + SV *namesv = newSVpvn_flags(type, tend - type, SVs_TEMP); type = NULL; + fp = PerlIO_openn(aTHX_ type,mode,-1,0,0,NULL,1,&namesv); } - fp = PerlIO_openn(aTHX_ type,mode,-1,0,0,NULL,num_svs,svp); } } /* !& */ if (!fp && type && *type && *type != ':' && !isIDFIRST(*type)) @@ -444,13 +505,14 @@ Perl_do_openn(pTHX_ GV *gv, const char * } } else { - if (!num_svs) { - namesv = newSVpvn_flags(type, tend - type, SVs_TEMP); - num_svs = 1; - svp = &namesv; + if (num_svs) { + fp = PerlIO_openn(aTHX_ type,mode,-1,0,0,NULL,num_svs,svp); + } + else { + SV *namesv = newSVpvn_flags(type, tend - type, SVs_TEMP); type = NULL; + fp = PerlIO_openn(aTHX_ type,mode,-1,0,0,NULL,1,&namesv); } - fp = PerlIO_openn(aTHX_ type,mode,-1,0,0,NULL,num_svs,svp); } if (!fp && type && *type && *type != ':' && !isIDFIRST(*type)) goto unknown_open_mode; @@ -475,6 +537,7 @@ Perl_do_openn(pTHX_ GV *gv, const char * if (ckWARN(WARN_PIPE)) Perl_warner(aTHX_ packWARN(WARN_PIPE), "Missing command in piped open"); errno = EPIPE; + fp = NULL; goto say_false; } if (!(*name == '-' && name[1] == '\0') || num_svs) @@ -499,6 +562,7 @@ Perl_do_openn(pTHX_ GV *gv, const char * type++; if (*type) { if (PerlIO_apply_layers(aTHX_ fp, mode, type) != 0) { + fp = NULL; goto say_false; } } @@ -523,22 +587,44 @@ Perl_do_openn(pTHX_ GV *gv, const char * IoTYPE(io) = IoTYPE_STD; } else { - if (!num_svs) { - namesv = newSVpvn_flags(type, tend - type, SVs_TEMP); - num_svs = 1; - svp = &namesv; + if (num_svs) { + fp = PerlIO_openn(aTHX_ type,mode,-1,0,0,NULL,num_svs,svp); + } + else { + SV *namesv = newSVpvn_flags(type, tend - type, SVs_TEMP); type = NULL; + fp = PerlIO_openn(aTHX_ type,mode,-1,0,0,NULL,1,&namesv); } - fp = PerlIO_openn(aTHX_ type,mode,-1,0,0,NULL,num_svs,svp); } } } + + say_false: + return openn_cleanup(gv, io, fp, mode, oname, saveifp, saveofp, savefd, + savetype, writing, was_fdopen, type); +} + +/* Yes, this is ugly, but it's private, and I don't see a cleaner way to + simplify the two-headed public interface of do_openn. */ +static bool +S_openn_cleanup(pTHX_ GV *gv, IO *io, PerlIO *fp, char *mode, const char *oname, + PerlIO *saveifp, PerlIO *saveofp, int savefd, char savetype, + int writing, bool was_fdopen, const char *type) +{ + int fd; + + PERL_ARGS_ASSERT_OPENN_CLEANUP; + if (!fp) { if (IoTYPE(io) == IoTYPE_RDONLY && ckWARN(WARN_NEWLINE) && strchr(oname, '\n') ) + { + GCC_DIAG_IGNORE(-Wformat-nonliteral); /* PL_warn_nl is constant */ Perl_warner(aTHX_ packWARN(WARN_NEWLINE), PL_warn_nl, "open"); + GCC_DIAG_RESTORE; + } goto say_false; } @@ -575,11 +661,7 @@ Perl_do_openn(pTHX_ GV *gv, const char * IoTYPE(io) = IoTYPE_SOCKET; /* in case a socket was passed in to us */ #ifdef HAS_SOCKET else if ( -#ifdef S_IFMT !(PL_statbuf.st_mode & S_IFMT) -#else - !PL_statbuf.st_mode -#endif && IoTYPE(io) != IoTYPE_WRONLY /* Dups of STD* filehandles already have */ && IoTYPE(io) != IoTYPE_RDONLY /* type so they aren't marked as sockets */ ) { /* on OS's that return 0 on fstat()ed pipe */ @@ -687,7 +769,7 @@ Perl_do_openn(pTHX_ GV *gv, const char * if (*s == IoTYPE_IMPLICIT || *s == IoTYPE_NUMERIC) s++; *s = 'w'; - if (!(IoOFP(io) = PerlIO_openn(aTHX_ type,s,fd,0,0,NULL,0,svp))) { + if (!(IoOFP(io) = PerlIO_openn(aTHX_ type,s,fd,0,0,NULL,0,NULL))) { PerlIO_close(fp); IoIFP(io) = NULL; goto say_false; @@ -709,13 +791,6 @@ PerlIO * Perl_nextargv(pTHX_ GV *gv) { dVAR; - SV *sv; -#ifndef FLEXFILENAMES - int filedev; - int fileino; -#endif - Uid_t fileuid; - Gid_t filegid; IO * const io = GvIOp(gv); PERL_ARGS_ASSERT_NEXTARGV; @@ -743,16 +818,32 @@ Perl_nextargv(pTHX_ GV *gv) PL_filemode = 0; if (!GvAV(gv)) return NULL; - while (av_len(GvAV(gv)) >= 0) { + while (av_tindex(GvAV(gv)) >= 0) { STRLEN oldlen; - sv = av_shift(GvAV(gv)); + SV *const sv = av_shift(GvAV(gv)); SAVEFREESV(sv); SvTAINTED_off(GvSVn(gv)); /* previous tainting irrelevant */ sv_setsv(GvSVn(gv),sv); SvSETMAGIC(GvSV(gv)); PL_oldname = SvPVx(GvSV(gv), oldlen); - if (do_open(gv,PL_oldname,oldlen,PL_inplace!=0,O_RDONLY,0,NULL)) { - if (PL_inplace) { + if (LIKELY(!PL_inplace)) { + if (do_open6(gv, PL_oldname, oldlen, NULL, NULL, 0)) { + return IoIFP(GvIOp(gv)); + } + } + else { + /* This very long block ends with return IoIFP(GvIOp(gv)); + Both this block and the block above fall through on open + failure to the warning code, and then the while loop above tries + the next entry. */ + if (do_open_raw(gv, PL_oldname, oldlen, O_RDONLY, 0)) { +#ifndef FLEXFILENAMES + int filedev; + int fileino; +#endif + Uid_t fileuid; + Gid_t filegid; + TAINT_PROPER("inplace open"); if (oldlen == 1 && *PL_oldname == '-') { setdefout(gv_fetchpvs("STDOUT", GV_ADD|GV_NOTQUAL, @@ -818,7 +909,7 @@ Perl_nextargv(pTHX_ GV *gv) do_close(gv,FALSE); (void)PerlLIO_unlink(SvPVX_const(sv)); (void)PerlLIO_rename(PL_oldname,SvPVX_const(sv)); - do_open(gv,(char*)SvPVX_const(sv),SvCUR(sv),TRUE,O_RDONLY,0,NULL); + do_open_raw(gv, SvPVX_const(sv), SvCUR(sv), O_RDONLY, 0); #endif /* DOSISH */ #else (void)UNLINK(SvPVX_const(sv)); @@ -850,14 +941,14 @@ Perl_nextargv(pTHX_ GV *gv) sv_setpvn(sv,PL_oldname,oldlen); SETERRNO(0,0); /* in case sprintf set errno */ - if (!Perl_do_openn(aTHX_ PL_argvoutgv, (char*)SvPVX_const(sv), - SvCUR(sv), TRUE, + if (!Perl_do_open_raw(aTHX_ PL_argvoutgv, SvPVX_const(sv), + SvCUR(sv), #ifdef VMS - O_WRONLY|O_CREAT|O_TRUNC,0, + O_WRONLY|O_CREAT|O_TRUNC, 0 #else - O_WRONLY|O_CREAT|OPEN_EXCL,0600, + O_WRONLY|O_CREAT|OPEN_EXCL, 0600 #endif - NULL, NULL, 0)) { + )) { Perl_ck_warner_d(aTHX_ packWARN(WARN_INPLACE), "Can't do inplace edit on %s: %s", PL_oldname, Strerror(errno) ); do_close(gv,FALSE); @@ -872,31 +963,31 @@ Perl_nextargv(pTHX_ GV *gv) (void)PerlLIO_chmod(PL_oldname,PL_filemode); #endif if (fileuid != PL_statbuf.st_uid || filegid != PL_statbuf.st_gid) { + /* XXX silently ignore failures */ #ifdef HAS_FCHOWN - (void)fchown(PL_lastfd,fileuid,filegid); + PERL_UNUSED_RESULT(fchown(PL_lastfd,fileuid,filegid)); #else #ifdef HAS_CHOWN - (void)PerlLIO_chown(PL_oldname,fileuid,filegid); + PERL_UNUSED_RESULT(PerlLIO_chown(PL_oldname,fileuid,filegid)); #endif #endif } + return IoIFP(GvIOp(gv)); } - return IoIFP(GvIOp(gv)); - } - else { - if (ckWARN_d(WARN_INPLACE)) { - const int eno = errno; - if (PerlLIO_stat(PL_oldname, &PL_statbuf) >= 0 - && !S_ISREG(PL_statbuf.st_mode)) - { - Perl_warner(aTHX_ packWARN(WARN_INPLACE), - "Can't do inplace edit: %s is not a regular file", - PL_oldname); - } - else - Perl_warner(aTHX_ packWARN(WARN_INPLACE), "Can't open %s: %s", - PL_oldname, Strerror(eno)); - } + } /* successful do_open_raw(), PL_inplace non-NULL */ + + if (ckWARN_d(WARN_INPLACE)) { + const int eno = errno; + if (PerlLIO_stat(PL_oldname, &PL_statbuf) >= 0 + && !S_ISREG(PL_statbuf.st_mode)) { + Perl_warner(aTHX_ packWARN(WARN_INPLACE), + "Can't do inplace edit: %s is not a regular file", + PL_oldname); + } + else { + Perl_warner(aTHX_ packWARN(WARN_INPLACE), "Can't open %s: %s", + PL_oldname, Strerror(eno)); + } } } if (io && (IoFLAGS(io) & IOf_ARGV)) @@ -1045,10 +1136,6 @@ Perl_do_tell(pTHX_ GV *gv) PERL_ARGS_ASSERT_DO_TELL; if (io && (fp = IoIFP(io))) { -#ifdef ULTRIX_STDIO_BOTCH - if (PerlIO_eof(fp)) - (void)PerlIO_seek(fp, 0L, 2); /* ultrix 1.2 workaround */ -#endif return PerlIO_tell(fp); } report_evil_fh(gv); @@ -1064,10 +1151,6 @@ Perl_do_seek(pTHX_ GV *gv, Off_t pos, in PerlIO *fp; if (io && (fp = IoIFP(io))) { -#ifdef ULTRIX_STDIO_BOTCH - if (PerlIO_eof(fp)) - (void)PerlIO_seek(fp, 0L, 2); /* ultrix 1.2 workaround */ -#endif return PerlIO_seek(fp, pos, whence) >= 0; } report_evil_fh(gv); @@ -1322,8 +1405,11 @@ Perl_my_stat_flags(pTHX_ const U32 flags s = SvPVX_const(PL_statname); /* s now NUL-terminated */ PL_laststype = OP_STAT; PL_laststatval = PerlLIO_stat(s, &PL_statcache); - if (PL_laststatval < 0 && ckWARN(WARN_NEWLINE) && strchr(s, '\n')) + if (PL_laststatval < 0 && ckWARN(WARN_NEWLINE) && strchr(s, '\n')) { + GCC_DIAG_IGNORE(-Wformat-nonliteral); /* PL_warn_nl is constant */ Perl_warner(aTHX_ packWARN(WARN_NEWLINE), PL_warn_nl, "stat"); + GCC_DIAG_RESTORE; + } return PL_laststatval; } } @@ -1337,6 +1423,7 @@ Perl_my_lstat_flags(pTHX_ const U32 flag dSP; const char *file; SV* const sv = TOPs; + bool isio = FALSE; if (PL_op->op_flags & OPf_REF) { if (cGVOP_gv == PL_defgv) { if (PL_laststype != OP_LSTAT) @@ -1345,6 +1432,7 @@ Perl_my_lstat_flags(pTHX_ const U32 flag } PL_laststatval = -1; if (ckWARN(WARN_IO)) { + /* diag_listed_as: Use of -l on filehandle%s */ Perl_warner(aTHX_ packWARN(WARN_IO), "Use of -l on filehandle %"HEKf, HEKfARG(GvENAME_HEK(cGVOP_gv))); @@ -1360,15 +1448,31 @@ Perl_my_lstat_flags(pTHX_ const U32 flag PL_laststype = OP_LSTAT; PL_statgv = NULL; - if (SvROK(sv) && isGV_with_GP(SvRV(sv)) && ckWARN(WARN_IO)) { - Perl_warner(aTHX_ packWARN(WARN_IO), "Use of -l on filehandle %s", - GvENAME((const GV *)SvRV(sv))); + if ( ( (SvROK(sv) && ( isGV_with_GP(SvRV(sv)) + || (isio = SvTYPE(SvRV(sv)) == SVt_PVIO) ) + ) + || isGV_with_GP(sv) + ) + && ckWARN(WARN_IO)) { + if (isio) + /* diag_listed_as: Use of -l on filehandle%s */ + Perl_warner(aTHX_ packWARN(WARN_IO), + "Use of -l on filehandle"); + else + /* diag_listed_as: Use of -l on filehandle%s */ + Perl_warner(aTHX_ packWARN(WARN_IO), + "Use of -l on filehandle %"HEKf, + GvENAME_HEK((const GV *) + (SvROK(sv) ? SvRV(sv) : sv))); } file = SvPV_flags_const_nolen(sv, flags); sv_setpv(PL_statname,file); PL_laststatval = PerlLIO_lstat(file,&PL_statcache); - if (PL_laststatval < 0 && ckWARN(WARN_NEWLINE) && strchr(file, '\n')) - Perl_warner(aTHX_ packWARN(WARN_NEWLINE), PL_warn_nl, "lstat"); + if (PL_laststatval < 0 && ckWARN(WARN_NEWLINE) && strchr(file, '\n')) { + GCC_DIAG_IGNORE(-Wformat-nonliteral); /* PL_warn_nl is constant */ + Perl_warner(aTHX_ packWARN(WARN_NEWLINE), PL_warn_nl, "lstat"); + GCC_DIAG_RESTORE; + } return PL_laststatval; } @@ -1381,7 +1485,8 @@ S_exec_failed(pTHX_ const char *cmd, int Perl_warner(aTHX_ packWARN(WARN_EXEC), "Can't exec \"%s\": %s", cmd, Strerror(e)); if (do_report) { - PerlLIO_write(fd, (void*)&e, sizeof(int)); + /* XXX silently ignore failures */ + PERL_UNUSED_RESULT(PerlLIO_write(fd, (void*)&e, sizeof(int))); PerlLIO_close(fd); } } @@ -1643,10 +1748,12 @@ Perl_apply(pTHX_ I32 type, SV **mark, SV } } else { - const char *name = SvPV_nomg_const_nolen(*mark); + const char *name = SvPV_nomg_const(*mark, len); APPLY_TAINT_PROPER(); - if (PerlLIO_chmod(name, val)) - tot--; + if (!IS_SAFE_PATHNAME(name, len, "chmod") || + PerlLIO_chmod(name, val)) { + tot--; + } } } } @@ -1677,10 +1784,12 @@ Perl_apply(pTHX_ I32 type, SV **mark, SV } } else { - const char *name = SvPV_nomg_const_nolen(*mark); + const char *name = SvPV_nomg_const(*mark, len); APPLY_TAINT_PROPER(); - if (PerlLIO_chown(name, val, val2)) + if (!IS_SAFE_PATHNAME(name, len, "chown") || + PerlLIO_chown(name, val, val2)) { tot--; + } } } } @@ -1763,12 +1872,15 @@ nothing in the core. if (!(SvNIOK(*mark) || looks_like_number(*mark))) Perl_croak(aTHX_ "Can't kill a non-numeric process ID"); proc = SvIV_nomg(*mark); - if (killgp) - { - proc = -proc; - } APPLY_TAINT_PROPER(); - if (PerlProc_kill(proc, val)) +#ifdef HAS_KILLPG + /* use killpg in preference, as the killpg() wrapper for Win32 + * understands process groups, but the kill() wrapper doesn't */ + if (killgp ? PerlProc_killpg(proc, val) + : PerlProc_kill(proc, val)) +#else + if (PerlProc_kill(killgp ? -proc: proc, val)) +#endif tot--; } PERL_ASYNC_CHECK(); @@ -1778,15 +1890,22 @@ nothing in the core. APPLY_TAINT_PROPER(); tot = sp - mark; while (++mark <= sp) { - s = SvPV_nolen_const(*mark); + s = SvPV_const(*mark, len); APPLY_TAINT_PROPER(); - if (PerlProc_geteuid() || PL_unsafe) { + if (!IS_SAFE_PATHNAME(s, len, "unlink")) { + tot--; + } + else if (PL_unsafe) { if (UNLINK(s)) tot--; } else { /* don't let root wipe out directories without -U */ - if (PerlLIO_lstat(s,&PL_statbuf) < 0 || S_ISDIR(PL_statbuf.st_mode)) + if (PerlLIO_lstat(s,&PL_statbuf) < 0) + tot--; + else if (S_ISDIR(PL_statbuf.st_mode)) { tot--; + SETERRNO(EISDIR, SS$_NOPRIV); + } else { if (UNLINK(s)) tot--; @@ -1856,8 +1975,12 @@ nothing in the core. } } else { - const char * const name = SvPV_nomg_const_nolen(*mark); + const char * const name = SvPV_nomg_const(*mark, len); APPLY_TAINT_PROPER(); + if (!IS_SAFE_PATHNAME(name, len, "utime")) { + tot--; + } + else #ifdef HAS_FUTIMES if (utimes(name, (struct timeval *)utbufp)) #else @@ -2111,11 +2234,16 @@ Perl_do_ipcctl(pTHX_ I32 optype, SV **ma #ifdef Semctl union semun unsemds; + if(cmd == SETVAL) { + unsemds.val = PTR2nat(a); + } + else { #ifdef EXTRA_F_IN_SEMUN_BUF - unsemds.buff = (struct semid_ds *)a; + unsemds.buff = (struct semid_ds *)a; #else - unsemds.buf = (struct semid_ds *)a; + unsemds.buf = (struct semid_ds *)a; #endif + } ret = Semctl(id, n, cmd, unsemds); #else /* diag_listed_as: sem%s not implemented */ @@ -2194,10 +2322,8 @@ Perl_do_msgrcv(pTHX_ SV **mark, SV **sp) if (ret >= 0) { SvCUR_set(mstr, sizeof(long)+ret); *SvEND(mstr) = '\0'; -#ifndef INCOMPLETE_TAINTS /* who knows who has been playing with this message? */ SvTAINTED_on(mstr); -#endif } return ret; #else @@ -2246,15 +2372,6 @@ Perl_do_semop(pTHX_ SV **mark, SV **sp) t++; } result = semop(id, temps, nsops); - t = temps; - o = ops; - i = nsops; - while (i--) { - *o++ = t->sem_num; - *o++ = t->sem_op; - *o++ = t->sem_flg; - t++; - } Safefree(temps); return result; } @@ -2304,10 +2421,8 @@ Perl_do_shmio(pTHX_ I32 optype, SV **mar SvCUR_set(mstr, msize); *SvEND(mstr) = '\0'; SvSETMAGIC(mstr); -#ifndef INCOMPLETE_TAINTS /* who knows who has been playing with this shared memory? */ SvTAINTED_on(mstr); -#endif } else { STRLEN len; @@ -2334,7 +2449,7 @@ Perl_do_shmio(pTHX_ I32 optype, SV **mar =for apidoc start_glob Function called by C to spawn a glob (or do the glob inside -perl on VMS). This code used to be inline, but now perl uses C +perl on VMS). This code used to be inline, but now perl uses C this glob starter is only used by miniperl during the build process. Moving it away shrinks pp_hot.c; shrinking pp_hot.c helps speed perl up. @@ -2347,9 +2462,14 @@ Perl_start_glob (pTHX_ SV *tmpglob, IO * dVAR; SV * const tmpcmd = newSV(0); PerlIO *fp; + STRLEN len; + const char *s = SvPV(tmpglob, len); PERL_ARGS_ASSERT_START_GLOB; + if (!IS_SAFE_SYSCALL(s, len, "pattern", "glob")) + return NULL; + ENTER; SAVEFREESV(tmpcmd); #ifdef VMS /* expand the wildcards right here, rather than opening a pipe, */ @@ -2387,11 +2507,7 @@ Perl_vms_start_glob #else sv_setpv(tmpcmd, "echo "); sv_catsv(tmpcmd, tmpglob); -#if 'z' - 'a' == 25 - sv_catpv(tmpcmd, "|tr -s ' \t\f\r' '\\012\\012\\012\\012'|"); -#else sv_catpv(tmpcmd, "|tr -s ' \t\f\r' '\\n\\n\\n\\n'|"); -#endif #endif /* !CSH */ #endif /* !DOSISH */ { @@ -2404,11 +2520,17 @@ Perl_vms_start_glob if (home && *home) SvSETMAGIC(*home); if (path && *path) SvSETMAGIC(*path); } - (void)do_open(PL_last_in_gv, (char*)SvPVX_const(tmpcmd), SvCUR(tmpcmd), - FALSE, O_RDONLY, 0, NULL); + (void)do_open6(PL_last_in_gv, SvPVX_const(tmpcmd), SvCUR(tmpcmd), + NULL, NULL, 0); fp = IoIFP(io); #endif /* !VMS */ LEAVE; + + if (!fp && ckWARN(WARN_GLOB)) { + Perl_warner(aTHX_ packWARN(WARN_GLOB), "glob failed (can't start child: %s)", + Strerror(errno)); + } + return fp; } Index: gnu/usr.bin/perl/doop.c =================================================================== RCS file: /mnt/memory/perl/importit/cvs/src/gnu/usr.bin/perl/doop.c,v retrieving revision 1.16 diff -u -p -u -p -r1.16 doop.c --- gnu/usr.bin/perl/doop.c 24 Mar 2014 15:05:13 -0000 1.16 +++ gnu/usr.bin/perl/doop.c 16 Nov 2014 03:22:24 -0000 @@ -15,8 +15,8 @@ */ /* This file contains some common functions needed to carry out certain - * ops. For example both pp_schomp() and pp_chomp() - scalar and array - * chomp operations - call the function do_chomp() found in this file. + * ops. For example, both pp_sprintf() and pp_prtf() call the function + * do_printf() found in this file. */ #include "EXTERN.h" @@ -331,7 +331,7 @@ S_do_trans_simple_utf8(pTHX_ SV * const const U8 * const e = s + len; while (t < e) { const U8 ch = *t++; - hibit = !NATIVE_IS_INVARIANT(ch); + hibit = !NATIVE_BYTE_IS_INVARIANT(ch); if (hibit) { s = bytes_to_utf8(s, &len); break; @@ -361,7 +361,7 @@ S_do_trans_simple_utf8(pTHX_ SV * const if (uv < none) { s += UTF8SKIP(s); matches++; - d = uvuni_to_utf8(d, uv); + d = uvchr_to_utf8(d, uv); } else if (uv == none) { const int i = UTF8SKIP(s); @@ -372,7 +372,7 @@ S_do_trans_simple_utf8(pTHX_ SV * const else if (uv == extra) { s += UTF8SKIP(s); matches++; - d = uvuni_to_utf8(d, final); + d = uvchr_to_utf8(d, final); } else s += UTF8SKIP(s); @@ -432,7 +432,7 @@ S_do_trans_count_utf8(pTHX_ SV * const s const U8 * const e = s + len; while (t < e) { const U8 ch = *t++; - hibit = !NATIVE_IS_INVARIANT(ch); + hibit = !NATIVE_BYTE_IS_INVARIANT(ch); if (hibit) { start = s = bytes_to_utf8(s, &len); break; @@ -487,7 +487,7 @@ S_do_trans_complex_utf8(pTHX_ SV * const const U8 * const e = s + len; while (t < e) { const U8 ch = *t++; - hibit = !NATIVE_IS_INVARIANT(ch); + hibit = !NATIVE_BYTE_IS_INVARIANT(ch); if (hibit) { s = bytes_to_utf8(s, &len); break; @@ -532,7 +532,7 @@ S_do_trans_complex_utf8(pTHX_ SV * const matches++; s += UTF8SKIP(s); if (uv != puv) { - d = uvuni_to_utf8(d, uv); + d = uvchr_to_utf8(d, uv); puv = uv; } continue; @@ -550,13 +550,13 @@ S_do_trans_complex_utf8(pTHX_ SV * const if (havefinal) { s += UTF8SKIP(s); if (puv != final) { - d = uvuni_to_utf8(d, final); + d = uvchr_to_utf8(d, final); puv = final; } } else { STRLEN len; - uv = utf8n_to_uvuni(s, send - s, &len, UTF8_ALLOW_DEFAULT); + uv = utf8n_to_uvchr(s, send - s, &len, UTF8_ALLOW_DEFAULT); if (uv != puv) { Move(s, d, len, U8); d += len; @@ -585,7 +585,7 @@ S_do_trans_complex_utf8(pTHX_ SV * const if (uv < none) { matches++; s += UTF8SKIP(s); - d = uvuni_to_utf8(d, uv); + d = uvchr_to_utf8(d, uv); continue; } else if (uv == none) { /* "none" is unmapped character */ @@ -598,7 +598,7 @@ S_do_trans_complex_utf8(pTHX_ SV * const else if (uv == extra && !del) { matches++; s += UTF8SKIP(s); - d = uvuni_to_utf8(d, final); + d = uvchr_to_utf8(d, final); continue; } matches++; /* "none+1" is delete character */ @@ -632,7 +632,6 @@ Perl_do_trans(pTHX_ SV *sv) PERL_ARGS_ASSERT_DO_TRANS; if (SvREADONLY(sv) && !(PL_op->op_private & OPpTRANS_IDENTICAL)) { - if (!SvIsCOW(sv)) Perl_croak_no_modify(); } (void)SvPV_const(sv, len); @@ -762,13 +761,14 @@ Perl_do_vecget(pTHX_ SV *sv, SSize_t off { dVAR; STRLEN srclen, len, uoffset, bitoffs = 0; - const unsigned char *s = (const unsigned char *) SvPV_flags_const(sv, srclen, - SV_GMAGIC | ((PL_op->op_flags & OPf_MOD || LVRET) - ? SV_UNDEF_RETURNS_NULL : 0)); + const I32 svpv_flags = ((PL_op->op_flags & OPf_MOD || LVRET) + ? SV_UNDEF_RETURNS_NULL : 0); + unsigned char *s = (unsigned char *) + SvPV_flags(sv, srclen, (svpv_flags|SV_GMAGIC)); UV retnum = 0; if (!s) { - s = (const unsigned char *)""; + s = (unsigned char *)""; } PERL_ARGS_ASSERT_DO_VECGET; @@ -778,8 +778,11 @@ Perl_do_vecget(pTHX_ SV *sv, SSize_t off if (size < 1 || (size & (size-1))) /* size < 1 or not a power of two */ Perl_croak(aTHX_ "Illegal number of bits in vec"); - if (SvUTF8(sv)) + if (SvUTF8(sv)) { (void) Perl_sv_utf8_downgrade(aTHX_ sv, TRUE); + /* PVX may have changed */ + s = (unsigned char *) SvPV_flags(sv, srclen, svpv_flags); + } if (size < 8) { bitoffs = ((offset%8)*size)%8; Index: gnu/usr.bin/perl/dosish.h =================================================================== RCS file: /mnt/memory/perl/importit/cvs/src/gnu/usr.bin/perl/dosish.h,v retrieving revision 1.12 diff -u -p -u -p -r1.12 dosish.h --- gnu/usr.bin/perl/dosish.h 24 Mar 2014 15:05:13 -0000 1.12 +++ gnu/usr.bin/perl/dosish.h 16 Nov 2014 03:22:24 -0000 @@ -58,23 +58,6 @@ #endif #define dXSUB_SYS -/* - * 5.003_07 and earlier keyed on #ifdef MSDOS for determining if we were - * running on DOS, *and* if we had to cope with 16 bit memory addressing - * constraints, *and* we need to have memory allocated as unsigned long. - * - * with the advent of *real* compilers for DOS, they are not locked together. - * MSDOS means "I am running on MSDOS". HAS_64K_LIMIT means "I have - * 16 bit memory addressing constraints". - * - * if you need the last, try #DEFINE MEM_SIZE unsigned long. - */ -#ifdef MSDOS -# ifndef DJGPP -# define HAS_64K_LIMIT -# endif -#endif - /* USEMYBINMODE * This symbol, if defined, indicates that the program should * use the routine my_binmode(FILE *fp, char iotype, int mode) to insure Index: gnu/usr.bin/perl/dquote_static.c =================================================================== RCS file: /mnt/memory/perl/importit/cvs/src/gnu/usr.bin/perl/dquote_static.c,v retrieving revision 1.1.1.2 diff -u -p -u -p -r1.1.1.2 dquote_static.c --- gnu/usr.bin/perl/dquote_static.c 24 Mar 2014 14:58:44 -0000 1.1.1.2 +++ gnu/usr.bin/perl/dquote_static.c 16 Nov 2014 03:22:24 -0000 @@ -46,44 +46,44 @@ S_regcurly(pTHX_ const char *s, */ STATIC char -S_grok_bslash_c(pTHX_ const char source, const bool utf8, const bool output_warning) +S_grok_bslash_c(pTHX_ const char source, const bool output_warning) { U8 result; - if (utf8) { - /* Trying to deprecate non-ASCII usages. This construct has never - * worked for a utf8 variant. So, even though are accepting non-ASCII - * Latin1 in 5.14, no need to make them work under utf8 */ - if (! isASCII(source)) { - Perl_croak(aTHX_ "Character following \"\\c\" must be ASCII"); + if (! isPRINT_A(source)) { + const char msg[] = "Character following \"\\c\" must be printable ASCII"; + if (! isASCII(source)) { + Perl_croak(aTHX_ "%s", msg); + } + else if (output_warning) { /* Unprintables can be removed in v5.22 */ + Perl_ck_warner_d(aTHX_ packWARN2(WARN_DEPRECATED, WARN_SYNTAX), "%s", + msg); } } + else if (source == '{') { + assert(isPRINT_A(toCTRL('{'))); - result = toCTRL(source); - if (! isASCII(source)) { - Perl_ck_warner_d(aTHX_ packWARN2(WARN_DEPRECATED, WARN_SYNTAX), - "Character following \"\\c\" must be ASCII"); + /* diag_listed_as: Use "%s" instead of "%s" */ + Perl_croak(aTHX_ "Use \"%c\" instead of \"\\c{\"", toCTRL('{')); } - else if (! isCNTRL(result) && output_warning) { - if (source == '{') { - Perl_ck_warner_d(aTHX_ packWARN2(WARN_DEPRECATED, WARN_SYNTAX), - "\"\\c{\" is deprecated and is more clearly written as \";\""); - } - else { - U8 clearer[3]; - U8 i = 0; - if (! isWORDCHAR(result)) { - clearer[i++] = '\\'; - } - clearer[i++] = result; - clearer[i++] = '\0'; - Perl_ck_warner(aTHX_ packWARN(WARN_SYNTAX), - "\"\\c%c\" is more clearly written simply as \"%s\"", - source, - clearer); - } + result = toCTRL(source); + if (output_warning && ! isCNTRL_L1(result)) { + /* We use isCNTRL_L1 above and not simply isCNTRL, because on EBCDIC + * machines, things like \cT map into a C1 control. */ + U8 clearer[3]; + U8 i = 0; + if (! isWORDCHAR(result)) { + clearer[i++] = '\\'; + } + clearer[i++] = result; + clearer[i++] = '\0'; + + Perl_ck_warner(aTHX_ packWARN(WARN_SYNTAX), + "\"\\c%c\" is more clearly written simply as \"%s\"", + source, + clearer); } return result; Index: gnu/usr.bin/perl/dump.c =================================================================== RCS file: /mnt/memory/perl/importit/cvs/src/gnu/usr.bin/perl/dump.c,v retrieving revision 1.15 diff -u -p -u -p -r1.15 dump.c --- gnu/usr.bin/perl/dump.c 24 Mar 2014 15:05:13 -0000 1.15 +++ gnu/usr.bin/perl/dump.c 16 Nov 2014 03:22:24 -0000 @@ -27,13 +27,12 @@ #include "perl.h" #include "regcomp.h" - static const char* const svtypenames[SVt_LAST] = { "NULL", - "BIND", "IV", "NV", "PV", + "INVLIST", "PVIV", "PVNV", "PVMG", @@ -50,10 +49,10 @@ static const char* const svtypenames[SVt static const char* const svshorttypenames[SVt_LAST] = { "UNDEF", - "BIND", "IV", "NV", "PV", + "INVLST", "PVIV", "PVNV", "PVMG", @@ -85,132 +84,10 @@ S_append_flags(pTHX_ SV *sv, U32 flags, #define append_flags(sv, f, flags) \ S_append_flags(aTHX_ (sv), (f), (flags), C_ARRAY_END(flags)) - - -void -Perl_dump_indent(pTHX_ I32 level, PerlIO *file, const char* pat, ...) -{ - va_list args; - PERL_ARGS_ASSERT_DUMP_INDENT; - va_start(args, pat); - dump_vindent(level, file, pat, &args); - va_end(args); -} - -void -Perl_dump_vindent(pTHX_ I32 level, PerlIO *file, const char* pat, va_list *args) -{ - dVAR; - PERL_ARGS_ASSERT_DUMP_VINDENT; - PerlIO_printf(file, "%*s", (int)(level*PL_dumpindent), ""); - PerlIO_vprintf(file, pat, *args); -} - -void -Perl_dump_all(pTHX) -{ - dump_all_perl(FALSE); -} - -void -Perl_dump_all_perl(pTHX_ bool justperl) -{ - - dVAR; - PerlIO_setlinebuf(Perl_debug_log); - if (PL_main_root) - op_dump(PL_main_root); - dump_packsubs_perl(PL_defstash, justperl); -} - -void -Perl_dump_packsubs(pTHX_ const HV *stash) -{ - PERL_ARGS_ASSERT_DUMP_PACKSUBS; - dump_packsubs_perl(stash, FALSE); -} - -void -Perl_dump_packsubs_perl(pTHX_ const HV *stash, bool justperl) -{ - dVAR; - I32 i; - - PERL_ARGS_ASSERT_DUMP_PACKSUBS_PERL; - - if (!HvARRAY(stash)) - return; - for (i = 0; i <= (I32) HvMAX(stash); i++) { - const HE *entry; - for (entry = HvARRAY(stash)[i]; entry; entry = HeNEXT(entry)) { - const GV * const gv = (const GV *)HeVAL(entry); - if (SvTYPE(gv) != SVt_PVGV || !GvGP(gv)) - continue; - if (GvCVu(gv)) - dump_sub_perl(gv, justperl); - if (GvFORM(gv)) - dump_form(gv); - if (HeKEY(entry)[HeKLEN(entry)-1] == ':') { - const HV * const hv = GvHV(gv); - if (hv && (hv != PL_defstash)) - dump_packsubs_perl(hv, justperl); /* nested package */ - } - } - } -} - -void -Perl_dump_sub(pTHX_ const GV *gv) -{ - PERL_ARGS_ASSERT_DUMP_SUB; - dump_sub_perl(gv, FALSE); -} - -void -Perl_dump_sub_perl(pTHX_ const GV *gv, bool justperl) -{ - SV * sv; - - PERL_ARGS_ASSERT_DUMP_SUB_PERL; - - if (justperl && (CvISXSUB(GvCV(gv)) || !CvROOT(GvCV(gv)))) - return; - - sv = sv_newmortal(); - gv_fullname3(sv, gv, NULL); - Perl_dump_indent(aTHX_ 0, Perl_debug_log, "\nSUB %s = ", SvPVX_const(sv)); - if (CvISXSUB(GvCV(gv))) - Perl_dump_indent(aTHX_ 0, Perl_debug_log, "(xsub 0x%"UVxf" %d)\n", - PTR2UV(CvXSUB(GvCV(gv))), - (int)CvXSUBANY(GvCV(gv)).any_i32); - else if (CvROOT(GvCV(gv))) - op_dump(CvROOT(GvCV(gv))); - else - Perl_dump_indent(aTHX_ 0, Perl_debug_log, "\n"); -} - -void -Perl_dump_form(pTHX_ const GV *gv) -{ - SV * const sv = sv_newmortal(); - - PERL_ARGS_ASSERT_DUMP_FORM; - - gv_fullname3(sv, gv, NULL); - Perl_dump_indent(aTHX_ 0, Perl_debug_log, "\nFORMAT %s = ", SvPVX_const(sv)); - if (CvROOT(GvFORM(gv))) - op_dump(CvROOT(GvFORM(gv))); - else - Perl_dump_indent(aTHX_ 0, Perl_debug_log, "\n"); -} - -void -Perl_dump_eval(pTHX) -{ - dVAR; - op_dump(PL_eval_root); -} - +#define generic_pv_escape(sv,s,len,utf8) pv_escape( (sv), (s), (len), \ + (len) * (4+UTF8_MAXBYTES) + 1, NULL, \ + PERL_PV_ESCAPE_NONASCII | PERL_PV_ESCAPE_DWIM \ + | ((utf8) ? PERL_PV_ESCAPE_UNI : 0) ) /* =for apidoc pv_escape @@ -231,20 +108,21 @@ using C to determine i If PERL_PV_ESCAPE_ALL is set then all input chars will be output using C<\x01F1> style escapes, otherwise if PERL_PV_ESCAPE_NONASCII is set, only -chars above 127 will be escaped using this style; otherwise, only chars above +non-ASCII chars will be escaped using this style; otherwise, only chars above 255 will be so escaped; other non printable chars will use octal or -common escaped patterns like C<\n>. Otherwise, if PERL_PV_ESCAPE_NOBACKSLASH +common escaped patterns like C<\n>. +Otherwise, if PERL_PV_ESCAPE_NOBACKSLASH then all chars below 255 will be treated as printable and will be output as literals. If PERL_PV_ESCAPE_FIRSTCHAR is set then only the first char of the -string will be escaped, regardless of max. If the output is to be in hex, +string will be escaped, regardless of max. If the output is to be in hex, then it will be returned as a plain hex -sequence. Thus the output will either be a single char, +sequence. Thus the output will either be a single char, an octal escape sequence, a special escape like C<\n> or a hex value. If PERL_PV_ESCAPE_RE is set then the escape char used will be a '%' and -not a '\\'. This is because regexes very often contain backslashed +not a '\\'. This is because regexes very often contain backslashed sequences, whereas '%' is not a particularly common character in patterns. Returns a pointer to the escaped text as held by dsv. @@ -285,14 +163,17 @@ Perl_pv_escape( pTHX_ SV *dsv, char cons if ( ( u > 255 ) || (flags & PERL_PV_ESCAPE_ALL) - || (( u > 127 ) && (flags & PERL_PV_ESCAPE_NONASCII))) + || (( ! isASCII(u) ) && (flags & (PERL_PV_ESCAPE_NONASCII|PERL_PV_ESCAPE_DWIM)))) { if (flags & PERL_PV_ESCAPE_FIRSTCHAR) chsize = my_snprintf( octbuf, PV_ESCAPE_OCTBUFSIZE, "%"UVxf, u); else chsize = my_snprintf( octbuf, PV_ESCAPE_OCTBUFSIZE, - "%cx{%"UVxf"}", esc, u); + ((flags & PERL_PV_ESCAPE_DWIM) && !isuni) + ? "%cx%02"UVxf + : "%cx{%02"UVxf"}", esc, u); + } else if (flags & PERL_PV_ESCAPE_NOBACKSLASH) { chsize = 1; } else { @@ -319,7 +200,12 @@ Perl_pv_escape( pTHX_ SV *dsv, char cons chsize = 1; break; default: - if ( (pv+readsize < end) && isDIGIT((U8)*(pv+readsize)) ) + if ( (flags & PERL_PV_ESCAPE_DWIM) && c != '\0' ) { + chsize = my_snprintf( octbuf, PV_ESCAPE_OCTBUFSIZE, + isuni ? "%cx{%02"UVxf"}" : "%cx%02"UVxf, + esc, u); + } + else if ( (pv+readsize < end) && isDIGIT((U8)*(pv+readsize)) ) chsize = my_snprintf( octbuf, PV_ESCAPE_OCTBUFSIZE, "%c%03o", esc, c); else @@ -336,12 +222,12 @@ Perl_pv_escape( pTHX_ SV *dsv, char cons sv_catpvn(dsv, octbuf, chsize); wrote += chsize; } else { - /* If PERL_PV_ESCAPE_NOBACKSLASH is set then bytes in the range - 128-255 can be appended raw to the dsv. If dsv happens to be + /* If PERL_PV_ESCAPE_NOBACKSLASH is set then non-ASCII bytes + can be appended raw to the dsv. If dsv happens to be UTF-8 then we need catpvf to upgrade them for us. Or add a new API call sv_catpvc(). Think about that name, and how to keep it clear that it's unlike the s of catpvs, which is - really an array octets, not a string. */ + really an array of octets, not a string. */ Perl_sv_catpvf( aTHX_ dsv, "%c", c); wrote++; } @@ -359,16 +245,16 @@ Converts a string into something present pv_escape() and supporting quoting and ellipses. If the PERL_PV_PRETTY_QUOTE flag is set then the result will be -double quoted with any double quotes in the string escaped. Otherwise +double quoted with any double quotes in the string escaped. Otherwise if the PERL_PV_PRETTY_LTGT flag is set then the result be wrapped in angle brackets. If the PERL_PV_PRETTY_ELLIPSES flag is set and not all characters in string were output then an ellipsis C<...> will be appended to the -string. Note that this happens AFTER it has been quoted. +string. Note that this happens AFTER it has been quoted. If start_color is non-null then it will be inserted after the opening -quote (if there is one) but before the escaped text. If end_color +quote (if there is one) but before the escaped text. If end_color is non-null then it will be inserted after the escaped text but before any quotes or ellipses. @@ -505,7 +391,7 @@ Perl_sv_peek(pTHX_ SV *sv) } else if (DEBUG_R_TEST_) { int is_tmp = 0; - I32 ix; + SSize_t ix; /* is this SV on the tmps stack? */ for (ix=PL_tmps_ix; ix>=0; ix--) { if (PL_tmps_stack[ix] == sv) { @@ -533,7 +419,11 @@ Perl_sv_peek(pTHX_ SV *sv) } type = SvTYPE(sv); if (type == SVt_PVCV) { - Perl_sv_catpvf(aTHX_ t, "CV(%s)", CvGV(sv) ? GvNAME(CvGV(sv)) : ""); + SV * const tmp = newSVpvs_flags("", SVs_TEMP); + GV* gvcv = CvGV(sv); + Perl_sv_catpvf(aTHX_ t, "CV(%s)", gvcv + ? generic_pv_escape( tmp, GvNAME(gvcv), GvNAMELEN(gvcv), GvNAMEUTF8(gvcv)) + : ""); goto finish; } else if (type < SVt_LAST) { sv_catpv(t, svshorttypenames[type]); @@ -586,6 +476,157 @@ Perl_sv_peek(pTHX_ SV *sv) return SvPV_nolen(t); } +/* +=head1 Debugging Utilities +*/ + +void +Perl_dump_indent(pTHX_ I32 level, PerlIO *file, const char* pat, ...) +{ + va_list args; + PERL_ARGS_ASSERT_DUMP_INDENT; + va_start(args, pat); + dump_vindent(level, file, pat, &args); + va_end(args); +} + +void +Perl_dump_vindent(pTHX_ I32 level, PerlIO *file, const char* pat, va_list *args) +{ + dVAR; + PERL_ARGS_ASSERT_DUMP_VINDENT; + PerlIO_printf(file, "%*s", (int)(level*PL_dumpindent), ""); + PerlIO_vprintf(file, pat, *args); +} + +/* +=for apidoc dump_all + +Dumps the entire optree of the current program starting at C to +C. Also dumps the optrees for all visible subroutines in +C. + +=cut +*/ + +void +Perl_dump_all(pTHX) +{ + dump_all_perl(FALSE); +} + +void +Perl_dump_all_perl(pTHX_ bool justperl) +{ + + dVAR; + PerlIO_setlinebuf(Perl_debug_log); + if (PL_main_root) + op_dump(PL_main_root); + dump_packsubs_perl(PL_defstash, justperl); +} + +/* +=for apidoc dump_packsubs + +Dumps the optrees for all visible subroutines in C. + +=cut +*/ + +void +Perl_dump_packsubs(pTHX_ const HV *stash) +{ + PERL_ARGS_ASSERT_DUMP_PACKSUBS; + dump_packsubs_perl(stash, FALSE); +} + +void +Perl_dump_packsubs_perl(pTHX_ const HV *stash, bool justperl) +{ + dVAR; + I32 i; + + PERL_ARGS_ASSERT_DUMP_PACKSUBS_PERL; + + if (!HvARRAY(stash)) + return; + for (i = 0; i <= (I32) HvMAX(stash); i++) { + const HE *entry; + for (entry = HvARRAY(stash)[i]; entry; entry = HeNEXT(entry)) { + const GV * const gv = (const GV *)HeVAL(entry); + if (SvTYPE(gv) != SVt_PVGV || !GvGP(gv)) + continue; + if (GvCVu(gv)) + dump_sub_perl(gv, justperl); + if (GvFORM(gv)) + dump_form(gv); + if (HeKEY(entry)[HeKLEN(entry)-1] == ':') { + const HV * const hv = GvHV(gv); + if (hv && (hv != PL_defstash)) + dump_packsubs_perl(hv, justperl); /* nested package */ + } + } + } +} + +void +Perl_dump_sub(pTHX_ const GV *gv) +{ + PERL_ARGS_ASSERT_DUMP_SUB; + dump_sub_perl(gv, FALSE); +} + +void +Perl_dump_sub_perl(pTHX_ const GV *gv, bool justperl) +{ + STRLEN len; + SV * const sv = newSVpvs_flags("", SVs_TEMP); + SV *tmpsv; + const char * name; + + PERL_ARGS_ASSERT_DUMP_SUB_PERL; + + if (justperl && (CvISXSUB(GvCV(gv)) || !CvROOT(GvCV(gv)))) + return; + + tmpsv = newSVpvs_flags("", SVs_TEMP); + gv_fullname3(sv, gv, NULL); + name = SvPV_const(sv, len); + Perl_dump_indent(aTHX_ 0, Perl_debug_log, "\nSUB %s = ", + generic_pv_escape(tmpsv, name, len, SvUTF8(sv))); + if (CvISXSUB(GvCV(gv))) + Perl_dump_indent(aTHX_ 0, Perl_debug_log, "(xsub 0x%"UVxf" %d)\n", + PTR2UV(CvXSUB(GvCV(gv))), + (int)CvXSUBANY(GvCV(gv)).any_i32); + else if (CvROOT(GvCV(gv))) + op_dump(CvROOT(GvCV(gv))); + else + Perl_dump_indent(aTHX_ 0, Perl_debug_log, "\n"); +} + +void +Perl_dump_form(pTHX_ const GV *gv) +{ + SV * const sv = sv_newmortal(); + + PERL_ARGS_ASSERT_DUMP_FORM; + + gv_fullname3(sv, gv, NULL); + Perl_dump_indent(aTHX_ 0, Perl_debug_log, "\nFORMAT %s = ", SvPVX_const(sv)); + if (CvROOT(GvFORM(gv))) + op_dump(CvROOT(GvFORM(gv))); + else + Perl_dump_indent(aTHX_ 0, Perl_debug_log, "\n"); +} + +void +Perl_dump_eval(pTHX) +{ + dVAR; + op_dump(PL_eval_root); +} + void Perl_do_pmop_dump(pTHX_ I32 level, PerlIO *file, const PMOP *pm) { @@ -667,7 +708,7 @@ S_pm_description(pTHX_ const PMOP *pm) if (RX_ISTAINTED(regex)) sv_catpv(desc, ",TAINTED"); if (RX_CHECK_SUBSTR(regex)) { - if (!(RX_EXTFLAGS(regex) & RXf_NOSCAN)) + if (!(RX_INTFLAGS(regex) & PREGf_NOSCAN)) sv_catpv(desc, ",SCANFIRST"); if (RX_EXTFLAGS(regex) & RXf_CHECK_ALL) sv_catpv(desc, ",ALL"); @@ -745,7 +786,6 @@ const struct flag_to_name op_const_names {OPpCONST_SHORTCIRCUIT, ",SHORTCIRCUIT"}, {OPpCONST_STRICT, ",STRICT"}, {OPpCONST_ENTERED, ",ENTERED"}, - {OPpCONST_FOLDED, ",FOLDED"}, {OPpCONST_BARE, ",BARE"} }; @@ -766,16 +806,16 @@ const struct flag_to_name op_open_names[ {OPpOPEN_OUT_CRLF, ",OUT_CRLF"} }; -const struct flag_to_name op_exit_names[] = { - {OPpEXIT_VMSISH, ",EXIT_VMSISH"}, - {OPpHUSH_VMSISH, ",HUSH_VMSISH"} -}; - const struct flag_to_name op_sassign_names[] = { {OPpASSIGN_BACKWARDS, ",BACKWARDS"}, {OPpASSIGN_CV_TO_GV, ",CV2GV"} }; +const struct flag_to_name op_leave_names[] = { + {OPpREFCOUNTED, ",REFCOUNTED"}, + {OPpLVALUE, ",LVALUE"} +}; + #define OP_PRIVATE_ONCE(op, flag, name) \ const struct flag_to_name CAT2(op, _names)[] = { \ {(flag), (name)} \ @@ -791,6 +831,8 @@ OP_PRIVATE_ONCE(op_list, OPpLIST_GUESSED OP_PRIVATE_ONCE(op_delete, OPpSLICE, ",SLICE"); OP_PRIVATE_ONCE(op_exists, OPpEXISTS_SUB, ",EXISTS_SUB"); OP_PRIVATE_ONCE(op_die, OPpHUSH_VMSISH, ",HUSH_VMSISH"); +OP_PRIVATE_ONCE(op_split, OPpSPLIT_IMPLIM, ",IMPLIM"); +OP_PRIVATE_ONCE(op_dbstate, OPpHUSH_VMSISH, ",HUSH_VMSISH"); struct op_private_by_op { U16 op_type; @@ -800,13 +842,12 @@ struct op_private_by_op { const struct op_private_by_op op_private_names[] = { {OP_LEAVESUB, C_ARRAY_LENGTH(op_leavesub_names), op_leavesub_names }, - {OP_LEAVE, C_ARRAY_LENGTH(op_leavesub_names), op_leavesub_names }, + {OP_LEAVE, C_ARRAY_LENGTH(op_leave_names), op_leave_names }, {OP_LEAVESUBLV, C_ARRAY_LENGTH(op_leavesub_names), op_leavesub_names }, {OP_LEAVEWRITE, C_ARRAY_LENGTH(op_leavesub_names), op_leavesub_names }, {OP_DIE, C_ARRAY_LENGTH(op_die_names), op_die_names }, {OP_DELETE, C_ARRAY_LENGTH(op_delete_names), op_delete_names }, {OP_EXISTS, C_ARRAY_LENGTH(op_exists_names), op_exists_names }, - {OP_EXIT, C_ARRAY_LENGTH(op_exit_names), op_exit_names }, {OP_FLIP, C_ARRAY_LENGTH(op_flip_names), op_flip_names }, {OP_FLOP, C_ARRAY_LENGTH(op_flip_names), op_flip_names }, {OP_GV, C_ARRAY_LENGTH(op_gv_names), op_gv_names }, @@ -818,14 +859,16 @@ const struct op_private_by_op op_private {OP_CONST, C_ARRAY_LENGTH(op_const_names), op_const_names }, {OP_SORT, C_ARRAY_LENGTH(op_sort_names), op_sort_names }, {OP_OPEN, C_ARRAY_LENGTH(op_open_names), op_open_names }, + {OP_SPLIT, C_ARRAY_LENGTH(op_split_names), op_split_names }, + {OP_DBSTATE, C_ARRAY_LENGTH(op_dbstate_names), op_dbstate_names }, + {OP_NEXTSTATE, C_ARRAY_LENGTH(op_dbstate_names), op_dbstate_names }, {OP_BACKTICK, C_ARRAY_LENGTH(op_open_names), op_open_names } }; static bool S_op_private_to_names(pTHX_ SV *tmpsv, U32 optype, U32 op_private) { const struct op_private_by_op *start = op_private_names; - const struct op_private_by_op *const end - = op_private_names + C_ARRAY_LENGTH(op_private_names); + const struct op_private_by_op *const end = C_ARRAY_END(op_private_names); /* This is a linear search, but no worse than the code that it replaced. It's debugging code - size is more important than speed. */ @@ -860,13 +903,13 @@ S_op_private_to_names(pTHX_ SV *tmpsv, U if (o->op_slabbed) sv_catpvs(tmpsv, ",SLABBED"); \ if (o->op_savefree) sv_catpvs(tmpsv, ",SAVEFREE"); \ if (o->op_static) sv_catpvs(tmpsv, ",STATIC"); \ + if (o->op_folded) sv_catpvs(tmpsv, ",FOLDED"); \ if (!xml) \ Perl_dump_indent(aTHX_ level, file, "FLAGS = (%s)\n", \ SvCUR(tmpsv) ? SvPVX_const(tmpsv) + 1 : "");\ else \ PerlIO_printf(file, " flags=\"%s\"", \ SvCUR(tmpsv) ? SvPVX(tmpsv) + 1 : ""); \ - SvREFCNT_dec_NN(tmpsv); \ } #if !defined(PERL_MAD) @@ -952,6 +995,11 @@ S_op_private_to_names(pTHX_ SV *tmpsv, U if (o->op_type == OP_PADRANGE) \ Perl_sv_catpvf(aTHX_ tmpsv, ",COUNT=%"UVuf, \ (UV)(oppriv & OPpPADRANGE_COUNTMASK)); \ + if ( (o->op_type == OP_RV2HV || o->op_type == OP_RV2AV || \ + o->op_type == OP_PADAV || o->op_type == OP_PADHV || \ + o->op_type == OP_ASLICE || o->op_type == OP_HSLICE) \ + && oppriv & OPpSLICEWARNING ) \ + sv_catpvs(tmpsv, ",SLICEWARNING"); \ if (SvCUR(tmpsv)) { \ if (xml) \ xmldump_attr1(level+1, file, "private=\"%s\"", SvPVX(tmpsv)+1); \ @@ -960,7 +1008,6 @@ S_op_private_to_names(pTHX_ SV *tmpsv, U } else if (!xml) \ Perl_dump_indent(aTHX_ level, file, "PRIVATE = (0x%"UVxf")\n", \ (UV)oppriv); \ - SvREFCNT_dec_NN(tmpsv); \ } @@ -996,12 +1043,25 @@ Perl_do_op_dump(pTHX_ I32 level, PerlIO if (CopLINE(cCOPo)) Perl_dump_indent(aTHX_ level, file, "LINE = %"UVuf"\n", (UV)CopLINE(cCOPo)); - if (CopSTASHPV(cCOPo)) + if (CopSTASHPV(cCOPo)) { + SV* tmpsv = newSVpvs_flags("", SVs_TEMP); + HV *stash = CopSTASH(cCOPo); + const char * const hvname = HvNAME_get(stash); + Perl_dump_indent(aTHX_ level, file, "PACKAGE = \"%s\"\n", - CopSTASHPV(cCOPo)); - if (CopLABEL(cCOPo)) + generic_pv_escape( tmpsv, hvname, HvNAMELEN(stash), HvNAMEUTF8(stash))); + } + if (CopLABEL(cCOPo)) { + SV* tmpsv = newSVpvs_flags("", SVs_TEMP); + STRLEN label_len; + U32 label_flags; + const char *label = CopLABEL_len_flags(cCOPo, + &label_len, + &label_flags); Perl_dump_indent(aTHX_ level, file, "LABEL = \"%s\"\n", - CopLABEL(cCOPo)); + generic_pv_escape( tmpsv, label, label_len,(label_flags & SVf_UTF8))); + } + } } else @@ -1052,8 +1112,6 @@ Perl_do_op_dump(pTHX_ I32 level, PerlIO } level--; Perl_dump_indent(aTHX_ level, file, "}\n"); - - SvREFCNT_dec_NN(tmpsv); } #endif @@ -1066,18 +1124,19 @@ Perl_do_op_dump(pTHX_ I32 level, PerlIO #else if ( ! (o->op_flags & OPf_SPECIAL)) { /* not lexical */ if (cSVOPo->op_sv) { - SV * const tmpsv = newSV(0); - ENTER; - SAVEFREESV(tmpsv); + STRLEN len; + const char * name; + SV * const tmpsv = newSVpvs_flags("", SVs_TEMP); + SV * const tmpsv2 = newSVpvs_flags("", SVs_TEMP); #ifdef PERL_MAD /* FIXME - is this making unwarranted assumptions about the UTF-8 cleanliness of the dump file handle? */ SvUTF8_on(tmpsv); #endif gv_fullname3(tmpsv, MUTABLE_GV(cSVOPo->op_sv), NULL); + name = SvPV_const(tmpsv, len); Perl_dump_indent(aTHX_ level, file, "GV = %s\n", - SvPV_nolen_const(tmpsv)); - LEAVE; + generic_pv_escape( tmpsv2, name, len, SvUTF8(tmpsv))); } else Perl_dump_indent(aTHX_ level, file, "GV = NULL\n"); @@ -1098,12 +1157,25 @@ Perl_do_op_dump(pTHX_ I32 level, PerlIO if (CopLINE(cCOPo)) Perl_dump_indent(aTHX_ level, file, "LINE = %"UVuf"\n", (UV)CopLINE(cCOPo)); - if (CopSTASHPV(cCOPo)) + if (CopSTASHPV(cCOPo)) { + SV* tmpsv = newSVpvs_flags("", SVs_TEMP); + HV *stash = CopSTASH(cCOPo); + const char * const hvname = HvNAME_get(stash); + Perl_dump_indent(aTHX_ level, file, "PACKAGE = \"%s\"\n", - CopSTASHPV(cCOPo)); - if (CopLABEL(cCOPo)) - Perl_dump_indent(aTHX_ level, file, "LABEL = \"%s\"\n", - CopLABEL(cCOPo)); + generic_pv_escape(tmpsv, hvname, + HvNAMELEN(stash), HvNAMEUTF8(stash))); + } + if (CopLABEL(cCOPo)) { + SV* tmpsv = newSVpvs_flags("", SVs_TEMP); + STRLEN label_len; + U32 label_flags; + const char *label = CopLABEL_len_flags(cCOPo, + &label_len, &label_flags); + Perl_dump_indent(aTHX_ level, file, "LABEL = \"%s\"\n", + generic_pv_escape( tmpsv, label, label_len, + (label_flags & SVf_UTF8))); + } break; case OP_ENTERLOOP: Perl_dump_indent(aTHX_ level, file, "REDO ===> "); @@ -1160,6 +1232,14 @@ Perl_do_op_dump(pTHX_ I32 level, PerlIO Perl_dump_indent(aTHX_ level-1, file, "}\n"); } +/* +=for apidoc op_dump + +Dumps the optree starting at OP C to C. + +=cut +*/ + void Perl_op_dump(pTHX_ const OP *o) { @@ -1170,7 +1250,10 @@ Perl_op_dump(pTHX_ const OP *o) void Perl_gv_dump(pTHX_ GV *gv) { - SV *sv; + STRLEN len; + const char* name; + SV *sv, *tmp = newSVpvs_flags("", SVs_TEMP); + PERL_ARGS_ASSERT_GV_DUMP; @@ -1181,10 +1264,14 @@ Perl_gv_dump(pTHX_ GV *gv) sv = sv_newmortal(); PerlIO_printf(Perl_debug_log, "{\n"); gv_fullname3(sv, gv, NULL); - Perl_dump_indent(aTHX_ 1, Perl_debug_log, "GV_NAME = %s", SvPVX_const(sv)); + name = SvPV_const(sv, len); + Perl_dump_indent(aTHX_ 1, Perl_debug_log, "GV_NAME = %s", + generic_pv_escape( tmp, name, len, SvUTF8(sv) )); if (gv != GvEGV(gv)) { gv_efullname3(sv, GvEGV(gv), NULL); - Perl_dump_indent(aTHX_ 1, Perl_debug_log, "-> %s", SvPVX_const(sv)); + name = SvPV_const(sv, len); + Perl_dump_indent(aTHX_ 1, Perl_debug_log, "-> %s", + generic_pv_escape( tmp, name, len, SvUTF8(sv) )); } PerlIO_putc(Perl_debug_log, '\n'); Perl_dump_indent(aTHX_ 0, Perl_debug_log, "}\n"); @@ -1260,6 +1347,9 @@ Perl_do_magic_dump(pTHX_ I32 level, Perl Perl_dump_indent(aTHX_ level, file, " DUP\n"); if (mg->mg_flags & MGf_LOCAL) Perl_dump_indent(aTHX_ level, file, " LOCAL\n"); + if (mg->mg_type == PERL_MAGIC_regex_global && + mg->mg_flags & MGf_BYTES) + Perl_dump_indent(aTHX_ level, file, " BYTES\n"); } if (mg->mg_obj) { Perl_dump_indent(aTHX_ level, file, " MG_OBJ = 0x%"UVxf"\n", @@ -1341,8 +1431,10 @@ Perl_do_hv_dump(pTHX_ I32 level, PerlIO name which quite legally could contain insane things like tabs, newlines, nulls or other scary crap - this should produce sane results - except maybe for unicode package names - but we will wait for someone to file a bug on that - demerphq */ - SV * const tmpsv = newSVpvs(""); - PerlIO_printf(file, "\t%s\n", pv_display(tmpsv, hvname, HvNAMELEN_get(sv), 0, 1024)); + SV * const tmpsv = newSVpvs_flags("", SVs_TEMP); + PerlIO_printf(file, "\t\"%s\"\n", + generic_pv_escape( tmpsv, hvname, + HvNAMELEN(sv), HvNAMEUTF8(sv))); } else PerlIO_putc(file, '\n'); @@ -1354,8 +1446,11 @@ Perl_do_gv_dump(pTHX_ I32 level, PerlIO PERL_ARGS_ASSERT_DO_GV_DUMP; Perl_dump_indent(aTHX_ level, file, "%s = 0x%"UVxf, name, PTR2UV(sv)); - if (sv && GvNAME(sv)) - PerlIO_printf(file, "\t\"%s\"\n", GvNAME(sv)); + if (sv && GvNAME(sv)) { + SV * const tmpsv = newSVpvs(""); + PerlIO_printf(file, "\t\"%s\"\n", + generic_pv_escape( tmpsv, GvNAME(sv), GvNAMELEN(sv), GvNAMEUTF8(sv) )); + } else PerlIO_putc(file, '\n'); } @@ -1367,11 +1462,18 @@ Perl_do_gvgv_dump(pTHX_ I32 level, PerlI Perl_dump_indent(aTHX_ level, file, "%s = 0x%"UVxf, name, PTR2UV(sv)); if (sv && GvNAME(sv)) { + SV *tmp = newSVpvs_flags("", SVs_TEMP); const char *hvname; - PerlIO_printf(file, "\t\""); - if (GvSTASH(sv) && (hvname = HvNAME_get(GvSTASH(sv)))) - PerlIO_printf(file, "%s\" :: \"", hvname); - PerlIO_printf(file, "%s\"\n", GvNAME(sv)); + HV * const stash = GvSTASH(sv); + PerlIO_printf(file, "\t"); + /* TODO might have an extra \" here */ + if (stash && (hvname = HvNAME_get(stash))) { + PerlIO_printf(file, "\"%s\" :: \"", + generic_pv_escape(tmp, hvname, + HvNAMELEN(stash), HvNAMEUTF8(stash))); + } + PerlIO_printf(file, "%s\"\n", + generic_pv_escape( tmp, GvNAME(sv), GvNAMELEN(sv), GvNAMEUTF8(sv))); } else PerlIO_putc(file, '\n'); @@ -1439,22 +1541,18 @@ const struct flag_to_name gp_flags_impor {GVf_IMPORTED_CV, " CV"}, }; -const struct flag_to_name regexp_flags_names[] = { +/* NOTE: this structure is mostly duplicative of one generated by + * 'make regen' in regnodes.h - perhaps we should somehow integrate + * the two. - Yves */ +const struct flag_to_name regexp_extflags_names[] = { {RXf_PMf_MULTILINE, "PMf_MULTILINE,"}, {RXf_PMf_SINGLELINE, "PMf_SINGLELINE,"}, {RXf_PMf_FOLD, "PMf_FOLD,"}, {RXf_PMf_EXTENDED, "PMf_EXTENDED,"}, {RXf_PMf_KEEPCOPY, "PMf_KEEPCOPY,"}, - {RXf_ANCH_BOL, "ANCH_BOL,"}, - {RXf_ANCH_MBOL, "ANCH_MBOL,"}, - {RXf_ANCH_SBOL, "ANCH_SBOL,"}, - {RXf_ANCH_GPOS, "ANCH_GPOS,"}, - {RXf_GPOS_SEEN, "GPOS_SEEN,"}, - {RXf_GPOS_FLOAT, "GPOS_FLOAT,"}, + {RXf_IS_ANCHORED, "IS_ANCHORED,"}, {RXf_NO_INPLACE_SUBST, "NO_INPLACE_SUBST,"}, {RXf_EVAL_SEEN, "EVAL_SEEN,"}, - {RXf_CANY_SEEN, "CANY_SEEN,"}, - {RXf_NOSCAN, "NOSCAN,"}, {RXf_CHECK_ALL, "CHECK_ALL,"}, {RXf_MATCH_UTF8, "MATCH_UTF8,"}, {RXf_USE_INTUIT_NOML, "USE_INTUIT_NOML,"}, @@ -1470,6 +1568,26 @@ const struct flag_to_name regexp_flags_n {RXf_NULL, "NULL,"}, }; +/* NOTE: this structure is mostly duplicative of one generated by + * 'make regen' in regnodes.h - perhaps we should somehow integrate + * the two. - Yves */ +const struct flag_to_name regexp_core_intflags_names[] = { + {PREGf_SKIP, "SKIP,"}, + {PREGf_IMPLICIT, "IMPLICIT,"}, + {PREGf_NAUGHTY, "NAUGHTY,"}, + {PREGf_VERBARG_SEEN, "VERBARG_SEEN,"}, + {PREGf_CUTGROUP_SEEN, "CUTGROUP_SEEN,"}, + {PREGf_USE_RE_EVAL, "USE_RE_EVAL,"}, + {PREGf_NOSCAN, "NOSCAN,"}, + {PREGf_CANY_SEEN, "CANY_SEEN,"}, + {PREGf_GPOS_SEEN, "GPOS_SEEN,"}, + {PREGf_GPOS_FLOAT, "GPOS_FLOAT,"}, + {PREGf_ANCH_BOL, "ANCH_BOL,"}, + {PREGf_ANCH_MBOL, "ANCH_MBOL,"}, + {PREGf_ANCH_SBOL, "ANCH_SBOL,"}, + {PREGf_ANCH_GPOS, "ANCH_GPOS,"}, +}; + void Perl_do_sv_dump(pTHX_ I32 level, PerlIO *file, SV *sv, I32 nest, I32 maxnest, bool dumpops, STRLEN pvlim) { @@ -1513,7 +1631,8 @@ Perl_do_sv_dump(pTHX_ I32 level, PerlIO if (SvWEAKREF(sv)) sv_catpv(d, "WEAKREF,"); } append_flags(d, flags, second_sv_flags_names); - if (flags & SVp_SCREAM && type != SVt_PVHV && !isGV_with_GP(sv)) { + if (flags & SVp_SCREAM && type != SVt_PVHV && !isGV_with_GP(sv) + && type != SVt_PVAV) { if (SvPCS_IMPORTED(sv)) sv_catpv(d, "PCS_IMPORTED,"); else @@ -1561,6 +1680,7 @@ Perl_do_sv_dump(pTHX_ I32 level, PerlIO if (SvPAD_STATE(sv)) sv_catpv(d, "STATE,"); goto evaled_or_uv; case SVt_PVAV: + if (AvPAD_NAMELIST(sv)) sv_catpvs(d, "NAMELIST,"); break; } /* SVphv_SHAREKEYS is also 0x20000000 */ @@ -1658,7 +1778,8 @@ Perl_do_sv_dump(pTHX_ I32 level, PerlIO return; } - if (type <= SVt_PVLV && !isGV_with_GP(sv)) { + if ((type <= SVt_PVLV && !isGV_with_GP(sv)) + || (type == SVt_PVIO && IoFLAGS(sv) & IOf_FAKE_DIRP)) { const bool re = isREGEXP(sv); const char * const ptr = re ? RX_WRAPPED((REGEXP*)sv) : SvPVX_const(sv); @@ -1677,12 +1798,21 @@ Perl_do_sv_dump(pTHX_ I32 level, PerlIO pv_display(d, ptr - delta, delta, 0, pvlim)); } - PerlIO_printf(file, "%s", pv_display(d, ptr, SvCUR(sv), - re ? 0 : SvLEN(sv), - pvlim)); - if (SvUTF8(sv)) /* the 6? \x{....} */ - PerlIO_printf(file, " [UTF8 \"%s\"]", sv_uni_display(d, sv, 6 * SvCUR(sv), UNI_DISPLAY_QQ)); - PerlIO_printf(file, "\n"); + if (type == SVt_INVLIST) { + PerlIO_printf(file, "\n"); + /* 4 blanks indents 2 beyond the PV, etc */ + _invlist_dump(file, level, " ", sv); + } + else { + PerlIO_printf(file, "%s", pv_display(d, ptr, SvCUR(sv), + re ? 0 : SvLEN(sv), + pvlim)); + if (SvUTF8(sv)) /* the 6? \x{....} */ + PerlIO_printf(file, " [UTF8 \"%s\"]", + sv_uni_display(d, sv, 6 * SvCUR(sv), + UNI_DISPLAY_QQ)); + PerlIO_printf(file, "\n"); + } Perl_dump_indent(aTHX_ level, file, " CUR = %"IVdf"\n", (IV)SvCUR(sv)); if (!re) Perl_dump_indent(aTHX_ level, file, " LEN = %"IVdf"\n", @@ -1702,6 +1832,9 @@ Perl_do_sv_dump(pTHX_ I32 level, PerlIO HV * const ost = SvOURSTASH(sv); if (ost) do_hv_dump(level, file, " OURSTASH", ost); + } else if (SvTYPE(sv) == SVt_PVAV && AvPAD_NAMELIST(sv)) { + Perl_dump_indent(aTHX_ level, file, " MAXNAMED = %"UVuf"\n", + (UV)PadnamelistMAXNAMED(sv)); } else { if (SvMAGIC(sv)) do_magic_dump(level, file, SvMAGIC(sv), nest+1, maxnest, dumpops, pvlim); @@ -1710,8 +1843,6 @@ Perl_do_sv_dump(pTHX_ I32 level, PerlIO do_hv_dump(level, file, " STASH", SvSTASH(sv)); if ((type == SVt_PVMG || type == SVt_PVLV) && SvVALID(sv)) { - Perl_dump_indent(aTHX_ level, file, " RARE = %u\n", (U8)BmRARE(sv)); - Perl_dump_indent(aTHX_ level, file, " PREVIOUS = %"UVuf"\n", (UV)BmPREVIOUS(sv)); Perl_dump_indent(aTHX_ level, file, " USEFUL = %"IVdf"\n", (IV)BmUSEFUL(sv)); } } @@ -1729,15 +1860,19 @@ Perl_do_sv_dump(pTHX_ I32 level, PerlIO PerlIO_putc(file, '\n'); Perl_dump_indent(aTHX_ level, file, " FILL = %"IVdf"\n", (IV)AvFILLp(sv)); Perl_dump_indent(aTHX_ level, file, " MAX = %"IVdf"\n", (IV)AvMAX(sv)); - Perl_dump_indent(aTHX_ level, file, " ARYLEN = 0x%"UVxf"\n", SvMAGIC(sv) ? PTR2UV(AvARYLEN(sv)) : 0); + /* arylen is stored in magic, and padnamelists use SvMAGIC for + something else. */ + if (!AvPAD_NAMELIST(sv)) + Perl_dump_indent(aTHX_ level, file, " ARYLEN = 0x%"UVxf"\n", + SvMAGIC(sv) ? PTR2UV(AvARYLEN(sv)) : 0); sv_setpvs(d, ""); if (AvREAL(sv)) sv_catpv(d, ",REAL"); if (AvREIFY(sv)) sv_catpv(d, ",REIFY"); Perl_dump_indent(aTHX_ level, file, " FLAGS = (%s)\n", SvCUR(d) ? SvPVX_const(d) + 1 : ""); - if (nest < maxnest && av_len(MUTABLE_AV(sv)) >= 0) { - int count; - for (count = 0; count <= av_len(MUTABLE_AV(sv)) && count < maxnest; count++) { + if (nest < maxnest && av_tindex(MUTABLE_AV(sv)) >= 0) { + SSize_t count; + for (count = 0; count <= av_tindex(MUTABLE_AV(sv)) && count < maxnest; count++) { SV** const elt = av_fetch(MUTABLE_AV(sv),count,0); Perl_dump_indent(aTHX_ level + 1, file, "Elt No. %"IVdf"\n", (IV)count); @@ -1746,15 +1881,22 @@ Perl_do_sv_dump(pTHX_ I32 level, PerlIO } } break; - case SVt_PVHV: + case SVt_PVHV: { + U32 usedkeys; + if (SvOOK(sv)) { + struct xpvhv_aux *const aux = HvAUX(sv); + Perl_dump_indent(aTHX_ level, file, " AUX_FLAGS = %"UVuf"\n", + (UV)aux->xhv_aux_flags); + } Perl_dump_indent(aTHX_ level, file, " ARRAY = 0x%"UVxf, PTR2UV(HvARRAY(sv))); - if (HvARRAY(sv) && HvUSEDKEYS(sv)) { + usedkeys = HvUSEDKEYS(sv); + if (HvARRAY(sv) && usedkeys) { /* Show distribution of HEs in the ARRAY */ int freq[200]; -#define FREQ_MAX ((int)(sizeof freq / sizeof freq[0] - 1)) +#define FREQ_MAX ((int)(C_ARRAY_LENGTH(freq) - 1)) int i; int max = 0; - U32 pow2 = 2, keys = HvUSEDKEYS(sv); + U32 pow2 = 2, keys = usedkeys; NV theoret, sum = 0; PerlIO_printf(file, " ("); @@ -1796,14 +1938,37 @@ Perl_do_sv_dump(pTHX_ I32 level, PerlIO } while ((keys = keys >> 1)) pow2 = pow2 << 1; - theoret = HvUSEDKEYS(sv); + theoret = usedkeys; theoret += theoret * (theoret-1)/pow2; PerlIO_putc(file, '\n'); Perl_dump_indent(aTHX_ level, file, " hash quality = %.1"NVff"%%", theoret/sum*100); } PerlIO_putc(file, '\n'); - Perl_dump_indent(aTHX_ level, file, " KEYS = %"IVdf"\n", (IV)HvUSEDKEYS(sv)); - Perl_dump_indent(aTHX_ level, file, " FILL = %"IVdf"\n", (IV)HvFILL(sv)); + Perl_dump_indent(aTHX_ level, file, " KEYS = %"IVdf"\n", (IV)usedkeys); + { + STRLEN count = 0; + HE **ents = HvARRAY(sv); + + if (ents) { + HE *const *const last = ents + HvMAX(sv); + count = last + 1 - ents; + + do { + if (!*ents) + --count; + } while (++ents <= last); + } + + if (SvOOK(sv)) { + struct xpvhv_aux *const aux = HvAUX(sv); + Perl_dump_indent(aTHX_ level, file, " FILL = %"UVuf + " (cached = %"UVuf")\n", + (UV)count, (UV)aux->xhv_fill_lazy); + } else { + Perl_dump_indent(aTHX_ level, file, " FILL = %"UVuf"\n", + (UV)count); + } + } Perl_dump_indent(aTHX_ level, file, " MAX = %"IVdf"\n", (IV)HvMAX(sv)); if (SvOOK(sv)) { Perl_dump_indent(aTHX_ level, file, " RITER = %"IVdf"\n", (IV)HvRITER_get(sv)); @@ -1824,8 +1989,12 @@ Perl_do_sv_dump(pTHX_ I32 level, PerlIO } { const char * const hvname = HvNAME_get(sv); - if (hvname) - Perl_dump_indent(aTHX_ level, file, " NAME = \"%s\"\n", hvname); + if (hvname) { + SV* tmpsv = newSVpvs_flags("", SVs_TEMP); + Perl_dump_indent(aTHX_ level, file, " NAME = \"%s\"\n", + generic_pv_escape( tmpsv, hvname, + HvNAMELEN(sv), HvNAMEUTF8(sv))); + } } if (SvOOK(sv)) { AV * const backrefs @@ -1847,10 +2016,10 @@ Perl_do_sv_dump(pTHX_ I32 level, PerlIO HEK *const *const endp = HvAUX(sv)->xhv_name_u.xhvnameu_names + (count < 0 ? -count : count); while (hekp < endp) { - if (*hekp) { - sv_catpvs(names, ", \""); - sv_catpvn(names, HEK_KEY(*hekp), HEK_LEN(*hekp)); - sv_catpvs(names, "\""); + if (HEK_LEN(*hekp)) { + SV *tmp = newSVpvs_flags("", SVs_TEMP); + Perl_sv_catpvf(aTHX_ names, ", \"%s\"", + generic_pv_escape(tmp, HEK_KEY(*hekp), HEK_LEN(*hekp), HEK_UTF8(*hekp))); } else { /* This should never happen. */ sv_catpvs(names, ", (null)"); @@ -1861,10 +2030,14 @@ Perl_do_sv_dump(pTHX_ I32 level, PerlIO level, file, " ENAME = %s\n", SvPV_nolen(names)+2 ); } - else + else { + SV * const tmp = newSVpvs_flags("", SVs_TEMP); + const char *const hvename = HvENAME_get(sv); Perl_dump_indent(aTHX_ - level, file, " ENAME = \"%s\"\n", HvENAME_get(sv) - ); + level, file, " ENAME = \"%s\"\n", + generic_pv_escape(tmp, hvename, + HvENAMELEN_get(sv), HvENAMEUTF8(sv))); + } } if (backrefs) { Perl_dump_indent(aTHX_ level, file, " BACKREFS = 0x%"UVxf"\n", @@ -1873,10 +2046,11 @@ Perl_do_sv_dump(pTHX_ I32 level, PerlIO dumpops, pvlim); } if (meta) { - /* FIXME - mro_algs kflags can signal a UTF-8 name. */ - Perl_dump_indent(aTHX_ level, file, " MRO_WHICH = \"%.*s\" (0x%"UVxf")\n", - (int)meta->mro_which->length, - meta->mro_which->name, + SV* tmpsv = newSVpvs_flags("", SVs_TEMP); + Perl_dump_indent(aTHX_ level, file, " MRO_WHICH = \"%s\" (0x%"UVxf")\n", + generic_pv_escape( tmpsv, meta->mro_which->name, + meta->mro_which->length, + (meta->mro_which->kflags & HVhek_UTF8)), PTR2UV(meta->mro_which)); Perl_dump_indent(aTHX_ level, file, " CACHE_GEN = 0x%"UVxf"\n", (UV)meta->cache_gen); @@ -1943,17 +2117,22 @@ Perl_do_sv_dump(pTHX_ I32 level, PerlIO } } break; + } /* case SVt_PVHV */ case SVt_PVCV: if (CvAUTOLOAD(sv)) { - STRLEN len; + SV* tmpsv = newSVpvs_flags("", SVs_TEMP); + STRLEN len; const char *const name = SvPV_const(sv, len); - Perl_dump_indent(aTHX_ level, file, " AUTOLOAD = \"%.*s\"\n", - (int) len, name); + Perl_dump_indent(aTHX_ level, file, " AUTOLOAD = \"%s\"\n", + generic_pv_escape(tmpsv, name, len, SvUTF8(sv))); } if (SvPOK(sv)) { - Perl_dump_indent(aTHX_ level, file, " PROTOTYPE = \"%.*s\"\n", - (int) CvPROTOLEN(sv), CvPROTO(sv)); + SV* tmpsv = newSVpvs_flags("", SVs_TEMP); + const char *const proto = CvPROTO(sv); + Perl_dump_indent(aTHX_ level, file, " PROTOTYPE = \"%s\"\n", + generic_pv_escape(tmpsv, proto, CvPROTOLEN(sv), + SvUTF8(sv))); } /* FALL THROUGH */ case SVt_PVFM: @@ -2006,7 +2185,13 @@ Perl_do_sv_dump(pTHX_ I32 level, PerlIO : CvANON(outside) ? "ANON" : (outside == PL_main_cv) ? "MAIN" : CvUNIQUE(outside) ? "UNIQUE" - : CvGV(outside) ? GvNAME(CvGV(outside)) : "UNDEFINED")); + : CvGV(outside) ? + generic_pv_escape( + newSVpvs_flags("", SVs_TEMP), + GvNAME(CvGV(outside)), + GvNAMELEN(CvGV(outside)), + GvNAMEUTF8(CvGV(outside))) + : "UNDEFINED")); } if (nest < maxnest && (CvCLONE(sv) || CvCLONED(sv))) do_sv_dump(level+1, file, MUTABLE_SV(CvOUTSIDE(sv)), nest+1, maxnest, dumpops, pvlim); @@ -2027,7 +2212,13 @@ Perl_do_sv_dump(pTHX_ I32 level, PerlIO if (isREGEXP(sv)) goto dumpregexp; if (!isGV_with_GP(sv)) break; - Perl_dump_indent(aTHX_ level, file, " NAME = \"%s\"\n", GvNAME(sv)); + { + SV* tmpsv = newSVpvs_flags("", SVs_TEMP); + Perl_dump_indent(aTHX_ level, file, " NAME = \"%s\"\n", + generic_pv_escape(tmpsv, GvNAME(sv), + GvNAMELEN(sv), + GvNAMEUTF8(sv))); + } Perl_dump_indent(aTHX_ level, file, " NAMELEN = %"IVdf"\n", (IV)GvNAMELEN(sv)); do_hv_dump (level, file, " GvSTASH", GvSTASH(sv)); Perl_dump_indent(aTHX_ level, file, " GP = 0x%"UVxf"\n", PTR2UV(GvGP(sv))); @@ -2096,25 +2287,34 @@ Perl_do_sv_dump(pTHX_ I32 level, PerlIO dumpregexp: { struct regexp * const r = ReANY((REGEXP*)sv); -#define SV_SET_STRINGIFY_REGEXP_FLAGS(d,flags) STMT_START { \ + +#define SV_SET_STRINGIFY_REGEXP_FLAGS(d,flags,names) STMT_START { \ sv_setpv(d,""); \ - append_flags(d, flags, regexp_flags_names); \ + append_flags(d, flags, names); \ if (SvCUR(d) > 0 && *(SvEND(d) - 1) == ',') { \ SvCUR_set(d, SvCUR(d) - 1); \ SvPVX(d)[SvCUR(d)] = '\0'; \ } \ } STMT_END - SV_SET_STRINGIFY_REGEXP_FLAGS(d,r->compflags); + SV_SET_STRINGIFY_REGEXP_FLAGS(d,r->compflags,regexp_extflags_names); Perl_dump_indent(aTHX_ level, file, " COMPFLAGS = 0x%"UVxf" (%s)\n", (UV)(r->compflags), SvPVX_const(d)); - SV_SET_STRINGIFY_REGEXP_FLAGS(d,r->extflags); + SV_SET_STRINGIFY_REGEXP_FLAGS(d,r->extflags,regexp_extflags_names); Perl_dump_indent(aTHX_ level, file, " EXTFLAGS = 0x%"UVxf" (%s)\n", (UV)(r->extflags), SvPVX_const(d)); -#undef SV_SET_STRINGIFY_REGEXP_FLAGS - Perl_dump_indent(aTHX_ level, file, " INTFLAGS = 0x%"UVxf"\n", + Perl_dump_indent(aTHX_ level, file, " ENGINE = 0x%"UVxf" (%s)\n", + PTR2UV(r->engine), (r->engine == &PL_core_reg_engine) ? "STANDARD" : "PLUG-IN" ); + if (r->engine == &PL_core_reg_engine) { + SV_SET_STRINGIFY_REGEXP_FLAGS(d,r->intflags,regexp_core_intflags_names); + Perl_dump_indent(aTHX_ level, file, " INTFLAGS = 0x%"UVxf" (%s)\n", + (UV)(r->intflags), SvPVX_const(d)); + } else { + Perl_dump_indent(aTHX_ level, file, " INTFLAGS = 0x%"UVxf"\n", (UV)(r->intflags)); + } +#undef SV_SET_STRINGIFY_REGEXP_FLAGS Perl_dump_indent(aTHX_ level, file, " NPARENS = %"UVuf"\n", (UV)(r->nparens)); Perl_dump_indent(aTHX_ level, file, " LASTPAREN = %"UVuf"\n", @@ -2141,10 +2341,11 @@ Perl_do_sv_dump(pTHX_ I32 level, PerlIO pv_display(d, r->subbeg, r->sublen, 50, pvlim)); else Perl_dump_indent(aTHX_ level, file, " SUBBEG = 0x0\n"); - Perl_dump_indent(aTHX_ level, file, " ENGINE = 0x%"UVxf"\n", - PTR2UV(r->engine)); Perl_dump_indent(aTHX_ level, file, " MOTHER_RE = 0x%"UVxf"\n", PTR2UV(r->mother_re)); + if (nest < maxnest && r->mother_re) + do_sv_dump(level+1, file, (SV *)r->mother_re, nest+1, + maxnest, dumpops, pvlim); Perl_dump_indent(aTHX_ level, file, " PAREN_NAMES = 0x%"UVxf"\n", PTR2UV(r->paren_names)); Perl_dump_indent(aTHX_ level, file, " SUBSTRS = 0x%"UVxf"\n", @@ -2165,6 +2366,16 @@ Perl_do_sv_dump(pTHX_ I32 level, PerlIO SvREFCNT_dec_NN(d); } +/* +=for apidoc sv_dump + +Dumps the contents of an SV to the C filehandle. + +For an example of its output, see L. + +=cut +*/ + void Perl_sv_dump(pTHX_ SV *sv) { @@ -2189,6 +2400,9 @@ Perl_runops_debug(pTHX) DEBUG_l(Perl_deb(aTHX_ "Entering new RUNOPS level\n")); do { +#ifdef PERL_TRACE_OPS + ++PL_op_exec_cnt[PL_op->op_type]; +#endif if (PL_debug) { if (PL_watchaddr && (*PL_watchaddr != PL_watchok)) PerlIO_printf(Perl_debug_log, @@ -2546,64 +2760,15 @@ Perl_sv_catxmlpvn(pTHX_ SV *dsv, const c else c = (*pv & 255); - switch (c) { - case 0x00: - case 0x01: - case 0x02: - case 0x03: - case 0x04: - case 0x05: - case 0x06: - case 0x07: - case 0x08: - case 0x0b: - case 0x0c: - case 0x0e: - case 0x0f: - case 0x10: - case 0x11: - case 0x12: - case 0x13: - case 0x14: - case 0x15: - case 0x16: - case 0x17: - case 0x18: - case 0x19: - case 0x1a: - case 0x1b: - case 0x1c: - case 0x1d: - case 0x1e: - case 0x1f: - case 0x7f: - case 0x80: - case 0x81: - case 0x82: - case 0x83: - case 0x84: - case 0x86: - case 0x87: - case 0x88: - case 0x89: - case 0x90: - case 0x91: - case 0x92: - case 0x93: - case 0x94: - case 0x95: - case 0x96: - case 0x97: - case 0x98: - case 0x99: - case 0x9a: - case 0x9b: - case 0x9c: - case 0x9d: - case 0x9e: - case 0x9f: + if (isCNTRL_L1(c) + && c != '\t' + && c != '\n' + && c != '\r' + && c != LATIN1_TO_NATIVE(0x85)) + { Perl_sv_catpvf(aTHX_ dsv, "STUPIDXML(#x%X)", c); - break; + } + else switch (c) { case '<': sv_catpvs(dsv, "<"); break; @@ -2618,7 +2783,7 @@ Perl_sv_catxmlpvn(pTHX_ SV *dsv, const c break; default: if (c < 0xD800) { - if (c < 32 || c > 127) { + if (! isPRINT(c)) { Perl_sv_catpvf(aTHX_ dsv, "&#x%X;", c); } else { @@ -2709,7 +2874,7 @@ Perl_sv_xmlpeek(pTHX_ SV *sv) } else if (DEBUG_R_TEST_) { int is_tmp = 0; - I32 ix; + SSize_t ix; /* is this SV on the tmps stack? */ for (ix=PL_tmps_ix; ix>=0; ix--) { if (PL_tmps_stack[ix] == sv) { @@ -2771,8 +2936,8 @@ Perl_sv_xmlpeek(pTHX_ SV *sv) case SVt_PVGV: sv_catpv(t, " GV=\""); break; - case SVt_BIND: - sv_catpv(t, " BIND=\""); + case SVt_INVLIST: + sv_catpv(t, " DUMMY=\""); break; case SVt_REGEXP: sv_catpv(t, " REGEXP=\""); Index: gnu/usr.bin/perl/embed.fnc =================================================================== RCS file: /mnt/memory/perl/importit/cvs/src/gnu/usr.bin/perl/embed.fnc,v retrieving revision 1.1.1.11 diff -u -p -u -p -r1.1.1.11 embed.fnc --- gnu/usr.bin/perl/embed.fnc 24 Mar 2014 14:58:44 -0000 1.1.1.11 +++ gnu/usr.bin/perl/embed.fnc 16 Nov 2014 03:22:24 -0000 @@ -16,7 +16,7 @@ : any doc entry goes in perlapi.pod rather than perlintern.pod. If no : documentation is furnished for this function, and M is also : specified, the function is not listed as part of the public API. -: If M isn't specified and no documentation is furnished, the +: If M isn't specified, and no documentation is furnished, the : function is listed in perlapi as existing and being undocumented : makes '#define foo Perl_foo' scope not just for PERL_CORE/PERL_EXT : @@ -39,7 +39,7 @@ : : proto.h: add __attribute__deprecated__ : -: d Function has documentation in the source: +: d Function has documentation (somewhere) in the source: : : enables 'no docs for foo" warning in autodoc.pl : @@ -48,11 +48,14 @@ : in embed.h, change "#ifdef PERL_CORE" : into "#if defined(PERL_CORE) || defined(PERL_EXT)" : -: Should always be combined with "X" to be usable from dynamically -: loaded extensions. -: -: f Function takes printf style format string, varargs (hence any entry that -: would otherwise go in embed.h is suppressed): +: To be usable from dynamically loaded extensions, either: +: 1) must be static to its containing file ("i" or "s" flag); or +: 2) be combined with the "X" flag. +: +: f Function takes a format string. If the function name /strftime/ +: then its assumed to take a strftime-style format string as 1st arg; +: otherwise it's assumed to be a printf style format string, varargs +: (hence any entry that would otherwise go in embed.h is suppressed): : : proto.h: add __attribute__format__ (or ...null_ok__) : @@ -184,6 +187,9 @@ Anop |Free_t |mfree |Malloc_t where npR |MEM_SIZE|malloced_size |NN void *p npR |MEM_SIZE|malloc_good_size |size_t nbytes #endif +#if defined(PERL_IN_MALLOC_C) +sn |int |adjust_size_and_find_bucket |NN size_t *nbytes_p +#endif AnpR |void* |get_context Anp |void |set_context |NN void *t @@ -203,27 +209,28 @@ Apd |OP* |op_prepend_elem|I32 optype|NUL p |I32 |apply |I32 type|NN SV** mark|NN SV** sp ApM |void |apply_attrs_string|NN const char *stashpv|NN CV *cv|NN const char *attrstr|STRLEN len Apd |void |av_clear |NN AV *av -Apd |SV* |av_delete |NN AV *av|I32 key|I32 flags -ApdR |bool |av_exists |NN AV *av|I32 key -Apd |void |av_extend |NN AV *av|I32 key -p |void |av_extend_guts |NULLOK AV *av|I32 key|NN SSize_t *maxp \ +Apd |SV* |av_delete |NN AV *av|SSize_t key|I32 flags +ApdR |bool |av_exists |NN AV *av|SSize_t key +Apd |void |av_extend |NN AV *av|SSize_t key +p |void |av_extend_guts |NULLOK AV *av|SSize_t key \ + |NN SSize_t *maxp \ |NN SV ***allocp|NN SV ***arrayp -ApdR |SV** |av_fetch |NN AV *av|I32 key|I32 lval -Apd |void |av_fill |NN AV *av|I32 fill -ApdR |I32 |av_len |NN AV *av -ApdR |AV* |av_make |I32 size|NN SV **strp +ApdR |SV** |av_fetch |NN AV *av|SSize_t key|I32 lval +Apd |void |av_fill |NN AV *av|SSize_t fill +ApdR |SSize_t|av_len |NN AV *av +ApdR |AV* |av_make |SSize_t size|NN SV **strp Apd |SV* |av_pop |NN AV *av ApdoxM |void |av_create_and_push|NN AV **const avp|NN SV *const val Apd |void |av_push |NN AV *av|NN SV *val : Used in scope.c, and by Data::Alias EXp |void |av_reify |NN AV *av ApdR |SV* |av_shift |NN AV *av -Apd |SV** |av_store |NN AV *av|I32 key|NULLOK SV *val -AidR |I32 |av_top_index |NN AV *av -AmpdR |I32 |av_tindex |NN AV *av +Apd |SV** |av_store |NN AV *av|SSize_t key|NULLOK SV *val +AidR |SSize_t|av_top_index |NN AV *av +AmpdR |SSize_t|av_tindex |NN AV *av Apd |void |av_undef |NN AV *av ApdoxM |SV** |av_create_and_unshift_one|NN AV **const avp|NN SV *const val -Apd |void |av_unshift |NN AV *av|I32 num +Apd |void |av_unshift |NN AV *av|SSize_t num Apo |SV** |av_arylen_p |NN AV *av Apo |IV* |av_iter_p |NN AV *av #if defined(PERL_IN_AV_C) @@ -253,6 +260,8 @@ ApR |UV |cast_uv |NV f #if !defined(HAS_TRUNCATE) && !defined(HAS_CHSIZE) && defined(F_FREESP) ApR |I32 |my_chsize |int fd|Off_t length #endif +p |const COP*|closest_cop |NN const COP *cop|NULLOK const OP *o \ + |NULLOK const OP *curop|bool opnext : Used in perly.y pR |OP* |convert |I32 optype|I32 flags|NULLOK OP* o : Used in op.c and perl.c @@ -265,7 +274,6 @@ Anprd |void |croak_no_modify Anprd |void |croak_xs_usage |NN const CV *const cv \ |NN const char *const params npr |void |croak_no_mem -nroX |void |Perl_croak_memory_wrap nprX |void |croak_popstack #if defined(WIN32) norx |void |win32_croak_not_implemented|NN const char * fname @@ -294,12 +302,13 @@ p |SV * |core_prototype |NULLOK SV *sv|N p |OP * |coresub_op |NN SV *const coreargssv|const int code \ |const int opnum : Used in sv.c -p |void |cv_ckproto_len_flags |NN const CV* cv|NULLOK const GV* gv\ +EMXp |void |cv_ckproto_len_flags |NN const CV* cv|NULLOK const GV* gv\ |NULLOK const char* p|const STRLEN len \ |const U32 flags : Used in pp.c and pp_sys.c ApdR |SV* |gv_const_sv |NN GV* gv ApdR |SV* |cv_const_sv |NULLOK const CV *const cv +pR |SV* |cv_const_sv_or_av|NULLOK const CV *const cv : Used in pad.c pR |SV* |op_const_sv |NULLOK const OP* o|NULLOK CV* cv Apd |void |cv_undef |NN CV* cv @@ -323,6 +332,7 @@ Ap |void |debprofdump Ap |I32 |debop |NN const OP* o Ap |I32 |debstack Ap |I32 |debstackptrs +pR |SV * |defelem_target |NN SV *sv|NULLOK MAGIC *mg Anp |char* |delimcpy |NN char* to|NN const char* toend|NN const char* from \ |NN const char* fromend|int delim|NN I32* retlen : Used in op.c, perl.c @@ -384,10 +394,25 @@ Apmb |bool |do_open |NN GV* gv|NN const Ap |bool |do_open9 |NN GV *gv|NN const char *name|I32 len|int as_raw \ |int rawmode|int rawperm|NULLOK PerlIO *supplied_fp \ |NN SV *svs|I32 num +#if defined(PERL_IN_DOIO_C) +s |IO * |openn_setup |NN GV *gv|NN char *mode|NN PerlIO **saveifp \ + |NN PerlIO **saveofp|NN int *savefd \ + |NN char *savetype +s |bool |openn_cleanup |NN GV *gv|NN IO *io|NULLOK PerlIO *fp \ + |NN char *mode|NN const char *oname \ + |NULLOK PerlIO *saveifp|NULLOK PerlIO *saveofp \ + |int savefd|char savetype|int writing \ + |bool was_fdopen|NULLOK const char *type +#endif Ap |bool |do_openn |NN GV *gv|NN const char *oname|I32 len \ |int as_raw|int rawmode|int rawperm \ |NULLOK PerlIO *supplied_fp|NULLOK SV **svp \ |I32 num +Mp |bool |do_open_raw |NN GV *gv|NN const char *oname|STRLEN len \ + |int rawmode|int rawperm +Mp |bool |do_open6 |NN GV *gv|NN const char *oname|STRLEN len \ + |NULLOK PerlIO *supplied_fp|NULLOK SV **svp \ + |U32 num : Used in pp_hot.c and pp_sys.c p |bool |do_print |NULLOK SV* sv|NN PerlIO* fp : Used in pp_sys.c @@ -413,9 +438,6 @@ ApR |I32 |dowantarray Ap |void |dump_all p |void |dump_all_perl |bool justperl Ap |void |dump_eval -#if defined(DUMP_FDS) -Ap |void |dump_fds |NN char* s -#endif Ap |void |dump_form |NN const GV* gv Ap |void |gv_dump |NN GV* gv Ap |void |op_dump |NN const OP *o @@ -428,6 +450,7 @@ Apd |void |fbm_compile |NN SV* sv|U32 fl ApdR |char* |fbm_instr |NN unsigned char* big|NN unsigned char* bigend \ |NN SV* littlestr|U32 flags p |CV * |find_lexical_cv|PADOFFSET off +pR |OP * |parse_subsignature : Defined in util.c, used only in perl.c p |char* |find_script |NN const char *scriptname|bool dosearch \ |NULLOK const char *const *const search_ext|I32 flags @@ -463,7 +486,7 @@ ApR |GV* |gv_autoload_pv |NULLOK HV* sta |U32 flags ApR |GV* |gv_autoload_pvn |NULLOK HV* stash|NN const char* name \ |STRLEN len|U32 flags -Ap |void |gv_check |NN const HV* stash +Ap |void |gv_check |NN HV* stash Ap |void |gv_efullname |NN SV* sv|NN const GV* gv Apmb |void |gv_efullname3 |NN SV* sv|NN const GV* gv|NULLOK const char* prefix Ap |void |gv_efullname4 |NN SV* sv|NN const GV* gv|NULLOK const char* prefix|bool keepmain @@ -509,6 +532,8 @@ Ap |void |gv_init_pv |NN GV* gv|NULLOK H Ap |void |gv_init_pvn |NN GV* gv|NULLOK HV* stash|NN const char* name \ |STRLEN len|U32 flags Ap |void |gv_name_set |NN GV* gv|NN const char *name|U32 len|U32 flags +px |GV * |gv_override |NN const char * const name \ + |const STRLEN len XMpd |void |gv_try_downgrade|NN GV* gv Apd |HV* |gv_stashpv |NN const char* name|I32 flags Apd |HV* |gv_stashpvn |NN const char* name|U32 namelen|I32 flags @@ -531,7 +556,7 @@ Ap |void* |hv_common |NULLOK HV *hv|NULL Ap |void* |hv_common_key_len|NULLOK HV *hv|NN const char *key \ |I32 klen_i32|const int action|NULLOK SV *val \ |const U32 hash -Apod |STRLEN |hv_fill |NN HV const *const hv +Apod |STRLEN |hv_fill |NN HV *const hv Ap |void |hv_free_ent |NN HV *hv|NULLOK HE *entry Apd |I32 |hv_iterinit |NN HV *hv ApdR |char* |hv_iterkey |NN HE* entry|NN I32* retlen @@ -634,14 +659,14 @@ iDMPR |bool |isALNUM_lazy |NN const char sR |U8 |to_lower_latin1|const U8 c|NULLOK U8 *p|NULLOK STRLEN *lenp #endif #if defined(PERL_IN_UTF8_C) || defined(PERL_IN_REGCOMP_C) || defined(PERL_IN_REGEXEC_C) -EXp |UV |_to_fold_latin1|const U8 c|NN U8 *p|NN STRLEN *lenp|const bool flags +EXp |UV |_to_fold_latin1|const U8 c|NN U8 *p|NN STRLEN *lenp|const unsigned int flags #endif #if defined(PERL_IN_UTF8_C) || defined(PERL_IN_PP_C) p |UV |_to_upper_title_latin1|const U8 c|NN U8 *p|NN STRLEN *lenp|const char S_or_s #endif AMp |UV |to_uni_lower |UV c|NN U8 *p|NN STRLEN *lenp AMmp |UV |to_uni_fold |UV c|NN U8 *p|NN STRLEN *lenp -AMp |UV |_to_uni_fold_flags|UV c|NN U8 *p|NN STRLEN *lenp|const U8 flags +AMp |UV |_to_uni_fold_flags|UV c|NN U8 *p|NN STRLEN *lenp|U8 flags ADMpPR |bool |is_uni_alnum_lc|UV c ADMpPR |bool |is_uni_alnumc_lc|UV c ADMpPR |bool |is_uni_idfirst_lc|UV c @@ -725,7 +750,7 @@ AMpd |SV* |parse_label |U32 flags AMpd |OP* |parse_fullstmt |U32 flags AMpd |OP* |parse_stmtseq |U32 flags : Used in various files -Ap |void |op_null |NN OP* o +Apd |void |op_null |NN OP* o : FIXME. Used by Data::Alias EXp |void |op_clear |NN OP* o Ap |void |op_refcnt_lock @@ -742,7 +767,7 @@ p |OP* |localize |NN OP *o|I32 lex ApdR |I32 |looks_like_number|NN SV *const sv Apd |UV |grok_bin |NN const char* start|NN STRLEN* len_p|NN I32* flags|NULLOK NV *result #if defined(PERL_IN_REGCOMP_C) || defined(PERL_IN_TOKE_C) -EMsR |char |grok_bslash_c |const char source|const bool utf8|const bool output_warning +EMsR |char |grok_bslash_c |const char source|const bool output_warning EMsR |bool |grok_bslash_o |NN char** s|NN UV* uv \ |NN const char** error_msg \ |const bool output_warning \ @@ -819,7 +844,7 @@ p |int |magic_set_all_env|NN SV* sv|NN M p |U32 |magic_sizepack |NN SV* sv|NN MAGIC* mg p |int |magic_wipepack |NN SV* sv|NN MAGIC* mg pod |SV* |magic_methcall |NN SV *sv|NN const MAGIC *mg \ - |NN const char *meth|U32 flags \ + |NN SV *meth|U32 flags \ |U32 argc|... Ap |void |markstack_grow #if defined(USE_LOCALE_COLLATE) @@ -842,6 +867,8 @@ Apd |int |mg_copy |NN SV *sv|NN SV *nsv| pd |void |mg_localize |NN SV* sv|NN SV* nsv|bool setmagic ApdR |MAGIC* |mg_find |NULLOK const SV* sv|int type ApdR |MAGIC* |mg_findext |NULLOK const SV* sv|int type|NULLOK const MGVTBL *vtbl +: exported for re.pm +EXpR |MAGIC* |mg_find_mglob |NN SV* sv Apd |int |mg_free |NN SV* sv Apd |void |mg_free_type |NN SV* sv|int how Apd |int |mg_get |NN SV* sv @@ -855,6 +882,7 @@ poX |OP* |op_lvalue_flags|NULLOK OP* o|I p |void |finalize_optree |NN OP* o #if defined(PERL_IN_OP_C) s |void |finalize_op |NN OP* o +s |void |move_proto_attr|NN OP **proto|NN OP **attrs|NN const GV *name #endif : Used in op.c and pp_sys.c p |int |mode_from_discipline|NULLOK const char* s|STRLEN len @@ -888,14 +916,11 @@ Ap |PerlIO*|my_popen_list |NN const char Ap |void |my_setenv |NULLOK const char* nam|NULLOK const char* val Apmb |I32 |my_stat pX |I32 |my_stat_flags |NULLOK const U32 flags -Ap |char * |my_strftime |NN const char *fmt|int sec|int min|int hour|int mday|int mon|int year|int wday|int yday|int isdst -#if defined(MYSWAP) -ApPR |short |my_swap |short s -ApPR |long |my_htonl |long l -ApPR |long |my_ntohl |long l -#endif +Afp |char * |my_strftime |NN const char *fmt|int sec|int min|int hour|int mday|int mon|int year|int wday|int yday|int isdst : Used in pp_ctl.c p |void |my_unexec +ADMnoPR |UV |NATIVE_TO_NEED |const UV enc|const UV ch +ADMnoPR |UV |ASCII_TO_NEED |const UV enc|const UV ch Apa |OP* |newANONLIST |NULLOK OP* o Apa |OP* |newANONHASH |NULLOK OP* o Ap |OP* |newANONSUB |I32 floor|NULLOK OP* proto|NULLOK OP* block @@ -959,6 +984,7 @@ Apda |SV* |newRV_noinc |NN SV *const sv Apda |SV* |newSV |const STRLEN len Apa |OP* |newSVREF |NN OP* o Apda |OP* |newSVOP |I32 type|I32 flags|NN SV* sv +pa |SV* |newSVavdefelem |NN AV *av|SSize_t ix|bool extendible Apda |SV* |newSViv |const IV i Apda |SV* |newSVuv |const UV u Apda |SV* |newSVnv |const NV n @@ -1005,7 +1031,7 @@ Apd |int |vcmp |NN SV *lhv|NN SV *rhv p |PerlIO*|nextargv |NN GV* gv AnpP |char* |ninstr |NN const char* big|NN const char* bigend \ |NN const char* little|NN const char* lend -Ap |void |op_free |NULLOK OP* arg +Apd |void |op_free |NULLOK OP* arg Mp |OP* |op_unscope |NULLOK OP* o #ifdef PERL_CORE p |void |opslab_free |NN OPSLAB *slab @@ -1058,14 +1084,20 @@ ApdO |AV* |get_av |NN const char *name| ApdO |HV* |get_hv |NN const char *name|I32 flags ApdO |CV* |get_cv |NN const char* name|I32 flags Apd |CV* |get_cvn_flags |NN const char* name|STRLEN len|I32 flags -ApO |int |init_i18nl10n |int printwarn -ApO |int |init_i18nl14n |int printwarn -ApO |void |new_collate |NULLOK const char* newcoll -ApO |void |new_ctype |NN const char* newctype -ApO |void |new_numeric |NULLOK const char* newcoll +#ifdef WIN32 +ApPM |char* |my_setlocale |int category|NULLOK const char* locale +#else +AmPM |char* |my_setlocale |int category|NULLOK const char* locale +#endif +ApOM |int |init_i18nl10n |int printwarn +ApOM |int |init_i18nl14n |int printwarn +ApOM |void |new_collate |NULLOK const char* newcoll +ApOM |void |new_ctype |NN const char* newctype +ApOM |void |new_numeric |NULLOK const char* newcoll Ap |void |set_numeric_local Ap |void |set_numeric_radix Ap |void |set_numeric_standard +Admn |void |sync_locale ApdO |void |require_pv |NN const char* pv Apd |void |pack_cat |NN SV *cat|NN const char *pat|NN const char *patend \ |NN SV **beglist|NN SV **endlist|NN SV ***next_in_list|U32 flags @@ -1088,13 +1120,13 @@ Ap |void |regdump |NN const regexp* r Ap |SV* |regclass_swash |NULLOK const regexp *prog \ |NN const struct regnode *node|bool doinit \ |NULLOK SV **listsvp|NULLOK SV **altsvp -#ifdef PERL_IN_REGCOMP_C -EMsR |SV* |_new_invlist_C_array|NN UV* list -: Not used currently: EXMs |bool |_invlistEQ |NN SV* const a|NN SV* const b|bool complement_b +#if defined(PERL_IN_REGCOMP_C) || defined(PERL_IN_PERL_C) || defined(PERL_IN_UTF8_C) +AMpR |SV* |_new_invlist_C_array|NN const UV* const list +: Not used currently: EXMs |bool |_invlistEQ |NN SV* const a|NN SV* const b|const bool complement_b #endif Ap |I32 |pregexec |NN REGEXP * const prog|NN char* stringarg \ - |NN char* strend|NN char* strbeg|I32 minend \ - |NN SV* screamer|U32 nosave + |NN char* strend|NN char* strbeg \ + |SSize_t minend |NN SV* screamer|U32 nosave Ap |void |pregfree |NULLOK REGEXP* r Ap |void |pregfree2 |NN REGEXP *rx : FIXME - is anything in re using this now? @@ -1112,8 +1144,12 @@ p |REGEXP*|re_op_compile |NULLOK SV ** c |NULLOK bool *is_bare_re \ |U32 rx_flags|U32 pm_flags Ap |REGEXP*|re_compile |NN SV * const pattern|U32 orig_rx_flags -Ap |char* |re_intuit_start|NN REGEXP * const rx|NULLOK SV* sv|NN char* strpos \ - |NN char* strend|const U32 flags \ +Ap |char* |re_intuit_start|NN REGEXP * const rx \ + |NULLOK SV* sv \ + |NN const char* const strbeg \ + |NN char* strpos \ + |NN char* strend \ + |const U32 flags \ |NULLOK re_scream_pos_data *data Ap |SV* |re_intuit_string|NN REGEXP *const r #if defined(PERL_IN_REGCOMP_C) || defined(PERL_IN_TOKE_C) @@ -1121,10 +1157,10 @@ EiPR |I32 |regcurly |NN const char *s |const bool rbrace_must_be_escaped #endif Ap |I32 |regexec_flags |NN REGEXP *const rx|NN char *stringarg \ - |NN char *strend|NN char *strbeg|I32 minend \ - |NN SV *sv|NULLOK void *data|U32 flags + |NN char *strend|NN char *strbeg \ + |SSize_t minend|NN SV *sv \ + |NULLOK void *data|U32 flags ApR |regnode*|regnext |NULLOK regnode* p - EXp |SV*|reg_named_buff |NN REGEXP * const rx|NULLOK SV * const key \ |NULLOK SV * const value|const U32 flags EXp |SV*|reg_named_buff_iter |NN REGEXP * const rx|NULLOK const SV * const lastkey \ @@ -1147,7 +1183,7 @@ EXp |I32|reg_numbered_buff_length|NN REG EXp |SV*|reg_qr_package|NN REGEXP * const rx : FIXME - why the E? -Ep |void |regprop |NULLOK const regexp *prog|NN SV* sv|NN const regnode* o +Ep |void |regprop |NULLOK const regexp *prog|NN SV* sv|NN const regnode* o|NULLOK const regmatch_info *reginfo Anp |void |repeatcpy |NN char* to|NN const char* from|I32 len|IV count AnpP |char* |rninstr |NN const char* big|NN const char* bigend \ |NN const char* little|NN const char* lend @@ -1178,8 +1214,9 @@ Apda |char* |savesharedsvpv |NN SV *sv Apda |char* |savesvpv |NN SV* sv Ap |void |savestack_grow Ap |void |savestack_grow_cnt |I32 need -Amp |void |save_aelem |NN AV* av|I32 idx|NN SV **sptr -Ap |void |save_aelem_flags|NN AV* av|I32 idx|NN SV **sptr|const U32 flags +Amp |void |save_aelem |NN AV* av|SSize_t idx|NN SV **sptr +Ap |void |save_aelem_flags|NN AV* av|SSize_t idx|NN SV **sptr \ + |const U32 flags Ap |I32 |save_alloc |I32 size|I32 pad Ap |void |save_aptr |NN AV** aptr Ap |AV* |save_ary |NN GV* gv @@ -1187,7 +1224,7 @@ Ap |void |save_bool |NN bool* boolp Ap |void |save_clearsv |NN SV** svp Ap |void |save_delete |NN HV *hv|NN char *key|I32 klen Ap |void |save_hdelete |NN HV *hv|NN SV *keysv -Ap |void |save_adelete |NN AV *av|I32 key +Ap |void |save_adelete |NN AV *av|SSize_t key Ap |void |save_destructor|DESTRUCTORFUNC_NOCONTEXT_t f|NN void* p Ap |void |save_destructor_x|DESTRUCTORFUNC_t f|NULLOK void* p Apmb |void |save_freesv |NULLOK SV* sv @@ -1221,6 +1258,7 @@ Ap |void |save_vptr |NN void *ptr Ap |void |save_re_context Ap |void |save_padsv_and_mortalize|PADOFFSET off Ap |void |save_sptr |NN SV** sptr +Xp |void |save_strlen |NN STRLEN* ptr Ap |SV* |save_svref |NN SV** sptr Ap |void |save_pushptr |NULLOK void *const ptr|const int type Ap |void |save_pushi32ptr|const I32 i|NULLOK void *const ptr|const int type @@ -1249,6 +1287,8 @@ Apd |NV |scan_oct |NN const char* start| AMpd |OP* |op_scope |NULLOK OP* o Ap |char* |screaminstr |NN SV *bigstr|NN SV *littlestr|I32 start_shift \ |I32 end_shift|NN I32 *old_posp|I32 last +: Only used by perl.c/miniperl.c, but defined in caretx.c +px |void |set_caret_X Apd |void |setdefout |NN GV* gv Ap |HEK* |share_hek |NN const char* str|I32 len|U32 hash #if defined(HAS_SIGACTION) && defined(SA_SIGINFO) @@ -1259,31 +1299,31 @@ Anp |Signal_t |csighandler |int sig|NULL np |Signal_t |sighandler |int sig Anp |Signal_t |csighandler |int sig #endif -Ap |SV** |stack_grow |NN SV** sp|NN SV** p|int n +Ap |SV** |stack_grow |NN SV** sp|NN SV** p|SSize_t n Ap |I32 |start_subparse |I32 is_format|U32 flags : Used in pp_ctl.c p |void |sub_crush_depth|NN CV* cv Amd |bool |sv_2bool |NN SV *const sv -Apd |bool |sv_2bool_flags |NN SV *const sv|const I32 flags +Apd |bool |sv_2bool_flags |NN SV *sv|I32 flags Apd |CV* |sv_2cv |NULLOK SV* sv|NN HV **const st|NN GV **const gvp \ |const I32 lref Apd |IO* |sv_2io |NN SV *const sv #if defined(PERL_IN_SV_C) s |bool |glob_2number |NN GV* const gv #endif -Amb |IV |sv_2iv |NULLOK SV *sv -Apd |IV |sv_2iv_flags |NULLOK SV *const sv|const I32 flags +Amb |IV |sv_2iv |NN SV *sv +Apd |IV |sv_2iv_flags |NN SV *const sv|const I32 flags Apd |SV* |sv_2mortal |NULLOK SV *const sv -Apd |NV |sv_2nv_flags |NULLOK SV *const sv|const I32 flags +Apd |NV |sv_2nv_flags |NN SV *const sv|const I32 flags : Used in pp.c, pp_hot.c, sv.c pMd |SV* |sv_2num |NN SV *const sv -Amb |char* |sv_2pv |NULLOK SV *sv|NULLOK STRLEN *lp -Apd |char* |sv_2pv_flags |NULLOK SV *const sv|NULLOK STRLEN *const lp|const I32 flags +Amb |char* |sv_2pv |NN SV *sv|NULLOK STRLEN *lp +Apd |char* |sv_2pv_flags |NN SV *const sv|NULLOK STRLEN *const lp|const I32 flags Apd |char* |sv_2pvutf8 |NN SV *sv|NULLOK STRLEN *const lp Apd |char* |sv_2pvbyte |NN SV *sv|NULLOK STRLEN *const lp Ap |char* |sv_pvn_nomg |NN SV* sv|NULLOK STRLEN* lp -Amb |UV |sv_2uv |NULLOK SV *sv -Apd |UV |sv_2uv_flags |NULLOK SV *const sv|const I32 flags +Amb |UV |sv_2uv |NN SV *sv +Apd |UV |sv_2uv_flags |NN SV *const sv|const I32 flags Apd |IV |sv_iv |NN SV* sv Apd |UV |sv_uv |NN SV* sv Apd |NV |sv_nv |NN SV* sv @@ -1297,6 +1337,12 @@ sd |void |sv_add_arena |NN char *const p #endif Apd |int |sv_backoff |NN SV *const sv Apd |SV* |sv_bless |NN SV *const sv|NN HV *const stash +#if defined(PERL_DEBUG_READONLY_COW) +p |void |sv_buf_to_ro |NN SV *sv +# if defined(PERL_IN_SV_C) +s |void |sv_buf_to_rw |NN SV *sv +# endif +#endif Afpd |void |sv_catpvf |NN SV *const sv|NN const char *const pat|... Apd |void |sv_vcatpvf |NN SV *const sv|NN const char *const pat \ |NULLOK va_list *const args @@ -1361,6 +1407,8 @@ Apd |void |sv_magic |NN SV *const sv|NUL Apd |MAGIC *|sv_magicext |NN SV *const sv|NULLOK SV *const obj|const int how \ |NULLOK const MGVTBL *const vtbl|NULLOK const char *const name \ |const I32 namlen +: exported for re.pm +EXp |MAGIC *|sv_magicext_mglob|NN SV *sv ApdbamR |SV* |sv_mortalcopy |NULLOK SV *const oldsv XpaR |SV* |sv_mortalcopy_flags|NULLOK SV *const oldsv|U32 flags ApdR |SV* |sv_newmortal @@ -1370,6 +1418,8 @@ Apd |void |sv_pos_u2b |NULLOK SV *const Apd |STRLEN |sv_pos_u2b_flags|NN SV *const sv|STRLEN uoffset \ |NULLOK STRLEN *const lenp|U32 flags Apd |void |sv_pos_b2u |NULLOK SV *const sv|NN I32 *const offsetp +Apd |STRLEN |sv_pos_b2u_flags|NN SV *const sv|STRLEN const offset \ + |U32 flags Amdb |char* |sv_pvn_force |NN SV* sv|NULLOK STRLEN* lp Apd |char* |sv_pvutf8n_force|NN SV *const sv|NULLOK STRLEN *const lp Apd |char* |sv_pvbyten_force|NN SV *const sv|NULLOK STRLEN *const lp @@ -1429,17 +1479,15 @@ EsM |void |_append_range_to_invlist |N EiMR |UV* |_invlist_array_init |NN SV* const invlist|const bool will_have_0 EiMR |UV* |invlist_array |NN SV* const invlist EsM |void |invlist_extend |NN SV* const invlist|const UV len -EiMR |UV* |get_invlist_zero_addr |NN SV* invlist EiMR |UV |invlist_max |NN SV* const invlist -EiM |void |invlist_set_len|NN SV* const invlist|const UV len +EiM |void |invlist_set_len|NN SV* const invlist|const UV len|const bool offset EiMR |IV* |get_invlist_previous_index_addr|NN SV* invlist EiMR |IV |invlist_previous_index|NN SV* const invlist EiM |void |invlist_set_previous_index|NN SV* const invlist|const IV index EiM |void |invlist_trim |NN SV* const invlist EiMR |SV* |invlist_clone |NN SV* const invlist EiMR |bool |invlist_is_iterating|NN SV* const invlist -EiMR |UV* |get_invlist_iter_addr |NN SV* invlist -EiMR |UV* |get_invlist_version_id_addr |NN SV* invlist +EiMR |STRLEN*|get_invlist_iter_addr |NN SV* invlist EiM |void |invlist_iterinit|NN SV* invlist EsMR |bool |invlist_iternext|NN SV* invlist|NN UV* start|NN UV* end EiM |void |invlist_iterfinish|NN SV* invlist @@ -1447,15 +1495,19 @@ EiMR |UV |invlist_highest|NN SV* const i #endif #if defined(PERL_IN_REGCOMP_C) || defined(PERL_IN_UTF8_C) EXmM |void |_invlist_intersection |NN SV* const a|NN SV* const b|NN SV** i -EXpM |void |_invlist_intersection_maybe_complement_2nd|NULLOK SV* const a|NN SV* const b|bool complement_b|NN SV** i +EXpM |void |_invlist_intersection_maybe_complement_2nd \ + |NULLOK SV* const a|NN SV* const b \ + |const bool complement_b|NN SV** i EXmM |void |_invlist_union |NULLOK SV* const a|NN SV* const b|NN SV** output -EXpM |void |_invlist_union_maybe_complement_2nd|NULLOK SV* const a|NN SV* const b|bool complement_b|NN SV** output +EXpM |void |_invlist_union_maybe_complement_2nd \ + |NULLOK SV* const a|NN SV* const b \ + |const bool complement_b|NN SV** output EXmM |void |_invlist_subtract|NN SV* const a|NN SV* const b|NN SV** result EXpM |void |_invlist_invert|NN SV* const invlist -EXpM |void |_invlist_invert_prop|NN SV* const invlist EXMpR |SV* |_new_invlist |IV initial_size EXMpR |SV* |_swash_to_invlist |NN SV* const swash EXMpR |SV* |_add_range_to_invlist |NULLOK SV* invlist|const UV start|const UV end +EXMpR |SV* |_setup_canned_invlist|const STRLEN size|const UV element0|NN UV** other_elements_ptr EXMp |void |_invlist_populate_swatch |NN SV* const invlist|const UV start|const UV end|NN U8* swatch #endif #if defined(PERL_IN_REGCOMP_C) || defined(PERL_IN_REGEXEC_C) || defined(PERL_IN_UTF8_C) || defined(PERL_IN_TOKE_C) @@ -1465,26 +1517,41 @@ EXp |SV* |_core_swash_init|NN const char #endif #if defined(PERL_IN_REGCOMP_C) || defined(PERL_IN_REGEXEC_C) || defined(PERL_IN_UTF8_C) EXMpR |SV* |_invlist_contents|NN SV* const invlist -EiMR |UV* |_get_invlist_len_addr |NN SV* invlist +EiMR |bool* |get_invlist_offset_addr|NN SV* invlist EiMR |UV |_invlist_len |NN SV* const invlist EMiR |bool |_invlist_contains_cp|NN SV* const invlist|const UV cp EXpMR |IV |_invlist_search |NN SV* const invlist|const UV cp EXMpR |SV* |_get_swash_invlist|NN SV* const swash EXMpR |HV* |_swash_inversion_hash |NN SV* const swash -: Not used currently: EXMp |void |_invlist_dump |NN SV* const invlist|NN const char * const header +#endif +#if defined(PERL_IN_REGCOMP_C) || defined(PERL_IN_REGEXEC_C) +ApM |SV* |_get_regclass_nonbitmap_data \ + |NULLOK const regexp *prog \ + |NN const struct regnode *node|bool doinit \ + |NULLOK SV **listsvp \ + |NULLOK SV **lonly_utf8_locale +#endif +#if defined(PERL_IN_REGCOMP_C) || defined (PERL_IN_DUMP_C) +EXMp |void |_invlist_dump |NN PerlIO *file|I32 level \ + |NN const char* const indent \ + |NN SV* const invlist #endif Ap |void |taint_env Ap |void |taint_proper |NULLOK const char* f|NN const char *const s Apd |UV |to_utf8_case |NN const U8 *p|NN U8* ustrp|NULLOK STRLEN *lenp \ |NN SV **swashp|NN const char *normal|NULLOK const char *special Abmd |UV |to_utf8_lower |NN const U8 *p|NN U8* ustrp|NULLOK STRLEN *lenp -AMp |UV |_to_utf8_lower_flags |NN const U8 *p|NN U8* ustrp|NULLOK STRLEN *lenp|const bool flags|NULLOK bool* tainted_ptr +AMp |UV |_to_utf8_lower_flags |NN const U8 *p|NN U8* ustrp \ + |NULLOK STRLEN *lenp|bool flags Abmd |UV |to_utf8_upper |NN const U8 *p|NN U8* ustrp|NULLOK STRLEN *lenp -AMp |UV |_to_utf8_upper_flags |NN const U8 *p|NN U8* ustrp|NULLOK STRLEN *lenp|const bool flags|NULLOK bool* tainted_ptr +AMp |UV |_to_utf8_upper_flags |NN const U8 *p|NN U8* ustrp \ + |NULLOK STRLEN *lenp|bool flags Abmd |UV |to_utf8_title |NN const U8 *p|NN U8* ustrp|NULLOK STRLEN *lenp -AMp |UV |_to_utf8_title_flags |NN const U8 *p|NN U8* ustrp|NULLOK STRLEN *lenp|const bool flags|NULLOK bool* tainted_ptr +AMp |UV |_to_utf8_title_flags |NN const U8 *p|NN U8* ustrp \ + |NULLOK STRLEN *lenp|bool flags Abmd |UV |to_utf8_fold |NN const U8 *p|NN U8* ustrp|NULLOK STRLEN *lenp -AMp |UV |_to_utf8_fold_flags|NN const U8 *p|NN U8* ustrp|NULLOK STRLEN *lenp|U8 flags|NULLOK bool* tainted_ptr +AMp |UV |_to_utf8_fold_flags|NN const U8 *p|NN U8* ustrp \ + |NULLOK STRLEN *lenp|U8 flags #if defined(PERL_IN_MG_C) || defined(PERL_IN_PP_C) p |bool |translate_substr_offsets|STRLEN curlen|IV pos1_iv \ |bool pos1_is_uv|IV len_iv \ @@ -1521,30 +1588,21 @@ ApMd |U8* |bytes_from_utf8|NN const U8 * ApMd |U8* |bytes_to_utf8 |NN const U8 *s|NN STRLEN *len ApdD |UV |utf8_to_uvchr |NN const U8 *s|NULLOK STRLEN *retlen ApdD |UV |utf8_to_uvuni |NN const U8 *s|NULLOK STRLEN *retlen -ApM |UV |valid_utf8_to_uvuni |NN const U8 *s|NULLOK STRLEN *retlen -Apd |UV |utf8_to_uvchr_buf |NN const U8 *s|NN const U8 *send|NULLOK STRLEN *retlen -Apd |UV |utf8_to_uvuni_buf |NN const U8 *s|NN const U8 *send|NULLOK STRLEN *retlen +ApMD |UV |valid_utf8_to_uvuni |NN const U8 *s|NULLOK STRLEN *retlen +Amd |UV |utf8_to_uvchr_buf |NN const U8 *s|NN const U8 *send|NULLOK STRLEN *retlen +ApdD |UV |utf8_to_uvuni_buf |NN const U8 *s|NN const U8 *send|NULLOK STRLEN *retlen pM |bool |check_utf8_print |NN const U8 *s|const STRLEN len -#ifdef EBCDIC Adp |UV |utf8n_to_uvchr |NN const U8 *s|STRLEN curlen|NULLOK STRLEN *retlen|U32 flags ApM |UV |valid_utf8_to_uvchr |NN const U8 *s|NULLOK STRLEN *retlen -#else -Adpbm |UV |utf8n_to_uvchr |NN const U8 *s|STRLEN curlen|NULLOK STRLEN *retlen|U32 flags -ApbmM |UV |valid_utf8_to_uvchr |NN const U8 *s|NULLOK STRLEN *retlen -#endif - -Adp |UV |utf8n_to_uvuni |NN const U8 *s|STRLEN curlen|NULLOK STRLEN *retlen|U32 flags -#ifdef EBCDIC -Apd |U8* |uvchr_to_utf8 |NN U8 *d|UV uv -#else -Apdbm |U8* |uvchr_to_utf8 |NN U8 *d|UV uv -#endif +Ap |UV |utf8n_to_uvuni|NN const U8 *s|STRLEN curlen|NULLOK STRLEN *retlen|U32 flags -Apbm |U8* |uvuni_to_utf8 |NN U8 *d|UV uv -Ap |U8* |uvchr_to_utf8_flags |NN U8 *d|UV uv|UV flags -Apd |U8* |uvuni_to_utf8_flags |NN U8 *d|UV uv|UV flags +Adm |U8* |uvchr_to_utf8 |NN U8 *d|UV uv +Ap |U8* |uvuni_to_utf8 |NN U8 *d|UV uv +Adm |U8* |uvchr_to_utf8_flags |NN U8 *d|UV uv|UV flags +Apd |U8* |uvoffuni_to_utf8_flags |NN U8 *d|UV uv|UV flags +Ap |U8* |uvuni_to_utf8_flags |NN U8 *d|UV uv|UV flags Apd |char* |pv_uni_display |NN SV *dsv|NN const U8 *spv|STRLEN len|STRLEN pvlim|UV flags ApdR |char* |sv_uni_display |NN SV *dsv|NN SV *ssv|STRLEN pvlim|UV flags : Used by Data::Alias @@ -1556,6 +1614,8 @@ p |I32 |wait4pid |Pid_t pid|NN int* stat : Used in locale.c and perl.c p |U32 |parse_unicode_opts|NN const char **popt Ap |U32 |seed +Xpno |double |drand48_r |NN perl_drand48_t *random_state +Xpno |void |drand48_init_r |NN perl_drand48_t *random_state|U32 seed : Only used in perl.c p |void |get_hash_seed |NN unsigned char * const seed_buffer : Used in doio.c, pp_hot.c, pp_sys.c @@ -1582,6 +1642,8 @@ Am |I32 |whichsig |NN const char* sig Ap |I32 |whichsig_sv |NN SV* sigsv Ap |I32 |whichsig_pv |NN const char* sig Ap |I32 |whichsig_pvn |NN const char* sig|STRLEN len +: used to check for NULs in pathnames and other names +AiR |bool |is_safe_syscall|NN const char *pv|STRLEN len|NN const char *what|NN const char *op_name : Used in pp_ctl.c p |void |write_to_stderr|NN SV* msv : Used in op.c @@ -1610,6 +1672,7 @@ Anpa |Malloc_t|safesysmalloc |MEM_SIZE n Anpa |Malloc_t|safesyscalloc |MEM_SIZE elements|MEM_SIZE size Anpa |Malloc_t|safesysrealloc|Malloc_t where|MEM_SIZE nbytes Anp |Free_t |safesysfree |Malloc_t where +Asrnx |void |croak_memory_wrap #if defined(PERL_GLOBAL_STRUCT) Ap |struct perl_vars *|GetVars Ap |struct perl_vars*|init_global_struct @@ -1676,15 +1739,15 @@ Apd |void |sv_utf8_encode |NN SV *const ApdM |bool |sv_utf8_decode |NN SV *const sv Apdmb |void |sv_force_normal|NN SV *sv Apd |void |sv_force_normal_flags|NN SV *const sv|const U32 flags -Ap |void |tmps_grow |I32 n +Ap |void |tmps_grow |SSize_t n Apd |SV* |sv_rvweaken |NN SV *const sv : This is indirectly referenced by globals.c. This is somewhat annoying. p |int |magic_killbackrefs|NN SV *sv|NN MAGIC *mg Ap |OP* |newANONATTRSUB |I32 floor|NULLOK OP *proto|NULLOK OP *attrs|NULLOK OP *block -Ap |CV* |newATTRSUB |I32 floor|NULLOK OP *o|NULLOK OP *proto|NULLOK OP *attrs|NULLOK OP *block -p |CV* |newATTRSUB_flags|I32 floor|NULLOK OP *o|NULLOK OP *proto \ +Am |CV* |newATTRSUB |I32 floor|NULLOK OP *o|NULLOK OP *proto|NULLOK OP *attrs|NULLOK OP *block +pX |CV* |newATTRSUB_x |I32 floor|NULLOK OP *o|NULLOK OP *proto \ |NULLOK OP *attrs|NULLOK OP *block \ - |U32 flags + |bool o_is_gv Ap |CV * |newMYSUB |I32 floor|NN OP *o|NULLOK OP *proto \ |NULLOK OP *attrs|NULLOK OP *block p |CV* |newSTUB |NN GV *gv|bool fake @@ -1722,19 +1785,18 @@ Ap |void |ptr_table_store|NN PTR_TBL_t * Ap |void |ptr_table_split|NN PTR_TBL_t *const tbl ApD |void |ptr_table_clear|NULLOK PTR_TBL_t *const tbl Ap |void |ptr_table_free|NULLOK PTR_TBL_t *const tbl -#if defined(USE_ITHREADS) -# if defined(HAVE_INTERP_INTERN) -Ap |void |sys_intern_dup |NN struct interp_intern* src|NN struct interp_intern* dst -# endif -#endif #if defined(HAVE_INTERP_INTERN) Ap |void |sys_intern_clear Ap |void |sys_intern_init +# if defined(USE_ITHREADS) +Ap |void |sys_intern_dup |NN struct interp_intern* src|NN struct interp_intern* dst +# endif #endif -AopP |const XOP * |custom_op_xop |NN const OP *o +AmopP |const XOP * |custom_op_xop |NN const OP *o ApR |const char * |custom_op_name |NN const OP *o ApR |const char * |custom_op_desc |NN const OP *o +pRX |XOPRETANY |custom_op_get_field |NN const OP *o|const xop_flags_enum field Aop |void |custom_op_register |NN Perl_ppaddr_t ppaddr \ |NN const XOP *xop @@ -1761,6 +1823,19 @@ sR |I32 |do_trans_complex_utf8 |NN SV * #if defined(PERL_IN_GV_C) s |void |gv_init_svtype |NN GV *gv|const svtype sv_type s |void |gv_magicalize_isa |NN GV *gv +s |bool|parse_gv_stash_name|NN HV **stash|NN GV **gv \ + |NN const char **name|NN STRLEN *len \ + |NN const char *nambeg|STRLEN full_len \ + |const U32 is_utf8|const I32 add +s |bool|find_default_stash|NN HV **stash|NN const char *name \ + |STRLEN len|const U32 is_utf8|const I32 add \ + |svtype sv_type +s |bool|gv_magicalize|NN GV *gv|NN HV *stash|NN const char *name \ + |STRLEN len|bool addmg \ + |svtype sv_type +s |void|maybe_multimagic_gv|NN GV *gv|NN const char *name|const svtype sv_type +s |bool|gv_is_in_main|NN const char *name|STRLEN len \ + |const U32 is_utf8 s |HV* |require_tie_mod|NN GV *gv|NN const char *varpv|NN SV* namesv \ |NN const char *methpv|const U32 flags #endif @@ -1779,8 +1854,9 @@ sn |void |hv_magic_check |NN HV *hv|NN b s |void |unshare_hek_or_pvn|NULLOK const HEK* hek|NULLOK const char* str|I32 len|U32 hash sR |HEK* |share_hek_flags|NN const char *str|I32 len|U32 hash|int flags rs |void |hv_notallowed |int flags|NN const char *key|I32 klen|NN const char *msg -sn |U32|ptr_hash|PTRV u +in |U32|ptr_hash|PTRV u s |struct xpvhv_aux*|hv_auxinit|NN HV *hv +sn |struct xpvhv_aux*|hv_auxinit_internal|NN struct xpvhv_aux *iter sM |SV* |hv_delete_common|NULLOK HV *hv|NULLOK SV *keysv \ |NULLOK const char *key|STRLEN klen|int k_flags|I32 d_flags \ |U32 hash @@ -1788,13 +1864,14 @@ sM |void |clear_placeholders |NN HV *hv| #endif #if defined(PERL_IN_MG_C) -s |void |save_magic |I32 mgs_ix|NN SV *sv --s |int |magic_methpack |NN SV *sv|NN const MAGIC *mg|NN const char *meth +s |void |save_magic_flags|I32 mgs_ix|NN SV *sv|U32 flags +-s |int |magic_methpack |NN SV *sv|NN const MAGIC *mg|NN SV *meth s |SV* |magic_methcall1|NN SV *sv|NN const MAGIC *mg \ - |NN const char *meth|U32 flags \ + |NN SV *meth|U32 flags \ |int n|NULLOK SV *val s |void |restore_magic |NULLOK const void *p s |void |unwind_handler_stack|NULLOK const void *p +s |void |fixup_errno_string|NN SV* sv #endif @@ -1810,6 +1887,7 @@ sR |OP* |newDEFSVOP sR |OP* |search_const |NN OP *o sR |OP* |new_logop |I32 type|I32 flags|NN OP **firstp|NN OP **otherp s |void |simplify_sort |NN OP *o +s |void |null_listop_in_list_context |NN OP* o s |SV* |gv_ename |NN GV *gv sRn |bool |scalar_mod_type|NULLOK const OP *o|I32 type s |OP * |my_kid |NULLOK OP *o|NULLOK OP *attrs|NN OP **imopsp @@ -1817,7 +1895,7 @@ s |OP * |dup_attrlist |NN OP *o s |void |apply_attrs |NN HV *stash|NN SV *target|NULLOK OP *attrs s |void |apply_attrs_my |NN HV *stash|NN OP *target|NULLOK OP *attrs|NN OP **imopsp s |void |bad_type_pv |I32 n|NN const char *t|NN const char *name|U32 flags|NN const OP *kid -s |void |bad_type_sv |I32 n|NN const char *t|NN SV *namesv|U32 flags|NN const OP *kid +s |void |bad_type_gv |I32 n|NN const char *t|NN GV *gv|U32 flags|NN const OP *kid s |void |no_bareword_allowed|NN OP *o sR |OP* |no_fh_allowed|NN OP *o sR |OP* |too_few_arguments_sv|NN OP *o|NN SV* namesv|U32 flags @@ -1903,7 +1981,8 @@ sR |const char *|get_num |NN const char ns |bool |need_utf8 |NN const char *pat|NN const char *patend ns |char |first_symbol |NN const char *pat|NN const char *patend sR |char * |sv_exp_grow |NN SV *sv|STRLEN needed -snR |char * |bytes_to_uni |NN const U8 *start|STRLEN len|NN char *dest +snR |char * |bytes_to_uni |NN const U8 *start|STRLEN len|NN char *dest \ + |const bool needs_swap #endif #if defined(PERL_IN_PP_CTL_C) @@ -1925,8 +2004,9 @@ sR |PerlIO *|check_type_and_open|NN SV * #ifndef PERL_DISABLE_PMC sR |PerlIO *|doopen_pm |NN SV *name #endif -s |SV ** |adjust_stack_on_leave|NN SV **newsp|NN SV **sp|NN SV **mark|I32 gimme|U32 flags -sRn |bool |path_is_absolute|NN const char *name +s |SV ** |adjust_stack_on_leave|NN SV **newsp|NN SV **sp|NN SV **mark|I32 gimme \ + |U32 flags|bool lvalue +iRn |bool |path_is_searchable|NN const char *name sR |I32 |run_user_filter|int idx|NN SV *buf_sv|int maxlen sR |PMOP* |make_matcher |NN REGEXP* re sR |bool |matcher_matches_sv|NN PMOP* matcher|NN SV* sv @@ -1954,99 +2034,125 @@ s |void |qsortsvu |NULLOK SV** array|siz #endif #if defined(PERL_IN_PP_SYS_C) -s |OP* |doform |NN CV *cv|NN GV *gv|NN OP *retop +s |OP* |doform |NN CV *cv|NN GV *gv|NULLOK OP *retop # if !defined(HAS_MKDIR) || !defined(HAS_RMDIR) sR |int |dooneliner |NN const char *cmd|NN const char *filename # endif s |SV * |space_join_names_mortal|NN char *const *array #endif -p |OP * |tied_method|NN const char *const methname|NN SV **sp \ +p |OP * |tied_method|NN SV *methname|NN SV **sp \ |NN SV *const sv|NN const MAGIC *const mg \ |const U32 flags|U32 argc|... #if defined(PERL_IN_REGCOMP_C) -Es |regnode*|reg |NN struct RExC_state_t *pRExC_state \ +Es |regnode*|reg |NN RExC_state_t *pRExC_state \ |I32 paren|NN I32 *flagp|U32 depth -Es |regnode*|reganode |NN struct RExC_state_t *pRExC_state|U8 op \ +Es |regnode*|reganode |NN RExC_state_t *pRExC_state|U8 op \ |U32 arg -Es |regnode*|regatom |NN struct RExC_state_t *pRExC_state \ +Es |regnode*|regatom |NN RExC_state_t *pRExC_state \ |NN I32 *flagp|U32 depth -Es |regnode*|regbranch |NN struct RExC_state_t *pRExC_state \ +Es |regnode*|regbranch |NN RExC_state_t *pRExC_state \ |NN I32 *flagp|I32 first|U32 depth -Es |STRLEN |reguni |NN const struct RExC_state_t *pRExC_state \ +Ei |STRLEN |reguni |NN const RExC_state_t *pRExC_state \ |UV uv|NN char *s -Es |regnode*|regclass |NN struct RExC_state_t *pRExC_state \ +Es |void |set_ANYOF_arg |NN RExC_state_t* const pRExC_state \ + |NN regnode* const node \ + |NULLOK SV* const cp_list \ + |NULLOK SV* const runtime_defns \ + |NULLOK SV* const only_utf8_locale_list \ + |NULLOK SV* const swash \ + |const bool has_user_defined_property +Es |regnode*|regclass |NN RExC_state_t *pRExC_state \ |NN I32 *flagp|U32 depth|const bool stop_at_1 \ |bool allow_multi_fold \ |const bool silence_non_portable \ |NULLOK SV** ret_invlist -Es |bool|could_it_be_a_POSIX_class|NN struct RExC_state_t *pRExC_state -Es |regnode*|handle_regex_sets|NN struct RExC_state_t *pRExC_state \ +Es |bool|could_it_be_a_POSIX_class|NN RExC_state_t *pRExC_state +Es |regnode*|handle_regex_sets|NN RExC_state_t *pRExC_state \ |NULLOK SV ** return_invlist \ |NN I32 *flagp|U32 depth \ |NN char * const oregcomp_parse -Es |void|parse_lparen_question_flags|NN struct RExC_state_t *pRExC_state -Es |regnode*|reg_node |NN struct RExC_state_t *pRExC_state|U8 op +Es |void|parse_lparen_question_flags|NN RExC_state_t *pRExC_state +Es |regnode*|reg_node |NN RExC_state_t *pRExC_state|U8 op Es |UV |reg_recode |const char value|NN SV **encp -Es |regnode*|regpiece |NN struct RExC_state_t *pRExC_state \ +Es |regnode*|regpiece |NN RExC_state_t *pRExC_state \ |NN I32 *flagp|U32 depth -Es |bool |grok_bslash_N |NN struct RExC_state_t *pRExC_state \ +Es |bool |grok_bslash_N |NN RExC_state_t *pRExC_state \ |NULLOK regnode** nodep|NULLOK UV *valuep \ |NN I32 *flagp|U32 depth|bool in_char_class \ |const bool strict -Es |void |reginsert |NN struct RExC_state_t *pRExC_state \ +Es |void |reginsert |NN RExC_state_t *pRExC_state \ |U8 op|NN regnode *opnd|U32 depth -Es |void |regtail |NN struct RExC_state_t *pRExC_state \ +Es |void |regtail |NN RExC_state_t *pRExC_state \ |NN regnode *p|NN const regnode *val|U32 depth -Es |SV * |reg_scan_name |NN struct RExC_state_t *pRExC_state \ +Es |SV * |reg_scan_name |NN RExC_state_t *pRExC_state \ |U32 flags -Es |U32 |join_exact |NN struct RExC_state_t *pRExC_state \ +Es |U32 |join_exact |NN RExC_state_t *pRExC_state \ |NN regnode *scan|NN UV *min_subtract \ - |NN bool *has_exactf_sharp_s \ + |NN bool *unfolded_multi_char \ |U32 flags|NULLOK regnode *val|U32 depth -EsRn |char * |regwhite |NN struct RExC_state_t *pRExC_state \ +EsRn |char * |regwhite |NN RExC_state_t *pRExC_state \ |NN char *p -EsRn |char * |regpatws |NN struct RExC_state_t *pRExC_state \ +EsRn |char * |regpatws |NN RExC_state_t *pRExC_state \ |NN char *p|const bool recognize_comment -Ei |void |alloc_maybe_populate_EXACT|NN struct RExC_state_t *pRExC_state \ +Ei |void |alloc_maybe_populate_EXACT|NN RExC_state_t *pRExC_state \ |NN regnode *node|NN I32 *flagp|STRLEN len \ - |UV code_point -Ei |U8 |compute_EXACTish|NN struct RExC_state_t *pRExC_state -Es |char * |nextchar |NN struct RExC_state_t *pRExC_state -Es |bool |reg_skipcomment|NN struct RExC_state_t *pRExC_state -Es |void |scan_commit |NN const struct RExC_state_t *pRExC_state \ - |NN struct scan_data_t *data|NN I32 *minlenp \ + |UV code_point|bool downgradable +Ei |U8 |compute_EXACTish|NN RExC_state_t *pRExC_state +Es |char * |nextchar |NN RExC_state_t *pRExC_state +Es |bool |reg_skipcomment|NN RExC_state_t *pRExC_state +Es |void |scan_commit |NN const RExC_state_t *pRExC_state \ + |NN struct scan_data_t *data \ + |NN SSize_t *minlenp \ |int is_inf -Esn |void |cl_anything |NN const struct RExC_state_t *pRExC_state \ - |NN struct regnode_charclass_class *cl -EsRn |int |cl_is_anything |NN const struct regnode_charclass_class *cl -Esn |void |cl_init |NN const struct RExC_state_t *pRExC_state \ - |NN struct regnode_charclass_class *cl -Esn |void |cl_and |NN struct regnode_charclass_class *cl \ - |NN const struct regnode_charclass_class *and_with -Esn |void |cl_or |NN const struct RExC_state_t *pRExC_state \ - |NN struct regnode_charclass_class *cl \ - |NN const struct regnode_charclass_class *or_with -Es |I32 |study_chunk |NN struct RExC_state_t *pRExC_state \ - |NN regnode **scanp|NN I32 *minlenp \ - |NN I32 *deltap|NN regnode *last \ +Es |void |populate_ANYOF_from_invlist|NN regnode *node|NN SV** invlist_ptr +Es |void |ssc_anything |NN regnode_ssc *ssc +EsR |int |ssc_is_anything|NN const regnode_ssc *ssc +Es |void |ssc_init |NN const RExC_state_t *pRExC_state \ + |NN regnode_ssc *ssc +EsR |int |ssc_is_cp_posixl_init|NN const RExC_state_t *pRExC_state \ + |NN const regnode_ssc *ssc +Es |void |ssc_and |NN const RExC_state_t *pRExC_state \ + |NN regnode_ssc *ssc \ + |NN const regnode_charclass *and_with +Es |void |ssc_or |NN const RExC_state_t *pRExC_state \ + |NN regnode_ssc *ssc \ + |NN const regnode_charclass *or_with +Es |SV* |get_ANYOF_cp_list_for_ssc \ + |NN const RExC_state_t *pRExC_state \ + |NN const regnode_charclass* const node +Ei |void |ssc_intersection|NN regnode_ssc *ssc \ + |NN SV* const invlist|const bool invert_2nd +Ei |void |ssc_union |NN regnode_ssc *ssc \ + |NN SV* const invlist|const bool invert_2nd +Ei |void |ssc_add_range |NN regnode_ssc *ssc \ + |UV const start|UV const end +Ei |void |ssc_cp_and |NN regnode_ssc *ssc \ + |UV const cp +Ei |void |ssc_clear_locale|NN regnode_ssc *ssc +Es |void |ssc_finalize |NN RExC_state_t *pRExC_state \ + |NN regnode_ssc *ssc +Es |SSize_t|study_chunk |NN RExC_state_t *pRExC_state \ + |NN regnode **scanp|NN SSize_t *minlenp \ + |NN SSize_t *deltap|NN regnode *last \ |NULLOK struct scan_data_t *data \ - |I32 stopparen|NULLOK U8* recursed \ - |NULLOK struct regnode_charclass_class *and_withp \ + |I32 stopparen|U32 recursed_depth \ + |NULLOK regnode_ssc *and_withp \ |U32 flags|U32 depth -EsRn |U32 |add_data |NN struct RExC_state_t *pRExC_state|U32 n \ - |NN const char *s -rs |void |re_croak2 |NN const char* pat1|NN const char* pat2|... -Ei |I32 |regpposixcc |NN struct RExC_state_t *pRExC_state \ +EsRn |U32 |add_data |NN RExC_state_t* const pRExC_state \ + |NN const char* const s|const U32 n +rs |void |re_croak2 |bool utf8|NN const char* pat1|NN const char* pat2|... +Ei |I32 |regpposixcc |NN RExC_state_t *pRExC_state \ |I32 value|const bool strict -Es |I32 |make_trie |NN struct RExC_state_t *pRExC_state \ +Es |I32 |make_trie |NN RExC_state_t *pRExC_state \ |NN regnode *startbranch|NN regnode *first \ |NN regnode *last|NN regnode *tail \ |U32 word_count|U32 flags|U32 depth -Es |void |make_trie_failtable |NN struct RExC_state_t *pRExC_state \ +Es |void |make_trie_failtable |NN RExC_state_t *pRExC_state \ |NN regnode *source|NN regnode *stclass \ |U32 depth # ifdef DEBUGGING +Es |void |regdump_intflags|NULLOK const char *lead| const U32 flags Es |void |regdump_extflags|NULLOK const char *lead| const U32 flags Es |const regnode*|dumpuntil|NN const regexp *r|NN const regnode *start \ |NN const regnode *node \ @@ -2054,6 +2160,8 @@ Es |const regnode*|dumpuntil|NN const re |NULLOK const regnode *plast \ |NN SV* sv|I32 indent|U32 depth Es |void |put_byte |NN SV* sv|int c +Es |bool |put_latin1_charclass_innards|NN SV* sv|NN char* bitmap +Es |void |put_range |NN SV* sv|UV start|UV end Es |void |dump_trie |NN const struct _reg_trie_data *trie\ |NULLOK HV* widecharmap|NN AV *revcharmap\ |U32 depth @@ -2063,7 +2171,7 @@ Es |void |dump_trie_interim_list|NN cons Es |void |dump_trie_interim_table|NN const struct _reg_trie_data *trie\ |NULLOK HV* widecharmap|NN AV *revcharmap\ |U32 next_alloc|U32 depth -Es |U8 |regtail_study |NN struct RExC_state_t *pRExC_state \ +Es |U8 |regtail_study |NN RExC_state_t *pRExC_state \ |NN regnode *p|NN const regnode *val|U32 depth # endif #endif @@ -2071,30 +2179,29 @@ Es |U8 |regtail_study |NN struct RExC_st #if defined(PERL_IN_REGEXEC_C) ERs |bool |isFOO_lc |const U8 classnum|const U8 character ERs |bool |isFOO_utf8_lc |const U8 classnum|NN const U8* character -ERs |I32 |regmatch |NN regmatch_info *reginfo|NN char *startpos|NN regnode *prog +ERs |SSize_t|regmatch |NN regmatch_info *reginfo|NN char *startpos|NN regnode *prog ERs |I32 |regrepeat |NN regexp *prog|NN char **startposp \ - |NN const regnode *p|I32 max|int depth \ - |bool is_utf8_pat + |NN const regnode *p \ + |NN regmatch_info *const reginfo \ + |I32 max \ + |int depth ERs |I32 |regtry |NN regmatch_info *reginfo|NN char **startposp -ERs |bool |reginclass |NULLOK regexp * const prog|NN const regnode * const n|NN const U8 * const p\ +ERs |bool |reginclass |NULLOK regexp * const prog \ + |NN const regnode * const n \ + |NN const U8 * const p \ + |NN const U8 * const p_end \ |bool const utf8_target Es |CHECKPOINT|regcppush |NN const regexp *rex|I32 parenfloor\ |U32 maxopenparen Es |void |regcppop |NN regexp *rex\ |NN U32 *maxopenparen_p -ERsn |U8* |reghop3 |NN U8 *s|I32 off|NN const U8 *lim -ERsM |SV* |core_regclass_swash|NULLOK const regexp *prog \ - |NN const struct regnode *node|bool doinit \ - |NULLOK SV **listsvp -#ifdef XXX_dmq -ERsn |U8* |reghop4 |NN U8 *s|I32 off|NN const U8 *llim \ +ERsn |U8* |reghop3 |NN U8 *s|SSize_t off|NN const U8 *lim +ERsn |U8* |reghop4 |NN U8 *s|SSize_t off|NN const U8 *llim \ |NN const U8 *rlim -#endif -ERsn |U8* |reghopmaybe3 |NN U8 *s|I32 off|NN const U8 *lim +ERsn |U8* |reghopmaybe3 |NN U8 *s|SSize_t off|NN const U8 *lim ERs |char* |find_byclass |NN regexp * prog|NN const regnode *c \ |NN char *s|NN const char *strend \ - |NULLOK regmatch_info *reginfo \ - |bool is_utf_pat + |NULLOK regmatch_info *reginfo Es |void |to_utf8_substr |NN regexp * prog Es |bool |to_byte_substr |NN regexp * prog ERs |I32 |reg_check_named_buff_matched |NN const regexp *rex \ @@ -2191,28 +2298,28 @@ s |void |force_next |I32 type s |char* |force_version |NN char *s|int guessing s |char* |force_strict_version |NN char *s s |char* |force_word |NN char *start|int token|int check_keyword \ - |int allow_pack|int allow_tick + |int allow_pack s |SV* |tokeq |NN SV *sv -s |void |readpipe_override| sR |char* |scan_const |NN char *start iR |SV* |get_and_check_backslash_N_name|NN const char* s \ |NN const char* const e sR |char* |scan_formline |NN char *s sR |char* |scan_heredoc |NN char *s -s |char* |scan_ident |NN char *s|NN const char *send|NN char *dest \ +s |char* |scan_ident |NN char *s|NN char *dest \ |STRLEN destlen|I32 ck_uni sR |char* |scan_inputsymbol|NN char *start sR |char* |scan_pat |NN char *start|I32 type sR |char* |scan_str |NN char *start|int keep_quoted \ |int keep_delims|int re_reparse \ - |bool deprecate_escaped_matching + |bool deprecate_escaped_matching \ + |NULLOK char **delimp sR |char* |scan_subst |NN char *start sR |char* |scan_trans |NN char *start s |char* |scan_word |NN char *s|NN char *dest|STRLEN destlen \ |int allow_package|NN STRLEN *slp s |void |update_debugger_info|NULLOK SV *orig_sv \ |NULLOK const char *const buf|STRLEN len -sR |char* |skipspace |NN char *s +sR |char* |skipspace_flags|NN char *s|U32 flags sR |char* |swallow_bom |NN U8 *s #ifndef PERL_NO_UTF16_FILTER s |I32 |utf16_textfilter|int idx|NN SV *sv|int maxlen @@ -2250,25 +2357,24 @@ s |void |strip_return |NN SV *sv # endif # if defined(DEBUGGING) s |int |tokereport |I32 rv|NN const YYSTYPE* lvalp -s |void |printbuf |NN const char *const fmt|NN const char *const s +sf |void |printbuf |NN const char *const fmt|NN const char *const s # endif #endif +EXMp |bool |validate_proto |NN SV *name|NULLOK SV *proto|bool warn #if defined(PERL_IN_UNIVERSAL_C) -s |bool|isa_lookup |NN HV *stash|NN const char * const name \ +s |bool |isa_lookup |NN HV *stash|NN const char * const name \ |STRLEN len|U32 flags #endif -#if defined(PERL_IN_LOCALE_C) -#if defined(USE_LOCALE_NUMERIC) || defined(USE_LOCALE_COLLATE) +#if defined(PERL_IN_LOCALE_C) && defined(USE_LOCALE) s |char* |stdize_locale |NN char* locs -#endif +s |bool |is_cur_LC_category_utf8|int category #endif #if defined(PERL_IN_UTIL_C) -s |const COP*|closest_cop |NN const COP *cop|NULLOK const OP *o s |SV* |mess_alloc -s |SV *|with_queued_errors|NN SV *ex +s |SV * |with_queued_errors|NN SV *ex s |bool |invoke_exception_hook|NULLOK SV *ex|bool warn #if defined(PERL_MEM_LOG) && !defined(PERL_MEM_LOG_NOIMPL) sn |void |mem_log_common |enum mem_log_type mlt|const UV n|const UV typesize \ @@ -2286,10 +2392,12 @@ sn |NV|mulexp10 |NV value|I32 exponent #if defined(PERL_IN_UTF8_C) iRn |STRLEN |is_utf8_char_slow|NN const U8 *s|const STRLEN len sRM |UV |check_locale_boundary_crossing|NN const U8* const p|const UV result|NN U8* const ustrp|NN STRLEN *lenp -iR |bool |is_utf8_common |NN const U8 *const p|NN SV **swash|NN const char * const swashname +iR |bool |is_utf8_common |NN const U8 *const p|NN SV **swash|NN const char * const swashname|NULLOK SV* const invlist sR |SV* |swatch_get |NN SV* swash|UV start|UV span #endif +AiMn |void |append_utf8_from_native_byte|const U8 byte|NN U8** dest + Apd |void |sv_setsv_flags |NN SV *dstr|NULLOK SV *sstr|const I32 flags Apd |void |sv_catpvn_flags|NN SV *const dstr|NN const char *sstr|const STRLEN len \ |const I32 flags @@ -2312,7 +2420,7 @@ pMXE |SV* |sv_setsv_cow |NULLOK SV* dstr Aop |const char *|PerlIO_context_layers|NULLOK const char *mode -#if defined(USE_PERLIO) && !defined(USE_SFIO) +#if defined(USE_PERLIO) Ap |int |PerlIO_close |NULLOK PerlIO *f Ap |int |PerlIO_fill |NULLOK PerlIO *f Ap |int |PerlIO_fileno |NULLOK PerlIO *f @@ -2320,9 +2428,9 @@ Ap |int |PerlIO_eof |NULLOK PerlIO *f Ap |int |PerlIO_error |NULLOK PerlIO *f Ap |int |PerlIO_flush |NULLOK PerlIO *f Ap |void |PerlIO_clearerr |NULLOK PerlIO *f -Ap |void |PerlIO_set_cnt |NULLOK PerlIO *f|int cnt +Ap |void |PerlIO_set_cnt |NULLOK PerlIO *f|SSize_t cnt Ap |void |PerlIO_set_ptrcnt |NULLOK PerlIO *f|NULLOK STDCHAR *ptr \ - |int cnt + |SSize_t cnt Ap |void |PerlIO_setlinebuf |NULLOK PerlIO *f Ap |SSize_t|PerlIO_read |NULLOK PerlIO *f|NN void *vbuf \ |Size_t count @@ -2335,8 +2443,8 @@ Ap |int |PerlIO_seek |NULLOK PerlIO *f| Ap |STDCHAR *|PerlIO_get_base |NULLOK PerlIO *f Ap |STDCHAR *|PerlIO_get_ptr |NULLOK PerlIO *f -ApR |int |PerlIO_get_bufsiz |NULLOK PerlIO *f -ApR |int |PerlIO_get_cnt |NULLOK PerlIO *f +ApR |SSize_t |PerlIO_get_bufsiz |NULLOK PerlIO *f +ApR |SSize_t |PerlIO_get_cnt |NULLOK PerlIO *f ApR |PerlIO *|PerlIO_stdin ApR |PerlIO *|PerlIO_stdout @@ -2448,7 +2556,7 @@ poM |AV** |hv_backreferences_p |NN HV *h poM |void |hv_kill_backrefs |NN HV *hv #endif Apd |void |hv_clear_placeholders |NN HV *hv -ApoR |I32* |hv_placeholders_p |NN HV *hv +XpoR |SSize_t*|hv_placeholders_p |NN HV *hv ApoR |I32 |hv_placeholders_get |NN const HV *hv Apo |void |hv_placeholders_set |NN HV *hv|I32 ph @@ -2464,84 +2572,6 @@ sMd |SV* |find_uninit_var|NULLOK const O |NULLOK const SV *const uninit_sv|bool top #endif -#ifdef PERL_NEED_MY_HTOLE16 -np |U16 |my_htole16 |U16 n -#endif -#ifdef PERL_NEED_MY_LETOH16 -np |U16 |my_letoh16 |U16 n -#endif -#ifdef PERL_NEED_MY_HTOBE16 -np |U16 |my_htobe16 |U16 n -#endif -#ifdef PERL_NEED_MY_BETOH16 -np |U16 |my_betoh16 |U16 n -#endif -#ifdef PERL_NEED_MY_HTOLE32 -np |U32 |my_htole32 |U32 n -#endif -#ifdef PERL_NEED_MY_LETOH32 -np |U32 |my_letoh32 |U32 n -#endif -#ifdef PERL_NEED_MY_HTOBE32 -np |U32 |my_htobe32 |U32 n -#endif -#ifdef PERL_NEED_MY_BETOH32 -np |U32 |my_betoh32 |U32 n -#endif -#ifdef PERL_NEED_MY_HTOLE64 -np |U64 |my_htole64 |U64 n -#endif -#ifdef PERL_NEED_MY_LETOH64 -np |U64 |my_letoh64 |U64 n -#endif -#ifdef PERL_NEED_MY_HTOBE64 -np |U64 |my_htobe64 |U64 n -#endif -#ifdef PERL_NEED_MY_BETOH64 -np |U64 |my_betoh64 |U64 n -#endif - -#ifdef PERL_NEED_MY_HTOLES -np |short |my_htoles |short n -#endif -#ifdef PERL_NEED_MY_LETOHS -np |short |my_letohs |short n -#endif -#ifdef PERL_NEED_MY_HTOBES -np |short |my_htobes |short n -#endif -#ifdef PERL_NEED_MY_BETOHS -np |short |my_betohs |short n -#endif -#ifdef PERL_NEED_MY_HTOLEI -np |int |my_htolei |int n -#endif -#ifdef PERL_NEED_MY_LETOHI -np |int |my_letohi |int n -#endif -#ifdef PERL_NEED_MY_HTOBEI -np |int |my_htobei |int n -#endif -#ifdef PERL_NEED_MY_BETOHI -np |int |my_betohi |int n -#endif -#ifdef PERL_NEED_MY_HTOLEL -np |long |my_htolel |long n -#endif -#ifdef PERL_NEED_MY_LETOHL -np |long |my_letohl |long n -#endif -#ifdef PERL_NEED_MY_HTOBEL -np |long |my_htobel |long n -#endif -#ifdef PERL_NEED_MY_BETOHL -np |long |my_betohl |long n -#endif - -: I think that these are only used by the above, which are macros, and in turn -: currently they are only used in pp_pack.c, but this is in util.c -np |void |my_swabn |NN void* ptr|int n - Ap |GV* |gv_fetchpvn_flags|NN const char* name|STRLEN len|I32 flags|const svtype sv_type Ap |GV* |gv_fetchsv|NN SV *name|I32 flags|const svtype sv_type @@ -2591,11 +2621,11 @@ Xpo |void |xs_apiversion_bootcheck|NN SV |STRLEN api_len #ifndef HAS_STRLCAT -Apno |Size_t |my_strlcat |NULLOK char *dst|NULLOK const char *src|Size_t size +Apnod |Size_t |my_strlcat |NULLOK char *dst|NULLOK const char *src|Size_t size #endif #ifndef HAS_STRLCPY -Apno |Size_t |my_strlcpy |NULLOK char *dst|NULLOK const char *src|Size_t size +Apnod |Size_t |my_strlcpy |NULLOK char *dst|NULLOK const char *src|Size_t size #endif #ifdef PERL_MAD @@ -2680,7 +2710,8 @@ sd |AV* |mro_get_linear_isa_dfs|NN HV* s s |void |mro_clean_isarev|NN HV * const isa \ |NN const char * const name \ |const STRLEN len \ - |NULLOK HV * const exceptions|U32 flags + |NULLOK HV * const exceptions \ + |U32 hash|U32 flags s |void |mro_gather_and_rename|NN HV * const stashes \ |NN HV * const seen_stashes \ |NULLOK HV *stash \ @@ -2719,5 +2750,12 @@ op |void |populate_isa |NN const char *n : Used in keywords.c and toke.c Xop |bool |feature_is_enabled|NN const char *const name \ |STRLEN namelen + +: Some static inline functions need predeclaration because they are used +: inside other static inline functions. +#if defined(PERL_CORE) || defined (PERL_EXT) +Ei |STRLEN |sv_or_pv_pos_u2b|NN SV *sv|NN const char *pv|STRLEN pos \ + |NULLOK STRLEN *lenp +#endif : ex: set ts=8 sts=4 sw=4 noet: Index: gnu/usr.bin/perl/embed.h =================================================================== RCS file: /mnt/memory/perl/importit/cvs/src/gnu/usr.bin/perl/embed.h,v retrieving revision 1.16 diff -u -p -u -p -r1.16 embed.h --- gnu/usr.bin/perl/embed.h 24 Mar 2014 15:05:13 -0000 1.16 +++ gnu/usr.bin/perl/embed.h 16 Nov 2014 03:22:24 -0000 @@ -35,12 +35,13 @@ #define _is_utf8_perl_idcont(a) Perl__is_utf8_perl_idcont(aTHX_ a) #define _is_utf8_perl_idstart(a) Perl__is_utf8_perl_idstart(aTHX_ a) #define _to_uni_fold_flags(a,b,c,d) Perl__to_uni_fold_flags(aTHX_ a,b,c,d) -#define _to_utf8_fold_flags(a,b,c,d,e) Perl__to_utf8_fold_flags(aTHX_ a,b,c,d,e) -#define _to_utf8_lower_flags(a,b,c,d,e) Perl__to_utf8_lower_flags(aTHX_ a,b,c,d,e) -#define _to_utf8_title_flags(a,b,c,d,e) Perl__to_utf8_title_flags(aTHX_ a,b,c,d,e) -#define _to_utf8_upper_flags(a,b,c,d,e) Perl__to_utf8_upper_flags(aTHX_ a,b,c,d,e) +#define _to_utf8_fold_flags(a,b,c,d) Perl__to_utf8_fold_flags(aTHX_ a,b,c,d) +#define _to_utf8_lower_flags(a,b,c,d) Perl__to_utf8_lower_flags(aTHX_ a,b,c,d) +#define _to_utf8_title_flags(a,b,c,d) Perl__to_utf8_title_flags(aTHX_ a,b,c,d) +#define _to_utf8_upper_flags(a,b,c,d) Perl__to_utf8_upper_flags(aTHX_ a,b,c,d) #define amagic_call(a,b,c,d) Perl_amagic_call(aTHX_ a,b,c,d) #define amagic_deref_call(a,b) Perl_amagic_deref_call(aTHX_ a,b) +#define append_utf8_from_native_byte S_append_utf8_from_native_byte #define apply_attrs_string(a,b,c,d) Perl_apply_attrs_string(aTHX_ a,b,c,d) #define atfork_lock Perl_atfork_lock #define atfork_unlock Perl_atfork_unlock @@ -84,6 +85,7 @@ #ifndef PERL_IMPLICIT_CONTEXT #define croak Perl_croak #endif +#define croak_memory_wrap S_croak_memory_wrap #define croak_no_modify Perl_croak_no_modify #define croak_sv(a) Perl_croak_sv(aTHX_ a) #define croak_xs_usage Perl_croak_xs_usage @@ -229,6 +231,7 @@ #define instr Perl_instr #define is_ascii_string Perl_is_ascii_string #define is_lvalue_sub() Perl_is_lvalue_sub(aTHX) +#define is_safe_syscall(a,b,c,d) S_is_safe_syscall(aTHX_ a,b,c,d) #define is_uni_alnum(a) Perl_is_uni_alnum(aTHX_ a) #define is_uni_alnum_lc(a) Perl_is_uni_alnum_lc(aTHX_ a) #define is_uni_alnumc(a) Perl_is_uni_alnumc(aTHX_ a) @@ -340,7 +343,6 @@ #define newANONLIST(a) Perl_newANONLIST(aTHX_ a) #define newANONSUB(a,b,c) Perl_newANONSUB(aTHX_ a,b,c) #define newASSIGNOP(a,b,c,d) Perl_newASSIGNOP(aTHX_ a,b,c,d) -#define newATTRSUB(a,b,c,d,e) Perl_newATTRSUB(aTHX_ a,b,c,d,e) #define newAVREF(a) Perl_newAVREF(aTHX_ a) #define newBINOP(a,b,c,d) Perl_newBINOP(aTHX_ a,b,c,d) #define newCONDOP(a,b,c,d) Perl_newCONDOP(aTHX_ a,b,c,d) @@ -451,7 +453,7 @@ #define pv_pretty(a,b,c,d,e,f,g) Perl_pv_pretty(aTHX_ a,b,c,d,e,f,g) #define pv_uni_display(a,b,c,d,e) Perl_pv_uni_display(aTHX_ a,b,c,d,e) #define re_compile(a,b) Perl_re_compile(aTHX_ a,b) -#define re_intuit_start(a,b,c,d,e,f) Perl_re_intuit_start(aTHX_ a,b,c,d,e,f) +#define re_intuit_start(a,b,c,d,e,f,g) Perl_re_intuit_start(aTHX_ a,b,c,d,e,f,g) #define re_intuit_string(a) Perl_re_intuit_string(aTHX_ a) #define reentrant_free() Perl_reentrant_free(aTHX) #define reentrant_init() Perl_reentrant_init(aTHX) @@ -607,6 +609,7 @@ #define sv_nv(a) Perl_sv_nv(aTHX_ a) #define sv_peek(a) Perl_sv_peek(aTHX_ a) #define sv_pos_b2u(a,b) Perl_sv_pos_b2u(aTHX_ a,b) +#define sv_pos_b2u_flags(a,b,c) Perl_sv_pos_b2u_flags(aTHX_ a,b,c) #define sv_pos_u2b(a,b,c) Perl_sv_pos_u2b(aTHX_ a,b,c) #define sv_pos_u2b_flags(a,b,c,d) Perl_sv_pos_u2b_flags(aTHX_ a,b,c,d) #define sv_pvbyten(a,b) Perl_sv_pvbyten(aTHX_ a,b) @@ -689,12 +692,14 @@ #define utf8_length(a,b) Perl_utf8_length(aTHX_ a,b) #define utf8_to_bytes(a,b) Perl_utf8_to_bytes(aTHX_ a,b) #define utf8_to_uvchr(a,b) Perl_utf8_to_uvchr(aTHX_ a,b) -#define utf8_to_uvchr_buf(a,b,c) Perl_utf8_to_uvchr_buf(aTHX_ a,b,c) #define utf8_to_uvuni(a,b) Perl_utf8_to_uvuni(aTHX_ a,b) #define utf8_to_uvuni_buf(a,b,c) Perl_utf8_to_uvuni_buf(aTHX_ a,b,c) +#define utf8n_to_uvchr(a,b,c,d) Perl_utf8n_to_uvchr(aTHX_ a,b,c,d) #define utf8n_to_uvuni(a,b,c,d) Perl_utf8n_to_uvuni(aTHX_ a,b,c,d) -#define uvchr_to_utf8_flags(a,b,c) Perl_uvchr_to_utf8_flags(aTHX_ a,b,c) +#define uvoffuni_to_utf8_flags(a,b,c) Perl_uvoffuni_to_utf8_flags(aTHX_ a,b,c) +#define uvuni_to_utf8(a,b) Perl_uvuni_to_utf8(aTHX_ a,b) #define uvuni_to_utf8_flags(a,b,c) Perl_uvuni_to_utf8_flags(aTHX_ a,b,c) +#define valid_utf8_to_uvchr(a,b) Perl_valid_utf8_to_uvchr(aTHX_ a,b) #define valid_utf8_to_uvuni(a,b) Perl_valid_utf8_to_uvuni(aTHX_ a,b) #define vcmp(a,b) Perl_vcmp(aTHX_ a,b) #define vcroak(a,b) Perl_vcroak(aTHX_ a,b) @@ -752,14 +757,6 @@ #define pad_setsv(a,b) Perl_pad_setsv(aTHX_ a,b) #define pad_sv(a) Perl_pad_sv(aTHX_ a) #endif -#if defined(DUMP_FDS) -#define dump_fds(a) Perl_dump_fds(aTHX_ a) -#endif -#if defined(EBCDIC) -#define utf8n_to_uvchr(a,b,c,d) Perl_utf8n_to_uvchr(aTHX_ a,b,c,d) -#define uvchr_to_utf8(a,b) Perl_uvchr_to_utf8(aTHX_ a,b) -#define valid_utf8_to_uvchr(a,b) Perl_valid_utf8_to_uvchr(aTHX_ a,b) -#endif #if defined(HAS_SIGACTION) && defined(SA_SIGINFO) #define csighandler Perl_csighandler #endif @@ -774,11 +771,6 @@ #define dump_mstats(a) Perl_dump_mstats(aTHX_ a) #define get_mstats(a,b,c) Perl_get_mstats(aTHX_ a,b,c) #endif -#if defined(MYSWAP) -#define my_htonl(a) Perl_my_htonl(aTHX_ a) -#define my_ntohl(a) Perl_my_ntohl(aTHX_ a) -#define my_swap(a) Perl_my_swap(aTHX_ a) -#endif #if defined(PERL_GLOBAL_STRUCT) #define GetVars() Perl_GetVars(aTHX) #define free_global_struct(a) Perl_free_global_struct(aTHX_ a) @@ -801,6 +793,12 @@ #define warn_nocontext Perl_warn_nocontext #define warner_nocontext Perl_warner_nocontext #endif +#if defined(PERL_IN_REGCOMP_C) || defined(PERL_IN_PERL_C) || defined(PERL_IN_UTF8_C) +#define _new_invlist_C_array(a) Perl__new_invlist_C_array(aTHX_ a) +#endif +#if defined(PERL_IN_REGCOMP_C) || defined(PERL_IN_REGEXEC_C) +#define _get_regclass_nonbitmap_data(a,b,c,d,e) Perl__get_regclass_nonbitmap_data(aTHX_ a,b,c,d,e) +#endif #if defined(PERL_MAD) #define newFORM(a,b,c) Perl_newFORM(aTHX_ a,b,c) #endif @@ -830,7 +828,7 @@ #if defined(USE_LOCALE_COLLATE) #define sv_collxfrm_flags(a,b,c) Perl_sv_collxfrm_flags(aTHX_ a,b,c) #endif -#if defined(USE_PERLIO) && !defined(USE_SFIO) +#if defined(USE_PERLIO) #define PerlIO_clearerr(a) Perl_PerlIO_clearerr(aTHX_ a) #define PerlIO_close(a) Perl_PerlIO_close(aTHX_ a) #define PerlIO_eof(a) Perl_PerlIO_eof(aTHX_ a) @@ -854,6 +852,9 @@ #define PerlIO_unread(a,b,c) Perl_PerlIO_unread(aTHX_ a,b,c) #define PerlIO_write(a,b,c) Perl_PerlIO_write(aTHX_ a,b,c) #endif +#if defined(WIN32) +#define my_setlocale(a,b) Perl_my_setlocale(aTHX_ a,b) +#endif #if defined(WIN32) || defined(__SYMBIAN32__) || defined(VMS) #define do_aspawn(a,b,c) Perl_do_aspawn(aTHX_ a,b,c) #define do_spawn(a) Perl_do_spawn(aTHX_ a) @@ -862,6 +863,8 @@ #if defined(PERL_CORE) || defined(PERL_EXT) #define av_reify(a) Perl_av_reify(aTHX_ a) #define current_re_engine() Perl_current_re_engine(aTHX) +#define cv_ckproto_len_flags(a,b,c,d,e) Perl_cv_ckproto_len_flags(aTHX_ a,b,c,d,e) +#define mg_find_mglob(a) Perl_mg_find_mglob(aTHX_ a) #define op_clear(a) Perl_op_clear(aTHX_ a) #define qerror(a) Perl_qerror(aTHX_ a) #define reg_named_buff(a,b,c,d) Perl_reg_named_buff(aTHX_ a,b,c,d) @@ -871,8 +874,10 @@ #define reg_numbered_buff_store(a,b,c) Perl_reg_numbered_buff_store(aTHX_ a,b,c) #define reg_qr_package(a) Perl_reg_qr_package(aTHX_ a) #define reg_temp_copy(a,b) Perl_reg_temp_copy(aTHX_ a,b) -#define regprop(a,b,c) Perl_regprop(aTHX_ a,b,c) +#define regprop(a,b,c,d) Perl_regprop(aTHX_ a,b,c,d) #define report_uninit(a) Perl_report_uninit(aTHX_ a) +#define sv_magicext_mglob(a) Perl_sv_magicext_mglob(aTHX_ a) +#define validate_proto(a,b,c) Perl_validate_proto(aTHX_ a,b,c) #define vivify_defelem(a) Perl_vivify_defelem(aTHX_ a) #define yylex() Perl_yylex(aTHX) # if defined(DEBUGGING) @@ -882,7 +887,10 @@ #define dump_trie_interim_table(a,b,c,d,e) S_dump_trie_interim_table(aTHX_ a,b,c,d,e) #define dumpuntil(a,b,c,d,e,f,g,h) S_dumpuntil(aTHX_ a,b,c,d,e,f,g,h) #define put_byte(a,b) S_put_byte(aTHX_ a,b) +#define put_latin1_charclass_innards(a,b) S_put_latin1_charclass_innards(aTHX_ a,b) +#define put_range(a,b,c) S_put_range(aTHX_ a,b,c) #define regdump_extflags(a,b) S_regdump_extflags(aTHX_ a,b) +#define regdump_intflags(a,b) S_regdump_intflags(aTHX_ a,b) #define regtail_study(a,b,c,d) S_regtail_study(aTHX_ a,b,c,d) # endif # if defined(PERL_IN_REGEXEC_C) @@ -893,24 +901,20 @@ # if defined(PERL_ANY_COW) #define sv_setsv_cow(a,b) Perl_sv_setsv_cow(aTHX_ a,b) # endif +# if defined(PERL_CORE) || defined (PERL_EXT) +#define sv_or_pv_pos_u2b(a,b,c,d) S_sv_or_pv_pos_u2b(aTHX_ a,b,c,d) +# endif # if defined(PERL_IN_REGCOMP_C) #define _append_range_to_invlist(a,b,c) S__append_range_to_invlist(aTHX_ a,b,c) #define _invlist_array_init(a,b) S__invlist_array_init(aTHX_ a,b) -#define _new_invlist_C_array(a) S__new_invlist_C_array(aTHX_ a) #define add_cp_to_invlist(a,b) S_add_cp_to_invlist(aTHX_ a,b) #define add_data S_add_data -#define alloc_maybe_populate_EXACT(a,b,c,d,e) S_alloc_maybe_populate_EXACT(aTHX_ a,b,c,d,e) -#define cl_and S_cl_and -#define cl_anything S_cl_anything -#define cl_init S_cl_init -#define cl_is_anything S_cl_is_anything -#define cl_or S_cl_or +#define alloc_maybe_populate_EXACT(a,b,c,d,e,f) S_alloc_maybe_populate_EXACT(aTHX_ a,b,c,d,e,f) #define compute_EXACTish(a) S_compute_EXACTish(aTHX_ a) #define could_it_be_a_POSIX_class(a) S_could_it_be_a_POSIX_class(aTHX_ a) +#define get_ANYOF_cp_list_for_ssc(a,b) S_get_ANYOF_cp_list_for_ssc(aTHX_ a,b) #define get_invlist_iter_addr(a) S_get_invlist_iter_addr(aTHX_ a) #define get_invlist_previous_index_addr(a) S_get_invlist_previous_index_addr(aTHX_ a) -#define get_invlist_version_id_addr(a) S_get_invlist_version_id_addr(aTHX_ a) -#define get_invlist_zero_addr(a) S_get_invlist_zero_addr(aTHX_ a) #define grok_bslash_N(a,b,c,d,e,f,g) S_grok_bslash_N(aTHX_ a,b,c,d,e,f,g) #define handle_regex_sets(a,b,c,d,e) S_handle_regex_sets(aTHX_ a,b,c,d,e) #define invlist_array(a) S_invlist_array(aTHX_ a) @@ -923,7 +927,7 @@ #define invlist_iternext(a,b,c) S_invlist_iternext(aTHX_ a,b,c) #define invlist_max(a) S_invlist_max(aTHX_ a) #define invlist_previous_index(a) S_invlist_previous_index(aTHX_ a) -#define invlist_set_len(a,b) S_invlist_set_len(aTHX_ a,b) +#define invlist_set_len(a,b,c) S_invlist_set_len(aTHX_ a,b,c) #define invlist_set_previous_index(a,b) S_invlist_set_previous_index(aTHX_ a,b) #define invlist_trim(a) S_invlist_trim(aTHX_ a) #define join_exact(a,b,c,d,e,f,g) S_join_exact(aTHX_ a,b,c,d,e,f,g) @@ -931,6 +935,7 @@ #define make_trie_failtable(a,b,c,d) S_make_trie_failtable(aTHX_ a,b,c,d) #define nextchar(a) S_nextchar(aTHX_ a) #define parse_lparen_question_flags(a) S_parse_lparen_question_flags(aTHX_ a) +#define populate_ANYOF_from_invlist(a,b) S_populate_ANYOF_from_invlist(aTHX_ a,b) #define reg(a,b,c,d) S_reg(aTHX_ a,b,c,d) #define reg_node(a,b) S_reg_node(aTHX_ a,b) #define reg_recode(a,b) S_reg_recode(aTHX_ a,b) @@ -948,23 +953,39 @@ #define reguni(a,b,c) S_reguni(aTHX_ a,b,c) #define regwhite S_regwhite #define scan_commit(a,b,c,d) S_scan_commit(aTHX_ a,b,c,d) +#define set_ANYOF_arg(a,b,c,d,e,f,g) S_set_ANYOF_arg(aTHX_ a,b,c,d,e,f,g) +#define ssc_add_range(a,b,c) S_ssc_add_range(aTHX_ a,b,c) +#define ssc_and(a,b,c) S_ssc_and(aTHX_ a,b,c) +#define ssc_anything(a) S_ssc_anything(aTHX_ a) +#define ssc_clear_locale(a) S_ssc_clear_locale(aTHX_ a) +#define ssc_cp_and(a,b) S_ssc_cp_and(aTHX_ a,b) +#define ssc_finalize(a,b) S_ssc_finalize(aTHX_ a,b) +#define ssc_init(a,b) S_ssc_init(aTHX_ a,b) +#define ssc_intersection(a,b,c) S_ssc_intersection(aTHX_ a,b,c) +#define ssc_is_anything(a) S_ssc_is_anything(aTHX_ a) +#define ssc_is_cp_posixl_init(a,b) S_ssc_is_cp_posixl_init(aTHX_ a,b) +#define ssc_or(a,b,c) S_ssc_or(aTHX_ a,b,c) +#define ssc_union(a,b,c) S_ssc_union(aTHX_ a,b,c) #define study_chunk(a,b,c,d,e,f,g,h,i,j,k) S_study_chunk(aTHX_ a,b,c,d,e,f,g,h,i,j,k) # endif +# if defined(PERL_IN_REGCOMP_C) || defined (PERL_IN_DUMP_C) +#define _invlist_dump(a,b,c,d) Perl__invlist_dump(aTHX_ a,b,c,d) +# endif # if defined(PERL_IN_REGCOMP_C) || defined(PERL_IN_REGEXEC_C) || defined(PERL_IN_UTF8_C) -#define _get_invlist_len_addr(a) S__get_invlist_len_addr(aTHX_ a) #define _get_swash_invlist(a) Perl__get_swash_invlist(aTHX_ a) #define _invlist_contains_cp(a,b) S__invlist_contains_cp(aTHX_ a,b) #define _invlist_contents(a) Perl__invlist_contents(aTHX_ a) #define _invlist_len(a) S__invlist_len(aTHX_ a) #define _invlist_search(a,b) Perl__invlist_search(aTHX_ a,b) #define _swash_inversion_hash(a) Perl__swash_inversion_hash(aTHX_ a) +#define get_invlist_offset_addr(a) S_get_invlist_offset_addr(aTHX_ a) # endif # if defined(PERL_IN_REGCOMP_C) || defined(PERL_IN_REGEXEC_C) || defined(PERL_IN_UTF8_C) || defined(PERL_IN_TOKE_C) #define _core_swash_init(a,b,c,d,e,f,g) Perl__core_swash_init(aTHX_ a,b,c,d,e,f,g) # endif # if defined(PERL_IN_REGCOMP_C) || defined(PERL_IN_TOKE_C) #define form_short_octal_warning(a,b) S_form_short_octal_warning(aTHX_ a,b) -#define grok_bslash_c(a,b,c) S_grok_bslash_c(aTHX_ a,b,c) +#define grok_bslash_c(a,b) S_grok_bslash_c(aTHX_ a,b) #define grok_bslash_o(a,b,c,d,e,f,g) S_grok_bslash_o(aTHX_ a,b,c,d,e,f,g) #define grok_bslash_x(a,b,c,d,e,f,g) S_grok_bslash_x(aTHX_ a,b,c,d,e,f,g) #define regcurly(a,b) S_regcurly(aTHX_ a,b) @@ -973,31 +994,28 @@ #define _add_range_to_invlist(a,b,c) Perl__add_range_to_invlist(aTHX_ a,b,c) #define _invlist_intersection_maybe_complement_2nd(a,b,c,d) Perl__invlist_intersection_maybe_complement_2nd(aTHX_ a,b,c,d) #define _invlist_invert(a) Perl__invlist_invert(aTHX_ a) -#define _invlist_invert_prop(a) Perl__invlist_invert_prop(aTHX_ a) #define _invlist_populate_swatch(a,b,c,d) Perl__invlist_populate_swatch(aTHX_ a,b,c,d) #define _invlist_union_maybe_complement_2nd(a,b,c,d) Perl__invlist_union_maybe_complement_2nd(aTHX_ a,b,c,d) #define _new_invlist(a) Perl__new_invlist(aTHX_ a) +#define _setup_canned_invlist(a,b,c) Perl__setup_canned_invlist(aTHX_ a,b,c) #define _swash_to_invlist(a) Perl__swash_to_invlist(aTHX_ a) # endif # if defined(PERL_IN_REGEXEC_C) -#define core_regclass_swash(a,b,c,d) S_core_regclass_swash(aTHX_ a,b,c,d) -#define find_byclass(a,b,c,d,e,f) S_find_byclass(aTHX_ a,b,c,d,e,f) +#define find_byclass(a,b,c,d,e) S_find_byclass(aTHX_ a,b,c,d,e) #define isFOO_lc(a,b) S_isFOO_lc(aTHX_ a,b) #define isFOO_utf8_lc(a,b) S_isFOO_utf8_lc(aTHX_ a,b) #define reg_check_named_buff_matched(a,b) S_reg_check_named_buff_matched(aTHX_ a,b) #define regcppop(a,b) S_regcppop(aTHX_ a,b) #define regcppush(a,b,c) S_regcppush(aTHX_ a,b,c) #define reghop3 S_reghop3 +#define reghop4 S_reghop4 #define reghopmaybe3 S_reghopmaybe3 -#define reginclass(a,b,c,d) S_reginclass(aTHX_ a,b,c,d) +#define reginclass(a,b,c,d,e) S_reginclass(aTHX_ a,b,c,d,e) #define regmatch(a,b,c) S_regmatch(aTHX_ a,b,c) #define regrepeat(a,b,c,d,e,f) S_regrepeat(aTHX_ a,b,c,d,e,f) #define regtry(a,b) S_regtry(aTHX_ a,b) #define to_byte_substr(a) S_to_byte_substr(aTHX_ a) #define to_utf8_substr(a) S_to_utf8_substr(aTHX_ a) -# if defined(XXX_dmq) -#define reghop4 S_reghop4 -# endif # endif # if defined(PERL_IN_UTF8_C) || defined(PERL_IN_REGCOMP_C) || defined(PERL_IN_REGEXEC_C) #define _to_fold_latin1(a,b,c,d) Perl__to_fold_latin1(aTHX_ a,b,c,d) @@ -1019,18 +1037,17 @@ #define cando(a,b,c) Perl_cando(aTHX_ a,b,c) #define check_utf8_print(a,b) Perl_check_utf8_print(aTHX_ a,b) #define ck_anoncode(a) Perl_ck_anoncode(aTHX_ a) +#define ck_backtick(a) Perl_ck_backtick(aTHX_ a) #define ck_bitop(a) Perl_ck_bitop(aTHX_ a) #define ck_cmp(a) Perl_ck_cmp(aTHX_ a) #define ck_concat(a) Perl_ck_concat(aTHX_ a) #define ck_defined(a) Perl_ck_defined(aTHX_ a) #define ck_delete(a) Perl_ck_delete(aTHX_ a) -#define ck_die(a) Perl_ck_die(aTHX_ a) #define ck_each(a) Perl_ck_each(aTHX_ a) #define ck_eof(a) Perl_ck_eof(aTHX_ a) #define ck_eval(a) Perl_ck_eval(aTHX_ a) #define ck_exec(a) Perl_ck_exec(aTHX_ a) #define ck_exists(a) Perl_ck_exists(aTHX_ a) -#define ck_exit(a) Perl_ck_exit(aTHX_ a) #define ck_ftst(a) Perl_ck_ftst(aTHX_ a) #define ck_fun(a) Perl_ck_fun(aTHX_ a) #define ck_glob(a) Perl_ck_glob(aTHX_ a) @@ -1062,18 +1079,21 @@ #define ck_svconst(a) Perl_ck_svconst(aTHX_ a) #define ck_tell(a) Perl_ck_tell(aTHX_ a) #define ck_trunc(a) Perl_ck_trunc(aTHX_ a) +#define closest_cop(a,b,c,d) Perl_closest_cop(aTHX_ a,b,c,d) #define convert(a,b,c) Perl_convert(aTHX_ a,b,c) #define core_prototype(a,b,c,d) Perl_core_prototype(aTHX_ a,b,c,d) #define coresub_op(a,b,c) Perl_coresub_op(aTHX_ a,b,c) #define create_eval_scope(a) Perl_create_eval_scope(aTHX_ a) #define croak_no_mem Perl_croak_no_mem #define croak_popstack Perl_croak_popstack -#define cv_ckproto_len_flags(a,b,c,d,e) Perl_cv_ckproto_len_flags(aTHX_ a,b,c,d,e) +#define custom_op_get_field(a,b) Perl_custom_op_get_field(aTHX_ a,b) #define cv_clone_into(a,b) Perl_cv_clone_into(aTHX_ a,b) +#define cv_const_sv_or_av(a) Perl_cv_const_sv_or_av(aTHX_ a) #define cv_forget_slab(a) Perl_cv_forget_slab(aTHX_ a) #define cvgv_set(a,b) Perl_cvgv_set(aTHX_ a,b) #define cvstash_set(a,b) Perl_cvstash_set(aTHX_ a,b) #define deb_stack_all() Perl_deb_stack_all(aTHX) +#define defelem_target(a,b) Perl_defelem_target(aTHX_ a,b) #define delete_eval_scope() Perl_delete_eval_scope(aTHX) #define die_unwind(a) Perl_die_unwind(aTHX_ a) #define do_aexec5(a,b,c,d,e) Perl_do_aexec5(aTHX_ a,b,c,d,e) @@ -1081,6 +1101,8 @@ #define do_eof(a) Perl_do_eof(aTHX_ a) #define do_execfree() Perl_do_execfree(aTHX) #define do_ncmp(a,b) Perl_do_ncmp(aTHX_ a,b) +#define do_open6(a,b,c,d,e,f) Perl_do_open6(aTHX_ a,b,c,d,e,f) +#define do_open_raw(a,b,c,d,e) Perl_do_open_raw(aTHX_ a,b,c,d,e) #define do_print(a,b) Perl_do_print(aTHX_ a,b) #define do_readline() Perl_do_readline(aTHX) #define do_seek(a,b,c) Perl_do_seek(aTHX_ a,b,c) @@ -1103,6 +1125,7 @@ #define get_hash_seed(a) Perl_get_hash_seed(aTHX_ a) #define get_no_modify() Perl_get_no_modify(aTHX) #define get_opargs() Perl_get_opargs(aTHX) +#define gv_override(a,b) Perl_gv_override(aTHX_ a,b) #define gv_try_downgrade(a) Perl_gv_try_downgrade(aTHX_ a) #define hv_ename_add(a,b,c,d) Perl_hv_ename_add(aTHX_ a,b,c,d) #define hv_ename_delete(a,b,c,d) Perl_hv_ename_delete(aTHX_ a,b,c,d) @@ -1175,10 +1198,10 @@ #define my_clearenv() Perl_my_clearenv(aTHX) #define my_lstat_flags(a) Perl_my_lstat_flags(aTHX_ a) #define my_stat_flags(a) Perl_my_stat_flags(aTHX_ a) -#define my_swabn Perl_my_swabn #define my_unexec() Perl_my_unexec(aTHX) -#define newATTRSUB_flags(a,b,c,d,e,f) Perl_newATTRSUB_flags(aTHX_ a,b,c,d,e,f) +#define newATTRSUB_x(a,b,c,d,e,f) Perl_newATTRSUB_x(aTHX_ a,b,c,d,e,f) #define newSTUB(a,b) Perl_newSTUB(aTHX_ a,b) +#define newSVavdefelem(a,b,c) Perl_newSVavdefelem(aTHX_ a,b,c) #define newXS_len_flags(a,b,c,d,e,f,g) Perl_newXS_len_flags(aTHX_ a,b,c,d,e,f,g) #define nextargv(a) Perl_nextargv(aTHX_ a) #define oopsAV(a) Perl_oopsAV(aTHX_ a) @@ -1193,6 +1216,7 @@ #define pad_push(a,b) Perl_pad_push(aTHX_ a,b) #define pad_swipe(a,b) Perl_pad_swipe(aTHX_ a,b) #define padlist_store(a,b,c) Perl_padlist_store(aTHX_ a,b,c) +#define parse_subsignature() Perl_parse_subsignature(aTHX) #define parse_unicode_opts(a) Perl_parse_unicode_opts(aTHX_ a) #define parser_free(a) Perl_parser_free(aTHX_ a) #define peep(a) Perl_peep(aTHX_ a) @@ -1213,9 +1237,11 @@ #define rsignal_restore(a,b) Perl_rsignal_restore(aTHX_ a,b) #define rsignal_save(a,b,c) Perl_rsignal_save(aTHX_ a,b,c) #define rxres_save(a,b) Perl_rxres_save(aTHX_ a,b) +#define save_strlen(a) Perl_save_strlen(aTHX_ a) #define sawparens(a) Perl_sawparens(aTHX_ a) #define scalar(a) Perl_scalar(aTHX_ a) #define scalarvoid(a) Perl_scalarvoid(aTHX_ a) +#define set_caret_X() Perl_set_caret_X(aTHX) #define sub_crush_depth(a) Perl_sub_crush_depth(aTHX_ a) #define sv_2num(a) Perl_sv_2num(aTHX_ a) #define sv_clean_all() Perl_sv_clean_all(aTHX) @@ -1344,6 +1370,12 @@ #define strip_return(a) S_strip_return(aTHX_ a) # endif # endif +# if defined(PERL_DEBUG_READONLY_COW) +#define sv_buf_to_ro(a) Perl_sv_buf_to_ro(aTHX_ a) +# if defined(PERL_IN_SV_C) +#define sv_buf_to_rw(a) S_sv_buf_to_rw(aTHX_ a) +# endif +# endif # if defined(PERL_IN_AV_C) #define get_aux_mg(a) S_get_aux_mg(aTHX_ a) # endif @@ -1353,6 +1385,8 @@ # if defined(PERL_IN_DOIO_C) #define exec_failed(a,b,c) S_exec_failed(aTHX_ a,b,c) #define ingroup(a,b) S_ingroup(aTHX_ a,b) +#define openn_cleanup(a,b,c,d,e,f,g,h,i,j,k,l) S_openn_cleanup(aTHX_ a,b,c,d,e,f,g,h,i,j,k,l) +#define openn_setup(a,b,c,d,e,f) S_openn_setup(aTHX_ a,b,c,d,e,f) # endif # if defined(PERL_IN_DOOP_C) #define do_trans_complex(a) S_do_trans_complex(aTHX_ a) @@ -1369,8 +1403,13 @@ #define sequence_num(a) S_sequence_num(aTHX_ a) # endif # if defined(PERL_IN_GV_C) +#define find_default_stash(a,b,c,d,e,f) S_find_default_stash(aTHX_ a,b,c,d,e,f) #define gv_init_svtype(a,b) S_gv_init_svtype(aTHX_ a,b) +#define gv_is_in_main(a,b,c) S_gv_is_in_main(aTHX_ a,b,c) +#define gv_magicalize(a,b,c,d,e,f) S_gv_magicalize(aTHX_ a,b,c,d,e,f) #define gv_magicalize_isa(a) S_gv_magicalize_isa(aTHX_ a) +#define maybe_multimagic_gv(a,b,c) S_maybe_multimagic_gv(aTHX_ a,b,c) +#define parse_gv_stash_name(a,b,c,d,e,f,g,h) S_parse_gv_stash_name(aTHX_ a,b,c,d,e,f,g,h) #define require_tie_mod(a,b,c,d,e) S_require_tie_mod(aTHX_ a,b,c,d,e) # endif # if defined(PERL_IN_HV_C) @@ -1378,6 +1417,7 @@ #define hfreeentries(a) S_hfreeentries(aTHX_ a) #define hsplit(a,b,c) S_hsplit(aTHX_ a,b,c) #define hv_auxinit(a) S_hv_auxinit(aTHX_ a) +#define hv_auxinit_internal S_hv_auxinit_internal #define hv_delete_common(a,b,c,d,e,f,g) S_hv_delete_common(aTHX_ a,b,c,d,e,f,g) #define hv_free_ent_ret(a,b) S_hv_free_ent_ret(aTHX_ a,b) #define hv_magic_check S_hv_magic_check @@ -1389,23 +1429,26 @@ #define share_hek_flags(a,b,c,d) S_share_hek_flags(aTHX_ a,b,c,d) #define unshare_hek_or_pvn(a,b,c,d) S_unshare_hek_or_pvn(aTHX_ a,b,c,d) # endif -# if defined(PERL_IN_LOCALE_C) -# if defined(USE_LOCALE_NUMERIC) || defined(USE_LOCALE_COLLATE) +# if defined(PERL_IN_LOCALE_C) && defined(USE_LOCALE) +#define is_cur_LC_category_utf8(a) S_is_cur_LC_category_utf8(aTHX_ a) #define stdize_locale(a) S_stdize_locale(aTHX_ a) -# endif +# endif +# if defined(PERL_IN_MALLOC_C) +#define adjust_size_and_find_bucket S_adjust_size_and_find_bucket # endif # if defined(PERL_IN_MG_C) +#define fixup_errno_string(a) S_fixup_errno_string(aTHX_ a) #define magic_methcall1(a,b,c,d,e,f) S_magic_methcall1(aTHX_ a,b,c,d,e,f) #define magic_methpack(a,b,c) S_magic_methpack(aTHX_ a,b,c) #define restore_magic(a) S_restore_magic(aTHX_ a) -#define save_magic(a,b) S_save_magic(aTHX_ a,b) +#define save_magic_flags(a,b,c) S_save_magic_flags(aTHX_ a,b,c) #define unwind_handler_stack(a) S_unwind_handler_stack(aTHX_ a) # endif # if defined(PERL_IN_MG_C) || defined(PERL_IN_PP_C) #define translate_substr_offsets(a,b,c,d,e,f,g) Perl_translate_substr_offsets(aTHX_ a,b,c,d,e,f,g) # endif # if defined(PERL_IN_MRO_C) -#define mro_clean_isarev(a,b,c,d,e) S_mro_clean_isarev(aTHX_ a,b,c,d,e) +#define mro_clean_isarev(a,b,c,d,e,f) S_mro_clean_isarev(aTHX_ a,b,c,d,e,f) #define mro_gather_and_rename(a,b,c,d,e) S_mro_gather_and_rename(aTHX_ a,b,c,d,e) #define mro_get_linear_isa_dfs(a,b) S_mro_get_linear_isa_dfs(aTHX_ a,b) # endif @@ -1416,8 +1459,8 @@ #define aassign_common_vars(a) S_aassign_common_vars(aTHX_ a) #define apply_attrs(a,b,c) S_apply_attrs(aTHX_ a,b,c) #define apply_attrs_my(a,b,c,d) S_apply_attrs_my(aTHX_ a,b,c,d) +#define bad_type_gv(a,b,c,d,e) S_bad_type_gv(aTHX_ a,b,c,d,e) #define bad_type_pv(a,b,c,d,e) S_bad_type_pv(aTHX_ a,b,c,d,e) -#define bad_type_sv(a,b,c,d,e) S_bad_type_sv(aTHX_ a,b,c,d,e) #define cop_free(a) S_cop_free(aTHX_ a) #define dup_attrlist(a) S_dup_attrlist(aTHX_ a) #define finalize_op(a) S_finalize_op(aTHX_ a) @@ -1433,12 +1476,14 @@ #define listkids(a) S_listkids(aTHX_ a) #define looks_like_bool(a) S_looks_like_bool(aTHX_ a) #define modkids(a,b) S_modkids(aTHX_ a,b) +#define move_proto_attr(a,b,c) S_move_proto_attr(aTHX_ a,b,c) #define my_kid(a,b,c) S_my_kid(aTHX_ a,b,c) #define newDEFSVOP() S_newDEFSVOP(aTHX) #define newGIVWHENOP(a,b,c,d,e) S_newGIVWHENOP(aTHX_ a,b,c,d,e) #define new_logop(a,b,c,d) S_new_logop(aTHX_ a,b,c,d) #define no_bareword_allowed(a) S_no_bareword_allowed(aTHX_ a) #define no_fh_allowed(a) S_no_fh_allowed(aTHX_ a) +#define null_listop_in_list_context(a) S_null_listop_in_list_context(aTHX_ a) #define op_integerize(a) S_op_integerize(aTHX_ a) #define op_std_init(a) S_op_std_init(aTHX_ a) #define pmtrans(a,b,c) S_pmtrans(aTHX_ a,b,c) @@ -1491,7 +1536,7 @@ #define refto(a) S_refto(aTHX_ a) # endif # if defined(PERL_IN_PP_CTL_C) -#define adjust_stack_on_leave(a,b,c,d,e) S_adjust_stack_on_leave(aTHX_ a,b,c,d,e) +#define adjust_stack_on_leave(a,b,c,d,e,f) S_adjust_stack_on_leave(aTHX_ a,b,c,d,e,f) #define check_type_and_open(a) S_check_type_and_open(aTHX_ a) #define destroy_matcher(a) S_destroy_matcher(aTHX_ a) #define do_smartmatch(a,b,c) S_do_smartmatch(aTHX_ a,b,c) @@ -1508,7 +1553,7 @@ #define make_matcher(a) S_make_matcher(aTHX_ a) #define matcher_matches_sv(a,b) S_matcher_matches_sv(aTHX_ a,b) #define num_overflow S_num_overflow -#define path_is_absolute S_path_is_absolute +#define path_is_searchable S_path_is_searchable #define run_user_filter(a,b,c) S_run_user_filter(aTHX_ a,b,c) #define rxres_free(a) S_rxres_free(aTHX_ a) #define rxres_restore(a,b) S_rxres_restore(aTHX_ a,b) @@ -1603,7 +1648,7 @@ #define force_next(a) S_force_next(aTHX_ a) #define force_strict_version(a) S_force_strict_version(aTHX_ a) #define force_version(a,b) S_force_version(aTHX_ a,b) -#define force_word(a,b,c,d,e) S_force_word(aTHX_ a,b,c,d,e) +#define force_word(a,b,c,d) S_force_word(aTHX_ a,b,c,d) #define get_and_check_backslash_N_name(a,b) S_get_and_check_backslash_N_name(aTHX_ a,b) #define incline(a) S_incline(aTHX_ a) #define intuit_method(a,b,c) S_intuit_method(aTHX_ a,b,c) @@ -1613,18 +1658,17 @@ #define no_op(a,b) S_no_op(aTHX_ a,b) #define parse_ident(a,b,c,d,e) S_parse_ident(aTHX_ a,b,c,d,e) #define pending_ident() S_pending_ident(aTHX) -#define readpipe_override() S_readpipe_override(aTHX) #define scan_const(a) S_scan_const(aTHX_ a) #define scan_formline(a) S_scan_formline(aTHX_ a) #define scan_heredoc(a) S_scan_heredoc(aTHX_ a) -#define scan_ident(a,b,c,d,e) S_scan_ident(aTHX_ a,b,c,d,e) +#define scan_ident(a,b,c,d) S_scan_ident(aTHX_ a,b,c,d) #define scan_inputsymbol(a) S_scan_inputsymbol(aTHX_ a) #define scan_pat(a,b) S_scan_pat(aTHX_ a,b) -#define scan_str(a,b,c,d,e) S_scan_str(aTHX_ a,b,c,d,e) +#define scan_str(a,b,c,d,e,f) S_scan_str(aTHX_ a,b,c,d,e,f) #define scan_subst(a) S_scan_subst(aTHX_ a) #define scan_trans(a) S_scan_trans(aTHX_ a) #define scan_word(a,b,c,d,e) S_scan_word(aTHX_ a,b,c,d,e) -#define skipspace(a) S_skipspace(aTHX_ a) +#define skipspace_flags(a,b) S_skipspace_flags(aTHX_ a,b) #define sublex_done() S_sublex_done(aTHX) #define sublex_push() S_sublex_push(aTHX) #define sublex_start() S_sublex_start(aTHX) @@ -1647,7 +1691,7 @@ # if defined(PERL_IN_UTF8_C) #define check_locale_boundary_crossing(a,b,c,d) S_check_locale_boundary_crossing(aTHX_ a,b,c,d) #define is_utf8_char_slow S_is_utf8_char_slow -#define is_utf8_common(a,b,c) S_is_utf8_common(aTHX_ a,b,c) +#define is_utf8_common(a,b,c,d) S_is_utf8_common(aTHX_ a,b,c,d) #define swatch_get(a,b,c) S_swatch_get(aTHX_ a,b,c) #define to_lower_latin1(a,b,c) S_to_lower_latin1(aTHX_ a,b,c) # endif @@ -1656,7 +1700,6 @@ # endif # if defined(PERL_IN_UTIL_C) #define ckwarn_common(a) S_ckwarn_common(aTHX_ a) -#define closest_cop(a,b) S_closest_cop(aTHX_ a,b) #define invoke_exception_hook(a,b) S_invoke_exception_hook(aTHX_ a,b) #define mess_alloc() S_mess_alloc(aTHX) #define with_queued_errors(a) S_with_queued_errors(aTHX_ a) @@ -1701,78 +1744,6 @@ #define xmldump_sub(a) Perl_xmldump_sub(aTHX_ a) #define xmldump_sub_perl(a,b) Perl_xmldump_sub_perl(aTHX_ a,b) #define xmldump_vindent(a,b,c,d) Perl_xmldump_vindent(aTHX_ a,b,c,d) -# endif -# if defined(PERL_NEED_MY_BETOH16) -#define my_betoh16 Perl_my_betoh16 -# endif -# if defined(PERL_NEED_MY_BETOH32) -#define my_betoh32 Perl_my_betoh32 -# endif -# if defined(PERL_NEED_MY_BETOH64) -#define my_betoh64 Perl_my_betoh64 -# endif -# if defined(PERL_NEED_MY_BETOHI) -#define my_betohi Perl_my_betohi -# endif -# if defined(PERL_NEED_MY_BETOHL) -#define my_betohl Perl_my_betohl -# endif -# if defined(PERL_NEED_MY_BETOHS) -#define my_betohs Perl_my_betohs -# endif -# if defined(PERL_NEED_MY_HTOBE16) -#define my_htobe16 Perl_my_htobe16 -# endif -# if defined(PERL_NEED_MY_HTOBE32) -#define my_htobe32 Perl_my_htobe32 -# endif -# if defined(PERL_NEED_MY_HTOBE64) -#define my_htobe64 Perl_my_htobe64 -# endif -# if defined(PERL_NEED_MY_HTOBEI) -#define my_htobei Perl_my_htobei -# endif -# if defined(PERL_NEED_MY_HTOBEL) -#define my_htobel Perl_my_htobel -# endif -# if defined(PERL_NEED_MY_HTOBES) -#define my_htobes Perl_my_htobes -# endif -# if defined(PERL_NEED_MY_HTOLE16) -#define my_htole16 Perl_my_htole16 -# endif -# if defined(PERL_NEED_MY_HTOLE32) -#define my_htole32 Perl_my_htole32 -# endif -# if defined(PERL_NEED_MY_HTOLE64) -#define my_htole64 Perl_my_htole64 -# endif -# if defined(PERL_NEED_MY_HTOLEI) -#define my_htolei Perl_my_htolei -# endif -# if defined(PERL_NEED_MY_HTOLEL) -#define my_htolel Perl_my_htolel -# endif -# if defined(PERL_NEED_MY_HTOLES) -#define my_htoles Perl_my_htoles -# endif -# if defined(PERL_NEED_MY_LETOH16) -#define my_letoh16 Perl_my_letoh16 -# endif -# if defined(PERL_NEED_MY_LETOH32) -#define my_letoh32 Perl_my_letoh32 -# endif -# if defined(PERL_NEED_MY_LETOH64) -#define my_letoh64 Perl_my_letoh64 -# endif -# if defined(PERL_NEED_MY_LETOHI) -#define my_letohi Perl_my_letohi -# endif -# if defined(PERL_NEED_MY_LETOHL) -#define my_letohl Perl_my_letohl -# endif -# if defined(PERL_NEED_MY_LETOHS) -#define my_letohs Perl_my_letohs # endif # if defined(PERL_USES_PL_PIDSTATUS) && defined(PERL_IN_UTIL_C) #define pidgone(a,b) S_pidgone(aTHX_ a,b) Index: gnu/usr.bin/perl/embedvar.h =================================================================== RCS file: /mnt/memory/perl/importit/cvs/src/gnu/usr.bin/perl/embedvar.h,v retrieving revision 1.1.1.13 diff -u -p -u -p -r1.1.1.13 embedvar.h --- gnu/usr.bin/perl/embedvar.h 24 Mar 2014 14:58:44 -0000 1.1.1.13 +++ gnu/usr.bin/perl/embedvar.h 16 Nov 2014 03:22:24 -0000 @@ -40,7 +40,6 @@ # define vTHX PERL_GET_INTERP # endif -#define PL_ASCII (vTHX->IASCII) #define PL_AboveLatin1 (vTHX->IAboveLatin1) #define PL_Argv (vTHX->IArgv) #define PL_Cmd (vTHX->ICmd) @@ -54,7 +53,6 @@ #define PL_Dir (vTHX->IDir) #define PL_Env (vTHX->IEnv) #define PL_HasMultiCharFold (vTHX->IHasMultiCharFold) -#define PL_L1Posix_ptrs (vTHX->IL1Posix_ptrs) #define PL_LIO (vTHX->ILIO) #define PL_Latin1 (vTHX->ILatin1) #define PL_Mem (vTHX->IMem) @@ -66,6 +64,7 @@ #define PL_Sock (vTHX->ISock) #define PL_StdIO (vTHX->IStdIO) #define PL_Sv (vTHX->ISv) +#define PL_UpperLatin1 (vTHX->IUpperLatin1) #define PL_XPosix_ptrs (vTHX->IXPosix_ptrs) #define PL_Xpv (vTHX->IXpv) #define PL_an (vTHX->Ian) @@ -157,12 +156,12 @@ #define PL_hash_rand_bits (vTHX->Ihash_rand_bits) #define PL_hash_rand_bits_enabled (vTHX->Ihash_rand_bits_enabled) #define PL_hintgv (vTHX->Ihintgv) -#define PL_hints (vTHX->Ihints) #define PL_hv_fetch_ent_mh (vTHX->Ihv_fetch_ent_mh) #define PL_in_clean_all (vTHX->Iin_clean_all) #define PL_in_clean_objs (vTHX->Iin_clean_objs) #define PL_in_eval (vTHX->Iin_eval) #define PL_in_load_module (vTHX->Iin_load_module) +#define PL_in_utf8_CTYPE_locale (vTHX->Iin_utf8_CTYPE_locale) #define PL_incgv (vTHX->Iincgv) #define PL_initav (vTHX->Iinitav) #define PL_inplace (vTHX->Iinplace) @@ -216,9 +215,9 @@ #define PL_ofsgv (vTHX->Iofsgv) #define PL_oldname (vTHX->Ioldname) #define PL_op (vTHX->Iop) +#define PL_op_exec_cnt (vTHX->Iop_exec_cnt) #define PL_op_mask (vTHX->Iop_mask) #define PL_opfreehook (vTHX->Iopfreehook) -#define PL_opsave (vTHX->Iopsave) #define PL_origalen (vTHX->Iorigalen) #define PL_origargc (vTHX->Iorigargc) #define PL_origargv (vTHX->Iorigargv) @@ -243,10 +242,10 @@ #define PL_psig_pend (vTHX->Ipsig_pend) #define PL_psig_ptr (vTHX->Ipsig_ptr) #define PL_ptr_table (vTHX->Iptr_table) +#define PL_random_state (vTHX->Irandom_state) #define PL_reentrant_buffer (vTHX->Ireentrant_buffer) #define PL_reentrant_retint (vTHX->Ireentrant_retint) -#define PL_reg_state (vTHX->Ireg_state) -#define PL_regdummy (vTHX->Iregdummy) +#define PL_reg_curpm (vTHX->Ireg_curpm) #define PL_regex_pad (vTHX->Iregex_pad) #define PL_regex_padav (vTHX->Iregex_padav) #define PL_registered_mros (vTHX->Iregistered_mros) @@ -302,6 +301,7 @@ #define PL_subline (vTHX->Isubline) #define PL_subname (vTHX->Isubname) #define PL_sv_arenaroot (vTHX->Isv_arenaroot) +#define PL_sv_consts (vTHX->Isv_consts) #define PL_sv_count (vTHX->Isv_count) #define PL_sv_no (vTHX->Isv_no) #define PL_sv_objcount (vTHX->Isv_objcount) Index: gnu/usr.bin/perl/fakethr.h =================================================================== RCS file: gnu/usr.bin/perl/fakethr.h diff -N gnu/usr.bin/perl/fakethr.h --- gnu/usr.bin/perl/fakethr.h 24 Mar 2014 14:58:44 -0000 1.1.1.5 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,75 +0,0 @@ -/* fakethr.h - * - * Copyright (C) 1999, by Larry Wall and others - * - * You may distribute under the terms of either the GNU General Public - * License or the Artistic License, as specified in the README file. - * - */ - -typedef int perl_mutex; -typedef int perl_key; - -typedef struct perl_thread *perl_os_thread; -/* With fake threads, thr is global(ish) so we don't need dTHR */ -#define dTHR extern int errno - -struct perl_wait_queue { - struct perl_thread * thread; - struct perl_wait_queue * next; -}; -typedef struct perl_wait_queue *perl_cond; - -/* Ask thread.h to include our per-thread extras */ -#define HAVE_THREAD_INTERN -struct thread_intern { - perl_os_thread next_run, prev_run; /* Linked list of runnable threads */ - perl_cond wait_queue; /* Wait queue that we are waiting on */ - IV private; /* Holds data across time slices */ - I32 savemark; /* Holds MARK for thread join values */ -}; - -#define init_thread_intern(t) \ - STMT_START { \ - t->self = (t); \ - (t)->i.next_run = (t)->i.prev_run = (t); \ - (t)->i.wait_queue = 0; \ - (t)->i.private = 0; \ - } STMT_END - -/* - * Note that SCHEDULE() is only callable from pp code (which - * must be expecting to be restarted). We'll have to do - * something a bit different for XS code. - */ - -#define SCHEDULE() return schedule(), PL_op - -#define MUTEX_LOCK(m) -#define MUTEX_UNLOCK(m) -#define MUTEX_INIT(m) -#define MUTEX_DESTROY(m) -#define COND_INIT(c) perl_cond_init(c) -#define COND_SIGNAL(c) perl_cond_signal(c) -#define COND_BROADCAST(c) perl_cond_broadcast(c) -#define COND_WAIT(c, m) \ - STMT_START { \ - perl_cond_wait(c); \ - SCHEDULE(); \ - } STMT_END -#define COND_DESTROY(c) - -#define THREAD_CREATE(t, f) f((t)) -#define THREAD_POST_CREATE(t) NOOP - -#define YIELD NOOP - -/* - * Local variables: - * c-indentation-style: bsd - * c-basic-offset: 4 - * indent-tabs-mode: nil - * End: - * - * ex: set ts=8 sts=4 sw=4 et: - */ Index: gnu/usr.bin/perl/feature.h =================================================================== RCS file: /mnt/memory/perl/importit/cvs/src/gnu/usr.bin/perl/feature.h,v retrieving revision 1.1.1.2 diff -u -p -u -p -r1.1.1.2 feature.h --- gnu/usr.bin/perl/feature.h 24 Mar 2014 14:58:44 -0000 1.1.1.2 +++ gnu/usr.bin/perl/feature.h 16 Nov 2014 03:22:24 -0000 @@ -27,7 +27,7 @@ & HINT_LOCALIZE_HH) \ ? Perl_feature_is_enabled(aTHX_ STR_WITH_LEN(name)) : FALSE) /* The longest string we pass in. */ -#define MAX_FEATURE_LEN (sizeof("evalbytes")-1) +#define MAX_FEATURE_LEN (sizeof("postderef_qq")-1) #define FEATURE_FC_IS_ENABLED \ ( \ @@ -67,6 +67,12 @@ FEATURE_IS_ENABLED("evalbytes")) \ ) +#define FEATURE_POSTDEREF_IS_ENABLED \ + ( \ + CURRENT_FEATURE_BUNDLE == FEATURE_BUNDLE_CUSTOM && \ + FEATURE_IS_ENABLED("postderef") \ + ) + #define FEATURE_ARYBASE_IS_ENABLED \ ( \ CURRENT_FEATURE_BUNDLE <= FEATURE_BUNDLE_511 \ @@ -74,6 +80,12 @@ FEATURE_IS_ENABLED("arybase")) \ ) +#define FEATURE_SIGNATURES_IS_ENABLED \ + ( \ + CURRENT_FEATURE_BUNDLE == FEATURE_BUNDLE_CUSTOM && \ + FEATURE_IS_ENABLED("signatures") \ + ) + #define FEATURE___SUB___IS_ENABLED \ ( \ CURRENT_FEATURE_BUNDLE == FEATURE_BUNDLE_515 \ @@ -85,6 +97,12 @@ ( \ CURRENT_FEATURE_BUNDLE == FEATURE_BUNDLE_CUSTOM && \ FEATURE_IS_ENABLED("lexsubs") \ + ) + +#define FEATURE_POSTDEREF_QQ_IS_ENABLED \ + ( \ + CURRENT_FEATURE_BUNDLE == FEATURE_BUNDLE_CUSTOM && \ + FEATURE_IS_ENABLED("postderef_qq") \ ) #define FEATURE_UNIEVAL_IS_ENABLED \ Index: gnu/usr.bin/perl/genpacksizetables.pl =================================================================== RCS file: gnu/usr.bin/perl/genpacksizetables.pl diff -N gnu/usr.bin/perl/genpacksizetables.pl --- gnu/usr.bin/perl/genpacksizetables.pl 29 Sep 2008 17:18:05 -0000 1.1.1.2 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,123 +0,0 @@ -#!/usr/bin/perl -w -# I'm assuming that you're running this on some kind of ASCII system, but -# it will generate EDCDIC too. (TODO) -use strict; -use Encode; - -sub make_text { - my ($chrmap, $letter, $unpredictable, $nocsum, $size, $condition) = @_; - my $text = " /* $letter */ $size"; - $text .= " | PACK_SIZE_UNPREDICTABLE" if $unpredictable; - $text .= " | PACK_SIZE_CANNOT_CSUM" if $nocsum; - $text .= ","; - - if ($condition) { - $condition = join " && ", map {"defined($_)"} split ' ', $condition; - $text = "#if $condition -$text -#else - 0, -#endif"; - } - return $text; -} - -sub make_tables { - my %arrays; - - my $chrmap = shift; - foreach (@_) { - my ($letter, $shriek, $unpredictable, $nocsum, $size, $condition) = - /^([A-Za-z])(!?)\t(\S*)\t(\S*)\t([^\t\n]+)(?:\t+(.*))?$/ or - die "Can't parse '$_'"; - - $size = "sizeof($size)" unless $size =~ s/^=//; - - $arrays{$shriek ? 'shrieking' : 'normal'}{ord $chrmap->{$letter}} = - make_text($chrmap, $letter, - $unpredictable, $nocsum, $size, $condition); - } - - my $text = "STATIC const packprops_t packprops[512] = {\n"; - foreach my $arrayname (qw(normal shrieking)) { - my $array = $arrays{$arrayname} || - die "No defined entries in $arrayname"; - $text .= " /* $arrayname */\n"; - for my $ch (0..255) { - $text .= $array->{$ch} || " 0,"; - $text .= "\n"; - } - } - # Join "0," entries together - 1 while $text =~ s/\b0,\s*\n\s*0,/0, 0,/g; - # But split them up again if the sequence gets too long - $text =~ s/((?:\b0, ){15}0,) /$1\n /g; - # Clean up final , - $text =~ s/,$//; - $text .= "};"; - return $text; -} - -my @lines = grep { - s/#.*//; - /\S/; -} ; - -my %asciimap = map {chr $_, chr $_} 0..255; -my %ebcdicmap = map {chr $_, Encode::encode("posix-bc", chr $_)} 0..255; - -print <<"EOC"; -/* These tables are regenerated by genpacksizetables.pl (and then hand pasted - in). You're unlikely ever to need to regenerate them. */ - -#if TYPE_IS_SHRIEKING != 0x100 - ++++shriek offset should be 256 -#endif - -typedef U8 packprops_t; -#if 'J'-'I' == 1 -/* ASCII */ -@{[make_tables (\%asciimap, @lines)]} -#else -/* EBCDIC (or bust) */ -@{[make_tables (\%ebcdicmap, @lines)]} -#endif -EOC - -__DATA__ -#Symbol unpredictable -# nocsum size -c char -C * unsigned char -W * unsigned char -U * char -s! short -s =SIZE16 -S! unsigned short -v =SIZE16 -n =SIZE16 -S =SIZE16 -v! =SIZE16 PERL_PACK_CAN_SHRIEKSIGN -n! =SIZE16 PERL_PACK_CAN_SHRIEKSIGN -i int -i! int -I unsigned int -I! unsigned int -j =IVSIZE -J =UVSIZE -l! long -l =SIZE32 -L! unsigned long -V =SIZE32 -N =SIZE32 -V! =SIZE32 PERL_PACK_CAN_SHRIEKSIGN -N! =SIZE32 PERL_PACK_CAN_SHRIEKSIGN -L =SIZE32 -p * char * -w * * char -q Quad_t HAS_QUAD -Q Uquad_t HAS_QUAD -f float -d double -F =NVSIZE -D =LONG_DOUBLESIZE HAS_LONG_DOUBLE USE_LONG_DOUBLE Index: gnu/usr.bin/perl/git_version.h =================================================================== RCS file: /mnt/memory/perl/importit/cvs/src/gnu/usr.bin/perl/git_version.h,v retrieving revision 1.6 diff -u -p -u -p -r1.6 git_version.h --- gnu/usr.bin/perl/git_version.h 24 Mar 2014 15:05:13 -0000 1.6 +++ gnu/usr.bin/perl/git_version.h 16 Nov 2014 03:22:24 -0000 @@ -2,7 +2,7 @@ * WARNING: 'git_version.h' is automatically generated by make_patchnum.pl * DO NOT EDIT DIRECTLY - edit make_patchnum.pl instead ***************************************************************************/ -#define PERL_GIT_UNCOMMITTED_CHANGES -#define PERL_PATCHNUM "" + #define PERL_GIT_UNPUSHED_COMMITS \ /*leave-this-comment*/ + Index: gnu/usr.bin/perl/globvar.sym =================================================================== RCS file: /mnt/memory/perl/importit/cvs/src/gnu/usr.bin/perl/globvar.sym,v retrieving revision 1.8 diff -u -p -u -p -r1.8 globvar.sym --- gnu/usr.bin/perl/globvar.sym 24 Mar 2014 15:05:13 -0000 1.8 +++ gnu/usr.bin/perl/globvar.sym 16 Nov 2014 03:22:24 -0000 @@ -23,6 +23,7 @@ magic_data magic_vtable_names magic_vtables memory_wrap +mod_latin1_uc no_aelem no_dir_func no_func @@ -42,6 +43,7 @@ opargs phase_names ppaddr reg_extflags_name +reg_intflags_name reg_name regkind revision Index: gnu/usr.bin/perl/gv.c =================================================================== RCS file: /mnt/memory/perl/importit/cvs/src/gnu/usr.bin/perl/gv.c,v retrieving revision 1.15 diff -u -p -u -p -r1.15 gv.c --- gnu/usr.bin/perl/gv.c 24 Mar 2014 15:05:13 -0000 1.15 +++ gnu/usr.bin/perl/gv.c 16 Nov 2014 03:22:24 -0000 @@ -82,10 +82,12 @@ Perl_gv_add_by_type(pTHX_ GV *gv, svtype } if (!*where) + { *where = newSV_type(type); - if (type == SVt_PVAV && GvNAMELEN(gv) == 3 - && strnEQ(GvNAME(gv), "ISA", 3)) - sv_magic(*where, (SV *)gv, PERL_MAGIC_isa, NULL, 0); + if (type == SVt_PVAV && GvNAMELEN(gv) == 3 + && strnEQ(GvNAME(gv), "ISA", 3)) + sv_magic(*where, (SV *)gv, PERL_MAGIC_isa, NULL, 0); + } return gv; } @@ -130,7 +132,7 @@ Perl_gv_fetchfile_flags(pTHX_ const char #endif } if ((PERLDB_LINE || PERLDB_SAVESRC) && !GvAV(gv)) - hv_magic(GvHVn(gv_AVadd(gv)), NULL, PERL_MAGIC_dbfile); + hv_magic(GvHVn(gv), GvAVn(gv), PERL_MAGIC_dbfile); if (tmpbuf != smallbuf) Safefree(tmpbuf); return gv; @@ -154,7 +156,7 @@ Perl_gv_const_sv(pTHX_ GV *gv) if (SvTYPE(gv) == SVt_PVGV) return cv_const_sv(GvCVu(gv)); - return SvROK(gv) ? SvRV(gv) : NULL; + return SvROK(gv) && SvTYPE(SvRV(gv)) != SVt_PVAV ? SvRV(gv) : NULL; } GP * @@ -165,7 +167,7 @@ Perl_newGP(pTHX_ GV *const gv) const char *file; STRLEN len; #ifndef USE_ITHREADS - SV * temp_sv; + GV *filegv; #endif dVAR; @@ -176,13 +178,24 @@ Perl_newGP(pTHX_ GV *const gv) gp->gp_sv = newSV(0); #endif -#ifdef USE_ITHREADS + /* PL_curcop may be null here. E.g., + INIT { bless {} and exit } + frees INIT before looking up DESTROY (and creating *DESTROY) + */ if (PL_curcop) { gp->gp_line = CopLINE(PL_curcop); /* 0 otherwise Newxz */ +#ifdef USE_ITHREADS if (CopFILE(PL_curcop)) { file = CopFILE(PL_curcop); len = strlen(file); } +#else + filegv = CopFILEGV(PL_curcop); + if (filegv) { + file = GvNAME(filegv)+2; + len = GvNAMELEN(filegv)-2; + } +#endif else goto no_file; } else { @@ -190,18 +203,6 @@ Perl_newGP(pTHX_ GV *const gv) file = ""; len = 0; } -#else - if(PL_curcop) - gp->gp_line = CopLINE(PL_curcop); /* 0 otherwise Newxz */ - temp_sv = CopFILESV(PL_curcop); - if (temp_sv) { - file = SvPVX(temp_sv); - len = SvCUR(temp_sv); - } else { - file = ""; - len = 0; - } -#endif PERL_HASH(hash, file, len); gp->gp_file_hek = share_hek(file, len, hash); @@ -346,7 +347,6 @@ Perl_gv_init_pvn(pTHX_ GV *gv, HV *stash if (has_constant) { /* The constant has to be a simple scalar type. */ switch (SvTYPE(has_constant)) { - case SVt_PVAV: case SVt_PVHV: case SVt_PVCV: case SVt_PVFM: @@ -463,7 +463,7 @@ S_maybe_add_coresub(pTHX_ HV * const sta /* no support for \&CORE::infix; no support for funcs that do not parse like funcs */ case KEY___DATA__: case KEY___END__: case KEY_and: case KEY_AUTOLOAD: - case KEY_BEGIN : case KEY_CHECK : case KEY_cmp: case KEY_CORE : + case KEY_BEGIN : case KEY_CHECK : case KEY_cmp: case KEY_default : case KEY_DESTROY: case KEY_do : case KEY_dump : case KEY_else : case KEY_elsif : case KEY_END : case KEY_eq : case KEY_eval : @@ -519,7 +519,6 @@ S_maybe_add_coresub(pTHX_ HV * const sta cv = MUTABLE_CV(newSV_type(SVt_PVCV)); GvCV_set(gv,cv); GvCVGEN(gv) = 0; - mro_method_changed_in(GvSTASH(gv)); CvISXSUB_on(cv); CvXSUB(cv) = core_xsub; } @@ -541,7 +540,7 @@ S_maybe_add_coresub(pTHX_ HV * const sta CvLVALUE_on(cv); /* newATTRSUB will free the CV and return NULL if we're still compiling after a syntax error */ - if ((cv = newATTRSUB_flags( + if ((cv = newATTRSUB_x( oldsavestack_ix, (OP *)gv, NULL,NULL, coresub_op( @@ -550,7 +549,7 @@ S_maybe_add_coresub(pTHX_ HV * const sta : newSVpvn(name,len), code, opnum ), - 1 + TRUE )) != NULL) { assert(GvCV(gv) == orig_cv); if (opnum != OP_VEC && opnum != OP_SUBSTR && opnum != OP_POS @@ -684,8 +683,9 @@ Perl_gv_fetchmeth_pvn(pTHX_ HV *stash, c topgen_cmp = HvMROMETA(stash)->cache_gen + PL_sub_generation; if (flags & GV_SUPER) { - if (!HvAUX(stash)->xhv_super) HvAUX(stash)->xhv_super = newHV(); - cachestash = HvAUX(stash)->xhv_super; + if (!HvAUX(stash)->xhv_mro_meta->super) + HvAUX(stash)->xhv_mro_meta->super = newHV(); + cachestash = HvAUX(stash)->xhv_mro_meta->super; } else cachestash = stash; @@ -901,16 +901,16 @@ means yes, look for AUTOLOAD; zero means Calling C is equivalent to calling C with a non-zero C parameter. -These functions grant C<"SUPER"> token as a prefix of the method name. Note +These functions grant C<"SUPER"> token +as a prefix of the method name. Note that if you want to keep the returned glob for a long time, you need to check for it being "AUTOLOAD", since at the later time the call may load a -different subroutine due to $AUTOLOAD changing its value. Use the glob -created via a side effect to do this. +different subroutine due to $AUTOLOAD changing its value. Use the glob +created as a side effect to do this. -These functions have the same side-effects and as C with -C. C should be writable if contains C<':'> or C<' -''>. The warning against passing the GV returned by C to -C apply equally to these functions. +These functions have the same side-effects as C with +C. The warning against passing the GV returned by +C to C applies equally to these functions. =cut */ @@ -1026,10 +1026,9 @@ Perl_gv_fetchmethod_pvn_flags(pTHX_ HV * return gv; } Perl_croak(aTHX_ - "Can't locate object method \"%"SVf + "Can't locate object method \"%"UTF8f "\" via package \"%"HEKf"\"", - SVfARG(newSVpvn_flags(name, nend - name, - SVs_TEMP | is_utf8)), + UTF8fARG(is_utf8, nend - name, name), HEKfARG(HvNAME_HEK(stash))); } else { @@ -1039,14 +1038,14 @@ Perl_gv_fetchmethod_pvn_flags(pTHX_ HV * packnamesv = newSVpvn_flags(origname, nsplit - origname, SVs_TEMP | is_utf8); } else { - packnamesv = sv_2mortal(newSVsv(error_report)); + packnamesv = error_report; } Perl_croak(aTHX_ - "Can't locate object method \"%"SVf"\" via package \"%"SVf"\"" + "Can't locate object method \"%"UTF8f + "\" via package \"%"SVf"\"" " (perhaps you forgot to load \"%"SVf"\"?)", - SVfARG(newSVpvn_flags(name, nend - name, - SVs_TEMP | is_utf8)), + UTF8fARG(is_utf8, nend - name, name), SVfARG(packnamesv), SVfARG(packnamesv)); } } @@ -1057,7 +1056,7 @@ Perl_gv_fetchmethod_pvn_flags(pTHX_ HV * GV* stubgv; GV* autogv; - if (CvANON(cv)) + if (CvANON(cv) || !CvGV(cv)) stubgv = gv; else { stubgv = CvGV(cv); @@ -1139,9 +1138,10 @@ Perl_gv_autoload_pvn(pTHX_ HV *stash, co && (GvCVGEN(gv) || GvSTASH(gv) != stash) ) Perl_ck_warner_d(aTHX_ packWARN(WARN_DEPRECATED), - "Use of inherited AUTOLOAD for non-method %"SVf"::%"SVf"() is deprecated", + "Use of inherited AUTOLOAD for non-method %"SVf + "::%"UTF8f"() is deprecated", SVfARG(packname), - SVfARG(newSVpvn_flags(name, len, SVs_TEMP | is_utf8))); + UTF8fARG(is_utf8, len, name)); if (CvISXSUB(cv)) { /* Instead of forcing the XSUB do another lookup for $AUTOLOAD @@ -1256,14 +1256,15 @@ S_require_tie_mod(pTHX_ GV *gv, const ch so save it. For the moment it's always a single char. */ const char type = varname == '[' ? '$' : '%'; +#ifdef DEBUGGING dSP; +#endif ENTER; SAVEFREESV(namesv); if ( flags & 1 ) save_scalar(gv); - PUSHSTACKi(PERLSI_MAGIC); Perl_load_module(aTHX_ PERL_LOADMOD_NOIMPORT, module, NULL); - POPSTACK; + assert(sp == PL_stack_sp); stash = gv_stashsv(namesv, 0); if (!stash) Perl_croak(aTHX_ "panic: Can't use %c%c because %"SVf" is not available", @@ -1390,7 +1391,7 @@ Perl_gv_fetchsv(pTHX_ SV *name, I32 flag return gv_fetchpvn_flags(nambeg, len, flags | SvUTF8(name), sv_type); } -STATIC void +PERL_STATIC_INLINE void S_gv_magicalize_isa(pTHX_ GV *gv) { AV* av; @@ -1403,318 +1404,277 @@ S_gv_magicalize_isa(pTHX_ GV *gv) NULL, 0); } -GV * -Perl_gv_fetchpvn_flags(pTHX_ const char *nambeg, STRLEN full_len, I32 flags, - const svtype sv_type) +/* This function grabs name and tries to split a stash and glob + * from its contents. TODO better description, comments + * + * If the function returns TRUE and 'name == name_end', then + * 'gv' can be directly returned to the caller of gv_fetchpvn_flags + */ +PERL_STATIC_INLINE bool +S_parse_gv_stash_name(pTHX_ HV **stash, GV **gv, const char **name, + STRLEN *len, const char *nambeg, STRLEN full_len, + const U32 is_utf8, const I32 add) { - dVAR; - const char *name = nambeg; - GV *gv = NULL; - GV**gvp; - I32 len; const char *name_cursor; - HV *stash = NULL; - const I32 no_init = flags & (GV_NOADD_NOINIT | GV_NOINIT); - const I32 no_expand = flags & GV_NOEXPAND; - const I32 add = flags & ~GV_NOADD_MASK; - const U32 is_utf8 = flags & SVf_UTF8; - bool addmg = !!(flags & GV_ADDMG); const char *const name_end = nambeg + full_len; const char *const name_em1 = name_end - 1; - U32 faking_it; - PERL_ARGS_ASSERT_GV_FETCHPVN_FLAGS; - - if (flags & GV_NOTQUAL) { - /* Caller promised that there is no stash, so we can skip the check. */ - len = full_len; - goto no_stash; - } - - if (full_len > 2 && *name == '*' && isIDFIRST_lazy_if(name + 1, is_utf8)) { - /* accidental stringify on a GV? */ - name++; - } - - for (name_cursor = name; name_cursor < name_end; name_cursor++) { - if (name_cursor < name_em1 && - ((*name_cursor == ':' - && name_cursor[1] == ':') - || *name_cursor == '\'')) - { - if (!stash) - stash = PL_defstash; - if (!stash || !SvREFCNT(stash)) /* symbol table under destruction */ - return NULL; - - len = name_cursor - name; - if (name_cursor > nambeg) { /* Skip for initial :: or ' */ - const char *key; - if (*name_cursor == ':') { - key = name; - len += 2; - } else { - char *tmpbuf; - Newx(tmpbuf, len+2, char); - Copy(name, tmpbuf, len, char); - tmpbuf[len++] = ':'; - tmpbuf[len++] = ':'; - key = tmpbuf; - } - gvp = (GV**)hv_fetch(stash, key, is_utf8 ? -len : len, add); - gv = gvp ? *gvp : NULL; - if (gv && gv != (const GV *)&PL_sv_undef) { - if (SvTYPE(gv) != SVt_PVGV) - gv_init_pvn(gv, stash, key, len, (add & GV_ADDMULTI)|is_utf8); - else - GvMULTI_on(gv); - } - if (key != name) - Safefree(key); - if (!gv || gv == (const GV *)&PL_sv_undef) - return NULL; - - if (!(stash = GvHV(gv))) - { - stash = GvHV(gv) = newHV(); - if (!HvNAME_get(stash)) { - if (GvSTASH(gv) == PL_defstash && len == 6 - && strnEQ(name, "CORE", 4)) - hv_name_set(stash, "CORE", 4, 0); - else - hv_name_set( - stash, nambeg, name_cursor-nambeg, is_utf8 - ); - /* If the containing stash has multiple effective - names, see that this one gets them, too. */ - if (HvAUX(GvSTASH(gv))->xhv_name_count) - mro_package_moved(stash, NULL, gv, 1); - } - } - else if (!HvNAME_get(stash)) - hv_name_set(stash, nambeg, name_cursor - nambeg, is_utf8); - } - - if (*name_cursor == ':') - name_cursor++; - name = name_cursor+1; - if (name == name_end) - return gv - ? gv : MUTABLE_GV(*hv_fetchs(PL_defstash, "main::", TRUE)); - } + PERL_ARGS_ASSERT_PARSE_GV_STASH_NAME; + + if (full_len > 2 && **name == '*' && isIDFIRST_lazy_if(*name + 1, is_utf8)) { + /* accidental stringify on a GV? */ + (*name)++; } - len = name_cursor - name; - - /* No stash in name, so see how we can default */ - if (!stash) { - no_stash: - if (len && isIDFIRST_lazy_if(name, is_utf8)) { - bool global = FALSE; - - switch (len) { - case 1: - if (*name == '_') - global = TRUE; - break; - case 3: - if ((name[0] == 'I' && name[1] == 'N' && name[2] == 'C') - || (name[0] == 'E' && name[1] == 'N' && name[2] == 'V') - || (name[0] == 'S' && name[1] == 'I' && name[2] == 'G')) - global = TRUE; - break; - case 4: - if (name[0] == 'A' && name[1] == 'R' && name[2] == 'G' - && name[3] == 'V') - global = TRUE; - break; - case 5: - if (name[0] == 'S' && name[1] == 'T' && name[2] == 'D' - && name[3] == 'I' && name[4] == 'N') - global = TRUE; - break; - case 6: - if ((name[0] == 'S' && name[1] == 'T' && name[2] == 'D') - &&((name[3] == 'O' && name[4] == 'U' && name[5] == 'T') - ||(name[3] == 'E' && name[4] == 'R' && name[5] == 'R'))) - global = TRUE; - break; - case 7: - if (name[0] == 'A' && name[1] == 'R' && name[2] == 'G' - && name[3] == 'V' && name[4] == 'O' && name[5] == 'U' - && name[6] == 'T') - global = TRUE; - break; - } + for (name_cursor = *name; name_cursor < name_end; name_cursor++) { + if (name_cursor < name_em1 && + ((*name_cursor == ':' && name_cursor[1] == ':') + || *name_cursor == '\'')) + { + if (!*stash) + *stash = PL_defstash; + if (!*stash || !SvREFCNT(*stash)) /* symbol table under destruction */ + return FALSE; + + *len = name_cursor - *name; + if (name_cursor > nambeg) { /* Skip for initial :: or ' */ + const char *key; + GV**gvp; + if (*name_cursor == ':') { + key = *name; + *len += 2; + } + else { + char *tmpbuf; + Newx(tmpbuf, *len+2, char); + Copy(*name, tmpbuf, *len, char); + tmpbuf[(*len)++] = ':'; + tmpbuf[(*len)++] = ':'; + key = tmpbuf; + } + gvp = (GV**)hv_fetch(*stash, key, is_utf8 ? -((I32)*len) : (I32)*len, add); + *gv = gvp ? *gvp : NULL; + if (*gv && *gv != (const GV *)&PL_sv_undef) { + if (SvTYPE(*gv) != SVt_PVGV) + gv_init_pvn(*gv, *stash, key, *len, (add & GV_ADDMULTI)|is_utf8); + else + GvMULTI_on(*gv); + } + if (key != *name) + Safefree(key); + if (!*gv || *gv == (const GV *)&PL_sv_undef) + return FALSE; + + if (!(*stash = GvHV(*gv))) { + *stash = GvHV(*gv) = newHV(); + if (!HvNAME_get(*stash)) { + if (GvSTASH(*gv) == PL_defstash && *len == 6 + && strnEQ(*name, "CORE", 4)) + hv_name_set(*stash, "CORE", 4, 0); + else + hv_name_set( + *stash, nambeg, name_cursor-nambeg, is_utf8 + ); + /* If the containing stash has multiple effective + names, see that this one gets them, too. */ + if (HvAUX(GvSTASH(*gv))->xhv_name_count) + mro_package_moved(*stash, NULL, *gv, 1); + } + } + else if (!HvNAME_get(*stash)) + hv_name_set(*stash, nambeg, name_cursor - nambeg, is_utf8); + } - if (global) - stash = PL_defstash; - else if (IN_PERL_COMPILETIME) { - stash = PL_curstash; - if (add && (PL_hints & HINT_STRICT_VARS) && - sv_type != SVt_PVCV && - sv_type != SVt_PVGV && - sv_type != SVt_PVFM && - sv_type != SVt_PVIO && - !(len == 1 && sv_type == SVt_PV && - (*name == 'a' || *name == 'b')) ) - { - gvp = (GV**)hv_fetch(stash,name,is_utf8 ? -len : len,0); - if (!gvp || - *gvp == (const GV *)&PL_sv_undef || - SvTYPE(*gvp) != SVt_PVGV) - { - stash = NULL; - } - else if ((sv_type == SVt_PV && !GvIMPORTED_SV(*gvp)) || - (sv_type == SVt_PVAV && !GvIMPORTED_AV(*gvp)) || - (sv_type == SVt_PVHV && !GvIMPORTED_HV(*gvp)) ) - { - SV* namesv = newSVpvn_flags(name, len, SVs_TEMP | is_utf8); - /* diag_listed_as: Variable "%s" is not imported%s */ - Perl_ck_warner_d( - aTHX_ packWARN(WARN_MISC), - "Variable \"%c%"SVf"\" is not imported", - sv_type == SVt_PVAV ? '@' : - sv_type == SVt_PVHV ? '%' : '$', - SVfARG(namesv)); - if (GvCVu(*gvp)) - Perl_ck_warner_d( - aTHX_ packWARN(WARN_MISC), - "\t(Did you mean &%"SVf" instead?)\n", SVfARG(namesv) - ); - stash = NULL; - } - } - } - else - stash = CopSTASH(PL_curcop); - } - else - stash = PL_defstash; + if (*name_cursor == ':') + name_cursor++; + *name = name_cursor+1; + if (*name == name_end) { + if (!*gv) + *gv = MUTABLE_GV(*hv_fetchs(PL_defstash, "main::", TRUE)); + return TRUE; + } + } } + *len = name_cursor - *name; + return TRUE; +} - /* By this point we should have a stash and a name */ - - if (!stash) { - if (add && !PL_in_clean_all) { - SV * const namesv = newSVpvn_flags(name, len, is_utf8); - SV * const err = Perl_mess(aTHX_ - "Global symbol \"%s%"SVf"\" requires explicit package name", - (sv_type == SVt_PV ? "$" - : sv_type == SVt_PVAV ? "@" - : sv_type == SVt_PVHV ? "%" - : ""), SVfARG(namesv)); - GV *gv; - SvREFCNT_dec_NN(namesv); - if (is_utf8) - SvUTF8_on(err); - qerror(err); - gv = gv_fetchpvs("::", GV_ADDMULTI, SVt_PVHV); - if(!gv) { - /* symbol table under destruction */ - return NULL; - } - stash = GvHV(gv); - } - else - return NULL; +/* Checks if an unqualified name is in the main stash */ +PERL_STATIC_INLINE bool +S_gv_is_in_main(pTHX_ const char *name, STRLEN len, const U32 is_utf8) +{ + PERL_ARGS_ASSERT_GV_IS_IN_MAIN; + + /* If it's an alphanumeric variable */ + if ( len && isIDFIRST_lazy_if(name, is_utf8) ) { + /* Some "normal" variables are always in main::, + * like INC or STDOUT. + */ + switch (len) { + case 1: + if (*name == '_') + return TRUE; + break; + case 3: + if ((name[0] == 'I' && name[1] == 'N' && name[2] == 'C') + || (name[0] == 'E' && name[1] == 'N' && name[2] == 'V') + || (name[0] == 'S' && name[1] == 'I' && name[2] == 'G')) + return TRUE; + break; + case 4: + if (name[0] == 'A' && name[1] == 'R' && name[2] == 'G' + && name[3] == 'V') + return TRUE; + break; + case 5: + if (name[0] == 'S' && name[1] == 'T' && name[2] == 'D' + && name[3] == 'I' && name[4] == 'N') + return TRUE; + break; + case 6: + if ((name[0] == 'S' && name[1] == 'T' && name[2] == 'D') + &&((name[3] == 'O' && name[4] == 'U' && name[5] == 'T') + ||(name[3] == 'E' && name[4] == 'R' && name[5] == 'R'))) + return TRUE; + break; + case 7: + if (name[0] == 'A' && name[1] == 'R' && name[2] == 'G' + && name[3] == 'V' && name[4] == 'O' && name[5] == 'U' + && name[6] == 'T') + return TRUE; + break; + } } + /* *{""}, or a special variable like $@ */ + else + return TRUE; + + return FALSE; +} - if (!SvREFCNT(stash)) /* symbol table under destruction */ - return NULL; - gvp = (GV**)hv_fetch(stash,name,is_utf8 ? -len : len,add); - if (!gvp || *gvp == (const GV *)&PL_sv_undef) { - if (addmg) gv = (GV *)newSV(0); - else return NULL; - } - else gv = *gvp, addmg = 0; - /* From this point on, addmg means gv has not been inserted in the - symtab yet. */ +/* This function is called if parse_gv_stash_name() failed to + * find a stash, or if GV_NOTQUAL or an empty name was passed + * to gv_fetchpvn_flags. + * + * It returns FALSE if the default stash can't be found nor created, + * which might happen during global destruction. + */ +PERL_STATIC_INLINE bool +S_find_default_stash(pTHX_ HV **stash, const char *name, STRLEN len, + const U32 is_utf8, const I32 add, + const svtype sv_type) +{ + PERL_ARGS_ASSERT_FIND_DEFAULT_STASH; + + /* No stash in name, so see how we can default */ - if (SvTYPE(gv) == SVt_PVGV) { - if (add) { - GvMULTI_on(gv); - gv_init_svtype(gv, sv_type); - /* You reach this path once the typeglob has already been created, - either by the same or a different sigil. If this path didn't - exist, then (say) referencing $! first, and %! second would - mean that %! was not handled correctly. */ - if (len == 1 && stash == PL_defstash) { - if (sv_type == SVt_PVHV || sv_type == SVt_PVGV) { - if (*name == '!') - require_tie_mod(gv, "!", newSVpvs("Errno"), "TIEHASH", 1); - else if (*name == '-' || *name == '+') - require_tie_mod(gv, name, newSVpvs("Tie::Hash::NamedCapture"), "TIEHASH", 0); - } else if (sv_type == SVt_PV) { - if (*name == '*' || *name == '#') { - /* diag_listed_as: $* is no longer supported */ - Perl_ck_warner_d(aTHX_ packWARN2(WARN_DEPRECATED, - WARN_SYNTAX), - "$%c is no longer supported", *name); - } - } - if (sv_type==SVt_PV || sv_type==SVt_PVGV) { - switch (*name) { - case '[': - require_tie_mod(gv,name,newSVpvs("arybase"),"FETCH",0); - break; -#ifdef PERL_SAWAMPERSAND - case '`': - PL_sawampersand |= SAWAMPERSAND_LEFT; - (void)GvSVn(gv); - break; - case '&': - PL_sawampersand |= SAWAMPERSAND_MIDDLE; - (void)GvSVn(gv); - break; - case '\'': - PL_sawampersand |= SAWAMPERSAND_RIGHT; - (void)GvSVn(gv); - break; -#endif + if ( gv_is_in_main(name, len, is_utf8) ) { + *stash = PL_defstash; + } + else { + if (IN_PERL_COMPILETIME) { + *stash = PL_curstash; + if (add && (PL_hints & HINT_STRICT_VARS) && + sv_type != SVt_PVCV && + sv_type != SVt_PVGV && + sv_type != SVt_PVFM && + sv_type != SVt_PVIO && + !(len == 1 && sv_type == SVt_PV && + (*name == 'a' || *name == 'b')) ) + { + GV**gvp = (GV**)hv_fetch(*stash,name,is_utf8 ? -(I32)len : (I32)len,0); + if (!gvp || *gvp == (const GV *)&PL_sv_undef || + SvTYPE(*gvp) != SVt_PVGV) + { + *stash = NULL; } - } - } - else if (len == 3 && sv_type == SVt_PVAV - && strnEQ(name, "ISA", 3) - && (!GvAV(gv) || !SvSMAGICAL(GvAV(gv)))) - gv_magicalize_isa(gv); - } - return gv; - } else if (no_init) { - assert(!addmg); - return gv; - } else if (no_expand && SvROK(gv)) { - assert(!addmg); - return gv; + else if ((sv_type == SVt_PV && !GvIMPORTED_SV(*gvp)) || + (sv_type == SVt_PVAV && !GvIMPORTED_AV(*gvp)) || + (sv_type == SVt_PVHV && !GvIMPORTED_HV(*gvp)) ) + { + /* diag_listed_as: Variable "%s" is not imported%s */ + Perl_ck_warner_d( + aTHX_ packWARN(WARN_MISC), + "Variable \"%c%"UTF8f"\" is not imported", + sv_type == SVt_PVAV ? '@' : + sv_type == SVt_PVHV ? '%' : '$', + UTF8fARG(is_utf8, len, name)); + if (GvCVu(*gvp)) + Perl_ck_warner_d( + aTHX_ packWARN(WARN_MISC), + "\t(Did you mean &%"UTF8f" instead?)\n", + UTF8fARG(is_utf8, len, name) + ); + *stash = NULL; + } + } + } + else { + /* Use the current op's stash */ + *stash = CopSTASH(PL_curcop); + } } - /* Adding a new symbol. - Unless of course there was already something non-GV here, in which case - we want to behave as if there was always a GV here, containing some sort - of subroutine. - Otherwise we run the risk of creating things like GvIO, which can cause - subtle bugs. eg the one that tripped up SQL::Translator */ + if (!*stash) { + if (add && !PL_in_clean_all) { + SV * const err = Perl_mess(aTHX_ + "Global symbol \"%s%"UTF8f + "\" requires explicit package name", + (sv_type == SVt_PV ? "$" + : sv_type == SVt_PVAV ? "@" + : sv_type == SVt_PVHV ? "%" + : ""), UTF8fARG(is_utf8, len, name)); + GV *gv; + if (is_utf8) + SvUTF8_on(err); + qerror(err); + /* To maintain the output of errors after the strict exception + * above, and to keep compat with older releases, rather than + * placing the variables in the pad, we place + * them in the :: stash. + */ + gv = gv_fetchpvs("::", GV_ADDMULTI, SVt_PVHV); + if (!gv) { + /* symbol table under destruction */ + return FALSE; + } + *stash = GvHV(gv); + } + else + return FALSE; + } - faking_it = SvOK(gv); + if (!SvREFCNT(*stash)) /* symbol table under destruction */ + return FALSE; - if (add & GV_ADDWARN) - Perl_ck_warner_d(aTHX_ packWARN(WARN_INTERNAL), "Had to create %"SVf" unexpectedly", - SVfARG(newSVpvn_flags(nambeg, name_end-nambeg, SVs_TEMP | is_utf8 ))); - gv_init_pvn(gv, stash, name, len, (add & GV_ADDMULTI)|is_utf8); + return TRUE; +} - if ( isIDFIRST_lazy_if(name, is_utf8) - && ! (isLEXWARN_on ? ckWARN(WARN_ONCE) : (PL_dowarn & G_WARN_ON ) ) ) - GvMULTI_on(gv) ; +/* gv_magicalize() is called by gv_fetchpvn_flags when creating + * a new GV. + * Note that it does not insert the GV into the stash prior to + * magicalization, which some variables require need in order + * to work (like $[, %+, %-, %!), so callers must take care of + * that beforehand. + * + * The return value has a specific meaning for gv_fetchpvn_flags: + * If it returns true, and the gv is empty, it indicates that its + * refcount should be decreased. + */ +PERL_STATIC_INLINE bool +S_gv_magicalize(pTHX_ GV *gv, HV *stash, const char *name, STRLEN len, + bool addmg, const svtype sv_type) +{ + SSize_t paren; - /* set up magic where warranted */ + PERL_ARGS_ASSERT_GV_MAGICALIZE; + if (stash != PL_defstash) { /* not the main stash */ - /* We only have to check for three names here: EXPORT, ISA + /* We only have to check for a few names here: a, b, EXPORT, ISA and VERSION. All the others apply only to the main stash or to CORE (which is checked right after this). */ - if (len > 2) { + if (len) { const char * const name2 = name + 1; switch (*name) { case 'E': @@ -1729,10 +1689,15 @@ Perl_gv_fetchpvn_flags(pTHX_ const char if (strEQ(name2, "ERSION")) GvMULTI_on(gv); break; + case 'a': + case 'b': + if (len == 1 && sv_type == SVt_PV) + GvMULTI_on(gv); + /* FALL THROUGH */ default: goto try_core; } - goto add_magical_gv; + return addmg; } try_core: if (len > 1 /* shortest is uc */ && HvNAMELEN_get(stash) == 4) { @@ -1749,7 +1714,13 @@ Perl_gv_fetchpvn_flags(pTHX_ const char /* Nothing else to do. The compiler will probably turn the switch statement into a branch table. Make sure we avoid even that small overhead for - the common case of lower case variable names. */ + the common case of lower case variable names. (On EBCDIC + platforms, we can't just do: + if (NATIVE_TO_ASCII(*name) > NATIVE_TO_ASCII('V') ) { + because cases like '\027' in the switch statement below are + C1 (non-ASCII) controls on those platforms, so the remapping + would make them larger than 'V') + */ } else #endif { @@ -1824,15 +1795,24 @@ Perl_gv_fetchpvn_flags(pTHX_ const char goto ro_magicalize; break; case '\015': /* $^MATCH */ - if (strEQ(name2, "ATCH")) - goto magicalize; + if (strEQ(name2, "ATCH")) { + paren = RX_BUFF_IDX_CARET_FULLMATCH; + goto storeparen; + } + break; case '\017': /* $^OPEN */ if (strEQ(name2, "PEN")) goto magicalize; break; case '\020': /* $^PREMATCH $^POSTMATCH */ - if (strEQ(name2, "REMATCH") || strEQ(name2, "OSTMATCH")) - goto magicalize; + if (strEQ(name2, "REMATCH")) { + paren = RX_BUFF_IDX_CARET_PREMATCH; + goto storeparen; + } + if (strEQ(name2, "OSTMATCH")) { + paren = RX_BUFF_IDX_CARET_POSTMATCH; + goto storeparen; + } break; case '\024': /* ${^TAINT} */ if (strEQ(name2, "AINT")) @@ -1865,9 +1845,11 @@ Perl_gv_fetchpvn_flags(pTHX_ const char /* This snippet is taken from is_gv_magical */ const char *end = name + len; while (--end > name) { - if (!isDIGIT(*end)) goto add_magical_gv; + if (!isDIGIT(*end)) + return addmg; } - goto magicalize; + paren = strtoul(name, NULL, 10); + goto storeparen; } } } @@ -1876,8 +1858,14 @@ Perl_gv_fetchpvn_flags(pTHX_ const char be case '\0' in this switch statement (ie a default case) */ switch (*name) { case '&': /* $& */ + paren = RX_BUFF_IDX_FULLMATCH; + goto sawampersand; case '`': /* $` */ + paren = RX_BUFF_IDX_PREMATCH; + goto sawampersand; case '\'': /* $' */ + paren = RX_BUFF_IDX_POSTMATCH; + sawampersand: #ifdef PERL_SAWAMPERSAND if (!( sv_type == SVt_PVAV || @@ -1893,7 +1881,23 @@ Perl_gv_fetchpvn_flags(pTHX_ const char : SAWAMPERSAND_RIGHT; } #endif - goto magicalize; + goto storeparen; + case '1': /* $1 */ + case '2': /* $2 */ + case '3': /* $3 */ + case '4': /* $4 */ + case '5': /* $5 */ + case '6': /* $6 */ + case '7': /* $7 */ + case '8': /* $8 */ + case '9': /* $9 */ + paren = *name - '0'; + + storeparen: + /* Flag the capture variables with a NULL mg_ptr + Use mg_len for the array index to lookup. */ + sv_magic(GvSVn(gv), MUTABLE_SV(gv), PERL_MAGIC_sv, NULL, paren); + break; case ':': /* $: */ sv_setpv(GvSVn(gv),PL_chopset); @@ -1914,9 +1918,8 @@ Perl_gv_fetchpvn_flags(pTHX_ const char /* magicalization must be done before require_tie_mod is called */ if (sv_type == SVt_PVHV || sv_type == SVt_PVGV) { - if (addmg) (void)hv_store(stash,name,len,(SV *)gv,0); - addmg = 0; require_tie_mod(gv, "!", newSVpvs("Errno"), "TIEHASH", 1); + addmg = FALSE; } break; @@ -1935,9 +1938,8 @@ Perl_gv_fetchpvn_flags(pTHX_ const char if (sv_type == SVt_PVHV || sv_type == SVt_PVGV) { - if (addmg) (void)hv_store(stash,name,len,(SV *)gv,0); - addmg = 0; require_tie_mod(gv, name, newSVpvs("Tie::Hash::NamedCapture"), "TIEHASH", 0); + addmg = FALSE; } break; @@ -1958,9 +1960,8 @@ Perl_gv_fetchpvn_flags(pTHX_ const char case '[': /* $[ */ if ((sv_type == SVt_PV || sv_type == SVt_PVGV) && FEATURE_ARYBASE_IS_ENABLED) { - if (addmg) (void)hv_store(stash,name,len,(SV *)gv,0); require_tie_mod(gv,name,newSVpvs("arybase"),"FETCH",0); - addmg = 0; + addmg = FALSE; } else goto magicalize; break; @@ -1969,15 +1970,6 @@ Perl_gv_fetchpvn_flags(pTHX_ const char SvREADONLY_on(GvSVn(gv)); /* FALL THROUGH */ case '0': /* $0 */ - case '1': /* $1 */ - case '2': /* $2 */ - case '3': /* $3 */ - case '4': /* $4 */ - case '5': /* $5 */ - case '6': /* $6 */ - case '7': /* $7 */ - case '8': /* $8 */ - case '9': /* $9 */ case '^': /* $^ */ case '~': /* $~ */ case '=': /* $= */ @@ -2030,16 +2022,202 @@ Perl_gv_fetchpvn_flags(pTHX_ const char SvREFCNT_dec(sv); } break; + case 'a': + case 'b': + if (sv_type == SVt_PV) + GvMULTI_on(gv); } } - add_magical_gv: - if (addmg) { - if (GvAV(gv) || GvHV(gv) || GvIO(gv) || GvCV(gv) || ( - GvSV(gv) && (SvOK(GvSV(gv)) || SvMAGICAL(GvSV(gv))) - )) - (void)hv_store(stash,name,len,(SV *)gv,0); - else SvREFCNT_dec_NN(gv), gv = NULL; + + return addmg; +} + +/* This function is called when the stash already holds the GV of the magic + * variable we're looking for, but we need to check that it has the correct + * kind of magic. For example, if someone first uses $! and then %!, the + * latter would end up here, and we add the Errno tie to the HASH slot of + * the *! glob. + */ +PERL_STATIC_INLINE void +S_maybe_multimagic_gv(pTHX_ GV *gv, const char *name, const svtype sv_type) +{ + PERL_ARGS_ASSERT_MAYBE_MULTIMAGIC_GV; + + if (sv_type == SVt_PVHV || sv_type == SVt_PVGV) { + if (*name == '!') + require_tie_mod(gv, "!", newSVpvs("Errno"), "TIEHASH", 1); + else if (*name == '-' || *name == '+') + require_tie_mod(gv, name, newSVpvs("Tie::Hash::NamedCapture"), "TIEHASH", 0); + } else if (sv_type == SVt_PV) { + if (*name == '*' || *name == '#') { + /* diag_listed_as: $* is no longer supported */ + Perl_ck_warner_d(aTHX_ packWARN2(WARN_DEPRECATED, + WARN_SYNTAX), + "$%c is no longer supported", *name); + } + } + if (sv_type==SVt_PV || sv_type==SVt_PVGV) { + switch (*name) { + case '[': + require_tie_mod(gv,name,newSVpvs("arybase"),"FETCH",0); + break; +#ifdef PERL_SAWAMPERSAND + case '`': + PL_sawampersand |= SAWAMPERSAND_LEFT; + (void)GvSVn(gv); + break; + case '&': + PL_sawampersand |= SAWAMPERSAND_MIDDLE; + (void)GvSVn(gv); + break; + case '\'': + PL_sawampersand |= SAWAMPERSAND_RIGHT; + (void)GvSVn(gv); + break; +#endif + } } +} + +GV * +Perl_gv_fetchpvn_flags(pTHX_ const char *nambeg, STRLEN full_len, I32 flags, + const svtype sv_type) +{ + dVAR; + const char *name = nambeg; + GV *gv = NULL; + GV**gvp; + STRLEN len; + HV *stash = NULL; + const I32 no_init = flags & (GV_NOADD_NOINIT | GV_NOINIT); + const I32 no_expand = flags & GV_NOEXPAND; + const I32 add = flags & ~GV_NOADD_MASK; + const U32 is_utf8 = flags & SVf_UTF8; + bool addmg = cBOOL(flags & GV_ADDMG); + const char *const name_end = nambeg + full_len; + U32 faking_it; + + PERL_ARGS_ASSERT_GV_FETCHPVN_FLAGS; + + /* If we have GV_NOTQUAL, the caller promised that + * there is no stash, so we can skip the check. + * Similarly if full_len is 0, since then we're + * dealing with something like *{""} or ""->foo() + */ + if ((flags & GV_NOTQUAL) || !full_len) { + len = full_len; + } + else if (parse_gv_stash_name(&stash, &gv, &name, &len, nambeg, full_len, is_utf8, add)) { + if (name == name_end) return gv; + } + else { + return NULL; + } + + if (!stash && !find_default_stash(&stash, name, len, is_utf8, add, sv_type)) { + return NULL; + } + + /* By this point we should have a stash and a name */ + gvp = (GV**)hv_fetch(stash,name,is_utf8 ? -(I32)len : (I32)len,add); + if (!gvp || *gvp == (const GV *)&PL_sv_undef) { + if (addmg) gv = (GV *)newSV(0); + else return NULL; + } + else gv = *gvp, addmg = 0; + /* From this point on, addmg means gv has not been inserted in the + symtab yet. */ + + if (SvTYPE(gv) == SVt_PVGV) { + /* The GV already exists, so return it, but check if we need to do + * anything else with it before that. + */ + if (add) { + /* This is the heuristic that handles if a variable triggers the + * 'used only once' warning. If there's already a GV in the stash + * with this name, then we assume that the variable has been used + * before and turn its MULTI flag on. + * It's a heuristic because it can easily be "tricked", like with + * BEGIN { $a = 1; $::{foo} = *a }; () = $foo + * not warning about $main::foo being used just once + */ + GvMULTI_on(gv); + gv_init_svtype(gv, sv_type); + /* You reach this path once the typeglob has already been created, + either by the same or a different sigil. If this path didn't + exist, then (say) referencing $! first, and %! second would + mean that %! was not handled correctly. */ + if (len == 1 && stash == PL_defstash) { + maybe_multimagic_gv(gv, name, sv_type); + } + else if (len == 3 && sv_type == SVt_PVAV + && strnEQ(name, "ISA", 3) + && (!GvAV(gv) || !SvSMAGICAL(GvAV(gv)))) + gv_magicalize_isa(gv); + } + return gv; + } else if (no_init) { + assert(!addmg); + return gv; + } + /* If GV_NOEXPAND is true and what we got off the stash is a ref, + * don't expand it to a glob. This is an optimization so that things + * copying constants over, like Exporter, don't have to be rewritten + * to take into account that you can store more than just globs in + * stashes. + */ + else if (no_expand && SvROK(gv)) { + assert(!addmg); + return gv; + } + + /* Adding a new symbol. + Unless of course there was already something non-GV here, in which case + we want to behave as if there was always a GV here, containing some sort + of subroutine. + Otherwise we run the risk of creating things like GvIO, which can cause + subtle bugs. eg the one that tripped up SQL::Translator */ + + faking_it = SvOK(gv); + + if (add & GV_ADDWARN) + Perl_ck_warner_d(aTHX_ packWARN(WARN_INTERNAL), + "Had to create %"UTF8f" unexpectedly", + UTF8fARG(is_utf8, name_end-nambeg, nambeg)); + gv_init_pvn(gv, stash, name, len, (add & GV_ADDMULTI)|is_utf8); + + if ( isIDFIRST_lazy_if(name, is_utf8) && !ckWARN(WARN_ONCE) ) + GvMULTI_on(gv) ; + + /* First, store the gv in the symtab if we're adding magic, + * but only for non-empty GVs + */ +#define GvEMPTY(gv) !(GvAV(gv) || GvHV(gv) || GvIO(gv) \ + || GvCV(gv) || (GvSV(gv) && SvOK(GvSV(gv)))) + + if ( addmg && !GvEMPTY(gv) ) { + (void)hv_store(stash,name,len,(SV *)gv,0); + } + + /* set up magic where warranted */ + if ( gv_magicalize(gv, stash, name, len, addmg, sv_type) ) { + /* See 23496c6 */ + if (GvEMPTY(gv)) { + if ( GvSV(gv) && SvMAGICAL(GvSV(gv)) ) { + /* The GV was and still is "empty", except that now + * it has the magic flags turned on, so we want it + * stored in the symtab. + */ + (void)hv_store(stash,name,len,(SV *)gv,0); + } + else { + /* Most likely the temporary GV created above */ + SvREFCNT_dec_NN(gv); + gv = NULL; + } + } + } + if (gv) gv_init_svtype(gv, faking_it ? SVt_PVCV : sv_type); return gv; } @@ -2075,8 +2253,13 @@ Perl_gv_efullname4(pTHX_ SV *sv, const G gv_fullname4(sv, egv ? egv : gv, prefix, keepmain); } + +/* recursively scan a stash and any nested stashes looking for entries + * that need the "only used once" warning raised + */ + void -Perl_gv_check(pTHX_ const HV *stash) +Perl_gv_check(pTHX_ HV *stash) { dVAR; I32 i; @@ -2085,15 +2268,23 @@ Perl_gv_check(pTHX_ const HV *stash) if (!HvARRAY(stash)) return; + + assert(SvOOK(stash)); + for (i = 0; i <= (I32) HvMAX(stash); i++) { const HE *entry; + /* mark stash is being scanned, to avoid recursing */ + HvAUX(stash)->xhv_aux_flags |= HvAUXf_SCAN_STASH; for (entry = HvARRAY(stash)[i]; entry; entry = HeNEXT(entry)) { GV *gv; HV *hv; if (HeKEY(entry)[HeKLEN(entry)-1] == ':' && (gv = MUTABLE_GV(HeVAL(entry))) && isGV(gv) && (hv = GvHV(gv))) { - if (hv != PL_defstash && hv != stash) + if (hv != PL_defstash && hv != stash + && !(SvOOK(hv) + && (HvAUX(hv)->xhv_aux_flags & HvAUXf_SCAN_STASH)) + ) gv_check(hv); /* nested package */ } else if ( *HeKEY(entry) != '_' @@ -2117,6 +2308,7 @@ Perl_gv_check(pTHX_ const HV *stash) HEKfARG(GvNAME_HEK(gv))); } } + HvAUX(stash)->xhv_aux_flags &= ~HvAUXf_SCAN_STASH; } } @@ -2125,10 +2317,10 @@ Perl_newGVgen_flags(pTHX_ const char *pa { dVAR; PERL_ARGS_ASSERT_NEWGVGEN_FLAGS; + assert(!(flags & ~SVf_UTF8)); - return gv_fetchpv(Perl_form(aTHX_ "%"SVf"::_GEN_%ld", - SVfARG(newSVpvn_flags(pack, strlen(pack), - SVs_TEMP | flags)), + return gv_fetchpv(Perl_form(aTHX_ "%"UTF8f"::_GEN_%ld", + UTF8fARG(flags, strlen(pack), pack), (long)PL_gensym++), GV_ADD, SVt_PVGV); } @@ -2170,9 +2362,11 @@ Perl_gp_free(pTHX_ GV *gv) pTHX__FORMAT pTHX__VALUE); return; } - if (--gp->gp_refcnt > 0) { + if (gp->gp_refcnt > 1) { + borrowed: if (gp->gp_egv == gv) gp->gp_egv = 0; + gp->gp_refcnt--; GvGP_set(gv, NULL); return; } @@ -2207,15 +2401,16 @@ Perl_gp_free(pTHX_ GV *gv) const HEK *hvname_hek = HvNAME_HEK(hv); DEBUG_o(Perl_deb(aTHX_ "gp_free clearing PL_stashcache for '%"HEKf"'\n", hvname_hek)); if (PL_stashcache && hvname_hek) - (void)hv_delete(PL_stashcache, HEK_KEY(hvname_hek), - (HEK_UTF8(hvname_hek) ? -HEK_LEN(hvname_hek) : HEK_LEN(hvname_hek)), - G_DISCARD); + (void)hv_deletehek(PL_stashcache, hvname_hek, G_DISCARD); SvREFCNT_dec(hv); } SvREFCNT_dec(io); SvREFCNT_dec(cv); SvREFCNT_dec(form); + /* Possibly reallocated by a destructor */ + gp = GvGP(gv); + if (!gp->gp_file_hek && !gp->gp_sv && !gp->gp_av @@ -2232,6 +2427,8 @@ Perl_gp_free(pTHX_ GV *gv) } } + /* Possibly incremented by a destructor doing glob assignment */ + if (gp->gp_refcnt > 1) goto borrowed; Safefree(gp); GvGP_set(gv, NULL); } @@ -2294,6 +2491,8 @@ Perl_Gv_AMupdate(pTHX_ HV *stash, bool d { int filled = 0; int i; + bool deref_seen = 0; + /* Work with "fallback" key, which we assume to be first in PL_AMG_names */ @@ -2324,6 +2523,10 @@ Perl_Gv_AMupdate(pTHX_ HV *stash, bool d filled = 1; } + assert(SvOOK(stash)); + /* initially assume the worst */ + HvAUX(stash)->xhv_aux_flags &= ~HvAUXf_NO_DEREF; + for (i = 1; i < NofAMmeth; i++) { const char * const cooky = PL_AMG_names[i]; /* Human-readable form, for debugging: */ @@ -2390,7 +2593,26 @@ Perl_Gv_AMupdate(pTHX_ HV *stash, bool d filled = 1; } amt.table[i]=MUTABLE_CV(SvREFCNT_inc_simple(cv)); + + if (gv) { + switch (i) { + case to_sv_amg: + case to_av_amg: + case to_hv_amg: + case to_gv_amg: + case to_cv_amg: + case nomethod_amg: + deref_seen = 1; + break; + } + } } + if (!deref_seen) + /* none of @{} etc overloaded; we can do $obj->[N] quicker. + * NB - aux var invalid here, HvARRAY() could have been + * reallocated since it was assigned to */ + HvAUX(stash)->xhv_aux_flags |= HvAUXf_NO_DEREF; + if (filled) { AMT_AMAGIC_on(&amt); sv_magic(MUTABLE_SV(stash), 0, PERL_MAGIC_overload_table, @@ -2560,11 +2782,19 @@ Perl_try_amagic_bin(pTHX_ int method, in SV * Perl_amagic_deref_call(pTHX_ SV *ref, int method) { SV *tmpsv = NULL; + HV *stash; PERL_ARGS_ASSERT_AMAGIC_DEREF_CALL; - while (SvAMAGIC(ref) && - (tmpsv = amagic_call(ref, &PL_sv_undef, method, + if (!SvAMAGIC(ref)) + return ref; + /* return quickly if none of the deref ops are overloaded */ + stash = SvSTASH(SvRV(ref)); + assert(SvOOK(stash)); + if (HvAUX(stash)->xhv_aux_flags & HvAUXf_NO_DEREF) + return ref; + + while ((tmpsv = amagic_call(ref, &PL_sv_undef, method, AMGf_noright | AMGf_unary))) { if (!SvROK(tmpsv)) Perl_croak(aTHX_ "Overloaded dereference did not return a reference"); @@ -2573,6 +2803,8 @@ Perl_amagic_deref_call(pTHX_ SV *ref, in return tmpsv; } ref = tmpsv; + if (!SvAMAGIC(ref)) + break; } return tmpsv ? tmpsv : ref; } @@ -3002,7 +3234,6 @@ Perl_amagic_call(pTHX_ SV *left, SV *rig PL_op = (OP *) &myop; if (PERLDB_SUB && PL_curstash != PL_debstash) PL_op->op_private |= OPpENTERSUB_DB; - PUTBACK; Perl_pp_pushmark(aTHX); EXTEND(SP, notfound + 5); @@ -3150,6 +3381,8 @@ Perl_gv_try_downgrade(pTHX_ GV *gv) !GvSV(gv) && !GvAV(gv) && !GvHV(gv) && !GvIOp(gv) && !GvFORM(gv) && GvEGVx(gv) == gv && (stash = GvSTASH(gv)))) return; + if (gv == PL_statgv || gv == PL_last_in_gv || gv == PL_stderrgv) + return; if (SvMAGICAL(gv)) { MAGIC *mg; /* only backref magic is allowed */ @@ -3163,26 +3396,42 @@ Perl_gv_try_downgrade(pTHX_ GV *gv) cv = GvCV(gv); if (!cv) { HEK *gvnhek = GvNAME_HEK(gv); - (void)hv_delete(stash, HEK_KEY(gvnhek), - HEK_UTF8(gvnhek) ? -HEK_LEN(gvnhek) : HEK_LEN(gvnhek), G_DISCARD); - } else if (GvMULTI(gv) && cv && + (void)hv_deletehek(stash, gvnhek, G_DISCARD); + } else if (GvMULTI(gv) && cv && SvREFCNT(cv) == 1 && !SvOBJECT(cv) && !SvMAGICAL(cv) && !SvREADONLY(cv) && CvSTASH(cv) == stash && CvGV(cv) == gv && CvCONST(cv) && !CvMETHOD(cv) && !CvLVALUE(cv) && !CvUNIQUE(cv) && !CvNODEBUG(cv) && !CvCLONE(cv) && !CvCLONED(cv) && !CvANON(cv) && (namehek = GvNAME_HEK(gv)) && - (gvp = hv_fetch(stash, HEK_KEY(namehek), - HEK_LEN(namehek)*(HEK_UTF8(namehek) ? -1 : 1), 0)) && + (gvp = hv_fetchhek(stash, namehek, 0)) && *gvp == (SV*)gv) { SV *value = SvREFCNT_inc(CvXSUBANY(cv).any_ptr); + const bool imported = !!GvIMPORTED_CV(gv); SvREFCNT(gv) = 0; sv_clear((SV*)gv); SvREFCNT(gv) = 1; - SvFLAGS(gv) = SVt_IV|SVf_ROK; + SvFLAGS(gv) = SVt_IV|SVf_ROK|SVprv_PCS_IMPORTED * imported; SvANY(gv) = (XPVGV*)((char*)&(gv->sv_u.svu_iv) - STRUCT_OFFSET(XPVIV, xiv_iv)); SvRV_set(gv, value); } +} + +GV * +Perl_gv_override(pTHX_ const char * const name, const STRLEN len) +{ + GV *gv = gv_fetchpvn(name, len, GV_NOTQUAL, SVt_PVCV); + GV * const *gvp; + PERL_ARGS_ASSERT_GV_OVERRIDE; + if (gv && GvCVu(gv) && GvIMPORTED_CV(gv)) return gv; + gvp = (GV**)hv_fetch(PL_globalstash, name, len, FALSE); + gv = gvp ? *gvp : NULL; + if (gv && !isGV(gv)) { + if (!SvPCS_IMPORTED(gv)) return NULL; + gv_init(gv, PL_globalstash, name, len, 0); + return gv; + } + return gv && GvCVu(gv) && GvIMPORTED_CV(gv) ? gv : NULL; } #include "XSUB.h" Index: gnu/usr.bin/perl/gv.h =================================================================== RCS file: /mnt/memory/perl/importit/cvs/src/gnu/usr.bin/perl/gv.h,v retrieving revision 1.13 diff -u -p -u -p -r1.13 gv.h --- gnu/usr.bin/perl/gv.h 24 Mar 2014 15:05:13 -0000 1.13 +++ gnu/usr.bin/perl/gv.h 16 Nov 2014 03:22:24 -0000 @@ -141,8 +141,9 @@ Return the CV from the GV. #define GvLINE(gv) (GvGP(gv)->gp_line) #define GvFILE_HEK(gv) (GvGP(gv)->gp_file_hek) -#define GvFILE(gv) (GvFILE_HEK(gv) ? HEK_KEY(GvFILE_HEK(gv)) : NULL) -#define GvFILEGV(gv) (gv_fetchfile(GvFILE(gv))) +#define GvFILEx(gv) HEK_KEY(GvFILE_HEK(gv)) +#define GvFILE(gv) (GvFILE_HEK(gv) ? GvFILEx(gv) : NULL) +#define GvFILEGV(gv) (GvFILE_HEK(gv) ? gv_fetchfile(GvFILEx(gv)) : NULL) #define GvEGV(gv) (GvGP(gv)->gp_egv) #define GvEGVx(gv) (isGV_with_GP(gv) ? GvEGV(gv) : NULL) Index: gnu/usr.bin/perl/handy.h =================================================================== RCS file: /mnt/memory/perl/importit/cvs/src/gnu/usr.bin/perl/handy.h,v retrieving revision 1.15 diff -u -p -u -p -r1.15 handy.h --- gnu/usr.bin/perl/handy.h 24 Mar 2014 15:05:13 -0000 1.15 +++ gnu/usr.bin/perl/handy.h 16 Nov 2014 03:22:24 -0000 @@ -8,6 +8,9 @@ * */ +/* IMPORTANT NOTE: Everything whose name begins with an underscore is for + * internal core Perl use only. */ + #ifndef HANDY_H /* Guard against nested #inclusion */ #define HANDY_H @@ -25,10 +28,11 @@ =head1 Handy Values =for apidoc AmU||Nullch -Null character pointer. (No longer available when C is defined.) +Null character pointer. (No longer available when C is +defined.) =for apidoc AmU||Nullsv -Null SV pointer. (No longer available when C is defined.) +Null SV pointer. (No longer available when C is defined.) =cut */ @@ -69,7 +73,7 @@ Null SV pointer. (No longer available wh #define MUTABLE_IO(p) ((IO *)MUTABLE_PTR(p)) #define MUTABLE_SV(p) ((SV *)MUTABLE_PTR(p)) -#ifdef I_STDBOOL +#if defined(I_STDBOOL) && !defined(PERL_BOOL_AS_CHAR) # include # ifndef HAS_BOOL # define HAS_BOOL 1 @@ -85,9 +89,11 @@ Null SV pointer. (No longer available wh Andy Dougherty February 2000 */ #ifdef __GNUG__ /* GNU g++ has bool built-in */ +# ifndef PERL_BOOL_AS_CHAR # ifndef HAS_BOOL # define HAS_BOOL 1 # endif +# endif #endif /* The NeXT dynamic loader headers will not build with the bool macro @@ -104,19 +110,17 @@ Null SV pointer. (No longer available wh #endif /* NeXT || __NeXT__ */ #ifndef HAS_BOOL -# if defined(VMS) -# define bool int -# else -# define bool char +# ifdef bool +# undef bool # endif +# define bool char # define HAS_BOOL 1 #endif -/* a simple (bool) cast may not do the right thing: if bool is defined - * as char for example, then the cast from int is implementation-defined - * (bool)!!(cbool) in a ternary triggers a bug in xlc on AIX - */ - +/* cast-to-bool. A simple (bool) cast may not do the right thing: if bool is + * defined as char for example, then the cast from int is + * implementation-defined (bool)!!(cbool) in a ternary triggers a bug in xlc on + * AIX */ #define cBOOL(cbool) ((cbool) ? (bool)1 : (bool)0) /* Try to figure out __func__ or __FUNCTION__ equivalent, if any. @@ -126,7 +130,7 @@ Null SV pointer. (No longer available wh #if (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) || (defined(__SUNPRO_C)) /* C99 or close enough. */ # define FUNCTION__ __func__ #else -# if (defined(_MSC_VER) && _MSC_VER < 1300) || /* MSVC6 has neither __func__ nor __FUNCTION and no good workarounds, either. */ \ +# if (defined(USING_MSVC6)) || /* MSVC6 has neither __func__ nor __FUNCTION and no good workarounds, either. */ \ (defined(__DECC_VER)) /* Tru64 or VMS, and strict C89 being used, but not modern enough cc (in Tur64, -c99 not known, only -std1). */ # define FUNCTION__ "" # else @@ -269,23 +273,34 @@ typedef U64TYPE U64; #define Ctl(ch) ((ch) & 037) +/* This is a helper macro to avoid preprocessor issues, replaced by nothing + * unless under DEBUGGING, where it expands to an assert of its argument, + * followed by a comma (hence the comma operator). If we just used a straight + * assert(), we would get a comma with nothing before it when not DEBUGGING */ +#ifdef DEBUGGING +# define __ASSERT_(statement) assert(statement), +#else +# define __ASSERT_(statement) +#endif + /* =head1 SV-Body Allocation =for apidoc Ama|SV*|newSVpvs|const char* s -Like C, but takes a literal string instead of a string/length pair. +Like C, but takes a literal C-terminated string instead of a +string/length pair. =for apidoc Ama|SV*|newSVpvs_flags|const char* s|U32 flags -Like C, but takes a literal string instead of a string/length -pair. +Like C, but takes a literal C-terminated string instead of +a string/length pair. =for apidoc Ama|SV*|newSVpvs_share|const char* s -Like C, but takes a literal string instead of a string/length -pair and omits the hash parameter. +Like C, but takes a literal C-terminated string instead of +a string/length pair and omits the hash parameter. =for apidoc Am|void|sv_catpvs_flags|SV* sv|const char* s|I32 flags -Like C, but takes a literal string instead of a -string/length pair. +Like C, but takes a literal C-terminated string instead +of a string/length pair. =for apidoc Am|void|sv_catpvs_nomg|SV* sv|const char* s Like C, but takes a literal string instead of a @@ -312,7 +327,8 @@ string/length pair. =head1 Memory Management =for apidoc Ama|char*|savepvs|const char* s -Like C, but takes a literal string instead of a string/length pair. +Like C, but takes a literal C-terminated string instead of a +string/length pair. =for apidoc Ama|char*|savesharedpvs|const char* s A version of C which allocates the duplicate string in memory @@ -420,12 +436,12 @@ the second, C. Returns true or fals =for apidoc Am|bool|strnNE|char* s1|char* s2|STRLEN len Test two strings to see if they are different. The C parameter -indicates the number of bytes to compare. Returns true or false. (A +indicates the number of bytes to compare. Returns true or false. (A wrapper for C). =for apidoc Am|bool|strnEQ|char* s1|char* s2|STRLEN len Test two strings to see if they are equal. The C parameter indicates -the number of bytes to compare. Returns true or false. (A wrapper for +the number of bytes to compare. Returns true or false. (A wrapper for C). =cut @@ -496,7 +512,7 @@ onto the platform. That is, the code po since ASCII is a subset of Latin-1. But the non-ASCII code points are treated as if they are Latin-1 characters. For example, C will return true when called with the code point 0xDF, which is a word character in both -ASCII and EBCDIC (though it represent different characters in each). +ASCII and EBCDIC (though it represents different characters in each). Variant C is like the C variant, but accepts any UV code point as input. If the code point is larger than 255, Unicode rules are used @@ -509,12 +525,13 @@ Variant C is like C is like the C and C variants, but uses -the C library function that gives the named classification instead of -hard-coded rules. For example, C returns the result of calling -C. This means that the result is based on the current locale, which -is what C in the name stands for. FALSE is always returned if the input -won't fit into an octet. +Variant C is like the C and C variants, but the +result is based on the current locale, which is what C in the name stands +for. If Perl can determine that the current locale is a UTF-8 locale, it uses +the published Unicode rules; otherwise, it uses the C library function that +gives the named classification. For example, C when not in a +UTF-8 locale returns the result of calling C. FALSE is always +returned if the input won't fit into an octet. Variant C is like C, but is defined on any UV. It returns the same as C for input code points less than 256, and @@ -552,6 +569,12 @@ C. Note, however, that library routine C. In these cases, the variants whose names contain C are the same as the corresponding ones without. +Also note, that because all ASCII characters are UTF-8 invariant (meaning they +have the exact same representation (always a single byte) whether encoded in +UTF-8 or not), C will give the correct results when called with any +byte in any string encoded or not in UTF-8. And similarly C will +work properly on any string encoded or not in UTF-8. + =for apidoc Am|bool|isBLANK|char ch Returns a boolean indicating whether the specified character is a character considered to be a blank, analogous to C. @@ -613,7 +636,7 @@ Returns a boolean indicating whether the whitespace character. This is analogous to what C matches in a regular expression. Starting in Perl 5.18 (experimentally), this also matches what C does. -("Experimentally" means that this change may be backed out in 5.20 or 5.22 if +("Experimentally" means that this change may be backed out in 5.22 if field experience indicates that it was unwise.) Prior to 5.18, only the locale forms of this macro (the ones with C in their names) matched precisely what C does. In those releases, the only difference, @@ -627,7 +650,7 @@ C, and C macros. ("Experimentally" means that this change -may be backed out in 5.20 or 5.22 if field experience indicates that it +may be backed out in 5.22 if field experience indicates that it was unwise.) The locale forms of this macro are identical to their corresponding C forms in all Perl releases. In releases prior to 5.18, the @@ -701,17 +724,125 @@ Behaviour is only well defined when isXD =head1 Character case changing -=for apidoc Am|char|toUPPER|char ch -Converts the specified character to uppercase, if possible; otherwise returns -the input character itself. - -=for apidoc Am|char|toLOWER|char ch -Converts the specified character to lowercase, if possible; otherwise returns -the input character itself. +=for apidoc Am|U8|toUPPER|U8 ch +Converts the specified character to uppercase. If the input is anything but an +ASCII lowercase character, that input character itself is returned. Variant +C is equivalent. + +=for apidoc Am|UV|toUPPER_uni|UV cp|U8* s|STRLEN* lenp +Converts the Unicode code point C to its uppercase version, and +stores that in UTF-8 in C, and its length in bytes in C. Note +that the buffer pointed to by C needs to be at least C +bytes since the uppercase version may be longer than the original character. + +The first code point of the uppercased version is returned +(but note, as explained just above, that there may be more.) + +=for apidoc Am|UV|toUPPER_utf8|U8* p|U8* s|STRLEN* lenp +Converts the UTF-8 encoded character at C

to its uppercase version, and +stores that in UTF-8 in C, and its length in bytes in C. Note +that the buffer pointed to by C needs to be at least C +bytes since the uppercase version may be longer than the original character. + +The first code point of the uppercased version is returned +(but note, as explained just above, that there may be more.) + +The input character at C

is assumed to be well-formed. + +=for apidoc Am|U8|toFOLD|U8 ch +Converts the specified character to foldcase. If the input is anything but an +ASCII uppercase character, that input character itself is returned. Variant +C is equivalent. (There is no equivalent C for the full +Latin1 range, as the full generality of L is needed there.) + +=for apidoc Am|UV|toFOLD_uni|UV cp|U8* s|STRLEN* lenp +Converts the Unicode code point C to its foldcase version, and +stores that in UTF-8 in C, and its length in bytes in C. Note +that the buffer pointed to by C needs to be at least C +bytes since the foldcase version may be longer than the original character. + +The first code point of the foldcased version is returned +(but note, as explained just above, that there may be more.) + +=for apidoc Am|UV|toFOLD_utf8|U8* p|U8* s|STRLEN* lenp +Converts the UTF-8 encoded character at C

to its foldcase version, and +stores that in UTF-8 in C, and its length in bytes in C. Note +that the buffer pointed to by C needs to be at least C +bytes since the foldcase version may be longer than the original character. + +The first code point of the foldcased version is returned +(but note, as explained just above, that there may be more.) + +The input character at C

is assumed to be well-formed. + +=for apidoc Am|U8|toLOWER|U8 ch +Converts the specified character to lowercase. If the input is anything but an +ASCII uppercase character, that input character itself is returned. Variant +C is equivalent. + +=for apidoc Am|U8|toLOWER_L1|U8 ch +Converts the specified Latin1 character to lowercase. The results are undefined if +the input doesn't fit in a byte. + +=for apidoc Am|U8|toLOWER_LC|U8 ch +Converts the specified character to lowercase using the current locale's rules, +if possible; otherwise returns the input character itself. + +=for apidoc Am|UV|toLOWER_uni|UV cp|U8* s|STRLEN* lenp +Converts the Unicode code point C to its lowercase version, and +stores that in UTF-8 in C, and its length in bytes in C. Note +that the buffer pointed to by C needs to be at least C +bytes since the lowercase version may be longer than the original character. + +The first code point of the lowercased version is returned +(but note, as explained just above, that there may be more.) + +=for apidoc Am|UV|toLOWER_utf8|U8* p|U8* s|STRLEN* lenp +Converts the UTF-8 encoded character at C

to its lowercase version, and +stores that in UTF-8 in C, and its length in bytes in C. Note +that the buffer pointed to by C needs to be at least C +bytes since the lowercase version may be longer than the original character. + +The first code point of the lowercased version is returned +(but note, as explained just above, that there may be more.) + +The input character at C

is assumed to be well-formed. + +=for apidoc Am|U8|toLOWER_LC|U8 ch +Converts the specified character to lowercase using the current locale's rules, +if possible; otherwise returns the input character itself. + +=for apidoc Am|U8|toTITLE|U8 ch +Converts the specified character to titlecase. If the input is anything but an +ASCII lowercase character, that input character itself is returned. Variant +C is equivalent. (There is no C for the full Latin1 range, +as the full generality of L is needed there. Titlecase is not a +concept used in locale handling, so there is no functionality for that.) + +=for apidoc Am|UV|toTITLE_uni|UV cp|U8* s|STRLEN* lenp +Converts the Unicode code point C to its titlecase version, and +stores that in UTF-8 in C, and its length in bytes in C. Note +that the buffer pointed to by C needs to be at least C +bytes since the titlecase version may be longer than the original character. + +The first code point of the titlecased version is returned +(but note, as explained just above, that there may be more.) + +=for apidoc Am|UV|toTITLE_utf8|U8* p|U8* s|STRLEN* lenp +Converts the UTF-8 encoded character at C

to its titlecase version, and +stores that in UTF-8 in C, and its length in bytes in C. Note +that the buffer pointed to by C needs to be at least C +bytes since the titlecase version may be longer than the original character. + +The first code point of the titlecased version is returned +(but note, as explained just above, that there may be more.) + +The input character at C

is assumed to be well-formed. =cut -XXX Still undocumented isVERTWS_uni and _utf8, and the other toUPPER etc functions +XXX Still undocumented isVERTWS_uni and _utf8; it's unclear what their names +really should be. Also toUPPER_LC and toFOLD_LC, which are subject to change. Note that these macros are repeated in Devel::PPPort, so should also be patched there. The file as of this writing is cpan/Devel-PPPort/parts/inc/misc @@ -737,7 +868,15 @@ patched there. The file as of this writ #define FITS_IN_8_BITS(c) ((sizeof(c) == 1) || !(((WIDEST_UTYPE)(c)) & ~0xFF)) #ifdef EBCDIC -# define isASCII(c) (FITS_IN_8_BITS(c) && (NATIVE_TO_UNI((U8) (c)) < 128)) +# ifndef _ALL_SOURCE + /* This returns the wrong results on at least z/OS unless this is + * defined. */ +# error _ALL_SOURCE should probably be defined +# endif + + /* We could be called without perl.h, in which case NATIVE_TO_ASCII() is + * likely not defined, and so we use the native function */ +# define isASCII(c) cBOOL(isascii(c)) #else # define isASCII(c) ((WIDEST_UTYPE)(c) < 128) #endif @@ -795,7 +934,8 @@ patched there. The file as of this writ # define _HIGHEST_REGCOMP_DOT_H_SYNC _CC_VERTSPACE /* The members of the third group below do not need to be coordinated with data - * structures in regcomp.[ch] and regexec.c */ + * structures in regcomp.[ch] and regexec.c. But they should be added to + * bootstrap_ctype() */ # define _CC_IDFIRST 17 # define _CC_CHARNAME_CONT 18 # define _CC_NONLATIN1_FOLD 19 @@ -872,20 +1012,27 @@ EXTCONST U32 PL_charclass[] = { # else /* ! DOINIT */ EXTCONST U32 PL_charclass[]; # endif +#endif /* Has perl.h */ + +#if defined(H_PERL) && ! defined(BOOTSTRAP_CHARSET) /* The 1U keeps Solaris from griping when shifting sets the uppermost bit */ # define _CC_mask(classnum) (1U << (classnum)) + + /* For internal core Perl use only: the base macro for defining macros like + * isALPHA */ # define _generic_isCC(c, classnum) cBOOL(FITS_IN_8_BITS(c) \ - && (PL_charclass[(U8) NATIVE_TO_UNI(c)] & _CC_mask(classnum))) + && (PL_charclass[(U8) (c)] & _CC_mask(classnum))) /* The mask for the _A versions of the macros; it just adds in the bit for * ASCII. */ # define _CC_mask_A(classnum) (_CC_mask(classnum) | _CC_mask(_CC_ASCII)) - /* The _A version makes sure that both the desired bit and the ASCII bit - * are present */ -# define _generic_isCC_A(c, classnum) (FITS_IN_8_BITS(c) \ - && ((PL_charclass[(U8) NATIVE_TO_UNI(c)] & _CC_mask_A(classnum)) \ + /* For internal core Perl use only: the base macro for defining macros like + * isALPHA_A. The foo_A version makes sure that both the desired bit and + * the ASCII bit are present */ +# define _generic_isCC_A(c, classnum) (FITS_IN_8_BITS(c) \ + && ((PL_charclass[(U8) (c)] & _CC_mask_A(classnum)) \ == _CC_mask_A(classnum))) # define isALPHA_A(c) _generic_isCC_A(c, _CC_ALPHA) @@ -902,231 +1049,341 @@ EXTCONST U32 PL_charclass[]; # define isUPPER_A(c) _generic_isCC_A(c, _CC_UPPER) # define isWORDCHAR_A(c) _generic_isCC_A(c, _CC_WORDCHAR) # define isXDIGIT_A(c) _generic_isCC(c, _CC_XDIGIT) -# define isIDFIRST_A(c) _generic_isCC_A(c, ( _CC_IDFIRST)) +# define isIDFIRST_A(c) _generic_isCC_A(c, _CC_IDFIRST) +# define isALPHA_L1(c) _generic_isCC(c, _CC_ALPHA) +# define isALPHANUMERIC_L1(c) _generic_isCC(c, _CC_ALPHANUMERIC) +# define isBLANK_L1(c) _generic_isCC(c, _CC_BLANK) + + /* continuation character for legal NAME in \N{NAME} */ +# define isCHARNAME_CONT(c) _generic_isCC(c, _CC_CHARNAME_CONT) + +# define isCNTRL_L1(c) _generic_isCC(c, _CC_CNTRL) +# define isGRAPH_L1(c) _generic_isCC(c, _CC_GRAPH) +# define isLOWER_L1(c) _generic_isCC(c, _CC_LOWER) +# define isPRINT_L1(c) _generic_isCC(c, _CC_PRINT) +# define isPSXSPC_L1(c) _generic_isCC(c, _CC_PSXSPC) +# define isPUNCT_L1(c) _generic_isCC(c, _CC_PUNCT) +# define isSPACE_L1(c) _generic_isCC(c, _CC_SPACE) +# define isUPPER_L1(c) _generic_isCC(c, _CC_UPPER) +# define isWORDCHAR_L1(c) _generic_isCC(c, _CC_WORDCHAR) +# define isIDFIRST_L1(c) _generic_isCC(c, _CC_IDFIRST) /* Either participates in a fold with a character above 255, or is a * multi-char fold */ -# define _HAS_NONLATIN1_FOLD_CLOSURE_ONLY_FOR_USE_BY_REGCOMP_DOT_C_AND_REGEXEC_DOT_C(c) ((! cBOOL(FITS_IN_8_BITS(c))) || (PL_charclass[(U8) NATIVE_TO_UNI(c)] & _CC_mask(_CC_NONLATIN1_FOLD))) +# define _HAS_NONLATIN1_FOLD_CLOSURE_ONLY_FOR_USE_BY_REGCOMP_DOT_C_AND_REGEXEC_DOT_C(c) ((! cBOOL(FITS_IN_8_BITS(c))) || (PL_charclass[(U8) (c)] & _CC_mask(_CC_NONLATIN1_FOLD))) # define _isQUOTEMETA(c) _generic_isCC(c, _CC_QUOTEMETA) # define _IS_NON_FINAL_FOLD_ONLY_FOR_USE_BY_REGCOMP_DOT_C(c) \ _generic_isCC(c, _CC_NON_FINAL_FOLD) # define _IS_IN_SOME_FOLD_ONLY_FOR_USE_BY_REGCOMP_DOT_C(c) \ _generic_isCC(c, _CC_IS_IN_SOME_FOLD) -#else /* No perl.h. */ +#else /* Either don't have perl.h or don't want to use char_class_tab.h */ + + /* If we don't have perl.h, we are compiling a utility program. Below we + * hard-code various macro definitions that wouldn't otherwise be available + * to it. We can also get here if we are configured to bootstrap up Perl + * on a non-ASCII platform that doesn't have a working Perl (currently only + * EBCDIC). For these we currently use the native definitions to get + * things going. (It should also be possible to use the translation + * function NATIVE_TO_LATIN1(), but that is an extra layer of dependence on + * Perl, so it is currently avoided for the macros where it's possible to + * do so.) */ # ifdef EBCDIC -# define isALPHA_A(c) (isASCII(c) && isALPHA(c)) -# define isALPHANUMERIC_A(c) (isASCII(c) && isALPHANUMERIC(c)) -# define isBLANK_A(c) (isASCII(c) && isBLANK(c)) -# define isCNTRL_A(c) (isASCII(c) && isCNTRL(c)) -# define isDIGIT_A(c) (isASCII(c) && isDIGIT(c)) -# define isGRAPH_A(c) (isASCII(c) && isGRAPH(c)) -# define isIDFIRST_A(c) (isASCII(c) && isIDFIRST(c)) -# define isLOWER_A(c) (isASCII(c) && isLOWER(c)) -# define isPRINT_A(c) (isASCII(c) && isPRINT(c)) -# define isPSXSPC_A(c) (isASCII(c) && isPSXSPC(c)) -# define isPUNCT_A(c) (isASCII(c) && isPUNCT(c)) -# define isSPACE_A(c) (isASCII(c) && isSPACE(c)) -# define isUPPER_A(c) (isASCII(c) && isUPPER(c)) -# define isWORDCHAR_A(c) (isASCII(c) && isWORDCHAR(c)) -# define isXDIGIT_A(c) (isASCII(c) && isXDIGIT(c)) -# else /* ASCII platform, no perl.h */ + /* Use the native functions. They likely will return false for all + * non-ASCII values, but this makes sure */ +# define isALPHA_A(c) (isASCII(c) && isalpha(c)) +# define isALPHANUMERIC_A(c) (isASCII(c) && isalnum(c)) +# define isCNTRL_A(c) (isASCII(c) && iscntrl(c)) +# define isDIGIT_A(c) (isASCII(c) && isdigit(c)) +# define isGRAPH_A(c) (isASCII(c) && isgraph(c)) +# define isLOWER_A(c) (isASCII(c) && islower(c)) +# define isPRINT_A(c) (isASCII(c) && isprint(c)) +# define isPUNCT_A(c) (isASCII(c) && ispunct(c)) +# define isSPACE_A(c) (isASCII(c) && isspace(c)) +# define isUPPER_A(c) (isASCII(c) && isupper(c)) +# define isXDIGIT_A(c) (isASCII(c) && isxdigit(c)) +# else /* ASCII platform. These are coded based on first principals */ # define isALPHA_A(c) (isUPPER_A(c) || isLOWER_A(c)) # define isALPHANUMERIC_A(c) (isALPHA_A(c) || isDIGIT_A(c)) -# define isBLANK_A(c) ((c) == ' ' || (c) == '\t') -# define isCNTRL_A(c) (FITS_IN_8_BITS(c) && ((U8) (c) < ' ' || (c) == 127)) +# define isCNTRL_A(c) (isASCII(c) && (! isPRINT_A(c))) # define isDIGIT_A(c) ((c) <= '9' && (c) >= '0') -# define isGRAPH_A(c) (isWORDCHAR_A(c) || isPUNCT_A(c)) -# define isIDFIRST_A(c) (isALPHA_A(c) || (c) == '_') +# define isGRAPH_A(c) (isPRINT_A(c) && (c) != ' ') # define isLOWER_A(c) ((c) >= 'a' && (c) <= 'z') # define isPRINT_A(c) (((c) >= 32 && (c) < 127)) -# define isPSXSPC_A(c) (isSPACE_A(c) || (c) == '\v') -# define isPUNCT_A(c) (((c) >= 33 && (c) <= 47) \ - || ((c) >= 58 && (c) <= 64) \ - || ((c) >= 91 && (c) <= 96) \ - || ((c) >= 123 && (c) <= 126)) -# define isSPACE_A(c) ((c) == ' ' \ - || (c) == '\t' \ - || (c) == '\n' \ - || (c) =='\r' \ +# define isPUNCT_A(c) (isGRAPH_A(c) && (! isALPHANUMERIC_A(c))) +# define isSPACE_A(c) ((c) == ' ' \ + || (c) == '\t' \ + || (c) == '\n' \ + || (c) == '\r' \ + || (c) =='\v' \ || (c) == '\f') # define isUPPER_A(c) ((c) <= 'Z' && (c) >= 'A') -# define isWORDCHAR_A(c) (isALPHA_A(c) || isDIGIT_A(c) || (c) == '_') -# define isXDIGIT_A(c) (isDIGIT_A(c) \ - || ((c) >= 'a' && (c) <= 'f') \ - || ((c) <= 'F' && (c) >= 'A')) -# endif -#endif /* ASCII range definitions */ +# define isXDIGIT_A(c) (isDIGIT_A(c) \ + || ((c) >= 'a' && (c) <= 'f') \ + || ((c) <= 'F' && (c) >= 'A')) +# endif /* Below are common definitions for ASCII and non-ASCII */ +# define isBLANK_A(c) ((c) == ' ' || (c) == '\t') +# define isIDFIRST_A(c) (isALPHA_A(c) || (c) == '_') +# define isWORDCHAR_A(c) (isALPHANUMERIC_A(c) || (c) == '_') + + /* The _L1 macros may be unnecessary for both the utilities and for + * bootstrapping; I (khw) added them during debugging of bootstrapping, and + * it seems best to keep them. */ +# define isPSXSPC_A(c) isSPACE_A(c) /* XXX Assumes SPACE matches '\v' */ +# define isALPHA_L1(c) (isUPPER_L1(c) || isLOWER_L1(c)) +# define isALPHANUMERIC_L1(c) (isALPHA_L1(c) || isDIGIT_A(c)) +# define isBLANK_L1(c) (isBLANK_A(c) \ + || (FITS_IN_8_BITS(c) \ + && NATIVE_TO_LATIN1((U8) c) == 0xA0)) +# define isCNTRL_L1(c) (FITS_IN_8_BITS(c) && (! isPRINT_L1(c))) +# define isGRAPH_L1(c) (isPRINT_L1(c) && (! isBLANK_L1(c))) +# define isLOWER_L1(c) (isLOWER_A(c) \ + || (FITS_IN_8_BITS(c) \ + && ((NATIVE_TO_LATIN1((U8) c) >= 0xDF \ + && NATIVE_TO_LATIN1((U8) c) != 0xF7) \ + || NATIVE_TO_LATIN1((U8) c) == 0xAA \ + || NATIVE_TO_LATIN1((U8) c) == 0xBA \ + || NATIVE_TO_LATIN1((U8) c) == 0xB5))) +# define isPRINT_L1(c) (isPRINT_A(c) \ + || (FITS_IN_8_BITS(c) \ + && NATIVE_TO_LATIN1((U8) c) >= 0xA0)) +# define isPSXSPC_L1(c) isSPACE_L1(c) +# define isPUNCT_L1(c) (isPUNCT_A(c) \ + || (FITS_IN_8_BITS(c) \ + && (NATIVE_TO_LATIN1((U8) c) == 0xA1 \ + || NATIVE_TO_LATIN1((U8) c) == 0xA7 \ + || NATIVE_TO_LATIN1((U8) c) == 0xAB \ + || NATIVE_TO_LATIN1((U8) c) == 0xB6 \ + || NATIVE_TO_LATIN1((U8) c) == 0xB7 \ + || NATIVE_TO_LATIN1((U8) c) == 0xBB \ + || NATIVE_TO_LATIN1((U8) c) == 0xBF))) +# define isSPACE_L1(c) (isSPACE_A(c) \ + || (FITS_IN_8_BITS(c) \ + && (NATIVE_TO_LATIN1((U8) c) == 0x85 \ + || NATIVE_TO_LATIN1((U8) c) == 0xA0))) +# define isUPPER_L1(c) (isUPPER_A(c) \ + || (FITS_IN_8_BITS(c) \ + && (NATIVE_TO_LATIN1((U8) c) >= 0xC0 \ + && NATIVE_TO_LATIN1((U8) c) <= 0xDE \ + && NATIVE_TO_LATIN1((U8) c) != 0xD7))) +# define isWORDCHAR_L1(c) (isIDFIRST_L1(c) || isDIGIT_A(c)) +# define isIDFIRST_L1(c) (isALPHA_L1(c) || NATIVE_TO_LATIN1(c) == '_') +# define isCHARNAME_CONT(c) (isWORDCHAR_L1(c) \ + || isBLANK_L1(c) \ + || (c) == '-' \ + || (c) == '(' \ + || (c) == ')') + /* The following are not fully accurate in the above-ASCII range. I (khw) + * don't think it's necessary to be so for the purposes where this gets + * compiled */ +# define _isQUOTEMETA(c) (FITS_IN_8_BITS(c) && ! isWORDCHAR_L1(c)) +# define _IS_IN_SOME_FOLD_ONLY_FOR_USE_BY_REGCOMP_DOT_C(c) isALPHA_L1(c) + + /* And these aren't accurate at all. They are useful only for above + * Latin1, which utilities and bootstrapping don't deal with */ +# define _IS_NON_FINAL_FOLD_ONLY_FOR_USE_BY_REGCOMP_DOT_C(c) 0 +# define _HAS_NONLATIN1_FOLD_CLOSURE_ONLY_FOR_USE_BY_REGCOMP_DOT_C_AND_REGEXEC_DOT_C(c) 0 + + /* Many of the macros later in this file are defined in terms of these. By + * implementing them with a function, which converts the class number into + * a call to the desired macro, all of the later ones work. However, that + * function won't be actually defined when building a utility program (no + * perl.h), and so a compiler error will be generated if one is attempted + * to be used. And the above-Latin1 code points require Unicode tables to + * be present, something unlikely to be the case when bootstrapping */ +# define _generic_isCC(c, classnum) \ + (FITS_IN_8_BITS(c) && S_bootstrap_ctype((U8) (c), (classnum), TRUE)) +# define _generic_isCC_A(c, classnum) \ + (FITS_IN_8_BITS(c) && S_bootstrap_ctype((U8) (c), (classnum), FALSE)) +#endif /* End of no perl.h or have BOOTSTRAP_CHARSET */ + +#define isALPHANUMERIC(c) isALPHANUMERIC_A(c) +#define isALPHA(c) isALPHA_A(c) +#define isBLANK(c) isBLANK_A(c) +#define isCNTRL(c) isCNTRL_A(c) +#define isDIGIT(c) isDIGIT_A(c) +#define isGRAPH(c) isGRAPH_A(c) +#define isIDFIRST(c) isIDFIRST_A(c) +#define isLOWER(c) isLOWER_A(c) +#define isPRINT(c) isPRINT_A(c) +#define isPSXSPC(c) isPSXSPC_A(c) +#define isPUNCT(c) isPUNCT_A(c) +#define isSPACE(c) isSPACE_A(c) +#define isUPPER(c) isUPPER_A(c) +#define isWORDCHAR(c) isWORDCHAR_A(c) +#define isXDIGIT(c) isXDIGIT_A(c) + +/* ASCII casing. These could also be written as + #define toLOWER(c) (isASCII(c) ? toLOWER_LATIN1(c) : (c)) + #define toUPPER(c) (isASCII(c) ? toUPPER_LATIN1_MOD(c) : (c)) + which uses table lookup and mask instead of subtraction. (This would + work because the _MOD does not apply in the ASCII range) */ +#define toLOWER(c) (isUPPER(c) ? (U8)((c) + ('a' - 'A')) : (c)) +#define toUPPER(c) (isLOWER(c) ? (U8)((c) - ('a' - 'A')) : (c)) + +/* In the ASCII range, these are equivalent to what they're here defined to be. + * But by creating these definitions, other code doesn't have to be aware of + * this detail */ +#define toFOLD(c) toLOWER(c) +#define toTITLE(c) toUPPER(c) + +#define toLOWER_A(c) toLOWER(c) +#define toUPPER_A(c) toUPPER(c) +#define toFOLD_A(c) toFOLD(c) +#define toTITLE_A(c) toTITLE(c) + +/* Use table lookup for speed; returns the input itself if is out-of-range */ +#define toLOWER_LATIN1(c) ((! FITS_IN_8_BITS(c)) \ + ? (c) \ + : PL_latin1_lc[ (U8) (c) ]) +#define toLOWER_L1(c) toLOWER_LATIN1(c) /* Synonym for consistency */ -/* Latin1 definitions */ -#ifdef H_PERL -# define isALPHA_L1(c) _generic_isCC(c, _CC_ALPHA) -# define isALPHANUMERIC_L1(c) _generic_isCC(c, _CC_ALPHANUMERIC) -# define isBLANK_L1(c) _generic_isCC(c, _CC_BLANK) +/* Modified uc. Is correct uc except for three non-ascii chars which are + * all mapped to one of them, and these need special handling; returns the + * input itself if is out-of-range */ +#define toUPPER_LATIN1_MOD(c) ((! FITS_IN_8_BITS(c)) \ + ? (c) \ + : PL_mod_latin1_uc[ (U8) (c) ]) +#define IN_UTF8_CTYPE_LOCALE PL_in_utf8_CTYPE_locale -/* continuation character for legal NAME in \N{NAME} */ -# define isCHARNAME_CONT(c) _generic_isCC(c, _CC_CHARNAME_CONT) +/* Use foo_LC_uvchr() instead of these for beyond the Latin1 range */ -# define isCNTRL_L1(c) _generic_isCC(c, _CC_CNTRL) -# define isGRAPH_L1(c) _generic_isCC(c, _CC_GRAPH) -# define isLOWER_L1(c) _generic_isCC(c, _CC_LOWER) -# define isPRINT_L1(c) _generic_isCC(c, _CC_PRINT) -# define isPSXSPC_L1(c) _generic_isCC(c, _CC_PSXSPC) -# define isPUNCT_L1(c) _generic_isCC(c, _CC_PUNCT) -# define isSPACE_L1(c) _generic_isCC(c, _CC_SPACE) -# define isUPPER_L1(c) _generic_isCC(c, _CC_UPPER) -# define isWORDCHAR_L1(c) _generic_isCC(c, _CC_WORDCHAR) -# define isIDFIRST_L1(c) _generic_isCC(c, _CC_IDFIRST) -#else /* No access to perl.h. Only a few provided here, just in case needed - * for backwards compatibility */ - /* ALPHAU includes Unicode semantics for latin1 characters. It has an extra - * >= AA test to speed up ASCII-only tests at the expense of the others */ -# define isALPHA_L1(c) (isALPHA(c) || (NATIVE_TO_UNI((U8) c) >= 0xAA \ - && ((NATIVE_TO_UNI((U8) c) >= 0xC0 \ - && NATIVE_TO_UNI((U8) c) != 0xD7 && NATIVE_TO_UNI((U8) c) != 0xF7) \ - || NATIVE_TO_UNI((U8) c) == 0xAA \ - || NATIVE_TO_UNI((U8) c) == 0xB5 \ - || NATIVE_TO_UNI((U8) c) == 0xBA))) -# define isCHARNAME_CONT(c) (isWORDCHAR_L1(c) \ - || (c) == ' ' \ - || (c) == '-' \ - || (c) == '(' \ - || (c) == ')' \ - || (c) == ':' \ - || NATIVE_TO_UNI((U8) c) == 0xA0) -#endif - -/* Macros that differ between EBCDIC and ASCII. Where C89 defines a function, - * that is used in the EBCDIC form, because in EBCDIC we do not do locales: - * therefore can use native functions. For those where C89 doesn't define a - * function, use our function, assuming that the EBCDIC code page is isomorphic - * with Latin1, which the three currently recognized by Perl are. Some libc's - * have an isblank(), but it's not guaranteed. */ -#ifdef EBCDIC -# define isALPHA(c) isalpha(c) -# define isALPHANUMERIC(c) isalnum(c) -# define isBLANK(c) ((c) == ' ' || (c) == '\t' || NATIVE_TO_UNI(c) == 0xA0) -# define isCNTRL(c) iscntrl(c) -# define isDIGIT(c) isdigit(c) -# define isGRAPH(c) isgraph(c) -# define isIDFIRST(c) (isALPHA(c) || (c) == '_') -# define isLOWER(c) islower(c) -# define isPRINT(c) isprint(c) -# define isPSXSPC(c) isspace(c) -# define isPUNCT(c) ispunct(c) -# define isSPACE(c) (isPSXSPC(c) /* && (c) != '\v' (Experimentally making - these macros identical) */) -# define isUPPER(c) isupper(c) -# define isXDIGIT(c) isxdigit(c) -# define isWORDCHAR(c) (isalnum(c) || (c) == '_') -# define toLOWER(c) tolower(c) -# define toUPPER(c) toupper(c) -#else /* Not EBCDIC: ASCII-only matching */ -# define isALPHANUMERIC(c) isALPHANUMERIC_A(c) -# define isALPHA(c) isALPHA_A(c) -# define isBLANK(c) isBLANK_A(c) -# define isCNTRL(c) isCNTRL_A(c) -# define isDIGIT(c) isDIGIT_A(c) -# define isGRAPH(c) isGRAPH_A(c) -# define isIDFIRST(c) isIDFIRST_A(c) -# define isLOWER(c) isLOWER_A(c) -# define isPRINT(c) isPRINT_A(c) -# define isPSXSPC(c) isPSXSPC_A(c) -# define isPUNCT(c) isPUNCT_A(c) -# define isSPACE(c) isSPACE_A(c) -# define isUPPER(c) isUPPER_A(c) -# define isWORDCHAR(c) isWORDCHAR_A(c) -# define isXDIGIT(c) isXDIGIT_A(c) - - /* ASCII casing. These could also be written as - #define toLOWER(c) (isASCII(c) ? toLOWER_LATIN1(c) : (c)) - #define toUPPER(c) (isASCII(c) ? toUPPER_LATIN1_MOD(c) : (c)) - which uses table lookup and mask instead of subtraction. (This would - work because the _MOD does not apply in the ASCII range) */ -# define toLOWER(c) (isUPPER(c) ? (c) + ('a' - 'A') : (c)) -# define toUPPER(c) (isLOWER(c) ? (c) - ('a' - 'A') : (c)) +/* For internal core Perl use only: the base macro for defining macros like + * isALPHA_LC, which uses the current LC_CTYPE locale. 'c' is the code point + * (0-255) to check. In a UTF-8 locale, the result is the same as calling + * isFOO_L1(); the 'utf8_locale_classnum' parameter is something like + * _CC_UPPER, which gives the class number for doing this. For non-UTF-8 + * locales, the code to actually do the test this is passed in 'non_utf8'. If + * 'c' is above 255, 0 is returned. For accessing the full range of possible + * code points under locale rules, use the macros based on _generic_LC_uvchr + * instead of this. */ +#define _generic_LC_base(c, utf8_locale_classnum, non_utf8) \ + (! FITS_IN_8_BITS(c) \ + ? 0 \ + : IN_UTF8_CTYPE_LOCALE \ + ? cBOOL(PL_charclass[(U8) (c)] & _CC_mask(utf8_locale_classnum)) \ + : cBOOL(non_utf8)) + +/* For internal core Perl use only: a helper macro for defining macros like + * isALPHA_LC. 'c' is the code point (0-255) to check. The function name to + * actually do this test is passed in 'non_utf8_func', which is called on 'c', + * casting 'c' to the macro _LC_CAST, which should not be parenthesized. See + * _generic_LC_base for more info */ +#define _generic_LC(c, utf8_locale_classnum, non_utf8_func) \ + _generic_LC_base(c,utf8_locale_classnum, \ + non_utf8_func( (_LC_CAST) (c))) + +/* For internal core Perl use only: like _generic_LC, but also returns TRUE if + * 'c' is the platform's native underscore character */ +#define _generic_LC_underscore(c,utf8_locale_classnum,non_utf8_func) \ + _generic_LC_base(c, utf8_locale_classnum, \ + (non_utf8_func( (_LC_CAST) (c)) \ + || (char)(c) == '_')) + +/* These next three are also for internal core Perl use only: case-change + * helper macros */ +#define _generic_toLOWER_LC(c, function, cast) (! FITS_IN_8_BITS(c) \ + ? (c) \ + : (IN_UTF8_CTYPE_LOCALE) \ + ? PL_latin1_lc[ (U8) (c) ] \ + : function((cast)(c))) + +/* Note that the result can be larger than a byte in a UTF-8 locale. It + * returns a single value, so can't adequately return the upper case of LATIN + * SMALL LETTER SHARP S in a UTF-8 locale (which should be a string of two + * values "SS"); instead it asserts against that under DEBUGGING, and + * otherwise returns its input */ +#define _generic_toUPPER_LC(c, function, cast) \ + (! FITS_IN_8_BITS(c) \ + ? (c) \ + : ((! IN_UTF8_CTYPE_LOCALE) \ + ? function((cast)(c)) \ + : ((((U8)(c)) == MICRO_SIGN) \ + ? GREEK_CAPITAL_LETTER_MU \ + : ((((U8)(c)) == LATIN_SMALL_LETTER_Y_WITH_DIAERESIS) \ + ? LATIN_CAPITAL_LETTER_Y_WITH_DIAERESIS \ + : ((((U8)(c)) == LATIN_SMALL_LETTER_SHARP_S) \ + ? (__ASSERT_(0) (c)) \ + : PL_mod_latin1_uc[ (U8) (c) ]))))) + +/* Note that the result can be larger than a byte in a UTF-8 locale. It + * returns a single value, so can't adequately return the fold case of LATIN + * SMALL LETTER SHARP S in a UTF-8 locale (which should be a string of two + * values "ss"); instead it asserts against that under DEBUGGING, and + * otherwise returns its input */ +#define _generic_toFOLD_LC(c, function, cast) \ + ((UNLIKELY((c) == MICRO_SIGN) && IN_UTF8_CTYPE_LOCALE) \ + ? GREEK_SMALL_LETTER_MU \ + : (__ASSERT_(! IN_UTF8_CTYPE_LOCALE \ + || (c) != LATIN_SMALL_LETTER_SHARP_S) \ + _generic_toLOWER_LC(c, function, cast))) + +/* Use the libc versions for these if available. */ +#if defined(HAS_ISASCII) && ! defined(USE_NEXT_CTYPE) +# define isASCII_LC(c) (FITS_IN_8_BITS(c) && isascii( (U8) (c))) +#else +# define isASCII_LC(c) isASCII(c) #endif - -/* Use table lookup for speed; return error character for input - * out-of-range */ -#define toLOWER_LATIN1(c) (FITS_IN_8_BITS(c) \ - ? UNI_TO_NATIVE(PL_latin1_lc[ \ - NATIVE_TO_UNI( (U8) (c)) ]) \ - : UNICODE_REPLACEMENT) -/* Modified uc. Is correct uc except for three non-ascii chars which are - * all mapped to one of them, and these need special handling; error - * character for input out-of-range */ -#define toUPPER_LATIN1_MOD(c) (FITS_IN_8_BITS(c) \ - ? UNI_TO_NATIVE(PL_mod_latin1_uc[ \ - NATIVE_TO_UNI( (U8) (c)) ]) \ - : UNICODE_REPLACEMENT) - -#ifdef USE_NEXT_CTYPE - -# define isALPHANUMERIC_LC(c) NXIsAlNum((unsigned int)(c)) -# define isALPHA_LC(c) NXIsAlpha((unsigned int)(c)) -# define isASCII_LC(c) isASCII((unsigned int)(c)) -# define isBLANK_LC(c) isBLANK((unsigned int)(c)) -# define isCNTRL_LC(c) NXIsCntrl((unsigned int)(c)) -# define isDIGIT_LC(c) NXIsDigit((unsigned int)(c)) -# define isGRAPH_LC(c) NXIsGraph((unsigned int)(c)) -# define isIDFIRST_LC(c) (NXIsAlpha((unsigned int)(c)) || (char)(c) == '_') -# define isLOWER_LC(c) NXIsLower((unsigned int)(c)) -# define isPRINT_LC(c) NXIsPrint((unsigned int)(c)) -# define isPUNCT_LC(c) NXIsPunct((unsigned int)(c)) -# define isSPACE_LC(c) NXIsSpace((unsigned int)(c)) -# define isUPPER_LC(c) NXIsUpper((unsigned int)(c)) -# define isWORDCHAR_LC(c) (NXIsAlNum((unsigned int)(c)) || (char)(c) == '_') -# define isXDIGIT_LC(c) NXIsXDigit((unsigned int)(c)) -# define toLOWER_LC(c) NXToLower((unsigned int)(c)) -# define toUPPER_LC(c) NXToUpper((unsigned int)(c)) +#if defined(HAS_ISBLANK) && ! defined(USE_NEXT_CTYPE) +# define isBLANK_LC(c) _generic_LC(c, _CC_BLANK, isblank) +#else /* Unlike isASCII, varies if in a UTF-8 locale */ +# define isBLANK_LC(c) (IN_UTF8_CTYPE_LOCALE) ? isBLANK_L1(c) : isBLANK(c) +#endif + +#ifdef USE_NEXT_CTYPE /* NeXT computers */ + +# define _LC_CAST unsigned int /* Needed by _generic_LC. NeXT functions + use this as their input type */ + +# define isALPHA_LC(c) _generic_LC(c, _CC_ALPHA, NXIsAlpha) +# define isALPHANUMERIC_LC(c) _generic_LC(c, _CC_ALPHANUMERIC, NXIsAlNum) +# define isCNTRL_LC(c) _generic_LC(c, _CC_CNTRL, NXIsCntrl) +# define isDIGIT_LC(c) _generic_LC(c, _CC_DIGIT, NXIsDigit) +# define isGRAPH_LC(c) _generic_LC(c, _CC_GRAPH, NXIsGraph) +# define isIDFIRST_LC(c) _generic_LC_underscore(c, _CC_IDFIRST, NXIsAlpha) +# define isLOWER_LC(c) _generic_LC(c, _CC_LOWER, NXIsLower) +# define isPRINT_LC(c) _generic_LC(c, _CC_PRINT, NXIsPrint) +# define isPUNCT_LC(c) _generic_LC(c, _CC_PUNCT, NXIsPunct) +# define isSPACE_LC(c) _generic_LC(c, _CC_SPACE, NXIsSpace) +# define isUPPER_LC(c) _generic_LC(c, _CC_UPPER, NXIsUpper) +# define isWORDCHAR_LC(c) _generic_LC_underscore(c, _CC_WORDCHAR, NXIsAlNum) +# define isXDIGIT_LC(c) _generic_LC(c, _CC_XDIGIT, NXIsXdigit) + +# define toLOWER_LC(c) _generic_toLOWER_LC((c), NXToLower, unsigned int) +# define toUPPER_LC(c) _generic_toUPPER_LC((c), NXToUpper, unsigned int) +# define toFOLD_LC(c) _generic_toFOLD_LC((c), NXToLower, unsigned int) #else /* !USE_NEXT_CTYPE */ -# if defined(CTYPE256) || (!defined(isascii) && !defined(HAS_ISASCII)) +# define _LC_CAST U8 -/* Use foo_LC_uvchr() instead of these for beyond the Latin1 range */ +# if defined(CTYPE256) || (!defined(isascii) && !defined(HAS_ISASCII)) + /* For most other platforms */ -# define isALPHA_LC(c) (FITS_IN_8_BITS(c) && isalpha((unsigned char)(c))) -# define isALPHANUMERIC_LC(c) (FITS_IN_8_BITS(c) \ - && isalnum((unsigned char)(c))) -# ifdef HAS_ISASCII -# define isASCII_LC(c) (FITS_IN_8_BITS(c) && isascii((unsigned char)(c))) -# else -# define isASCII_LC(c) (FITS_IN_8_BITS(c) && isASCII((unsigned char)(c))) -# endif -# ifdef HAS_ISBLANK -# define isBLANK_LC(c) (FITS_IN_8_BITS(c) && isblank((unsigned char)(c))) -# else -# define isBLANK_LC(c) (FITS_IN_8_BITS(c) && isBLANK((unsigned char)(c))) -# endif -# define isCNTRL_LC(c) (FITS_IN_8_BITS(c) && iscntrl((unsigned char)(c))) -# define isDIGIT_LC(c) (FITS_IN_8_BITS(c) && isdigit((unsigned char)(c))) -# define isGRAPH_LC(c) (FITS_IN_8_BITS(c) && isgraph((unsigned char)(c))) -# define isIDFIRST_LC(c) (FITS_IN_8_BITS(c) \ - && (isalpha((unsigned char)(c)) || (char)(c) == '_')) -# define isLOWER_LC(c) (FITS_IN_8_BITS(c) && islower((unsigned char)(c))) -# define isPRINT_LC(c) (FITS_IN_8_BITS(c) && isprint((unsigned char)(c))) -# define isPUNCT_LC(c) (FITS_IN_8_BITS(c) && ispunct((unsigned char)(c))) -# define isSPACE_LC(c) (FITS_IN_8_BITS(c) && isspace((unsigned char)(c))) -# define isUPPER_LC(c) (FITS_IN_8_BITS(c) && isupper((unsigned char)(c))) -# define isWORDCHAR_LC(c) (FITS_IN_8_BITS(c) \ - && (isalnum((unsigned char)(c)) || (char)(c) == '_')) -# define isXDIGIT_LC(c) (FITS_IN_8_BITS(c) && isxdigit((unsigned char)(c))) -# define toLOWER_LC(c) (FITS_IN_8_BITS(c) ? tolower((unsigned char)(c)) : (c)) -# define toUPPER_LC(c) (FITS_IN_8_BITS(c) ? toupper((unsigned char)(c)) : (c)) +# define isALPHA_LC(c) _generic_LC(c, _CC_ALPHA, isalpha) +# define isALPHANUMERIC_LC(c) _generic_LC(c, _CC_ALPHANUMERIC, isalnum) +# define isCNTRL_LC(c) _generic_LC(c, _CC_CNTRL, iscntrl) +# define isDIGIT_LC(c) _generic_LC(c, _CC_DIGIT, isdigit) +# define isGRAPH_LC(c) _generic_LC(c, _CC_GRAPH, isgraph) +# define isIDFIRST_LC(c) _generic_LC_underscore(c, _CC_IDFIRST, isalpha) +# define isLOWER_LC(c) _generic_LC(c, _CC_LOWER, islower) +# define isPRINT_LC(c) _generic_LC(c, _CC_PRINT, isprint) +# define isPUNCT_LC(c) _generic_LC(c, _CC_PUNCT, ispunct) +# define isSPACE_LC(c) _generic_LC(c, _CC_SPACE, isspace) +# define isUPPER_LC(c) _generic_LC(c, _CC_UPPER, isupper) +# define isWORDCHAR_LC(c) _generic_LC_underscore(c, _CC_WORDCHAR, isalnum) +# define isXDIGIT_LC(c) _generic_LC(c, _CC_XDIGIT, isxdigit) + + +# define toLOWER_LC(c) _generic_toLOWER_LC((c), tolower, U8) +# define toUPPER_LC(c) _generic_toUPPER_LC((c), toupper, U8) +# define toFOLD_LC(c) _generic_toFOLD_LC((c), tolower, U8) -# else +# else /* The final fallback position */ # define isALPHA_LC(c) (isascii(c) && isalpha(c)) # define isALPHANUMERIC_LC(c) (isascii(c) && isalnum(c)) -# define isASCII_LC(c) isascii(c) -# ifdef HAS_ISBLANK -# define isBLANK_LC(c) (isascii(c) && isblank(c)) -# else -# define isBLANK_LC(c) isBLANK_A(c) -# endif # define isCNTRL_LC(c) (isascii(c) && iscntrl(c)) # define isDIGIT_LC(c) (isascii(c) && isdigit(c)) # define isGRAPH_LC(c) (isascii(c) && isgraph(c)) @@ -1138,8 +1395,10 @@ EXTCONST U32 PL_charclass[]; # define isUPPER_LC(c) (isascii(c) && isupper(c)) # define isWORDCHAR_LC(c) (isascii(c) && (isalnum(c) || (c) == '_')) # define isXDIGIT_LC(c) (isascii(c) && isxdigit(c)) + # define toLOWER_LC(c) (isascii(c) ? tolower(c) : (c)) # define toUPPER_LC(c) (isascii(c) ? toupper(c) : (c)) +# define toFOLD_LC(c) (isascii(c) ? tolower(c) : (c)) # endif #endif /* USE_NEXT_CTYPE */ @@ -1150,11 +1409,18 @@ EXTCONST U32 PL_charclass[]; #define isIDCONT_LC(c) isWORDCHAR_LC(c) #define isPSXSPC_LC(c) isSPACE_LC(c) -/* For internal core Perl use only. If the input is Latin1, use the Latin1 - * macro; otherwise use the function 'above_latin1'. Won't compile if 'c' isn't unsigned, as - * won't match above_latin1 prototype. The macros do bounds checking, so have - * duplicate checks here, so could create versions of the macros that don't, - * but experiments show that gcc optimizes them out anyway. */ +/* For internal core Perl use only: the base macros for defining macros like + * isALPHA_uni. 'c' is the code point to check. 'classnum' is the POSIX class + * number defined earlier in this file. _generic_uni() is used for POSIX + * classes where there is a macro or function 'above_latin1' that takes the + * single argument 'c' and returns the desired value. These exist for those + * classes which have simple definitions, avoiding the overhead of a hash + * lookup or inversion list binary search. _generic_swash_uni() can be used + * for classes where that overhead is faster than a direct lookup. + * _generic_uni() won't compile if 'c' isn't unsigned, as it won't match the + * 'above_latin1' prototype. _generic_isCC() macro does bounds checking, so + * have duplicate checks here, so could create versions of the macros that + * don't, but experiments show that gcc optimizes them out anyway. */ /* Note that all ignore 'use bytes' */ #define _generic_uni(classnum, above_latin1, c) ((c) < 256 \ @@ -1190,6 +1456,11 @@ EXTCONST U32 PL_charclass[]; #define toTITLE_uni(c,s,l) to_uni_title(c,s,l) #define toUPPER_uni(c,s,l) to_uni_upper(c,s,l) +/* For internal core Perl use only: the base macros for defining macros like + * isALPHA_LC_uvchr. These are like isALPHA_LC, but the input can be any code + * point, not just 0-255. Like _generic_uni, there are two versions, one for + * simple class definitions; the other for more complex. These are like + * _generic_uni, so see it for more info. */ #define _generic_LC_uvchr(latin1, above_latin1, c) \ (c < 256 ? latin1(c) : above_latin1(c)) #define _generic_LC_swash_uvchr(latin1, classnum, c) \ @@ -1219,31 +1490,28 @@ EXTCONST U32 PL_charclass[]; _CC_WORDCHAR, c) #define isXDIGIT_LC_uvchr(c) _generic_LC_uvchr(isXDIGIT_LC, is_XDIGIT_cp_high, c) - #define isBLANK_LC_uni(c) isBLANK_LC_uvchr(UNI_TO_NATIVE(c)) -/* Everything whose name begins with an underscore is for internal core Perl - * use only. */ - -/* If the input is in the Latin1 range, use - * the Latin1 macro 'classnum' on 'p' which is a pointer to a UTF-8 string. - * Otherwise use the value given by the 'utf8' parameter. This relies on the - * fact that ASCII characters have the same representation whether utf8 or not. - * Note that it assumes that the utf8 has been validated, and ignores 'use - * bytes' */ +/* For internal core Perl use only: the base macros for defining macros like + * isALPHA_utf8. These are like the earlier defined macros, but take an input + * UTF-8 encoded string 'p'. If the input is in the Latin1 range, use + * the Latin1 macro 'classnum' on 'p'. Otherwise use the value given by the + * 'utf8' parameter. This relies on the fact that ASCII characters have the + * same representation whether utf8 or not. Note that it assumes that the utf8 + * has been validated, and ignores 'use bytes' */ #define _generic_utf8(classnum, p, utf8) (UTF8_IS_INVARIANT(*(p)) \ ? _generic_isCC(*(p), classnum) \ : (UTF8_IS_DOWNGRADEABLE_START(*(p))) \ ? _generic_isCC( \ - TWO_BYTE_UTF8_TO_UNI(*(p), \ + TWO_BYTE_UTF8_TO_NATIVE(*(p), \ *((p)+1 )), \ - classnum) \ + classnum) \ : utf8) /* Like the above, but calls 'above_latin1(p)' to get the utf8 value. 'above_latin1' * can be a macro */ #define _generic_func_utf8(classnum, above_latin1, p) \ _generic_utf8(classnum, p, above_latin1(p)) -/* Like the above, but passes classnum to _isFOO_utf8(), instead of having a +/* Like the above, but passes classnum to _isFOO_utf8(), instead of having an * 'above_latin1' parameter */ #define _generic_swash_utf8(classnum, p) \ _generic_utf8(classnum, p, _is_utf8_FOO(classnum, p)) @@ -1251,11 +1519,11 @@ EXTCONST U32 PL_charclass[]; /* Like the above, but should be used only when it is known that there are no * characters in the range 128-255 which the class is TRUE for. Hence it can * skip the tests for this range. 'above_latin1' should include its arguments */ -#define _generic_utf8_no_upper_latin1(classnum, p, above_latin1) \ +#define _generic_utf8_no_upper_latin1(classnum, p, above_latin1) \ (UTF8_IS_INVARIANT(*(p)) \ ? _generic_isCC(*(p), classnum) \ : (UTF8_IS_ABOVE_LATIN1(*(p))) \ - ? above_latin1 \ + ? above_latin1 \ : 0) /* NOTE that some of these macros have very similar ones in regcharclass.h. @@ -1302,26 +1570,26 @@ EXTCONST U32 PL_charclass[]; #define isXDIGIT_utf8(p) _generic_utf8_no_upper_latin1(_CC_XDIGIT, p, \ is_XDIGIT_high(p)) +#define toFOLD_utf8(p,s,l) to_utf8_fold(p,s,l) #define toLOWER_utf8(p,s,l) to_utf8_lower(p,s,l) #define toTITLE_utf8(p,s,l) to_utf8_title(p,s,l) #define toUPPER_utf8(p,s,l) to_utf8_upper(p,s,l) -/* For internal core Perl use only. If the input is in the Latin1 range, use - * the macro 'macro' on 'p' which is a pointer to a UTF-8 string. Otherwise - * use the value given by the 'utf8' parameter. This relies on the fact that - * ASCII characters have the same representation whether utf8 or not. Note - * that it assumes that the utf8 has been validated, and ignores 'use bytes' */ -#define _generic_LC_utf8(macro, p, utf8) \ - (UTF8_IS_INVARIANT(*(p)) \ - ? macro(*(p)) \ - : (UTF8_IS_DOWNGRADEABLE_START(*(p))) \ - ? macro(TWO_BYTE_UTF8_TO_UNI(*(p), *((p)+1))) \ +/* For internal core Perl use only: the base macros for defining macros like + * isALPHA_LC_utf8. These are like _generic_utf8, but if the first code point + * in 'p' is within the 0-255 range, it uses locale rules from the passed-in + * 'macro' parameter */ +#define _generic_LC_utf8(macro, p, utf8) \ + (UTF8_IS_INVARIANT(*(p)) \ + ? macro(*(p)) \ + : (UTF8_IS_DOWNGRADEABLE_START(*(p))) \ + ? macro(TWO_BYTE_UTF8_TO_NATIVE(*(p), *((p)+1))) \ : utf8) #define _generic_LC_swash_utf8(macro, classnum, p) \ _generic_LC_utf8(macro, p, _is_utf8_FOO(classnum, p)) #define _generic_LC_func_utf8(macro, above_latin1, p) \ - _generic_LC_utf8(macro, p, above_latin1(p)) + _generic_LC_utf8(macro, p, above_latin1(p)) #define isALPHANUMERIC_LC_utf8(p) _generic_LC_swash_utf8(isALPHANUMERIC_LC, \ _CC_ALPHANUMERIC, p) @@ -1367,11 +1635,23 @@ EXTCONST U32 PL_charclass[]; #define isALNUMC_utf8(p) isALPHANUMERIC_utf8(p) #define isALNUMC_LC_utf8(p) isALPHANUMERIC_LC_utf8(p) -/* This conversion works both ways, strangely enough. On EBCDIC platforms, - * CTRL-@ is 0, CTRL-A is 1, etc, just like on ASCII, except that they don't - * necessarily mean the same characters, e.g. CTRL-D is 4 on both systems, but - * that is EOT on ASCII; ST on EBCDIC */ -# define toCTRL(c) (toUPPER(NATIVE_TO_UNI(c)) ^ 64) +/* On EBCDIC platforms, CTRL-@ is 0, CTRL-A is 1, etc, just like on ASCII, + * except that they don't necessarily mean the same characters, e.g. CTRL-D is + * 4 on both systems, but that is EOT on ASCII; ST on EBCDIC. + * '?' is special-cased on EBCDIC to APC, which is the control there that is + * the outlier from the block that contains the other controls, just like + * toCTRL('?') on ASCII yields DEL, the control that is the outlier from the C0 + * block. If it weren't special cased, it would yield a non-control. + * The conversion works both ways, so CTRL('D') is 4, and CTRL(4) is D, etc. */ +#ifndef EBCDIC +# define toCTRL(c) (toUPPER(c) ^ 64) +#else +# define toCTRL(c) ((c) == '?' \ + ? LATIN1_TO_NATIVE(0x9F) \ + : (c) == LATIN1_TO_NATIVE(0x9F) \ + ? '?' \ + : (NATIVE_TO_LATIN1(toUPPER(c)) ^ 64)) +#endif /* Line numbers are unsigned, 32 bits. */ typedef U32 line_t; @@ -1390,7 +1670,22 @@ typedef U32 line_t; } \ return a; -#define READ_XDIGIT(s) (isALPHA(*(s)) ? ((*(s)++ + 9) & 0xf) : (*(s)++ & 0xf)) +/* Converts a character known to represent a hexadecimal digit (0-9, A-F, or + * a-f) to its numeric value. READ_XDIGIT's argument is a string pointer, + * which is advanced. The input is validated only by an assert() in DEBUGGING + * builds. In both ASCII and EBCDIC the last 4 bits of the digits are 0-9; and + * the last 4 bits of A-F and a-f are 1-6, so adding 9 yields 10-15 */ +#define XDIGIT_VALUE(c) (__ASSERT_(isXDIGIT(c)) (0xf & (isDIGIT(c) \ + ? (c) \ + : ((c) + 9)))) +#define READ_XDIGIT(s) (__ASSERT_(isXDIGIT(*s)) (0xf & (isDIGIT(*(s)) \ + ? (*(s)++) \ + : (*(s)++ + 9)))) + +/* Converts a character known to represent an octal digit (0-7) to its numeric + * value. The input is validated only by an assert() in DEBUGGING builds. In + * both ASCII and EBCDIC the last 3 bits of the octal digits range from 0-7. */ +#define OCTAL_VALUE(c) (__ASSERT_(isOCTAL(c)) (7 & (c))) /* =head1 Memory Management @@ -1398,6 +1693,8 @@ typedef U32 line_t; =for apidoc Am|void|Newx|void* ptr|int nitems|type The XSUB-writer's interface to the C C function. +Memory obtained by this should B be freed with L<"Safefree">. + In 5.9.3, Newx() and friends replace the older New() API, and drops the first parameter, I, a debug aid which allowed callers to identify themselves. This aid has been superseded by a new build option, @@ -1408,27 +1705,38 @@ there for use in XS modules supporting o The XSUB-writer's interface to the C C function, with cast. See also C. +Memory obtained by this should B be freed with L<"Safefree">. + =for apidoc Am|void|Newxz|void* ptr|int nitems|type The XSUB-writer's interface to the C C function. The allocated memory is zeroed with C. See also C. +Memory obtained by this should B be freed with L<"Safefree">. + =for apidoc Am|void|Renew|void* ptr|int nitems|type The XSUB-writer's interface to the C C function. +Memory obtained by this should B be freed with L<"Safefree">. + =for apidoc Am|void|Renewc|void* ptr|int nitems|type|cast The XSUB-writer's interface to the C C function, with cast. +Memory obtained by this should B be freed with L<"Safefree">. + =for apidoc Am|void|Safefree|void* ptr The XSUB-writer's interface to the C C function. +This should B be used on memory obtained using L<"Newx"> and friends. + =for apidoc Am|void|Move|void* src|void* dest|int nitems|type The XSUB-writer's interface to the C C function. The C is the source, C is the destination, C is the number of items, and C is the type. Can do overlapping moves. See also C. =for apidoc Am|void *|MoveD|void* src|void* dest|int nitems|type -Like C but returns dest. Useful for encouraging compilers to tail-call +Like C but returns dest. Useful +for encouraging compilers to tail-call optimise. =for apidoc Am|void|Copy|void* src|void* dest|int nitems|type @@ -1438,7 +1746,8 @@ C is the type. May fail on overla =for apidoc Am|void *|CopyD|void* src|void* dest|int nitems|type -Like C but returns dest. Useful for encouraging compilers to tail-call +Like C but returns dest. Useful +for encouraging compilers to tail-call optimise. =for apidoc Am|void|Zero|void* dest|int nitems|type @@ -1448,7 +1757,8 @@ destination, C is the number of =for apidoc Am|void *|ZeroD|void* dest|int nitems|type -Like C but returns dest. Useful for encouraging compilers to tail-call +Like C but returns dest. Useful +for encouraging compilers to tail-call optimise. =for apidoc Am|void|StructCopy|type *src|type *dest|type @@ -1485,12 +1795,12 @@ PoisonWith(0xEF) for catching access to * (U16)n > (size_t)~0/sizeof(U16) always being false. */ #ifdef PERL_MALLOC_WRAP #define MEM_WRAP_CHECK(n,t) \ - (void)(sizeof(t) > 1 && ((MEM_SIZE)(n)+0.0) > MEM_SIZE_MAX/sizeof(t) && (Perl_croak_memory_wrap(),0)) + (void)(UNLIKELY(sizeof(t) > 1 && ((MEM_SIZE)(n)+0.0) > MEM_SIZE_MAX/sizeof(t)) && (croak_memory_wrap(),0)) #define MEM_WRAP_CHECK_1(n,t,a) \ - (void)(sizeof(t) > 1 && ((MEM_SIZE)(n)+0.0) > MEM_SIZE_MAX/sizeof(t) && (Perl_croak_nocontext("%s",(a)),0)) + (void)(UNLIKELY(sizeof(t) > 1 && ((MEM_SIZE)(n)+0.0) > MEM_SIZE_MAX/sizeof(t)) && (Perl_croak_nocontext("%s",(a)),0)) #define MEM_WRAP_CHECK_(n,t) MEM_WRAP_CHECK(n,t), -#define PERL_STRLEN_ROUNDUP(n) ((void)(((n) > MEM_SIZE_MAX - 2 * PERL_STRLEN_ROUNDUP_QUANTUM) ? (Perl_croak_memory_wrap(),0):0),((n-1+PERL_STRLEN_ROUNDUP_QUANTUM)&~((MEM_SIZE)PERL_STRLEN_ROUNDUP_QUANTUM-1))) +#define PERL_STRLEN_ROUNDUP(n) ((void)(((n) > MEM_SIZE_MAX - 2 * PERL_STRLEN_ROUNDUP_QUANTUM) ? (croak_memory_wrap(),0):0),((n-1+PERL_STRLEN_ROUNDUP_QUANTUM)&~((MEM_SIZE)PERL_STRLEN_ROUNDUP_QUANTUM-1))) #else #define MEM_WRAP_CHECK(n,t) @@ -1616,14 +1926,25 @@ void Perl_mem_log_del_sv(const SV *sv, c #define PoisonFree(d,n,t) PoisonWith(d,n,t,0xEF) #define Poison(d,n,t) PoisonFree(d,n,t) +#ifdef PERL_POISON +# define PERL_POISON_EXPR(x) x +#else +# define PERL_POISON_EXPR(x) +#endif + #ifdef USE_STRUCT_COPY #define StructCopy(s,d,t) (*((t*)(d)) = *((t*)(s))) #else #define StructCopy(s,d,t) Copy(s,d,1,t) #endif +/* C_ARRAY_LENGTH is the number of elements in the C array (so you + * want your zero-based indices to be less than but not equal to). + * + * C_ARRAY_END is one past the last: half-open/half-closed range, + * not last-inclusive range. */ #define C_ARRAY_LENGTH(a) (sizeof(a)/sizeof((a)[0])) -#define C_ARRAY_END(a) (a) + (sizeof(a)/sizeof((a)[0])) +#define C_ARRAY_END(a) ((a) + C_ARRAY_LENGTH(a)) #ifdef NEED_VA_COPY # ifdef va_copy @@ -1659,6 +1980,37 @@ void Perl_mem_log_del_sv(const SV *sv, c CPAN::Unpack show any users outside the core. */ #ifdef PERL_CORE # define deprecate(s) Perl_ck_warner_d(aTHX_ packWARN(WARN_DEPRECATED), "Use of " s " is deprecated") +#endif + +/* Internal macros to deal with gids and uids */ +#ifdef PERL_CORE + +# if Uid_t_size > IVSIZE +# define sv_setuid(sv, uid) sv_setnv((sv), (NV)(uid)) +# define SvUID(sv) SvNV(sv) +# else +# if Uid_t_sign <= 0 +# define sv_setuid(sv, uid) sv_setiv((sv), (IV)(uid)) +# define SvUID(sv) SvIV(sv) +# else +# define sv_setuid(sv, uid) sv_setuv((sv), (UV)(uid)) +# define SvUID(sv) SvUV(sv) +# endif +# endif /* Uid_t_size */ + +# if Gid_t_size > IVSIZE +# define sv_setgid(sv, gid) sv_setnv((sv), (NV)(gid)) +# define SvGID(sv) SvNV(sv) +# else +# if Gid_t_sign <= 0 +# define sv_setgid(sv, gid) sv_setiv((sv), (IV)(gid)) +# define SvGID(sv) SvIV(sv) +# else +# define sv_setgid(sv, gid) sv_setuv((sv), (UV)(gid)) +# define SvGID(sv) SvUV(sv) +# endif +# endif /* Gid_t_size */ + #endif #endif /* HANDY_H */ Index: gnu/usr.bin/perl/hv.c =================================================================== RCS file: /mnt/memory/perl/importit/cvs/src/gnu/usr.bin/perl/hv.c,v retrieving revision 1.18 diff -u -p -u -p -r1.18 hv.c --- gnu/usr.bin/perl/hv.c 10 Apr 2014 06:50:29 -0000 1.18 +++ gnu/usr.bin/perl/hv.c 16 Nov 2014 03:22:24 -0000 @@ -36,6 +36,7 @@ holds the key and hash value. #include "perl.h" #define DO_HSPLIT(xhv) ((xhv)->xhv_keys > (xhv)->xhv_max) /* HvTOTALKEYS(hv) > HvMAX(hv) */ +#define HV_FILL_THRESHOLD 31 static const char S_strtab_error[] = "Cannot modify shared string table in hv_%s"; @@ -749,7 +750,8 @@ Perl_hv_common(pTHX_ HV *hv, SV *keysv, recursive call would call the key conversion routine again. However, as we replace the original key with the converted key, this would result in a double conversion, which would show - up as a bug if the conversion routine is not idempotent. */ + up as a bug if the conversion routine is not idempotent. + Hence the use of HV_DISABLE_UVAR_XKEY. */ return hv_common(hv, keysv, key, klen, flags, HV_FETCH_ISSTORE|HV_DISABLE_UVAR_XKEY|return_svp, val, hash); @@ -790,6 +792,13 @@ Perl_hv_common(pTHX_ HV *hv, SV *keysv, HeKEY_hek(entry) = save_hek_flags(key, klen, hash, flags); HeVAL(entry) = val; + if (!*oentry && SvOOK(hv)) { + /* initial entry, and aux struct present. */ + struct xpvhv_aux *const aux = HvAUX(hv); + if (aux->xhv_fill_lazy) + ++aux->xhv_fill_lazy; + } + #ifdef PERL_HASH_RANDOMIZE_KEYS /* This logic semi-randomizes the insert order in a bucket. * Either we insert into the top, or the slot below the top, @@ -891,7 +900,8 @@ S_hv_magic_check(HV *hv, bool *needs_cop /* =for apidoc hv_scalar -Evaluates the hash in scalar context and returns the result. Handles magic when the hash is tied. +Evaluates the hash in scalar context and returns the result. Handles magic +when the hash is tied. =cut */ @@ -948,6 +958,7 @@ S_hv_delete_common(pTHX_ HV *hv, SV *key XPVHV* xhv; HE *entry; HE **oentry; + HE *const *first_entry; bool is_utf8 = (k_flags & HVhek_UTF8) ? TRUE : FALSE; int masked_flags; @@ -1023,7 +1034,7 @@ S_hv_delete_common(pTHX_ HV *hv, SV *key masked_flags = (k_flags & HVhek_MASK); - oentry = &(HvARRAY(hv))[hash & (I32) HvMAX(hv)]; + first_entry = oentry = &(HvARRAY(hv))[hash & (I32) HvMAX(hv)]; entry = *oentry; for (; entry; oentry = &HeNEXT(entry), entry = *oentry) { SV *sv; @@ -1052,8 +1063,7 @@ S_hv_delete_common(pTHX_ HV *hv, SV *key Safefree(key); return NULL; } - if (SvREADONLY(hv) && HeVAL(entry) && SvREADONLY(HeVAL(entry)) - && !SvIsCOW(HeVAL(entry))) { + if (SvREADONLY(hv) && HeVAL(entry) && SvREADONLY(HeVAL(entry))) { hv_notallowed(k_flags, key, klen, "Attempt to delete readonly key '%"SVf"' from" " a restricted hash"); @@ -1111,6 +1121,12 @@ S_hv_delete_common(pTHX_ HV *hv, SV *key HvPLACEHOLDERS(hv)++; else { *oentry = HeNEXT(entry); + if(!*first_entry && SvOOK(hv)) { + /* removed last entry, and aux struct present. */ + struct xpvhv_aux *const aux = HvAUX(hv); + if (aux->xhv_fill_lazy) + --aux->xhv_fill_lazy; + } if (SvOOK(hv) && entry == HvAUX(hv)->xhv_eiter /* HvEITER(hv) */) HvLAZYDEL_on(hv); else { @@ -1146,6 +1162,7 @@ S_hv_delete_common(pTHX_ HV *hv, SV *key return NULL; } + STATIC void S_hsplit(pTHX_ HV *hv, STRLEN const oldsize, STRLEN newsize) { @@ -1154,18 +1171,25 @@ S_hsplit(pTHX_ HV *hv, STRLEN const olds char *a = (char*) HvARRAY(hv); HE **aep; - PERL_ARGS_ASSERT_HSPLIT; + bool do_aux= ( + /* already have an HvAUX(hv) so we have to move it */ + SvOOK(hv) || + /* no HvAUX() but array we are going to allocate is large enough + * there is no point in saving the space for the iterator, and + * speeds up later traversals. */ + ( ( hv != PL_strtab ) && ( newsize >= PERL_HV_ALLOC_AUX_SIZE ) ) + ); - /*PerlIO_printf(PerlIO_stderr(), "hsplit called for %p which had %d\n", - (void*)hv, (int) oldsize);*/ + PERL_ARGS_ASSERT_HSPLIT; PL_nomemok = TRUE; Renew(a, PERL_HV_ARRAY_ALLOC_BYTES(newsize) - + (SvOOK(hv) ? sizeof(struct xpvhv_aux) : 0), char); + + (do_aux ? sizeof(struct xpvhv_aux) : 0), char); + PL_nomemok = FALSE; if (!a) { - PL_nomemok = FALSE; return; } + #ifdef PERL_HASH_RANDOMIZE_KEYS /* the idea of this is that we create a "random" value by hashing the address of * the array, we then use the low bit to decide if we insert at the top, or insert @@ -1178,25 +1202,46 @@ S_hsplit(pTHX_ HV *hv, STRLEN const olds PL_hash_rand_bits = ROTL_UV(PL_hash_rand_bits,1); } #endif - - if (SvOOK(hv)) { + HvARRAY(hv) = (HE**) a; + HvMAX(hv) = newsize - 1; + /* before we zero the newly added memory, we + * need to deal with the aux struct that may be there + * or have been allocated by us*/ + if (do_aux) { struct xpvhv_aux *const dest = (struct xpvhv_aux*) &a[newsize * sizeof(HE*)]; - Move(&a[oldsize * sizeof(HE*)], dest, 1, struct xpvhv_aux); - /* we reset the iterator's xhv_rand as well, so they get a totally new ordering */ + if (SvOOK(hv)) { + /* alread have an aux, copy the old one in place. */ + Move(&a[oldsize * sizeof(HE*)], dest, 1, struct xpvhv_aux); + /* we reset the iterator's xhv_rand as well, so they get a totally new ordering */ +#ifdef PERL_HASH_RANDOMIZE_KEYS + dest->xhv_rand = (U32)PL_hash_rand_bits; +#endif + /* For now, just reset the lazy fill counter. + It would be possible to update the counter in the code below + instead. */ + dest->xhv_fill_lazy = 0; + } else { + /* no existing aux structure, but we allocated space for one + * so intialize it properly. This unrolls hv_auxinit() a bit, + * since we have to do the realloc anyway. */ + /* first we set the iterator's xhv_rand so it can be copied into lastrand below */ #ifdef PERL_HASH_RANDOMIZE_KEYS - dest->xhv_rand = (U32)PL_hash_rand_bits; + dest->xhv_rand = (U32)PL_hash_rand_bits; #endif + /* this is the "non realloc" part of the hv_auxinit() */ + (void)hv_auxinit_internal(dest); + /* Turn on the OOK flag */ + SvOOK_on(hv); + } } - - PL_nomemok = FALSE; + /* now we can safely clear the second half */ Zero(&a[oldsize * sizeof(HE*)], (newsize-oldsize) * sizeof(HE*), char); /* zero 2nd half*/ - HvMAX(hv) = --newsize; - HvARRAY(hv) = (HE**) a; if (!HvTOTALKEYS(hv)) /* skip rest if no entries */ return; + newsize--; aep = (HE**)a; do { HE **oentry = aep + i; @@ -1517,7 +1562,7 @@ Perl_hv_clear(pTHX_ HV *hv) /* not already placeholder */ if (HeVAL(entry) != &PL_sv_placeholder) { if (HeVAL(entry)) { - if (SvREADONLY(HeVAL(entry)) && !SvIsCOW(HeVAL(entry))) { + if (SvREADONLY(HeVAL(entry))) { SV* const keysv = hv_iterkeysv(entry); Perl_croak_nocontext( "Attempt to delete readonly key '%"SVf"' from a restricted hash", @@ -1605,8 +1650,10 @@ S_clear_placeholders(pTHX_ HV *hv, U32 i if (--items == 0) { /* Finished. */ - HvTOTALKEYS(hv) -= (IV)HvPLACEHOLDERS_get(hv); - if (HvUSEDKEYS(hv) == 0) + I32 placeholders = HvPLACEHOLDERS_get(hv); + HvTOTALKEYS(hv) -= (IV)placeholders; + /* HvUSEDKEYS expanded */ + if ((HvTOTALKEYS(hv) - placeholders) == 0) HvHASKFLAGS_off(hv); HvPLACEHOLDERS_set(hv, 0); return; @@ -1618,7 +1665,7 @@ S_clear_placeholders(pTHX_ HV *hv, U32 i } while (--i >= 0); /* You can't get here, hence assertion should always fail. */ assert (items == 0); - assert (0); + NOT_REACHED; } STATIC void @@ -1657,22 +1704,29 @@ Perl_hfree_next_entry(pTHX_ HV *hv, STRL PERL_ARGS_ASSERT_HFREE_NEXT_ENTRY; - if (SvOOK(hv) && ((iter = HvAUX(hv))) - && ((entry = iter->xhv_eiter)) ) - { - /* the iterator may get resurrected after each - * destructor call, so check each time */ - if (entry && HvLAZYDEL(hv)) { /* was deleted earlier? */ - HvLAZYDEL_off(hv); - hv_free_ent(hv, entry); - /* warning: at this point HvARRAY may have been - * re-allocated, HvMAX changed etc */ - } - iter->xhv_riter = -1; /* HvRITER(hv) = -1 */ - iter->xhv_eiter = NULL; /* HvEITER(hv) = NULL */ + if (SvOOK(hv) && ((iter = HvAUX(hv)))) { + if ((entry = iter->xhv_eiter)) { + /* the iterator may get resurrected after each + * destructor call, so check each time */ + if (entry && HvLAZYDEL(hv)) { /* was deleted earlier? */ + HvLAZYDEL_off(hv); + hv_free_ent(hv, entry); + /* warning: at this point HvARRAY may have been + * re-allocated, HvMAX changed etc */ + } + iter = HvAUX(hv); /* may have been realloced */ + iter->xhv_riter = -1; /* HvRITER(hv) = -1 */ + iter->xhv_eiter = NULL; /* HvEITER(hv) = NULL */ #ifdef PERL_HASH_RANDOMIZE_KEYS - iter->xhv_last_rand = iter->xhv_rand; + iter->xhv_last_rand = iter->xhv_rand; #endif + } + /* Reset any cached HvFILL() to "unknown". It's unlikely that anyone + will actually call HvFILL() on a hash under destruction, so it + seems pointless attempting to track the number of keys remaining. + But if they do, we want to reset it again. */ + if (iter->xhv_fill_lazy) + iter->xhv_fill_lazy = 0; } if (!((XPVHV*)SvANY(hv))->xhv_keys) @@ -1727,14 +1781,13 @@ Perl_hv_undef_flags(pTHX_ HV *hv, U32 fl { dVAR; XPVHV* xhv; - const char *name; bool save; if (!hv) return; + save = !!SvREFCNT(hv); DEBUG_A(Perl_hv_assert(aTHX_ hv)); xhv = (XPVHV*)SvANY(hv); - save = !!SvREFCNT(hv); /* The name must be deleted before the call to hfreeeeentries so that CVs are anonymised properly. But the effective name must be pre- @@ -1746,14 +1799,11 @@ Perl_hv_undef_flags(pTHX_ HV *hv, U32 fl if they will be freed anyway. */ /* note that the code following prior to hfreeentries is duplicated * in sv_clear(), and changes here should be done there too */ - if (PL_phase != PERL_PHASE_DESTRUCT && (name = HvNAME(hv))) { + if (PL_phase != PERL_PHASE_DESTRUCT && HvNAME(hv)) { if (PL_stashcache) { DEBUG_o(Perl_deb(aTHX_ "hv_undef_flags clearing PL_stashcache for '%" HEKf"'\n", HvNAME_HEK(hv))); - (void)hv_delete(PL_stashcache, name, - HEK_UTF8(HvNAME_HEK(hv)) ? -HvNAMELEN_get(hv) : HvNAMELEN_get(hv), - G_DISCARD - ); + (void)hv_deletehek(PL_stashcache, HvNAME_HEK(hv), G_DISCARD); } hv_name_set(hv, NULL, 0, 0); } @@ -1763,35 +1813,31 @@ Perl_hv_undef_flags(pTHX_ HV *hv, U32 fl } hfreeentries(hv); if (SvOOK(hv)) { - struct xpvhv_aux * const aux = HvAUX(hv); struct mro_meta *meta; + const char *name; - if ((name = HvENAME_get(hv))) { + if (HvENAME_get(hv)) { if (PL_phase != PERL_PHASE_DESTRUCT) mro_isa_changed_in(hv); if (PL_stashcache) { DEBUG_o(Perl_deb(aTHX_ "hv_undef_flags clearing PL_stashcache for effective name '%" HEKf"'\n", HvENAME_HEK(hv))); - (void)hv_delete( - PL_stashcache, name, - HEK_UTF8(HvENAME_HEK(hv)) ? -HvENAMELEN_get(hv) : HvENAMELEN_get(hv), - G_DISCARD - ); + (void)hv_deletehek(PL_stashcache, HvENAME_HEK(hv), G_DISCARD); } } /* If this call originated from sv_clear, then we must check for * effective names that need freeing, as well as the usual name. */ name = HvNAME(hv); - if (flags & HV_NAME_SETALL ? !!aux->xhv_name_u.xhvnameu_name : !!name) { + if (flags & HV_NAME_SETALL ? !!HvAUX(hv)->xhv_name_u.xhvnameu_name : !!name) { if (name && PL_stashcache) { DEBUG_o(Perl_deb(aTHX_ "hv_undef_flags clearing PL_stashcache for name '%" HEKf"'\n", HvNAME_HEK(hv))); - (void)hv_delete(PL_stashcache, name, (HEK_UTF8(HvNAME_HEK(hv)) ? -HvNAMELEN_get(hv) : HvNAMELEN_get(hv)), G_DISCARD); + (void)hv_deletehek(PL_stashcache, HvNAME_HEK(hv), G_DISCARD); } hv_name_set(hv, NULL, 0, flags); } - if((meta = aux->xhv_mro_meta)) { + if((meta = HvAUX(hv)->xhv_mro_meta)) { if (meta->mro_linear_all) { SvREFCNT_dec_NN(meta->mro_linear_all); /* mro_linear_current is just acting as a shortcut pointer, @@ -1803,11 +1849,11 @@ Perl_hv_undef_flags(pTHX_ HV *hv, U32 fl SvREFCNT_dec(meta->mro_linear_current); SvREFCNT_dec(meta->mro_nextmethod); SvREFCNT_dec(meta->isa); + SvREFCNT_dec(meta->super); Safefree(meta); - aux->xhv_mro_meta = NULL; + HvAUX(hv)->xhv_mro_meta = NULL; } - SvREFCNT_dec(aux->xhv_super); - if (!aux->xhv_name_u.xhvnameu_name && ! aux->xhv_backreferences) + if (!HvAUX(hv)->xhv_name_u.xhvnameu_name && ! HvAUX(hv)->xhv_backreferences) SvFLAGS(hv) &= ~SVf_OOK; } if (!SvOOK(hv)) { @@ -1828,23 +1874,40 @@ Perl_hv_undef_flags(pTHX_ HV *hv, U32 fl /* =for apidoc hv_fill -Returns the number of hash buckets that happen to be in use. This function is +Returns the number of hash buckets that +happen to be in use. This function is wrapped by the macro C. -Previously this value was stored in the HV structure, rather than being -calculated on demand. +Previously this value was always stored in the HV structure, which created an +overhead on every hash (and pretty much every object) for something that was +rarely used. Now we calculate it on demand the first +time that it is needed, and cache it if that calculation +is going to be costly to repeat. The cached +value is updated by insertions and deletions, but (currently) discarded if +the hash is split. =cut */ STRLEN -Perl_hv_fill(pTHX_ HV const *const hv) +Perl_hv_fill(pTHX_ HV *const hv) { STRLEN count = 0; HE **ents = HvARRAY(hv); + struct xpvhv_aux *aux = SvOOK(hv) ? HvAUX(hv) : NULL; PERL_ARGS_ASSERT_HV_FILL; + /* No keys implies no buckets used. + One key can only possibly mean one bucket used. */ + if (HvTOTALKEYS(hv) < 2) + return HvTOTALKEYS(hv); + +#ifndef DEBUGGING + if (aux && aux->xhv_fill_lazy) + return aux->xhv_fill_lazy; +#endif + if (ents) { HE *const *const last = ents + HvMAX(hv); count = last + 1 - ents; @@ -1854,6 +1917,16 @@ Perl_hv_fill(pTHX_ HV const *const hv) --count; } while (++ents <= last); } + if (aux) { +#ifdef DEBUGGING + if (aux->xhv_fill_lazy) + assert(aux->xhv_fill_lazy == count); +#endif + aux->xhv_fill_lazy = count; + } else if (HvMAX(hv) >= HV_FILL_THRESHOLD) { + aux = hv_auxinit(hv); + aux->xhv_fill_lazy = count; + } return count; } @@ -1890,6 +1963,23 @@ PERL_STATIC_INLINE U32 S_ptr_hash(PTRV u return (U32)u; } +static struct xpvhv_aux* +S_hv_auxinit_internal(struct xpvhv_aux *iter) { + PERL_ARGS_ASSERT_HV_AUXINIT_INTERNAL; + iter->xhv_riter = -1; /* HvRITER(hv) = -1 */ + iter->xhv_eiter = NULL; /* HvEITER(hv) = NULL */ +#ifdef PERL_HASH_RANDOMIZE_KEYS + iter->xhv_last_rand = iter->xhv_rand; +#endif + iter->xhv_fill_lazy = 0; + iter->xhv_name_u.xhvnameu_name = 0; + iter->xhv_name_count = 0; + iter->xhv_backreferences = 0; + iter->xhv_mro_meta = NULL; + iter->xhv_aux_flags = 0; + return iter; +} + static struct xpvhv_aux* S_hv_auxinit(pTHX_ HV *hv) { @@ -1923,17 +2013,7 @@ S_hv_auxinit(pTHX_ HV *hv) { iter = HvAUX(hv); } - iter->xhv_riter = -1; /* HvRITER(hv) = -1 */ - iter->xhv_eiter = NULL; /* HvEITER(hv) = NULL */ -#ifdef PERL_HASH_RANDOMIZE_KEYS - iter->xhv_last_rand = iter->xhv_rand; -#endif - iter->xhv_name_u.xhvnameu_name = 0; - iter->xhv_name_count = 0; - iter->xhv_backreferences = 0; - iter->xhv_mro_meta = NULL; - iter->xhv_super = NULL; - return iter; + return hv_auxinit_internal(iter); } /* @@ -1962,12 +2042,13 @@ Perl_hv_iterinit(pTHX_ HV *hv) Perl_croak(aTHX_ "Bad hash"); if (SvOOK(hv)) { - struct xpvhv_aux * const iter = HvAUX(hv); + struct xpvhv_aux * iter = HvAUX(hv); HE * const entry = iter->xhv_eiter; /* HvEITER(hv) */ if (entry && HvLAZYDEL(hv)) { /* was deleted earlier? */ HvLAZYDEL_off(hv); hv_free_ent(hv, entry); } + iter = HvAUX(hv); /* may have been reallocated */ iter->xhv_riter = -1; /* HvRITER(hv) = -1 */ iter->xhv_eiter = NULL; /* HvEITER(hv) = NULL */ #ifdef PERL_HASH_RANDOMIZE_KEYS @@ -2099,6 +2180,7 @@ Perl_hv_name_set(pTHX_ HV *hv, const cha /* The first elem may be null. */ if(*name) unshare_hek_or_pvn(*name, 0, 0, 0); Safefree(name); + iter = HvAUX(hv); /* may been realloced */ spot = &iter->xhv_name_u.xhvnameu_name; iter->xhv_name_count = 0; } @@ -2120,6 +2202,7 @@ Perl_hv_name_set(pTHX_ HV *hv, const cha } else if (flags & HV_NAME_SETALL) { unshare_hek_or_pvn(iter->xhv_name_u.xhvnameu_name, 0, 0, 0); + iter = HvAUX(hv); /* may been realloced */ spot = &iter->xhv_name_u.xhvnameu_name; } else { @@ -2264,6 +2347,7 @@ Perl_hv_ename_delete(pTHX_ HV *hv, const : (HEK_LEN(*victim) == (I32)len && memEQ(HEK_KEY(*victim), name, len)) ) { unshare_hek_or_pvn(*victim, 0, 0, 0); + aux = HvAUX(hv); /* may been realloced */ if (count < 0) ++aux->xhv_name_count; else --aux->xhv_name_count; if ( @@ -2351,7 +2435,7 @@ trigger the resource deallocation. Returns entries from a hash iterator. See C and C. The C value will normally be zero; if HV_ITERNEXT_WANTPLACEHOLDERS is set the placeholders keys (for restricted hashes) will be returned in addition -to normal keys. By default placeholders are automatically skipped over. +to normal keys. By default placeholders are automatically skipped over. Currently a placeholder is implemented with a value that is C<&PL_sv_placeholder>. Note that the implementation of placeholders and restricted hashes may change, and the implementation currently is @@ -2416,6 +2500,7 @@ Perl_hv_iternext_flags(pTHX_ HV *hv, I32 SvREFCNT_dec(HeVAL(entry)); Safefree(HeKEY_hek(entry)); del_HE(entry); + iter = HvAUX(hv); /* may been realloced */ iter->xhv_eiter = NULL; /* HvEITER(hv) = NULL */ HvLAZYDEL_off(hv); return NULL; @@ -2462,6 +2547,7 @@ Perl_hv_iternext_flags(pTHX_ HV *hv, I32 pTHX__FORMAT pTHX__VALUE); } + iter = HvAUX(hv); /* may been realloced */ iter->xhv_last_rand = iter->xhv_rand; } #endif @@ -2506,6 +2592,7 @@ Perl_hv_iternext_flags(pTHX_ HV *hv, I32 hv_free_ent(hv, oldentry); } + iter = HvAUX(hv); /* may been realloced */ iter->xhv_eiter = entry; /* HvEITER(hv) = entry */ return entry; } @@ -2844,7 +2931,7 @@ S_share_hek_flags(pTHX_ const char *str, return HeKEY_hek(entry); } -I32 * +SSize_t * Perl_hv_placeholders_p(pTHX_ HV *hv) { dVAR; @@ -3073,12 +3160,12 @@ Perl_refcounted_he_fetch_pvn(pTHX_ const const char *keyend = keypv + keylen, *p; STRLEN nonascii_count = 0; for (p = keypv; p != keyend; p++) { - U8 c = (U8)*p; - if (c & 0x80) { - if (!((c & 0xfe) == 0xc2 && ++p != keyend && - (((U8)*p) & 0xc0) == 0x80)) + if (! UTF8_IS_INVARIANT(*p)) { + if (! UTF8_IS_NEXT_CHAR_DOWNGRADEABLE(p, keyend)) { goto canonicalised_key; + } nonascii_count++; + p++; } } if (nonascii_count) { @@ -3090,8 +3177,13 @@ Perl_refcounted_he_fetch_pvn(pTHX_ const keypv = q; for (; p != keyend; p++, q++) { U8 c = (U8)*p; - *q = (char) - ((c & 0x80) ? ((c & 0x03) << 6) | (((U8)*++p) & 0x3f) : c); + if (UTF8_IS_INVARIANT(c)) { + *q = (char) c; + } + else { + p++; + *q = (char) TWO_BYTE_UTF8_TO_NATIVE(c, *p); + } } } flags &= ~REFCOUNTED_HE_KEY_UTF8; @@ -3243,12 +3335,12 @@ Perl_refcounted_he_new_pvn(pTHX_ struct const char *keyend = keypv + keylen, *p; STRLEN nonascii_count = 0; for (p = keypv; p != keyend; p++) { - U8 c = (U8)*p; - if (c & 0x80) { - if (!((c & 0xfe) == 0xc2 && ++p != keyend && - (((U8)*p) & 0xc0) == 0x80)) + if (! UTF8_IS_INVARIANT(*p)) { + if (! UTF8_IS_NEXT_CHAR_DOWNGRADEABLE(p, keyend)) { goto canonicalised_key; + } nonascii_count++; + p++; } } if (nonascii_count) { @@ -3260,8 +3352,13 @@ Perl_refcounted_he_new_pvn(pTHX_ struct keypv = q; for (; p != keyend; p++, q++) { U8 c = (U8)*p; - *q = (char) - ((c & 0x80) ? ((c & 0x03) << 6) | (((U8)*++p) & 0x3f) : c); + if (UTF8_IS_INVARIANT(c)) { + *q = (char) c; + } + else { + p++; + *q = (char) TWO_BYTE_UTF8_TO_NATIVE(c, *p); + } } } flags &= ~REFCOUNTED_HE_KEY_UTF8; @@ -3460,7 +3557,8 @@ Perl_cop_fetch_label(pTHX_ COP *const co /* =for apidoc cop_store_label -Save a label into a C. You need to set flags to C +Save a label into a C. +You need to set flags to C for a utf-8 label. =cut Index: gnu/usr.bin/perl/hv.h =================================================================== RCS file: /mnt/memory/perl/importit/cvs/src/gnu/usr.bin/perl/hv.h,v retrieving revision 1.13 diff -u -p -u -p -r1.13 hv.h --- gnu/usr.bin/perl/hv.h 24 Mar 2014 15:05:13 -0000 1.13 +++ gnu/usr.bin/perl/hv.h 16 Nov 2014 03:22:24 -0000 @@ -81,6 +81,7 @@ struct mro_meta { U32 pkg_gen; /* Bumps when local methods/@ISA change */ const struct mro_alg *mro_which; /* which mro alg is in use? */ HV *isa; /* Everything this class @ISA */ + HV *super; /* SUPER method cache */ U32 destroy_gen; /* Generation number of DESTROY cache */ }; @@ -112,14 +113,18 @@ struct xpvhv_aux { */ I32 xhv_name_count; struct mro_meta *xhv_mro_meta; - HV * xhv_super; /* SUPER method cache */ #ifdef PERL_HASH_RANDOMIZE_KEYS U32 xhv_rand; /* random value for hash traversal */ U32 xhv_last_rand; /* last random value for hash traversal, used to detect each() after insert for warnings */ #endif + U32 xhv_fill_lazy; + U32 xhv_aux_flags; /* assorted extra flags */ }; +#define HvAUXf_SCAN_STASH 0x1 /* stash is being scanned by gv_check */ +#define HvAUXf_NO_DEREF 0x2 /* @{}, %{} etc (and nomethod) not present */ + /* hash structure: */ /* This structure must match the beginning of struct xpvmg in sv.h. */ struct xpvhv { @@ -135,7 +140,7 @@ struct xpvhv { =for apidoc AmU||HEf_SVKEY This flag, used in the length slot of hash entries and magic structures, specifies the structure contains an C pointer where a C pointer -is to be expected. (For information only--not to be used). +is to be expected. (For information only--not to be used). =head1 Handy Values @@ -157,10 +162,10 @@ Returns the length of the stash's name. Returns true if the name is in UTF8 encoding. =for apidoc Am|char*|HvENAME|HV* stash -Returns the effective name of a stash, or NULL if there is none. The +Returns the effective name of a stash, or NULL if there is none. The effective name represents a location in the symbol table where this stash -resides. It is updated automatically when packages are aliased or deleted. -A stash that is no longer in the symbol table has no effective name. This +resides. It is updated automatically when packages are aliased or deleted. +A stash that is no longer in the symbol table has no effective name. This name is preferable to C for use in MRO linearisations and isa caches. @@ -171,7 +176,7 @@ Returns the length of the stash's effect Returns true if the effective name is in UTF8 encoding. =for apidoc Am|void*|HeKEY|HE* he -Returns the actual pointer stored in the key slot of the hash entry. The +Returns the actual pointer stored in the key slot of the hash entry. The pointer may be either C or C, depending on the value of C. Can be assigned to. The C or C macros are usually preferable for finding the value of a key. @@ -179,11 +184,12 @@ usually preferable for finding the value =for apidoc Am|STRLEN|HeKLEN|HE* he If this is negative, and amounts to C, it indicates the entry holds an C key. Otherwise, holds the actual length of the key. Can -be assigned to. The C macro is usually preferable for finding key +be assigned to. The C macro is usually preferable for finding key lengths. =for apidoc Am|SV*|HeVAL|HE* he -Returns the value slot (type C) stored in the hash entry. Can be assigned +Returns the value slot (type C) +stored in the hash entry. Can be assigned to. SV *foo= HeVAL(hv); @@ -201,14 +207,14 @@ not care about what the length of the ke variable C, though this is rather less efficient than using a local variable. Remember though, that hash keys in perl are free to contain embedded nulls, so using C or similar is not a good way to find -the length of hash keys. This is very similar to the C macro -described elsewhere in this document. See also C. +the length of hash keys. This is very similar to the C macro +described elsewhere in this document. See also C. If you are using C to get values to pass to C to create a new SV, you should consider using C as it is more efficient. -=for apidoc Am|char*|HeUTF8|HE* he +=for apidoc Am|U32|HeUTF8|HE* he Returns whether the C value returned by C is encoded in UTF-8, doing any necessary dereferencing of possibly C keys. The value returned will be 0 or non-0, not necessarily 1 (or even a value with any low bits set), @@ -233,6 +239,18 @@ C. #define PERL_HASH_DEFAULT_HvMAX 7 +/* During hsplit(), if HvMAX(hv)+1 (the new bucket count) is >= this value, + * we preallocate the HvAUX() struct. + * The assumption being that we are using so much space anyway we might + * as well allocate the extra bytes and speed up later keys() + * or each() operations. We don't do this to small hashes as we assume + * that a) it will be easy/fast to resize them to add the iterator, and b) that + * many of them will be objects which won't be traversed. Larger hashes however + * will take longer to extend, and the size of the aux struct is swamped by the + * overall length of the bucket array. + * */ +#define PERL_HV_ALLOC_AUX_SIZE (1 << 9) + /* these hash entry flags ride on hent_klen (for use only in magic/tied HVs) */ #define HEf_SVKEY -2 /* hent_key is an SV* */ @@ -240,7 +258,7 @@ C. # define Nullhv Null(HV*) #endif #define HvARRAY(hv) ((hv)->sv_u.svu_hash) -#define HvFILL(hv) Perl_hv_fill(aTHX_ (const HV *)(hv)) +#define HvFILL(hv) Perl_hv_fill(aTHX_ MUTABLE_HV(hv)) #define HvMAX(hv) ((XPVHV*) SvANY(hv))->xhv_max /* This quite intentionally does no flag checking first. That's your responsibility. */ @@ -366,7 +384,9 @@ C. ((HeKLEN(he) == HEf_SVKEY) ? \ HeKEY_sv(he) : \ newSVpvn_flags(HeKEY(he), \ - HeKLEN(he), SVs_TEMP)) : \ + HeKLEN(he), \ + SVs_TEMP | \ + ( HeKUTF8(he) ? SVf_UTF8 : 0 ))) : \ &PL_sv_undef) #define HeSVKEY_set(he,sv) ((HeKLEN(he) = HEf_SVKEY), (HeKEY_sv(he) = sv)) @@ -466,6 +486,22 @@ C. #define hv_delete(hv, key, klen, flags) \ (MUTABLE_SV(hv_common_key_len((hv), (key), (klen), \ (flags) | HV_DELETE, NULL, 0))) + +#ifdef PERL_CORE +# define hv_storehek(hv, hek, val) \ + hv_common((hv), NULL, HEK_KEY(hek), HEK_LEN(hek), HEK_UTF8(hek), \ + HV_FETCH_ISSTORE|HV_FETCH_JUST_SV, (val), HEK_HASH(hek)) +# define hv_fetchhek(hv, hek, lval) \ + ((SV **) \ + hv_common((hv), NULL, HEK_KEY(hek), HEK_LEN(hek), HEK_UTF8(hek), \ + (lval) \ + ? (HV_FETCH_JUST_SV | HV_FETCH_LVALUE) \ + : HV_FETCH_JUST_SV, \ + NULL, HEK_HASH(hek))) +# define hv_deletehek(hv, hek, flags) \ + hv_common((hv), NULL, HEK_KEY(hek), HEK_LEN(hek), HEK_UTF8(hek), \ + (flags)|HV_DELETE, NULL, HEK_HASH(hek)) +#endif /* This refcounted he structure is used for storing the hints used for lexical pragmas. Without threads, it's basically struct he + refcount. Index: gnu/usr.bin/perl/hv_func.h =================================================================== RCS file: /mnt/memory/perl/importit/cvs/src/gnu/usr.bin/perl/hv_func.h,v retrieving revision 1.1.1.1 diff -u -p -u -p -r1.1.1.1 hv_func.h --- gnu/usr.bin/perl/hv_func.h 24 Mar 2014 14:58:44 -0000 1.1.1.1 +++ gnu/usr.bin/perl/hv_func.h 16 Nov 2014 03:22:24 -0000 @@ -93,7 +93,7 @@ */ #if (defined(__GNUC__) && defined(__i386__)) || defined(__WATCOMC__) \ - || defined(_MSC_VER) || defined (__BORLANDC__) || defined (__TURBOC__) + || defined(_MSC_VER) || defined (__TURBOC__) #define U8TO16_LE(d) (*((const U16 *) (d))) #endif @@ -472,6 +472,16 @@ S_perl_hash_sdbm(const unsigned char * c return hash; } +/* - ONE_AT_A_TIME_HARD is the 5.17+ recommend ONE_AT_A_TIME algorithm + * - ONE_AT_A_TIME_OLD is the unmodified 5.16 and older algorithm + * - ONE_AT_A_TIME is a 5.17+ tweak of ONE_AT_A_TIME_OLD to + * prevent strings of only \0 but different lengths from colliding + * + * Security-wise, from best to worst, + * ONE_AT_A_TIME_HARD > ONE_AT_A_TIME > ONE_AT_A_TIME_OLD + * There is a big drop-off in security between ONE_AT_A_TIME_HARD and + * ONE_AT_A_TIME + * */ /* This is the "One-at-a-Time" algorithm by Bob Jenkins * from requirements by Colin Plumb. Index: gnu/usr.bin/perl/inline.h =================================================================== RCS file: /mnt/memory/perl/importit/cvs/src/gnu/usr.bin/perl/inline.h,v retrieving revision 1.1.1.1 diff -u -p -u -p -r1.1.1.1 inline.h --- gnu/usr.bin/perl/inline.h 24 Mar 2014 14:58:44 -0000 1.1.1.1 +++ gnu/usr.bin/perl/inline.h 16 Nov 2014 03:22:24 -0000 @@ -14,7 +14,7 @@ /* ------------------------------- av.h ------------------------------- */ -PERL_STATIC_INLINE I32 +PERL_STATIC_INLINE SSize_t S_av_top_index(pTHX_ AV *av) { PERL_ARGS_ASSERT_AV_TOP_INDEX; @@ -32,6 +32,56 @@ S_CvDEPTHp(const CV * const sv) return &((XPVCV*)SvANY(sv))->xcv_depth; } +/* + CvPROTO returns the prototype as stored, which is not necessarily what + the interpreter should be using. Specifically, the interpreter assumes + that spaces have been stripped, which has been the case if the prototype + was added by toke.c, but is generally not the case if it was added elsewhere. + Since we can't enforce the spacelessness at assignment time, this routine + provides a temporary copy at parse time with spaces removed. + I is the start of the original buffer, I is the length of the + prototype and will be updated when this returns. + */ + +#ifdef PERL_CORE +PERL_STATIC_INLINE char * +S_strip_spaces(pTHX_ const char * orig, STRLEN * const len) +{ + SV * tmpsv; + char * tmps; + tmpsv = newSVpvn_flags(orig, *len, SVs_TEMP); + tmps = SvPVX(tmpsv); + while ((*len)--) { + if (!isSPACE(*orig)) + *tmps++ = *orig; + orig++; + } + *tmps = '\0'; + *len = tmps - SvPVX(tmpsv); + return SvPVX(tmpsv); +} +#endif + +/* ------------------------------- mg.h ------------------------------- */ + +#if defined(PERL_CORE) || defined(PERL_EXT) +/* assumes get-magic and stringification have already occurred */ +PERL_STATIC_INLINE STRLEN +S_MgBYTEPOS(pTHX_ MAGIC *mg, SV *sv, const char *s, STRLEN len) +{ + assert(mg->mg_type == PERL_MAGIC_regex_global); + assert(mg->mg_len != -1); + if (mg->mg_flags & MGf_BYTES || !DO_UTF8(sv)) + return (STRLEN)mg->mg_len; + else { + const STRLEN pos = (STRLEN)mg->mg_len; + /* Without this check, we may read past the end of the buffer: */ + if (pos > sv_or_pv_len_utf8(sv, s, len)) return len+1; + return sv_or_pv_pos_u2b(sv, s, pos, NULL); + } +} +#endif + /* ----------------------------- regexp.h ----------------------------- */ PERL_STATIC_INLINE struct regexp * @@ -67,7 +117,7 @@ S_SvREFCNT_dec(pTHX_ SV *sv) { if (LIKELY(sv != NULL)) { U32 rc = SvREFCNT(sv); - if (rc > 1) + if (LIKELY(rc > 1)) SvREFCNT(sv) = rc - 1; else Perl_sv_free2(aTHX_ sv, rc); @@ -78,7 +128,7 @@ PERL_STATIC_INLINE void S_SvREFCNT_dec_NN(pTHX_ SV *sv) { U32 rc = SvREFCNT(sv); - if (rc > 1) + if (LIKELY(rc > 1)) SvREFCNT(sv) = rc - 1; else Perl_sv_free2(aTHX_ sv, rc); @@ -121,10 +171,11 @@ S_SvPADSTALE_off(SV *sv) assert(SvFLAGS(sv) & SVs_PADMY); return SvFLAGS(sv) &= ~SVs_PADSTALE; } -#ifdef PERL_CORE +#if defined(PERL_CORE) || defined (PERL_EXT) PERL_STATIC_INLINE STRLEN S_sv_or_pv_pos_u2b(pTHX_ SV *sv, const char *pv, STRLEN pos, STRLEN *lenp) { + PERL_ARGS_ASSERT_SV_OR_PV_POS_U2B; if (SvGAMAGIC(sv)) { U8 *hopped = utf8_hop((U8 *)pv, pos); if (lenp) *lenp = (STRLEN)(utf8_hop(hopped, *lenp) - hopped); @@ -134,10 +185,89 @@ S_sv_or_pv_pos_u2b(pTHX_ SV *sv, const c } #endif +/* ------------------------------- handy.h ------------------------------- */ + +/* saves machine code for a common noreturn idiom typically used in Newx*() */ +#ifdef __clang__ +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wunused-function" +#endif +static void +S_croak_memory_wrap(void) +{ + Perl_croak_nocontext("%s",PL_memory_wrap); +} +#ifdef __clang__ +#pragma clang diagnostic pop +#endif + +#ifdef BOOTSTRAP_CHARSET +static bool +S_bootstrap_ctype(U8 character, UV classnum, bool full_Latin1) +{ + /* See comments in handy.h. This is placed in this file primarily to avoid + * having to have an entry for it in embed.fnc */ + + dTHX; + + if (! full_Latin1 && ! isASCII(character)) { + return FALSE; + } + + switch (classnum) { + case _CC_ALPHANUMERIC: return isALPHANUMERIC_L1(character); + case _CC_ALPHA: return isALPHA_L1(character); + case _CC_ASCII: return isASCII_L1(character); + case _CC_BLANK: return isBLANK_L1(character); + case _CC_CASED: return isLOWER_L1(character) + || isUPPER_L1(character); + case _CC_CNTRL: return isCNTRL_L1(character); + case _CC_DIGIT: return isDIGIT_L1(character); + case _CC_GRAPH: return isGRAPH_L1(character); + case _CC_LOWER: return isLOWER_L1(character); + case _CC_PRINT: return isPRINT_L1(character); + case _CC_PSXSPC: return isPSXSPC_L1(character); + case _CC_PUNCT: return isPUNCT_L1(character); + case _CC_SPACE: return isSPACE_L1(character); + case _CC_UPPER: return isUPPER_L1(character); + case _CC_WORDCHAR: return isWORDCHAR_L1(character); + case _CC_XDIGIT: return isXDIGIT_L1(character); + case _CC_VERTSPACE: return isSPACE_L1(character) && ! isBLANK_L1(character); + case _CC_IDFIRST: return isIDFIRST_L1(character); + case _CC_QUOTEMETA: return _isQUOTEMETA(character); + case _CC_CHARNAME_CONT: return isCHARNAME_CONT(character); + case _CC_NONLATIN1_FOLD: return _HAS_NONLATIN1_FOLD_CLOSURE_ONLY_FOR_USE_BY_REGCOMP_DOT_C_AND_REGEXEC_DOT_C(character); + case _CC_NON_FINAL_FOLD: return _IS_NON_FINAL_FOLD_ONLY_FOR_USE_BY_REGCOMP_DOT_C(character); + case _CC_IS_IN_SOME_FOLD: return _IS_IN_SOME_FOLD_ONLY_FOR_USE_BY_REGCOMP_DOT_C(character); + case _CC_BACKSLASH_FOO_LBRACE_IS_META: return 0; + + + default: break; + } + Perl_croak(aTHX_ "panic: bootstrap_ctype() has an unexpected character class '%" UVxf "'", classnum); +} +#endif + /* ------------------------------- utf8.h ------------------------------- */ -/* These exist only to replace the macros they formerly were so that their use - * can be deprecated */ +PERL_STATIC_INLINE void +S_append_utf8_from_native_byte(const U8 byte, U8** dest) +{ + /* Takes an input 'byte' (Latin1 or EBCDIC) and appends it to the UTF-8 + * encoded string at '*dest', updating '*dest' to include it */ + + PERL_ARGS_ASSERT_APPEND_UTF8_FROM_NATIVE_BYTE; + + if (NATIVE_BYTE_IS_INVARIANT(byte)) + *(*dest)++ = byte; + else { + *(*dest)++ = UTF8_EIGHT_BIT_HI(byte); + *(*dest)++ = UTF8_EIGHT_BIT_LO(byte); + } +} + +/* These two exist only to replace the macros they formerly were so that their + * use can be deprecated */ PERL_STATIC_INLINE bool S_isIDFIRST_lazy(pTHX_ const char* p) @@ -154,3 +284,50 @@ S_isALNUM_lazy(pTHX_ const char* p) return isALNUM_lazy_if(p,1); } + +/* ------------------------------- perl.h ----------------------------- */ + +/* +=for apidoc AiR|bool|is_safe_syscall|const char *pv|STRLEN len|const char *what|const char *op_name + +Test that the given C doesn't contain any internal C characters. +If it does, set C to ENOENT, optionally warn, and return FALSE. + +Return TRUE if the name is safe. + +Used by the IS_SAFE_SYSCALL() macro. + +=cut +*/ + +PERL_STATIC_INLINE bool +S_is_safe_syscall(pTHX_ const char *pv, STRLEN len, const char *what, const char *op_name) { + /* While the Windows CE API provides only UCS-16 (or UTF-16) APIs + * perl itself uses xce*() functions which accept 8-bit strings. + */ + + PERL_ARGS_ASSERT_IS_SAFE_SYSCALL; + + if (pv && len > 1) { + char *null_at; + if (UNLIKELY((null_at = (char *)memchr(pv, 0, len-1)) != NULL)) { + SETERRNO(ENOENT, LIB_INVARG); + Perl_ck_warner(aTHX_ packWARN(WARN_SYSCALLS), + "Invalid \\0 character in %s for %s: %s\\0%s", + what, op_name, pv, null_at+1); + return FALSE; + } + } + + return TRUE; +} + +/* + * Local variables: + * c-indentation-style: bsd + * c-basic-offset: 4 + * indent-tabs-mode: nil + * End: + * + * ex: set ts=8 sts=4 sw=4 et: + */ Index: gnu/usr.bin/perl/inline_invlist.c =================================================================== RCS file: /mnt/memory/perl/importit/cvs/src/gnu/usr.bin/perl/inline_invlist.c,v retrieving revision 1.1.1.1 diff -u -p -u -p -r1.1.1.1 inline_invlist.c --- gnu/usr.bin/perl/inline_invlist.c 24 Mar 2014 14:58:44 -0000 1.1.1.1 +++ gnu/usr.bin/perl/inline_invlist.c 16 Nov 2014 03:22:24 -0000 @@ -8,47 +8,26 @@ #if defined(PERL_IN_UTF8_C) || defined(PERL_IN_REGCOMP_C) || defined(PERL_IN_REGEXEC_C) -#define INVLIST_LEN_OFFSET 0 /* Number of elements in the inversion list */ -#define INVLIST_ITER_OFFSET 1 /* Current iteration position */ -#define INVLIST_PREVIOUS_INDEX_OFFSET 2 /* Place to cache index of previous - result */ - -/* This is a combination of a version and data structure type, so that one - * being passed in can be validated to be an inversion list of the correct - * vintage. When the structure of the header is changed, a new random number - * in the range 2**31-1 should be generated and the new() method changed to - * insert that at this location. Then, if an auxiliary program doesn't change - * correspondingly, it will be discovered immediately */ -#define INVLIST_VERSION_ID_OFFSET 3 -#define INVLIST_VERSION_ID 290655244 - -/* For safety, when adding new elements, remember to #undef them at the end of - * the inversion list code section */ - -#define INVLIST_ZERO_OFFSET 4 /* 0 or 1; must be last element in header */ -/* The UV at position ZERO contains either 0 or 1. If 0, the inversion list - * contains the code point U+00000, and begins here. If 1, the inversion list - * doesn't contain U+0000, and it begins at the next UV in the array. - * Inverting an inversion list consists of adding or removing the 0 at the - * beginning of it. By reserving a space for that 0, inversion can be made - * very fast */ - -#define HEADER_LENGTH (INVLIST_ZERO_OFFSET + 1) - /* An element is in an inversion list iff its index is even numbered: 0, 2, 4, * etc */ #define ELEMENT_RANGE_MATCHES_INVLIST(i) (! ((i) & 1)) #define PREV_RANGE_MATCHES_INVLIST(i) (! ELEMENT_RANGE_MATCHES_INVLIST(i)) -PERL_STATIC_INLINE UV* -S__get_invlist_len_addr(pTHX_ SV* invlist) +/* This converts to/from our UVs to what the SV code is expecting: bytes. */ +#define TO_INTERNAL_SIZE(x) ((x) * sizeof(UV)) +#define FROM_INTERNAL_SIZE(x) ((x)/ sizeof(UV)) + +PERL_STATIC_INLINE bool* +S_get_invlist_offset_addr(pTHX_ SV* invlist) { - /* Return the address of the UV that contains the current number - * of used elements in the inversion list */ + /* Return the address of the field that says whether the inversion list is + * offset (it contains 1) or not (contains 0) */ + + PERL_ARGS_ASSERT_GET_INVLIST_OFFSET_ADDR; - PERL_ARGS_ASSERT__GET_INVLIST_LEN_ADDR; + assert(SvTYPE(invlist) == SVt_INVLIST); - return (UV *) (SvPVX(invlist) + (INVLIST_LEN_OFFSET * sizeof (UV))); + return &(((XINVLIST*) SvANY(invlist))->is_offset); } PERL_STATIC_INLINE UV @@ -59,7 +38,11 @@ S__invlist_len(pTHX_ SV* const invlist) PERL_ARGS_ASSERT__INVLIST_LEN; - return *_get_invlist_len_addr(invlist); + assert(SvTYPE(invlist) == SVt_INVLIST); + + return (SvCUR(invlist) == 0) + ? 0 + : FROM_INTERNAL_SIZE(SvCUR(invlist)) - *get_invlist_offset_addr(invlist); } PERL_STATIC_INLINE bool @@ -73,5 +56,12 @@ S__invlist_contains_cp(pTHX_ SV* const i return index >= 0 && ELEMENT_RANGE_MATCHES_INVLIST(index); } + +# if defined(PERL_IN_UTF8_C) || defined(PERL_IN_REGEXEC_C) + +/* These symbols are only needed later in regcomp.c */ +# undef TO_INTERNAL_SIZE +# undef FROM_INTERNAL_SIZE +# endif #endif Index: gnu/usr.bin/perl/install_lib.pl =================================================================== RCS file: /mnt/memory/perl/importit/cvs/src/gnu/usr.bin/perl/install_lib.pl,v retrieving revision 1.1.1.3 diff -u -p -u -p -r1.1.1.3 install_lib.pl --- gnu/usr.bin/perl/install_lib.pl 24 Mar 2014 14:58:44 -0000 1.1.1.3 +++ gnu/usr.bin/perl/install_lib.pl 16 Nov 2014 03:22:24 -0000 @@ -7,18 +7,19 @@ use strict; use vars qw($Is_VMS $Is_W32 $Is_OS2 $Is_Cygwin $Is_Darwin $Is_NetWare %opts $packlist); use subs qw(unlink link chmod); +require File::Path; -use Config; BEGIN { - if ($Config{userelocatableinc}) { + require Config; + if ($Config::Config{userelocatableinc}) { # This might be a considered a hack. Need to get information about the # configuration from Config.pm *before* Config.pm expands any .../ # prefixes. # # So we set $^X to pretend that we're the already installed perl, so - # Config.pm doesits ... expansion off that location. + # Config.pm does its ... expansion off that location. - my $location = $Config{initialinstalllocation}; + my $location = $Config::Config{initialinstalllocation}; die <<'OS' unless defined $location; $Config{initialinstalllocation} is not defined - can't install a relocatable perl without this. @@ -33,8 +34,8 @@ OS # You never saw us. We weren't here. require Config; - Config->import; } + Config->import; } if ($Config{d_umask}) { @@ -110,21 +111,38 @@ sub chmod { unless $opts{notify}; } - sub samepath { my($p1, $p2) = @_; return (lc($p1) eq lc($p2)) if ($Is_W32 || $Is_NetWare); - if ($p1 ne $p2) { - my($dev1, $ino1, $dev2, $ino2); - ($dev1, $ino1) = stat($p1); - ($dev2, $ino2) = stat($p2); - ($dev1 == $dev2 && $ino1 == $ino2); - } - else { - 1; + return 1 + if $p1 eq $p2; + + my ($dev1, $ino1) = stat $p1; + return 0 + unless defined $dev1; + my ($dev2, $ino2) = stat $p2; + + return $dev1 == $dev2 && $ino1 == $ino2; +} + +sub safe_rename { + my($from,$to) = @_; + if (-f $to and not unlink($to)) { + my($i); + for ($i = 1; $i < 50; $i++) { + last if rename($to, "$to.$i"); + } + warn("Cannot rename to '$to.$i': $!"), return 0 + if $i >= 50; # Give up! } + link($from,$to) || return 0; + unlink($from); +} + +sub mkpath { + File::Path::mkpath(shift , $opts{verbose}, 0777) unless $opts{notify}; } 1; Index: gnu/usr.bin/perl/installhtml =================================================================== RCS file: /mnt/memory/perl/importit/cvs/src/gnu/usr.bin/perl/installhtml,v retrieving revision 1.12 diff -u -p -u -p -r1.12 installhtml --- gnu/usr.bin/perl/installhtml 24 Mar 2014 15:05:13 -0000 1.12 +++ gnu/usr.bin/perl/installhtml 16 Nov 2014 03:22:24 -0000 @@ -15,10 +15,10 @@ installhtml - converts a collection of P =head1 SYNOPSIS - installhtml [--help] [--podpath=:...:] [--podroot=] - [--htmldir=] [--htmlroot=] [--norecurse] [--recurse] - [--splithead=,...,] [--splititem=,...,] - [--ignore=,...,] [--verbose] + installhtml [--help] [--podpath=:...:] [--podroot=] + [--htmldir=] [--htmlroot=] [--norecurse] [--recurse] + [--splithead=,...,] [--splititem=,...,] + [--ignore=,...,] [--verbose] =head1 DESCRIPTION Index: gnu/usr.bin/perl/installman =================================================================== RCS file: /mnt/memory/perl/importit/cvs/src/gnu/usr.bin/perl/installman,v retrieving revision 1.12 diff -u -p -u -p -r1.12 installman --- gnu/usr.bin/perl/installman 24 Mar 2014 15:05:13 -0000 1.12 +++ gnu/usr.bin/perl/installman 16 Nov 2014 03:22:24 -0000 @@ -1,14 +1,16 @@ #!./perl -w + BEGIN { @INC = qw(lib); # This needs to be at BEGIN time, before any use of Config + # install_lib itself loads and imports Config into main:: require './install_lib.pl'; } + use strict; use Getopt::Long; -require File::Path; use ExtUtils::Packlist; use Pod::Man; use vars qw(%opts $packlist); @@ -36,9 +38,12 @@ my $usage = --verbose (or -V) report all progress. --silent (or -S) be silent. Only report errors.\n"; +# --strip intentionally does nothing. By permitting installman to accept it +# without error, the Makefile can pass the same options to installperl and +# installman, which permits more simplification there than this comment costs. GetOptions( \%opts, qw( man1dir=s man1ext=s man3dir=s man3ext=s - destdir:s notify n help silent S verbose V)) + destdir:s notify|n help|h|? silent|S verbose|V strip)) || die $usage; die $usage if $opts{help}; $opts{destdir} //= ''; @@ -47,9 +52,7 @@ foreach my $pre (qw(man1 man3)) { $opts{"${pre}dir"} //= $opts{destdir} . $Config{"install${pre}dir"}; $opts{"${pre}ext"} //= $Config{"${pre}ext"}; } -$opts{silent} ||= $opts{S}; -$opts{notify} ||= $opts{n}; -$opts{verbose} ||= $opts{V} || $opts{notify}; +$opts{verbose} ||= $opts{notify}; #Sanity checks @@ -118,7 +121,7 @@ sub pod2man { } } - File::Path::mkpath($mandir, $opts{verbose}, 0777) unless $opts{notify}; + mkpath($mandir); foreach my $manpage (sort keys %$modpods) { my $mod = $modpods->{$manpage}; @@ -158,7 +161,7 @@ sub pod2man { print " $xmanpage\n" unless $opts{silent}; if (!$opts{notify} && $parser->parse_from_file($mod, $tmp)) { if (-s $tmp) { - if (rename($tmp, $manpage)) { + if (safe_rename($tmp, $manpage)) { $packlist->{$xmanpage} = { type => 'file' }; next; } @@ -170,20 +173,6 @@ sub pod2man { $packlist->write() unless $opts{notify}; print " Installation complete\n" if $opts{verbose}; - -sub rename { - my($from,$to) = @_; - if (-f $to and not unlink($to)) { - my($i); - for ($i = 1; $i < 50; $i++) { - last if CORE::rename($to, "$to.$i"); - } - warn("Cannot rename to '$to.$i': $!"), return 0 - if $i >= 50; # Give up! - } - link($from,$to) || return 0; - unlink($from); -} # Local variables: # cperl-indent-level: 4 Index: gnu/usr.bin/perl/installperl =================================================================== RCS file: /mnt/memory/perl/importit/cvs/src/gnu/usr.bin/perl/installperl,v retrieving revision 1.28 diff -u -p -u -p -r1.28 installperl --- gnu/usr.bin/perl/installperl 24 Mar 2014 15:05:13 -0000 1.28 +++ gnu/usr.bin/perl/installperl 16 Nov 2014 03:22:24 -0000 @@ -1,20 +1,19 @@ #!./perl -w BEGIN { - require 5.004; chdir '..' if !-d 'lib' and -d '../lib'; @INC = 'lib'; $ENV{PERL5LIB} = 'lib'; # This needs to be at BEGIN time, before any use of Config + # install_lib itself loads and imports Config into main:: require './install_lib.pl'; } use strict; use vars qw($Is_VMS $Is_W32 $Is_OS2 $Is_Cygwin $Is_Darwin $Is_NetWare %opts $packlist); -my ($dostrip, $versiononly, $force, - $otherperls, $archname, $nwinstall, $nopods); +my $versiononly; BEGIN { if ($Is_VMS) { eval 'use VMS::Filespec;' } @@ -25,9 +24,10 @@ my $scr_ext = ($Is_VMS ? '.Com' : $Is_W3 use File::Find; use File::Compare; use File::Copy (); -use File::Path (); use ExtUtils::Packlist; use Cwd; +# nogetopt_compat to disable treating +v as meaning -v +use Getopt::Long qw(:config nogetopt_compat no_auto_abbrev noignorecase); require './Porting/pod_lib.pl'; @@ -36,11 +36,6 @@ if ($Is_NetWare) { $scr_ext = '.pl'; } -# override the ones in the rest of the script -sub mkpath { - File::Path::mkpath(@_) unless $opts{notify}; -} - my $mainperldir = "/usr/bin"; my $exe_ext = $Config{exe_ext}; @@ -65,29 +60,31 @@ if ( $Is_VMS ) { } } -$otherperls = 1; # This little hack simplifies making the code after the comment "Fetch some # frequently-used items from %Config" warning free. With $opts{destdir} always # defined, it's also possible to make the s/\Q$opts{destdir}\E unconditional. $opts{destdir} = ''; -# Consider refactoring this to use Getopt::Long once Getopt::Long's planned -# feature is implemented, to distinguish + and - options. -while (@ARGV) { - $opts{notify} = 1 if $ARGV[0] eq '-n'; - $dostrip = 1 if $ARGV[0] eq '-s'; - $versiononly = 1 if $ARGV[0] eq '-v'; - $versiononly = 0 if $ARGV[0] eq '+v'; - $opts{silent} = 1 if $ARGV[0] eq '-S'; - $otherperls = 0 if $ARGV[0] eq '-o'; - $force = 1 if $ARGV[0] eq '-f'; - $opts{verbose} = 1 if $ARGV[0] eq '-V' || $ARGV [0] eq '-n'; - $archname = 1 if $ARGV[0] eq '-A'; - $nwinstall = 1 if $ARGV[0] eq '-netware'; - $nopods = 1 if $ARGV[0] eq '-p'; - $opts{destdir} = $1 if $ARGV[0] =~ /^-?-destdir=(.*)$/; - if ($ARGV[0] eq '-?' or $ARGV[0] =~ /^-?-h/) { - print <<"EOT"; +{ + my $usage = 0; + if (!GetOptions(\%opts, 'notify|n', 'strip|s', 'silent|S', + 'skip-otherperls|o', 'force|f', 'verbose|V', 'archname|A', + 'netware', 'nopods|p', 'destdir:s', 'help|h|?', + 'versiononly|v' => \$versiononly, '<>' => sub { + if ($_[0] eq '+v') { + $versiononly = 0; + } else { + # Any other unknown argument is going to be an error + $usage = 1; + } + }, + )) { + $usage = 1; + } + $opts{verbose} ||= $opts{notify}; + + if ($usage || $opts{help}) { + print <<"EOT"; Usage $0: [switches] -n Don't actually run any commands; just print them. -s Run strip on installed binaries. @@ -104,10 +101,10 @@ Usage $0: [switches] -p Don't install the pod files. [This will break use diagnostics;] -netware Install correctly on a Netware server. -destdir Prefix installation directories by this string. + -h Display this help message. EOT - exit; + exit $usage; } - shift; } $versiononly = 1 if $Config{versiononly} && !defined $versiononly; @@ -137,7 +134,6 @@ if ($scr_ext) { @scripts = map { "$_$scr my %archpms = ( Config => 1, lib => 1, - Cwd => 1, ); if ($^O eq 'dos') { @@ -213,7 +209,7 @@ if ($^O eq 'os390') { } } -if ($nwinstall) { +if ($opts{netware}) { # This is required only if we are installing on a NetWare server $installscript = $Config{installnwscripts}; $installprivlib = $Config{installnwlib}; @@ -234,7 +230,7 @@ if ($Is_VMS) { # Hang in there until Fi # Do some quick sanity checks. $installbin || die "No installbin directory in config.sh\n"; --d $installbin || mkpath($installbin, $opts{verbose}, 0777); +-d $installbin || mkpath($installbin); -d $installbin || $opts{notify} || die "$installbin is not a directory\n"; -w $installbin || $opts{notify} || die "$installbin is not writable by you\n" unless $installbin =~ m#^/afs/# || $opts{notify}; @@ -275,7 +271,7 @@ if (($Is_W32 and ! $Is_NetWare) or $Is_C safe_unlink("$installbin/$perldll"); copy("$perldll", "$installbin/$perldll"); chmod(0755, "$installbin/$perldll"); - $packlist->{"$installbin/$perldll"} = { type => 'file' }; + $packlist->{"$Config{installbin}/$perldll"} = { type => 'file' }; } # if (($Is_W32 and ! $Is_NetWare) or $Is_Cygwin) # Get the install command and flags from the environment @@ -305,20 +301,19 @@ if ($Is_VMS) { } elsif ($^O ne 'dos') { if (!$Is_NetWare) { - install("perl$exe_ext", "$installbin/$perl_verbase$ver$exe_ext", - "0755", $dostrip); + install("perl$exe_ext", "$installbin/$perl_verbase$ver$exe_ext", "0755"); } else { # If installing onto a NetWare server - if ($nwinstall) { + if ($opts{netware}) { # Copy perl.nlm, echo.nlm, type.nlm, a2p.nlm & cgi2perl.nlm - mkpath($Config{installnwsystem}, $opts{verbose}, 0777); + mkpath($Config{installnwsystem}); copy("netware\\".$ENV{'MAKE_TYPE'}."\\perl.nlm", $Config{installnwsystem}); copy("netware\\testnlm\\echo\\echo.nlm", $Config{installnwsystem}); copy("netware\\testnlm\\type\\type.nlm", $Config{installnwsystem}); copy("x2p\\a2p.nlm", $Config{installnwsystem}); chmod(0755, "$Config{installnwsystem}\\perl.nlm"); - mkpath($Config{installnwlcgi}, $opts{verbose}, 0777); + mkpath($Config{installnwlcgi}); copy("lib\\auto\\cgi2perl\\cgi2perl.nlm", $Config{installnwlcgi}); } } #if (!$Is_NetWare) @@ -335,8 +330,8 @@ my $do_installprivlib = !samepath($insta my $vershort = ($Is_Cygwin and !$Config{usedevel}) ? substr($ver,0,-2) : $ver; $do_installprivlib = 0 if $versiononly && !($installprivlib =~ m/\Q$vershort/); -mkpath($installprivlib, $opts{verbose}, 0777); -mkpath($installarchlib, $opts{verbose}, 0777); +mkpath($installprivlib); +mkpath($installarchlib); mkpath($installsitelib, $opts{verbose}, 0777) if ($installsitelib); mkpath($installsitearch, $opts{verbose}, 0777) if ($installsitearch); @@ -349,7 +344,7 @@ else { } # Install header files and libraries. -mkpath("$installarchlib/CORE", $opts{verbose}, 0777); +mkpath("$installarchlib/CORE"); my @corefiles; if ($Is_VMS) { # We did core file selection during build my $coredir = "lib/$Config{archname}/$ver/CORE"; @@ -359,21 +354,22 @@ if ($Is_VMS) { # We did core file selec elsif ($Is_Cygwin) { # On Cygwin symlink it to CORE to make Makefile happy @corefiles = <*.h libperl*.* perl*$Config{lib_ext}>; my $coredll = "$installarchlib/CORE/$libperl"; + my $instcoredll = "$Config{installarchlib}/CORE/$libperl"; safe_unlink($coredll); ( $Config{'d_link'} eq 'define' && eval { CORE::link("$installbin/$libperl", $coredll); - $packlist->{$coredll} = { from => "$installbin/$libperl", + $packlist->{$instcoredll} = { from => "$Config{installbin}/$libperl", type => 'link' }; } ) || eval { symlink("$installbin/$libperl", $coredll); - $packlist->{$coredll} = { from => "$installbin/$libperl", + $packlist->{$instcoredll} = { from => "$Config{installbin}/$libperl", type => 'link' }; } || ( copy("$installbin/$libperl", $coredll) && - push(@corefiles, $coredll) + push(@corefiles, $instcoredll) ) } else { # [als] hard-coded 'libperl' name... not good! @@ -414,7 +410,7 @@ if (! $versiononly && ! samepath($instal # For development purposes it can be very useful to have multiple perls # build for different "architectures" (eg threading or not) simultaneously. -if ($archname && ! samepath($installbin, '.') && ($^O ne 'dos') && ! $Is_VMS) { +if ($opts{archname} && ! samepath($installbin, '.') && ($^O ne 'dos') && ! $Is_VMS) { my $archperl = "$perl_verbase$ver-$Config{archname}$exe_ext"; safe_unlink("$installbin/$archperl"); if ($^O eq 'vos') { @@ -499,7 +495,7 @@ sub script_alias { } # Install scripts. -mkpath($installscript, $opts{verbose}, 0777); +mkpath($installscript); if ($versiononly) { for (@scripts) { (my $base = $_) =~ s#.*/##; @@ -531,9 +527,9 @@ if ($versiononly) { # Install pod pages. Where? I guess in $installprivlib/pod # ($installprivlib/pods for cygwin). -if (!$nopods && (!$versiononly || ($installprivlib =~ m/\Q$vershort/))) { +if (!$opts{nopods} && (!$versiononly || ($installprivlib =~ m/\Q$vershort/))) { my $pod = ($Is_Cygwin || $Is_Darwin || $Is_VMS || $Is_W32) ? 'pods' : 'pod'; - mkpath("${installprivlib}/$pod", $opts{verbose}, 0777); + mkpath("${installprivlib}/$pod"); for (map {$_->[1]} @{get_pod_metadata()->{master}}) { # $_ is a name like pod/perl.pod @@ -550,7 +546,7 @@ if (!$nopods && (!$versiononly || ($inst # Also skip $mainperl if the user opted to have it be a link to the # installed perl. -if (!$versiononly && $otherperls) { +if (!$versiononly && !$opts{'skip-otherperls'}) { my ($path, @path); my $dirsep = ($Is_OS2 || $Is_W32 || $Is_NetWare) ? ';' : ':' ; ($path = $ENV{"PATH"}) =~ s:\\:/:g ; @@ -625,20 +621,6 @@ sub safe_unlink { } } -sub safe_rename { - my($from,$to) = @_; - if (-f $to and not unlink($to)) { - my($i); - for ($i = 1; $i < 50; $i++) { - last if rename($to, "$to.$i"); - } - warn("Cannot rename to '$to.$i': $!"), return 0 - if $i >= 50; # Give up! - } - link($from,$to) || return 0; - unlink($from); -} - sub copy { my($from,$to) = @_; @@ -658,12 +640,12 @@ sub copy { } sub install { - my($from,$to,$mode,$strip) = @_; + my($from,$to,$mode) = @_; my $xto = $to; my $cmd = join(' ', @installcmd); $cmd .= " -m $mode" if $mode; - $cmd .= " -s" if $strip; + $cmd .= " -s" if $opts{strip}; $cmd .= " $from $to"; $xto =~ s/^\Q$opts{destdir}\E// if $opts{destdir}; print $opts{verbose} ? " install $from $xto\n" : " $xto\n" unless $opts{silent}; @@ -690,7 +672,7 @@ sub installlib { # this, as $_ becomes a pathname, and so still works. However, it's not # obvious that $_ is needed later, and hence $_ must not be modified. - # Also, many of the regex exlusion tests below are now superfluous, as the + # Also, many of the regex exclusion tests below are now superfluous, as the # files in question are either no longer in blead, or now in ext/, dist/ or # cpan/ and not copied into lib/ @@ -710,7 +692,7 @@ sub installlib { # lib/Archive/Tar/bin, the config_data script in lib/Module/Build/scripts # and zipdetails in cpan/IO-Compress/bin # (they're installed later with other utils) - return if $name =~ /^(?:cpan|instmodsh|prove|corelist|ptar|cpan2dist|cpanp|cpanp-run-perl|ptardiff|ptargrep|config_data|zipdetails)\z/; + return if $name =~ /^(?:cpan|instmodsh|prove|corelist|ptar|ptardiff|ptargrep|config_data|zipdetails)\z/; # ignore the Makefiles return if $name =~ /^makefile$/i; # ignore the test extensions @@ -769,29 +751,21 @@ sub installlib { return unless $do_installprivlib; } - if ($Is_NetWare && !$nwinstall && /\.(?:nlp|nlm|bs)$/) { + if ($Is_NetWare && !$opts{netware} && /\.(?:nlp|nlm|bs)$/) { # Don't copy .nlp,.nlm files, doesn't make sense on Windows and also # if copied will give problems when building new extensions. # Has to be copied if we are installing on a NetWare server and - # hence the check !$nwinstall + # hence the check !$opts{netware} return; } if (-f $_) { - if (/\.(?:al|ix)$/ && !($dir =~ m[^auto/(.*)$])) { - $installlib = $installprivlib; - #We're installing *.al and *.ix files into $installprivlib, - #but we have to delete old *.al and *.ix files from the 5.000 - #distribution: - #This might not work because $archname might have changed. - unlink("$installarchlib/$name"); - } my $xname = "$installlib/$name"; $xname =~ s/^\Q$opts{destdir}\E//; $packlist->{$xname} = { type => 'file' }; - if ($force || compare($_, "$installlib/$name") || $opts{notify}) { + if ($opts{force} || compare($_, "$installlib/$name") || $opts{notify}) { unlink("$installlib/$name"); - mkpath("$installlib/$dir", $opts{verbose}, 0777); + mkpath("$installlib/$dir"); # HP-UX (at least) needs to maintain execute permissions # on dynamically-loaded libraries. if (copy_if_diff($_, "$installlib/$name")) { @@ -831,7 +805,7 @@ sub copy_if_diff { } -f $from || $perlpodbadsymlink || warn "$0: $from not found"; $packlist->{$xto} = { type => 'file' }; - if ($force || compare($from, $to) || $opts{notify}) { + if ($opts{force} || compare($from, $to) || $opts{notify}) { safe_unlink($to); # In case we don't have write permissions. if ($perlpodbadsymlink && $from =~ m!^pod/perl(.+)\.pod$!) { $from = "README.$1"; @@ -850,7 +824,7 @@ sub strip { my(@args) = @_; - return unless $dostrip; + return unless $opts{strip}; my @opts; while (@args && $args[0] =~ /^(-\w+)$/) { Index: gnu/usr.bin/perl/intrpvar.h =================================================================== RCS file: /mnt/memory/perl/importit/cvs/src/gnu/usr.bin/perl/intrpvar.h,v retrieving revision 1.1.1.12 diff -u -p -u -p -r1.1.1.12 intrpvar.h --- gnu/usr.bin/perl/intrpvar.h 24 Mar 2014 14:58:44 -0000 1.1.1.12 +++ gnu/usr.bin/perl/intrpvar.h 16 Nov 2014 03:22:24 -0000 @@ -33,11 +33,7 @@ * Important ones in the first cache line (if alignment is done right) */ PERLVAR(I, stack_sp, SV **) /* top of the stack */ -#ifdef OP_IN_REGISTER -PERLVAR(I, opsave, OP *) -#else PERLVAR(I, op, OP *) /* currently executing op */ -#endif PERLVAR(I, curpad, SV **) /* active pad (lexicals+tmps) */ PERLVAR(I, stack_base, SV **) @@ -53,9 +49,9 @@ PERLVAR(I, scopestack_ix, I32) PERLVAR(I, scopestack_max, I32) PERLVAR(I, tmps_stack, SV **) /* mortals we've made */ -PERLVARI(I, tmps_ix, I32, -1) -PERLVARI(I, tmps_floor, I32, -1) -PERLVAR(I, tmps_max, I32) +PERLVARI(I, tmps_ix, SSize_t, -1) +PERLVARI(I, tmps_floor, SSize_t, -1) +PERLVAR(I, tmps_max, SSize_t) PERLVARI(I, sub_generation, U32, 1) /* incr to invalidate method cache */ @@ -80,6 +76,7 @@ PERLVAR(I, tainted, bool) /* using vari PERLVAR(I, delaymagic, U16) /* ($<,$>) = ... */ PERLVAR(I, localizing, U8) /* are we processing a local() list? */ PERLVAR(I, in_eval, U8) /* trap "fatal" errors? */ +PERLVAR(I, defgv, GV *) /* the *_ glob */ /* =for apidoc mn|bool|PL_dowarn @@ -113,16 +110,18 @@ PERLVAR(I, mainstack, AV *) /* the stac /* memory management */ PERLVAR(I, sv_count, IV) /* how many SV* are currently allocated */ PERLVAR(I, sv_objcount, IV) /* DEPRECATED AND UNMAINTAINED. - * Will be removed in Perl 5.20. + * Will be removed in Perl 5.22. * Used to be: how many objects are currently allocated. */ PERLVAR(I, sv_root, SV *) /* storage for SVs belonging to interp */ PERLVAR(I, sv_arenaroot, SV *) /* list of areas for garbage collection */ -PERLVAR(I, reg_state, struct re_save_state) +/* fake PMOP that PL_curpm points to while in (?{}) so $1 et al are visible */ +PERLVARI(I, reg_curpm, PMOP*, NULL) /* the currently active slab in a chain of slabs of regmatch states, - * and the currently active state within that slab */ + * and the currently active state within that slab. This stack of states + * is shared amongst re-entrant calls to the regex engine */ PERLVARI(I, regmatch_slab, regmatch_slab *, NULL) PERLVAR(I, regmatch_state, regmatch_state *) @@ -175,6 +174,7 @@ PERLVAR(I, statgv, GV *) PERLVARI(I, statname, SV *, NULL) #ifdef HAS_TIMES +/* Will be removed soon after v5.21.0. See RT #121351 */ PERLVAR(I, timesbuf, struct tms) #endif @@ -185,7 +185,7 @@ The input record separator - C<$/> in Pe =for apidoc mn|GV*|PL_last_in_gv -The GV which was last used for a filehandle input operation. (C<< >>) +The GV which was last used for a filehandle input operation. (C<< >>) =for apidoc mn|GV*|PL_ofsgv @@ -226,16 +226,15 @@ PERLVAR(I, secondgv, GV *) /* $b */ PERLVAR(I, efloatbuf, char *) PERLVAR(I, efloatsize, STRLEN) -PERLVAR(I, regdummy, regnode) /* from regcomp.c */ - PERLVARI(I, dumpindent, U16, 4) /* number of blanks per dump indentation level */ PERLVAR(I, exit_flags, U8) /* was exit() unexpected, etc. */ PERLVAR(I, utf8locale, bool) /* utf8 locale detected */ +PERLVAR(I, in_utf8_CTYPE_locale, bool) -PERLVARA(I, colors,6, char *) /* from regcomp.c */ +PERLVARA(I, colors,6, char *) /* values from PERL_RE_COLORS env var */ /* =for apidoc Amn|peep_t|PL_peepp @@ -352,7 +351,6 @@ PERLVAR(I, psig_pend, int *) /* per-sig /* shortcuts to various I/O objects */ PERLVAR(I, stdingv, GV *) /* *STDIN */ PERLVAR(I, stderrgv, GV *) /* *STDERR */ -PERLVAR(I, defgv, GV *) PERLVAR(I, argvgv, GV *) /* *ARGV */ PERLVAR(I, argvoutgv, GV *) /* *ARGVOUT */ PERLVAR(I, argvout_stack, AV *) @@ -540,8 +538,6 @@ PERLVAR(I, padix, I32) /* max used inde PERLVAR(I, padix_floor, I32) /* how low may inner block reset padix */ -PERLVAR(I, hints, U32) /* pragma-tic compile-time flags */ - #ifdef USE_LOCALE_COLLATE PERLVAR(I, collation_name, char *) /* Name of current collation */ PERLVAR(I, collxfrm_base, Size_t) /* Basic overhead in *xfrm() */ @@ -556,7 +552,7 @@ PERLVAR(I, sawampersand, U8) /* must sa #endif PERLVAR(I, unsafe, bool) -PERLVAR(I, colorset, bool) /* from regcomp.c */ +PERLVAR(I, colorset, bool) /* PERL_RE_COLORS env var is in use */ /* current phase the interpreter is in for ordering this structure to remove holes, we're assuming that this is 4 @@ -582,8 +578,8 @@ PERLVAR(I, numeric_radix_sv, SV *) /* Th #endif /* !USE_LOCALE_NUMERIC */ /* Unicode inversion lists */ -PERLVAR(I, ASCII, SV *) PERLVAR(I, Latin1, SV *) +PERLVAR(I, UpperLatin1, SV *) /* Code points 128 - 255 */ PERLVAR(I, AboveLatin1, SV *) PERLVAR(I, NonL1NonFinalFold, SV *) @@ -602,7 +598,6 @@ PERLVAR(I, utf8_charname_continue, SV *) PERLVARA(I, utf8_swash_ptrs, POSIX_SWASH_COUNT, SV *) PERLVARA(I, Posix_ptrs, POSIX_CC_COUNT, SV *) -PERLVARA(I, L1Posix_ptrs, POSIX_CC_COUNT, SV *) PERLVARA(I, XPosix_ptrs, POSIX_CC_COUNT, SV *) PERLVAR(I, last_swash_hv, HV *) @@ -741,7 +736,7 @@ PERLVAR(I, debug_pad, struct perl_debug_ /* Hook for File::Glob */ PERLVARI(I, globhook, globhook_t, NULL) -/* The last unconditional member of the interpreter structure when 5.18.2 was +/* The last unconditional member of the interpreter structure when 5.20.1 was released. The offset of the end of this is baked into a global variable in any shared perl library which will allow a sanity test in future perl releases. */ @@ -774,6 +769,19 @@ PERLVARI(I, xmlfp, PerlIO *, NULL) #ifdef DEBUG_LEAKING_SCALARS PERLVARI(I, sv_serial, U32, 0) /* SV serial number, used in sv.c */ #endif + +PERLVARA(I, sv_consts, SV_CONSTS_COUNT, SV*) /* constant SVs with precomputed hash value */ + +#ifdef PERL_TRACE_OPS +PERLVARA(I, op_exec_cnt, OP_max+2, UV) /* Counts of executed OPs of the given type. + If PERL_TRACE_OPS is enabled, we'll dump + a summary count of all ops executed in the + program at perl_destruct time. For + profiling/debugging only. Works only if + DEBUGGING is enabled, too. */ +#endif + +PERLVAR(I, random_state, PL_RANDOM_STATE_TYPE) /* If you are adding a U8 or U16, check to see if there are 'Space' comments * above on where there are gaps which currently will be structure padding. */ Index: gnu/usr.bin/perl/iperlsys.h =================================================================== RCS file: /mnt/memory/perl/importit/cvs/src/gnu/usr.bin/perl/iperlsys.h,v retrieving revision 1.1.1.11 diff -u -p -u -p -r1.1.1.11 iperlsys.h --- gnu/usr.bin/perl/iperlsys.h 24 Mar 2014 14:58:44 -0000 1.1.1.11 +++ gnu/usr.bin/perl/iperlsys.h 16 Nov 2014 03:22:24 -0000 @@ -933,10 +933,10 @@ typedef int (*LPProcExecv)(struct IPerl const char*const*); typedef int (*LPProcExecvp)(struct IPerlProc*, const char*, const char*const*); -typedef uid_t (*LPProcGetuid)(struct IPerlProc*); -typedef uid_t (*LPProcGeteuid)(struct IPerlProc*); -typedef gid_t (*LPProcGetgid)(struct IPerlProc*); -typedef gid_t (*LPProcGetegid)(struct IPerlProc*); +typedef Uid_t (*LPProcGetuid)(struct IPerlProc*); +typedef Uid_t (*LPProcGeteuid)(struct IPerlProc*); +typedef Gid_t (*LPProcGetgid)(struct IPerlProc*); +typedef Gid_t (*LPProcGetegid)(struct IPerlProc*); typedef char* (*LPProcGetlogin)(struct IPerlProc*); typedef int (*LPProcKill)(struct IPerlProc*, int, int); typedef int (*LPProcKillpg)(struct IPerlProc*, int, int); Index: gnu/usr.bin/perl/keywords.c =================================================================== RCS file: /mnt/memory/perl/importit/cvs/src/gnu/usr.bin/perl/keywords.c,v retrieving revision 1.1.1.1 diff -u -p -u -p -r1.1.1.1 keywords.c --- gnu/usr.bin/perl/keywords.c 25 Mar 2013 20:06:25 -0000 1.1.1.1 +++ gnu/usr.bin/perl/keywords.c 16 Nov 2014 03:22:24 -0000 @@ -490,19 +490,9 @@ Perl_keyword (pTHX_ const char *name, I3 goto unknown; } - case 4: /* 41 tokens of length 4 */ + case 4: /* 40 tokens of length 4 */ switch (name[0]) { - case 'C': - if (name[1] == 'O' && - name[2] == 'R' && - name[3] == 'E') - { /* CORE */ - return -KEY_CORE; - } - - goto unknown; - case 'I': if (name[1] == 'N' && name[2] == 'I' && @@ -3449,5 +3439,5 @@ unknown: } /* Generated from: - * e5a540774760ea54c761ef17ee4a153cc264e9a700b817d561e390730c457406 regen/keywords.pl + * 7c6d47fd2890b2422a40331ec90eac08f9808209b01f2b9c113141410fea91b5 regen/keywords.pl * ex: set ro: */ Index: gnu/usr.bin/perl/keywords.h =================================================================== RCS file: /mnt/memory/perl/importit/cvs/src/gnu/usr.bin/perl/keywords.h,v retrieving revision 1.9 diff -u -p -u -p -r1.9 keywords.h --- gnu/usr.bin/perl/keywords.h 25 Mar 2013 20:40:44 -0000 1.9 +++ gnu/usr.bin/perl/keywords.h 16 Nov 2014 03:22:24 -0000 @@ -23,253 +23,252 @@ #define KEY_AUTOLOAD 7 #define KEY_BEGIN 8 #define KEY_UNITCHECK 9 -#define KEY_CORE 10 -#define KEY_DESTROY 11 -#define KEY_END 12 -#define KEY_INIT 13 -#define KEY_CHECK 14 -#define KEY_abs 15 -#define KEY_accept 16 -#define KEY_alarm 17 -#define KEY_and 18 -#define KEY_atan2 19 -#define KEY_bind 20 -#define KEY_binmode 21 -#define KEY_bless 22 -#define KEY_break 23 -#define KEY_caller 24 -#define KEY_chdir 25 -#define KEY_chmod 26 -#define KEY_chomp 27 -#define KEY_chop 28 -#define KEY_chown 29 -#define KEY_chr 30 -#define KEY_chroot 31 -#define KEY_close 32 -#define KEY_closedir 33 -#define KEY_cmp 34 -#define KEY_connect 35 -#define KEY_continue 36 -#define KEY_cos 37 -#define KEY_crypt 38 -#define KEY_dbmclose 39 -#define KEY_dbmopen 40 -#define KEY_default 41 -#define KEY_defined 42 -#define KEY_delete 43 -#define KEY_die 44 -#define KEY_do 45 -#define KEY_dump 46 -#define KEY_each 47 -#define KEY_else 48 -#define KEY_elsif 49 -#define KEY_endgrent 50 -#define KEY_endhostent 51 -#define KEY_endnetent 52 -#define KEY_endprotoent 53 -#define KEY_endpwent 54 -#define KEY_endservent 55 -#define KEY_eof 56 -#define KEY_eq 57 -#define KEY_eval 58 -#define KEY_evalbytes 59 -#define KEY_exec 60 -#define KEY_exists 61 -#define KEY_exit 62 -#define KEY_exp 63 -#define KEY_fc 64 -#define KEY_fcntl 65 -#define KEY_fileno 66 -#define KEY_flock 67 -#define KEY_for 68 -#define KEY_foreach 69 -#define KEY_fork 70 -#define KEY_format 71 -#define KEY_formline 72 -#define KEY_ge 73 -#define KEY_getc 74 -#define KEY_getgrent 75 -#define KEY_getgrgid 76 -#define KEY_getgrnam 77 -#define KEY_gethostbyaddr 78 -#define KEY_gethostbyname 79 -#define KEY_gethostent 80 -#define KEY_getlogin 81 -#define KEY_getnetbyaddr 82 -#define KEY_getnetbyname 83 -#define KEY_getnetent 84 -#define KEY_getpeername 85 -#define KEY_getpgrp 86 -#define KEY_getppid 87 -#define KEY_getpriority 88 -#define KEY_getprotobyname 89 -#define KEY_getprotobynumber 90 -#define KEY_getprotoent 91 -#define KEY_getpwent 92 -#define KEY_getpwnam 93 -#define KEY_getpwuid 94 -#define KEY_getservbyname 95 -#define KEY_getservbyport 96 -#define KEY_getservent 97 -#define KEY_getsockname 98 -#define KEY_getsockopt 99 -#define KEY_given 100 -#define KEY_glob 101 -#define KEY_gmtime 102 -#define KEY_goto 103 -#define KEY_grep 104 -#define KEY_gt 105 -#define KEY_hex 106 -#define KEY_if 107 -#define KEY_index 108 -#define KEY_int 109 -#define KEY_ioctl 110 -#define KEY_join 111 -#define KEY_keys 112 -#define KEY_kill 113 -#define KEY_last 114 -#define KEY_lc 115 -#define KEY_lcfirst 116 -#define KEY_le 117 -#define KEY_length 118 -#define KEY_link 119 -#define KEY_listen 120 -#define KEY_local 121 -#define KEY_localtime 122 -#define KEY_lock 123 -#define KEY_log 124 -#define KEY_lstat 125 -#define KEY_lt 126 -#define KEY_m 127 -#define KEY_map 128 -#define KEY_mkdir 129 -#define KEY_msgctl 130 -#define KEY_msgget 131 -#define KEY_msgrcv 132 -#define KEY_msgsnd 133 -#define KEY_my 134 -#define KEY_ne 135 -#define KEY_next 136 -#define KEY_no 137 -#define KEY_not 138 -#define KEY_oct 139 -#define KEY_open 140 -#define KEY_opendir 141 -#define KEY_or 142 -#define KEY_ord 143 -#define KEY_our 144 -#define KEY_pack 145 -#define KEY_package 146 -#define KEY_pipe 147 -#define KEY_pop 148 -#define KEY_pos 149 -#define KEY_print 150 -#define KEY_printf 151 -#define KEY_prototype 152 -#define KEY_push 153 -#define KEY_q 154 -#define KEY_qq 155 -#define KEY_qr 156 -#define KEY_quotemeta 157 -#define KEY_qw 158 -#define KEY_qx 159 -#define KEY_rand 160 -#define KEY_read 161 -#define KEY_readdir 162 -#define KEY_readline 163 -#define KEY_readlink 164 -#define KEY_readpipe 165 -#define KEY_recv 166 -#define KEY_redo 167 -#define KEY_ref 168 -#define KEY_rename 169 -#define KEY_require 170 -#define KEY_reset 171 -#define KEY_return 172 -#define KEY_reverse 173 -#define KEY_rewinddir 174 -#define KEY_rindex 175 -#define KEY_rmdir 176 -#define KEY_s 177 -#define KEY_say 178 -#define KEY_scalar 179 -#define KEY_seek 180 -#define KEY_seekdir 181 -#define KEY_select 182 -#define KEY_semctl 183 -#define KEY_semget 184 -#define KEY_semop 185 -#define KEY_send 186 -#define KEY_setgrent 187 -#define KEY_sethostent 188 -#define KEY_setnetent 189 -#define KEY_setpgrp 190 -#define KEY_setpriority 191 -#define KEY_setprotoent 192 -#define KEY_setpwent 193 -#define KEY_setservent 194 -#define KEY_setsockopt 195 -#define KEY_shift 196 -#define KEY_shmctl 197 -#define KEY_shmget 198 -#define KEY_shmread 199 -#define KEY_shmwrite 200 -#define KEY_shutdown 201 -#define KEY_sin 202 -#define KEY_sleep 203 -#define KEY_socket 204 -#define KEY_socketpair 205 -#define KEY_sort 206 -#define KEY_splice 207 -#define KEY_split 208 -#define KEY_sprintf 209 -#define KEY_sqrt 210 -#define KEY_srand 211 -#define KEY_stat 212 -#define KEY_state 213 -#define KEY_study 214 -#define KEY_sub 215 -#define KEY_substr 216 -#define KEY_symlink 217 -#define KEY_syscall 218 -#define KEY_sysopen 219 -#define KEY_sysread 220 -#define KEY_sysseek 221 -#define KEY_system 222 -#define KEY_syswrite 223 -#define KEY_tell 224 -#define KEY_telldir 225 -#define KEY_tie 226 -#define KEY_tied 227 -#define KEY_time 228 -#define KEY_times 229 -#define KEY_tr 230 -#define KEY_truncate 231 -#define KEY_uc 232 -#define KEY_ucfirst 233 -#define KEY_umask 234 -#define KEY_undef 235 -#define KEY_unless 236 -#define KEY_unlink 237 -#define KEY_unpack 238 -#define KEY_unshift 239 -#define KEY_untie 240 -#define KEY_until 241 -#define KEY_use 242 -#define KEY_utime 243 -#define KEY_values 244 -#define KEY_vec 245 -#define KEY_wait 246 -#define KEY_waitpid 247 -#define KEY_wantarray 248 -#define KEY_warn 249 -#define KEY_when 250 -#define KEY_while 251 -#define KEY_write 252 -#define KEY_x 253 -#define KEY_xor 254 -#define KEY_y 255 +#define KEY_DESTROY 10 +#define KEY_END 11 +#define KEY_INIT 12 +#define KEY_CHECK 13 +#define KEY_abs 14 +#define KEY_accept 15 +#define KEY_alarm 16 +#define KEY_and 17 +#define KEY_atan2 18 +#define KEY_bind 19 +#define KEY_binmode 20 +#define KEY_bless 21 +#define KEY_break 22 +#define KEY_caller 23 +#define KEY_chdir 24 +#define KEY_chmod 25 +#define KEY_chomp 26 +#define KEY_chop 27 +#define KEY_chown 28 +#define KEY_chr 29 +#define KEY_chroot 30 +#define KEY_close 31 +#define KEY_closedir 32 +#define KEY_cmp 33 +#define KEY_connect 34 +#define KEY_continue 35 +#define KEY_cos 36 +#define KEY_crypt 37 +#define KEY_dbmclose 38 +#define KEY_dbmopen 39 +#define KEY_default 40 +#define KEY_defined 41 +#define KEY_delete 42 +#define KEY_die 43 +#define KEY_do 44 +#define KEY_dump 45 +#define KEY_each 46 +#define KEY_else 47 +#define KEY_elsif 48 +#define KEY_endgrent 49 +#define KEY_endhostent 50 +#define KEY_endnetent 51 +#define KEY_endprotoent 52 +#define KEY_endpwent 53 +#define KEY_endservent 54 +#define KEY_eof 55 +#define KEY_eq 56 +#define KEY_eval 57 +#define KEY_evalbytes 58 +#define KEY_exec 59 +#define KEY_exists 60 +#define KEY_exit 61 +#define KEY_exp 62 +#define KEY_fc 63 +#define KEY_fcntl 64 +#define KEY_fileno 65 +#define KEY_flock 66 +#define KEY_for 67 +#define KEY_foreach 68 +#define KEY_fork 69 +#define KEY_format 70 +#define KEY_formline 71 +#define KEY_ge 72 +#define KEY_getc 73 +#define KEY_getgrent 74 +#define KEY_getgrgid 75 +#define KEY_getgrnam 76 +#define KEY_gethostbyaddr 77 +#define KEY_gethostbyname 78 +#define KEY_gethostent 79 +#define KEY_getlogin 80 +#define KEY_getnetbyaddr 81 +#define KEY_getnetbyname 82 +#define KEY_getnetent 83 +#define KEY_getpeername 84 +#define KEY_getpgrp 85 +#define KEY_getppid 86 +#define KEY_getpriority 87 +#define KEY_getprotobyname 88 +#define KEY_getprotobynumber 89 +#define KEY_getprotoent 90 +#define KEY_getpwent 91 +#define KEY_getpwnam 92 +#define KEY_getpwuid 93 +#define KEY_getservbyname 94 +#define KEY_getservbyport 95 +#define KEY_getservent 96 +#define KEY_getsockname 97 +#define KEY_getsockopt 98 +#define KEY_given 99 +#define KEY_glob 100 +#define KEY_gmtime 101 +#define KEY_goto 102 +#define KEY_grep 103 +#define KEY_gt 104 +#define KEY_hex 105 +#define KEY_if 106 +#define KEY_index 107 +#define KEY_int 108 +#define KEY_ioctl 109 +#define KEY_join 110 +#define KEY_keys 111 +#define KEY_kill 112 +#define KEY_last 113 +#define KEY_lc 114 +#define KEY_lcfirst 115 +#define KEY_le 116 +#define KEY_length 117 +#define KEY_link 118 +#define KEY_listen 119 +#define KEY_local 120 +#define KEY_localtime 121 +#define KEY_lock 122 +#define KEY_log 123 +#define KEY_lstat 124 +#define KEY_lt 125 +#define KEY_m 126 +#define KEY_map 127 +#define KEY_mkdir 128 +#define KEY_msgctl 129 +#define KEY_msgget 130 +#define KEY_msgrcv 131 +#define KEY_msgsnd 132 +#define KEY_my 133 +#define KEY_ne 134 +#define KEY_next 135 +#define KEY_no 136 +#define KEY_not 137 +#define KEY_oct 138 +#define KEY_open 139 +#define KEY_opendir 140 +#define KEY_or 141 +#define KEY_ord 142 +#define KEY_our 143 +#define KEY_pack 144 +#define KEY_package 145 +#define KEY_pipe 146 +#define KEY_pop 147 +#define KEY_pos 148 +#define KEY_print 149 +#define KEY_printf 150 +#define KEY_prototype 151 +#define KEY_push 152 +#define KEY_q 153 +#define KEY_qq 154 +#define KEY_qr 155 +#define KEY_quotemeta 156 +#define KEY_qw 157 +#define KEY_qx 158 +#define KEY_rand 159 +#define KEY_read 160 +#define KEY_readdir 161 +#define KEY_readline 162 +#define KEY_readlink 163 +#define KEY_readpipe 164 +#define KEY_recv 165 +#define KEY_redo 166 +#define KEY_ref 167 +#define KEY_rename 168 +#define KEY_require 169 +#define KEY_reset 170 +#define KEY_return 171 +#define KEY_reverse 172 +#define KEY_rewinddir 173 +#define KEY_rindex 174 +#define KEY_rmdir 175 +#define KEY_s 176 +#define KEY_say 177 +#define KEY_scalar 178 +#define KEY_seek 179 +#define KEY_seekdir 180 +#define KEY_select 181 +#define KEY_semctl 182 +#define KEY_semget 183 +#define KEY_semop 184 +#define KEY_send 185 +#define KEY_setgrent 186 +#define KEY_sethostent 187 +#define KEY_setnetent 188 +#define KEY_setpgrp 189 +#define KEY_setpriority 190 +#define KEY_setprotoent 191 +#define KEY_setpwent 192 +#define KEY_setservent 193 +#define KEY_setsockopt 194 +#define KEY_shift 195 +#define KEY_shmctl 196 +#define KEY_shmget 197 +#define KEY_shmread 198 +#define KEY_shmwrite 199 +#define KEY_shutdown 200 +#define KEY_sin 201 +#define KEY_sleep 202 +#define KEY_socket 203 +#define KEY_socketpair 204 +#define KEY_sort 205 +#define KEY_splice 206 +#define KEY_split 207 +#define KEY_sprintf 208 +#define KEY_sqrt 209 +#define KEY_srand 210 +#define KEY_stat 211 +#define KEY_state 212 +#define KEY_study 213 +#define KEY_sub 214 +#define KEY_substr 215 +#define KEY_symlink 216 +#define KEY_syscall 217 +#define KEY_sysopen 218 +#define KEY_sysread 219 +#define KEY_sysseek 220 +#define KEY_system 221 +#define KEY_syswrite 222 +#define KEY_tell 223 +#define KEY_telldir 224 +#define KEY_tie 225 +#define KEY_tied 226 +#define KEY_time 227 +#define KEY_times 228 +#define KEY_tr 229 +#define KEY_truncate 230 +#define KEY_uc 231 +#define KEY_ucfirst 232 +#define KEY_umask 233 +#define KEY_undef 234 +#define KEY_unless 235 +#define KEY_unlink 236 +#define KEY_unpack 237 +#define KEY_unshift 238 +#define KEY_untie 239 +#define KEY_until 240 +#define KEY_use 241 +#define KEY_utime 242 +#define KEY_values 243 +#define KEY_vec 244 +#define KEY_wait 245 +#define KEY_waitpid 246 +#define KEY_wantarray 247 +#define KEY_warn 248 +#define KEY_when 249 +#define KEY_while 250 +#define KEY_write 251 +#define KEY_x 252 +#define KEY_xor 253 +#define KEY_y 254 /* Generated from: - * e5a540774760ea54c761ef17ee4a153cc264e9a700b817d561e390730c457406 regen/keywords.pl + * 7c6d47fd2890b2422a40331ec90eac08f9808209b01f2b9c113141410fea91b5 regen/keywords.pl * ex: set ro: */ Index: gnu/usr.bin/perl/locale.c =================================================================== RCS file: /mnt/memory/perl/importit/cvs/src/gnu/usr.bin/perl/locale.c,v retrieving revision 1.1.1.9 diff -u -p -u -p -r1.1.1.9 locale.c --- gnu/usr.bin/perl/locale.c 24 Mar 2014 14:58:44 -0000 1.1.1.9 +++ gnu/usr.bin/perl/locale.c 16 Nov 2014 03:22:24 -0000 @@ -22,6 +22,14 @@ /* utility functions for handling locale-specific stuff like what * character represents the decimal point. + * + * All C programs have an underlying locale. Perl generally doesn't pay any + * attention to it except within the scope of a 'use locale'. For most + * categories, it accomplishes this by just using different operations if it is + * in such scope than if not. However, various libc functions called by Perl + * are affected by the LC_NUMERIC category, so there are macros in perl.h that + * are used to toggle between the current locale and the C locale depending on + * the desired behavior of those functions at the moment. */ #include "EXTERN.h" @@ -34,18 +42,21 @@ #include "reentr.h" -#if defined(USE_LOCALE_NUMERIC) || defined(USE_LOCALE_COLLATE) +#ifdef USE_LOCALE + /* - * Standardize the locale name from a string returned by 'setlocale'. + * Standardize the locale name from a string returned by 'setlocale', possibly + * modifying that string. * - * The standard return value of setlocale() is either + * The typical return value of setlocale() is either * (1) "xx_YY" if the first argument of setlocale() is not LC_ALL * (2) "xa_YY xb_YY ..." if the first argument of setlocale() is LC_ALL * (the space-separated values represent the various sublocales, - * in some unspecified order) + * in some unspecified order). This is not handled by this function. * * In some platforms it has a form like "LC_SOMETHING=Lang_Country.866\n", - * which is harmful for further use of the string in setlocale(). + * which is harmful for further use of the string in setlocale(). This + * function removes the trailing new line and everything up through the '=' * */ STATIC char * @@ -75,6 +86,7 @@ S_stdize_locale(pTHX_ char *locs) return locs; } + #endif void @@ -95,21 +107,60 @@ Perl_set_numeric_radix(pTHX) sv_setpv(PL_numeric_radix_sv, lc->decimal_point); else PL_numeric_radix_sv = newSVpv(lc->decimal_point, 0); + if (! is_ascii_string((U8 *) lc->decimal_point, 0) + && is_utf8_string((U8 *) lc->decimal_point, 0) + && is_cur_LC_category_utf8(LC_NUMERIC)) + { + SvUTF8_on(PL_numeric_radix_sv); + } } } else PL_numeric_radix_sv = NULL; + + DEBUG_L(PerlIO_printf(Perl_debug_log, "Locale radix is %s\n", + (PL_numeric_radix_sv) + ? lc->decimal_point + : "NULL")); + # endif /* HAS_LOCALECONV */ #endif /* USE_LOCALE_NUMERIC */ } -/* - * Set up for a new numeric locale. - */ void Perl_new_numeric(pTHX_ const char *newnum) { #ifdef USE_LOCALE_NUMERIC + + /* Called after all libc setlocale() calls affecting LC_NUMERIC, to tell + * core Perl this and that 'newnum' is the name of the new locale. + * It installs this locale as the current underlying default. + * + * The default locale and the C locale can be toggled between by use of the + * set_numeric_local() and set_numeric_standard() functions, which should + * probably not be called directly, but only via macros like + * SET_NUMERIC_STANDARD() in perl.h. + * + * The toggling is necessary mainly so that a non-dot radix decimal point + * character can be output, while allowing internal calculations to use a + * dot. + * + * This sets several interpreter-level variables: + * PL_numeric_name The default locale's name: a copy of 'newnum' + * PL_numeric_local A boolean indicating if the toggled state is such + * that the current locale is the default locale + * PL_numeric_standard A boolean indicating if the toggled state is such + * that the current locale is the C locale + * Note that both of the last two variables can be true at the same time, + * if the underlying locale is C. (Toggling is a no-op under these + * circumstances.) + * + * Any code changing the locale (outside this file) should use + * POSIX::setlocale, which calls this function. Therefore this function + * should be called directly only from this file and from + * POSIX::setlocale() */ + + char *save_newnum; dVAR; if (! newnum) { @@ -120,15 +171,17 @@ Perl_new_numeric(pTHX_ const char *newnu return; } - if (! PL_numeric_name || strNE(PL_numeric_name, newnum)) { + save_newnum = stdize_locale(savepv(newnum)); + if (! PL_numeric_name || strNE(PL_numeric_name, save_newnum)) { Safefree(PL_numeric_name); - PL_numeric_name = stdize_locale(savepv(newnum)); - PL_numeric_standard = ((*newnum == 'C' && newnum[1] == '\0') - || strEQ(newnum, "POSIX")); - PL_numeric_local = TRUE; - set_numeric_radix(); + PL_numeric_name = save_newnum; } + PL_numeric_standard = ((*save_newnum == 'C' && save_newnum[1] == '\0') + || strEQ(save_newnum, "POSIX")); + PL_numeric_local = TRUE; + set_numeric_radix(); + #endif /* USE_LOCALE_NUMERIC */ } @@ -138,12 +191,18 @@ Perl_set_numeric_standard(pTHX) #ifdef USE_LOCALE_NUMERIC dVAR; + /* Toggle the LC_NUMERIC locale to C, if not already there. Probably + * should use the macros like SET_NUMERIC_STANDARD() in perl.h instead of + * calling this directly. */ + if (! PL_numeric_standard) { setlocale(LC_NUMERIC, "C"); PL_numeric_standard = TRUE; PL_numeric_local = FALSE; set_numeric_radix(); } + DEBUG_L(PerlIO_printf(Perl_debug_log, + "Underlying LC_NUMERIC locale now is C\n")); #endif /* USE_LOCALE_NUMERIC */ } @@ -154,12 +213,19 @@ Perl_set_numeric_local(pTHX) #ifdef USE_LOCALE_NUMERIC dVAR; + /* Toggle the LC_NUMERIC locale to the current underlying default, if not + * already there. Probably should use the macros like SET_NUMERIC_LOCAL() + * in perl.h instead of calling this directly. */ + if (! PL_numeric_local) { setlocale(LC_NUMERIC, PL_numeric_name); PL_numeric_standard = FALSE; PL_numeric_local = TRUE; set_numeric_radix(); } + DEBUG_L(PerlIO_printf(Perl_debug_log, + "Underlying LC_NUMERIC locale now is %s\n", + PL_numeric_name)); #endif /* USE_LOCALE_NUMERIC */ } @@ -171,18 +237,39 @@ void Perl_new_ctype(pTHX_ const char *newctype) { #ifdef USE_LOCALE_CTYPE + + /* Called after all libc setlocale() calls affecting LC_CTYPE, to tell + * core Perl this and that 'newctype' is the name of the new locale. + * + * This function sets up the folding arrays for all 256 bytes, assuming + * that tofold() is tolc() since fold case is not a concept in POSIX, + * + * Any code changing the locale (outside this file) should use + * POSIX::setlocale, which calls this function. Therefore this function + * should be called directly only from this file and from + * POSIX::setlocale() */ + dVAR; - int i; + UV i; PERL_ARGS_ASSERT_NEW_CTYPE; - for (i = 0; i < 256; i++) { - if (isUPPER_LC(i)) - PL_fold_locale[i] = toLOWER_LC(i); - else if (isLOWER_LC(i)) - PL_fold_locale[i] = toUPPER_LC(i); - else - PL_fold_locale[i] = i; + PL_in_utf8_CTYPE_locale = is_cur_LC_category_utf8(LC_CTYPE); + + /* A UTF-8 locale gets standard rules. But note that code still has to + * handle this specially because of the three problematic code points */ + if (PL_in_utf8_CTYPE_locale) { + Copy(PL_fold_latin1, PL_fold_locale, 256, U8); + } + else { + for (i = 0; i < 256; i++) { + if (isUPPER_LC((U8) i)) + PL_fold_locale[i] = (U8) toLOWER_LC((U8) i); + else if (isLOWER_LC((U8) i)) + PL_fold_locale[i] = (U8) toUPPER_LC((U8) i); + else + PL_fold_locale[i] = (U8) i; + } } #endif /* USE_LOCALE_CTYPE */ @@ -191,13 +278,19 @@ Perl_new_ctype(pTHX_ const char *newctyp PERL_UNUSED_CONTEXT; } -/* - * Set up for a new collation locale. - */ void Perl_new_collate(pTHX_ const char *newcoll) { #ifdef USE_LOCALE_COLLATE + + /* Called after all libc setlocale() calls affecting LC_COLLATE, to tell + * core Perl this and that 'newcoll' is the name of the new locale. + * + * Any code changing the locale (outside this file) should use + * POSIX::setlocale, which calls this function. Therefore this function + * should be called directly only from this file and from + * POSIX::setlocale() */ + dVAR; if (! newcoll) { @@ -238,19 +331,158 @@ Perl_new_collate(pTHX_ const char *newco #endif /* USE_LOCALE_COLLATE */ } +#ifdef WIN32 + +char * +Perl_my_setlocale(pTHX_ int category, const char* locale) +{ + /* This, for Windows, emulates POSIX setlocale() behavior. There is no + * difference unless the input locale is "", which means on Windows to get + * the machine default, which is set via the computer's "Regional and + * Language Options" (or its current equivalent). In POSIX, it instead + * means to find the locale from the user's environment. This routine + * looks in the environment, and, if anything is found, uses that instead + * of going to the machine default. If there is no environment override, + * the machine default is used, as normal, by calling the real setlocale() + * with "". The POSIX behavior is to use the LC_ALL variable if set; + * otherwise to use the particular category's variable if set; otherwise to + * use the LANG variable. */ + + bool override_LC_ALL = 0; + char * result; + + if (locale && strEQ(locale, "")) { +# ifdef LC_ALL + locale = PerlEnv_getenv("LC_ALL"); + if (! locale) { +#endif + switch (category) { +# ifdef LC_ALL + case LC_ALL: + override_LC_ALL = TRUE; + break; /* We already know its variable isn't set */ +# endif +# ifdef USE_LOCALE_TIME + case LC_TIME: + locale = PerlEnv_getenv("LC_TIME"); + break; +# endif +# ifdef USE_LOCALE_CTYPE + case LC_CTYPE: + locale = PerlEnv_getenv("LC_CTYPE"); + break; +# endif +# ifdef USE_LOCALE_COLLATE + case LC_COLLATE: + locale = PerlEnv_getenv("LC_COLLATE"); + break; +# endif +# ifdef USE_LOCALE_MONETARY + case LC_MONETARY: + locale = PerlEnv_getenv("LC_MONETARY"); + break; +# endif +# ifdef USE_LOCALE_NUMERIC + case LC_NUMERIC: + locale = PerlEnv_getenv("LC_NUMERIC"); + break; +# endif +# ifdef USE_LOCALE_MESSAGES + case LC_MESSAGES: + locale = PerlEnv_getenv("LC_MESSAGES"); + break; +# endif + default: + /* This is a category, like PAPER_SIZE that we don't + * know about; and so can't provide a wrapper. */ + break; + } + if (! locale) { + locale = PerlEnv_getenv("LANG"); + if (! locale) { + locale = ""; + } + } +# ifdef LC_ALL + } +# endif + } + + result = setlocale(category, locale); + + if (! override_LC_ALL) { + return result; + } + + /* Here the input locale was LC_ALL, and we have set it to what is in the + * LANG variable or the system default if there is no LANG. But these have + * lower priority than the other LC_foo variables, so override it for each + * one that is set. (If they are set to "", it means to use the same thing + * we just set LC_ALL to, so can skip) */ +# ifdef USE_LOCALE_TIME + result = PerlEnv_getenv("LC_TIME"); + if (result && strNE(result, "")) { + setlocale(LC_TIME, result); + } +# endif +# ifdef USE_LOCALE_CTYPE + result = PerlEnv_getenv("LC_CTYPE"); + if (result && strNE(result, "")) { + setlocale(LC_CTYPE, result); + } +# endif +# ifdef USE_LOCALE_COLLATE + result = PerlEnv_getenv("LC_COLLATE"); + if (result && strNE(result, "")) { + setlocale(LC_COLLATE, result); + } +# endif +# ifdef USE_LOCALE_MONETARY + result = PerlEnv_getenv("LC_MONETARY"); + if (result && strNE(result, "")) { + setlocale(LC_MONETARY, result); + } +# endif +# ifdef USE_LOCALE_NUMERIC + result = PerlEnv_getenv("LC_NUMERIC"); + if (result && strNE(result, "")) { + setlocale(LC_NUMERIC, result); + } +# endif +# ifdef USE_LOCALE_MESSAGES + result = PerlEnv_getenv("LC_MESSAGES"); + if (result && strNE(result, "")) { + setlocale(LC_MESSAGES, result); + } +# endif + + return setlocale(LC_ALL, NULL); + +} + +#endif + + /* * Initialize locale awareness. */ int Perl_init_i18nl10n(pTHX_ int printwarn) { - int ok = 1; - /* returns + /* printwarn is + * + * 0 if not to output warning when setup locale is bad + * 1 if to output warning based on value of PERL_BADLANG + * >1 if to output regardless of PERL_BADLANG + * + * returns * 1 = set ok or not applicable, - * 0 = fallback to C locale, - * -1 = fallback to C locale failed + * 0 = fallback to a locale of lower priority + * -1 = fallback to all locales failed, not even to the C locale */ + int ok = 1; + #if defined(USE_LOCALE) dVAR; @@ -266,218 +498,374 @@ Perl_init_i18nl10n(pTHX_ int printwarn) #ifdef __GLIBC__ char * const language = PerlEnv_getenv("LANGUAGE"); #endif + + /* NULL uses the existing already set up locale */ + const char * const setlocale_init = (PerlEnv_getenv("PERL_SKIP_LOCALE_INIT")) + ? NULL + : ""; + const char* trial_locales[5]; /* 5 = 1 each for "", LC_ALL, LANG, "", C */ + unsigned int trial_locales_count; char * const lc_all = PerlEnv_getenv("LC_ALL"); char * const lang = PerlEnv_getenv("LANG"); bool setlocale_failure = FALSE; + unsigned int i; + char *p; + const bool locwarn = (printwarn > 1 || + (printwarn && + (!(p = PerlEnv_getenv("PERL_BADLANG")) || atoi(p)))); + bool done = FALSE; + const char *system_default_locale = NULL; -#ifdef LOCALE_ENVIRON_REQUIRED + +#ifndef LOCALE_ENVIRON_REQUIRED + PERL_UNUSED_VAR(done); +#else /* * Ultrix setlocale(..., "") fails if there are no environment * variables from which to get a locale name. */ - bool done = FALSE; - -#ifdef LC_ALL +# ifdef LC_ALL if (lang) { - if (setlocale(LC_ALL, "")) + if (my_setlocale(LC_ALL, setlocale_init)) done = TRUE; else setlocale_failure = TRUE; } if (!setlocale_failure) { -#ifdef USE_LOCALE_CTYPE +# ifdef USE_LOCALE_CTYPE Safefree(curctype); if (! (curctype = - setlocale(LC_CTYPE, + my_setlocale(LC_CTYPE, (!done && (lang || PerlEnv_getenv("LC_CTYPE"))) - ? "" : NULL))) + ? setlocale_init : NULL))) setlocale_failure = TRUE; else curctype = savepv(curctype); -#endif /* USE_LOCALE_CTYPE */ -#ifdef USE_LOCALE_COLLATE +# endif /* USE_LOCALE_CTYPE */ +# ifdef USE_LOCALE_COLLATE Safefree(curcoll); if (! (curcoll = - setlocale(LC_COLLATE, + my_setlocale(LC_COLLATE, (!done && (lang || PerlEnv_getenv("LC_COLLATE"))) - ? "" : NULL))) + ? setlocale_init : NULL))) setlocale_failure = TRUE; else curcoll = savepv(curcoll); -#endif /* USE_LOCALE_COLLATE */ -#ifdef USE_LOCALE_NUMERIC +# endif /* USE_LOCALE_COLLATE */ +# ifdef USE_LOCALE_NUMERIC Safefree(curnum); if (! (curnum = - setlocale(LC_NUMERIC, + my_setlocale(LC_NUMERIC, (!done && (lang || PerlEnv_getenv("LC_NUMERIC"))) - ? "" : NULL))) + ? setlocale_init : NULL))) setlocale_failure = TRUE; else curnum = savepv(curnum); -#endif /* USE_LOCALE_NUMERIC */ +# endif /* USE_LOCALE_NUMERIC */ +# ifdef USE_LOCALE_MESSAGES + if (! my_setlocale(LC_MESSAGES, + (!done && (lang || PerlEnv_getenv("LC_MESSAGES"))) + ? setlocale_init : NULL)) + { + setlocale_failure = TRUE; + } +# endif /* USE_LOCALE_MESSAGES */ +# ifdef USE_LOCALE_MONETARY + if (! my_setlocale(LC_MONETARY, + (!done && (lang || PerlEnv_getenv("LC_MONETARY"))) + ? setlocale_init : NULL)) + { + setlocale_failure = TRUE; + } +# endif /* USE_LOCALE_MONETARY */ } -#endif /* LC_ALL */ +# endif /* LC_ALL */ #endif /* !LOCALE_ENVIRON_REQUIRED */ + /* We try each locale in the list until we get one that works, or exhaust + * the list */ + trial_locales[0] = setlocale_init; + trial_locales_count = 1; + for (i= 0; i < trial_locales_count; i++) { + const char * trial_locale = trial_locales[i]; + + if (i > 0) { + + /* XXX This is to preserve old behavior for LOCALE_ENVIRON_REQUIRED + * when i==0, but I (khw) don't think that behavior makes much + * sense */ + setlocale_failure = FALSE; + +#ifdef WIN32 + + /* On Windows machines, an entry of "" after the 0th means to use + * the system default locale, which we now proceed to get. */ + if (strEQ(trial_locale, "")) { + unsigned int j; + + /* Note that this may change the locale, but we are going to do + * that anyway just below */ + system_default_locale = setlocale(LC_ALL, ""); + + /* Skip if invalid or it's already on the list of locales to + * try */ + if (! system_default_locale) { + goto next_iteration; + } + for (j = 0; j < trial_locales_count; j++) { + if (strEQ(system_default_locale, trial_locales[j])) { + goto next_iteration; + } + } + + trial_locale = system_default_locale; + } +#endif + } + #ifdef LC_ALL - if (! setlocale(LC_ALL, "")) - setlocale_failure = TRUE; + if (! my_setlocale(LC_ALL, trial_locale)) { + setlocale_failure = TRUE; + } + else { + /* Since LC_ALL succeeded, it should have changed all the other + * categories it can to its value; so we massage things so that the + * setlocales below just return their category's current values. + * This adequately handles the case in NetBSD where LC_COLLATE may + * not be defined for a locale, and setting it individually will + * fail, whereas setting LC_ALL suceeds, leaving LC_COLLATE set to + * the POSIX locale. */ + trial_locale = NULL; + } #endif /* LC_ALL */ - if (!setlocale_failure) { + if (!setlocale_failure) { #ifdef USE_LOCALE_CTYPE - Safefree(curctype); - if (! (curctype = setlocale(LC_CTYPE, ""))) - setlocale_failure = TRUE; - else - curctype = savepv(curctype); + Safefree(curctype); + if (! (curctype = my_setlocale(LC_CTYPE, trial_locale))) + setlocale_failure = TRUE; + else + curctype = savepv(curctype); #endif /* USE_LOCALE_CTYPE */ #ifdef USE_LOCALE_COLLATE - Safefree(curcoll); - if (! (curcoll = setlocale(LC_COLLATE, ""))) - setlocale_failure = TRUE; - else - curcoll = savepv(curcoll); + Safefree(curcoll); + if (! (curcoll = my_setlocale(LC_COLLATE, trial_locale))) + setlocale_failure = TRUE; + else + curcoll = savepv(curcoll); #endif /* USE_LOCALE_COLLATE */ #ifdef USE_LOCALE_NUMERIC - Safefree(curnum); - if (! (curnum = setlocale(LC_NUMERIC, ""))) - setlocale_failure = TRUE; - else - curnum = savepv(curnum); + Safefree(curnum); + if (! (curnum = my_setlocale(LC_NUMERIC, trial_locale))) + setlocale_failure = TRUE; + else + curnum = savepv(curnum); #endif /* USE_LOCALE_NUMERIC */ - } +#ifdef USE_LOCALE_MESSAGES + if (! (my_setlocale(LC_MESSAGES, trial_locale))) + setlocale_failure = TRUE; +#endif /* USE_LOCALE_MESSAGES */ +#ifdef USE_LOCALE_MONETARY + if (! (my_setlocale(LC_MONETARY, trial_locale))) + setlocale_failure = TRUE; +#endif /* USE_LOCALE_MONETARY */ + + if (! setlocale_failure) { /* Success */ + break; + } + } - if (setlocale_failure) { - char *p; - const bool locwarn = (printwarn > 1 || - (printwarn && - (!(p = PerlEnv_getenv("PERL_BADLANG")) || atoi(p)))); + /* Here, something failed; will need to try a fallback. */ + ok = 0; - if (locwarn) { + if (i == 0) { + unsigned int j; + + if (locwarn) { /* Output failure info only on the first one */ #ifdef LC_ALL - PerlIO_printf(Perl_error_log, - "perl: warning: Setting locale failed.\n"); + PerlIO_printf(Perl_error_log, + "perl: warning: Setting locale failed.\n"); #else /* !LC_ALL */ - PerlIO_printf(Perl_error_log, - "perl: warning: Setting locale failed for the categories:\n\t"); + PerlIO_printf(Perl_error_log, + "perl: warning: Setting locale failed for the categories:\n\t"); #ifdef USE_LOCALE_CTYPE - if (! curctype) - PerlIO_printf(Perl_error_log, "LC_CTYPE "); + if (! curctype) + PerlIO_printf(Perl_error_log, "LC_CTYPE "); #endif /* USE_LOCALE_CTYPE */ #ifdef USE_LOCALE_COLLATE - if (! curcoll) - PerlIO_printf(Perl_error_log, "LC_COLLATE "); + if (! curcoll) + PerlIO_printf(Perl_error_log, "LC_COLLATE "); #endif /* USE_LOCALE_COLLATE */ #ifdef USE_LOCALE_NUMERIC - if (! curnum) - PerlIO_printf(Perl_error_log, "LC_NUMERIC "); + if (! curnum) + PerlIO_printf(Perl_error_log, "LC_NUMERIC "); #endif /* USE_LOCALE_NUMERIC */ - PerlIO_printf(Perl_error_log, "\n"); + PerlIO_printf(Perl_error_log, "and possibly others\n"); #endif /* LC_ALL */ - PerlIO_printf(Perl_error_log, - "perl: warning: Please check that your locale settings:\n"); + PerlIO_printf(Perl_error_log, + "perl: warning: Please check that your locale settings:\n"); #ifdef __GLIBC__ - PerlIO_printf(Perl_error_log, - "\tLANGUAGE = %c%s%c,\n", - language ? '"' : '(', - language ? language : "unset", - language ? '"' : ')'); + PerlIO_printf(Perl_error_log, + "\tLANGUAGE = %c%s%c,\n", + language ? '"' : '(', + language ? language : "unset", + language ? '"' : ')'); #endif - PerlIO_printf(Perl_error_log, - "\tLC_ALL = %c%s%c,\n", - lc_all ? '"' : '(', - lc_all ? lc_all : "unset", - lc_all ? '"' : ')'); + PerlIO_printf(Perl_error_log, + "\tLC_ALL = %c%s%c,\n", + lc_all ? '"' : '(', + lc_all ? lc_all : "unset", + lc_all ? '"' : ')'); #if defined(USE_ENVIRON_ARRAY) - { - char **e; - for (e = environ; *e; e++) { - if (strnEQ(*e, "LC_", 3) - && strnNE(*e, "LC_ALL=", 7) - && (p = strchr(*e, '='))) - PerlIO_printf(Perl_error_log, "\t%.*s = \"%s\",\n", - (int)(p - *e), *e, p + 1); - } - } + { + char **e; + for (e = environ; *e; e++) { + if (strnEQ(*e, "LC_", 3) + && strnNE(*e, "LC_ALL=", 7) + && (p = strchr(*e, '='))) + PerlIO_printf(Perl_error_log, "\t%.*s = \"%s\",\n", + (int)(p - *e), *e, p + 1); + } + } #else - PerlIO_printf(Perl_error_log, - "\t(possibly more locale environment variables)\n"); + PerlIO_printf(Perl_error_log, + "\t(possibly more locale environment variables)\n"); #endif - PerlIO_printf(Perl_error_log, - "\tLANG = %c%s%c\n", - lang ? '"' : '(', - lang ? lang : "unset", - lang ? '"' : ')'); + PerlIO_printf(Perl_error_log, + "\tLANG = %c%s%c\n", + lang ? '"' : '(', + lang ? lang : "unset", + lang ? '"' : ')'); + + PerlIO_printf(Perl_error_log, + " are supported and installed on your system.\n"); + } + + /* Calculate what fallback locales to try. We have avoided this + * until we have to, becuase failure is quite unlikely. This will + * usually change the upper bound of the loop we are in. + * + * Since the system's default way of setting the locale has not + * found one that works, We use Perl's defined ordering: LC_ALL, + * LANG, and the C locale. We don't try the same locale twice, so + * don't add to the list if already there. (On POSIX systems, the + * LC_ALL element will likely be a repeat of the 0th element "", + * but there's no harm done by doing it explicitly */ + if (lc_all) { + for (j = 0; j < trial_locales_count; j++) { + if (strEQ(lc_all, trial_locales[j])) { + goto done_lc_all; + } + } + trial_locales[trial_locales_count++] = lc_all; + } + done_lc_all: + + if (lang) { + for (j = 0; j < trial_locales_count; j++) { + if (strEQ(lang, trial_locales[j])) { + goto done_lang; + } + } + trial_locales[trial_locales_count++] = lang; + } + done_lang: + +#if defined(WIN32) && defined(LC_ALL) + /* For Windows, we also try the system default locale before "C". + * (If there exists a Windows without LC_ALL we skip this because + * it gets too complicated. For those, the "C" is the next + * fallback possibility). The "" is the same as the 0th element of + * the array, but the code at the loop above knows to treat it + * differently when not the 0th */ + trial_locales[trial_locales_count++] = ""; +#endif - PerlIO_printf(Perl_error_log, - " are supported and installed on your system.\n"); - } + for (j = 0; j < trial_locales_count; j++) { + if (strEQ("C", trial_locales[j])) { + goto done_C; + } + } + trial_locales[trial_locales_count++] = "C"; -#ifdef LC_ALL + done_C: ; + } /* end of first time through the loop */ - if (setlocale(LC_ALL, "C")) { - if (locwarn) - PerlIO_printf(Perl_error_log, - "perl: warning: Falling back to the standard locale (\"C\").\n"); - ok = 0; - } - else { - if (locwarn) - PerlIO_printf(Perl_error_log, - "perl: warning: Failed to fall back to the standard locale (\"C\").\n"); - ok = -1; - } +#ifdef WIN32 + next_iteration: ; +#endif -#else /* ! LC_ALL */ + } /* end of looping through the trial locales */ - if (0 -#ifdef USE_LOCALE_CTYPE - || !(curctype || setlocale(LC_CTYPE, "C")) -#endif /* USE_LOCALE_CTYPE */ -#ifdef USE_LOCALE_COLLATE - || !(curcoll || setlocale(LC_COLLATE, "C")) -#endif /* USE_LOCALE_COLLATE */ -#ifdef USE_LOCALE_NUMERIC - || !(curnum || setlocale(LC_NUMERIC, "C")) -#endif /* USE_LOCALE_NUMERIC */ - ) - { - if (locwarn) - PerlIO_printf(Perl_error_log, - "perl: warning: Cannot fall back to the standard locale (\"C\").\n"); - ok = -1; - } + if (ok < 1) { /* If we tried to fallback */ + const char* msg; + if (! setlocale_failure) { /* fallback succeeded */ + msg = "Falling back to"; + } + else { /* fallback failed */ + + /* We dropped off the end of the loop, so have to decrement i to + * get back to the value the last time through */ + i--; -#endif /* ! LC_ALL */ + ok = -1; + msg = "Failed to fall back to"; + /* To continue, we should use whatever values we've got */ #ifdef USE_LOCALE_CTYPE - Safefree(curctype); - curctype = savepv(setlocale(LC_CTYPE, NULL)); + Safefree(curctype); + curctype = savepv(setlocale(LC_CTYPE, NULL)); #endif /* USE_LOCALE_CTYPE */ #ifdef USE_LOCALE_COLLATE - Safefree(curcoll); - curcoll = savepv(setlocale(LC_COLLATE, NULL)); + Safefree(curcoll); + curcoll = savepv(setlocale(LC_COLLATE, NULL)); #endif /* USE_LOCALE_COLLATE */ #ifdef USE_LOCALE_NUMERIC - Safefree(curnum); - curnum = savepv(setlocale(LC_NUMERIC, NULL)); + Safefree(curnum); + curnum = savepv(setlocale(LC_NUMERIC, NULL)); #endif /* USE_LOCALE_NUMERIC */ - } - else { + } + + if (locwarn) { + const char * description; + const char * name = ""; + if (strEQ(trial_locales[i], "C")) { + description = "the standard locale"; + name = "C"; + } + else if (strEQ(trial_locales[i], "")) { + description = "the system default locale"; + if (system_default_locale) { + name = system_default_locale; + } + } + else { + description = "a fallback locale"; + name = trial_locales[i]; + } + if (name && strNE(name, "")) { + PerlIO_printf(Perl_error_log, + "perl: warning: %s %s (\"%s\").\n", msg, description, name); + } + else { + PerlIO_printf(Perl_error_log, + "perl: warning: %s %s.\n", msg, description); + } + } + } /* End of tried to fallback */ #ifdef USE_LOCALE_CTYPE new_ctype(curctype); @@ -491,56 +879,14 @@ Perl_init_i18nl10n(pTHX_ int printwarn) new_numeric(curnum); #endif /* USE_LOCALE_NUMERIC */ - } - -#endif /* USE_LOCALE */ +#if defined(USE_PERLIO) && defined(USE_LOCALE_CTYPE) + /* Set PL_utf8locale to TRUE if using PerlIO _and_ the current LC_CTYPE + * locale is UTF-8. If PL_utf8locale and PL_unicode (set by -C or by + * $ENV{PERL_UNICODE}) are true, perl.c:S_parse_body() will turn on the + * PerlIO :utf8 layer on STDIN, STDOUT, STDERR, _and_ the default open + * discipline. */ + PL_utf8locale = is_cur_LC_category_utf8(LC_CTYPE); -#ifdef USE_PERLIO - { - /* Set PL_utf8locale to TRUE if using PerlIO _and_ - any of the following are true: - - nl_langinfo(CODESET) contains /^utf-?8/i - - $ENV{LC_ALL} contains /^utf-?8/i - - $ENV{LC_CTYPE} contains /^utf-?8/i - - $ENV{LANG} contains /^utf-?8/i - The LC_ALL, LC_CTYPE, LANG obey the usual override - hierarchy of locale environment variables. (LANGUAGE - affects only LC_MESSAGES only under glibc.) (If present, - it overrides LC_MESSAGES for GNU gettext, and it also - can have more than one locale, separated by spaces, - in case you need to know.) - If PL_utf8locale and PL_unicode (set by -C or by $ENV{PERL_UNICODE}) - are true, perl.c:S_parse_body() will turn on the PerlIO :utf8 layer - on STDIN, STDOUT, STDERR, _and_ the default open discipline. - */ - bool utf8locale = FALSE; - char *codeset = NULL; -#if defined(HAS_NL_LANGINFO) && defined(CODESET) - codeset = nl_langinfo(CODESET); -#endif - if (codeset) - utf8locale = (foldEQ(codeset, STR_WITH_LEN("UTF-8")) - || foldEQ(codeset, STR_WITH_LEN("UTF8") )); -#if defined(USE_LOCALE) - else { /* nl_langinfo(CODESET) is supposed to correctly - * interpret the locale environment variables, - * but just in case it fails, let's do this manually. */ - if (lang) - utf8locale = (foldEQ(lang, STR_WITH_LEN("UTF-8")) - || foldEQ(lang, STR_WITH_LEN("UTF8") )); -#ifdef USE_LOCALE_CTYPE - if (curctype) - utf8locale = (foldEQ(curctype, STR_WITH_LEN("UTF-8")) - || foldEQ(curctype, STR_WITH_LEN("UTF8") )); -#endif - if (lc_all) - utf8locale = (foldEQ(lc_all, STR_WITH_LEN("UTF-8")) - || foldEQ(lc_all, STR_WITH_LEN("UTF8") )); - } -#endif /* USE_LOCALE */ - if (utf8locale) - PL_utf8locale = TRUE; - } /* Set PL_unicode to $ENV{PERL_UNICODE} if using PerlIO. This is an alternative to using the -C command line switch (the -C if present will override this). */ @@ -561,9 +907,13 @@ Perl_init_i18nl10n(pTHX_ int printwarn) #ifdef USE_LOCALE_NUMERIC Safefree(curnum); #endif /* USE_LOCALE_NUMERIC */ + +#endif /* USE_LOCALE */ + return ok; } + #ifdef USE_LOCALE_COLLATE /* @@ -626,6 +976,394 @@ Perl_mem_collxfrm(pTHX_ const char *s, S } #endif /* USE_LOCALE_COLLATE */ + +#ifdef USE_LOCALE + +STATIC bool +S_is_cur_LC_category_utf8(pTHX_ int category) +{ + /* Returns TRUE if the current locale for 'category' is UTF-8; FALSE + * otherwise. 'category' may not be LC_ALL. If the platform doesn't have + * nl_langinfo(), nor MB_CUR_MAX, this employs a heuristic, which hence + * could give the wrong result. It errs on the side of not being a UTF-8 + * locale. */ + + char *save_input_locale = NULL; + STRLEN final_pos; + +#ifdef LC_ALL + assert(category != LC_ALL); +#endif + + /* First dispose of the trivial cases */ + save_input_locale = setlocale(category, NULL); + if (! save_input_locale) { + DEBUG_L(PerlIO_printf(Perl_debug_log, + "Could not find current locale for category %d\n", + category)); + return FALSE; /* XXX maybe should croak */ + } + save_input_locale = stdize_locale(savepv(save_input_locale)); + if ((*save_input_locale == 'C' && save_input_locale[1] == '\0') + || strEQ(save_input_locale, "POSIX")) + { + DEBUG_L(PerlIO_printf(Perl_debug_log, + "Current locale for category %d is %s\n", + category, save_input_locale)); + Safefree(save_input_locale); + return FALSE; + } + +#if defined(USE_LOCALE_CTYPE) \ + && (defined(MB_CUR_MAX) || (defined(HAS_NL_LANGINFO) && defined(CODESET))) + + { /* Next try nl_langinfo or MB_CUR_MAX if available */ + + char *save_ctype_locale = NULL; + bool is_utf8; + + if (category != LC_CTYPE) { /* These work only on LC_CTYPE */ + + /* Get the current LC_CTYPE locale */ + save_ctype_locale = stdize_locale(savepv(setlocale(LC_CTYPE, NULL))); + if (! save_ctype_locale) { + DEBUG_L(PerlIO_printf(Perl_debug_log, + "Could not find current locale for LC_CTYPE\n")); + goto cant_use_nllanginfo; + } + + /* If LC_CTYPE and the desired category use the same locale, this + * means that finding the value for LC_CTYPE is the same as finding + * the value for the desired category. Otherwise, switch LC_CTYPE + * to the desired category's locale */ + if (strEQ(save_ctype_locale, save_input_locale)) { + Safefree(save_ctype_locale); + save_ctype_locale = NULL; + } + else if (! setlocale(LC_CTYPE, save_input_locale)) { + DEBUG_L(PerlIO_printf(Perl_debug_log, + "Could not change LC_CTYPE locale to %s\n", + save_input_locale)); + Safefree(save_ctype_locale); + goto cant_use_nllanginfo; + } + } + + DEBUG_L(PerlIO_printf(Perl_debug_log, "Current LC_CTYPE locale=%s\n", + save_input_locale)); + + /* Here the current LC_CTYPE is set to the locale of the category whose + * information is desired. This means that nl_langinfo() and MB_CUR_MAX + * should give the correct results */ + +# if defined(HAS_NL_LANGINFO) && defined(CODESET) + { + char *codeset = savepv(nl_langinfo(CODESET)); + if (codeset && strNE(codeset, "")) { + + /* If we switched LC_CTYPE, switch back */ + if (save_ctype_locale) { + setlocale(LC_CTYPE, save_ctype_locale); + Safefree(save_ctype_locale); + } + + is_utf8 = foldEQ(codeset, STR_WITH_LEN("UTF-8")) + || foldEQ(codeset, STR_WITH_LEN("UTF8")); + + DEBUG_L(PerlIO_printf(Perl_debug_log, + "\tnllanginfo returned CODESET '%s'; ?UTF8 locale=%d\n", + codeset, is_utf8)); + Safefree(codeset); + Safefree(save_input_locale); + return is_utf8; + } + Safefree(codeset); + } + +# endif +# ifdef MB_CUR_MAX + + /* Here, either we don't have nl_langinfo, or it didn't return a + * codeset. Try MB_CUR_MAX */ + + /* Standard UTF-8 needs at least 4 bytes to represent the maximum + * Unicode code point. Since UTF-8 is the only non-single byte + * encoding we handle, we just say any such encoding is UTF-8, and if + * turns out to be wrong, other things will fail */ + is_utf8 = MB_CUR_MAX >= 4; + + DEBUG_L(PerlIO_printf(Perl_debug_log, + "\tMB_CUR_MAX=%d; ?UTF8 locale=%d\n", + (int) MB_CUR_MAX, is_utf8)); + + Safefree(save_input_locale); + +# ifdef HAS_MBTOWC + + /* ... But, most system that have MB_CUR_MAX will also have mbtowc(), + * since they are both in the C99 standard. We can feed a known byte + * string to the latter function, and check that it gives the expected + * result */ + if (is_utf8) { + wchar_t wc; + PERL_UNUSED_RESULT(mbtowc(&wc, NULL, 0));/* Reset any shift state */ + errno = 0; + if (mbtowc(&wc, HYPHEN_UTF8, strlen(HYPHEN_UTF8)) + != strlen(HYPHEN_UTF8) + || wc != (wchar_t) 0x2010) + { + is_utf8 = FALSE; + DEBUG_L(PerlIO_printf(Perl_debug_log, "\thyphen=U+%x\n", wc)); + DEBUG_L(PerlIO_printf(Perl_debug_log, + "\treturn from mbtowc=%d; errno=%d; ?UTF8 locale=0\n", + mbtowc(&wc, HYPHEN_UTF8, strlen(HYPHEN_UTF8)), errno)); + } + } +# endif + + /* If we switched LC_CTYPE, switch back */ + if (save_ctype_locale) { + setlocale(LC_CTYPE, save_ctype_locale); + Safefree(save_ctype_locale); + } + + return is_utf8; +# endif + } + + cant_use_nllanginfo: + +#endif /* HAS_NL_LANGINFO etc */ + + /* nl_langinfo not available or failed somehow. Look at the locale name to + * see if it matches qr/UTF -? 8 /ix */ + + final_pos = strlen(save_input_locale) - 1; + if (final_pos >= 3) { + char *name = save_input_locale; + + /* Find next 'U' or 'u' and look from there */ + while ((name += strcspn(name, "Uu") + 1) + <= save_input_locale + final_pos - 2) + { + if (toFOLD(*(name)) != 't' + || toFOLD(*(name + 1)) != 'f') + { + continue; + } + name += 2; + if (*(name) == '-') { + if ((name > save_input_locale + final_pos - 1)) { + break; + } + name++; + } + if (*(name) == '8') { + Safefree(save_input_locale); + DEBUG_L(PerlIO_printf(Perl_debug_log, + "Locale %s ends with UTF-8 in name\n", + save_input_locale)); + return TRUE; + } + } + DEBUG_L(PerlIO_printf(Perl_debug_log, + "Locale %s doesn't end with UTF-8 in name\n", + save_input_locale)); + } + +#ifdef WIN32 + /* http://msdn.microsoft.com/en-us/library/windows/desktop/dd317756.aspx */ + if (final_pos >= 4 + && *(save_input_locale + final_pos - 0) == '1' + && *(save_input_locale + final_pos - 1) == '0' + && *(save_input_locale + final_pos - 2) == '0' + && *(save_input_locale + final_pos - 3) == '5' + && *(save_input_locale + final_pos - 4) == '6') + { + DEBUG_L(PerlIO_printf(Perl_debug_log, + "Locale %s ends with 10056 in name, is UTF-8 locale\n", + save_input_locale)); + Safefree(save_input_locale); + return TRUE; + } +#endif + + /* Other common encodings are the ISO 8859 series, which aren't UTF-8 */ + if (instr(save_input_locale, "8859")) { + DEBUG_L(PerlIO_printf(Perl_debug_log, + "Locale %s has 8859 in name, not UTF-8 locale\n", + save_input_locale)); + Safefree(save_input_locale); + return FALSE; + } + +#ifdef HAS_LOCALECONV + +# ifdef USE_LOCALE_MONETARY + + /* Here, there is nothing in the locale name to indicate whether the locale + * is UTF-8 or not. This "name", the return of setlocale(), is actually + * defined to be opaque, so we can't really rely on the absence of various + * substrings in the name to indicate its UTF-8ness. Look at the locale's + * currency symbol. Often that will be in the native script, and if the + * symbol isn't in UTF-8, we know that the locale isn't. If it is + * non-ASCII UTF-8, we infer that the locale is too. + * To do this, like above for LC_CTYPE, we first set LC_MONETARY to the + * locale of the desired category, if it isn't that locale already */ + + { + char *save_monetary_locale = NULL; + bool illegal_utf8 = FALSE; + bool only_ascii = FALSE; + const struct lconv* const lc = localeconv(); + + if (category != LC_MONETARY) { + + save_monetary_locale = stdize_locale(savepv(setlocale(LC_MONETARY, + NULL))); + if (! save_monetary_locale) { + DEBUG_L(PerlIO_printf(Perl_debug_log, + "Could not find current locale for LC_MONETARY\n")); + goto cant_use_monetary; + } + + if (strNE(save_monetary_locale, save_input_locale)) { + if (! setlocale(LC_MONETARY, save_input_locale)) { + DEBUG_L(PerlIO_printf(Perl_debug_log, + "Could not change LC_MONETARY locale to %s\n", + save_input_locale)); + Safefree(save_monetary_locale); + goto cant_use_monetary; + } + } + } + + /* Here the current LC_MONETARY is set to the locale of the category + * whose information is desired. */ + + if (lc && lc->currency_symbol) { + if (! is_utf8_string((U8 *) lc->currency_symbol, 0)) { + DEBUG_L(PerlIO_printf(Perl_debug_log, + "Currency symbol for %s is not legal UTF-8\n", + save_input_locale)); + illegal_utf8 = TRUE; + } + else if (is_ascii_string((U8 *) lc->currency_symbol, 0)) { + DEBUG_L(PerlIO_printf(Perl_debug_log, "Currency symbol for %s contains only ASCII; can't use for determining if UTF-8 locale\n", save_input_locale)); + only_ascii = TRUE; + } + } + + /* If we changed it, restore LC_MONETARY to its original locale */ + if (save_monetary_locale) { + setlocale(LC_MONETARY, save_monetary_locale); + Safefree(save_monetary_locale); + } + + Safefree(save_input_locale); + + /* It isn't a UTF-8 locale if the symbol is not legal UTF-8; otherwise + * assume the locale is UTF-8 if and only if the symbol is non-ascii + * UTF-8. (We can't really tell if the locale is UTF-8 or not if the + * symbol is just a '$', so we err on the side of it not being UTF-8) + * */ + DEBUG_L(PerlIO_printf(Perl_debug_log, "\tis_utf8=%d\n", (illegal_utf8) + ? FALSE + : ! only_ascii)); + return (illegal_utf8) + ? FALSE + : ! only_ascii; + + } + cant_use_monetary: + +# endif /* USE_LOCALE_MONETARY */ +#endif /* HAS_LOCALECONV */ + +#if 0 && defined(HAS_STRERROR) && defined(USE_LOCALE_MESSAGES) + +/* This code is ifdefd out because it was found to not be necessary in testing + * on our dromedary test machine, which has over 700 locales. There, looking + * at just the currency symbol gave essentially the same results as doing this + * extra work. Executing this also caused segfaults in miniperl. I left it in + * so as to avoid rewriting it if real-world experience indicates that + * dromedary is an outlier. Essentially, instead of returning abpve if we + * haven't found illegal utf8, we continue on and examine all the strerror() + * messages on the platform for utf8ness. If all are ASCII, we still don't + * know the answer; but otherwise we have a pretty good indication of the + * utf8ness. The reason this doesn't necessarily help much is that the + * messages may not have been translated into the locale. The currency symbol + * is much more likely to have been translated. The code below would need to + * be altered somewhat to just be a continuation of testing the currency + * symbol. */ + int e; + unsigned int failures = 0, non_ascii = 0; + char *save_messages_locale = NULL; + + /* Like above for LC_CTYPE, we set LC_MESSAGES to the locale of the + * desired category, if it isn't that locale already */ + + if (category != LC_MESSAGES) { + + save_messages_locale = stdize_locale(savepv(setlocale(LC_MESSAGES, + NULL))); + if (! save_messages_locale) { + goto cant_use_messages; + } + + if (strEQ(save_messages_locale, save_input_locale)) { + Safefree(save_input_locale); + } + else if (! setlocale(LC_MESSAGES, save_input_locale)) { + Safefree(save_messages_locale); + goto cant_use_messages; + } + } + + /* Here the current LC_MESSAGES is set to the locale of the category + * whose information is desired. Look through all the messages */ + + for (e = 0; +#ifdef HAS_SYS_ERRLIST + e <= sys_nerr +#endif + ; e++) + { + const U8* const errmsg = (U8 *) Strerror(e) ; + if (!errmsg) + break; + if (! is_utf8_string(errmsg, 0)) { + failures++; + break; + } + else if (! is_ascii_string(errmsg, 0)) { + non_ascii++; + } + } + + /* And, if we changed it, restore LC_MESSAGES to its original locale */ + if (save_messages_locale) { + setlocale(LC_MESSAGES, save_messages_locale); + Safefree(save_messages_locale); + } + + /* Any non-UTF-8 message means not a UTF-8 locale; if all are valid, + * any non-ascii means it is one; otherwise we assume it isn't */ + return (failures) ? FALSE : non_ascii; + + } + cant_use_messages: + +#endif + + DEBUG_L(PerlIO_printf(Perl_debug_log, + "Assuming locale %s is not a UTF-8 locale\n", + save_input_locale)); + Safefree(save_input_locale); + return FALSE; +} + +#endif /* * Local variables: Index: gnu/usr.bin/perl/make_ext.pl =================================================================== RCS file: /mnt/memory/perl/importit/cvs/src/gnu/usr.bin/perl/make_ext.pl,v retrieving revision 1.1.1.4 diff -u -p -u -p -r1.1.1.4 make_ext.pl --- gnu/usr.bin/perl/make_ext.pl 24 Mar 2014 14:58:45 -0000 1.1.1.4 +++ gnu/usr.bin/perl/make_ext.pl 16 Nov 2014 03:22:24 -0000 @@ -2,6 +2,7 @@ use strict; use warnings; use Config; +use constant IS_CROSS => defined $Config::Config{usecrosscompile} ? 1 : 0; my $is_Win32 = $^O eq 'MSWin32'; my $is_VMS = $^O eq 'VMS'; @@ -43,8 +44,9 @@ my $ext_dirs_re = '(?:' . join('|', @ext # Mostly because they still not ported to specified platform. # # If any extensions are listed with a '+' char then only those -# extensions will be built, but only if they arent countermanded +# extensions will be built, but only if they aren't countermanded # by an '!ext' and are appropriate to the type of building being done. +# An extensions follows the format of Foo/Bar, which would be extension Foo::Bar # It may be deleted in a later release of perl so try to # avoid using it for other purposes. @@ -118,15 +120,13 @@ unless(defined $makecmd and $makecmd =~ # names, but neither did what it replaced. Once there is a use case that needs # it, please supply patches. Until then, I'm sticking to KISS my @make = split ' ', $1 || $Config{make} || $ENV{MAKE}; -# Using an array of 0 or 1 elements makes the subsequent code simpler. -my @run = $Config{run}; -@run = () if not defined $run[0] or $run[0] eq ''; if ($target eq '') { die "make_ext: no make target specified (eg all or clean)\n"; -} elsif ($target !~ /(?:^all|clean)$/) { - # for the time being we are strict about what make_ext is used for +} elsif ($target !~ /^(?:all|clean|distclean|realclean|veryclean)$/) { + # we are strict about what make_ext is used for because we emulate these + # targets for simple modules: die "$0: unknown make target '$target'\n"; } @@ -154,7 +154,7 @@ if ($is_Win32) { unless (-f "$pl2bat.bat") { my @args = ($perl, "-I$topdir\\lib", ("$pl2bat.pl") x 2); print "@args\n"; - system(@args) unless defined $::Cross::platform; + system(@args) unless IS_CROSS; } print "In $build"; @@ -230,6 +230,11 @@ foreach my $spec (@extspec) { # Try new style ext/Data-Dumper/ first my $copy = $spec; $copy =~ tr!/!-!; + + # List/Util.xs lives in Scalar-List-Utils, Cwd.xs lives in PathTools + $copy = 'Scalar-List-Utils' if $copy eq 'List-Util'; + $copy = 'PathTools' if $copy eq 'Cwd'; + foreach my $dir (@ext_dirs) { if (-d "$dir/$copy") { $ext_pathname = "$dir/$copy"; @@ -249,12 +254,12 @@ foreach my $spec (@extspec) { print "\tMaking $mname ($target)\n"; - build_extension($ext_pathname, $perl, $mname, + build_extension($ext_pathname, $perl, $mname, $target, [@pass_through, @{$extra_passthrough{$spec} || []}]); } sub build_extension { - my ($ext_dir, $perl, $mname, $pass_through) = @_; + my ($ext_dir, $perl, $mname, $target, $pass_through) = @_; unless (chdir "$ext_dir") { warn "Cannot cd to $ext_dir: $!"; @@ -298,13 +303,51 @@ sub build_extension { require ExtUtils::MM_Unix; defined (my $newv = parse_version MM $vmod) or last; if ($newv ne $oldv) { - 1 while unlink $makefile + close $mfh or die "close $makefile: $!"; + _unlink($makefile); + { + no warnings 'deprecated'; + goto NO_MAKEFILE; + } } } + + if (IS_CROSS) { + # If we're cross-compiling, it's possible that the host's + # Makefiles are around. + seek($mfh, 0, 0) or die "Cannot seek $makefile: $!"; + + my $cross_makefile; + while (<$mfh>) { + # XXX This might not be throughout enough. + # For example, it's possible to cause a false-positive + # if cross compiling on and for the Raspberry Pi, + # which is insane but plausible. + # False positives are really not troublesome, though; + # all they mean is that the module gets rebuilt. + if (/^CC = \Q$Config{cc}\E/) { + $cross_makefile = 1; + last; + } + } + + if (!$cross_makefile) { + print "Deleting non-Cross makefile\n"; + close $mfh or die "close $makefile: $!"; + _unlink($makefile); + } + } } if (!-f $makefile) { + NO_MAKEFILE: if (!-f 'Makefile.PL') { + unless (just_pm_to_blib($target, $ext_dir, $mname, $return_dir)) { + # No problems returned, so it has faked everything for us. :-) + chdir $return_dir || die "Cannot cd to $return_dir: $!"; + return; + } + print "\nCreating Makefile.PL in $ext_dir for $mname\n"; my ($fromname, $key, $value); if ($mname eq 'podlators') { @@ -323,6 +366,7 @@ sub build_extension { my $leafname = "$leaf.pm"; my $pathname = join '/', @dirs, $leafname; my @locations = ($leafname, $pathname, "lib/$pathname"); + unshift @locations, 'lib/IO/Compress/Base.pm' if $mname eq 'IO::Compress'; foreach (@locations) { if (-f $_) { $fromname = $_; @@ -402,20 +446,54 @@ EOM my $ftime = time - 4; utime $ftime, $ftime, 'Makefile.PL'; }; + } elsif ($mname =~ /\A(?:Carp + |ExtUtils::CBuilder + |Safe + |Search::Dict)\z/x) { + # An explicit list of dual-life extensions that have a Makefile.PL + # for CPAN, but we have verified can also be built using the fakery. + my ($problem) = just_pm_to_blib($target, $ext_dir, $mname, $return_dir); + # We really need to sanity test that we can fake it. + # Otherwise "skips" will go undetected, and the build slow down for + # everyone, defeating the purpose. + if (defined $problem) { + if (-d "$return_dir/.git") { + # Get the list of files that git isn't ignoring: + my @files = `git ls-files --cached --others --exclude-standard 2>/dev/null`; + # on error (eg no git) we get nothing, but that's not a + # problem. The goal is to see if git thinks that the problem + # file is interesting, by getting a positive match with + # something git told us about, and if so bail out: + foreach (@files) { + chomp; + # We really need to sanity test that we can fake it. + # The intent is that this should only fail because + # you've just added a file to the dual-life dist that + # we can't handle. In which case you should either + # 1) remove the dist from the regex a few lines above. + # or + # 2) add the file to regex of "safe" filenames earlier + # in this function, that starts with ChangeLog + die "FATAL - $0 has $mname in the list of simple extensions, but it now contains file '$problem' which we can't handle" + if $problem eq $_; + } + # There's an unexpected file, but it seems to be something + # that git will ignore. So fall through to the regular + # Makefile.PL handling code below, on the assumption that + # we won't get here for a clean build. + } + warn "WARNING - $0 is building $mname using EU::MM, as it found file '$problem'"; + } else { + # It faked everything for us. + chdir $return_dir || die "Cannot cd to $return_dir: $!"; + return; + } } - print "\nRunning Makefile.PL in $ext_dir\n"; - # Presumably this can be simplified - my @cross; - if (defined $::Cross::platform) { - # Inherited from win32/buildext.pl - @cross = "-MCross=$::Cross::platform"; - } elsif ($opts{cross}) { - # Inherited from make_ext.pl - @cross = '-MCross'; - } + # We are going to have to use Makefile.PL: + print "\nRunning Makefile.PL in $ext_dir\n"; - my @args = ("-I$lib_dir", @cross, 'Makefile.PL'); + my @args = ("-I$lib_dir", 'Makefile.PL'); if ($is_VMS) { my $libd = VMS::Filespec::vmspath($lib_dir); push @args, "INST_LIB=$libd", "INST_ARCHLIB=$libd"; @@ -425,8 +503,8 @@ EOM } push @args, @$pass_through; _quote_args(\@args) if $is_VMS; - print join(' ', @run, $perl, @args), "\n"; - my $code = system @run, $perl, @args; + print join(' ', $perl, @args), "\n"; + my $code = system $perl, @args; warn "$code from $ext_dir\'s Makefile.PL" if $code; # Right. The reason for this little hack is that we're sitting inside @@ -441,14 +519,8 @@ EOM # But this always used to be a problem with the old /bin/sh version of # this. if ($is_Unix) { - my $suffix = '.sh'; foreach my $clean_target ('realclean', 'veryclean') { - my $file = "$return_dir/$clean_target$suffix"; - open my $fh, '>>', $file or die "open $file: $!"; - # Quite possible that we're being run in parallel here. - # Can't use Fcntl this early to get the LOCK_EX - flock $fh, 2 or warn "flock $file: $!"; - print $fh <<"EOS"; + fallback_cleanup($return_dir, $clean_target, <<"EOS"); cd $ext_dir if test ! -f Makefile -a -f Makefile.old; then echo "Note: Using Makefile.old" @@ -461,7 +533,6 @@ else fi cd $return_dir EOS - close $fh or die "close $file: $!"; } } } @@ -482,11 +553,11 @@ EOS # Give makefile an opportunity to rewrite itself. # reassure users that life goes on... my @args = ('config', @$pass_through); - system(@run, @make, @args) and print "@run @make @args failed, continuing anyway...\n"; + system(@make, @args) and print "@make @args failed, continuing anyway...\n"; } my @targ = ($target, @$pass_through); - print "Making $target in $ext_dir\n@run @make @targ\n"; - my $code = system(@run, @make, @targ); + print "Making $target in $ext_dir\n@make @targ\n"; + my $code = system(@make, @targ); die "Unsuccessful make($ext_dir): code=$code" if $code != 0; chdir $return_dir || die "Cannot cd to $return_dir: $!"; @@ -502,4 +573,162 @@ sub _quote_args { } } @{$args} ; +} + +#guarentee that a file is deleted or die, void _unlink($filename) +#xxx replace with _unlink_or_rename from EU::Install? +sub _unlink { + 1 while unlink $_[0]; + my $err = $!; + die "Can't unlink $_[0]: $err" if -f $_[0]; +} + +# Figure out if this extension is simple enough that it would only use +# ExtUtils::MakeMaker's pm_to_blib target. If we're confident that it would, +# then do all the work ourselves (returning an empty list), else return the +# name of a file that we identified as beyond our ability to handle. +# +# While this is clearly quite a bit more work than just letting +# ExtUtils::MakeMaker do it, and effectively is some code duplication, the time +# savings are impressive. + +sub just_pm_to_blib { + my ($target, $ext_dir, $mname, $return_dir) = @_; + my ($has_lib, $has_top, $has_topdir); + my ($last) = $mname =~ /([^:]+)$/; + my ($first) = $mname =~ /^([^:]+)/; + + my $pm_to_blib = $is_VMS ? 'pm_to_blib.ts' : 'pm_to_blib'; + + foreach my $leaf (<*>) { + if (-d $leaf) { + $leaf =~ s/\.DIR\z//i + if $is_VMS; + next if $leaf =~ /\A(?:\.|\.\.|t|demo)\z/; + if ($leaf eq 'lib') { + ++$has_lib; + next; + } + if ($leaf eq $first) { + ++$has_topdir; + next; + } + } + return $leaf + unless -f _; + $leaf =~ s/\.\z// + if $is_VMS; + # Makefile.PL is "safe" to ignore because we will only be called for + # directories that hold a Makefile.PL if they are in the exception list. + next + if $leaf =~ /\A(ChangeLog + |Changes + |LICENSE + |Makefile\.PL + |MANIFEST + |META\.yml + |\Q$pm_to_blib\E + |README + |README\.patching + |README\.release + )\z/xi; # /i to deal with case munging systems. + if ($leaf eq "$last.pm") { + ++$has_top; + next; + } + return $leaf; + } + return 'no lib/' + unless $has_lib || $has_top; + die "Inconsistent module $mname has both lib/ and $first/" + if $has_lib && $has_topdir; + + print "\nRunning pm_to_blib for $ext_dir directly\n"; + + my %pm; + if ($has_top) { + my $to = $mname =~ s!::!/!gr; + $pm{"$last.pm"} = "../../lib/$to.pm"; + } + if ($has_lib || $has_topdir) { + # strictly ExtUtils::MakeMaker uses the pm_to_blib target to install + # .pm, pod and .pl files. We're just going to do it for .pm and .pod + # files, to avoid problems on case munging file systems. Specifically, + # _pm.PL which ExtUtils::MakeMaker should run munges to _PM.PL, and + # looks a lot like a regular foo.pl (ie FOO.PL) + my @found; + require File::Find; + unless (eval { + File::Find::find({ + no_chdir => 1, + wanted => sub { + return if -d $_; + # Bail out immediately with the problem file: + die \$_ + unless -f _; + die \$_ + unless /\A[^.]+\.(?:pm|pod)\z/i; + push @found, $_; + } + }, $has_lib ? 'lib' : $first); + 1; + }) { + # Problem files aren't really errors: + return ${$@} + if ref $@ eq 'SCALAR'; + # But anything else is: + die $@; + } + if ($has_lib) { + $pm{$_} = "../../$_" + foreach @found; + } else { + $pm{$_} = "../../lib/$_" + foreach @found; + } + } + # This is running under miniperl, so no autodie + if ($target eq 'all') { + require ExtUtils::Install; + ExtUtils::Install::pm_to_blib(\%pm, '../../lib/auto'); + open my $fh, '>', $pm_to_blib + or die "Can't open '$pm_to_blib': $!"; + print $fh "$0 has handled pm_to_blib directly\n"; + close $fh + or die "Can't close '$pm_to_blib': $!"; + if ($is_Unix) { + # Fake the fallback cleanup + my $fallback + = join '', map {s!^\.\./\.\./!!; "rm -f $_\n"} sort values %pm; + foreach my $clean_target ('realclean', 'veryclean') { + fallback_cleanup($return_dir, $clean_target, $fallback); + } + } + } else { + # A clean target. + # For now, make the targets behave the same way as ExtUtils::MakeMaker + # does + _unlink($pm_to_blib); + unless ($target eq 'clean') { + # but cheat a bit, by relying on the top level Makefile clean target + # to take out our directory lib/auto/... + # (which it has to deal with, as cpan/foo/bar creates + # lib/auto/foo/bar, but the EU::MM rule will only + # rmdir lib/auto/foo/bar, leaving lib/auto/foo + _unlink("../../$_") + foreach sort values %pm; + } + } + return; +} + +sub fallback_cleanup { + my ($dir, $clean_target, $contents) = @_; + my $file = "$dir/$clean_target.sh"; + open my $fh, '>>', $file or die "open $file: $!"; + # Quite possible that we're being run in parallel here. + # Can't use Fcntl this early to get the LOCK_EX + flock $fh, 2 or warn "flock $file: $!"; + print $fh $contents or die "print $file: $!"; + close $fh or die "close $file: $!"; } Index: gnu/usr.bin/perl/make_patchnum.pl =================================================================== RCS file: /mnt/memory/perl/importit/cvs/src/gnu/usr.bin/perl/make_patchnum.pl,v retrieving revision 1.1.1.4 diff -u -p -u -p -r1.1.1.4 make_patchnum.pl --- gnu/usr.bin/perl/make_patchnum.pl 24 Mar 2014 14:58:45 -0000 1.1.1.4 +++ gnu/usr.bin/perl/make_patchnum.pl 16 Nov 2014 03:22:24 -0000 @@ -178,7 +178,7 @@ git_unpushed='$unpushed_commit_list'"; $commit_title ||= "Commit id:"; } -# we extract the filename out of the warning header, so dont mess with that +# we extract the filename out of the warning header, so don't mess with that write_files(<<"EOF_HEADER", <<"EOF_CONFIG"); /************************************************************************** * WARNING: 'git_version.h' is automatically generated by make_patchnum.pl Index: gnu/usr.bin/perl/makedef.pl =================================================================== RCS file: /mnt/memory/perl/importit/cvs/src/gnu/usr.bin/perl/makedef.pl,v retrieving revision 1.8 diff -u -p -u -p -r1.8 makedef.pl --- gnu/usr.bin/perl/makedef.pl 24 Mar 2014 15:05:13 -0000 1.8 +++ gnu/usr.bin/perl/makedef.pl 16 Nov 2014 03:22:24 -0000 @@ -104,7 +104,7 @@ my %exportperlmalloc = my $exportperlmalloc = $ARGS{PLATFORM} eq 'os2'; -my $config_h = $ARGS{PLATFORM} eq 'wince' ? 'xconfig.h' : 'config.h'; +my $config_h = 'config.h'; open(CFG, '<', $config_h) || die "Cannot open $config_h: $!\n"; while () { $define{$1} = 1 if /^\s*\#\s*define\s+(MYMALLOC|MULTIPLICITY @@ -235,6 +235,12 @@ if ($ARGS{PLATFORM} ne 'vms') { } } +if ($ARGS{PLATFORM} ne 'win32') { + ++$skip{$_} foreach qw( + Perl_my_setlocale + ); +} + unless ($define{UNLINK_ALL_VERSIONS}) { ++$skip{Perl_unlnk}; } @@ -364,6 +370,7 @@ unless ($define{'USE_ITHREADS'}) { PL_stashpadix PL_stashpadmax Perl_alloccopstash + Perl_allocfilegv Perl_clone_params_del Perl_clone_params_new Perl_parser_dup @@ -540,6 +547,9 @@ if ($define{'PERL_GLOBAL_STRUCT'}) { ++$skip{$_} foreach qw(Perl_init_global_struct Perl_free_global_struct); } +++$skip{PL_op_exec_cnt} + unless $define{PERL_TRACE_OPS}; + # functions from *.sym files my @syms = qw(globvar.sym); @@ -627,93 +637,12 @@ if ($ARGS{PLATFORM} eq 'netware') { } if ($define{'USE_PERLIO'}) { - # Export the symols that make up the PerlIO abstraction, regardless + # Export the symbols that make up the PerlIO abstraction, regardless # of its implementation - read from a file push @syms, 'perlio.sym'; - # This part is then dependent on how the abstraction is implemented - if ($define{'USE_SFIO'}) { - # Old legacy non-stdio "PerlIO" - ++$skip{$_} foreach @layer_syms; - ++$skip{perlsio_binmode}; - # SFIO defines most of the PerlIO routines as macros - # So undo most of what $perlio_sym has just done - d'oh ! - # Perhaps it would be better to list the ones which do exist - # And emit them - ++$skip{$_} foreach qw( - PerlIO_canset_cnt - PerlIO_clearerr - PerlIO_close - PerlIO_eof - PerlIO_error - PerlIO_exportFILE - PerlIO_fast_gets - PerlIO_fdopen - PerlIO_fileno - PerlIO_findFILE - PerlIO_flush - PerlIO_get_base - PerlIO_get_bufsiz - PerlIO_get_cnt - PerlIO_get_ptr - PerlIO_getc - PerlIO_getname - PerlIO_has_base - PerlIO_has_cntptr - PerlIO_importFILE - PerlIO_open - PerlIO_printf - PerlIO_putc - PerlIO_puts - PerlIO_read - PerlIO_releaseFILE - PerlIO_reopen - PerlIO_rewind - PerlIO_seek - PerlIO_set_cnt - PerlIO_set_ptrcnt - PerlIO_setlinebuf - PerlIO_sprintf - PerlIO_stderr - PerlIO_stdin - PerlIO_stdout - PerlIO_stdoutf - PerlIO_tell - PerlIO_ungetc - PerlIO_vprintf - PerlIO_write - PerlIO_perlio - Perl_PerlIO_clearerr - Perl_PerlIO_close - Perl_PerlIO_eof - Perl_PerlIO_error - Perl_PerlIO_fileno - Perl_PerlIO_fill - Perl_PerlIO_flush - Perl_PerlIO_get_base - Perl_PerlIO_get_bufsiz - Perl_PerlIO_get_cnt - Perl_PerlIO_get_ptr - Perl_PerlIO_read - Perl_PerlIO_seek - Perl_PerlIO_set_cnt - Perl_PerlIO_set_ptrcnt - Perl_PerlIO_setlinebuf - Perl_PerlIO_stderr - Perl_PerlIO_stdin - Perl_PerlIO_stdout - Perl_PerlIO_tell - Perl_PerlIO_unread - Perl_PerlIO_write - PL_def_layerlist - PL_known_layers - PL_perlio - ); - } - else { - # PerlIO with layers - export implementation - try_symbols(@layer_syms, 'perlsio_binmode'); - } + # PerlIO with layers - export implementation + try_symbols(@layer_syms, 'perlsio_binmode'); } else { # -Uuseperlio # Skip the PerlIO layer symbols - although @@ -801,9 +730,7 @@ try_symbols(qw( PerlIO_getpos PerlIO_init PerlIO_setpos - PerlIO_sprintf PerlIO_tmpfile - PerlIO_vsprintf )); if ($ARGS{PLATFORM} eq 'win32') { Index: gnu/usr.bin/perl/makedepend.SH =================================================================== RCS file: /mnt/memory/perl/importit/cvs/src/gnu/usr.bin/perl/makedepend.SH,v retrieving revision 1.10 diff -u -p -u -p -r1.10 makedepend.SH --- gnu/usr.bin/perl/makedepend.SH 24 Mar 2014 15:05:13 -0000 1.10 +++ gnu/usr.bin/perl/makedepend.SH 16 Nov 2014 03:22:24 -0000 @@ -39,7 +39,7 @@ mkdir .depending # This script should be called with # sh ./makedepend MAKE=$(MAKE) case "$1" in - MAKE=*) eval $1 ;; + MAKE=*) eval $1; shift ;; esac export PATH || (echo "OOPS, this isn't sh. Desperation time. I will feed myself to sh."; sh \$0; kill \$\$) @@ -206,35 +206,12 @@ for file in `$cat .clist`; do -e 's|\.c\.c|.c|' $uwinfix .cout .cerr| \ $uniq | $sort | $uniq >> .deptmp fi - echo "$filebase\$(OBJ_EXT): cflags" >> .deptmp + echo "$filebase\$(OBJ_EXT): $@" >> .deptmp done $sed <$mf >$mf.new -e '1,/^# AUTOMATICALLY/!d' -$MAKE shlist || ($echo "Searching for .SH files..."; \ - $echo *.SH | $tr ' ' $trnl | $egrep -v '\*' >.shlist) - -# Now extract the dependencies on makedepend.SH and Makefile.SH -# (they should reside in the main Makefile): -rm -f .shlist.old -mv .shlist .shlist.old -$egrep -v '^makedepend\.SH' <.shlist.old >.shlist -rm -f .shlist.old -mv .shlist .shlist.old -$egrep -v '^Makefile\.SH' <.shlist.old >.shlist -rm -f .shlist.old -mv .shlist .shlist.old -$egrep -v '^perl_exp\.SH' <.shlist.old >.shlist -rm -f .shlist.old -mv .shlist .shlist.old -$egrep -v '^config_h\.SH' <.shlist.old >.shlist -rm .shlist.old - if $test -s .deptmp; then - for file in `cat .shlist`; do - $echo `$expr X$file : 'X\(.*\).SH'`: $file $TOP/config.sh \; \ - $sh $file >> .deptmp - done $echo "Updating $mf..." $echo "# If this runs make out of memory, delete /usr/include lines." \ >> $mf.new @@ -262,10 +239,6 @@ else $sed -f .hsed >> $mf.new <.deptmp $sed -n 's|h:#include "\(.*\)".*$|h: \1|p' | \ $sed -f .hsed >> $mf.new - for file in `$cat .shlist`; do - $echo `$expr X$file : 'X\(.*\).SH'`: $file $TOP/config.sh \; \ - $sh $file >> $mf.new - done fi $rm -f $mf.old $cp $mf $mf.old @@ -273,15 +246,9 @@ $rm -f $mf $cp $mf.new $mf $rm $mf.new $echo "# WARNING: Put nothing here or make depend will gobble it up!" >> $mf -$rm -rf .deptmp UU .shlist .clist .hlist .hsed .cout .cerr +$rm -rf .deptmp UU .clist .hlist .hsed .cout .cerr rmdir .depending !NO!SUBS! $eunicefix makedepend chmod +x makedepend -case `pwd` in -*SH) - $rm -f ../makedepend - ln makedepend ../makedepend - ;; -esac Index: gnu/usr.bin/perl/malloc.c =================================================================== RCS file: /mnt/memory/perl/importit/cvs/src/gnu/usr.bin/perl/malloc.c,v retrieving revision 1.14 diff -u -p -u -p -r1.14 malloc.c --- gnu/usr.bin/perl/malloc.c 24 Mar 2014 15:05:13 -0000 1.14 +++ gnu/usr.bin/perl/malloc.c 16 Nov 2014 03:22:24 -0000 @@ -755,16 +755,7 @@ static const char bucket_of[] = # define POW2_OPTIMIZE_SURPLUS(bucket) 0 #endif /* !TWO_POT_OPTIMIZE */ -#ifdef HAS_64K_LIMIT -# define BARK_64K_LIMIT(what,nbytes,size) \ - if (nbytes > 0xffff) { \ - PerlIO_printf(PerlIO_stderr(), \ - "%s too large: %lx\n", what, size); \ - my_exit(1); \ - } -#else /* !HAS_64K_LIMIT */ -# define BARK_64K_LIMIT(what,nbytes,size) -#endif /* !HAS_64K_LIMIT */ +#define BARK_64K_LIMIT(what,nbytes,size) #ifndef MIN_SBRK # define MIN_SBRK 2048 @@ -1212,12 +1203,16 @@ cmp_pat_4bytes(unsigned char *s, size_t # define FILLCHECK_DEADBEEF(s, n) ((void)0) #endif -int -S_ajust_size_and_find_bucket(size_t *nbytes_p) +STATIC int +S_adjust_size_and_find_bucket(size_t *nbytes_p) { - MEM_SIZE shiftr; + MEM_SIZE shiftr; int bucket; - size_t nbytes = *nbytes_p; + size_t nbytes; + + PERL_ARGS_ASSERT_ADJUST_SIZE_AND_FIND_BUCKET; + + nbytes = *nbytes_p; /* * Convert amount of memory requested into @@ -1273,7 +1268,7 @@ Perl_malloc(size_t nbytes) croak("%s", "panic: malloc"); #endif - bucket = S_ajust_size_and_find_bucket(&nbytes); + bucket = adjust_size_and_find_bucket(&nbytes); MALLOC_LOCK; /* * If nothing in hash bucket right now, @@ -2173,7 +2168,7 @@ Perl_malloced_size(void *p) MEM_SIZE Perl_malloc_good_size(size_t wanted) { - return BUCKET_SIZE_REAL(S_ajust_size_and_find_bucket(&wanted)); + return BUCKET_SIZE_REAL(adjust_size_and_find_bucket(&wanted)); } # ifdef BUCKETS_ROOT2 Index: gnu/usr.bin/perl/mathoms.c =================================================================== RCS file: /mnt/memory/perl/importit/cvs/src/gnu/usr.bin/perl/mathoms.c,v retrieving revision 1.1.1.5 diff -u -p -u -p -r1.1.1.5 mathoms.c --- gnu/usr.bin/perl/mathoms.c 24 Mar 2014 14:58:45 -0000 1.1.1.5 +++ gnu/usr.bin/perl/mathoms.c 16 Nov 2014 03:22:24 -0000 @@ -128,7 +128,7 @@ Perl_sv_unref(pTHX_ SV *sv) /* =for apidoc sv_taint -Taint an SV. Use C instead. +Taint an SV. Use C instead. =cut */ @@ -148,6 +148,8 @@ Perl_sv_taint(pTHX_ SV *sv) IV Perl_sv_2iv(pTHX_ SV *sv) { + PERL_ARGS_ASSERT_SV_2IV; + return sv_2iv_flags(sv, SV_GMAGIC); } @@ -158,6 +160,8 @@ Perl_sv_2iv(pTHX_ SV *sv) UV Perl_sv_2uv(pTHX_ SV *sv) { + PERL_ARGS_ASSERT_SV_2UV; + return sv_2uv_flags(sv, SV_GMAGIC); } @@ -179,13 +183,15 @@ Perl_sv_2nv(pTHX_ SV *sv) char * Perl_sv_2pv(pTHX_ SV *sv, STRLEN *lp) { + PERL_ARGS_ASSERT_SV_2PV; + return sv_2pv_flags(sv, lp, SV_GMAGIC); } /* =for apidoc sv_2pv_nolen -Like C, but doesn't return the length too. You should usually +Like C, but doesn't return the length too. You should usually use the macro wrapper C instead. =cut @@ -241,7 +247,7 @@ Perl_sv_2pvutf8_nolen(pTHX_ SV *sv) Undo various types of fakery on an SV: if the PV is a shared string, make a private copy; if we're a ref, stop refing; if we're a glob, downgrade to -an xpvmg. See also C. +an xpvmg. See also C. =cut */ @@ -326,7 +332,7 @@ Perl_sv_catsv_mg(pTHX_ SV *dsv, SV *ssv) =for apidoc sv_iv A private implementation of the C macro for compilers which can't -cope with complex macro expressions. Always use the macro instead. +cope with complex macro expressions. Always use the macro instead. =cut */ @@ -348,7 +354,7 @@ Perl_sv_iv(pTHX_ SV *sv) =for apidoc sv_uv A private implementation of the C macro for compilers which can't -cope with complex macro expressions. Always use the macro instead. +cope with complex macro expressions. Always use the macro instead. =cut */ @@ -370,7 +376,7 @@ Perl_sv_uv(pTHX_ SV *sv) =for apidoc sv_nv A private implementation of the C macro for compilers which can't -cope with complex macro expressions. Always use the macro instead. +cope with complex macro expressions. Always use the macro instead. =cut */ @@ -393,7 +399,7 @@ Use the C macro instead =for apidoc sv_pvn A private implementation of the C macro for compilers which can't -cope with complex macro expressions. Always use the macro instead. +cope with complex macro expressions. Always use the macro instead. =cut */ @@ -471,7 +477,7 @@ Use C instead. =for apidoc sv_pvbyten A private implementation of the C macro for compilers -which can't cope with complex macro expressions. Always use the macro +which can't cope with complex macro expressions. Always use the macro instead. =cut @@ -507,7 +513,7 @@ Use the C macro instead =for apidoc sv_pvutf8n A private implementation of the C macro for compilers -which can't cope with complex macro expressions. Always use the macro +which can't cope with complex macro expressions. Always use the macro instead. =cut @@ -538,6 +544,7 @@ int Perl_fprintf_nocontext(PerlIO *stream, const char *format, ...) { dTHXs; + int ret = 0; va_list(arglist); /* Easier to special case this here than in embed.pl. (Look at what it @@ -547,7 +554,9 @@ Perl_fprintf_nocontext(PerlIO *stream, c #endif va_start(arglist, format); - return PerlIO_vprintf(stream, format, arglist); + ret = PerlIO_vprintf(stream, format, arglist); + va_end(arglist); + return ret; } int @@ -555,13 +564,16 @@ Perl_printf_nocontext(const char *format { dTHX; va_list(arglist); + int ret = 0; #ifdef PERL_IMPLICIT_CONTEXT PERL_ARGS_ASSERT_PRINTF_NOCONTEXT; #endif va_start(arglist, format); - return PerlIO_vprintf(PerlIO_stdout(), format, arglist); + ret = PerlIO_vprintf(PerlIO_stdout(), format, arglist); + va_end(arglist); + return ret; } #if defined(HUGE_VAL) || (defined(USE_LONG_DOUBLE) && defined(HUGE_VALL)) @@ -704,14 +716,6 @@ Perl_init_i18nl14n(pTHX_ int printwarn) return init_i18nl10n(printwarn); } -U8 * -Perl_uvuni_to_utf8(pTHX_ U8 *d, UV uv) -{ - PERL_ARGS_ASSERT_UVUNI_TO_UTF8; - - return Perl_uvuni_to_utf8_flags(aTHX_ d, uv, 0); -} - bool Perl_is_utf8_string_loc(pTHX_ const U8 *s, STRLEN len, const U8 **ep) { @@ -836,9 +840,9 @@ Perl_sv_usepvn_mg(pTHX_ SV *sv, char *pt /* =for apidoc sv_usepvn -Tells an SV to use C to find its string value. Implemented by +Tells an SV to use C to find its string value. Implemented by calling C with C of 0, hence does not handle 'set' -magic. See C. +magic. See C. =cut */ @@ -854,8 +858,9 @@ Perl_sv_usepvn(pTHX_ SV *sv, char *ptr, /* =for apidoc unpack_str -The engine implementing unpack() Perl function. Note: parameters strbeg, new_s -and ocnt are not used. This call should not be used, use unpackstring instead. +The engine implementing unpack() Perl function. Note: parameters strbeg, +new_s and ocnt are not used. This call should not be used, use +unpackstring instead. =cut */ @@ -876,8 +881,9 @@ Perl_unpack_str(pTHX_ const char *pat, c /* =for apidoc pack_cat -The engine implementing pack() Perl function. Note: parameters next_in_list and -flags are not used. This call should not be used; use packlist instead. +The engine implementing pack() Perl function. Note: parameters +next_in_list and flags are not used. This call should not be used; use +packlist instead. =cut */ @@ -1143,12 +1149,12 @@ Perl_sv_2bool(pTHX_ SV *const sv) /* =for apidoc custom_op_name -Return the name for a given custom op. This was once used by the OP_NAME +Return the name for a given custom op. This was once used by the OP_NAME macro, but is no longer: it has only been kept for compatibility, and should not be used. =for apidoc custom_op_desc -Return the description of a given custom op. This was once used by the +Return the description of a given custom op. This was once used by the OP_DESC macro, but is no longer: it has only been kept for compatibility, and should not be used. @@ -1159,20 +1165,20 @@ const char* Perl_custom_op_name(pTHX_ const OP* o) { PERL_ARGS_ASSERT_CUSTOM_OP_NAME; - return XopENTRY(Perl_custom_op_xop(aTHX_ o), xop_name); + return XopENTRYCUSTOM(o, xop_name); } const char* Perl_custom_op_desc(pTHX_ const OP* o) { PERL_ARGS_ASSERT_CUSTOM_OP_DESC; - return XopENTRY(Perl_custom_op_xop(aTHX_ o), xop_desc); + return XopENTRYCUSTOM(o, xop_desc); } CV * Perl_newSUB(pTHX_ I32 floor, OP *o, OP *proto, OP *block) { - return Perl_newATTRSUB(aTHX_ floor, o, proto, NULL, block); + return newATTRSUB(floor, o, proto, NULL, block); } UV @@ -1180,7 +1186,7 @@ Perl_to_utf8_fold(pTHX_ const U8 *p, U8* { PERL_ARGS_ASSERT_TO_UTF8_FOLD; - return _to_utf8_fold_flags(p, ustrp, lenp, FOLD_FLAGS_FULL, NULL); + return _to_utf8_fold_flags(p, ustrp, lenp, FOLD_FLAGS_FULL); } UV @@ -1188,7 +1194,7 @@ Perl_to_utf8_lower(pTHX_ const U8 *p, U8 { PERL_ARGS_ASSERT_TO_UTF8_LOWER; - return _to_utf8_lower_flags(p, ustrp, lenp, FALSE, NULL); + return _to_utf8_lower_flags(p, ustrp, lenp, FALSE); } UV @@ -1196,7 +1202,7 @@ Perl_to_utf8_title(pTHX_ const U8 *p, U8 { PERL_ARGS_ASSERT_TO_UTF8_TITLE; - return _to_utf8_title_flags(p, ustrp, lenp, FALSE, NULL); + return _to_utf8_title_flags(p, ustrp, lenp, FALSE); } UV @@ -1204,13 +1210,422 @@ Perl_to_utf8_upper(pTHX_ const U8 *p, U8 { PERL_ARGS_ASSERT_TO_UTF8_UPPER; - return _to_utf8_upper_flags(p, ustrp, lenp, FALSE, NULL); + return _to_utf8_upper_flags(p, ustrp, lenp, FALSE); } SV * Perl_sv_mortalcopy(pTHX_ SV *const oldstr) { return Perl_sv_mortalcopy_flags(aTHX_ oldstr, SV_GMAGIC); +} + +UV /* Made into a function, so can be deprecated */ +NATIVE_TO_NEED(const UV enc, const UV ch) +{ + PERL_UNUSED_ARG(enc); + return ch; +} + +UV /* Made into a function, so can be deprecated */ +ASCII_TO_NEED(const UV enc, const UV ch) +{ + PERL_UNUSED_ARG(enc); + return ch; +} + +bool +Perl_is_uni_alnum(pTHX_ UV c) +{ + return isWORDCHAR_uni(c); +} + +bool +Perl_is_uni_alnumc(pTHX_ UV c) +{ + return isALNUM_uni(c); +} + +bool +Perl_is_uni_alpha(pTHX_ UV c) +{ + return isALPHA_uni(c); +} + +bool +Perl_is_uni_ascii(pTHX_ UV c) +{ + return isASCII_uni(c); +} + +bool +Perl_is_uni_blank(pTHX_ UV c) +{ + return isBLANK_uni(c); +} + +bool +Perl_is_uni_space(pTHX_ UV c) +{ + return isSPACE_uni(c); +} + +bool +Perl_is_uni_digit(pTHX_ UV c) +{ + return isDIGIT_uni(c); +} + +bool +Perl_is_uni_upper(pTHX_ UV c) +{ + return isUPPER_uni(c); +} + +bool +Perl_is_uni_lower(pTHX_ UV c) +{ + return isLOWER_uni(c); +} + +bool +Perl_is_uni_cntrl(pTHX_ UV c) +{ + return isCNTRL_L1(c); +} + +bool +Perl_is_uni_graph(pTHX_ UV c) +{ + return isGRAPH_uni(c); +} + +bool +Perl_is_uni_print(pTHX_ UV c) +{ + return isPRINT_uni(c); +} + +bool +Perl_is_uni_punct(pTHX_ UV c) +{ + return isPUNCT_uni(c); +} + +bool +Perl_is_uni_xdigit(pTHX_ UV c) +{ + return isXDIGIT_uni(c); +} + +bool +Perl_is_uni_alnum_lc(pTHX_ UV c) +{ + return isWORDCHAR_LC_uvchr(c); +} + +bool +Perl_is_uni_alnumc_lc(pTHX_ UV c) +{ + return isALPHANUMERIC_LC_uvchr(c); +} + +bool +Perl_is_uni_idfirst_lc(pTHX_ UV c) +{ + /* XXX Should probably be something that resolves to the old IDFIRST, but + * this function is deprecated, so not bothering */ + return isIDFIRST_LC_uvchr(c); +} + +bool +Perl_is_uni_alpha_lc(pTHX_ UV c) +{ + return isALPHA_LC_uvchr(c); +} + +bool +Perl_is_uni_ascii_lc(pTHX_ UV c) +{ + return isASCII_LC_uvchr(c); +} + +bool +Perl_is_uni_blank_lc(pTHX_ UV c) +{ + return isBLANK_LC_uvchr(c); +} + +bool +Perl_is_uni_space_lc(pTHX_ UV c) +{ + return isSPACE_LC_uvchr(c); +} + +bool +Perl_is_uni_digit_lc(pTHX_ UV c) +{ + return isDIGIT_LC_uvchr(c); +} + +bool +Perl_is_uni_upper_lc(pTHX_ UV c) +{ + return isUPPER_LC_uvchr(c); +} + +bool +Perl_is_uni_lower_lc(pTHX_ UV c) +{ + return isLOWER_LC_uvchr(c); +} + +bool +Perl_is_uni_cntrl_lc(pTHX_ UV c) +{ + return isCNTRL_LC_uvchr(c); +} + +bool +Perl_is_uni_graph_lc(pTHX_ UV c) +{ + return isGRAPH_LC_uvchr(c); +} + +bool +Perl_is_uni_print_lc(pTHX_ UV c) +{ + return isPRINT_LC_uvchr(c); +} + +bool +Perl_is_uni_punct_lc(pTHX_ UV c) +{ + return isPUNCT_LC_uvchr(c); +} + +bool +Perl_is_uni_xdigit_lc(pTHX_ UV c) +{ + return isXDIGIT_LC_uvchr(c); +} + +U32 +Perl_to_uni_upper_lc(pTHX_ U32 c) +{ + /* XXX returns only the first character -- do not use XXX */ + /* XXX no locale support yet */ + STRLEN len; + U8 tmpbuf[UTF8_MAXBYTES_CASE+1]; + return (U32)to_uni_upper(c, tmpbuf, &len); +} + +U32 +Perl_to_uni_title_lc(pTHX_ U32 c) +{ + /* XXX returns only the first character XXX -- do not use XXX */ + /* XXX no locale support yet */ + STRLEN len; + U8 tmpbuf[UTF8_MAXBYTES_CASE+1]; + return (U32)to_uni_title(c, tmpbuf, &len); +} + +U32 +Perl_to_uni_lower_lc(pTHX_ U32 c) +{ + /* XXX returns only the first character -- do not use XXX */ + /* XXX no locale support yet */ + STRLEN len; + U8 tmpbuf[UTF8_MAXBYTES_CASE+1]; + return (U32)to_uni_lower(c, tmpbuf, &len); +} + +bool +Perl_is_utf8_alnum(pTHX_ const U8 *p) +{ + dVAR; + + PERL_ARGS_ASSERT_IS_UTF8_ALNUM; + + /* NOTE: "IsWord", not "IsAlnum", since Alnum is a true + * descendant of isalnum(3), in other words, it doesn't + * contain the '_'. --jhi */ + return isWORDCHAR_utf8(p); +} + +bool +Perl_is_utf8_alnumc(pTHX_ const U8 *p) +{ + dVAR; + + PERL_ARGS_ASSERT_IS_UTF8_ALNUMC; + + return isALPHANUMERIC_utf8(p); +} + +bool +Perl_is_utf8_alpha(pTHX_ const U8 *p) +{ + dVAR; + + PERL_ARGS_ASSERT_IS_UTF8_ALPHA; + + return isALPHA_utf8(p); +} + +bool +Perl_is_utf8_ascii(pTHX_ const U8 *p) +{ + dVAR; + + PERL_ARGS_ASSERT_IS_UTF8_ASCII; + + return isASCII_utf8(p); +} + +bool +Perl_is_utf8_blank(pTHX_ const U8 *p) +{ + dVAR; + + PERL_ARGS_ASSERT_IS_UTF8_BLANK; + + return isBLANK_utf8(p); +} + +bool +Perl_is_utf8_space(pTHX_ const U8 *p) +{ + dVAR; + + PERL_ARGS_ASSERT_IS_UTF8_SPACE; + + return isSPACE_utf8(p); +} + +bool +Perl_is_utf8_perl_space(pTHX_ const U8 *p) +{ + dVAR; + + PERL_ARGS_ASSERT_IS_UTF8_PERL_SPACE; + + /* Only true if is an ASCII space-like character, and ASCII is invariant + * under utf8, so can just use the macro */ + return isSPACE_A(*p); +} + +bool +Perl_is_utf8_perl_word(pTHX_ const U8 *p) +{ + dVAR; + + PERL_ARGS_ASSERT_IS_UTF8_PERL_WORD; + + /* Only true if is an ASCII word character, and ASCII is invariant + * under utf8, so can just use the macro */ + return isWORDCHAR_A(*p); +} + +bool +Perl_is_utf8_digit(pTHX_ const U8 *p) +{ + dVAR; + + PERL_ARGS_ASSERT_IS_UTF8_DIGIT; + + return isDIGIT_utf8(p); +} + +bool +Perl_is_utf8_posix_digit(pTHX_ const U8 *p) +{ + dVAR; + + PERL_ARGS_ASSERT_IS_UTF8_POSIX_DIGIT; + + /* Only true if is an ASCII digit character, and ASCII is invariant + * under utf8, so can just use the macro */ + return isDIGIT_A(*p); +} + +bool +Perl_is_utf8_upper(pTHX_ const U8 *p) +{ + dVAR; + + PERL_ARGS_ASSERT_IS_UTF8_UPPER; + + return isUPPER_utf8(p); +} + +bool +Perl_is_utf8_lower(pTHX_ const U8 *p) +{ + dVAR; + + PERL_ARGS_ASSERT_IS_UTF8_LOWER; + + return isLOWER_utf8(p); +} + +bool +Perl_is_utf8_cntrl(pTHX_ const U8 *p) +{ + dVAR; + + PERL_ARGS_ASSERT_IS_UTF8_CNTRL; + + return isCNTRL_utf8(p); +} + +bool +Perl_is_utf8_graph(pTHX_ const U8 *p) +{ + dVAR; + + PERL_ARGS_ASSERT_IS_UTF8_GRAPH; + + return isGRAPH_utf8(p); +} + +bool +Perl_is_utf8_print(pTHX_ const U8 *p) +{ + dVAR; + + PERL_ARGS_ASSERT_IS_UTF8_PRINT; + + return isPRINT_utf8(p); +} + +bool +Perl_is_utf8_punct(pTHX_ const U8 *p) +{ + dVAR; + + PERL_ARGS_ASSERT_IS_UTF8_PUNCT; + + return isPUNCT_utf8(p); +} + +bool +Perl_is_utf8_xdigit(pTHX_ const U8 *p) +{ + dVAR; + + PERL_ARGS_ASSERT_IS_UTF8_XDIGIT; + + return isXDIGIT_utf8(p); +} + +bool +Perl_is_utf8_mark(pTHX_ const U8 *p) +{ + dVAR; + + PERL_ARGS_ASSERT_IS_UTF8_MARK; + + return _is_utf8_mark(p); } END_EXTERN_C Index: gnu/usr.bin/perl/mg.c =================================================================== RCS file: /mnt/memory/perl/importit/cvs/src/gnu/usr.bin/perl/mg.c,v retrieving revision 1.18 diff -u -p -u -p -r1.18 mg.c --- gnu/usr.bin/perl/mg.c 24 Mar 2014 15:05:13 -0000 1.18 +++ gnu/usr.bin/perl/mg.c 16 Nov 2014 03:22:24 -0000 @@ -21,17 +21,17 @@ "Magic" is special data attached to SV structures in order to give them "magical" properties. When any Perl code tries to read from, or assign to, an SV marked as magical, it calls the 'get' or 'set' function associated -with that SV's magic. A get is called prior to reading an SV, in order to +with that SV's magic. A get is called prior to reading an SV, in order to give it a chance to update its internal value (get on $. writes the line -number of the last read filehandle into to the SV's IV slot), while +number of the last read filehandle into the SV's IV slot), while set is called after an SV has been written to, in order to allow it to make use of its changed value (set on $/ copies the SV's new value to the PL_rs global variable). Magic is implemented as a linked list of MAGIC structures attached to the -SV. Each MAGIC struct holds the type of the magic, a pointer to an array +SV. Each MAGIC struct holds the type of the magic, a pointer to an array of functions that implement the get(), set(), length() etc functions, -plus space for some flags and pointers. For example, a tied variable has +plus space for some flags and pointers. For example, a tied variable has a MAGIC structure that contains a pointer to the object associated with the tie. @@ -90,13 +90,13 @@ struct magic_state { /* MGS is typedef'ed to struct magic_state in perl.h */ STATIC void -S_save_magic(pTHX_ I32 mgs_ix, SV *sv) +S_save_magic_flags(pTHX_ I32 mgs_ix, SV *sv, U32 flags) { dVAR; MGS* mgs; bool bumped = FALSE; - PERL_ARGS_ASSERT_SAVE_MAGIC; + PERL_ARGS_ASSERT_SAVE_MAGIC_FLAGS; assert(SvMAGICAL(sv)); @@ -116,16 +116,16 @@ S_save_magic(pTHX_ I32 mgs_ix, SV *sv) mgs = SSPTR(mgs_ix, MGS*); mgs->mgs_sv = sv; mgs->mgs_magical = SvMAGICAL(sv); - mgs->mgs_readonly = SvREADONLY(sv) && !SvIsCOW(sv); + mgs->mgs_readonly = SvREADONLY(sv) != 0; mgs->mgs_ss_ix = PL_savestack_ix; /* points after the saved destructor */ mgs->mgs_bumped = bumped; - SvMAGICAL_off(sv); - /* Turning READONLY off for a copy-on-write scalar (including shared - hash keys) is a bad idea. */ - if (!SvIsCOW(sv)) SvREADONLY_off(sv); + SvFLAGS(sv) &= ~flags; + SvREADONLY_off(sv); } +#define save_magic(a,b) save_magic_flags(a,b,SVs_GMG|SVs_SMG|SVs_RMG) + /* =for apidoc mg_magical @@ -163,7 +163,7 @@ Perl_mg_magical(pTHX_ SV *sv) =for apidoc mg_get Do magic before a value is retrieved from the SV. The type of SV must -be >= SVt_PVMG. See C. +be >= SVt_PVMG. See C. =cut */ @@ -263,7 +263,7 @@ Perl_mg_set(pTHX_ SV *sv) if (PL_localizing == 2 && sv == DEFSV) return 0; - save_magic(mgs_ix, sv); + save_magic_flags(mgs_ix, sv, SVs_GMG|SVs_SMG); /* leave SVs_RMG on */ for (mg = SvMAGIC(sv); mg; mg = nextmg) { const MGVTBL* vtbl = mg->mg_virtual; @@ -286,9 +286,7 @@ Perl_mg_set(pTHX_ SV *sv) /* =for apidoc mg_length -This function is deprecated. - -It reports on the SV's length in bytes, calling length magic if available, +Reports on the SV's length in bytes, calling length magic if available, but does not set the UTF8 flag on the sv. It will fall back to 'get' magic if there is no 'length' magic, but with no indication as to whether it called 'get' magic. It assumes the sv is a PVMG or @@ -397,6 +395,8 @@ S_mg_findext_flags(pTHX_ const SV *sv, i if (sv) { MAGIC *mg; + assert(!(SvTYPE(sv) == SVt_PVAV && AvPAD_NAMELIST(sv))); + for (mg = SvMAGIC(sv); mg; mg = mg->mg_moremagic) { if (mg->mg_type == type && (!flags || mg->mg_virtual == vtbl)) { return mg; @@ -436,6 +436,21 @@ Perl_mg_findext(pTHX_ const SV *sv, int return S_mg_findext_flags(aTHX_ sv, type, vtbl, 1); } +MAGIC * +Perl_mg_find_mglob(pTHX_ SV *sv) +{ + PERL_ARGS_ASSERT_MG_FIND_MGLOB; + if (SvTYPE(sv) == SVt_PVLV && LvTYPE(sv) == 'y') { + /* This sv is only a delegate. //g magic must be attached to + its target. */ + vivify_defelem(sv); + sv = LvTARG(sv); + } + if (SvTYPE(sv) >= SVt_PVMG && SvMAGIC(sv)) + return S_mg_findext_flags(aTHX_ sv, PERL_MAGIC_regex_global, 0, 0); + return NULL; +} + /* =for apidoc mg_copy @@ -478,7 +493,8 @@ Perl_mg_copy(pTHX_ SV *sv, SV *nsv, cons =for apidoc mg_localize Copy some of the magic from an existing SV to new localized version of that -SV. Container magic (eg %ENV, $1, tie) gets copied, value magic doesn't (eg +SV. Container magic (eg %ENV, $1, tie) +gets copied, value magic doesn't (eg taint, pos). If setmagic is false then no set magic will be called on the new (empty) SV. @@ -511,7 +527,7 @@ Perl_mg_localize(pTHX_ SV *sv, SV *nsv, mg->mg_ptr, mg->mg_len); /* container types should remain read-only across localization */ - if (!SvIsCOW(sv)) SvFLAGS(nsv) |= SvREADONLY(sv); + SvFLAGS(nsv) |= SvREADONLY(sv); } if (SvTYPE(nsv) >= SVt_PVMG && SvMAGIC(nsv)) { @@ -646,21 +662,21 @@ Perl_magic_regdatum_get(pTHX_ SV *sv, MA const REGEXP * const rx = PM_GETRE(PL_curpm); if (rx) { const I32 paren = mg->mg_len; - I32 s; - I32 t; + SSize_t s; + SSize_t t; if (paren < 0) return 0; if (paren <= (I32)RX_NPARENS(rx) && (s = RX_OFFS(rx)[paren].start) != -1 && (t = RX_OFFS(rx)[paren].end) != -1) { - I32 i; + SSize_t i; if (mg->mg_obj) /* @+ */ i = t; else /* @- */ i = s; - if (i > 0 && RX_MATCH_UTF8(rx)) { + if (RX_MATCH_UTF8(rx)) { const char * const b = RX_SUBBEG(rx); if (b) i = RX_SUBCOFFSET(rx) + @@ -668,10 +684,12 @@ Perl_magic_regdatum_get(pTHX_ SV *sv, MA (U8*)(b-RX_SUBOFFSET(rx)+i)); } - sv_setiv(sv, i); + sv_setuv(sv, i); + return 0; } } } + sv_setsv(sv, NULL); return 0; } @@ -722,6 +740,47 @@ Perl_emulate_cop_io(pTHX_ const COP *con } } +STATIC void +S_fixup_errno_string(pTHX_ SV* sv) +{ + /* Do what is necessary to fixup the non-empty string in 'sv' for return to + * Perl space. */ + + PERL_ARGS_ASSERT_FIXUP_ERRNO_STRING; + + assert(SvOK(sv)); + + if(strEQ(SvPVX(sv), "")) { + sv_catpv(sv, UNKNOWN_ERRNO_MSG); + } +#if 0 + /* This is disabled to get v5.20 out the door. It means that $! behaves as + * if in the scope of both 'use locale' and 'use bytes'. This can cause + * mixed encodings and double utf8 upgrading, See towards the end of the + * thread for [perl #119499] */ + else { + + /* In some locales the error string may come back as UTF-8, in which + * case we should turn on that flag. This didn't use to happen, and to + * avoid any possible backward compatibility issues, we don't turn on + * the flag unless we have to. So the flag stays off for an entirely + * ASCII string. We assume that if the string looks like UTF-8, it + * really is UTF-8: "text in any other encoding that uses bytes with + * the high bit set is extremely unlikely to pass a UTF-8 validity + * test" (http://en.wikipedia.org/wiki/Charset_detection). There is a + * potential that we will get it wrong however, especially on short + * error message text. (If it turns out to be necessary, we could also + * keep track if the current LC_MESSAGES locale is UTF-8) */ + if (! IN_BYTES /* respect 'use bytes' */ + && ! is_ascii_string((U8*) SvPVX_const(sv), SvCUR(sv)) + && is_utf8_string((U8*) SvPVX_const(sv), SvCUR(sv))) + { + SvUTF8_on(sv); + } + } +#endif +} + #ifdef VMS #include #include @@ -735,10 +794,22 @@ Perl_magic_get(pTHX_ SV *sv, MAGIC *mg) const char *s = NULL; REGEXP *rx; const char * const remaining = mg->mg_ptr + 1; - const char nextchar = *remaining; + char nextchar; PERL_ARGS_ASSERT_MAGIC_GET; + if (!mg->mg_ptr) { + paren = mg->mg_len; + if (PL_curpm && (rx = PM_GETRE(PL_curpm))) { + do_numbuf_fetch: + CALLREG_NUMBUF_FETCH(rx,paren,sv); + } else { + sv_setsv(sv,&PL_sv_undef); + } + return 0; + } + + nextchar = *remaining; switch (*mg->mg_ptr) { case '\001': /* ^A */ if (SvOK(PL_bodytarget)) sv_copypv(sv, PL_bodytarget); @@ -759,55 +830,93 @@ Perl_magic_get(pTHX_ SV *sv, MAGIC *mg) sv_setiv(sv, (IV)(PL_debug & DEBUG_MASK)); break; case '\005': /* ^E */ - if (nextchar == '\0') { -#if defined(VMS) - { - char msg[255]; - $DESCRIPTOR(msgdsc,msg); - sv_setnv(sv,(NV) vaxc$errno); - if (sys$getmsg(vaxc$errno,&msgdsc.dsc$w_length,&msgdsc,0,0) & 1) - sv_setpvn(sv,msgdsc.dsc$a_pointer,msgdsc.dsc$w_length); - else - sv_setpvs(sv,""); - } + if (nextchar != '\0') { + if (strEQ(remaining, "NCODING")) + sv_setsv(sv, PL_encoding); + break; + } + +#if defined(VMS) || defined(OS2) || defined(WIN32) +# if defined(VMS) + { + char msg[255]; + $DESCRIPTOR(msgdsc,msg); + sv_setnv(sv,(NV) vaxc$errno); + if (sys$getmsg(vaxc$errno,&msgdsc.dsc$w_length,&msgdsc,0,0) & 1) + sv_setpvn(sv,msgdsc.dsc$a_pointer,msgdsc.dsc$w_length); + else + sv_setpvs(sv,""); + } #elif defined(OS2) - if (!(_emx_env & 0x200)) { /* Under DOS */ - sv_setnv(sv, (NV)errno); - sv_setpv(sv, errno ? Strerror(errno) : ""); - } else { - if (errno != errno_isOS2) { - const int tmp = _syserrno(); - if (tmp) /* 2nd call to _syserrno() makes it 0 */ - Perl_rc = tmp; - } - sv_setnv(sv, (NV)Perl_rc); - sv_setpv(sv, os2error(Perl_rc)); - } -#elif defined(WIN32) - { - const DWORD dwErr = GetLastError(); - sv_setnv(sv, (NV)dwErr); - if (dwErr) { - PerlProc_GetOSError(sv, dwErr); - } - else - sv_setpvs(sv, ""); - SetLastError(dwErr); - } -#else - { - dSAVE_ERRNO; - sv_setnv(sv, (NV)errno); - sv_setpv(sv, errno ? Strerror(errno) : ""); - RESTORE_ERRNO; - } + if (!(_emx_env & 0x200)) { /* Under DOS */ + sv_setnv(sv, (NV)errno); + sv_setpv(sv, errno ? Strerror(errno) : ""); + } else { + if (errno != errno_isOS2) { + const int tmp = _syserrno(); + if (tmp) /* 2nd call to _syserrno() makes it 0 */ + Perl_rc = tmp; + } + sv_setnv(sv, (NV)Perl_rc); + sv_setpv(sv, os2error(Perl_rc)); + } + if (SvOK(sv) && strNE(SvPVX(sv), "")) { + fixup_errno_string(sv); + } +# elif defined(WIN32) + { + const DWORD dwErr = GetLastError(); + sv_setnv(sv, (NV)dwErr); + if (dwErr) { + PerlProc_GetOSError(sv, dwErr); + fixup_errno_string(sv); + } + else + sv_setpvs(sv, ""); + SetLastError(dwErr); + } +# else +# error Missing code for platform +# endif + SvRTRIM(sv); + SvNOK_on(sv); /* what a wonderful hack! */ + break; +#endif /* End of platforms with special handling for $^E; others just fall + through to $! */ + + case '!': + { + dSAVE_ERRNO; +#ifdef VMS + sv_setnv(sv, (NV)((errno == EVMSERR) ? vaxc$errno : errno)); +#else + sv_setnv(sv, (NV)errno); #endif - SvRTRIM(sv); - SvNOK_on(sv); /* what a wonderful hack! */ - } - else if (strEQ(remaining, "NCODING")) - sv_setsv(sv, PL_encoding); - break; +#ifdef OS2 + if (errno == errno_isOS2 || errno == errno_isOS2_set) + sv_setpv(sv, os2error(Perl_rc)); + else +#endif + if (! errno) { + sv_setpvs(sv, ""); + } + else { + + /* Strerror can return NULL on some platforms, which will + * result in 'sv' not being considered SvOK. The SvNOK_on() + * below will cause just the number part to be valid */ + sv_setpv(sv, Strerror(errno)); + if (SvOK(sv)) { + fixup_errno_string(sv); + } + } + RESTORE_ERRNO; + } + + SvRTRIM(sv); + SvNOK_on(sv); /* what a wonderful hack! */ + break; + case '\006': /* ^F */ sv_setiv(sv, (IV)PL_maxsysfd); break; @@ -847,19 +956,10 @@ Perl_magic_get(pTHX_ SV *sv, MAGIC *mg) } break; case '\020': - if (nextchar == '\0') { /* ^P */ - sv_setiv(sv, (IV)PL_perldb); - } else if (strEQ(remaining, "REMATCH")) { /* $^PREMATCH */ - - paren = RX_BUFF_IDX_CARET_PREMATCH; - goto do_numbuf_fetch; - } else if (strEQ(remaining, "OSTMATCH")) { /* $^POSTMATCH */ - paren = RX_BUFF_IDX_CARET_POSTMATCH; - goto do_numbuf_fetch; - } + sv_setiv(sv, (IV)PL_perldb); break; case '\023': /* ^S */ - if (nextchar == '\0') { + { if (PL_parser && PL_parser->lex_state != LEX_NOTPARSING) SvOK_off(sv); else if (PL_in_eval) @@ -916,26 +1016,6 @@ Perl_magic_get(pTHX_ SV *sv, MAGIC *mg) } } break; - case '\015': /* $^MATCH */ - if (strEQ(remaining, "ATCH")) { - paren = RX_BUFF_IDX_CARET_FULLMATCH; - goto do_numbuf_fetch; - } - - case '1': case '2': case '3': case '4': - case '5': case '6': case '7': case '8': case '9': case '&': - /* - * Pre-threads, this was paren = atoi(GvENAME((const GV *)mg->mg_obj)); - * XXX Does the new way break anything? - */ - paren = atoi(mg->mg_ptr); /* $& is in [0] */ - do_numbuf_fetch: - if (PL_curpm && (rx = PM_GETRE(PL_curpm))) { - CALLREG_NUMBUF_FETCH(rx,paren,sv); - break; - } - sv_setsv(sv,&PL_sv_undef); - break; case '+': if (PL_curpm && (rx = PM_GETRE(PL_curpm))) { paren = RX_LASTPAREN(rx); @@ -952,12 +1032,6 @@ Perl_magic_get(pTHX_ SV *sv, MAGIC *mg) } sv_setsv(sv,&PL_sv_undef); break; - case '`': - paren = RX_BUFF_IDX_PREMATCH; - goto do_numbuf_fetch; - case '\'': - paren = RX_BUFF_IDX_POSTMATCH; - goto do_numbuf_fetch; case '.': if (GvIO(PL_last_in_gv)) { sv_setiv(sv, (IV)IoLINES(GvIOp(PL_last_in_gv))); @@ -1031,38 +1105,17 @@ Perl_magic_get(pTHX_ SV *sv, MAGIC *mg) /* else a value has been assigned manually, so do nothing */ } break; - - case '!': - { - dSAVE_ERRNO; -#ifdef VMS - sv_setnv(sv, (NV)((errno == EVMSERR) ? vaxc$errno : errno)); -#else - sv_setnv(sv, (NV)errno); -#endif -#ifdef OS2 - if (errno == errno_isOS2 || errno == errno_isOS2_set) - sv_setpv(sv, os2error(Perl_rc)); - else -#endif - sv_setpv(sv, errno ? Strerror(errno) : ""); - RESTORE_ERRNO; - } - - SvRTRIM(sv); - SvNOK_on(sv); /* what a wonderful hack! */ - break; case '<': - sv_setiv(sv, (IV)PerlProc_getuid()); + sv_setuid(sv, PerlProc_getuid()); break; case '>': - sv_setiv(sv, (IV)PerlProc_geteuid()); + sv_setuid(sv, PerlProc_geteuid()); break; case '(': - sv_setiv(sv, (IV)PerlProc_getgid()); + sv_setgid(sv, PerlProc_getgid()); goto add_groups; case ')': - sv_setiv(sv, (IV)PerlProc_getegid()); + sv_setgid(sv, PerlProc_getegid()); add_groups: #ifdef HAS_GETGROUPS { @@ -1706,7 +1759,7 @@ Returns the SV (if any) returned by the */ SV* -Perl_magic_methcall(pTHX_ SV *sv, const MAGIC *mg, const char *meth, U32 flags, +Perl_magic_methcall(pTHX_ SV *sv, const MAGIC *mg, SV *meth, U32 flags, U32 argc, ...) { dVAR; @@ -1747,10 +1800,10 @@ Perl_magic_methcall(pTHX_ SV *sv, const } PUTBACK; if (flags & G_DISCARD) { - call_method(meth, G_SCALAR|G_DISCARD); + call_sv(meth, G_SCALAR|G_DISCARD|G_METHOD_NAMED); } else { - if (call_method(meth, G_SCALAR)) + if (call_sv(meth, G_SCALAR|G_METHOD_NAMED)) ret = *PL_stack_sp--; } POPSTACK; @@ -1760,11 +1813,10 @@ Perl_magic_methcall(pTHX_ SV *sv, const return ret; } - /* wrapper for magic_methcall that creates the first arg */ STATIC SV* -S_magic_methcall1(pTHX_ SV *sv, const MAGIC *mg, const char *meth, U32 flags, +S_magic_methcall1(pTHX_ SV *sv, const MAGIC *mg, SV *meth, U32 flags, int n, SV *val) { dVAR; @@ -1790,7 +1842,7 @@ S_magic_methcall1(pTHX_ SV *sv, const MA } STATIC int -S_magic_methpack(pTHX_ SV *sv, const MAGIC *mg, const char *meth) +S_magic_methpack(pTHX_ SV *sv, const MAGIC *mg, SV *meth) { dVAR; SV* ret; @@ -1810,7 +1862,7 @@ Perl_magic_getpack(pTHX_ SV *sv, MAGIC * if (mg->mg_type == PERL_MAGIC_tiedelem) mg->mg_flags |= MGf_GSKIP; - magic_methpack(sv,mg,"FETCH"); + magic_methpack(sv,mg,SV_CONST(FETCH)); return 0; } @@ -1842,7 +1894,7 @@ Perl_magic_setpack(pTHX_ SV *sv, MAGIC * else val = sv; - magic_methcall1(sv, mg, "STORE", G_DISCARD, 2, val); + magic_methcall1(sv, mg, SV_CONST(STORE), G_DISCARD, 2, val); return 0; } @@ -1852,7 +1904,7 @@ Perl_magic_clearpack(pTHX_ SV *sv, MAGIC PERL_ARGS_ASSERT_MAGIC_CLEARPACK; if (mg->mg_type == PERL_MAGIC_tiedscalar) return 0; - return magic_methpack(sv,mg,"DELETE"); + return magic_methpack(sv,mg,SV_CONST(DELETE)); } @@ -1865,7 +1917,7 @@ Perl_magic_sizepack(pTHX_ SV *sv, MAGIC PERL_ARGS_ASSERT_MAGIC_SIZEPACK; - retsv = magic_methcall1(sv, mg, "FETCHSIZE", 0, 1, NULL); + retsv = magic_methcall1(sv, mg, SV_CONST(FETCHSIZE), 0, 1, NULL); if (retsv) { retval = SvIV(retsv)-1; if (retval < -1) @@ -1881,7 +1933,7 @@ Perl_magic_wipepack(pTHX_ SV *sv, MAGIC PERL_ARGS_ASSERT_MAGIC_WIPEPACK; - Perl_magic_methcall(aTHX_ sv, mg, "CLEAR", G_DISCARD, 0); + Perl_magic_methcall(aTHX_ sv, mg, SV_CONST(CLEAR), G_DISCARD, 0); return 0; } @@ -1893,8 +1945,8 @@ Perl_magic_nextpack(pTHX_ SV *sv, MAGIC PERL_ARGS_ASSERT_MAGIC_NEXTPACK; - ret = SvOK(key) ? Perl_magic_methcall(aTHX_ sv, mg, "NEXTKEY", 0, 1, key) - : Perl_magic_methcall(aTHX_ sv, mg, "FIRSTKEY", 0, 0); + ret = SvOK(key) ? Perl_magic_methcall(aTHX_ sv, mg, SV_CONST(NEXTKEY), 0, 1, key) + : Perl_magic_methcall(aTHX_ sv, mg, SV_CONST(FIRSTKEY), 0, 0); if (ret) sv_setsv(key,ret); return 0; @@ -1905,7 +1957,7 @@ Perl_magic_existspack(pTHX_ SV *sv, cons { PERL_ARGS_ASSERT_MAGIC_EXISTSPACK; - return magic_methpack(sv,mg,"EXISTS"); + return magic_methpack(sv,mg,SV_CONST(EXISTS)); } SV * @@ -1931,7 +1983,7 @@ Perl_magic_scalarpack(pTHX_ HV *hv, MAGI } /* there is a SCALAR method that we can call */ - retval = Perl_magic_methcall(aTHX_ MUTABLE_SV(hv), mg, "SCALAR", 0, 0); + retval = Perl_magic_methcall(aTHX_ MUTABLE_SV(hv), mg, SV_CONST(SCALAR), 0, 0); if (!retval) retval = &PL_sv_undef; return retval; @@ -1941,13 +1993,21 @@ int Perl_magic_setdbline(pTHX_ SV *sv, MAGIC *mg) { dVAR; - GV * const gv = PL_DBline; - const I32 i = SvTRUE(sv); - SV ** const svp = av_fetch(GvAV(gv), - atoi(MgPV_nolen_const(mg)), FALSE); + SV **svp; PERL_ARGS_ASSERT_MAGIC_SETDBLINE; + /* The magic ptr/len for the debugger's hash should always be an SV. */ + if (UNLIKELY(mg->mg_len != HEf_SVKEY)) { + Perl_croak(aTHX_ "panic: magic_setdbline len=%"IVdf", ptr='%s'", + (IV)mg->mg_len, mg->mg_ptr); + } + + /* Use sv_2iv instead of SvIV() as the former generates smaller code, and + setting/clearing debugger breakpoints is not a hot path. */ + svp = av_fetch(MUTABLE_AV(mg->mg_obj), + sv_2iv(MUTABLE_SV((mg)->mg_ptr)), FALSE); + if (svp && SvIOKp(*svp)) { OP * const o = INT2PTR(OP*,SvIVX(*svp)); if (o) { @@ -1955,7 +2015,7 @@ Perl_magic_setdbline(pTHX_ SV *sv, MAGIC Slab_to_rw(OpSLAB(o)); #endif /* set or clear breakpoint in the relevant control op */ - if (i) + if (SvTRUE(sv)) o->op_flags |= OPf_SPECIAL; else o->op_flags &= ~OPf_SPECIAL; @@ -1978,7 +2038,7 @@ Perl_magic_getarylen(pTHX_ SV *sv, const if (obj) { sv_setiv(sv, AvFILL(obj)); } else { - SvOK_off(sv); + sv_setsv(sv, NULL); } return 0; } @@ -2049,21 +2109,19 @@ Perl_magic_getpos(pTHX_ SV *sv, MAGIC *m { dVAR; SV* const lsv = LvTARG(sv); + MAGIC * const found = mg_find_mglob(lsv); PERL_ARGS_ASSERT_MAGIC_GETPOS; PERL_UNUSED_ARG(mg); - if (SvTYPE(lsv) >= SVt_PVMG && SvMAGIC(lsv)) { - MAGIC * const found = mg_find(lsv, PERL_MAGIC_regex_global); - if (found && found->mg_len >= 0) { - I32 i = found->mg_len; - if (DO_UTF8(lsv)) - sv_pos_b2u(lsv, &i); - sv_setiv(sv, i); + if (found && found->mg_len != -1) { + STRLEN i = found->mg_len; + if (found->mg_flags & MGf_BYTES && DO_UTF8(lsv)) + i = sv_pos_b2u_flags(lsv, i, SV_GMAGIC|SV_CONST_RETURN); + sv_setuv(sv, i); return 0; - } } - SvOK_off(sv); + sv_setsv(sv,NULL); return 0; } @@ -2081,19 +2139,11 @@ Perl_magic_setpos(pTHX_ SV *sv, MAGIC *m PERL_ARGS_ASSERT_MAGIC_SETPOS; PERL_UNUSED_ARG(mg); - if (SvTYPE(lsv) >= SVt_PVMG && SvMAGIC(lsv)) - found = mg_find(lsv, PERL_MAGIC_regex_global); - else - found = NULL; + found = mg_find_mglob(lsv); if (!found) { if (!SvOK(sv)) return 0; -#ifdef PERL_OLD_COPY_ON_WRITE - if (SvIsCOW(lsv)) - sv_force_normal_flags(lsv, 0); -#endif - found = sv_magicext(lsv, NULL, PERL_MAGIC_regex_global, &PL_vtbl_mglob, - NULL, 0); + found = sv_magicext_mglob(lsv); } else if (!SvOK(sv)) { found->mg_len = -1; @@ -2117,12 +2167,8 @@ Perl_magic_setpos(pTHX_ SV *sv, MAGIC *m else if (pos > (SSize_t)len) pos = len; - if (ulen) { - pos = sv_or_pv_pos_u2b(lsv, s, pos, 0); - } - found->mg_len = pos; - found->mg_flags &= ~MGf_MINMATCH; + found->mg_flags &= ~(MGf_MINMATCH|MGf_BYTES); return 0; } @@ -2252,10 +2298,7 @@ Perl_magic_getvec(pTHX_ SV *sv, MAGIC *m PERL_ARGS_ASSERT_MAGIC_GETVEC; PERL_UNUSED_ARG(mg); - if (lsv) - sv_setuv(sv, do_vecget(lsv, LvTARGOFF(sv), LvTARGLEN(sv))); - else - SvOK_off(sv); + sv_setuv(sv, do_vecget(lsv, LvTARGOFF(sv), LvTARGLEN(sv))); return 0; } @@ -2269,14 +2312,14 @@ Perl_magic_setvec(pTHX_ SV *sv, MAGIC *m return 0; } -int -Perl_magic_getdefelem(pTHX_ SV *sv, MAGIC *mg) +SV * +Perl_defelem_target(pTHX_ SV *sv, MAGIC *mg) { dVAR; SV *targ = NULL; - - PERL_ARGS_ASSERT_MAGIC_GETDEFELEM; - + PERL_ARGS_ASSERT_DEFELEM_TARGET; + if (!mg) mg = mg_find(sv, PERL_MAGIC_defelem); + assert(mg); if (LvTARGLEN(sv)) { if (mg->mg_obj) { SV * const ahv = LvTARG(sv); @@ -2284,10 +2327,17 @@ Perl_magic_getdefelem(pTHX_ SV *sv, MAGI if (he) targ = HeVAL(he); } - else { + else if (LvSTARGOFF(sv) >= 0) { AV *const av = MUTABLE_AV(LvTARG(sv)); - if ((I32)LvTARGOFF(sv) <= AvFILL(av)) - targ = AvARRAY(av)[LvTARGOFF(sv)]; + if (LvSTARGOFF(sv) <= AvFILL(av)) + { + if (SvRMAGICAL(av)) { + SV * const * const svp = av_fetch(av, LvSTARGOFF(sv), 0); + targ = svp ? *svp : NULL; + } + else + targ = AvARRAY(av)[LvSTARGOFF(sv)]; + } } if (targ && (targ != &PL_sv_undef)) { /* somebody else defined it for us */ @@ -2298,10 +2348,18 @@ Perl_magic_getdefelem(pTHX_ SV *sv, MAGI mg->mg_obj = NULL; mg->mg_flags &= ~MGf_REFCOUNTED; } + return targ; } else - targ = LvTARG(sv); - sv_setsv(sv, targ ? targ : &PL_sv_undef); + return LvTARG(sv); +} + +int +Perl_magic_getdefelem(pTHX_ SV *sv, MAGIC *mg) +{ + PERL_ARGS_ASSERT_MAGIC_GETDEFELEM; + + sv_setsv(sv, defelem_target(sv, mg)); return 0; } @@ -2338,14 +2396,16 @@ Perl_vivify_defelem(pTHX_ SV *sv) if (!value || value == &PL_sv_undef) Perl_croak(aTHX_ PL_no_helem_sv, SVfARG(mg->mg_obj)); } + else if (LvSTARGOFF(sv) < 0) + Perl_croak(aTHX_ PL_no_aelem, LvSTARGOFF(sv)); else { AV *const av = MUTABLE_AV(LvTARG(sv)); - if ((I32)LvTARGLEN(sv) < 0 && (I32)LvTARGOFF(sv) > AvFILL(av)) + if ((I32)LvTARGLEN(sv) < 0 && LvSTARGOFF(sv) > AvFILL(av)) LvTARG(sv) = NULL; /* array can't be extended */ else { - SV* const * const svp = av_fetch(av, LvTARGOFF(sv), TRUE); - if (!svp || (value = *svp) == &PL_sv_undef) - Perl_croak(aTHX_ PL_no_aelem, (I32)LvTARGOFF(sv)); + SV* const * const svp = av_fetch(av, LvSTARGOFF(sv), TRUE); + if (!svp || !(value = *svp)) + Perl_croak(aTHX_ PL_no_aelem, LvSTARGOFF(sv)); } } SvREFCNT_inc_simple_void(value); @@ -2445,46 +2505,30 @@ Perl_magic_set(pTHX_ SV *sv, MAGIC *mg) const char *s; I32 paren; const REGEXP * rx; - const char * const remaining = mg->mg_ptr + 1; I32 i; STRLEN len; MAGIC *tmg; PERL_ARGS_ASSERT_MAGIC_SET; - switch (*mg->mg_ptr) { - case '\015': /* $^MATCH */ - if (strEQ(remaining, "ATCH")) - goto do_match; - case '`': /* ${^PREMATCH} caught below */ - do_prematch: - paren = RX_BUFF_IDX_PREMATCH; - goto setparen; - case '\'': /* ${^POSTMATCH} caught below */ - do_postmatch: - paren = RX_BUFF_IDX_POSTMATCH; - goto setparen; - case '&': - do_match: - paren = RX_BUFF_IDX_FULLMATCH; - goto setparen; - case '1': case '2': case '3': case '4': - case '5': case '6': case '7': case '8': case '9': - paren = atoi(mg->mg_ptr); - setparen: + if (!mg->mg_ptr) { + paren = mg->mg_len; if (PL_curpm && (rx = PM_GETRE(PL_curpm))) { - setparen_got_rx: + setparen_got_rx: CALLREG_NUMBUF_STORE((REGEXP * const)rx,paren,sv); } else { /* Croak with a READONLY error when a numbered match var is * set without a previous pattern match. Unless it's C */ - croakparen: + croakparen: if (!PL_localizing) { Perl_croak_no_modify(); } } - break; + return 0; + } + + switch (*mg->mg_ptr) { case '\001': /* ^A */ if (SvOK(sv)) sv_copypv(PL_bodytarget, sv); else SvOK_off(PL_bodytarget); @@ -2593,16 +2637,9 @@ Perl_magic_set(pTHX_ SV *sv, MAGIC *mg) } break; case '\020': /* ^P */ - if (*remaining == '\0') { /* ^P */ PL_perldb = SvIV(sv); if (PL_perldb && !PL_DBsingle) init_debugger(); - break; - } else if (strEQ(remaining, "REMATCH")) { /* $^PREMATCH */ - goto do_prematch; - } else if (strEQ(remaining, "OSTMATCH")) { /* $^POSTMATCH */ - goto do_postmatch; - } break; case '\024': /* ^T */ #ifdef BIG_TIME @@ -2645,8 +2682,11 @@ Perl_magic_set(pTHX_ SV *sv, MAGIC *mg) PL_compiling.cop_warnings = pWARN_NONE; } /* Yuck. I can't see how to abstract this: */ - else if (isWARN_on(((STRLEN *)SvPV_nolen_const(sv)) - 1, - WARN_ALL) && !any_fatals) { + else if (isWARN_on( + ((STRLEN *)SvPV_nolen_const(sv)) - 1, + WARN_ALL) + && !any_fatals) + { if (!specialWARN(PL_compiling.cop_warnings)) PerlMemShared_free(PL_compiling.cop_warnings); PL_compiling.cop_warnings = pWARN_ALL; @@ -2715,8 +2755,34 @@ Perl_magic_set(pTHX_ SV *sv, MAGIC *mg) } break; case '/': - SvREFCNT_dec(PL_rs); - PL_rs = newSVsv(sv); + { + SV *tmpsv= sv; + if (SvROK(sv)) { + SV *referent= SvRV(sv); + const char *reftype= sv_reftype(referent, 0); + /* XXX: dodgy type check: This leaves me feeling dirty, but the alternative + * is to copy pretty much the entire sv_reftype() into this routine, or to do + * a full string comparison on the return of sv_reftype() both of which + * make me feel worse! NOTE, do not modify this comment without reviewing the + * corresponding comment in sv_reftype(). - Yves */ + if (reftype[0] == 'S' || reftype[0] == 'L') { + IV val= SvIV(referent); + if (val <= 0) { + tmpsv= &PL_sv_undef; + Perl_ck_warner(aTHX_ packWARN(WARN_DEPRECATED), + "Setting $/ to a reference to %s as a form of slurp is deprecated, treating as undef", + SvIV(SvRV(sv)) < 0 ? "a negative integer" : "zero" + ); + } + } else { + /* diag_listed_as: Setting $/ to %s reference is forbidden */ + Perl_croak(aTHX_ "Setting $/ to a%s %s reference is forbidden", + *reftype == 'A' ? "n" : "", reftype); + } + } + SvREFCNT_dec(PL_rs); + PL_rs = newSVsv(tmpsv); + } break; case '\\': SvREFCNT_dec(PL_ors_sv); @@ -2754,34 +2820,40 @@ Perl_magic_set(pTHX_ SV *sv, MAGIC *mg) #else # define PERL_VMS_BANG 0 #endif +#if defined(WIN32) && ! defined(UNDER_CE) + SETERRNO(win32_get_errno(SvIOK(sv) ? SvIVX(sv) : SvOK(sv) ? sv_2iv(sv) : 0), + (SvIV(sv) == EVMSERR) ? 4 : PERL_VMS_BANG); +#else SETERRNO(SvIOK(sv) ? SvIVX(sv) : SvOK(sv) ? sv_2iv(sv) : 0, (SvIV(sv) == EVMSERR) ? 4 : PERL_VMS_BANG); +#endif } break; case '<': { - const IV new_uid = SvIV(sv); + /* XXX $< currently silently ignores failures */ + const Uid_t new_uid = SvUID(sv); PL_delaymagic_uid = new_uid; if (PL_delaymagic) { PL_delaymagic |= DM_RUID; break; /* don't do magic till later */ } #ifdef HAS_SETRUID - (void)setruid((Uid_t)new_uid); + PERL_UNUSED_RESULT(setruid(new_uid)); #else #ifdef HAS_SETREUID - (void)setreuid((Uid_t)new_uid, (Uid_t)-1); + PERL_UNUSED_RESULT(setreuid(new_uid, (Uid_t)-1)); #else #ifdef HAS_SETRESUID - (void)setresuid((Uid_t)new_uid, (Uid_t)-1, (Uid_t)-1); + PERL_UNUSED_RESULT(setresuid(new_uid, (Uid_t)-1, (Uid_t)-1)); #else if (new_uid == PerlProc_geteuid()) { /* special case $< = $> */ #ifdef PERL_DARWIN /* workaround for Darwin's setuid peculiarity, cf [perl #24122] */ if (new_uid != 0 && PerlProc_getuid() == 0) - (void)PerlProc_setuid(0); + PERL_UNUSED_RESULT(PerlProc_setuid(0)); #endif - (void)PerlProc_setuid(new_uid); + PERL_UNUSED_RESULT(PerlProc_setuid(new_uid)); } else { Perl_croak(aTHX_ "setruid() not implemented"); } @@ -2792,23 +2864,24 @@ Perl_magic_set(pTHX_ SV *sv, MAGIC *mg) } case '>': { - const UV new_euid = SvIV(sv); + /* XXX $> currently silently ignores failures */ + const Uid_t new_euid = SvUID(sv); PL_delaymagic_euid = new_euid; if (PL_delaymagic) { PL_delaymagic |= DM_EUID; break; /* don't do magic till later */ } #ifdef HAS_SETEUID - (void)seteuid((Uid_t)new_euid); + PERL_UNUSED_RESULT(seteuid(new_euid)); #else #ifdef HAS_SETREUID - (void)setreuid((Uid_t)-1, (Uid_t)new_euid); + PERL_UNUSED_RESULT(setreuid((Uid_t)-1, new_euid)); #else #ifdef HAS_SETRESUID - (void)setresuid((Uid_t)-1, (Uid_t)new_euid, (Uid_t)-1); + PERL_UNUSED_RESULT(setresuid((Uid_t)-1, new_euid, (Uid_t)-1)); #else if (new_euid == PerlProc_getuid()) /* special case $> = $< */ - PerlProc_setuid(new_euid); + PERL_UNUSED_RESULT(PerlProc_setuid(new_euid)); else { Perl_croak(aTHX_ "seteuid() not implemented"); } @@ -2819,23 +2892,24 @@ Perl_magic_set(pTHX_ SV *sv, MAGIC *mg) } case '(': { - const UV new_gid = SvIV(sv); + /* XXX $( currently silently ignores failures */ + const Gid_t new_gid = SvGID(sv); PL_delaymagic_gid = new_gid; if (PL_delaymagic) { PL_delaymagic |= DM_RGID; break; /* don't do magic till later */ } #ifdef HAS_SETRGID - (void)setrgid((Gid_t)new_gid); + PERL_UNUSED_RESULT(setrgid(new_gid)); #else #ifdef HAS_SETREGID - (void)setregid((Gid_t)new_gid, (Gid_t)-1); + PERL_UNUSED_RESULT(setregid(new_gid, (Gid_t)-1)); #else #ifdef HAS_SETRESGID - (void)setresgid((Gid_t)new_gid, (Gid_t)-1, (Gid_t) -1); + PERL_UNUSED_RESULT(setresgid(new_gid, (Gid_t)-1, (Gid_t) -1)); #else if (new_gid == PerlProc_getegid()) /* special case $( = $) */ - (void)PerlProc_setgid(new_gid); + PERL_UNUSED_RESULT(PerlProc_setgid(new_gid)); else { Perl_croak(aTHX_ "setrgid() not implemented"); } @@ -2846,7 +2920,8 @@ Perl_magic_set(pTHX_ SV *sv, MAGIC *mg) } case ')': { - UV new_egid; + /* XXX $) currently silently ignores failures */ + Gid_t new_egid; #ifdef HAS_SETGROUPS { const char *p = SvPV_const(sv, len); @@ -2862,7 +2937,7 @@ Perl_magic_set(pTHX_ SV *sv, MAGIC *mg) while (isSPACE(*p)) ++p; - new_egid = Atol(p); + new_egid = (Gid_t)Atol(p); for (i = 0; i < maxgrp; ++i) { while (*p && !isSPACE(*p)) ++p; @@ -2874,14 +2949,14 @@ Perl_magic_set(pTHX_ SV *sv, MAGIC *mg) Newx(gary, i + 1, Groups_t); else Renew(gary, i + 1, Groups_t); - gary[i] = Atol(p); + gary[i] = (Groups_t)Atol(p); } if (i) - (void)setgroups(i, gary); + PERL_UNUSED_RESULT(setgroups(i, gary)); Safefree(gary); } #else /* HAS_SETGROUPS */ - new_egid = SvIV(sv); + new_egid = SvGID(sv); #endif /* HAS_SETGROUPS */ PL_delaymagic_egid = new_egid; if (PL_delaymagic) { @@ -2889,16 +2964,16 @@ Perl_magic_set(pTHX_ SV *sv, MAGIC *mg) break; /* don't do magic till later */ } #ifdef HAS_SETEGID - (void)setegid((Gid_t)new_egid); + PERL_UNUSED_RESULT(setegid(new_egid)); #else #ifdef HAS_SETREGID - (void)setregid((Gid_t)-1, (Gid_t)new_egid); + PERL_UNUSED_RESULT(setregid((Gid_t)-1, new_egid)); #else #ifdef HAS_SETRESGID - (void)setresgid((Gid_t)-1, (Gid_t)new_egid, (Gid_t)-1); + PERL_UNUSED_RESULT(setresgid((Gid_t)-1, new_egid, (Gid_t)-1)); #else if (new_egid == PerlProc_getgid()) /* special case $) = $( */ - (void)PerlProc_setgid(new_egid); + PERL_UNUSED_RESULT(PerlProc_setgid(new_egid)); else { Perl_croak(aTHX_ "setegid() not implemented"); } @@ -3180,7 +3255,7 @@ cleanup: /* pop any of SAVEFREESV, SAVEDESTRUCTOR_X and "save in progress" */ PL_savestack_ix = old_ss_ix; if (flags & 8) - SvREFCNT_dec(sv); + SvREFCNT_dec_NN(sv); PL_op = myop; /* Apparently not needed... */ PL_Sv = tSv; /* Restore global temporaries. */ @@ -3246,7 +3321,7 @@ S_restore_magic(pTHX_ const void *p) SvTEMP_off(sv); } else - SvREFCNT_dec(sv); /* undo the inc in S_save_magic() */ + SvREFCNT_dec_NN(sv); /* undo the inc in S_save_magic() */ } } Index: gnu/usr.bin/perl/mg.h =================================================================== RCS file: /mnt/memory/perl/importit/cvs/src/gnu/usr.bin/perl/mg.h,v retrieving revision 1.13 diff -u -p -u -p -r1.13 mg.h --- gnu/usr.bin/perl/mg.h 24 Mar 2014 15:05:13 -0000 1.13 +++ gnu/usr.bin/perl/mg.h 16 Nov 2014 03:22:24 -0000 @@ -8,9 +8,6 @@ * */ -#ifdef STRUCT_MGVTBL_DEFINITION -STRUCT_MGVTBL_DEFINITION; -#else struct mgvtbl { int (*svt_get) (pTHX_ SV *sv, MAGIC* mg); int (*svt_set) (pTHX_ SV *sv, MAGIC* mg); @@ -22,7 +19,6 @@ struct mgvtbl { int (*svt_dup) (pTHX_ MAGIC *mg, CLONE_PARAMS *param); int (*svt_local)(pTHX_ SV *nsv, MAGIC *mg); }; -#endif struct magic { MAGIC* mg_moremagic; @@ -30,7 +26,7 @@ struct magic { U16 mg_private; char mg_type; U8 mg_flags; - I32 mg_len; + SSize_t mg_len; SV* mg_obj; char* mg_ptr; }; @@ -42,6 +38,7 @@ struct magic { #define MGf_COPY 8 /* has an svt_copy MGVTBL entry */ #define MGf_DUP 0x10 /* has an svt_dup MGVTBL entry */ #define MGf_LOCAL 0x20 /* has an svt_local MGVTBL entry */ +#define MGf_BYTES 0x40 /* PERL_MAGIC_regex_global only */ #define MgTAINTEDDIR(mg) (mg->mg_flags & MGf_TAINTEDDIR) #define MgTAINTEDDIR_on(mg) (mg->mg_flags |= MGf_TAINTEDDIR) @@ -60,6 +57,19 @@ struct magic { #define SvTIED_mg(sv,how) (SvRMAGICAL(sv) ? mg_find((sv),(how)) : NULL) #define SvTIED_obj(sv,mg) \ ((mg)->mg_obj ? (mg)->mg_obj : sv_2mortal(newRV(sv))) + +#if defined(PERL_CORE) || defined(PERL_EXT) +# define MgBYTEPOS(mg,sv,pv,len) S_MgBYTEPOS(aTHX_ mg,sv,pv,len) +/* assumes get-magic and stringification have already occurred */ +# define MgBYTEPOS_set(mg,sv,pv,off) ( \ + assert_((mg)->mg_type == PERL_MAGIC_regex_global) \ + SvPOK(sv) && !SvGMAGICAL(sv) \ + ? (mg)->mg_len = (off), (mg)->mg_flags |= MGf_BYTES \ + : ((mg)->mg_len = DO_UTF8(sv) \ + ? (SSize_t)utf8_length((U8 *)(pv), (U8 *)(pv)+(off)) \ + : (SSize_t)(off), \ + (mg)->mg_flags &= ~MGf_BYTES)) +#endif #define whichsig(pv) whichsig_pv(pv) Index: gnu/usr.bin/perl/mg_raw.h =================================================================== RCS file: /mnt/memory/perl/importit/cvs/src/gnu/usr.bin/perl/mg_raw.h,v retrieving revision 1.1.1.2 diff -u -p -u -p -r1.1.1.2 mg_raw.h --- gnu/usr.bin/perl/mg_raw.h 24 Mar 2014 14:58:45 -0000 1.1.1.2 +++ gnu/usr.bin/perl/mg_raw.h 16 Nov 2014 03:22:24 -0000 @@ -60,7 +60,7 @@ "/* tiedelem 'p' Tied array or hash element */" }, { 'q', "want_vtbl_packelem", "/* tiedscalar 'q' Tied scalar or handle */" }, - { 'r', "want_vtbl_regexp | PERL_MAGIC_VALUE_MAGIC", + { 'r', "want_vtbl_regexp | PERL_MAGIC_READONLY_ACCEPTABLE | PERL_MAGIC_VALUE_MAGIC", "/* qr 'r' precompiled qr// regex */" }, { 'S', "magic_vtable_max", "/* sig 'S' %SIG hash */" }, Index: gnu/usr.bin/perl/minimod.pl =================================================================== RCS file: gnu/usr.bin/perl/minimod.pl diff -N gnu/usr.bin/perl/minimod.pl --- gnu/usr.bin/perl/minimod.pl 24 Mar 2014 15:05:13 -0000 1.8 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,146 +0,0 @@ -#./miniperl -w -# minimod.pl writes the contents of miniperlmain.c into the module -# ExtUtils::Miniperl for later perusal (when the perl source is -# deleted) -# -# It also writes the subroutine writemain(), which takes as its -# arguments module names that shall be statically linked into perl. -# -# Authors: Andreas Koenig , Tim Bunce -# -# -# Version 1.0, Feb 2nd 1995 by Andreas Koenig - -BEGIN { unshift @INC, "lib" } - -use strict; - -print <<'END'; -# This File keeps the contents of miniperlmain.c. -# -# It was generated automatically by minimod.PL from the contents -# of miniperlmain.c. Don't edit this file! -# -# ANY CHANGES MADE HERE WILL BE LOST! -# - - -package ExtUtils::Miniperl; -require Exporter; -@ISA = qw(Exporter); -@EXPORT = qw(&writemain); - -$head= <<'EOF!HEAD'; -END - -open MINI, "miniperlmain.c"; -while () { - last if /Do not delete this line--writemain depends on it/; - print; - /#include "perl.h"/ and print qq/#include "XSUB.h"\n/; -} - -print <<'END'; -EOF!HEAD -$tail=<<'EOF!TAIL'; -END - -while () { - print unless /dXSUB_SYS/; -} -close MINI; - -print <<'END'; -EOF!TAIL - -sub writemain{ - my(@exts) = @_; - - my($pname); - my($dl) = canon('/','DynaLoader'); - print $head; - - foreach $_ (@exts){ - my($pname) = canon('/', $_); - my($mname, $cname); - ($mname = $pname) =~ s!/!::!g; - ($cname = $pname) =~ s!/!__!g; - print "EXTERN_C void boot_${cname} (pTHX_ CV* cv);\n"; - } - - my ($tail1,$tail2,$tail3) = ( $tail =~ /\A(.*{\s*\n)(.*\n)(\s*\}.*)\Z/s ); - - print $tail1; - print "\tstatic const char file[] = __FILE__;\n"; - print "\tdXSUB_SYS;\n" if $] > 5.002; - print $tail2; - - foreach $_ (@exts){ - my($pname) = canon('/', $_); - my($mname, $cname, $ccode); - ($mname = $pname) =~ s!/!::!g; - ($cname = $pname) =~ s!/!__!g; - print "\t{\n"; - if ($pname eq $dl){ - # Must NOT install 'DynaLoader::boot_DynaLoader' as 'bootstrap'! - # boot_DynaLoader is called directly in DynaLoader.pm - $ccode = "\t/* DynaLoader is a special case */\n -\tnewXS(\"${mname}::boot_${cname}\", boot_${cname}, file);\n"; - print $ccode unless $SEEN{$ccode}++; - } else { - $ccode = "\tnewXS(\"${mname}::bootstrap\", boot_${cname}, file);\n"; - print $ccode unless $SEEN{$ccode}++; - } - print "\t}\n"; - } - print $tail3; -} - -sub canon{ - my($as, @ext) = @_; - foreach(@ext){ - # might be X::Y or lib/auto/X/Y/Y.a - next if s!::!/!g; - s:^(lib|ext)/(auto/)?::; - s:/\w+\.\w+$::; - } - grep(s:/:$as:, @ext) if ($as ne '/'); - @ext; -} - -1; -__END__ - -=head1 NAME - -ExtUtils::Miniperl, writemain - write the C code for perlmain.c - -=head1 SYNOPSIS - -C - -C - -=head1 DESCRIPTION - -This whole module is written when perl itself is built from a script -called minimod.PL. In case you want to patch it, please patch -minimod.PL in the perl distribution instead. - -writemain() takes an argument list of directories containing archive -libraries that relate to perl modules and should be linked into a new -perl binary. It writes to STDOUT a corresponding perlmain.c file that -is a plain C file containing all the bootstrap code to make the -modules associated with the libraries available from within perl. - -The typical usage is from within a Makefile generated by -ExtUtils::MakeMaker. So under normal circumstances you won't have to -deal with this module directly. - -=head1 SEE ALSO - -L - -=cut - -END Index: gnu/usr.bin/perl/miniperlmain.c =================================================================== RCS file: /mnt/memory/perl/importit/cvs/src/gnu/usr.bin/perl/miniperlmain.c,v retrieving revision 1.13 diff -u -p -u -p -r1.13 miniperlmain.c --- gnu/usr.bin/perl/miniperlmain.c 24 Mar 2014 15:05:13 -0000 1.13 +++ gnu/usr.bin/perl/miniperlmain.c 16 Nov 2014 03:22:24 -0000 @@ -1,3 +1,9 @@ +/* -*- buffer-read-only: t -*- + !!!!!!! DO NOT EDIT THIS FILE !!!!!!! + This file is built by regen/miniperlmain.pl and ExtUtils::Miniperl. + Any changes made here will be lost! + */ + /* miniperlmain.c * * Copyright (C) 1994, 1995, 1996, 1997, 1999, 2000, 2001, 2002, 2003, @@ -34,10 +40,10 @@ #endif #endif - -#include "EXTERN.h" #define PERL_IN_MINIPERLMAIN_C +#include "EXTERN.h" #include "perl.h" +#include "XSUB.h" static void xs_init (pTHX); static PerlInterpreter *my_perl; @@ -60,12 +66,13 @@ int main(int argc, char **argv, char **env) #endif { - dVAR; int exitstatus, i; #ifdef PERL_GLOBAL_STRUCT - struct perl_vars *plvarsp = init_global_struct(); + struct perl_vars *my_vars = init_global_struct(); # ifdef PERL_GLOBAL_STRUCT_PRIVATE - my_vars = my_plvarsp = plvarsp; + int veto; + + my_plvarsp = my_vars; # endif #endif /* PERL_GLOBAL_STRUCT */ #ifndef NO_ENV_ARRAY_IN_MAIN @@ -141,7 +148,17 @@ main(int argc, char **argv, char **env) PERL_SYS_TERM(); #ifdef PERL_GLOBAL_STRUCT - free_global_struct(plvarsp); +# ifdef PERL_GLOBAL_STRUCT_PRIVATE + veto = my_plvarsp->Gveto_cleanup; +# endif + free_global_struct(my_vars); +# ifdef PERL_GLOBAL_STRUCT_PRIVATE + if (!veto) + my_plvarsp = NULL; + /* Remember, functions registered with atexit() can run after this point, + and may access "global" variables, and hence end up calling + Perl_GetVarsPrivate() */ +#endif #endif /* PERL_GLOBAL_STRUCT */ exit(exitstatus); @@ -150,21 +167,12 @@ main(int argc, char **argv, char **env) /* Register any extra external extensions */ -/* Do not delete this line--writemain depends on it */ static void xs_init(pTHX) { - PERL_UNUSED_CONTEXT; dXSUB_SYS; + PERL_UNUSED_CONTEXT; } -/* - * Local variables: - * c-indentation-style: bsd - * c-basic-offset: 4 - * indent-tabs-mode: nil - * End: - * - * ex: set ts=8 sts=4 sw=4 et: - */ +/* ex: set ro: */ Index: gnu/usr.bin/perl/mkppport.lst =================================================================== RCS file: /mnt/memory/perl/importit/cvs/src/gnu/usr.bin/perl/mkppport.lst,v retrieving revision 1.1.1.4 diff -u -p -u -p -r1.1.1.4 mkppport.lst --- gnu/usr.bin/perl/mkppport.lst 25 Mar 2013 20:06:27 -0000 1.1.1.4 +++ gnu/usr.bin/perl/mkppport.lst 16 Nov 2014 03:22:24 -0000 @@ -7,7 +7,7 @@ cpan/DB_File cpan/IPC-SysV -cpan/List-Util +cpan/Scalar-List-Utils cpan/Time-HiRes cpan/Win32API-File -dist/Cwd +dist/PathTools Index: gnu/usr.bin/perl/mro.c =================================================================== RCS file: /mnt/memory/perl/importit/cvs/src/gnu/usr.bin/perl/mro.c,v retrieving revision 1.1.1.5 diff -u -p -u -p -r1.1.1.5 mro.c --- gnu/usr.bin/perl/mro.c 24 Mar 2014 14:58:45 -0000 1.1.1.5 +++ gnu/usr.bin/perl/mro.c 16 Nov 2014 03:22:24 -0000 @@ -131,7 +131,7 @@ Perl_mro_register(pTHX_ const struct mro if (!Perl_hv_common(aTHX_ PL_registered_mros, NULL, mro->name, mro->length, mro->kflags, HV_FETCH_ISSTORE, wrapper, mro->hash)) { - SvREFCNT_dec(wrapper); + SvREFCNT_dec_NN(wrapper); Perl_croak(aTHX_ "panic: hv_store() failed in mro_register() " "for '%.*s' %d", (int) mro->length, mro->name, mro->kflags); } @@ -186,6 +186,8 @@ Perl_mro_meta_dup(pTHX_ struct mro_meta* newmeta->isa = MUTABLE_HV(sv_dup_inc((const SV *)newmeta->isa, param)); + newmeta->super = NULL; + return newmeta; } @@ -267,10 +269,11 @@ S_mro_get_linear_isa_dfs(pTHX_ HV *stash /* foreach(@ISA) */ while (items--) { - SV* const sv = *svp++; + SV* const sv = *svp ? *svp : &PL_sv_undef; HV* const basestash = gv_stashsv(sv, 0); SV *const *subrv_p; I32 subrv_items; + svp++; if (!basestash) { /* if no stash exists for this @ISA member, @@ -499,9 +502,9 @@ Perl_mro_isa_changed_in(pTHX_ HV* stash) struct mro_meta * meta; HV *isa = NULL; + const HEK * const stashhek = HvENAME_HEK(stash); const char * const stashname = HvENAME_get(stash); const STRLEN stashname_len = HvENAMELEN_get(stash); - const bool stashname_utf8 = HvENAMEUTF8(stash) ? 1 : 0; PERL_ARGS_ASSERT_MRO_ISA_CHANGED_IN; @@ -524,8 +527,7 @@ Perl_mro_isa_changed_in(pTHX_ HV* stash) /* Wipe the global method cache if this package is UNIVERSAL or one of its parents */ - svp = hv_fetch(PL_isarev, stashname, - stashname_utf8 ? -(I32)stashname_len : (I32)stashname_len, 0); + svp = hv_fetchhek(PL_isarev, stashhek, 0); isarev = svp ? MUTABLE_HV(*svp) : NULL; if((stashname_len == 9 && strEQ(stashname, "UNIVERSAL")) @@ -543,6 +545,8 @@ Perl_mro_isa_changed_in(pTHX_ HV* stash) /* Changes to @ISA might turn overloading on */ HvAMAGIC_on(stash); + /* pessimise derefs for now. Will get recalculated by Gv_AMupdate() */ + HvAUX(stash)->xhv_aux_flags &= ~HvAUXf_NO_DEREF; /* DESTROY can be cached in SvSTASH. */ if (!SvOBJECT(stash)) SvSTASH(stash) = NULL; @@ -631,17 +635,14 @@ Perl_mro_isa_changed_in(pTHX_ HV* stash) it doesn't exist. */ (void) - hv_store( - mroisarev, HEK_KEY(namehek), - HEK_UTF8(namehek) ? -HEK_LEN(namehek) : HEK_LEN(namehek), - &PL_sv_yes, 0 - ); + hv_storehek(mroisarev, namehek, &PL_sv_yes); } if((SV *)isa != &PL_sv_undef) mro_clean_isarev( isa, HEK_KEY(namehek), HEK_LEN(namehek), - HvMROMETA(revstash)->isa, (HEK_UTF8(namehek) ? SVf_UTF8 : 0) + HvMROMETA(revstash)->isa, HEK_HASH(namehek), + HEK_UTF8(namehek) ); } } @@ -675,20 +676,20 @@ Perl_mro_isa_changed_in(pTHX_ HV* stash) save time by not making two calls to the common HV code for the case where it doesn't exist. */ - (void)hv_store(mroisarev, stashname, - stashname_utf8 ? -(I32)stashname_len : (I32)stashname_len, &PL_sv_yes, 0); + (void)hv_storehek(mroisarev, stashhek, &PL_sv_yes); } /* Delete our name from our former parents' isarevs. */ if(isa && HvARRAY(isa)) mro_clean_isarev(isa, stashname, stashname_len, meta->isa, - (stashname_utf8 ? SVf_UTF8 : 0) ); + HEK_HASH(stashhek), HEK_UTF8(stashhek)); } /* Deletes name from all the isarev entries listed in isa */ STATIC void S_mro_clean_isarev(pTHX_ HV * const isa, const char * const name, - const STRLEN len, HV * const exceptions, U32 flags) + const STRLEN len, HV * const exceptions, U32 hash, + U32 flags) { HE* iter; @@ -705,7 +706,8 @@ S_mro_clean_isarev(pTHX_ HV * const isa, svp = hv_fetch(PL_isarev, key, HeKUTF8(iter) ? -klen : klen, 0); if(svp) { HV * const isarev = (HV *)*svp; - (void)hv_delete(isarev, name, (flags & SVf_UTF8) ? -(I32)len : (I32)len, G_DISCARD); + (void)hv_common(isarev, NULL, name, len, flags, + G_DISCARD|HV_DELETE, NULL, hash); if(!HvARRAY(isarev) || !HvUSEDKEYS(isarev)) (void)hv_delete(PL_isarev, key, HeKUTF8(iter) ? -klen : klen, G_DISCARD); @@ -719,7 +721,7 @@ S_mro_clean_isarev(pTHX_ HV * const isa, Call this function to signal to a stash that it has been assigned to another spot in the stash hierarchy. C is the stash that has been -assigned. C is the stash it replaces, if any. C is the glob +assigned. C is the stash it replaces, if any. C is the glob that is actually being assigned to. This can also be called with a null first argument to @@ -774,8 +776,7 @@ Perl_mro_package_moved(pTHX_ HV * const SV **svp; if( !GvSTASH(gv) || !HvENAME(GvSTASH(gv)) || - !(svp = hv_fetch(GvSTASH(gv), GvNAME(gv), - GvNAMEUTF8(gv) ? -GvNAMELEN(gv) : GvNAMELEN(gv), 0)) || + !(svp = hv_fetchhek(GvSTASH(gv), GvNAME_HEK(gv), 0)) || *svp != (SV *)gv ) return; } @@ -975,7 +976,8 @@ S_mro_gather_and_rename(pTHX_ HV * const * fies it for us, so sv_2mortal is not necessary. */ if(HvENAME_HEK(oldstash) != enamehek) { if(meta->isa && HvARRAY(meta->isa)) - mro_clean_isarev(meta->isa, name, len, 0, name_utf8); + mro_clean_isarev(meta->isa, name, len, 0, 0, + name_utf8 ? HVhek_UTF8 : 0); isarev = (HV *)hv_delete(PL_isarev, name, name_utf8 ? -(I32)len : (I32)len, 0); fetched_isarev=TRUE; @@ -1061,12 +1063,9 @@ S_mro_gather_and_rename(pTHX_ HV * const assert(!oldstash || HvENAME(oldstash)); if (oldstash) { /* Extra variable to avoid a compiler warning */ - char * const hvename = HvENAME(oldstash); + const HEK * const hvename = HvENAME_HEK(oldstash); fetched_isarev = TRUE; - svp = hv_fetch(PL_isarev, hvename, - HvENAMEUTF8(oldstash) - ? -HvENAMELEN_get(oldstash) - : HvENAMELEN_get(oldstash), 0); + svp = hv_fetchhek(PL_isarev, hvename, 0); if (svp) isarev = MUTABLE_HV(*svp); } else if(SvTYPE(namesv) == SVt_PVAV) { @@ -1148,7 +1147,7 @@ S_mro_gather_and_rename(pTHX_ HV * const if( ( - stashentry && *stashentry + stashentry && *stashentry && isGV(*stashentry) && (substash = GvHV(*stashentry)) ) || (oldsubstash && HvENAME_get(oldsubstash)) @@ -1317,10 +1316,8 @@ Perl_mro_method_changed_in(pTHX_ HV *sta { const char * const stashname = HvENAME_get(stash); const STRLEN stashname_len = HvENAMELEN_get(stash); - const bool stashname_utf8 = HvENAMEUTF8(stash) ? 1 : 0; - SV ** const svp = hv_fetch(PL_isarev, stashname, - stashname_utf8 ? -(I32)stashname_len : (I32)stashname_len, 0); + SV ** const svp = hv_fetchhek(PL_isarev, HvENAME_HEK(stash), 0); HV * const isarev = svp ? MUTABLE_HV(*svp) : NULL; PERL_ARGS_ASSERT_MRO_METHOD_CHANGED_IN; @@ -1364,6 +1361,8 @@ Perl_mro_method_changed_in(pTHX_ HV *sta /* The method change may be due to *{$package . "::()"} = \&nil; in overload.pm. */ HvAMAGIC_on(stash); + /* pessimise derefs for now. Will get recalculated by Gv_AMupdate() */ + HvAUX(stash)->xhv_aux_flags &= ~HvAUXf_NO_DEREF; } void Index: gnu/usr.bin/perl/myconfig.SH =================================================================== RCS file: /mnt/memory/perl/importit/cvs/src/gnu/usr.bin/perl/myconfig.SH,v retrieving revision 1.1.1.7 diff -u -p -u -p -r1.1.1.7 myconfig.SH --- gnu/usr.bin/perl/myconfig.SH 24 Mar 2014 14:58:45 -0000 1.1.1.7 +++ gnu/usr.bin/perl/myconfig.SH 16 Nov 2014 03:22:24 -0000 @@ -37,7 +37,6 @@ Summary of my $package (revision $revisi config_args='$config_args' hint=$hint, useposix=$useposix, d_sigaction=$d_sigaction useithreads=$useithreads, usemultiplicity=$usemultiplicity - useperlio=$useperlio, d_sfio=$d_sfio, uselargefiles=$uselargefiles, usesocks=$usesocks use64bitint=$use64bitint, use64bitall=$use64bitall, uselongdouble=$uselongdouble usemymalloc=$usemymalloc, bincompat5005=undef Compiler: Index: gnu/usr.bin/perl/numeric.c =================================================================== RCS file: /mnt/memory/perl/importit/cvs/src/gnu/usr.bin/perl/numeric.c,v retrieving revision 1.1.1.9 diff -u -p -u -p -r1.1.1.9 numeric.c --- gnu/usr.bin/perl/numeric.c 24 Mar 2014 14:58:45 -0000 1.1.1.9 +++ gnu/usr.bin/perl/numeric.c 16 Nov 2014 03:22:24 -0000 @@ -120,13 +120,13 @@ On return I<*len> is set to the length o and I<*flags> gives output flags. If the value is <= C it is returned as a UV, the output flags are clear, -and nothing is written to I<*result>. If the value is > UV_MAX C +and nothing is written to I<*result>. If the value is > UV_MAX C returns UV_MAX, sets C in the output flags, and writes the value to I<*result> (or the value is discarded if I is NULL). The binary number may optionally be prefixed with "0b" or "b" unless -C is set in I<*flags> on entry. If +C is set in I<*flags> on entry. If C is set in I<*flags> then the binary number may use '_' characters to separate digits. @@ -234,7 +234,7 @@ Perl_grok_bin(pTHX_ const char *start, S converts a string representing a hex number to numeric form. -On entry I and I<*len> give the string to scan, I<*flags> gives +On entry I and I<*len_p> give the string to scan, I<*flags> gives conversion flags, and I should be NULL or a pointer to an NV. The scan stops at the end of the string, or the first invalid character. Unless C is set in I<*flags>, encountering an @@ -243,13 +243,13 @@ On return I<*len> is set to the length o and I<*flags> gives output flags. If the value is <= UV_MAX it is returned as a UV, the output flags are clear, -and nothing is written to I<*result>. If the value is > UV_MAX C +and nothing is written to I<*result>. If the value is > UV_MAX C returns UV_MAX, sets C in the output flags, and writes the value to I<*result> (or the value is discarded if I is NULL). The hex number may optionally be prefixed with "0x" or "x" unless -C is set in I<*flags> on entry. If +C is set in I<*flags> on entry. If C is set in I<*flags> then the hex number may use '_' characters to separate digits. @@ -291,15 +291,14 @@ Perl_grok_hex(pTHX_ const char *start, S } for (; len-- && *s; s++) { - const char *hexdigit = strchr(PL_hexdigit, *s); - if (hexdigit) { + if (isXDIGIT(*s)) { /* Write it in this wonky order with a goto to attempt to get the compiler to make the common case integer-only loop pretty tight. With gcc seems to be much straighter code than old scan_hex. */ redo: if (!overflowed) { if (value <= max_div_16) { - value = (value << 4) | ((hexdigit - PL_hexdigit) & 15); + value = (value << 4) | XDIGIT_VALUE(*s); continue; } /* Bah. We're just overflowed. */ @@ -316,11 +315,11 @@ Perl_grok_hex(pTHX_ const char *start, S * the low-order bits anyway): we could just remember when * did we overflow and in the end just multiply value_nv by the * right amount of 16-tuples. */ - value_nv += (NV)((hexdigit - PL_hexdigit) & 15); + value_nv += (NV) XDIGIT_VALUE(*s); continue; } if (*s == '_' && len && allow_underscores && s[1] - && (hexdigit = strchr(PL_hexdigit, s[1]))) + && isXDIGIT(s[1])) { --len; ++s; @@ -366,7 +365,7 @@ On return I<*len> is set to the length o and I<*flags> gives output flags. If the value is <= UV_MAX it is returned as a UV, the output flags are clear, -and nothing is written to I<*result>. If the value is > UV_MAX C +and nothing is written to I<*result>. If the value is > UV_MAX C returns UV_MAX, sets C in the output flags, and writes the value to I<*result> (or the value is discarded if I is NULL). @@ -395,17 +394,14 @@ Perl_grok_oct(pTHX_ const char *start, S PERL_ARGS_ASSERT_GROK_OCT; for (; len-- && *s; s++) { - /* gcc 2.95 optimiser not smart enough to figure that this subtraction - out front allows slicker code. */ - int digit = *s - '0'; - if (digit >= 0 && digit <= 7) { + if (isOCTAL(*s)) { /* Write it in this wonky order with a goto to attempt to get the compiler to make the common case integer-only loop pretty tight. */ redo: if (!overflowed) { if (value <= max_div_8) { - value = (value << 3) | digit; + value = (value << 3) | OCTAL_VALUE(*s); continue; } /* Bah. We're just overflowed. */ @@ -422,20 +418,19 @@ Perl_grok_oct(pTHX_ const char *start, S * the low-order bits anyway): we could just remember when * did we overflow and in the end just multiply value_nv by the * right amount of 8-tuples. */ - value_nv += (NV)digit; + value_nv += (NV) OCTAL_VALUE(*s); continue; } - if (digit == ('_' - '0') && len && allow_underscores - && (digit = s[1] - '0') && (digit >= 0 && digit <= 7)) - { - --len; - ++s; - goto redo; - } + if (*s == '_' && len && allow_underscores && isOCTAL(s[1])) { + --len; + ++s; + goto redo; + } /* Allow \octal to work the DWIM way (that is, stop scanning * as soon as non-octal characters are seen, complain only if - * someone seems to want to use the digits eight and nine). */ - if (digit == 8 || digit == 9) { + * someone seems to want to use the digits eight and nine. Since we + * know it is not octal, then if isDIGIT, must be an 8 or 9). */ + if (isDIGIT(*s)) { if (!(*flags & PERL_SCAN_SILENT_ILLDIGIT)) Perl_ck_warner(aTHX_ packWARN(WARN_DIGIT), "Illegal octal digit '%c' ignored", *s); @@ -466,15 +461,15 @@ Perl_grok_oct(pTHX_ const char *start, S /* =for apidoc scan_bin -For backwards compatibility. Use C instead. +For backwards compatibility. Use C instead. =for apidoc scan_hex -For backwards compatibility. Use C instead. +For backwards compatibility. Use C instead. =for apidoc scan_oct -For backwards compatibility. Use C instead. +For backwards compatibility. Use C instead. =cut */ @@ -562,7 +557,7 @@ Recognise (or not) a number. The type o IS_NUMBER_IN_UV, IS_NUMBER_GREATER_THAN_UV_MAX, IS_NUMBER_NOT_INT, IS_NUMBER_NEG, IS_NUMBER_INFINITY, IS_NUMBER_NAN (defined in perl.h). -If the value of the number can fit an in UV, it is returned in the *valuep +If the value of the number can fit in a UV, it is returned in the *valuep IS_NUMBER_IN_UV will be set to indicate that *valuep is valid, IS_NUMBER_IN_UV will never be set unless *valuep is valid, but *valuep may have been assigned to during processing even though IS_NUMBER_IN_UV is not set on return. @@ -599,7 +594,7 @@ Perl_grok_number(pTHX_ const char *pv, S numtype = IS_NUMBER_NEG; } else if (*s == '+') - s++; + s++; if (s == send) return 0; @@ -823,6 +818,17 @@ S_mulexp10(NV value, I32 exponent) if (exponent < 0) { negative = 1; exponent = -exponent; +#ifdef NV_MAX_10_EXP + /* for something like 1234 x 10^-309, the action of calculating + * the intermediate value 10^309 then returning 1234 / (10^309) + * will fail, since 10^309 becomes infinity. In this case try to + * refactor it as 123 / (10^308) etc. + */ + while (value && exponent > NV_MAX_10_EXP) { + exponent--; + value /= 10; + } +#endif } for (bit = 1; exponent; bit <<= 1) { if (exponent & bit) { @@ -847,31 +853,36 @@ Perl_my_atof(pTHX_ const char* s) PERL_ARGS_ASSERT_MY_ATOF; - if (PL_numeric_local && PL_numeric_radix_sv && IN_SOME_LOCALE_FORM) { - const char *standard = NULL, *local = NULL; - bool use_standard_radix; - - /* Look through the string for the first thing that looks like a - * decimal point: either the value in the current locale or the - * standard fallback of '.'. The one which appears earliest in the - * input string is the one that we should have atof look for. Note that - * we have to determine this beforehand because on some systems, - * Perl_atof2 is just a wrapper around the system's atof. */ - standard = strchr(s, '.'); - local = strstr(s, SvPV_nolen(PL_numeric_radix_sv)); - - use_standard_radix = standard && (!local || standard < local); + { + DECLARE_STORE_LC_NUMERIC_SET_TO_NEEDED(); + if (PL_numeric_local && PL_numeric_radix_sv && IN_SOME_LOCALE_FORM) { + const char *standard = NULL, *local = NULL; + bool use_standard_radix; + + /* Look through the string for the first thing that looks like a + * decimal point: either the value in the current locale or the + * standard fallback of '.'. The one which appears earliest in the + * input string is the one that we should have atof look for. Note + * that we have to determine this beforehand because on some + * systems, Perl_atof2 is just a wrapper around the system's atof. + * */ + standard = strchr(s, '.'); + local = strstr(s, SvPV_nolen(PL_numeric_radix_sv)); + + use_standard_radix = standard && (!local || standard < local); - if (use_standard_radix) - SET_NUMERIC_STANDARD(); + if (use_standard_radix) + SET_NUMERIC_STANDARD(); - Perl_atof2(s, x); + Perl_atof2(s, x); - if (use_standard_radix) - SET_NUMERIC_LOCAL(); + if (use_standard_radix) + SET_NUMERIC_LOCAL(); + } + else + Perl_atof2(s, x); + RESTORE_LC_NUMERIC(); } - else - Perl_atof2(s, x); #else Perl_atof2(s, x); #endif Index: gnu/usr.bin/perl/op.c =================================================================== RCS file: /mnt/memory/perl/importit/cvs/src/gnu/usr.bin/perl/op.c,v retrieving revision 1.17 diff -u -p -u -p -r1.17 op.c --- gnu/usr.bin/perl/op.c 24 Mar 2014 15:05:13 -0000 1.17 +++ gnu/usr.bin/perl/op.c 16 Nov 2014 03:22:24 -0000 @@ -109,6 +109,24 @@ recursive, but it's recursive on basic b #define CALL_RPEEP(o) PL_rpeepp(aTHX_ o) #define CALL_OPFREEHOOK(o) if (PL_opfreehook) PL_opfreehook(aTHX_ o) +/* remove any leading "empty" ops from the op_next chain whose first + * node's address is stored in op_p. Store the updated address of the + * first node in op_p. + */ + +STATIC void +S_prune_chain_head(pTHX_ OP** op_p) +{ + while (*op_p + && ( (*op_p)->op_type == OP_NULL + || (*op_p)->op_type == OP_SCOPE + || (*op_p)->op_type == OP_SCALAR + || (*op_p)->op_type == OP_LINESEQ) + ) + *op_p = (*op_p)->op_next; +} + + /* See the explanatory comments above struct opslab in op.h. */ #ifdef PERL_DEBUG_READONLY_OPS @@ -165,24 +183,23 @@ Perl_Slab_Alloc(pTHX_ size_t sz) OP *o; size_t opsz, space; + /* We only allocate ops from the slab during subroutine compilation. + We find the slab via PL_compcv, hence that must be non-NULL. It could + also be pointing to a subroutine which is now fully set up (CvROOT() + pointing to the top of the optree for that sub), or a subroutine + which isn't using the slab allocator. If our sanity checks aren't met, + don't use a slab, but allocate the OP directly from the heap. */ if (!PL_compcv || CvROOT(PL_compcv) || (CvSTART(PL_compcv) && !CvSLABBED(PL_compcv))) return PerlMemShared_calloc(1, sz); -#if defined(USE_ITHREADS) && IVSIZE > U32SIZE && IVSIZE > PTRSIZE - /* Work around a goof with alignment on our part. For sparc32 (and - possibly other architectures), if built with -Duse64bitint, the IV - op_pmoffset in struct pmop should be 8 byte aligned, but the slab - allocator is only providing 4 byte alignment. The real fix is to change - the IV to a type the same size as a pointer, such as size_t, but we - can't do that without breaking the ABI, which is a no-no in a maint - release. So instead, simply allocate struct pmop directly, which will be - suitably aligned: */ - if (sz == sizeof(struct pmop)) - return PerlMemShared_calloc(1, sz); -#endif - - if (!CvSTART(PL_compcv)) { /* sneak it in here */ + /* While the subroutine is under construction, the slabs are accessed via + CvSTART(), to avoid needing to expand PVCV by one pointer for something + unneeded at runtime. Once a subroutine is constructed, the slabs are + accessed via CvROOT(). So if CvSTART() is NULL, no slab has been + allocated yet. See the commit message for 8be227ab5eaa23f2 for more + details. */ + if (!CvSTART(PL_compcv)) { CvSTART(PL_compcv) = (OP *)(slab = S_new_slab(aTHX_ PERL_SLAB_SIZE)); CvSLABBED_on(PL_compcv); @@ -193,6 +210,9 @@ Perl_Slab_Alloc(pTHX_ size_t sz) opsz = SIZE_TO_PSIZE(sz); sz = opsz + OPSLOT_HEADER_P; + /* The slabs maintain a free list of OPs. In particular, constant folding + will free up OPs, so it makes sense to re-use them where possible. A + freed up slot is used in preference to a new allocation. */ if (slab->opslab_freed) { OP **too = &slab->opslab_freed; o = *too; @@ -296,7 +316,7 @@ Perl_Slab_to_rw(pTHX_ OPSLAB *const slab } #else -# define Slab_to_rw(op) +# define Slab_to_rw(op) NOOP #endif /* This cannot possibly be right, but it was copied from the old slab @@ -533,9 +553,10 @@ S_bad_type_pv(pTHX_ I32 n, const char *t } STATIC void -S_bad_type_sv(pTHX_ I32 n, const char *t, SV *namesv, U32 flags, const OP *kid) +S_bad_type_gv(pTHX_ I32 n, const char *t, GV *gv, U32 flags, const OP *kid) { - PERL_ARGS_ASSERT_BAD_TYPE_SV; + SV * const namesv = gv_ename(gv); + PERL_ARGS_ASSERT_BAD_TYPE_GV; yyerror_pv(Perl_form(aTHX_ "Type of arg %d to %"SVf" must be %s (not %s)", (int)n, SVfARG(namesv), t, OP_DESC(kid)), SvUTF8(namesv) | flags); @@ -669,6 +690,15 @@ S_op_destroy(pTHX_ OP *o) /* Destructor */ +/* +=for apidoc Am|void|op_free|OP *o + +Free an op. Only use this when an op is no longer linked to from any +optree. + +=cut +*/ + void Perl_op_free(pTHX_ OP *o) { @@ -725,9 +755,8 @@ Perl_op_free(pTHX_ OP *o) if (type == OP_NULL) type = (OPCODE)o->op_targ; - if (o->op_slabbed) { - Slab_to_rw(OpSLAB(o)); - } + if (o->op_slabbed) + Slab_to_rw(OpSLAB(o)); /* COP* is not cleared by op_clear() so that we may track line * numbers etc even after null() */ @@ -923,6 +952,8 @@ S_cop_free(pTHX_ COP* cop) if (! specialWARN(cop->cop_warnings)) PerlMemShared_free(cop->cop_warnings); cophh_free(CopHINTHASH_get(cop)); + if (PL_curcop == cop) + PL_curcop = NULL; } STATIC void @@ -982,6 +1013,15 @@ S_find_and_forget_pmops(pTHX_ OP *o) } } +/* +=for apidoc Am|void|op_null|OP *o + +Neutralizes an op when it is no longer needed, but is still linked to from +other ops. + +=cut +*/ + void Perl_op_null(pTHX_ OP *o) { @@ -1046,7 +1086,7 @@ Perl_op_contextualize(pTHX_ OP *o, I32 c =head1 Optree Manipulation Functions =for apidoc Am|OP*|op_linklist|OP *o -This function is the implementation of the L macro. It should +This function is the implementation of the L macro. It should not be called directly. =cut @@ -1119,6 +1159,121 @@ S_scalarboolean(pTHX_ OP *o) return scalar(o); } +static SV * +S_op_varname(pTHX_ const OP *o) +{ + assert(o); + assert(o->op_type == OP_PADAV || o->op_type == OP_RV2AV || + o->op_type == OP_PADHV || o->op_type == OP_RV2HV); + { + const char funny = o->op_type == OP_PADAV + || o->op_type == OP_RV2AV ? '@' : '%'; + if (o->op_type == OP_RV2AV || o->op_type == OP_RV2HV) { + GV *gv; + if (cUNOPo->op_first->op_type != OP_GV + || !(gv = cGVOPx_gv(cUNOPo->op_first))) + return NULL; + return varname(gv, funny, 0, NULL, 0, 1); + } + return + varname(MUTABLE_GV(PL_compcv), funny, o->op_targ, NULL, 0, 1); + } +} + +static void +S_op_pretty(pTHX_ const OP *o, SV **retsv, const char **retpv) +{ /* or not so pretty :-) */ + if (o->op_type == OP_CONST) { + *retsv = cSVOPo_sv; + if (SvPOK(*retsv)) { + SV *sv = *retsv; + *retsv = sv_newmortal(); + pv_pretty(*retsv, SvPVX_const(sv), SvCUR(sv), 32, NULL, NULL, + PERL_PV_PRETTY_DUMP |PERL_PV_ESCAPE_UNI_DETECT); + } + else if (!SvOK(*retsv)) + *retpv = "undef"; + } + else *retpv = "..."; +} + +static void +S_scalar_slice_warning(pTHX_ const OP *o) +{ + OP *kid; + const char lbrack = + o->op_type == OP_HSLICE ? '{' : '['; + const char rbrack = + o->op_type == OP_HSLICE ? '}' : ']'; + SV *name; + SV *keysv = NULL; /* just to silence compiler warnings */ + const char *key = NULL; + + if (!(o->op_private & OPpSLICEWARNING)) + return; + if (PL_parser && PL_parser->error_count) + /* This warning can be nonsensical when there is a syntax error. */ + return; + + kid = cLISTOPo->op_first; + kid = kid->op_sibling; /* get past pushmark */ + /* weed out false positives: any ops that can return lists */ + switch (kid->op_type) { + case OP_BACKTICK: + case OP_GLOB: + case OP_READLINE: + case OP_MATCH: + case OP_RV2AV: + case OP_EACH: + case OP_VALUES: + case OP_KEYS: + case OP_SPLIT: + case OP_LIST: + case OP_SORT: + case OP_REVERSE: + case OP_ENTERSUB: + case OP_CALLER: + case OP_LSTAT: + case OP_STAT: + case OP_READDIR: + case OP_SYSTEM: + case OP_TMS: + case OP_LOCALTIME: + case OP_GMTIME: + case OP_ENTEREVAL: + case OP_REACH: + case OP_RKEYS: + case OP_RVALUES: + return; + } + + /* Don't warn if we have a nulled list either. */ + if (kid->op_type == OP_NULL && kid->op_targ == OP_LIST) + return; + + assert(kid->op_sibling); + name = S_op_varname(aTHX_ kid->op_sibling); + if (!name) /* XS module fiddling with the op tree */ + return; + S_op_pretty(aTHX_ kid, &keysv, &key); + assert(SvPOK(name)); + sv_chop(name,SvPVX(name)+1); + if (key) + /* diag_listed_as: Scalar value @%s[%s] better written as $%s[%s] */ + Perl_warner(aTHX_ packWARN(WARN_SYNTAX), + "Scalar value @%"SVf"%c%s%c better written as $%"SVf + "%c%s%c", + SVfARG(name), lbrack, key, rbrack, SVfARG(name), + lbrack, key, rbrack); + else + /* diag_listed_as: Scalar value @%s[%s] better written as $%s[%s] */ + Perl_warner(aTHX_ packWARN(WARN_SYNTAX), + "Scalar value @%"SVf"%c%"SVf"%c better written as $%" + SVf"%c%"SVf"%c", + SVfARG(name), lbrack, keysv, rbrack, + SVfARG(name), lbrack, keysv, rbrack); +} + OP * Perl_scalar(pTHX_ OP *o) { @@ -1181,6 +1336,46 @@ Perl_scalar(pTHX_ OP *o) case OP_SORT: Perl_ck_warner(aTHX_ packWARN(WARN_VOID), "Useless use of sort in scalar context"); break; + case OP_KVHSLICE: + case OP_KVASLICE: + { + /* Warn about scalar context */ + const char lbrack = o->op_type == OP_KVHSLICE ? '{' : '['; + const char rbrack = o->op_type == OP_KVHSLICE ? '}' : ']'; + SV *name; + SV *keysv; + const char *key = NULL; + + /* This warning can be nonsensical when there is a syntax error. */ + if (PL_parser && PL_parser->error_count) + break; + + if (!ckWARN(WARN_SYNTAX)) break; + + kid = cLISTOPo->op_first; + kid = kid->op_sibling; /* get past pushmark */ + assert(kid->op_sibling); + name = S_op_varname(aTHX_ kid->op_sibling); + if (!name) /* XS module fiddling with the op tree */ + break; + S_op_pretty(aTHX_ kid, &keysv, &key); + assert(SvPOK(name)); + sv_chop(name,SvPVX(name)+1); + if (key) + /* diag_listed_as: %%s[%s] in scalar context better written as $%s[%s] */ + Perl_warner(aTHX_ packWARN(WARN_SYNTAX), + "%%%"SVf"%c%s%c in scalar context better written " + "as $%"SVf"%c%s%c", + SVfARG(name), lbrack, key, rbrack, SVfARG(name), + lbrack, key, rbrack); + else + /* diag_listed_as: %%s[%s] in scalar context better written as $%s[%s] */ + Perl_warner(aTHX_ packWARN(WARN_SYNTAX), + "%%%"SVf"%c%"SVf"%c in scalar context better " + "written as $%"SVf"%c%"SVf"%c", + SVfARG(name), lbrack, keysv, rbrack, + SVfARG(name), lbrack, keysv, rbrack); + } } return o; } @@ -1272,8 +1467,10 @@ Perl_scalarvoid(pTHX_ OP *o) case OP_AELEMFAST: case OP_AELEMFAST_LEX: case OP_ASLICE: + case OP_KVASLICE: case OP_HELEM: case OP_HSLICE: + case OP_KVHSLICE: case OP_UNPACK: case OP_PACK: case OP_JOIN: @@ -1379,29 +1576,16 @@ Perl_scalarvoid(pTHX_ OP *o) else if (SvNIOK(sv) && (SvNV(sv) == 0.0 || SvNV(sv) == 1.0)) useless = NULL; else if (SvPOK(sv)) { - /* perl4's way of mixing documentation and code - (before the invention of POD) was based on a - trick to mix nroff and perl code. The trick was - built upon these three nroff macros being used in - void context. The pink camel has the details in - the script wrapman near page 319. */ - const char * const maybe_macro = SvPVX_const(sv); - if (strnEQ(maybe_macro, "di", 2) || - strnEQ(maybe_macro, "ds", 2) || - strnEQ(maybe_macro, "ig", 2)) - useless = NULL; - else { - SV * const dsv = newSVpvs(""); - useless_sv - = Perl_newSVpvf(aTHX_ - "a constant (%s)", - pv_pretty(dsv, maybe_macro, - SvCUR(sv), 32, NULL, NULL, - PERL_PV_PRETTY_DUMP - | PERL_PV_ESCAPE_NOCLEAR - | PERL_PV_ESCAPE_UNI_DETECT)); - SvREFCNT_dec_NN(dsv); - } + SV * const dsv = newSVpvs(""); + useless_sv + = Perl_newSVpvf(aTHX_ + "a constant (%s)", + pv_pretty(dsv, SvPVX_const(sv), + SvCUR(sv), 32, NULL, NULL, + PERL_PV_PRETTY_DUMP + | PERL_PV_ESCAPE_NOCLEAR + | PERL_PV_ESCAPE_UNI_DETECT)); + SvREFCNT_dec_NN(dsv); } else if (SvOK(sv)) { useless_sv = Perl_newSVpvf(aTHX_ "a constant (%"SVf")", sv); @@ -1669,8 +1853,8 @@ S_modkids(pTHX_ OP *o, I32 type) /* =for apidoc finalize_optree -This function finalizes the optree. Should be called directly after -the complete optree is built. It does some additional +This function finalizes the optree. Should be called directly after +the complete optree is built. It does some additional checking which can't be done in the normal ck_xxx functions and makes the tree thread-safe. @@ -1720,7 +1904,7 @@ S_finalize_op(pTHX_ OP* o) case OP_EXEC: if ( o->op_sibling && (o->op_sibling->op_type == OP_NEXTSTATE || o->op_sibling->op_type == OP_DBSTATE) - && ckWARN(WARN_SYNTAX)) + && ckWARN(WARN_EXEC)) { if (o->op_sibling->op_sibling) { const OPCODE type = o->op_sibling->op_sibling->op_type; @@ -1762,35 +1946,11 @@ S_finalize_op(pTHX_ OP* o) * Despite being a "constant", the SV is written to, * for reference counts, sv_upgrade() etc. */ if (cSVOPo->op_sv) { - const PADOFFSET ix = pad_alloc(OP_CONST, SVs_PADTMP); - if (o->op_type != OP_METHOD_NAMED && - (SvPADTMP(cSVOPo->op_sv) || SvPADMY(cSVOPo->op_sv))) - { - /* If op_sv is already a PADTMP/MY then it is being used by - * some pad, so make a copy. */ - sv_setsv(PAD_SVl(ix),cSVOPo->op_sv); - if (!SvIsCOW(PAD_SVl(ix))) SvREADONLY_on(PAD_SVl(ix)); - SvREFCNT_dec(cSVOPo->op_sv); - } - else if (o->op_type != OP_METHOD_NAMED - && cSVOPo->op_sv == &PL_sv_undef) { - /* PL_sv_undef is hack - it's unsafe to store it in the - AV that is the pad, because av_fetch treats values of - PL_sv_undef as a "free" AV entry and will merrily - replace them with a new SV, causing pad_alloc to think - that this pad slot is free. (When, clearly, it is not) - */ - SvOK_off(PAD_SVl(ix)); - SvPADTMP_on(PAD_SVl(ix)); - SvREADONLY_on(PAD_SVl(ix)); - } - else { - SvREFCNT_dec(PAD_SVl(ix)); - SvPADTMP_on(cSVOPo->op_sv); - PAD_SETSV(ix, cSVOPo->op_sv); - /* XXX I don't know how this isn't readonly already. */ - if (!SvIsCOW(PAD_SVl(ix))) SvREADONLY_on(PAD_SVl(ix)); - } + const PADOFFSET ix = pad_alloc(OP_CONST, SVf_READONLY); + SvREFCNT_dec(PAD_SVl(ix)); + PAD_SETSV(ix, cSVOPo->op_sv); + /* XXX I don't know how this isn't readonly already. */ + if (!SvIsCOW(PAD_SVl(ix))) SvREADONLY_on(PAD_SVl(ix)); cSVOPo->op_sv = NULL; o->op_targ = ix; } @@ -1801,66 +1961,39 @@ S_finalize_op(pTHX_ OP* o) UNOP *rop; SV *lexname; GV **fields; - SV **svp, *sv; - const char *key = NULL; - STRLEN keylen; + SVOP *key_op; + OP *kid; + bool check_fields; - if (((BINOP*)o)->op_last->op_type != OP_CONST) + if ((key_op = cSVOPx(((BINOP*)o)->op_last))->op_type != OP_CONST) break; - /* Make the CONST have a shared SV */ - svp = cSVOPx_svp(((BINOP*)o)->op_last); - if ((!SvIsCOW(sv = *svp)) - && SvTYPE(sv) < SVt_PVMG && !SvROK(sv)) { - key = SvPV_const(sv, keylen); - lexname = newSVpvn_share(key, - SvUTF8(sv) ? -(I32)keylen : (I32)keylen, - 0); - SvREFCNT_dec_NN(sv); - *svp = lexname; - } + rop = (UNOP*)((BINOP*)o)->op_first; - if ((o->op_private & (OPpLVAL_INTRO))) - break; + goto check_keys; - rop = (UNOP*)((BINOP*)o)->op_first; - if (rop->op_type != OP_RV2HV || rop->op_first->op_type != OP_PADSV) - break; - lexname = *av_fetch(PL_comppad_name, rop->op_first->op_targ, TRUE); - if (!SvPAD_TYPED(lexname)) - break; - fields = (GV**)hv_fetchs(SvSTASH(lexname), "FIELDS", FALSE); - if (!fields || !GvHV(*fields)) - break; - key = SvPV_const(*svp, keylen); - if (!hv_fetch(GvHV(*fields), key, - SvUTF8(*svp) ? -(I32)keylen : (I32)keylen, FALSE)) { - Perl_croak(aTHX_ "No such class field \"%"SVf"\" " - "in variable %"SVf" of type %"HEKf, - SVfARG(*svp), SVfARG(lexname), - HEKfARG(HvNAME_HEK(SvSTASH(lexname)))); - } - break; - } + case OP_HSLICE: + S_scalar_slice_warning(aTHX_ o); - case OP_HSLICE: { - UNOP *rop; - SV *lexname; - GV **fields; - SV **svp; - const char *key; - STRLEN keylen; - SVOP *first_key_op, *key_op; - - if ((o->op_private & (OPpLVAL_INTRO)) - /* I bet there's always a pushmark... */ - || ((LISTOP*)o)->op_first->op_sibling->op_type != OP_LIST) - /* hmmm, no optimization if list contains only one key. */ + case OP_KVHSLICE: + kid = cLISTOPo->op_first->op_sibling; + if (/* I bet there's always a pushmark... */ + OP_TYPE_ISNT_AND_WASNT_NN(kid, OP_LIST) + && OP_TYPE_ISNT_NN(kid, OP_CONST)) + { break; + } + + key_op = (SVOP*)(kid->op_type == OP_CONST + ? kid + : kLISTOP->op_first->op_sibling); + rop = (UNOP*)((LISTOP*)o)->op_last; - if (rop->op_type != OP_RV2HV) - break; - if (rop->op_first->op_type == OP_PADSV) + + check_keys: + if (o->op_private & OPpLVAL_INTRO || rop->op_type != OP_RV2HV) + rop = NULL; + else if (rop->op_first->op_type == OP_PADSV) /* @$hash{qw(keys here)} */ rop = (UNOP*)rop->op_first; else { @@ -1871,26 +2004,38 @@ S_finalize_op(pTHX_ OP* o) rop = (UNOP*)cLISTOPx(rop->op_first)->op_last; } else - break; + rop = NULL; } - lexname = *av_fetch(PL_comppad_name, rop->op_targ, TRUE); - if (!SvPAD_TYPED(lexname)) - break; - fields = (GV**)hv_fetchs(SvSTASH(lexname), "FIELDS", FALSE); - if (!fields || !GvHV(*fields)) - break; - /* Again guessing that the pushmark can be jumped over.... */ - first_key_op = (SVOP*)((LISTOP*)((LISTOP*)o)->op_first->op_sibling) - ->op_first->op_sibling; - for (key_op = first_key_op; key_op; + lexname = NULL; /* just to silence compiler warnings */ + fields = NULL; /* just to silence compiler warnings */ + + check_fields = + rop + && (lexname = *av_fetch(PL_comppad_name, rop->op_targ, TRUE), + SvPAD_TYPED(lexname)) + && (fields = (GV**)hv_fetchs(SvSTASH(lexname), "FIELDS", FALSE)) + && isGV(*fields) && GvHV(*fields); + for (; key_op; key_op = (SVOP*)key_op->op_sibling) { + SV **svp, *sv; if (key_op->op_type != OP_CONST) continue; svp = cSVOPx_svp(key_op); - key = SvPV_const(*svp, keylen); - if (!hv_fetch(GvHV(*fields), key, - SvUTF8(*svp) ? -(I32)keylen : (I32)keylen, FALSE)) { + + /* Make the CONST have a shared SV */ + if ((!SvIsCOW_shared_hash(sv = *svp)) + && SvTYPE(sv) < SVt_PVMG && SvOK(sv) && !SvROK(sv)) { + SSize_t keylen; + const char * const key = SvPV_const(sv, *(STRLEN*)&keylen); + SV *nsv = newSVpvn_share(key, + SvUTF8(sv) ? -keylen : keylen, 0); + SvREFCNT_dec_NN(sv); + *svp = nsv; + } + + if (check_fields + && !hv_fetch_ent(GvHV(*fields), *svp, FALSE, 0)) { Perl_croak(aTHX_ "No such class field \"%"SVf"\" " "in variable %"SVf" of type %"HEKf, SVfARG(*svp), SVfARG(lexname), @@ -1899,6 +2044,9 @@ S_finalize_op(pTHX_ OP* o) } break; } + case OP_ASLICE: + S_scalar_slice_warning(aTHX_ o); + break; case OP_SUBST: { if (cPMOPo->op_pmreplrootu.op_pmreplroot) @@ -1926,7 +2074,7 @@ because it has no op type of its own (it the lvalue op). This function detects things that can't be modified, such as C<$x+1>, and -generates errors for them. For example, C<$x+1 = 2> would cause it to be +generates errors for them. For example, C<$x+1 = 2> would cause it to be called with an op of type OP_ADD and a C argument of OP_SASSIGN. It also flags things that need to behave specially in an lvalue context, @@ -1935,6 +2083,21 @@ such as C<$$x = 5> which might have to v =cut */ +static bool +S_vivifies(const OPCODE type) +{ + switch(type) { + case OP_RV2AV: case OP_ASLICE: + case OP_RV2HV: case OP_KVASLICE: + case OP_RV2SV: case OP_HSLICE: + case OP_AELEMFAST: case OP_KVHSLICE: + case OP_HELEM: + case OP_AELEM: + return 1; + } + return 0; +} + OP * Perl_op_lvalue_flags(pTHX_ OP *o, I32 type, U32 flags) { @@ -2087,13 +2250,22 @@ Perl_op_lvalue_flags(pTHX_ OP *o, I32 ty localize = 1; /* FALL THROUGH */ case OP_AASSIGN: - if (type == OP_LEAVESUBLV) + /* Do not apply the lvsub flag for rv2[ah]v in scalar context. */ + if (type == OP_LEAVESUBLV && ( + (o->op_type != OP_RV2AV && o->op_type != OP_RV2HV) + || (o->op_flags & OPf_WANT) != OPf_WANT_SCALAR + )) o->op_private |= OPpMAYBE_LVSUB; /* FALL THROUGH */ case OP_NEXTSTATE: case OP_DBSTATE: PL_modcount = RETURN_UNLIMITED_NUMBER; break; + case OP_KVHSLICE: + case OP_KVASLICE: + if (type == OP_LEAVESUBLV) + o->op_private |= OPpMAYBE_LVSUB; + goto nomod; case OP_AV2ARYLEN: PL_hints |= HINT_BLOCK_SCOPE; if (type == OP_LEAVESUBLV) @@ -2126,7 +2298,8 @@ Perl_op_lvalue_flags(pTHX_ OP *o, I32 ty return o; /* Treat \(@foo) like ordinary list. */ if (scalar_mod_type(o, type)) goto nomod; - if (type == OP_LEAVESUBLV) + if ((o->op_flags & OPf_WANT) != OPf_WANT_SCALAR + && type == OP_LEAVESUBLV) o->op_private |= OPpMAYBE_LVSUB; /* FALL THROUGH */ case OP_PADSV: @@ -2154,9 +2327,6 @@ Perl_op_lvalue_flags(pTHX_ OP *o, I32 ty lvalue_func: if (type == OP_LEAVESUBLV) o->op_private |= OPpMAYBE_LVSUB; - pad_free(o->op_targ); - o->op_targ = pad_alloc(o->op_type, SVs_PADMY); - assert(SvTYPE(PAD_SV(o->op_targ)) == SVt_NULL); if (o->op_flags & OPf_KIDS) op_lvalue(cBINOPo->op_first->op_sibling, type); break; @@ -2173,8 +2343,10 @@ Perl_op_lvalue_flags(pTHX_ OP *o, I32 ty PL_modcount++; break; - case OP_SCOPE: case OP_LEAVE: + case OP_LEAVELOOP: + o->op_private |= OPpLVALUE; + case OP_SCOPE: case OP_ENTER: case OP_LINESEQ: localize = 0; @@ -2209,6 +2381,16 @@ Perl_op_lvalue_flags(pTHX_ OP *o, I32 ty case OP_COREARGS: return o; + + case OP_AND: + case OP_OR: + if (type == OP_LEAVESUBLV + || !S_vivifies(cLOGOPo->op_first->op_type)) + op_lvalue(cLOGOPo->op_first, type); + if (type == OP_LEAVESUBLV + || !S_vivifies(cLOGOPo->op_first->op_sibling->op_type)) + op_lvalue(cLOGOPo->op_first->op_sibling, type); + goto nomod; } /* [20011101.069] File test operators interpret OPf_REF to mean that @@ -2469,7 +2651,6 @@ S_apply_attrs(pTHX_ HV *stash, SV *targe PERL_ARGS_ASSERT_APPLY_ATTRS; /* fake up C */ - ENTER; /* need to protect against side-effects of 'use' */ #define ATTRSMODULE "attributes" #define ATTRSMODULE_PM "attributes.pm" @@ -2483,7 +2664,6 @@ S_apply_attrs(pTHX_ HV *stash, SV *targe newSVOP(OP_CONST, 0, newRV(target)), dup_attrlist(attrs)))); - LEAVE; } STATIC void @@ -2503,7 +2683,6 @@ S_apply_attrs_my(pTHX_ HV *stash, OP *ta target->op_type == OP_PADAV); /* Ensure that attributes.pm is loaded. */ - ENTER; /* need to protect against side-effects of 'use' */ /* Don't force the C if we don't need it. */ svp = hv_fetchs(GvHVn(PL_incgv), ATTRSMODULE_PM, FALSE); if (svp && *svp != &PL_sv_undef) @@ -2511,7 +2690,6 @@ S_apply_attrs_my(pTHX_ HV *stash, OP *ta else Perl_load_module(aTHX_ PERL_LOADMOD_NOIMPORT, newSVpvs(ATTRSMODULE), NULL); - LEAVE; /* Need package name for method call. */ pack = newSVOP(OP_CONST, 0, newSVpvs(ATTRSMODULE)); @@ -2589,6 +2767,114 @@ Perl_apply_attrs_string(pTHX_ const char attrs))); } +STATIC void +S_move_proto_attr(pTHX_ OP **proto, OP **attrs, const GV * name) +{ + OP *new_proto = NULL; + STRLEN pvlen; + char *pv; + OP *o; + + PERL_ARGS_ASSERT_MOVE_PROTO_ATTR; + + if (!*attrs) + return; + + o = *attrs; + if (o->op_type == OP_CONST) { + pv = SvPV(cSVOPo_sv, pvlen); + if (pvlen >= 10 && memEQ(pv, "prototype(", 10)) { + SV * const tmpsv = newSVpvn_flags(pv + 10, pvlen - 11, SvUTF8(cSVOPo_sv)); + SV ** const tmpo = cSVOPx_svp(o); + SvREFCNT_dec(cSVOPo_sv); + *tmpo = tmpsv; + new_proto = o; + *attrs = NULL; + } + } else if (o->op_type == OP_LIST) { + OP * lasto = NULL; + assert(o->op_flags & OPf_KIDS); + assert(cLISTOPo->op_first->op_type == OP_PUSHMARK); + /* Counting on the first op to hit the lasto = o line */ + for (o = cLISTOPo->op_first; o; o=o->op_sibling) { + if (o->op_type == OP_CONST) { + pv = SvPV(cSVOPo_sv, pvlen); + if (pvlen >= 10 && memEQ(pv, "prototype(", 10)) { + SV * const tmpsv = newSVpvn_flags(pv + 10, pvlen - 11, SvUTF8(cSVOPo_sv)); + SV ** const tmpo = cSVOPx_svp(o); + SvREFCNT_dec(cSVOPo_sv); + *tmpo = tmpsv; + if (new_proto && ckWARN(WARN_MISC)) { + STRLEN new_len; + const char * newp = SvPV(cSVOPo_sv, new_len); + Perl_warner(aTHX_ packWARN(WARN_MISC), + "Attribute prototype(%"UTF8f") discards earlier prototype attribute in same sub", + UTF8fARG(SvUTF8(cSVOPo_sv), new_len, newp)); + op_free(new_proto); + } + else if (new_proto) + op_free(new_proto); + new_proto = o; + lasto->op_sibling = o->op_sibling; + continue; + } + } + lasto = o; + } + /* If the list is now just the PUSHMARK, scrap the whole thing; otherwise attributes.xs + would get pulled in with no real need */ + if (!cLISTOPx(*attrs)->op_first->op_sibling) { + op_free(*attrs); + *attrs = NULL; + } + } + + if (new_proto) { + SV *svname; + if (isGV(name)) { + svname = sv_newmortal(); + gv_efullname3(svname, name, NULL); + } + else if (SvPOK(name) && *SvPVX((SV *)name) == '&') + svname = newSVpvn_flags(SvPVX((SV *)name)+1, SvCUR(name)-1, SvUTF8(name)|SVs_TEMP); + else + svname = (SV *)name; + if (ckWARN(WARN_ILLEGALPROTO)) + (void)validate_proto(svname, cSVOPx_sv(new_proto), TRUE); + if (*proto && ckWARN(WARN_PROTOTYPE)) { + STRLEN old_len, new_len; + const char * oldp = SvPV(cSVOPx_sv(*proto), old_len); + const char * newp = SvPV(cSVOPx_sv(new_proto), new_len); + + Perl_warner(aTHX_ packWARN(WARN_PROTOTYPE), + "Prototype '%"UTF8f"' overridden by attribute 'prototype(%"UTF8f")'" + " in %"SVf, + UTF8fARG(SvUTF8(cSVOPx_sv(*proto)), old_len, oldp), + UTF8fARG(SvUTF8(cSVOPx_sv(new_proto)), new_len, newp), + SVfARG(svname)); + } + if (*proto) + op_free(*proto); + *proto = new_proto; + } +} + +static void +S_cant_declare(pTHX_ OP *o) +{ + if (o->op_type == OP_NULL + && (o->op_flags & (OPf_SPECIAL|OPf_KIDS)) == OPf_KIDS) + o = cUNOPo->op_first; + yyerror(Perl_form(aTHX_ "Can't declare %s in \"%s\"", + o->op_type == OP_NULL + && o->op_flags & OPf_SPECIAL + ? "do block" + : OP_DESC(o), + PL_parser->in_my == KEY_our ? "our" : + PL_parser->in_my == KEY_state ? "state" : + "my")); +} + STATIC OP * S_my_kid(pTHX_ OP *o, OP *attrs, OP **imopsp) { @@ -2618,11 +2904,7 @@ S_my_kid(pTHX_ OP *o, OP *attrs, OP **im type == OP_RV2AV || type == OP_RV2HV) { /* XXX does this let anything illegal in? */ if (cUNOPo->op_first->op_type != OP_GV) { /* MJD 20011224 */ - yyerror(Perl_form(aTHX_ "Can't declare %s in \"%s\"", - OP_DESC(o), - PL_parser->in_my == KEY_our - ? "our" - : PL_parser->in_my == KEY_state ? "state" : "my")); + S_cant_declare(aTHX_ o); } else if (attrs) { GV * const gv = cGVOPx_gv(cUNOPo->op_first); PL_parser->in_my = FALSE; @@ -2641,11 +2923,7 @@ S_my_kid(pTHX_ OP *o, OP *attrs, OP **im type != OP_PADHV && type != OP_PUSHMARK) { - yyerror(Perl_form(aTHX_ "Can't declare %s in \"%s\"", - OP_DESC(o), - PL_parser->in_my == KEY_our - ? "our" - : PL_parser->in_my == KEY_state ? "state" : "my")); + S_cant_declare(aTHX_ o); return o; } else if (attrs && type != OP_PUSHMARK) { @@ -2743,16 +3021,8 @@ Perl_bind_match(pTHX_ I32 type, OP *left ) ? (int)rtype : OP_MATCH]; const bool isary = ltype == OP_RV2AV || ltype == OP_PADAV; - GV *gv; SV * const name = - (ltype == OP_RV2AV || ltype == OP_RV2HV) - ? cUNOPx(left)->op_first->op_type == OP_GV - && (gv = cGVOPx_gv(cUNOPx(left)->op_first)) - ? varname(gv, isary ? '@' : '%', 0, NULL, 0, 1) - : NULL - : varname( - (GV *)PL_compcv, isary ? '@' : '%', left->op_targ, NULL, 0, 1 - ); + S_op_varname(aTHX_ left); if (name) Perl_warner(aTHX_ packWARN(WARN_MISC), "Applying %s to %"SVf" will act on scalar(%"SVf")", @@ -2776,8 +3046,10 @@ Perl_bind_match(pTHX_ I32 type, OP *left /* !~ doesn't make sense with /r, so error on it for now */ if (rtype == OP_SUBST && (cPMOPx(right)->op_pmflags & PMf_NONDESTRUCT) && type == OP_NOT) + /* diag_listed_as: Using !~ with %s doesn't make sense */ yyerror("Using !~ with s///r doesn't make sense"); if (rtype == OP_TRANSR && type == OP_NOT) + /* diag_listed_as: Using !~ with %s doesn't make sense */ yyerror("Using !~ with tr///r doesn't make sense"); ismatchop = (rtype == OP_MATCH || @@ -2906,7 +3178,6 @@ Perl_block_end(pTHX_ I32 floor, OP *seq) CALL_BLOCK_HOOKS(bhk_pre_end, &retval); LEAVE_SCOPE(floor); - CopHINTS_set(&PL_compiling, PL_hints); if (needblockscope) PL_hints |= HINT_BLOCK_SCOPE; /* propagate out */ o = pad_leavemy(); @@ -2981,7 +3252,7 @@ Perl_block_end(pTHX_ I32 floor, OP *seq) =for apidoc Aox||blockhook_register Register a set of hooks to be called when the Perl lexical scope changes -at compile time. See L. +at compile time. See L. =cut */ @@ -3044,6 +3315,7 @@ Perl_newPROG(pTHX_ OP *o) ENTER; CALL_PEEP(PL_eval_start); finalize_optree(PL_eval_root); + S_prune_chain_head(aTHX_ &PL_eval_start); LEAVE; PL_savestack_ix = i; } @@ -3088,6 +3360,7 @@ Perl_newPROG(pTHX_ OP *o) PL_main_root->op_next = 0; CALL_PEEP(PL_main_start); finalize_optree(PL_main_root); + S_prune_chain_head(aTHX_ &PL_main_start); cv_forget_slab(PL_compcv); PL_compcv = 0; @@ -3242,6 +3515,7 @@ S_fold_constants(pTHX_ OP *o) case OP_LCFIRST: case OP_UC: case OP_LC: + case OP_FC: case OP_SLT: case OP_SGT: case OP_SLE: @@ -3270,6 +3544,11 @@ S_fold_constants(pTHX_ OP *o) break; case OP_REPEAT: if (o->op_private & OPpREPEAT_DOLIST) goto nope; + break; + case OP_SREFGEN: + if (cUNOPx(cUNOPo->op_first)->op_first->op_type != OP_CONST + || SvPADTMP(cSVOPx_sv(cUNOPx(cUNOPo->op_first)->op_first))) + goto nope; } if (PL_parser && PL_parser->error_count) @@ -3324,6 +3603,7 @@ S_fold_constants(pTHX_ OP *o) SvREFCNT_inc_simple_void(sv); SvTEMP_off(sv); } + else { assert(SvIMMORTAL(sv)); } break; case 3: /* Something tried to die. Abandon constant folding. */ @@ -3355,10 +3635,18 @@ S_fold_constants(pTHX_ OP *o) op_free(o); #endif assert(sv); + if (type == OP_STRINGIFY) SvPADTMP_off(sv); + else if (!SvIMMORTAL(sv)) { + SvPADTMP_on(sv); + SvREADONLY_on(sv); + } if (type == OP_RV2GV) newop = newGVOP(OP_GV, 0, MUTABLE_GV(sv)); else - newop = newSVOP(OP_CONST, OPpCONST_FOLDED<<8, MUTABLE_SV(sv)); + { + newop = newSVOP(OP_CONST, 0, MUTABLE_SV(sv)); + if (type != OP_STRINGIFY) newop->op_folded = 1; + } op_getmad(o,newop,'f'); return newop; @@ -3371,15 +3659,19 @@ S_gen_constant_list(pTHX_ OP *o) { dVAR; OP *curop; - const I32 oldtmps_floor = PL_tmps_floor; + const SSize_t oldtmps_floor = PL_tmps_floor; + SV **svp; + AV *av; list(o); if (PL_parser && PL_parser->error_count) return o; /* Don't attempt to run with errors */ - PL_op = curop = LINKLIST(o); + curop = LINKLIST(o); o->op_next = 0; CALL_PEEP(curop); + S_prune_chain_head(aTHX_ &curop); + PL_op = curop; Perl_pp_pushmark(aTHX); CALLRUNOPS(aTHX); PL_op = curop; @@ -3394,7 +3686,14 @@ S_gen_constant_list(pTHX_ OP *o) o->op_flags |= OPf_PARENS; /* and flatten \(1..2,3) */ o->op_opt = 0; /* needs to be revisited in rpeep() */ curop = ((UNOP*)o)->op_first; - ((UNOP*)o)->op_first = newSVOP(OP_CONST, 0, SvREFCNT_inc_NN(*PL_stack_sp--)); + av = (AV *)SvREFCNT_inc_NN(*PL_stack_sp--); + ((UNOP*)o)->op_first = newSVOP(OP_CONST, 0, (SV *)av); + if (AvFILLp(av) != -1) + for (svp = AvARRAY(av) + AvFILLp(av); svp >= AvARRAY(av); --svp) + { + SvPADTMP_on(*svp); + SvREADONLY_on(*svp); + } #ifdef PERL_MAD op_getmad(curop,o,'O'); #else @@ -4010,7 +4309,7 @@ Perl_newBINOP(pTHX_ I32 type, I32 flags, dVAR; BINOP *binop; - assert((PL_opargs[type] & OA_CLASS_MASK) == OA_BINOP + ASSUME((PL_opargs[type] & OA_CLASS_MASK) == OA_BINOP || type == OP_SASSIGN || type == OP_NULL ); NewOp(1101, binop, 1, BINOP); @@ -4127,11 +4426,9 @@ S_pmtrans(pTHX_ OP *o, OP *expr, OP *rep rend = r + len; } -/* There are several snags with this code on EBCDIC: - 1. 0xFF is a legal UTF-EBCDIC byte (there are no illegal bytes). - 2. scan_const() in toke.c has encoded chars in native encoding which makes - ranges at least in EBCDIC 0..255 range the bottom odd. -*/ +/* There is a snag with this code on EBCDIC: scan_const() in toke.c has + * encoded chars in native encoding which makes ranges in the EBCDIC 0..255 + * odd. */ if (complement) { U8 tmpbuf[UTF8_MAXBYTES+1]; @@ -4141,11 +4438,11 @@ S_pmtrans(pTHX_ OP *o, OP *expr, OP *rep i = 0; transv = newSVpvs(""); while (t < tend) { - cp[2*i] = utf8n_to_uvuni(t, tend-t, &ulen, flags); + cp[2*i] = utf8n_to_uvchr(t, tend-t, &ulen, flags); t += ulen; - if (t < tend && NATIVE_TO_UTF(*t) == 0xff) { + if (t < tend && *t == ILLEGAL_UTF8_BYTE) { t++; - cp[2*i+1] = utf8n_to_uvuni(t, tend-t, &ulen, flags); + cp[2*i+1] = utf8n_to_uvchr(t, tend-t, &ulen, flags); t += ulen; } else { @@ -4158,11 +4455,11 @@ S_pmtrans(pTHX_ OP *o, OP *expr, OP *rep UV val = cp[2*j]; diff = val - nextmin; if (diff > 0) { - t = uvuni_to_utf8(tmpbuf,nextmin); + t = uvchr_to_utf8(tmpbuf,nextmin); sv_catpvn(transv, (char*)tmpbuf, t - tmpbuf); if (diff > 1) { - U8 range_mark = UTF_TO_NATIVE(0xff); - t = uvuni_to_utf8(tmpbuf, val - 1); + U8 range_mark = ILLEGAL_UTF8_BYTE; + t = uvchr_to_utf8(tmpbuf, val - 1); sv_catpvn(transv, (char *)&range_mark, 1); sv_catpvn(transv, (char*)tmpbuf, t - tmpbuf); } @@ -4171,13 +4468,13 @@ S_pmtrans(pTHX_ OP *o, OP *expr, OP *rep if (val >= nextmin) nextmin = val + 1; } - t = uvuni_to_utf8(tmpbuf,nextmin); + t = uvchr_to_utf8(tmpbuf,nextmin); sv_catpvn(transv, (char*)tmpbuf, t - tmpbuf); { - U8 range_mark = UTF_TO_NATIVE(0xff); + U8 range_mark = ILLEGAL_UTF8_BYTE; sv_catpvn(transv, (char *)&range_mark, 1); } - t = uvuni_to_utf8(tmpbuf, 0x7fffffff); + t = uvchr_to_utf8(tmpbuf, 0x7fffffff); sv_catpvn(transv, (char*)tmpbuf, t - tmpbuf); t = (const U8*)SvPVX_const(transv); tlen = SvCUR(transv); @@ -4198,11 +4495,11 @@ S_pmtrans(pTHX_ OP *o, OP *expr, OP *rep while (t < tend || tfirst <= tlast) { /* see if we need more "t" chars */ if (tfirst > tlast) { - tfirst = (I32)utf8n_to_uvuni(t, tend - t, &ulen, flags); + tfirst = (I32)utf8n_to_uvchr(t, tend - t, &ulen, flags); t += ulen; - if (t < tend && NATIVE_TO_UTF(*t) == 0xff) { /* illegal utf8 val indicates range */ + if (t < tend && *t == ILLEGAL_UTF8_BYTE) { /* illegal utf8 val indicates range */ t++; - tlast = (I32)utf8n_to_uvuni(t, tend - t, &ulen, flags); + tlast = (I32)utf8n_to_uvchr(t, tend - t, &ulen, flags); t += ulen; } else @@ -4212,11 +4509,11 @@ S_pmtrans(pTHX_ OP *o, OP *expr, OP *rep /* now see if we need more "r" chars */ if (rfirst > rlast) { if (r < rend) { - rfirst = (I32)utf8n_to_uvuni(r, rend - r, &ulen, flags); + rfirst = (I32)utf8n_to_uvchr(r, rend - r, &ulen, flags); r += ulen; - if (r < rend && NATIVE_TO_UTF(*r) == 0xff) { /* illegal utf8 val indicates range */ + if (r < rend && *r == ILLEGAL_UTF8_BYTE) { /* illegal utf8 val indicates range */ r++; - rlast = (I32)utf8n_to_uvuni(r, rend - r, &ulen, flags); + rlast = (I32)utf8n_to_uvchr(r, rend - r, &ulen, flags); r += ulen; } else @@ -4278,7 +4575,7 @@ S_pmtrans(pTHX_ OP *o, OP *expr, OP *rep swash = MUTABLE_SV(swash_init("utf8", "", listsv, bits, none)); #ifdef USE_ITHREADS - cPADOPo->op_padix = pad_alloc(OP_TRANS, SVs_PADTMP); + cPADOPo->op_padix = pad_alloc(OP_TRANS, SVf_READONLY); SvREFCNT_dec(PAD_SVl(cPADOPo->op_padix)); PAD_SETSV(cPADOPo->op_padix, swash); SvPADTMP_on(swash); @@ -4384,7 +4681,7 @@ S_pmtrans(pTHX_ OP *o, OP *expr, OP *rep if(del && rlen == tlen) { Perl_ck_warner(aTHX_ packWARN(WARN_MISC), "Useless use of /d modifier in transliteration operator"); - } else if(rlen > tlen) { + } else if(rlen > tlen && !complement) { Perl_ck_warner(aTHX_ packWARN(WARN_MISC), "Replacement list is longer than search list"); } @@ -4468,7 +4765,7 @@ Perl_newPMOP(pTHX_ I32 type, I32 flags) } else { SV * const repointer = &PL_sv_undef; av_push(PL_regex_padav, repointer); - pmop->op_pmoffset = av_len(PL_regex_padav); + pmop->op_pmoffset = av_tindex(PL_regex_padav); PL_regex_pad = AvARRAY(PL_regex_padav); } #endif @@ -4601,6 +4898,7 @@ Perl_pmruntime(pTHX_ OP *o, OP *expr, bo /* have to peep the DOs individually as we've removed it from * the op_next chain */ CALL_PEEP(o); + S_prune_chain_head(aTHX_ &(o->op_next)); if (is_compiletime) /* runtime finalizes as part of finalizing whole tree */ finalize_optree(o); @@ -4787,10 +5085,6 @@ Perl_pmruntime(pTHX_ OP *o, OP *expr, bo if (repl) { OP *curop = repl; bool konst; - if (pm->op_pmflags & PMf_EVAL) { - if (CopLINE(PL_curcop) < (line_t)PL_parser->multi_end) - CopLINE_set(PL_curcop, (line_t)PL_parser->multi_end); - } /* If we are looking at s//.../e with a single statement, get past the implicit do{}. */ if (curop->op_type == OP_NULL && curop->op_flags & OPf_KIDS @@ -4921,7 +5215,6 @@ Perl_newPADOP(pTHX_ I32 type, I32 flags, SvREFCNT_dec(PAD_SVl(padop->op_padix)); PAD_SETSV(padop->op_padix, sv); assert(sv); - SvPADTMP_on(sv); padop->op_next = (OP*)padop; padop->op_flags = (U8)flags; if (PL_opargs[type] & OA_RETSCALAR) @@ -4931,7 +5224,7 @@ Perl_newPADOP(pTHX_ I32 type, I32 flags, return CHECKOP(type, padop); } -#endif /* !USE_ITHREADS */ +#endif /* USE_ITHREADS */ /* =for apidoc Am|OP *|newGVOP|I32 type|I32 flags|GV *gv @@ -4966,7 +5259,7 @@ Perl_newGVOP(pTHX_ I32 type, I32 flags, Constructs, checks, and returns an op of any type that involves an embedded C-level pointer (PV). I is the opcode. I gives the eight bits of C. I supplies the C-level pointer, which -must have been allocated using L; the memory will +must have been allocated using C; the memory will be freed when the op is destroyed. =cut @@ -5211,7 +5504,8 @@ Loads the module whose name is pointed t Note that the actual module name, not its filename, should be given. Eg, "Foo::Bar" instead of "Foo/Bar.pm". flags can be any of PERL_LOADMOD_DENY, PERL_LOADMOD_NOIMPORT, or PERL_LOADMOD_IMPORT_OPS -(or 0 for no flags). ver, if specified and not NULL, provides version semantics +(or 0 for no flags). ver, if specified +and not NULL, provides version semantics similar to C. The optional trailing SV* arguments can be used to specify arguments to the module's import() method, similar to C. They must be @@ -5284,7 +5578,8 @@ Perl_vload_module(pTHX_ U32 flags, SV *n * that it has a PL_parser to play with while doing that, and also * that it doesn't mess with any existing parser, by creating a tmp * new parser with lex_start(). This won't actually be used for much, - * since pp_require() will create another parser for the real work. */ + * since pp_require() will create another parser for the real work. + * The ENTER/LEAVE pair protect callers from any side effects of use. */ ENTER; SAVEVPTR(PL_curcop); @@ -5294,28 +5589,26 @@ Perl_vload_module(pTHX_ U32 flags, SV *n LEAVE; } +PERL_STATIC_INLINE OP * +S_new_entersubop(pTHX_ GV *gv, OP *arg) +{ + return newUNOP(OP_ENTERSUB, OPf_STACKED, + newLISTOP(OP_LIST, 0, arg, + newUNOP(OP_RV2CV, 0, + newGVOP(OP_GV, 0, gv)))); +} + OP * Perl_dofile(pTHX_ OP *term, I32 force_builtin) { dVAR; OP *doop; - GV *gv = NULL; + GV *gv; PERL_ARGS_ASSERT_DOFILE; - if (!force_builtin) { - gv = gv_fetchpvs("do", GV_NOTQUAL, SVt_PVCV); - if (!(gv && GvCVu(gv) && GvIMPORTED_CV(gv))) { - GV * const * const gvp = (GV**)hv_fetchs(PL_globalstash, "do", FALSE); - gv = gvp ? *gvp : NULL; - } - } - - if (gv && GvCVu(gv) && GvIMPORTED_CV(gv)) { - doop = newUNOP(OP_ENTERSUB, OPf_STACKED, - op_append_elem(OP_LIST, term, - scalar(newUNOP(OP_RV2CV, 0, - newGVOP(OP_GV, 0, gv))))); + if (!force_builtin && (gv = gv_override("do", 2))) { + doop = S_new_entersubop(aTHX_ gv, term); } else { doop = newUNOP(OP_DOFILE, 0, scalar(term)); @@ -5379,7 +5672,8 @@ S_is_list_assignment(pTHX_ const OP *o) if (type == OP_LIST || flags & OPf_PARENS || type == OP_RV2AV || type == OP_RV2HV || - type == OP_ASLICE || type == OP_HSLICE) + type == OP_ASLICE || type == OP_HSLICE || + type == OP_KVASLICE || type == OP_KVHSLICE) return TRUE; if (type == OP_PADAV || type == OP_PADHV) @@ -5430,24 +5724,20 @@ S_aassign_common_vars(pTHX_ OP* o) return TRUE; } else if (curop->op_type == OP_PUSHRE) { + GV *const gv = #ifdef USE_ITHREADS - if (((PMOP*)curop)->op_pmreplrootu.op_pmtargetoff) { - GV *const gv = MUTABLE_GV(PAD_SVl(((PMOP*)curop)->op_pmreplrootu.op_pmtargetoff)); - if (gv == PL_defgv - || (int)GvASSIGN_GENERATION(gv) == PL_generation) - return TRUE; - GvASSIGN_GENERATION_set(gv, PL_generation); - } + ((PMOP*)curop)->op_pmreplrootu.op_pmtargetoff + ? MUTABLE_GV(PAD_SVl(((PMOP*)curop)->op_pmreplrootu.op_pmtargetoff)) + : NULL; #else - GV *const gv - = ((PMOP*)curop)->op_pmreplrootu.op_pmtargetgv; + ((PMOP*)curop)->op_pmreplrootu.op_pmtargetgv; +#endif if (gv) { if (gv == PL_defgv || (int)GvASSIGN_GENERATION(gv) == PL_generation) return TRUE; GvASSIGN_GENERATION_set(gv, PL_generation); } -#endif } else return TRUE; @@ -5508,14 +5798,16 @@ Perl_newASSIGNOP(pTHX_ I32 flags, OP *le OP *curop; bool maybe_common_vars = TRUE; + if (left->op_type == OP_ASLICE || left->op_type == OP_HSLICE) + left->op_private &= ~ OPpSLICEWARNING; + PL_modcount = 0; left = op_lvalue(left, OP_AASSIGN); curop = list(force_list(left)); o = newBINOP(OP_AASSIGN, flags, list(force_list(right)), curop); o->op_private = (U8)(0 | (flags >> 8)); - if ((left->op_type == OP_LIST - || (left->op_type == OP_NULL && left->op_targ == OP_LIST))) + if (OP_TYPE_IS_OR_WAS(left, OP_LIST)) { OP* lop = ((LISTOP*)left)->op_first; maybe_common_vars = FALSE; @@ -5541,7 +5833,7 @@ Perl_newASSIGNOP(pTHX_ I32 flags, OP *le (state $a, my $b, our $c, $d, undef) = ... */ } } else if (lop->op_type == OP_UNDEF || - lop->op_type == OP_PUSHMARK) { + OP_TYPE_IS_OR_WAS(lop, OP_PUSHMARK)) { /* undef may be interesting in (state $a, undef, state $c) */ } else { @@ -5633,9 +5925,22 @@ Perl_newASSIGNOP(pTHX_ I32 flags, OP *le if (PL_modcount < RETURN_UNLIMITED_NUMBER && ((LISTOP*)right)->op_last->op_type == OP_CONST) { - SV *sv = ((SVOP*)((LISTOP*)right)->op_last)->op_sv; + SV ** const svp = + &((SVOP*)((LISTOP*)right)->op_last)->op_sv; + SV * const sv = *svp; if (SvIOK(sv) && SvIVX(sv) == 0) + { + if (right->op_private & OPpSPLIT_IMPLIM) { + /* our own SV, created in ck_split */ + SvREADONLY_off(sv); sv_setiv(sv, PL_modcount+1); + } + else { + /* SV may belong to someone else */ + SvREFCNT_dec(sv); + *svp = newSViv(PL_modcount+1); + } + } } } } @@ -5661,7 +5966,7 @@ Perl_newASSIGNOP(pTHX_ I32 flags, OP *le Constructs a state op (COP). The state op is normally a C op, but will be a C op if debugging is enabled for currently-compiled -code. The state op is populated from L (or L). +code. The state op is populated from C (or C). If I

//' */ if (!dirlen || *(tmp-1) != '/') { *tmp++ = '/'; + } else { + /* So SvCUR_set reports the correct length below */ + dirlen--; } /* name came from an SV, so it will have a '\0' at the @@ -3984,7 +4053,7 @@ PP(pp_require) } else { if (namesv) { /* did we lookup @INC? */ AV * const ar = GvAVn(PL_incgv); - I32 i; + SSize_t i; SV *const msg = newSVpvs_flags("", SVs_TEMP); SV *const inc = newSVpvs_flags("", SVs_TEMP); for (i = 0; i <= AvFILL(ar); i++) { @@ -4050,7 +4119,10 @@ PP(pp_require) than hanging another SV from it. In turn, filter_add() optionally takes the SV to use as the filter (or creates a new SV if passed NULL), so simply pass in whatever value filter_cache has. */ - SV * const datasv = filter_add(S_run_user_filter, filter_cache); + SV * const fc = filter_cache ? newSV(0) : NULL; + SV *datasv; + if (fc) sv_copypv(fc, filter_cache); + datasv = filter_add(S_run_user_filter, fc); IoLINES(datasv) = filter_has_file; IoTOP_GV(datasv) = MUTABLE_GV(filter_state); IoBOTTOM_GV(datasv) = MUTABLE_GV(filter_sub); @@ -4246,7 +4318,7 @@ PP(pp_leaveeval) TAINT_NOT; SP = adjust_stack_on_leave((gimme == G_VOID) ? SP : newsp, SP, newsp, - gimme, SVs_TEMP); + gimme, SVs_TEMP, FALSE); PL_curpm = newpm; /* Don't pop $1 et al till now */ #ifdef DEBUGGING @@ -4344,7 +4416,8 @@ PP(pp_leavetry) PERL_UNUSED_VAR(optype); TAINT_NOT; - SP = adjust_stack_on_leave(newsp, SP, newsp, gimme, SVs_PADTMP|SVs_TEMP); + SP = adjust_stack_on_leave(newsp, SP, newsp, gimme, + SVs_PADTMP|SVs_TEMP, FALSE); PL_curpm = newpm; /* Don't pop $1 et al till now */ LEAVE_with_name("eval_scope"); @@ -4390,7 +4463,8 @@ PP(pp_leavegiven) assert(CxTYPE(cx) == CXt_GIVEN); TAINT_NOT; - SP = adjust_stack_on_leave(newsp, SP, newsp, gimme, SVs_PADTMP|SVs_TEMP); + SP = adjust_stack_on_leave(newsp, SP, newsp, gimme, + SVs_PADTMP|SVs_TEMP, FALSE); PL_curpm = newpm; /* Don't pop $1 et al till now */ LEAVE_with_name("given"); @@ -4548,10 +4622,10 @@ S_do_smartmatch(pTHX_ HV *seen_this, HV } else if (SvROK(d) && SvTYPE(SvRV(d)) == SVt_PVAV) { /* Test sub truth for each element */ - I32 i; + SSize_t i; bool andedresults = TRUE; AV *av = (AV*) SvRV(d); - const I32 len = av_len(av); + const I32 len = av_tindex(av); DEBUG_M(Perl_deb(aTHX_ " applying rule Array-CodeRef\n")); if (len == -1) RETPUSHYES; @@ -4610,28 +4684,28 @@ S_do_smartmatch(pTHX_ HV *seen_this, HV /* Check that the key-sets are identical */ HE *he; HV *other_hv = MUTABLE_HV(SvRV(d)); - bool tied = FALSE; - bool other_tied = FALSE; + bool tied; + bool other_tied; U32 this_key_count = 0, other_key_count = 0; HV *hv = MUTABLE_HV(SvRV(e)); DEBUG_M(Perl_deb(aTHX_ " applying rule Hash-Hash\n")); /* Tied hashes don't know how many keys they have. */ - if (SvTIED_mg((SV*)hv, PERL_MAGIC_tied)) { - tied = TRUE; - } - else if (SvTIED_mg((const SV *)other_hv, PERL_MAGIC_tied)) { - HV * const temp = other_hv; - other_hv = hv; - hv = temp; - tied = TRUE; + tied = cBOOL(SvTIED_mg((SV*)hv, PERL_MAGIC_tied)); + other_tied = cBOOL(SvTIED_mg((const SV *)other_hv, PERL_MAGIC_tied)); + if (!tied ) { + if(other_tied) { + /* swap HV sides */ + HV * const temp = other_hv; + other_hv = hv; + hv = temp; + tied = TRUE; + other_tied = FALSE; + } + else if(HvUSEDKEYS((const HV *) hv) != HvUSEDKEYS(other_hv)) + RETPUSHNO; } - if (SvTIED_mg((const SV *)other_hv, PERL_MAGIC_tied)) - other_tied = TRUE; - - if (!tied && HvUSEDKEYS((const HV *) hv) != HvUSEDKEYS(other_hv)) - RETPUSHNO; /* The hashes have the same number of keys, so it suffices to check that one is a subset of the other. */ @@ -4663,8 +4737,8 @@ S_do_smartmatch(pTHX_ HV *seen_this, HV } else if (SvROK(d) && SvTYPE(SvRV(d)) == SVt_PVAV) { AV * const other_av = MUTABLE_AV(SvRV(d)); - const I32 other_len = av_len(other_av) + 1; - I32 i; + const SSize_t other_len = av_tindex(other_av) + 1; + SSize_t i; HV *hv = MUTABLE_HV(SvRV(e)); DEBUG_M(Perl_deb(aTHX_ " applying rule Array-Hash\n")); @@ -4715,8 +4789,8 @@ S_do_smartmatch(pTHX_ HV *seen_this, HV } else if (SvROK(d) && SvTYPE(SvRV(d)) == SVt_PVHV) { AV * const other_av = MUTABLE_AV(SvRV(e)); - const I32 other_len = av_len(other_av) + 1; - I32 i; + const SSize_t other_len = av_tindex(other_av) + 1; + SSize_t i; DEBUG_M(Perl_deb(aTHX_ " applying rule Hash-Array\n")); for (i = 0; i < other_len; ++i) { @@ -4733,11 +4807,11 @@ S_do_smartmatch(pTHX_ HV *seen_this, HV if (SvROK(d) && SvTYPE(SvRV(d)) == SVt_PVAV) { AV *other_av = MUTABLE_AV(SvRV(d)); DEBUG_M(Perl_deb(aTHX_ " applying rule Array-Array\n")); - if (av_len(MUTABLE_AV(SvRV(e))) != av_len(other_av)) + if (av_tindex(MUTABLE_AV(SvRV(e))) != av_tindex(other_av)) RETPUSHNO; else { - I32 i; - const I32 other_len = av_len(other_av); + SSize_t i; + const SSize_t other_len = av_tindex(other_av); if (NULL == seen_this) { seen_this = newHV(); @@ -4792,8 +4866,8 @@ S_do_smartmatch(pTHX_ HV *seen_this, HV sm_regex_array: { PMOP * const matcher = make_matcher((REGEXP*) SvRV(d)); - const I32 this_len = av_len(MUTABLE_AV(SvRV(e))); - I32 i; + const SSize_t this_len = av_tindex(MUTABLE_AV(SvRV(e))); + SSize_t i; for(i = 0; i <= this_len; ++i) { SV * const * const svp = av_fetch(MUTABLE_AV(SvRV(e)), i, FALSE); @@ -4809,8 +4883,8 @@ S_do_smartmatch(pTHX_ HV *seen_this, HV } else if (!SvOK(d)) { /* undef ~~ array */ - const I32 this_len = av_len(MUTABLE_AV(SvRV(e))); - I32 i; + const SSize_t this_len = av_tindex(MUTABLE_AV(SvRV(e))); + SSize_t i; DEBUG_M(Perl_deb(aTHX_ " applying rule Undef-Array\n")); for (i = 0; i <= this_len; ++i) { @@ -4824,8 +4898,8 @@ S_do_smartmatch(pTHX_ HV *seen_this, HV else { sm_any_array: { - I32 i; - const I32 this_len = av_len(MUTABLE_AV(SvRV(e))); + SSize_t i; + const SSize_t this_len = av_tindex(MUTABLE_AV(SvRV(e))); DEBUG_M(Perl_deb(aTHX_ " applying rule Any-Array\n")); for (i = 0; i <= this_len; ++i) { @@ -4968,7 +5042,8 @@ PP(pp_leavewhen) assert(CxTYPE(cx) == CXt_WHEN); TAINT_NOT; - SP = adjust_stack_on_leave(newsp, SP, newsp, gimme, SVs_PADTMP|SVs_TEMP); + SP = adjust_stack_on_leave(newsp, SP, newsp, gimme, + SVs_PADTMP|SVs_TEMP, FALSE); PL_curpm = newpm; /* pop $1 et al */ LEAVE_with_name("when"); @@ -5425,6 +5500,7 @@ S_run_user_filter(pTHX_ int idx, SV *buf if (count > 0) { SV *out = POPs; + SvGETMAGIC(out); if (SvOK(out)) { status = SvIV(out); } @@ -5440,9 +5516,13 @@ S_run_user_filter(pTHX_ int idx, SV *buf LEAVE_with_name("call_filter_sub"); } + if (SvGMAGICAL(upstream)) { + mg_get(upstream); + if (upstream == buf_sv) mg_free(buf_sv); + } if (SvIsCOW(upstream)) sv_force_normal(upstream); if(!err && SvOK(upstream)) { - got_p = SvPV(upstream, got_len); + got_p = SvPV_nomg(upstream, got_len); if (umaxlen) { if (got_len > umaxlen) { prune_from = got_p + umaxlen; @@ -5473,7 +5553,12 @@ S_run_user_filter(pTHX_ int idx, SV *buf if (SvUTF8(upstream)) { SvUTF8_on(cache); } - SvCUR_set(upstream, got_len - cached_len); + if (SvPOK(upstream)) SvCUR_set(upstream, got_len - cached_len); + else + /* Cannot just use sv_setpvn, as that could free the buffer + before we have a chance to assign it. */ + sv_usepvn(upstream, savepvn(got_p, got_len - cached_len), + got_len - cached_len); *prune_from = 0; /* Can't yet be EOF */ if (status == 0) @@ -5485,9 +5570,10 @@ S_run_user_filter(pTHX_ int idx, SV *buf concatenate it then we get a warning about use of uninitialised value. */ if (!err && upstream != buf_sv && - (SvOK(upstream) || SvGMAGICAL(upstream))) { - sv_catsv(buf_sv, upstream); + SvOK(upstream)) { + sv_catsv_nomg(buf_sv, upstream); } + else if (SvOK(upstream)) (void)SvPV_force_nolen(buf_sv); if (status <= 0) { IoLINES(datasv) = 0; @@ -5512,32 +5598,6 @@ S_run_user_filter(pTHX_ int idx, SV *buf return 1; } return status; -} - -/* perhaps someone can come up with a better name for - this? it is not really "absolute", per se ... */ -static bool -S_path_is_absolute(const char *name) -{ - PERL_ARGS_ASSERT_PATH_IS_ABSOLUTE; - - if (PERL_FILE_IS_ABSOLUTE(name) -#ifdef WIN32 - || (*name == '.' && ((name[1] == '/' || - (name[1] == '.' && name[2] == '/')) - || (name[1] == '\\' || - ( name[1] == '.' && name[2] == '\\'))) - ) -#else - || (*name == '.' && (name[1] == '/' || - (name[1] == '.' && name[2] == '/'))) -#endif - ) - { - return TRUE; - } - else - return FALSE; } /* Index: gnu/usr.bin/perl/pp_hot.c =================================================================== RCS file: /mnt/memory/perl/importit/cvs/src/gnu/usr.bin/perl/pp_hot.c,v retrieving revision 1.16 diff -u -p -u -p -r1.16 pp_hot.c --- gnu/usr.bin/perl/pp_hot.c 24 Mar 2014 15:05:13 -0000 1.16 +++ gnu/usr.bin/perl/pp_hot.c 16 Nov 2014 03:22:24 -0000 @@ -61,7 +61,7 @@ PP(pp_gvsv) dVAR; dSP; EXTEND(SP,1); - if (PL_op->op_private & OPpLVAL_INTRO) + if (UNLIKELY(PL_op->op_private & OPpLVAL_INTRO)) PUSHs(save_scalar(cGVOP_gv)); else PUSHs(GvSVn(cGVOP_gv)); @@ -133,9 +133,10 @@ PP(pp_sassign) SV * const temp = left; left = right; right = temp; } - if (TAINTING_get && TAINT_get && !SvTAINTED(right)) + if (TAINTING_get && UNLIKELY(TAINT_get) && !SvTAINTED(right)) TAINT_NOT; - if (PL_op->op_private & OPpASSIGN_CV_TO_GV) { + if (UNLIKELY(PL_op->op_private & OPpASSIGN_CV_TO_GV)) { + /* *foo =\&bar */ SV * const cv = SvRV(right); const U32 cv_type = SvTYPE(cv); const bool is_gv = isGV_with_GP(left); @@ -214,7 +215,7 @@ PP(pp_sassign) } if ( - SvTEMP(left) && !SvSMAGICAL(left) && SvREFCNT(left) == 1 && + UNLIKELY(SvTEMP(left)) && !SvSMAGICAL(left) && SvREFCNT(left) == 1 && (!isGV_with_GP(left) || SvFAKE(left)) && ckWARN(WARN_MISC) ) Perl_warner(aTHX_ @@ -278,16 +279,18 @@ PP(pp_concat) else SvUTF8_off(TARG); } - else { /* $l .= $r */ - if (!SvOK(TARG)) { + else { /* $l .= $r and left == TARG */ + if (!SvOK(left)) { if (left == right && ckWARN(WARN_UNINITIALIZED)) /* $l .= $l */ report_uninit(right); sv_setpvs(left, ""); } - SvPV_force_nomg_nolen(left); + else { + SvPV_force_nomg_nolen(left); + } lbyte = !DO_UTF8(left); if (IN_BYTES) - SvUTF8_off(TARG); + SvUTF8_off(left); } if (!rcopied) { @@ -326,11 +329,11 @@ STATIC void S_pushav(pTHX_ AV* const av) { dSP; - const I32 maxarg = AvFILL(av) + 1; + const SSize_t maxarg = AvFILL(av) + 1; EXTEND(SP, maxarg); - if (SvRMAGICAL(av)) { - U32 i; - for (i=0; i < (U32)maxarg; i++) { + if (UNLIKELY(SvRMAGICAL(av))) { + PADOFFSET i; + for (i=0; i < (PADOFFSET)maxarg; i++) { SV ** const svp = av_fetch(av, i, FALSE); /* See note in pp_helem, and bug id #27839 */ SP[i+1] = svp @@ -339,7 +342,11 @@ S_pushav(pTHX_ AV* const av) } } else { - Copy(AvARRAY(av), SP+1, maxarg, SV*); + PADOFFSET i; + for (i=0; i < (PADOFFSET)maxarg; i++) { + SV * const sv = AvARRAY(av)[i]; + SP[i+1] = LIKELY(sv) ? sv : &PL_sv_undef; + } } SP += maxarg; PUTBACK; @@ -464,9 +471,9 @@ PP(pp_preinc) dVAR; dSP; const bool inc = PL_op->op_type == OP_PREINC || PL_op->op_type == OP_I_PREINC; - if (SvTYPE(TOPs) >= SVt_PVAV || (isGV_with_GP(TOPs) && !SvFAKE(TOPs))) + if (UNLIKELY(SvTYPE(TOPs) >= SVt_PVAV || (isGV_with_GP(TOPs) && !SvFAKE(TOPs)))) Perl_croak_no_modify(); - if (!SvREADONLY(TOPs) && !SvGMAGICAL(TOPs) && SvIOK_notUV(TOPs) && !SvNOK(TOPs) && !SvPOK(TOPs) + if (LIKELY(!SvREADONLY(TOPs) && !SvGMAGICAL(TOPs) && SvIOK_notUV(TOPs) && !SvNOK(TOPs) && !SvPOK(TOPs)) && SvIVX(TOPs) != (inc ? IV_MAX : IV_MIN)) { SvIV_set(TOPs, SvIVX(TOPs) + (inc ? 1 : -1)); @@ -503,7 +510,7 @@ PP(pp_defined) if (is_dor) { PERL_ASYNC_CHECK(); sv = TOPs; - if (!sv || !SvANY(sv)) { + if (UNLIKELY(!sv || !SvANY(sv))) { if (op_type == OP_DOR) --SP; RETURNOP(cLOGOP->op_other); @@ -512,7 +519,7 @@ PP(pp_defined) else { /* OP_DEFINED */ sv = POPs; - if (!sv || !SvANY(sv)) + if (UNLIKELY(!sv || !SvANY(sv))) RETPUSHNO; } @@ -721,8 +728,12 @@ PP(pp_aelemfast) AV * const av = PL_op->op_type == OP_AELEMFAST_LEX ? MUTABLE_AV(PAD_SV(PL_op->op_targ)) : GvAVn(cGVOP_gv); const U32 lval = PL_op->op_flags & OPf_MOD; - SV** const svp = av_fetch(av, PL_op->op_private, lval); + SV** const svp = av_fetch(av, (I8)PL_op->op_private, lval); SV *sv = (svp ? *svp : &PL_sv_undef); + + if (UNLIKELY(!svp && lval)) + DIE(aTHX_ PL_no_aelem, (int)(I8)PL_op->op_private); + EXTEND(SP, 1); if (!lval && SvRMAGICAL(av) && SvGMAGICAL(sv)) /* see note in pp_helem() */ mg_get(sv); @@ -783,7 +794,7 @@ PP(pp_print) Move(MARK, MARK + 1, (SP - MARK) + 1, SV*); ++SP; } - return Perl_tied_method(aTHX_ "PRINT", mark - 1, MUTABLE_SV(io), + return Perl_tied_method(aTHX_ SV_CONST(PRINT), mark - 1, MUTABLE_SV(io), mg, (G_SCALAR | TIED_METHOD_ARGUMENTS_ON_STACK | (PL_op->op_type == OP_SAY @@ -866,18 +877,18 @@ PP(pp_rv2av) SvGETMAGIC(sv); if (SvROK(sv)) { - if (SvAMAGIC(sv)) { + if (UNLIKELY(SvAMAGIC(sv))) { sv = amagic_deref_call(sv, is_pp_rv2av ? to_av_amg : to_hv_amg); } sv = SvRV(sv); - if (SvTYPE(sv) != type) + if (UNLIKELY(SvTYPE(sv) != type)) /* diag_listed_as: Not an ARRAY reference */ DIE(aTHX_ "Not %s reference", is_pp_rv2av ? an_array : a_hash); - else if (PL_op->op_flags & OPf_MOD - && PL_op->op_private & OPpLVAL_INTRO) + else if (UNLIKELY(PL_op->op_flags & OPf_MOD + && PL_op->op_private & OPpLVAL_INTRO)) Perl_croak(aTHX_ "%s", PL_no_localize_ref); } - else if (SvTYPE(sv) != type) { + else if (UNLIKELY(SvTYPE(sv) != type)) { GV *gv; if (!isGV_with_GP(sv)) { @@ -897,7 +908,7 @@ PP(pp_rv2av) SETs(sv); RETURN; } - else if (PL_op->op_private & OPpMAYBE_LVSUB) { + else if (UNLIKELY(PL_op->op_private & OPpMAYBE_LVSUB)) { const I32 flags = is_lvalue_sub(); if (flags && !(flags & OPpENTERSUB_INARGS)) { if (gimme != G_ARRAY) @@ -920,7 +931,7 @@ PP(pp_rv2av) } else if (gimme == G_SCALAR) { dTARGET; - const I32 maxarg = AvFILL(av) + 1; + const SSize_t maxarg = AvFILL(av) + 1; SETi(maxarg); } } else { @@ -935,9 +946,8 @@ PP(pp_rv2av) && (!SvRMAGICAL(sv) || !mg_find(sv, PERL_MAGIC_tied))) SETs(HvUSEDKEYS(sv) ? &PL_sv_yes : sv_2mortal(newSViv(0))); else if (gimme == G_SCALAR) { - dTARGET; + dTARG; TARG = Perl_hv_scalar(aTHX_ MUTABLE_HV(sv)); - SPAGAIN; SETTARG; } } @@ -990,7 +1000,7 @@ PP(pp_aassign) I32 gimme; HV *hash; - I32 i; + SSize_t i; int magic; U32 lval = 0; @@ -1017,13 +1027,13 @@ PP(pp_aassign) ) { EXTEND_MORTAL(lastrelem - firstrelem + 1); for (relem = firstrelem; relem <= lastrelem; relem++) { - if ((sv = *relem)) { + if (LIKELY((sv = *relem))) { TAINT_NOT; /* Each item is independent */ /* Dear TODO test in t/op/sort.t, I love you. (It's relying on a panic, not a "semi-panic" from newSVsv() and then an assertion failure below.) */ - if (SvIS_FREED(sv)) { + if (UNLIKELY(SvIS_FREED(sv))) { Perl_croak(aTHX_ "panic: attempt to copy freed scalar %p", (void*)sv); } @@ -1041,7 +1051,7 @@ PP(pp_aassign) ary = NULL; hash = NULL; - while (lelem <= lastlelem) { + while (LIKELY(lelem <= lastlelem)) { TAINT_NOT; /* Each item stands on its own, taintwise. */ sv = *lelem++; switch (SvTYPE(sv)) { @@ -1055,8 +1065,8 @@ PP(pp_aassign) i = 0; while (relem <= lastrelem) { /* gobble up all the rest */ SV **didstore; - assert(*relem); - SvGETMAGIC(*relem); /* before newSV, in case it dies */ + if (LIKELY(*relem)) + SvGETMAGIC(*relem); /* before newSV, in case it dies */ sv = newSV(0); sv_setsv_nomg(sv, *relem); *(relem++) = sv; @@ -1069,7 +1079,7 @@ PP(pp_aassign) } TAINT_NOT; } - if (PL_delaymagic & DM_ARRAY_ISA) + if (UNLIKELY(PL_delaymagic & DM_ARRAY_ISA)) SvSETMAGIC(MUTABLE_SV(ary)); LEAVE; break; @@ -1084,7 +1094,7 @@ PP(pp_aassign) magic = SvMAGICAL(hash) != 0; odd = ((lastrelem - firsthashrelem)&1)? 0 : 1; - if ( odd ) { + if (UNLIKELY(odd)) { do_oddball(lastrelem, firsthashrelem); /* we have firstlelem to reuse, it's not needed anymore */ @@ -1094,7 +1104,7 @@ PP(pp_aassign) ENTER; SAVEFREESV(SvREFCNT_inc_simple_NN(sv)); hv_clear(hash); - while (relem < lastrelem+odd) { /* gobble up all the rest */ + while (LIKELY(relem < lastrelem+odd)) { /* gobble up all the rest */ HE *didstore; assert(*relem); /* Copy the key if aassign is called in lvalue context, @@ -1154,10 +1164,10 @@ PP(pp_aassign) break; } if (relem <= lastrelem) { - if ( + if (UNLIKELY( SvTEMP(sv) && !SvSMAGICAL(sv) && SvREFCNT(sv) == 1 && (!isGV_with_GP(sv) || SvFAKE(sv)) && ckWARN(WARN_MISC) - ) + )) Perl_warner(aTHX_ packWARN(WARN_MISC), "Useless assignment to a temporary" @@ -1171,74 +1181,82 @@ PP(pp_aassign) break; } } - if (PL_delaymagic & ~DM_DELAY) { + if (UNLIKELY(PL_delaymagic & ~DM_DELAY)) { /* Will be used to set PL_tainting below */ - UV tmp_uid = PerlProc_getuid(); - UV tmp_euid = PerlProc_geteuid(); - UV tmp_gid = PerlProc_getgid(); - UV tmp_egid = PerlProc_getegid(); + Uid_t tmp_uid = PerlProc_getuid(); + Uid_t tmp_euid = PerlProc_geteuid(); + Gid_t tmp_gid = PerlProc_getgid(); + Gid_t tmp_egid = PerlProc_getegid(); + /* XXX $> et al currently silently ignore failures */ if (PL_delaymagic & DM_UID) { #ifdef HAS_SETRESUID - (void)setresuid((PL_delaymagic & DM_RUID) ? PL_delaymagic_uid : (Uid_t)-1, - (PL_delaymagic & DM_EUID) ? PL_delaymagic_euid : (Uid_t)-1, - (Uid_t)-1); + PERL_UNUSED_RESULT( + setresuid((PL_delaymagic & DM_RUID) ? PL_delaymagic_uid : (Uid_t)-1, + (PL_delaymagic & DM_EUID) ? PL_delaymagic_euid : (Uid_t)-1, + (Uid_t)-1)); #else # ifdef HAS_SETREUID - (void)setreuid((PL_delaymagic & DM_RUID) ? PL_delaymagic_uid : (Uid_t)-1, - (PL_delaymagic & DM_EUID) ? PL_delaymagic_euid : (Uid_t)-1); + PERL_UNUSED_RESULT( + setreuid((PL_delaymagic & DM_RUID) ? PL_delaymagic_uid : (Uid_t)-1, + (PL_delaymagic & DM_EUID) ? PL_delaymagic_euid : (Uid_t)-1)); # else # ifdef HAS_SETRUID if ((PL_delaymagic & DM_UID) == DM_RUID) { - (void)setruid(PL_delaymagic_uid); + PERL_UNUSED_RESULT(setruid(PL_delaymagic_uid)); PL_delaymagic &= ~DM_RUID; } # endif /* HAS_SETRUID */ # ifdef HAS_SETEUID if ((PL_delaymagic & DM_UID) == DM_EUID) { - (void)seteuid(PL_delaymagic_euid); + PERL_UNUSED_RESULT(seteuid(PL_delaymagic_euid)); PL_delaymagic &= ~DM_EUID; } # endif /* HAS_SETEUID */ if (PL_delaymagic & DM_UID) { if (PL_delaymagic_uid != PL_delaymagic_euid) DIE(aTHX_ "No setreuid available"); - (void)PerlProc_setuid(PL_delaymagic_uid); + PERL_UNUSED_RESULT(PerlProc_setuid(PL_delaymagic_uid)); } # endif /* HAS_SETREUID */ #endif /* HAS_SETRESUID */ + tmp_uid = PerlProc_getuid(); tmp_euid = PerlProc_geteuid(); } + /* XXX $> et al currently silently ignore failures */ if (PL_delaymagic & DM_GID) { #ifdef HAS_SETRESGID - (void)setresgid((PL_delaymagic & DM_RGID) ? PL_delaymagic_gid : (Gid_t)-1, - (PL_delaymagic & DM_EGID) ? PL_delaymagic_egid : (Gid_t)-1, - (Gid_t)-1); + PERL_UNUSED_RESULT( + setresgid((PL_delaymagic & DM_RGID) ? PL_delaymagic_gid : (Gid_t)-1, + (PL_delaymagic & DM_EGID) ? PL_delaymagic_egid : (Gid_t)-1, + (Gid_t)-1)); #else # ifdef HAS_SETREGID - (void)setregid((PL_delaymagic & DM_RGID) ? PL_delaymagic_gid : (Gid_t)-1, - (PL_delaymagic & DM_EGID) ? PL_delaymagic_egid : (Gid_t)-1); + PERL_UNUSED_RESULT( + setregid((PL_delaymagic & DM_RGID) ? PL_delaymagic_gid : (Gid_t)-1, + (PL_delaymagic & DM_EGID) ? PL_delaymagic_egid : (Gid_t)-1)); # else # ifdef HAS_SETRGID if ((PL_delaymagic & DM_GID) == DM_RGID) { - (void)setrgid(PL_delaymagic_gid); + PERL_UNUSED_RESULT(setrgid(PL_delaymagic_gid)); PL_delaymagic &= ~DM_RGID; } # endif /* HAS_SETRGID */ # ifdef HAS_SETEGID if ((PL_delaymagic & DM_GID) == DM_EGID) { - (void)setegid(PL_delaymagic_egid); + PERL_UNUSED_RESULT(setegid(PL_delaymagic_egid)); PL_delaymagic &= ~DM_EGID; } # endif /* HAS_SETEGID */ if (PL_delaymagic & DM_GID) { if (PL_delaymagic_gid != PL_delaymagic_egid) DIE(aTHX_ "No setregid available"); - (void)PerlProc_setgid(PL_delaymagic_gid); + PERL_UNUSED_RESULT(PerlProc_setgid(PL_delaymagic_gid)); } # endif /* HAS_SETREGID */ #endif /* HAS_SETRESGID */ + tmp_gid = PerlProc_getgid(); tmp_egid = PerlProc_getegid(); } @@ -1296,7 +1314,7 @@ PP(pp_qr) SvROK_on(rv); cvp = &( ReANY((REGEXP *)SvRV(rv))->qr_anoncv); - if ((cv = *cvp) && CvCLONE(*cvp)) { + if (UNLIKELY((cv = *cvp) && CvCLONE(*cvp))) { *cvp = cv_clone(cv); SvREFCNT_dec_NN(cv); } @@ -1307,7 +1325,7 @@ PP(pp_qr) (void)sv_bless(rv, stash); } - if (RX_ISTAINTED(rx)) { + if (UNLIKELY(RX_ISTAINTED(rx))) { SvTAINTED_on(rv); SvTAINTED_on(SvRV(rv)); } @@ -1320,21 +1338,19 @@ PP(pp_match) dVAR; dSP; dTARG; PMOP *pm = cPMOP; PMOP *dynpm = pm; - const char *t; const char *s; const char *strend; + SSize_t curpos = 0; /* initial pos() or current $+[0] */ I32 global; - U8 r_flags = REXEC_CHECKED; + U8 r_flags = 0; const char *truebase; /* Start of string */ REGEXP *rx = PM_GETRE(pm); bool rxtainted; const I32 gimme = GIMME; STRLEN len; - I32 minmatch = 0; const I32 oldsave = PL_savestack_ix; - I32 update_minmatch = 1; I32 had_zerolen = 0; - U32 gpos = 0; + MAGIC *mg = NULL; if (PL_op->op_flags & OPf_STACKED) TARG = POPs; @@ -1348,18 +1364,16 @@ PP(pp_match) PUTBACK; /* EVAL blocks need stack_sp. */ /* Skip get-magic if this is a qr// clone, because regcomp has already done it. */ - s = ReANY(rx)->mother_re + truebase = ReANY(rx)->mother_re ? SvPV_nomg_const(TARG, len) : SvPV_const(TARG, len); - if (!s) + if (!truebase) DIE(aTHX_ "panic: pp_match"); - strend = s + len; + strend = truebase + len; rxtainted = (RX_ISTAINTED(rx) || (TAINT_get && (pm->op_pmflags & PMf_RETAINT))); TAINT_NOT; - RX_MATCH_UTF8_set(rx, DO_UTF8(TARG)); - /* We need to know this in case we fail out early - pos() must be reset */ global = dynpm->op_pmflags & PMf_GLOBAL; @@ -1383,33 +1397,24 @@ PP(pp_match) rx = PM_GETRE(pm); } - if (RX_MINLEN(rx) > (I32)len) { - DEBUG_r(PerlIO_printf(Perl_debug_log, "String shorter than min possible regex match\n")); + if (RX_MINLEN(rx) >= 0 && (STRLEN)RX_MINLEN(rx) > len) { + DEBUG_r(PerlIO_printf(Perl_debug_log, "String shorter than min possible regex match (%" + UVuf" < %"IVdf")\n", + (UV)len, (IV)RX_MINLEN(rx))); goto nope; } - truebase = t = s; - - /* XXXX What part of this is needed with true \G-support? */ + /* get pos() if //g */ if (global) { - RX_OFFS(rx)[0].start = -1; - if (SvTYPE(TARG) >= SVt_PVMG && SvMAGIC(TARG)) { - MAGIC* const mg = mg_find(TARG, PERL_MAGIC_regex_global); - if (mg && mg->mg_len >= 0) { - if (!(RX_EXTFLAGS(rx) & RXf_GPOS_SEEN)) - RX_OFFS(rx)[0].end = RX_OFFS(rx)[0].start = mg->mg_len; - else if (RX_EXTFLAGS(rx) & RXf_ANCH_GPOS) { - r_flags |= REXEC_IGNOREPOS; - RX_OFFS(rx)[0].end = RX_OFFS(rx)[0].start = mg->mg_len; - } else if (RX_EXTFLAGS(rx) & RXf_GPOS_FLOAT) - gpos = mg->mg_len; - else - RX_OFFS(rx)[0].end = RX_OFFS(rx)[0].start = mg->mg_len; - minmatch = (mg->mg_flags & MGf_MINMATCH) ? RX_GOFS(rx) + 1 : 0; - update_minmatch = 0; - } - } + mg = mg_find_mglob(TARG); + if (mg && mg->mg_len >= 0) { + curpos = MgBYTEPOS(mg, TARG, truebase, len); + /* last time pos() was set, it was zero-length match */ + if (mg->mg_flags & MGf_MINMATCH) + had_zerolen = 1; + } } + #ifdef PERL_SAWAMPERSAND if ( RX_NPARENS(rx) || PL_sawampersand @@ -1432,50 +1437,48 @@ PP(pp_match) r_flags &= ~(REXEC_COPY_SKIP_PRE|REXEC_COPY_SKIP_POST); #endif + s = truebase; + play_it_again: - if (global && RX_OFFS(rx)[0].start != -1) { - t = s = RX_OFFS(rx)[0].end + truebase - RX_GOFS(rx); - if ((s + RX_MINLEN(rx)) > strend || s < truebase) { - DEBUG_r(PerlIO_printf(Perl_debug_log, "Regex match can't succeed, so not even tried\n")); - goto nope; - } - if (update_minmatch++) - minmatch = had_zerolen; - } - if (RX_EXTFLAGS(rx) & RXf_USE_INTUIT && - DO_UTF8(TARG) == (RX_UTF8(rx) != 0)) { - /* FIXME - can PL_bostr be made const char *? */ - PL_bostr = (char *)truebase; - s = CALLREG_INTUIT_START(rx, TARG, (char *)s, (char *)strend, r_flags, NULL); + if (global) + s = truebase + curpos; - if (!s) - goto nope; -#ifdef PERL_SAWAMPERSAND - if ( (RX_EXTFLAGS(rx) & RXf_CHECK_ALL) - && !PL_sawampersand - && !(RX_EXTFLAGS(rx) & RXf_PMf_KEEPCOPY) - && !SvROK(TARG)) /* Cannot trust since INTUIT cannot guess ^ */ - goto yup; -#endif - } if (!CALLREGEXEC(rx, (char*)s, (char *)strend, (char*)truebase, - minmatch, TARG, NUM2PTR(void*, gpos), r_flags)) - goto ret_no; + had_zerolen, TARG, NULL, r_flags)) + goto nope; PL_curpm = pm; - if (dynpm->op_pmflags & PMf_ONCE) { + if (dynpm->op_pmflags & PMf_ONCE) #ifdef USE_ITHREADS SvREADONLY_on(PL_regex_pad[dynpm->op_pmoffset]); #else dynpm->op_pmflags |= PMf_USED; #endif - } - gotcha: if (rxtainted) RX_MATCH_TAINTED_on(rx); TAINT_IF(RX_MATCH_TAINTED(rx)); - if (gimme == G_ARRAY) { + + /* update pos */ + + if (global && (gimme != G_ARRAY || (dynpm->op_pmflags & PMf_CONTINUE))) { + if (!mg) + mg = sv_magicext_mglob(TARG); + MgBYTEPOS_set(mg, TARG, truebase, RX_OFFS(rx)[0].end); + if (RX_ZERO_LEN(rx)) + mg->mg_flags |= MGf_MINMATCH; + else + mg->mg_flags &= ~MGf_MINMATCH; + } + + if ((!RX_NPARENS(rx) && !global) || gimme != G_ARRAY) { + LEAVE_SCOPE(oldsave); + RETPUSHYES; + } + + /* push captures on stack */ + + { const I32 nparens = RX_NPARENS(rx); I32 i = (global && !nparens) ? 1 : 0; @@ -1484,11 +1487,13 @@ PP(pp_match) EXTEND_MORTAL(nparens + i); for (i = !i; i <= nparens; i++) { PUSHs(sv_newmortal()); - if ((RX_OFFS(rx)[i].start != -1) && RX_OFFS(rx)[i].end != -1 ) { + if (LIKELY((RX_OFFS(rx)[i].start != -1) + && RX_OFFS(rx)[i].end != -1 )) + { const I32 len = RX_OFFS(rx)[i].end - RX_OFFS(rx)[i].start; - s = RX_OFFS(rx)[i].start + truebase; - if (RX_OFFS(rx)[i].end < 0 || RX_OFFS(rx)[i].start < 0 || - len < 0 || len > strend - s) + const char * const s = RX_OFFS(rx)[i].start + truebase; + if (UNLIKELY(RX_OFFS(rx)[i].end < 0 || RX_OFFS(rx)[i].start < 0 + || len < 0 || len > strend - s)) DIE(aTHX_ "panic: pp_match start/end pointers, i=%ld, " "start=%ld, end=%ld, s=%p, strend=%p, len=%"UVuf, (long) i, (long) RX_OFFS(rx)[i].start, @@ -1499,152 +1504,23 @@ PP(pp_match) } } if (global) { - if (dynpm->op_pmflags & PMf_CONTINUE) { - MAGIC* mg = NULL; - if (SvTYPE(TARG) >= SVt_PVMG && SvMAGIC(TARG)) - mg = mg_find(TARG, PERL_MAGIC_regex_global); - if (!mg) { -#ifdef PERL_OLD_COPY_ON_WRITE - if (SvIsCOW(TARG)) - sv_force_normal_flags(TARG, 0); -#endif - mg = sv_magicext(TARG, NULL, PERL_MAGIC_regex_global, - &PL_vtbl_mglob, NULL, 0); - } - if (RX_OFFS(rx)[0].start != -1) { - mg->mg_len = RX_OFFS(rx)[0].end; - if (RX_OFFS(rx)[0].start + RX_GOFS(rx) == (UV)RX_OFFS(rx)[0].end) - mg->mg_flags |= MGf_MINMATCH; - else - mg->mg_flags &= ~MGf_MINMATCH; - } - } - had_zerolen = (RX_OFFS(rx)[0].start != -1 - && (RX_OFFS(rx)[0].start + RX_GOFS(rx) - == (UV)RX_OFFS(rx)[0].end)); + curpos = (UV)RX_OFFS(rx)[0].end; + had_zerolen = RX_ZERO_LEN(rx); PUTBACK; /* EVAL blocks may use stack */ r_flags |= REXEC_IGNOREPOS | REXEC_NOT_FIRST; goto play_it_again; } - else if (!nparens) - XPUSHs(&PL_sv_yes); LEAVE_SCOPE(oldsave); RETURN; } - else { - if (global) { - MAGIC* mg; - if (SvTYPE(TARG) >= SVt_PVMG && SvMAGIC(TARG)) - mg = mg_find(TARG, PERL_MAGIC_regex_global); - else - mg = NULL; - if (!mg) { -#ifdef PERL_OLD_COPY_ON_WRITE - if (SvIsCOW(TARG)) - sv_force_normal_flags(TARG, 0); -#endif - mg = sv_magicext(TARG, NULL, PERL_MAGIC_regex_global, - &PL_vtbl_mglob, NULL, 0); - } - if (RX_OFFS(rx)[0].start != -1) { - mg->mg_len = RX_OFFS(rx)[0].end; - if (RX_OFFS(rx)[0].start + RX_GOFS(rx) == (UV)RX_OFFS(rx)[0].end) - mg->mg_flags |= MGf_MINMATCH; - else - mg->mg_flags &= ~MGf_MINMATCH; - } - } - LEAVE_SCOPE(oldsave); - RETPUSHYES; - } - -#ifdef PERL_SAWAMPERSAND -yup: /* Confirmed by INTUIT */ -#endif - if (rxtainted) - RX_MATCH_TAINTED_on(rx); - TAINT_IF(RX_MATCH_TAINTED(rx)); - PL_curpm = pm; - if (dynpm->op_pmflags & PMf_ONCE) { -#ifdef USE_ITHREADS - SvREADONLY_on(PL_regex_pad[dynpm->op_pmoffset]); -#else - dynpm->op_pmflags |= PMf_USED; -#endif - } - if (RX_MATCH_COPIED(rx)) - Safefree(RX_SUBBEG(rx)); - RX_MATCH_COPIED_off(rx); - RX_SUBBEG(rx) = NULL; - if (global) { - /* FIXME - should rx->subbeg be const char *? */ - RX_SUBBEG(rx) = (char *) truebase; - RX_SUBOFFSET(rx) = 0; - RX_SUBCOFFSET(rx) = 0; - RX_OFFS(rx)[0].start = s - truebase; - if (RX_MATCH_UTF8(rx)) { - char * const t = (char*)utf8_hop((U8*)s, RX_MINLENRET(rx)); - RX_OFFS(rx)[0].end = t - truebase; - } - else { - RX_OFFS(rx)[0].end = s - truebase + RX_MINLENRET(rx); - } - RX_SUBLEN(rx) = strend - truebase; - goto gotcha; - } -#ifdef PERL_SAWAMPERSAND - if (PL_sawampersand || RX_EXTFLAGS(rx) & RXf_PMf_KEEPCOPY) -#endif - { - I32 off; -#ifdef PERL_ANY_COW - if (SvCANCOW(TARG)) { - if (DEBUG_C_TEST) { - PerlIO_printf(Perl_debug_log, - "Copy on write: pp_match $& capture, type %d, truebase=%p, t=%p, difference %d\n", - (int) SvTYPE(TARG), (void*)truebase, (void*)t, - (int)(t-truebase)); - } - RX_SAVED_COPY(rx) = sv_setsv_cow(RX_SAVED_COPY(rx), TARG); - RX_SUBBEG(rx) - = (char *) SvPVX_const(RX_SAVED_COPY(rx)) + (t - truebase); - assert (SvPOKp(RX_SAVED_COPY(rx))); - } else -#endif - { - - RX_SUBBEG(rx) = savepvn(t, strend - t); -#ifdef PERL_ANY_COW - RX_SAVED_COPY(rx) = NULL; -#endif - } - RX_SUBLEN(rx) = strend - t; - RX_SUBOFFSET(rx) = 0; - RX_SUBCOFFSET(rx) = 0; - RX_MATCH_COPIED_on(rx); - off = RX_OFFS(rx)[0].start = s - t; - RX_OFFS(rx)[0].end = off + RX_MINLENRET(rx); - } -#ifdef PERL_SAWAMPERSAND - else { /* startp/endp are used by @- @+. */ - RX_OFFS(rx)[0].start = s - truebase; - RX_OFFS(rx)[0].end = s - truebase + RX_MINLENRET(rx); - } -#endif - /* match via INTUIT shouldn't have any captures. Let @-, @+, $^N know */ - assert(!RX_NPARENS(rx)); - RX_LASTPAREN(rx) = RX_LASTCLOSEPAREN(rx) = 0; - LEAVE_SCOPE(oldsave); - RETPUSHYES; + /* NOTREACHED */ nope: -ret_no: if (global && !(dynpm->op_pmflags & PMf_CONTINUE)) { - if (SvTYPE(TARG) >= SVt_PVMG && SvMAGIC(TARG)) { - MAGIC* const mg = mg_find(TARG, PERL_MAGIC_regex_global); - if (mg) - mg->mg_len = -1; - } + if (!mg) + mg = mg_find_mglob(TARG); + if (mg) + mg->mg_len = -1; } LEAVE_SCOPE(oldsave); if (gimme == G_ARRAY) @@ -1667,7 +1543,7 @@ Perl_do_readline(pTHX) if (io) { const MAGIC *const mg = SvTIED_mg((const SV *)io, PERL_MAGIC_tiedscalar); if (mg) { - Perl_tied_method(aTHX_ "READLINE", SP, MUTABLE_SV(io), mg, gimme, 0); + Perl_tied_method(aTHX_ SV_CONST(READLINE), SP, MUTABLE_SV(io), mg, gimme, 0); if (gimme == G_SCALAR) { SPAGAIN; SvSetSV_nosteal(TARG, TOPs); @@ -1683,9 +1559,9 @@ Perl_do_readline(pTHX) if (IoFLAGS(io) & IOf_ARGV) { if (IoFLAGS(io) & IOf_START) { IoLINES(io) = 0; - if (av_len(GvAVn(PL_last_in_gv)) < 0) { + if (av_tindex(GvAVn(PL_last_in_gv)) < 0) { IoFLAGS(io) &= ~IOf_START; - do_open(PL_last_in_gv,"-",1,FALSE,O_RDONLY,0,NULL); + do_open6(PL_last_in_gv, "-", 1, NULL, NULL, 0); SvTAINTED_off(GvSVn(PL_last_in_gv)); /* previous tainting irrelevant */ sv_setpvs(GvSVn(PL_last_in_gv), "-"); SvSETMAGIC(GvSV(PL_last_in_gv)); @@ -1709,14 +1585,10 @@ Perl_do_readline(pTHX) } if (!fp) { if ((!io || !(IoFLAGS(io) & IOf_START)) - && ckWARN2(WARN_GLOB, WARN_CLOSED)) + && ckWARN(WARN_CLOSED) + && type != OP_GLOB) { - if (type == OP_GLOB) - Perl_ck_warner_d(aTHX_ packWARN(WARN_GLOB), - "glob failed (can't start child: %s)", - Strerror(errno)); - else - report_evil_fh(PL_last_in_gv); + report_evil_fh(PL_last_in_gv); } if (gimme == G_SCALAR) { /* undef TARG, and push that undefined value */ @@ -1825,8 +1697,11 @@ Perl_do_readline(pTHX) } } for (t1 = SvPVX_const(sv); *t1; t1++) - if (!isALPHANUMERIC(*t1) && - strchr("$&*(){}[]'\";\\|?<>~`", *t1)) +#ifdef __VMS + if (strchr("*%?", *t1)) +#else + if (strchr("$&*(){}[]'\";\\|?<>~`", *t1)) +#endif break; if (*t1 && PerlLIO_lstat(SvPVX_const(sv), &PL_statbuf) < 0) { (void)POPs; /* Unmatched wildcard? Chuck it... */ @@ -1963,11 +1838,11 @@ PP(pp_iter) It has SvPVX of "" and SvCUR of 0, which is what we want. */ STRLEN maxlen = 0; const char *max = SvPV_const(end, maxlen); - if (SvNIOK(cur) || SvCUR(cur) > maxlen) + if (UNLIKELY(SvNIOK(cur) || SvCUR(cur) > maxlen)) RETPUSHNO; oldsv = *itersvp; - if (SvREFCNT(oldsv) == 1 && !SvMAGICAL(oldsv)) { + if (LIKELY(SvREFCNT(oldsv) == 1 && !SvMAGICAL(oldsv))) { /* safe to reuse old SV */ sv_setsv(oldsv, cur); } @@ -1989,12 +1864,12 @@ PP(pp_iter) case CXt_LOOP_LAZYIV: /* integer increment */ { IV cur = cx->blk_loop.state_u.lazyiv.cur; - if (cur > cx->blk_loop.state_u.lazyiv.end) + if (UNLIKELY(cur > cx->blk_loop.state_u.lazyiv.end)) RETPUSHNO; oldsv = *itersvp; /* don't risk potential race */ - if (SvREFCNT(oldsv) == 1 && !SvMAGICAL(oldsv)) { + if (LIKELY(SvREFCNT(oldsv) == 1 && !SvMAGICAL(oldsv))) { /* safe to reuse old SV */ sv_setiv(oldsv, cur); } @@ -2007,7 +1882,7 @@ PP(pp_iter) SvREFCNT_dec_NN(oldsv); } - if (cur == IV_MAX) { + if (UNLIKELY(cur == IV_MAX)) { /* Handle end of range at IV_MAX */ cx->blk_loop.state_u.lazyiv.end = IV_MIN; } else @@ -2029,16 +1904,16 @@ PP(pp_iter) } if (PL_op->op_private & OPpITER_REVERSED) { ix = --cx->blk_loop.state_u.ary.ix; - if (ix <= (av_is_stack ? cx->blk_loop.resetsp : -1)) + if (UNLIKELY(ix <= (av_is_stack ? cx->blk_loop.resetsp : -1))) RETPUSHNO; } else { ix = ++cx->blk_loop.state_u.ary.ix; - if (ix > (av_is_stack ? cx->blk_oldsp : AvFILL(av))) + if (UNLIKELY(ix > (av_is_stack ? cx->blk_oldsp : AvFILL(av)))) RETPUSHNO; } - if (SvMAGICAL(av) || AvREIFY(av)) { + if (UNLIKELY(SvMAGICAL(av) || AvREIFY(av))) { SV * const * const svp = av_fetch(av, ix, FALSE); sv = svp ? *svp : NULL; } @@ -2046,27 +1921,26 @@ PP(pp_iter) sv = AvARRAY(av)[ix]; } - if (sv) { - if (SvIS_FREED(sv)) { + if (LIKELY(sv)) { + if (UNLIKELY(SvIS_FREED(sv))) { *itersvp = NULL; Perl_croak(aTHX_ "Use of freed value in iteration"); } - SvTEMP_off(sv); - SvREFCNT_inc_simple_void_NN(sv); + if (SvPADTMP(sv)) { + assert(!IS_PADGV(sv)); + sv = newSVsv(sv); + } + else { + SvTEMP_off(sv); + SvREFCNT_inc_simple_void_NN(sv); + } + } + else if (!av_is_stack) { + sv = newSVavdefelem(av, ix, 0); } else sv = &PL_sv_undef; - if (!av_is_stack && sv == &PL_sv_undef) { - SV *lv = newSV_type(SVt_PVLV); - LvTYPE(lv) = 'y'; - sv_magic(lv, NULL, PERL_MAGIC_defelem, NULL, 0); - LvTARG(lv) = SvREFCNT_inc_simple(av); - LvTARGOFF(lv) = ix; - LvTARGLEN(lv) = (STRLEN)UV_MAX; - sv = lv; - } - oldsv = *itersvp; *itersvp = sv; SvREFCNT_dec(oldsv); @@ -2089,17 +1963,14 @@ While the pattern is being assembled/con PL_tainted will get set (via TAINT_set) if any component of the pattern is tainted, e.g. /.*$tainted/. At the end of pattern compilation, the RXf_TAINTED flag is set on the pattern if PL_tainted is set (via -TAINT_get). +TAINT_get). It will also be set if any component of the pattern matches +based on locale-dependent behavior. When the pattern is copied, e.g. $r = qr/..../, the SV holding the ref to the pattern is marked as tainted. This means that subsequent usage, such as /x$r/, will set PL_tainted using TAINT_set, and thus RXf_TAINTED, on the new pattern too. -At the start of execution of a pattern, the RXf_TAINTED_SEEN flag on the -regex is cleared; during execution, locale-variant ops such as POSIXL may -set RXf_TAINTED_SEEN. - RXf_TAINTED_SEEN is used post-execution by the get magic code of $1 et al to indicate whether the returned value should be tainted. It is the responsibility of the caller of the pattern (i.e. pp_match, @@ -2157,13 +2028,10 @@ PP(pp_subst) PMOP *rpm = pm; char *s; char *strend; - char *m; const char *c; - char *d; STRLEN clen; I32 iters = 0; I32 maxiters; - I32 i; bool once; U8 rxtainted = 0; /* holds various SUBST_TAINT_* flag bits. See "how taint works" above */ @@ -2203,9 +2071,6 @@ PP(pp_subst) sv_force_normal_flags(TARG,0); #endif if (!(rpm->op_pmflags & PMf_NONDESTRUCT) -#ifdef PERL_ANY_COW - && !is_cow -#endif && (SvREADONLY(TARG) || ( ((SvTYPE(TARG) == SVt_PVGV && isGV_with_GP(TARG)) || SvTYPE(TARG) > SVt_PVLV) @@ -2213,7 +2078,10 @@ PP(pp_subst) Perl_croak_no_modify(); PUTBACK; - s = SvPV_nomg(TARG, len); + orig = SvPV_nomg(TARG, len); + /* note we don't (yet) force the var into being a string; if we fail + * to match, we leave as-is; on successful match howeverm, we *will* + * coerce into a string, then repeat the match */ if (!SvPOKp(TARG) || SvTYPE(TARG) == SVt_PVGV || SvVOK(TARG)) force_on_match = 1; @@ -2231,14 +2099,12 @@ PP(pp_subst) TAINT_NOT; } - RX_MATCH_UTF8_set(rx, DO_UTF8(TARG)); - force_it: - if (!pm || !s) - DIE(aTHX_ "panic: pp_subst, pm=%p, s=%p", pm, s); + if (!pm || !orig) + DIE(aTHX_ "panic: pp_subst, pm=%p, orig=%p", pm, orig); - strend = s + len; - slen = RX_MATCH_UTF8(rx) ? utf8_length((U8*)s, (U8*)strend) : len; + strend = orig + len; + slen = DO_UTF8(TARG) ? utf8_length((U8*)orig, (U8*)strend) : len; maxiters = 2 * slen + 10; /* We can match twice at each position, once with zero-length, second time with non-zero. */ @@ -2261,31 +2127,13 @@ PP(pp_subst) r_flags = REXEC_COPY_STR; #endif - orig = m = s; - if (RX_EXTFLAGS(rx) & RXf_USE_INTUIT) { - PL_bostr = orig; - s = CALLREG_INTUIT_START(rx, TARG, s, strend, r_flags, NULL); - - if (!s) - goto ret_no; - /* How to do it in subst? */ -/* if ( (RX_EXTFLAGS(rx) & RXf_CHECK_ALL) - && !PL_sawampersand - && !(RX_EXTFLAGS(rx) & RXf_KEEPCOPY)) - goto yup; -*/ - } - - if (!CALLREGEXEC(rx, s, strend, orig, 0, TARG, NULL, - r_flags | REXEC_CHECKED)) + if (!CALLREGEXEC(rx, orig, strend, orig, 0, TARG, NULL, r_flags)) { - ret_no: SPAGAIN; PUSHs(rpm->op_pmflags & PMf_NONDESTRUCT ? TARG : &PL_sv_no); LEAVE_SCOPE(oldsave); RETURN; } - PL_curpm = pm; /* known replacement string? */ @@ -2320,7 +2168,10 @@ PP(pp_subst) && !is_cow #endif && (I32)clen <= RX_MINLENRET(rx) - && (once || !(r_flags & REXEC_COPY_STR)) + && ( once + || !(r_flags & REXEC_COPY_STR) + || (!SvGMAGICAL(dstr) && !(RX_EXTFLAGS(rx) & RXf_EVAL_SEEN)) + ) && !(RX_EXTFLAGS(rx) & RXf_NO_INPLACE_SUBST) && (!doutf8 || SvUTF8(TARG)) && !(rpm->op_pmflags & PMf_NONDESTRUCT)) @@ -2334,18 +2185,22 @@ PP(pp_subst) } #endif if (force_on_match) { + /* redo the first match, this time with the orig var + * forced into being a string */ force_on_match = 0; - s = SvPV_force_nomg(TARG, len); + orig = SvPV_force_nomg(TARG, len); goto force_it; } - d = s; + if (once) { + char *d, *m; if (RX_MATCH_TAINTED(rx)) /* run time pattern taint, eg locale */ rxtainted |= SUBST_TAINT_PAT; m = orig + RX_OFFS(rx)[0].start; d = orig + RX_OFFS(rx)[0].end; s = orig; if (m - s > strend - d) { /* faster to shorten from end */ + I32 i; if (clen) { Copy(c, m, clen, char); m += clen; @@ -2358,30 +2213,26 @@ PP(pp_subst) *m = '\0'; SvCUR_set(TARG, m - s); } - else if ((i = m - s)) { /* faster from front */ + else { /* faster from front */ + I32 i = m - s; d -= clen; - m = d; - Move(s, d - i, i, char); + if (i > 0) + Move(s, d - i, i, char); sv_chop(TARG, d-i); if (clen) - Copy(c, m, clen, char); - } - else if (clen) { - d -= clen; - sv_chop(TARG, d); - Copy(c, d, clen, char); - } - else { - sv_chop(TARG, d); + Copy(c, d, clen, char); } SPAGAIN; PUSHs(&PL_sv_yes); } else { + char *d, *m; + d = s = RX_OFFS(rx)[0].start + orig; do { - if (iters++ > maxiters) + I32 i; + if (UNLIKELY(iters++ > maxiters)) DIE(aTHX_ "Substitution loop"); - if (RX_MATCH_TAINTED(rx)) /* run time pattern taint, eg locale */ + if (UNLIKELY(RX_MATCH_TAINTED(rx))) /* run time pattern taint, eg locale */ rxtainted |= SUBST_TAINT_PAT; m = RX_OFFS(rx)[0].start + orig; if ((i = m - s)) { @@ -2394,12 +2245,12 @@ PP(pp_subst) d += clen; } s = RX_OFFS(rx)[0].end + orig; - } while (CALLREGEXEC(rx, s, strend, orig, s == m, + } while (CALLREGEXEC(rx, s, strend, orig, + s == m, /* don't match same null twice */ TARG, NULL, - /* don't match same null twice */ - REXEC_NOT_FIRST|REXEC_IGNOREPOS)); + REXEC_NOT_FIRST|REXEC_IGNOREPOS|REXEC_FAIL_ON_UNDERFLOW)); if (s != d) { - i = strend - s; + I32 i = strend - s; SvCUR_set(TARG, d - SvPVX_const(TARG) + i); Move(s, d, i+1, char); /* include the NUL */ } @@ -2409,8 +2260,11 @@ PP(pp_subst) } else { bool first; + char *m; SV *repl; if (force_on_match) { + /* redo the first match, this time with the orig var + * forced into being a string */ force_on_match = 0; if (rpm->op_pmflags & PMf_NONDESTRUCT) { /* I feel that it should be possible to avoid this mortal copy @@ -2420,7 +2274,7 @@ PP(pp_subst) cases where it would be viable to drop into the copy code. */ TARG = sv_2mortal(newSVsv(TARG)); } - s = SvPV_force_nomg(TARG, len); + orig = SvPV_force_nomg(TARG, len); goto force_it; } #ifdef PERL_ANY_COW @@ -2429,10 +2283,13 @@ PP(pp_subst) if (RX_MATCH_TAINTED(rx)) /* run time pattern taint, eg locale */ rxtainted |= SUBST_TAINT_PAT; repl = dstr; - dstr = newSVpvn_flags(m, s-m, SVs_TEMP | (DO_UTF8(TARG) ? SVf_UTF8 : 0)); + s = RX_OFFS(rx)[0].start + orig; + dstr = newSVpvn_flags(orig, s-orig, + SVs_TEMP | (DO_UTF8(TARG) ? SVf_UTF8 : 0)); if (!c) { PERL_CONTEXT *cx; SPAGAIN; + m = orig; /* note that a whole bunch of local vars are saved here for * use by pp_substcont: here's a list of them in case you're * searching for places in this sub that uses a particular var: @@ -2441,20 +2298,20 @@ PP(pp_subst) PUSHSUBST(cx); RETURNOP(cPMOP->op_pmreplrootu.op_pmreplroot); } - r_flags |= REXEC_IGNOREPOS | REXEC_NOT_FIRST; first = TRUE; do { - if (iters++ > maxiters) + if (UNLIKELY(iters++ > maxiters)) DIE(aTHX_ "Substitution loop"); - if (RX_MATCH_TAINTED(rx)) + if (UNLIKELY(RX_MATCH_TAINTED(rx))) rxtainted |= SUBST_TAINT_PAT; if (RX_MATCH_COPIED(rx) && RX_SUBBEG(rx) != orig) { - m = s; - s = orig; + char *old_s = s; + char *old_orig = orig; assert(RX_SUBOFFSET(rx) == 0); + orig = RX_SUBBEG(rx); - s = orig + (m - s); - strend = s + (strend - m); + s = orig + (old_s - old_orig); + strend = s + (strend - old_s); } m = RX_OFFS(rx)[0].start + orig; sv_catpvn_nomg_maybeutf8(dstr, s, m - s, DO_UTF8(TARG)); @@ -2473,13 +2330,14 @@ PP(pp_subst) sv_catsv(dstr, nsv); } else sv_catsv(dstr, repl); - if (SvTAINTED(repl)) + if (UNLIKELY(SvTAINTED(repl))) rxtainted |= SUBST_TAINT_REPL; } if (once) break; } while (CALLREGEXEC(rx, s, strend, orig, s == m, - TARG, NULL, r_flags)); + TARG, NULL, + REXEC_NOT_FIRST|REXEC_IGNOREPOS|REXEC_FAIL_ON_UNDERFLOW)); sv_catpvn_nomg_maybeutf8(dstr, s, strend - s, DO_UTF8(TARG)); if (rpm->op_pmflags & PMf_NONDESTRUCT) { @@ -2555,7 +2413,7 @@ PP(pp_grepwhile) LEAVE_with_name("grep_item"); /* exit inner scope */ /* All done yet? */ - if (PL_stack_base + *PL_markstack_ptr > SP) { + if (UNLIKELY(PL_stack_base + *PL_markstack_ptr > SP)) { I32 items; const I32 gimme = GIMME_V; @@ -2586,6 +2444,11 @@ PP(pp_grepwhile) SAVEVPTR(PL_curpm); src = PL_stack_base[*PL_markstack_ptr]; + if (SvPADTMP(src)) { + assert(!IS_PADGV(src)); + src = PL_stack_base[*PL_markstack_ptr] = sv_mortalcopy(src); + PL_tmps_floor++; + } SvTEMP_off(src); if (PL_op->op_private & OPpGREP_LEX) PAD_SVl(PL_op->op_targ) = src; @@ -2615,7 +2478,7 @@ PP(pp_leavesub) TAINT_NOT; if (gimme == G_SCALAR) { MARK = newsp + 1; - if (MARK <= SP) { + if (LIKELY(MARK <= SP)) { if (cx->blk_sub.cv && CvDEPTH(cx->blk_sub.cv) > 1) { if (SvTEMP(TOPs) && SvREFCNT(TOPs) == 1 && !SvMAGICAL(TOPs)) { @@ -2655,8 +2518,8 @@ PP(pp_leavesub) PUTBACK; LEAVE; - cxstack_ix--; POPSUB(cx,sv); /* Stack values are safe: release CV and @_ ... */ + cxstack_ix--; PL_curpm = newpm; /* ... and pop $1 et al */ LEAVESUB(sv); @@ -2672,71 +2535,72 @@ PP(pp_entersub) I32 gimme; const bool hasargs = (PL_op->op_flags & OPf_STACKED) != 0; - if (!sv) - DIE(aTHX_ "Not a CODE reference"); - switch (SvTYPE(sv)) { - /* This is overwhelming the most common case: */ - case SVt_PVGV: - we_have_a_glob: - if (!(cv = GvCVu((const GV *)sv))) { - HV *stash; - cv = sv_2cv(sv, &stash, &gv, 0); - } - if (!cv) { - ENTER; - SAVETMPS; - goto try_autoload; - } - break; - case SVt_PVLV: - if(isGV_with_GP(sv)) goto we_have_a_glob; - /*FALLTHROUGH*/ - default: - if (sv == &PL_sv_yes) { /* unfound import, ignore */ - if (hasargs) - SP = PL_stack_base + POPMARK; - else - (void)POPMARK; - RETURN; - } - SvGETMAGIC(sv); - if (SvROK(sv)) { - if (SvAMAGIC(sv)) { - sv = amagic_deref_call(sv, to_cv_amg); - /* Don't SPAGAIN here. */ - } - } - else { - const char *sym; - STRLEN len; - if (!SvOK(sv)) - DIE(aTHX_ PL_no_usym, "a subroutine"); - sym = SvPV_nomg_const(sv, len); - if (PL_op->op_private & HINT_STRICT_REFS) - DIE(aTHX_ "Can't use string (\"%" SVf32 "\"%s) as a subroutine ref while \"strict refs\" in use", sv, len>32 ? "..." : ""); - cv = get_cvn_flags(sym, len, GV_ADD|SvUTF8(sv)); - break; - } - cv = MUTABLE_CV(SvRV(sv)); - if (SvTYPE(cv) == SVt_PVCV) - break; - /* FALL THROUGH */ - case SVt_PVHV: - case SVt_PVAV: + if (UNLIKELY(!sv)) DIE(aTHX_ "Not a CODE reference"); - /* This is the second most common case: */ - case SVt_PVCV: - cv = MUTABLE_CV(sv); - break; + /* This is overwhelmingly the most common case: */ + if (!LIKELY(SvTYPE(sv) == SVt_PVGV && (cv = GvCVu((const GV *)sv)))) { + switch (SvTYPE(sv)) { + case SVt_PVGV: + we_have_a_glob: + if (!(cv = GvCVu((const GV *)sv))) { + HV *stash; + cv = sv_2cv(sv, &stash, &gv, 0); + } + if (!cv) { + ENTER; + SAVETMPS; + goto try_autoload; + } + break; + case SVt_PVLV: + if(isGV_with_GP(sv)) goto we_have_a_glob; + /*FALLTHROUGH*/ + default: + if (sv == &PL_sv_yes) { /* unfound import, ignore */ + if (hasargs) + SP = PL_stack_base + POPMARK; + else + (void)POPMARK; + RETURN; + } + SvGETMAGIC(sv); + if (SvROK(sv)) { + if (SvAMAGIC(sv)) { + sv = amagic_deref_call(sv, to_cv_amg); + /* Don't SPAGAIN here. */ + } + } + else { + const char *sym; + STRLEN len; + if (!SvOK(sv)) + DIE(aTHX_ PL_no_usym, "a subroutine"); + sym = SvPV_nomg_const(sv, len); + if (PL_op->op_private & HINT_STRICT_REFS) + DIE(aTHX_ "Can't use string (\"%" SVf32 "\"%s) as a subroutine ref while \"strict refs\" in use", sv, len>32 ? "..." : ""); + cv = get_cvn_flags(sym, len, GV_ADD|SvUTF8(sv)); + break; + } + cv = MUTABLE_CV(SvRV(sv)); + if (SvTYPE(cv) == SVt_PVCV) + break; + /* FALL THROUGH */ + case SVt_PVHV: + case SVt_PVAV: + DIE(aTHX_ "Not a CODE reference"); + /* This is the second most common case: */ + case SVt_PVCV: + cv = MUTABLE_CV(sv); + break; + } } ENTER; - SAVETMPS; retry: - if (CvCLONE(cv) && ! CvCLONED(cv)) + if (UNLIKELY(CvCLONE(cv) && ! CvCLONED(cv))) DIE(aTHX_ "Closure prototype called"); - if (!CvROOT(cv) && !CvXSUB(cv)) { + if (UNLIKELY(!CvROOT(cv) && !CvXSUB(cv))) { GV* autogv; SV* sub_name; @@ -2772,14 +2636,15 @@ try_autoload: goto retry; } - gimme = GIMME_V; - if ((PL_op->op_private & OPpENTERSUB_DB) && GvCV(PL_DBsub) && !CvNODEBUG(cv)) { + if (UNLIKELY((PL_op->op_private & OPpENTERSUB_DB) && GvCV(PL_DBsub) + && !CvNODEBUG(cv))) + { Perl_get_db_sub(aTHX_ &sv, cv); if (CvISXSUB(cv)) PL_curcopdb = PL_curcop; if (CvLVALUE(cv)) { /* check for lsub that handles lvalue subroutines */ - cv = GvCV(gv_HVadd(gv_fetchpvs("DB::lsub", GV_ADDMULTI, SVt_PVHV))); + cv = GvCV(gv_fetchpvs("DB::lsub", GV_ADDMULTI, SVt_PVCV)); /* if lsub not found then fall back to DB::sub */ if (!cv) cv = GvCV(PL_DBsub); } else { @@ -2790,37 +2655,43 @@ try_autoload: DIE(aTHX_ "No DB::sub routine defined"); } + gimme = GIMME_V; + if (!(CvISXSUB(cv))) { /* This path taken at least 75% of the time */ dMARK; - I32 items = SP - MARK; PADLIST * const padlist = CvPADLIST(cv); + I32 depth; + PUSHBLOCK(cx, CXt_SUB, MARK); PUSHSUB(cx); cx->blk_sub.retop = PL_op->op_next; - CvDEPTH(cv)++; - if (CvDEPTH(cv) >= 2) { + if (UNLIKELY((depth = ++CvDEPTH(cv)) >= 2)) { PERL_STACK_OVERFLOW_CHECK(); - pad_push(padlist, CvDEPTH(cv)); + pad_push(padlist, depth); } SAVECOMPPAD(); - PAD_SET_CUR_NOSAVE(padlist, CvDEPTH(cv)); - if (hasargs) { + PAD_SET_CUR_NOSAVE(padlist, depth); + if (LIKELY(hasargs)) { AV *const av = MUTABLE_AV(PAD_SVl(0)); - if (AvREAL(av)) { + SSize_t items; + AV **defavp; + + if (UNLIKELY(AvREAL(av))) { /* @_ is normally not REAL--this should only ever * happen when DB::sub() calls things that modify @_ */ av_clear(av); AvREAL_off(av); AvREIFY_on(av); } - cx->blk_sub.savearray = GvAV(PL_defgv); - GvAV(PL_defgv) = MUTABLE_AV(SvREFCNT_inc_simple(av)); + defavp = &GvAV(PL_defgv); + cx->blk_sub.savearray = *defavp; + *defavp = MUTABLE_AV(SvREFCNT_inc_simple_NN(av)); CX_CURPAD_SAVE(cx->blk_sub); cx->blk_sub.argarray = av; - ++MARK; + items = SP - MARK; - if (items - 1 > AvMAX(av)) { + if (UNLIKELY(items - 1 > AvMAX(av))) { SV **ary = AvALLOC(av); AvMAX(av) = items - 1; Renew(ary, items, SV*); @@ -2828,55 +2699,90 @@ try_autoload: AvARRAY(av) = ary; } - Copy(MARK,AvARRAY(av),items,SV*); + Copy(MARK+1,AvARRAY(av),items,SV*); AvFILLp(av) = items - 1; + MARK = AvARRAY(av); while (items--) { if (*MARK) + { + if (SvPADTMP(*MARK)) { + assert(!IS_PADGV(*MARK)); + *MARK = sv_mortalcopy(*MARK); + } SvTEMP_off(*MARK); + } MARK++; } } - if ((cx->blk_u16 & OPpENTERSUB_LVAL_MASK) == OPpLVAL_INTRO && - !CvLVALUE(cv)) + SAVETMPS; + if (UNLIKELY((cx->blk_u16 & OPpENTERSUB_LVAL_MASK) == OPpLVAL_INTRO && + !CvLVALUE(cv))) DIE(aTHX_ "Can't modify non-lvalue subroutine call"); /* warning must come *after* we fully set up the context * stuff so that __WARN__ handlers can safely dounwind() * if they want to */ - if (CvDEPTH(cv) == PERL_SUB_DEPTH_WARN && ckWARN(WARN_RECURSION) - && !(PERLDB_SUB && cv == GvCV(PL_DBsub))) + if (UNLIKELY(depth == PERL_SUB_DEPTH_WARN + && ckWARN(WARN_RECURSION) + && !(PERLDB_SUB && cv == GvCV(PL_DBsub)))) sub_crush_depth(cv); RETURNOP(CvSTART(cv)); } else { - I32 markix = TOPMARK; + SSize_t markix = TOPMARK; + SAVETMPS; PUTBACK; - if (((PL_op->op_private + if (UNLIKELY(((PL_op->op_private & PUSHSUB_GET_LVALUE_MASK(Perl_is_lvalue_sub) ) & OPpENTERSUB_LVAL_MASK) == OPpLVAL_INTRO && - !CvLVALUE(cv)) + !CvLVALUE(cv))) DIE(aTHX_ "Can't modify non-lvalue subroutine call"); - if (!hasargs) { + if (UNLIKELY(!hasargs && GvAV(PL_defgv))) { /* Need to copy @_ to stack. Alternative may be to * switch stack to @_, and copy return values * back. This would allow popping @_ in XSUB, e.g.. XXXX */ AV * const av = GvAV(PL_defgv); - const I32 items = AvFILLp(av) + 1; /* @_ is not tieable */ + const SSize_t items = AvFILL(av) + 1; if (items) { + SSize_t i = 0; + const bool m = cBOOL(SvRMAGICAL(av)); /* Mark is at the end of the stack. */ EXTEND(SP, items); - Copy(AvARRAY(av), SP + 1, items, SV*); + for (; i < items; ++i) + { + SV *sv; + if (m) { + SV ** const svp = av_fetch(av, i, 0); + sv = svp ? *svp : NULL; + } + else sv = AvARRAY(av)[i]; + if (sv) SP[i+1] = sv; + else { + SP[i+1] = newSVavdefelem(av, i, 1); + } + } SP += items; PUTBACK ; } } + else { + SV **mark = PL_stack_base + markix; + SSize_t items = SP - mark; + while (items--) { + mark++; + if (*mark && SvPADTMP(*mark)) { + assert(!IS_PADGV(*mark)); + *mark = sv_mortalcopy(*mark); + } + } + } /* We assume first XSUB in &DB::sub is the called one. */ - if (PL_curcopdb) { + if (UNLIKELY(PL_curcopdb)) { SAVEVPTR(PL_curcop); PL_curcop = PL_curcopdb; PL_curcopdb = NULL; @@ -2888,12 +2794,12 @@ try_autoload: CvXSUB(cv)(aTHX_ cv); /* Enforce some sanity in scalar context. */ - if (gimme == G_SCALAR && ++markix != PL_stack_sp - PL_stack_base ) { - if (markix > PL_stack_sp - PL_stack_base) - *(PL_stack_base + markix) = &PL_sv_undef; - else - *(PL_stack_base + markix) = *PL_stack_sp; - PL_stack_sp = PL_stack_base + markix; + if (gimme == G_SCALAR) { + SV **svp = PL_stack_base + markix + 1; + if (svp != PL_stack_sp) { + *svp = svp > PL_stack_sp ? &PL_sv_undef : *PL_stack_sp; + PL_stack_sp = svp; + } } LEAVE; return NORMAL; @@ -2930,19 +2836,19 @@ PP(pp_aelem) IV elem = SvIV(elemsv); AV *const av = MUTABLE_AV(POPs); const U32 lval = PL_op->op_flags & OPf_MOD || LVRET; - const U32 defer = (PL_op->op_private & OPpLVAL_DEFER) && (elem > av_len(av)); + const U32 defer = PL_op->op_private & OPpLVAL_DEFER; const bool localizing = PL_op->op_private & OPpLVAL_INTRO; bool preeminent = TRUE; SV *sv; - if (SvROK(elemsv) && !SvGAMAGIC(elemsv) && ckWARN(WARN_MISC)) + if (UNLIKELY(SvROK(elemsv) && !SvGAMAGIC(elemsv) && ckWARN(WARN_MISC))) Perl_warner(aTHX_ packWARN(WARN_MISC), "Use of reference \"%"SVf"\" as array index", SVfARG(elemsv)); - if (SvTYPE(av) != SVt_PVAV) + if (UNLIKELY(SvTYPE(av) != SVt_PVAV)) RETPUSHUNDEF; - if (localizing) { + if (UNLIKELY(localizing)) { MAGIC *mg; HV *stash; @@ -2969,21 +2875,20 @@ PP(pp_aelem) MEM_WRAP_CHECK_1(elem,SV*,oom_array_extend); } #endif - if (!svp || *svp == &PL_sv_undef) { - SV* lv; + if (!svp || !*svp) { + IV len; if (!defer) DIE(aTHX_ PL_no_aelem, elem); - lv = sv_newmortal(); - sv_upgrade(lv, SVt_PVLV); - LvTYPE(lv) = 'y'; - sv_magic(lv, NULL, PERL_MAGIC_defelem, NULL, 0); - LvTARG(lv) = SvREFCNT_inc_simple(av); - LvTARGOFF(lv) = elem; - LvTARGLEN(lv) = 1; - PUSHs(lv); + len = av_tindex(av); + mPUSHs(newSVavdefelem(av, + /* Resolve a negative index now, unless it points before the + beginning of the array, in which case record it for error + reporting in magic_setdefelem. */ + elem < 0 && len + elem >= 0 ? len + elem : elem, + 1)); RETURN; } - if (localizing) { + if (UNLIKELY(localizing)) { if (preeminent) save_aelem(av, elem, svp); else @@ -3079,7 +2984,7 @@ S_method_common(pTHX_ SV* meth, U32* has PERL_ARGS_ASSERT_METHOD_COMMON; - if (!sv) + if (UNLIKELY(!sv)) undefined: Perl_croak(aTHX_ "Can't call method \"%"SVf"\" on an undefined value", SVfARG(meth)); @@ -3088,6 +2993,19 @@ S_method_common(pTHX_ SV* meth, U32* has if (SvROK(sv)) ob = MUTABLE_SV(SvRV(sv)); else if (!SvOK(sv)) goto undefined; + else if (isGV_with_GP(sv)) { + if (!GvIO(sv)) + Perl_croak(aTHX_ "Can't call method \"%"SVf"\" " + "without a package or object reference", + SVfARG(meth)); + ob = sv; + if (SvTYPE(ob) == SVt_PVLV && LvTYPE(ob) == 'y') { + assert(!LvTARGLEN(ob)); + ob = LvTARG(ob); + assert(ob); + } + *(PL_stack_base + TOPMARK + 1) = sv_2mortal(newRV(ob)); + } else { /* this isn't a reference */ GV* iogv; @@ -3136,10 +3054,9 @@ S_method_common(pTHX_ SV* meth, U32* has *(PL_stack_base + TOPMARK + 1) = sv_2mortal(newRV(MUTABLE_SV(iogv))); } - /* if we got here, ob should be a reference or a glob */ + /* if we got here, ob should be an object or a glob */ if (!ob || !(SvOBJECT(ob) - || (SvTYPE(ob) == SVt_PVGV - && isGV_with_GP(ob) + || (isGV_with_GP(ob) && (ob = MUTABLE_SV(GvIO((const GV *)ob))) && SvOBJECT(ob)))) { Index: gnu/usr.bin/perl/pp_pack.c =================================================================== RCS file: /mnt/memory/perl/importit/cvs/src/gnu/usr.bin/perl/pp_pack.c,v retrieving revision 1.1.1.10 diff -u -p -u -p -r1.1.1.10 pp_pack.c --- gnu/usr.bin/perl/pp_pack.c 24 Mar 2014 14:58:46 -0000 1.1.1.10 +++ gnu/usr.bin/perl/pp_pack.c 16 Nov 2014 03:22:24 -0000 @@ -82,11 +82,6 @@ typedef union { } ld_bytes; #endif -#if PERL_VERSION >= 9 -# define PERL_PACK_CAN_BYTEORDER -# define PERL_PACK_CAN_SHRIEKSIGN -#endif - #ifndef CHAR_BIT # define CHAR_BIT 8 #endif @@ -134,46 +129,50 @@ typedef union { # define OFF32(p) ((char *) (p)) #endif -/* Only to be used inside a loop (see the break) */ -#define SHIFT16(utf8, s, strend, p, datumtype) STMT_START { \ - if (utf8) { \ - if (!uni_to_bytes(aTHX_ &(s), strend, OFF16(p), SIZE16, datumtype)) break; \ - } else { \ - Copy(s, OFF16(p), SIZE16, char); \ - (s) += SIZE16; \ - } \ -} STMT_END - -/* Only to be used inside a loop (see the break) */ -#define SHIFT32(utf8, s, strend, p, datumtype) STMT_START { \ - if (utf8) { \ - if (!uni_to_bytes(aTHX_ &(s), strend, OFF32(p), SIZE32, datumtype)) break; \ - } else { \ - Copy(s, OFF32(p), SIZE32, char); \ - (s) += SIZE32; \ - } \ -} STMT_END - -#define PUSH16(utf8, cur, p) PUSH_BYTES(utf8, cur, OFF16(p), SIZE16) -#define PUSH32(utf8, cur, p) PUSH_BYTES(utf8, cur, OFF32(p), SIZE32) +#define PUSH16(utf8, cur, p, needs_swap) \ + PUSH_BYTES(utf8, cur, OFF16(p), SIZE16, needs_swap) +#define PUSH32(utf8, cur, p, needs_swap) \ + PUSH_BYTES(utf8, cur, OFF32(p), SIZE32, needs_swap) + +#if BYTEORDER == 0x4321 || BYTEORDER == 0x87654321 /* big-endian */ +# define NEEDS_SWAP(d) (TYPE_ENDIANNESS(d) == TYPE_IS_LITTLE_ENDIAN) +#elif BYTEORDER == 0x1234 || BYTEORDER == 0x12345678 /* little-endian */ +# define NEEDS_SWAP(d) (TYPE_ENDIANNESS(d) == TYPE_IS_BIG_ENDIAN) +#else +# error "Unsupported byteorder" + /* Need to add code here to re-instate mixed endian support. + NEEDS_SWAP would need to hold a flag indicating which action to + take, and S_reverse_copy and the code in uni_to_bytes would need + logic adding to deal with any mixed-endian transformations needed. + */ +#endif /* Only to be used inside a loop (see the break) */ -#define SHIFT_BYTES(utf8, s, strend, buf, len, datumtype) \ +#define SHIFT_BYTES(utf8, s, strend, buf, len, datumtype, needs_swap) \ STMT_START { \ - if (utf8) { \ + if (UNLIKELY(utf8)) { \ if (!uni_to_bytes(aTHX_ &s, strend, \ (char *) (buf), len, datumtype)) break; \ } else { \ - Copy(s, (char *) (buf), len, char); \ + if (UNLIKELY(needs_swap)) \ + S_reverse_copy(s, (char *) (buf), len); \ + else \ + Copy(s, (char *) (buf), len, char); \ s += len; \ } \ } STMT_END -#define SHIFT_VAR(utf8, s, strend, var, datumtype) \ - SHIFT_BYTES(utf8, s, strend, &(var), sizeof(var), datumtype) +#define SHIFT16(utf8, s, strend, p, datumtype, needs_swap) \ + SHIFT_BYTES(utf8, s, strend, OFF16(p), SIZE16, datumtype, needs_swap) + +#define SHIFT32(utf8, s, strend, p, datumtype, needs_swap) \ + SHIFT_BYTES(utf8, s, strend, OFF32(p), SIZE32, datumtype, needs_swap) + +#define SHIFT_VAR(utf8, s, strend, var, datumtype, needs_swap) \ + SHIFT_BYTES(utf8, s, strend, &(var), sizeof(var), datumtype, needs_swap) -#define PUSH_VAR(utf8, aptr, var) \ - PUSH_BYTES(utf8, aptr, &(var), sizeof(var)) +#define PUSH_VAR(utf8, aptr, var, needs_swap) \ + PUSH_BYTES(utf8, aptr, &(var), sizeof(var), needs_swap) /* Avoid stack overflow due to pathological templates. 100 should be plenty. */ #define MAX_SUB_TEMPLATE_LEVEL 100 @@ -237,407 +236,24 @@ S_mul128(pTHX_ SV *sv, U8 m) #define TYPE_MODIFIERS(t) ((t) & ~0xFF) #define TYPE_NO_MODIFIERS(t) ((t) & 0xFF) -#ifdef PERL_PACK_CAN_SHRIEKSIGN -# define SHRIEKING_ALLOWED_TYPES "sSiIlLxXnNvV@." -#else -# define SHRIEKING_ALLOWED_TYPES "sSiIlLxX" -#endif - -#ifndef PERL_PACK_CAN_BYTEORDER -/* Put "can't" first because it is shorter */ -# define TYPE_ENDIANNESS(t) 0 -# define TYPE_NO_ENDIANNESS(t) (t) - -# define ENDIANNESS_ALLOWED_TYPES "" - -# define DO_BO_UNPACK(var, type) -# define DO_BO_PACK(var, type) -# define DO_BO_UNPACK_PTR(var, type, pre_cast, post_cast) -# define DO_BO_PACK_PTR(var, type, pre_cast, post_cast) -# define DO_BO_UNPACK_N(var, type) -# define DO_BO_PACK_N(var, type) -# define DO_BO_UNPACK_P(var) -# define DO_BO_PACK_P(var) -# define DO_BO_UNPACK_PC(var) -# define DO_BO_PACK_PC(var) - -#else /* PERL_PACK_CAN_BYTEORDER */ - # define TYPE_ENDIANNESS(t) ((t) & TYPE_ENDIANNESS_MASK) # define TYPE_NO_ENDIANNESS(t) ((t) & ~TYPE_ENDIANNESS_MASK) # define ENDIANNESS_ALLOWED_TYPES "sSiIlLqQjJfFdDpP(" -# define DO_BO_UNPACK(var, type) \ - STMT_START { \ - switch (TYPE_ENDIANNESS(datumtype)) { \ - case TYPE_IS_BIG_ENDIAN: var = my_betoh ## type (var); break; \ - case TYPE_IS_LITTLE_ENDIAN: var = my_letoh ## type (var); break; \ - default: break; \ - } \ - } STMT_END - -# define DO_BO_PACK(var, type) \ - STMT_START { \ - switch (TYPE_ENDIANNESS(datumtype)) { \ - case TYPE_IS_BIG_ENDIAN: var = my_htobe ## type (var); break; \ - case TYPE_IS_LITTLE_ENDIAN: var = my_htole ## type (var); break; \ - default: break; \ - } \ - } STMT_END - -# define DO_BO_UNPACK_PTR(var, type, pre_cast, post_cast) \ - STMT_START { \ - switch (TYPE_ENDIANNESS(datumtype)) { \ - case TYPE_IS_BIG_ENDIAN: \ - var = (post_cast*) my_betoh ## type ((pre_cast) var); \ - break; \ - case TYPE_IS_LITTLE_ENDIAN: \ - var = (post_cast *) my_letoh ## type ((pre_cast) var); \ - break; \ - default: \ - break; \ - } \ - } STMT_END - -# define DO_BO_PACK_PTR(var, type, pre_cast, post_cast) \ - STMT_START { \ - switch (TYPE_ENDIANNESS(datumtype)) { \ - case TYPE_IS_BIG_ENDIAN: \ - var = (post_cast *) my_htobe ## type ((pre_cast) var); \ - break; \ - case TYPE_IS_LITTLE_ENDIAN: \ - var = (post_cast *) my_htole ## type ((pre_cast) var); \ - break; \ - default: \ - break; \ - } \ - } STMT_END - -# define BO_CANT_DOIT(action, type) \ - STMT_START { \ - switch (TYPE_ENDIANNESS(datumtype)) { \ - case TYPE_IS_BIG_ENDIAN: \ - Perl_croak(aTHX_ "Can't %s big-endian %ss on this " \ - "platform", #action, #type); \ - break; \ - case TYPE_IS_LITTLE_ENDIAN: \ - Perl_croak(aTHX_ "Can't %s little-endian %ss on this " \ - "platform", #action, #type); \ - break; \ - default: \ - break; \ - } \ - } STMT_END - -# if PTRSIZE == INTSIZE -# define DO_BO_UNPACK_P(var) DO_BO_UNPACK_PTR(var, i, int, void) -# define DO_BO_PACK_P(var) DO_BO_PACK_PTR(var, i, int, void) -# define DO_BO_UNPACK_PC(var) DO_BO_UNPACK_PTR(var, i, int, char) -# define DO_BO_PACK_PC(var) DO_BO_PACK_PTR(var, i, int, char) -# elif PTRSIZE == LONGSIZE -# if LONGSIZE < IVSIZE && IVSIZE == 8 -# define DO_BO_UNPACK_P(var) DO_BO_UNPACK_PTR(var, 64, IV, void) -# define DO_BO_PACK_P(var) DO_BO_PACK_PTR(var, 64, IV, void) -# define DO_BO_UNPACK_PC(var) DO_BO_UNPACK_PTR(var, 64, IV, char) -# define DO_BO_PACK_PC(var) DO_BO_PACK_PTR(var, 64, IV, char) -# else -# define DO_BO_UNPACK_P(var) DO_BO_UNPACK_PTR(var, l, IV, void) -# define DO_BO_PACK_P(var) DO_BO_PACK_PTR(var, l, IV, void) -# define DO_BO_UNPACK_PC(var) DO_BO_UNPACK_PTR(var, l, IV, char) -# define DO_BO_PACK_PC(var) DO_BO_PACK_PTR(var, l, IV, char) -# endif -# elif PTRSIZE == IVSIZE -# define DO_BO_UNPACK_P(var) DO_BO_UNPACK_PTR(var, l, IV, void) -# define DO_BO_PACK_P(var) DO_BO_PACK_PTR(var, l, IV, void) -# define DO_BO_UNPACK_PC(var) DO_BO_UNPACK_PTR(var, l, IV, char) -# define DO_BO_PACK_PC(var) DO_BO_PACK_PTR(var, l, IV, char) -# else -# define DO_BO_UNPACK_P(var) BO_CANT_DOIT(unpack, pointer) -# define DO_BO_PACK_P(var) BO_CANT_DOIT(pack, pointer) -# define DO_BO_UNPACK_PC(var) BO_CANT_DOIT(unpack, pointer) -# define DO_BO_PACK_PC(var) BO_CANT_DOIT(pack, pointer) -# endif - -# if defined(my_htolen) && defined(my_letohn) && \ - defined(my_htoben) && defined(my_betohn) -# define DO_BO_UNPACK_N(var, type) \ - STMT_START { \ - switch (TYPE_ENDIANNESS(datumtype)) { \ - case TYPE_IS_BIG_ENDIAN: my_betohn(&var, sizeof(type)); break;\ - case TYPE_IS_LITTLE_ENDIAN: my_letohn(&var, sizeof(type)); break;\ - default: break; \ - } \ - } STMT_END - -# define DO_BO_PACK_N(var, type) \ - STMT_START { \ - switch (TYPE_ENDIANNESS(datumtype)) { \ - case TYPE_IS_BIG_ENDIAN: my_htoben(&var, sizeof(type)); break;\ - case TYPE_IS_LITTLE_ENDIAN: my_htolen(&var, sizeof(type)); break;\ - default: break; \ - } \ - } STMT_END -# else -# define DO_BO_UNPACK_N(var, type) BO_CANT_DOIT(unpack, type) -# define DO_BO_PACK_N(var, type) BO_CANT_DOIT(pack, type) -# endif - -#endif /* PERL_PACK_CAN_BYTEORDER */ - #define PACK_SIZE_CANNOT_CSUM 0x80 #define PACK_SIZE_UNPREDICTABLE 0x40 /* Not a fixed size element */ #define PACK_SIZE_MASK 0x3F -/* These tables are regenerated by genpacksizetables.pl (and then hand pasted - in). You're unlikely ever to need to regenerate them. */ - -#if TYPE_IS_SHRIEKING != 0x100 - ++++shriek offset should be 256 -#endif +#include "packsizetables.c" -typedef U8 packprops_t; -#if 'J'-'I' == 1 -/* ASCII */ -STATIC const packprops_t packprops[512] = { - /* normal */ - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, - /* C */ sizeof(unsigned char), -#if defined(HAS_LONG_DOUBLE) && defined(USE_LONG_DOUBLE) - /* D */ LONG_DOUBLESIZE, -#else - 0, -#endif - 0, - /* F */ NVSIZE, - 0, 0, - /* I */ sizeof(unsigned int), - /* J */ UVSIZE, - 0, - /* L */ SIZE32, - 0, - /* N */ SIZE32, - 0, 0, -#if defined(HAS_QUAD) - /* Q */ sizeof(Uquad_t), -#else - 0, -#endif - 0, - /* S */ SIZE16, - 0, - /* U */ sizeof(char) | PACK_SIZE_UNPREDICTABLE, - /* V */ SIZE32, - /* W */ sizeof(unsigned char) | PACK_SIZE_UNPREDICTABLE, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - /* c */ sizeof(char), - /* d */ sizeof(double), - 0, - /* f */ sizeof(float), - 0, 0, - /* i */ sizeof(int), - /* j */ IVSIZE, - 0, - /* l */ SIZE32, - 0, - /* n */ SIZE16, - 0, - /* p */ sizeof(char *) | PACK_SIZE_CANNOT_CSUM, -#if defined(HAS_QUAD) - /* q */ sizeof(Quad_t), -#else - 0, -#endif - 0, - /* s */ SIZE16, - 0, 0, - /* v */ SIZE16, - /* w */ sizeof(char) | PACK_SIZE_UNPREDICTABLE | PACK_SIZE_CANNOT_CSUM, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - /* shrieking */ - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, - /* I */ sizeof(unsigned int), - 0, 0, - /* L */ sizeof(unsigned long), - 0, -#if defined(PERL_PACK_CAN_SHRIEKSIGN) - /* N */ SIZE32, -#else - 0, -#endif - 0, 0, 0, 0, - /* S */ sizeof(unsigned short), - 0, 0, -#if defined(PERL_PACK_CAN_SHRIEKSIGN) - /* V */ SIZE32, -#else - 0, -#endif - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, - /* i */ sizeof(int), - 0, 0, - /* l */ sizeof(long), - 0, -#if defined(PERL_PACK_CAN_SHRIEKSIGN) - /* n */ SIZE16, -#else - 0, -#endif - 0, 0, 0, 0, - /* s */ sizeof(short), - 0, 0, -#if defined(PERL_PACK_CAN_SHRIEKSIGN) - /* v */ SIZE16, -#else - 0, -#endif - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0 -}; -#else -/* EBCDIC (or bust) */ -STATIC const packprops_t packprops[512] = { - /* normal */ - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, - /* c */ sizeof(char), - /* d */ sizeof(double), - 0, - /* f */ sizeof(float), - 0, 0, - /* i */ sizeof(int), - 0, 0, 0, 0, 0, 0, 0, - /* j */ IVSIZE, - 0, - /* l */ SIZE32, - 0, - /* n */ SIZE16, - 0, - /* p */ sizeof(char *) | PACK_SIZE_CANNOT_CSUM, -#if defined(HAS_QUAD) - /* q */ sizeof(Quad_t), -#else - 0, -#endif - 0, 0, 0, 0, 0, 0, 0, 0, 0, - /* s */ SIZE16, - 0, 0, - /* v */ SIZE16, - /* w */ sizeof(char) | PACK_SIZE_UNPREDICTABLE | PACK_SIZE_CANNOT_CSUM, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - /* C */ sizeof(unsigned char), -#if defined(HAS_LONG_DOUBLE) && defined(USE_LONG_DOUBLE) - /* D */ LONG_DOUBLESIZE, -#else - 0, -#endif - 0, - /* F */ NVSIZE, - 0, 0, - /* I */ sizeof(unsigned int), - 0, 0, 0, 0, 0, 0, 0, - /* J */ UVSIZE, - 0, - /* L */ SIZE32, - 0, - /* N */ SIZE32, - 0, 0, -#if defined(HAS_QUAD) - /* Q */ sizeof(Uquad_t), -#else - 0, -#endif - 0, 0, 0, 0, 0, 0, 0, 0, 0, - /* S */ SIZE16, - 0, - /* U */ sizeof(char) | PACK_SIZE_UNPREDICTABLE, - /* V */ SIZE32, - /* W */ sizeof(unsigned char) | PACK_SIZE_UNPREDICTABLE, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, - /* shrieking */ - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, - /* i */ sizeof(int), - 0, 0, 0, 0, 0, 0, 0, 0, 0, - /* l */ sizeof(long), - 0, -#if defined(PERL_PACK_CAN_SHRIEKSIGN) - /* n */ SIZE16, -#else - 0, -#endif - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - /* s */ sizeof(short), - 0, 0, -#if defined(PERL_PACK_CAN_SHRIEKSIGN) - /* v */ SIZE16, -#else - 0, -#endif - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, - /* I */ sizeof(unsigned int), - 0, 0, 0, 0, 0, 0, 0, 0, 0, - /* L */ sizeof(unsigned long), - 0, -#if defined(PERL_PACK_CAN_SHRIEKSIGN) - /* N */ SIZE32, -#else - 0, -#endif - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - /* S */ sizeof(unsigned short), - 0, 0, -#if defined(PERL_PACK_CAN_SHRIEKSIGN) - /* V */ SIZE32, -#else - 0, -#endif - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 -}; -#endif +static void +S_reverse_copy(const char *src, char *dest, STRLEN len) +{ + dest += len; + while (len--) + *--dest = *src++; +} STATIC U8 uni_to_byte(pTHX_ const char **s, const char *end, I32 datumtype) @@ -674,6 +290,11 @@ uni_to_bytes(pTHX_ const char **s, const int bad = 0; const U32 flags = ckWARN(WARN_UTF8) ? UTF8_CHECK_ONLY : (UTF8_CHECK_ONLY | UTF8_ALLOW_ANY); + const bool needs_swap = NEEDS_SWAP(datumtype); + + if (UNLIKELY(needs_swap)) + buf += buf_len; + for (;buf_len > 0; buf_len--) { if (from >= end) return FALSE; val = utf8n_to_uvchr((U8 *) from, end-from, &retlen, flags); @@ -685,7 +306,10 @@ uni_to_bytes(pTHX_ const char **s, const bad |= 2; val &= 0xff; } - *(U8 *)buf++ = (U8)val; + if (UNLIKELY(needs_swap)) + *(U8 *)--buf = (U8)val; + else + *(U8 *)buf++ = (U8)val; } /* We have enough characters for the buffer. Did we have problems ? */ if (bad) { @@ -695,7 +319,7 @@ uni_to_bytes(pTHX_ const char **s, const const int flags = ckWARN(WARN_UTF8) ? 0 : UTF8_ALLOW_ANY; for (ptr = *s; ptr < from; ptr += UTF8SKIP(ptr)) { if (ptr >= end) break; - utf8n_to_uvuni((U8 *) ptr, end-ptr, &retlen, flags); + utf8n_to_uvchr((U8 *) ptr, end-ptr, &retlen, flags); } if (from > end) from = end; } @@ -727,30 +351,33 @@ next_uni_uu(pTHX_ const char **s, const } STATIC char * -S_bytes_to_uni(const U8 *start, STRLEN len, char *dest) { - const U8 * const end = start + len; - +S_bytes_to_uni(const U8 *start, STRLEN len, char *dest, const bool needs_swap) { PERL_ARGS_ASSERT_BYTES_TO_UNI; - while (start < end) { - const UV uv = NATIVE_TO_ASCII(*start); - if (UNI_IS_INVARIANT(uv)) - *dest++ = (char)(U8)UTF_TO_NATIVE(uv); - else { - *dest++ = (char)(U8)UTF8_EIGHT_BIT_HI(uv); - *dest++ = (char)(U8)UTF8_EIGHT_BIT_LO(uv); - } - start++; + if (UNLIKELY(needs_swap)) { + const U8 *p = start + len; + while (p-- > start) { + append_utf8_from_native_byte(*p, (U8 **) & dest); + } + } else { + const U8 * const end = start + len; + while (start < end) { + append_utf8_from_native_byte(*start, (U8 **) & dest); + start++; + } } return dest; } -#define PUSH_BYTES(utf8, cur, buf, len) \ +#define PUSH_BYTES(utf8, cur, buf, len, needs_swap) \ STMT_START { \ - if (utf8) \ - (cur) = bytes_to_uni((U8 *) buf, len, (cur)); \ + if (UNLIKELY(utf8)) \ + (cur) = S_bytes_to_uni((U8 *) buf, len, (cur), needs_swap); \ else { \ - Copy(buf, cur, len, char); \ + if (UNLIKELY(needs_swap)) \ + S_reverse_copy((char *)(buf), cur, len); \ + else \ + Copy(buf, cur, len, char); \ (cur) += (len); \ } \ } STMT_END @@ -776,14 +403,14 @@ STMT_START { \ (start) = sv_exp_grow(cat, gl); \ (cur) = (start) + SvCUR(cat); \ } \ - PUSH_BYTES(utf8, cur, buf, glen); \ + PUSH_BYTES(utf8, cur, buf, glen, 0); \ } STMT_END #define PUSH_BYTE(utf8, s, byte) \ STMT_START { \ if (utf8) { \ const U8 au8 = (byte); \ - (s) = bytes_to_uni(&au8, 1, (s)); \ + (s) = S_bytes_to_uni(&au8, 1, (s), 0); \ } else *(U8 *)(s)++ = (byte); \ } STMT_END @@ -837,10 +464,8 @@ S_measure_struct(pTHX_ tempsym_t* symptr Perl_croak(aTHX_ "Invalid type '%c' in %s", (int)TYPE_NO_MODIFIERS(symptr->code), _action( symptr ) ); -#ifdef PERL_PACK_CAN_SHRIEKSIGN case '.' | TYPE_IS_SHRIEKING: case '@' | TYPE_IS_SHRIEKING: -#endif case '@': case '.': case '/': @@ -1027,9 +652,8 @@ S_next_symbol(pTHX_ tempsym_t* symptr ) switch (*patptr) { case '!': modifier = TYPE_IS_SHRIEKING; - allowed = SHRIEKING_ALLOWED_TYPES; + allowed = "sSiIlLxXnNvV@."; break; -#ifdef PERL_PACK_CAN_BYTEORDER case '>': modifier = TYPE_IS_BIG_ENDIAN; allowed = ENDIANNESS_ALLOWED_TYPES; @@ -1038,7 +662,6 @@ S_next_symbol(pTHX_ tempsym_t* symptr ) modifier = TYPE_IS_LITTLE_ENDIAN; allowed = ENDIANNESS_ALLOWED_TYPES; break; -#endif /* PERL_PACK_CAN_BYTEORDER */ default: allowed = ""; modifier = 0; @@ -1194,7 +817,7 @@ The engine implementing the unpack() Per Using the template pat..patend, this function unpacks the string s..strend into a number of mortal SVs, which it pushes onto the perl argument (@_) stack (so you will need to issue a C before and -C after the call to this function). It returns the number of +C after the call to this function). It returns the number of pushed elements. The strend and patend pointers should point to the byte following the last @@ -1257,6 +880,7 @@ S_unpack_rec(pTHX_ tempsym_t* symptr, co packprops_t props; I32 len; I32 datumtype = symptr->code; + bool needs_swap; /* do first one only unless in list context / is implemented by unpacking the count, then popping it from the stack, so must check that we're not in the middle of a / */ @@ -1294,6 +918,8 @@ S_unpack_rec(pTHX_ tempsym_t* symptr, co } } + needs_swap = NEEDS_SWAP(datumtype); + switch(TYPE_NO_ENDIANNESS(datumtype)) { default: Perl_croak(aTHX_ "Invalid type '%c' in unpack", (int)TYPE_NO_MODIFIERS(datumtype) ); @@ -1329,17 +955,11 @@ S_unpack_rec(pTHX_ tempsym_t* symptr, co *symptr = savsym; break; } -#ifdef PERL_PACK_CAN_SHRIEKSIGN case '.' | TYPE_IS_SHRIEKING: -#endif case '.': { const char *from; SV *sv; -#ifdef PERL_PACK_CAN_SHRIEKSIGN const bool u8 = utf8 && !(datumtype & TYPE_IS_SHRIEKING); -#else /* PERL_PACK_CAN_SHRIEKSIGN */ - const bool u8 = utf8; -#endif if (howlen == e_star) from = strbeg; else if (len <= 0) from = s; else { @@ -1354,16 +974,10 @@ S_unpack_rec(pTHX_ tempsym_t* symptr, co mXPUSHs(sv); break; } -#ifdef PERL_PACK_CAN_SHRIEKSIGN case '@' | TYPE_IS_SHRIEKING: -#endif case '@': s = strbeg + symptr->strbeg; -#ifdef PERL_PACK_CAN_SHRIEKSIGN if (utf8 && !(datumtype & TYPE_IS_SHRIEKING)) -#else /* PERL_PACK_CAN_SHRIEKSIGN */ - if (utf8) -#endif { while (len > 0) { if (s >= strend) @@ -1702,10 +1316,10 @@ S_unpack_rec(pTHX_ tempsym_t* symptr, co len = UTF8SKIP(result); if (!uni_to_bytes(aTHX_ &ptr, strend, (char *) &result[1], len-1, 'U')) break; - auv = utf8n_to_uvuni(result, len, &retlen, UTF8_ALLOW_DEFAULT); + auv = utf8n_to_uvchr(result, len, &retlen, UTF8_ALLOW_DEFAULT); s = ptr; } else { - auv = utf8n_to_uvuni((U8*)s, strend - s, &retlen, UTF8_ALLOW_DEFAULT); + auv = utf8n_to_uvchr((U8*)s, strend - s, &retlen, UTF8_ALLOW_DEFAULT); if (retlen == (STRLEN) -1 || retlen == 0) Perl_croak(aTHX_ "Malformed UTF-8 string in unpack"); s += retlen; @@ -1722,8 +1336,7 @@ S_unpack_rec(pTHX_ tempsym_t* symptr, co #if SHORTSIZE != SIZE16 while (len-- > 0) { short ashort; - SHIFT_VAR(utf8, s, strend, ashort, datumtype); - DO_BO_UNPACK(ashort, s); + SHIFT_VAR(utf8, s, strend, ashort, datumtype, needs_swap); if (!checksum) mPUSHi(ashort); else if (checksum > bits_in_uv) @@ -1742,8 +1355,7 @@ S_unpack_rec(pTHX_ tempsym_t* symptr, co #if U16SIZE > SIZE16 ai16 = 0; #endif - SHIFT16(utf8, s, strend, &ai16, datumtype); - DO_BO_UNPACK(ai16, 16); + SHIFT16(utf8, s, strend, &ai16, datumtype, needs_swap); #if U16SIZE > SIZE16 if (ai16 > 32767) ai16 -= 65536; @@ -1760,8 +1372,8 @@ S_unpack_rec(pTHX_ tempsym_t* symptr, co #if SHORTSIZE != SIZE16 while (len-- > 0) { unsigned short aushort; - SHIFT_VAR(utf8, s, strend, aushort, datumtype); - DO_BO_UNPACK(aushort, s); + SHIFT_VAR(utf8, s, strend, aushort, datumtype, needs_swap, + needs_swap); if (!checksum) mPUSHu(aushort); else if (checksum > bits_in_uv) @@ -1781,16 +1393,11 @@ S_unpack_rec(pTHX_ tempsym_t* symptr, co #if U16SIZE > SIZE16 au16 = 0; #endif - SHIFT16(utf8, s, strend, &au16, datumtype); - DO_BO_UNPACK(au16, 16); -#ifdef HAS_NTOHS + SHIFT16(utf8, s, strend, &au16, datumtype, needs_swap); if (datumtype == 'n') au16 = PerlSock_ntohs(au16); -#endif -#ifdef HAS_VTOHS if (datumtype == 'v') au16 = vtohs(au16); -#endif if (!checksum) mPUSHu(au16); else if (checksum > bits_in_uv) @@ -1799,7 +1406,6 @@ S_unpack_rec(pTHX_ tempsym_t* symptr, co cuv += au16; } break; -#ifdef PERL_PACK_CAN_SHRIEKSIGN case 'v' | TYPE_IS_SHRIEKING: case 'n' | TYPE_IS_SHRIEKING: while (len-- > 0) { @@ -1807,15 +1413,13 @@ S_unpack_rec(pTHX_ tempsym_t* symptr, co # if U16SIZE > SIZE16 ai16 = 0; # endif - SHIFT16(utf8, s, strend, &ai16, datumtype); -# ifdef HAS_NTOHS + SHIFT16(utf8, s, strend, &ai16, datumtype, needs_swap); + /* There should never be any byte-swapping here. */ + assert(!TYPE_ENDIANNESS(datumtype)); if (datumtype == ('n' | TYPE_IS_SHRIEKING)) ai16 = (I16) PerlSock_ntohs((U16) ai16); -# endif /* HAS_NTOHS */ -# ifdef HAS_VTOHS if (datumtype == ('v' | TYPE_IS_SHRIEKING)) ai16 = (I16) vtohs((U16) ai16); -# endif /* HAS_VTOHS */ if (!checksum) mPUSHi(ai16); else if (checksum > bits_in_uv) @@ -1824,13 +1428,11 @@ S_unpack_rec(pTHX_ tempsym_t* symptr, co cuv += ai16; } break; -#endif /* PERL_PACK_CAN_SHRIEKSIGN */ case 'i': case 'i' | TYPE_IS_SHRIEKING: while (len-- > 0) { int aint; - SHIFT_VAR(utf8, s, strend, aint, datumtype); - DO_BO_UNPACK(aint, i); + SHIFT_VAR(utf8, s, strend, aint, datumtype, needs_swap); if (!checksum) mPUSHi(aint); else if (checksum > bits_in_uv) @@ -1843,8 +1445,7 @@ S_unpack_rec(pTHX_ tempsym_t* symptr, co case 'I' | TYPE_IS_SHRIEKING: while (len-- > 0) { unsigned int auint; - SHIFT_VAR(utf8, s, strend, auint, datumtype); - DO_BO_UNPACK(auint, i); + SHIFT_VAR(utf8, s, strend, auint, datumtype, needs_swap); if (!checksum) mPUSHu(auint); else if (checksum > bits_in_uv) @@ -1856,16 +1457,7 @@ S_unpack_rec(pTHX_ tempsym_t* symptr, co case 'j': while (len-- > 0) { IV aiv; - SHIFT_VAR(utf8, s, strend, aiv, datumtype); -#if IVSIZE == INTSIZE - DO_BO_UNPACK(aiv, i); -#elif IVSIZE == LONGSIZE - DO_BO_UNPACK(aiv, l); -#elif defined(HAS_QUAD) && IVSIZE == U64SIZE - DO_BO_UNPACK(aiv, 64); -#else - Perl_croak(aTHX_ "'j' not supported on this platform"); -#endif + SHIFT_VAR(utf8, s, strend, aiv, datumtype, needs_swap); if (!checksum) mPUSHi(aiv); else if (checksum > bits_in_uv) @@ -1877,16 +1469,7 @@ S_unpack_rec(pTHX_ tempsym_t* symptr, co case 'J': while (len-- > 0) { UV auv; - SHIFT_VAR(utf8, s, strend, auv, datumtype); -#if IVSIZE == INTSIZE - DO_BO_UNPACK(auv, i); -#elif IVSIZE == LONGSIZE - DO_BO_UNPACK(auv, l); -#elif defined(HAS_QUAD) && IVSIZE == U64SIZE - DO_BO_UNPACK(auv, 64); -#else - Perl_croak(aTHX_ "'J' not supported on this platform"); -#endif + SHIFT_VAR(utf8, s, strend, auv, datumtype, needs_swap); if (!checksum) mPUSHu(auv); else if (checksum > bits_in_uv) @@ -1899,8 +1482,7 @@ S_unpack_rec(pTHX_ tempsym_t* symptr, co #if LONGSIZE != SIZE32 while (len-- > 0) { long along; - SHIFT_VAR(utf8, s, strend, along, datumtype); - DO_BO_UNPACK(along, l); + SHIFT_VAR(utf8, s, strend, along, datumtype, needs_swap); if (!checksum) mPUSHi(along); else if (checksum > bits_in_uv) @@ -1918,8 +1500,7 @@ S_unpack_rec(pTHX_ tempsym_t* symptr, co #if U32SIZE > SIZE32 ai32 = 0; #endif - SHIFT32(utf8, s, strend, &ai32, datumtype); - DO_BO_UNPACK(ai32, 32); + SHIFT32(utf8, s, strend, &ai32, datumtype, needs_swap); #if U32SIZE > SIZE32 if (ai32 > 2147483647) ai32 -= 4294967296; #endif @@ -1935,8 +1516,7 @@ S_unpack_rec(pTHX_ tempsym_t* symptr, co #if LONGSIZE != SIZE32 while (len-- > 0) { unsigned long aulong; - SHIFT_VAR(utf8, s, strend, aulong, datumtype); - DO_BO_UNPACK(aulong, l); + SHIFT_VAR(utf8, s, strend, aulong, datumtype, needs_swap); if (!checksum) mPUSHu(aulong); else if (checksum > bits_in_uv) @@ -1956,16 +1536,11 @@ S_unpack_rec(pTHX_ tempsym_t* symptr, co #if U32SIZE > SIZE32 au32 = 0; #endif - SHIFT32(utf8, s, strend, &au32, datumtype); - DO_BO_UNPACK(au32, 32); -#ifdef HAS_NTOHL + SHIFT32(utf8, s, strend, &au32, datumtype, needs_swap); if (datumtype == 'N') au32 = PerlSock_ntohl(au32); -#endif -#ifdef HAS_VTOHL if (datumtype == 'V') au32 = vtohl(au32); -#endif if (!checksum) mPUSHu(au32); else if (checksum > bits_in_uv) @@ -1974,23 +1549,20 @@ S_unpack_rec(pTHX_ tempsym_t* symptr, co cuv += au32; } break; -#ifdef PERL_PACK_CAN_SHRIEKSIGN case 'V' | TYPE_IS_SHRIEKING: case 'N' | TYPE_IS_SHRIEKING: while (len-- > 0) { I32 ai32; -# if U32SIZE > SIZE32 +#if U32SIZE > SIZE32 ai32 = 0; -# endif - SHIFT32(utf8, s, strend, &ai32, datumtype); -# ifdef HAS_NTOHL +#endif + SHIFT32(utf8, s, strend, &ai32, datumtype, needs_swap); + /* There should never be any byte swapping here. */ + assert(!TYPE_ENDIANNESS(datumtype)); if (datumtype == ('N' | TYPE_IS_SHRIEKING)) ai32 = (I32)PerlSock_ntohl((U32)ai32); -# endif -# ifdef HAS_VTOHL if (datumtype == ('V' | TYPE_IS_SHRIEKING)) ai32 = (I32)vtohl((U32)ai32); -# endif if (!checksum) mPUSHi(ai32); else if (checksum > bits_in_uv) @@ -1999,12 +1571,10 @@ S_unpack_rec(pTHX_ tempsym_t* symptr, co cuv += ai32; } break; -#endif /* PERL_PACK_CAN_SHRIEKSIGN */ case 'p': while (len-- > 0) { const char *aptr; - SHIFT_VAR(utf8, s, strend, aptr, datumtype); - DO_BO_UNPACK_PC(aptr); + SHIFT_VAR(utf8, s, strend, aptr, datumtype, needs_swap); /* newSVpv generates undef if aptr is NULL */ mPUSHs(newSVpv(aptr, 0)); } @@ -2057,18 +1627,16 @@ S_unpack_rec(pTHX_ tempsym_t* symptr, co EXTEND(SP, 1); if (s + sizeof(char*) <= strend) { char *aptr; - SHIFT_VAR(utf8, s, strend, aptr, datumtype); - DO_BO_UNPACK_PC(aptr); + SHIFT_VAR(utf8, s, strend, aptr, datumtype, needs_swap); /* newSVpvn generates undef if aptr is NULL */ PUSHs(newSVpvn_flags(aptr, len, SVs_TEMP)); } break; -#ifdef HAS_QUAD +#if IVSIZE >= 8 case 'q': while (len-- > 0) { Quad_t aquad; - SHIFT_VAR(utf8, s, strend, aquad, datumtype); - DO_BO_UNPACK(aquad, 64); + SHIFT_VAR(utf8, s, strend, aquad, datumtype, needs_swap); if (!checksum) mPUSHs(aquad >= IV_MIN && aquad <= IV_MAX ? newSViv((IV)aquad) : newSVnv((NV)aquad)); @@ -2081,8 +1649,7 @@ S_unpack_rec(pTHX_ tempsym_t* symptr, co case 'Q': while (len-- > 0) { Uquad_t auquad; - SHIFT_VAR(utf8, s, strend, auquad, datumtype); - DO_BO_UNPACK(auquad, 64); + SHIFT_VAR(utf8, s, strend, auquad, datumtype, needs_swap); if (!checksum) mPUSHs(auquad <= UV_MAX ? newSVuv((UV)auquad) : newSVnv((NV)auquad)); @@ -2092,13 +1659,12 @@ S_unpack_rec(pTHX_ tempsym_t* symptr, co cuv += auquad; } break; -#endif /* HAS_QUAD */ +#endif /* float and double added gnb@melba.bby.oz.au 22/11/89 */ case 'f': while (len-- > 0) { float afloat; - SHIFT_VAR(utf8, s, strend, afloat, datumtype); - DO_BO_UNPACK_N(afloat, float); + SHIFT_VAR(utf8, s, strend, afloat, datumtype, needs_swap); if (!checksum) mPUSHn(afloat); else @@ -2108,8 +1674,7 @@ S_unpack_rec(pTHX_ tempsym_t* symptr, co case 'd': while (len-- > 0) { double adouble; - SHIFT_VAR(utf8, s, strend, adouble, datumtype); - DO_BO_UNPACK_N(adouble, double); + SHIFT_VAR(utf8, s, strend, adouble, datumtype, needs_swap); if (!checksum) mPUSHn(adouble); else @@ -2119,8 +1684,8 @@ S_unpack_rec(pTHX_ tempsym_t* symptr, co case 'F': while (len-- > 0) { NV_bytes anv; - SHIFT_BYTES(utf8, s, strend, anv.bytes, sizeof(anv.bytes), datumtype); - DO_BO_UNPACK_N(anv.nv, NV); + SHIFT_BYTES(utf8, s, strend, anv.bytes, sizeof(anv.bytes), + datumtype, needs_swap); if (!checksum) mPUSHn(anv.nv); else @@ -2131,8 +1696,8 @@ S_unpack_rec(pTHX_ tempsym_t* symptr, co case 'D': while (len-- > 0) { ld_bytes aldouble; - SHIFT_BYTES(utf8, s, strend, aldouble.bytes, sizeof(aldouble.bytes), datumtype); - DO_BO_UNPACK_N(aldouble.ld, long double); + SHIFT_BYTES(utf8, s, strend, aldouble.bytes, + sizeof(aldouble.bytes), datumtype, needs_swap); if (!checksum) mPUSHn(aldouble.ld); else @@ -2438,7 +2003,7 @@ marked_upgrade(pTHX_ SV *sv, tempsym_t * from_start = SvPVX_const(sv); from_end = from_start + SvCUR(sv); for (from_ptr = from_start; from_ptr < from_end; from_ptr++) - if (!NATIVE_IS_INVARIANT(*from_ptr)) break; + if (!NATIVE_BYTE_IS_INVARIANT(*from_ptr)) break; if (from_ptr == from_end) { /* Simple case: no character needs to be changed */ SvUTF8_on(sv); @@ -2536,6 +2101,7 @@ S_pack_rec(pTHX_ SV *cat, tempsym_t* sym howlen_t howlen = symptr->howlen; char *start = SvPVX(cat); char *cur = start + SvCUR(cat); + bool needs_swap; #define NEXTFROM (lengthcode ? lengthcode : items-- > 0 ? *beglist++ : &PL_sv_no) @@ -2585,6 +2151,8 @@ S_pack_rec(pTHX_ SV *cat, tempsym_t* sym lengthcode = sv_2mortal(newSViv(count)); } + needs_swap = NEEDS_SWAP(datumtype); + /* Code inside the switch must take care to properly update cat (CUR length and '\0' termination) if it updated *cur and doesn't simply leave using break */ @@ -2596,9 +2164,7 @@ S_pack_rec(pTHX_ SV *cat, tempsym_t* sym Perl_croak(aTHX_ "'%%' may not be used in pack"); { char *from; -#ifdef PERL_PACK_CAN_SHRIEKSIGN case '.' | TYPE_IS_SHRIEKING: -#endif case '.': if (howlen == e_star) from = start; else if (len == 0) from = cur; @@ -2611,17 +2177,11 @@ S_pack_rec(pTHX_ SV *cat, tempsym_t* sym fromstr = NEXTFROM; len = SvIV(fromstr); goto resize; -#ifdef PERL_PACK_CAN_SHRIEKSIGN case '@' | TYPE_IS_SHRIEKING: -#endif case '@': from = start + symptr->strbeg; resize: -#ifdef PERL_PACK_CAN_SHRIEKSIGN if (utf8 && !(datumtype & TYPE_IS_SHRIEKING)) -#else /* PERL_PACK_CAN_SHRIEKSIGN */ - if (utf8) -#endif if (len >= 0) { while (len && from < cur) { from += UTF8SKIP(from); @@ -3025,8 +2585,8 @@ S_pack_rec(pTHX_ SV *cat, tempsym_t* sym GROWING(0, cat, start, cur, len+UTF8_MAXLEN); end = start+SvLEN(cat)-UTF8_MAXLEN; } - cur = (char *) uvuni_to_utf8_flags((U8 *) cur, - NATIVE_TO_UNI(auv), + cur = (char *) uvchr_to_utf8_flags((U8 *) cur, + auv, warn_utf8 ? 0 : UNICODE_ALLOW_ANY); } else { @@ -3079,7 +2639,7 @@ S_pack_rec(pTHX_ SV *cat, tempsym_t* sym auv = SvUV(fromstr); if (utf8) { U8 buffer[UTF8_MAXLEN], *endb; - endb = uvuni_to_utf8_flags(buffer, auv, + endb = uvchr_to_utf8_flags(buffer, auv, warn_utf8 ? 0 : UNICODE_ALLOW_ANY); if (cur+(endb-buffer)*UTF8_EXPAND >= end) { @@ -3089,7 +2649,7 @@ S_pack_rec(pTHX_ SV *cat, tempsym_t* sym len+(endb-buffer)*UTF8_EXPAND); end = start+SvLEN(cat); } - cur = bytes_to_uni(buffer, endb-buffer, cur); + cur = S_bytes_to_uni(buffer, endb-buffer, cur, 0); } else { if (cur >= end) { *cur = '\0'; @@ -3097,7 +2657,7 @@ S_pack_rec(pTHX_ SV *cat, tempsym_t* sym GROWING(0, cat, start, cur, len+UTF8_MAXLEN); end = start+SvLEN(cat)-UTF8_MAXLEN; } - cur = (char *) uvuni_to_utf8_flags((U8 *) cur, auv, + cur = (char *) uvchr_to_utf8_flags((U8 *) cur, auv, warn_utf8 ? 0 : UNICODE_ALLOW_ANY); } @@ -3123,8 +2683,7 @@ S_pack_rec(pTHX_ SV *cat, tempsym_t* sym # else afloat = (float)anv; # endif - DO_BO_PACK_N(afloat, float); - PUSH_VAR(utf8, cur, afloat); + PUSH_VAR(utf8, cur, afloat, needs_swap); } break; case 'd': @@ -3145,8 +2704,7 @@ S_pack_rec(pTHX_ SV *cat, tempsym_t* sym # else adouble = (double)anv; # endif - DO_BO_PACK_N(adouble, double); - PUSH_VAR(utf8, cur, adouble); + PUSH_VAR(utf8, cur, adouble, needs_swap); } break; case 'F': { @@ -3160,8 +2718,7 @@ S_pack_rec(pTHX_ SV *cat, tempsym_t* sym #else anv.nv = SvNV(fromstr); #endif - DO_BO_PACK_N(anv, NV); - PUSH_BYTES(utf8, cur, anv.bytes, sizeof(anv.bytes)); + PUSH_BYTES(utf8, cur, anv.bytes, sizeof(anv.bytes), needs_swap); } break; } @@ -3178,38 +2735,30 @@ S_pack_rec(pTHX_ SV *cat, tempsym_t* sym # else aldouble.ld = (long double)SvNV(fromstr); # endif - DO_BO_PACK_N(aldouble, long double); - PUSH_BYTES(utf8, cur, aldouble.bytes, sizeof(aldouble.bytes)); + PUSH_BYTES(utf8, cur, aldouble.bytes, sizeof(aldouble.bytes), + needs_swap); } break; } #endif -#ifdef PERL_PACK_CAN_SHRIEKSIGN case 'n' | TYPE_IS_SHRIEKING: -#endif case 'n': while (len-- > 0) { I16 ai16; fromstr = NEXTFROM; ai16 = (I16)SvIV(fromstr); -#ifdef HAS_HTONS ai16 = PerlSock_htons(ai16); -#endif - PUSH16(utf8, cur, &ai16); + PUSH16(utf8, cur, &ai16, FALSE); } break; -#ifdef PERL_PACK_CAN_SHRIEKSIGN case 'v' | TYPE_IS_SHRIEKING: -#endif case 'v': while (len-- > 0) { I16 ai16; fromstr = NEXTFROM; ai16 = (I16)SvIV(fromstr); -#ifdef HAS_HTOVS ai16 = htovs(ai16); -#endif - PUSH16(utf8, cur, &ai16); + PUSH16(utf8, cur, &ai16, FALSE); } break; case 'S' | TYPE_IS_SHRIEKING: @@ -3218,8 +2767,7 @@ S_pack_rec(pTHX_ SV *cat, tempsym_t* sym unsigned short aushort; fromstr = NEXTFROM; aushort = SvUV(fromstr); - DO_BO_PACK(aushort, s); - PUSH_VAR(utf8, cur, aushort); + PUSH_VAR(utf8, cur, aushort, needs_swap); } break; #else @@ -3230,8 +2778,7 @@ S_pack_rec(pTHX_ SV *cat, tempsym_t* sym U16 au16; fromstr = NEXTFROM; au16 = (U16)SvUV(fromstr); - DO_BO_PACK(au16, 16); - PUSH16(utf8, cur, &au16); + PUSH16(utf8, cur, &au16, needs_swap); } break; case 's' | TYPE_IS_SHRIEKING: @@ -3240,8 +2787,7 @@ S_pack_rec(pTHX_ SV *cat, tempsym_t* sym short ashort; fromstr = NEXTFROM; ashort = SvIV(fromstr); - DO_BO_PACK(ashort, s); - PUSH_VAR(utf8, cur, ashort); + PUSH_VAR(utf8, cur, ashort, needs_swap); } break; #else @@ -3252,8 +2798,7 @@ S_pack_rec(pTHX_ SV *cat, tempsym_t* sym I16 ai16; fromstr = NEXTFROM; ai16 = (I16)SvIV(fromstr); - DO_BO_PACK(ai16, 16); - PUSH16(utf8, cur, &ai16); + PUSH16(utf8, cur, &ai16, needs_swap); } break; case 'I': @@ -3262,8 +2807,7 @@ S_pack_rec(pTHX_ SV *cat, tempsym_t* sym unsigned int auint; fromstr = NEXTFROM; auint = SvUV(fromstr); - DO_BO_PACK(auint, i); - PUSH_VAR(utf8, cur, auint); + PUSH_VAR(utf8, cur, auint, needs_swap); } break; case 'j': @@ -3271,16 +2815,7 @@ S_pack_rec(pTHX_ SV *cat, tempsym_t* sym IV aiv; fromstr = NEXTFROM; aiv = SvIV(fromstr); -#if IVSIZE == INTSIZE - DO_BO_PACK(aiv, i); -#elif IVSIZE == LONGSIZE - DO_BO_PACK(aiv, l); -#elif defined(HAS_QUAD) && IVSIZE == U64SIZE - DO_BO_PACK(aiv, 64); -#else - Perl_croak(aTHX_ "'j' not supported on this platform"); -#endif - PUSH_VAR(utf8, cur, aiv); + PUSH_VAR(utf8, cur, aiv, needs_swap); } break; case 'J': @@ -3288,16 +2823,7 @@ S_pack_rec(pTHX_ SV *cat, tempsym_t* sym UV auv; fromstr = NEXTFROM; auv = SvUV(fromstr); -#if UVSIZE == INTSIZE - DO_BO_PACK(auv, i); -#elif UVSIZE == LONGSIZE - DO_BO_PACK(auv, l); -#elif defined(HAS_QUAD) && UVSIZE == U64SIZE - DO_BO_PACK(auv, 64); -#else - Perl_croak(aTHX_ "'J' not supported on this platform"); -#endif - PUSH_VAR(utf8, cur, auv); + PUSH_VAR(utf8, cur, auv, needs_swap); } break; case 'w': @@ -3393,36 +2919,27 @@ S_pack_rec(pTHX_ SV *cat, tempsym_t* sym int aint; fromstr = NEXTFROM; aint = SvIV(fromstr); - DO_BO_PACK(aint, i); - PUSH_VAR(utf8, cur, aint); + PUSH_VAR(utf8, cur, aint, needs_swap); } break; -#ifdef PERL_PACK_CAN_SHRIEKSIGN case 'N' | TYPE_IS_SHRIEKING: -#endif case 'N': while (len-- > 0) { U32 au32; fromstr = NEXTFROM; au32 = SvUV(fromstr); -#ifdef HAS_HTONL au32 = PerlSock_htonl(au32); -#endif - PUSH32(utf8, cur, &au32); + PUSH32(utf8, cur, &au32, FALSE); } break; -#ifdef PERL_PACK_CAN_SHRIEKSIGN case 'V' | TYPE_IS_SHRIEKING: -#endif case 'V': while (len-- > 0) { U32 au32; fromstr = NEXTFROM; au32 = SvUV(fromstr); -#ifdef HAS_HTOVL au32 = htovl(au32); -#endif - PUSH32(utf8, cur, &au32); + PUSH32(utf8, cur, &au32, FALSE); } break; case 'L' | TYPE_IS_SHRIEKING: @@ -3431,8 +2948,7 @@ S_pack_rec(pTHX_ SV *cat, tempsym_t* sym unsigned long aulong; fromstr = NEXTFROM; aulong = SvUV(fromstr); - DO_BO_PACK(aulong, l); - PUSH_VAR(utf8, cur, aulong); + PUSH_VAR(utf8, cur, aulong, needs_swap); } break; #else @@ -3443,8 +2959,7 @@ S_pack_rec(pTHX_ SV *cat, tempsym_t* sym U32 au32; fromstr = NEXTFROM; au32 = SvUV(fromstr); - DO_BO_PACK(au32, 32); - PUSH32(utf8, cur, &au32); + PUSH32(utf8, cur, &au32, needs_swap); } break; case 'l' | TYPE_IS_SHRIEKING: @@ -3453,8 +2968,7 @@ S_pack_rec(pTHX_ SV *cat, tempsym_t* sym long along; fromstr = NEXTFROM; along = SvIV(fromstr); - DO_BO_PACK(along, l); - PUSH_VAR(utf8, cur, along); + PUSH_VAR(utf8, cur, along, needs_swap); } break; #else @@ -3465,18 +2979,16 @@ S_pack_rec(pTHX_ SV *cat, tempsym_t* sym I32 ai32; fromstr = NEXTFROM; ai32 = SvIV(fromstr); - DO_BO_PACK(ai32, 32); - PUSH32(utf8, cur, &ai32); + PUSH32(utf8, cur, &ai32, needs_swap); } break; -#ifdef HAS_QUAD +#if IVSIZE >= 8 case 'Q': while (len-- > 0) { Uquad_t auquad; fromstr = NEXTFROM; auquad = (Uquad_t) SvUV(fromstr); - DO_BO_PACK(auquad, 64); - PUSH_VAR(utf8, cur, auquad); + PUSH_VAR(utf8, cur, auquad, needs_swap); } break; case 'q': @@ -3484,11 +2996,10 @@ S_pack_rec(pTHX_ SV *cat, tempsym_t* sym Quad_t aquad; fromstr = NEXTFROM; aquad = (Quad_t)SvIV(fromstr); - DO_BO_PACK(aquad, 64); - PUSH_VAR(utf8, cur, aquad); + PUSH_VAR(utf8, cur, aquad, needs_swap); } break; -#endif /* HAS_QUAD */ +#endif case 'P': len = 1; /* assume SV is correct length */ GROWING(utf8, cat, start, cur, sizeof(char *)); @@ -3516,8 +3027,7 @@ S_pack_rec(pTHX_ SV *cat, tempsym_t* sym else aptr = SvPV_force_flags_nolen(fromstr, 0); } - DO_BO_PACK_PC(aptr); - PUSH_VAR(utf8, cur, aptr); + PUSH_VAR(utf8, cur, aptr, needs_swap); } break; case 'u': { @@ -3563,7 +3073,7 @@ S_pack_rec(pTHX_ SV *cat, tempsym_t* sym end = doencodes(hunk, aptr, todo); aptr += todo; } - PUSH_BYTES(utf8, cur, hunk, end-hunk); + PUSH_BYTES(utf8, cur, hunk, end-hunk, 0); fromlen -= todo; } break; Index: gnu/usr.bin/perl/pp_proto.h =================================================================== RCS file: /mnt/memory/perl/importit/cvs/src/gnu/usr.bin/perl/pp_proto.h,v retrieving revision 1.1.1.9 diff -u -p -u -p -r1.1.1.9 pp_proto.h --- gnu/usr.bin/perl/pp_proto.h 24 Mar 2014 14:58:46 -0000 1.1.1.9 +++ gnu/usr.bin/perl/pp_proto.h 16 Nov 2014 03:22:24 -0000 @@ -123,6 +123,8 @@ PERL_CALLCONV OP *Perl_pp_introcv(pTHX); PERL_CALLCONV OP *Perl_pp_ioctl(pTHX); PERL_CALLCONV OP *Perl_pp_iter(pTHX); PERL_CALLCONV OP *Perl_pp_join(pTHX); +PERL_CALLCONV OP *Perl_pp_kvaslice(pTHX); +PERL_CALLCONV OP *Perl_pp_kvhslice(pTHX); PERL_CALLCONV OP *Perl_pp_last(pTHX); PERL_CALLCONV OP *Perl_pp_lc(pTHX); PERL_CALLCONV OP *Perl_pp_le(pTHX); Index: gnu/usr.bin/perl/pp_sort.c =================================================================== RCS file: /mnt/memory/perl/importit/cvs/src/gnu/usr.bin/perl/pp_sort.c,v retrieving revision 1.1.1.10 diff -u -p -u -p -r1.1.1.10 pp_sort.c --- gnu/usr.bin/perl/pp_sort.c 24 Mar 2014 14:58:46 -0000 1.1.1.10 +++ gnu/usr.bin/perl/pp_sort.c 16 Nov 2014 03:22:24 -0000 @@ -53,9 +53,12 @@ * The original code was written in conjunction with BSD Computer Software * Research Group at University of California, Berkeley. * - * See also: "Optimistic Merge Sort" (SODA '92) + * See also: "Optimistic Sorting and Information Theoretic Complexity" + * Peter McIlroy + * SODA (Fourth Annual ACM-SIAM Symposium on Discrete Algorithms), + * pp 467-474, Austin, Texas, 25-27 January 1993. * - * The integration to Perl is by John P. Linderman . + * The integration to Perl is by John P. Linderman . * * The code can be distributed under the same terms as Perl itself. * @@ -1430,11 +1433,11 @@ S_qsortsv(pTHX_ gptr *list1, size_t nmem =for apidoc sortsv -Sort an array. Here is an example: +Sort an array. Here is an example: sortsv(AvARRAY(av), av_top_index(av)+1, Perl_sv_cmp_locale); -Currently this always uses mergesort. See sortsv_flags for a more +Currently this always uses mergesort. See sortsv_flags for a more flexible routine. =cut @@ -1474,15 +1477,15 @@ PP(pp_sort) { dVAR; dSP; dMARK; dORIGMARK; SV **p1 = ORIGMARK+1, **p2; - I32 max, i; + SSize_t max, i; AV* av = NULL; - HV *stash; GV *gv; CV *cv = NULL; I32 gimme = GIMME; OP* const nextop = PL_op->op_next; I32 overloading = 0; bool hasargs = FALSE; + bool copytmps; I32 is_xsub = 0; I32 sorting_av = 0; const U8 priv = PL_op->op_private; @@ -1509,14 +1512,13 @@ PP(pp_sort) SAVEVPTR(PL_sortcop); if (flags & OPf_STACKED) { if (flags & OPf_SPECIAL) { - OP *kid = cLISTOP->op_first->op_sibling; /* pass pushmark */ - kid = kUNOP->op_first; /* pass rv2gv */ - kid = kUNOP->op_first; /* pass leave */ - PL_sortcop = kid->op_next; - stash = CopSTASH(PL_curcop); + OP *nullop = cLISTOP->op_first->op_sibling; /* pass pushmark */ + assert(nullop->op_type == OP_NULL); + PL_sortcop = nullop->op_next; } else { GV *autogv = NULL; + HV *stash; cv = sv_2cv(*++MARK, &stash, &gv, GV_ADD); check_cv: if (cv && SvPOK(cv)) { @@ -1564,7 +1566,6 @@ PP(pp_sort) } else { PL_sortcop = NULL; - stash = CopSTASH(PL_curcop); } /* optimiser converts "@a = sort @a" to "sort \@a"; @@ -1588,7 +1589,10 @@ PP(pp_sort) if (SvREADONLY(av)) Perl_croak_no_modify(); else + { SvREADONLY_on(av); + save_pushptr((void *)av, SAVEt_READONLY_OFF); + } p1 = p2 = AvARRAY(av); sorting_av = 1; } @@ -1601,8 +1605,13 @@ PP(pp_sort) /* shuffle stack down, removing optional initial cv (p1!=p2), plus * any nulls; also stringify or converting to integer or number as * required any args */ + copytmps = !sorting_av && PL_sortcop; for (i=max; i > 0 ; i--) { if ((*p1 = *p2++)) { /* Weed out nulls. */ + if (copytmps && SvPADTMP(*p1)) { + assert(!IS_PADGV(*p1)); + *p1 = sv_mortalcopy(*p1); + } SvTEMP_off(*p1); if (!PL_sortcop) { if (priv & OPpSORT_NUMERIC) { @@ -1646,12 +1655,14 @@ PP(pp_sort) CATCH_SET(TRUE); PUSHSTACKi(PERLSI_SORT); if (!hasargs && !is_xsub) { - SAVESPTR(PL_firstgv); - SAVESPTR(PL_secondgv); - SAVESPTR(PL_sortstash); - PL_firstgv = gv_fetchpvs("a", GV_ADD|GV_NOTQUAL, SVt_PV); - PL_secondgv = gv_fetchpvs("b", GV_ADD|GV_NOTQUAL, SVt_PV); - PL_sortstash = stash; + SAVEGENERICSV(PL_firstgv); + SAVEGENERICSV(PL_secondgv); + PL_firstgv = MUTABLE_GV(SvREFCNT_inc( + gv_fetchpvs("a", GV_ADD|GV_NOTQUAL, SVt_PV) + )); + PL_secondgv = MUTABLE_GV(SvREFCNT_inc( + gv_fetchpvs("b", GV_ADD|GV_NOTQUAL, SVt_PV) + )); SAVESPTR(GvSV(PL_firstgv)); SAVESPTR(GvSV(PL_secondgv)); } Index: gnu/usr.bin/perl/pp_sys.c =================================================================== RCS file: /mnt/memory/perl/importit/cvs/src/gnu/usr.bin/perl/pp_sys.c,v retrieving revision 1.15 diff -u -p -u -p -r1.15 pp_sys.c --- gnu/usr.bin/perl/pp_sys.c 24 Mar 2014 15:05:13 -0000 1.15 +++ gnu/usr.bin/perl/pp_sys.c 16 Nov 2014 03:22:24 -0000 @@ -476,7 +476,8 @@ PP(pp_die) SV *exsv; STRLEN len; #ifdef VMS - VMSISH_HUSHED = VMSISH_HUSHED || (PL_op->op_private & OPpHUSH_VMSISH); + VMSISH_HUSHED = + VMSISH_HUSHED || (PL_curcop->op_private & OPpHUSH_VMSISH); #endif if (SP - MARK != 1) { dTARGET; @@ -528,7 +529,7 @@ PP(pp_die) /* I/O. */ OP * -Perl_tied_method(pTHX_ const char *const methname, SV **sp, SV *const sv, +Perl_tied_method(pTHX_ SV *methname, SV **sp, SV *const sv, const MAGIC *const mg, const U32 flags, U32 argc, ...) { SV **orig_sp = sp; @@ -572,7 +573,7 @@ Perl_tied_method(pTHX_ const char *const SAVEGENERICSV(PL_ors_sv); PL_ors_sv = newSVpvs("\n"); } - ret_args = call_method(methname, flags & G_WANT); + ret_args = call_sv(methname, (flags & G_WANT)|G_METHOD_NAMED); SPAGAIN; orig_sp = sp; POPSTACK; @@ -623,7 +624,7 @@ PP(pp_open) if (mg) { /* Method's args are same as ours ... */ /* ... except handle is replaced by the object */ - return Perl_tied_method(aTHX_ "OPEN", mark - 1, MUTABLE_SV(io), mg, + return Perl_tied_method(aTHX_ SV_CONST(OPEN), mark - 1, MUTABLE_SV(io), mg, G_SCALAR | TIED_METHOD_ARGUMENTS_ON_STACK, sp - mark); } @@ -637,7 +638,7 @@ PP(pp_open) } tmps = SvPV_const(sv, len); - ok = do_openn(gv, tmps, len, FALSE, O_RDONLY, 0, NULL, MARK+1, (SP-MARK)); + ok = do_open6(gv, tmps, len, NULL, MARK+1, (SP-MARK)); SP = ORIGMARK; if (ok) PUSHi( (I32)PL_forkprocess ); @@ -662,7 +663,7 @@ PP(pp_close) if (io) { const MAGIC * const mg = SvTIED_mg((const SV *)io, PERL_MAGIC_tiedscalar); if (mg) { - return tied_method0("CLOSE", SP, MUTABLE_SV(io), mg); + return tied_method0(SV_CONST(CLOSE), SP, MUTABLE_SV(io), mg); } } } @@ -682,16 +683,13 @@ PP(pp_pipe_op) GV * const wgv = MUTABLE_GV(POPs); GV * const rgv = MUTABLE_GV(POPs); - if (!rgv || !wgv) - goto badexit; - - if (!isGV_with_GP(rgv) || !isGV_with_GP(wgv)) - DIE(aTHX_ PL_no_usym, "filehandle"); + assert (isGV_with_GP(rgv)); + assert (isGV_with_GP(wgv)); rstio = GvIOn(rgv); - wstio = GvIOn(wgv); - if (IoIFP(rstio)) do_close(rgv, FALSE); + + wstio = GvIOn(wgv); if (IoIFP(wstio)) do_close(wgv, FALSE); @@ -745,7 +743,7 @@ PP(pp_fileno) if (io && (mg = SvTIED_mg((const SV *)io, PERL_MAGIC_tiedscalar))) { - return tied_method0("FILENO", SP, MUTABLE_SV(io), mg); + return tied_method0(SV_CONST(FILENO), SP, MUTABLE_SV(io), mg); } if (!io || !(fp = IoIFP(io))) { @@ -816,7 +814,7 @@ PP(pp_binmode) function, which I don't think that the optimiser will be able to figure out. Although, as it's a static function, in theory it could. */ - return Perl_tied_method(aTHX_ "BINMODE", SP, MUTABLE_SV(io), mg, + return Perl_tied_method(aTHX_ SV_CONST(BINMODE), SP, MUTABLE_SV(io), mg, G_SCALAR|TIED_METHOD_MORTALIZE_NOT_NEEDED, discp ? 1 : 0, discp); } @@ -899,6 +897,10 @@ PP(pp_tie) varsv = MUTABLE_SV(GvIOp(varsv)); break; } + if (SvTYPE(varsv) == SVt_PVLV && LvTYPE(varsv) == 'y') { + vivify_defelem(varsv); + varsv = LvTARG(varsv); + } /* FALL THROUGH */ default: methname = "TIESCALAR"; @@ -967,6 +969,9 @@ PP(pp_untie) if (isGV_with_GP(sv) && !SvFAKE(sv) && !(sv = MUTABLE_SV(GvIOp(sv)))) RETPUSHYES; + if (SvTYPE(sv) == SVt_PVLV && LvTYPE(sv) == 'y' && + !(sv = defelem_target(sv, NULL))) RETPUSHUNDEF; + if ((mg = SvTIED_mg(sv, how))) { SV * const obj = SvRV(SvTIED_obj(sv, mg)); if (obj) { @@ -1005,6 +1010,9 @@ PP(pp_tied) if (isGV_with_GP(sv) && !SvFAKE(sv) && !(sv = MUTABLE_SV(GvIOp(sv)))) RETPUSHUNDEF; + if (SvTYPE(sv) == SVt_PVLV && LvTYPE(sv) == 'y' && + !(sv = defelem_target(sv, NULL))) RETPUSHUNDEF; + if ((mg = SvTIED_mg(sv, how))) { PUSHs(SvTIED_obj(sv, mg)); RETURN; @@ -1102,10 +1110,11 @@ PP(pp_sselect) SvGETMAGIC(sv); if (!SvOK(sv)) continue; - if (SvIsCOW(sv)) - sv_force_normal_flags(sv, 0); - if (SvREADONLY(sv) && !(SvPOK(sv) && SvCUR(sv) == 0)) + if (SvREADONLY(sv)) { + if (!(SvPOK(sv) && SvCUR(sv) == 0)) Perl_croak_no_modify(); + } + else if (SvIsCOW(sv)) sv_force_normal_flags(sv, 0); if (!SvPOK(sv)) { if (!SvPOKp(sv)) Perl_ck_warner(aTHX_ packWARN(WARN_MISC), @@ -1148,8 +1157,9 @@ PP(pp_sselect) # endif sv = SP[4]; + SvGETMAGIC(sv); if (SvOK(sv)) { - value = SvNV(sv); + value = SvNV_nomg(sv); if (value < 0.0) value = 0.0; timebuf.tv_sec = (long)value; @@ -1236,7 +1246,7 @@ PP(pp_sselect) =for apidoc setdefout Sets PL_defoutgv, the default file handle for output, to the passed in -typeglob. As PL_defoutgv "owns" a reference on its typeglob, the reference +typeglob. As PL_defoutgv "owns" a reference on its typeglob, the reference count of the passed in typeglob is increased by one, and the reference count of the typeglob that PL_defoutgv points to is decreased by one. @@ -1298,7 +1308,7 @@ PP(pp_getc) const MAGIC * const mg = SvTIED_mg((const SV *)io, PERL_MAGIC_tiedscalar); if (mg) { const U32 gimme = GIMME_V; - Perl_tied_method(aTHX_ "GETC", SP, MUTABLE_SV(io), mg, gimme, 0); + Perl_tied_method(aTHX_ SV_CONST(GETC), SP, MUTABLE_SV(io), mg, gimme, 0); if (gimme == G_SCALAR) { SPAGAIN; SvSetMagicSV_nosteal(TARG, TOPs); @@ -1325,6 +1335,7 @@ PP(pp_getc) } SvUTF8_on(TARG); } + else SvUTF8_off(TARG); PUSHTARG; RETURN; } @@ -1338,7 +1349,7 @@ S_doform(pTHX_ CV *cv, GV *gv, OP *retop PERL_ARGS_ASSERT_DOFORM; - if (cv && CvCLONE(cv)) + if (CvCLONE(cv)) cv = MUTABLE_CV(sv_2mortal(MUTABLE_SV(cv_clone(cv)))); ENTER; @@ -1368,8 +1379,8 @@ PP(pp_enterwrite) SV *tmpsv = NULL; if (MAXARG == 0) { - gv = PL_defoutgv; EXTEND(SP, 1); + gv = PL_defoutgv; } else { gv = MUTABLE_GV(POPs); @@ -1470,8 +1481,7 @@ PP(pp_leavewrite) PL_formtarget = PL_toptarget; IoFLAGS(io) |= IOf_DIDTOP; fgv = IoTOP_GV(io); - if (!fgv) - DIE(aTHX_ "bad top format reference"); + assert(fgv); /* IoTOP_GV(io) should have been set above */ cv = GvFORM(fgv); if (!cv) { SV * const sv = sv_newmortal(); @@ -1483,8 +1493,8 @@ PP(pp_leavewrite) forget_top: POPBLOCK(cx,PL_curpm); - POPFORMAT(cx); retop = cx->blk_sub.retop; + POPFORMAT(cx); SP = newsp; /* ignore retval of formline */ LEAVE; @@ -1536,7 +1546,7 @@ PP(pp_prtf) Move(MARK, MARK + 1, (SP - MARK) + 1, SV*); ++SP; } - return Perl_tied_method(aTHX_ "PRINTF", mark - 1, MUTABLE_SV(io), + return Perl_tied_method(aTHX_ SV_CONST(PRINTF), mark - 1, MUTABLE_SV(io), mg, G_SCALAR | TIED_METHOD_ARGUMENTS_ON_STACK, sp - mark); @@ -1588,8 +1598,7 @@ PP(pp_sysopen) /* Need TIEHANDLE method ? */ const char * const tmps = SvPV_const(sv, len); - /* FIXME? do_open should do const */ - if (do_open(gv, tmps, len, TRUE, mode, perm, NULL)) { + if (do_open_raw(gv, tmps, len, mode, perm)) { IoLINES(GvIOp(gv)) = 0; PUSHs(&PL_sv_yes); } @@ -1625,7 +1634,7 @@ PP(pp_sysread) { const MAGIC *const mg = SvTIED_mg((const SV *)io, PERL_MAGIC_tiedscalar); if (mg) { - return Perl_tied_method(aTHX_ "READ", mark - 1, MUTABLE_SV(io), mg, + return Perl_tied_method(aTHX_ SV_CONST(READ), mark - 1, MUTABLE_SV(io), mg, G_SCALAR | TIED_METHOD_ARGUMENTS_ON_STACK, sp - mark); } @@ -1701,6 +1710,14 @@ PP(pp_sysread) if (!(IoFLAGS(io) & IOf_UNTAINT)) SvTAINTED_on(bufsv); SP = ORIGMARK; +#if defined(__CYGWIN__) + /* recvfrom() on cygwin doesn't set bufsize at all for + connected sockets, leaving us with trash in the returned + name, so use the same test as the Win32 code to check if it + wasn't set, and set it [perl #118843] */ + if (bufsize == sizeof namebuf) + bufsize = 0; +#endif sv_setpvn(TARG, namebuf, bufsize); PUSHs(TARG); RETURN; @@ -1759,20 +1776,6 @@ PP(pp_sysread) } } else -#ifdef HAS_SOCKET__bad_code_maybe - if (IoTYPE(io) == IoTYPE_SOCKET) { - Sock_size_t bufsize; - char namebuf[MAXPATHLEN]; -#if defined(VMS_DO_SOCKETS) && defined(DECCRTL_SOCKETS) - bufsize = sizeof (struct sockaddr_in); -#else - bufsize = sizeof namebuf; -#endif - count = PerlSock_recvfrom(PerlIO_fileno(IoIFP(io)), buffer, length, 0, - (struct sockaddr *)namebuf, &bufsize); - } - else -#endif { count = PerlIO_read(IoIFP(io), buffer, length); /* PerlIO_read() - like fread() returns 0 on both error and EOF */ @@ -1863,7 +1866,7 @@ PP(pp_syswrite) PUTBACK; } - return Perl_tied_method(aTHX_ "WRITE", mark - 1, MUTABLE_SV(io), mg, + return Perl_tied_method(aTHX_ SV_CONST(WRITE), mark - 1, MUTABLE_SV(io), mg, G_SCALAR | TIED_METHOD_ARGUMENTS_ON_STACK, sp - mark); } @@ -2076,15 +2079,15 @@ PP(pp_eof) RETPUSHNO; if ((io = GvIO(gv)) && (mg = SvTIED_mg((const SV *)io, PERL_MAGIC_tiedscalar))) { - return tied_method1("EOF", SP, MUTABLE_SV(io), mg, newSVuv(which)); + return tied_method1(SV_CONST(EOF), SP, MUTABLE_SV(io), mg, newSVuv(which)); } if (!MAXARG && (PL_op->op_flags & OPf_SPECIAL)) { /* eof() */ if (io && !IoIFP(io)) { - if ((IoFLAGS(io) & IOf_START) && av_len(GvAVn(gv)) < 0) { + if ((IoFLAGS(io) & IOf_START) && av_tindex(GvAVn(gv)) < 0) { IoLINES(io) = 0; IoFLAGS(io) &= ~IOf_START; - do_open(gv, "-", 1, FALSE, O_RDONLY, 0, NULL); + do_open6(gv, "-", 1, NULL, NULL, 0); if (GvSV(gv)) sv_setpvs(GvSV(gv), "-"); else @@ -2116,7 +2119,7 @@ PP(pp_tell) if (io) { const MAGIC * const mg = SvTIED_mg((const SV *)io, PERL_MAGIC_tiedscalar); if (mg) { - return tied_method0("TELL", SP, MUTABLE_SV(io), mg); + return tied_method0(SV_CONST(TELL), SP, MUTABLE_SV(io), mg); } } else if (!gv) { @@ -2156,7 +2159,7 @@ PP(pp_sysseek) SV *const offset_sv = newSViv(offset); #endif - return tied_method2("SEEK", SP, MUTABLE_SV(io), mg, offset_sv, + return tied_method2(SV_CONST(SEEK), SP, MUTABLE_SV(io), mg, offset_sv, newSViv(whence)); } } @@ -2269,13 +2272,13 @@ PP(pp_ioctl) dVAR; dSP; dTARGET; SV * const argsv = POPs; const unsigned int func = POPu; - const int optype = PL_op->op_type; + int optype; GV * const gv = MUTABLE_GV(POPs); - IO * const io = gv ? GvIOn(gv) : NULL; + IO * const io = GvIOn(gv); char *s; IV retval; - if (!io || !argsv || !IoIFP(io)) { + if (!IoIFP(io)) { report_evil_fh(gv); SETERRNO(EBADF,RMS_IFI); /* well, sort of... */ RETPUSHUNDEF; @@ -2298,6 +2301,7 @@ PP(pp_ioctl) s = INT2PTR(char*,retval); /* ouch */ } + optype = PL_op->op_type; TAINT_PROPER(PL_op_desc[optype]); if (optype == OP_IOCTL) @@ -2376,17 +2380,9 @@ PP(pp_socket) const int type = POPi; const int domain = POPi; GV * const gv = MUTABLE_GV(POPs); - IO * const io = gv ? GvIOn(gv) : NULL; + IO * const io = GvIOn(gv); int fd; - if (!io) { - report_evil_fh(gv); - if (io && IoIFP(io)) - do_close(gv, FALSE); - SETERRNO(EBADF,LIB_INVARG); - RETPUSHUNDEF; - } - if (IoIFP(io)) do_close(gv, FALSE); @@ -2415,28 +2411,21 @@ PP(pp_sockpair) { #if defined (HAS_SOCKETPAIR) || (defined (HAS_SOCKET) && defined(SOCK_DGRAM) && defined(AF_INET) && defined(PF_INET)) dVAR; dSP; + int fd[2]; const int protocol = POPi; const int type = POPi; const int domain = POPi; + GV * const gv2 = MUTABLE_GV(POPs); + IO * const io2 = GvIOn(gv2); GV * const gv1 = MUTABLE_GV(POPs); - IO * const io1 = gv1 ? GvIOn(gv1) : NULL; - IO * const io2 = gv2 ? GvIOn(gv2) : NULL; - int fd[2]; - - if (!io1) - report_evil_fh(gv1); - if (!io2) - report_evil_fh(gv2); + IO * const io1 = GvIOn(gv1); - if (io1 && IoIFP(io1)) + if (IoIFP(io1)) do_close(gv1, FALSE); - if (io2 && IoIFP(io2)) + if (IoIFP(io2)) do_close(gv2, FALSE); - if (!io1 || !io2) - RETPUSHUNDEF; - TAINT_PROPER("socketpair"); if (PerlSock_socketpair(domain, type, protocol, fd) < 0) RETPUSHUNDEF; @@ -2477,12 +2466,13 @@ PP(pp_bind) GV * const gv = MUTABLE_GV(POPs); IO * const io = GvIOn(gv); STRLEN len; - const int op_type = PL_op->op_type; + int op_type; - if (!io || !IoIFP(io)) + if (!IoIFP(io)) goto nuts; addr = SvPV_const(addrsv, len); + op_type = PL_op->op_type; TAINT_PROPER(PL_op_desc[op_type]); if ((op_type == OP_BIND ? PerlSock_bind(PerlIO_fileno(IoIFP(io)), (struct sockaddr *)addr, len) @@ -2503,9 +2493,9 @@ PP(pp_listen) dVAR; dSP; const int backlog = POPi; GV * const gv = MUTABLE_GV(POPs); - IO * const io = gv ? GvIOn(gv) : NULL; + IO * const io = GvIOn(gv); - if (!io || !IoIFP(io)) + if (!IoIFP(io)) goto nuts; if (PerlSock_listen(PerlIO_fileno(IoIFP(io)), backlog) >= 0) @@ -2523,7 +2513,6 @@ PP(pp_accept) { dVAR; dSP; dTARGET; IO *nstio; - IO *gstio; char namebuf[MAXPATHLEN]; #if (defined(VMS_DO_SOCKETS) && defined(DECCRTL_SOCKETS)) || defined(__QNXNTO__) Sock_size_t len = sizeof (struct sockaddr_in); @@ -2534,12 +2523,7 @@ PP(pp_accept) GV * const ngv = MUTABLE_GV(POPs); int fd; - if (!ngv) - goto badexit; - if (!ggv) - goto nuts; - - gstio = GvIO(ggv); + IO * const gstio = GvIO(ggv); if (!gstio || !IoIFP(gstio)) goto nuts; @@ -2596,7 +2580,7 @@ PP(pp_shutdown) GV * const gv = MUTABLE_GV(POPs); IO * const io = GvIOn(gv); - if (!io || !IoIFP(io)) + if (!IoIFP(io)) goto nuts; PUSHi( PerlSock_shutdown(PerlIO_fileno(IoIFP(io)), how) >= 0 ); @@ -2620,7 +2604,7 @@ PP(pp_ssockopt) int fd; Sock_size_t len; - if (!io || !IoIFP(io)) + if (!IoIFP(io)) goto nuts; fd = PerlIO_fileno(IoIFP(io)); @@ -2690,7 +2674,7 @@ PP(pp_getpeername) SV *sv; int fd; - if (!io || !IoIFP(io)) + if (!IoIFP(io)) goto nuts; sv = sv_2mortal(newSV(257)); @@ -2816,8 +2800,14 @@ PP(pp_stat) else PL_laststatval = PerlLIO_stat(SvPV_nolen_const(PL_statname), &PL_statcache); if (PL_laststatval < 0) { - if (ckWARN(WARN_NEWLINE) && strchr(SvPV_nolen_const(PL_statname), '\n')) + if (ckWARN(WARN_NEWLINE) && + strchr(SvPV_nolen_const(PL_statname), '\n')) + { + /* PL_warn_nl is constant */ + GCC_DIAG_IGNORE(-Wformat-nonliteral); Perl_warner(aTHX_ packWARN(WARN_NEWLINE), PL_warn_nl, "stat"); + GCC_DIAG_RESTORE; + } max = 0; } } @@ -2843,24 +2833,10 @@ PP(pp_stat) #endif mPUSHu(PL_statcache.st_mode); mPUSHu(PL_statcache.st_nlink); -#if Uid_t_size > IVSIZE - mPUSHn(PL_statcache.st_uid); -#else -# if Uid_t_sign <= 0 - mPUSHi(PL_statcache.st_uid); -# else - mPUSHu(PL_statcache.st_uid); -# endif -#endif -#if Gid_t_size > IVSIZE - mPUSHn(PL_statcache.st_gid); -#else -# if Gid_t_sign <= 0 - mPUSHi(PL_statcache.st_gid); -# else - mPUSHu(PL_statcache.st_gid); -# endif -#endif + + sv_setuid(PUSHmortal, PL_statcache.st_uid); + sv_setgid(PUSHmortal, PL_statcache.st_gid); + #ifdef USE_STAT_RDEV mPUSHi(PL_statcache.st_rdev); #else @@ -3292,7 +3268,7 @@ PP(pp_fttext) { dVAR; I32 i; - I32 len; + SSize_t len; I32 odd = 0; STDCHAR tbuf[512]; STDCHAR *s; @@ -3373,7 +3349,12 @@ PP(pp_fttext) } if (ckWARN(WARN_NEWLINE) && strchr(SvPV_nolen_const(PL_statname), '\n')) + { + /* PL_warn_nl is constant */ + GCC_DIAG_IGNORE(-Wformat-nonliteral); Perl_warner(aTHX_ packWARN(WARN_NEWLINE), PL_warn_nl, "open"); + GCC_DIAG_RESTORE; + } FT_RETURNUNDEF; } PL_laststype = OP_STAT; @@ -3628,9 +3609,7 @@ PP(pp_readlink) char buf[MAXPATHLEN]; int len; -#ifndef INCOMPLETE_TAINTS TAINT; -#endif tmps = POPpconstx; len = readlink(tmps, buf, sizeof(buf) - 1); if (len < 0) @@ -3682,13 +3661,7 @@ S_dooneliner(pTHX_ const char *cmd, cons ; e++) { /* you don't see this */ - const char * const errmsg = -#ifdef HAS_SYS_ERRLIST - sys_errlist[e] -#else - strerror(e) -#endif - ; + const char * const errmsg = Strerror(e) ; if (!errmsg) break; if (instr(s, errmsg)) { @@ -3810,9 +3783,6 @@ PP(pp_open_dir) GV * const gv = MUTABLE_GV(POPs); IO * const io = GvIOn(gv); - if (!io) - goto nope; - if ((IoIFP(io) || IoOFP(io))) Perl_ck_warner_d(aTHX_ packWARN2(WARN_IO, WARN_DEPRECATED), "Opening filehandle %"HEKf" also as a directory", @@ -3849,7 +3819,7 @@ PP(pp_readdir) const Direntry_t *dp; IO * const io = GvIOn(gv); - if (!io || !IoDIRP(io)) { + if (!IoDIRP(io)) { Perl_ck_warner(aTHX_ packWARN(WARN_IO), "readdir() attempted on invalid dirhandle %"HEKf, HEKfARG(GvENAME_HEK(gv))); @@ -3865,15 +3835,13 @@ PP(pp_readdir) #else sv = newSVpv(dp->d_name, 0); #endif -#ifndef INCOMPLETE_TAINTS if (!(IoFLAGS(io) & IOf_UNTAINT)) SvTAINTED_on(sv); -#endif mXPUSHs(sv); } while (gimme == G_ARRAY); if (!dp && gimme != G_ARRAY) - goto nope; + RETPUSHUNDEF; RETURN; @@ -3901,7 +3869,7 @@ PP(pp_telldir) GV * const gv = MUTABLE_GV(POPs); IO * const io = GvIOn(gv); - if (!io || !IoDIRP(io)) { + if (!IoDIRP(io)) { Perl_ck_warner(aTHX_ packWARN(WARN_IO), "telldir() attempted on invalid dirhandle %"HEKf, HEKfARG(GvENAME_HEK(gv))); @@ -3927,7 +3895,7 @@ PP(pp_seekdir) GV * const gv = MUTABLE_GV(POPs); IO * const io = GvIOn(gv); - if (!io || !IoDIRP(io)) { + if (!IoDIRP(io)) { Perl_ck_warner(aTHX_ packWARN(WARN_IO), "seekdir() attempted on invalid dirhandle %"HEKf, HEKfARG(GvENAME_HEK(gv))); @@ -3952,7 +3920,7 @@ PP(pp_rewinddir) GV * const gv = MUTABLE_GV(POPs); IO * const io = GvIOn(gv); - if (!io || !IoDIRP(io)) { + if (!IoDIRP(io)) { Perl_ck_warner(aTHX_ packWARN(WARN_IO), "rewinddir() attempted on invalid dirhandle %"HEKf, HEKfARG(GvENAME_HEK(gv))); @@ -3976,7 +3944,7 @@ PP(pp_closedir) GV * const gv = MUTABLE_GV(POPs); IO * const io = GvIOn(gv); - if (!io || !IoDIRP(io)) { + if (!IoDIRP(io)) { Perl_ck_warner(aTHX_ packWARN(WARN_IO), "closedir() attempted on invalid dirhandle %"HEKf, HEKfARG(GvENAME_HEK(gv))); @@ -4009,13 +3977,13 @@ PP(pp_fork) #ifdef HAS_FORK dVAR; dSP; dTARGET; Pid_t childpid; -#if defined(HAS_SIGPROCMASK) && !defined(PERL_MICRO) +#ifdef HAS_SIGPROCMASK sigset_t oldmask, newmask; #endif EXTEND(SP, 1); PERL_FLUSHALL_FOR_CHILD; -#if defined(HAS_SIGPROCMASK) && !defined(PERL_MICRO) +#ifdef HAS_SIGPROCMASK sigfillset(&newmask); sigprocmask(SIG_SETMASK, &newmask, &oldmask); #endif @@ -4027,7 +3995,7 @@ PP(pp_fork) for (sig = 1; sig < SIG_SIZE; sig++) PL_psig_pend[sig] = 0; } -#if defined(HAS_SIGPROCMASK) && !defined(PERL_MICRO) +#ifdef HAS_SIGPROCMASK { dSAVE_ERRNO; sigprocmask(SIG_SETMASK, &oldmask, NULL); @@ -4146,13 +4114,13 @@ PP(pp_system) Pid_t childpid; int pp[2]; I32 did_pipes = 0; -#if (defined(HAS_SIGPROCMASK) && !defined(PERL_MICRO)) +#ifdef HAS_SIGPROCMASK sigset_t newset, oldset; #endif if (PerlProc_pipe(pp) >= 0) did_pipes = 1; -#if (defined(HAS_SIGPROCMASK) && !defined(PERL_MICRO)) +#ifdef HAS_SIGPROCMASK sigemptyset(&newset); sigaddset(&newset, SIGCHLD); sigprocmask(SIG_BLOCK, &newset, &oldset); @@ -4166,7 +4134,7 @@ PP(pp_system) PerlLIO_close(pp[0]); PerlLIO_close(pp[1]); } -#if (defined(HAS_SIGPROCMASK) && !defined(PERL_MICRO)) +#ifdef HAS_SIGPROCMASK sigprocmask(SIG_SETMASK, &oldset, NULL); #endif RETURN; @@ -4220,7 +4188,7 @@ PP(pp_system) XPUSHi(STATUS_CURRENT); RETURN; } -#if (defined(HAS_SIGPROCMASK) && !defined(PERL_MICRO)) +#ifdef HAS_SIGPROCMASK sigprocmask(SIG_SETMASK, &oldset, NULL); #endif if (did_pipes) { @@ -4428,20 +4396,16 @@ PP(pp_tms) #ifdef HAS_TIMES dVAR; dSP; + struct tms timesbuf; + EXTEND(SP, 4); -#ifndef VMS - (void)PerlProc_times(&PL_timesbuf); -#else - (void)PerlProc_times((tbuffer_t *)&PL_timesbuf); /* time.h uses different name for */ - /* struct tms, though same data */ - /* is returned. */ -#endif + (void)PerlProc_times(×buf); - mPUSHn(((NV)PL_timesbuf.tms_utime)/(NV)PL_clocktick); + mPUSHn(((NV)timesbuf.tms_utime)/(NV)PL_clocktick); if (GIMME == G_ARRAY) { - mPUSHn(((NV)PL_timesbuf.tms_stime)/(NV)PL_clocktick); - mPUSHn(((NV)PL_timesbuf.tms_cutime)/(NV)PL_clocktick); - mPUSHn(((NV)PL_timesbuf.tms_cstime)/(NV)PL_clocktick); + mPUSHn(((NV)timesbuf.tms_stime)/(NV)PL_clocktick); + mPUSHn(((NV)timesbuf.tms_cutime)/(NV)PL_clocktick); + mPUSHn(((NV)timesbuf.tms_cstime)/(NV)PL_clocktick); } RETURN; #else @@ -4519,30 +4483,29 @@ PP(pp_gmtime) } if (err == NULL) { + /* diag_listed_as: gmtime(%f) failed */ /* XXX %lld broken for quads */ Perl_ck_warner(aTHX_ packWARN(WARN_OVERFLOW), "%s(%.0" NVff ") failed", opname, when); } if (GIMME != G_ARRAY) { /* scalar context */ - SV *tsv; - /* XXX newSVpvf()'s %lld type is broken, so cheat with a double */ - double year = (double)tmbuf.tm_year + 1900; - EXTEND(SP, 1); EXTEND_MORTAL(1); if (err == NULL) RETPUSHUNDEF; - - tsv = Perl_newSVpvf(aTHX_ "%s %s %2d %02d:%02d:%02d %.0f", - dayname[tmbuf.tm_wday], - monname[tmbuf.tm_mon], - tmbuf.tm_mday, - tmbuf.tm_hour, - tmbuf.tm_min, - tmbuf.tm_sec, - year); - mPUSHs(tsv); + else { + mPUSHs(Perl_newSVpvf(aTHX_ "%s %s %2d %02d:%02d:%02d %.0f", + dayname[tmbuf.tm_wday], + monname[tmbuf.tm_mon], + tmbuf.tm_mday, + tmbuf.tm_hour, + tmbuf.tm_min, + tmbuf.tm_sec, + /* XXX newSVpvf()'s %lld type is broken, + * so cheat with a double */ + (double)tmbuf.tm_year + 1900)); + } } else { /* list context */ if ( err == NULL ) @@ -4942,9 +4905,7 @@ PP(pp_gservent) #ifdef HAS_GETSERVBYPORT const char * const proto = POPpbytex; unsigned short port = (unsigned short)POPu; -#ifdef HAS_HTONS port = PerlSock_htons(port); -#endif sent = PerlSock_getservbyport(port, (proto && !*proto) ? NULL : proto); #else DIE(aTHX_ PL_no_sock_func, "getservbyport"); @@ -4962,11 +4923,7 @@ PP(pp_gservent) PUSHs(sv = sv_newmortal()); if (sent) { if (which == OP_GSBYNAME) { -#ifdef HAS_NTOHS sv_setiv(sv, (IV)PerlSock_ntohs(sent->s_port)); -#else - sv_setiv(sv, (IV)(sent->s_port)); -#endif } else sv_setpv(sv, sent->s_name); @@ -4977,11 +4934,7 @@ PP(pp_gservent) if (sent) { mPUSHs(newSVpv(sent->s_name, 0)); PUSHs(space_join_names_mortal(sent->s_aliases)); -#ifdef HAS_NTOHS mPUSHi(PerlSock_ntohs(sent->s_port)); -#else - mPUSHi(sent->s_port); -#endif mPUSHs(newSVpv(sent->s_proto, 0)); } @@ -5196,11 +5149,7 @@ PP(pp_gpwent) PUSHs(sv = sv_newmortal()); if (pwent) { if (which == OP_GPWNAM) -# if Uid_t_sign <= 0 - sv_setiv(sv, (IV)pwent->pw_uid); -# else - sv_setuv(sv, (UV)pwent->pw_uid); -# endif + sv_setuid(sv, pwent->pw_uid); else sv_setpv(sv, pwent->pw_name); } @@ -5248,23 +5197,13 @@ PP(pp_gpwent) sv_setpv(sv, pwent->pw_passwd); # endif -# ifndef INCOMPLETE_TAINTS /* passwd is tainted because user himself can diddle with it. * admittedly not much and in a very limited way, but nevertheless. */ SvTAINTED_on(sv); -# endif -# if Uid_t_sign <= 0 - mPUSHi(pwent->pw_uid); -# else - mPUSHu(pwent->pw_uid); -# endif + sv_setuid(PUSHmortal, pwent->pw_uid); + sv_setgid(PUSHmortal, pwent->pw_gid); -# if Uid_t_sign <= 0 - mPUSHi(pwent->pw_gid); -# else - mPUSHu(pwent->pw_gid); -# endif /* pw_change, pw_quota, and pw_age are mutually exclusive-- * because of the poor interface of the Perl getpw*(), * not because there's some standard/convention saying so. @@ -5303,18 +5242,14 @@ PP(pp_gpwent) # else PUSHs(sv = sv_mortalcopy(&PL_sv_no)); # endif -# ifndef INCOMPLETE_TAINTS /* pw_gecos is tainted because user himself can diddle with it. */ SvTAINTED_on(sv); -# endif mPUSHs(newSVpv(pwent->pw_dir, 0)); PUSHs(sv = sv_2mortal(newSVpv(pwent->pw_shell, 0))); -# ifndef INCOMPLETE_TAINTS /* pw_shell is tainted because user himself can diddle with it. */ SvTAINTED_on(sv); -# endif # ifdef PWEXPIRE mPUSHi(pwent->pw_expire); @@ -5355,11 +5290,7 @@ PP(pp_ggrent) PUSHs(sv); if (grent) { if (which == OP_GGRNAM) -#if Gid_t_sign <= 0 - sv_setiv(sv, (IV)grent->gr_gid); -#else - sv_setuv(sv, (UV)grent->gr_gid); -#endif + sv_setgid(sv, grent->gr_gid); else sv_setpv(sv, grent->gr_name); } @@ -5375,11 +5306,7 @@ PP(pp_ggrent) PUSHs(sv_mortalcopy(&PL_sv_no)); #endif -#if Gid_t_sign <= 0 - mPUSHi(grent->gr_gid); -#else - mPUSHu(grent->gr_gid); -#endif + sv_setgid(PUSHmortal, grent->gr_gid); #if !(defined(_CRAYMPP) && defined(USE_REENTRANT_API)) /* In UNICOS/mk (_CRAYMPP) the multithreading Index: gnu/usr.bin/perl/proto.h =================================================================== RCS file: /mnt/memory/perl/importit/cvs/src/gnu/usr.bin/perl/proto.h,v retrieving revision 1.16 diff -u -p -u -p -r1.16 proto.h --- gnu/usr.bin/perl/proto.h 24 Mar 2014 15:05:13 -0000 1.16 +++ gnu/usr.bin/perl/proto.h 16 Nov 2014 03:22:24 -0000 @@ -17,15 +17,22 @@ */ START_EXTERN_C +PERL_CALLCONV UV ASCII_TO_NEED(const UV enc, const UV ch) + __attribute__deprecated__ + __attribute__warn_unused_result__ + __attribute__pure__; + PERL_CALLCONV int Perl_Gv_AMupdate(pTHX_ HV* stash, bool destructing) __attribute__nonnull__(pTHX_1); #define PERL_ARGS_ASSERT_GV_AMUPDATE \ assert(stash) -PERL_CALLCONV const char * Perl_PerlIO_context_layers(pTHX_ const char *mode); -PERL_CALLCONV_NO_RET void Perl_croak_memory_wrap(void) - __attribute__noreturn__; +PERL_CALLCONV UV NATIVE_TO_NEED(const UV enc, const UV ch) + __attribute__deprecated__ + __attribute__warn_unused_result__ + __attribute__pure__; +PERL_CALLCONV const char * Perl_PerlIO_context_layers(pTHX_ const char *mode); PERL_CALLCONV void* Perl_Slab_Alloc(pTHX_ size_t sz) __attribute__malloc__ __attribute__warn_unused_result__; @@ -68,31 +75,31 @@ PERL_CALLCONV bool Perl__is_utf8_perl_id #define PERL_ARGS_ASSERT__IS_UTF8_PERL_IDSTART \ assert(p) -PERL_CALLCONV UV Perl__to_uni_fold_flags(pTHX_ UV c, U8 *p, STRLEN *lenp, const U8 flags) +PERL_CALLCONV UV Perl__to_uni_fold_flags(pTHX_ UV c, U8 *p, STRLEN *lenp, U8 flags) __attribute__nonnull__(pTHX_2) __attribute__nonnull__(pTHX_3); #define PERL_ARGS_ASSERT__TO_UNI_FOLD_FLAGS \ assert(p); assert(lenp) -PERL_CALLCONV UV Perl__to_utf8_fold_flags(pTHX_ const U8 *p, U8* ustrp, STRLEN *lenp, U8 flags, bool* tainted_ptr) +PERL_CALLCONV UV Perl__to_utf8_fold_flags(pTHX_ const U8 *p, U8* ustrp, STRLEN *lenp, U8 flags) __attribute__nonnull__(pTHX_1) __attribute__nonnull__(pTHX_2); #define PERL_ARGS_ASSERT__TO_UTF8_FOLD_FLAGS \ assert(p); assert(ustrp) -PERL_CALLCONV UV Perl__to_utf8_lower_flags(pTHX_ const U8 *p, U8* ustrp, STRLEN *lenp, const bool flags, bool* tainted_ptr) +PERL_CALLCONV UV Perl__to_utf8_lower_flags(pTHX_ const U8 *p, U8* ustrp, STRLEN *lenp, bool flags) __attribute__nonnull__(pTHX_1) __attribute__nonnull__(pTHX_2); #define PERL_ARGS_ASSERT__TO_UTF8_LOWER_FLAGS \ assert(p); assert(ustrp) -PERL_CALLCONV UV Perl__to_utf8_title_flags(pTHX_ const U8 *p, U8* ustrp, STRLEN *lenp, const bool flags, bool* tainted_ptr) +PERL_CALLCONV UV Perl__to_utf8_title_flags(pTHX_ const U8 *p, U8* ustrp, STRLEN *lenp, bool flags) __attribute__nonnull__(pTHX_1) __attribute__nonnull__(pTHX_2); #define PERL_ARGS_ASSERT__TO_UTF8_TITLE_FLAGS \ assert(p); assert(ustrp) -PERL_CALLCONV UV Perl__to_utf8_upper_flags(pTHX_ const U8 *p, U8* ustrp, STRLEN *lenp, const bool flags, bool* tainted_ptr) +PERL_CALLCONV UV Perl__to_utf8_upper_flags(pTHX_ const U8 *p, U8* ustrp, STRLEN *lenp, bool flags) __attribute__nonnull__(pTHX_1) __attribute__nonnull__(pTHX_2); #define PERL_ARGS_ASSERT__TO_UTF8_UPPER_FLAGS \ @@ -115,6 +122,11 @@ PERL_CALLCONV SV * Perl_amagic_deref_cal assert(ref) PERL_CALLCONV bool Perl_amagic_is_enabled(pTHX_ int method); +PERL_STATIC_INLINE void S_append_utf8_from_native_byte(const U8 byte, U8** dest) + __attribute__nonnull__(2); +#define PERL_ARGS_ASSERT_APPEND_UTF8_FROM_NATIVE_BYTE \ + assert(dest) + PERL_CALLCONV I32 Perl_apply(pTHX_ I32 type, SV** mark, SV** sp) __attribute__nonnull__(pTHX_2) __attribute__nonnull__(pTHX_3); @@ -152,36 +164,36 @@ PERL_CALLCONV SV** Perl_av_create_and_un #define PERL_ARGS_ASSERT_AV_CREATE_AND_UNSHIFT_ONE \ assert(avp); assert(val) -PERL_CALLCONV SV* Perl_av_delete(pTHX_ AV *av, I32 key, I32 flags) +PERL_CALLCONV SV* Perl_av_delete(pTHX_ AV *av, SSize_t key, I32 flags) __attribute__nonnull__(pTHX_1); #define PERL_ARGS_ASSERT_AV_DELETE \ assert(av) -PERL_CALLCONV bool Perl_av_exists(pTHX_ AV *av, I32 key) +PERL_CALLCONV bool Perl_av_exists(pTHX_ AV *av, SSize_t key) __attribute__warn_unused_result__ __attribute__nonnull__(pTHX_1); #define PERL_ARGS_ASSERT_AV_EXISTS \ assert(av) -PERL_CALLCONV void Perl_av_extend(pTHX_ AV *av, I32 key) +PERL_CALLCONV void Perl_av_extend(pTHX_ AV *av, SSize_t key) __attribute__nonnull__(pTHX_1); #define PERL_ARGS_ASSERT_AV_EXTEND \ assert(av) -PERL_CALLCONV void Perl_av_extend_guts(pTHX_ AV *av, I32 key, SSize_t *maxp, SV ***allocp, SV ***arrayp) +PERL_CALLCONV void Perl_av_extend_guts(pTHX_ AV *av, SSize_t key, SSize_t *maxp, SV ***allocp, SV ***arrayp) __attribute__nonnull__(pTHX_3) __attribute__nonnull__(pTHX_4) __attribute__nonnull__(pTHX_5); #define PERL_ARGS_ASSERT_AV_EXTEND_GUTS \ assert(maxp); assert(allocp); assert(arrayp) -PERL_CALLCONV SV** Perl_av_fetch(pTHX_ AV *av, I32 key, I32 lval) +PERL_CALLCONV SV** Perl_av_fetch(pTHX_ AV *av, SSize_t key, I32 lval) __attribute__warn_unused_result__ __attribute__nonnull__(pTHX_1); #define PERL_ARGS_ASSERT_AV_FETCH \ assert(av) -PERL_CALLCONV void Perl_av_fill(pTHX_ AV *av, I32 fill) +PERL_CALLCONV void Perl_av_fill(pTHX_ AV *av, SSize_t fill) __attribute__nonnull__(pTHX_1); #define PERL_ARGS_ASSERT_AV_FILL \ assert(av) @@ -191,13 +203,13 @@ PERL_CALLCONV IV* Perl_av_iter_p(pTHX_ A #define PERL_ARGS_ASSERT_AV_ITER_P \ assert(av) -PERL_CALLCONV I32 Perl_av_len(pTHX_ AV *av) +PERL_CALLCONV SSize_t Perl_av_len(pTHX_ AV *av) __attribute__warn_unused_result__ __attribute__nonnull__(pTHX_1); #define PERL_ARGS_ASSERT_AV_LEN \ assert(av) -PERL_CALLCONV AV* Perl_av_make(pTHX_ I32 size, SV **strp) +PERL_CALLCONV AV* Perl_av_make(pTHX_ SSize_t size, SV **strp) __attribute__warn_unused_result__ __attribute__nonnull__(pTHX_2); #define PERL_ARGS_ASSERT_AV_MAKE \ @@ -225,16 +237,16 @@ PERL_CALLCONV SV* Perl_av_shift(pTHX_ AV #define PERL_ARGS_ASSERT_AV_SHIFT \ assert(av) -PERL_CALLCONV SV** Perl_av_store(pTHX_ AV *av, I32 key, SV *val) +PERL_CALLCONV SV** Perl_av_store(pTHX_ AV *av, SSize_t key, SV *val) __attribute__nonnull__(pTHX_1); #define PERL_ARGS_ASSERT_AV_STORE \ assert(av) -/* PERL_CALLCONV I32 Perl_av_tindex(pTHX_ AV *av) +/* PERL_CALLCONV SSize_t Perl_av_tindex(pTHX_ AV *av) __attribute__warn_unused_result__ __attribute__nonnull__(pTHX_1); */ -PERL_STATIC_INLINE I32 S_av_top_index(pTHX_ AV *av) +PERL_STATIC_INLINE SSize_t S_av_top_index(pTHX_ AV *av) __attribute__warn_unused_result__ __attribute__nonnull__(pTHX_1); #define PERL_ARGS_ASSERT_AV_TOP_INDEX \ @@ -245,7 +257,7 @@ PERL_CALLCONV void Perl_av_undef(pTHX_ A #define PERL_ARGS_ASSERT_AV_UNDEF \ assert(av) -PERL_CALLCONV void Perl_av_unshift(pTHX_ AV *av, I32 num) +PERL_CALLCONV void Perl_av_unshift(pTHX_ AV *av, SSize_t num) __attribute__nonnull__(pTHX_1); #define PERL_ARGS_ASSERT_AV_UNSHIFT \ assert(av) @@ -353,6 +365,12 @@ PERL_CALLCONV OP * Perl_ck_anoncode(pTHX #define PERL_ARGS_ASSERT_CK_ANONCODE \ assert(o) +PERL_CALLCONV OP * Perl_ck_backtick(pTHX_ OP *o) + __attribute__warn_unused_result__ + __attribute__nonnull__(pTHX_1); +#define PERL_ARGS_ASSERT_CK_BACKTICK \ + assert(o) + PERL_CALLCONV OP * Perl_ck_bitop(pTHX_ OP *o) __attribute__warn_unused_result__ __attribute__nonnull__(pTHX_1); @@ -383,12 +401,6 @@ PERL_CALLCONV OP * Perl_ck_delete(pTHX_ #define PERL_ARGS_ASSERT_CK_DELETE \ assert(o) -PERL_CALLCONV OP * Perl_ck_die(pTHX_ OP *o) - __attribute__warn_unused_result__ - __attribute__nonnull__(pTHX_1); -#define PERL_ARGS_ASSERT_CK_DIE \ - assert(o) - PERL_CALLCONV OP * Perl_ck_each(pTHX_ OP *o) __attribute__warn_unused_result__ __attribute__nonnull__(pTHX_1); @@ -445,12 +457,6 @@ PERL_CALLCONV OP * Perl_ck_exists(pTHX_ #define PERL_ARGS_ASSERT_CK_EXISTS \ assert(o) -PERL_CALLCONV OP * Perl_ck_exit(pTHX_ OP *o) - __attribute__warn_unused_result__ - __attribute__nonnull__(pTHX_1); -#define PERL_ARGS_ASSERT_CK_EXIT \ - assert(o) - PERL_CALLCONV OP * Perl_ck_ftst(pTHX_ OP *o) __attribute__warn_unused_result__ __attribute__nonnull__(pTHX_1); @@ -651,6 +657,11 @@ PERL_CALLCONV void Perl_ck_warner_d(pTHX PERL_CALLCONV bool Perl_ckwarn(pTHX_ U32 w); PERL_CALLCONV bool Perl_ckwarn_d(pTHX_ U32 w); +PERL_CALLCONV const COP* Perl_closest_cop(pTHX_ const COP *cop, const OP *o, const OP *curop, bool opnext) + __attribute__nonnull__(pTHX_1); +#define PERL_ARGS_ASSERT_CLOSEST_COP \ + assert(cop) + PERL_CALLCONV OP* Perl_convert(pTHX_ I32 optype, I32 flags, OP* o) __attribute__warn_unused_result__; @@ -680,6 +691,9 @@ PERL_CALLCONV_NO_RET void Perl_croak(pTH __attribute__noreturn__ __attribute__format__null_ok__(__printf__,pTHX_1,pTHX_2); +PERL_STATIC_NO_RET void S_croak_memory_wrap(void) + __attribute__noreturn__; + PERL_CALLCONV_NO_RET void Perl_croak_no_mem(void) __attribute__noreturn__; @@ -709,6 +723,12 @@ PERL_CALLCONV const char * Perl_custom_o #define PERL_ARGS_ASSERT_CUSTOM_OP_DESC \ assert(o) +PERL_CALLCONV XOPRETANY Perl_custom_op_get_field(pTHX_ const OP *o, const xop_flags_enum field) + __attribute__warn_unused_result__ + __attribute__nonnull__(pTHX_1); +#define PERL_ARGS_ASSERT_CUSTOM_OP_GET_FIELD \ + assert(o) + PERL_CALLCONV const char * Perl_custom_op_name(pTHX_ const OP *o) __attribute__warn_unused_result__ __attribute__nonnull__(pTHX_1); @@ -721,11 +741,9 @@ PERL_CALLCONV void Perl_custom_op_regist #define PERL_ARGS_ASSERT_CUSTOM_OP_REGISTER \ assert(ppaddr); assert(xop) -PERL_CALLCONV const XOP * Perl_custom_op_xop(pTHX_ const OP *o) +/* PERL_CALLCONV const XOP * Perl_custom_op_xop(pTHX_ const OP *o) __attribute__pure__ - __attribute__nonnull__(pTHX_1); -#define PERL_ARGS_ASSERT_CUSTOM_OP_XOP \ - assert(o) + __attribute__nonnull__(pTHX_1); */ PERL_CALLCONV void Perl_cv_ckproto_len_flags(pTHX_ const CV* cv, const GV* gv, const char* p, const STRLEN len, const U32 flags) __attribute__nonnull__(pTHX_1); @@ -746,6 +764,9 @@ PERL_CALLCONV CV* Perl_cv_clone_into(pTH PERL_CALLCONV SV* Perl_cv_const_sv(pTHX_ const CV *const cv) __attribute__warn_unused_result__; +PERL_CALLCONV SV* Perl_cv_const_sv_or_av(pTHX_ const CV *const cv) + __attribute__warn_unused_result__; + PERL_CALLCONV void Perl_cv_forget_slab(pTHX_ CV *cv) __attribute__nonnull__(pTHX_1); #define PERL_ARGS_ASSERT_CV_FORGET_SLAB \ @@ -803,6 +824,12 @@ PERL_CALLCONV I32 Perl_debop(pTHX_ const PERL_CALLCONV void Perl_debprofdump(pTHX); PERL_CALLCONV I32 Perl_debstack(pTHX); PERL_CALLCONV I32 Perl_debstackptrs(pTHX); +PERL_CALLCONV SV * Perl_defelem_target(pTHX_ SV *sv, MAGIC *mg) + __attribute__warn_unused_result__ + __attribute__nonnull__(pTHX_1); +#define PERL_ARGS_ASSERT_DEFELEM_TARGET \ + assert(sv) + PERL_CALLCONV void Perl_delete_eval_scope(pTHX); PERL_CALLCONV char* Perl_delimcpy(char* to, const char* toend, const char* from, const char* fromend, int delim, I32* retlen) __attribute__nonnull__(1) @@ -907,6 +934,12 @@ PERL_CALLCONV void Perl_do_op_dump(pTHX_ #define PERL_ARGS_ASSERT_DO_OPEN \ assert(gv); assert(name) +PERL_CALLCONV bool Perl_do_open6(pTHX_ GV *gv, const char *oname, STRLEN len, PerlIO *supplied_fp, SV **svp, U32 num) + __attribute__nonnull__(pTHX_1) + __attribute__nonnull__(pTHX_2); +#define PERL_ARGS_ASSERT_DO_OPEN6 \ + assert(gv); assert(oname) + PERL_CALLCONV bool Perl_do_open9(pTHX_ GV *gv, const char *name, I32 len, int as_raw, int rawmode, int rawperm, PerlIO *supplied_fp, SV *svs, I32 num) __attribute__nonnull__(pTHX_1) __attribute__nonnull__(pTHX_2) @@ -914,6 +947,12 @@ PERL_CALLCONV bool Perl_do_open9(pTHX_ G #define PERL_ARGS_ASSERT_DO_OPEN9 \ assert(gv); assert(name); assert(svs) +PERL_CALLCONV bool Perl_do_open_raw(pTHX_ GV *gv, const char *oname, STRLEN len, int rawmode, int rawperm) + __attribute__nonnull__(pTHX_1) + __attribute__nonnull__(pTHX_2); +#define PERL_ARGS_ASSERT_DO_OPEN_RAW \ + assert(gv); assert(oname) + PERL_CALLCONV bool Perl_do_openn(pTHX_ GV *gv, const char *oname, I32 len, int as_raw, int rawmode, int rawperm, PerlIO *supplied_fp, SV **svp, I32 num) __attribute__nonnull__(pTHX_1) __attribute__nonnull__(pTHX_2); @@ -995,6 +1034,16 @@ PERL_CALLCONV void Perl_dounwind(pTHX_ I PERL_CALLCONV I32 Perl_dowantarray(pTHX) __attribute__warn_unused_result__; +PERL_CALLCONV void Perl_drand48_init_r(perl_drand48_t *random_state, U32 seed) + __attribute__nonnull__(1); +#define PERL_ARGS_ASSERT_DRAND48_INIT_R \ + assert(random_state) + +PERL_CALLCONV double Perl_drand48_r(perl_drand48_t *random_state) + __attribute__nonnull__(1); +#define PERL_ARGS_ASSERT_DRAND48_R \ + assert(random_state) + PERL_CALLCONV void Perl_dump_all(pTHX); PERL_CALLCONV void Perl_dump_all_perl(pTHX_ bool justperl); PERL_CALLCONV void Perl_dump_eval(pTHX); @@ -1275,7 +1324,7 @@ PERL_CALLCONV GV* Perl_gv_autoload_sv(pT #define PERL_ARGS_ASSERT_GV_AUTOLOAD_SV \ assert(namesv) -PERL_CALLCONV void Perl_gv_check(pTHX_ const HV* stash) +PERL_CALLCONV void Perl_gv_check(pTHX_ HV* stash) __attribute__nonnull__(pTHX_1); #define PERL_ARGS_ASSERT_GV_CHECK \ assert(stash) @@ -1449,6 +1498,11 @@ PERL_CALLCONV void Perl_gv_name_set(pTHX #define PERL_ARGS_ASSERT_GV_NAME_SET \ assert(gv); assert(name) +PERL_CALLCONV GV * Perl_gv_override(pTHX_ const char * const name, const STRLEN len) + __attribute__nonnull__(pTHX_1); +#define PERL_ARGS_ASSERT_GV_OVERRIDE \ + assert(name) + PERL_CALLCONV HV* Perl_gv_stashpv(pTHX_ const char* name, I32 flags) __attribute__nonnull__(pTHX_1); #define PERL_ARGS_ASSERT_GV_STASHPV \ @@ -1549,7 +1603,7 @@ PERL_CALLCONV void Perl_hv_ename_delete( #define PERL_ARGS_ASSERT_HV_FETCH_ENT \ assert(keysv) -PERL_CALLCONV STRLEN Perl_hv_fill(pTHX_ HV const *const hv) +PERL_CALLCONV STRLEN Perl_hv_fill(pTHX_ HV *const hv) __attribute__nonnull__(pTHX_1); #define PERL_ARGS_ASSERT_HV_FILL \ assert(hv) @@ -1625,7 +1679,7 @@ PERL_CALLCONV I32 Perl_hv_placeholders_g #define PERL_ARGS_ASSERT_HV_PLACEHOLDERS_GET \ assert(hv) -PERL_CALLCONV I32* Perl_hv_placeholders_p(pTHX_ HV *hv) +PERL_CALLCONV SSize_t* Perl_hv_placeholders_p(pTHX_ HV *hv) __attribute__warn_unused_result__ __attribute__nonnull__(pTHX_1); #define PERL_ARGS_ASSERT_HV_PLACEHOLDERS_P \ @@ -1732,6 +1786,14 @@ PERL_CALLCONV bool Perl_is_ascii_string( PERL_CALLCONV I32 Perl_is_lvalue_sub(pTHX) __attribute__warn_unused_result__; +PERL_STATIC_INLINE bool S_is_safe_syscall(pTHX_ const char *pv, STRLEN len, const char *what, const char *op_name) + __attribute__warn_unused_result__ + __attribute__nonnull__(pTHX_1) + __attribute__nonnull__(pTHX_3) + __attribute__nonnull__(pTHX_4); +#define PERL_ARGS_ASSERT_IS_SAFE_SYSCALL \ + assert(pv); assert(what); assert(op_name) + PERL_CALLCONV bool Perl_is_uni_alnum(pTHX_ UV c) __attribute__deprecated__ __attribute__warn_unused_result__ @@ -2280,7 +2342,7 @@ PERL_CALLCONV int Perl_magic_killbackref #define PERL_ARGS_ASSERT_MAGIC_KILLBACKREFS \ assert(sv); assert(mg) -PERL_CALLCONV SV* Perl_magic_methcall(pTHX_ SV *sv, const MAGIC *mg, const char *meth, U32 flags, U32 argc, ...) +PERL_CALLCONV SV* Perl_magic_methcall(pTHX_ SV *sv, const MAGIC *mg, SV *meth, U32 flags, U32 argc, ...) __attribute__nonnull__(pTHX_1) __attribute__nonnull__(pTHX_2) __attribute__nonnull__(pTHX_3); @@ -2468,6 +2530,12 @@ PERL_CALLCONV int Perl_mg_copy(pTHX_ SV PERL_CALLCONV MAGIC* Perl_mg_find(pTHX_ const SV* sv, int type) __attribute__warn_unused_result__; +PERL_CALLCONV MAGIC* Perl_mg_find_mglob(pTHX_ SV* sv) + __attribute__warn_unused_result__ + __attribute__nonnull__(pTHX_1); +#define PERL_ARGS_ASSERT_MG_FIND_MGLOB \ + assert(sv) + PERL_CALLCONV MAGIC* Perl_mg_findext(pTHX_ const SV* sv, int type, const MGVTBL *vtbl) __attribute__warn_unused_result__; @@ -2625,15 +2693,11 @@ PERL_CALLCONV int Perl_my_socketpair(int /* PERL_CALLCONV I32 Perl_my_stat(pTHX); */ PERL_CALLCONV I32 Perl_my_stat_flags(pTHX_ const U32 flags); PERL_CALLCONV char * Perl_my_strftime(pTHX_ const char *fmt, int sec, int min, int hour, int mday, int mon, int year, int wday, int yday, int isdst) + __attribute__format__(__strftime__,pTHX_1,0) __attribute__nonnull__(pTHX_1); #define PERL_ARGS_ASSERT_MY_STRFTIME \ assert(fmt) -PERL_CALLCONV void Perl_my_swabn(void* ptr, int n) - __attribute__nonnull__(1); -#define PERL_ARGS_ASSERT_MY_SWABN \ - assert(ptr) - PERL_CALLCONV void Perl_my_unexec(pTHX); PERL_CALLCONV int Perl_my_vsnprintf(char *buffer, const Size_t len, const char *format, va_list ap) __attribute__nonnull__(1) @@ -2655,8 +2719,8 @@ PERL_CALLCONV OP* Perl_newASSIGNOP(pTHX_ __attribute__malloc__ __attribute__warn_unused_result__; -PERL_CALLCONV CV* Perl_newATTRSUB(pTHX_ I32 floor, OP *o, OP *proto, OP *attrs, OP *block); -PERL_CALLCONV CV* Perl_newATTRSUB_flags(pTHX_ I32 floor, OP *o, OP *proto, OP *attrs, OP *block, U32 flags); +/* PERL_CALLCONV CV* newATTRSUB(pTHX_ I32 floor, OP *o, OP *proto, OP *attrs, OP *block); */ +PERL_CALLCONV CV* Perl_newATTRSUB_x(pTHX_ I32 floor, OP *o, OP *proto, OP *attrs, OP *block, bool o_is_gv); /* PERL_CALLCONV AV* Perl_newAV(pTHX) __attribute__warn_unused_result__; */ @@ -2850,6 +2914,13 @@ PERL_CALLCONV SV* Perl_newSV_type(pTHX_ __attribute__malloc__ __attribute__warn_unused_result__; +PERL_CALLCONV SV* Perl_newSVavdefelem(pTHX_ AV *av, SSize_t ix, bool extendible) + __attribute__malloc__ + __attribute__warn_unused_result__ + __attribute__nonnull__(pTHX_1); +#define PERL_ARGS_ASSERT_NEWSVAVDEFELEM \ + assert(av) + PERL_CALLCONV SV* Perl_newSVhek(pTHX_ const HEK *const hek) __attribute__malloc__ __attribute__warn_unused_result__; @@ -3121,6 +3192,9 @@ PERL_CALLCONV OP* Perl_parse_fullstmt(pT PERL_CALLCONV SV* Perl_parse_label(pTHX_ U32 flags); PERL_CALLCONV OP* Perl_parse_listexpr(pTHX_ U32 flags); PERL_CALLCONV OP* Perl_parse_stmtseq(pTHX_ U32 flags); +PERL_CALLCONV OP * Perl_parse_subsignature(pTHX) + __attribute__warn_unused_result__; + PERL_CALLCONV OP* Perl_parse_termexpr(pTHX_ U32 flags); PERL_CALLCONV U32 Perl_parse_unicode_opts(pTHX_ const char **popt) __attribute__nonnull__(pTHX_1); @@ -3177,7 +3251,7 @@ PERL_CALLCONV REGEXP* Perl_pregcomp(pTHX #define PERL_ARGS_ASSERT_PREGCOMP \ assert(pattern) -PERL_CALLCONV I32 Perl_pregexec(pTHX_ REGEXP * const prog, char* stringarg, char* strend, char* strbeg, I32 minend, SV* screamer, U32 nosave) +PERL_CALLCONV I32 Perl_pregexec(pTHX_ REGEXP * const prog, char* stringarg, char* strend, char* strbeg, SSize_t minend, SV* screamer, U32 nosave) __attribute__nonnull__(pTHX_1) __attribute__nonnull__(pTHX_2) __attribute__nonnull__(pTHX_3) @@ -3257,12 +3331,13 @@ PERL_CALLCONV REGEXP* Perl_re_compile(pT #define PERL_ARGS_ASSERT_RE_COMPILE \ assert(pattern) -PERL_CALLCONV char* Perl_re_intuit_start(pTHX_ REGEXP * const rx, SV* sv, char* strpos, char* strend, const U32 flags, re_scream_pos_data *data) +PERL_CALLCONV char* Perl_re_intuit_start(pTHX_ REGEXP * const rx, SV* sv, const char* const strbeg, char* strpos, char* strend, const U32 flags, re_scream_pos_data *data) __attribute__nonnull__(pTHX_1) __attribute__nonnull__(pTHX_3) - __attribute__nonnull__(pTHX_4); + __attribute__nonnull__(pTHX_4) + __attribute__nonnull__(pTHX_5); #define PERL_ARGS_ASSERT_RE_INTUIT_START \ - assert(rx); assert(strpos); assert(strend) + assert(rx); assert(strbeg); assert(strpos); assert(strend) PERL_CALLCONV SV* Perl_re_intuit_string(pTHX_ REGEXP *const r) __attribute__nonnull__(pTHX_1); @@ -3398,7 +3473,7 @@ PERL_CALLCONV void Perl_regdump(pTHX_ co #define PERL_ARGS_ASSERT_REGDUMP \ assert(r) -PERL_CALLCONV I32 Perl_regexec_flags(pTHX_ REGEXP *const rx, char *stringarg, char *strend, char *strbeg, I32 minend, SV *sv, void *data, U32 flags) +PERL_CALLCONV I32 Perl_regexec_flags(pTHX_ REGEXP *const rx, char *stringarg, char *strend, char *strbeg, SSize_t minend, SV *sv, void *data, U32 flags) __attribute__nonnull__(pTHX_1) __attribute__nonnull__(pTHX_2) __attribute__nonnull__(pTHX_3) @@ -3416,7 +3491,7 @@ PERL_CALLCONV void Perl_reginitcolors(pT PERL_CALLCONV regnode* Perl_regnext(pTHX_ regnode* p) __attribute__warn_unused_result__; -PERL_CALLCONV void Perl_regprop(pTHX_ const regexp *prog, SV* sv, const regnode* o) +PERL_CALLCONV void Perl_regprop(pTHX_ const regexp *prog, SV* sv, const regnode* o, const regmatch_info *reginfo) __attribute__nonnull__(pTHX_2) __attribute__nonnull__(pTHX_3); #define PERL_ARGS_ASSERT_REGPROP \ @@ -3495,16 +3570,16 @@ PERL_CALLCONV void Perl_save_I8(pTHX_ I8 #define PERL_ARGS_ASSERT_SAVE_I8 \ assert(bytep) -PERL_CALLCONV void Perl_save_adelete(pTHX_ AV *av, I32 key) +PERL_CALLCONV void Perl_save_adelete(pTHX_ AV *av, SSize_t key) __attribute__nonnull__(pTHX_1); #define PERL_ARGS_ASSERT_SAVE_ADELETE \ assert(av) -/* PERL_CALLCONV void Perl_save_aelem(pTHX_ AV* av, I32 idx, SV **sptr) +/* PERL_CALLCONV void Perl_save_aelem(pTHX_ AV* av, SSize_t idx, SV **sptr) __attribute__nonnull__(pTHX_1) __attribute__nonnull__(pTHX_3); */ -PERL_CALLCONV void Perl_save_aelem_flags(pTHX_ AV* av, I32 idx, SV **sptr, const U32 flags) +PERL_CALLCONV void Perl_save_aelem_flags(pTHX_ AV* av, SSize_t idx, SV **sptr, const U32 flags) __attribute__nonnull__(pTHX_1) __attribute__nonnull__(pTHX_3); #define PERL_ARGS_ASSERT_SAVE_AELEM_FLAGS \ @@ -3656,6 +3731,11 @@ PERL_CALLCONV void Perl_save_sptr(pTHX_ #define PERL_ARGS_ASSERT_SAVE_SPTR \ assert(sptr) +PERL_CALLCONV void Perl_save_strlen(pTHX_ STRLEN* ptr) + __attribute__nonnull__(pTHX_1); +#define PERL_ARGS_ASSERT_SAVE_STRLEN \ + assert(ptr) + PERL_CALLCONV SV* Perl_save_svref(pTHX_ SV** sptr) __attribute__nonnull__(pTHX_1); #define PERL_ARGS_ASSERT_SAVE_SVREF \ @@ -3750,6 +3830,7 @@ PERL_CALLCONV char* Perl_screaminstr(pTH assert(bigstr); assert(littlestr); assert(old_posp) PERL_CALLCONV U32 Perl_seed(pTHX); +PERL_CALLCONV void Perl_set_caret_X(pTHX); PERL_CALLCONV void Perl_set_context(void *t) __attribute__nonnull__(1); #define PERL_ARGS_ASSERT_SET_CONTEXT \ @@ -3778,7 +3859,7 @@ PERL_CALLCONV void Perl_sortsv_flags(pTH #define PERL_ARGS_ASSERT_SORTSV_FLAGS \ assert(cmp) -PERL_CALLCONV SV** Perl_stack_grow(pTHX_ SV** sp, SV** p, int n) +PERL_CALLCONV SV** Perl_stack_grow(pTHX_ SV** sp, SV** p, SSize_t n) __attribute__nonnull__(pTHX_1) __attribute__nonnull__(pTHX_2); #define PERL_ARGS_ASSERT_STACK_GROW \ @@ -3805,7 +3886,7 @@ PERL_CALLCONV void Perl_sub_crush_depth( /* PERL_CALLCONV bool sv_2bool(pTHX_ SV *const sv) __attribute__nonnull__(pTHX_1); */ -PERL_CALLCONV bool Perl_sv_2bool_flags(pTHX_ SV *const sv, const I32 flags) +PERL_CALLCONV bool Perl_sv_2bool_flags(pTHX_ SV *sv, I32 flags) __attribute__nonnull__(pTHX_1); #define PERL_ARGS_ASSERT_SV_2BOOL_FLAGS \ assert(sv) @@ -3821,17 +3902,37 @@ PERL_CALLCONV IO* Perl_sv_2io(pTHX_ SV * #define PERL_ARGS_ASSERT_SV_2IO \ assert(sv) -/* PERL_CALLCONV IV Perl_sv_2iv(pTHX_ SV *sv); */ -PERL_CALLCONV IV Perl_sv_2iv_flags(pTHX_ SV *const sv, const I32 flags); +/* PERL_CALLCONV IV Perl_sv_2iv(pTHX_ SV *sv) + __attribute__nonnull__(pTHX_1); */ +#define PERL_ARGS_ASSERT_SV_2IV \ + assert(sv) + +PERL_CALLCONV IV Perl_sv_2iv_flags(pTHX_ SV *const sv, const I32 flags) + __attribute__nonnull__(pTHX_1); +#define PERL_ARGS_ASSERT_SV_2IV_FLAGS \ + assert(sv) + PERL_CALLCONV SV* Perl_sv_2mortal(pTHX_ SV *const sv); PERL_CALLCONV SV* Perl_sv_2num(pTHX_ SV *const sv) __attribute__nonnull__(pTHX_1); #define PERL_ARGS_ASSERT_SV_2NUM \ assert(sv) -PERL_CALLCONV NV Perl_sv_2nv_flags(pTHX_ SV *const sv, const I32 flags); -/* PERL_CALLCONV char* Perl_sv_2pv(pTHX_ SV *sv, STRLEN *lp); */ -PERL_CALLCONV char* Perl_sv_2pv_flags(pTHX_ SV *const sv, STRLEN *const lp, const I32 flags); +PERL_CALLCONV NV Perl_sv_2nv_flags(pTHX_ SV *const sv, const I32 flags) + __attribute__nonnull__(pTHX_1); +#define PERL_ARGS_ASSERT_SV_2NV_FLAGS \ + assert(sv) + +/* PERL_CALLCONV char* Perl_sv_2pv(pTHX_ SV *sv, STRLEN *lp) + __attribute__nonnull__(pTHX_1); */ +#define PERL_ARGS_ASSERT_SV_2PV \ + assert(sv) + +PERL_CALLCONV char* Perl_sv_2pv_flags(pTHX_ SV *const sv, STRLEN *const lp, const I32 flags) + __attribute__nonnull__(pTHX_1); +#define PERL_ARGS_ASSERT_SV_2PV_FLAGS \ + assert(sv) + /* PERL_CALLCONV char* Perl_sv_2pv_nolen(pTHX_ SV* sv) __attribute__warn_unused_result__ __attribute__nonnull__(pTHX_1); */ @@ -3860,8 +3961,16 @@ PERL_CALLCONV char* Perl_sv_2pvutf8(pTHX #define PERL_ARGS_ASSERT_SV_2PVUTF8_NOLEN \ assert(sv) -/* PERL_CALLCONV UV Perl_sv_2uv(pTHX_ SV *sv); */ -PERL_CALLCONV UV Perl_sv_2uv_flags(pTHX_ SV *const sv, const I32 flags); +/* PERL_CALLCONV UV Perl_sv_2uv(pTHX_ SV *sv) + __attribute__nonnull__(pTHX_1); */ +#define PERL_ARGS_ASSERT_SV_2UV \ + assert(sv) + +PERL_CALLCONV UV Perl_sv_2uv_flags(pTHX_ SV *const sv, const I32 flags) + __attribute__nonnull__(pTHX_1); +#define PERL_ARGS_ASSERT_SV_2UV_FLAGS \ + assert(sv) + PERL_CALLCONV int Perl_sv_backoff(pTHX_ SV *const sv) __attribute__nonnull__(pTHX_1); #define PERL_ARGS_ASSERT_SV_BACKOFF \ @@ -4119,6 +4228,11 @@ PERL_CALLCONV MAGIC * Perl_sv_magicext(p #define PERL_ARGS_ASSERT_SV_MAGICEXT \ assert(sv) +PERL_CALLCONV MAGIC * Perl_sv_magicext_mglob(pTHX_ SV *sv) + __attribute__nonnull__(pTHX_1); +#define PERL_ARGS_ASSERT_SV_MAGICEXT_MGLOB \ + assert(sv) + /* PERL_CALLCONV SV* Perl_sv_mortalcopy(pTHX_ SV *const oldsv) __attribute__malloc__ __attribute__warn_unused_result__; */ @@ -4144,6 +4258,11 @@ PERL_CALLCONV void Perl_sv_pos_b2u(pTHX_ #define PERL_ARGS_ASSERT_SV_POS_B2U \ assert(offsetp) +PERL_CALLCONV STRLEN Perl_sv_pos_b2u_flags(pTHX_ SV *const sv, STRLEN const offset, U32 flags) + __attribute__nonnull__(pTHX_1); +#define PERL_ARGS_ASSERT_SV_POS_B2U_FLAGS \ + assert(sv) + PERL_CALLCONV void Perl_sv_pos_u2b(pTHX_ SV *const sv, I32 *const offsetp, I32 *const lenp) __attribute__nonnull__(pTHX_2); #define PERL_ARGS_ASSERT_SV_POS_U2B \ @@ -4527,6 +4646,7 @@ PERL_CALLCONV SV* Perl_swash_init(pTHX_ #define PERL_ARGS_ASSERT_SWASH_INIT \ assert(pkg); assert(name); assert(listsv) +/* PERL_CALLCONV void sync_locale(void); */ PERL_CALLCONV void Perl_sys_init(int* argc, char*** argv) __attribute__nonnull__(1) __attribute__nonnull__(2); @@ -4547,7 +4667,7 @@ PERL_CALLCONV void Perl_taint_proper(pTH #define PERL_ARGS_ASSERT_TAINT_PROPER \ assert(s) -PERL_CALLCONV OP * Perl_tied_method(pTHX_ const char *const methname, SV **sp, SV *const sv, const MAGIC *const mg, const U32 flags, U32 argc, ...) +PERL_CALLCONV OP * Perl_tied_method(pTHX_ SV *methname, SV **sp, SV *const sv, const MAGIC *const mg, const U32 flags, U32 argc, ...) __attribute__nonnull__(pTHX_1) __attribute__nonnull__(pTHX_2) __attribute__nonnull__(pTHX_3) @@ -4555,7 +4675,7 @@ PERL_CALLCONV OP * Perl_tied_method(pTHX #define PERL_ARGS_ASSERT_TIED_METHOD \ assert(methname); assert(sp); assert(sv); assert(mg) -PERL_CALLCONV void Perl_tmps_grow(pTHX_ I32 n); +PERL_CALLCONV void Perl_tmps_grow(pTHX_ SSize_t n); /* PERL_CALLCONV UV Perl_to_uni_fold(pTHX_ UV c, U8 *p, STRLEN *lenp) __attribute__nonnull__(pTHX_2) __attribute__nonnull__(pTHX_3); */ @@ -4699,11 +4819,9 @@ PERL_CALLCONV UV Perl_utf8_to_uvchr(pTHX #define PERL_ARGS_ASSERT_UTF8_TO_UVCHR \ assert(s) -PERL_CALLCONV UV Perl_utf8_to_uvchr_buf(pTHX_ const U8 *s, const U8 *send, STRLEN *retlen) +/* PERL_CALLCONV UV utf8_to_uvchr_buf(pTHX_ const U8 *s, const U8 *send, STRLEN *retlen) __attribute__nonnull__(pTHX_1) - __attribute__nonnull__(pTHX_2); -#define PERL_ARGS_ASSERT_UTF8_TO_UVCHR_BUF \ - assert(s); assert(send) + __attribute__nonnull__(pTHX_2); */ PERL_CALLCONV UV Perl_utf8_to_uvuni(pTHX_ const U8 *s, STRLEN *retlen) __attribute__deprecated__ @@ -4712,23 +4830,35 @@ PERL_CALLCONV UV Perl_utf8_to_uvuni(pTHX assert(s) PERL_CALLCONV UV Perl_utf8_to_uvuni_buf(pTHX_ const U8 *s, const U8 *send, STRLEN *retlen) + __attribute__deprecated__ __attribute__nonnull__(pTHX_1) __attribute__nonnull__(pTHX_2); #define PERL_ARGS_ASSERT_UTF8_TO_UVUNI_BUF \ assert(s); assert(send) +PERL_CALLCONV UV Perl_utf8n_to_uvchr(pTHX_ const U8 *s, STRLEN curlen, STRLEN *retlen, U32 flags) + __attribute__nonnull__(pTHX_1); +#define PERL_ARGS_ASSERT_UTF8N_TO_UVCHR \ + assert(s) + PERL_CALLCONV UV Perl_utf8n_to_uvuni(pTHX_ const U8 *s, STRLEN curlen, STRLEN *retlen, U32 flags) __attribute__nonnull__(pTHX_1); #define PERL_ARGS_ASSERT_UTF8N_TO_UVUNI \ assert(s) -PERL_CALLCONV U8* Perl_uvchr_to_utf8_flags(pTHX_ U8 *d, UV uv, UV flags) +/* PERL_CALLCONV U8* uvchr_to_utf8(pTHX_ U8 *d, UV uv) + __attribute__nonnull__(pTHX_1); */ + +/* PERL_CALLCONV U8* uvchr_to_utf8_flags(pTHX_ U8 *d, UV uv, UV flags) + __attribute__nonnull__(pTHX_1); */ + +PERL_CALLCONV U8* Perl_uvoffuni_to_utf8_flags(pTHX_ U8 *d, UV uv, UV flags) __attribute__nonnull__(pTHX_1); -#define PERL_ARGS_ASSERT_UVCHR_TO_UTF8_FLAGS \ +#define PERL_ARGS_ASSERT_UVOFFUNI_TO_UTF8_FLAGS \ assert(d) -/* PERL_CALLCONV U8* Perl_uvuni_to_utf8(pTHX_ U8 *d, UV uv) - __attribute__nonnull__(pTHX_1); */ +PERL_CALLCONV U8* Perl_uvuni_to_utf8(pTHX_ U8 *d, UV uv) + __attribute__nonnull__(pTHX_1); #define PERL_ARGS_ASSERT_UVUNI_TO_UTF8 \ assert(d) @@ -4737,11 +4867,22 @@ PERL_CALLCONV U8* Perl_uvuni_to_utf8_fla #define PERL_ARGS_ASSERT_UVUNI_TO_UTF8_FLAGS \ assert(d) +PERL_CALLCONV UV Perl_valid_utf8_to_uvchr(pTHX_ const U8 *s, STRLEN *retlen) + __attribute__nonnull__(pTHX_1); +#define PERL_ARGS_ASSERT_VALID_UTF8_TO_UVCHR \ + assert(s) + PERL_CALLCONV UV Perl_valid_utf8_to_uvuni(pTHX_ const U8 *s, STRLEN *retlen) + __attribute__deprecated__ __attribute__nonnull__(pTHX_1); #define PERL_ARGS_ASSERT_VALID_UTF8_TO_UVUNI \ assert(s) +PERL_CALLCONV bool Perl_validate_proto(pTHX_ SV *name, SV *proto, bool warn) + __attribute__nonnull__(pTHX_1); +#define PERL_ARGS_ASSERT_VALIDATE_PROTO \ + assert(name) + PERL_CALLCONV int Perl_vcmp(pTHX_ SV *lhv, SV *rhv) __attribute__nonnull__(pTHX_1) __attribute__nonnull__(pTHX_2); @@ -4918,23 +5059,6 @@ STATIC int S_sv_2iuv_non_preserve(pTHX_ # endif # endif #endif -#if !(defined(EBCDIC)) -/* PERL_CALLCONV UV Perl_utf8n_to_uvchr(pTHX_ const U8 *s, STRLEN curlen, STRLEN *retlen, U32 flags) - __attribute__nonnull__(pTHX_1); */ -#define PERL_ARGS_ASSERT_UTF8N_TO_UVCHR \ - assert(s) - -/* PERL_CALLCONV U8* Perl_uvchr_to_utf8(pTHX_ U8 *d, UV uv) - __attribute__nonnull__(pTHX_1); */ -#define PERL_ARGS_ASSERT_UVCHR_TO_UTF8 \ - assert(d) - -/* PERL_CALLCONV UV Perl_valid_utf8_to_uvchr(pTHX_ const U8 *s, STRLEN *retlen) - __attribute__nonnull__(pTHX_1); */ -#define PERL_ARGS_ASSERT_VALID_UTF8_TO_UVCHR \ - assert(s) - -#endif #if !(defined(HAS_SIGACTION) && defined(SA_SIGINFO)) PERL_CALLCONV Signal_t Perl_csighandler(int sig); PERL_CALLCONV Signal_t Perl_sighandler(int sig); @@ -4971,6 +5095,11 @@ PERL_CALLCONV void Perl_utilize(pTHX_ in assert(idop) #endif +#if !(defined(WIN32)) +/* PERL_CALLCONV char* my_setlocale(pTHX_ int category, const char* locale) + __attribute__pure__; */ + +#endif #if !(defined(_MSC_VER)) PERL_CALLCONV_NO_RET int Perl_magic_regdatum_set(pTHX_ SV* sv, MAGIC* mg) __attribute__noreturn__ @@ -5191,8 +5320,20 @@ STATIC void S_put_byte(pTHX_ SV* sv, int #define PERL_ARGS_ASSERT_PUT_BYTE \ assert(sv) +STATIC bool S_put_latin1_charclass_innards(pTHX_ SV* sv, char* bitmap) + __attribute__nonnull__(pTHX_1) + __attribute__nonnull__(pTHX_2); +#define PERL_ARGS_ASSERT_PUT_LATIN1_CHARCLASS_INNARDS \ + assert(sv); assert(bitmap) + +STATIC void S_put_range(pTHX_ SV* sv, UV start, UV end) + __attribute__nonnull__(pTHX_1); +#define PERL_ARGS_ASSERT_PUT_RANGE \ + assert(sv) + STATIC void S_regdump_extflags(pTHX_ const char *lead, const U32 flags); -STATIC U8 S_regtail_study(pTHX_ struct RExC_state_t *pRExC_state, regnode *p, const regnode *val, U32 depth) +STATIC void S_regdump_intflags(pTHX_ const char *lead, const U32 flags); +STATIC U8 S_regtail_study(pTHX_ RExC_state_t *pRExC_state, regnode *p, const regnode *val, U32 depth) __attribute__nonnull__(pTHX_1) __attribute__nonnull__(pTHX_2) __attribute__nonnull__(pTHX_3); @@ -5228,6 +5369,7 @@ STATIC void S_del_sv(pTHX_ SV *p) # endif # if defined(PERL_IN_TOKE_C) STATIC void S_printbuf(pTHX_ const char *const fmt, const char *const s) + __attribute__format__(__printf__,pTHX_1,0) __attribute__nonnull__(pTHX_1) __attribute__nonnull__(pTHX_2); #define PERL_ARGS_ASSERT_PRINTBUF \ @@ -5247,30 +5389,6 @@ PERL_CALLCONV void Perl_dump_sv_child(pT assert(sv) #endif -#if defined(DUMP_FDS) -PERL_CALLCONV void Perl_dump_fds(pTHX_ char* s) - __attribute__nonnull__(pTHX_1); -#define PERL_ARGS_ASSERT_DUMP_FDS \ - assert(s) - -#endif -#if defined(EBCDIC) -PERL_CALLCONV UV Perl_utf8n_to_uvchr(pTHX_ const U8 *s, STRLEN curlen, STRLEN *retlen, U32 flags) - __attribute__nonnull__(pTHX_1); -#define PERL_ARGS_ASSERT_UTF8N_TO_UVCHR \ - assert(s) - -PERL_CALLCONV U8* Perl_uvchr_to_utf8(pTHX_ U8 *d, UV uv) - __attribute__nonnull__(pTHX_1); -#define PERL_ARGS_ASSERT_UVCHR_TO_UTF8 \ - assert(d) - -PERL_CALLCONV UV Perl_valid_utf8_to_uvchr(pTHX_ const U8 *s, STRLEN *retlen) - __attribute__nonnull__(pTHX_1); -#define PERL_ARGS_ASSERT_VALID_UTF8_TO_UVCHR \ - assert(s) - -#endif #if defined(HAS_MSG) || defined(HAS_SEM) || defined(HAS_SHM) PERL_CALLCONV I32 Perl_do_ipcctl(pTHX_ I32 optype, SV** mark, SV** sp) __attribute__nonnull__(pTHX_2) @@ -5346,20 +5464,6 @@ PERL_CALLCONV MEM_SIZE Perl_malloced_siz assert(p) #endif -#if defined(MYSWAP) -PERL_CALLCONV long Perl_my_htonl(pTHX_ long l) - __attribute__warn_unused_result__ - __attribute__pure__; - -PERL_CALLCONV long Perl_my_ntohl(pTHX_ long l) - __attribute__warn_unused_result__ - __attribute__pure__; - -PERL_CALLCONV short Perl_my_swap(pTHX_ short s) - __attribute__warn_unused_result__ - __attribute__pure__; - -#endif #if defined(NO_MATHOMS) /* PERL_CALLCONV void Perl_sv_nounlocking(pTHX_ SV *sv); */ #endif @@ -5405,6 +5509,14 @@ PERL_CALLCONV void Perl_Slab_to_rw(pTHX_ # endif #endif +#if defined(PERL_CORE) || defined (PERL_EXT) +PERL_STATIC_INLINE STRLEN S_sv_or_pv_pos_u2b(pTHX_ SV *sv, const char *pv, STRLEN pos, STRLEN *lenp) + __attribute__nonnull__(pTHX_1) + __attribute__nonnull__(pTHX_2); +#define PERL_ARGS_ASSERT_SV_OR_PV_POS_U2B \ + assert(sv); assert(pv) + +#endif #if defined(PERL_CR_FILTER) # if defined(PERL_IN_TOKE_C) STATIC I32 S_cr_textfilter(pTHX_ int idx, SV *sv, int maxlen); @@ -5415,6 +5527,20 @@ STATIC void S_strip_return(pTHX_ SV *sv) # endif #endif +#if defined(PERL_DEBUG_READONLY_COW) +PERL_CALLCONV void Perl_sv_buf_to_ro(pTHX_ SV *sv) + __attribute__nonnull__(pTHX_1); +#define PERL_ARGS_ASSERT_SV_BUF_TO_RO \ + assert(sv) + +# if defined(PERL_IN_SV_C) +STATIC void S_sv_buf_to_rw(pTHX_ SV *sv) + __attribute__nonnull__(pTHX_1); +#define PERL_ARGS_ASSERT_SV_BUF_TO_RW \ + assert(sv) + +# endif +#endif #if defined(PERL_DEBUG_READONLY_OPS) PERL_CALLCONV PADOFFSET Perl_op_refcnt_dec(pTHX_ OP *o) __attribute__nonnull__(pTHX_1); @@ -5599,6 +5725,24 @@ STATIC void S_exec_failed(pTHX_ const ch STATIC bool S_ingroup(pTHX_ Gid_t testgid, bool effective) __attribute__warn_unused_result__; +STATIC bool S_openn_cleanup(pTHX_ GV *gv, IO *io, PerlIO *fp, char *mode, const char *oname, PerlIO *saveifp, PerlIO *saveofp, int savefd, char savetype, int writing, bool was_fdopen, const char *type) + __attribute__nonnull__(pTHX_1) + __attribute__nonnull__(pTHX_2) + __attribute__nonnull__(pTHX_4) + __attribute__nonnull__(pTHX_5); +#define PERL_ARGS_ASSERT_OPENN_CLEANUP \ + assert(gv); assert(io); assert(mode); assert(oname) + +STATIC IO * S_openn_setup(pTHX_ GV *gv, char *mode, PerlIO **saveifp, PerlIO **saveofp, int *savefd, char *savetype) + __attribute__nonnull__(pTHX_1) + __attribute__nonnull__(pTHX_2) + __attribute__nonnull__(pTHX_3) + __attribute__nonnull__(pTHX_4) + __attribute__nonnull__(pTHX_5) + __attribute__nonnull__(pTHX_6); +#define PERL_ARGS_ASSERT_OPENN_SETUP \ + assert(gv); assert(mode); assert(saveifp); assert(saveofp); assert(savefd); assert(savetype) + #endif #if defined(PERL_IN_DOOP_C) STATIC I32 S_do_trans_complex(pTHX_ SV * const sv) @@ -5669,16 +5813,49 @@ PERL_CALLCONV void Perl_hv_kill_backrefs #endif #if defined(PERL_IN_GV_C) +STATIC bool S_find_default_stash(pTHX_ HV **stash, const char *name, STRLEN len, const U32 is_utf8, const I32 add, svtype sv_type) + __attribute__nonnull__(pTHX_1) + __attribute__nonnull__(pTHX_2); +#define PERL_ARGS_ASSERT_FIND_DEFAULT_STASH \ + assert(stash); assert(name) + STATIC void S_gv_init_svtype(pTHX_ GV *gv, const svtype sv_type) __attribute__nonnull__(pTHX_1); #define PERL_ARGS_ASSERT_GV_INIT_SVTYPE \ assert(gv) +STATIC bool S_gv_is_in_main(pTHX_ const char *name, STRLEN len, const U32 is_utf8) + __attribute__nonnull__(pTHX_1); +#define PERL_ARGS_ASSERT_GV_IS_IN_MAIN \ + assert(name) + +STATIC bool S_gv_magicalize(pTHX_ GV *gv, HV *stash, const char *name, STRLEN len, bool addmg, svtype sv_type) + __attribute__nonnull__(pTHX_1) + __attribute__nonnull__(pTHX_2) + __attribute__nonnull__(pTHX_3); +#define PERL_ARGS_ASSERT_GV_MAGICALIZE \ + assert(gv); assert(stash); assert(name) + STATIC void S_gv_magicalize_isa(pTHX_ GV *gv) __attribute__nonnull__(pTHX_1); #define PERL_ARGS_ASSERT_GV_MAGICALIZE_ISA \ assert(gv) +STATIC void S_maybe_multimagic_gv(pTHX_ GV *gv, const char *name, const svtype sv_type) + __attribute__nonnull__(pTHX_1) + __attribute__nonnull__(pTHX_2); +#define PERL_ARGS_ASSERT_MAYBE_MULTIMAGIC_GV \ + assert(gv); assert(name) + +STATIC bool S_parse_gv_stash_name(pTHX_ HV **stash, GV **gv, const char **name, STRLEN *len, const char *nambeg, STRLEN full_len, const U32 is_utf8, const I32 add) + __attribute__nonnull__(pTHX_1) + __attribute__nonnull__(pTHX_2) + __attribute__nonnull__(pTHX_3) + __attribute__nonnull__(pTHX_4) + __attribute__nonnull__(pTHX_5); +#define PERL_ARGS_ASSERT_PARSE_GV_STASH_NAME \ + assert(stash); assert(gv); assert(name); assert(len); assert(nambeg) + STATIC HV* S_require_tie_mod(pTHX_ GV *gv, const char *varpv, SV* namesv, const char *methpv, const U32 flags) __attribute__nonnull__(pTHX_1) __attribute__nonnull__(pTHX_2) @@ -5717,6 +5894,11 @@ STATIC struct xpvhv_aux* S_hv_auxinit(pT #define PERL_ARGS_ASSERT_HV_AUXINIT \ assert(hv) +STATIC struct xpvhv_aux* S_hv_auxinit_internal(struct xpvhv_aux *iter) + __attribute__nonnull__(1); +#define PERL_ARGS_ASSERT_HV_AUXINIT_INTERNAL \ + assert(iter) + STATIC SV* S_hv_delete_common(pTHX_ HV *hv, SV *keysv, const char *key, STRLEN klen, int k_flags, I32 d_flags, U32 hash); STATIC SV* S_hv_free_ent_ret(pTHX_ HV *hv, HE *entry) __attribute__nonnull__(pTHX_1) @@ -5742,7 +5924,7 @@ STATIC HE* S_new_he(pTHX) __attribute__malloc__ __attribute__warn_unused_result__; -STATIC U32 S_ptr_hash(PTRV u); +PERL_STATIC_INLINE U32 S_ptr_hash(PTRV u); STATIC SV * S_refcounted_he_value(pTHX_ const struct refcounted_he *he) __attribute__nonnull__(pTHX_1); #define PERL_ARGS_ASSERT_REFCOUNTED_HE_VALUE \ @@ -5778,24 +5960,35 @@ PERL_CALLCONV SV* Perl_hfree_next_entry( assert(hv); assert(indexp) #endif -#if defined(PERL_IN_LOCALE_C) -# if defined(USE_LOCALE_NUMERIC) || defined(USE_LOCALE_COLLATE) +#if defined(PERL_IN_LOCALE_C) && defined(USE_LOCALE) +STATIC bool S_is_cur_LC_category_utf8(pTHX_ int category); STATIC char* S_stdize_locale(pTHX_ char* locs) __attribute__nonnull__(pTHX_1); #define PERL_ARGS_ASSERT_STDIZE_LOCALE \ assert(locs) -# endif +#endif +#if defined(PERL_IN_MALLOC_C) +STATIC int S_adjust_size_and_find_bucket(size_t *nbytes_p) + __attribute__nonnull__(1); +#define PERL_ARGS_ASSERT_ADJUST_SIZE_AND_FIND_BUCKET \ + assert(nbytes_p) + #endif #if defined(PERL_IN_MG_C) -STATIC SV* S_magic_methcall1(pTHX_ SV *sv, const MAGIC *mg, const char *meth, U32 flags, int n, SV *val) +STATIC void S_fixup_errno_string(pTHX_ SV* sv) + __attribute__nonnull__(pTHX_1); +#define PERL_ARGS_ASSERT_FIXUP_ERRNO_STRING \ + assert(sv) + +STATIC SV* S_magic_methcall1(pTHX_ SV *sv, const MAGIC *mg, SV *meth, U32 flags, int n, SV *val) __attribute__nonnull__(pTHX_1) __attribute__nonnull__(pTHX_2) __attribute__nonnull__(pTHX_3); #define PERL_ARGS_ASSERT_MAGIC_METHCALL1 \ assert(sv); assert(mg); assert(meth) -STATIC int S_magic_methpack(pTHX_ SV *sv, const MAGIC *mg, const char *meth) +STATIC int S_magic_methpack(pTHX_ SV *sv, const MAGIC *mg, SV *meth) __attribute__nonnull__(pTHX_1) __attribute__nonnull__(pTHX_2) __attribute__nonnull__(pTHX_3); @@ -5803,9 +5996,9 @@ STATIC int S_magic_methpack(pTHX_ SV *sv assert(sv); assert(mg); assert(meth) STATIC void S_restore_magic(pTHX_ const void *p); -STATIC void S_save_magic(pTHX_ I32 mgs_ix, SV *sv) +STATIC void S_save_magic_flags(pTHX_ I32 mgs_ix, SV *sv, U32 flags) __attribute__nonnull__(pTHX_2); -#define PERL_ARGS_ASSERT_SAVE_MAGIC \ +#define PERL_ARGS_ASSERT_SAVE_MAGIC_FLAGS \ assert(sv) STATIC void S_unwind_handler_stack(pTHX_ const void *p); @@ -5819,7 +6012,7 @@ PERL_CALLCONV bool Perl_translate_substr #endif #if defined(PERL_IN_MRO_C) -STATIC void S_mro_clean_isarev(pTHX_ HV * const isa, const char * const name, const STRLEN len, HV * const exceptions, U32 flags) +STATIC void S_mro_clean_isarev(pTHX_ HV * const isa, const char * const name, const STRLEN len, HV * const exceptions, U32 hash, U32 flags) __attribute__nonnull__(pTHX_1) __attribute__nonnull__(pTHX_2); #define PERL_ARGS_ASSERT_MRO_CLEAN_ISAREV \ @@ -5856,19 +6049,19 @@ STATIC void S_apply_attrs_my(pTHX_ HV *s #define PERL_ARGS_ASSERT_APPLY_ATTRS_MY \ assert(stash); assert(target); assert(imopsp) -STATIC void S_bad_type_pv(pTHX_ I32 n, const char *t, const char *name, U32 flags, const OP *kid) +STATIC void S_bad_type_gv(pTHX_ I32 n, const char *t, GV *gv, U32 flags, const OP *kid) __attribute__nonnull__(pTHX_2) __attribute__nonnull__(pTHX_3) __attribute__nonnull__(pTHX_5); -#define PERL_ARGS_ASSERT_BAD_TYPE_PV \ - assert(t); assert(name); assert(kid) +#define PERL_ARGS_ASSERT_BAD_TYPE_GV \ + assert(t); assert(gv); assert(kid) -STATIC void S_bad_type_sv(pTHX_ I32 n, const char *t, SV *namesv, U32 flags, const OP *kid) +STATIC void S_bad_type_pv(pTHX_ I32 n, const char *t, const char *name, U32 flags, const OP *kid) __attribute__nonnull__(pTHX_2) __attribute__nonnull__(pTHX_3) __attribute__nonnull__(pTHX_5); -#define PERL_ARGS_ASSERT_BAD_TYPE_SV \ - assert(t); assert(namesv); assert(kid) +#define PERL_ARGS_ASSERT_BAD_TYPE_PV \ + assert(t); assert(name); assert(kid) STATIC void S_cop_free(pTHX_ COP *cop) __attribute__nonnull__(pTHX_1); @@ -5928,6 +6121,13 @@ STATIC bool S_looks_like_bool(pTHX_ cons assert(o) STATIC OP* S_modkids(pTHX_ OP *o, I32 type); +STATIC void S_move_proto_attr(pTHX_ OP **proto, OP **attrs, const GV *name) + __attribute__nonnull__(pTHX_1) + __attribute__nonnull__(pTHX_2) + __attribute__nonnull__(pTHX_3); +#define PERL_ARGS_ASSERT_MOVE_PROTO_ATTR \ + assert(proto); assert(attrs); assert(name) + STATIC OP * S_my_kid(pTHX_ OP *o, OP *attrs, OP **imopsp) __attribute__nonnull__(pTHX_3); #define PERL_ARGS_ASSERT_MY_KID \ @@ -5959,6 +6159,11 @@ STATIC OP* S_no_fh_allowed(pTHX_ OP *o) #define PERL_ARGS_ASSERT_NO_FH_ALLOWED \ assert(o) +STATIC void S_null_listop_in_list_context(pTHX_ OP* o) + __attribute__nonnull__(pTHX_1); +#define PERL_ARGS_ASSERT_NULL_LISTOP_IN_LIST_CONTEXT \ + assert(o) + PERL_STATIC_INLINE OP* S_op_integerize(pTHX_ OP *o) __attribute__nonnull__(pTHX_1); #define PERL_ARGS_ASSERT_OP_INTEGERIZE \ @@ -6143,7 +6348,7 @@ PERL_CALLCONV GV* Perl_softref2xv(pTHX_ #endif #if defined(PERL_IN_PP_CTL_C) -STATIC SV ** S_adjust_stack_on_leave(pTHX_ SV **newsp, SV **sp, SV **mark, I32 gimme, U32 flags) +STATIC SV ** S_adjust_stack_on_leave(pTHX_ SV **newsp, SV **sp, SV **mark, I32 gimme, U32 flags, bool lvalue) __attribute__nonnull__(pTHX_1) __attribute__nonnull__(pTHX_2) __attribute__nonnull__(pTHX_3); @@ -6220,10 +6425,10 @@ STATIC bool S_matcher_matches_sv(pTHX_ P STATIC bool S_num_overflow(NV value, I32 fldsize, I32 frcsize) __attribute__warn_unused_result__; -STATIC bool S_path_is_absolute(const char *name) +PERL_STATIC_INLINE bool S_path_is_searchable(const char *name) __attribute__warn_unused_result__ __attribute__nonnull__(1); -#define PERL_ARGS_ASSERT_PATH_IS_ABSOLUTE \ +#define PERL_ARGS_ASSERT_PATH_IS_SEARCHABLE \ assert(name) STATIC I32 S_run_user_filter(pTHX_ int idx, SV *buf_sv, int maxlen) @@ -6264,7 +6469,7 @@ STATIC SV* S_method_common(pTHX_ SV* met #endif #if defined(PERL_IN_PP_PACK_C) -STATIC char * S_bytes_to_uni(const U8 *start, STRLEN len, char *dest) +STATIC char * S_bytes_to_uni(const U8 *start, STRLEN len, char *dest, const bool needs_swap) __attribute__warn_unused_result__ __attribute__nonnull__(1) __attribute__nonnull__(3); @@ -6410,10 +6615,9 @@ STATIC I32 S_sv_ncmp(pTHX_ SV *const a, #if defined(PERL_IN_PP_SYS_C) STATIC OP* S_doform(pTHX_ CV *cv, GV *gv, OP *retop) __attribute__nonnull__(pTHX_1) - __attribute__nonnull__(pTHX_2) - __attribute__nonnull__(pTHX_3); + __attribute__nonnull__(pTHX_2); #define PERL_ARGS_ASSERT_DOFORM \ - assert(cv); assert(gv); assert(retop) + assert(cv); assert(gv) STATIC SV * S_space_join_names_mortal(pTHX_ char *const *array) __attribute__nonnull__(pTHX_1); @@ -6433,71 +6637,40 @@ PERL_STATIC_INLINE UV* S__invlist_array_ #define PERL_ARGS_ASSERT__INVLIST_ARRAY_INIT \ assert(invlist) -STATIC SV* S__new_invlist_C_array(pTHX_ UV* list) - __attribute__warn_unused_result__ - __attribute__nonnull__(pTHX_1); -#define PERL_ARGS_ASSERT__NEW_INVLIST_C_ARRAY \ - assert(list) - PERL_STATIC_INLINE SV* S_add_cp_to_invlist(pTHX_ SV* invlist, const UV cp) __attribute__warn_unused_result__; -STATIC U32 S_add_data(struct RExC_state_t *pRExC_state, U32 n, const char *s) +STATIC U32 S_add_data(RExC_state_t* const pRExC_state, const char* const s, const U32 n) __attribute__warn_unused_result__ __attribute__nonnull__(1) - __attribute__nonnull__(3); + __attribute__nonnull__(2); #define PERL_ARGS_ASSERT_ADD_DATA \ assert(pRExC_state); assert(s) -PERL_STATIC_INLINE void S_alloc_maybe_populate_EXACT(pTHX_ struct RExC_state_t *pRExC_state, regnode *node, I32 *flagp, STRLEN len, UV code_point) +PERL_STATIC_INLINE void S_alloc_maybe_populate_EXACT(pTHX_ RExC_state_t *pRExC_state, regnode *node, I32 *flagp, STRLEN len, UV code_point, bool downgradable) __attribute__nonnull__(pTHX_1) __attribute__nonnull__(pTHX_2) __attribute__nonnull__(pTHX_3); #define PERL_ARGS_ASSERT_ALLOC_MAYBE_POPULATE_EXACT \ assert(pRExC_state); assert(node); assert(flagp) -STATIC void S_cl_and(struct regnode_charclass_class *cl, const struct regnode_charclass_class *and_with) - __attribute__nonnull__(1) - __attribute__nonnull__(2); -#define PERL_ARGS_ASSERT_CL_AND \ - assert(cl); assert(and_with) - -STATIC void S_cl_anything(const struct RExC_state_t *pRExC_state, struct regnode_charclass_class *cl) - __attribute__nonnull__(1) - __attribute__nonnull__(2); -#define PERL_ARGS_ASSERT_CL_ANYTHING \ - assert(pRExC_state); assert(cl) - -STATIC void S_cl_init(const struct RExC_state_t *pRExC_state, struct regnode_charclass_class *cl) - __attribute__nonnull__(1) - __attribute__nonnull__(2); -#define PERL_ARGS_ASSERT_CL_INIT \ - assert(pRExC_state); assert(cl) - -STATIC int S_cl_is_anything(const struct regnode_charclass_class *cl) - __attribute__warn_unused_result__ - __attribute__nonnull__(1); -#define PERL_ARGS_ASSERT_CL_IS_ANYTHING \ - assert(cl) - -STATIC void S_cl_or(const struct RExC_state_t *pRExC_state, struct regnode_charclass_class *cl, const struct regnode_charclass_class *or_with) - __attribute__nonnull__(1) - __attribute__nonnull__(2) - __attribute__nonnull__(3); -#define PERL_ARGS_ASSERT_CL_OR \ - assert(pRExC_state); assert(cl); assert(or_with) - -PERL_STATIC_INLINE U8 S_compute_EXACTish(pTHX_ struct RExC_state_t *pRExC_state) +PERL_STATIC_INLINE U8 S_compute_EXACTish(pTHX_ RExC_state_t *pRExC_state) __attribute__nonnull__(pTHX_1); #define PERL_ARGS_ASSERT_COMPUTE_EXACTISH \ assert(pRExC_state) -STATIC bool S_could_it_be_a_POSIX_class(pTHX_ struct RExC_state_t *pRExC_state) +STATIC bool S_could_it_be_a_POSIX_class(pTHX_ RExC_state_t *pRExC_state) __attribute__nonnull__(pTHX_1); #define PERL_ARGS_ASSERT_COULD_IT_BE_A_POSIX_CLASS \ assert(pRExC_state) -PERL_STATIC_INLINE UV* S_get_invlist_iter_addr(pTHX_ SV* invlist) +STATIC SV* S_get_ANYOF_cp_list_for_ssc(pTHX_ const RExC_state_t *pRExC_state, const regnode_charclass* const node) + __attribute__nonnull__(pTHX_1) + __attribute__nonnull__(pTHX_2); +#define PERL_ARGS_ASSERT_GET_ANYOF_CP_LIST_FOR_SSC \ + assert(pRExC_state); assert(node) + +PERL_STATIC_INLINE STRLEN* S_get_invlist_iter_addr(pTHX_ SV* invlist) __attribute__warn_unused_result__ __attribute__nonnull__(pTHX_1); #define PERL_ARGS_ASSERT_GET_INVLIST_ITER_ADDR \ @@ -6509,25 +6682,13 @@ PERL_STATIC_INLINE IV* S_get_invlist_pre #define PERL_ARGS_ASSERT_GET_INVLIST_PREVIOUS_INDEX_ADDR \ assert(invlist) -PERL_STATIC_INLINE UV* S_get_invlist_version_id_addr(pTHX_ SV* invlist) - __attribute__warn_unused_result__ - __attribute__nonnull__(pTHX_1); -#define PERL_ARGS_ASSERT_GET_INVLIST_VERSION_ID_ADDR \ - assert(invlist) - -PERL_STATIC_INLINE UV* S_get_invlist_zero_addr(pTHX_ SV* invlist) - __attribute__warn_unused_result__ - __attribute__nonnull__(pTHX_1); -#define PERL_ARGS_ASSERT_GET_INVLIST_ZERO_ADDR \ - assert(invlist) - -STATIC bool S_grok_bslash_N(pTHX_ struct RExC_state_t *pRExC_state, regnode** nodep, UV *valuep, I32 *flagp, U32 depth, bool in_char_class, const bool strict) +STATIC bool S_grok_bslash_N(pTHX_ RExC_state_t *pRExC_state, regnode** nodep, UV *valuep, I32 *flagp, U32 depth, bool in_char_class, const bool strict) __attribute__nonnull__(pTHX_1) __attribute__nonnull__(pTHX_4); #define PERL_ARGS_ASSERT_GROK_BSLASH_N \ assert(pRExC_state); assert(flagp) -STATIC regnode* S_handle_regex_sets(pTHX_ struct RExC_state_t *pRExC_state, SV ** return_invlist, I32 *flagp, U32 depth, char * const oregcomp_parse) +STATIC regnode* S_handle_regex_sets(pTHX_ RExC_state_t *pRExC_state, SV ** return_invlist, I32 *flagp, U32 depth, char * const oregcomp_parse) __attribute__nonnull__(pTHX_1) __attribute__nonnull__(pTHX_3) __attribute__nonnull__(pTHX_5); @@ -6593,7 +6754,7 @@ PERL_STATIC_INLINE IV S_invlist_previous #define PERL_ARGS_ASSERT_INVLIST_PREVIOUS_INDEX \ assert(invlist) -PERL_STATIC_INLINE void S_invlist_set_len(pTHX_ SV* const invlist, const UV len) +PERL_STATIC_INLINE void S_invlist_set_len(pTHX_ SV* const invlist, const UV len, const bool offset) __attribute__nonnull__(pTHX_1); #define PERL_ARGS_ASSERT_INVLIST_SET_LEN \ assert(invlist) @@ -6608,15 +6769,15 @@ PERL_STATIC_INLINE void S_invlist_trim(p #define PERL_ARGS_ASSERT_INVLIST_TRIM \ assert(invlist) -STATIC U32 S_join_exact(pTHX_ struct RExC_state_t *pRExC_state, regnode *scan, UV *min_subtract, bool *has_exactf_sharp_s, U32 flags, regnode *val, U32 depth) +STATIC U32 S_join_exact(pTHX_ RExC_state_t *pRExC_state, regnode *scan, UV *min_subtract, bool *unfolded_multi_char, U32 flags, regnode *val, U32 depth) __attribute__nonnull__(pTHX_1) __attribute__nonnull__(pTHX_2) __attribute__nonnull__(pTHX_3) __attribute__nonnull__(pTHX_4); #define PERL_ARGS_ASSERT_JOIN_EXACT \ - assert(pRExC_state); assert(scan); assert(min_subtract); assert(has_exactf_sharp_s) + assert(pRExC_state); assert(scan); assert(min_subtract); assert(unfolded_multi_char) -STATIC I32 S_make_trie(pTHX_ struct RExC_state_t *pRExC_state, regnode *startbranch, regnode *first, regnode *last, regnode *tail, U32 word_count, U32 flags, U32 depth) +STATIC I32 S_make_trie(pTHX_ RExC_state_t *pRExC_state, regnode *startbranch, regnode *first, regnode *last, regnode *tail, U32 word_count, U32 flags, U32 depth) __attribute__nonnull__(pTHX_1) __attribute__nonnull__(pTHX_2) __attribute__nonnull__(pTHX_3) @@ -6625,37 +6786,43 @@ STATIC I32 S_make_trie(pTHX_ struct RExC #define PERL_ARGS_ASSERT_MAKE_TRIE \ assert(pRExC_state); assert(startbranch); assert(first); assert(last); assert(tail) -STATIC void S_make_trie_failtable(pTHX_ struct RExC_state_t *pRExC_state, regnode *source, regnode *stclass, U32 depth) +STATIC void S_make_trie_failtable(pTHX_ RExC_state_t *pRExC_state, regnode *source, regnode *stclass, U32 depth) __attribute__nonnull__(pTHX_1) __attribute__nonnull__(pTHX_2) __attribute__nonnull__(pTHX_3); #define PERL_ARGS_ASSERT_MAKE_TRIE_FAILTABLE \ assert(pRExC_state); assert(source); assert(stclass) -STATIC char * S_nextchar(pTHX_ struct RExC_state_t *pRExC_state) +STATIC char * S_nextchar(pTHX_ RExC_state_t *pRExC_state) __attribute__nonnull__(pTHX_1); #define PERL_ARGS_ASSERT_NEXTCHAR \ assert(pRExC_state) -STATIC void S_parse_lparen_question_flags(pTHX_ struct RExC_state_t *pRExC_state) +STATIC void S_parse_lparen_question_flags(pTHX_ RExC_state_t *pRExC_state) __attribute__nonnull__(pTHX_1); #define PERL_ARGS_ASSERT_PARSE_LPAREN_QUESTION_FLAGS \ assert(pRExC_state) -PERL_STATIC_NO_RET void S_re_croak2(pTHX_ const char* pat1, const char* pat2, ...) - __attribute__noreturn__ +STATIC void S_populate_ANYOF_from_invlist(pTHX_ regnode *node, SV** invlist_ptr) __attribute__nonnull__(pTHX_1) __attribute__nonnull__(pTHX_2); +#define PERL_ARGS_ASSERT_POPULATE_ANYOF_FROM_INVLIST \ + assert(node); assert(invlist_ptr) + +PERL_STATIC_NO_RET void S_re_croak2(pTHX_ bool utf8, const char* pat1, const char* pat2, ...) + __attribute__noreturn__ + __attribute__nonnull__(pTHX_2) + __attribute__nonnull__(pTHX_3); #define PERL_ARGS_ASSERT_RE_CROAK2 \ assert(pat1); assert(pat2) -STATIC regnode* S_reg(pTHX_ struct RExC_state_t *pRExC_state, I32 paren, I32 *flagp, U32 depth) +STATIC regnode* S_reg(pTHX_ RExC_state_t *pRExC_state, I32 paren, I32 *flagp, U32 depth) __attribute__nonnull__(pTHX_1) __attribute__nonnull__(pTHX_3); #define PERL_ARGS_ASSERT_REG \ assert(pRExC_state); assert(flagp) -STATIC regnode* S_reg_node(pTHX_ struct RExC_state_t *pRExC_state, U8 op) +STATIC regnode* S_reg_node(pTHX_ RExC_state_t *pRExC_state, U8 op) __attribute__nonnull__(pTHX_1); #define PERL_ARGS_ASSERT_REG_NODE \ assert(pRExC_state) @@ -6665,91 +6832,168 @@ STATIC UV S_reg_recode(pTHX_ const char #define PERL_ARGS_ASSERT_REG_RECODE \ assert(encp) -STATIC SV * S_reg_scan_name(pTHX_ struct RExC_state_t *pRExC_state, U32 flags) +STATIC SV * S_reg_scan_name(pTHX_ RExC_state_t *pRExC_state, U32 flags) __attribute__nonnull__(pTHX_1); #define PERL_ARGS_ASSERT_REG_SCAN_NAME \ assert(pRExC_state) -STATIC bool S_reg_skipcomment(pTHX_ struct RExC_state_t *pRExC_state) +STATIC bool S_reg_skipcomment(pTHX_ RExC_state_t *pRExC_state) __attribute__nonnull__(pTHX_1); #define PERL_ARGS_ASSERT_REG_SKIPCOMMENT \ assert(pRExC_state) -STATIC regnode* S_reganode(pTHX_ struct RExC_state_t *pRExC_state, U8 op, U32 arg) +STATIC regnode* S_reganode(pTHX_ RExC_state_t *pRExC_state, U8 op, U32 arg) __attribute__nonnull__(pTHX_1); #define PERL_ARGS_ASSERT_REGANODE \ assert(pRExC_state) -STATIC regnode* S_regatom(pTHX_ struct RExC_state_t *pRExC_state, I32 *flagp, U32 depth) +STATIC regnode* S_regatom(pTHX_ RExC_state_t *pRExC_state, I32 *flagp, U32 depth) __attribute__nonnull__(pTHX_1) __attribute__nonnull__(pTHX_2); #define PERL_ARGS_ASSERT_REGATOM \ assert(pRExC_state); assert(flagp) -STATIC regnode* S_regbranch(pTHX_ struct RExC_state_t *pRExC_state, I32 *flagp, I32 first, U32 depth) +STATIC regnode* S_regbranch(pTHX_ RExC_state_t *pRExC_state, I32 *flagp, I32 first, U32 depth) __attribute__nonnull__(pTHX_1) __attribute__nonnull__(pTHX_2); #define PERL_ARGS_ASSERT_REGBRANCH \ assert(pRExC_state); assert(flagp) -STATIC regnode* S_regclass(pTHX_ struct RExC_state_t *pRExC_state, I32 *flagp, U32 depth, const bool stop_at_1, bool allow_multi_fold, const bool silence_non_portable, SV** ret_invlist) +STATIC regnode* S_regclass(pTHX_ RExC_state_t *pRExC_state, I32 *flagp, U32 depth, const bool stop_at_1, bool allow_multi_fold, const bool silence_non_portable, SV** ret_invlist) __attribute__nonnull__(pTHX_1) __attribute__nonnull__(pTHX_2); #define PERL_ARGS_ASSERT_REGCLASS \ assert(pRExC_state); assert(flagp) -STATIC void S_reginsert(pTHX_ struct RExC_state_t *pRExC_state, U8 op, regnode *opnd, U32 depth) +STATIC void S_reginsert(pTHX_ RExC_state_t *pRExC_state, U8 op, regnode *opnd, U32 depth) __attribute__nonnull__(pTHX_1) __attribute__nonnull__(pTHX_3); #define PERL_ARGS_ASSERT_REGINSERT \ assert(pRExC_state); assert(opnd) -STATIC char * S_regpatws(struct RExC_state_t *pRExC_state, char *p, const bool recognize_comment) +STATIC char * S_regpatws(RExC_state_t *pRExC_state, char *p, const bool recognize_comment) __attribute__warn_unused_result__ __attribute__nonnull__(1) __attribute__nonnull__(2); #define PERL_ARGS_ASSERT_REGPATWS \ assert(pRExC_state); assert(p) -STATIC regnode* S_regpiece(pTHX_ struct RExC_state_t *pRExC_state, I32 *flagp, U32 depth) +STATIC regnode* S_regpiece(pTHX_ RExC_state_t *pRExC_state, I32 *flagp, U32 depth) __attribute__nonnull__(pTHX_1) __attribute__nonnull__(pTHX_2); #define PERL_ARGS_ASSERT_REGPIECE \ assert(pRExC_state); assert(flagp) -PERL_STATIC_INLINE I32 S_regpposixcc(pTHX_ struct RExC_state_t *pRExC_state, I32 value, const bool strict) +PERL_STATIC_INLINE I32 S_regpposixcc(pTHX_ RExC_state_t *pRExC_state, I32 value, const bool strict) __attribute__nonnull__(pTHX_1); #define PERL_ARGS_ASSERT_REGPPOSIXCC \ assert(pRExC_state) -STATIC void S_regtail(pTHX_ struct RExC_state_t *pRExC_state, regnode *p, const regnode *val, U32 depth) +STATIC void S_regtail(pTHX_ RExC_state_t *pRExC_state, regnode *p, const regnode *val, U32 depth) __attribute__nonnull__(pTHX_1) __attribute__nonnull__(pTHX_2) __attribute__nonnull__(pTHX_3); #define PERL_ARGS_ASSERT_REGTAIL \ assert(pRExC_state); assert(p); assert(val) -STATIC STRLEN S_reguni(pTHX_ const struct RExC_state_t *pRExC_state, UV uv, char *s) +PERL_STATIC_INLINE STRLEN S_reguni(pTHX_ const RExC_state_t *pRExC_state, UV uv, char *s) __attribute__nonnull__(pTHX_1) __attribute__nonnull__(pTHX_3); #define PERL_ARGS_ASSERT_REGUNI \ assert(pRExC_state); assert(s) -STATIC char * S_regwhite(struct RExC_state_t *pRExC_state, char *p) +STATIC char * S_regwhite(RExC_state_t *pRExC_state, char *p) __attribute__warn_unused_result__ __attribute__nonnull__(1) __attribute__nonnull__(2); #define PERL_ARGS_ASSERT_REGWHITE \ assert(pRExC_state); assert(p) -STATIC void S_scan_commit(pTHX_ const struct RExC_state_t *pRExC_state, struct scan_data_t *data, I32 *minlenp, int is_inf) +STATIC void S_scan_commit(pTHX_ const RExC_state_t *pRExC_state, struct scan_data_t *data, SSize_t *minlenp, int is_inf) __attribute__nonnull__(pTHX_1) __attribute__nonnull__(pTHX_2) __attribute__nonnull__(pTHX_3); #define PERL_ARGS_ASSERT_SCAN_COMMIT \ assert(pRExC_state); assert(data); assert(minlenp) -STATIC I32 S_study_chunk(pTHX_ struct RExC_state_t *pRExC_state, regnode **scanp, I32 *minlenp, I32 *deltap, regnode *last, struct scan_data_t *data, I32 stopparen, U8* recursed, struct regnode_charclass_class *and_withp, U32 flags, U32 depth) +STATIC void S_set_ANYOF_arg(pTHX_ RExC_state_t* const pRExC_state, regnode* const node, SV* const cp_list, SV* const runtime_defns, SV* const only_utf8_locale_list, SV* const swash, const bool has_user_defined_property) + __attribute__nonnull__(pTHX_1) + __attribute__nonnull__(pTHX_2); +#define PERL_ARGS_ASSERT_SET_ANYOF_ARG \ + assert(pRExC_state); assert(node) + +PERL_STATIC_INLINE void S_ssc_add_range(pTHX_ regnode_ssc *ssc, UV const start, UV const end) + __attribute__nonnull__(pTHX_1); +#define PERL_ARGS_ASSERT_SSC_ADD_RANGE \ + assert(ssc) + +STATIC void S_ssc_and(pTHX_ const RExC_state_t *pRExC_state, regnode_ssc *ssc, const regnode_charclass *and_with) + __attribute__nonnull__(pTHX_1) + __attribute__nonnull__(pTHX_2) + __attribute__nonnull__(pTHX_3); +#define PERL_ARGS_ASSERT_SSC_AND \ + assert(pRExC_state); assert(ssc); assert(and_with) + +STATIC void S_ssc_anything(pTHX_ regnode_ssc *ssc) + __attribute__nonnull__(pTHX_1); +#define PERL_ARGS_ASSERT_SSC_ANYTHING \ + assert(ssc) + +PERL_STATIC_INLINE void S_ssc_clear_locale(pTHX_ regnode_ssc *ssc) + __attribute__nonnull__(pTHX_1); +#define PERL_ARGS_ASSERT_SSC_CLEAR_LOCALE \ + assert(ssc) + +PERL_STATIC_INLINE void S_ssc_cp_and(pTHX_ regnode_ssc *ssc, UV const cp) + __attribute__nonnull__(pTHX_1); +#define PERL_ARGS_ASSERT_SSC_CP_AND \ + assert(ssc) + +STATIC void S_ssc_finalize(pTHX_ RExC_state_t *pRExC_state, regnode_ssc *ssc) + __attribute__nonnull__(pTHX_1) + __attribute__nonnull__(pTHX_2); +#define PERL_ARGS_ASSERT_SSC_FINALIZE \ + assert(pRExC_state); assert(ssc) + +STATIC void S_ssc_init(pTHX_ const RExC_state_t *pRExC_state, regnode_ssc *ssc) + __attribute__nonnull__(pTHX_1) + __attribute__nonnull__(pTHX_2); +#define PERL_ARGS_ASSERT_SSC_INIT \ + assert(pRExC_state); assert(ssc) + +PERL_STATIC_INLINE void S_ssc_intersection(pTHX_ regnode_ssc *ssc, SV* const invlist, const bool invert_2nd) + __attribute__nonnull__(pTHX_1) + __attribute__nonnull__(pTHX_2); +#define PERL_ARGS_ASSERT_SSC_INTERSECTION \ + assert(ssc); assert(invlist) + +STATIC int S_ssc_is_anything(pTHX_ const regnode_ssc *ssc) + __attribute__warn_unused_result__ + __attribute__nonnull__(pTHX_1); +#define PERL_ARGS_ASSERT_SSC_IS_ANYTHING \ + assert(ssc) + +STATIC int S_ssc_is_cp_posixl_init(pTHX_ const RExC_state_t *pRExC_state, const regnode_ssc *ssc) + __attribute__warn_unused_result__ + __attribute__nonnull__(pTHX_1) + __attribute__nonnull__(pTHX_2); +#define PERL_ARGS_ASSERT_SSC_IS_CP_POSIXL_INIT \ + assert(pRExC_state); assert(ssc) + +STATIC void S_ssc_or(pTHX_ const RExC_state_t *pRExC_state, regnode_ssc *ssc, const regnode_charclass *or_with) + __attribute__nonnull__(pTHX_1) + __attribute__nonnull__(pTHX_2) + __attribute__nonnull__(pTHX_3); +#define PERL_ARGS_ASSERT_SSC_OR \ + assert(pRExC_state); assert(ssc); assert(or_with) + +PERL_STATIC_INLINE void S_ssc_union(pTHX_ regnode_ssc *ssc, SV* const invlist, const bool invert_2nd) + __attribute__nonnull__(pTHX_1) + __attribute__nonnull__(pTHX_2); +#define PERL_ARGS_ASSERT_SSC_UNION \ + assert(ssc); assert(invlist) + +STATIC SSize_t S_study_chunk(pTHX_ RExC_state_t *pRExC_state, regnode **scanp, SSize_t *minlenp, SSize_t *deltap, regnode *last, struct scan_data_t *data, I32 stopparen, U32 recursed_depth, regnode_ssc *and_withp, U32 flags, U32 depth) __attribute__nonnull__(pTHX_1) __attribute__nonnull__(pTHX_2) __attribute__nonnull__(pTHX_3) @@ -6759,13 +7003,31 @@ STATIC I32 S_study_chunk(pTHX_ struct RE assert(pRExC_state); assert(scanp); assert(minlenp); assert(deltap); assert(last) #endif -#if defined(PERL_IN_REGCOMP_C) || defined(PERL_IN_REGEXEC_C) || defined(PERL_IN_UTF8_C) -PERL_STATIC_INLINE UV* S__get_invlist_len_addr(pTHX_ SV* invlist) +#if defined(PERL_IN_REGCOMP_C) || defined (PERL_IN_DUMP_C) +PERL_CALLCONV void Perl__invlist_dump(pTHX_ PerlIO *file, I32 level, const char* const indent, SV* const invlist) + __attribute__nonnull__(pTHX_1) + __attribute__nonnull__(pTHX_3) + __attribute__nonnull__(pTHX_4); +#define PERL_ARGS_ASSERT__INVLIST_DUMP \ + assert(file); assert(indent); assert(invlist) + +#endif +#if defined(PERL_IN_REGCOMP_C) || defined(PERL_IN_PERL_C) || defined(PERL_IN_UTF8_C) +PERL_CALLCONV SV* Perl__new_invlist_C_array(pTHX_ const UV* const list) __attribute__warn_unused_result__ __attribute__nonnull__(pTHX_1); -#define PERL_ARGS_ASSERT__GET_INVLIST_LEN_ADDR \ - assert(invlist) +#define PERL_ARGS_ASSERT__NEW_INVLIST_C_ARRAY \ + assert(list) + +#endif +#if defined(PERL_IN_REGCOMP_C) || defined(PERL_IN_REGEXEC_C) +PERL_CALLCONV SV* Perl__get_regclass_nonbitmap_data(pTHX_ const regexp *prog, const struct regnode *node, bool doinit, SV **listsvp, SV **lonly_utf8_locale) + __attribute__nonnull__(pTHX_2); +#define PERL_ARGS_ASSERT__GET_REGCLASS_NONBITMAP_DATA \ + assert(node) +#endif +#if defined(PERL_IN_REGCOMP_C) || defined(PERL_IN_REGEXEC_C) || defined(PERL_IN_UTF8_C) PERL_CALLCONV SV* Perl__get_swash_invlist(pTHX_ SV* const swash) __attribute__warn_unused_result__ __attribute__nonnull__(pTHX_1); @@ -6802,6 +7064,12 @@ PERL_CALLCONV HV* Perl__swash_inversion_ #define PERL_ARGS_ASSERT__SWASH_INVERSION_HASH \ assert(swash) +PERL_STATIC_INLINE bool* S_get_invlist_offset_addr(pTHX_ SV* invlist) + __attribute__warn_unused_result__ + __attribute__nonnull__(pTHX_1); +#define PERL_ARGS_ASSERT_GET_INVLIST_OFFSET_ADDR \ + assert(invlist) + #endif #if defined(PERL_IN_REGCOMP_C) || defined(PERL_IN_REGEXEC_C) || defined(PERL_IN_UTF8_C) || defined(PERL_IN_TOKE_C) PERL_CALLCONV SV* Perl__core_swash_init(pTHX_ const char* pkg, const char* name, SV* listsv, I32 minbits, I32 none, SV* invlist, U8* const flags_p) @@ -6820,7 +7088,7 @@ STATIC char* S_form_short_octal_warning( #define PERL_ARGS_ASSERT_FORM_SHORT_OCTAL_WARNING \ assert(s) -STATIC char S_grok_bslash_c(pTHX_ const char source, const bool utf8, const bool output_warning) +STATIC char S_grok_bslash_c(pTHX_ const char source, const bool output_warning) __attribute__warn_unused_result__; STATIC bool S_grok_bslash_o(pTHX_ char** s, UV* uv, const char** error_msg, const bool output_warning, const bool strict, const bool silence_non_portable, const bool utf8) @@ -6856,7 +7124,7 @@ PERL_CALLCONV SV* Perl__add_range_to_inv __attribute__nonnull__(pTHX_2) __attribute__nonnull__(pTHX_3); */ -PERL_CALLCONV void Perl__invlist_intersection_maybe_complement_2nd(pTHX_ SV* const a, SV* const b, bool complement_b, SV** i) +PERL_CALLCONV void Perl__invlist_intersection_maybe_complement_2nd(pTHX_ SV* const a, SV* const b, const bool complement_b, SV** i) __attribute__nonnull__(pTHX_2) __attribute__nonnull__(pTHX_4); #define PERL_ARGS_ASSERT__INVLIST_INTERSECTION_MAYBE_COMPLEMENT_2ND \ @@ -6867,11 +7135,6 @@ PERL_CALLCONV void Perl__invlist_invert( #define PERL_ARGS_ASSERT__INVLIST_INVERT \ assert(invlist) -PERL_CALLCONV void Perl__invlist_invert_prop(pTHX_ SV* const invlist) - __attribute__nonnull__(pTHX_1); -#define PERL_ARGS_ASSERT__INVLIST_INVERT_PROP \ - assert(invlist) - PERL_CALLCONV void Perl__invlist_populate_swatch(pTHX_ SV* const invlist, const UV start, const UV end, U8* swatch) __attribute__nonnull__(pTHX_1) __attribute__nonnull__(pTHX_4); @@ -6887,7 +7150,7 @@ PERL_CALLCONV void Perl__invlist_populat __attribute__nonnull__(pTHX_2) __attribute__nonnull__(pTHX_3); */ -PERL_CALLCONV void Perl__invlist_union_maybe_complement_2nd(pTHX_ SV* const a, SV* const b, bool complement_b, SV** output) +PERL_CALLCONV void Perl__invlist_union_maybe_complement_2nd(pTHX_ SV* const a, SV* const b, const bool complement_b, SV** output) __attribute__nonnull__(pTHX_2) __attribute__nonnull__(pTHX_4); #define PERL_ARGS_ASSERT__INVLIST_UNION_MAYBE_COMPLEMENT_2ND \ @@ -6896,6 +7159,12 @@ PERL_CALLCONV void Perl__invlist_union_m PERL_CALLCONV SV* Perl__new_invlist(pTHX_ IV initial_size) __attribute__warn_unused_result__; +PERL_CALLCONV SV* Perl__setup_canned_invlist(pTHX_ const STRLEN size, const UV element0, UV** other_elements_ptr) + __attribute__warn_unused_result__ + __attribute__nonnull__(pTHX_3); +#define PERL_ARGS_ASSERT__SETUP_CANNED_INVLIST \ + assert(other_elements_ptr) + PERL_CALLCONV SV* Perl__swash_to_invlist(pTHX_ SV* const swash) __attribute__warn_unused_result__ __attribute__nonnull__(pTHX_1); @@ -6904,13 +7173,7 @@ PERL_CALLCONV SV* Perl__swash_to_invlist #endif #if defined(PERL_IN_REGEXEC_C) -STATIC SV* S_core_regclass_swash(pTHX_ const regexp *prog, const struct regnode *node, bool doinit, SV **listsvp) - __attribute__warn_unused_result__ - __attribute__nonnull__(pTHX_2); -#define PERL_ARGS_ASSERT_CORE_REGCLASS_SWASH \ - assert(node) - -STATIC char* S_find_byclass(pTHX_ regexp * prog, const regnode *c, char *s, const char *strend, regmatch_info *reginfo, bool is_utf_pat) +STATIC char* S_find_byclass(pTHX_ regexp * prog, const regnode *c, char *s, const char *strend, regmatch_info *reginfo) __attribute__warn_unused_result__ __attribute__nonnull__(pTHX_1) __attribute__nonnull__(pTHX_2) @@ -6946,28 +7209,37 @@ STATIC CHECKPOINT S_regcppush(pTHX_ cons #define PERL_ARGS_ASSERT_REGCPPUSH \ assert(rex) -STATIC U8* S_reghop3(U8 *s, I32 off, const U8 *lim) +STATIC U8* S_reghop3(U8 *s, SSize_t off, const U8 *lim) __attribute__warn_unused_result__ __attribute__nonnull__(1) __attribute__nonnull__(3); #define PERL_ARGS_ASSERT_REGHOP3 \ assert(s); assert(lim) -STATIC U8* S_reghopmaybe3(U8 *s, I32 off, const U8 *lim) +STATIC U8* S_reghop4(U8 *s, SSize_t off, const U8 *llim, const U8 *rlim) + __attribute__warn_unused_result__ + __attribute__nonnull__(1) + __attribute__nonnull__(3) + __attribute__nonnull__(4); +#define PERL_ARGS_ASSERT_REGHOP4 \ + assert(s); assert(llim); assert(rlim) + +STATIC U8* S_reghopmaybe3(U8 *s, SSize_t off, const U8 *lim) __attribute__warn_unused_result__ __attribute__nonnull__(1) __attribute__nonnull__(3); #define PERL_ARGS_ASSERT_REGHOPMAYBE3 \ assert(s); assert(lim) -STATIC bool S_reginclass(pTHX_ regexp * const prog, const regnode * const n, const U8 * const p, bool const utf8_target) +STATIC bool S_reginclass(pTHX_ regexp * const prog, const regnode * const n, const U8 * const p, const U8 * const p_end, bool const utf8_target) __attribute__warn_unused_result__ __attribute__nonnull__(pTHX_2) - __attribute__nonnull__(pTHX_3); + __attribute__nonnull__(pTHX_3) + __attribute__nonnull__(pTHX_4); #define PERL_ARGS_ASSERT_REGINCLASS \ - assert(n); assert(p) + assert(n); assert(p); assert(p_end) -STATIC I32 S_regmatch(pTHX_ regmatch_info *reginfo, char *startpos, regnode *prog) +STATIC SSize_t S_regmatch(pTHX_ regmatch_info *reginfo, char *startpos, regnode *prog) __attribute__warn_unused_result__ __attribute__nonnull__(pTHX_1) __attribute__nonnull__(pTHX_2) @@ -6975,13 +7247,14 @@ STATIC I32 S_regmatch(pTHX_ regmatch_inf #define PERL_ARGS_ASSERT_REGMATCH \ assert(reginfo); assert(startpos); assert(prog) -STATIC I32 S_regrepeat(pTHX_ regexp *prog, char **startposp, const regnode *p, I32 max, int depth, bool is_utf8_pat) +STATIC I32 S_regrepeat(pTHX_ regexp *prog, char **startposp, const regnode *p, regmatch_info *const reginfo, I32 max, int depth) __attribute__warn_unused_result__ __attribute__nonnull__(pTHX_1) __attribute__nonnull__(pTHX_2) - __attribute__nonnull__(pTHX_3); + __attribute__nonnull__(pTHX_3) + __attribute__nonnull__(pTHX_4); #define PERL_ARGS_ASSERT_REGREPEAT \ - assert(prog); assert(startposp); assert(p) + assert(prog); assert(startposp); assert(p); assert(reginfo) STATIC I32 S_regtry(pTHX_ regmatch_info *reginfo, char **startposp) __attribute__warn_unused_result__ @@ -7000,16 +7273,6 @@ STATIC void S_to_utf8_substr(pTHX_ regex #define PERL_ARGS_ASSERT_TO_UTF8_SUBSTR \ assert(prog) -# if defined(XXX_dmq) -STATIC U8* S_reghop4(U8 *s, I32 off, const U8 *llim, const U8 *rlim) - __attribute__warn_unused_result__ - __attribute__nonnull__(1) - __attribute__nonnull__(3) - __attribute__nonnull__(4); -#define PERL_ARGS_ASSERT_REGHOP4 \ - assert(s); assert(llim); assert(rlim) - -# endif #endif #if defined(PERL_IN_SCOPE_C) STATIC void S_save_pushptri32ptr(pTHX_ void *const ptr1, const I32 i, void *const ptr2, const int type); @@ -7233,7 +7496,7 @@ STATIC char* S_force_version(pTHX_ char #define PERL_ARGS_ASSERT_FORCE_VERSION \ assert(s) -STATIC char* S_force_word(pTHX_ char *start, int token, int check_keyword, int allow_pack, int allow_tick) +STATIC char* S_force_word(pTHX_ char *start, int token, int check_keyword, int allow_pack) __attribute__nonnull__(pTHX_1); #define PERL_ARGS_ASSERT_FORCE_WORD \ assert(start) @@ -7287,7 +7550,6 @@ STATIC void S_parse_ident(pTHX_ char **s assert(s); assert(d); assert(e) STATIC int S_pending_ident(pTHX); -STATIC void S_readpipe_override(pTHX); STATIC char* S_scan_const(pTHX_ char *start) __attribute__warn_unused_result__ __attribute__nonnull__(pTHX_1); @@ -7306,12 +7568,11 @@ STATIC char* S_scan_heredoc(pTHX_ char * #define PERL_ARGS_ASSERT_SCAN_HEREDOC \ assert(s) -STATIC char* S_scan_ident(pTHX_ char *s, const char *send, char *dest, STRLEN destlen, I32 ck_uni) +STATIC char* S_scan_ident(pTHX_ char *s, char *dest, STRLEN destlen, I32 ck_uni) __attribute__nonnull__(pTHX_1) - __attribute__nonnull__(pTHX_2) - __attribute__nonnull__(pTHX_3); + __attribute__nonnull__(pTHX_2); #define PERL_ARGS_ASSERT_SCAN_IDENT \ - assert(s); assert(send); assert(dest) + assert(s); assert(dest) STATIC char* S_scan_inputsymbol(pTHX_ char *start) __attribute__warn_unused_result__ @@ -7325,7 +7586,7 @@ STATIC char* S_scan_pat(pTHX_ char *star #define PERL_ARGS_ASSERT_SCAN_PAT \ assert(start) -STATIC char* S_scan_str(pTHX_ char *start, int keep_quoted, int keep_delims, int re_reparse, bool deprecate_escaped_matching) +STATIC char* S_scan_str(pTHX_ char *start, int keep_quoted, int keep_delims, int re_reparse, bool deprecate_escaped_matching, char **delimp) __attribute__warn_unused_result__ __attribute__nonnull__(pTHX_1); #define PERL_ARGS_ASSERT_SCAN_STR \ @@ -7350,10 +7611,10 @@ STATIC char* S_scan_word(pTHX_ char *s, #define PERL_ARGS_ASSERT_SCAN_WORD \ assert(s); assert(dest); assert(slp) -STATIC char* S_skipspace(pTHX_ char *s) +STATIC char* S_skipspace_flags(pTHX_ char *s, U32 flags) __attribute__warn_unused_result__ __attribute__nonnull__(pTHX_1); -#define PERL_ARGS_ASSERT_SKIPSPACE \ +#define PERL_ARGS_ASSERT_SKIPSPACE_FLAGS \ assert(s) STATIC I32 S_sublex_done(pTHX) @@ -7431,7 +7692,7 @@ PERL_STATIC_INLINE STRLEN S_is_utf8_char #define PERL_ARGS_ASSERT_IS_UTF8_CHAR_SLOW \ assert(s) -PERL_STATIC_INLINE bool S_is_utf8_common(pTHX_ const U8 *const p, SV **swash, const char * const swashname) +PERL_STATIC_INLINE bool S_is_utf8_common(pTHX_ const U8 *const p, SV **swash, const char * const swashname, SV* const invlist) __attribute__warn_unused_result__ __attribute__nonnull__(pTHX_1) __attribute__nonnull__(pTHX_2) @@ -7458,7 +7719,7 @@ PERL_CALLCONV UV Perl__to_upper_title_la #endif #if defined(PERL_IN_UTF8_C) || defined(PERL_IN_REGCOMP_C) || defined(PERL_IN_REGEXEC_C) -PERL_CALLCONV UV Perl__to_fold_latin1(pTHX_ const U8 c, U8 *p, STRLEN *lenp, const bool flags) +PERL_CALLCONV UV Perl__to_fold_latin1(pTHX_ const U8 c, U8 *p, STRLEN *lenp, const unsigned int flags) __attribute__nonnull__(pTHX_2) __attribute__nonnull__(pTHX_3); #define PERL_ARGS_ASSERT__TO_FOLD_LATIN1 \ @@ -7467,11 +7728,6 @@ PERL_CALLCONV UV Perl__to_fold_latin1(pT #endif #if defined(PERL_IN_UTIL_C) STATIC bool S_ckwarn_common(pTHX_ U32 w); -STATIC const COP* S_closest_cop(pTHX_ const COP *cop, const OP *o) - __attribute__nonnull__(pTHX_1); -#define PERL_ARGS_ASSERT_CLOSEST_COP \ - assert(cop) - STATIC bool S_invoke_exception_hook(pTHX_ SV *ex, bool warn); STATIC SV* S_mess_alloc(pTHX); STATIC SV * S_with_queued_errors(pTHX_ SV *ex) @@ -7612,78 +7868,6 @@ PERL_CALLCONV void Perl_xmldump_vindent( assert(file); assert(pat) #endif -#if defined(PERL_NEED_MY_BETOH16) -PERL_CALLCONV U16 Perl_my_betoh16(U16 n); -#endif -#if defined(PERL_NEED_MY_BETOH32) -PERL_CALLCONV U32 Perl_my_betoh32(U32 n); -#endif -#if defined(PERL_NEED_MY_BETOH64) -PERL_CALLCONV U64 Perl_my_betoh64(U64 n); -#endif -#if defined(PERL_NEED_MY_BETOHI) -PERL_CALLCONV int Perl_my_betohi(int n); -#endif -#if defined(PERL_NEED_MY_BETOHL) -PERL_CALLCONV long Perl_my_betohl(long n); -#endif -#if defined(PERL_NEED_MY_BETOHS) -PERL_CALLCONV short Perl_my_betohs(short n); -#endif -#if defined(PERL_NEED_MY_HTOBE16) -PERL_CALLCONV U16 Perl_my_htobe16(U16 n); -#endif -#if defined(PERL_NEED_MY_HTOBE32) -PERL_CALLCONV U32 Perl_my_htobe32(U32 n); -#endif -#if defined(PERL_NEED_MY_HTOBE64) -PERL_CALLCONV U64 Perl_my_htobe64(U64 n); -#endif -#if defined(PERL_NEED_MY_HTOBEI) -PERL_CALLCONV int Perl_my_htobei(int n); -#endif -#if defined(PERL_NEED_MY_HTOBEL) -PERL_CALLCONV long Perl_my_htobel(long n); -#endif -#if defined(PERL_NEED_MY_HTOBES) -PERL_CALLCONV short Perl_my_htobes(short n); -#endif -#if defined(PERL_NEED_MY_HTOLE16) -PERL_CALLCONV U16 Perl_my_htole16(U16 n); -#endif -#if defined(PERL_NEED_MY_HTOLE32) -PERL_CALLCONV U32 Perl_my_htole32(U32 n); -#endif -#if defined(PERL_NEED_MY_HTOLE64) -PERL_CALLCONV U64 Perl_my_htole64(U64 n); -#endif -#if defined(PERL_NEED_MY_HTOLEI) -PERL_CALLCONV int Perl_my_htolei(int n); -#endif -#if defined(PERL_NEED_MY_HTOLEL) -PERL_CALLCONV long Perl_my_htolel(long n); -#endif -#if defined(PERL_NEED_MY_HTOLES) -PERL_CALLCONV short Perl_my_htoles(short n); -#endif -#if defined(PERL_NEED_MY_LETOH16) -PERL_CALLCONV U16 Perl_my_letoh16(U16 n); -#endif -#if defined(PERL_NEED_MY_LETOH32) -PERL_CALLCONV U32 Perl_my_letoh32(U32 n); -#endif -#if defined(PERL_NEED_MY_LETOH64) -PERL_CALLCONV U64 Perl_my_letoh64(U64 n); -#endif -#if defined(PERL_NEED_MY_LETOHI) -PERL_CALLCONV int Perl_my_letohi(int n); -#endif -#if defined(PERL_NEED_MY_LETOHL) -PERL_CALLCONV long Perl_my_letohl(long n); -#endif -#if defined(PERL_NEED_MY_LETOHS) -PERL_CALLCONV short Perl_my_letohs(short n); -#endif #if defined(PERL_USES_PL_PIDSTATUS) && defined(PERL_IN_UTIL_C) STATIC void S_pidgone(pTHX_ Pid_t pid, int status); #endif @@ -7860,7 +8044,7 @@ PERL_CALLCONV char* Perl_sv_collxfrm_fla assert(sv); assert(nxp) #endif -#if defined(USE_PERLIO) && !defined(USE_SFIO) +#if defined(USE_PERLIO) PERL_CALLCONV void Perl_PerlIO_clearerr(pTHX_ PerlIO *f); PERL_CALLCONV int Perl_PerlIO_close(pTHX_ PerlIO *f); PERL_CALLCONV int Perl_PerlIO_eof(pTHX_ PerlIO *f); @@ -7869,10 +8053,10 @@ PERL_CALLCONV int Perl_PerlIO_fileno(pTH PERL_CALLCONV int Perl_PerlIO_fill(pTHX_ PerlIO *f); PERL_CALLCONV int Perl_PerlIO_flush(pTHX_ PerlIO *f); PERL_CALLCONV STDCHAR * Perl_PerlIO_get_base(pTHX_ PerlIO *f); -PERL_CALLCONV int Perl_PerlIO_get_bufsiz(pTHX_ PerlIO *f) +PERL_CALLCONV SSize_t Perl_PerlIO_get_bufsiz(pTHX_ PerlIO *f) __attribute__warn_unused_result__; -PERL_CALLCONV int Perl_PerlIO_get_cnt(pTHX_ PerlIO *f) +PERL_CALLCONV SSize_t Perl_PerlIO_get_cnt(pTHX_ PerlIO *f) __attribute__warn_unused_result__; PERL_CALLCONV STDCHAR * Perl_PerlIO_get_ptr(pTHX_ PerlIO *f); @@ -7882,8 +8066,8 @@ PERL_CALLCONV SSize_t Perl_PerlIO_read(p assert(vbuf) PERL_CALLCONV int Perl_PerlIO_seek(pTHX_ PerlIO *f, Off_t offset, int whence); -PERL_CALLCONV void Perl_PerlIO_set_cnt(pTHX_ PerlIO *f, int cnt); -PERL_CALLCONV void Perl_PerlIO_set_ptrcnt(pTHX_ PerlIO *f, STDCHAR *ptr, int cnt); +PERL_CALLCONV void Perl_PerlIO_set_cnt(pTHX_ PerlIO *f, SSize_t cnt); +PERL_CALLCONV void Perl_PerlIO_set_ptrcnt(pTHX_ PerlIO *f, STDCHAR *ptr, SSize_t cnt); PERL_CALLCONV void Perl_PerlIO_setlinebuf(pTHX_ PerlIO *f); PERL_CALLCONV PerlIO * Perl_PerlIO_stderr(pTHX) __attribute__warn_unused_result__; @@ -7907,6 +8091,9 @@ PERL_CALLCONV SSize_t Perl_PerlIO_write( #endif #if defined(WIN32) +PERL_CALLCONV char* Perl_my_setlocale(pTHX_ int category, const char* locale) + __attribute__pure__; + PERL_CALLCONV_NO_RET void win32_croak_not_implemented(const char * fname) __attribute__noreturn__ __attribute__nonnull__(1); Index: gnu/usr.bin/perl/reentr.c =================================================================== RCS file: /mnt/memory/perl/importit/cvs/src/gnu/usr.bin/perl/reentr.c,v retrieving revision 1.1.1.9 diff -u -p -u -p -r1.1.1.9 reentr.c --- gnu/usr.bin/perl/reentr.c 24 Mar 2014 14:58:47 -0000 1.1.1.9 +++ gnu/usr.bin/perl/reentr.c 16 Nov 2014 03:22:24 -0000 @@ -40,8 +40,6 @@ Perl_reentrant_size(pTHX) { #ifdef HAS_CTIME_R PL_reentrant_buffer->_ctime_size = REENTRANTSMALLSIZE; #endif /* HAS_CTIME_R */ -#ifdef HAS_DRAND48_R -#endif /* HAS_DRAND48_R */ #ifdef HAS_GETGRNAM_R # if defined(HAS_SYSCONF) && defined(_SC_GETGR_R_SIZE_MAX) && !defined(__GLIBC__) PL_reentrant_buffer->_grent_size = sysconf(_SC_GETGR_R_SIZE_MAX); @@ -116,8 +114,6 @@ Perl_reentrant_size(pTHX) { # endif # endif #endif /* HAS_GETSPNAM_R */ -#ifdef HAS_RANDOM_R -#endif /* HAS_RANDOM_R */ #ifdef HAS_READDIR_R /* This is the size Solaris recommends. * (though we go static, should use pathconf() instead) */ @@ -131,8 +127,6 @@ Perl_reentrant_size(pTHX) { #ifdef HAS_SETLOCALE_R PL_reentrant_buffer->_setlocale_size = REENTRANTSMALLSIZE; #endif /* HAS_SETLOCALE_R */ -#ifdef HAS_SRANDOM_R -#endif /* HAS_SRANDOM_R */ #ifdef HAS_STRERROR_R PL_reentrant_buffer->_strerror_size = REENTRANTSMALLSIZE; #endif /* HAS_STRERROR_R */ @@ -159,8 +153,6 @@ Perl_reentrant_init(pTHX) { #ifdef HAS_CTIME_R Newx(PL_reentrant_buffer->_ctime_buffer, PL_reentrant_buffer->_ctime_size, char); #endif /* HAS_CTIME_R */ -#ifdef HAS_DRAND48_R -#endif /* HAS_DRAND48_R */ #ifdef HAS_GETGRNAM_R # ifdef USE_GRENT_FPTR PL_reentrant_buffer->_grent_fptr = NULL; @@ -202,8 +194,6 @@ Perl_reentrant_init(pTHX) { # endif Newx(PL_reentrant_buffer->_spent_buffer, PL_reentrant_buffer->_spent_size, char); #endif /* HAS_GETSPNAM_R */ -#ifdef HAS_RANDOM_R -#endif /* HAS_RANDOM_R */ #ifdef HAS_READDIR_R PL_reentrant_buffer->_readdir_struct = (struct dirent*)safemalloc(PL_reentrant_buffer->_readdir_size); #endif /* HAS_READDIR_R */ @@ -213,8 +203,6 @@ Perl_reentrant_init(pTHX) { #ifdef HAS_SETLOCALE_R Newx(PL_reentrant_buffer->_setlocale_buffer, PL_reentrant_buffer->_setlocale_size, char); #endif /* HAS_SETLOCALE_R */ -#ifdef HAS_SRANDOM_R -#endif /* HAS_SRANDOM_R */ #ifdef HAS_STRERROR_R Newx(PL_reentrant_buffer->_strerror_buffer, PL_reentrant_buffer->_strerror_size, char); #endif /* HAS_STRERROR_R */ @@ -239,8 +227,6 @@ Perl_reentrant_free(pTHX) { #ifdef HAS_CTIME_R Safefree(PL_reentrant_buffer->_ctime_buffer); #endif /* HAS_CTIME_R */ -#ifdef HAS_DRAND48_R -#endif /* HAS_DRAND48_R */ #ifdef HAS_GETGRNAM_R Safefree(PL_reentrant_buffer->_grent_buffer); #endif /* HAS_GETGRNAM_R */ @@ -273,8 +259,6 @@ Perl_reentrant_free(pTHX) { #ifdef HAS_GETSPNAM_R Safefree(PL_reentrant_buffer->_spent_buffer); #endif /* HAS_GETSPNAM_R */ -#ifdef HAS_RANDOM_R -#endif /* HAS_RANDOM_R */ #ifdef HAS_READDIR_R Safefree(PL_reentrant_buffer->_readdir_struct); #endif /* HAS_READDIR_R */ @@ -284,8 +268,6 @@ Perl_reentrant_free(pTHX) { #ifdef HAS_SETLOCALE_R Safefree(PL_reentrant_buffer->_setlocale_buffer); #endif /* HAS_SETLOCALE_R */ -#ifdef HAS_SRANDOM_R -#endif /* HAS_SRANDOM_R */ #ifdef HAS_STRERROR_R Safefree(PL_reentrant_buffer->_strerror_buffer); #endif /* HAS_STRERROR_R */ @@ -449,8 +431,10 @@ Perl_reentrant_retry(const char *f, ...) uid = va_arg(ap, Uid_t); #endif retptr = getpwuid(uid); break; +#if defined(HAS_GETPWENT) || defined(HAS_GETPWENT_R) case OP_GPWENT: retptr = getpwent(); break; +#endif default: SETERRNO(ERANGE, LIB_INVARG); break; Index: gnu/usr.bin/perl/reentr.h =================================================================== RCS file: /mnt/memory/perl/importit/cvs/src/gnu/usr.bin/perl/reentr.h,v retrieving revision 1.1.1.8 diff -u -p -u -p -r1.1.1.8 reentr.h --- gnu/usr.bin/perl/reentr.h 25 Mar 2013 20:06:37 -0000 1.1.1.8 +++ gnu/usr.bin/perl/reentr.h 16 Nov 2014 03:22:24 -0000 @@ -41,13 +41,11 @@ #ifdef __hpux # undef HAS_CRYPT_R -# undef HAS_DRAND48_R # undef HAS_ENDGRENT_R # undef HAS_ENDPWENT_R # undef HAS_GETGRENT_R # undef HAS_GETPWENT_R # undef HAS_SETLOCALE_R -# undef HAS_SRAND48_R # undef HAS_STRERROR_R # define NETDB_R_OBSOLETE #endif @@ -101,9 +99,6 @@ #ifdef I_NETDB # include #endif -#ifdef I_STDLIB -# include /* drand48_data */ -#endif #ifdef I_CRYPT # ifdef I_CRYPT # include @@ -150,48 +145,43 @@ #define REENTRANT_PROTO_I_ISD 33 #define REENTRANT_PROTO_I_LISBI 34 #define REENTRANT_PROTO_I_LISD 35 -#define REENTRANT_PROTO_I_LS 36 -#define REENTRANT_PROTO_I_SB 37 -#define REENTRANT_PROTO_I_SBI 38 -#define REENTRANT_PROTO_I_SBIE 39 -#define REENTRANT_PROTO_I_SBIH 40 -#define REENTRANT_PROTO_I_SBIR 41 -#define REENTRANT_PROTO_I_SBWR 42 -#define REENTRANT_PROTO_I_SBWRE 43 -#define REENTRANT_PROTO_I_SD 44 -#define REENTRANT_PROTO_I_ST 45 -#define REENTRANT_PROTO_I_St 46 -#define REENTRANT_PROTO_I_TISD 47 -#define REENTRANT_PROTO_I_TS 48 -#define REENTRANT_PROTO_I_TSBI 49 -#define REENTRANT_PROTO_I_TSBIR 50 -#define REENTRANT_PROTO_I_TSBWR 51 -#define REENTRANT_PROTO_I_TSR 52 -#define REENTRANT_PROTO_I_TsISBWRE 53 -#define REENTRANT_PROTO_I_UISBWRE 54 -#define REENTRANT_PROTO_I_iS 55 -#define REENTRANT_PROTO_I_lS 56 -#define REENTRANT_PROTO_I_uISBWRE 57 -#define REENTRANT_PROTO_S_CBI 58 -#define REENTRANT_PROTO_S_CCSBI 59 -#define REENTRANT_PROTO_S_CIISBIE 60 -#define REENTRANT_PROTO_S_CSBI 61 -#define REENTRANT_PROTO_S_CSBIE 62 -#define REENTRANT_PROTO_S_CWISBIE 63 -#define REENTRANT_PROTO_S_CWISBWIE 64 -#define REENTRANT_PROTO_S_ICSBI 65 -#define REENTRANT_PROTO_S_ISBI 66 -#define REENTRANT_PROTO_S_LISBI 67 -#define REENTRANT_PROTO_S_SBI 68 -#define REENTRANT_PROTO_S_SBIE 69 -#define REENTRANT_PROTO_S_SBW 70 -#define REENTRANT_PROTO_S_TISBI 71 -#define REENTRANT_PROTO_S_TSBI 72 -#define REENTRANT_PROTO_S_TSBIE 73 -#define REENTRANT_PROTO_S_TWISBIE 74 -#define REENTRANT_PROTO_V_D 75 -#define REENTRANT_PROTO_V_H 76 -#define REENTRANT_PROTO_V_ID 77 +#define REENTRANT_PROTO_I_SB 36 +#define REENTRANT_PROTO_I_SBI 37 +#define REENTRANT_PROTO_I_SBIE 38 +#define REENTRANT_PROTO_I_SBIH 39 +#define REENTRANT_PROTO_I_SBIR 40 +#define REENTRANT_PROTO_I_SBWR 41 +#define REENTRANT_PROTO_I_SBWRE 42 +#define REENTRANT_PROTO_I_SD 43 +#define REENTRANT_PROTO_I_TISD 44 +#define REENTRANT_PROTO_I_TS 45 +#define REENTRANT_PROTO_I_TSBI 46 +#define REENTRANT_PROTO_I_TSBIR 47 +#define REENTRANT_PROTO_I_TSBWR 48 +#define REENTRANT_PROTO_I_TSR 49 +#define REENTRANT_PROTO_I_TsISBWRE 50 +#define REENTRANT_PROTO_I_UISBWRE 51 +#define REENTRANT_PROTO_I_uISBWRE 52 +#define REENTRANT_PROTO_S_CBI 53 +#define REENTRANT_PROTO_S_CCSBI 54 +#define REENTRANT_PROTO_S_CIISBIE 55 +#define REENTRANT_PROTO_S_CSBI 56 +#define REENTRANT_PROTO_S_CSBIE 57 +#define REENTRANT_PROTO_S_CWISBIE 58 +#define REENTRANT_PROTO_S_CWISBWIE 59 +#define REENTRANT_PROTO_S_ICSBI 60 +#define REENTRANT_PROTO_S_ISBI 61 +#define REENTRANT_PROTO_S_LISBI 62 +#define REENTRANT_PROTO_S_SBI 63 +#define REENTRANT_PROTO_S_SBIE 64 +#define REENTRANT_PROTO_S_SBW 65 +#define REENTRANT_PROTO_S_TISBI 66 +#define REENTRANT_PROTO_S_TSBI 67 +#define REENTRANT_PROTO_S_TSBIE 68 +#define REENTRANT_PROTO_S_TWISBIE 69 +#define REENTRANT_PROTO_V_D 70 +#define REENTRANT_PROTO_V_H 71 +#define REENTRANT_PROTO_V_ID 72 /* Defines for indicating which special features are supported. */ @@ -639,10 +629,6 @@ typedef struct { char* _ctime_buffer; size_t _ctime_size; #endif /* HAS_CTIME_R */ -#ifdef HAS_DRAND48_R - struct drand48_data _drand48_struct; - double _drand48_double; -#endif /* HAS_DRAND48_R */ #ifdef HAS_GETGRNAM_R struct group _grent_struct; char* _grent_buffer; @@ -740,18 +726,6 @@ typedef struct { FILE* _spent_fptr; # endif #endif /* HAS_GETSPNAM_R */ -#ifdef HAS_RANDOM_R - struct random_data _random_struct; -# if RANDOM_R_PROTO == REENTRANT_PROTO_I_iS - int _random_retval; -# endif -# if RANDOM_R_PROTO == REENTRANT_PROTO_I_lS - long _random_retval; -# endif -# if RANDOM_R_PROTO == REENTRANT_PROTO_I_St - int32_t _random_retval; -# endif -#endif /* HAS_RANDOM_R */ #ifdef HAS_READDIR_R struct dirent* _readdir_struct; size_t _readdir_size; @@ -770,9 +744,6 @@ typedef struct { char* _setlocale_buffer; size_t _setlocale_size; #endif /* HAS_SETLOCALE_R */ -#ifdef HAS_SRANDOM_R - struct random_data _srandom_struct; -#endif /* HAS_SRANDOM_R */ #ifdef HAS_STRERROR_R char* _strerror_buffer; size_t _strerror_size; @@ -844,15 +815,6 @@ typedef struct { # endif #endif /* HAS_CTIME_R */ -#ifdef HAS_DRAND48_R -# if defined(PERL_REENTR_API) && (PERL_REENTR_API+0 == 1) -# undef drand48 -# if !defined(drand48) && DRAND48_R_PROTO == REENTRANT_PROTO_I_ST -# define drand48() (drand48_r(&PL_reentrant_buffer->_drand48_struct, &PL_reentrant_buffer->_drand48_double) == 0 ? PL_reentrant_buffer->_drand48_double : 0) -# endif -# endif -#endif /* HAS_DRAND48_R */ - #ifdef HAS_ENDGRENT_R # if defined(PERL_REENTR_API) && (PERL_REENTR_API+0 == 1) # undef endgrent @@ -1324,21 +1286,6 @@ typedef struct { # endif #endif /* HAS_GETSPNAM_R */ -#ifdef HAS_RANDOM_R -# if defined(PERL_REENTR_API) && (PERL_REENTR_API+0 == 1) -# undef random -# if !defined(random) && RANDOM_R_PROTO == REENTRANT_PROTO_I_iS -# define random() (random_r(&PL_reentrant_buffer->_random_retval, &PL_reentrant_buffer->_random_struct) == 0 ? PL_reentrant_buffer->_random_retval : 0) -# endif -# if !defined(random) && RANDOM_R_PROTO == REENTRANT_PROTO_I_lS -# define random() (random_r(&PL_reentrant_buffer->_random_retval, &PL_reentrant_buffer->_random_struct) == 0 ? PL_reentrant_buffer->_random_retval : 0) -# endif -# if !defined(random) && RANDOM_R_PROTO == REENTRANT_PROTO_I_St -# define random() (random_r(&PL_reentrant_buffer->_random_struct, &PL_reentrant_buffer->_random_retval) == 0 ? PL_reentrant_buffer->_random_retval : 0) -# endif -# endif -#endif /* HAS_RANDOM_R */ - #ifdef HAS_READDIR_R # if defined(PERL_REENTR_API) && (PERL_REENTR_API+0 == 1) # undef readdir @@ -1443,24 +1390,6 @@ typedef struct { # endif # endif #endif /* HAS_SETSERVENT_R */ - -#ifdef HAS_SRAND48_R -# if defined(PERL_REENTR_API) && (PERL_REENTR_API+0 == 1) -# undef srand48 -# if !defined(srand48) && SRAND48_R_PROTO == REENTRANT_PROTO_I_LS -# define srand48(a) (srand48_r(a, &PL_reentrant_buffer->_drand48_struct) == 0 ? &PL_reentrant_buffer->_drand48_struct : 0) -# endif -# endif -#endif /* HAS_SRAND48_R */ - -#ifdef HAS_SRANDOM_R -# if defined(PERL_REENTR_API) && (PERL_REENTR_API+0 == 1) -# undef srandom -# if !defined(srandom) && SRANDOM_R_PROTO == REENTRANT_PROTO_I_TS -# define srandom(a) (srandom_r(a, &PL_reentrant_buffer->_srandom_struct) == 0 ? &PL_reentrant_buffer->_srandom_struct : 0) -# endif -# endif -#endif /* HAS_SRANDOM_R */ #ifdef HAS_STRERROR_R # if defined(PERL_REENTR_API) && (PERL_REENTR_API+0 == 1) Index: gnu/usr.bin/perl/regcharclass.h =================================================================== RCS file: /mnt/memory/perl/importit/cvs/src/gnu/usr.bin/perl/regcharclass.h,v retrieving revision 1.1.1.3 diff -u -p -u -p -r1.1.1.3 regcharclass.h --- gnu/usr.bin/perl/regcharclass.h 24 Mar 2014 14:58:47 -0000 1.1.1.3 +++ gnu/usr.bin/perl/regcharclass.h 16 Nov 2014 03:22:24 -0000 @@ -10,6 +10,8 @@ * !!!!!!! DO NOT EDIT THIS FILE !!!!!!! * This file is built by regen/regcharclass.pl. * Any changes made here will be lost! + * WARNING: These macros are for internal Perl core use only, and may be + * changed or removed without notice. */ @@ -23,84 +25,57 @@ \p{VertSpace} */ /*** GENERATED CODE ***/ -#define is_LNBREAK(s,is_utf8) \ -( ( 0x0A <= ((U8*)s)[0] && ((U8*)s)[0] <= 0x0C ) ? 1 \ -: ( 0x0D == ((U8*)s)[0] ) ? \ - ( ( 0x0A == ((U8*)s)[1] ) ? 2 : 1 ) \ -: ( is_utf8 ) ? \ - ( ( 0xC2 == ((U8*)s)[0] ) ? \ - ( ( 0x85 == ((U8*)s)[1] ) ? 2 : 0 ) \ - : ( ( ( 0xE2 == ((U8*)s)[0] ) && ( 0x80 == ((U8*)s)[1] ) ) && ( ( ((U8*)s)[2] & 0xFE ) == 0xA8 ) ) ? 3 : 0 )\ -: ( 0x85 == ((U8*)s)[0] ) ) - -/*** GENERATED CODE ***/ #define is_LNBREAK_safe(s,e,is_utf8) \ ( ((e)-(s) > 2) ? \ - ( ( 0x0A <= ((U8*)s)[0] && ((U8*)s)[0] <= 0x0C ) ? 1 \ - : ( 0x0D == ((U8*)s)[0] ) ? \ - ( ( 0x0A == ((U8*)s)[1] ) ? 2 : 1 ) \ + ( ( 0x0A <= NATIVE_TO_LATIN1(((U8*)s)[0]) && NATIVE_TO_LATIN1(((U8*)s)[0]) <= 0x0C ) ? 1\ + : ( 0x0D == NATIVE_TO_LATIN1(((U8*)s)[0]) ) ? \ + ( ( 0x0A == NATIVE_TO_LATIN1(((U8*)s)[1]) ) ? 2 : 1 ) \ : ( is_utf8 ) ? \ - ( ( 0xC2 == ((U8*)s)[0] ) ? \ - ( ( 0x85 == ((U8*)s)[1] ) ? 2 : 0 ) \ - : ( ( ( 0xE2 == ((U8*)s)[0] ) && ( 0x80 == ((U8*)s)[1] ) ) && ( ( ((U8*)s)[2] & 0xFE ) == 0xA8 ) ) ? 3 : 0 )\ - : ( 0x85 == ((U8*)s)[0] ) ) \ + ( ( 0xC2 == NATIVE_TO_LATIN1(((U8*)s)[0]) ) ? \ + ( ( 0x85 == NATIVE_TO_LATIN1(((U8*)s)[1]) ) ? 2 : 0 ) \ + : ( ( ( 0xE2 == NATIVE_TO_LATIN1(((U8*)s)[0]) ) && ( 0x80 == NATIVE_TO_LATIN1(((U8*)s)[1]) ) ) && ( ( NATIVE_TO_LATIN1(((U8*)s)[2]) & 0xFE ) == 0xA8 ) ) ? 3 : 0 )\ + : ( 0x85 == NATIVE_TO_LATIN1(((U8*)s)[0]) ) ) \ : ((e)-(s) > 1) ? \ - ( ( 0x0A <= ((U8*)s)[0] && ((U8*)s)[0] <= 0x0C ) ? 1 \ - : ( 0x0D == ((U8*)s)[0] ) ? \ - ( ( 0x0A == ((U8*)s)[1] ) ? 2 : 1 ) \ + ( ( 0x0A <= NATIVE_TO_LATIN1(((U8*)s)[0]) && NATIVE_TO_LATIN1(((U8*)s)[0]) <= 0x0C ) ? 1\ + : ( 0x0D == NATIVE_TO_LATIN1(((U8*)s)[0]) ) ? \ + ( ( 0x0A == NATIVE_TO_LATIN1(((U8*)s)[1]) ) ? 2 : 1 ) \ : ( is_utf8 ) ? \ - ( ( ( 0xC2 == ((U8*)s)[0] ) && ( 0x85 == ((U8*)s)[1] ) ) ? 2 : 0 ) \ - : ( 0x85 == ((U8*)s)[0] ) ) \ + ( ( ( 0xC2 == NATIVE_TO_LATIN1(((U8*)s)[0]) ) && ( 0x85 == NATIVE_TO_LATIN1(((U8*)s)[1]) ) ) ? 2 : 0 )\ + : ( 0x85 == NATIVE_TO_LATIN1(((U8*)s)[0]) ) ) \ : ((e)-(s) > 0) ? \ - ( ( 0x0A <= ((U8*)s)[0] && ((U8*)s)[0] <= 0x0D ) ? 1 \ + ( ( 0x0A <= NATIVE_TO_LATIN1(((U8*)s)[0]) && NATIVE_TO_LATIN1(((U8*)s)[0]) <= 0x0D ) ? 1\ : ( !( is_utf8 ) ) ? \ - ( 0x85 == ((U8*)s)[0] ) \ + ( 0x85 == NATIVE_TO_LATIN1(((U8*)s)[0]) ) \ : 0 ) \ : 0 ) /*** GENERATED CODE ***/ -#define is_LNBREAK_utf8(s) \ -( ( 0x0A <= ((U8*)s)[0] && ((U8*)s)[0] <= 0x0C ) ? 1 \ -: ( 0x0D == ((U8*)s)[0] ) ? \ - ( ( 0x0A == ((U8*)s)[1] ) ? 2 : 1 ) \ -: ( 0xC2 == ((U8*)s)[0] ) ? \ - ( ( 0x85 == ((U8*)s)[1] ) ? 2 : 0 ) \ -: ( ( ( 0xE2 == ((U8*)s)[0] ) && ( 0x80 == ((U8*)s)[1] ) ) && ( ( ((U8*)s)[2] & 0xFE ) == 0xA8 ) ) ? 3 : 0 ) - -/*** GENERATED CODE ***/ #define is_LNBREAK_utf8_safe(s,e) \ ( ((e)-(s) > 2) ? \ - ( ( 0x0A <= ((U8*)s)[0] && ((U8*)s)[0] <= 0x0C ) ? 1 \ - : ( 0x0D == ((U8*)s)[0] ) ? \ - ( ( 0x0A == ((U8*)s)[1] ) ? 2 : 1 ) \ - : ( 0xC2 == ((U8*)s)[0] ) ? \ - ( ( 0x85 == ((U8*)s)[1] ) ? 2 : 0 ) \ - : ( ( ( 0xE2 == ((U8*)s)[0] ) && ( 0x80 == ((U8*)s)[1] ) ) && ( ( ((U8*)s)[2] & 0xFE ) == 0xA8 ) ) ? 3 : 0 )\ + ( ( 0x0A <= NATIVE_TO_LATIN1(((U8*)s)[0]) && NATIVE_TO_LATIN1(((U8*)s)[0]) <= 0x0C ) ? 1\ + : ( 0x0D == NATIVE_TO_LATIN1(((U8*)s)[0]) ) ? \ + ( ( 0x0A == NATIVE_TO_LATIN1(((U8*)s)[1]) ) ? 2 : 1 ) \ + : ( 0xC2 == NATIVE_TO_LATIN1(((U8*)s)[0]) ) ? \ + ( ( 0x85 == NATIVE_TO_LATIN1(((U8*)s)[1]) ) ? 2 : 0 ) \ + : ( ( ( 0xE2 == NATIVE_TO_LATIN1(((U8*)s)[0]) ) && ( 0x80 == NATIVE_TO_LATIN1(((U8*)s)[1]) ) ) && ( ( NATIVE_TO_LATIN1(((U8*)s)[2]) & 0xFE ) == 0xA8 ) ) ? 3 : 0 )\ : ((e)-(s) > 1) ? \ - ( ( 0x0A <= ((U8*)s)[0] && ((U8*)s)[0] <= 0x0C ) ? 1 \ - : ( 0x0D == ((U8*)s)[0] ) ? \ - ( ( 0x0A == ((U8*)s)[1] ) ? 2 : 1 ) \ - : ( ( 0xC2 == ((U8*)s)[0] ) && ( 0x85 == ((U8*)s)[1] ) ) ? 2 : 0 ) \ + ( ( 0x0A <= NATIVE_TO_LATIN1(((U8*)s)[0]) && NATIVE_TO_LATIN1(((U8*)s)[0]) <= 0x0C ) ? 1\ + : ( 0x0D == NATIVE_TO_LATIN1(((U8*)s)[0]) ) ? \ + ( ( 0x0A == NATIVE_TO_LATIN1(((U8*)s)[1]) ) ? 2 : 1 ) \ + : ( ( 0xC2 == NATIVE_TO_LATIN1(((U8*)s)[0]) ) && ( 0x85 == NATIVE_TO_LATIN1(((U8*)s)[1]) ) ) ? 2 : 0 )\ : ((e)-(s) > 0) ? \ - ( 0x0A <= ((U8*)s)[0] && ((U8*)s)[0] <= 0x0D ) \ -: 0 ) - -/*** GENERATED CODE ***/ -#define is_LNBREAK_latin1(s) \ -( ( ( 0x0A <= ((U8*)s)[0] && ((U8*)s)[0] <= 0x0C ) || 0x85 == ((U8*)s)[0] ) ? 1\ -: ( 0x0D == ((U8*)s)[0] ) ? \ - ( ( 0x0A == ((U8*)s)[1] ) ? 2 : 1 ) \ + ( 0x0A <= NATIVE_TO_LATIN1(((U8*)s)[0]) && NATIVE_TO_LATIN1(((U8*)s)[0]) <= 0x0D )\ : 0 ) /*** GENERATED CODE ***/ #define is_LNBREAK_latin1_safe(s,e) \ ( ((e)-(s) > 1) ? \ - ( ( ( 0x0A <= ((U8*)s)[0] && ((U8*)s)[0] <= 0x0C ) || 0x85 == ((U8*)s)[0] ) ? 1\ - : ( 0x0D == ((U8*)s)[0] ) ? \ - ( ( 0x0A == ((U8*)s)[1] ) ? 2 : 1 ) \ + ( ( ( 0x0A <= NATIVE_TO_LATIN1(((U8*)s)[0]) && NATIVE_TO_LATIN1(((U8*)s)[0]) <= 0x0C ) || 0x85 == NATIVE_TO_LATIN1(((U8*)s)[0]) ) ? 1\ + : ( 0x0D == NATIVE_TO_LATIN1(((U8*)s)[0]) ) ? \ + ( ( 0x0A == NATIVE_TO_LATIN1(((U8*)s)[1]) ) ? 2 : 1 ) \ : 0 ) \ : ((e)-(s) > 0) ? \ - ( ( 0x0A <= ((U8*)s)[0] && ((U8*)s)[0] <= 0x0D ) || 0x85 == ((U8*)s)[0] )\ + ( ( 0x0A <= NATIVE_TO_LATIN1(((U8*)s)[0]) && NATIVE_TO_LATIN1(((U8*)s)[0]) <= 0x0D ) || 0x85 == NATIVE_TO_LATIN1(((U8*)s)[0]) )\ : 0 ) /* @@ -109,142 +84,21 @@ \p{HorizSpace} */ /*** GENERATED CODE ***/ -#define is_HORIZWS(s,is_utf8) \ -( ( 0x09 == ((U8*)s)[0] || 0x20 == ((U8*)s)[0] ) ? 1 \ -: ( is_utf8 ) ? \ - ( ( 0xC2 == ((U8*)s)[0] ) ? \ - ( ( 0xA0 == ((U8*)s)[1] ) ? 2 : 0 ) \ - : ( 0xE1 == ((U8*)s)[0] ) ? \ - ( ( 0x9A == ((U8*)s)[1] ) ? \ - ( ( 0x80 == ((U8*)s)[2] ) ? 3 : 0 ) \ - : ( ( 0xA0 == ((U8*)s)[1] ) && ( 0x8E == ((U8*)s)[2] ) ) ? 3 : 0 ) \ - : ( 0xE2 == ((U8*)s)[0] ) ? \ - ( ( 0x80 == ((U8*)s)[1] ) ? \ - ( ( ( 0x80 <= ((U8*)s)[2] && ((U8*)s)[2] <= 0x8A ) || 0xAF == ((U8*)s)[2] ) ? 3 : 0 )\ - : ( ( 0x81 == ((U8*)s)[1] ) && ( 0x9F == ((U8*)s)[2] ) ) ? 3 : 0 ) \ - : ( ( ( 0xE3 == ((U8*)s)[0] ) && ( 0x80 == ((U8*)s)[1] ) ) && ( 0x80 == ((U8*)s)[2] ) ) ? 3 : 0 )\ -: ( 0xA0 == ((U8*)s)[0] ) ) - -/*** GENERATED CODE ***/ -#define is_HORIZWS_safe(s,e,is_utf8) \ -( ((e)-(s) > 2) ? \ - ( ( 0x09 == ((U8*)s)[0] || 0x20 == ((U8*)s)[0] ) ? 1 \ - : ( is_utf8 ) ? \ - ( ( 0xC2 == ((U8*)s)[0] ) ? \ - ( ( 0xA0 == ((U8*)s)[1] ) ? 2 : 0 ) \ - : ( 0xE1 == ((U8*)s)[0] ) ? \ - ( ( 0x9A == ((U8*)s)[1] ) ? \ - ( ( 0x80 == ((U8*)s)[2] ) ? 3 : 0 ) \ - : ( ( 0xA0 == ((U8*)s)[1] ) && ( 0x8E == ((U8*)s)[2] ) ) ? 3 : 0 )\ - : ( 0xE2 == ((U8*)s)[0] ) ? \ - ( ( 0x80 == ((U8*)s)[1] ) ? \ - ( ( ( 0x80 <= ((U8*)s)[2] && ((U8*)s)[2] <= 0x8A ) || 0xAF == ((U8*)s)[2] ) ? 3 : 0 )\ - : ( ( 0x81 == ((U8*)s)[1] ) && ( 0x9F == ((U8*)s)[2] ) ) ? 3 : 0 )\ - : ( ( ( 0xE3 == ((U8*)s)[0] ) && ( 0x80 == ((U8*)s)[1] ) ) && ( 0x80 == ((U8*)s)[2] ) ) ? 3 : 0 )\ - : ( 0xA0 == ((U8*)s)[0] ) ) \ -: ((e)-(s) > 1) ? \ - ( ( 0x09 == ((U8*)s)[0] || 0x20 == ((U8*)s)[0] ) ? 1 \ - : ( is_utf8 ) ? \ - ( ( ( 0xC2 == ((U8*)s)[0] ) && ( 0xA0 == ((U8*)s)[1] ) ) ? 2 : 0 ) \ - : ( 0xA0 == ((U8*)s)[0] ) ) \ -: ((e)-(s) > 0) ? \ - ( ( 0x09 == ((U8*)s)[0] || 0x20 == ((U8*)s)[0] ) ? 1 \ - : ( !( is_utf8 ) ) ? \ - ( 0xA0 == ((U8*)s)[0] ) \ - : 0 ) \ -: 0 ) - -/*** GENERATED CODE ***/ -#define is_HORIZWS_utf8(s) \ -( ( 0x09 == ((U8*)s)[0] || 0x20 == ((U8*)s)[0] ) ? 1 \ -: ( 0xC2 == ((U8*)s)[0] ) ? \ - ( ( 0xA0 == ((U8*)s)[1] ) ? 2 : 0 ) \ -: ( 0xE1 == ((U8*)s)[0] ) ? \ - ( ( 0x9A == ((U8*)s)[1] ) ? \ - ( ( 0x80 == ((U8*)s)[2] ) ? 3 : 0 ) \ - : ( ( 0xA0 == ((U8*)s)[1] ) && ( 0x8E == ((U8*)s)[2] ) ) ? 3 : 0 ) \ -: ( 0xE2 == ((U8*)s)[0] ) ? \ - ( ( 0x80 == ((U8*)s)[1] ) ? \ - ( ( ( ((U8*)s)[2] <= 0x8A ) || 0xAF == ((U8*)s)[2] ) ? 3 : 0 ) \ - : ( ( 0x81 == ((U8*)s)[1] ) && ( 0x9F == ((U8*)s)[2] ) ) ? 3 : 0 ) \ -: ( ( ( 0xE3 == ((U8*)s)[0] ) && ( 0x80 == ((U8*)s)[1] ) ) && ( 0x80 == ((U8*)s)[2] ) ) ? 3 : 0 ) - -/*** GENERATED CODE ***/ -#define is_HORIZWS_utf8_safe(s,e) \ -( ((e)-(s) > 2) ? \ - ( ( 0x09 == ((U8*)s)[0] || 0x20 == ((U8*)s)[0] ) ? 1 \ - : ( 0xC2 == ((U8*)s)[0] ) ? \ - ( ( 0xA0 == ((U8*)s)[1] ) ? 2 : 0 ) \ - : ( 0xE1 == ((U8*)s)[0] ) ? \ - ( ( 0x9A == ((U8*)s)[1] ) ? \ - ( ( 0x80 == ((U8*)s)[2] ) ? 3 : 0 ) \ - : ( ( 0xA0 == ((U8*)s)[1] ) && ( 0x8E == ((U8*)s)[2] ) ) ? 3 : 0 ) \ - : ( 0xE2 == ((U8*)s)[0] ) ? \ - ( ( 0x80 == ((U8*)s)[1] ) ? \ - ( ( ( 0x80 <= ((U8*)s)[2] && ((U8*)s)[2] <= 0x8A ) || 0xAF == ((U8*)s)[2] ) ? 3 : 0 )\ - : ( ( 0x81 == ((U8*)s)[1] ) && ( 0x9F == ((U8*)s)[2] ) ) ? 3 : 0 ) \ - : ( ( ( 0xE3 == ((U8*)s)[0] ) && ( 0x80 == ((U8*)s)[1] ) ) && ( 0x80 == ((U8*)s)[2] ) ) ? 3 : 0 )\ -: ((e)-(s) > 1) ? \ - ( ( 0x09 == ((U8*)s)[0] || 0x20 == ((U8*)s)[0] ) ? 1 \ - : ( ( 0xC2 == ((U8*)s)[0] ) && ( 0xA0 == ((U8*)s)[1] ) ) ? 2 : 0 ) \ -: ((e)-(s) > 0) ? \ - ( 0x09 == ((U8*)s)[0] || 0x20 == ((U8*)s)[0] ) \ -: 0 ) - -/*** GENERATED CODE ***/ -#define is_HORIZWS_latin1(s) \ -( ((U8*)s)[0] == 0x09 || ( ( ((U8*)s)[0] & 0x7F ) == 0x20 ) ) - -/*** GENERATED CODE ***/ -#define is_HORIZWS_latin1_safe(s,e) \ -( ((e)-(s) > 0) ? \ - ( ((U8*)s)[0] == 0x09 || ( ( ((U8*)s)[0] & 0x7F ) == 0x20 ) ) \ -: 0 ) - -/*** GENERATED CODE ***/ #define is_HORIZWS_high(s) \ -( ( 0xE1 == ((U8*)s)[0] ) ? \ - ( ( 0x9A == ((U8*)s)[1] ) ? \ - ( ( 0x80 == ((U8*)s)[2] ) ? 3 : 0 ) \ - : ( ( 0xA0 == ((U8*)s)[1] ) && ( 0x8E == ((U8*)s)[2] ) ) ? 3 : 0 ) \ -: ( 0xE2 == ((U8*)s)[0] ) ? \ - ( ( 0x80 == ((U8*)s)[1] ) ? \ - ( ( ( ((U8*)s)[2] <= 0x8A ) || 0xAF == ((U8*)s)[2] ) ? 3 : 0 ) \ - : ( ( 0x81 == ((U8*)s)[1] ) && ( 0x9F == ((U8*)s)[2] ) ) ? 3 : 0 ) \ -: ( ( ( 0xE3 == ((U8*)s)[0] ) && ( 0x80 == ((U8*)s)[1] ) ) && ( 0x80 == ((U8*)s)[2] ) ) ? 3 : 0 ) - -/*** GENERATED CODE ***/ -#define is_HORIZWS_high_safe(s,e) \ -( ((e)-(s) > 2) ? \ - ( ( 0xE1 == ((U8*)s)[0] ) ? \ - ( ( 0x9A == ((U8*)s)[1] ) ? \ - ( ( 0x80 == ((U8*)s)[2] ) ? 3 : 0 ) \ - : ( ( 0xA0 == ((U8*)s)[1] ) && ( 0x8E == ((U8*)s)[2] ) ) ? 3 : 0 ) \ - : ( 0xE2 == ((U8*)s)[0] ) ? \ - ( ( 0x80 == ((U8*)s)[1] ) ? \ - ( ( ( 0x80 <= ((U8*)s)[2] && ((U8*)s)[2] <= 0x8A ) || 0xAF == ((U8*)s)[2] ) ? 3 : 0 )\ - : ( ( 0x81 == ((U8*)s)[1] ) && ( 0x9F == ((U8*)s)[2] ) ) ? 3 : 0 ) \ - : ( ( ( 0xE3 == ((U8*)s)[0] ) && ( 0x80 == ((U8*)s)[1] ) ) && ( 0x80 == ((U8*)s)[2] ) ) ? 3 : 0 )\ -: 0 ) - -/*** GENERATED CODE ***/ -#define is_HORIZWS_cp(cp) \ -( 0x09 == cp || ( 0x09 < cp && \ -( 0x20 == cp || ( 0x20 < cp && \ -( 0xA0 == cp || ( 0xA0 < cp && \ -( 0x1680 == cp || ( 0x1680 < cp && \ -( 0x180E == cp || ( 0x180E < cp && \ -( ( 0x2000 <= cp && cp <= 0x200A ) || ( 0x200A < cp && \ -( 0x202F == cp || ( 0x202F < cp && \ -( 0x205F == cp || 0x3000 == cp ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) +( ( 0xE1 == NATIVE_TO_LATIN1(((U8*)s)[0]) ) ? \ + ( ( ( 0x9A == NATIVE_TO_LATIN1(((U8*)s)[1]) ) && ( 0x80 == NATIVE_TO_LATIN1(((U8*)s)[2]) ) ) ? 3 : 0 )\ +: ( 0xE2 == NATIVE_TO_LATIN1(((U8*)s)[0]) ) ? \ + ( ( 0x80 == NATIVE_TO_LATIN1(((U8*)s)[1]) ) ? \ + ( ( ( NATIVE_TO_LATIN1(((U8*)s)[2]) <= 0x8A ) || 0xAF == NATIVE_TO_LATIN1(((U8*)s)[2]) ) ? 3 : 0 )\ + : ( ( 0x81 == NATIVE_TO_LATIN1(((U8*)s)[1]) ) && ( 0x9F == NATIVE_TO_LATIN1(((U8*)s)[2]) ) ) ? 3 : 0 )\ +: ( ( ( 0xE3 == NATIVE_TO_LATIN1(((U8*)s)[0]) ) && ( 0x80 == NATIVE_TO_LATIN1(((U8*)s)[1]) ) ) && ( 0x80 == NATIVE_TO_LATIN1(((U8*)s)[2]) ) ) ? 3 : 0 ) /*** GENERATED CODE ***/ #define is_HORIZWS_cp_high(cp) \ -( 0x1680 == cp || ( 0x1680 < cp && \ -( 0x180E == cp || ( 0x180E < cp && \ -( ( 0x2000 <= cp && cp <= 0x200A ) || ( 0x200A < cp && \ -( 0x202F == cp || ( 0x202F < cp && \ -( 0x205F == cp || 0x3000 == cp ) ) ) ) ) ) ) ) ) +( 0x1680 == NATIVE_TO_UNI(cp) || ( 0x1680 < NATIVE_TO_UNI(cp) && \ +( ( 0x2000 <= NATIVE_TO_UNI(cp) && NATIVE_TO_UNI(cp) <= 0x200A ) || ( 0x200A < NATIVE_TO_UNI(cp) &&\ +( 0x202F == NATIVE_TO_UNI(cp) || ( 0x202F < NATIVE_TO_UNI(cp) && \ +( 0x205F == NATIVE_TO_UNI(cp) || 0x3000 == NATIVE_TO_UNI(cp) ) ) ) ) ) ) ) /* VERTWS: Vertical Whitespace: \v \V @@ -252,83 +106,12 @@ \p{VertSpace} */ /*** GENERATED CODE ***/ -#define is_VERTWS(s,is_utf8) \ -( ( 0x0A <= ((U8*)s)[0] && ((U8*)s)[0] <= 0x0D ) ? 1 \ -: ( is_utf8 ) ? \ - ( ( 0xC2 == ((U8*)s)[0] ) ? \ - ( ( 0x85 == ((U8*)s)[1] ) ? 2 : 0 ) \ - : ( ( ( 0xE2 == ((U8*)s)[0] ) && ( 0x80 == ((U8*)s)[1] ) ) && ( ( ((U8*)s)[2] & 0xFE ) == 0xA8 ) ) ? 3 : 0 )\ -: ( 0x85 == ((U8*)s)[0] ) ) - -/*** GENERATED CODE ***/ -#define is_VERTWS_safe(s,e,is_utf8) \ -( ((e)-(s) > 2) ? \ - ( ( 0x0A <= ((U8*)s)[0] && ((U8*)s)[0] <= 0x0D ) ? 1 \ - : ( is_utf8 ) ? \ - ( ( 0xC2 == ((U8*)s)[0] ) ? \ - ( ( 0x85 == ((U8*)s)[1] ) ? 2 : 0 ) \ - : ( ( ( 0xE2 == ((U8*)s)[0] ) && ( 0x80 == ((U8*)s)[1] ) ) && ( ( ((U8*)s)[2] & 0xFE ) == 0xA8 ) ) ? 3 : 0 )\ - : ( 0x85 == ((U8*)s)[0] ) ) \ -: ((e)-(s) > 1) ? \ - ( ( 0x0A <= ((U8*)s)[0] && ((U8*)s)[0] <= 0x0D ) ? 1 \ - : ( is_utf8 ) ? \ - ( ( ( 0xC2 == ((U8*)s)[0] ) && ( 0x85 == ((U8*)s)[1] ) ) ? 2 : 0 ) \ - : ( 0x85 == ((U8*)s)[0] ) ) \ -: ((e)-(s) > 0) ? \ - ( ( 0x0A <= ((U8*)s)[0] && ((U8*)s)[0] <= 0x0D ) ? 1 \ - : ( !( is_utf8 ) ) ? \ - ( 0x85 == ((U8*)s)[0] ) \ - : 0 ) \ -: 0 ) - -/*** GENERATED CODE ***/ -#define is_VERTWS_utf8(s) \ -( ( 0x0A <= ((U8*)s)[0] && ((U8*)s)[0] <= 0x0D ) ? 1 \ -: ( 0xC2 == ((U8*)s)[0] ) ? \ - ( ( 0x85 == ((U8*)s)[1] ) ? 2 : 0 ) \ -: ( ( ( 0xE2 == ((U8*)s)[0] ) && ( 0x80 == ((U8*)s)[1] ) ) && ( ( ((U8*)s)[2] & 0xFE ) == 0xA8 ) ) ? 3 : 0 ) - -/*** GENERATED CODE ***/ -#define is_VERTWS_utf8_safe(s,e) \ -( ((e)-(s) > 2) ? \ - ( ( 0x0A <= ((U8*)s)[0] && ((U8*)s)[0] <= 0x0D ) ? 1 \ - : ( 0xC2 == ((U8*)s)[0] ) ? \ - ( ( 0x85 == ((U8*)s)[1] ) ? 2 : 0 ) \ - : ( ( ( 0xE2 == ((U8*)s)[0] ) && ( 0x80 == ((U8*)s)[1] ) ) && ( ( ((U8*)s)[2] & 0xFE ) == 0xA8 ) ) ? 3 : 0 )\ -: ((e)-(s) > 1) ? \ - ( ( 0x0A <= ((U8*)s)[0] && ((U8*)s)[0] <= 0x0D ) ? 1 \ - : ( ( 0xC2 == ((U8*)s)[0] ) && ( 0x85 == ((U8*)s)[1] ) ) ? 2 : 0 ) \ -: ((e)-(s) > 0) ? \ - ( 0x0A <= ((U8*)s)[0] && ((U8*)s)[0] <= 0x0D ) \ -: 0 ) - -/*** GENERATED CODE ***/ #define is_VERTWS_high(s) \ -( ( ( ( 0xE2 == ((U8*)s)[0] ) && ( 0x80 == ((U8*)s)[1] ) ) && ( ( ((U8*)s)[2] & 0xFE ) == 0xA8 ) ) ? 3 : 0 ) - -/*** GENERATED CODE ***/ -#define is_VERTWS_high_safe(s,e) \ -( ( ( ( ((e)-(s) > 2) && ( 0xE2 == ((U8*)s)[0] ) ) && ( 0x80 == ((U8*)s)[1] ) ) && ( ( ((U8*)s)[2] & 0xFE ) == 0xA8 ) ) ? 3 : 0 ) - -/*** GENERATED CODE ***/ -#define is_VERTWS_latin1(s) \ -( ( 0x0A <= ((U8*)s)[0] && ((U8*)s)[0] <= 0x0D ) || 0x85 == ((U8*)s)[0] ) - -/*** GENERATED CODE ***/ -#define is_VERTWS_latin1_safe(s,e) \ -( ((e)-(s) > 0) ? \ - ( ( 0x0A <= ((U8*)s)[0] && ((U8*)s)[0] <= 0x0D ) || 0x85 == ((U8*)s)[0] )\ -: 0 ) - -/*** GENERATED CODE ***/ -#define is_VERTWS_cp(cp) \ -( ( 0x0A <= cp && cp <= 0x0D ) || ( 0x0D < cp && \ -( 0x85 == cp || ( 0x85 < cp && \ -( 0x2028 == cp || 0x2029 == cp ) ) ) ) ) +( ( ( ( 0xE2 == NATIVE_TO_LATIN1(((U8*)s)[0]) ) && ( 0x80 == NATIVE_TO_LATIN1(((U8*)s)[1]) ) ) && ( ( NATIVE_TO_LATIN1(((U8*)s)[2]) & 0xFE ) == 0xA8 ) ) ? 3 : 0 ) /*** GENERATED CODE ***/ #define is_VERTWS_cp_high(cp) \ -( 0x2028 == cp || 0x2029 == cp ) +( 0x2028 == NATIVE_TO_UNI(cp) || 0x2029 == NATIVE_TO_UNI(cp) ) /* XDIGIT: Hexadecimal digits @@ -336,26 +119,17 @@ \p{XDigit} */ /*** GENERATED CODE ***/ -#define is_XDIGIT_utf8(s) \ -( ( ( 0x30 <= ((U8*)s)[0] && ((U8*)s)[0] <= 0x39 ) || ( 0x41 <= ((U8*)s)[0] && ((U8*)s)[0] <= 0x46 ) || ( 0x61 <= ((U8*)s)[0] && ((U8*)s)[0] <= 0x66 ) ) ? 1\ -: ( 0xEF == ((U8*)s)[0] ) ? \ - ( ( 0xBC == ((U8*)s)[1] ) ? \ - ( ( ( 0x90 <= ((U8*)s)[2] && ((U8*)s)[2] <= 0x99 ) || ( 0xA1 <= ((U8*)s)[2] && ((U8*)s)[2] <= 0xA6 ) ) ? 3 : 0 )\ - : ( ( 0xBD == ((U8*)s)[1] ) && ( 0x81 <= ((U8*)s)[2] && ((U8*)s)[2] <= 0x86 ) ) ? 3 : 0 )\ -: 0 ) - -/*** GENERATED CODE ***/ #define is_XDIGIT_high(s) \ -( ( 0xEF == ((U8*)s)[0] ) ? \ - ( ( 0xBC == ((U8*)s)[1] ) ? \ - ( ( ( 0x90 <= ((U8*)s)[2] && ((U8*)s)[2] <= 0x99 ) || ( 0xA1 <= ((U8*)s)[2] && ((U8*)s)[2] <= 0xA6 ) ) ? 3 : 0 )\ - : ( ( 0xBD == ((U8*)s)[1] ) && ( 0x81 <= ((U8*)s)[2] && ((U8*)s)[2] <= 0x86 ) ) ? 3 : 0 )\ +( ( 0xEF == NATIVE_TO_LATIN1(((U8*)s)[0]) ) ? \ + ( ( 0xBC == NATIVE_TO_LATIN1(((U8*)s)[1]) ) ? \ + ( ( ( 0x90 <= NATIVE_TO_LATIN1(((U8*)s)[2]) && NATIVE_TO_LATIN1(((U8*)s)[2]) <= 0x99 ) || ( 0xA1 <= NATIVE_TO_LATIN1(((U8*)s)[2]) && NATIVE_TO_LATIN1(((U8*)s)[2]) <= 0xA6 ) ) ? 3 : 0 )\ + : ( ( 0xBD == NATIVE_TO_LATIN1(((U8*)s)[1]) ) && ( 0x81 <= NATIVE_TO_LATIN1(((U8*)s)[2]) && NATIVE_TO_LATIN1(((U8*)s)[2]) <= 0x86 ) ) ? 3 : 0 )\ : 0 ) /*** GENERATED CODE ***/ #define is_XDIGIT_cp_high(cp) \ -( ( 0xFF10 <= cp && cp <= 0xFF19 ) || ( 0xFF19 < cp && \ -( ( 0xFF21 <= cp && cp <= 0xFF26 ) || ( 0xFF41 <= cp && cp <= 0xFF46 ) ) ) ) +( ( 0xFF10 <= NATIVE_TO_UNI(cp) && NATIVE_TO_UNI(cp) <= 0xFF19 ) || ( 0xFF19 < NATIVE_TO_UNI(cp) &&\ +( ( 0xFF21 <= NATIVE_TO_UNI(cp) && NATIVE_TO_UNI(cp) <= 0xFF26 ) || ( 0xFF41 <= NATIVE_TO_UNI(cp) && NATIVE_TO_UNI(cp) <= 0xFF46 ) ) ) ) /* XPERLSPACE: \p{XPerlSpace} @@ -363,58 +137,23 @@ \p{XPerlSpace} */ /*** GENERATED CODE ***/ -#define is_XPERLSPACE(s,is_utf8) \ -( ( ( 0x09 <= ((U8*)s)[0] && ((U8*)s)[0] <= 0x0D ) || 0x20 == ((U8*)s)[0] ) ? 1\ -: ( is_utf8 ) ? \ - ( ( 0xC2 == ((U8*)s)[0] ) ? \ - ( ( 0x85 == ((U8*)s)[1] || 0xA0 == ((U8*)s)[1] ) ? 2 : 0 ) \ - : ( 0xE1 == ((U8*)s)[0] ) ? \ - ( ( 0x9A == ((U8*)s)[1] ) ? \ - ( ( 0x80 == ((U8*)s)[2] ) ? 3 : 0 ) \ - : ( ( 0xA0 == ((U8*)s)[1] ) && ( 0x8E == ((U8*)s)[2] ) ) ? 3 : 0 ) \ - : ( 0xE2 == ((U8*)s)[0] ) ? \ - ( ( 0x80 == ((U8*)s)[1] ) ? \ - ( ( ( 0x80 <= ((U8*)s)[2] && ((U8*)s)[2] <= 0x8A ) || ( ((U8*)s)[2] & 0xFE ) == 0xA8 || 0xAF == ((U8*)s)[2] ) ? 3 : 0 )\ - : ( ( 0x81 == ((U8*)s)[1] ) && ( 0x9F == ((U8*)s)[2] ) ) ? 3 : 0 ) \ - : ( ( ( 0xE3 == ((U8*)s)[0] ) && ( 0x80 == ((U8*)s)[1] ) ) && ( 0x80 == ((U8*)s)[2] ) ) ? 3 : 0 )\ -: ( 0x85 == ((U8*)s)[0] || 0xA0 == ((U8*)s)[0] ) ) - -/*** GENERATED CODE ***/ -#define is_XPERLSPACE_utf8(s) \ -( ( ( 0x09 <= ((U8*)s)[0] && ((U8*)s)[0] <= 0x0D ) || 0x20 == ((U8*)s)[0] ) ? 1\ -: ( 0xC2 == ((U8*)s)[0] ) ? \ - ( ( 0x85 == ((U8*)s)[1] || 0xA0 == ((U8*)s)[1] ) ? 2 : 0 ) \ -: ( 0xE1 == ((U8*)s)[0] ) ? \ - ( ( 0x9A == ((U8*)s)[1] ) ? \ - ( ( 0x80 == ((U8*)s)[2] ) ? 3 : 0 ) \ - : ( ( 0xA0 == ((U8*)s)[1] ) && ( 0x8E == ((U8*)s)[2] ) ) ? 3 : 0 ) \ -: ( 0xE2 == ((U8*)s)[0] ) ? \ - ( ( 0x80 == ((U8*)s)[1] ) ? \ - ( ( ( ((U8*)s)[2] <= 0x8A ) || ( ((U8*)s)[2] & 0xFE ) == 0xA8 || 0xAF == ((U8*)s)[2] ) ? 3 : 0 )\ - : ( ( 0x81 == ((U8*)s)[1] ) && ( 0x9F == ((U8*)s)[2] ) ) ? 3 : 0 ) \ -: ( ( ( 0xE3 == ((U8*)s)[0] ) && ( 0x80 == ((U8*)s)[1] ) ) && ( 0x80 == ((U8*)s)[2] ) ) ? 3 : 0 ) - -/*** GENERATED CODE ***/ #define is_XPERLSPACE_high(s) \ -( ( 0xE1 == ((U8*)s)[0] ) ? \ - ( ( 0x9A == ((U8*)s)[1] ) ? \ - ( ( 0x80 == ((U8*)s)[2] ) ? 3 : 0 ) \ - : ( ( 0xA0 == ((U8*)s)[1] ) && ( 0x8E == ((U8*)s)[2] ) ) ? 3 : 0 ) \ -: ( 0xE2 == ((U8*)s)[0] ) ? \ - ( ( 0x80 == ((U8*)s)[1] ) ? \ - ( ( ( ((U8*)s)[2] <= 0x8A ) || ( ((U8*)s)[2] & 0xFE ) == 0xA8 || 0xAF == ((U8*)s)[2] ) ? 3 : 0 )\ - : ( ( 0x81 == ((U8*)s)[1] ) && ( 0x9F == ((U8*)s)[2] ) ) ? 3 : 0 ) \ -: ( ( ( 0xE3 == ((U8*)s)[0] ) && ( 0x80 == ((U8*)s)[1] ) ) && ( 0x80 == ((U8*)s)[2] ) ) ? 3 : 0 ) +( ( 0xE1 == NATIVE_TO_LATIN1(((U8*)s)[0]) ) ? \ + ( ( ( 0x9A == NATIVE_TO_LATIN1(((U8*)s)[1]) ) && ( 0x80 == NATIVE_TO_LATIN1(((U8*)s)[2]) ) ) ? 3 : 0 )\ +: ( 0xE2 == NATIVE_TO_LATIN1(((U8*)s)[0]) ) ? \ + ( ( 0x80 == NATIVE_TO_LATIN1(((U8*)s)[1]) ) ? \ + ( ( ( NATIVE_TO_LATIN1(((U8*)s)[2]) <= 0x8A ) || ( NATIVE_TO_LATIN1(((U8*)s)[2]) & 0xFE ) == 0xA8 || 0xAF == NATIVE_TO_LATIN1(((U8*)s)[2]) ) ? 3 : 0 )\ + : ( ( 0x81 == NATIVE_TO_LATIN1(((U8*)s)[1]) ) && ( 0x9F == NATIVE_TO_LATIN1(((U8*)s)[2]) ) ) ? 3 : 0 )\ +: ( ( ( 0xE3 == NATIVE_TO_LATIN1(((U8*)s)[0]) ) && ( 0x80 == NATIVE_TO_LATIN1(((U8*)s)[1]) ) ) && ( 0x80 == NATIVE_TO_LATIN1(((U8*)s)[2]) ) ) ? 3 : 0 ) /*** GENERATED CODE ***/ #define is_XPERLSPACE_cp_high(cp) \ -( 0x1680 == cp || ( 0x1680 < cp && \ -( 0x180E == cp || ( 0x180E < cp && \ -( ( 0x2000 <= cp && cp <= 0x200A ) || ( 0x200A < cp && \ -( 0x2028 == cp || ( 0x2028 < cp && \ -( 0x2029 == cp || ( 0x2029 < cp && \ -( 0x202F == cp || ( 0x202F < cp && \ -( 0x205F == cp || 0x3000 == cp ) ) ) ) ) ) ) ) ) ) ) ) ) +( 0x1680 == NATIVE_TO_UNI(cp) || ( 0x1680 < NATIVE_TO_UNI(cp) && \ +( ( 0x2000 <= NATIVE_TO_UNI(cp) && NATIVE_TO_UNI(cp) <= 0x200A ) || ( 0x200A < NATIVE_TO_UNI(cp) &&\ +( 0x2028 == NATIVE_TO_UNI(cp) || ( 0x2028 < NATIVE_TO_UNI(cp) && \ +( 0x2029 == NATIVE_TO_UNI(cp) || ( 0x2029 < NATIVE_TO_UNI(cp) && \ +( 0x202F == NATIVE_TO_UNI(cp) || ( 0x202F < NATIVE_TO_UNI(cp) && \ +( 0x205F == NATIVE_TO_UNI(cp) || 0x3000 == NATIVE_TO_UNI(cp) ) ) ) ) ) ) ) ) ) ) ) /* REPLACEMENT: Unicode REPLACEMENT CHARACTER @@ -423,7 +162,7 @@ */ /*** GENERATED CODE ***/ #define is_REPLACEMENT_utf8_safe(s,e) \ -( ( ( ( ((e)-(s) > 2) && ( 0xEF == ((U8*)s)[0] ) ) && ( 0xBF == ((U8*)s)[1] ) ) && ( 0xBD == ((U8*)s)[2] ) ) ? 3 : 0 ) +( ( ( ( ( ((e) - (s)) >= 3 ) && ( 0xEF == NATIVE_TO_LATIN1(((U8*)s)[0]) ) ) && ( 0xBF == NATIVE_TO_LATIN1(((U8*)s)[1]) ) ) && ( 0xBD == NATIVE_TO_LATIN1(((U8*)s)[2]) ) ) ? 3 : 0 ) /* NONCHAR: Non character code points @@ -432,15 +171,15 @@ */ /*** GENERATED CODE ***/ #define is_NONCHAR_utf8(s) \ -( ( 0xEF == ((U8*)s)[0] ) ? \ - ( ( 0xB7 == ((U8*)s)[1] ) ? \ - ( ( 0x90 <= ((U8*)s)[2] && ((U8*)s)[2] <= 0xAF ) ? 3 : 0 ) \ - : ( ( 0xBF == ((U8*)s)[1] ) && ( ((U8*)s)[2] >= 0xBE ) ) ? 3 : 0 ) \ -: ( 0xF0 == ((U8*)s)[0] ) ? \ - ( ( ( ( ((U8*)s)[1] == 0x9F || ( ( ((U8*)s)[1] & 0xEF ) == 0xAF ) ) && ( 0xBF == ((U8*)s)[2] ) ) && ( ((U8*)s)[3] >= 0xBE ) ) ? 4 : 0 )\ -: ( 0xF1 <= ((U8*)s)[0] && ((U8*)s)[0] <= 0xF3 ) ? \ - ( ( ( ( ( ((U8*)s)[1] & 0xCF ) == 0x8F ) && ( 0xBF == ((U8*)s)[2] ) ) && ( ((U8*)s)[3] >= 0xBE ) ) ? 4 : 0 )\ -: ( ( ( ( 0xF4 == ((U8*)s)[0] ) && ( 0x8F == ((U8*)s)[1] ) ) && ( 0xBF == ((U8*)s)[2] ) ) && ( ((U8*)s)[3] >= 0xBE ) ) ? 4 : 0 ) +( ( 0xEF == NATIVE_TO_LATIN1(((U8*)s)[0]) ) ? \ + ( ( 0xB7 == NATIVE_TO_LATIN1(((U8*)s)[1]) ) ? \ + ( ( 0x90 <= NATIVE_TO_LATIN1(((U8*)s)[2]) && NATIVE_TO_LATIN1(((U8*)s)[2]) <= 0xAF ) ? 3 : 0 )\ + : ( ( 0xBF == NATIVE_TO_LATIN1(((U8*)s)[1]) ) && ( NATIVE_TO_LATIN1(((U8*)s)[2]) >= 0xBE ) ) ? 3 : 0 )\ +: ( 0xF0 == NATIVE_TO_LATIN1(((U8*)s)[0]) ) ? \ + ( ( ( ( NATIVE_TO_LATIN1(((U8*)s)[1]) == 0x9F || ( ( NATIVE_TO_LATIN1(((U8*)s)[1]) & 0xEF ) == 0xAF ) ) && ( 0xBF == NATIVE_TO_LATIN1(((U8*)s)[2]) ) ) && ( NATIVE_TO_LATIN1(((U8*)s)[3]) >= 0xBE ) ) ? 4 : 0 )\ +: ( 0xF1 <= NATIVE_TO_LATIN1(((U8*)s)[0]) && NATIVE_TO_LATIN1(((U8*)s)[0]) <= 0xF3 ) ?\ + ( ( ( ( ( NATIVE_TO_LATIN1(((U8*)s)[1]) & 0xCF ) == 0x8F ) && ( 0xBF == NATIVE_TO_LATIN1(((U8*)s)[2]) ) ) && ( NATIVE_TO_LATIN1(((U8*)s)[3]) >= 0xBE ) ) ? 4 : 0 )\ +: ( ( ( ( 0xF4 == NATIVE_TO_LATIN1(((U8*)s)[0]) ) && ( 0x8F == NATIVE_TO_LATIN1(((U8*)s)[1]) ) ) && ( 0xBF == NATIVE_TO_LATIN1(((U8*)s)[2]) ) ) && ( NATIVE_TO_LATIN1(((U8*)s)[3]) >= 0xBE ) ) ? 4 : 0 ) /* SURROGATE: Surrogate characters @@ -449,7 +188,7 @@ */ /*** GENERATED CODE ***/ #define is_SURROGATE_utf8(s) \ -( ( ( 0xED == ((U8*)s)[0] ) && ( ((U8*)s)[1] >= 0xA0 ) ) ? 3 : 0 ) +( ( ( 0xED == NATIVE_TO_LATIN1(((U8*)s)[0]) ) && ( NATIVE_TO_LATIN1(((U8*)s)[1]) >= 0xA0 ) ) ? 3 : 0 ) /* GCB_L: Grapheme_Cluster_Break=L @@ -458,11 +197,11 @@ */ /*** GENERATED CODE ***/ #define is_GCB_L_utf8(s) \ -( ( 0xE1 == ((U8*)s)[0] ) ? \ - ( ( 0x84 == ((U8*)s)[1] ) ? \ +( ( 0xE1 == NATIVE_TO_LATIN1(((U8*)s)[0]) ) ? \ + ( ( 0x84 == NATIVE_TO_LATIN1(((U8*)s)[1]) ) ? \ 3 \ - : ( ( 0x85 == ((U8*)s)[1] ) && ( ((U8*)s)[2] <= 0x9F ) ) ? 3 : 0 ) \ -: ( ( ( 0xEA == ((U8*)s)[0] ) && ( 0xA5 == ((U8*)s)[1] ) ) && ( 0xA0 <= ((U8*)s)[2] && ((U8*)s)[2] <= 0xBC ) ) ? 3 : 0 ) + : ( ( 0x85 == NATIVE_TO_LATIN1(((U8*)s)[1]) ) && ( NATIVE_TO_LATIN1(((U8*)s)[2]) <= 0x9F ) ) ? 3 : 0 )\ +: ( ( ( 0xEA == NATIVE_TO_LATIN1(((U8*)s)[0]) ) && ( 0xA5 == NATIVE_TO_LATIN1(((U8*)s)[1]) ) ) && ( 0xA0 <= NATIVE_TO_LATIN1(((U8*)s)[2]) && NATIVE_TO_LATIN1(((U8*)s)[2]) <= 0xBC ) ) ? 3 : 0 ) /* GCB_LV_LVT_V: Grapheme_Cluster_Break=(LV or LVT or V) @@ -471,22 +210,22 @@ */ /*** GENERATED CODE ***/ #define is_GCB_LV_LVT_V_utf8(s) \ -( ( 0xE1 == ((U8*)s)[0] ) ? \ - ( ( 0x85 == ((U8*)s)[1] ) ? \ - ( ( ((U8*)s)[2] >= 0xA0 ) ? 3 : 0 ) \ - : ( ( 0x86 == ((U8*)s)[1] ) && ( ((U8*)s)[2] <= 0xA7 ) ) ? 3 : 0 ) \ -: ( 0xEA == ((U8*)s)[0] ) ? \ - ( ( ((U8*)s)[1] >= 0xB0 ) ? \ +( ( 0xE1 == NATIVE_TO_LATIN1(((U8*)s)[0]) ) ? \ + ( ( 0x85 == NATIVE_TO_LATIN1(((U8*)s)[1]) ) ? \ + ( ( NATIVE_TO_LATIN1(((U8*)s)[2]) >= 0xA0 ) ? 3 : 0 ) \ + : ( ( 0x86 == NATIVE_TO_LATIN1(((U8*)s)[1]) ) && ( NATIVE_TO_LATIN1(((U8*)s)[2]) <= 0xA7 ) ) ? 3 : 0 )\ +: ( 0xEA == NATIVE_TO_LATIN1(((U8*)s)[0]) ) ? \ + ( ( NATIVE_TO_LATIN1(((U8*)s)[1]) >= 0xB0 ) ? \ 3 \ : 0 ) \ -: ( 0xEB == ((U8*)s)[0] || 0xEC == ((U8*)s)[0] ) ? \ +: ( 0xEB == NATIVE_TO_LATIN1(((U8*)s)[0]) || 0xEC == NATIVE_TO_LATIN1(((U8*)s)[0]) ) ?\ 3 \ -: ( 0xED == ((U8*)s)[0] ) ? \ - ( ( ((U8*)s)[1] <= 0x9D ) ? \ +: ( 0xED == NATIVE_TO_LATIN1(((U8*)s)[0]) ) ? \ + ( ( NATIVE_TO_LATIN1(((U8*)s)[1]) <= 0x9D ) ? \ 3 \ - : ( 0x9E == ((U8*)s)[1] ) ? \ - ( ( ( ((U8*)s)[2] <= 0xA3 ) || ( ((U8*)s)[2] >= 0xB0 ) ) ? 3 : 0 ) \ - : ( ( 0x9F == ((U8*)s)[1] ) && ( ((U8*)s)[2] <= 0x86 ) ) ? 3 : 0 ) \ + : ( 0x9E == NATIVE_TO_LATIN1(((U8*)s)[1]) ) ? \ + ( ( ( NATIVE_TO_LATIN1(((U8*)s)[2]) <= 0xA3 ) || ( NATIVE_TO_LATIN1(((U8*)s)[2]) >= 0xB0 ) ) ? 3 : 0 )\ + : ( ( 0x9F == NATIVE_TO_LATIN1(((U8*)s)[1]) ) && ( NATIVE_TO_LATIN1(((U8*)s)[2]) <= 0x86 ) ) ? 3 : 0 )\ : 0 ) /* @@ -505,7 +244,7 @@ */ /*** GENERATED CODE ***/ #define is_GCB_RI_utf8(s) \ -( ( ( ( ( 0xF0 == ((U8*)s)[0] ) && ( 0x9F == ((U8*)s)[1] ) ) && ( 0x87 == ((U8*)s)[2] ) ) && ( ((U8*)s)[3] >= 0xA6 ) ) ? 4 : 0 ) +( ( ( ( ( 0xF0 == NATIVE_TO_LATIN1(((U8*)s)[0]) ) && ( 0x9F == NATIVE_TO_LATIN1(((U8*)s)[1]) ) ) && ( 0x87 == NATIVE_TO_LATIN1(((U8*)s)[2]) ) ) && ( NATIVE_TO_LATIN1(((U8*)s)[3]) >= 0xA6 ) ) ? 4 : 0 ) /* GCB_SPECIAL_BEGIN_START: Grapheme_Cluster_Break=special_begin_starts @@ -514,25 +253,25 @@ */ /*** GENERATED CODE ***/ #define is_GCB_SPECIAL_BEGIN_START_utf8(s) \ -( ( 0xE1 == ((U8*)s)[0] ) ? \ - ( ( ( ((U8*)s)[1] & 0xFC ) == 0x84 ) ? \ +( ( 0xE1 == NATIVE_TO_LATIN1(((U8*)s)[0]) ) ? \ + ( ( ( NATIVE_TO_LATIN1(((U8*)s)[1]) & 0xFC ) == 0x84 ) ? \ 3 \ : 0 ) \ -: ( 0xEA == ((U8*)s)[0] ) ? \ - ( ( 0xA5 == ((U8*)s)[1] ) ? \ - ( ( 0xA0 <= ((U8*)s)[2] && ((U8*)s)[2] <= 0xBC ) ? 3 : 0 ) \ - : ( ((U8*)s)[1] >= 0xB0 ) ? \ +: ( 0xEA == NATIVE_TO_LATIN1(((U8*)s)[0]) ) ? \ + ( ( 0xA5 == NATIVE_TO_LATIN1(((U8*)s)[1]) ) ? \ + ( ( 0xA0 <= NATIVE_TO_LATIN1(((U8*)s)[2]) && NATIVE_TO_LATIN1(((U8*)s)[2]) <= 0xBC ) ? 3 : 0 )\ + : ( NATIVE_TO_LATIN1(((U8*)s)[1]) >= 0xB0 ) ? \ 3 \ : 0 ) \ -: ( 0xEB == ((U8*)s)[0] || 0xEC == ((U8*)s)[0] ) ? \ +: ( 0xEB == NATIVE_TO_LATIN1(((U8*)s)[0]) || 0xEC == NATIVE_TO_LATIN1(((U8*)s)[0]) ) ?\ 3 \ -: ( 0xED == ((U8*)s)[0] ) ? \ - ( ( ((U8*)s)[1] <= 0x9D ) ? \ +: ( 0xED == NATIVE_TO_LATIN1(((U8*)s)[0]) ) ? \ + ( ( NATIVE_TO_LATIN1(((U8*)s)[1]) <= 0x9D ) ? \ 3 \ - : ( 0x9E == ((U8*)s)[1] ) ? \ - ( ( ( ((U8*)s)[2] <= 0xA3 ) || ( ((U8*)s)[2] >= 0xB0 ) ) ? 3 : 0 ) \ - : ( ( 0x9F == ((U8*)s)[1] ) && ( ( ((U8*)s)[2] <= 0x86 ) || ( 0x8B <= ((U8*)s)[2] && ((U8*)s)[2] <= 0xBB ) ) ) ? 3 : 0 )\ -: ( ( ( ( 0xF0 == ((U8*)s)[0] ) && ( 0x9F == ((U8*)s)[1] ) ) && ( 0x87 == ((U8*)s)[2] ) ) && ( ((U8*)s)[3] >= 0xA6 ) ) ? 4 : 0 ) + : ( 0x9E == NATIVE_TO_LATIN1(((U8*)s)[1]) ) ? \ + ( ( ( NATIVE_TO_LATIN1(((U8*)s)[2]) <= 0xA3 ) || ( NATIVE_TO_LATIN1(((U8*)s)[2]) >= 0xB0 ) ) ? 3 : 0 )\ + : ( ( 0x9F == NATIVE_TO_LATIN1(((U8*)s)[1]) ) && ( ( NATIVE_TO_LATIN1(((U8*)s)[2]) <= 0x86 ) || ( 0x8B <= NATIVE_TO_LATIN1(((U8*)s)[2]) && NATIVE_TO_LATIN1(((U8*)s)[2]) <= 0xBB ) ) ) ? 3 : 0 )\ +: ( ( ( ( 0xF0 == NATIVE_TO_LATIN1(((U8*)s)[0]) ) && ( 0x9F == NATIVE_TO_LATIN1(((U8*)s)[1]) ) ) && ( 0x87 == NATIVE_TO_LATIN1(((U8*)s)[2]) ) ) && ( NATIVE_TO_LATIN1(((U8*)s)[3]) >= 0xA6 ) ) ? 4 : 0 ) /* GCB_T: Grapheme_Cluster_Break=T @@ -541,13 +280,13 @@ */ /*** GENERATED CODE ***/ #define is_GCB_T_utf8(s) \ -( ( 0xE1 == ((U8*)s)[0] ) ? \ - ( ( 0x86 == ((U8*)s)[1] ) ? \ - ( ( ((U8*)s)[2] >= 0xA8 ) ? 3 : 0 ) \ - : ( 0x87 == ((U8*)s)[1] ) ? \ +( ( 0xE1 == NATIVE_TO_LATIN1(((U8*)s)[0]) ) ? \ + ( ( 0x86 == NATIVE_TO_LATIN1(((U8*)s)[1]) ) ? \ + ( ( NATIVE_TO_LATIN1(((U8*)s)[2]) >= 0xA8 ) ? 3 : 0 ) \ + : ( 0x87 == NATIVE_TO_LATIN1(((U8*)s)[1]) ) ? \ 3 \ : 0 ) \ -: ( ( ( 0xED == ((U8*)s)[0] ) && ( 0x9F == ((U8*)s)[1] ) ) && ( 0x8B <= ((U8*)s)[2] && ((U8*)s)[2] <= 0xBB ) ) ? 3 : 0 ) +: ( ( ( 0xED == NATIVE_TO_LATIN1(((U8*)s)[0]) ) && ( 0x9F == NATIVE_TO_LATIN1(((U8*)s)[1]) ) ) && ( 0x8B <= NATIVE_TO_LATIN1(((U8*)s)[2]) && NATIVE_TO_LATIN1(((U8*)s)[2]) <= 0xBB ) ) ? 3 : 0 ) /* GCB_V: Grapheme_Cluster_Break=V @@ -556,14 +295,14 @@ */ /*** GENERATED CODE ***/ #define is_GCB_V_utf8(s) \ -( ( 0xE1 == ((U8*)s)[0] ) ? \ - ( ( 0x85 == ((U8*)s)[1] ) ? \ - ( ( ((U8*)s)[2] >= 0xA0 ) ? 3 : 0 ) \ - : ( ( 0x86 == ((U8*)s)[1] ) && ( ((U8*)s)[2] <= 0xA7 ) ) ? 3 : 0 ) \ -: ( 0xED == ((U8*)s)[0] ) ? \ - ( ( 0x9E == ((U8*)s)[1] ) ? \ - ( ( ((U8*)s)[2] >= 0xB0 ) ? 3 : 0 ) \ - : ( ( 0x9F == ((U8*)s)[1] ) && ( ((U8*)s)[2] <= 0x86 ) ) ? 3 : 0 ) \ +( ( 0xE1 == NATIVE_TO_LATIN1(((U8*)s)[0]) ) ? \ + ( ( 0x85 == NATIVE_TO_LATIN1(((U8*)s)[1]) ) ? \ + ( ( NATIVE_TO_LATIN1(((U8*)s)[2]) >= 0xA0 ) ? 3 : 0 ) \ + : ( ( 0x86 == NATIVE_TO_LATIN1(((U8*)s)[1]) ) && ( NATIVE_TO_LATIN1(((U8*)s)[2]) <= 0xA7 ) ) ? 3 : 0 )\ +: ( 0xED == NATIVE_TO_LATIN1(((U8*)s)[0]) ) ? \ + ( ( 0x9E == NATIVE_TO_LATIN1(((U8*)s)[1]) ) ? \ + ( ( NATIVE_TO_LATIN1(((U8*)s)[2]) >= 0xB0 ) ? 3 : 0 ) \ + : ( ( 0x9F == NATIVE_TO_LATIN1(((U8*)s)[1]) ) && ( NATIVE_TO_LATIN1(((U8*)s)[2]) <= 0x86 ) ) ? 3 : 0 )\ : 0 ) /* @@ -573,49 +312,51 @@ */ /*** GENERATED CODE ***/ #define is_QUOTEMETA_high(s) \ -( ( 0xCD == ((U8*)s)[0] ) ? \ - ( ( 0x8F == ((U8*)s)[1] ) ? 2 : 0 ) \ -: ( 0xE1 == ((U8*)s)[0] ) ? \ - ( ( 0x85 == ((U8*)s)[1] ) ? \ - ( ( 0x9F == ((U8*)s)[2] || 0xA0 == ((U8*)s)[2] ) ? 3 : 0 ) \ - : ( 0x9A == ((U8*)s)[1] ) ? \ - ( ( 0x80 == ((U8*)s)[2] ) ? 3 : 0 ) \ - : ( 0x9E == ((U8*)s)[1] ) ? \ - ( ( ( ((U8*)s)[2] & 0xFE ) == 0xB4 ) ? 3 : 0 ) \ - : ( ( 0xA0 == ((U8*)s)[1] ) && ( 0x8B <= ((U8*)s)[2] && ((U8*)s)[2] <= 0x8E ) ) ? 3 : 0 )\ -: ( 0xE2 == ((U8*)s)[0] ) ? \ - ( ( 0x80 == ((U8*)s)[1] ) ? \ - ( ( ((U8*)s)[2] <= 0xBE ) ? 3 : 0 ) \ - : ( 0x81 == ((U8*)s)[1] ) ? \ - ( ( ( 0x81 <= ((U8*)s)[2] && ((U8*)s)[2] <= 0x93 ) || ( 0x95 <= ((U8*)s)[2] && ((U8*)s)[2] <= 0xAF ) ) ? 3 : 0 )\ - : ( 0x86 == ((U8*)s)[1] ) ? \ - ( ( ((U8*)s)[2] >= 0x90 ) ? 3 : 0 ) \ - : ( ( 0x87 <= ((U8*)s)[1] && ((U8*)s)[1] <= 0x90 ) || ( 0x94 <= ((U8*)s)[1] && ((U8*)s)[1] <= 0x9C ) || ( 0x9F <= ((U8*)s)[1] && ((U8*)s)[1] <= 0xAF ) || ( ((U8*)s)[1] & 0xFE ) == 0xB8 ) ?\ +( ( 0xCD == NATIVE_TO_LATIN1(((U8*)s)[0]) ) ? \ + ( ( 0x8F == NATIVE_TO_LATIN1(((U8*)s)[1]) ) ? 2 : 0 ) \ +: ( 0xD8 == NATIVE_TO_LATIN1(((U8*)s)[0]) ) ? \ + ( ( 0x9C == NATIVE_TO_LATIN1(((U8*)s)[1]) ) ? 2 : 0 ) \ +: ( 0xE1 == NATIVE_TO_LATIN1(((U8*)s)[0]) ) ? \ + ( ( 0x85 == NATIVE_TO_LATIN1(((U8*)s)[1]) ) ? \ + ( ( 0x9F == NATIVE_TO_LATIN1(((U8*)s)[2]) || 0xA0 == NATIVE_TO_LATIN1(((U8*)s)[2]) ) ? 3 : 0 )\ + : ( 0x9A == NATIVE_TO_LATIN1(((U8*)s)[1]) ) ? \ + ( ( 0x80 == NATIVE_TO_LATIN1(((U8*)s)[2]) ) ? 3 : 0 ) \ + : ( 0x9E == NATIVE_TO_LATIN1(((U8*)s)[1]) ) ? \ + ( ( ( NATIVE_TO_LATIN1(((U8*)s)[2]) & 0xFE ) == 0xB4 ) ? 3 : 0 ) \ + : ( ( 0xA0 == NATIVE_TO_LATIN1(((U8*)s)[1]) ) && ( 0x8B <= NATIVE_TO_LATIN1(((U8*)s)[2]) && NATIVE_TO_LATIN1(((U8*)s)[2]) <= 0x8E ) ) ? 3 : 0 )\ +: ( 0xE2 == NATIVE_TO_LATIN1(((U8*)s)[0]) ) ? \ + ( ( 0x80 == NATIVE_TO_LATIN1(((U8*)s)[1]) ) ? \ + ( ( NATIVE_TO_LATIN1(((U8*)s)[2]) <= 0xBE ) ? 3 : 0 ) \ + : ( 0x81 == NATIVE_TO_LATIN1(((U8*)s)[1]) ) ? \ + ( ( ( 0x81 <= NATIVE_TO_LATIN1(((U8*)s)[2]) && NATIVE_TO_LATIN1(((U8*)s)[2]) <= 0x93 ) || ( 0x95 <= NATIVE_TO_LATIN1(((U8*)s)[2]) && NATIVE_TO_LATIN1(((U8*)s)[2]) <= 0xAF ) ) ? 3 : 0 )\ + : ( 0x86 == NATIVE_TO_LATIN1(((U8*)s)[1]) ) ? \ + ( ( NATIVE_TO_LATIN1(((U8*)s)[2]) >= 0x90 ) ? 3 : 0 ) \ + : ( ( 0x87 <= NATIVE_TO_LATIN1(((U8*)s)[1]) && NATIVE_TO_LATIN1(((U8*)s)[1]) <= 0x90 ) || ( 0x94 <= NATIVE_TO_LATIN1(((U8*)s)[1]) && NATIVE_TO_LATIN1(((U8*)s)[1]) <= 0x9C ) || ( 0x9F <= NATIVE_TO_LATIN1(((U8*)s)[1]) && NATIVE_TO_LATIN1(((U8*)s)[1]) <= 0xAF ) || ( NATIVE_TO_LATIN1(((U8*)s)[1]) & 0xFE ) == 0xB8 ) ?\ 3 \ - : ( 0x91 == ((U8*)s)[1] ) ? \ - ( ( ((U8*)s)[2] <= 0x9F ) ? 3 : 0 ) \ - : ( 0x9D == ((U8*)s)[1] ) ? \ - ( ( ((U8*)s)[2] <= 0xB5 ) ? 3 : 0 ) \ - : ( ( 0x9E == ((U8*)s)[1] ) && ( ((U8*)s)[2] >= 0x94 ) ) ? 3 : 0 ) \ -: ( 0xE3 == ((U8*)s)[0] ) ? \ - ( ( 0x80 == ((U8*)s)[1] ) ? \ - ( ( ( ((U8*)s)[2] <= 0x83 ) || ( 0x88 <= ((U8*)s)[2] && ((U8*)s)[2] <= 0xA0 ) || 0xB0 == ((U8*)s)[2] ) ? 3 : 0 )\ - : ( ( 0x85 == ((U8*)s)[1] ) && ( 0xA4 == ((U8*)s)[2] ) ) ? 3 : 0 ) \ -: ( 0xEF == ((U8*)s)[0] ) ? \ - ( ( 0xB4 == ((U8*)s)[1] ) ? \ - ( ( ((U8*)s)[2] >= 0xBE ) ? 3 : 0 ) \ - : ( 0xB8 == ((U8*)s)[1] ) ? \ - ( ( ((U8*)s)[2] <= 0x8F ) ? 3 : 0 ) \ - : ( 0xB9 == ((U8*)s)[1] ) ? \ - ( ( 0x85 == ((U8*)s)[2] || 0x86 == ((U8*)s)[2] ) ? 3 : 0 ) \ - : ( 0xBB == ((U8*)s)[1] ) ? \ - ( ( 0xBF == ((U8*)s)[2] ) ? 3 : 0 ) \ - : ( 0xBE == ((U8*)s)[1] ) ? \ - ( ( 0xA0 == ((U8*)s)[2] ) ? 3 : 0 ) \ - : ( ( 0xBF == ((U8*)s)[1] ) && ( 0xB0 <= ((U8*)s)[2] && ((U8*)s)[2] <= 0xB8 ) ) ? 3 : 0 )\ -: ( 0xF0 == ((U8*)s)[0] ) ? \ - ( ( ( ( 0x9D == ((U8*)s)[1] ) && ( 0x85 == ((U8*)s)[2] ) ) && ( 0xB3 <= ((U8*)s)[3] && ((U8*)s)[3] <= 0xBA ) ) ? 4 : 0 )\ -: ( ( 0xF3 == ((U8*)s)[0] ) && ( 0xA0 == ((U8*)s)[1] ) ) ? 4 : 0 ) + : ( 0x91 == NATIVE_TO_LATIN1(((U8*)s)[1]) ) ? \ + ( ( NATIVE_TO_LATIN1(((U8*)s)[2]) <= 0x9F ) ? 3 : 0 ) \ + : ( 0x9D == NATIVE_TO_LATIN1(((U8*)s)[1]) ) ? \ + ( ( NATIVE_TO_LATIN1(((U8*)s)[2]) <= 0xB5 ) ? 3 : 0 ) \ + : ( ( 0x9E == NATIVE_TO_LATIN1(((U8*)s)[1]) ) && ( NATIVE_TO_LATIN1(((U8*)s)[2]) >= 0x94 ) ) ? 3 : 0 )\ +: ( 0xE3 == NATIVE_TO_LATIN1(((U8*)s)[0]) ) ? \ + ( ( 0x80 == NATIVE_TO_LATIN1(((U8*)s)[1]) ) ? \ + ( ( ( NATIVE_TO_LATIN1(((U8*)s)[2]) <= 0x83 ) || ( 0x88 <= NATIVE_TO_LATIN1(((U8*)s)[2]) && NATIVE_TO_LATIN1(((U8*)s)[2]) <= 0xA0 ) || 0xB0 == NATIVE_TO_LATIN1(((U8*)s)[2]) ) ? 3 : 0 )\ + : ( ( 0x85 == NATIVE_TO_LATIN1(((U8*)s)[1]) ) && ( 0xA4 == NATIVE_TO_LATIN1(((U8*)s)[2]) ) ) ? 3 : 0 )\ +: ( 0xEF == NATIVE_TO_LATIN1(((U8*)s)[0]) ) ? \ + ( ( 0xB4 == NATIVE_TO_LATIN1(((U8*)s)[1]) ) ? \ + ( ( NATIVE_TO_LATIN1(((U8*)s)[2]) >= 0xBE ) ? 3 : 0 ) \ + : ( 0xB8 == NATIVE_TO_LATIN1(((U8*)s)[1]) ) ? \ + ( ( NATIVE_TO_LATIN1(((U8*)s)[2]) <= 0x8F ) ? 3 : 0 ) \ + : ( 0xB9 == NATIVE_TO_LATIN1(((U8*)s)[1]) ) ? \ + ( ( 0x85 == NATIVE_TO_LATIN1(((U8*)s)[2]) || 0x86 == NATIVE_TO_LATIN1(((U8*)s)[2]) ) ? 3 : 0 )\ + : ( 0xBB == NATIVE_TO_LATIN1(((U8*)s)[1]) ) ? \ + ( ( 0xBF == NATIVE_TO_LATIN1(((U8*)s)[2]) ) ? 3 : 0 ) \ + : ( 0xBE == NATIVE_TO_LATIN1(((U8*)s)[1]) ) ? \ + ( ( 0xA0 == NATIVE_TO_LATIN1(((U8*)s)[2]) ) ? 3 : 0 ) \ + : ( ( 0xBF == NATIVE_TO_LATIN1(((U8*)s)[1]) ) && ( 0xB0 <= NATIVE_TO_LATIN1(((U8*)s)[2]) && NATIVE_TO_LATIN1(((U8*)s)[2]) <= 0xB8 ) ) ? 3 : 0 )\ +: ( 0xF0 == NATIVE_TO_LATIN1(((U8*)s)[0]) ) ? \ + ( ( ( ( 0x9D == NATIVE_TO_LATIN1(((U8*)s)[1]) ) && ( 0x85 == NATIVE_TO_LATIN1(((U8*)s)[2]) ) ) && ( 0xB3 <= NATIVE_TO_LATIN1(((U8*)s)[3]) && NATIVE_TO_LATIN1(((U8*)s)[3]) <= 0xBA ) ) ? 4 : 0 )\ +: ( ( 0xF3 == NATIVE_TO_LATIN1(((U8*)s)[0]) ) && ( 0xA0 == NATIVE_TO_LATIN1(((U8*)s)[1]) ) ) ? 4 : 0 ) /* MULTI_CHAR_FOLD: multi-char strings that are folded to by a single character @@ -625,211 +366,233 @@ */ /*** GENERATED CODE ***/ #define is_MULTI_CHAR_FOLD_utf8_safe_part0(s,e) \ -( ( 0x61 == ((U8*)s)[0] ) ? \ - ( ( ( 0xCA == ((U8*)s)[1] ) && ( 0xBE == ((U8*)s)[2] ) ) ? 3 : 0 ) \ - : ( 0x66 == ((U8*)s)[0] ) ? \ - ( ( 0x66 == ((U8*)s)[1] ) ? \ - ( ( 0x69 == ((U8*)s)[2] || 0x6C == ((U8*)s)[2] ) ? 3 : 2 ) \ - : ( 0x69 == ((U8*)s)[1] || 0x6C == ((U8*)s)[1] ) ? 2 : 0 ) \ - : ( 0x68 == ((U8*)s)[0] ) ? \ - ( ( ( 0xCC == ((U8*)s)[1] ) && ( 0xB1 == ((U8*)s)[2] ) ) ? 3 : 0 ) \ - : ( 0x69 == ((U8*)s)[0] ) ? \ - ( ( ( 0xCC == ((U8*)s)[1] ) && ( 0x87 == ((U8*)s)[2] ) ) ? 3 : 0 ) \ - : ( 0x6A == ((U8*)s)[0] ) ? \ - ( ( ( 0xCC == ((U8*)s)[1] ) && ( 0x8C == ((U8*)s)[2] ) ) ? 3 : 0 ) \ - : ( 0x73 == ((U8*)s)[0] ) ? \ - ( ( 0x73 == ((U8*)s)[1] || 0x74 == ((U8*)s)[1] ) ? 2 : 0 ) \ - : ( 0x74 == ((U8*)s)[0] ) ? \ - ( ( ( 0xCC == ((U8*)s)[1] ) && ( 0x88 == ((U8*)s)[2] ) ) ? 3 : 0 ) \ - : ( 0x77 == ((U8*)s)[0] || 0x79 == ((U8*)s)[0] ) ? \ - ( ( ( 0xCC == ((U8*)s)[1] ) && ( 0x8A == ((U8*)s)[2] ) ) ? 3 : 0 ) \ - : ( 0xCA == ((U8*)s)[0] ) ? \ - ( ( ( 0xBC == ((U8*)s)[1] ) && ( 0x6E == ((U8*)s)[2] ) ) ? 3 : 0 ) \ - : ( 0xCE == ((U8*)s)[0] ) ? \ - ( ( ( ((U8*)s)[1] & 0xFD ) == 0xAC ) ? \ - ( ( ( 0xCE == ((U8*)s)[2] ) && ( 0xB9 == ((U8*)s)[3] ) ) ? 4 : 0 )\ - : ( 0xB1 == ((U8*)s)[1] || 0xB7 == ((U8*)s)[1] ) ? \ - ( ( 0xCD == ((U8*)s)[2] ) ? \ - ( ( 0x82 == ((U8*)s)[3] ) ? 4 : 0 ) \ - : ( ( 0xCE == ((U8*)s)[2] ) && ( 0xB9 == ((U8*)s)[3] ) ) ? 4 : 0 )\ - : ( ( ( 0xB9 == ((U8*)s)[1] ) && ( 0xCD == ((U8*)s)[2] ) ) && ( 0x82 == ((U8*)s)[3] ) ) ? 4 : 0 )\ - : ( 0xCF == ((U8*)s)[0] ) ? \ - ( ( 0x81 == ((U8*)s)[1] ) ? \ - ( ( ( 0xCC == ((U8*)s)[2] ) && ( 0x93 == ((U8*)s)[3] ) ) ? 4 : 0 )\ - : ( 0x85 == ((U8*)s)[1] ) ? \ - ( ( 0xCC == ((U8*)s)[2] ) ? \ - ( ( 0x93 == ((U8*)s)[3] ) ? 4 : 0 ) \ - : ( ( 0xCD == ((U8*)s)[2] ) && ( 0x82 == ((U8*)s)[3] ) ) ? 4 : 0 )\ - : ( 0x89 == ((U8*)s)[1] ) ? \ - ( ( 0xCD == ((U8*)s)[2] ) ? \ - ( ( 0x82 == ((U8*)s)[3] ) ? 4 : 0 ) \ - : ( ( 0xCE == ((U8*)s)[2] ) && ( 0xB9 == ((U8*)s)[3] ) ) ? 4 : 0 )\ - : ( ( ( 0x8E == ((U8*)s)[1] ) && ( 0xCE == ((U8*)s)[2] ) ) && ( 0xB9 == ((U8*)s)[3] ) ) ? 4 : 0 )\ - : ( 0xD5 == ((U8*)s)[0] ) ? \ - ( ( 0xA5 == ((U8*)s)[1] ) ? \ - ( ( ( 0xD6 == ((U8*)s)[2] ) && ( 0x82 == ((U8*)s)[3] ) ) ? 4 : 0 )\ - : ( 0xB4 == ((U8*)s)[1] ) ? \ - ( ( ( 0xD5 == ((U8*)s)[2] ) && ( ( ( ((U8*)s)[3] & 0xF7 ) == 0xA5 ) || ((U8*)s)[3] == 0xAB || ((U8*)s)[3] == 0xB6 ) ) ? 4 : 0 )\ - : ( ( ( 0xBE == ((U8*)s)[1] ) && ( 0xD5 == ((U8*)s)[2] ) ) && ( 0xB6 == ((U8*)s)[3] ) ) ? 4 : 0 )\ - : ( 0xE1 == ((U8*)s)[0] ) ? \ - ( ( 0xBC == ((U8*)s)[1] ) ? \ - ( ( ( ( ( ((U8*)s)[2] & 0xD8 ) == 0x80 ) && ( 0xCE == ((U8*)s)[3] ) ) && ( 0xB9 == ((U8*)s)[4] ) ) ? 5 : 0 )\ - : ( ( ( ( 0xBD == ((U8*)s)[1] ) && ( ( ( ((U8*)s)[2] & 0xF8 ) == 0xA0 ) || ( ( ((U8*)s)[2] & 0xFB ) == 0xB0 ) || ((U8*)s)[2] == 0xBC ) ) && ( 0xCE == ((U8*)s)[3] ) ) && ( 0xB9 == ((U8*)s)[4] ) ) ? 5 : 0 )\ - : 0 ) +( ( 0x73 == NATIVE_TO_LATIN1(((U8*)s)[1]) || 0x74 == NATIVE_TO_LATIN1(((U8*)s)[1]) ) ? 2 : 0 ) /*** GENERATED CODE ***/ #define is_MULTI_CHAR_FOLD_utf8_safe_part1(s,e) \ -( ((e)-(s) > 3) ? \ - ( ( 0x61 == ((U8*)s)[0] ) ? \ - ( ( ( 0xCA == ((U8*)s)[1] ) && ( 0xBE == ((U8*)s)[2] ) ) ? 3 : 0 ) \ - : ( 0x66 == ((U8*)s)[0] ) ? \ - ( ( 0x66 == ((U8*)s)[1] ) ? \ - ( ( 0x69 == ((U8*)s)[2] || 0x6C == ((U8*)s)[2] ) ? 3 : 2 ) \ - : ( 0x69 == ((U8*)s)[1] || 0x6C == ((U8*)s)[1] ) ? 2 : 0 ) \ - : ( 0x68 == ((U8*)s)[0] ) ? \ - ( ( ( 0xCC == ((U8*)s)[1] ) && ( 0xB1 == ((U8*)s)[2] ) ) ? 3 : 0 ) \ - : ( 0x69 == ((U8*)s)[0] ) ? \ - ( ( ( 0xCC == ((U8*)s)[1] ) && ( 0x87 == ((U8*)s)[2] ) ) ? 3 : 0 ) \ - : ( 0x6A == ((U8*)s)[0] ) ? \ - ( ( ( 0xCC == ((U8*)s)[1] ) && ( 0x8C == ((U8*)s)[2] ) ) ? 3 : 0 ) \ - : ( 0x73 == ((U8*)s)[0] ) ? \ - ( ( 0x73 == ((U8*)s)[1] || 0x74 == ((U8*)s)[1] ) ? 2 : 0 ) \ - : ( 0x74 == ((U8*)s)[0] ) ? \ - ( ( ( 0xCC == ((U8*)s)[1] ) && ( 0x88 == ((U8*)s)[2] ) ) ? 3 : 0 ) \ - : ( 0x77 == ((U8*)s)[0] || 0x79 == ((U8*)s)[0] ) ? \ - ( ( ( 0xCC == ((U8*)s)[1] ) && ( 0x8A == ((U8*)s)[2] ) ) ? 3 : 0 ) \ - : ( 0xCA == ((U8*)s)[0] ) ? \ - ( ( ( 0xBC == ((U8*)s)[1] ) && ( 0x6E == ((U8*)s)[2] ) ) ? 3 : 0 ) \ - : ( 0xCE == ((U8*)s)[0] ) ? \ - ( ( ( ((U8*)s)[1] & 0xFD ) == 0xAC ) ? \ - ( ( ( 0xCE == ((U8*)s)[2] ) && ( 0xB9 == ((U8*)s)[3] ) ) ? 4 : 0 )\ - : ( 0xB1 == ((U8*)s)[1] || 0xB7 == ((U8*)s)[1] ) ? \ - ( ( 0xCD == ((U8*)s)[2] ) ? \ - ( ( 0x82 == ((U8*)s)[3] ) ? 4 : 0 ) \ - : ( ( 0xCE == ((U8*)s)[2] ) && ( 0xB9 == ((U8*)s)[3] ) ) ? 4 : 0 )\ - : ( ( ( 0xB9 == ((U8*)s)[1] ) && ( 0xCD == ((U8*)s)[2] ) ) && ( 0x82 == ((U8*)s)[3] ) ) ? 4 : 0 )\ - : ( 0xCF == ((U8*)s)[0] ) ? \ - ( ( 0x81 == ((U8*)s)[1] ) ? \ - ( ( ( 0xCC == ((U8*)s)[2] ) && ( 0x93 == ((U8*)s)[3] ) ) ? 4 : 0 )\ - : ( 0x85 == ((U8*)s)[1] ) ? \ - ( ( 0xCC == ((U8*)s)[2] ) ? \ - ( ( 0x93 == ((U8*)s)[3] ) ? 4 : 0 ) \ - : ( ( 0xCD == ((U8*)s)[2] ) && ( 0x82 == ((U8*)s)[3] ) ) ? 4 : 0 )\ - : ( 0x89 == ((U8*)s)[1] ) ? \ - ( ( 0xCD == ((U8*)s)[2] ) ? \ - ( ( 0x82 == ((U8*)s)[3] ) ? 4 : 0 ) \ - : ( ( 0xCE == ((U8*)s)[2] ) && ( 0xB9 == ((U8*)s)[3] ) ) ? 4 : 0 )\ - : ( ( ( 0x8E == ((U8*)s)[1] ) && ( 0xCE == ((U8*)s)[2] ) ) && ( 0xB9 == ((U8*)s)[3] ) ) ? 4 : 0 )\ - : ( 0xD5 == ((U8*)s)[0] ) ? \ - ( ( 0xA5 == ((U8*)s)[1] ) ? \ - ( ( ( 0xD6 == ((U8*)s)[2] ) && ( 0x82 == ((U8*)s)[3] ) ) ? 4 : 0 )\ - : ( 0xB4 == ((U8*)s)[1] ) ? \ - ( ( ( 0xD5 == ((U8*)s)[2] ) && ( ( ( ((U8*)s)[3] & 0xF7 ) == 0xA5 ) || ((U8*)s)[3] == 0xAB || ((U8*)s)[3] == 0xB6 ) ) ? 4 : 0 )\ - : ( ( ( 0xBE == ((U8*)s)[1] ) && ( 0xD5 == ((U8*)s)[2] ) ) && ( 0xB6 == ((U8*)s)[3] ) ) ? 4 : 0 )\ - : 0 ) \ -: ((e)-(s) > 2) ? \ - ( ( 0x61 == ((U8*)s)[0] ) ? \ - ( ( ( 0xCA == ((U8*)s)[1] ) && ( 0xBE == ((U8*)s)[2] ) ) ? 3 : 0 ) \ - : ( 0x66 == ((U8*)s)[0] ) ? \ - ( ( 0x66 == ((U8*)s)[1] ) ? \ - ( ( 0x69 == ((U8*)s)[2] || 0x6C == ((U8*)s)[2] ) ? 3 : 2 ) \ - : ( 0x69 == ((U8*)s)[1] || 0x6C == ((U8*)s)[1] ) ? 2 : 0 ) \ - : ( 0x68 == ((U8*)s)[0] ) ? \ - ( ( ( 0xCC == ((U8*)s)[1] ) && ( 0xB1 == ((U8*)s)[2] ) ) ? 3 : 0 ) \ - : ( 0x69 == ((U8*)s)[0] ) ? \ - ( ( ( 0xCC == ((U8*)s)[1] ) && ( 0x87 == ((U8*)s)[2] ) ) ? 3 : 0 ) \ - : ( 0x6A == ((U8*)s)[0] ) ? \ - ( ( ( 0xCC == ((U8*)s)[1] ) && ( 0x8C == ((U8*)s)[2] ) ) ? 3 : 0 ) \ - : ( 0x73 == ((U8*)s)[0] ) ? \ - ( ( 0x73 == ((U8*)s)[1] || 0x74 == ((U8*)s)[1] ) ? 2 : 0 ) \ - : ( 0x74 == ((U8*)s)[0] ) ? \ - ( ( ( 0xCC == ((U8*)s)[1] ) && ( 0x88 == ((U8*)s)[2] ) ) ? 3 : 0 ) \ - : ( 0x77 == ((U8*)s)[0] || 0x79 == ((U8*)s)[0] ) ? \ - ( ( ( 0xCC == ((U8*)s)[1] ) && ( 0x8A == ((U8*)s)[2] ) ) ? 3 : 0 ) \ - : ( ( ( 0xCA == ((U8*)s)[0] ) && ( 0xBC == ((U8*)s)[1] ) ) && ( 0x6E == ((U8*)s)[2] ) ) ? 3 : 0 )\ -: ((e)-(s) > 1) ? \ - ( ( 0x66 == ((U8*)s)[0] ) ? \ - ( ( 0x66 == ((U8*)s)[1] || 0x69 == ((U8*)s)[1] || 0x6C == ((U8*)s)[1] ) ? 2 : 0 )\ - : ( ( 0x73 == ((U8*)s)[0] ) && ( 0x73 == ((U8*)s)[1] || 0x74 == ((U8*)s)[1] ) ) ? 2 : 0 )\ -: 0 ) - - -/*** GENERATED CODE ***/ -#define is_MULTI_CHAR_FOLD_utf8_safe(s,e) \ -( ((e)-(s) > 5) ? \ - ( ( 0x61 == ((U8*)s)[0] ) ? \ - ( ( ( 0xCA == ((U8*)s)[1] ) && ( 0xBE == ((U8*)s)[2] ) ) ? 3 : 0 ) \ - : ( 0x66 == ((U8*)s)[0] ) ? \ - ( ( 0x66 == ((U8*)s)[1] ) ? \ - ( ( 0x69 == ((U8*)s)[2] || 0x6C == ((U8*)s)[2] ) ? 3 : 2 ) \ - : ( 0x69 == ((U8*)s)[1] || 0x6C == ((U8*)s)[1] ) ? 2 : 0 ) \ - : ( 0x68 == ((U8*)s)[0] ) ? \ - ( ( ( 0xCC == ((U8*)s)[1] ) && ( 0xB1 == ((U8*)s)[2] ) ) ? 3 : 0 ) \ - : ( 0x69 == ((U8*)s)[0] ) ? \ - ( ( ( 0xCC == ((U8*)s)[1] ) && ( 0x87 == ((U8*)s)[2] ) ) ? 3 : 0 ) \ - : ( 0x6A == ((U8*)s)[0] ) ? \ - ( ( ( 0xCC == ((U8*)s)[1] ) && ( 0x8C == ((U8*)s)[2] ) ) ? 3 : 0 ) \ - : ( 0x73 == ((U8*)s)[0] ) ? \ - ( ( 0x73 == ((U8*)s)[1] || 0x74 == ((U8*)s)[1] ) ? 2 : 0 ) \ - : ( 0x74 == ((U8*)s)[0] ) ? \ - ( ( ( 0xCC == ((U8*)s)[1] ) && ( 0x88 == ((U8*)s)[2] ) ) ? 3 : 0 ) \ - : ( 0x77 == ((U8*)s)[0] || 0x79 == ((U8*)s)[0] ) ? \ - ( ( ( 0xCC == ((U8*)s)[1] ) && ( 0x8A == ((U8*)s)[2] ) ) ? 3 : 0 ) \ - : ( 0xCA == ((U8*)s)[0] ) ? \ - ( ( ( 0xBC == ((U8*)s)[1] ) && ( 0x6E == ((U8*)s)[2] ) ) ? 3 : 0 ) \ - : ( 0xCE == ((U8*)s)[0] ) ? \ - ( ( ( ((U8*)s)[1] & 0xFD ) == 0xAC ) ? \ - ( ( ( 0xCE == ((U8*)s)[2] ) && ( 0xB9 == ((U8*)s)[3] ) ) ? 4 : 0 )\ - : ( 0xB1 == ((U8*)s)[1] || 0xB7 == ((U8*)s)[1] ) ? \ - ( ( 0xCD == ((U8*)s)[2] ) ? \ - ( ( 0x82 == ((U8*)s)[3] ) ? \ - ( ( ( 0xCE == ((U8*)s)[4] ) && ( 0xB9 == ((U8*)s)[5] ) ) ? 6 : 4 )\ +( ( 0x74 == NATIVE_TO_LATIN1(((U8*)s)[0]) ) ? \ + ( ( ( 0xCC == NATIVE_TO_LATIN1(((U8*)s)[1]) ) && ( 0x88 == NATIVE_TO_LATIN1(((U8*)s)[2]) ) ) ? 3 : 0 )\ + : ( 0x77 == NATIVE_TO_LATIN1(((U8*)s)[0]) || 0x79 == NATIVE_TO_LATIN1(((U8*)s)[0]) ) ?\ + ( ( ( 0xCC == NATIVE_TO_LATIN1(((U8*)s)[1]) ) && ( 0x8A == NATIVE_TO_LATIN1(((U8*)s)[2]) ) ) ? 3 : 0 )\ + : ( 0xC5 == NATIVE_TO_LATIN1(((U8*)s)[0]) ) ? \ + ( ( ( ( 0xBF == NATIVE_TO_LATIN1(((U8*)s)[1]) ) && ( 0xC5 == NATIVE_TO_LATIN1(((U8*)s)[2]) ) ) && ( 0xBF == NATIVE_TO_LATIN1(((U8*)s)[3]) ) ) ? 4 : 0 )\ + : ( 0xCA == NATIVE_TO_LATIN1(((U8*)s)[0]) ) ? \ + ( ( ( 0xBC == NATIVE_TO_LATIN1(((U8*)s)[1]) ) && ( 0x6E == NATIVE_TO_LATIN1(((U8*)s)[2]) ) ) ? 3 : 0 )\ + : ( 0xCE == NATIVE_TO_LATIN1(((U8*)s)[0]) ) ? \ + ( ( ( NATIVE_TO_LATIN1(((U8*)s)[1]) & 0xFD ) == 0xAC ) ? \ + ( ( ( 0xCE == NATIVE_TO_LATIN1(((U8*)s)[2]) ) && ( 0xB9 == NATIVE_TO_LATIN1(((U8*)s)[3]) ) ) ? 4 : 0 )\ + : ( 0xB1 == NATIVE_TO_LATIN1(((U8*)s)[1]) || 0xB7 == NATIVE_TO_LATIN1(((U8*)s)[1]) ) ?\ + ( ( 0xCD == NATIVE_TO_LATIN1(((U8*)s)[2]) ) ? \ + ( ( 0x82 == NATIVE_TO_LATIN1(((U8*)s)[3]) ) ? \ + ( ( ( 0xCE == NATIVE_TO_LATIN1(((U8*)s)[4]) ) && ( 0xB9 == NATIVE_TO_LATIN1(((U8*)s)[5]) ) ) ? 6 : 4 )\ : 0 ) \ - : ( ( 0xCE == ((U8*)s)[2] ) && ( 0xB9 == ((U8*)s)[3] ) ) ? 4 : 0 )\ - : ( 0xB9 == ((U8*)s)[1] ) ? \ - ( ( 0xCC == ((U8*)s)[2] ) ? \ - ( ( 0x88 == ((U8*)s)[3] ) ? \ - ( ( 0xCC == ((U8*)s)[4] ) ? \ - ( ( ( ((U8*)s)[5] & 0xFE ) == 0x80 ) ? 6 : 0 ) \ - : ( ( 0xCD == ((U8*)s)[4] ) && ( 0x82 == ((U8*)s)[5] ) ) ? 6 : 0 )\ + : ( ( 0xCE == NATIVE_TO_LATIN1(((U8*)s)[2]) ) && ( 0xB9 == NATIVE_TO_LATIN1(((U8*)s)[3]) ) ) ? 4 : 0 )\ + : ( 0xB9 == NATIVE_TO_LATIN1(((U8*)s)[1]) ) ? \ + ( ( 0xCC == NATIVE_TO_LATIN1(((U8*)s)[2]) ) ? \ + ( ( 0x88 == NATIVE_TO_LATIN1(((U8*)s)[3]) ) ? \ + ( ( 0xCC == NATIVE_TO_LATIN1(((U8*)s)[4]) ) ? \ + ( ( ( NATIVE_TO_LATIN1(((U8*)s)[5]) & 0xFE ) == 0x80 ) ? 6 : 0 )\ + : ( ( 0xCD == NATIVE_TO_LATIN1(((U8*)s)[4]) ) && ( 0x82 == NATIVE_TO_LATIN1(((U8*)s)[5]) ) ) ? 6 : 0 )\ : 0 ) \ - : ( ( 0xCD == ((U8*)s)[2] ) && ( 0x82 == ((U8*)s)[3] ) ) ? 4 : 0 )\ + : ( ( 0xCD == NATIVE_TO_LATIN1(((U8*)s)[2]) ) && ( 0x82 == NATIVE_TO_LATIN1(((U8*)s)[3]) ) ) ? 4 : 0 )\ : 0 ) \ - : ( 0xCF == ((U8*)s)[0] ) ? \ - ( ( 0x81 == ((U8*)s)[1] ) ? \ - ( ( ( 0xCC == ((U8*)s)[2] ) && ( 0x93 == ((U8*)s)[3] ) ) ? 4 : 0 )\ - : ( 0x85 == ((U8*)s)[1] ) ? \ - ( ( 0xCC == ((U8*)s)[2] ) ? \ - ( ( 0x88 == ((U8*)s)[3] ) ? \ - ( ( 0xCC == ((U8*)s)[4] ) ? \ - ( ( ( ((U8*)s)[5] & 0xFE ) == 0x80 ) ? 6 : 0 ) \ - : ( ( 0xCD == ((U8*)s)[4] ) && ( 0x82 == ((U8*)s)[5] ) ) ? 6 : 0 )\ - : ( 0x93 == ((U8*)s)[3] ) ? \ - ( ( 0xCC == ((U8*)s)[4] ) ? \ - ( ( ( ((U8*)s)[5] & 0xFE ) == 0x80 ) ? 6 : 4 ) \ - : ( ( 0xCD == ((U8*)s)[4] ) && ( 0x82 == ((U8*)s)[5] ) ) ? 6 : 4 )\ + : ( 0xCF == NATIVE_TO_LATIN1(((U8*)s)[0]) ) ? \ + ( ( 0x81 == NATIVE_TO_LATIN1(((U8*)s)[1]) ) ? \ + ( ( ( 0xCC == NATIVE_TO_LATIN1(((U8*)s)[2]) ) && ( 0x93 == NATIVE_TO_LATIN1(((U8*)s)[3]) ) ) ? 4 : 0 )\ + : ( 0x85 == NATIVE_TO_LATIN1(((U8*)s)[1]) ) ? \ + ( ( 0xCC == NATIVE_TO_LATIN1(((U8*)s)[2]) ) ? \ + ( ( 0x88 == NATIVE_TO_LATIN1(((U8*)s)[3]) ) ? \ + ( ( 0xCC == NATIVE_TO_LATIN1(((U8*)s)[4]) ) ? \ + ( ( ( NATIVE_TO_LATIN1(((U8*)s)[5]) & 0xFE ) == 0x80 ) ? 6 : 0 )\ + : ( ( 0xCD == NATIVE_TO_LATIN1(((U8*)s)[4]) ) && ( 0x82 == NATIVE_TO_LATIN1(((U8*)s)[5]) ) ) ? 6 : 0 )\ + : ( 0x93 == NATIVE_TO_LATIN1(((U8*)s)[3]) ) ? \ + ( ( 0xCC == NATIVE_TO_LATIN1(((U8*)s)[4]) ) ? \ + ( ( ( NATIVE_TO_LATIN1(((U8*)s)[5]) & 0xFE ) == 0x80 ) ? 6 : 4 )\ + : ( ( 0xCD == NATIVE_TO_LATIN1(((U8*)s)[4]) ) && ( 0x82 == NATIVE_TO_LATIN1(((U8*)s)[5]) ) ) ? 6 : 4 )\ : 0 ) \ - : ( ( 0xCD == ((U8*)s)[2] ) && ( 0x82 == ((U8*)s)[3] ) ) ? 4 : 0 )\ - : ( 0x89 == ((U8*)s)[1] ) ? \ - ( ( 0xCD == ((U8*)s)[2] ) ? \ - ( ( 0x82 == ((U8*)s)[3] ) ? \ - ( ( ( 0xCE == ((U8*)s)[4] ) && ( 0xB9 == ((U8*)s)[5] ) ) ? 6 : 4 )\ + : ( ( 0xCD == NATIVE_TO_LATIN1(((U8*)s)[2]) ) && ( 0x82 == NATIVE_TO_LATIN1(((U8*)s)[3]) ) ) ? 4 : 0 )\ + : ( 0x89 == NATIVE_TO_LATIN1(((U8*)s)[1]) ) ? \ + ( ( 0xCD == NATIVE_TO_LATIN1(((U8*)s)[2]) ) ? \ + ( ( 0x82 == NATIVE_TO_LATIN1(((U8*)s)[3]) ) ? \ + ( ( ( 0xCE == NATIVE_TO_LATIN1(((U8*)s)[4]) ) && ( 0xB9 == NATIVE_TO_LATIN1(((U8*)s)[5]) ) ) ? 6 : 4 )\ : 0 ) \ - : ( ( 0xCE == ((U8*)s)[2] ) && ( 0xB9 == ((U8*)s)[3] ) ) ? 4 : 0 )\ - : ( ( ( 0x8E == ((U8*)s)[1] ) && ( 0xCE == ((U8*)s)[2] ) ) && ( 0xB9 == ((U8*)s)[3] ) ) ? 4 : 0 )\ - : ( 0xD5 == ((U8*)s)[0] ) ? \ - ( ( 0xA5 == ((U8*)s)[1] ) ? \ - ( ( ( 0xD6 == ((U8*)s)[2] ) && ( 0x82 == ((U8*)s)[3] ) ) ? 4 : 0 )\ - : ( 0xB4 == ((U8*)s)[1] ) ? \ - ( ( ( 0xD5 == ((U8*)s)[2] ) && ( ( ( ((U8*)s)[3] & 0xF7 ) == 0xA5 ) || ((U8*)s)[3] == 0xAB || ((U8*)s)[3] == 0xB6 ) ) ? 4 : 0 )\ - : ( ( ( 0xBE == ((U8*)s)[1] ) && ( 0xD5 == ((U8*)s)[2] ) ) && ( 0xB6 == ((U8*)s)[3] ) ) ? 4 : 0 )\ - : ( 0xE1 == ((U8*)s)[0] ) ? \ - ( ( 0xBC == ((U8*)s)[1] ) ? \ - ( ( ( ( ( ((U8*)s)[2] & 0xD8 ) == 0x80 ) && ( 0xCE == ((U8*)s)[3] ) ) && ( 0xB9 == ((U8*)s)[4] ) ) ? 5 : 0 )\ - : ( ( ( ( 0xBD == ((U8*)s)[1] ) && ( ( ( ((U8*)s)[2] & 0xF8 ) == 0xA0 ) || ( ( ((U8*)s)[2] & 0xFB ) == 0xB0 ) || ((U8*)s)[2] == 0xBC ) ) && ( 0xCE == ((U8*)s)[3] ) ) && ( 0xB9 == ((U8*)s)[4] ) ) ? 5 : 0 )\ + : ( ( 0xCE == NATIVE_TO_LATIN1(((U8*)s)[2]) ) && ( 0xB9 == NATIVE_TO_LATIN1(((U8*)s)[3]) ) ) ? 4 : 0 )\ + : ( ( ( 0x8E == NATIVE_TO_LATIN1(((U8*)s)[1]) ) && ( 0xCE == NATIVE_TO_LATIN1(((U8*)s)[2]) ) ) && ( 0xB9 == NATIVE_TO_LATIN1(((U8*)s)[3]) ) ) ? 4 : 0 )\ + : ( 0xD5 == NATIVE_TO_LATIN1(((U8*)s)[0]) ) ? \ + ( ( 0xA5 == NATIVE_TO_LATIN1(((U8*)s)[1]) ) ? \ + ( ( ( 0xD6 == NATIVE_TO_LATIN1(((U8*)s)[2]) ) && ( 0x82 == NATIVE_TO_LATIN1(((U8*)s)[3]) ) ) ? 4 : 0 )\ + : ( 0xB4 == NATIVE_TO_LATIN1(((U8*)s)[1]) ) ? \ + ( ( ( 0xD5 == NATIVE_TO_LATIN1(((U8*)s)[2]) ) && ( ( ( NATIVE_TO_LATIN1(((U8*)s)[3]) & 0xF7 ) == 0xA5 ) || NATIVE_TO_LATIN1(((U8*)s)[3]) == 0xAB || NATIVE_TO_LATIN1(((U8*)s)[3]) == 0xB6 ) ) ? 4 : 0 )\ + : ( ( ( 0xBE == NATIVE_TO_LATIN1(((U8*)s)[1]) ) && ( 0xD5 == NATIVE_TO_LATIN1(((U8*)s)[2]) ) ) && ( 0xB6 == NATIVE_TO_LATIN1(((U8*)s)[3]) ) ) ? 4 : 0 )\ + : ( 0xE1 == NATIVE_TO_LATIN1(((U8*)s)[0]) ) ? \ + ( ( 0xBC == NATIVE_TO_LATIN1(((U8*)s)[1]) ) ? \ + ( ( ( ( ( NATIVE_TO_LATIN1(((U8*)s)[2]) & 0xD8 ) == 0x80 ) && ( 0xCE == NATIVE_TO_LATIN1(((U8*)s)[3]) ) ) && ( 0xB9 == NATIVE_TO_LATIN1(((U8*)s)[4]) ) ) ? 5 : 0 )\ + : ( ( ( ( 0xBD == NATIVE_TO_LATIN1(((U8*)s)[1]) ) && ( ( ( NATIVE_TO_LATIN1(((U8*)s)[2]) & 0xF8 ) == 0xA0 ) || ( ( NATIVE_TO_LATIN1(((U8*)s)[2]) & 0xFB ) == 0xB0 ) || NATIVE_TO_LATIN1(((U8*)s)[2]) == 0xBC ) ) && ( 0xCE == NATIVE_TO_LATIN1(((U8*)s)[3]) ) ) && ( 0xB9 == NATIVE_TO_LATIN1(((U8*)s)[4]) ) ) ? 5 : 0 )\ + : 0 ) + + +/*** GENERATED CODE ***/ +#define is_MULTI_CHAR_FOLD_utf8_safe_part2(s,e) \ +( ( 0x61 == NATIVE_TO_LATIN1(((U8*)s)[0]) ) ? \ + ( ( ( 0xCA == NATIVE_TO_LATIN1(((U8*)s)[1]) ) && ( 0xBE == NATIVE_TO_LATIN1(((U8*)s)[2]) ) ) ? 3 : 0 )\ + : ( 0x66 == NATIVE_TO_LATIN1(((U8*)s)[0]) ) ? \ + ( ( 0x66 == NATIVE_TO_LATIN1(((U8*)s)[1]) ) ? \ + ( ( 0x69 == NATIVE_TO_LATIN1(((U8*)s)[2]) || 0x6C == NATIVE_TO_LATIN1(((U8*)s)[2]) ) ? 3 : 2 )\ + : ( 0x69 == NATIVE_TO_LATIN1(((U8*)s)[1]) || 0x6C == NATIVE_TO_LATIN1(((U8*)s)[1]) ) ? 2 : 0 )\ + : ( 0x68 == NATIVE_TO_LATIN1(((U8*)s)[0]) ) ? \ + ( ( ( 0xCC == NATIVE_TO_LATIN1(((U8*)s)[1]) ) && ( 0xB1 == NATIVE_TO_LATIN1(((U8*)s)[2]) ) ) ? 3 : 0 )\ + : ( 0x69 == NATIVE_TO_LATIN1(((U8*)s)[0]) ) ? \ + ( ( ( 0xCC == NATIVE_TO_LATIN1(((U8*)s)[1]) ) && ( 0x87 == NATIVE_TO_LATIN1(((U8*)s)[2]) ) ) ? 3 : 0 )\ + : ( 0x6A == NATIVE_TO_LATIN1(((U8*)s)[0]) ) ? \ + ( ( ( 0xCC == NATIVE_TO_LATIN1(((U8*)s)[1]) ) && ( 0x8C == NATIVE_TO_LATIN1(((U8*)s)[2]) ) ) ? 3 : 0 )\ + : ( 0x73 == NATIVE_TO_LATIN1(((U8*)s)[0]) ) ? \ + ( ( 0x73 == NATIVE_TO_LATIN1(((U8*)s)[1]) || 0x74 == NATIVE_TO_LATIN1(((U8*)s)[1]) ) ? 2 : 0 )\ + : ( 0x74 == NATIVE_TO_LATIN1(((U8*)s)[0]) ) ? \ + ( ( ( 0xCC == NATIVE_TO_LATIN1(((U8*)s)[1]) ) && ( 0x88 == NATIVE_TO_LATIN1(((U8*)s)[2]) ) ) ? 3 : 0 )\ + : ( 0x77 == NATIVE_TO_LATIN1(((U8*)s)[0]) || 0x79 == NATIVE_TO_LATIN1(((U8*)s)[0]) ) ?\ + ( ( ( 0xCC == NATIVE_TO_LATIN1(((U8*)s)[1]) ) && ( 0x8A == NATIVE_TO_LATIN1(((U8*)s)[2]) ) ) ? 3 : 0 )\ + : ( 0xC5 == NATIVE_TO_LATIN1(((U8*)s)[0]) ) ? \ + ( ( ( ( 0xBF == NATIVE_TO_LATIN1(((U8*)s)[1]) ) && ( 0xC5 == NATIVE_TO_LATIN1(((U8*)s)[2]) ) ) && ( 0xBF == NATIVE_TO_LATIN1(((U8*)s)[3]) ) ) ? 4 : 0 )\ + : ( 0xCA == NATIVE_TO_LATIN1(((U8*)s)[0]) ) ? \ + ( ( ( 0xBC == NATIVE_TO_LATIN1(((U8*)s)[1]) ) && ( 0x6E == NATIVE_TO_LATIN1(((U8*)s)[2]) ) ) ? 3 : 0 )\ + : ( 0xCE == NATIVE_TO_LATIN1(((U8*)s)[0]) ) ? \ + ( ( ( NATIVE_TO_LATIN1(((U8*)s)[1]) & 0xFD ) == 0xAC ) ? \ + ( ( ( 0xCE == NATIVE_TO_LATIN1(((U8*)s)[2]) ) && ( 0xB9 == NATIVE_TO_LATIN1(((U8*)s)[3]) ) ) ? 4 : 0 )\ + : ( 0xB1 == NATIVE_TO_LATIN1(((U8*)s)[1]) || 0xB7 == NATIVE_TO_LATIN1(((U8*)s)[1]) ) ?\ + ( ( 0xCD == NATIVE_TO_LATIN1(((U8*)s)[2]) ) ? \ + ( ( 0x82 == NATIVE_TO_LATIN1(((U8*)s)[3]) ) ? 4 : 0 ) \ + : ( ( 0xCE == NATIVE_TO_LATIN1(((U8*)s)[2]) ) && ( 0xB9 == NATIVE_TO_LATIN1(((U8*)s)[3]) ) ) ? 4 : 0 )\ + : ( ( ( 0xB9 == NATIVE_TO_LATIN1(((U8*)s)[1]) ) && ( 0xCD == NATIVE_TO_LATIN1(((U8*)s)[2]) ) ) && ( 0x82 == NATIVE_TO_LATIN1(((U8*)s)[3]) ) ) ? 4 : 0 )\ + : ( 0xCF == NATIVE_TO_LATIN1(((U8*)s)[0]) ) ? \ + ( ( 0x81 == NATIVE_TO_LATIN1(((U8*)s)[1]) ) ? \ + ( ( ( 0xCC == NATIVE_TO_LATIN1(((U8*)s)[2]) ) && ( 0x93 == NATIVE_TO_LATIN1(((U8*)s)[3]) ) ) ? 4 : 0 )\ + : ( 0x85 == NATIVE_TO_LATIN1(((U8*)s)[1]) ) ? \ + ( ( 0xCC == NATIVE_TO_LATIN1(((U8*)s)[2]) ) ? \ + ( ( 0x93 == NATIVE_TO_LATIN1(((U8*)s)[3]) ) ? 4 : 0 ) \ + : ( ( 0xCD == NATIVE_TO_LATIN1(((U8*)s)[2]) ) && ( 0x82 == NATIVE_TO_LATIN1(((U8*)s)[3]) ) ) ? 4 : 0 )\ + : ( 0x89 == NATIVE_TO_LATIN1(((U8*)s)[1]) ) ? \ + ( ( 0xCD == NATIVE_TO_LATIN1(((U8*)s)[2]) ) ? \ + ( ( 0x82 == NATIVE_TO_LATIN1(((U8*)s)[3]) ) ? 4 : 0 ) \ + : ( ( 0xCE == NATIVE_TO_LATIN1(((U8*)s)[2]) ) && ( 0xB9 == NATIVE_TO_LATIN1(((U8*)s)[3]) ) ) ? 4 : 0 )\ + : ( ( ( 0x8E == NATIVE_TO_LATIN1(((U8*)s)[1]) ) && ( 0xCE == NATIVE_TO_LATIN1(((U8*)s)[2]) ) ) && ( 0xB9 == NATIVE_TO_LATIN1(((U8*)s)[3]) ) ) ? 4 : 0 )\ + : ( 0xD5 == NATIVE_TO_LATIN1(((U8*)s)[0]) ) ? \ + ( ( 0xA5 == NATIVE_TO_LATIN1(((U8*)s)[1]) ) ? \ + ( ( ( 0xD6 == NATIVE_TO_LATIN1(((U8*)s)[2]) ) && ( 0x82 == NATIVE_TO_LATIN1(((U8*)s)[3]) ) ) ? 4 : 0 )\ + : ( 0xB4 == NATIVE_TO_LATIN1(((U8*)s)[1]) ) ? \ + ( ( ( 0xD5 == NATIVE_TO_LATIN1(((U8*)s)[2]) ) && ( ( ( NATIVE_TO_LATIN1(((U8*)s)[3]) & 0xF7 ) == 0xA5 ) || NATIVE_TO_LATIN1(((U8*)s)[3]) == 0xAB || NATIVE_TO_LATIN1(((U8*)s)[3]) == 0xB6 ) ) ? 4 : 0 )\ + : ( ( ( 0xBE == NATIVE_TO_LATIN1(((U8*)s)[1]) ) && ( 0xD5 == NATIVE_TO_LATIN1(((U8*)s)[2]) ) ) && ( 0xB6 == NATIVE_TO_LATIN1(((U8*)s)[3]) ) ) ? 4 : 0 )\ + : 0 ) + + +/*** GENERATED CODE ***/ +#define is_MULTI_CHAR_FOLD_utf8_safe_part3(s,e) \ +( ((e)-(s) > 2) ? \ + ( ( 0x61 == NATIVE_TO_LATIN1(((U8*)s)[0]) ) ? \ + ( ( ( 0xCA == NATIVE_TO_LATIN1(((U8*)s)[1]) ) && ( 0xBE == NATIVE_TO_LATIN1(((U8*)s)[2]) ) ) ? 3 : 0 )\ + : ( 0x66 == NATIVE_TO_LATIN1(((U8*)s)[0]) ) ? \ + ( ( 0x66 == NATIVE_TO_LATIN1(((U8*)s)[1]) ) ? \ + ( ( 0x69 == NATIVE_TO_LATIN1(((U8*)s)[2]) || 0x6C == NATIVE_TO_LATIN1(((U8*)s)[2]) ) ? 3 : 2 )\ + : ( 0x69 == NATIVE_TO_LATIN1(((U8*)s)[1]) || 0x6C == NATIVE_TO_LATIN1(((U8*)s)[1]) ) ? 2 : 0 )\ + : ( 0x68 == NATIVE_TO_LATIN1(((U8*)s)[0]) ) ? \ + ( ( ( 0xCC == NATIVE_TO_LATIN1(((U8*)s)[1]) ) && ( 0xB1 == NATIVE_TO_LATIN1(((U8*)s)[2]) ) ) ? 3 : 0 )\ + : ( 0x69 == NATIVE_TO_LATIN1(((U8*)s)[0]) ) ? \ + ( ( ( 0xCC == NATIVE_TO_LATIN1(((U8*)s)[1]) ) && ( 0x87 == NATIVE_TO_LATIN1(((U8*)s)[2]) ) ) ? 3 : 0 )\ + : ( 0x6A == NATIVE_TO_LATIN1(((U8*)s)[0]) ) ? \ + ( ( ( 0xCC == NATIVE_TO_LATIN1(((U8*)s)[1]) ) && ( 0x8C == NATIVE_TO_LATIN1(((U8*)s)[2]) ) ) ? 3 : 0 )\ + : ( 0x73 == NATIVE_TO_LATIN1(((U8*)s)[0]) ) ? \ + ( ( 0x73 == NATIVE_TO_LATIN1(((U8*)s)[1]) || 0x74 == NATIVE_TO_LATIN1(((U8*)s)[1]) ) ? 2 : 0 )\ + : ( 0x74 == NATIVE_TO_LATIN1(((U8*)s)[0]) ) ? \ + ( ( ( 0xCC == NATIVE_TO_LATIN1(((U8*)s)[1]) ) && ( 0x88 == NATIVE_TO_LATIN1(((U8*)s)[2]) ) ) ? 3 : 0 )\ + : ( 0x77 == NATIVE_TO_LATIN1(((U8*)s)[0]) || 0x79 == NATIVE_TO_LATIN1(((U8*)s)[0]) ) ?\ + ( ( ( 0xCC == NATIVE_TO_LATIN1(((U8*)s)[1]) ) && ( 0x8A == NATIVE_TO_LATIN1(((U8*)s)[2]) ) ) ? 3 : 0 )\ + : ( ( ( 0xCA == NATIVE_TO_LATIN1(((U8*)s)[0]) ) && ( 0xBC == NATIVE_TO_LATIN1(((U8*)s)[1]) ) ) && ( 0x6E == NATIVE_TO_LATIN1(((U8*)s)[2]) ) ) ? 3 : 0 )\ +: ((e)-(s) > 1) ? \ + ( ( 0x66 == NATIVE_TO_LATIN1(((U8*)s)[0]) ) ? \ + ( ( 0x66 == NATIVE_TO_LATIN1(((U8*)s)[1]) || 0x69 == NATIVE_TO_LATIN1(((U8*)s)[1]) || 0x6C == NATIVE_TO_LATIN1(((U8*)s)[1]) ) ? 2 : 0 )\ + : ( ( 0x73 == NATIVE_TO_LATIN1(((U8*)s)[0]) ) && ( 0x73 == NATIVE_TO_LATIN1(((U8*)s)[1]) || 0x74 == NATIVE_TO_LATIN1(((U8*)s)[1]) ) ) ? 2 : 0 )\ +: 0 ) + + +/*** GENERATED CODE ***/ +#define is_MULTI_CHAR_FOLD_utf8_safe_part4(s,e) \ +( ( 0x61 == NATIVE_TO_LATIN1(((U8*)s)[0]) ) ? \ + ( ( ( 0xCA == NATIVE_TO_LATIN1(((U8*)s)[1]) ) && ( 0xBE == NATIVE_TO_LATIN1(((U8*)s)[2]) ) ) ? 3 : 0 )\ + : ( 0x66 == NATIVE_TO_LATIN1(((U8*)s)[0]) ) ? \ + ( ( 0x66 == NATIVE_TO_LATIN1(((U8*)s)[1]) ) ? \ + ( ( 0x69 == NATIVE_TO_LATIN1(((U8*)s)[2]) || 0x6C == NATIVE_TO_LATIN1(((U8*)s)[2]) ) ? 3 : 2 )\ + : ( 0x69 == NATIVE_TO_LATIN1(((U8*)s)[1]) || 0x6C == NATIVE_TO_LATIN1(((U8*)s)[1]) ) ? 2 : 0 )\ + : ( 0x68 == NATIVE_TO_LATIN1(((U8*)s)[0]) ) ? \ + ( ( ( 0xCC == NATIVE_TO_LATIN1(((U8*)s)[1]) ) && ( 0xB1 == NATIVE_TO_LATIN1(((U8*)s)[2]) ) ) ? 3 : 0 )\ + : ( 0x69 == NATIVE_TO_LATIN1(((U8*)s)[0]) ) ? \ + ( ( ( 0xCC == NATIVE_TO_LATIN1(((U8*)s)[1]) ) && ( 0x87 == NATIVE_TO_LATIN1(((U8*)s)[2]) ) ) ? 3 : 0 )\ + : ( 0x6A == NATIVE_TO_LATIN1(((U8*)s)[0]) ) ? \ + ( ( ( 0xCC == NATIVE_TO_LATIN1(((U8*)s)[1]) ) && ( 0x8C == NATIVE_TO_LATIN1(((U8*)s)[2]) ) ) ? 3 : 0 )\ + : ( 0x73 == NATIVE_TO_LATIN1(((U8*)s)[0]) ) ? is_MULTI_CHAR_FOLD_utf8_safe_part0(s,e) : is_MULTI_CHAR_FOLD_utf8_safe_part1(s,e) ) + + +/*** GENERATED CODE ***/ +#define is_MULTI_CHAR_FOLD_utf8_safe_part5(s,e) \ +( ((e)-(s) > 4) ? \ + ( ( 0x61 == NATIVE_TO_LATIN1(((U8*)s)[0]) ) ? \ + ( ( ( 0xCA == NATIVE_TO_LATIN1(((U8*)s)[1]) ) && ( 0xBE == NATIVE_TO_LATIN1(((U8*)s)[2]) ) ) ? 3 : 0 )\ + : ( 0x66 == NATIVE_TO_LATIN1(((U8*)s)[0]) ) ? \ + ( ( 0x66 == NATIVE_TO_LATIN1(((U8*)s)[1]) ) ? \ + ( ( 0x69 == NATIVE_TO_LATIN1(((U8*)s)[2]) || 0x6C == NATIVE_TO_LATIN1(((U8*)s)[2]) ) ? 3 : 2 )\ + : ( 0x69 == NATIVE_TO_LATIN1(((U8*)s)[1]) || 0x6C == NATIVE_TO_LATIN1(((U8*)s)[1]) ) ? 2 : 0 )\ + : ( 0x68 == NATIVE_TO_LATIN1(((U8*)s)[0]) ) ? \ + ( ( ( 0xCC == NATIVE_TO_LATIN1(((U8*)s)[1]) ) && ( 0xB1 == NATIVE_TO_LATIN1(((U8*)s)[2]) ) ) ? 3 : 0 )\ + : ( 0x69 == NATIVE_TO_LATIN1(((U8*)s)[0]) ) ? \ + ( ( ( 0xCC == NATIVE_TO_LATIN1(((U8*)s)[1]) ) && ( 0x87 == NATIVE_TO_LATIN1(((U8*)s)[2]) ) ) ? 3 : 0 )\ + : ( 0x6A == NATIVE_TO_LATIN1(((U8*)s)[0]) ) ? \ + ( ( ( 0xCC == NATIVE_TO_LATIN1(((U8*)s)[1]) ) && ( 0x8C == NATIVE_TO_LATIN1(((U8*)s)[2]) ) ) ? 3 : 0 )\ + : ( 0x73 == NATIVE_TO_LATIN1(((U8*)s)[0]) ) ? \ + ( ( 0x73 == NATIVE_TO_LATIN1(((U8*)s)[1]) || 0x74 == NATIVE_TO_LATIN1(((U8*)s)[1]) ) ? 2 : 0 )\ + : ( 0x74 == NATIVE_TO_LATIN1(((U8*)s)[0]) ) ? \ + ( ( ( 0xCC == NATIVE_TO_LATIN1(((U8*)s)[1]) ) && ( 0x88 == NATIVE_TO_LATIN1(((U8*)s)[2]) ) ) ? 3 : 0 )\ + : ( 0x77 == NATIVE_TO_LATIN1(((U8*)s)[0]) || 0x79 == NATIVE_TO_LATIN1(((U8*)s)[0]) ) ?\ + ( ( ( 0xCC == NATIVE_TO_LATIN1(((U8*)s)[1]) ) && ( 0x8A == NATIVE_TO_LATIN1(((U8*)s)[2]) ) ) ? 3 : 0 )\ + : ( 0xC5 == NATIVE_TO_LATIN1(((U8*)s)[0]) ) ? \ + ( ( ( ( 0xBF == NATIVE_TO_LATIN1(((U8*)s)[1]) ) && ( 0xC5 == NATIVE_TO_LATIN1(((U8*)s)[2]) ) ) && ( 0xBF == NATIVE_TO_LATIN1(((U8*)s)[3]) ) ) ? 4 : 0 )\ + : ( 0xCA == NATIVE_TO_LATIN1(((U8*)s)[0]) ) ? \ + ( ( ( 0xBC == NATIVE_TO_LATIN1(((U8*)s)[1]) ) && ( 0x6E == NATIVE_TO_LATIN1(((U8*)s)[2]) ) ) ? 3 : 0 )\ + : ( 0xCE == NATIVE_TO_LATIN1(((U8*)s)[0]) ) ? \ + ( ( ( NATIVE_TO_LATIN1(((U8*)s)[1]) & 0xFD ) == 0xAC ) ? \ + ( ( ( 0xCE == NATIVE_TO_LATIN1(((U8*)s)[2]) ) && ( 0xB9 == NATIVE_TO_LATIN1(((U8*)s)[3]) ) ) ? 4 : 0 )\ + : ( 0xB1 == NATIVE_TO_LATIN1(((U8*)s)[1]) || 0xB7 == NATIVE_TO_LATIN1(((U8*)s)[1]) ) ?\ + ( ( 0xCD == NATIVE_TO_LATIN1(((U8*)s)[2]) ) ? \ + ( ( 0x82 == NATIVE_TO_LATIN1(((U8*)s)[3]) ) ? 4 : 0 ) \ + : ( ( 0xCE == NATIVE_TO_LATIN1(((U8*)s)[2]) ) && ( 0xB9 == NATIVE_TO_LATIN1(((U8*)s)[3]) ) ) ? 4 : 0 )\ + : ( ( ( 0xB9 == NATIVE_TO_LATIN1(((U8*)s)[1]) ) && ( 0xCD == NATIVE_TO_LATIN1(((U8*)s)[2]) ) ) && ( 0x82 == NATIVE_TO_LATIN1(((U8*)s)[3]) ) ) ? 4 : 0 )\ + : ( 0xCF == NATIVE_TO_LATIN1(((U8*)s)[0]) ) ? \ + ( ( 0x81 == NATIVE_TO_LATIN1(((U8*)s)[1]) ) ? \ + ( ( ( 0xCC == NATIVE_TO_LATIN1(((U8*)s)[2]) ) && ( 0x93 == NATIVE_TO_LATIN1(((U8*)s)[3]) ) ) ? 4 : 0 )\ + : ( 0x85 == NATIVE_TO_LATIN1(((U8*)s)[1]) ) ? \ + ( ( 0xCC == NATIVE_TO_LATIN1(((U8*)s)[2]) ) ? \ + ( ( 0x93 == NATIVE_TO_LATIN1(((U8*)s)[3]) ) ? 4 : 0 ) \ + : ( ( 0xCD == NATIVE_TO_LATIN1(((U8*)s)[2]) ) && ( 0x82 == NATIVE_TO_LATIN1(((U8*)s)[3]) ) ) ? 4 : 0 )\ + : ( 0x89 == NATIVE_TO_LATIN1(((U8*)s)[1]) ) ? \ + ( ( 0xCD == NATIVE_TO_LATIN1(((U8*)s)[2]) ) ? \ + ( ( 0x82 == NATIVE_TO_LATIN1(((U8*)s)[3]) ) ? 4 : 0 ) \ + : ( ( 0xCE == NATIVE_TO_LATIN1(((U8*)s)[2]) ) && ( 0xB9 == NATIVE_TO_LATIN1(((U8*)s)[3]) ) ) ? 4 : 0 )\ + : ( ( ( 0x8E == NATIVE_TO_LATIN1(((U8*)s)[1]) ) && ( 0xCE == NATIVE_TO_LATIN1(((U8*)s)[2]) ) ) && ( 0xB9 == NATIVE_TO_LATIN1(((U8*)s)[3]) ) ) ? 4 : 0 )\ + : ( 0xD5 == NATIVE_TO_LATIN1(((U8*)s)[0]) ) ? \ + ( ( 0xA5 == NATIVE_TO_LATIN1(((U8*)s)[1]) ) ? \ + ( ( ( 0xD6 == NATIVE_TO_LATIN1(((U8*)s)[2]) ) && ( 0x82 == NATIVE_TO_LATIN1(((U8*)s)[3]) ) ) ? 4 : 0 )\ + : ( 0xB4 == NATIVE_TO_LATIN1(((U8*)s)[1]) ) ? \ + ( ( ( 0xD5 == NATIVE_TO_LATIN1(((U8*)s)[2]) ) && ( ( ( NATIVE_TO_LATIN1(((U8*)s)[3]) & 0xF7 ) == 0xA5 ) || NATIVE_TO_LATIN1(((U8*)s)[3]) == 0xAB || NATIVE_TO_LATIN1(((U8*)s)[3]) == 0xB6 ) ) ? 4 : 0 )\ + : ( ( ( 0xBE == NATIVE_TO_LATIN1(((U8*)s)[1]) ) && ( 0xD5 == NATIVE_TO_LATIN1(((U8*)s)[2]) ) ) && ( 0xB6 == NATIVE_TO_LATIN1(((U8*)s)[3]) ) ) ? 4 : 0 )\ + : ( 0xE1 == NATIVE_TO_LATIN1(((U8*)s)[0]) ) ? \ + ( ( 0xBC == NATIVE_TO_LATIN1(((U8*)s)[1]) ) ? \ + ( ( ( ( ( NATIVE_TO_LATIN1(((U8*)s)[2]) & 0xD8 ) == 0x80 ) && ( 0xCE == NATIVE_TO_LATIN1(((U8*)s)[3]) ) ) && ( 0xB9 == NATIVE_TO_LATIN1(((U8*)s)[4]) ) ) ? 5 : 0 )\ + : ( ( ( ( 0xBD == NATIVE_TO_LATIN1(((U8*)s)[1]) ) && ( ( ( NATIVE_TO_LATIN1(((U8*)s)[2]) & 0xF8 ) == 0xA0 ) || ( ( NATIVE_TO_LATIN1(((U8*)s)[2]) & 0xFB ) == 0xB0 ) || NATIVE_TO_LATIN1(((U8*)s)[2]) == 0xBC ) ) && ( 0xCE == NATIVE_TO_LATIN1(((U8*)s)[3]) ) ) && ( 0xB9 == NATIVE_TO_LATIN1(((U8*)s)[4]) ) ) ? 5 : 0 )\ : 0 ) \ -: ((e)-(s) > 4) ? is_MULTI_CHAR_FOLD_utf8_safe_part0(s,e) : is_MULTI_CHAR_FOLD_utf8_safe_part1(s,e) ) +: ((e)-(s) > 3) ? is_MULTI_CHAR_FOLD_utf8_safe_part2(s,e) : is_MULTI_CHAR_FOLD_utf8_safe_part3(s,e) ) + + +/*** GENERATED CODE ***/ +#define is_MULTI_CHAR_FOLD_utf8_safe(s,e) \ +( ((e)-(s) > 5) ? is_MULTI_CHAR_FOLD_utf8_safe_part4(s,e) : is_MULTI_CHAR_FOLD_utf8_safe_part5(s,e) ) /* MULTI_CHAR_FOLD: multi-char strings that are folded to by a single character @@ -839,16 +602,120 @@ /*** GENERATED CODE ***/ #define is_MULTI_CHAR_FOLD_latin1_safe(s,e) \ ( ((e)-(s) > 2) ? \ - ( ( ( ((U8*)s)[0] & 0xDF ) == 0x46 ) ? \ - ( ( ( ((U8*)s)[1] & 0xDF ) == 0x46 ) ? \ - ( ( ( ( ((U8*)s)[2] & 0xDF ) == 0x49 ) || ( ( ((U8*)s)[2] & 0xDF ) == 0x4C ) ) ? 3 : 2 )\ - : ( ( ( ((U8*)s)[1] & 0xDF ) == 0x49 ) || ( ( ((U8*)s)[1] & 0xDF ) == 0x4C ) ) ? 2 : 0 )\ - : ( ( ( ((U8*)s)[0] & 0xDF ) == 0x53 ) && ( ( ( ((U8*)s)[1] & 0xDF ) == 0x53 ) || ( ( ((U8*)s)[1] & 0xDF ) == 0x54 ) ) ) ? 2 : 0 )\ + ( ( ( NATIVE_TO_LATIN1(((U8*)s)[0]) & 0xDF ) == 0x46 ) ? \ + ( ( ( NATIVE_TO_LATIN1(((U8*)s)[1]) & 0xDF ) == 0x46 ) ? \ + ( ( ( ( NATIVE_TO_LATIN1(((U8*)s)[2]) & 0xDF ) == 0x49 ) || ( ( NATIVE_TO_LATIN1(((U8*)s)[2]) & 0xDF ) == 0x4C ) ) ? 3 : 2 )\ + : ( ( ( NATIVE_TO_LATIN1(((U8*)s)[1]) & 0xDF ) == 0x49 ) || ( ( NATIVE_TO_LATIN1(((U8*)s)[1]) & 0xDF ) == 0x4C ) ) ? 2 : 0 )\ + : ( ( ( NATIVE_TO_LATIN1(((U8*)s)[0]) & 0xDF ) == 0x53 ) && ( ( ( NATIVE_TO_LATIN1(((U8*)s)[1]) & 0xDF ) == 0x53 ) || ( ( NATIVE_TO_LATIN1(((U8*)s)[1]) & 0xDF ) == 0x54 ) ) ) ? 2 : 0 )\ : ((e)-(s) > 1) ? \ - ( ( ( ((U8*)s)[0] & 0xDF ) == 0x46 ) ? \ - ( ( ( ( ((U8*)s)[1] & 0xDF ) == 0x46 ) || ( ( ((U8*)s)[1] & 0xDF ) == 0x49 ) || ( ( ((U8*)s)[1] & 0xDF ) == 0x4C ) ) ? 2 : 0 )\ - : ( ( ( ((U8*)s)[0] & 0xDF ) == 0x53 ) && ( ( ( ((U8*)s)[1] & 0xDF ) == 0x53 ) || ( ( ((U8*)s)[1] & 0xDF ) == 0x54 ) ) ) ? 2 : 0 )\ -: 0 ) + ( ( ( NATIVE_TO_LATIN1(((U8*)s)[0]) & 0xDF ) == 0x46 ) ? \ + ( ( ( ( NATIVE_TO_LATIN1(((U8*)s)[1]) & 0xDF ) == 0x46 ) || ( ( NATIVE_TO_LATIN1(((U8*)s)[1]) & 0xDF ) == 0x49 ) || ( ( NATIVE_TO_LATIN1(((U8*)s)[1]) & 0xDF ) == 0x4C ) ) ? 2 : 0 )\ + : ( ( ( NATIVE_TO_LATIN1(((U8*)s)[0]) & 0xDF ) == 0x53 ) && ( ( ( NATIVE_TO_LATIN1(((U8*)s)[1]) & 0xDF ) == 0x53 ) || ( ( NATIVE_TO_LATIN1(((U8*)s)[1]) & 0xDF ) == 0x54 ) ) ) ? 2 : 0 )\ +: 0 ) + +/* + FOLDS_TO_MULTI: characters that fold to multi-char strings + + \p{_Perl_Folds_To_Multi_Char} +*/ +/*** GENERATED CODE ***/ +#define is_FOLDS_TO_MULTI_utf8(s) \ +( ( 0xC3 == NATIVE_TO_LATIN1(((U8*)s)[0]) ) ? \ + ( ( 0x9F == NATIVE_TO_LATIN1(((U8*)s)[1]) ) ? 2 : 0 ) \ +: ( 0xC4 == NATIVE_TO_LATIN1(((U8*)s)[0]) || 0xC7 == NATIVE_TO_LATIN1(((U8*)s)[0]) ) ?\ + ( ( 0xB0 == NATIVE_TO_LATIN1(((U8*)s)[1]) ) ? 2 : 0 ) \ +: ( 0xC5 == NATIVE_TO_LATIN1(((U8*)s)[0]) ) ? \ + ( ( 0x89 == NATIVE_TO_LATIN1(((U8*)s)[1]) ) ? 2 : 0 ) \ +: ( 0xCE == NATIVE_TO_LATIN1(((U8*)s)[0]) ) ? \ + ( ( ( NATIVE_TO_LATIN1(((U8*)s)[1]) & 0xDF ) == 0x90 ) ? 2 : 0 ) \ +: ( 0xD6 == NATIVE_TO_LATIN1(((U8*)s)[0]) ) ? \ + ( ( 0x87 == NATIVE_TO_LATIN1(((U8*)s)[1]) ) ? 2 : 0 ) \ +: ( 0xE1 == NATIVE_TO_LATIN1(((U8*)s)[0]) ) ? \ + ( ( 0xBA == NATIVE_TO_LATIN1(((U8*)s)[1]) ) ? \ + ( ( ( 0x96 <= NATIVE_TO_LATIN1(((U8*)s)[2]) && NATIVE_TO_LATIN1(((U8*)s)[2]) <= 0x9A ) || 0x9E == NATIVE_TO_LATIN1(((U8*)s)[2]) ) ? 3 : 0 )\ + : ( 0xBD == NATIVE_TO_LATIN1(((U8*)s)[1]) ) ? \ + ( ( ( NATIVE_TO_LATIN1(((U8*)s)[2]) & 0xF9 ) == 0x90 ) ? 3 : 0 ) \ + : ( 0xBE == NATIVE_TO_LATIN1(((U8*)s)[1]) ) ? \ + ( ( ( ( NATIVE_TO_LATIN1(((U8*)s)[2]) & 0xE0 ) == 0x80 ) || ( ( NATIVE_TO_LATIN1(((U8*)s)[2]) & 0xF0 ) == 0xA0 ) || ( ( NATIVE_TO_LATIN1(((U8*)s)[2]) & 0xFA ) == 0xB2 ) || ( ( NATIVE_TO_LATIN1(((U8*)s)[2]) & 0xF7 ) == 0xB4 ) ) ? 3 : 0 )\ + : ( ( 0xBF == NATIVE_TO_LATIN1(((U8*)s)[1]) ) && ( ( ( NATIVE_TO_LATIN1(((U8*)s)[2]) & 0xCA ) == 0x82 ) || ( ( NATIVE_TO_LATIN1(((U8*)s)[2]) & 0xF7 ) == 0x84 ) || NATIVE_TO_LATIN1(((U8*)s)[2]) == 0xA4 || ( ( NATIVE_TO_LATIN1(((U8*)s)[2]) & 0xF7 ) == 0xB4 ) ) ) ? 3 : 0 )\ +: ( ( ( 0xEF == NATIVE_TO_LATIN1(((U8*)s)[0]) ) && ( 0xAC == NATIVE_TO_LATIN1(((U8*)s)[1]) ) ) && ( ( NATIVE_TO_LATIN1(((U8*)s)[2]) <= 0x86 ) || ( 0x93 <= NATIVE_TO_LATIN1(((U8*)s)[2]) && NATIVE_TO_LATIN1(((U8*)s)[2]) <= 0x97 ) ) ) ? 3 : 0 ) + +/* + PROBLEMATIC_LOCALE_FOLD: characters whose fold is problematic under locale + + \p{_Perl_Problematic_Locale_Folds} +*/ +/*** GENERATED CODE ***/ +#define is_PROBLEMATIC_LOCALE_FOLD_utf8(s) \ +( ( ( NATIVE_TO_LATIN1(((U8*)s)[0]) & 0x80 ) == 0x00 ) ? 1 \ +: ( ( NATIVE_TO_LATIN1(((U8*)s)[0]) & 0xFE ) == 0xC2 ) ? \ + 2 \ +: ( 0xC4 == NATIVE_TO_LATIN1(((U8*)s)[0]) || 0xC7 == NATIVE_TO_LATIN1(((U8*)s)[0]) ) ?\ + ( ( 0xB0 == NATIVE_TO_LATIN1(((U8*)s)[1]) ) ? 2 : 0 ) \ +: ( 0xC5 == NATIVE_TO_LATIN1(((U8*)s)[0]) ) ? \ + ( ( 0x89 == NATIVE_TO_LATIN1(((U8*)s)[1]) || 0xB8 == NATIVE_TO_LATIN1(((U8*)s)[1]) || 0xBF == NATIVE_TO_LATIN1(((U8*)s)[1]) ) ? 2 : 0 )\ +: ( 0xCE == NATIVE_TO_LATIN1(((U8*)s)[0]) ) ? \ + ( ( ( NATIVE_TO_LATIN1(((U8*)s)[1]) & 0xDF ) == 0x9C ) ? 2 : 0 ) \ +: ( 0xE1 == NATIVE_TO_LATIN1(((U8*)s)[0]) ) ? \ + ( ( ( 0xBA == NATIVE_TO_LATIN1(((U8*)s)[1]) ) && ( ( 0x96 <= NATIVE_TO_LATIN1(((U8*)s)[2]) && NATIVE_TO_LATIN1(((U8*)s)[2]) <= 0x9A ) || 0x9E == NATIVE_TO_LATIN1(((U8*)s)[2]) ) ) ? 3 : 0 )\ +: ( 0xE2 == NATIVE_TO_LATIN1(((U8*)s)[0]) ) ? \ + ( ( ( 0x84 == NATIVE_TO_LATIN1(((U8*)s)[1]) ) && ( ( NATIVE_TO_LATIN1(((U8*)s)[2]) & 0xFE ) == 0xAA ) ) ? 3 : 0 )\ +: ( ( ( 0xEF == NATIVE_TO_LATIN1(((U8*)s)[0]) ) && ( 0xAC == NATIVE_TO_LATIN1(((U8*)s)[1]) ) ) && ( NATIVE_TO_LATIN1(((U8*)s)[2]) <= 0x86 ) ) ? 3 : 0 ) + +/*** GENERATED CODE ***/ +#define is_PROBLEMATIC_LOCALE_FOLD_cp(cp) \ +( NATIVE_TO_UNI(cp) <= 0xFF || ( 0xFF < NATIVE_TO_UNI(cp) && \ +( 0x130 == NATIVE_TO_UNI(cp) || ( 0x130 < NATIVE_TO_UNI(cp) && \ +( 0x149 == NATIVE_TO_UNI(cp) || ( 0x149 < NATIVE_TO_UNI(cp) && \ +( 0x178 == NATIVE_TO_UNI(cp) || ( 0x178 < NATIVE_TO_UNI(cp) && \ +( 0x17F == NATIVE_TO_UNI(cp) || ( 0x17F < NATIVE_TO_UNI(cp) && \ +( 0x1F0 == NATIVE_TO_UNI(cp) || ( 0x1F0 < NATIVE_TO_UNI(cp) && \ +( 0x39C == NATIVE_TO_UNI(cp) || ( 0x39C < NATIVE_TO_UNI(cp) && \ +( 0x3BC == NATIVE_TO_UNI(cp) || ( 0x3BC < NATIVE_TO_UNI(cp) && \ +( ( 0x1E96 <= NATIVE_TO_UNI(cp) && NATIVE_TO_UNI(cp) <= 0x1E9A ) || ( 0x1E9A < NATIVE_TO_UNI(cp) &&\ +( 0x1E9E == NATIVE_TO_UNI(cp) || ( 0x1E9E < NATIVE_TO_UNI(cp) && \ +( 0x212A == NATIVE_TO_UNI(cp) || ( 0x212A < NATIVE_TO_UNI(cp) && \ +( 0x212B == NATIVE_TO_UNI(cp) || ( 0xFB00 <= NATIVE_TO_UNI(cp) && NATIVE_TO_UNI(cp) <= 0xFB06 ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) + +/* + PROBLEMATIC_LOCALE_FOLDEDS_START: The first folded character of folds which are problematic under locale + + \p{_Perl_Problematic_Locale_Foldeds_Start} +*/ +/*** GENERATED CODE ***/ +#define is_PROBLEMATIC_LOCALE_FOLDEDS_START_utf8(s) \ +( ( ( NATIVE_TO_LATIN1(((U8*)s)[0]) & 0x80 ) == 0x00 ) ? 1 \ +: ( ( NATIVE_TO_LATIN1(((U8*)s)[0]) & 0xFE ) == 0xC2 ) ? \ + 2 \ +: ( 0xC4 == NATIVE_TO_LATIN1(((U8*)s)[0]) || 0xC7 == NATIVE_TO_LATIN1(((U8*)s)[0]) ) ?\ + ( ( 0xB0 == NATIVE_TO_LATIN1(((U8*)s)[1]) ) ? 2 : 0 ) \ +: ( 0xC5 == NATIVE_TO_LATIN1(((U8*)s)[0]) ) ? \ + ( ( 0x89 == NATIVE_TO_LATIN1(((U8*)s)[1]) || 0xB8 == NATIVE_TO_LATIN1(((U8*)s)[1]) || 0xBF == NATIVE_TO_LATIN1(((U8*)s)[1]) ) ? 2 : 0 )\ +: ( 0xCA == NATIVE_TO_LATIN1(((U8*)s)[0]) ) ? \ + ( ( 0xBC == NATIVE_TO_LATIN1(((U8*)s)[1]) ) ? 2 : 0 ) \ +: ( 0xCE == NATIVE_TO_LATIN1(((U8*)s)[0]) ) ? \ + ( ( ( NATIVE_TO_LATIN1(((U8*)s)[1]) & 0xDF ) == 0x9C ) ? 2 : 0 ) \ +: ( 0xE1 == NATIVE_TO_LATIN1(((U8*)s)[0]) ) ? \ + ( ( ( 0xBA == NATIVE_TO_LATIN1(((U8*)s)[1]) ) && ( ( 0x96 <= NATIVE_TO_LATIN1(((U8*)s)[2]) && NATIVE_TO_LATIN1(((U8*)s)[2]) <= 0x9A ) || 0x9E == NATIVE_TO_LATIN1(((U8*)s)[2]) ) ) ? 3 : 0 )\ +: ( 0xE2 == NATIVE_TO_LATIN1(((U8*)s)[0]) ) ? \ + ( ( ( 0x84 == NATIVE_TO_LATIN1(((U8*)s)[1]) ) && ( ( NATIVE_TO_LATIN1(((U8*)s)[2]) & 0xFE ) == 0xAA ) ) ? 3 : 0 )\ +: ( ( ( 0xEF == NATIVE_TO_LATIN1(((U8*)s)[0]) ) && ( 0xAC == NATIVE_TO_LATIN1(((U8*)s)[1]) ) ) && ( NATIVE_TO_LATIN1(((U8*)s)[2]) <= 0x86 ) ) ? 3 : 0 ) + +/*** GENERATED CODE ***/ +#define is_PROBLEMATIC_LOCALE_FOLDEDS_START_cp(cp) \ +( NATIVE_TO_UNI(cp) <= 0xFF || ( 0xFF < NATIVE_TO_UNI(cp) && \ +( 0x130 == NATIVE_TO_UNI(cp) || ( 0x130 < NATIVE_TO_UNI(cp) && \ +( 0x149 == NATIVE_TO_UNI(cp) || ( 0x149 < NATIVE_TO_UNI(cp) && \ +( 0x178 == NATIVE_TO_UNI(cp) || ( 0x178 < NATIVE_TO_UNI(cp) && \ +( 0x17F == NATIVE_TO_UNI(cp) || ( 0x17F < NATIVE_TO_UNI(cp) && \ +( 0x1F0 == NATIVE_TO_UNI(cp) || ( 0x1F0 < NATIVE_TO_UNI(cp) && \ +( 0x2BC == NATIVE_TO_UNI(cp) || ( 0x2BC < NATIVE_TO_UNI(cp) && \ +( 0x39C == NATIVE_TO_UNI(cp) || ( 0x39C < NATIVE_TO_UNI(cp) && \ +( 0x3BC == NATIVE_TO_UNI(cp) || ( 0x3BC < NATIVE_TO_UNI(cp) && \ +( ( 0x1E96 <= NATIVE_TO_UNI(cp) && NATIVE_TO_UNI(cp) <= 0x1E9A ) || ( 0x1E9A < NATIVE_TO_UNI(cp) &&\ +( 0x1E9E == NATIVE_TO_UNI(cp) || ( 0x1E9E < NATIVE_TO_UNI(cp) && \ +( 0x212A == NATIVE_TO_UNI(cp) || ( 0x212A < NATIVE_TO_UNI(cp) && \ +( 0x212B == NATIVE_TO_UNI(cp) || ( 0xFB00 <= NATIVE_TO_UNI(cp) && NATIVE_TO_UNI(cp) <= 0xFB06 ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) /* PATWS: pattern white space @@ -856,65 +723,38 @@ \p{PatWS} */ /*** GENERATED CODE ***/ -#define is_PATWS(s,is_utf8) \ -( ( ( 0x09 <= ((U8*)s)[0] && ((U8*)s)[0] <= 0x0D ) || 0x20 == ((U8*)s)[0] ) ? 1\ -: ( is_utf8 ) ? \ - ( ( 0xC2 == ((U8*)s)[0] ) ? \ - ( ( 0x85 == ((U8*)s)[1] ) ? 2 : 0 ) \ - : ( ( ( 0xE2 == ((U8*)s)[0] ) && ( 0x80 == ((U8*)s)[1] ) ) && ( ( ((U8*)s)[2] & 0xFE ) == 0x8E || ( ((U8*)s)[2] & 0xFE ) == 0xA8 ) ) ? 3 : 0 )\ -: ( 0x85 == ((U8*)s)[0] ) ) - -/*** GENERATED CODE ***/ #define is_PATWS_safe(s,e,is_utf8) \ -( ((e)-(s) > 2) ? \ - ( ( ( 0x09 <= ((U8*)s)[0] && ((U8*)s)[0] <= 0x0D ) || 0x20 == ((U8*)s)[0] ) ? 1\ - : ( is_utf8 ) ? \ - ( ( 0xC2 == ((U8*)s)[0] ) ? \ - ( ( 0x85 == ((U8*)s)[1] ) ? 2 : 0 ) \ - : ( ( ( 0xE2 == ((U8*)s)[0] ) && ( 0x80 == ((U8*)s)[1] ) ) && ( ( ((U8*)s)[2] & 0xFE ) == 0x8E || ( ((U8*)s)[2] & 0xFE ) == 0xA8 ) ) ? 3 : 0 )\ - : ( 0x85 == ((U8*)s)[0] ) ) \ -: ((e)-(s) > 1) ? \ - ( ( ( 0x09 <= ((U8*)s)[0] && ((U8*)s)[0] <= 0x0D ) || 0x20 == ((U8*)s)[0] ) ? 1\ - : ( is_utf8 ) ? \ - ( ( ( 0xC2 == ((U8*)s)[0] ) && ( 0x85 == ((U8*)s)[1] ) ) ? 2 : 0 ) \ - : ( 0x85 == ((U8*)s)[0] ) ) \ -: ((e)-(s) > 0) ? \ - ( ( ( 0x09 <= ((U8*)s)[0] && ((U8*)s)[0] <= 0x0D ) || 0x20 == ((U8*)s)[0] ) ? 1\ - : ( !( is_utf8 ) ) ? \ - ( 0x85 == ((U8*)s)[0] ) \ - : 0 ) \ +( ((e) > (s)) ? \ + ( ( ( 0x09 <= NATIVE_TO_LATIN1(((U8*)s)[0]) && NATIVE_TO_LATIN1(((U8*)s)[0]) <= 0x0D ) || 0x20 == NATIVE_TO_LATIN1(((U8*)s)[0]) ) ? 1\ + : (! is_utf8 ) ? \ + ( 0x85 == NATIVE_TO_LATIN1(((U8*)s)[0]) ) \ + : (((e) - (s)) >= UTF8SKIP(s)) ? \ + ( ( 0xC2 == NATIVE_TO_LATIN1(((U8*)s)[0]) ) ? \ + ( ( 0x85 == NATIVE_TO_LATIN1(((U8*)s)[1]) ) ? 2 : 0 ) \ + : ( ( ( 0xE2 == NATIVE_TO_LATIN1(((U8*)s)[0]) ) && ( 0x80 == NATIVE_TO_LATIN1(((U8*)s)[1]) ) ) && ( ( NATIVE_TO_LATIN1(((U8*)s)[2]) & 0xFE ) == 0x8E || ( NATIVE_TO_LATIN1(((U8*)s)[2]) & 0xFE ) == 0xA8 ) ) ? 3 : 0 )\ + : 0 ) \ : 0 ) /*** GENERATED CODE ***/ -#define is_PATWS_non_low(s,is_utf8) \ -( ( is_utf8 ) ? \ - ( ( 0xC2 == ((U8*)s)[0] ) ? \ - ( ( 0x85 == ((U8*)s)[1] ) ? 2 : 0 ) \ - : ( ( ( 0xE2 == ((U8*)s)[0] ) && ( 0x80 == ((U8*)s)[1] ) ) && ( ( ((U8*)s)[2] & 0xFE ) == 0x8E || ( ((U8*)s)[2] & 0xFE ) == 0xA8 ) ) ? 3 : 0 )\ -: ( 0x85 == ((U8*)s)[0] ) ) - -/*** GENERATED CODE ***/ #define is_PATWS_non_low_safe(s,e,is_utf8) \ -( ((e)-(s) > 2) ? \ - ( ( is_utf8 ) ? \ - ( ( 0xC2 == ((U8*)s)[0] ) ? \ - ( ( 0x85 == ((U8*)s)[1] ) ? 2 : 0 ) \ - : ( ( ( 0xE2 == ((U8*)s)[0] ) && ( 0x80 == ((U8*)s)[1] ) ) && ( ( ((U8*)s)[2] & 0xFE ) == 0x8E || ( ((U8*)s)[2] & 0xFE ) == 0xA8 ) ) ? 3 : 0 )\ - : ( 0x85 == ((U8*)s)[0] ) ) \ -: ((e)-(s) > 1) ? \ - ( ( is_utf8 ) ? \ - ( ( ( 0xC2 == ((U8*)s)[0] ) && ( 0x85 == ((U8*)s)[1] ) ) ? 2 : 0 ) \ - : ( 0x85 == ((U8*)s)[0] ) ) \ -: ( ((e)-(s) > 0) && ( !( is_utf8 ) ) ) ? ( 0x85 == ((U8*)s)[0] ) : 0 ) +( ((e) > (s)) ? \ + ( (! is_utf8) ? \ + ( 0x85 == NATIVE_TO_LATIN1(((U8*)s)[0]) ) \ + : (((e) - (s)) >= UTF8SKIP(s)) ? \ + ( ( 0xC2 == NATIVE_TO_LATIN1(((U8*)s)[0]) ) ? \ + ( ( 0x85 == NATIVE_TO_LATIN1(((U8*)s)[1]) ) ? 2 : 0 ) \ + : ( ( ( 0xE2 == NATIVE_TO_LATIN1(((U8*)s)[0]) ) && ( 0x80 == NATIVE_TO_LATIN1(((U8*)s)[1]) ) ) && ( ( NATIVE_TO_LATIN1(((U8*)s)[2]) & 0xFE ) == 0x8E || ( NATIVE_TO_LATIN1(((U8*)s)[2]) & 0xFE ) == 0xA8 ) ) ? 3 : 0 )\ + : 0 ) \ +: 0 ) /*** GENERATED CODE ***/ #define is_PATWS_cp(cp) \ -( ( 0x09 <= cp && cp <= 0x0D ) || ( 0x0D < cp && \ -( 0x20 == cp || ( 0x20 < cp && \ -( 0x85 == cp || ( 0x85 < cp && \ -( 0x200E == cp || ( 0x200E < cp && \ -( 0x200F == cp || ( 0x200F < cp && \ -( 0x2028 == cp || 0x2029 == cp ) ) ) ) ) ) ) ) ) ) ) +( ( 0x09 <= NATIVE_TO_UNI(cp) && NATIVE_TO_UNI(cp) <= 0x0D ) || ( 0x0D < NATIVE_TO_UNI(cp) &&\ +( 0x20 == NATIVE_TO_UNI(cp) || ( 0x20 < NATIVE_TO_UNI(cp) && \ +( 0x85 == NATIVE_TO_UNI(cp) || ( 0x85 < NATIVE_TO_UNI(cp) && \ +( 0x200E == NATIVE_TO_UNI(cp) || ( 0x200E < NATIVE_TO_UNI(cp) && \ +( 0x200F == NATIVE_TO_UNI(cp) || ( 0x200F < NATIVE_TO_UNI(cp) && \ +( 0x2028 == NATIVE_TO_UNI(cp) || 0x2029 == NATIVE_TO_UNI(cp) ) ) ) ) ) ) ) ) ) ) ) #endif /* H_REGCHARCLASS */ Index: gnu/usr.bin/perl/regcomp.c =================================================================== RCS file: /mnt/memory/perl/importit/cvs/src/gnu/usr.bin/perl/regcomp.c,v retrieving revision 1.18 diff -u -p -u -p -r1.18 regcomp.c --- gnu/usr.bin/perl/regcomp.c 24 Mar 2014 15:05:13 -0000 1.18 +++ gnu/usr.bin/perl/regcomp.c 16 Nov 2014 03:22:24 -0000 @@ -81,7 +81,7 @@ #define REG_COMP_C #ifdef PERL_IN_XSUB_RE # include "re_comp.h" -extern const struct regexp_engine my_reg_engine; +EXTERN_C const struct regexp_engine my_reg_engine; #else # include "regcomp.h" #endif @@ -91,49 +91,46 @@ extern const struct regexp_engine my_reg #include "inline_invlist.c" #include "unicode_constants.h" -#define HAS_NONLATIN1_FOLD_CLOSURE(i) _HAS_NONLATIN1_FOLD_CLOSURE_ONLY_FOR_USE_BY_REGCOMP_DOT_C_AND_REGEXEC_DOT_C(i) +#define HAS_NONLATIN1_FOLD_CLOSURE(i) \ + _HAS_NONLATIN1_FOLD_CLOSURE_ONLY_FOR_USE_BY_REGCOMP_DOT_C_AND_REGEXEC_DOT_C(i) #define IS_NON_FINAL_FOLD(c) _IS_NON_FINAL_FOLD_ONLY_FOR_USE_BY_REGCOMP_DOT_C(c) #define IS_IN_SOME_FOLD_L1(c) _IS_IN_SOME_FOLD_ONLY_FOR_USE_BY_REGCOMP_DOT_C(c) -#ifdef op -#undef op -#endif /* op */ - -#ifdef MSDOS -# if defined(BUGGY_MSC6) - /* MSC 6.00A breaks on op/regexp.t test 85 unless we turn this off */ -# pragma optimize("a",off) - /* But MSC 6.00A is happy with 'w', for aliases only across function calls*/ -# pragma optimize("w",on ) -# endif /* BUGGY_MSC6 */ -#endif /* MSDOS */ - #ifndef STATIC #define STATIC static #endif -typedef struct RExC_state_t { +struct RExC_state_t { U32 flags; /* RXf_* are we folding, multilining? */ U32 pm_flags; /* PMf_* stuff from the calling PMOP */ char *precomp; /* uncompiled string. */ REGEXP *rx_sv; /* The SV that is the regexp. */ regexp *rx; /* perl core regexp structure */ - regexp_internal *rxi; /* internal data for regexp object pprivate field */ + regexp_internal *rxi; /* internal data for regexp object + pprivate field */ char *start; /* Start of input for compile */ char *end; /* End of input for compile */ char *parse; /* Input-scan pointer. */ - I32 whilem_seen; /* number of WHILEM in this expr */ + SSize_t whilem_seen; /* number of WHILEM in this expr */ regnode *emit_start; /* Start of emitted-code area */ - regnode *emit_bound; /* First regnode outside of the allocated space */ - regnode *emit; /* Code-emit pointer; ®dummy = don't = compiling */ + regnode *emit_bound; /* First regnode outside of the + allocated space */ + regnode *emit; /* Code-emit pointer; if = &emit_dummy, + implies compiling, so don't emit */ + regnode_ssc emit_dummy; /* placeholder for emit to point to; + large enough for the largest + non-EXACTish node, so can use it as + scratch in pass1 */ I32 naughty; /* How bad is this pattern? */ I32 sawback; /* Did we see \1, ...? */ U32 seen; - I32 size; /* Code size. */ - I32 npar; /* Capture buffer count, (OPEN). */ - I32 cpar; /* Capture buffer count, (CLOSE). */ - I32 nestroot; /* root parens we are in - used by accept */ + SSize_t size; /* Code size. */ + I32 npar; /* Capture buffer count, (OPEN) plus + one. ("par" 0 is the whole + pattern)*/ + I32 nestroot; /* root parens we are in - used by + accept */ I32 extralen; I32 seen_zerolen; regnode **open_parens; /* pointers to open parens */ @@ -147,18 +144,23 @@ typedef struct RExC_state_t { rules, even if the pattern is not in utf8 */ HV *paren_names; /* Paren names */ - + regnode **recurse; /* Recurse regops */ I32 recurse_count; /* Number of recurse regops */ + U8 *study_chunk_recursed; /* bitmap of which parens we have moved + through */ + U32 study_chunk_recursed_bytes; /* bytes in bitmap */ I32 in_lookbehind; I32 contains_locale; + I32 contains_i; I32 override_recoding; I32 in_multi_char_class; struct reg_code_block *code_blocks; /* positions of literal (?{}) within pattern */ int num_code_blocks; /* size of code_blocks[] */ int code_index; /* next code_blocks[] slot */ -#if ADD_TO_REGEXEC + SSize_t maxlen; /* mininum possible number of chars in string to match */ +#ifdef ADD_TO_REGEXEC char *starttry; /* -Dr: where regtry was called. */ #define RExC_starttry (pRExC_state->starttry) #endif @@ -171,7 +173,7 @@ typedef struct RExC_state_t { #define RExC_lastnum (pRExC_state->lastnum) #define RExC_paren_name_list (pRExC_state->paren_name_list) #endif -} RExC_state_t; +}; #define RExC_flags (pRExC_state->flags) #define RExC_pm_flags (pRExC_state->pm_flags) @@ -184,15 +186,18 @@ typedef struct RExC_state_t { #define RExC_parse (pRExC_state->parse) #define RExC_whilem_seen (pRExC_state->whilem_seen) #ifdef RE_TRACK_PATTERN_OFFSETS -#define RExC_offsets (pRExC_state->rxi->u.offsets) /* I am not like the others */ +#define RExC_offsets (pRExC_state->rxi->u.offsets) /* I am not like the + others */ #endif #define RExC_emit (pRExC_state->emit) +#define RExC_emit_dummy (pRExC_state->emit_dummy) #define RExC_emit_start (pRExC_state->emit_start) #define RExC_emit_bound (pRExC_state->emit_bound) #define RExC_naughty (pRExC_state->naughty) #define RExC_sawback (pRExC_state->sawback) #define RExC_seen (pRExC_state->seen) #define RExC_size (pRExC_state->size) +#define RExC_maxlen (pRExC_state->maxlen) #define RExC_npar (pRExC_state->npar) #define RExC_nestroot (pRExC_state->nestroot) #define RExC_extralen (pRExC_state->extralen) @@ -206,8 +211,12 @@ typedef struct RExC_state_t { #define RExC_paren_names (pRExC_state->paren_names) #define RExC_recurse (pRExC_state->recurse) #define RExC_recurse_count (pRExC_state->recurse_count) +#define RExC_study_chunk_recursed (pRExC_state->study_chunk_recursed) +#define RExC_study_chunk_recursed_bytes \ + (pRExC_state->study_chunk_recursed_bytes) #define RExC_in_lookbehind (pRExC_state->in_lookbehind) #define RExC_contains_locale (pRExC_state->contains_locale) +#define RExC_contains_i (pRExC_state->contains_i) #define RExC_override_recoding (pRExC_state->override_recoding) #define RExC_in_multi_char_class (pRExC_state->in_multi_char_class) @@ -216,9 +225,6 @@ typedef struct RExC_state_t { #define ISMULT2(s) ((*s) == '*' || (*s) == '+' || (*s) == '?' || \ ((*s) == '{' && regcurly(s, FALSE))) -#ifdef SPSTART -#undef SPSTART /* dratted cpp namespace... */ -#endif /* * Flags to be passed up and down. */ @@ -264,106 +270,129 @@ typedef struct RExC_state_t { #define namedclass_to_classnum(class) ((int) ((class) / 2)) #define classnum_to_namedclass(classnum) ((classnum) * 2) +#define _invlist_union_complement_2nd(a, b, output) \ + _invlist_union_maybe_complement_2nd(a, b, TRUE, output) +#define _invlist_intersection_complement_2nd(a, b, output) \ + _invlist_intersection_maybe_complement_2nd(a, b, TRUE, output) + /* About scan_data_t. During optimisation we recurse through the regexp program performing various inplace (keyhole style) optimisations. In addition study_chunk and scan_commit populate this data structure with information about - what strings MUST appear in the pattern. We look for the longest + what strings MUST appear in the pattern. We look for the longest string that must appear at a fixed location, and we look for the longest string that may appear at a floating location. So for instance in the pattern: - + /FOO[xX]A.*B[xX]BAR/ - + Both 'FOO' and 'A' are fixed strings. Both 'B' and 'BAR' are floating strings (because they follow a .* construct). study_chunk will identify both FOO and BAR as being the longest fixed and floating strings respectively. - + The strings can be composites, for instance - + /(f)(o)(o)/ - + will result in a composite fixed substring 'foo'. - + For each string some basic information is maintained: - + - offset or min_offset This is the position the string must appear at, or not before. It also implicitly (when combined with minlenp) tells us how many characters must match before the string we are searching for. Likewise when combined with minlenp and the length of the string it - tells us how many characters must appear after the string we have + tells us how many characters must appear after the string we have found. - + - max_offset Only used for floating strings. This is the rightmost point that - the string can appear at. If set to I32 max it indicates that the + the string can appear at. If set to SSize_t_MAX it indicates that the string can occur infinitely far to the right. - + - minlenp A pointer to the minimum number of characters of the pattern that the string was found inside. This is important as in the case of positive - lookahead or positive lookbehind we can have multiple patterns + lookahead or positive lookbehind we can have multiple patterns involved. Consider - + /(?=FOO).*F/ - + The minimum length of the pattern overall is 3, the minimum length of the lookahead part is 3, but the minimum length of the part that - will actually match is 1. So 'FOO's minimum length is 3, but the + will actually match is 1. So 'FOO's minimum length is 3, but the minimum length for the F is 1. This is important as the minimum length - is used to determine offsets in front of and behind the string being + is used to determine offsets in front of and behind the string being looked for. Since strings can be composites this is the length of the pattern at the time it was committed with a scan_commit. Note that the length is calculated by study_chunk, so that the minimum lengths - are not known until the full pattern has been compiled, thus the + are not known until the full pattern has been compiled, thus the pointer to the value. - + - lookbehind - + In the case of lookbehind the string being searched for can be - offset past the start point of the final matching string. + offset past the start point of the final matching string. If this value was just blithely removed from the min_offset it would invalidate some of the calculations for how many chars must match before or after (as they are derived from min_offset and minlen and - the length of the string being searched for). + the length of the string being searched for). When the final pattern is compiled and the data is moved from the scan_data_t structure into the regexp structure the information - about lookbehind is factored in, with the information that would - have been lost precalculated in the end_shift field for the + about lookbehind is factored in, with the information that would + have been lost precalculated in the end_shift field for the associated string. The fields pos_min and pos_delta are used to store the minimum offset - and the delta to the maximum offset at the current point in the pattern. + and the delta to the maximum offset at the current point in the pattern. */ typedef struct scan_data_t { /*I32 len_min; unused */ /*I32 len_delta; unused */ - I32 pos_min; - I32 pos_delta; + SSize_t pos_min; + SSize_t pos_delta; SV *last_found; - I32 last_end; /* min value, <0 unless valid. */ - I32 last_start_min; - I32 last_start_max; + SSize_t last_end; /* min value, <0 unless valid. */ + SSize_t last_start_min; + SSize_t last_start_max; SV **longest; /* Either &l_fixed, or &l_float. */ SV *longest_fixed; /* longest fixed string found in pattern */ - I32 offset_fixed; /* offset where it starts */ - I32 *minlen_fixed; /* pointer to the minlen relevant to the string */ + SSize_t offset_fixed; /* offset where it starts */ + SSize_t *minlen_fixed; /* pointer to the minlen relevant to the string */ I32 lookbehind_fixed; /* is the position of the string modfied by LB */ SV *longest_float; /* longest floating string found in pattern */ - I32 offset_float_min; /* earliest point in string it can appear */ - I32 offset_float_max; /* latest point in string it can appear */ - I32 *minlen_float; /* pointer to the minlen relevant to the string */ - I32 lookbehind_float; /* is the position of the string modified by LB */ + SSize_t offset_float_min; /* earliest point in string it can appear */ + SSize_t offset_float_max; /* latest point in string it can appear */ + SSize_t *minlen_float; /* pointer to the minlen relevant to the string */ + SSize_t lookbehind_float; /* is the pos of the string modified by LB */ I32 flags; I32 whilem_c; - I32 *last_closep; - struct regnode_charclass_class *start_class; + SSize_t *last_closep; + regnode_ssc *start_class; } scan_data_t; +/* The below is perhaps overboard, but this allows us to save a test at the + * expense of a mask. This is because on both EBCDIC and ASCII machines, 'A' + * and 'a' differ by a single bit; the same with the upper and lower case of + * all other ASCII-range alphabetics. On ASCII platforms, they are 32 apart; + * on EBCDIC, they are 64. This uses an exclusive 'or' to find that bit and + * then inverts it to form a mask, with just a single 0, in the bit position + * where the upper- and lowercase differ. XXX There are about 40 other + * instances in the Perl core where this micro-optimization could be used. + * Should decide if maintenance cost is worse, before changing those + * + * Returns a boolean as to whether or not 'v' is either a lowercase or + * uppercase instance of 'c', where 'c' is in [A-Za-z]. If 'c' is a + * compile-time constant, the generated code is better than some optimizing + * compilers figure out, amounting to a mask and test. The results are + * meaningless if 'c' is not one of [A-Za-z] */ +#define isARG2_lower_or_UPPER_ARG1(c, v) \ + (((v) & ~('A' ^ 'a')) == ((c) & ~('A' ^ 'a'))) + /* * Forward declarations for pregcomp()'s friends. */ @@ -377,13 +406,8 @@ static const scan_data_t zero_scan_data #define SF_FIX_BEFORE_EOL (SF_FIX_BEFORE_SEOL|SF_FIX_BEFORE_MEOL) #define SF_FL_BEFORE_EOL (SF_FL_BEFORE_SEOL|SF_FL_BEFORE_MEOL) -#ifdef NO_UNARY_PLUS -# define SF_FIX_SHIFT_EOL (0+2) -# define SF_FL_SHIFT_EOL (0+4) -#else -# define SF_FIX_SHIFT_EOL (+2) -# define SF_FL_SHIFT_EOL (+4) -#endif +#define SF_FIX_SHIFT_EOL (+2) +#define SF_FL_SHIFT_EOL (+4) #define SF_FIX_BEFORE_SEOL (SF_BEFORE_SEOL << SF_FIX_SHIFT_EOL) #define SF_FIX_BEFORE_MEOL (SF_BEFORE_MEOL << SF_FIX_SHIFT_EOL) @@ -401,21 +425,32 @@ static const scan_data_t zero_scan_data #define SCF_WHILEM_VISITED_POS 0x2000 #define SCF_TRIE_RESTUDY 0x4000 /* Do restudy? */ -#define SCF_SEEN_ACCEPT 0x8000 +#define SCF_SEEN_ACCEPT 0x8000 +#define SCF_TRIE_DOING_RESTUDY 0x10000 #define UTF cBOOL(RExC_utf8) /* The enums for all these are ordered so things work out correctly */ #define LOC (get_regex_charset(RExC_flags) == REGEX_LOCALE_CHARSET) -#define DEPENDS_SEMANTICS (get_regex_charset(RExC_flags) == REGEX_DEPENDS_CHARSET) +#define DEPENDS_SEMANTICS (get_regex_charset(RExC_flags) \ + == REGEX_DEPENDS_CHARSET) #define UNI_SEMANTICS (get_regex_charset(RExC_flags) == REGEX_UNICODE_CHARSET) -#define AT_LEAST_UNI_SEMANTICS (get_regex_charset(RExC_flags) >= REGEX_UNICODE_CHARSET) -#define ASCII_RESTRICTED (get_regex_charset(RExC_flags) == REGEX_ASCII_RESTRICTED_CHARSET) -#define AT_LEAST_ASCII_RESTRICTED (get_regex_charset(RExC_flags) >= REGEX_ASCII_RESTRICTED_CHARSET) -#define ASCII_FOLD_RESTRICTED (get_regex_charset(RExC_flags) == REGEX_ASCII_MORE_RESTRICTED_CHARSET) +#define AT_LEAST_UNI_SEMANTICS (get_regex_charset(RExC_flags) \ + >= REGEX_UNICODE_CHARSET) +#define ASCII_RESTRICTED (get_regex_charset(RExC_flags) \ + == REGEX_ASCII_RESTRICTED_CHARSET) +#define AT_LEAST_ASCII_RESTRICTED (get_regex_charset(RExC_flags) \ + >= REGEX_ASCII_RESTRICTED_CHARSET) +#define ASCII_FOLD_RESTRICTED (get_regex_charset(RExC_flags) \ + == REGEX_ASCII_MORE_RESTRICTED_CHARSET) #define FOLD cBOOL(RExC_flags & RXf_PMf_FOLD) +/* For programs that want to be strictly Unicode compatible by dying if any + * attempt is made to match a non-Unicode code point against a Unicode + * property. */ +#define ALWAYS_WARN_SUPER ckDEAD(packWARN(WARN_NON_UNICODE)) + #define OOB_NAMEDCLASS -1 /* There is no code point that is out-of-bounds, so this is problematic. But @@ -438,7 +473,12 @@ static const scan_data_t zero_scan_data #define MARKER1 "<-- HERE" /* marker as it appears in the description */ #define MARKER2 " <-- HERE " /* marker as it appears within the regex */ -#define REPORT_LOCATION " in regex; marked by " MARKER1 " in m/%.*s" MARKER2 "%s/" +#define REPORT_LOCATION " in regex; marked by " MARKER1 \ + " in m/%"UTF8f MARKER2 "%"UTF8f"/" + +#define REPORT_LOCATION_ARGS(offset) \ + UTF8fARG(UTF, offset, RExC_precomp), \ + UTF8fARG(UTF, RExC_end - RExC_precomp - offset, RExC_precomp + offset) /* * Calls SAVEDESTRUCTOR_X if needed, then calls Perl_croak with the given @@ -460,12 +500,12 @@ static const scan_data_t zero_scan_data } STMT_END #define FAIL(msg) _FAIL( \ - Perl_croak(aTHX_ "%s in regex m/%.*s%s/", \ - msg, (int)len, RExC_precomp, ellipses)) + Perl_croak(aTHX_ "%s in regex m/%"UTF8f"%s/", \ + msg, UTF8fARG(UTF, len, RExC_precomp), ellipses)) #define FAIL2(msg,arg) _FAIL( \ - Perl_croak(aTHX_ msg " in regex m/%.*s%s/", \ - arg, (int)len, RExC_precomp, ellipses)) + Perl_croak(aTHX_ msg " in regex m/%"UTF8f"%s/", \ + arg, UTF8fARG(UTF, len, RExC_precomp), ellipses)) /* * Simple_vFAIL -- like FAIL, but marks the current location in the scan @@ -473,7 +513,7 @@ static const scan_data_t zero_scan_data #define Simple_vFAIL(m) STMT_START { \ const IV offset = RExC_parse - RExC_precomp; \ Perl_croak(aTHX_ "%s" REPORT_LOCATION, \ - m, (int)offset, RExC_precomp, RExC_precomp + offset); \ + m, REPORT_LOCATION_ARGS(offset)); \ } STMT_END /* @@ -490,8 +530,8 @@ static const scan_data_t zero_scan_data */ #define Simple_vFAIL2(m,a1) STMT_START { \ const IV offset = RExC_parse - RExC_precomp; \ - S_re_croak2(aTHX_ m, REPORT_LOCATION, a1, \ - (int)offset, RExC_precomp, RExC_precomp + offset); \ + S_re_croak2(aTHX_ UTF, m, REPORT_LOCATION, a1, \ + REPORT_LOCATION_ARGS(offset)); \ } STMT_END /* @@ -509,8 +549,8 @@ static const scan_data_t zero_scan_data */ #define Simple_vFAIL3(m, a1, a2) STMT_START { \ const IV offset = RExC_parse - RExC_precomp; \ - S_re_croak2(aTHX_ m, REPORT_LOCATION, a1, a2, \ - (int)offset, RExC_precomp, RExC_precomp + offset); \ + S_re_croak2(aTHX_ UTF, m, REPORT_LOCATION, a1, a2, \ + REPORT_LOCATION_ARGS(offset)); \ } STMT_END /* @@ -527,8 +567,8 @@ static const scan_data_t zero_scan_data */ #define Simple_vFAIL4(m, a1, a2, a3) STMT_START { \ const IV offset = RExC_parse - RExC_precomp; \ - S_re_croak2(aTHX_ m, REPORT_LOCATION, a1, a2, a3, \ - (int)offset, RExC_precomp, RExC_precomp + offset); \ + S_re_croak2(aTHX_ UTF, m, REPORT_LOCATION, a1, a2, a3, \ + REPORT_LOCATION_ARGS(offset)); \ } STMT_END #define vFAIL4(m,a1,a2,a3) STMT_START { \ @@ -537,80 +577,90 @@ static const scan_data_t zero_scan_data Simple_vFAIL4(m, a1, a2, a3); \ } STMT_END +/* A specialized version of vFAIL2 that works with UTF8f */ +#define vFAIL2utf8f(m, a1) STMT_START { \ + const IV offset = RExC_parse - RExC_precomp; \ + if (!SIZE_ONLY) \ + SAVEFREESV(RExC_rx_sv); \ + S_re_croak2(aTHX_ UTF, m, REPORT_LOCATION, a1, \ + REPORT_LOCATION_ARGS(offset)); \ +} STMT_END + + /* m is not necessarily a "literal string", in this macro */ #define reg_warn_non_literal_string(loc, m) STMT_START { \ const IV offset = loc - RExC_precomp; \ Perl_warner(aTHX_ packWARN(WARN_REGEXP), "%s" REPORT_LOCATION, \ - m, (int)offset, RExC_precomp, RExC_precomp + offset); \ + m, REPORT_LOCATION_ARGS(offset)); \ } STMT_END #define ckWARNreg(loc,m) STMT_START { \ const IV offset = loc - RExC_precomp; \ Perl_ck_warner(aTHX_ packWARN(WARN_REGEXP), m REPORT_LOCATION, \ - (int)offset, RExC_precomp, RExC_precomp + offset); \ + REPORT_LOCATION_ARGS(offset)); \ } STMT_END #define vWARN_dep(loc, m) STMT_START { \ const IV offset = loc - RExC_precomp; \ Perl_warner(aTHX_ packWARN(WARN_DEPRECATED), m REPORT_LOCATION, \ - (int)offset, RExC_precomp, RExC_precomp + offset); \ + REPORT_LOCATION_ARGS(offset)); \ } STMT_END #define ckWARNdep(loc,m) STMT_START { \ const IV offset = loc - RExC_precomp; \ Perl_ck_warner_d(aTHX_ packWARN(WARN_DEPRECATED), \ m REPORT_LOCATION, \ - (int)offset, RExC_precomp, RExC_precomp + offset); \ + REPORT_LOCATION_ARGS(offset)); \ } STMT_END #define ckWARNregdep(loc,m) STMT_START { \ const IV offset = loc - RExC_precomp; \ Perl_ck_warner_d(aTHX_ packWARN2(WARN_DEPRECATED, WARN_REGEXP), \ m REPORT_LOCATION, \ - (int)offset, RExC_precomp, RExC_precomp + offset); \ + REPORT_LOCATION_ARGS(offset)); \ } STMT_END -#define ckWARN2regdep(loc,m, a1) STMT_START { \ +#define ckWARN2reg_d(loc,m, a1) STMT_START { \ const IV offset = loc - RExC_precomp; \ - Perl_ck_warner_d(aTHX_ packWARN2(WARN_DEPRECATED, WARN_REGEXP), \ + Perl_ck_warner_d(aTHX_ packWARN(WARN_REGEXP), \ m REPORT_LOCATION, \ - a1, (int)offset, RExC_precomp, RExC_precomp + offset); \ + a1, REPORT_LOCATION_ARGS(offset)); \ } STMT_END #define ckWARN2reg(loc, m, a1) STMT_START { \ const IV offset = loc - RExC_precomp; \ Perl_ck_warner(aTHX_ packWARN(WARN_REGEXP), m REPORT_LOCATION, \ - a1, (int)offset, RExC_precomp, RExC_precomp + offset); \ + a1, REPORT_LOCATION_ARGS(offset)); \ } STMT_END #define vWARN3(loc, m, a1, a2) STMT_START { \ const IV offset = loc - RExC_precomp; \ Perl_warner(aTHX_ packWARN(WARN_REGEXP), m REPORT_LOCATION, \ - a1, a2, (int)offset, RExC_precomp, RExC_precomp + offset); \ + a1, a2, REPORT_LOCATION_ARGS(offset)); \ } STMT_END #define ckWARN3reg(loc, m, a1, a2) STMT_START { \ const IV offset = loc - RExC_precomp; \ Perl_ck_warner(aTHX_ packWARN(WARN_REGEXP), m REPORT_LOCATION, \ - a1, a2, (int)offset, RExC_precomp, RExC_precomp + offset); \ + a1, a2, REPORT_LOCATION_ARGS(offset)); \ } STMT_END #define vWARN4(loc, m, a1, a2, a3) STMT_START { \ const IV offset = loc - RExC_precomp; \ Perl_warner(aTHX_ packWARN(WARN_REGEXP), m REPORT_LOCATION, \ - a1, a2, a3, (int)offset, RExC_precomp, RExC_precomp + offset); \ + a1, a2, a3, REPORT_LOCATION_ARGS(offset)); \ } STMT_END #define ckWARN4reg(loc, m, a1, a2, a3) STMT_START { \ const IV offset = loc - RExC_precomp; \ Perl_ck_warner(aTHX_ packWARN(WARN_REGEXP), m REPORT_LOCATION, \ - a1, a2, a3, (int)offset, RExC_precomp, RExC_precomp + offset); \ + a1, a2, a3, REPORT_LOCATION_ARGS(offset)); \ } STMT_END #define vWARN5(loc, m, a1, a2, a3, a4) STMT_START { \ const IV offset = loc - RExC_precomp; \ Perl_warner(aTHX_ packWARN(WARN_REGEXP), m REPORT_LOCATION, \ - a1, a2, a3, a4, (int)offset, RExC_precomp, RExC_precomp + offset); \ + a1, a2, a3, a4, REPORT_LOCATION_ARGS(offset)); \ } STMT_END @@ -619,7 +669,7 @@ static const scan_data_t zero_scan_data if (!SIZE_ONLY) *(s) = (c); else (void)(s); \ } STMT_END -/* Macros for recording node offsets. 20001227 mjd@plover.com +/* Macros for recording node offsets. 20001227 mjd@plover.com * Nodes are numbered 1, 2, 3, 4. Node #n's position is recorded in * element 2*n-1 of the array. Element #2n holds the byte length node #n. * Element 0 holds the number n. @@ -631,9 +681,9 @@ static const scan_data_t zero_scan_data #define Set_Cur_Node_Offset #define Set_Node_Length_To_R(node,len) #define Set_Node_Length(node,len) -#define Set_Node_Cur_Length(node) -#define Node_Offset(n) -#define Node_Length(n) +#define Set_Node_Cur_Length(node,start) +#define Node_Offset(n) +#define Node_Length(n) #define Set_Node_Offset_Length(node,offset,len) #define ProgLen(ri) ri->u.proglen #define SetProgLen(ri,x) ri->u.proglen = x @@ -645,7 +695,8 @@ static const scan_data_t zero_scan_data MJD_OFFSET_DEBUG(("** (%d) offset of node %d is %d.\n", \ __LINE__, (int)(node), (int)(byte))); \ if((node) < 0) { \ - Perl_croak(aTHX_ "value of node is %d in Offset macro", (int)(node)); \ + Perl_croak(aTHX_ "value of node is %d in Offset macro", \ + (int)(node)); \ } else { \ RExC_offsets[2*(node)-1] = (byte); \ } \ @@ -661,7 +712,8 @@ static const scan_data_t zero_scan_data MJD_OFFSET_DEBUG(("** (%d) size of node %d is %d.\n", \ __LINE__, (int)(node), (int)(len))); \ if((node) < 0) { \ - Perl_croak(aTHX_ "value of node is %d in Length macro", (int)(node)); \ + Perl_croak(aTHX_ "value of node is %d in Length macro", \ + (int)(node)); \ } else { \ RExC_offsets[2*(node)] = (len); \ } \ @@ -670,9 +722,8 @@ static const scan_data_t zero_scan_data #define Set_Node_Length(node,len) \ Set_Node_Length_To_R((node)-RExC_emit_start, len) -#define Set_Cur_Node_Length(len) Set_Node_Length(RExC_emit, len) -#define Set_Node_Cur_Length(node) \ - Set_Node_Length(node, RExC_parse - parse_start) +#define Set_Node_Cur_Length(node, start) \ + Set_Node_Length(node, RExC_parse - start) /* Get offsets and lengths */ #define Node_Offset(n) (RExC_offsets[2*((n)-RExC_emit_start)-1]) @@ -688,6 +739,49 @@ static const scan_data_t zero_scan_data #define EXPERIMENTAL_INPLACESCAN #endif /*PERL_ENABLE_EXPERIMENTAL_REGEX_OPTIMISATIONS*/ +#define DEBUG_RExC_seen() \ + DEBUG_OPTIMISE_MORE_r({ \ + PerlIO_printf(Perl_debug_log,"RExC_seen: "); \ + \ + if (RExC_seen & REG_ZERO_LEN_SEEN) \ + PerlIO_printf(Perl_debug_log,"REG_ZERO_LEN_SEEN "); \ + \ + if (RExC_seen & REG_LOOKBEHIND_SEEN) \ + PerlIO_printf(Perl_debug_log,"REG_LOOKBEHIND_SEEN "); \ + \ + if (RExC_seen & REG_GPOS_SEEN) \ + PerlIO_printf(Perl_debug_log,"REG_GPOS_SEEN "); \ + \ + if (RExC_seen & REG_CANY_SEEN) \ + PerlIO_printf(Perl_debug_log,"REG_CANY_SEEN "); \ + \ + if (RExC_seen & REG_RECURSE_SEEN) \ + PerlIO_printf(Perl_debug_log,"REG_RECURSE_SEEN "); \ + \ + if (RExC_seen & REG_TOP_LEVEL_BRANCHES_SEEN) \ + PerlIO_printf(Perl_debug_log,"REG_TOP_LEVEL_BRANCHES_SEEN "); \ + \ + if (RExC_seen & REG_VERBARG_SEEN) \ + PerlIO_printf(Perl_debug_log,"REG_VERBARG_SEEN "); \ + \ + if (RExC_seen & REG_CUTGROUP_SEEN) \ + PerlIO_printf(Perl_debug_log,"REG_CUTGROUP_SEEN "); \ + \ + if (RExC_seen & REG_RUN_ON_COMMENT_SEEN) \ + PerlIO_printf(Perl_debug_log,"REG_RUN_ON_COMMENT_SEEN "); \ + \ + if (RExC_seen & REG_UNFOLDED_MULTI_SEEN) \ + PerlIO_printf(Perl_debug_log,"REG_UNFOLDED_MULTI_SEEN "); \ + \ + if (RExC_seen & REG_GOSTART_SEEN) \ + PerlIO_printf(Perl_debug_log,"REG_GOSTART_SEEN "); \ + \ + if (RExC_seen & REG_UNBOUNDED_QUANTIFIER_SEEN) \ + PerlIO_printf(Perl_debug_log,"REG_UNBOUNDED_QUANTIFIER_SEEN "); \ + \ + PerlIO_printf(Perl_debug_log,"\n"); \ + }); + #define DEBUG_STUDYDATA(str,data,depth) \ DEBUG_OPTIMISE_MORE_r(if(data){ \ PerlIO_printf(Perl_debug_log, \ @@ -727,7 +821,8 @@ DEBUG_OPTIMISE_MORE_r(if(data){ floating substrings if needed. */ STATIC void -S_scan_commit(pTHX_ const RExC_state_t *pRExC_state, scan_data_t *data, I32 *minlenp, int is_inf) +S_scan_commit(pTHX_ const RExC_state_t *pRExC_state, scan_data_t *data, + SSize_t *minlenp, int is_inf) { const STRLEN l = CHR_SVLEN(data->last_found); const STRLEN old_l = CHR_SVLEN(*data->longest); @@ -751,9 +846,12 @@ S_scan_commit(pTHX_ const RExC_state_t * data->offset_float_min = l ? data->last_start_min : data->pos_min; data->offset_float_max = (l ? data->last_start_max - : (data->pos_delta == I32_MAX ? I32_MAX : data->pos_min + data->pos_delta)); - if (is_inf || (U32)data->offset_float_max > (U32)I32_MAX) - data->offset_float_max = I32_MAX; + : (data->pos_delta == SSize_t_MAX + ? SSize_t_MAX + : data->pos_min + data->pos_delta)); + if (is_inf + || (STRLEN)data->offset_float_max > (STRLEN)SSize_t_MAX) + data->offset_float_max = SSize_t_MAX; if (data->flags & SF_BEFORE_EOL) data->flags |= ((data->flags & SF_BEFORE_EOL) << SF_FL_SHIFT_EOL); @@ -777,299 +875,592 @@ S_scan_commit(pTHX_ const RExC_state_t * DEBUG_STUDYDATA("commit: ",data,0); } -/* These macros set, clear and test whether the synthetic start class ('ssc', - * given by the parameter) matches an empty string (EOS). This uses the - * 'next_off' field in the node, to save a bit in the flags field. The ssc - * stands alone, so there is never a next_off, so this field is otherwise - * unused. The EOS information is used only for compilation, but theoretically - * it could be passed on to the execution code. This could be used to store - * more than one bit of information, but only this one is currently used. */ -#define SET_SSC_EOS(node) STMT_START { (node)->next_off = TRUE; } STMT_END -#define CLEAR_SSC_EOS(node) STMT_START { (node)->next_off = FALSE; } STMT_END -#define TEST_SSC_EOS(node) cBOOL((node)->next_off) +/* An SSC is just a regnode_charclass_posix with an extra field: the inversion + * list that describes which code points it matches */ + +STATIC void +S_ssc_anything(pTHX_ regnode_ssc *ssc) +{ + /* Set the SSC 'ssc' to match an empty string or any code point */ + + PERL_ARGS_ASSERT_SSC_ANYTHING; + + assert(is_ANYOF_SYNTHETIC(ssc)); + + ssc->invlist = sv_2mortal(_new_invlist(2)); /* mortalize so won't leak */ + _append_range_to_invlist(ssc->invlist, 0, UV_MAX); + ANYOF_FLAGS(ssc) |= ANYOF_EMPTY_STRING; /* Plus match empty string */ +} + +STATIC int +S_ssc_is_anything(pTHX_ const regnode_ssc *ssc) +{ + /* Returns TRUE if the SSC 'ssc' can match the empty string and any code + * point; FALSE otherwise. Thus, this is used to see if using 'ssc' buys + * us anything: if the function returns TRUE, 'ssc' hasn't been restricted + * in any way, so there's no point in using it */ + + UV start, end; + bool ret; + + PERL_ARGS_ASSERT_SSC_IS_ANYTHING; + + assert(is_ANYOF_SYNTHETIC(ssc)); + + if (! (ANYOF_FLAGS(ssc) & ANYOF_EMPTY_STRING)) { + return FALSE; + } + + /* See if the list consists solely of the range 0 - Infinity */ + invlist_iterinit(ssc->invlist); + ret = invlist_iternext(ssc->invlist, &start, &end) + && start == 0 + && end == UV_MAX; + + invlist_iterfinish(ssc->invlist); + + if (ret) { + return TRUE; + } + + /* If e.g., both \w and \W are set, matches everything */ + if (ANYOF_POSIXL_SSC_TEST_ANY_SET(ssc)) { + int i; + for (i = 0; i < ANYOF_POSIXL_MAX; i += 2) { + if (ANYOF_POSIXL_TEST(ssc, i) && ANYOF_POSIXL_TEST(ssc, i+1)) { + return TRUE; + } + } + } + + return FALSE; +} -/* Can match anything (initialization) */ STATIC void -S_cl_anything(const RExC_state_t *pRExC_state, struct regnode_charclass_class *cl) +S_ssc_init(pTHX_ const RExC_state_t *pRExC_state, regnode_ssc *ssc) { - PERL_ARGS_ASSERT_CL_ANYTHING; + /* Initializes the SSC 'ssc'. This includes setting it to match an empty + * string, any code point, or any posix class under locale */ - ANYOF_BITMAP_SETALL(cl); - cl->flags = ANYOF_UNICODE_ALL; - SET_SSC_EOS(cl); + PERL_ARGS_ASSERT_SSC_INIT; + + Zero(ssc, 1, regnode_ssc); + set_ANYOF_SYNTHETIC(ssc); + ARG_SET(ssc, ANYOF_NONBITMAP_EMPTY); + ssc_anything(ssc); /* If any portion of the regex is to operate under locale rules, * initialization includes it. The reason this isn't done for all regexes * is that the optimizer was written under the assumption that locale was * all-or-nothing. Given the complexity and lack of documentation in the - * optimizer, and that there are inadequate test cases for locale, so many + * optimizer, and that there are inadequate test cases for locale, many * parts of it may not work properly, it is safest to avoid locale unless * necessary. */ if (RExC_contains_locale) { - ANYOF_CLASS_SETALL(cl); /* /l uses class */ - cl->flags |= ANYOF_LOCALE|ANYOF_CLASS|ANYOF_LOC_FOLD; + ANYOF_POSIXL_SETALL(ssc); } else { - ANYOF_CLASS_ZERO(cl); /* Only /l uses class now */ + ANYOF_POSIXL_ZERO(ssc); } } -/* Can match anything (initialization) */ STATIC int -S_cl_is_anything(const struct regnode_charclass_class *cl) +S_ssc_is_cp_posixl_init(pTHX_ const RExC_state_t *pRExC_state, + const regnode_ssc *ssc) { - int value; + /* Returns TRUE if the SSC 'ssc' is in its initial state with regard only + * to the list of code points matched, and locale posix classes; hence does + * not check its flags) */ - PERL_ARGS_ASSERT_CL_IS_ANYTHING; + UV start, end; + bool ret; - for (value = 0; value < ANYOF_MAX; value += 2) - if (ANYOF_CLASS_TEST(cl, value) && ANYOF_CLASS_TEST(cl, value + 1)) - return 1; - if (!(cl->flags & ANYOF_UNICODE_ALL)) - return 0; - if (!ANYOF_BITMAP_TESTALLSET((const void*)cl)) - return 0; - return 1; + PERL_ARGS_ASSERT_SSC_IS_CP_POSIXL_INIT; + + assert(is_ANYOF_SYNTHETIC(ssc)); + + invlist_iterinit(ssc->invlist); + ret = invlist_iternext(ssc->invlist, &start, &end) + && start == 0 + && end == UV_MAX; + + invlist_iterfinish(ssc->invlist); + + if (! ret) { + return FALSE; + } + + if (RExC_contains_locale && ! ANYOF_POSIXL_SSC_TEST_ALL_SET(ssc)) { + return FALSE; + } + + return TRUE; } -/* Can match anything (initialization) */ -STATIC void -S_cl_init(const RExC_state_t *pRExC_state, struct regnode_charclass_class *cl) +STATIC SV* +S_get_ANYOF_cp_list_for_ssc(pTHX_ const RExC_state_t *pRExC_state, + const regnode_charclass* const node) { - PERL_ARGS_ASSERT_CL_INIT; + /* Returns a mortal inversion list defining which code points are matched + * by 'node', which is of type ANYOF. Handles complementing the result if + * appropriate. If some code points aren't knowable at this time, the + * returned list must, and will, contain every code point that is a + * possibility. */ + + SV* invlist = sv_2mortal(_new_invlist(0)); + SV* only_utf8_locale_invlist = NULL; + unsigned int i; + const U32 n = ARG(node); + bool new_node_has_latin1 = FALSE; + + PERL_ARGS_ASSERT_GET_ANYOF_CP_LIST_FOR_SSC; + + /* Look at the data structure created by S_set_ANYOF_arg() */ + if (n != ANYOF_NONBITMAP_EMPTY) { + SV * const rv = MUTABLE_SV(RExC_rxi->data->data[n]); + AV * const av = MUTABLE_AV(SvRV(rv)); + SV **const ary = AvARRAY(av); + assert(RExC_rxi->data->what[n] == 's'); + + if (ary[1] && ary[1] != &PL_sv_undef) { /* Has compile-time swash */ + invlist = sv_2mortal(invlist_clone(_get_swash_invlist(ary[1]))); + } + else if (ary[0] && ary[0] != &PL_sv_undef) { + + /* Here, no compile-time swash, and there are things that won't be + * known until runtime -- we have to assume it could be anything */ + return _add_range_to_invlist(invlist, 0, UV_MAX); + } + else if (ary[3] && ary[3] != &PL_sv_undef) { + + /* Here no compile-time swash, and no run-time only data. Use the + * node's inversion list */ + invlist = sv_2mortal(invlist_clone(ary[3])); + } + + /* Get the code points valid only under UTF-8 locales */ + if ((ANYOF_FLAGS(node) & ANYOF_LOC_FOLD) + && ary[2] && ary[2] != &PL_sv_undef) + { + only_utf8_locale_invlist = ary[2]; + } + } + + /* An ANYOF node contains a bitmap for the first 256 code points, and an + * inversion list for the others, but if there are code points that should + * match only conditionally on the target string being UTF-8, those are + * placed in the inversion list, and not the bitmap. Since there are + * circumstances under which they could match, they are included in the + * SSC. But if the ANYOF node is to be inverted, we have to exclude them + * here, so that when we invert below, the end result actually does include + * them. (Think about "\xe0" =~ /[^\xc0]/di;). We have to do this here + * before we add the unconditionally matched code points */ + if (ANYOF_FLAGS(node) & ANYOF_INVERT) { + _invlist_intersection_complement_2nd(invlist, + PL_UpperLatin1, + &invlist); + } + + /* Add in the points from the bit map */ + for (i = 0; i < 256; i++) { + if (ANYOF_BITMAP_TEST(node, i)) { + invlist = add_cp_to_invlist(invlist, i); + new_node_has_latin1 = TRUE; + } + } + + /* If this can match all upper Latin1 code points, have to add them + * as well */ + if (ANYOF_FLAGS(node) & ANYOF_NON_UTF8_NON_ASCII_ALL) { + _invlist_union(invlist, PL_UpperLatin1, &invlist); + } + + /* Similarly for these */ + if (ANYOF_FLAGS(node) & ANYOF_ABOVE_LATIN1_ALL) { + invlist = _add_range_to_invlist(invlist, 256, UV_MAX); + } + + if (ANYOF_FLAGS(node) & ANYOF_INVERT) { + _invlist_invert(invlist); + } + else if (new_node_has_latin1 && ANYOF_FLAGS(node) & ANYOF_LOC_FOLD) { + + /* Under /li, any 0-255 could fold to any other 0-255, depending on the + * locale. We can skip this if there are no 0-255 at all. */ + _invlist_union(invlist, PL_Latin1, &invlist); + } + + /* Similarly add the UTF-8 locale possible matches. These have to be + * deferred until after the non-UTF-8 locale ones are taken care of just + * above, or it leads to wrong results under ANYOF_INVERT */ + if (only_utf8_locale_invlist) { + _invlist_union_maybe_complement_2nd(invlist, + only_utf8_locale_invlist, + ANYOF_FLAGS(node) & ANYOF_INVERT, + &invlist); + } - Zero(cl, 1, struct regnode_charclass_class); - cl->type = ANYOF; - cl_anything(pRExC_state, cl); - ARG_SET(cl, ANYOF_NONBITMAP_EMPTY); + return invlist; } /* These two functions currently do the exact same thing */ -#define cl_init_zero S_cl_init +#define ssc_init_zero ssc_init + +#define ssc_add_cp(ssc, cp) ssc_add_range((ssc), (cp), (cp)) +#define ssc_match_all_cp(ssc) ssc_add_range(ssc, 0, UV_MAX) + +/* 'AND' a given class with another one. Can create false positives. 'ssc' + * should not be inverted. 'and_with->flags & ANYOF_POSIXL' should be 0 if + * 'and_with' is a regnode_charclass instead of a regnode_ssc. */ -/* 'AND' a given class with another one. Can create false positives. 'cl' - * should not be inverted. 'and_with->flags & ANYOF_CLASS' should be 0 if - * 'and_with' is a regnode_charclass instead of a regnode_charclass_class. */ STATIC void -S_cl_and(struct regnode_charclass_class *cl, - const struct regnode_charclass_class *and_with) +S_ssc_and(pTHX_ const RExC_state_t *pRExC_state, regnode_ssc *ssc, + const regnode_charclass *and_with) { - PERL_ARGS_ASSERT_CL_AND; + /* Accumulate into SSC 'ssc' its 'AND' with 'and_with', which is either + * another SSC or a regular ANYOF class. Can create false positives. */ - assert(PL_regkind[and_with->type] == ANYOF); + SV* anded_cp_list; + U8 anded_flags; - /* I (khw) am not sure all these restrictions are necessary XXX */ - if (!(ANYOF_CLASS_TEST_ANY_SET(and_with)) - && !(ANYOF_CLASS_TEST_ANY_SET(cl)) - && (and_with->flags & ANYOF_LOCALE) == (cl->flags & ANYOF_LOCALE) - && !(and_with->flags & ANYOF_LOC_FOLD) - && !(cl->flags & ANYOF_LOC_FOLD)) { - int i; + PERL_ARGS_ASSERT_SSC_AND; + + assert(is_ANYOF_SYNTHETIC(ssc)); + + /* 'and_with' is used as-is if it too is an SSC; otherwise have to extract + * the code point inversion list and just the relevant flags */ + if (is_ANYOF_SYNTHETIC(and_with)) { + anded_cp_list = ((regnode_ssc *)and_with)->invlist; + anded_flags = ANYOF_FLAGS(and_with); + + /* XXX This is a kludge around what appears to be deficiencies in the + * optimizer. If we make S_ssc_anything() add in the WARN_SUPER flag, + * there are paths through the optimizer where it doesn't get weeded + * out when it should. And if we don't make some extra provision for + * it like the code just below, it doesn't get added when it should. + * This solution is to add it only when AND'ing, which is here, and + * only when what is being AND'ed is the pristine, original node + * matching anything. Thus it is like adding it to ssc_anything() but + * only when the result is to be AND'ed. Probably the same solution + * could be adopted for the same problem we have with /l matching, + * which is solved differently in S_ssc_init(), and that would lead to + * fewer false positives than that solution has. But if this solution + * creates bugs, the consequences are only that a warning isn't raised + * that should be; while the consequences for having /l bugs is + * incorrect matches */ + if (ssc_is_anything((regnode_ssc *)and_with)) { + anded_flags |= ANYOF_WARN_SUPER; + } + } + else { + anded_cp_list = get_ANYOF_cp_list_for_ssc(pRExC_state, and_with); + anded_flags = ANYOF_FLAGS(and_with) & ANYOF_COMMON_FLAGS; + } - if (and_with->flags & ANYOF_INVERT) - for (i = 0; i < ANYOF_BITMAP_SIZE; i++) - cl->bitmap[i] &= ~and_with->bitmap[i]; - else - for (i = 0; i < ANYOF_BITMAP_SIZE; i++) - cl->bitmap[i] &= and_with->bitmap[i]; - } /* XXXX: logic is complicated otherwise, leave it along for a moment. */ - - if (and_with->flags & ANYOF_INVERT) { - - /* Here, the and'ed node is inverted. Get the AND of the flags that - * aren't affected by the inversion. Those that are affected are - * handled individually below */ - U8 affected_flags = cl->flags & ~INVERSION_UNAFFECTED_FLAGS; - cl->flags &= (and_with->flags & INVERSION_UNAFFECTED_FLAGS); - cl->flags |= affected_flags; - - /* We currently don't know how to deal with things that aren't in the - * bitmap, but we know that the intersection is no greater than what - * is already in cl, so let there be false positives that get sorted - * out after the synthetic start class succeeds, and the node is - * matched for real. */ - - /* The inversion of these two flags indicate that the resulting - * intersection doesn't have them */ - if (and_with->flags & ANYOF_UNICODE_ALL) { - cl->flags &= ~ANYOF_UNICODE_ALL; - } - if (and_with->flags & ANYOF_NON_UTF8_LATIN1_ALL) { - cl->flags &= ~ANYOF_NON_UTF8_LATIN1_ALL; - } - } - else { /* and'd node is not inverted */ - U8 outside_bitmap_but_not_utf8; /* Temp variable */ - - if (! ANYOF_NONBITMAP(and_with)) { - - /* Here 'and_with' doesn't match anything outside the bitmap - * (except possibly ANYOF_UNICODE_ALL), which means the - * intersection can't either, except for ANYOF_UNICODE_ALL, in - * which case we don't know what the intersection is, but it's no - * greater than what cl already has, so can just leave it alone, - * with possible false positives */ - if (! (and_with->flags & ANYOF_UNICODE_ALL)) { - ARG_SET(cl, ANYOF_NONBITMAP_EMPTY); - cl->flags &= ~ANYOF_NONBITMAP_NON_UTF8; - } - } - else if (! ANYOF_NONBITMAP(cl)) { - - /* Here, 'and_with' does match something outside the bitmap, and cl - * doesn't have a list of things to match outside the bitmap. If - * cl can match all code points above 255, the intersection will - * be those above-255 code points that 'and_with' matches. If cl - * can't match all Unicode code points, it means that it can't - * match anything outside the bitmap (since the 'if' that got us - * into this block tested for that), so we leave the bitmap empty. - */ - if (cl->flags & ANYOF_UNICODE_ALL) { - ARG_SET(cl, ARG(and_with)); + ANYOF_FLAGS(ssc) &= anded_flags; - /* and_with's ARG may match things that don't require UTF8. - * And now cl's will too, in spite of this being an 'and'. See - * the comments below about the kludge */ - cl->flags |= and_with->flags & ANYOF_NONBITMAP_NON_UTF8; - } - } - else { - /* Here, both 'and_with' and cl match something outside the - * bitmap. Currently we do not do the intersection, so just match - * whatever cl had at the beginning. */ - } + /* Below, C1 is the list of code points in 'ssc'; P1, its posix classes. + * C2 is the list of code points in 'and-with'; P2, its posix classes. + * 'and_with' may be inverted. When not inverted, we have the situation of + * computing: + * (C1 | P1) & (C2 | P2) + * = (C1 & (C2 | P2)) | (P1 & (C2 | P2)) + * = ((C1 & C2) | (C1 & P2)) | ((P1 & C2) | (P1 & P2)) + * <= ((C1 & C2) | P2)) | ( P1 | (P1 & P2)) + * <= ((C1 & C2) | P1 | P2) + * Alternatively, the last few steps could be: + * = ((C1 & C2) | (C1 & P2)) | ((P1 & C2) | (P1 & P2)) + * <= ((C1 & C2) | C1 ) | ( C2 | (P1 & P2)) + * <= (C1 | C2 | (P1 & P2)) + * We favor the second approach if either P1 or P2 is non-empty. This is + * because these components are a barrier to doing optimizations, as what + * they match cannot be known until the moment of matching as they are + * dependent on the current locale, 'AND"ing them likely will reduce or + * eliminate them. + * But we can do better if we know that C1,P1 are in their initial state (a + * frequent occurrence), each matching everything: + * () & (C2 | P2) = C2 | P2 + * Similarly, if C2,P2 are in their initial state (again a frequent + * occurrence), the result is a no-op + * (C1 | P1) & () = C1 | P1 + * + * Inverted, we have + * (C1 | P1) & ~(C2 | P2) = (C1 | P1) & (~C2 & ~P2) + * = (C1 & (~C2 & ~P2)) | (P1 & (~C2 & ~P2)) + * <= (C1 & ~C2) | (P1 & ~P2) + * */ + if ((ANYOF_FLAGS(and_with) & ANYOF_INVERT) + && ! is_ANYOF_SYNTHETIC(and_with)) + { + unsigned int i; - /* Take the intersection of the two sets of flags. However, the - * ANYOF_NONBITMAP_NON_UTF8 flag is treated as an 'or'. This is a - * kludge around the fact that this flag is not treated like the others - * which are initialized in cl_anything(). The way the optimizer works - * is that the synthetic start class (SSC) is initialized to match - * anything, and then the first time a real node is encountered, its - * values are AND'd with the SSC's with the result being the values of - * the real node. However, there are paths through the optimizer where - * the AND never gets called, so those initialized bits are set - * inappropriately, which is not usually a big deal, as they just cause - * false positives in the SSC, which will just mean a probably - * imperceptible slow down in execution. However this bit has a - * higher false positive consequence in that it can cause utf8.pm, - * utf8_heavy.pl ... to be loaded when not necessary, which is a much - * bigger slowdown and also causes significant extra memory to be used. - * In order to prevent this, the code now takes a different tack. The - * bit isn't set unless some part of the regular expression needs it, - * but once set it won't get cleared. This means that these extra - * modules won't get loaded unless there was some path through the - * pattern that would have required them anyway, and so any false - * positives that occur by not ANDing them out when they could be - * aren't as severe as they would be if we treated this bit like all - * the others */ - outside_bitmap_but_not_utf8 = (cl->flags | and_with->flags) - & ANYOF_NONBITMAP_NON_UTF8; - cl->flags &= and_with->flags; - cl->flags |= outside_bitmap_but_not_utf8; + ssc_intersection(ssc, + anded_cp_list, + FALSE /* Has already been inverted */ + ); + + /* If either P1 or P2 is empty, the intersection will be also; can skip + * the loop */ + if (! (ANYOF_FLAGS(and_with) & ANYOF_POSIXL)) { + ANYOF_POSIXL_ZERO(ssc); + } + else if (ANYOF_POSIXL_SSC_TEST_ANY_SET(ssc)) { + + /* Note that the Posix class component P from 'and_with' actually + * looks like: + * P = Pa | Pb | ... | Pn + * where each component is one posix class, such as in [\w\s]. + * Thus + * ~P = ~(Pa | Pb | ... | Pn) + * = ~Pa & ~Pb & ... & ~Pn + * <= ~Pa | ~Pb | ... | ~Pn + * The last is something we can easily calculate, but unfortunately + * is likely to have many false positives. We could do better + * in some (but certainly not all) instances if two classes in + * P have known relationships. For example + * :lower: <= :alpha: <= :alnum: <= \w <= :graph: <= :print: + * So + * :lower: & :print: = :lower: + * And similarly for classes that must be disjoint. For example, + * since \s and \w can have no elements in common based on rules in + * the POSIX standard, + * \w & ^\S = nothing + * Unfortunately, some vendor locales do not meet the Posix + * standard, in particular almost everything by Microsoft. + * The loop below just changes e.g., \w into \W and vice versa */ + + regnode_charclass_posixl temp; + int add = 1; /* To calculate the index of the complement */ + + ANYOF_POSIXL_ZERO(&temp); + for (i = 0; i < ANYOF_MAX; i++) { + assert(i % 2 != 0 + || ! ANYOF_POSIXL_TEST((regnode_charclass_posixl*) and_with, i) + || ! ANYOF_POSIXL_TEST((regnode_charclass_posixl*) and_with, i + 1)); + + if (ANYOF_POSIXL_TEST((regnode_charclass_posixl*) and_with, i)) { + ANYOF_POSIXL_SET(&temp, i + add); + } + add = 0 - add; /* 1 goes to -1; -1 goes to 1 */ + } + ANYOF_POSIXL_AND(&temp, ssc); + + } /* else ssc already has no posixes */ + } /* else: Not inverted. This routine is a no-op if 'and_with' is an SSC + in its initial state */ + else if (! is_ANYOF_SYNTHETIC(and_with) + || ! ssc_is_cp_posixl_init(pRExC_state, (regnode_ssc *)and_with)) + { + /* But if 'ssc' is in its initial state, the result is just 'and_with'; + * copy it over 'ssc' */ + if (ssc_is_cp_posixl_init(pRExC_state, ssc)) { + if (is_ANYOF_SYNTHETIC(and_with)) { + StructCopy(and_with, ssc, regnode_ssc); + } + else { + ssc->invlist = anded_cp_list; + ANYOF_POSIXL_ZERO(ssc); + if (ANYOF_FLAGS(and_with) & ANYOF_POSIXL) { + ANYOF_POSIXL_OR((regnode_charclass_posixl*) and_with, ssc); + } + } + } + else if (ANYOF_POSIXL_SSC_TEST_ANY_SET(ssc) + || (ANYOF_FLAGS(and_with) & ANYOF_POSIXL)) + { + /* One or the other of P1, P2 is non-empty. */ + if (ANYOF_FLAGS(and_with) & ANYOF_POSIXL) { + ANYOF_POSIXL_AND((regnode_charclass_posixl*) and_with, ssc); + } + ssc_union(ssc, anded_cp_list, FALSE); + } + else { /* P1 = P2 = empty */ + ssc_intersection(ssc, anded_cp_list, FALSE); + } } } -/* 'OR' a given class with another one. Can create false positives. 'cl' - * should not be inverted. 'or_with->flags & ANYOF_CLASS' should be 0 if - * 'or_with' is a regnode_charclass instead of a regnode_charclass_class. */ STATIC void -S_cl_or(const RExC_state_t *pRExC_state, struct regnode_charclass_class *cl, const struct regnode_charclass_class *or_with) +S_ssc_or(pTHX_ const RExC_state_t *pRExC_state, regnode_ssc *ssc, + const regnode_charclass *or_with) { - PERL_ARGS_ASSERT_CL_OR; + /* Accumulate into SSC 'ssc' its 'OR' with 'or_with', which is either + * another SSC or a regular ANYOF class. Can create false positives if + * 'or_with' is to be inverted. */ - if (or_with->flags & ANYOF_INVERT) { + SV* ored_cp_list; + U8 ored_flags; - /* Here, the or'd node is to be inverted. This means we take the - * complement of everything not in the bitmap, but currently we don't - * know what that is, so give up and match anything */ - if (ANYOF_NONBITMAP(or_with)) { - cl_anything(pRExC_state, cl); - } - /* We do not use - * (B1 | CL1) | (!B2 & !CL2) = (B1 | !B2 & !CL2) | (CL1 | (!B2 & !CL2)) - * <= (B1 | !B2) | (CL1 | !CL2) - * which is wasteful if CL2 is small, but we ignore CL2: - * (B1 | CL1) | (!B2 & !CL2) <= (B1 | CL1) | !B2 = (B1 | !B2) | CL1 - * XXXX Can we handle case-fold? Unclear: - * (OK1(i) | OK1(i')) | !(OK1(i) | OK1(i')) = - * (OK1(i) | OK1(i')) | (!OK1(i) & !OK1(i')) - */ - else if ( (or_with->flags & ANYOF_LOCALE) == (cl->flags & ANYOF_LOCALE) - && !(or_with->flags & ANYOF_LOC_FOLD) - && !(cl->flags & ANYOF_LOC_FOLD) ) { - int i; + PERL_ARGS_ASSERT_SSC_OR; - for (i = 0; i < ANYOF_BITMAP_SIZE; i++) - cl->bitmap[i] |= ~or_with->bitmap[i]; - } /* XXXX: logic is complicated otherwise */ - else { - cl_anything(pRExC_state, cl); - } + assert(is_ANYOF_SYNTHETIC(ssc)); - /* And, we can just take the union of the flags that aren't affected - * by the inversion */ - cl->flags |= or_with->flags & INVERSION_UNAFFECTED_FLAGS; - - /* For the remaining flags: - ANYOF_UNICODE_ALL and inverted means to not match anything above - 255, which means that the union with cl should just be - what cl has in it, so can ignore this flag - ANYOF_NON_UTF8_LATIN1_ALL and inverted means if not utf8 and ord - is 127-255 to match them, but then invert that, so the - union with cl should just be what cl has in it, so can - ignore this flag - */ - } else { /* 'or_with' is not inverted */ - /* (B1 | CL1) | (B2 | CL2) = (B1 | B2) | (CL1 | CL2)) */ - if ( (or_with->flags & ANYOF_LOCALE) == (cl->flags & ANYOF_LOCALE) - && (!(or_with->flags & ANYOF_LOC_FOLD) - || (cl->flags & ANYOF_LOC_FOLD)) ) { - int i; + /* 'or_with' is used as-is if it too is an SSC; otherwise have to extract + * the code point inversion list and just the relevant flags */ + if (is_ANYOF_SYNTHETIC(or_with)) { + ored_cp_list = ((regnode_ssc*) or_with)->invlist; + ored_flags = ANYOF_FLAGS(or_with); + } + else { + ored_cp_list = get_ANYOF_cp_list_for_ssc(pRExC_state, or_with); + ored_flags = ANYOF_FLAGS(or_with) & ANYOF_COMMON_FLAGS; + } + + ANYOF_FLAGS(ssc) |= ored_flags; + + /* Below, C1 is the list of code points in 'ssc'; P1, its posix classes. + * C2 is the list of code points in 'or-with'; P2, its posix classes. + * 'or_with' may be inverted. When not inverted, we have the simple + * situation of computing: + * (C1 | P1) | (C2 | P2) = (C1 | C2) | (P1 | P2) + * If P1|P2 yields a situation with both a class and its complement are + * set, like having both \w and \W, this matches all code points, and we + * can delete these from the P component of the ssc going forward. XXX We + * might be able to delete all the P components, but I (khw) am not certain + * about this, and it is better to be safe. + * + * Inverted, we have + * (C1 | P1) | ~(C2 | P2) = (C1 | P1) | (~C2 & ~P2) + * <= (C1 | P1) | ~C2 + * <= (C1 | ~C2) | P1 + * (which results in actually simpler code than the non-inverted case) + * */ - /* OR char bitmap and class bitmap separately */ - for (i = 0; i < ANYOF_BITMAP_SIZE; i++) - cl->bitmap[i] |= or_with->bitmap[i]; - if (or_with->flags & ANYOF_CLASS) { - ANYOF_CLASS_OR(or_with, cl); + if ((ANYOF_FLAGS(or_with) & ANYOF_INVERT) + && ! is_ANYOF_SYNTHETIC(or_with)) + { + /* We ignore P2, leaving P1 going forward */ + } /* else Not inverted */ + else if (ANYOF_FLAGS(or_with) & ANYOF_POSIXL) { + ANYOF_POSIXL_OR((regnode_charclass_posixl*)or_with, ssc); + if (ANYOF_POSIXL_SSC_TEST_ANY_SET(ssc)) { + unsigned int i; + for (i = 0; i < ANYOF_MAX; i += 2) { + if (ANYOF_POSIXL_TEST(ssc, i) && ANYOF_POSIXL_TEST(ssc, i + 1)) + { + ssc_match_all_cp(ssc); + ANYOF_POSIXL_CLEAR(ssc, i); + ANYOF_POSIXL_CLEAR(ssc, i+1); + } } - } - else { /* XXXX: logic is complicated, leave it along for a moment. */ - cl_anything(pRExC_state, cl); - } + } + } - if (ANYOF_NONBITMAP(or_with)) { + ssc_union(ssc, + ored_cp_list, + FALSE /* Already has been inverted */ + ); +} - /* Use the added node's outside-the-bit-map match if there isn't a - * conflict. If there is a conflict (both nodes match something - * outside the bitmap, but what they match outside is not the same - * pointer, and hence not easily compared until XXX we extend - * inversion lists this far), give up and allow the start class to - * match everything outside the bitmap. If that stuff is all above - * 255, can just set UNICODE_ALL, otherwise caould be anything. */ - if (! ANYOF_NONBITMAP(cl)) { - ARG_SET(cl, ARG(or_with)); - } - else if (ARG(cl) != ARG(or_with)) { +PERL_STATIC_INLINE void +S_ssc_union(pTHX_ regnode_ssc *ssc, SV* const invlist, const bool invert2nd) +{ + PERL_ARGS_ASSERT_SSC_UNION; - if ((or_with->flags & ANYOF_NONBITMAP_NON_UTF8)) { - cl_anything(pRExC_state, cl); - } - else { - cl->flags |= ANYOF_UNICODE_ALL; - } - } - } + assert(is_ANYOF_SYNTHETIC(ssc)); + + _invlist_union_maybe_complement_2nd(ssc->invlist, + invlist, + invert2nd, + &ssc->invlist); +} + +PERL_STATIC_INLINE void +S_ssc_intersection(pTHX_ regnode_ssc *ssc, + SV* const invlist, + const bool invert2nd) +{ + PERL_ARGS_ASSERT_SSC_INTERSECTION; + + assert(is_ANYOF_SYNTHETIC(ssc)); + + _invlist_intersection_maybe_complement_2nd(ssc->invlist, + invlist, + invert2nd, + &ssc->invlist); +} + +PERL_STATIC_INLINE void +S_ssc_add_range(pTHX_ regnode_ssc *ssc, const UV start, const UV end) +{ + PERL_ARGS_ASSERT_SSC_ADD_RANGE; + + assert(is_ANYOF_SYNTHETIC(ssc)); + + ssc->invlist = _add_range_to_invlist(ssc->invlist, start, end); +} + +PERL_STATIC_INLINE void +S_ssc_cp_and(pTHX_ regnode_ssc *ssc, const UV cp) +{ + /* AND just the single code point 'cp' into the SSC 'ssc' */ + + SV* cp_list = _new_invlist(2); + + PERL_ARGS_ASSERT_SSC_CP_AND; + + assert(is_ANYOF_SYNTHETIC(ssc)); + + cp_list = add_cp_to_invlist(cp_list, cp); + ssc_intersection(ssc, cp_list, + FALSE /* Not inverted */ + ); + SvREFCNT_dec_NN(cp_list); +} + +PERL_STATIC_INLINE void +S_ssc_clear_locale(pTHX_ regnode_ssc *ssc) +{ + /* Set the SSC 'ssc' to not match any locale things */ + + PERL_ARGS_ASSERT_SSC_CLEAR_LOCALE; + + assert(is_ANYOF_SYNTHETIC(ssc)); + + ANYOF_POSIXL_ZERO(ssc); + ANYOF_FLAGS(ssc) &= ~ANYOF_LOCALE_FLAGS; +} + +STATIC void +S_ssc_finalize(pTHX_ RExC_state_t *pRExC_state, regnode_ssc *ssc) +{ + /* The inversion list in the SSC is marked mortal; now we need a more + * permanent copy, which is stored the same way that is done in a regular + * ANYOF node, with the first 256 code points in a bit map */ + + SV* invlist = invlist_clone(ssc->invlist); + + PERL_ARGS_ASSERT_SSC_FINALIZE; - /* Take the union */ - cl->flags |= or_with->flags; + assert(is_ANYOF_SYNTHETIC(ssc)); + + /* The code in this file assumes that all but these flags aren't relevant + * to the SSC, except ANYOF_EMPTY_STRING, which should be cleared by the + * time we reach here */ + assert(! (ANYOF_FLAGS(ssc) & ~ANYOF_COMMON_FLAGS)); + + populate_ANYOF_from_invlist( (regnode *) ssc, &invlist); + + set_ANYOF_arg(pRExC_state, (regnode *) ssc, invlist, + NULL, NULL, NULL, FALSE); + + /* Make sure is clone-safe */ + ssc->invlist = NULL; + + if (ANYOF_POSIXL_SSC_TEST_ANY_SET(ssc)) { + ANYOF_FLAGS(ssc) |= ANYOF_POSIXL; } + + assert(! (ANYOF_FLAGS(ssc) & ANYOF_LOCALE_FLAGS) || RExC_contains_locale); } #define TRIE_LIST_ITEM(state,idx) (trie->states[state].trans.list)[ idx ] #define TRIE_LIST_CUR(state) ( TRIE_LIST_ITEM( state, 0 ).forid ) #define TRIE_LIST_LEN(state) ( TRIE_LIST_ITEM( state, 0 ).newstate ) -#define TRIE_LIST_USED(idx) ( trie->states[state].trans.list ? (TRIE_LIST_CUR( idx ) - 1) : 0 ) +#define TRIE_LIST_USED(idx) ( trie->states[state].trans.list \ + ? (TRIE_LIST_CUR( idx ) - 1) \ + : 0 ) #ifdef DEBUGGING @@ -1112,13 +1503,13 @@ S_dump_trie(pTHX_ const struct _reg_trie for( state = 0 ; state < trie->uniquecharcount ; state++ ) { SV ** const tmp = av_fetch( revcharmap, state, 0); if ( tmp ) { - PerlIO_printf( Perl_debug_log, "%*s", + PerlIO_printf( Perl_debug_log, "%*s", colwidth, - pv_pretty(sv, SvPV_nolen_const(*tmp), SvCUR(*tmp), colwidth, + pv_pretty(sv, SvPV_nolen_const(*tmp), SvCUR(*tmp), colwidth, PL_colors[0], PL_colors[1], (SvUTF8(*tmp) ? PERL_PV_ESCAPE_UNI : 0) | - PERL_PV_ESCAPE_FIRSTCHAR - ) + PERL_PV_ESCAPE_FIRSTCHAR + ) ); } } @@ -1132,10 +1523,12 @@ S_dump_trie(pTHX_ const struct _reg_trie for( state = 1 ; state < trie->statecount ; state++ ) { const U32 base = trie->states[ state ].trans.base; - PerlIO_printf( Perl_debug_log, "%*s#%4"UVXf"|", (int)depth * 2 + 2,"", (UV)state); + PerlIO_printf( Perl_debug_log, "%*s#%4"UVXf"|", + (int)depth * 2 + 2,"", (UV)state); if ( trie->states[ state ].wordnum ) { - PerlIO_printf( Perl_debug_log, " W%4X", trie->states[ state ].wordnum ); + PerlIO_printf( Perl_debug_log, " W%4X", + trie->states[ state ].wordnum ); } else { PerlIO_printf( Perl_debug_log, "%6s", "" ); } @@ -1147,19 +1540,23 @@ S_dump_trie(pTHX_ const struct _reg_trie while( ( base + ofs < trie->uniquecharcount ) || ( base + ofs - trie->uniquecharcount < trie->lasttrans - && trie->trans[ base + ofs - trie->uniquecharcount ].check != state)) + && trie->trans[ base + ofs - trie->uniquecharcount ].check + != state)) ofs++; PerlIO_printf( Perl_debug_log, "+%2"UVXf"[ ", (UV)ofs); for ( ofs = 0 ; ofs < trie->uniquecharcount ; ofs++ ) { - if ( ( base + ofs >= trie->uniquecharcount ) && - ( base + ofs - trie->uniquecharcount < trie->lasttrans ) && - trie->trans[ base + ofs - trie->uniquecharcount ].check == state ) + if ( ( base + ofs >= trie->uniquecharcount ) + && ( base + ofs - trie->uniquecharcount + < trie->lasttrans ) + && trie->trans[ base + ofs + - trie->uniquecharcount ].check == state ) { PerlIO_printf( Perl_debug_log, "%*"UVXf, colwidth, - (UV)trie->trans[ base + ofs - trie->uniquecharcount ].next ); + (UV)trie->trans[ base + ofs + - trie->uniquecharcount ].next ); } else { PerlIO_printf( Perl_debug_log, "%*s",colwidth," ." ); } @@ -1170,17 +1567,18 @@ S_dump_trie(pTHX_ const struct _reg_trie } PerlIO_printf( Perl_debug_log, "\n" ); } - PerlIO_printf(Perl_debug_log, "%*sword_info N:(prev,len)=", (int)depth*2, ""); + PerlIO_printf(Perl_debug_log, "%*sword_info N:(prev,len)=", + (int)depth*2, ""); for (word=1; word <= trie->wordcount; word++) { PerlIO_printf(Perl_debug_log, " %d:(%d,%d)", (int)word, (int)(trie->wordinfo[word].prev), (int)(trie->wordinfo[word].len)); } PerlIO_printf(Perl_debug_log, "\n" ); -} +} /* Dumps a fully constructed but uncompressed trie in list form. - List tries normally only are used for construction when the number of + List tries normally only are used for construction when the number of possible chars (trie->uniquecharcount) is very high. Used for debugging make_trie(). */ @@ -1200,10 +1598,10 @@ S_dump_trie_interim_list(pTHX_ const str PerlIO_printf( Perl_debug_log, "%*sState :Word | Transition Data\n%*s%s", (int)depth * 2 + 2,"", (int)depth * 2 + 2,"", "------:-----+-----------------\n" ); - + for( state=1 ; state < next_alloc ; state ++ ) { U16 charid; - + PerlIO_printf( Perl_debug_log, "%*s %4"UVXf" :", (int)depth * 2 + 2,"", (UV)state ); if ( ! trie->states[ state ].wordnum ) { @@ -1214,31 +1612,33 @@ S_dump_trie_interim_list(pTHX_ const str ); } for( charid = 1 ; charid <= TRIE_LIST_USED( state ) ; charid++ ) { - SV ** const tmp = av_fetch( revcharmap, TRIE_LIST_ITEM(state,charid).forid, 0); + SV ** const tmp = av_fetch( revcharmap, + TRIE_LIST_ITEM(state,charid).forid, 0); if ( tmp ) { PerlIO_printf( Perl_debug_log, "%*s:%3X=%4"UVXf" | ", colwidth, - pv_pretty(sv, SvPV_nolen_const(*tmp), SvCUR(*tmp), colwidth, - PL_colors[0], PL_colors[1], - (SvUTF8(*tmp) ? PERL_PV_ESCAPE_UNI : 0) | - PERL_PV_ESCAPE_FIRSTCHAR + pv_pretty(sv, SvPV_nolen_const(*tmp), SvCUR(*tmp), + colwidth, + PL_colors[0], PL_colors[1], + (SvUTF8(*tmp) ? PERL_PV_ESCAPE_UNI : 0) + | PERL_PV_ESCAPE_FIRSTCHAR ) , TRIE_LIST_ITEM(state,charid).forid, (UV)TRIE_LIST_ITEM(state,charid).newstate ); - if (!(charid % 10)) + if (!(charid % 10)) PerlIO_printf(Perl_debug_log, "\n%*s| ", (int)((depth * 2) + 14), ""); } } PerlIO_printf( Perl_debug_log, "\n"); } -} +} /* Dumps a fully constructed but uncompressed trie in table form. - This is the normal DFA style state transition table, with a few - twists to facilitate compression later. + This is the normal DFA style state transition table, with a few + twists to facilitate compression later. Used for debugging make_trie(). */ STATIC void @@ -1253,24 +1653,24 @@ S_dump_trie_interim_table(pTHX_ const st GET_RE_DEBUG_FLAGS_DECL; PERL_ARGS_ASSERT_DUMP_TRIE_INTERIM_TABLE; - + /* print out the table precompression so that we can do a visual check that they are identical. */ - + PerlIO_printf( Perl_debug_log, "%*sChar : ",(int)depth * 2 + 2,"" ); for( charid = 0 ; charid < trie->uniquecharcount ; charid++ ) { SV ** const tmp = av_fetch( revcharmap, charid, 0); if ( tmp ) { - PerlIO_printf( Perl_debug_log, "%*s", + PerlIO_printf( Perl_debug_log, "%*s", colwidth, - pv_pretty(sv, SvPV_nolen_const(*tmp), SvCUR(*tmp), colwidth, + pv_pretty(sv, SvPV_nolen_const(*tmp), SvCUR(*tmp), colwidth, PL_colors[0], PL_colors[1], (SvUTF8(*tmp) ? PERL_PV_ESCAPE_UNI : 0) | - PERL_PV_ESCAPE_FIRSTCHAR - ) + PERL_PV_ESCAPE_FIRSTCHAR + ) ); } } @@ -1285,7 +1685,7 @@ S_dump_trie_interim_table(pTHX_ const st for( state=1 ; state < next_alloc ; state += trie->uniquecharcount ) { - PerlIO_printf( Perl_debug_log, "%*s%4"UVXf" : ", + PerlIO_printf( Perl_debug_log, "%*s%4"UVXf" : ", (int)depth * 2 + 2,"", (UV)TRIE_NODENUM( state ) ); @@ -1297,9 +1697,11 @@ S_dump_trie_interim_table(pTHX_ const st PerlIO_printf( Perl_debug_log, "%*s", colwidth, "." ); } if ( ! trie->states[ TRIE_NODENUM( state ) ].wordnum ) { - PerlIO_printf( Perl_debug_log, " (%4"UVXf")\n", (UV)trie->trans[ state ].check ); + PerlIO_printf( Perl_debug_log, " (%4"UVXf")\n", + (UV)trie->trans[ state ].check ); } else { - PerlIO_printf( Perl_debug_log, " (%4"UVXf") W%4X\n", (UV)trie->trans[ state ].check, + PerlIO_printf( Perl_debug_log, " (%4"UVXf") W%4X\n", + (UV)trie->trans[ state ].check, trie->states[ TRIE_NODENUM( state ) ].wordnum ); } } @@ -1418,7 +1820,7 @@ and would end up looking like: 8: EXACT (10) 10: END(0) - d = uvuni_to_utf8_flags(d, uv, 0); + d = uvchr_to_utf8_flags(d, uv, 0); is the recommended Unicode-aware way of saying @@ -1430,7 +1832,7 @@ is the recommended Unicode-aware way of if (UTF) { \ SV *zlopp = newSV(7); /* XXX: optimize me */ \ unsigned char *flrbbbbb = (unsigned char *) SvPVX(zlopp); \ - unsigned const char *const kapow = uvuni_to_utf8(flrbbbbb, val); \ + unsigned const char *const kapow = uvchr_to_utf8(flrbbbbb, val); \ SvCUR_set(zlopp, kapow - flrbbbbb); \ SvPOK_on(zlopp); \ SvUTF8_on(zlopp); \ @@ -1441,31 +1843,28 @@ is the recommended Unicode-aware way of } \ } STMT_END -#define TRIE_READ_CHAR STMT_START { \ - wordlen++; \ - if ( UTF ) { \ - /* if it is UTF then it is either already folded, or does not need folding */ \ - uvc = utf8n_to_uvuni( (const U8*) uc, UTF8_MAXLEN, &len, uniflags); \ - } \ - else if (folder == PL_fold_latin1) { \ - /* if we use this folder we have to obey unicode rules on latin-1 data */ \ - if ( foldlen > 0 ) { \ - uvc = utf8n_to_uvuni( (const U8*) scan, UTF8_MAXLEN, &len, uniflags ); \ - foldlen -= len; \ - scan += len; \ - len = 0; \ - } else { \ - len = 1; \ - uvc = _to_fold_latin1( (U8) *uc, foldbuf, &foldlen, 1); \ - skiplen = UNISKIP(uvc); \ - foldlen -= skiplen; \ - scan = foldbuf + skiplen; \ - } \ - } else { \ - /* raw data, will be folded later if needed */ \ - uvc = (U32)*uc; \ - len = 1; \ - } \ +/* This gets the next character from the input, folding it if not already + * folded. */ +#define TRIE_READ_CHAR STMT_START { \ + wordlen++; \ + if ( UTF ) { \ + /* if it is UTF then it is either already folded, or does not need \ + * folding */ \ + uvc = valid_utf8_to_uvchr( (const U8*) uc, &len); \ + } \ + else if (folder == PL_fold_latin1) { \ + /* This folder implies Unicode rules, which in the range expressible \ + * by not UTF is the lower case, with the two exceptions, one of \ + * which should have been taken care of before calling this */ \ + assert(*uc != LATIN_SMALL_LETTER_SHARP_S); \ + uvc = toLOWER_L1(*uc); \ + if (UNLIKELY(uvc == MICRO_SIGN)) uvc = GREEK_SMALL_LETTER_MU; \ + len = 1; \ + } else { \ + /* raw data, will be folded later if needed */ \ + uvc = (U32)*uc; \ + len = 1; \ + } \ } STMT_END @@ -1508,7 +1907,8 @@ is the recommended Unicode-aware way of \ if ( noper_next < tail ) { \ if (!trie->jump) \ - trie->jump = (U16 *) PerlMemShared_calloc( word_count + 1, sizeof(U16) ); \ + trie->jump = (U16 *) PerlMemShared_calloc( word_count + 1, \ + sizeof(U16) ); \ trie->jump[curword] = (U16)(noper_next - convert); \ if (!jumper) \ jumper = noper_next; \ @@ -1543,7 +1943,9 @@ is the recommended Unicode-aware way of #define MADE_EXACT_TRIE 4 STATIC I32 -S_make_trie(pTHX_ RExC_state_t *pRExC_state, regnode *startbranch, regnode *first, regnode *last, regnode *tail, U32 word_count, U32 flags, U32 depth) +S_make_trie(pTHX_ RExC_state_t *pRExC_state, regnode *startbranch, + regnode *first, regnode *last, regnode *tail, + U32 word_count, U32 flags, U32 depth) { dVAR; /* first pass, loop through and scan words */ @@ -1551,7 +1953,6 @@ S_make_trie(pTHX_ RExC_state_t *pRExC_st HV *widecharmap = NULL; AV *revcharmap = newAV(); regnode *cur; - const U32 uniflags = UTF8_ALLOW_DEFAULT; STRLEN len = 0; UV uvc = 0; U16 curword = 0; @@ -1564,13 +1965,13 @@ S_make_trie(pTHX_ RExC_state_t *pRExC_st const U8 * folder = NULL; #ifdef DEBUGGING - const U32 data_slot = add_data( pRExC_state, 4, "tuuu" ); + const U32 data_slot = add_data( pRExC_state, STR_WITH_LEN("tuuu")); AV *trie_words = NULL; /* along with revcharmap, this only used during construction but both are * useful during debugging so we store them in the struct when debugging. */ #else - const U32 data_slot = add_data( pRExC_state, 2, "tu" ); + const U32 data_slot = add_data( pRExC_state, STR_WITH_LEN("tu")); STRLEN trie_charcount=0; #endif SV *re_trie_maxbuff; @@ -1585,10 +1986,8 @@ S_make_trie(pTHX_ RExC_state_t *pRExC_st case EXACT: break; case EXACTFA: case EXACTFU_SS: - case EXACTFU_TRICKYFOLD: case EXACTFU: folder = PL_fold_latin1; break; case EXACTF: folder = PL_fold; break; - case EXACTFL: folder = PL_fold_locale; break; default: Perl_croak( aTHX_ "panic! In trie construction, unknown node type %u %s", (unsigned) flags, PL_reg_name[flags] ); } @@ -1612,14 +2011,13 @@ S_make_trie(pTHX_ RExC_state_t *pRExC_st sv_setiv(re_trie_maxbuff, RE_TRIE_MAXBUF_INIT); } DEBUG_TRIE_COMPILE_r({ - PerlIO_printf( Perl_debug_log, - "%*smake_trie start==%d, first==%d, last==%d, tail==%d depth=%d\n", - (int)depth * 2 + 2, "", - REG_NODE_NUM(startbranch),REG_NODE_NUM(first), - REG_NODE_NUM(last), REG_NODE_NUM(tail), - (int)depth); + PerlIO_printf( Perl_debug_log, + "%*smake_trie start==%d, first==%d, last==%d, tail==%d depth=%d\n", + (int)depth * 2 + 2, "", + REG_NODE_NUM(startbranch),REG_NODE_NUM(first), + REG_NODE_NUM(last), REG_NODE_NUM(tail), (int)depth); }); - + /* Find the node we are going to overwrite */ if ( first == startbranch && OP( last ) != BRANCH ) { /* whole branch chain */ @@ -1628,7 +2026,7 @@ S_make_trie(pTHX_ RExC_state_t *pRExC_st /* branch sub-chain */ convert = NEXTOPER( first ); } - + /* -- First loop and Setup -- We first traverse the branches and scan each word to determine if it @@ -1637,9 +2035,9 @@ S_make_trie(pTHX_ RExC_state_t *pRExC_st have unique chars. We use an array of integers to represent the character codes 0..255 - (trie->charmap) and we use a an HV* to store Unicode characters. We use the - native representation of the character value as the key and IV's for the - coded index. + (trie->charmap) and we use a an HV* to store Unicode characters. We use + the native representation of the character value as the key and IV's for + the coded index. *TODO* If we keep track of how many times each character is used we can remap the columns so that the table compression later on is more @@ -1656,13 +2054,12 @@ S_make_trie(pTHX_ RExC_state_t *pRExC_st regnode *noper = NEXTOPER( cur ); const U8 *uc = (U8*)STRING( noper ); const U8 *e = uc + STR_LEN( noper ); - STRLEN foldlen = 0; - U8 foldbuf[ UTF8_MAXBYTES_CASE + 1 ]; - STRLEN skiplen = 0; - const U8 *scan = (U8*)NULL; + int foldlen = 0; U32 wordlen = 0; /* required init */ - STRLEN chars = 0; - bool set_bit = trie->bitmap ? 1 : 0; /*store the first char in the bitmap?*/ + STRLEN minchars = 0; + STRLEN maxchars = 0; + bool set_bit = trie->bitmap ? 1 : 0; /*store the first char in the + bitmap?*/ if (OP(noper) == NOTHING) { regnode *noper_next= regnext(noper); @@ -1682,13 +2079,77 @@ S_make_trie(pTHX_ RExC_state_t *pRExC_st regardless of encoding */ if (OP( noper ) == EXACTFU_SS) { /* false positives are ok, so just set this */ - TRIE_BITMAP_SET(trie,0xDF); + TRIE_BITMAP_SET(trie, LATIN_SMALL_LETTER_SHARP_S); } } - for ( ; uc < e ; uc += len ) { + for ( ; uc < e ; uc += len ) { /* Look at each char in the current + branch */ TRIE_CHARCOUNT(trie)++; TRIE_READ_CHAR; - chars++; + + /* TRIE_READ_CHAR returns the current character, or its fold if /i + * is in effect. Under /i, this character can match itself, or + * anything that folds to it. If not under /i, it can match just + * itself. Most folds are 1-1, for example k, K, and KELVIN SIGN + * all fold to k, and all are single characters. But some folds + * expand to more than one character, so for example LATIN SMALL + * LIGATURE FFI folds to the three character sequence 'ffi'. If + * the string beginning at 'uc' is 'ffi', it could be matched by + * three characters, or just by the one ligature character. (It + * could also be matched by two characters: LATIN SMALL LIGATURE FF + * followed by 'i', or by 'f' followed by LATIN SMALL LIGATURE FI). + * (Of course 'I' and/or 'F' instead of 'i' and 'f' can also + * match.) The trie needs to know the minimum and maximum number + * of characters that could match so that it can use size alone to + * quickly reject many match attempts. The max is simple: it is + * the number of folded characters in this branch (since a fold is + * never shorter than what folds to it. */ + + maxchars++; + + /* And the min is equal to the max if not under /i (indicated by + * 'folder' being NULL), or there are no multi-character folds. If + * there is a multi-character fold, the min is incremented just + * once, for the character that folds to the sequence. Each + * character in the sequence needs to be added to the list below of + * characters in the trie, but we count only the first towards the + * min number of characters needed. This is done through the + * variable 'foldlen', which is returned by the macros that look + * for these sequences as the number of bytes the sequence + * occupies. Each time through the loop, we decrement 'foldlen' by + * how many bytes the current char occupies. Only when it reaches + * 0 do we increment 'minchars' or look for another multi-character + * sequence. */ + if (folder == NULL) { + minchars++; + } + else if (foldlen > 0) { + foldlen -= (UTF) ? UTF8SKIP(uc) : 1; + } + else { + minchars++; + + /* See if *uc is the beginning of a multi-character fold. If + * so, we decrement the length remaining to look at, to account + * for the current character this iteration. (We can use 'uc' + * instead of the fold returned by TRIE_READ_CHAR because for + * non-UTF, the latin1_safe macro is smart enough to account + * for all the unfolded characters, and because for UTF, the + * string will already have been folded earlier in the + * compilation process */ + if (UTF) { + if ((foldlen = is_MULTI_CHAR_FOLD_utf8_safe(uc, e))) { + foldlen -= UTF8SKIP(uc); + } + } + else if ((foldlen = is_MULTI_CHAR_FOLD_latin1_safe(uc, e))) { + foldlen--; + } + } + + /* The current character (and any potential folds) should be added + * to the possible matching characters for this position in this + * branch */ if ( uvc < 256 ) { if ( folder ) { U8 folded= folder[ (U8) uvc ]; @@ -1712,13 +2173,21 @@ S_make_trie(pTHX_ RExC_state_t *pRExC_st if ( !UTF ) { /* store first byte of utf8 representation of variant codepoints */ - if (! UNI_IS_INVARIANT(uvc)) { + if (! UVCHR_IS_INVARIANT(uvc)) { TRIE_BITMAP_SET(trie, UTF8_TWO_BYTE_HI(uvc)); } } set_bit = 0; /* We've done our bit :-) */ } } else { + + /* XXX We could come up with the list of code points that fold + * to this using PL_utf8_foldclosures, except not for + * multi-char folds, as there may be multiple combinations + * there that could work, which needs to wait until runtime to + * resolve (The comment about LIGATURE FFI above is such an + * example */ + SV** svpp; if ( !widecharmap ) widecharmap = newHV(); @@ -1733,30 +2202,22 @@ S_make_trie(pTHX_ RExC_state_t *pRExC_st TRIE_STORE_REVCHAR(uvc); } } - } + } /* end loop through characters in this branch of the trie */ + + /* We take the min and max for this branch and combine to find the min + * and max for all branches processed so far */ if( cur == first ) { - trie->minlen = chars; - trie->maxlen = chars; - } else if (chars < trie->minlen) { - trie->minlen = chars; - } else if (chars > trie->maxlen) { - trie->maxlen = chars; - } - if (OP( noper ) == EXACTFU_SS) { - /* XXX: workaround - 'ss' could match "\x{DF}" so minlen could be 1 and not 2*/ - if (trie->minlen > 1) - trie->minlen= 1; - } - if (OP( noper ) == EXACTFU_TRICKYFOLD) { - /* XXX: workround - things like "\x{1FBE}\x{0308}\x{0301}" can match "\x{0390}" - * - We assume that any such sequence might match a 2 byte string */ - if (trie->minlen > 2 ) - trie->minlen= 2; + trie->minlen = minchars; + trie->maxlen = maxchars; + } else if (minchars < trie->minlen) { + trie->minlen = minchars; + } else if (maxchars > trie->maxlen) { + trie->maxlen = maxchars; } - } /* end first pass */ DEBUG_TRIE_COMPILE_r( - PerlIO_printf( Perl_debug_log, "%*sTRIE(%s): W:%d C:%d Uq:%d Min:%d Max:%d\n", + PerlIO_printf( Perl_debug_log, + "%*sTRIE(%s): W:%d C:%d Uq:%d Min:%d Max:%d\n", (int)depth * 2 + 2,"", ( widecharmap ? "UTF8" : "NATIVE" ), (int)word_count, (int)TRIE_CHARCOUNT(trie), trie->uniquecharcount, @@ -1788,7 +2249,9 @@ S_make_trie(pTHX_ RExC_state_t *pRExC_st Newx(prev_states, TRIE_CHARCOUNT(trie) + 2, U32); prev_states[1] = 0; - if ( (IV)( ( TRIE_CHARCOUNT(trie) + 1 ) * trie->uniquecharcount + 1) > SvIV(re_trie_maxbuff) ) { + if ( (IV)( ( TRIE_CHARCOUNT(trie) + 1 ) * trie->uniquecharcount + 1) + > SvIV(re_trie_maxbuff) ) + { /* Second Pass -- Array Of Lists Representation @@ -1803,7 +2266,7 @@ S_make_trie(pTHX_ RExC_state_t *pRExC_st STRLEN transcount = 1; - DEBUG_TRIE_COMPILE_MORE_r( PerlIO_printf( Perl_debug_log, + DEBUG_TRIE_COMPILE_MORE_r( PerlIO_printf( Perl_debug_log, "%*sCompiling trie using list compiler\n", (int)depth * 2 + 2, "")); @@ -1820,11 +2283,7 @@ S_make_trie(pTHX_ RExC_state_t *pRExC_st const U8 *e = uc + STR_LEN( noper ); U32 state = 1; /* required init */ U16 charid = 0; /* sanity init */ - U8 *scan = (U8*)NULL; /* sanity init */ - STRLEN foldlen = 0; /* required init */ U32 wordlen = 0; /* required init */ - U8 foldbuf[ UTF8_MAXBYTES_CASE + 1 ]; - STRLEN skiplen = 0; if (OP(noper) == NOTHING) { regnode *noper_next= regnext(noper); @@ -1843,14 +2302,18 @@ S_make_trie(pTHX_ RExC_state_t *pRExC_st if ( uvc < 256 ) { charid = trie->charmap[ uvc ]; } else { - SV** const svpp = hv_fetch( widecharmap, (char*)&uvc, sizeof( UV ), 0); + SV** const svpp = hv_fetch( widecharmap, + (char*)&uvc, + sizeof( UV ), + 0); if ( !svpp ) { charid = 0; } else { charid=(U16)SvIV( *svpp ); } } - /* charid is now 0 if we dont know the char read, or nonzero if we do */ + /* charid is now 0 if we dont know the char read, or + * nonzero if we do */ if ( charid ) { U16 check; @@ -1860,8 +2323,13 @@ S_make_trie(pTHX_ RExC_state_t *pRExC_st if ( !trie->states[ state ].trans.list ) { TRIE_LIST_NEW( state ); } - for ( check = 1; check <= TRIE_LIST_USED( state ); check++ ) { - if ( TRIE_LIST_ITEM( state, check ).forid == charid ) { + for ( check = 1; + check <= TRIE_LIST_USED( state ); + check++ ) + { + if ( TRIE_LIST_ITEM( state, check ).forid + == charid ) + { newstate = TRIE_LIST_ITEM( state, check ).newstate; break; } @@ -1883,7 +2351,7 @@ S_make_trie(pTHX_ RExC_state_t *pRExC_st } /* end second pass */ /* next alloc is the NEXT state to be allocated */ - trie->statecount = next_alloc; + trie->statecount = next_alloc; trie->states = (reg_trie_state *) PerlMemShared_realloc( trie->states, next_alloc @@ -1931,7 +2399,9 @@ S_make_trie(pTHX_ RExC_state_t *pRExC_st PerlMemShared_realloc( trie->trans, transcount * sizeof(reg_trie_trans) ); - Zero( trie->trans + (transcount / 2), transcount / 2 , reg_trie_trans ); + Zero( trie->trans + (transcount / 2), + transcount / 2, + reg_trie_trans ); } base = trie->uniquecharcount + tp - minid; if ( maxid == minid ) { @@ -1939,22 +2409,27 @@ S_make_trie(pTHX_ RExC_state_t *pRExC_st for ( ; zp < tp ; zp++ ) { if ( ! trie->trans[ zp ].next ) { base = trie->uniquecharcount + zp - minid; - trie->trans[ zp ].next = TRIE_LIST_ITEM( state, 1).newstate; + trie->trans[ zp ].next = TRIE_LIST_ITEM( state, + 1).newstate; trie->trans[ zp ].check = state; set = 1; break; } } if ( !set ) { - trie->trans[ tp ].next = TRIE_LIST_ITEM( state, 1).newstate; + trie->trans[ tp ].next = TRIE_LIST_ITEM( state, + 1).newstate; trie->trans[ tp ].check = state; tp++; zp = tp; } } else { for ( idx=1; idx <= TRIE_LIST_USED( state ) ; idx++ ) { - const U32 tid = base - trie->uniquecharcount + TRIE_LIST_ITEM( state, idx ).forid; - trie->trans[ tid ].next = TRIE_LIST_ITEM( state, idx ).newstate; + const U32 tid = base + - trie->uniquecharcount + + TRIE_LIST_ITEM( state, idx ).forid; + trie->trans[ tid ].next = TRIE_LIST_ITEM( state, + idx ).newstate; trie->trans[ tid ].check = state; } tp += ( maxid - minid + 1 ); @@ -1974,26 +2449,26 @@ S_make_trie(pTHX_ RExC_state_t *pRExC_st /* Second Pass -- Flat Table Representation. - we dont use the 0 slot of either trans[] or states[] so we add 1 to each. - We know that we will need Charcount+1 trans at most to store the data - (one row per char at worst case) So we preallocate both structures - assuming worst case. + we dont use the 0 slot of either trans[] or states[] so we add 1 to + each. We know that we will need Charcount+1 trans at most to store + the data (one row per char at worst case) So we preallocate both + structures assuming worst case. We then construct the trie using only the .next slots of the entry structs. - We use the .check field of the first entry of the node temporarily to - make compression both faster and easier by keeping track of how many non - zero fields are in the node. + We use the .check field of the first entry of the node temporarily + to make compression both faster and easier by keeping track of how + many non zero fields are in the node. Since trans are numbered from 1 any 0 pointer in the table is a FAIL transition. - There are two terms at use here: state as a TRIE_NODEIDX() which is a - number representing the first entry of the node, and state as a - TRIE_NODENUM() which is the trans number. state 1 is TRIE_NODEIDX(1) and - TRIE_NODENUM(1), state 2 is TRIE_NODEIDX(2) and TRIE_NODENUM(3) if there - are 2 entrys per node. eg: + There are two terms at use here: state as a TRIE_NODEIDX() which is + a number representing the first entry of the node, and state as a + TRIE_NODENUM() which is the trans number. state 1 is TRIE_NODEIDX(1) + and TRIE_NODENUM(1), state 2 is TRIE_NODEIDX(2) and TRIE_NODENUM(3) + if there are 2 entrys per node. eg: A B A B 1. 2 4 1. 3 7 @@ -2001,12 +2476,12 @@ S_make_trie(pTHX_ RExC_state_t *pRExC_st 3. 0 0 5. 0 0 4. 0 0 7. 0 0 - The table is internally in the right hand, idx form. However as we also - have to deal with the states array which is indexed by nodenum we have to - use TRIE_NODENUM() to convert. + The table is internally in the right hand, idx form. However as we + also have to deal with the states array which is indexed by nodenum + we have to use TRIE_NODENUM() to convert. */ - DEBUG_TRIE_COMPILE_MORE_r( PerlIO_printf( Perl_debug_log, + DEBUG_TRIE_COMPILE_MORE_r( PerlIO_printf( Perl_debug_log, "%*sCompiling trie using table compiler\n", (int)depth * 2 + 2, "")); @@ -2030,12 +2505,8 @@ S_make_trie(pTHX_ RExC_state_t *pRExC_st U16 charid = 0; /* sanity init */ U32 accept_state = 0; /* sanity init */ - U8 *scan = (U8*)NULL; /* sanity init */ - STRLEN foldlen = 0; /* required init */ U32 wordlen = 0; /* required init */ - STRLEN skiplen = 0; - U8 foldbuf[ UTF8_MAXBYTES_CASE + 1 ]; if (OP(noper) == NOTHING) { regnode *noper_next= regnext(noper); @@ -2054,7 +2525,10 @@ S_make_trie(pTHX_ RExC_state_t *pRExC_st if ( uvc < 256 ) { charid = trie->charmap[ uvc ]; } else { - SV* const * const svpp = hv_fetch( widecharmap, (char*)&uvc, sizeof( UV ), 0); + SV* const * const svpp = hv_fetch( widecharmap, + (char*)&uvc, + sizeof( UV ), + 0); charid = svpp ? (U16)SvIV(*svpp) : 0; } if ( charid ) { @@ -2070,7 +2544,8 @@ S_make_trie(pTHX_ RExC_state_t *pRExC_st } else { Perl_croak( aTHX_ "panic! In trie construction, no char mapping for %"IVdf, uvc ); } - /* charid is now 0 if we dont know the char read, or nonzero if we do */ + /* charid is now 0 if we dont know the char read, or + * nonzero if we do */ } } accept_state = TRIE_NODENUM( state ); @@ -2157,7 +2632,10 @@ S_make_trie(pTHX_ RExC_state_t *pRExC_st U32 used = trie->trans[ stateidx ].check; trie->trans[ stateidx ].check = 0; - for ( charid = 0 ; used && charid < trie->uniquecharcount ; charid++ ) { + for ( charid = 0; + used && charid < trie->uniquecharcount; + charid++ ) + { if ( flag || trie->trans[ stateidx + charid ].next ) { if ( trie->trans[ stateidx + charid ].next ) { if (o_used == 1) { @@ -2166,8 +2644,13 @@ S_make_trie(pTHX_ RExC_state_t *pRExC_st break; } } - trie->states[ state ].trans.base = zp + trie->uniquecharcount - charid ; - trie->trans[ zp ].next = SAFE_TRIE_NODENUM( trie->trans[ stateidx + charid ].next ); + trie->states[ state ].trans.base + = zp + + trie->uniquecharcount + - charid ; + trie->trans[ zp ].next + = SAFE_TRIE_NODENUM( trie->trans[ stateidx + + charid ].next ); trie->trans[ zp ].check = state; if ( ++zp > pos ) pos = zp; break; @@ -2176,9 +2659,12 @@ S_make_trie(pTHX_ RExC_state_t *pRExC_st } if ( !flag ) { flag = 1; - trie->states[ state ].trans.base = pos + trie->uniquecharcount - charid ; + trie->states[ state ].trans.base + = pos + trie->uniquecharcount - charid ; } - trie->trans[ pos ].next = SAFE_TRIE_NODENUM( trie->trans[ stateidx + charid ].next ); + trie->trans[ pos ].next + = SAFE_TRIE_NODENUM( + trie->trans[ stateidx + charid ].next ); trie->trans[ pos ].check = state; pos++; } @@ -2189,19 +2675,21 @@ S_make_trie(pTHX_ RExC_state_t *pRExC_st PerlMemShared_realloc( trie->states, laststate * sizeof(reg_trie_state) ); DEBUG_TRIE_COMPILE_MORE_r( - PerlIO_printf( Perl_debug_log, - "%*sAlloc: %d Orig: %"IVdf" elements, Final:%"IVdf". Savings of %%%5.2f\n", - (int)depth * 2 + 2,"", - (int)( ( TRIE_CHARCOUNT(trie) + 1 ) * trie->uniquecharcount + 1 ), - (IV)next_alloc, - (IV)pos, - ( ( next_alloc - pos ) * 100 ) / (double)next_alloc ); + PerlIO_printf( Perl_debug_log, + "%*sAlloc: %d Orig: %"IVdf" elements, Final:%"IVdf". Savings of %%%5.2f\n", + (int)depth * 2 + 2,"", + (int)( ( TRIE_CHARCOUNT(trie) + 1 ) * trie->uniquecharcount + + 1 ), + (IV)next_alloc, + (IV)pos, + ( ( next_alloc - pos ) * 100 ) / (double)next_alloc ); ); } /* end table compress */ } DEBUG_TRIE_COMPILE_MORE_r( - PerlIO_printf(Perl_debug_log, "%*sStatecount:%"UVxf" Lasttrans:%"UVxf"\n", + PerlIO_printf(Perl_debug_log, + "%*sStatecount:%"UVxf" Lasttrans:%"UVxf"\n", (int)depth * 2 + 2, "", (UV)trie->statecount, (UV)trie->lasttrans) @@ -2211,10 +2699,10 @@ S_make_trie(pTHX_ RExC_state_t *pRExC_st PerlMemShared_realloc( trie->trans, trie->lasttrans * sizeof(reg_trie_trans) ); - { /* Modify the program and insert the new TRIE node */ + { /* Modify the program and insert the new TRIE node */ U8 nodetype =(U8)(flags & 0xFF); char *str=NULL; - + #ifdef DEBUGGING regnode *optimize = NULL; #ifdef RE_TRACK_PATTERN_OFFSETS @@ -2252,12 +2740,13 @@ S_make_trie(pTHX_ RExC_state_t *pRExC_st }); } DEBUG_OPTIMISE_r( - PerlIO_printf(Perl_debug_log, "%*sMJD offset:%"UVuf" MJD length:%"UVuf"\n", + PerlIO_printf(Perl_debug_log, + "%*sMJD offset:%"UVuf" MJD length:%"UVuf"\n", (int)depth * 2 + 2, "", (UV)mjd_offset, (UV)mjd_nodelen) ); #endif - /* But first we check to see if there is a common prefix we can + /* But first we check to see if there is a common prefix we can split out as an EXACT and put in front of the TRIE node. */ trie->startstate= 1; if ( trie->bitmap && !widecharmap && !trie->jump ) { @@ -2316,11 +2805,11 @@ S_make_trie(pTHX_ RExC_state_t *pRExC_st PerlIO_printf( Perl_debug_log, "%*sPrefix State: %"UVuf" Idx:%"UVuf" Char='%s'\n", (int)depth * 2 + 2, "", - (UV)state, (UV)idx, - pv_pretty(sv, SvPV_nolen_const(*tmp), SvCUR(*tmp), 6, + (UV)state, (UV)idx, + pv_pretty(sv, SvPV_nolen_const(*tmp), SvCUR(*tmp), 6, PL_colors[0], PL_colors[1], (SvUTF8(*tmp) ? PERL_PV_ESCAPE_UNI : 0) | - PERL_PV_ESCAPE_FIRSTCHAR + PERL_PV_ESCAPE_FIRSTCHAR ) ); }); @@ -2333,7 +2822,7 @@ S_make_trie(pTHX_ RExC_state_t *pRExC_st while (len--) *str++ = *ch++; } else { -#ifdef DEBUGGING +#ifdef DEBUGGING if (state>1) DEBUG_OPTIMISE_r(PerlIO_printf( Perl_debug_log,"]\n")); #endif @@ -2384,17 +2873,17 @@ S_make_trie(pTHX_ RExC_state_t *pRExC_st } } } - if (!jumper) - jumper = last; + if (!jumper) + jumper = last; if ( trie->maxlen ) { NEXT_OFF( convert ) = (U16)(tail - convert); ARG_SET( convert, data_slot ); - /* Store the offset to the first unabsorbed branch in - jump[0], which is otherwise unused by the jump logic. + /* Store the offset to the first unabsorbed branch in + jump[0], which is otherwise unused by the jump logic. We use this when dumping a trie and during optimisation. */ - if (trie->jump) + if (trie->jump) trie->jump[0] = (U16)(nextbranch - convert); - + /* If the start state is not accepting (meaning there is no empty string/NOTHING) * and there is a bitmap * and the first "jump target" node we found leaves enough room @@ -2409,17 +2898,17 @@ S_make_trie(pTHX_ RExC_state_t *pRExC_st Copy(trie->bitmap, ((struct regnode_charclass *)convert)->bitmap, ANYOF_BITMAP_SIZE, char); PerlMemShared_free(trie->bitmap); trie->bitmap= NULL; - } else + } else OP( convert ) = TRIE; /* store the type in the flags */ convert->flags = nodetype; DEBUG_r({ - optimize = convert - + NODE_STEP_REGNODE + optimize = convert + + NODE_STEP_REGNODE + regarglen[ OP( convert ) ]; }); - /* XXX We really should free up the resource in trie now, + /* XXX We really should free up the resource in trie now, as we won't use them - (which resources?) dmq */ } /* needed for dumping*/ @@ -2429,8 +2918,8 @@ S_make_trie(pTHX_ RExC_state_t *pRExC_st while ( ++opt < optimize) { Set_Node_Offset_Length(opt,0,0); } - /* - Try to clean up some of the debris left after the + /* + Try to clean up some of the debris left after the optimisation. */ while( optimize < jumper ) { @@ -2485,32 +2974,37 @@ S_make_trie(pTHX_ RExC_state_t *pRExC_st #else SvREFCNT_dec_NN(revcharmap); #endif - return trie->jump - ? MADE_JUMP_TRIE - : trie->startstate>1 - ? MADE_EXACT_TRIE + return trie->jump + ? MADE_JUMP_TRIE + : trie->startstate>1 + ? MADE_EXACT_TRIE : MADE_TRIE; } STATIC void S_make_trie_failtable(pTHX_ RExC_state_t *pRExC_state, regnode *source, regnode *stclass, U32 depth) { -/* The Trie is constructed and compressed now so we can build a fail array if it's needed +/* The Trie is constructed and compressed now so we can build a fail array if + * it's needed - This is basically the Aho-Corasick algorithm. Its from exercise 3.31 and 3.32 in the - "Red Dragon" -- Compilers, principles, techniques, and tools. Aho, Sethi, Ullman 1985/88 + This is basically the Aho-Corasick algorithm. Its from exercise 3.31 and + 3.32 in the + "Red Dragon" -- Compilers, principles, techniques, and tools. Aho, Sethi, + Ullman 1985/88 ISBN 0-201-10088-6 - We find the fail state for each state in the trie, this state is the longest proper - suffix of the current state's 'word' that is also a proper prefix of another word in our - trie. State 1 represents the word '' and is thus the default fail state. This allows - the DFA not to have to restart after its tried and failed a word at a given point, it - simply continues as though it had been matching the other word in the first place. + We find the fail state for each state in the trie, this state is the longest + proper suffix of the current state's 'word' that is also a proper prefix of + another word in our trie. State 1 represents the word '' and is thus the + default fail state. This allows the DFA not to have to restart after its + tried and failed a word at a given point, it simply continues as though it + had been matching the other word in the first place. Consider 'abcdgu'=~/abcdefg|cdgu/ - When we get to 'd' we are still matching the first word, we would encounter 'g' which would - fail, which would bring us to the state representing 'd' in the second word where we would - try 'g' and succeed, proceeding to match 'cdgu'. + When we get to 'd' we are still matching the first word, we would encounter + 'g' which would fail, which would bring us to the state representing 'd' in + the second word where we would try 'g' and succeed, proceeding to match + 'cdgu'. */ /* add a fail transition */ const U32 trie_offset = ARG(source); @@ -2525,7 +3019,7 @@ S_make_trie_failtable(pTHX_ RExC_state_t U32 base = trie->states[ 1 ].trans.base; U32 *fail; reg_ac_data *aho; - const U32 data_slot = add_data( pRExC_state, 1, "T" ); + const U32 data_slot = add_data( pRExC_state, STR_WITH_LEN("T")); GET_RE_DEBUG_FLAGS_DECL; PERL_ARGS_ASSERT_MAKE_TRIE_FAILTABLE; @@ -2589,7 +3083,7 @@ S_make_trie_failtable(pTHX_ RExC_state_t fail[ 0 ] = fail[ 1 ] = 0; DEBUG_TRIE_COMPILE_r({ PerlIO_printf(Perl_debug_log, - "%*sStclass Failtable (%"UVuf" states): 0", + "%*sStclass Failtable (%"UVuf" states): 0", (int)(depth * 2), "", (UV)numstates ); for( q_read=1; q_read%3d: %s (%d)\n", \ (int)depth*2, "", REG_NODE_NUM(scan), SvPV_nolen_const(mysv),\ Next ? (REG_NODE_NUM(Next)) : 0 ); \ @@ -2636,49 +3119,58 @@ S_make_trie_failtable(pTHX_ RExC_state_t * * If a node is to match under /i (folded), the number of characters it matches * can be different than its character length if it contains a multi-character - * fold. *min_subtract is set to the total delta of the input nodes. + * fold. *min_subtract is set to the total delta number of characters of the + * input nodes. * - * And *has_exactf_sharp_s is set to indicate whether or not the node is EXACTF - * and contains LATIN SMALL LETTER SHARP S + * And *unfolded_multi_char is set to indicate whether or not the node contains + * an unfolded multi-char fold. This happens when whether the fold is valid or + * not won't be known until runtime; namely for EXACTF nodes that contain LATIN + * SMALL LETTER SHARP S, as only if the target string being matched against + * turns out to be UTF-8 is that fold valid; and also for EXACTFL nodes whose + * folding rules depend on the locale in force at runtime. (Multi-char folds + * whose components are all above the Latin1 range are not run-time locale + * dependent, and have already been folded by the time this function is + * called.) * * This is as good a place as any to discuss the design of handling these * multi-character fold sequences. It's been wrong in Perl for a very long * time. There are three code points in Unicode whose multi-character folds * were long ago discovered to mess things up. The previous designs for * dealing with these involved assigning a special node for them. This - * approach doesn't work, as evidenced by this example: + * approach doesn't always work, as evidenced by this example: * "\xDFs" =~ /s\xDF/ui # Used to fail before these patches - * Both these fold to "sss", but if the pattern is parsed to create a node that + * Both sides fold to "sss", but if the pattern is parsed to create a node that * would match just the \xDF, it won't be able to handle the case where a * successful match would have to cross the node's boundary. The new approach * that hopefully generally solves the problem generates an EXACTFU_SS node - * that is "sss". + * that is "sss" in this case. * * It turns out that there are problems with all multi-character folds, and not - * just these three. Now the code is general, for all such cases, but the - * three still have some special handling. The approach taken is: + * just these three. Now the code is general, for all such cases. The + * approach taken is: * 1) This routine examines each EXACTFish node that could contain multi- - * character fold sequences. It returns in *min_subtract how much to - * subtract from the the actual length of the string to get a real minimum - * match length; it is 0 if there are no multi-char folds. This delta is - * used by the caller to adjust the min length of the match, and the delta - * between min and max, so that the optimizer doesn't reject these - * possibilities based on size constraints. - * 2) Certain of these sequences require special handling by the trie code, - * so, if found, this code changes the joined node type to special ops: - * EXACTFU_TRICKYFOLD and EXACTFU_SS. - * 3) For the sequence involving the Sharp s (\xDF), the node type EXACTFU_SS + * character folded sequences. Since a single character can fold into + * such a sequence, the minimum match length for this node is less than + * the number of characters in the node. This routine returns in + * *min_subtract how many characters to subtract from the the actual + * length of the string to get a real minimum match length; it is 0 if + * there are no multi-char foldeds. This delta is used by the caller to + * adjust the min length of the match, and the delta between min and max, + * so that the optimizer doesn't reject these possibilities based on size + * constraints. + * 2) For the sequence involving the Sharp s (\xDF), the node type EXACTFU_SS * is used for an EXACTFU node that contains at least one "ss" sequence in * it. For non-UTF-8 patterns and strings, this is the only case where * there is a possible fold length change. That means that a regular * EXACTFU node without UTF-8 involvement doesn't have to concern itself * with length changes, and so can be processed faster. regexec.c takes * advantage of this. Generally, an EXACTFish node that is in UTF-8 is - * pre-folded by regcomp.c. This saves effort in regex matching. - * However, the pre-folding isn't done for non-UTF8 patterns because the - * fold of the MICRO SIGN requires UTF-8, and we don't want to slow things - * down by forcing the pattern into UTF8 unless necessary. Also what - * EXACTF and EXACTFL nodes fold to isn't known until runtime. The fold + * pre-folded by regcomp.c (except EXACTFL, some of whose folds aren't + * known until runtime). This saves effort in regex matching. However, + * the pre-folding isn't done for non-UTF8 patterns because the fold of + * the MICRO SIGN requires UTF-8, and we don't want to slow things down by + * forcing the pattern into UTF8 unless necessary. Also what EXACTF (and, + * again, EXACTFL) nodes fold to isn't known until runtime. The fold * possibilities for the non-UTF8 patterns are quite simple, except for * the sharp s. All the ones that don't involve a UTF-8 target string are * members of a fold-pair, and arrays are set up for all of them so that @@ -2686,37 +3178,63 @@ S_make_trie_failtable(pTHX_ RExC_state_t * this file makes sure that in EXACTFU nodes, the sharp s gets folded to * 'ss', even if the pattern isn't UTF-8. This avoids the issues * described in the next item. - * 4) A problem remains for the sharp s in EXACTF nodes. Whether it matches - * 'ss' or not is not knowable at compile time. It will match iff the - * target string is in UTF-8, unlike the EXACTFU nodes, where it always - * matches; and the EXACTFL and EXACTFA nodes where it never does. Thus - * it can't be folded to "ss" at compile time, unlike EXACTFU does (as - * described in item 3). An assumption that the optimizer part of - * regexec.c (probably unwittingly) makes is that a character in the - * pattern corresponds to at most a single character in the target string. - * (And I do mean character, and not byte here, unlike other parts of the - * documentation that have never been updated to account for multibyte - * Unicode.) This assumption is wrong only in this case, as all other - * cases are either 1-1 folds when no UTF-8 is involved; or is true by - * virtue of having this file pre-fold UTF-8 patterns. I'm - * reluctant to try to change this assumption, so instead the code punts. - * This routine examines EXACTF nodes for the sharp s, and returns a - * boolean indicating whether or not the node is an EXACTF node that - * contains a sharp s. When it is true, the caller sets a flag that later - * causes the optimizer in this file to not set values for the floating - * and fixed string lengths, and thus avoids the optimizer code in - * regexec.c that makes the invalid assumption. Thus, there is no - * optimization based on string lengths for EXACTF nodes that contain the - * sharp s. This only happens for /id rules (which means the pattern - * isn't in UTF-8). - */ + * 3) A problem remains for unfolded multi-char folds. (These occur when the + * validity of the fold won't be known until runtime, and so must remain + * unfolded for now. This happens for the sharp s in EXACTF and EXACTFA + * nodes when the pattern isn't in UTF-8. (Note, BTW, that there cannot + * be an EXACTF node with a UTF-8 pattern.) They also occur for various + * folds in EXACTFL nodes, regardless of the UTF-ness of the pattern.) + * The reason this is a problem is that the optimizer part of regexec.c + * (probably unwittingly, in Perl_regexec_flags()) makes an assumption + * that a character in the pattern corresponds to at most a single + * character in the target string. (And I do mean character, and not byte + * here, unlike other parts of the documentation that have never been + * updated to account for multibyte Unicode.) sharp s in EXACTF and + * EXACTFL nodes can match the two character string 'ss'; in EXACTFA nodes + * it can match "\x{17F}\x{17F}". These, along with other ones in EXACTFL + * nodes, violate the assumption, and they are the only instances where it + * is violated. I'm reluctant to try to change the assumption, as the + * code involved is impenetrable to me (khw), so instead the code here + * punts. This routine examines EXACTFL nodes, and (when the pattern + * isn't UTF-8) EXACTF and EXACTFA for such unfolded folds, and returns a + * boolean indicating whether or not the node contains such a fold. When + * it is true, the caller sets a flag that later causes the optimizer in + * this file to not set values for the floating and fixed string lengths, + * and thus avoids the optimizer code in regexec.c that makes the invalid + * assumption. Thus, there is no optimization based on string lengths for + * EXACTFL nodes that contain these few folds, nor for non-UTF8-pattern + * EXACTF and EXACTFA nodes that contain the sharp s. (The reason the + * assumption is wrong only in these cases is that all other non-UTF-8 + * folds are 1-1; and, for UTF-8 patterns, we pre-fold all other folds to + * their expanded versions. (Again, we can't prefold sharp s to 'ss' in + * EXACTF nodes because we don't know at compile time if it actually + * matches 'ss' or not. For EXACTF nodes it will match iff the target + * string is in UTF-8. This is in contrast to EXACTFU nodes, where it + * always matches; and EXACTFA where it never does. In an EXACTFA node in + * a UTF-8 pattern, sharp s is folded to "\x{17F}\x{17F}, avoiding the + * problem; but in a non-UTF8 pattern, folding it to that above-Latin1 + * string would require the pattern to be forced into UTF-8, the overhead + * of which we want to avoid. Similarly the unfolded multi-char folds in + * EXACTFL nodes will match iff the locale at the time of match is a UTF-8 + * locale.) + * + * Similarly, the code that generates tries doesn't currently handle + * not-already-folded multi-char folds, and it looks like a pain to change + * that. Therefore, trie generation of EXACTFA nodes with the sharp s + * doesn't work. Instead, such an EXACTFA is turned into a new regnode, + * EXACTFA_NO_TRIE, which the trie code knows not to handle. Most people + * using /iaa matching will be doing so almost entirely with ASCII + * strings, so this should rarely be encountered in practice */ -#define JOIN_EXACT(scan,min_subtract,has_exactf_sharp_s, flags) \ +#define JOIN_EXACT(scan,min_subtract,unfolded_multi_char, flags) \ if (PL_regkind[OP(scan)] == EXACT) \ - join_exact(pRExC_state,(scan),(min_subtract),has_exactf_sharp_s, (flags),NULL,depth+1) + join_exact(pRExC_state,(scan),(min_subtract),unfolded_multi_char, (flags),NULL,depth+1) STATIC U32 -S_join_exact(pTHX_ RExC_state_t *pRExC_state, regnode *scan, UV *min_subtract, bool *has_exactf_sharp_s, U32 flags,regnode *val, U32 depth) { +S_join_exact(pTHX_ RExC_state_t *pRExC_state, regnode *scan, + UV *min_subtract, bool *unfolded_multi_char, + U32 flags,regnode *val, U32 depth) +{ /* Merge several consecutive EXACTish nodes into one. */ regnode *n = regnext(scan); U32 stringok = 1; @@ -2745,7 +3263,7 @@ S_join_exact(pTHX_ RExC_state_t *pRExC_s && NEXT_OFF(n) && NEXT_OFF(scan) + NEXT_OFF(n) < I16_MAX) { - + if (OP(n) == TAIL || n > next) stringok = 0; if (PL_regkind[OP(n)] == NOTHING) { @@ -2762,12 +3280,13 @@ S_join_exact(pTHX_ RExC_state_t *pRExC_s const unsigned int oldl = STR_LEN(scan); regnode * const nnext = regnext(n); - /* XXX I (khw) kind of doubt that this works on platforms where - * U8_MAX is above 255 because of lots of other assumptions */ + /* XXX I (khw) kind of doubt that this works on platforms (should + * Perl ever run on one) where U8_MAX is above 255 because of lots + * of other assumptions */ /* Don't join if the sum can't fit into a single node */ if (oldl + STR_LEN(n) > U8_MAX) break; - + DEBUG_PEEP("merg",n,depth); merged++; @@ -2798,7 +3317,7 @@ S_join_exact(pTHX_ RExC_state_t *pRExC_s } *min_subtract = 0; - *has_exactf_sharp_s = FALSE; + *unfolded_multi_char = FALSE; /* Here, all the adjacent mergeable EXACTish nodes have been merged. We * can now analyze for sequences of problematic code points. (Prior to @@ -2806,15 +3325,68 @@ S_join_exact(pTHX_ RExC_state_t *pRExC_s * hence missed). The sequences only happen in folding, hence for any * non-EXACT EXACTish node */ if (OP(scan) != EXACT) { - const U8 * const s0 = (U8*) STRING(scan); - const U8 * s = s0; - const U8 * const s_end = s0 + STR_LEN(scan); + U8* s0 = (U8*) STRING(scan); + U8* s = s0; + U8* s_end = s0 + STR_LEN(scan); + + int total_count_delta = 0; /* Total delta number of characters that + multi-char folds expand to */ /* One pass is made over the node's string looking for all the - * possibilities. to avoid some tests in the loop, there are two main + * possibilities. To avoid some tests in the loop, there are two main * cases, for UTF-8 patterns (which can't have EXACTF nodes) and * non-UTF-8 */ if (UTF) { + U8* folded = NULL; + + if (OP(scan) == EXACTFL) { + U8 *d; + + /* An EXACTFL node would already have been changed to another + * node type unless there is at least one character in it that + * is problematic; likely a character whose fold definition + * won't be known until runtime, and so has yet to be folded. + * For all but the UTF-8 locale, folds are 1-1 in length, but + * to handle the UTF-8 case, we need to create a temporary + * folded copy using UTF-8 locale rules in order to analyze it. + * This is because our macros that look to see if a sequence is + * a multi-char fold assume everything is folded (otherwise the + * tests in those macros would be too complicated and slow). + * Note that here, the non-problematic folds will have already + * been done, so we can just copy such characters. We actually + * don't completely fold the EXACTFL string. We skip the + * unfolded multi-char folds, as that would just create work + * below to figure out the size they already are */ + + Newx(folded, UTF8_MAX_FOLD_CHAR_EXPAND * STR_LEN(scan) + 1, U8); + d = folded; + while (s < s_end) { + STRLEN s_len = UTF8SKIP(s); + if (! is_PROBLEMATIC_LOCALE_FOLD_utf8(s)) { + Copy(s, d, s_len, U8); + d += s_len; + } + else if (is_FOLDS_TO_MULTI_utf8(s)) { + *unfolded_multi_char = TRUE; + Copy(s, d, s_len, U8); + d += s_len; + } + else if (isASCII(*s)) { + *(d++) = toFOLD(*s); + } + else { + STRLEN len; + _to_utf8_fold_flags(s, d, &len, FOLD_FLAGS_FULL); + d += len; + } + s += s_len; + } + + /* Point the remainder of the routine to look at our temporary + * folded copy */ + s = folded; + s_end = d; + } /* End of creating folded copy of EXACTFL string */ /* Examine the string for a multi-character fold sequence. UTF-8 * patterns have all characters pre-folded by the time this code is @@ -2822,59 +3394,32 @@ S_join_exact(pTHX_ RExC_state_t *pRExC_s while (s < s_end - 1) /* Can stop 1 before the end, as minimum length sequence we are looking for is 2 */ { - int count = 0; + int count = 0; /* How many characters in a multi-char fold */ int len = is_MULTI_CHAR_FOLD_utf8_safe(s, s_end); if (! len) { /* Not a multi-char fold: get next char */ s += UTF8SKIP(s); continue; } - /* Nodes with 'ss' require special handling, except for EXACTFL - * and EXACTFA for which there is no multi-char fold to this */ + /* Nodes with 'ss' require special handling, except for + * EXACTFA-ish for which there is no multi-char fold to this */ if (len == 2 && *s == 's' && *(s+1) == 's' - && OP(scan) != EXACTFL && OP(scan) != EXACTFA) + && OP(scan) != EXACTFA + && OP(scan) != EXACTFA_NO_TRIE) { count = 2; - OP(scan) = EXACTFU_SS; - s += 2; - } - else if (len == 6 /* len is the same in both ASCII and EBCDIC for these */ - && (memEQ(s, GREEK_SMALL_LETTER_IOTA_UTF8 - COMBINING_DIAERESIS_UTF8 - COMBINING_ACUTE_ACCENT_UTF8, - 6) - || memEQ(s, GREEK_SMALL_LETTER_UPSILON_UTF8 - COMBINING_DIAERESIS_UTF8 - COMBINING_ACUTE_ACCENT_UTF8, - 6))) - { - count = 3; - - /* These two folds require special handling by trie's, so - * change the node type to indicate this. If EXACTFA and - * EXACTFL were ever to be handled by trie's, this would - * have to be changed. If this node has already been - * changed to EXACTFU_SS in this loop, leave it as is. (I - * (khw) think it doesn't matter in regexec.c for UTF - * patterns, but no need to change it */ - if (OP(scan) == EXACTFU) { - OP(scan) = EXACTFU_TRICKYFOLD; + if (OP(scan) != EXACTFL) { + OP(scan) = EXACTFU_SS; } - s += 6; + s += 2; } else { /* Here is a generic multi-char fold. */ - const U8* multi_end = s + len; + U8* multi_end = s + len; - /* Count how many characters in it. In the case of /l and - * /aa, no folds which contain ASCII code points are - * allowed, so check for those, and skip if found. (In - * EXACTFL, no folds are allowed to any Latin1 code point, - * not just ASCII. But there aren't any of these - * currently, nor ever likely, so don't take the time to - * test for them. The code that generates the - * is_MULTI_foo() macros croaks should one actually get put - * into Unicode .) */ - if (OP(scan) != EXACTFL && OP(scan) != EXACTFA) { + /* Count how many characters in it. In the case of /aa, no + * folds which contain ASCII code points are allowed, so + * check for those, and skip if found. */ + if (OP(scan) != EXACTFA && OP(scan) != EXACTFA_NO_TRIE) { count = utf8_length(s, multi_end); s = multi_end; } @@ -2894,53 +3439,78 @@ S_join_exact(pTHX_ RExC_state_t *pRExC_s /* The delta is how long the sequence is minus 1 (1 is how long * the character that folds to the sequence is) */ - *min_subtract += count - 1; - next_iteration: ; + total_count_delta += count - 1; + next_iteration: ; } - } - else if (OP(scan) != EXACTFL && OP(scan) != EXACTFA) { - - /* Here, the pattern is not UTF-8. Look for the multi-char folds - * that are all ASCII. As in the above case, EXACTFL and EXACTFA - * nodes can't have multi-char folds to this range (and there are - * no existing ones in the upper latin1 range). In the EXACTF - * case we look also for the sharp s, which can be in the final - * position. Otherwise we can stop looking 1 byte earlier because - * have to find at least two characters for a multi-fold */ - const U8* upper = (OP(scan) == EXACTF) ? s_end : s_end -1; - - /* The below is perhaps overboard, but this allows us to save a - * test each time through the loop at the expense of a mask. This - * is because on both EBCDIC and ASCII machines, 'S' and 's' differ - * by a single bit. On ASCII they are 32 apart; on EBCDIC, they - * are 64. This uses an exclusive 'or' to find that bit and then - * inverts it to form a mask, with just a single 0, in the bit - * position where 'S' and 's' differ. */ - const U8 S_or_s_mask = (U8) ~ ('S' ^ 's'); - const U8 s_masked = 's' & S_or_s_mask; + + /* We created a temporary folded copy of the string in EXACTFL + * nodes. Therefore we need to be sure it doesn't go below zero, + * as the real string could be shorter */ + if (OP(scan) == EXACTFL) { + int total_chars = utf8_length((U8*) STRING(scan), + (U8*) STRING(scan) + STR_LEN(scan)); + if (total_count_delta > total_chars) { + total_count_delta = total_chars; + } + } + + *min_subtract += total_count_delta; + Safefree(folded); + } + else if (OP(scan) == EXACTFA) { + + /* Non-UTF-8 pattern, EXACTFA node. There can't be a multi-char + * fold to the ASCII range (and there are no existing ones in the + * upper latin1 range). But, as outlined in the comments preceding + * this function, we need to flag any occurrences of the sharp s. + * This character forbids trie formation (because of added + * complexity) */ + while (s < s_end) { + if (*s == LATIN_SMALL_LETTER_SHARP_S) { + OP(scan) = EXACTFA_NO_TRIE; + *unfolded_multi_char = TRUE; + break; + } + s++; + continue; + } + } + else { + + /* Non-UTF-8 pattern, not EXACTFA node. Look for the multi-char + * folds that are all Latin1. As explained in the comments + * preceding this function, we look also for the sharp s in EXACTF + * and EXACTFL nodes; it can be in the final position. Otherwise + * we can stop looking 1 byte earlier because have to find at least + * two characters for a multi-fold */ + const U8* upper = (OP(scan) == EXACTF || OP(scan) == EXACTFL) + ? s_end + : s_end -1; while (s < upper) { int len = is_MULTI_CHAR_FOLD_latin1_safe(s, s_end); if (! len) { /* Not a multi-char fold. */ - if (*s == LATIN_SMALL_LETTER_SHARP_S && OP(scan) == EXACTF) + if (*s == LATIN_SMALL_LETTER_SHARP_S + && (OP(scan) == EXACTF || OP(scan) == EXACTFL)) { - *has_exactf_sharp_s = TRUE; + *unfolded_multi_char = TRUE; } s++; continue; } if (len == 2 - && ((*s & S_or_s_mask) == s_masked) - && ((*(s+1) & S_or_s_mask) == s_masked)) + && isARG2_lower_or_UPPER_ARG1('s', *s) + && isARG2_lower_or_UPPER_ARG1('s', *(s+1))) { /* EXACTF nodes need to know that the minimum length * changed so that a sharp s in the string can match this * ss in the pattern, but they remain EXACTF nodes, as they * won't match this unless the target string is is UTF-8, - * which we don't know until runtime */ - if (OP(scan) != EXACTF) { + * which we don't know until runtime. EXACTFL nodes can't + * transform into EXACTFU nodes */ + if (OP(scan) != EXACTF && OP(scan) != EXACTFL) { OP(scan) = EXACTFU_SS; } } @@ -2974,7 +3544,7 @@ S_join_exact(pTHX_ RExC_state_t *pRExC_s #define INIT_AND_WITHP \ assert(!and_withp); \ - Newx(and_withp,1,struct regnode_charclass_class); \ + Newx(and_withp,1, regnode_ssc); \ SAVEFREEPV(and_withp) /* this is a chain of data about sub patterns we are processing that @@ -2985,20 +3555,19 @@ typedef struct scan_frame { regnode *last; /* last node to process in this frame */ regnode *next; /* next node to process when last is reached */ struct scan_frame *prev; /*previous frame*/ + U32 prev_recursed_depth; I32 stop; /* what stopparen do we use */ } scan_frame; -#define SCAN_COMMIT(s, data, m) scan_commit(s, data, m, is_inf) - -STATIC I32 +STATIC SSize_t S_study_chunk(pTHX_ RExC_state_t *pRExC_state, regnode **scanp, - I32 *minlenp, I32 *deltap, + SSize_t *minlenp, SSize_t *deltap, regnode *last, scan_data_t *data, I32 stopparen, - U8* recursed, - struct regnode_charclass_class *and_withp, + U32 recursed_depth, + regnode_ssc *and_withp, U32 flags, U32 depth) /* scanp: Start here (read-write). */ /* deltap: Write maxlen-minlen here. */ @@ -3009,17 +3578,18 @@ S_study_chunk(pTHX_ RExC_state_t *pRExC_ /* and_withp: Valid if flags & SCF_DO_STCLASS_OR */ { dVAR; - I32 min = 0; /* There must be at least this number of characters to match */ + /* There must be at least this number of characters to match */ + SSize_t min = 0; I32 pars = 0, code; regnode *scan = *scanp, *next; - I32 delta = 0; + SSize_t delta = 0; int is_inf = (flags & SCF_DO_SUBSTR) && (data->flags & SF_IS_INF); int is_inf_internal = 0; /* The studied chunk is infinite */ I32 is_par = OP(scan) == OPEN ? ARG(scan) : 0; scan_data_t data_fake; SV *re_trie_maxbuff = NULL; regnode *first_non_open = scan; - I32 stopmin = I32_MAX; + SSize_t stopmin = SSize_t_MAX; scan_frame *frame = NULL; GET_RE_DEBUG_FLAGS_DECL; @@ -3028,7 +3598,6 @@ S_study_chunk(pTHX_ RExC_state_t *pRExC_ #ifdef DEBUGGING StructCopy(&zero_scan_data, &data_fake, scan_data_t); #endif - if ( depth == 0 ) { while (first_non_open && OP(first_non_open) == OPEN) first_non_open=regnext(first_non_open); @@ -3040,15 +3609,40 @@ S_study_chunk(pTHX_ RExC_state_t *pRExC_ UV min_subtract = 0; /* How mmany chars to subtract from the minimum node length to get a real minimum (because the folded version may be shorter) */ - bool has_exactf_sharp_s = FALSE; + bool unfolded_multi_char = FALSE; /* Peephole optimizer: */ - DEBUG_STUDYDATA("Peep:", data,depth); - DEBUG_PEEP("Peep",scan,depth); + DEBUG_OPTIMISE_MORE_r( + { + PerlIO_printf(Perl_debug_log, + "%*sstudy_chunk stopparen=%ld depth=%lu recursed_depth=%lu ", + ((int) depth*2), "", (long)stopparen, + (unsigned long)depth, (unsigned long)recursed_depth); + if (recursed_depth) { + U32 i; + U32 j; + for ( j = 0 ; j < recursed_depth ; j++ ) { + PerlIO_printf(Perl_debug_log,"["); + for ( i = 0 ; i < (U32)RExC_npar ; i++ ) + PerlIO_printf(Perl_debug_log,"%d", + PAREN_TEST(RExC_study_chunk_recursed + + (j * RExC_study_chunk_recursed_bytes), i) + ? 1 : 0 + ); + PerlIO_printf(Perl_debug_log,"]"); + } + } + PerlIO_printf(Perl_debug_log,"\n"); + } + ); + DEBUG_STUDYDATA("Peep:", data, depth); + DEBUG_PEEP("Peep", scan, depth); + - /* Its not clear to khw or hv why this is done here, and not in the - * clauses that deal with EXACT nodes. khw's guess is that it's - * because of a previous design */ - JOIN_EXACT(scan,&min_subtract, &has_exactf_sharp_s, 0); + /* The reason we do this here we need to deal with things like /(?:f)(?:o)(?:o)/ + * which cant be dealt with by the normal EXACT parsing code, as each (?:..) is handled + * by a different invocation of reg() -- Yves + */ + JOIN_EXACT(scan,&min_subtract, &unfolded_multi_char, 0); /* Follow the next-chain of the current node and optimize away all the NOTHINGs from it. */ @@ -3081,24 +3675,29 @@ S_study_chunk(pTHX_ RExC_state_t *pRExC_ || OP(scan) == IFTHEN) { next = regnext(scan); code = OP(scan); - /* demq: the op(next)==code check is to see if we have "branch-branch" AFAICT */ + /* demq: the op(next)==code check is to see if we have + * "branch-branch" AFAICT */ if (OP(next) == code || code == IFTHEN) { - /* NOTE - There is similar code to this block below for handling - TRIE nodes on a re-study. If you change stuff here check there - too. */ - I32 max1 = 0, min1 = I32_MAX, num = 0; - struct regnode_charclass_class accum; + /* NOTE - There is similar code to this block below for + * handling TRIE nodes on a re-study. If you change stuff here + * check there too. */ + SSize_t max1 = 0, min1 = SSize_t_MAX, num = 0; + regnode_ssc accum; regnode * const startbranch=scan; - if (flags & SCF_DO_SUBSTR) - SCAN_COMMIT(pRExC_state, data, minlenp); /* Cannot merge strings after this. */ - if (flags & SCF_DO_STCLASS) - cl_init_zero(pRExC_state, &accum); + if (flags & SCF_DO_SUBSTR) { + /* Cannot merge strings after this. */ + scan_commit(pRExC_state, data, minlenp, is_inf); + } + + if (flags & SCF_DO_STCLASS) + ssc_init_zero(pRExC_state, &accum); while (OP(scan) == code) { - I32 deltanext, minnext, f = 0, fake; - struct regnode_charclass_class this_class; + SSize_t deltanext, minnext, fake; + I32 f = 0; + regnode_ssc this_class; num++; data_fake.flags = 0; @@ -3115,7 +3714,7 @@ S_study_chunk(pTHX_ RExC_state_t *pRExC_ if (code != BRANCH) scan = NEXTOPER(scan); if (flags & SCF_DO_STCLASS) { - cl_init(pRExC_state, &this_class); + ssc_init(pRExC_state, &this_class); data_fake.start_class = &this_class; f = SCF_DO_STCLASS_AND; } @@ -3123,21 +3722,21 @@ S_study_chunk(pTHX_ RExC_state_t *pRExC_ f |= SCF_WHILEM_VISITED_POS; /* we suppose the run is continuous, last=next...*/ - minnext = study_chunk(pRExC_state, &scan, minlenp, &deltanext, - next, &data_fake, - stopparen, recursed, NULL, f,depth+1); + minnext = study_chunk(pRExC_state, &scan, minlenp, + &deltanext, next, &data_fake, stopparen, + recursed_depth, NULL, f,depth+1); if (min1 > minnext) min1 = minnext; - if (deltanext == I32_MAX) { + if (deltanext == SSize_t_MAX) { is_inf = is_inf_internal = 1; - max1 = I32_MAX; + max1 = SSize_t_MAX; } else if (max1 < minnext + deltanext) max1 = minnext + deltanext; scan = next; if (data_fake.flags & (SF_HAS_PAR|SF_IN_PAR)) pars++; if (data_fake.flags & SCF_SEEN_ACCEPT) { - if ( stopmin > minnext) + if ( stopmin > minnext) stopmin = min + min1; flags &= ~SCF_DO_SUBSTR; if (data) @@ -3149,63 +3748,64 @@ S_study_chunk(pTHX_ RExC_state_t *pRExC_ data->whilem_c = data_fake.whilem_c; } if (flags & SCF_DO_STCLASS) - cl_or(pRExC_state, &accum, &this_class); + ssc_or(pRExC_state, &accum, (regnode_charclass*)&this_class); } if (code == IFTHEN && num < 2) /* Empty ELSE branch */ min1 = 0; if (flags & SCF_DO_SUBSTR) { data->pos_min += min1; - if (data->pos_delta >= I32_MAX - (max1 - min1)) - data->pos_delta = I32_MAX; + if (data->pos_delta >= SSize_t_MAX - (max1 - min1)) + data->pos_delta = SSize_t_MAX; else data->pos_delta += max1 - min1; if (max1 != min1 || is_inf) data->longest = &(data->longest_float); } min += min1; - if (delta == I32_MAX || I32_MAX - delta - (max1 - min1) < 0) - delta = I32_MAX; + if (delta == SSize_t_MAX + || SSize_t_MAX - delta - (max1 - min1) < 0) + delta = SSize_t_MAX; else delta += max1 - min1; if (flags & SCF_DO_STCLASS_OR) { - cl_or(pRExC_state, data->start_class, &accum); + ssc_or(pRExC_state, data->start_class, (regnode_charclass*) &accum); if (min1) { - cl_and(data->start_class, and_withp); + ssc_and(pRExC_state, data->start_class, (regnode_charclass *) and_withp); flags &= ~SCF_DO_STCLASS; } } else if (flags & SCF_DO_STCLASS_AND) { if (min1) { - cl_and(data->start_class, &accum); + ssc_and(pRExC_state, data->start_class, (regnode_charclass *) &accum); flags &= ~SCF_DO_STCLASS; } else { /* Switch to OR mode: cache the old value of * data->start_class */ INIT_AND_WITHP; - StructCopy(data->start_class, and_withp, - struct regnode_charclass_class); + StructCopy(data->start_class, and_withp, regnode_ssc); flags &= ~SCF_DO_STCLASS_AND; - StructCopy(&accum, data->start_class, - struct regnode_charclass_class); + StructCopy(&accum, data->start_class, regnode_ssc); flags |= SCF_DO_STCLASS_OR; - SET_SSC_EOS(data->start_class); } } - if (PERL_ENABLE_TRIE_OPTIMISATION && OP( startbranch ) == BRANCH ) { + if (PERL_ENABLE_TRIE_OPTIMISATION && + OP( startbranch ) == BRANCH ) + { /* demq. - Assuming this was/is a branch we are dealing with: 'scan' now - points at the item that follows the branch sequence, whatever - it is. We now start at the beginning of the sequence and look - for subsequences of + Assuming this was/is a branch we are dealing with: 'scan' + now points at the item that follows the branch sequence, + whatever it is. We now start at the beginning of the + sequence and look for subsequences of BRANCH->EXACT=>x1 BRANCH->EXACT=>x2 tail - which would be constructed from a pattern like /A|LIST|OF|WORDS/ + which would be constructed from a pattern like + /A|LIST|OF|WORDS/ If we can find such a subsequence we need to turn the first element into a trie and then add the subsequent branch exact @@ -3213,7 +3813,8 @@ S_study_chunk(pTHX_ RExC_state_t *pRExC_ We have two cases - 1. patterns where the whole set of branches can be converted. + 1. patterns where the whole set of branches can be + converted. 2. patterns where only a subset can be converted. @@ -3224,7 +3825,7 @@ S_study_chunk(pTHX_ RExC_state_t *pRExC_ 'BRANCH EXACT; BRANCH EXACT; BRANCH X' becomes BRANCH TRIE; BRANCH X; - There is an additional case, that being where there is a + There is an additional case, that being where there is a common prefix, which gets split out into an EXACT like node preceding the TRIE node. @@ -3250,7 +3851,7 @@ S_study_chunk(pTHX_ RExC_state_t *pRExC_ U32 count=0; #ifdef DEBUGGING - SV * const mysv = sv_newmortal(); /* for dumping */ + SV * const mysv = sv_newmortal(); /* for dumping */ #endif /* var tail is used because there may be a TAIL regop in the way. Ie, the exacts will point to the @@ -3265,49 +3866,60 @@ S_study_chunk(pTHX_ RExC_state_t *pRExC_ tail = regnext( tail ); } - + DEBUG_TRIE_COMPILE_r({ - regprop(RExC_rx, mysv, tail ); + regprop(RExC_rx, mysv, tail, NULL); PerlIO_printf( Perl_debug_log, "%*s%s%s\n", - (int)depth * 2 + 2, "", - "Looking for TRIE'able sequences. Tail node is: ", - SvPV_nolen_const( mysv ) + (int)depth * 2 + 2, "", + "Looking for TRIE'able sequences. Tail node is: ", + SvPV_nolen_const( mysv ) ); }); - + /* Step through the branches cur represents each branch, - noper is the first thing to be matched as part of that branch + noper is the first thing to be matched as part + of that branch noper_next is the regnext() of that node. - We normally handle a case like this /FOO[xyz]|BAR[pqr]/ - via a "jump trie" but we also support building with NOJUMPTRIE, - which restricts the trie logic to structures like /FOO|BAR/. - - If noper is a trieable nodetype then the branch is a possible optimization - target. If we are building under NOJUMPTRIE then we require that noper_next - is the same as scan (our current position in the regex program). - - Once we have two or more consecutive such branches we can create a - trie of the EXACT's contents and stitch it in place into the program. - - If the sequence represents all of the branches in the alternation we - replace the entire thing with a single TRIE node. - - Otherwise when it is a subsequence we need to stitch it in place and - replace only the relevant branches. This means the first branch has - to remain as it is used by the alternation logic, and its next pointer, - and needs to be repointed at the item on the branch chain following - the last branch we have optimized away. - - This could be either a BRANCH, in which case the subsequence is internal, - or it could be the item following the branch sequence in which case the - subsequence is at the end (which does not necessarily mean the first node - is the start of the alternation). + We normally handle a case like this + /FOO[xyz]|BAR[pqr]/ via a "jump trie" but we also + support building with NOJUMPTRIE, which restricts + the trie logic to structures like /FOO|BAR/. + + If noper is a trieable nodetype then the branch is + a possible optimization target. If we are building + under NOJUMPTRIE then we require that noper_next is + the same as scan (our current position in the regex + program). + + Once we have two or more consecutive such branches + we can create a trie of the EXACT's contents and + stitch it in place into the program. + + If the sequence represents all of the branches in + the alternation we replace the entire thing with a + single TRIE node. + + Otherwise when it is a subsequence we need to + stitch it in place and replace only the relevant + branches. This means the first branch has to remain + as it is used by the alternation logic, and its + next pointer, and needs to be repointed at the item + on the branch chain following the last branch we + have optimized away. + + This could be either a BRANCH, in which case the + subsequence is internal, or it could be the item + following the branch sequence in which case the + subsequence is at the end (which does not + necessarily mean the first node is the start of the + alternation). - TRIE_TYPE(X) is a define which maps the optype to a trietype. + TRIE_TYPE(X) is a define which maps the optype to a + trietype. optype | trietype ----------------+----------- @@ -3315,14 +3927,14 @@ S_study_chunk(pTHX_ RExC_state_t *pRExC_ EXACT | EXACT EXACTFU | EXACTFU EXACTFU_SS | EXACTFU - EXACTFU_TRICKYFOLD | EXACTFU - EXACTFA | 0 + EXACTFA | EXACTFA */ #define TRIE_TYPE(X) ( ( NOTHING == (X) ) ? NOTHING : \ ( EXACT == (X) ) ? EXACT : \ - ( EXACTFU == (X) || EXACTFU_SS == (X) || EXACTFU_TRICKYFOLD == (X) ) ? EXACTFU : \ + ( EXACTFU == (X) || EXACTFU_SS == (X) ) ? EXACTFU : \ + ( EXACTFA == (X) ) ? EXACTFA : \ 0 ) /* dont use tail as the end marker for this traverse */ @@ -3337,27 +3949,27 @@ S_study_chunk(pTHX_ RExC_state_t *pRExC_ #endif DEBUG_TRIE_COMPILE_r({ - regprop(RExC_rx, mysv, cur); + regprop(RExC_rx, mysv, cur, NULL); PerlIO_printf( Perl_debug_log, "%*s- %s (%d)", (int)depth * 2 + 2,"", SvPV_nolen_const( mysv ), REG_NODE_NUM(cur) ); - regprop(RExC_rx, mysv, noper); + regprop(RExC_rx, mysv, noper, NULL); PerlIO_printf( Perl_debug_log, " -> %s", SvPV_nolen_const(mysv)); if ( noper_next ) { - regprop(RExC_rx, mysv, noper_next ); + regprop(RExC_rx, mysv, noper_next, NULL); PerlIO_printf( Perl_debug_log,"\t=> %s\t", SvPV_nolen_const(mysv)); } PerlIO_printf( Perl_debug_log, "(First==%d,Last==%d,Cur==%d,tt==%s,nt==%s,nnt==%s)\n", REG_NODE_NUM(first), REG_NODE_NUM(last), REG_NODE_NUM(cur), - PL_reg_name[trietype], PL_reg_name[noper_trietype], PL_reg_name[noper_next_trietype] + PL_reg_name[trietype], PL_reg_name[noper_trietype], PL_reg_name[noper_next_trietype] ); }); - /* Is noper a trieable nodetype that can be merged with the - * current trie (if there is one)? */ + /* Is noper a trieable nodetype that can be merged + * with the current trie (if there is one)? */ if ( noper_trietype && ( @@ -3370,10 +3982,10 @@ S_study_chunk(pTHX_ RExC_state_t *pRExC_ #endif && count < U16_MAX) { - /* Handle mergable triable node - * Either we are the first node in a new trieable sequence, - * in which case we do some bookkeeping, otherwise we update - * the end pointer. */ + /* Handle mergable triable node Either we are + * the first node in a new trieable sequence, + * in which case we do some bookkeeping, + * otherwise we update the end pointer. */ if ( !first ) { first = cur; if ( noper_trietype == NOTHING ) { @@ -3386,8 +3998,9 @@ S_study_chunk(pTHX_ RExC_state_t *pRExC_ if ( noper_next_trietype ) { trietype = noper_next_trietype; } else if (noper_next_type) { - /* a NOTHING regop is 1 regop wide. We need at least two - * for a trie so we can't merge this in */ + /* a NOTHING regop is 1 regop wide. + * We need at least two for a trie + * so we can't merge this in */ first = NULL; } } else { @@ -3403,31 +4016,39 @@ S_study_chunk(pTHX_ RExC_state_t *pRExC_ } /* end handle mergable triable node */ else { /* handle unmergable node - - * noper may either be a triable node which can not be tried - * together with the current trie, or a non triable node */ + * noper may either be a triable node which can + * not be tried together with the current trie, + * or a non triable node */ if ( last ) { - /* If last is set and trietype is not NOTHING then we have found - * at least two triable branch sequences in a row of a similar - * trietype so we can turn them into a trie. If/when we - * allow NOTHING to start a trie sequence this condition will be - * required, and it isn't expensive so we leave it in for now. */ + /* If last is set and trietype is not + * NOTHING then we have found at least two + * triable branch sequences in a row of a + * similar trietype so we can turn them + * into a trie. If/when we allow NOTHING to + * start a trie sequence this condition + * will be required, and it isn't expensive + * so we leave it in for now. */ if ( trietype && trietype != NOTHING ) make_trie( pRExC_state, - startbranch, first, cur, tail, count, - trietype, depth+1 ); - last = NULL; /* note: we clear/update first, trietype etc below, so we dont do it here */ + startbranch, first, cur, tail, + count, trietype, depth+1 ); + last = NULL; /* note: we clear/update + first, trietype etc below, + so we dont do it here */ } if ( noper_trietype #ifdef NOJUMPTRIE && noper_next == tail #endif ){ - /* noper is triable, so we can start a new trie sequence */ + /* noper is triable, so we can start a new + * trie sequence */ count = 1; first = cur; trietype = noper_trietype; } else if (first) { - /* if we already saw a first but the current node is not triable then we have + /* if we already saw a first but the + * current node is not triable then we have * to reset the first information. */ count = 0; first = NULL; @@ -3436,18 +4057,21 @@ S_study_chunk(pTHX_ RExC_state_t *pRExC_ } /* end handle unmergable node */ } /* loop over branches */ DEBUG_TRIE_COMPILE_r({ - regprop(RExC_rx, mysv, cur); + regprop(RExC_rx, mysv, cur, NULL); PerlIO_printf( Perl_debug_log, - "%*s- %s (%d) \n", (int)depth * 2 + 2, + "%*s- %s (%d) \n", + (int)depth * 2 + 2, "", SvPV_nolen_const( mysv ),REG_NODE_NUM(cur)); }); if ( last && trietype ) { if ( trietype != NOTHING ) { - /* the last branch of the sequence was part of a trie, - * so we have to construct it here outside of the loop - */ - made= make_trie( pRExC_state, startbranch, first, scan, tail, count, trietype, depth+1 ); + /* the last branch of the sequence was part of + * a trie, so we have to construct it here + * outside of the loop */ + made= make_trie( pRExC_state, startbranch, + first, scan, tail, count, + trietype, depth+1 ); #ifdef TRIE_STUDY_OPT if ( ((made == MADE_EXACT_TRIE && startbranch == first) @@ -3457,20 +4081,23 @@ S_study_chunk(pTHX_ RExC_state_t *pRExC_ if ( startbranch == first && scan == tail ) { - RExC_seen &=~REG_TOP_LEVEL_BRANCHES; + RExC_seen &=~REG_TOP_LEVEL_BRANCHES_SEEN; } } #endif } else { - /* at this point we know whatever we have is a NOTHING sequence/branch - * AND if 'startbranch' is 'first' then we can turn the whole thing into a NOTHING + /* at this point we know whatever we have is a + * NOTHING sequence/branch AND if 'startbranch' + * is 'first' then we can turn the whole thing + * into a NOTHING */ if ( startbranch == first ) { regnode *opt; - /* the entire thing is a NOTHING sequence, something like this: - * (?:|) So we can turn it into a plain NOTHING op. */ + /* the entire thing is a NOTHING sequence, + * something like this: (?:|) So we can + * turn it into a plain NOTHING op. */ DEBUG_TRIE_COMPILE_r({ - regprop(RExC_rx, mysv, cur); + regprop(RExC_rx, mysv, cur, NULL); PerlIO_printf( Perl_debug_log, "%*s- %s (%d) \n", (int)depth * 2 + 2, "", SvPV_nolen_const( mysv ),REG_NODE_NUM(cur)); @@ -3484,9 +4111,9 @@ S_study_chunk(pTHX_ RExC_state_t *pRExC_ } } /* end if ( last) */ } /* TRIE_MAXBUF is non zero */ - + } /* do trie */ - + } else if ( code == BRANCHJ ) { /* single branch is optimized. */ scan = NEXTOPER(NEXTOPER(scan)); @@ -3498,9 +4125,10 @@ S_study_chunk(pTHX_ RExC_state_t *pRExC_ I32 paren; regnode *start; regnode *end; + U32 my_recursed_depth= recursed_depth; if (OP(scan) != SUSPEND) { - /* set the pointer */ + /* set the pointer */ if (OP(scan) == GOSUB) { paren = ARG(scan); RExC_recurse[ARG2L(scan)] = scan; @@ -3511,21 +4139,33 @@ S_study_chunk(pTHX_ RExC_state_t *pRExC_ start = RExC_rxi->program + 1; end = RExC_opend; } - if (!recursed) { - Newxz(recursed, (((RExC_npar)>>3) +1), U8); - SAVEFREEPV(recursed); - } - if (!PAREN_TEST(recursed,paren+1)) { - PAREN_SET(recursed,paren+1); + if (!recursed_depth + || + !PAREN_TEST(RExC_study_chunk_recursed + ((recursed_depth-1) * RExC_study_chunk_recursed_bytes), paren) + ) { + if (!recursed_depth) { + Zero(RExC_study_chunk_recursed, RExC_study_chunk_recursed_bytes, U8); + } else { + Copy(RExC_study_chunk_recursed + ((recursed_depth-1) * RExC_study_chunk_recursed_bytes), + RExC_study_chunk_recursed + (recursed_depth * RExC_study_chunk_recursed_bytes), + RExC_study_chunk_recursed_bytes, U8); + } + /* we havent recursed into this paren yet, so recurse into it */ + DEBUG_STUDYDATA("set:", data,depth); + PAREN_SET(RExC_study_chunk_recursed + (recursed_depth * RExC_study_chunk_recursed_bytes), paren); + my_recursed_depth= recursed_depth + 1; Newx(newframe,1,scan_frame); } else { + DEBUG_STUDYDATA("inf:", data,depth); + /* some form of infinite recursion, assume infinite length + * */ if (flags & SCF_DO_SUBSTR) { - SCAN_COMMIT(pRExC_state,data,minlenp); + scan_commit(pRExC_state, data, minlenp, is_inf); data->longest = &(data->longest_float); } is_inf = is_inf_internal = 1; if (flags & SCF_DO_STCLASS_OR) /* Allow everything */ - cl_anything(pRExC_state, data->start_class); + ssc_anything(data->start_class); flags &= ~SCF_DO_STCLASS; } } else { @@ -3542,17 +4182,23 @@ S_study_chunk(pTHX_ RExC_state_t *pRExC_ newframe->last = last; newframe->stop = stopparen; newframe->prev = frame; + newframe->prev_recursed_depth = recursed_depth; + + DEBUG_STUDYDATA("frame-new:",data,depth); + DEBUG_PEEP("fnew", scan, depth); frame = newframe; scan = start; stopparen = paren; last = end; + depth = depth + 1; + recursed_depth= my_recursed_depth; continue; } } else if (OP(scan) == EXACT) { - I32 l = STR_LEN(scan); + SSize_t l = STR_LEN(scan); UV uc; if (UTF) { const U8 * const s = (U8*)STRING(scan); @@ -3568,7 +4214,7 @@ S_study_chunk(pTHX_ RExC_state_t *pRExC_ if (data->last_end == -1) { /* Update the start info. */ data->last_start_min = data->pos_min; data->last_start_max = is_inf - ? I32_MAX : data->pos_min + data->pos_delta; + ? SSize_t_MAX : data->pos_min + data->pos_delta; } sv_catpvn(data->last_found, STRING(scan), STR_LEN(scan)); if (UTF) @@ -3579,83 +4225,47 @@ S_study_chunk(pTHX_ RExC_state_t *pRExC_ mg_find(sv, PERL_MAGIC_utf8) : NULL; if (mg && mg->mg_len >= 0) mg->mg_len += utf8_length((U8*)STRING(scan), - (U8*)STRING(scan)+STR_LEN(scan)); + (U8*)STRING(scan)+STR_LEN(scan)); } data->last_end = data->pos_min + l; data->pos_min += l; /* As in the first entry. */ data->flags &= ~SF_BEFORE_EOL; } - if (flags & SCF_DO_STCLASS_AND) { - /* Check whether it is compatible with what we know already! */ - int compat = 1; - - /* If compatible, we or it in below. It is compatible if is - * in the bitmp and either 1) its bit or its fold is set, or 2) - * it's for a locale. Even if there isn't unicode semantics - * here, at runtime there may be because of matching against a - * utf8 string, so accept a possible false positive for - * latin1-range folds */ - if (uc >= 0x100 || - (!(data->start_class->flags & ANYOF_LOCALE) - && !ANYOF_BITMAP_TEST(data->start_class, uc) - && (!(data->start_class->flags & ANYOF_LOC_FOLD) - || !ANYOF_BITMAP_TEST(data->start_class, PL_fold_latin1[uc]))) - ) - { - compat = 0; - } - ANYOF_CLASS_ZERO(data->start_class); - ANYOF_BITMAP_ZERO(data->start_class); - if (compat) - ANYOF_BITMAP_SET(data->start_class, uc); - else if (uc >= 0x100) { - int i; - - /* Some Unicode code points fold to the Latin1 range; as - * XXX temporary code, instead of figuring out if this is - * one, just assume it is and set all the start class bits - * that could be some such above 255 code point's fold - * which will generate fals positives. As the code - * elsewhere that does compute the fold settles down, it - * can be extracted out and re-used here */ - for (i = 0; i < 256; i++){ - if (HAS_NONLATIN1_FOLD_CLOSURE(i)) { - ANYOF_BITMAP_SET(data->start_class, i); - } - } - } - CLEAR_SSC_EOS(data->start_class); - if (uc < 0x100) - data->start_class->flags &= ~ANYOF_UNICODE_ALL; + /* ANDing the code point leaves at most it, and not in locale, and + * can't match null string */ + if (flags & SCF_DO_STCLASS_AND) { + ssc_cp_and(data->start_class, uc); + ANYOF_FLAGS(data->start_class) &= ~ANYOF_EMPTY_STRING; + ssc_clear_locale(data->start_class); } else if (flags & SCF_DO_STCLASS_OR) { - /* false positive possible if the class is case-folded */ - if (uc < 0x100) - ANYOF_BITMAP_SET(data->start_class, uc); - else - data->start_class->flags |= ANYOF_UNICODE_ALL; - CLEAR_SSC_EOS(data->start_class); - cl_and(data->start_class, and_withp); + ssc_add_cp(data->start_class, uc); + ssc_and(pRExC_state, data->start_class, (regnode_charclass *) and_withp); + + /* See commit msg 749e076fceedeb708a624933726e7989f2302f6a */ + ANYOF_FLAGS(data->start_class) &= ~ANYOF_EMPTY_STRING; } flags &= ~SCF_DO_STCLASS; } else if (PL_regkind[OP(scan)] == EXACT) { /* But OP != EXACT! */ - I32 l = STR_LEN(scan); + SSize_t l = STR_LEN(scan); UV uc = *((U8*)STRING(scan)); + SV* EXACTF_invlist = _new_invlist(4); /* Start out big enough for 2 + separate code points */ /* Search for fixed substrings supports EXACT only. */ if (flags & SCF_DO_SUBSTR) { assert(data); - SCAN_COMMIT(pRExC_state, data, minlenp); + scan_commit(pRExC_state, data, minlenp, is_inf); } if (UTF) { const U8 * const s = (U8 *)STRING(scan); uc = utf8_to_uvchr_buf(s, s + l, NULL); l = utf8_length(s, s + l); } - if (has_exactf_sharp_s) { - RExC_seen |= REG_SEEN_EXACTF_SHARP_S; + if (unfolded_multi_char) { + RExC_seen |= REG_UNFOLDED_MULTI_SEEN; } min += l - min_subtract; assert (min >= 0); @@ -3670,99 +4280,95 @@ S_study_chunk(pTHX_ RExC_state_t *pRExC_ data->longest = &(data->longest_float); } } - if (flags & SCF_DO_STCLASS_AND) { - /* Check whether it is compatible with what we know already! */ - int compat = 1; - if (uc >= 0x100 || - (!(data->start_class->flags & ANYOF_LOCALE) - && !ANYOF_BITMAP_TEST(data->start_class, uc) - && !ANYOF_BITMAP_TEST(data->start_class, PL_fold_latin1[uc]))) - { - compat = 0; - } - ANYOF_CLASS_ZERO(data->start_class); - ANYOF_BITMAP_ZERO(data->start_class); - if (compat) { - ANYOF_BITMAP_SET(data->start_class, uc); - CLEAR_SSC_EOS(data->start_class); - if (OP(scan) == EXACTFL) { - /* XXX This set is probably no longer necessary, and - * probably wrong as LOCALE now is on in the initial - * state */ - data->start_class->flags |= ANYOF_LOCALE|ANYOF_LOC_FOLD; - } - else { + if (OP(scan) == EXACTFL) { - /* Also set the other member of the fold pair. In case - * that unicode semantics is called for at runtime, use - * the full latin1 fold. (Can't do this for locale, - * because not known until runtime) */ - ANYOF_BITMAP_SET(data->start_class, PL_fold_latin1[uc]); - - /* All other (EXACTFL handled above) folds except under - * /iaa that include s, S, and sharp_s also may include - * the others */ - if (OP(scan) != EXACTFA) { - if (uc == 's' || uc == 'S') { - ANYOF_BITMAP_SET(data->start_class, - LATIN_SMALL_LETTER_SHARP_S); - } - else if (uc == LATIN_SMALL_LETTER_SHARP_S) { - ANYOF_BITMAP_SET(data->start_class, 's'); - ANYOF_BITMAP_SET(data->start_class, 'S'); - } - } - } - } - else if (uc >= 0x100) { - int i; - for (i = 0; i < 256; i++){ - if (_HAS_NONLATIN1_FOLD_CLOSURE_ONLY_FOR_USE_BY_REGCOMP_DOT_C_AND_REGEXEC_DOT_C(i)) { - ANYOF_BITMAP_SET(data->start_class, i); - } - } - } + /* We don't know what the folds are; it could be anything. XXX + * Actually, we only support UTF-8 encoding for code points + * above Latin1, so we could know what those folds are. */ + EXACTF_invlist = _add_range_to_invlist(EXACTF_invlist, + 0, + UV_MAX); + } + else { /* Non-locale EXACTFish */ + EXACTF_invlist = add_cp_to_invlist(EXACTF_invlist, uc); + if (flags & SCF_DO_STCLASS_AND) { + ssc_clear_locale(data->start_class); + } + if (uc < 256) { /* We know what the Latin1 folds are ... */ + if (IS_IN_SOME_FOLD_L1(uc)) { /* For instance, we + know if anything folds + with this */ + EXACTF_invlist = add_cp_to_invlist(EXACTF_invlist, + PL_fold_latin1[uc]); + if (OP(scan) != EXACTFA) { /* The folds below aren't + legal under /iaa */ + if (isARG2_lower_or_UPPER_ARG1('s', uc)) { + EXACTF_invlist + = add_cp_to_invlist(EXACTF_invlist, + LATIN_SMALL_LETTER_SHARP_S); + } + else if (uc == LATIN_SMALL_LETTER_SHARP_S) { + EXACTF_invlist + = add_cp_to_invlist(EXACTF_invlist, 's'); + EXACTF_invlist + = add_cp_to_invlist(EXACTF_invlist, 'S'); + } + } + + /* We also know if there are above-Latin1 code points + * that fold to this (none legal for ASCII and /iaa) */ + if ((! isASCII(uc) || OP(scan) != EXACTFA) + && HAS_NONLATIN1_FOLD_CLOSURE(uc)) + { + /* XXX We could know exactly what does fold to this + * if the reverse folds are loaded, as currently in + * S_regclass() */ + _invlist_union(EXACTF_invlist, + PL_AboveLatin1, + &EXACTF_invlist); + } + } + } + else { /* Non-locale, above Latin1. XXX We don't currently + know what participates in folds with this, so have + to assume anything could */ + + /* XXX We could know exactly what does fold to this if the + * reverse folds are loaded, as currently in S_regclass(). + * But we do know that under /iaa nothing in the ASCII + * range can participate */ + if (OP(scan) == EXACTFA) { + _invlist_union_complement_2nd(EXACTF_invlist, + PL_XPosix_ptrs[_CC_ASCII], + &EXACTF_invlist); + } + else { + EXACTF_invlist = _add_range_to_invlist(EXACTF_invlist, + 0, UV_MAX); + } + } + } + if (flags & SCF_DO_STCLASS_AND) { + ANYOF_FLAGS(data->start_class) &= ~ANYOF_EMPTY_STRING; + ANYOF_POSIXL_ZERO(data->start_class); + ssc_intersection(data->start_class, EXACTF_invlist, FALSE); } else if (flags & SCF_DO_STCLASS_OR) { - if (data->start_class->flags & ANYOF_LOC_FOLD) { - /* false positive possible if the class is case-folded. - Assume that the locale settings are the same... */ - if (uc < 0x100) { - ANYOF_BITMAP_SET(data->start_class, uc); - if (OP(scan) != EXACTFL) { - - /* And set the other member of the fold pair, but - * can't do that in locale because not known until - * run-time */ - ANYOF_BITMAP_SET(data->start_class, - PL_fold_latin1[uc]); - - /* All folds except under /iaa that include s, S, - * and sharp_s also may include the others */ - if (OP(scan) != EXACTFA) { - if (uc == 's' || uc == 'S') { - ANYOF_BITMAP_SET(data->start_class, - LATIN_SMALL_LETTER_SHARP_S); - } - else if (uc == LATIN_SMALL_LETTER_SHARP_S) { - ANYOF_BITMAP_SET(data->start_class, 's'); - ANYOF_BITMAP_SET(data->start_class, 'S'); - } - } - } - } - CLEAR_SSC_EOS(data->start_class); - } - cl_and(data->start_class, and_withp); + ssc_union(data->start_class, EXACTF_invlist, FALSE); + ssc_and(pRExC_state, data->start_class, (regnode_charclass *) and_withp); + + /* See commit msg 749e076fceedeb708a624933726e7989f2302f6a */ + ANYOF_FLAGS(data->start_class) &= ~ANYOF_EMPTY_STRING; } flags &= ~SCF_DO_STCLASS; + SvREFCNT_dec(EXACTF_invlist); } else if (REGNODE_VARIES(OP(scan))) { - I32 mincount, maxcount, minnext, deltanext, fl = 0; - I32 f = flags, pos_before = 0; + SSize_t mincount, maxcount, minnext, deltanext, pos_before = 0; + I32 fl = 0, f = flags; regnode * const oscan = scan; - struct regnode_charclass_class this_class; - struct regnode_charclass_class *oclass = NULL; + regnode_ssc this_class; + regnode_ssc *oclass = NULL; I32 next_is_eval = 0; switch (PL_regkind[OP(scan)]) { @@ -3792,12 +4398,13 @@ S_study_chunk(pTHX_ RExC_state_t *pRExC_ scan = NEXTOPER(scan); goto do_curly; } - is_inf = is_inf_internal = 1; - scan = regnext(scan); if (flags & SCF_DO_SUBSTR) { - SCAN_COMMIT(pRExC_state, data, minlenp); /* Cannot extend fixed substrings */ + scan_commit(pRExC_state, data, minlenp, is_inf); + /* Cannot extend fixed substrings */ data->longest = &(data->longest_float); } + is_inf = is_inf_internal = 1; + scan = regnext(scan); goto optimize_curly_tail; case CURLY: if (stopparen>0 && (OP(scan)==CURLYN || OP(scan)==CURLYM) @@ -3818,7 +4425,9 @@ S_study_chunk(pTHX_ RExC_state_t *pRExC_ next_is_eval = (OP(scan) == EVAL); do_curly: if (flags & SCF_DO_SUBSTR) { - if (mincount == 0) SCAN_COMMIT(pRExC_state,data,minlenp); /* Cannot extend fixed substrings */ + if (mincount == 0) + scan_commit(pRExC_state, data, minlenp, is_inf); + /* Cannot extend fixed substrings */ pos_before = data->pos_min; } if (data) { @@ -3828,7 +4437,7 @@ S_study_chunk(pTHX_ RExC_state_t *pRExC_ data->flags |= SF_IS_INF; } if (flags & SCF_DO_STCLASS) { - cl_init(pRExC_state, &this_class); + ssc_init(pRExC_state, &this_class); oclass = data->start_class; data->start_class = &this_class; f |= SCF_DO_STCLASS_AND; @@ -3847,62 +4456,65 @@ S_study_chunk(pTHX_ RExC_state_t *pRExC_ f &= ~SCF_WHILEM_VISITED_POS; /* This will finish on WHILEM, setting scan, or on NULL: */ - minnext = study_chunk(pRExC_state, &scan, minlenp, &deltanext, - last, data, stopparen, recursed, NULL, - (mincount == 0 - ? (f & ~SCF_DO_SUBSTR) : f),depth+1); + minnext = study_chunk(pRExC_state, &scan, minlenp, &deltanext, + last, data, stopparen, recursed_depth, NULL, + (mincount == 0 + ? (f & ~SCF_DO_SUBSTR) + : f) + ,depth+1); if (flags & SCF_DO_STCLASS) data->start_class = oclass; if (mincount == 0 || minnext == 0) { if (flags & SCF_DO_STCLASS_OR) { - cl_or(pRExC_state, data->start_class, &this_class); + ssc_or(pRExC_state, data->start_class, (regnode_charclass *) &this_class); } else if (flags & SCF_DO_STCLASS_AND) { /* Switch to OR mode: cache the old value of * data->start_class */ INIT_AND_WITHP; - StructCopy(data->start_class, and_withp, - struct regnode_charclass_class); + StructCopy(data->start_class, and_withp, regnode_ssc); flags &= ~SCF_DO_STCLASS_AND; - StructCopy(&this_class, data->start_class, - struct regnode_charclass_class); + StructCopy(&this_class, data->start_class, regnode_ssc); flags |= SCF_DO_STCLASS_OR; - SET_SSC_EOS(data->start_class); + ANYOF_FLAGS(data->start_class) |= ANYOF_EMPTY_STRING; } } else { /* Non-zero len */ if (flags & SCF_DO_STCLASS_OR) { - cl_or(pRExC_state, data->start_class, &this_class); - cl_and(data->start_class, and_withp); + ssc_or(pRExC_state, data->start_class, (regnode_charclass *) &this_class); + ssc_and(pRExC_state, data->start_class, (regnode_charclass *) and_withp); } else if (flags & SCF_DO_STCLASS_AND) - cl_and(data->start_class, &this_class); + ssc_and(pRExC_state, data->start_class, (regnode_charclass *) &this_class); flags &= ~SCF_DO_STCLASS; } if (!scan) /* It was not CURLYX, but CURLY. */ scan = next; - if ( /* ? quantifier ok, except for (?{ ... }) */ - (next_is_eval || !(mincount == 0 && maxcount == 1)) + if (!(flags & SCF_TRIE_DOING_RESTUDY) + /* ? quantifier ok, except for (?{ ... }) */ + && (next_is_eval || !(mincount == 0 && maxcount == 1)) && (minnext == 0) && (deltanext == 0) && data && !(data->flags & (SF_HAS_PAR|SF_IN_PAR)) - && maxcount <= REG_INFTY/3) /* Complement check for big count */ + && maxcount <= REG_INFTY/3) /* Complement check for big + count */ { /* Fatal warnings may leak the regexp without this: */ SAVEFREESV(RExC_rx_sv); ckWARNreg(RExC_parse, - "Quantifier unexpected on zero-length expression"); + "Quantifier unexpected on zero-length expression"); (void)ReREFCNT_inc(RExC_rx_sv); } min += minnext * mincount; - is_inf_internal |= deltanext == I32_MAX - || (maxcount == REG_INFTY && minnext + deltanext > 0); + is_inf_internal |= deltanext == SSize_t_MAX + || (maxcount == REG_INFTY && minnext + deltanext > 0); is_inf |= is_inf_internal; - if (is_inf) - delta = I32_MAX; - else - delta += (minnext + deltanext) * maxcount - minnext * mincount; - + if (is_inf) { + delta = SSize_t_MAX; + } else { + delta += (minnext + deltanext) * maxcount + - minnext * mincount; + } /* Try powerful optimization CURLYX => CURLYN. */ if ( OP(oscan) == CURLYX && data && data->flags & SF_IN_PAR @@ -3953,7 +4565,10 @@ S_study_chunk(pTHX_ RExC_state_t *pRExC_ && !(data->flags & SF_HAS_EVAL) && !deltanext /* atom is fixed width */ && minnext != 0 /* CURLYM can't handle zero width */ - && ! (RExC_seen & REG_SEEN_EXACTF_SHARP_S) /* Nor \xDF */ + + /* Nor characters whose fold at run-time may be + * multi-character */ + && ! (RExC_seen & REG_UNFOLDED_MULTI_SEEN) ) { /* XXXX How to optimize if data == 0? */ /* Optimize to a simpler form. */ @@ -4000,7 +4615,7 @@ S_study_chunk(pTHX_ RExC_state_t *pRExC_ #endif /* Optimize again: */ study_chunk(pRExC_state, &nxt1, minlenp, &deltanext, nxt, - NULL, stopparen, recursed, NULL, 0,depth+1); + NULL, stopparen, recursed_depth, NULL, 0,depth+1); } else oscan->flags = 0; @@ -4025,43 +4640,32 @@ S_study_chunk(pTHX_ RExC_state_t *pRExC_ pars++; if (flags & SCF_DO_SUBSTR) { SV *last_str = NULL; + STRLEN last_chrs = 0; int counted = mincount != 0; - if (data->last_end > 0 && mincount != 0) { /* Ends with a string. */ -#if defined(SPARC64_GCC_WORKAROUND) - I32 b = 0; - STRLEN l = 0; - const char *s = NULL; - I32 old = 0; - - if (pos_before >= data->last_start_min) - b = pos_before; - else - b = data->last_start_min; - - l = 0; - s = SvPV_const(data->last_found, l); - old = b - data->last_start_min; - -#else - I32 b = pos_before >= data->last_start_min + if (data->last_end > 0 && mincount != 0) { /* Ends with a + string. */ + SSize_t b = pos_before >= data->last_start_min ? pos_before : data->last_start_min; STRLEN l; const char * const s = SvPV_const(data->last_found, l); - I32 old = b - data->last_start_min; -#endif + SSize_t old = b - data->last_start_min; if (UTF) old = utf8_hop((U8*)s, old) - (U8*)s; l -= old; /* Get the added string: */ last_str = newSVpvn_utf8(s + old, l, UTF); + last_chrs = UTF ? utf8_length((U8*)(s + old), + (U8*)(s + old + l)) : l; if (deltanext == 0 && pos_before == b) { /* What was added is a constant string */ if (mincount > 1) { + SvGROW(last_str, (mincount * l) + 1); repeatcpy(SvPVX(last_str) + l, - SvPVX_const(last_str), l, mincount - 1); + SvPVX_const(last_str), l, + mincount - 1); SvCUR_set(last_str, SvCUR(last_str) * mincount); /* Add additional parts. */ SvCUR_set(data->last_found, @@ -4073,34 +4677,41 @@ S_study_chunk(pTHX_ RExC_state_t *pRExC_ SvUTF8(sv) && SvMAGICAL(sv) ? mg_find(sv, PERL_MAGIC_utf8) : NULL; if (mg && mg->mg_len >= 0) - mg->mg_len += CHR_SVLEN(last_str) - l; + mg->mg_len += last_chrs * (mincount-1); } + last_chrs *= mincount; data->last_end += l * (mincount - 1); } } else { /* start offset must point into the last copy */ data->last_start_min += minnext * (mincount - 1); - data->last_start_max += is_inf ? I32_MAX + data->last_start_max += is_inf ? SSize_t_MAX : (maxcount - 1) * (minnext + data->pos_delta); } } /* It is counted once already... */ data->pos_min += minnext * (mincount - counted); #if 0 -PerlIO_printf(Perl_debug_log, "counted=%d deltanext=%d I32_MAX=%d minnext=%d maxcount=%d mincount=%d\n", - counted, deltanext, I32_MAX, minnext, maxcount, mincount); -if (deltanext != I32_MAX) -PerlIO_printf(Perl_debug_log, "LHS=%d RHS=%d\n", -counted * deltanext + (minnext + deltanext) * maxcount - minnext * mincount, I32_MAX - data->pos_delta); -#endif - if (deltanext == I32_MAX || -counted * deltanext + (minnext + deltanext) * maxcount - minnext * mincount >= I32_MAX - data->pos_delta) - data->pos_delta = I32_MAX; +PerlIO_printf(Perl_debug_log, "counted=%"UVdf" deltanext=%"UVdf + " SSize_t_MAX=%"UVdf" minnext=%"UVdf + " maxcount=%"UVdf" mincount=%"UVdf"\n", + (UV)counted, (UV)deltanext, (UV)SSize_t_MAX, (UV)minnext, (UV)maxcount, + (UV)mincount); +if (deltanext != SSize_t_MAX) +PerlIO_printf(Perl_debug_log, "LHS=%"UVdf" RHS=%"UVdf"\n", + (UV)(-counted * deltanext + (minnext + deltanext) * maxcount + - minnext * mincount), (UV)(SSize_t_MAX - data->pos_delta)); +#endif + if (deltanext == SSize_t_MAX + || -counted * deltanext + (minnext + deltanext) * maxcount - minnext * mincount >= SSize_t_MAX - data->pos_delta) + data->pos_delta = SSize_t_MAX; else data->pos_delta += - counted * deltanext + (minnext + deltanext) * maxcount - minnext * mincount; if (mincount != maxcount) { /* Cannot extend fixed substrings found inside the group. */ - SCAN_COMMIT(pRExC_state,data,minlenp); + scan_commit(pRExC_state, data, minlenp, is_inf); if (mincount && last_str) { SV * const sv = data->last_found; MAGIC * const mg = SvUTF8(sv) && SvMAGICAL(sv) ? @@ -4110,12 +4721,10 @@ PerlIO_printf(Perl_debug_log, "LHS=%d RH mg->mg_len = -1; sv_setsv(sv, last_str); data->last_end = data->pos_min; - data->last_start_min = - data->pos_min - CHR_SVLEN(last_str); + data->last_start_min = data->pos_min - last_chrs; data->last_start_max = is_inf - ? I32_MAX - : data->pos_min + data->pos_delta - - CHR_SVLEN(last_str); + ? SSize_t_MAX + : data->pos_min + data->pos_delta - last_chrs; } data->longest = &(data->longest_float); } @@ -4130,164 +4739,212 @@ PerlIO_printf(Perl_debug_log, "LHS=%d RH NEXT_OFF(oscan) += NEXT_OFF(next); } continue; - default: /* REF, and CLUMP only? */ + + default: +#ifdef DEBUGGING + Perl_croak(aTHX_ "panic: unexpected varying REx opcode %d", + OP(scan)); +#endif + case REF: + case CLUMP: if (flags & SCF_DO_SUBSTR) { - SCAN_COMMIT(pRExC_state,data,minlenp); /* Cannot expect anything... */ + /* Cannot expect anything... */ + scan_commit(pRExC_state, data, minlenp, is_inf); data->longest = &(data->longest_float); } is_inf = is_inf_internal = 1; - if (flags & SCF_DO_STCLASS_OR) - cl_anything(pRExC_state, data->start_class); + if (flags & SCF_DO_STCLASS_OR) { + if (OP(scan) == CLUMP) { + /* Actually is any start char, but very few code points + * aren't start characters */ + ssc_match_all_cp(data->start_class); + } + else { + ssc_anything(data->start_class); + } + } flags &= ~SCF_DO_STCLASS; break; } } else if (OP(scan) == LNBREAK) { if (flags & SCF_DO_STCLASS) { - int value = 0; - CLEAR_SSC_EOS(data->start_class); /* No match on empty */ if (flags & SCF_DO_STCLASS_AND) { - for (value = 0; value < 256; value++) - if (!is_VERTWS_cp(value)) - ANYOF_BITMAP_CLEAR(data->start_class, value); - } - else { - for (value = 0; value < 256; value++) - if (is_VERTWS_cp(value)) - ANYOF_BITMAP_SET(data->start_class, value); + ssc_intersection(data->start_class, + PL_XPosix_ptrs[_CC_VERTSPACE], FALSE); + ssc_clear_locale(data->start_class); + ANYOF_FLAGS(data->start_class) &= ~ANYOF_EMPTY_STRING; + } + else if (flags & SCF_DO_STCLASS_OR) { + ssc_union(data->start_class, + PL_XPosix_ptrs[_CC_VERTSPACE], + FALSE); + ssc_and(pRExC_state, data->start_class, (regnode_charclass *) and_withp); + + /* See commit msg for + * 749e076fceedeb708a624933726e7989f2302f6a */ + ANYOF_FLAGS(data->start_class) &= ~ANYOF_EMPTY_STRING; } - if (flags & SCF_DO_STCLASS_OR) - cl_and(data->start_class, and_withp); flags &= ~SCF_DO_STCLASS; } min++; delta++; /* Because of the 2 char string cr-lf */ if (flags & SCF_DO_SUBSTR) { - SCAN_COMMIT(pRExC_state,data,minlenp); /* Cannot expect anything... */ + /* Cannot expect anything... */ + scan_commit(pRExC_state, data, minlenp, is_inf); data->pos_min += 1; data->pos_delta += 1; data->longest = &(data->longest_float); } } else if (REGNODE_SIMPLE(OP(scan))) { - int value = 0; if (flags & SCF_DO_SUBSTR) { - SCAN_COMMIT(pRExC_state,data,minlenp); + scan_commit(pRExC_state, data, minlenp, is_inf); data->pos_min++; } min++; if (flags & SCF_DO_STCLASS) { - int loop_max = 256; - CLEAR_SSC_EOS(data->start_class); /* No match on empty */ + bool invert = 0; + SV* my_invlist = sv_2mortal(_new_invlist(0)); + U8 namedclass; + + /* See commit msg 749e076fceedeb708a624933726e7989f2302f6a */ + ANYOF_FLAGS(data->start_class) &= ~ANYOF_EMPTY_STRING; /* Some of the logic below assumes that switching locale on will only add false positives. */ - switch (PL_regkind[OP(scan)]) { - U8 classnum; + switch (OP(scan)) { - case SANY: default: #ifdef DEBUGGING - Perl_croak(aTHX_ "panic: unexpected simple REx opcode %d", OP(scan)); + Perl_croak(aTHX_ "panic: unexpected simple REx opcode %d", + OP(scan)); #endif - do_default: + case CANY: + case SANY: if (flags & SCF_DO_STCLASS_OR) /* Allow everything */ - cl_anything(pRExC_state, data->start_class); + ssc_match_all_cp(data->start_class); break; + case REG_ANY: - if (OP(scan) == SANY) - goto do_default; - if (flags & SCF_DO_STCLASS_OR) { /* Everything but \n */ - value = (ANYOF_BITMAP_TEST(data->start_class,'\n') - || ANYOF_CLASS_TEST_ANY_SET(data->start_class)); - cl_anything(pRExC_state, data->start_class); + { + SV* REG_ANY_invlist = _new_invlist(2); + REG_ANY_invlist = add_cp_to_invlist(REG_ANY_invlist, + '\n'); + if (flags & SCF_DO_STCLASS_OR) { + ssc_union(data->start_class, + REG_ANY_invlist, + TRUE /* TRUE => invert, hence all but \n + */ + ); + } + else if (flags & SCF_DO_STCLASS_AND) { + ssc_intersection(data->start_class, + REG_ANY_invlist, + TRUE /* TRUE => invert */ + ); + ssc_clear_locale(data->start_class); + } + SvREFCNT_dec_NN(REG_ANY_invlist); } - if (flags & SCF_DO_STCLASS_AND || !value) - ANYOF_BITMAP_CLEAR(data->start_class,'\n'); break; - case ANYOF: + + case ANYOF: if (flags & SCF_DO_STCLASS_AND) - cl_and(data->start_class, - (struct regnode_charclass_class*)scan); + ssc_and(pRExC_state, data->start_class, + (regnode_charclass *) scan); else - cl_or(pRExC_state, data->start_class, - (struct regnode_charclass_class*)scan); + ssc_or(pRExC_state, data->start_class, + (regnode_charclass *) scan); break; - case POSIXA: - loop_max = 128; + + case NPOSIXL: + invert = 1; /* FALL THROUGH */ + case POSIXL: - case POSIXD: - case POSIXU: - classnum = FLAGS(scan); - if (flags & SCF_DO_STCLASS_AND) { - if (!(data->start_class->flags & ANYOF_LOCALE)) { - ANYOF_CLASS_CLEAR(data->start_class, classnum_to_namedclass(classnum) + 1); - for (value = 0; value < loop_max; value++) { - if (! _generic_isCC(UNI_TO_NATIVE(value), classnum)) { - ANYOF_BITMAP_CLEAR(data->start_class, UNI_TO_NATIVE(value)); - } - } - } - } - else { - if (data->start_class->flags & ANYOF_LOCALE) { - ANYOF_CLASS_SET(data->start_class, classnum_to_namedclass(classnum)); + namedclass = classnum_to_namedclass(FLAGS(scan)) + invert; + if (flags & SCF_DO_STCLASS_AND) { + bool was_there = cBOOL( + ANYOF_POSIXL_TEST(data->start_class, + namedclass)); + ANYOF_POSIXL_ZERO(data->start_class); + if (was_there) { /* Do an AND */ + ANYOF_POSIXL_SET(data->start_class, namedclass); } - else { + /* No individual code points can now match */ + data->start_class->invlist + = sv_2mortal(_new_invlist(0)); + } + else { + int complement = namedclass + ((invert) ? -1 : 1); - /* Even if under locale, set the bits for non-locale - * in case it isn't a true locale-node. This will - * create false positives if it truly is locale */ - for (value = 0; value < loop_max; value++) { - if (_generic_isCC(UNI_TO_NATIVE(value), classnum)) { - ANYOF_BITMAP_SET(data->start_class, UNI_TO_NATIVE(value)); - } + assert(flags & SCF_DO_STCLASS_OR); + + /* If the complement of this class was already there, + * the result is that they match all code points, + * (\d + \D == everything). Remove the classes from + * future consideration. Locale is not relevant in + * this case */ + if (ANYOF_POSIXL_TEST(data->start_class, complement)) { + ssc_match_all_cp(data->start_class); + ANYOF_POSIXL_CLEAR(data->start_class, namedclass); + ANYOF_POSIXL_CLEAR(data->start_class, complement); } + else { /* The usual case; just add this class to the + existing set */ + ANYOF_POSIXL_SET(data->start_class, namedclass); } - } - break; - case NPOSIXA: - loop_max = 128; + } + break; + + case NPOSIXA: /* For these, we always know the exact set of + what's matched */ + invert = 1; /* FALL THROUGH */ - case NPOSIXL: - case NPOSIXU: + case POSIXA: + if (FLAGS(scan) == _CC_ASCII) { + my_invlist = PL_XPosix_ptrs[_CC_ASCII]; + } + else { + _invlist_intersection(PL_XPosix_ptrs[FLAGS(scan)], + PL_XPosix_ptrs[_CC_ASCII], + &my_invlist); + } + goto join_posix; + case NPOSIXD: - classnum = FLAGS(scan); - if (flags & SCF_DO_STCLASS_AND) { - if (!(data->start_class->flags & ANYOF_LOCALE)) { - ANYOF_CLASS_CLEAR(data->start_class, classnum_to_namedclass(classnum)); - for (value = 0; value < loop_max; value++) { - if (_generic_isCC(UNI_TO_NATIVE(value), classnum)) { - ANYOF_BITMAP_CLEAR(data->start_class, UNI_TO_NATIVE(value)); - } - } - } - } - else { - if (data->start_class->flags & ANYOF_LOCALE) { - ANYOF_CLASS_SET(data->start_class, classnum_to_namedclass(classnum) + 1); - } - else { + case NPOSIXU: + invert = 1; + /* FALL THROUGH */ + case POSIXD: + case POSIXU: + my_invlist = invlist_clone(PL_XPosix_ptrs[FLAGS(scan)]); - /* Even if under locale, set the bits for non-locale in - * case it isn't a true locale-node. This will create - * false positives if it truly is locale */ - for (value = 0; value < loop_max; value++) { - if (! _generic_isCC(UNI_TO_NATIVE(value), classnum)) { - ANYOF_BITMAP_SET(data->start_class, UNI_TO_NATIVE(value)); - } - } - if (PL_regkind[OP(scan)] == NPOSIXD) { - data->start_class->flags |= ANYOF_NON_UTF8_LATIN1_ALL; - } - } - } - break; + /* NPOSIXD matches all upper Latin1 code points unless the + * target string being matched is UTF-8, which is + * unknowable until match time. Since we are going to + * invert, we want to get rid of all of them so that the + * inversion will match all */ + if (OP(scan) == NPOSIXD) { + _invlist_subtract(my_invlist, PL_UpperLatin1, + &my_invlist); + } + + join_posix: + + if (flags & SCF_DO_STCLASS_AND) { + ssc_intersection(data->start_class, my_invlist, invert); + ssc_clear_locale(data->start_class); + } + else { + assert(flags & SCF_DO_STCLASS_OR); + ssc_union(data->start_class, my_invlist, invert); + } } if (flags & SCF_DO_STCLASS_OR) - cl_and(data->start_class, and_withp); + ssc_and(pRExC_state, data->start_class, (regnode_charclass *) and_withp); flags &= ~SCF_DO_STCLASS; } } @@ -4295,7 +4952,7 @@ PerlIO_printf(Perl_debug_log, "LHS=%d RH data->flags |= (OP(scan) == MEOL ? SF_BEFORE_MEOL : SF_BEFORE_SEOL); - SCAN_COMMIT(pRExC_state, data, minlenp); + scan_commit(pRExC_state, data, minlenp, is_inf); } else if ( PL_regkind[OP(scan)] == BRANCHJ @@ -4314,11 +4971,12 @@ PerlIO_printf(Perl_debug_log, "LHS=%d RH DEBUG_STUDYDATA("OPFAIL",data,depth); /*DEBUG_PARSE_MSG("opfail");*/ - regprop(RExC_rx, mysv_val, upto); - PerlIO_printf(Perl_debug_log, "~ replace with OPFAIL pointed at %s (%"IVdf") offset %"IVdf"\n", - SvPV_nolen_const(mysv_val), - (IV)REG_NODE_NUM(upto), - (IV)(upto - scan) + regprop(RExC_rx, mysv_val, upto, NULL); + PerlIO_printf(Perl_debug_log, + "~ replace with OPFAIL pointed at %s (%"IVdf") offset %"IVdf"\n", + SvPV_nolen_const(mysv_val), + (IV)REG_NODE_NUM(upto), + (IV)(upto - scan) ); }); OP(scan) = OPFAIL; @@ -4328,16 +4986,16 @@ PerlIO_printf(Perl_debug_log, "LHS=%d RH scan= upto; continue; } - if ( !PERL_ENABLE_POSITIVE_ASSERTION_STUDY + if ( !PERL_ENABLE_POSITIVE_ASSERTION_STUDY || OP(scan) == UNLESSM ) { /* Negative Lookahead/lookbehind In this case we can't do fixed string optimisation. */ - I32 deltanext, minnext, fake = 0; + SSize_t deltanext, minnext, fake = 0; regnode *nscan; - struct regnode_charclass_class intrnl; + regnode_ssc intrnl; int f = 0; data_fake.flags = 0; @@ -4350,7 +5008,7 @@ PerlIO_printf(Perl_debug_log, "LHS=%d RH data_fake.pos_delta = delta; if ( flags & SCF_DO_STCLASS && !scan->flags && OP(scan) == IFMATCH ) { /* Lookahead */ - cl_init(pRExC_state, &intrnl); + ssc_init(pRExC_state, &intrnl); data_fake.start_class = &intrnl; f |= SCF_DO_STCLASS_AND; } @@ -4358,14 +5016,16 @@ PerlIO_printf(Perl_debug_log, "LHS=%d RH f |= SCF_WHILEM_VISITED_POS; next = regnext(scan); nscan = NEXTOPER(NEXTOPER(scan)); - minnext = study_chunk(pRExC_state, &nscan, minlenp, &deltanext, - last, &data_fake, stopparen, recursed, NULL, f, depth+1); + minnext = study_chunk(pRExC_state, &nscan, minlenp, &deltanext, + last, &data_fake, stopparen, + recursed_depth, NULL, f, depth+1); if (scan->flags) { if (deltanext) { FAIL("Variable length lookbehind not implemented"); } else if (minnext > (I32)U8_MAX) { - FAIL2("Lookbehind longer than %"UVuf" not implemented", (UV)U8_MAX); + FAIL2("Lookbehind longer than %"UVuf" not implemented", + (UV)U8_MAX); } scan->flags = (U8)minnext; } @@ -4384,14 +5044,13 @@ PerlIO_printf(Perl_debug_log, "LHS=%d RH * *** HACK *** for now just treat as "no information". * See [perl #56690]. */ - cl_init(pRExC_state, data->start_class); + ssc_init(pRExC_state, data->start_class); } else { - /* AND before and after: combine and continue */ - const int was = TEST_SSC_EOS(data->start_class); - - cl_and(data->start_class, &intrnl); - if (was) - SET_SSC_EOS(data->start_class); + /* AND before and after: combine and continue. These + * assertions are zero-length, so can match an EMPTY + * string */ + ssc_and(pRExC_state, data->start_class, (regnode_charclass *) &intrnl); + ANYOF_FLAGS(data->start_class) |= ANYOF_EMPTY_STRING; } } } @@ -4404,26 +5063,26 @@ PerlIO_printf(Perl_debug_log, "LHS=%d RH length of the pattern, something we won't know about until after the recurse. */ - I32 deltanext, fake = 0; + SSize_t deltanext, fake = 0; regnode *nscan; - struct regnode_charclass_class intrnl; + regnode_ssc intrnl; int f = 0; - /* We use SAVEFREEPV so that when the full compile - is finished perl will clean up the allocated + /* We use SAVEFREEPV so that when the full compile + is finished perl will clean up the allocated minlens when it's all done. This way we don't have to worry about freeing them when we know they wont be used, which would be a pain. */ - I32 *minnextp; - Newx( minnextp, 1, I32 ); + SSize_t *minnextp; + Newx( minnextp, 1, SSize_t ); SAVEFREEPV(minnextp); if (data) { StructCopy(data, &data_fake, scan_data_t); if ((flags & SCF_DO_SUBSTR) && data->last_found) { f |= SCF_DO_SUBSTR; - if (scan->flags) - SCAN_COMMIT(pRExC_state, &data_fake,minlenp); + if (scan->flags) + scan_commit(pRExC_state, &data_fake, minlenp, is_inf); data_fake.last_found=newSVsv(data->last_found); } } @@ -4435,7 +5094,7 @@ PerlIO_printf(Perl_debug_log, "LHS=%d RH data_fake.flags |= SF_IS_INF; if ( flags & SCF_DO_STCLASS && !scan->flags && OP(scan) == IFMATCH ) { /* Lookahead */ - cl_init(pRExC_state, &intrnl); + ssc_init(pRExC_state, &intrnl); data_fake.start_class = &intrnl; f |= SCF_DO_STCLASS_AND; } @@ -4444,14 +5103,17 @@ PerlIO_printf(Perl_debug_log, "LHS=%d RH next = regnext(scan); nscan = NEXTOPER(NEXTOPER(scan)); - *minnextp = study_chunk(pRExC_state, &nscan, minnextp, &deltanext, - last, &data_fake, stopparen, recursed, NULL, f,depth+1); + *minnextp = study_chunk(pRExC_state, &nscan, minnextp, + &deltanext, last, &data_fake, + stopparen, recursed_depth, NULL, + f,depth+1); if (scan->flags) { if (deltanext) { FAIL("Variable length lookbehind not implemented"); } else if (*minnextp > (I32)U8_MAX) { - FAIL2("Lookbehind longer than %"UVuf" not implemented", (UV)U8_MAX); + FAIL2("Lookbehind longer than %"UVuf" not implemented", + (UV)U8_MAX); } scan->flags = (U8)*minnextp; } @@ -4459,11 +5121,8 @@ PerlIO_printf(Perl_debug_log, "LHS=%d RH *minnextp += min; if (f & SCF_DO_STCLASS_AND) { - const int was = TEST_SSC_EOS(data.start_class); - - cl_and(data->start_class, &intrnl); - if (was) - SET_SSC_EOS(data->start_class); + ssc_and(pRExC_state, data->start_class, (regnode_charclass *) &intrnl); + ANYOF_FLAGS(data->start_class) |= ANYOF_EMPTY_STRING; } if (data) { if (data_fake.flags & (SF_HAS_PAR|SF_IN_PAR)) @@ -4474,10 +5133,10 @@ PerlIO_printf(Perl_debug_log, "LHS=%d RH if ((flags & SCF_DO_SUBSTR) && data_fake.last_found) { if (RExC_rx->minlen<*minnextp) RExC_rx->minlen=*minnextp; - SCAN_COMMIT(pRExC_state, &data_fake, minnextp); + scan_commit(pRExC_state, &data_fake, minnextp, is_inf); SvREFCNT_dec_NN(data_fake.last_found); - - if ( data_fake.minlen_fixed != minlenp ) + + if ( data_fake.minlen_fixed != minlenp ) { data->offset_fixed= data_fake.offset_fixed; data->minlen_fixed= data_fake.minlen_fixed; @@ -4518,7 +5177,7 @@ PerlIO_printf(Perl_debug_log, "LHS=%d RH } else if ( PL_regkind[OP(scan)] == ENDLIKE ) { if (flags & SCF_DO_SUBSTR) { - SCAN_COMMIT(pRExC_state,data,minlenp); + scan_commit(pRExC_state, data, minlenp, is_inf); flags &= ~SCF_DO_SUBSTR; } if (data && OP(scan)==ACCEPT) { @@ -4530,26 +5189,26 @@ PerlIO_printf(Perl_debug_log, "LHS=%d RH else if (OP(scan) == LOGICAL && scan->flags == 2) /* Embedded follows */ { if (flags & SCF_DO_SUBSTR) { - SCAN_COMMIT(pRExC_state,data,minlenp); + scan_commit(pRExC_state, data, minlenp, is_inf); data->longest = &(data->longest_float); } is_inf = is_inf_internal = 1; if (flags & SCF_DO_STCLASS_OR) /* Allow everything */ - cl_anything(pRExC_state, data->start_class); + ssc_anything(data->start_class); flags &= ~SCF_DO_STCLASS; } else if (OP(scan) == GPOS) { - if (!(RExC_rx->extflags & RXf_GPOS_FLOAT) && - !(delta || is_inf || (data && data->pos_delta))) + if (!(RExC_rx->intflags & PREGf_GPOS_FLOAT) && + !(delta || is_inf || (data && data->pos_delta))) { - if (!(RExC_rx->extflags & RXf_ANCH) && (flags & SCF_DO_SUBSTR)) - RExC_rx->extflags |= RXf_ANCH_GPOS; - if (RExC_rx->gofs < (U32)min) + if (!(RExC_rx->intflags & PREGf_ANCH) && (flags & SCF_DO_SUBSTR)) + RExC_rx->intflags |= PREGf_ANCH_GPOS; + if (RExC_rx->gofs < (STRLEN)min) RExC_rx->gofs = min; } else { - RExC_rx->extflags |= RXf_GPOS_FLOAT; + RExC_rx->intflags |= PREGf_GPOS_FLOAT; RExC_rx->gofs = 0; - } + } } #ifdef TRIE_STUDY_OPT #ifdef FULL_TRIE_STUDY @@ -4560,26 +5219,28 @@ PerlIO_printf(Perl_debug_log, "LHS=%d RH regnode *trie_node= scan; regnode *tail= regnext(scan); reg_trie_data *trie = (reg_trie_data*)RExC_rxi->data->data[ ARG(scan) ]; - I32 max1 = 0, min1 = I32_MAX; - struct regnode_charclass_class accum; + SSize_t max1 = 0, min1 = SSize_t_MAX; + regnode_ssc accum; - if (flags & SCF_DO_SUBSTR) /* XXXX Add !SUSPEND? */ - SCAN_COMMIT(pRExC_state, data,minlenp); /* Cannot merge strings after this. */ + if (flags & SCF_DO_SUBSTR) { /* XXXX Add !SUSPEND? */ + /* Cannot merge strings after this. */ + scan_commit(pRExC_state, data, minlenp, is_inf); + } if (flags & SCF_DO_STCLASS) - cl_init_zero(pRExC_state, &accum); - + ssc_init_zero(pRExC_state, &accum); + if (!trie->jump) { min1= trie->minlen; max1= trie->maxlen; } else { const regnode *nextbranch= NULL; U32 word; - - for ( word=1 ; word <= trie->wordcount ; word++) + + for ( word=1 ; word <= trie->wordcount ; word++) { - I32 deltanext=0, minnext=0, f = 0, fake; - struct regnode_charclass_class this_class; - + SSize_t deltanext=0, minnext=0, f = 0, fake; + regnode_ssc this_class; + data_fake.flags = 0; if (data) { data_fake.whilem_c = data->whilem_c; @@ -4589,40 +5250,39 @@ PerlIO_printf(Perl_debug_log, "LHS=%d RH data_fake.last_closep = &fake; data_fake.pos_delta = delta; if (flags & SCF_DO_STCLASS) { - cl_init(pRExC_state, &this_class); + ssc_init(pRExC_state, &this_class); data_fake.start_class = &this_class; f = SCF_DO_STCLASS_AND; } if (flags & SCF_WHILEM_VISITED_POS) f |= SCF_WHILEM_VISITED_POS; - + if (trie->jump[word]) { if (!nextbranch) nextbranch = trie_node + trie->jump[0]; scan= trie_node + trie->jump[word]; /* We go from the jump point to the branch that follows - it. Note this means we need the vestigal unused branches - even though they arent otherwise used. - */ - minnext = study_chunk(pRExC_state, &scan, minlenp, - &deltanext, (regnode *)nextbranch, &data_fake, - stopparen, recursed, NULL, f,depth+1); + it. Note this means we need the vestigal unused + branches even though they arent otherwise used. */ + minnext = study_chunk(pRExC_state, &scan, minlenp, + &deltanext, (regnode *)nextbranch, &data_fake, + stopparen, recursed_depth, NULL, f,depth+1); } if (nextbranch && PL_regkind[OP(nextbranch)]==BRANCH) nextbranch= regnext((regnode*)nextbranch); - - if (min1 > (I32)(minnext + trie->minlen)) + + if (min1 > (SSize_t)(minnext + trie->minlen)) min1 = minnext + trie->minlen; - if (deltanext == I32_MAX) { + if (deltanext == SSize_t_MAX) { is_inf = is_inf_internal = 1; - max1 = I32_MAX; - } else if (max1 < (I32)(minnext + deltanext + trie->maxlen)) + max1 = SSize_t_MAX; + } else if (max1 < (SSize_t)(minnext + deltanext + trie->maxlen)) max1 = minnext + deltanext + trie->maxlen; - + if (data_fake.flags & (SF_HAS_PAR|SF_IN_PAR)) pars++; if (data_fake.flags & SCF_SEEN_ACCEPT) { - if ( stopmin > min + min1) + if ( stopmin > min + min1) stopmin = min + min1; flags &= ~SCF_DO_SUBSTR; if (data) @@ -4634,7 +5294,7 @@ PerlIO_printf(Perl_debug_log, "LHS=%d RH data->whilem_c = data_fake.whilem_c; } if (flags & SCF_DO_STCLASS) - cl_or(pRExC_state, &accum, &this_class); + ssc_or(pRExC_state, &accum, (regnode_charclass *) &this_class); } } if (flags & SCF_DO_SUBSTR) { @@ -4646,28 +5306,25 @@ PerlIO_printf(Perl_debug_log, "LHS=%d RH min += min1; delta += max1 - min1; if (flags & SCF_DO_STCLASS_OR) { - cl_or(pRExC_state, data->start_class, &accum); + ssc_or(pRExC_state, data->start_class, (regnode_charclass *) &accum); if (min1) { - cl_and(data->start_class, and_withp); + ssc_and(pRExC_state, data->start_class, (regnode_charclass *) and_withp); flags &= ~SCF_DO_STCLASS; } } else if (flags & SCF_DO_STCLASS_AND) { if (min1) { - cl_and(data->start_class, &accum); + ssc_and(pRExC_state, data->start_class, (regnode_charclass *) &accum); flags &= ~SCF_DO_STCLASS; } else { /* Switch to OR mode: cache the old value of * data->start_class */ INIT_AND_WITHP; - StructCopy(data->start_class, and_withp, - struct regnode_charclass_class); + StructCopy(data->start_class, and_withp, regnode_ssc); flags &= ~SCF_DO_STCLASS_AND; - StructCopy(&accum, data->start_class, - struct regnode_charclass_class); + StructCopy(&accum, data->start_class, regnode_ssc); flags |= SCF_DO_STCLASS_OR; - SET_SSC_EOS(data->start_class); } } scan= tail; @@ -4677,19 +5334,20 @@ PerlIO_printf(Perl_debug_log, "LHS=%d RH else if (PL_regkind[OP(scan)] == TRIE) { reg_trie_data *trie = (reg_trie_data*)RExC_rxi->data->data[ ARG(scan) ]; U8*bang=NULL; - + min += trie->minlen; delta += (trie->maxlen - trie->minlen); flags &= ~SCF_DO_STCLASS; /* xxx */ if (flags & SCF_DO_SUBSTR) { - SCAN_COMMIT(pRExC_state,data,minlenp); /* Cannot expect anything... */ + /* Cannot expect anything... */ + scan_commit(pRExC_state, data, minlenp, is_inf); data->pos_min += trie->minlen; data->pos_delta += (trie->maxlen - trie->minlen); if (trie->maxlen != trie->minlen) data->longest = &(data->longest_float); } if (trie->jump) /* no more substrings -- for now /grr*/ - flags &= ~SCF_DO_SUBSTR; + flags &= ~SCF_DO_SUBSTR; } #endif /* old or new */ #endif /* TRIE_STUDY_OPT */ @@ -4697,10 +5355,24 @@ PerlIO_printf(Perl_debug_log, "LHS=%d RH /* Else: zero-length, ignore. */ scan = regnext(scan); } + /* If we are exiting a recursion we can unset its recursed bit + * and allow ourselves to enter it again - no danger of an + * infinite loop there. + if (stopparen > -1 && recursed) { + DEBUG_STUDYDATA("unset:", data,depth); + PAREN_UNSET( recursed, stopparen); + } + */ if (frame) { + DEBUG_STUDYDATA("frame-end:",data,depth); + DEBUG_PEEP("fend", scan, depth); + /* restore previous context */ last = frame->last; scan = frame->next; stopparen = frame->stop; + recursed_depth = frame->prev_recursed_depth; + depth = depth - 1; + frame = frame->prev; goto fake_study_recurse; } @@ -4710,9 +5382,10 @@ PerlIO_printf(Perl_debug_log, "LHS=%d RH DEBUG_STUDYDATA("pre-fin:",data,depth); *scanp = scan; - *deltap = is_inf_internal ? I32_MAX : delta; + *deltap = is_inf_internal ? SSize_t_MAX : delta; + if (flags & SCF_DO_SUBSTR && is_inf) - data->pos_delta = I32_MAX - data->pos_min; + data->pos_delta = SSize_t_MAX - data->pos_min; if (is_par > (I32)U8_MAX) is_par = 0; if (is_par && pars==1 && data) { @@ -4724,17 +5397,25 @@ PerlIO_printf(Perl_debug_log, "LHS=%d RH data->flags &= ~SF_IN_PAR; } if (flags & SCF_DO_STCLASS_OR) - cl_and(data->start_class, and_withp); + ssc_and(pRExC_state, data->start_class, (regnode_charclass *) and_withp); if (flags & SCF_TRIE_RESTUDY) data->flags |= SCF_TRIE_RESTUDY; - + DEBUG_STUDYDATA("post-fin:",data,depth); - - return min < stopmin ? min : stopmin; + + { + SSize_t final_minlen= min < stopmin ? min : stopmin; + + if (!(RExC_seen & REG_UNBOUNDED_QUANTIFIER_SEEN) && (RExC_maxlen < final_minlen + delta)) { + RExC_maxlen = final_minlen + delta; + } + return final_minlen; + } + /* not-reached */ } STATIC U32 -S_add_data(RExC_state_t *pRExC_state, U32 n, const char *s) +S_add_data(RExC_state_t* const pRExC_state, const char* const s, const U32 n) { U32 count = RExC_rxi->data ? RExC_rxi->data->count : 0; @@ -4795,7 +5476,7 @@ Perl_reginitcolors(pTHX) } STMT_END #else #define CHECK_RESTUDY_GOTO_butfirst -#endif +#endif /* * pregcomp - compile a regular expression into internal code @@ -4804,7 +5485,7 @@ Perl_reginitcolors(pTHX) * scope */ -#ifndef PERL_IN_XSUB_RE +#ifndef PERL_IN_XSUB_RE /* return the currently in-scope regex engine (or the default if none) */ @@ -4817,7 +5498,7 @@ Perl_current_re_engine(pTHX) HV * const table = GvHV(PL_hintgv); SV **ptr; - if (!table) + if (!table || !(PL_hints & HINT_LOCALIZE_HH)) return &PL_core_reg_engine; ptr = hv_fetchs(table, "regcomp", FALSE); if ( !(ptr && SvIOK(*ptr) && SvIV(*ptr))) @@ -4898,12 +5579,11 @@ S_pat_upgrade_to_utf8(pTHX_ RExC_state_t Newx(dst, *plen_p * 2 + 1, U8); while (s < *plen_p) { - const UV uv = NATIVE_TO_ASCII(src[s]); - if (UNI_IS_INVARIANT(uv)) - dst[d] = (U8)UTF_TO_NATIVE(uv); + if (NATIVE_BYTE_IS_INVARIANT(src[s])) + dst[d] = src[s]; else { - dst[d++] = (U8)UTF8_EIGHT_BIT_HI(uv); - dst[d] = (U8)UTF8_EIGHT_BIT_LO(uv); + dst[d++] = UTF8_EIGHT_BIT_HI(src[s]); + dst[d] = UTF8_EIGHT_BIT_LO(src[s]); } if (n < num_code_blocks) { if (!do_end && pRExC_state->code_blocks[n].start == s) { @@ -4967,6 +5647,7 @@ S_concat_pat(pTHX_ RExC_state_t * const STRLEN orig_patlen = 0; bool code = 0; SV *msv = use_delim ? delim : *svp; + if (!msv) msv = &PL_sv_undef; /* if we've got a delimiter, we go round the loop twice for each * svp slot (except the last), using the delimiter the second @@ -4985,21 +5666,21 @@ S_concat_pat(pTHX_ RExC_state_t * const * The code in this block is based on S_pushav() */ AV *const av = (AV*)msv; - const I32 maxarg = AvFILL(av) + 1; + const SSize_t maxarg = AvFILL(av) + 1; SV **array; if (oplist) { assert(oplist->op_type == OP_PADAV - || oplist->op_type == OP_RV2AV); + || oplist->op_type == OP_RV2AV); oplist = oplist->op_sibling;; } if (SvRMAGICAL(av)) { - U32 i; + SSize_t i; Newx(array, maxarg, SV*); SAVEFREEPV(array); - for (i=0; i < (U32)maxarg; i++) { + for (i=0; i < maxarg; i++) { SV ** const svp = av_fetch(av, i, FALSE); array[i] = svp ? *svp : &PL_sv_undef; } @@ -5289,7 +5970,7 @@ S_compile_runtime_code(pTHX_ RExC_state_ { Safefree(pRExC_state->code_blocks); /* use croak_sv ? */ - Perl_croak_nocontext("%s", SvPV_nolen_const(errsv)); + Perl_croak_nocontext("%"SVf, SVfARG(errsv)); } } assert(SvROK(qr_ref)); @@ -5380,20 +6061,24 @@ S_compile_runtime_code(pTHX_ RExC_state_ STATIC bool -S_setup_longest(pTHX_ RExC_state_t *pRExC_state, SV* sv_longest, SV** rx_utf8, SV** rx_substr, I32* rx_end_shift, I32 lookbehind, I32 offset, I32 *minlen, STRLEN longest_length, bool eol, bool meol) +S_setup_longest(pTHX_ RExC_state_t *pRExC_state, SV* sv_longest, + SV** rx_utf8, SV** rx_substr, SSize_t* rx_end_shift, + SSize_t lookbehind, SSize_t offset, SSize_t *minlen, + STRLEN longest_length, bool eol, bool meol) { /* This is the common code for setting up the floating and fixed length * string data extracted from Perl_re_op_compile() below. Returns a boolean * as to whether succeeded or not */ - I32 t,ml; + I32 t; + SSize_t ml; if (! (longest_length || (eol /* Can't have SEOL and MULTI */ && (! meol || (RExC_flags & RXf_PMf_MULTILINE))) ) - /* See comments for join_exact for why REG_SEEN_EXACTF_SHARP_S */ - || (RExC_seen & REG_SEEN_EXACTF_SHARP_S)) + /* See comments for join_exact for why REG_UNFOLDED_MULTI_SEEN */ + || (RExC_seen & REG_UNFOLDED_MULTI_SEEN)) { return FALSE; } @@ -5411,7 +6096,7 @@ S_setup_longest(pTHX_ RExC_state_t *pREx follow this item. We calculate it ahead of time as once the lookbehind offset is added in we lose the ability to correctly calculate it.*/ - ml = minlen ? *(minlen) : (I32)longest_length; + ml = minlen ? *(minlen) : (SSize_t)longest_length; *rx_end_shift = ml - offset - longest_length + (SvTAIL(sv_longest) != 0) + lookbehind; @@ -5480,7 +6165,7 @@ Perl_re_op_compile(pTHX_ SV ** const pat char *exp; regnode *scan; I32 flags; - I32 minlen = 0; + SSize_t minlen = 0; U32 rx_flags; SV *pat; SV *code_blocksv = NULL; @@ -5491,16 +6176,18 @@ Perl_re_op_compile(pTHX_ SV ** const pat I32 sawlookahead = 0; I32 sawplus = 0; I32 sawopen = 0; + I32 sawminmod = 0; + regex_charset initial_charset = get_regex_charset(orig_rx_flags); bool recompile = 0; bool runtime_code = 0; scan_data_t data; RExC_state_t RExC_state; RExC_state_t * const pRExC_state = &RExC_state; -#ifdef TRIE_STUDY_OPT +#ifdef TRIE_STUDY_OPT int restudied = 0; RExC_state_t copyRExC_state; -#endif +#endif GET_RE_DEBUG_FLAGS_DECL; PERL_ARGS_ASSERT_RE_OP_COMPILE; @@ -5512,61 +6199,11 @@ Perl_re_op_compile(pTHX_ SV ** const pat * having to test them each time otherwise */ if (! PL_AboveLatin1) { PL_AboveLatin1 = _new_invlist_C_array(AboveLatin1_invlist); - PL_ASCII = _new_invlist_C_array(ASCII_invlist); PL_Latin1 = _new_invlist_C_array(Latin1_invlist); - - PL_L1Posix_ptrs[_CC_ALPHANUMERIC] - = _new_invlist_C_array(L1PosixAlnum_invlist); - PL_Posix_ptrs[_CC_ALPHANUMERIC] - = _new_invlist_C_array(PosixAlnum_invlist); - - PL_L1Posix_ptrs[_CC_ALPHA] - = _new_invlist_C_array(L1PosixAlpha_invlist); - PL_Posix_ptrs[_CC_ALPHA] = _new_invlist_C_array(PosixAlpha_invlist); - - PL_Posix_ptrs[_CC_BLANK] = _new_invlist_C_array(PosixBlank_invlist); - PL_XPosix_ptrs[_CC_BLANK] = _new_invlist_C_array(XPosixBlank_invlist); - - /* Cased is the same as Alpha in the ASCII range */ - PL_L1Posix_ptrs[_CC_CASED] = _new_invlist_C_array(L1Cased_invlist); - PL_Posix_ptrs[_CC_CASED] = _new_invlist_C_array(PosixAlpha_invlist); - - PL_Posix_ptrs[_CC_CNTRL] = _new_invlist_C_array(PosixCntrl_invlist); - PL_XPosix_ptrs[_CC_CNTRL] = _new_invlist_C_array(XPosixCntrl_invlist); - - PL_Posix_ptrs[_CC_DIGIT] = _new_invlist_C_array(PosixDigit_invlist); - PL_L1Posix_ptrs[_CC_DIGIT] = _new_invlist_C_array(PosixDigit_invlist); - - PL_L1Posix_ptrs[_CC_GRAPH] = _new_invlist_C_array(L1PosixGraph_invlist); - PL_Posix_ptrs[_CC_GRAPH] = _new_invlist_C_array(PosixGraph_invlist); - - PL_L1Posix_ptrs[_CC_LOWER] = _new_invlist_C_array(L1PosixLower_invlist); - PL_Posix_ptrs[_CC_LOWER] = _new_invlist_C_array(PosixLower_invlist); - - PL_L1Posix_ptrs[_CC_PRINT] = _new_invlist_C_array(L1PosixPrint_invlist); - PL_Posix_ptrs[_CC_PRINT] = _new_invlist_C_array(PosixPrint_invlist); - - PL_L1Posix_ptrs[_CC_PUNCT] = _new_invlist_C_array(L1PosixPunct_invlist); - PL_Posix_ptrs[_CC_PUNCT] = _new_invlist_C_array(PosixPunct_invlist); - - PL_Posix_ptrs[_CC_SPACE] = _new_invlist_C_array(PerlSpace_invlist); - PL_XPosix_ptrs[_CC_SPACE] = _new_invlist_C_array(XPerlSpace_invlist); - PL_Posix_ptrs[_CC_PSXSPC] = _new_invlist_C_array(PosixSpace_invlist); - PL_XPosix_ptrs[_CC_PSXSPC] = _new_invlist_C_array(XPosixSpace_invlist); - - PL_L1Posix_ptrs[_CC_UPPER] = _new_invlist_C_array(L1PosixUpper_invlist); - PL_Posix_ptrs[_CC_UPPER] = _new_invlist_C_array(PosixUpper_invlist); - - PL_XPosix_ptrs[_CC_VERTSPACE] = _new_invlist_C_array(VertSpace_invlist); - - PL_Posix_ptrs[_CC_WORDCHAR] = _new_invlist_C_array(PosixWord_invlist); - PL_L1Posix_ptrs[_CC_WORDCHAR] - = _new_invlist_C_array(L1PosixWord_invlist); - - PL_Posix_ptrs[_CC_XDIGIT] = _new_invlist_C_array(PosixXDigit_invlist); - PL_XPosix_ptrs[_CC_XDIGIT] = _new_invlist_C_array(XPosixXDigit_invlist); - - PL_HasMultiCharFold = _new_invlist_C_array(_Perl_Multi_Char_Folds_invlist); + PL_UpperLatin1 = _new_invlist_C_array(UpperLatin1_invlist); + PL_utf8_foldable = _new_invlist_C_array(_Perl_Any_Folds_invlist); + PL_HasMultiCharFold = + _new_invlist_C_array(_Perl_Folds_To_Multi_Char_invlist); } #endif @@ -5682,6 +6319,7 @@ Perl_re_op_compile(pTHX_ SV ** const pat RExC_utf8 = RExC_orig_utf8 = (plen == 0 || IN_BYTES) ? 0 : SvUTF8(pat); RExC_uni_semantics = 0; RExC_contains_locale = 0; + RExC_contains_i = 0; pRExC_state->runtime_code_qr = NULL; DEBUG_COMPILE_r({ @@ -5703,11 +6341,11 @@ Perl_re_op_compile(pTHX_ SV ** const pat runtime_code = S_has_runtime_code(aTHX_ pRExC_state, exp, plen); /* return old regex if pattern hasn't changed */ - /* XXX: note in the below we have to check the flags as well as the pattern. + /* XXX: note in the below we have to check the flags as well as the + * pattern. * - * Things get a touch tricky as we have to compare the utf8 flag independently - * from the compile flags. - */ + * Things get a touch tricky as we have to compare the utf8 flag + * independently from the compile flags. */ if ( old_re && !recompile @@ -5724,10 +6362,10 @@ Perl_re_op_compile(pTHX_ SV ** const pat rx_flags = orig_rx_flags; - if (initial_charset == REGEX_LOCALE_CHARSET) { - RExC_contains_locale = 1; + if (rx_flags & PMf_FOLD) { + RExC_contains_i = 1; } - else if (RExC_utf8 && initial_charset == REGEX_DEPENDS_CHARSET) { + if (RExC_utf8 && initial_charset == REGEX_DEPENDS_CHARSET) { /* Set to use unicode semantics if the pattern is in utf8 and has the * 'depends' charset specified, as it means unicode when utf8 */ @@ -5755,6 +6393,7 @@ Perl_re_op_compile(pTHX_ SV ** const pat RExC_sawback = 0; RExC_seen = 0; + RExC_maxlen = 0; RExC_in_lookbehind = 0; RExC_seen_zerolen = *exp == '^' ? -1 : 0; RExC_extralen = 0; @@ -5769,7 +6408,7 @@ Perl_re_op_compile(pTHX_ SV ** const pat RExC_npar = 1; RExC_nestroot = 0; RExC_size = 0L; - RExC_emit = &PL_regdummy; + RExC_emit = (regnode *) &RExC_emit_dummy; RExC_whilem_seen = 0; RExC_open_parens = NULL; RExC_close_parens = NULL; @@ -5779,6 +6418,8 @@ Perl_re_op_compile(pTHX_ SV ** const pat RExC_paren_name_list = NULL; #endif RExC_recurse = NULL; + RExC_study_chunk_recursed = NULL; + RExC_study_chunk_recursed_bytes= 0; RExC_recurse_count = 0; pRExC_state->code_index = 0; @@ -5816,18 +6457,18 @@ Perl_re_op_compile(pTHX_ SV ** const pat pRExC_state->num_code_blocks); goto redo_first_pass; } - Perl_croak(aTHX_ "panic: reg returned NULL to re_op_compile for sizing pass, flags=%#X", flags); + Perl_croak(aTHX_ "panic: reg returned NULL to re_op_compile for sizing pass, flags=%#"UVxf"", (UV) flags); } if (code_blocksv) SvLEN_set(code_blocksv,0); /* no you can't have it, sv_clear */ DEBUG_PARSE_r({ - PerlIO_printf(Perl_debug_log, + PerlIO_printf(Perl_debug_log, "Required size %"IVdf" nodes\n" - "Starting second pass (creation)\n", + "Starting second pass (creation)\n", (IV)RExC_size); - RExC_lastnum=0; - RExC_lastparse=NULL; + RExC_lastnum=0; + RExC_lastparse=NULL; }); /* The first pass could have found things that force Unicode semantics */ @@ -5846,8 +6487,8 @@ Perl_re_op_compile(pTHX_ SV ** const pat if (RExC_whilem_seen > 15) RExC_whilem_seen = 15; - /* Allocate space and zero-initialize. Note, the two step process - of zeroing when in debug mode, thus anything assigned has to + /* Allocate space and zero-initialize. Note, the two step process + of zeroing when in debug mode, thus anything assigned has to happen after that */ rx = (REGEXP*) newSV_type(SVt_REGEXP); r = ReANY(rx); @@ -5857,10 +6498,11 @@ Perl_re_op_compile(pTHX_ SV ** const pat FAIL("Regexp out of space"); #ifdef DEBUGGING /* avoid reading uninitialized memory in DEBUGGING code in study_chunk() */ - Zero(ri, sizeof(regexp_internal) + (unsigned)RExC_size * sizeof(regnode), char); -#else + Zero(ri, sizeof(regexp_internal) + (unsigned)RExC_size * sizeof(regnode), + char); +#else /* bulk initialize base fields with 0. */ - Zero(ri, sizeof(regexp_internal), char); + Zero(ri, sizeof(regexp_internal), char); #endif /* non-zero initialization begins here */ @@ -5884,14 +6526,16 @@ Perl_re_op_compile(pTHX_ SV ** const pat { bool has_p = ((r->extflags & RXf_PMf_KEEPCOPY) == RXf_PMf_KEEPCOPY); - bool has_charset = (get_regex_charset(r->extflags) != REGEX_DEPENDS_CHARSET); + bool has_charset = (get_regex_charset(r->extflags) + != REGEX_DEPENDS_CHARSET); /* The caret is output if there are any defaults: if not all the STD * flags are set, or if no character set specifier is needed */ bool has_default = (((r->extflags & RXf_PMf_STD_PMMOD) != RXf_PMf_STD_PMMOD) || ! has_charset); - bool has_runon = ((RExC_seen & REG_SEEN_RUN_ON_COMMENT)==REG_SEEN_RUN_ON_COMMENT); + bool has_runon = ((RExC_seen & REG_RUN_ON_COMMENT_SEEN) + == REG_RUN_ON_COMMENT_SEEN); U16 reganch = (U16)((r->extflags & RXf_PMf_STD_PMMOD) >> RXf_PMf_STD_PMMOD_SHIFT); const char *fptr = STD_PAT_MODS; /*"msix"*/ @@ -5952,13 +6596,24 @@ Perl_re_op_compile(pTHX_ SV ** const pat r->intflags = 0; r->nparens = RExC_npar - 1; /* set early to validate backrefs */ - - if (RExC_seen & REG_SEEN_RECURSE) { + + /* setup various meta data about recursion, this all requires + * RExC_npar to be correctly set, and a bit later on we clear it */ + if (RExC_seen & REG_RECURSE_SEEN) { Newxz(RExC_open_parens, RExC_npar,regnode *); SAVEFREEPV(RExC_open_parens); Newxz(RExC_close_parens,RExC_npar,regnode *); SAVEFREEPV(RExC_close_parens); } + if (RExC_seen & (REG_RECURSE_SEEN | REG_GOSTART_SEEN)) { + /* Note, RExC_npar is 1 + the number of parens in a pattern. + * So its 1 if there are no parens. */ + RExC_study_chunk_recursed_bytes= (RExC_npar >> 3) + + ((RExC_npar & 0x07) != 0); + Newx(RExC_study_chunk_recursed, + RExC_study_chunk_recursed_bytes * RExC_npar, U8); + SAVEFREEPV(RExC_study_chunk_recursed); + } /* Useful during FAIL. */ #ifdef RE_TRACK_PATTERN_OFFSETS @@ -5987,8 +6642,8 @@ Perl_re_op_compile(pTHX_ SV ** const pat REGC((U8)REG_MAGIC, (char*) RExC_emit++); if (reg(pRExC_state, 0, &flags,1) == NULL) { - ReREFCNT_dec(rx); - Perl_croak(aTHX_ "panic: reg returned NULL to re_op_compile for generation pass, flags=%#X", flags); + ReREFCNT_dec(rx); + Perl_croak(aTHX_ "panic: reg returned NULL to re_op_compile for generation pass, flags=%#"UVxf"", (UV) flags); } /* XXXX To minimize changes to RE engine we always allocate 3-units-long substrs field. */ @@ -5999,8 +6654,11 @@ Perl_re_op_compile(pTHX_ SV ** const pat } reStudy: - r->minlen = minlen = sawlookahead = sawplus = sawopen = 0; + r->minlen = minlen = sawlookahead = sawplus = sawopen = sawminmod = 0; Zero(r->substrs, 1, struct reg_substr_data); + if (RExC_study_chunk_recursed) + Zero(RExC_study_chunk_recursed, + RExC_study_chunk_recursed_bytes * RExC_npar, U8); #ifdef TRIE_STUDY_OPT if (!restudied) { @@ -6009,22 +6667,22 @@ reStudy: } else { U32 seen=RExC_seen; DEBUG_OPTIMISE_r(PerlIO_printf(Perl_debug_log,"Restudying\n")); - + RExC_state = copyRExC_state; - if (seen & REG_TOP_LEVEL_BRANCHES) - RExC_seen |= REG_TOP_LEVEL_BRANCHES; + if (seen & REG_TOP_LEVEL_BRANCHES_SEEN) + RExC_seen |= REG_TOP_LEVEL_BRANCHES_SEEN; else - RExC_seen &= ~REG_TOP_LEVEL_BRANCHES; + RExC_seen &= ~REG_TOP_LEVEL_BRANCHES_SEEN; StructCopy(&zero_scan_data, &data, scan_data_t); } #else StructCopy(&zero_scan_data, &data, scan_data_t); -#endif +#endif /* Dig out information for optimizations. */ r->extflags = RExC_flags; /* was pm_op */ /*dmq: removed as part of de-PMOP: pm->op_pmflags = RExC_flags; */ - + if (UTF) SvUTF8_on(rx); /* Unicode in it? */ ri->regstclass = NULL; @@ -6034,20 +6692,21 @@ reStudy: /* testing for BRANCH here tells us whether there is "must appear" data in the pattern. If there is then we can use it for optimisations */ - if (!(RExC_seen & REG_TOP_LEVEL_BRANCHES)) { /* Only one top-level choice. */ - I32 fake; + if (!(RExC_seen & REG_TOP_LEVEL_BRANCHES_SEEN)) { /* Only one top-level choice. + */ + SSize_t fake; STRLEN longest_float_length, longest_fixed_length; - struct regnode_charclass_class ch_class; /* pointed to by data */ + regnode_ssc ch_class; /* pointed to by data */ int stclass_flag; - I32 last_close = 0; /* pointed to by data */ + SSize_t last_close = 0; /* pointed to by data */ regnode *first= scan; regnode *first_next= regnext(first); /* * Skip introductions and multiplicators >= 1 - * so that we can extract the 'meat' of the pattern that must + * so that we can extract the 'meat' of the pattern that must * match in the large if() sequence following. * NOTE that EXACT is NOT covered here, as it is normally - * picked up by the optimiser separately. + * picked up by the optimiser separately. * * This is unfortunate as the optimiser isnt handling lookahead * properly currently. @@ -6064,16 +6723,19 @@ reStudy: (PL_regkind[OP(first)] == CURLY && ARG1(first) > 0) || (OP(first) == NOTHING && PL_regkind[OP(first_next)] != END )) { - /* + /* * the only op that could be a regnode is PLUS, all the rest * will be regnode_1 or regnode_2. * + * (yves doesn't think this is true) */ if (OP(first) == PLUS) sawplus = 1; - else + else { + if (OP(first) == MINMOD) + sawminmod = 1; first += regarglen[OP(first)]; - + } first = NEXTOPER(first); first_next= regnext(first); } @@ -6090,7 +6752,7 @@ reStudy: } #ifdef TRIE_STCLASS else if (PL_regkind[OP(first)] == TRIE && - ((reg_trie_data *)ri->data->data[ ARG(first) ])->minlen>0) + ((reg_trie_data *)ri->data->data[ ARG(first) ])->minlen>0) { regnode *trie_op; /* this can happen only on restudy */ @@ -6116,35 +6778,35 @@ reStudy: PL_regkind[OP(first)] == NBOUND) ri->regstclass = first; else if (PL_regkind[OP(first)] == BOL) { - r->extflags |= (OP(first) == MBOL - ? RXf_ANCH_MBOL + r->intflags |= (OP(first) == MBOL + ? PREGf_ANCH_MBOL : (OP(first) == SBOL - ? RXf_ANCH_SBOL - : RXf_ANCH_BOL)); + ? PREGf_ANCH_SBOL + : PREGf_ANCH_BOL)); first = NEXTOPER(first); goto again; } else if (OP(first) == GPOS) { - r->extflags |= RXf_ANCH_GPOS; + r->intflags |= PREGf_ANCH_GPOS; first = NEXTOPER(first); goto again; } else if ((!sawopen || !RExC_sawback) && (OP(first) == STAR && PL_regkind[OP(NEXTOPER(first))] == REG_ANY) && - !(r->extflags & RXf_ANCH) && !pRExC_state->num_code_blocks) + !(r->intflags & PREGf_ANCH) && !pRExC_state->num_code_blocks) { /* turn .* into ^.* with an implied $*=1 */ const int type = (OP(NEXTOPER(first)) == REG_ANY) - ? RXf_ANCH_MBOL - : RXf_ANCH_SBOL; - r->extflags |= type; - r->intflags |= PREGf_IMPLICIT; + ? PREGf_ANCH_MBOL + : PREGf_ANCH_SBOL; + r->intflags |= (type | PREGf_IMPLICIT); first = NEXTOPER(first); goto again; } - if (sawplus && !sawlookahead && (!sawopen || !RExC_sawback) + if (sawplus && !sawminmod && !sawlookahead + && (!sawopen || !RExC_sawback) && !pRExC_state->num_code_blocks) /* May examine pos and $& */ /* x+ must match at the 1st pos of run of x's */ r->intflags |= PREGf_SKIP; @@ -6186,16 +6848,20 @@ reStudy: SAVEFREESV(data.last_found); first = scan; if (!ri->regstclass) { - cl_init(pRExC_state, &ch_class); + ssc_init(pRExC_state, &ch_class); data.start_class = &ch_class; stclass_flag = SCF_DO_STCLASS_AND; } else /* XXXX Check for BOUND? */ stclass_flag = 0; data.last_closep = &last_close; - - minlen = study_chunk(pRExC_state, &first, &minlen, &fake, scan + RExC_size, /* Up to end */ - &data, -1, NULL, NULL, - SCF_DO_SUBSTR | SCF_WHILEM_VISITED_POS | stclass_flag,0); + + DEBUG_RExC_seen(); + minlen = study_chunk(pRExC_state, &first, &minlen, &fake, + scan + RExC_size, /* Up to end */ + &data, -1, 0, NULL, + SCF_DO_SUBSTR | SCF_WHILEM_VISITED_POS | stclass_flag + | (restudied ? SCF_TRIE_DOING_RESTUDY : 0), + 0); CHECK_RESTUDY_GOTO_butfirst(LEAVE_with_name("study_chunk")); @@ -6204,9 +6870,11 @@ reStudy: if ( RExC_npar == 1 && data.longest == &(data.longest_fixed) && data.last_start_min == 0 && data.last_end > 0 && !RExC_seen_zerolen - && !(RExC_seen & REG_SEEN_VERBARG) - && (!(RExC_seen & REG_SEEN_GPOS) || (r->extflags & RXf_ANCH_GPOS))) + && !(RExC_seen & REG_VERBARG_SEEN) + && !(RExC_seen & REG_GPOS_SEEN) + ){ r->extflags |= RXf_CHECK_ALL; + } scan_commit(pRExC_state, &data,&minlen,0); longest_float_length = CHR_SVLEN(data.longest_float); @@ -6228,7 +6896,7 @@ reStudy: { r->float_min_offset = data.offset_float_min - data.lookbehind_float; r->float_max_offset = data.offset_float_max; - if (data.offset_float_max < I32_MAX) /* Don't offset infinity */ + if (data.offset_float_max < SSize_t_MAX) /* Don't offset infinity */ r->float_max_offset -= data.lookbehind_float; SvREFCNT_inc_simple_void_NN(data.longest_float); } @@ -6266,123 +6934,141 @@ reStudy: if ((!(r->anchored_substr || r->anchored_utf8) || r->anchored_offset) && stclass_flag - && ! TEST_SSC_EOS(data.start_class) - && !cl_is_anything(data.start_class)) + && ! (ANYOF_FLAGS(data.start_class) & ANYOF_EMPTY_STRING) + && !ssc_is_anything(data.start_class)) { - const U32 n = add_data(pRExC_state, 1, "f"); - OP(data.start_class) = ANYOF_SYNTHETIC; + const U32 n = add_data(pRExC_state, STR_WITH_LEN("f")); + + ssc_finalize(pRExC_state, data.start_class); - Newx(RExC_rxi->data->data[n], 1, - struct regnode_charclass_class); + Newx(RExC_rxi->data->data[n], 1, regnode_ssc); StructCopy(data.start_class, - (struct regnode_charclass_class*)RExC_rxi->data->data[n], - struct regnode_charclass_class); + (regnode_ssc*)RExC_rxi->data->data[n], + regnode_ssc); ri->regstclass = (regnode*)RExC_rxi->data->data[n]; r->intflags &= ~PREGf_SKIP; /* Used in find_byclass(). */ DEBUG_COMPILE_r({ SV *sv = sv_newmortal(); - regprop(r, sv, (regnode*)data.start_class); + regprop(r, sv, (regnode*)data.start_class, NULL); PerlIO_printf(Perl_debug_log, "synthetic stclass \"%s\".\n", SvPVX_const(sv));}); + data.start_class = NULL; } - /* A temporary algorithm prefers floated substr to fixed one to dig more info. */ + /* A temporary algorithm prefers floated substr to fixed one to dig + * more info. */ if (longest_fixed_length > longest_float_length) { + r->substrs->check_ix = 0; r->check_end_shift = r->anchored_end_shift; r->check_substr = r->anchored_substr; r->check_utf8 = r->anchored_utf8; r->check_offset_min = r->check_offset_max = r->anchored_offset; - if (r->extflags & RXf_ANCH_SINGLE) - r->extflags |= RXf_NOSCAN; + if (r->intflags & (PREGf_ANCH_SBOL|PREGf_ANCH_GPOS)) + r->intflags |= PREGf_NOSCAN; } else { + r->substrs->check_ix = 1; r->check_end_shift = r->float_end_shift; r->check_substr = r->float_substr; r->check_utf8 = r->float_utf8; r->check_offset_min = r->float_min_offset; r->check_offset_max = r->float_max_offset; } - /* XXXX Currently intuiting is not compatible with ANCH_GPOS. - This should be changed ASAP! */ - if ((r->check_substr || r->check_utf8) && !(r->extflags & RXf_ANCH_GPOS)) { + if ((r->check_substr || r->check_utf8) ) { r->extflags |= RXf_USE_INTUIT; if (SvTAIL(r->check_substr ? r->check_substr : r->check_utf8)) r->extflags |= RXf_INTUIT_TAIL; } + r->substrs->data[0].max_offset = r->substrs->data[0].min_offset; + /* XXX Unneeded? dmq (shouldn't as this is handled elsewhere) if ( (STRLEN)minlen < longest_float_length ) minlen= longest_float_length; if ( (STRLEN)minlen < longest_fixed_length ) - minlen= longest_fixed_length; + minlen= longest_fixed_length; */ } else { /* Several toplevels. Best we can is to set minlen. */ - I32 fake; - struct regnode_charclass_class ch_class; - I32 last_close = 0; + SSize_t fake; + regnode_ssc ch_class; + SSize_t last_close = 0; DEBUG_PARSE_r(PerlIO_printf(Perl_debug_log, "\nMulti Top Level\n")); scan = ri->program + 1; - cl_init(pRExC_state, &ch_class); + ssc_init(pRExC_state, &ch_class); data.start_class = &ch_class; data.last_closep = &last_close; - - minlen = study_chunk(pRExC_state, &scan, &minlen, &fake, scan + RExC_size, - &data, -1, NULL, NULL, SCF_DO_STCLASS_AND|SCF_WHILEM_VISITED_POS,0); - + DEBUG_RExC_seen(); + minlen = study_chunk(pRExC_state, + &scan, &minlen, &fake, scan + RExC_size, &data, -1, 0, NULL, + SCF_DO_STCLASS_AND|SCF_WHILEM_VISITED_POS|(restudied + ? SCF_TRIE_DOING_RESTUDY + : 0), + 0); + CHECK_RESTUDY_GOTO_butfirst(NOOP); r->check_substr = r->check_utf8 = r->anchored_substr = r->anchored_utf8 = r->float_substr = r->float_utf8 = NULL; - if (! TEST_SSC_EOS(data.start_class) - && !cl_is_anything(data.start_class)) - { - const U32 n = add_data(pRExC_state, 1, "f"); - OP(data.start_class) = ANYOF_SYNTHETIC; + if (! (ANYOF_FLAGS(data.start_class) & ANYOF_EMPTY_STRING) + && ! ssc_is_anything(data.start_class)) + { + const U32 n = add_data(pRExC_state, STR_WITH_LEN("f")); - Newx(RExC_rxi->data->data[n], 1, - struct regnode_charclass_class); + ssc_finalize(pRExC_state, data.start_class); + + Newx(RExC_rxi->data->data[n], 1, regnode_ssc); StructCopy(data.start_class, - (struct regnode_charclass_class*)RExC_rxi->data->data[n], - struct regnode_charclass_class); + (regnode_ssc*)RExC_rxi->data->data[n], + regnode_ssc); ri->regstclass = (regnode*)RExC_rxi->data->data[n]; r->intflags &= ~PREGf_SKIP; /* Used in find_byclass(). */ DEBUG_COMPILE_r({ SV* sv = sv_newmortal(); - regprop(r, sv, (regnode*)data.start_class); + regprop(r, sv, (regnode*)data.start_class, NULL); PerlIO_printf(Perl_debug_log, "synthetic stclass \"%s\".\n", SvPVX_const(sv));}); + data.start_class = NULL; } } + if (RExC_seen & REG_UNBOUNDED_QUANTIFIER_SEEN) { + r->extflags |= RXf_UNBOUNDED_QUANTIFIER_SEEN; + r->maxlen = REG_INFTY; + } + else { + r->maxlen = RExC_maxlen; + } + /* Guard against an embedded (?=) or (?<=) with a longer minlen than the "real" pattern. */ DEBUG_OPTIMISE_r({ - PerlIO_printf(Perl_debug_log,"minlen: %"IVdf" r->minlen:%"IVdf"\n", - (IV)minlen, (IV)r->minlen); + PerlIO_printf(Perl_debug_log,"minlen: %"IVdf" r->minlen:%"IVdf" maxlen:%ld\n", + (IV)minlen, (IV)r->minlen, RExC_maxlen); }); r->minlenret = minlen; - if (r->minlen < minlen) + if (r->minlen < minlen) r->minlen = minlen; - - if (RExC_seen & REG_SEEN_GPOS) - r->extflags |= RXf_GPOS_SEEN; - if (RExC_seen & REG_SEEN_LOOKBEHIND) - r->extflags |= RXf_NO_INPLACE_SUBST; /* inplace might break the lookbehind */ + + if (RExC_seen & REG_GPOS_SEEN) + r->intflags |= PREGf_GPOS_SEEN; + if (RExC_seen & REG_LOOKBEHIND_SEEN) + r->extflags |= RXf_NO_INPLACE_SUBST; /* inplace might break the + lookbehind */ if (pRExC_state->num_code_blocks) r->extflags |= RXf_EVAL_SEEN; - if (RExC_seen & REG_SEEN_CANY) - r->extflags |= RXf_CANY_SEEN; - if (RExC_seen & REG_SEEN_VERBARG) + if (RExC_seen & REG_CANY_SEEN) + r->intflags |= PREGf_CANY_SEEN; + if (RExC_seen & REG_VERBARG_SEEN) { r->intflags |= PREGf_VERBARG_SEEN; r->extflags |= RXf_NO_INPLACE_SUBST; /* don't understand this! Yves */ } - if (RExC_seen & REG_SEEN_CUTGROUP) + if (RExC_seen & REG_CUTGROUP_SEEN) r->intflags |= PREGf_CUTGROUP_SEEN; if (pm_flags & PMf_USE_RE_EVAL) r->intflags |= PREGf_USE_RE_EVAL; @@ -6391,7 +7077,20 @@ reStudy: else RXp_PAREN_NAMES(r) = NULL; + /* If we have seen an anchor in our pattern then we set the extflag RXf_IS_ANCHORED + * so it can be used in pp.c */ + if (r->intflags & PREGf_ANCH) + r->extflags |= RXf_IS_ANCHORED; + + { + /* this is used to identify "special" patterns that might result + * in Perl NOT calling the regex engine and instead doing the match "itself", + * particularly special cases in split//. By having the regex compiler + * do this pattern matching at a regop level (instead of by inspecting the pattern) + * we avoid weird issues with equivalent patterns resulting in different behavior, + * AND we allow non Perl engines to get the same optimizations by the setting the + * flags appropriately - Yves */ regnode *first = ri->program + 1; U8 fop = OP(first); regnode *next = NEXTOPER(first); @@ -6401,16 +7100,28 @@ reStudy: r->extflags |= RXf_NULL; else if (PL_regkind[fop] == BOL && nop == END) r->extflags |= RXf_START_ONLY; - else if (fop == PLUS && PL_regkind[nop] == POSIXD && FLAGS(next) == _CC_SPACE && OP(regnext(first)) == END) + else if (fop == PLUS + && PL_regkind[nop] == POSIXD && FLAGS(next) == _CC_SPACE + && OP(regnext(first)) == END) r->extflags |= RXf_WHITE; - else if ( r->extflags & RXf_SPLIT && fop == EXACT && STR_LEN(first) == 1 && *(STRING(first)) == ' ' && OP(regnext(first)) == END ) + else if ( r->extflags & RXf_SPLIT + && fop == EXACT + && STR_LEN(first) == 1 + && *(STRING(first)) == ' ' + && OP(regnext(first)) == END ) r->extflags |= (RXf_SKIPWHITE|RXf_WHITE); } + + if (RExC_contains_locale) { + RXp_EXTFLAGS(r) |= RXf_TAINTED; + } + #ifdef DEBUGGING if (RExC_paren_names) { - ri->name_list_idx = add_data( pRExC_state, 1, "a" ); - ri->data->data[ri->name_list_idx] = (void*)SvREFCNT_inc(RExC_paren_name_list); + ri->name_list_idx = add_data( pRExC_state, STR_WITH_LEN("a")); + ri->data->data[ri->name_list_idx] + = (void*)SvREFCNT_inc(RExC_paren_name_list); } else #endif ri->name_list_idx = 0; @@ -6425,15 +7136,17 @@ reStudy: /* assume we don't need to swap parens around before we match */ DEBUG_DUMP_r({ + DEBUG_RExC_seen(); PerlIO_printf(Perl_debug_log,"Final program:\n"); regdump(r); }); #ifdef RE_TRACK_PATTERN_OFFSETS DEBUG_OFFSETS_r(if (ri->u.offsets) { - const U32 len = ri->u.offsets[0]; - U32 i; + const STRLEN len = ri->u.offsets[0]; + STRLEN i; GET_RE_DEBUG_FLAGS_DECL; - PerlIO_printf(Perl_debug_log, "Offsets: [%"UVuf"]\n\t", (UV)ri->u.offsets[0]); + PerlIO_printf(Perl_debug_log, + "Offsets: [%"UVuf"]\n\t", (UV)ri->u.offsets[0]); for (i = 1; i <= len; i++) { if (ri->u.offsets[i*2-1] || ri->u.offsets[i*2]) PerlIO_printf(Perl_debug_log, "%"UVuf":%"UVuf"[%"UVuf"] ", @@ -6493,7 +7206,8 @@ Perl_reg_named_buff_iter(pTHX_ REGEXP * else if (flags & RXapif_NEXTKEY) return reg_named_buff_nextkey(rx, flags); else { - Perl_croak(aTHX_ "panic: Unknown flags %d in named_buff_iter", (int)flags); + Perl_croak(aTHX_ "panic: Unknown flags %d in named_buff_iter", + (int)flags); return NULL; } } @@ -6619,7 +7333,7 @@ Perl_reg_named_buff_scalar(pTHX_ REGEXP { SV *ret; AV *av; - I32 length; + SSize_t length; struct regexp *const rx = ReANY(r); PERL_ARGS_ASSERT_REG_NAMED_BUFF_SCALAR; @@ -6630,11 +7344,12 @@ Perl_reg_named_buff_scalar(pTHX_ REGEXP } else if (flags & RXapif_ONE) { ret = CALLREG_NAMED_BUFF_ALL(r, (flags | RXapif_REGNAMES)); av = MUTABLE_AV(SvRV(ret)); - length = av_len(av); + length = av_tindex(av); SvREFCNT_dec_NN(ret); return newSViv(length + 1); } else { - Perl_croak(aTHX_ "panic: Unknown flags %d in named_buff_scalar", (int)flags); + Perl_croak(aTHX_ "panic: Unknown flags %d in named_buff_scalar", + (int)flags); return NULL; } } @@ -6682,12 +7397,12 @@ Perl_reg_numbered_buff_fetch(pTHX_ REGEX { struct regexp *const rx = ReANY(r); char *s = NULL; - I32 i = 0; - I32 s1, t1; + SSize_t i = 0; + SSize_t s1, t1; I32 n = paren; PERL_ARGS_ASSERT_REG_NUMBERED_BUFF_FETCH; - + if ( n == RX_BUFF_IDX_CARET_PREMATCH || n == RX_BUFF_IDX_CARET_FULLMATCH || n == RX_BUFF_IDX_CARET_POSTMATCH @@ -6720,14 +7435,14 @@ Perl_reg_numbered_buff_fetch(pTHX_ REGEX i = rx->offs[0].start; s = rx->subbeg; } - else + else if ((n == RX_BUFF_IDX_POSTMATCH || n == RX_BUFF_IDX_CARET_POSTMATCH) && rx->offs[0].end != -1) { /* $', ${^POSTMATCH} */ s = rx->subbeg - rx->suboffset + rx->offs[0].end; i = rx->sublen + rx->suboffset - rx->offs[0].end; - } + } else if ( 0 <= n && n <= (I32)rx->nparens && (s1 = rx->offs[n].start) != -1 && @@ -6738,12 +7453,12 @@ Perl_reg_numbered_buff_fetch(pTHX_ REGEX s = rx->subbeg + s1 - rx->suboffset; } else { goto ret_undef; - } + } assert(s >= rx->subbeg); - assert(rx->sublen >= (s - rx->subbeg) + i ); + assert((STRLEN)rx->sublen >= (STRLEN)((s - rx->subbeg) + i) ); if (i >= 0) { -#if NO_TAINT_SUPPORT +#ifdef NO_TAINT_SUPPORT sv_setpvn(sv, s, i); #else const int oldtainted = TAINT_get; @@ -6751,7 +7466,7 @@ Perl_reg_numbered_buff_fetch(pTHX_ REGEX sv_setpvn(sv, s, i); TAINT_set(oldtainted); #endif - if ( (rx->extflags & RXf_CANY_SEEN) + if ( (rx->intflags & PREGf_CANY_SEEN) ? (RXp_MATCH_UTF8(rx) && (!i || is_utf8_string((U8*)s, i))) : (RXp_MATCH_UTF8(rx)) ) @@ -6776,7 +7491,7 @@ Perl_reg_numbered_buff_fetch(pTHX_ REGEX TAINT; SvTAINT(sv); } - } else + } else SvTAINTED_off(sv); } } else { @@ -6911,7 +7626,9 @@ S_reg_scan_name(pTHX_ RExC_state_t *pREx PERL_ARGS_ASSERT_REG_SCAN_NAME; - if (isIDFIRST_lazy_if(RExC_parse, UTF)) { + assert (RExC_parse <= RExC_end); + if (RExC_parse == RExC_end) NOOP; + else if (isIDFIRST_lazy_if(RExC_parse, UTF)) { /* skip IDFIRST by using do...while */ if (UTF) do { @@ -6922,7 +7639,8 @@ S_reg_scan_name(pTHX_ RExC_state_t *pREx RExC_parse++; } while (isWORDCHAR(*RExC_parse)); } else { - RExC_parse++; /* so the <- from the vFAIL is after the offending character */ + RExC_parse++; /* so the <- from the vFAIL is after the offending + character */ vFAIL("Group name must start with a non-digit word character"); } if ( flags ) { @@ -7002,11 +7720,12 @@ S_reg_scan_name(pTHX_ RExC_state_t *pREx /* This section of code defines the inversion list object and its methods. The * interfaces are highly subject to change, so as much as possible is static to * this file. An inversion list is here implemented as a malloc'd C UV array - * with some added info that is placed as UVs at the beginning in a header - * portion. An inversion list for Unicode is an array of code points, sorted - * by ordinal number. The zeroth element is the first code point in the list. - * The 1th element is the first element beyond that not in the list. In other - * words, the first range is + * as an SVt_INVLIST scalar. + * + * An inversion list for Unicode is an array of code points, sorted by ordinal + * number. The zeroth element is the first code point in the list. The 1th + * element is the first element beyond that not in the list. In other words, + * the first range is * invlist[0]..(invlist[1]-1) * The other ranges follow. Thus every element whose index is divisible by two * marks the beginning of a range that is in the list, and every element not @@ -7024,9 +7743,9 @@ S_reg_scan_name(pTHX_ RExC_state_t *pREx * Taking the complement (inverting) an inversion list is quite simple, if the * first element is 0, remove it; otherwise add a 0 element at the beginning. * This implementation reserves an element at the beginning of each inversion - * list to contain 0 when the list contains 0, and contains 1 otherwise. The - * actual beginning of the list is either that element if 0, or the next one if - * 1. + * list to always contain 0; there is an additional flag in the header which + * indicates if the list begins at the 0, or is offset to begin at the next + * element. * * More about inversion lists can be found in "Unicode Demystified" * Chapter 13 by Richard Gillam, published by Addison-Wesley. @@ -7041,32 +7760,31 @@ S_reg_scan_name(pTHX_ RExC_state_t *pREx * should eventually be made public */ /* The header definitions are in F */ -#define TO_INTERNAL_SIZE(x) (((x) + HEADER_LENGTH) * sizeof(UV)) -#define FROM_INTERNAL_SIZE(x) (((x)/ sizeof(UV)) - HEADER_LENGTH) - -#define INVLIST_INITIAL_LEN 10 PERL_STATIC_INLINE UV* S__invlist_array_init(pTHX_ SV* const invlist, const bool will_have_0) { /* Returns a pointer to the first element in the inversion list's array. * This is called upon initialization of an inversion list. Where the - * array begins depends on whether the list has the code point U+0000 - * in it or not. The other parameter tells it whether the code that - * follows this call is about to put a 0 in the inversion list or not. - * The first element is either the element with 0, if 0, or the next one, - * if 1 */ + * array begins depends on whether the list has the code point U+0000 in it + * or not. The other parameter tells it whether the code that follows this + * call is about to put a 0 in the inversion list or not. The first + * element is either the element reserved for 0, if TRUE, or the element + * after it, if FALSE */ - UV* zero = get_invlist_zero_addr(invlist); + bool* offset = get_invlist_offset_addr(invlist); + UV* zero_addr = (UV *) SvPVX(invlist); PERL_ARGS_ASSERT__INVLIST_ARRAY_INIT; /* Must be empty */ - assert(! *_get_invlist_len_addr(invlist)); + assert(! _invlist_len(invlist)); + + *zero_addr = 0; /* 1^1 = 0; 1^0 = 1 */ - *zero = 1 ^ will_have_0; - return zero + *zero; + *offset = 1 ^ will_have_0; + return zero_addr + *offset; } PERL_STATIC_INLINE UV* @@ -7080,53 +7798,44 @@ S_invlist_array(pTHX_ SV* const invlist) /* Must not be empty. If these fail, you probably didn't check for * being non-zero before trying to get the array */ - assert(*_get_invlist_len_addr(invlist)); - assert(*get_invlist_zero_addr(invlist) == 0 - || *get_invlist_zero_addr(invlist) == 1); - - /* The array begins either at the element reserved for zero if the - * list contains 0 (that element will be set to 0), or otherwise the next - * element (in which case the reserved element will be set to 1). */ - return (UV *) (get_invlist_zero_addr(invlist) - + *get_invlist_zero_addr(invlist)); + assert(_invlist_len(invlist)); + + /* The very first element always contains zero, The array begins either + * there, or if the inversion list is offset, at the element after it. + * The offset header field determines which; it contains 0 or 1 to indicate + * how much additionally to add */ + assert(0 == *(SvPVX(invlist))); + return ((UV *) SvPVX(invlist) + *get_invlist_offset_addr(invlist)); } PERL_STATIC_INLINE void -S_invlist_set_len(pTHX_ SV* const invlist, const UV len) +S_invlist_set_len(pTHX_ SV* const invlist, const UV len, const bool offset) { - /* Sets the current number of elements stored in the inversion list */ + /* Sets the current number of elements stored in the inversion list. + * Updates SvCUR correspondingly */ PERL_ARGS_ASSERT_INVLIST_SET_LEN; - *_get_invlist_len_addr(invlist) = len; + assert(SvTYPE(invlist) == SVt_INVLIST); - assert(len <= SvLEN(invlist)); - - SvCUR_set(invlist, TO_INTERNAL_SIZE(len)); - /* If the list contains U+0000, that element is part of the header, - * and should not be counted as part of the array. It will contain - * 0 in that case, and 1 otherwise. So we could flop 0=>1, 1=>0 and - * subtract: - * SvCUR_set(invlist, - * TO_INTERNAL_SIZE(len - * - (*get_invlist_zero_addr(inv_list) ^ 1))); - * But, this is only valid if len is not 0. The consequences of not doing - * this is that the memory allocation code may think that 1 more UV is - * being used than actually is, and so might do an unnecessary grow. That - * seems worth not bothering to make this the precise amount. - * - * Note that when inverting, SvCUR shouldn't change */ + SvCUR_set(invlist, + (len == 0) + ? 0 + : TO_INTERNAL_SIZE(len + offset)); + assert(SvLEN(invlist) == 0 || SvCUR(invlist) <= SvLEN(invlist)); } PERL_STATIC_INLINE IV* S_get_invlist_previous_index_addr(pTHX_ SV* invlist) { - /* Return the address of the UV that is reserved to hold the cached index + /* Return the address of the IV that is reserved to hold the cached index * */ PERL_ARGS_ASSERT_GET_INVLIST_PREVIOUS_INDEX_ADDR; - return (IV *) (SvPVX(invlist) + (INVLIST_PREVIOUS_INDEX_OFFSET * sizeof (UV))); + assert(SvTYPE(invlist) == SVt_INVLIST); + + return &(((XINVLIST*) SvANY(invlist))->prev_index); } PERL_STATIC_INLINE IV @@ -7159,27 +7868,18 @@ S_invlist_max(pTHX_ SV* const invlist) PERL_ARGS_ASSERT_INVLIST_MAX; + assert(SvTYPE(invlist) == SVt_INVLIST); + + /* Assumes worst case, in which the 0 element is not counted in the + * inversion list, so subtracts 1 for that */ return SvLEN(invlist) == 0 /* This happens under _new_invlist_C_array */ - ? _invlist_len(invlist) - : FROM_INTERNAL_SIZE(SvLEN(invlist)); + ? FROM_INTERNAL_SIZE(SvCUR(invlist)) - 1 + : FROM_INTERNAL_SIZE(SvLEN(invlist)) - 1; } -PERL_STATIC_INLINE UV* -S_get_invlist_zero_addr(pTHX_ SV* invlist) -{ - /* Return the address of the UV that is reserved to hold 0 if the inversion - * list contains 0. This has to be the last element of the heading, as the - * list proper starts with either it if 0, or the next element if not. - * (But we force it to contain either 0 or 1) */ - - PERL_ARGS_ASSERT_GET_INVLIST_ZERO_ADDR; - - return (UV *) (SvPVX(invlist) + (INVLIST_ZERO_OFFSET * sizeof (UV))); -} - -#ifndef PERL_IN_XSUB_RE -SV* -Perl__new_invlist(pTHX_ IV initial_size) +#ifndef PERL_IN_XSUB_RE +SV* +Perl__new_invlist(pTHX_ IV initial_size) { /* Return a pointer to a newly constructed inversion list, with enough @@ -7189,60 +7889,81 @@ Perl__new_invlist(pTHX_ IV initial_size) SV* new_list; if (initial_size < 0) { - initial_size = INVLIST_INITIAL_LEN; + initial_size = 10; } /* Allocate the initial space */ - new_list = newSV(TO_INTERNAL_SIZE(initial_size)); - invlist_set_len(new_list, 0); + new_list = newSV_type(SVt_INVLIST); - /* Force iterinit() to be used to get iteration to work */ - *get_invlist_iter_addr(new_list) = UV_MAX; + /* First 1 is in case the zero element isn't in the list; second 1 is for + * trailing NUL */ + SvGROW(new_list, TO_INTERNAL_SIZE(initial_size + 1) + 1); + invlist_set_len(new_list, 0, 0); - /* This should force a segfault if a method doesn't initialize this - * properly */ - *get_invlist_zero_addr(new_list) = UV_MAX; + /* Force iterinit() to be used to get iteration to work */ + *get_invlist_iter_addr(new_list) = (STRLEN) UV_MAX; *get_invlist_previous_index_addr(new_list) = 0; - *get_invlist_version_id_addr(new_list) = INVLIST_VERSION_ID; -#if HEADER_LENGTH != 5 -# error Need to regenerate INVLIST_VERSION_ID by running perl -E 'say int(rand 2**31-1)', and then changing the #if to the new length -#endif return new_list; } -#endif -STATIC SV* -S__new_invlist_C_array(pTHX_ UV* list) +SV* +Perl__new_invlist_C_array(pTHX_ const UV* const list) { /* Return a pointer to a newly constructed inversion list, initialized to * point to , which has to be in the exact correct inversion list * form, including internal fields. Thus this is a dangerous routine that - * should not be used in the wrong hands */ + * should not be used in the wrong hands. The passed in 'list' contains + * several header fields at the beginning that are not part of the + * inversion list body proper */ + + const STRLEN length = (STRLEN) list[0]; + const UV version_id = list[1]; + const bool offset = cBOOL(list[2]); +#define HEADER_LENGTH 3 + /* If any of the above changes in any way, you must change HEADER_LENGTH + * (if appropriate) and regenerate INVLIST_VERSION_ID by running + * perl -E 'say int(rand 2**31-1)' + */ +#define INVLIST_VERSION_ID 148565664 /* This is a combination of a version and + data structure type, so that one being + passed in can be validated to be an + inversion list of the correct vintage. + */ - SV* invlist = newSV_type(SVt_PV); + SV* invlist = newSV_type(SVt_INVLIST); PERL_ARGS_ASSERT__NEW_INVLIST_C_ARRAY; - SvPV_set(invlist, (char *) list); + if (version_id != INVLIST_VERSION_ID) { + Perl_croak(aTHX_ "panic: Incorrect version for previously generated inversion list"); + } + + /* The generated array passed in includes header elements that aren't part + * of the list proper, so start it just after them */ + SvPV_set(invlist, (char *) (list + HEADER_LENGTH)); + SvLEN_set(invlist, 0); /* Means we own the contents, and the system shouldn't touch it */ - SvCUR_set(invlist, TO_INTERNAL_SIZE(_invlist_len(invlist))); - if (*get_invlist_version_id_addr(invlist) != INVLIST_VERSION_ID) { - Perl_croak(aTHX_ "panic: Incorrect version for previously generated inversion list"); - } + *(get_invlist_offset_addr(invlist)) = offset; + + /* The 'length' passed to us is the physical number of elements in the + * inversion list. But if there is an offset the logical number is one + * less than that */ + invlist_set_len(invlist, length - offset, offset); - /* Initialize the iteration pointer. - * XXX This could be done at compile time in charclass_invlists.h, but I - * (khw) am not confident that the suffixes for specifying the C constant - * UV_MAX are portable, e.g. 'ull' on a 32 bit machine that is configured - * to use 64 bits; might need a Configure probe */ + invlist_set_previous_index(invlist, 0); + + /* Initialize the iteration pointer. */ invlist_iterfinish(invlist); + SvREADONLY_on(invlist); + return invlist; } +#endif /* ifndef PERL_IN_XSUB_RE */ STATIC void S_invlist_extend(pTHX_ SV* const invlist, const UV new_max) @@ -7251,7 +7972,11 @@ S_invlist_extend(pTHX_ SV* const invlist PERL_ARGS_ASSERT_INVLIST_EXTEND; - SvGROW((SV *)invlist, TO_INTERNAL_SIZE(new_max)); + assert(SvTYPE(invlist) == SVt_INVLIST); + + /* Add one to account for the zero element at the beginning which may not + * be counted by the calling parameters */ + SvGROW((SV *)invlist, TO_INTERNAL_SIZE(new_max + 1)); } PERL_STATIC_INLINE void @@ -7259,16 +7984,16 @@ S_invlist_trim(pTHX_ SV* const invlist) { PERL_ARGS_ASSERT_INVLIST_TRIM; + assert(SvTYPE(invlist) == SVt_INVLIST); + /* Change the length of the inversion list to how many entries it currently * has */ - SvPV_shrink_to_cur((SV *) invlist); } -#define _invlist_union_complement_2nd(a, b, output) _invlist_union_maybe_complement_2nd(a, b, TRUE, output) - STATIC void -S__append_range_to_invlist(pTHX_ SV* const invlist, const UV start, const UV end) +S__append_range_to_invlist(pTHX_ SV* const invlist, + const UV start, const UV end) { /* Subject to change or removal. Append the range from 'start' to 'end' at * the end of the inversion list. The range must be above any existing @@ -7277,11 +8002,13 @@ S__append_range_to_invlist(pTHX_ SV* con UV* array; UV max = invlist_max(invlist); UV len = _invlist_len(invlist); + bool offset; PERL_ARGS_ASSERT__APPEND_RANGE_TO_INVLIST; if (len == 0) { /* Empty lists must be initialized */ - array = _invlist_array_init(invlist, start == 0); + offset = start != 0; + array = _invlist_array_init(invlist, ! offset); } else { /* Here, the existing list is non-empty. The current max entry in the @@ -7296,14 +8023,15 @@ S__append_range_to_invlist(pTHX_ SV* con || ELEMENT_RANGE_MATCHES_INVLIST(final_element)) { Perl_croak(aTHX_ "panic: attempting to append to an inversion list, but wasn't at the end of the list, final=%"UVuf", start=%"UVuf", match=%c", - array[final_element], start, - ELEMENT_RANGE_MATCHES_INVLIST(final_element) ? 't' : 'f'); + array[final_element], start, + ELEMENT_RANGE_MATCHES_INVLIST(final_element) ? 't' : 'f'); } /* Here, it is a legal append. If the new range begins with the first * value not in the set, it is extending the set, so the new first * value not in the set is one greater than the newly extended range. * */ + offset = *get_invlist_offset_addr(invlist); if (array[final_element] == start) { if (end != UV_MAX) { array[final_element] = end + 1; @@ -7311,7 +8039,7 @@ S__append_range_to_invlist(pTHX_ SV* con else { /* But if the end is the maximum representable on the machine, * just let the range that this would extend to have no end */ - invlist_set_len(invlist, len - 1); + invlist_set_len(invlist, len - 1, offset); } return; } @@ -7321,16 +8049,18 @@ S__append_range_to_invlist(pTHX_ SV* con len += 2; /* Includes an element each for the start and end of range */ - /* If overflows the existing space, extend, which may cause the array to be - * moved */ + /* If wll overflow the existing space, extend, which may cause the array to + * be moved */ if (max < len) { invlist_extend(invlist, len); - invlist_set_len(invlist, len); /* Have to set len here to avoid assert - failure in invlist_array() */ + + /* Have to set len here to avoid assert failure in invlist_array() */ + invlist_set_len(invlist, len, offset); + array = invlist_array(invlist); } else { - invlist_set_len(invlist, len); + invlist_set_len(invlist, len, offset); } /* The next item on the list starts the range, the one after that is @@ -7342,7 +8072,7 @@ S__append_range_to_invlist(pTHX_ SV* con else { /* But if the end is the maximum representable on the machine, just let * the range have no end */ - invlist_set_len(invlist, len - 1); + invlist_set_len(invlist, len - 1, offset); } } @@ -7437,7 +8167,8 @@ Perl__invlist_search(pTHX_ SV* const inv } void -Perl__invlist_populate_swatch(pTHX_ SV* const invlist, const UV start, const UV end, U8* swatch) +Perl__invlist_populate_swatch(pTHX_ SV* const invlist, + const UV start, const UV end, U8* swatch) { /* populates a swatch of a swash the same way swatch_get() does in utf8.c, * but is used when the swash has an inversion list. This makes this much @@ -7530,14 +8261,16 @@ Perl__invlist_populate_swatch(pTHX_ SV* } void -Perl__invlist_union_maybe_complement_2nd(pTHX_ SV* const a, SV* const b, bool complement_b, SV** output) +Perl__invlist_union_maybe_complement_2nd(pTHX_ SV* const a, SV* const b, + const bool complement_b, SV** output) { /* Take the union of two inversion lists and point to it. *output * SHOULD BE DEFINED upon input, and if it points to one of the two lists, - * the reference count to that list will be decremented. The first list, - * , may be NULL, in which case a copy of the second list is returned. - * If is TRUE, the union is taken of the complement - * (inversion) of instead of b itself. + * the reference count to that list will be decremented if not already a + * temporary (mortal); otherwise *output will be made correspondingly + * mortal. The first list, , may be NULL, in which case a copy of the + * second list is returned. If is TRUE, the union is taken + * of the complement (inversion) of instead of b itself. * * The basis for this comes from "Unicode Demystified" Chapter 13 by * Richard Gillam, published by Addison-Wesley, and explained at some @@ -7552,8 +8285,8 @@ Perl__invlist_union_maybe_complement_2nd * return the larger of the input lists, but then outside code might need * to keep track of whether to free the input list or not */ - UV* array_a; /* a's array */ - UV* array_b; + const UV* array_a; /* a's array */ + const UV* array_b; UV len_a; /* length of a's array */ UV len_b; @@ -7578,9 +8311,13 @@ Perl__invlist_union_maybe_complement_2nd /* If either one is empty, the union is the other one */ if (a == NULL || ((len_a = _invlist_len(a)) == 0)) { + bool make_temp = FALSE; /* Should we mortalize the result? */ + if (*output == a) { if (a != NULL) { - SvREFCNT_dec_NN(a); + if (! (make_temp = cBOOL(SvTEMP(a)))) { + SvREFCNT_dec_NN(a); + } } } if (*output != b) { @@ -7589,18 +8326,27 @@ Perl__invlist_union_maybe_complement_2nd _invlist_invert(*output); } } /* else *output already = b; */ + + if (make_temp) { + sv_2mortal(*output); + } return; } else if ((len_b = _invlist_len(b)) == 0) { + bool make_temp = FALSE; if (*output == b) { - SvREFCNT_dec_NN(b); + if (! (make_temp = cBOOL(SvTEMP(b)))) { + SvREFCNT_dec_NN(b); + } } /* The complement of an empty list is a list that has everything in it, * so the union with includes everything too */ if (complement_b) { if (a == *output) { - SvREFCNT_dec_NN(a); + if (! (make_temp = cBOOL(SvTEMP(a)))) { + SvREFCNT_dec_NN(a); + } } *output = _new_invlist(1); _append_range_to_invlist(*output, 0, UV_MAX); @@ -7609,6 +8355,10 @@ Perl__invlist_union_maybe_complement_2nd *output = invlist_clone(a); } /* else *output already = a; */ + + if (make_temp) { + sv_2mortal(*output); + } return; } @@ -7621,23 +8371,17 @@ Perl__invlist_union_maybe_complement_2nd if (complement_b) { /* To complement, we invert: if the first element is 0, remove it. To - * do this, we just pretend the array starts one later, and clear the - * flag as we don't have to do anything else later */ + * do this, we just pretend the array starts one later */ if (array_b[0] == 0) { array_b++; len_b--; - complement_b = FALSE; } else { - /* But if the first element is not zero, we unshift a 0 before the - * array. The data structure reserves a space for that 0 (which - * should be a '1' right now), so physical shifting is unneeded, - * but temporarily change that element to 0. Before exiting the - * routine, we must restore the element to '1' */ + /* But if the first element is not zero, we pretend the list starts + * at the 0 that is always stored immediately before the array. */ array_b--; len_b++; - array_b[0] = 0; } } @@ -7733,7 +8477,7 @@ Perl__invlist_union_maybe_complement_2nd /* Set result to final length, which can change the pointer to array_u, so * re-find it */ if (len_u != _invlist_len(u)) { - invlist_set_len(u, len_u); + invlist_set_len(u, len_u, *get_invlist_offset_addr(u)); invlist_trim(u); array_u = invlist_array(u); } @@ -7754,29 +8498,36 @@ Perl__invlist_union_maybe_complement_2nd } } - /* If we've changed b, restore it */ - if (complement_b) { - array_b[0] = 1; - } - - /* We may be removing a reference to one of the inputs */ + /* We may be removing a reference to one of the inputs. If so, the output + * is made mortal if the input was. (Mortal SVs shouldn't have their ref + * count decremented) */ if (a == *output || b == *output) { assert(! invlist_is_iterating(*output)); - SvREFCNT_dec_NN(*output); + if ((SvTEMP(*output))) { + sv_2mortal(u); + } + else { + SvREFCNT_dec_NN(*output); + } } *output = u; + return; } void -Perl__invlist_intersection_maybe_complement_2nd(pTHX_ SV* const a, SV* const b, bool complement_b, SV** i) +Perl__invlist_intersection_maybe_complement_2nd(pTHX_ SV* const a, SV* const b, + const bool complement_b, SV** i) { /* Take the intersection of two inversion lists and point to it. *i * SHOULD BE DEFINED upon input, and if it points to one of the two lists, - * the reference count to that list will be decremented. - * If is TRUE, the result will be the intersection of - * and the complement (or inversion) of instead of directly. + * the reference count to that list will be decremented if not already a + * temporary (mortal); otherwise *i will be made correspondingly mortal. + * The first list, , may be NULL, in which case an empty list is + * returned. If is TRUE, the result will be the + * intersection of and the complement (or inversion) of instead of + * directly. * * The basis for this comes from "Unicode Demystified" Chapter 13 by * Richard Gillam, published by Addison-Wesley, and explained at some @@ -7787,8 +8538,8 @@ Perl__invlist_intersection_maybe_complem * union above */ - UV* array_a; /* a's array */ - UV* array_b; + const UV* array_a; /* a's array */ + const UV* array_b; UV len_a; /* length of a's array */ UV len_b; @@ -7812,8 +8563,9 @@ Perl__invlist_intersection_maybe_complem assert(a != b); /* Special case if either one is empty */ - len_a = _invlist_len(a); + len_a = (a == NULL) ? 0 : _invlist_len(a); if ((len_a == 0) || ((len_b = _invlist_len(b)) == 0)) { + bool make_temp = FALSE; if (len_a != 0 && complement_b) { @@ -7822,25 +8574,39 @@ Perl__invlist_intersection_maybe_complem * must be every possible code point. Thus the intersection is * simply 'a'. */ if (*i != a) { - *i = invlist_clone(a); - if (*i == b) { - SvREFCNT_dec_NN(b); + if (! (make_temp = cBOOL(SvTEMP(b)))) { + SvREFCNT_dec_NN(b); + } } + + *i = invlist_clone(a); } /* else *i is already 'a' */ + + if (make_temp) { + sv_2mortal(*i); + } return; } /* Here, 'a' or 'b' is empty and not using the complement of 'b'. The * intersection must be empty */ if (*i == a) { - SvREFCNT_dec_NN(a); + if (! (make_temp = cBOOL(SvTEMP(a)))) { + SvREFCNT_dec_NN(a); + } } else if (*i == b) { - SvREFCNT_dec_NN(b); + if (! (make_temp = cBOOL(SvTEMP(b)))) { + SvREFCNT_dec_NN(b); + } } *i = _new_invlist(0); + if (make_temp) { + sv_2mortal(*i); + } + return; } @@ -7853,23 +8619,17 @@ Perl__invlist_intersection_maybe_complem if (complement_b) { /* To complement, we invert: if the first element is 0, remove it. To - * do this, we just pretend the array starts one later, and clear the - * flag as we don't have to do anything else later */ + * do this, we just pretend the array starts one later */ if (array_b[0] == 0) { array_b++; len_b--; - complement_b = FALSE; } else { - /* But if the first element is not zero, we unshift a 0 before the - * array. The data structure reserves a space for that 0 (which - * should be a '1' right now), so physical shifting is unneeded, - * but temporarily change that element to 0. Before exiting the - * routine, we must restore the element to '1' */ + /* But if the first element is not zero, we pretend the list starts + * at the 0 that is always stored immediately before the array. */ array_b--; len_b++; - array_b[0] = 0; } } @@ -7951,7 +8711,8 @@ Perl__invlist_intersection_maybe_complem } /* The final length is what we've output so far plus what else is in the - * intersection. At most one of the subexpressions below will be non-zero */ + * intersection. At most one of the subexpressions below will be non-zero + * */ len_r = i_r; if (count >= 2) { len_r += (len_a - i_a) + (len_b - i_b); @@ -7960,7 +8721,7 @@ Perl__invlist_intersection_maybe_complem /* Set result to final length, which can change the pointer to array_r, so * re-find it */ if (len_r != _invlist_len(r)) { - invlist_set_len(r, len_r); + invlist_set_len(r, len_r, *get_invlist_offset_addr(r)); invlist_trim(r); array_r = invlist_array(r); } @@ -7976,18 +8737,21 @@ Perl__invlist_intersection_maybe_complem } } - /* If we've changed b, restore it */ - if (complement_b) { - array_b[0] = 1; - } - - /* We may be removing a reference to one of the inputs */ + /* We may be removing a reference to one of the inputs. If so, the output + * is made mortal if the input was. (Mortal SVs shouldn't have their ref + * count decremented) */ if (a == *i || b == *i) { assert(! invlist_is_iterating(*i)); - SvREFCNT_dec_NN(*i); + if (SvTEMP(*i)) { + sv_2mortal(r); + } + else { + SvREFCNT_dec_NN(*i); + } } *i = r; + return; } @@ -8034,6 +8798,35 @@ Perl__add_range_to_invlist(pTHX_ SV* inv return invlist; } +SV* +Perl__setup_canned_invlist(pTHX_ const STRLEN size, const UV element0, + UV** other_elements_ptr) +{ + /* Create and return an inversion list whose contents are to be populated + * by the caller. The caller gives the number of elements (in 'size') and + * the very first element ('element0'). This function will set + * '*other_elements_ptr' to an array of UVs, where the remaining elements + * are to be placed. + * + * Obviously there is some trust involved that the caller will properly + * fill in the other elements of the array. + * + * (The first element needs to be passed in, as the underlying code does + * things differently depending on whether it is zero or non-zero) */ + + SV* invlist = _new_invlist(size); + bool offset; + + PERL_ARGS_ASSERT__SETUP_CANNED_INVLIST; + + _append_range_to_invlist(invlist, element0, element0); + offset = *get_invlist_offset_addr(invlist); + + invlist_set_len(invlist, size, offset); + *other_elements_ptr = invlist_array(invlist) + 1; + return invlist; +} + #endif PERL_STATIC_INLINE SV* @@ -8049,66 +8842,19 @@ Perl__invlist_invert(pTHX_ SV* const inv * have a zero; removes it otherwise. As described above, the data * structure is set up so that this is very efficient */ - UV* len_pos = _get_invlist_len_addr(invlist); - PERL_ARGS_ASSERT__INVLIST_INVERT; assert(! invlist_is_iterating(invlist)); /* The inverse of matching nothing is matching everything */ - if (*len_pos == 0) { + if (_invlist_len(invlist) == 0) { _append_range_to_invlist(invlist, 0, UV_MAX); return; } - /* The exclusive or complents 0 to 1; and 1 to 0. If the result is 1, the - * zero element was a 0, so it is being removed, so the length decrements - * by 1; and vice-versa. SvCUR is unaffected */ - if (*get_invlist_zero_addr(invlist) ^= 1) { - (*len_pos)--; - } - else { - (*len_pos)++; - } + *get_invlist_offset_addr(invlist) = ! *get_invlist_offset_addr(invlist); } -void -Perl__invlist_invert_prop(pTHX_ SV* const invlist) -{ - /* Complement the input inversion list (which must be a Unicode property, - * all of which don't match above the Unicode maximum code point.) And - * Perl has chosen to not have the inversion match above that either. This - * adds a 0x110000 if the list didn't end with it, and removes it if it did - */ - - UV len; - UV* array; - - PERL_ARGS_ASSERT__INVLIST_INVERT_PROP; - - _invlist_invert(invlist); - - len = _invlist_len(invlist); - - if (len != 0) { /* If empty do nothing */ - array = invlist_array(invlist); - if (array[len - 1] != PERL_UNICODE_MAX + 1) { - /* Add 0x110000. First, grow if necessary */ - len++; - if (invlist_max(invlist) < len) { - invlist_extend(invlist, len); - array = invlist_array(invlist); - } - invlist_set_len(invlist, len); - array[len - 1] = PERL_UNICODE_MAX + 1; - } - else { /* Remove the 0x110000 */ - invlist_set_len(invlist, len - 1); - } - } - - return; -} #endif PERL_STATIC_INLINE SV* @@ -8116,22 +8862,24 @@ S_invlist_clone(pTHX_ SV* const invlist) { /* Return a new inversion list that is a copy of the input one, which is - * unchanged */ + * unchanged. The new list will not be mortal even if the old one was. */ /* Need to allocate extra space to accommodate Perl's addition of a * trailing NUL to SvPV's, since it thinks they are always strings */ SV* new_invlist = _new_invlist(_invlist_len(invlist) + 1); - STRLEN length = SvCUR(invlist); + STRLEN physical_length = SvCUR(invlist); + bool offset = *(get_invlist_offset_addr(invlist)); PERL_ARGS_ASSERT_INVLIST_CLONE; - SvCUR_set(new_invlist, length); /* This isn't done automatically */ - Copy(SvPVX(invlist), SvPVX(new_invlist), length, char); + *(get_invlist_offset_addr(new_invlist)) = offset; + invlist_set_len(new_invlist, _invlist_len(invlist), offset); + Copy(SvPVX(invlist), SvPVX(new_invlist), physical_length, char); return new_invlist; } -PERL_STATIC_INLINE UV* +PERL_STATIC_INLINE STRLEN* S_get_invlist_iter_addr(pTHX_ SV* invlist) { /* Return the address of the UV that contains the current iteration @@ -8139,17 +8887,9 @@ S_get_invlist_iter_addr(pTHX_ SV* invlis PERL_ARGS_ASSERT_GET_INVLIST_ITER_ADDR; - return (UV *) (SvPVX(invlist) + (INVLIST_ITER_OFFSET * sizeof (UV))); -} - -PERL_STATIC_INLINE UV* -S_get_invlist_version_id_addr(pTHX_ SV* invlist) -{ - /* Return the address of the UV that contains the version id. */ - - PERL_ARGS_ASSERT_GET_INVLIST_VERSION_ID_ADDR; + assert(SvTYPE(invlist) == SVt_INVLIST); - return (UV *) (SvPVX(invlist) + (INVLIST_VERSION_ID_OFFSET * sizeof (UV))); + return &(((XINVLIST*) SvANY(invlist))->iterator); } PERL_STATIC_INLINE void @@ -8173,7 +8913,7 @@ S_invlist_iterfinish(pTHX_ SV* invlist) PERL_ARGS_ASSERT_INVLIST_ITERFINISH; - *get_invlist_iter_addr(invlist) = UV_MAX; + *get_invlist_iter_addr(invlist) = (STRLEN) UV_MAX; } STATIC bool @@ -8186,14 +8926,14 @@ S_invlist_iternext(pTHX_ SV* invlist, UV * <*start> and <*end> are unchanged, and the next call to this function * will start over at the beginning of the list */ - UV* pos = get_invlist_iter_addr(invlist); + STRLEN* pos = get_invlist_iter_addr(invlist); UV len = _invlist_len(invlist); UV *array; PERL_ARGS_ASSERT_INVLIST_ITERNEXT; if (*pos >= len) { - *pos = UV_MAX; /* Force iterinit() to be required next time */ + *pos = (STRLEN) UV_MAX; /* Force iterinit() to be required next time */ return FALSE; } @@ -8216,7 +8956,7 @@ S_invlist_is_iterating(pTHX_ SV* const i { PERL_ARGS_ASSERT_INVLIST_IS_ITERATING; - return *(get_invlist_iter_addr(invlist)) < UV_MAX; + return *(get_invlist_iter_addr(invlist)) < (STRLEN) UV_MAX; } PERL_STATIC_INLINE UV @@ -8282,51 +9022,68 @@ Perl__invlist_contents(pTHX_ SV* const i } #endif -#ifdef PERL_ARGS_ASSERT__INVLIST_DUMP +#ifndef PERL_IN_XSUB_RE void -Perl__invlist_dump(pTHX_ SV* const invlist, const char * const header) +Perl__invlist_dump(pTHX_ PerlIO *file, I32 level, + const char * const indent, SV* const invlist) { - /* Dumps out the ranges in an inversion list. The string 'header' - * if present is output on a line before the first range */ + /* Designed to be called only by do_sv_dump(). Dumps out the ranges of the + * inversion list 'invlist' to 'file' at 'level' Each line is prefixed by + * the string 'indent'. The output looks like this: + [0] 0x000A .. 0x000D + [2] 0x0085 + [4] 0x2028 .. 0x2029 + [6] 0x3104 .. INFINITY + * This means that the first range of code points matched by the list are + * 0xA through 0xD; the second range contains only the single code point + * 0x85, etc. An inversion list is an array of UVs. Two array elements + * are used to define each range (except if the final range extends to + * infinity, only a single element is needed). The array index of the + * first element for the corresponding range is given in brackets. */ UV start, end; + STRLEN count = 0; PERL_ARGS_ASSERT__INVLIST_DUMP; - if (header && strlen(header)) { - PerlIO_printf(Perl_debug_log, "%s\n", header); - } if (invlist_is_iterating(invlist)) { - PerlIO_printf(Perl_debug_log, "Can't dump because is in middle of iterating\n"); + Perl_dump_indent(aTHX_ level, file, + "%sCan't dump inversion list because is in middle of iterating\n", + indent); return; } invlist_iterinit(invlist); while (invlist_iternext(invlist, &start, &end)) { if (end == UV_MAX) { - PerlIO_printf(Perl_debug_log, "0x%04"UVXf" .. INFINITY\n", start); + Perl_dump_indent(aTHX_ level, file, + "%s[%"UVuf"] 0x%04"UVXf" .. INFINITY\n", + indent, (UV)count, start); } else if (end != start) { - PerlIO_printf(Perl_debug_log, "0x%04"UVXf" .. 0x%04"UVXf"\n", - start, end); + Perl_dump_indent(aTHX_ level, file, + "%s[%"UVuf"] 0x%04"UVXf" .. 0x%04"UVXf"\n", + indent, (UV)count, start, end); } else { - PerlIO_printf(Perl_debug_log, "0x%04"UVXf"\n", start); + Perl_dump_indent(aTHX_ level, file, "%s[%"UVuf"] 0x%04"UVXf"\n", + indent, (UV)count, start); } + count += 2; } } #endif -#if 0 +#ifdef PERL_ARGS_ASSERT__INVLISTEQ bool -S__invlistEQ(pTHX_ SV* const a, SV* const b, bool complement_b) +S__invlistEQ(pTHX_ SV* const a, SV* const b, const bool complement_b) { /* Return a boolean as to if the two passed in inversion lists are * identical. The final argument, if TRUE, says to take the complement of * the second inversion list before doing the comparison */ - UV* array_a = invlist_array(a); - UV* array_b = invlist_array(b); + const UV* array_a = invlist_array(a); + const UV* array_b = invlist_array(b); UV len_a = _invlist_len(a); UV len_b = _invlist_len(b); @@ -8348,23 +9105,17 @@ S__invlistEQ(pTHX_ SV* const a, SV* cons /* Otherwise, to complement, we invert. Here, the first element is * 0, just remove it. To do this, we just pretend the array starts - * one later, and clear the flag as we don't have to do anything - * else later */ + * one later */ array_b++; len_b--; - complement_b = FALSE; } else { - /* But if the first element is not zero, we unshift a 0 before the - * array. The data structure reserves a space for that 0 (which - * should be a '1' right now), so physical shifting is unneeded, - * but temporarily change that element to 0. Before exiting the - * routine, we must restore the element to '1' */ + /* But if the first element is not zero, we pretend the list starts + * at the 0 that is always stored immediately before the array. */ array_b--; len_b++; - array_b[0] = 0; } } @@ -8381,27 +9132,19 @@ S__invlistEQ(pTHX_ SV* const a, SV* cons } } - if (complement_b) { - array_b[0] = 1; - } return retval; } #endif #undef HEADER_LENGTH -#undef INVLIST_INITIAL_LENGTH #undef TO_INTERNAL_SIZE #undef FROM_INTERNAL_SIZE -#undef INVLIST_LEN_OFFSET -#undef INVLIST_ZERO_OFFSET -#undef INVLIST_ITER_OFFSET #undef INVLIST_VERSION_ID -#undef INVLIST_PREVIOUS_INDEX_OFFSET /* End of inversion list object */ STATIC void -S_parse_lparen_question_flags(pTHX_ struct RExC_state_t *pRExC_state) +S_parse_lparen_question_flags(pTHX_ RExC_state_t *pRExC_state) { /* This parses the flags that are in either the '(?foo)' or '(?foo:bar)' * constructs, and updates RExC_flags with them. On input, RExC_parse @@ -8415,7 +9158,7 @@ S_parse_lparen_question_flags(pTHX_ stru #define WASTED_O 0x01 #define WASTED_G 0x02 #define WASTED_C 0x04 -#define WASTED_GC (0x02|0x04) +#define WASTED_GC (WASTED_G|WASTED_C) I32 wastedflags = 0x00; U32 posflags = 0, negflags = 0; U32 *flagsp = &posflags; @@ -8461,7 +9204,6 @@ S_parse_lparen_question_flags(pTHX_ stru } cs = REGEX_LOCALE_CHARSET; has_charset_modifier = LOCALE_PAT_MOD; - RExC_contains_locale = 1; break; case UNICODE_PAT_MOD: if (has_charset_modifier) { @@ -8515,7 +9257,8 @@ S_parse_lparen_question_flags(pTHX_ stru vFAIL2("Regexp modifier \"%c\" may appear a maximum of twice", ASCII_RESTRICT_PAT_MOD); } else if (has_charset_modifier == *(RExC_parse - 1)) { - vFAIL2("Regexp modifier \"%c\" may not appear twice", *(RExC_parse - 1)); + vFAIL2("Regexp modifier \"%c\" may not appear twice", + *(RExC_parse - 1)); } else { vFAIL3("Regexp modifiers \"%c\" and \"%c\" are mutually exclusive", has_charset_modifier, *(RExC_parse - 1)); @@ -8523,14 +9266,18 @@ S_parse_lparen_question_flags(pTHX_ stru /*NOTREACHED*/ neg_modifier: RExC_parse++; - vFAIL2("Regexp modifier \"%c\" may not appear after the \"-\"", *(RExC_parse - 1)); + vFAIL2("Regexp modifier \"%c\" may not appear after the \"-\"", + *(RExC_parse - 1)); /*NOTREACHED*/ case ONCE_PAT_MOD: /* 'o' */ case GLOBAL_PAT_MOD: /* 'g' */ if (SIZE_ONLY && ckWARN(WARN_REGEXP)) { - const I32 wflagbit = *RExC_parse == 'o' ? WASTED_O : WASTED_G; + const I32 wflagbit = *RExC_parse == 'o' + ? WASTED_O + : WASTED_G; if (! (wastedflags & wflagbit) ) { wastedflags |= wflagbit; + /* diag_listed_as: Useless (?-%s) - don't use /%s modifier in regex; marked by <-- HERE in m/%s/ */ vWARN5( RExC_parse + 1, "Useless (%s%c) - %suse /%c modifier", @@ -8547,6 +9294,7 @@ S_parse_lparen_question_flags(pTHX_ stru if (SIZE_ONLY && ckWARN(WARN_REGEXP)) { if (! (wastedflags & WASTED_C) ) { wastedflags |= WASTED_GC; + /* diag_listed_as: Useless (?-%s) - don't use /%s modifier in regex; marked by <-- HERE in m/%s/ */ vWARN3( RExC_parse + 1, "Useless (%sc) - %suse /gc modifier", @@ -8579,13 +9327,17 @@ S_parse_lparen_question_flags(pTHX_ stru RExC_flags |= posflags; RExC_flags &= ~negflags; set_regex_charset(&RExC_flags, cs); + if (RExC_flags & RXf_PMf_FOLD) { + RExC_contains_i = 1; + } return; /*NOTREACHED*/ default: fail_modifiers: - RExC_parse++; - vFAIL3("Sequence (%.*s...) not recognized", - RExC_parse-seqstart, seqstart); + RExC_parse += UTF ? UTF8SKIP(RExC_parse) : 1; + /* diag_listed_as: Sequence (?%s...) not recognized in regex; marked by <-- HERE in m/%s/ */ + vFAIL2utf8f("Sequence (%"UTF8f"...) not recognized", + UTF8fARG(UTF, RExC_parse-seqstart, seqstart)); /*NOTREACHED*/ } @@ -8660,7 +9412,8 @@ S_reg(pTHX_ RExC_state_t *pRExC_state, I char *start_arg = NULL; unsigned char op = 0; int argok = 1; - int internal_argval = 0; /* internal_argval is only useful if !argok */ + int internal_argval = 0; /* internal_argval is only useful if + !argok */ if (has_intervening_patws && SIZE_ONLY) { ckWARNregdep(RExC_parse + 1, "In '(*VERB...)', splitting the initial '(*' is deprecated"); @@ -8676,9 +9429,9 @@ S_reg(pTHX_ RExC_state_t *pRExC_state, I verb_len = RExC_parse - start_verb; if ( start_arg ) { RExC_parse++; - while ( *RExC_parse && *RExC_parse != ')' ) + while ( *RExC_parse && *RExC_parse != ')' ) RExC_parse++; - if ( *RExC_parse != ')' ) + if ( *RExC_parse != ')' ) vFAIL("Unterminated verb pattern argument"); if ( RExC_parse == start_arg ) start_arg = NULL; @@ -8686,7 +9439,7 @@ S_reg(pTHX_ RExC_state_t *pRExC_state, I if ( *RExC_parse != ')' ) vFAIL("Unterminated verb pattern"); } - + switch ( *start_verb ) { case 'A': /* (*ACCEPT) */ if ( memEQs(start_verb,verb_len,"ACCEPT") ) { @@ -8715,55 +9468,58 @@ S_reg(pTHX_ RExC_state_t *pRExC_state, I if ( memEQs(start_verb,verb_len,"PRUNE") ) op = PRUNE; break; - case 'S': /* (*SKIP) */ - if ( memEQs(start_verb,verb_len,"SKIP") ) + case 'S': /* (*SKIP) */ + if ( memEQs(start_verb,verb_len,"SKIP") ) op = SKIP; break; case 'T': /* (*THEN) */ /* [19:06] :: is then */ if ( memEQs(start_verb,verb_len,"THEN") ) { op = CUTGROUP; - RExC_seen |= REG_SEEN_CUTGROUP; + RExC_seen |= REG_CUTGROUP_SEEN; } break; } if ( ! op ) { - RExC_parse++; - vFAIL3("Unknown verb pattern '%.*s'", - verb_len, start_verb); + RExC_parse += UTF ? UTF8SKIP(RExC_parse) : 1; + vFAIL2utf8f( + "Unknown verb pattern '%"UTF8f"'", + UTF8fARG(UTF, verb_len, start_verb)); } if ( argok ) { if ( start_arg && internal_argval ) { vFAIL3("Verb pattern '%.*s' may not have an argument", - verb_len, start_verb); + verb_len, start_verb); } else if ( argok < 0 && !start_arg ) { vFAIL3("Verb pattern '%.*s' has a mandatory argument", - verb_len, start_verb); + verb_len, start_verb); } else { ret = reganode(pRExC_state, op, internal_argval); if ( ! internal_argval && ! SIZE_ONLY ) { if (start_arg) { - SV *sv = newSVpvn( start_arg, RExC_parse - start_arg); - ARG(ret) = add_data( pRExC_state, 1, "S" ); + SV *sv = newSVpvn( start_arg, + RExC_parse - start_arg); + ARG(ret) = add_data( pRExC_state, + STR_WITH_LEN("S")); RExC_rxi->data->data[ARG(ret)]=(void*)sv; ret->flags = 0; } else { - ret->flags = 1; + ret->flags = 1; } - } + } } if (!internal_argval) - RExC_seen |= REG_SEEN_VERBARG; + RExC_seen |= REG_VERBARG_SEEN; } else if ( start_arg ) { vFAIL3("Verb pattern '%.*s' may not have an argument", - verb_len, start_verb); + verb_len, start_verb); } else { ret = reg_node(pRExC_state, op); } nextchar(pRExC_state); return ret; - } else - if (*RExC_parse == '?') { /* (?...) */ + } + else if (*RExC_parse == '?') { /* (?...) */ bool is_logical = 0; const char * const seqstart = RExC_parse; if (has_intervening_patws && SIZE_ONLY) { @@ -8783,17 +9539,19 @@ S_reg(pTHX_ RExC_state_t *pRExC_state, I goto named_recursion; } else if (paren == '=') { /* (?P=...) named backref */ - /* this pretty much dupes the code for \k in regatom(), if - you change this make sure you change that */ + /* this pretty much dupes the code for \k in + * regatom(), if you change this make sure you change that + * */ char* name_start = RExC_parse; U32 num = 0; SV *sv_dat = reg_scan_name(pRExC_state, SIZE_ONLY ? REG_RSN_RETURN_NULL : REG_RSN_RETURN_DATA); if (RExC_parse == name_start || *RExC_parse != ')') + /* diag_listed_as: Sequence ?P=... not terminated in regex; marked by <-- HERE in m/%s/ */ vFAIL2("Sequence %.3s... not terminated",parse_start); if (!SIZE_ONLY) { - num = add_data( pRExC_state, 1, "S" ); + num = add_data( pRExC_state, STR_WITH_LEN("S")); RExC_rxi->data->data[num]=(void*)sv_dat; SvREFCNT_inc_simple_void(sv_dat); } @@ -8812,18 +9570,20 @@ S_reg(pTHX_ RExC_state_t *pRExC_state, I *flagp |= HASWIDTH; Set_Node_Offset(ret, parse_start+1); - Set_Node_Cur_Length(ret); /* MJD */ + Set_Node_Cur_Length(ret, parse_start); nextchar(pRExC_state); return ret; } RExC_parse++; - vFAIL3("Sequence (%.*s...) not recognized", RExC_parse-seqstart, seqstart); + /* diag_listed_as: Sequence (?%s...) not recognized in regex; marked by <-- HERE in m/%s/ */ + vFAIL3("Sequence (%.*s...) not recognized", + RExC_parse-seqstart, seqstart); /*NOTREACHED*/ case '<': /* (?<...) */ if (*RExC_parse == '!') paren = ','; - else if (*RExC_parse != '=') + else if (*RExC_parse != '=') named_capture: { /* (?<...>) */ char *name_start; @@ -8832,15 +9592,10 @@ S_reg(pTHX_ RExC_state_t *pRExC_state, I case '\'': /* (?'...') */ name_start= RExC_parse; svname = reg_scan_name(pRExC_state, - SIZE_ONLY ? /* reverse test from the others */ - REG_RSN_RETURN_NAME : - REG_RSN_RETURN_NULL); - if (RExC_parse == name_start) { - RExC_parse++; - vFAIL3("Sequence (%.*s...) not recognized", RExC_parse-seqstart, seqstart); - /*NOTREACHED*/ - } - if (*RExC_parse != paren) + SIZE_ONLY /* reverse test from the others */ + ? REG_RSN_RETURN_NAME + : REG_RSN_RETURN_NULL); + if (RExC_parse == name_start || *RExC_parse != paren) vFAIL2("Sequence (?%c... not terminated", paren=='>' ? '<' : paren); if (SIZE_ONLY) { @@ -8880,20 +9635,24 @@ S_reg(pTHX_ RExC_state_t *pRExC_state, I } } if ( count ) { - pv = (I32*)SvGROW(sv_dat, SvCUR(sv_dat) + sizeof(I32)+1); + pv = (I32*)SvGROW(sv_dat, + SvCUR(sv_dat) + sizeof(I32)+1); SvCUR_set(sv_dat, SvCUR(sv_dat) + sizeof(I32)); pv[count] = RExC_npar; SvIV_set(sv_dat, SvIVX(sv_dat) + 1); } } else { (void)SvUPGRADE(sv_dat,SVt_PVNV); - sv_setpvn(sv_dat, (char *)&(RExC_npar), sizeof(I32)); + sv_setpvn(sv_dat, (char *)&(RExC_npar), + sizeof(I32)); SvIOK_on(sv_dat); SvIV_set(sv_dat, 1); } #ifdef DEBUGGING - /* Yes this does cause a memory leak in debugging Perls */ - if (!av_store(RExC_paren_name_list, RExC_npar, SvREFCNT_inc(svname))) + /* Yes this does cause a memory leak in debugging Perls + * */ + if (!av_store(RExC_paren_name_list, + RExC_npar, SvREFCNT_inc(svname))) SvREFCNT_dec_NN(svname); #endif @@ -8903,7 +9662,7 @@ S_reg(pTHX_ RExC_state_t *pRExC_state, I paren = 1; goto capturing_parens; } - RExC_seen |= REG_SEEN_LOOKBEHIND; + RExC_seen |= REG_LOOKBEHIND_SEEN; RExC_in_lookbehind++; RExC_parse++; case '=': /* (?=...) */ @@ -8920,7 +9679,7 @@ S_reg(pTHX_ RExC_state_t *pRExC_state, I case '|': /* (?|...) */ /* branch reset, behave like a (?:...) except that buffers in alternations share the same numbers */ - paren = ':'; + paren = ':'; after_freeze = freeze_paren = RExC_npar; break; case ':': /* (?:...) */ @@ -8947,6 +9706,7 @@ S_reg(pTHX_ RExC_state_t *pRExC_state, I if (*RExC_parse != ')') FAIL("Sequence (?R) not terminated"); ret = reg_node(pRExC_state, GOSTART); + RExC_seen |= REG_GOSTART_SEEN; *flagp |= POSTPONED; nextchar(pRExC_state); return ret; @@ -8961,6 +9721,8 @@ S_reg(pTHX_ RExC_state_t *pRExC_state, I SIZE_ONLY ? REG_RSN_RETURN_NULL : REG_RSN_RETURN_DATA); num = sv_dat ? *((I32 *)SvPVX(sv_dat)) : 0; } + if (RExC_parse == RExC_end || *RExC_parse != ')') + vFAIL("Sequence (?&... not terminated"); goto gen_recurse_regop; assert(0); /* NOT REACHED */ case '+': @@ -8974,7 +9736,7 @@ S_reg(pTHX_ RExC_state_t *pRExC_state, I if (!(RExC_parse[0] >= '1' && RExC_parse[0] <= '9')) { RExC_parse--; /* rewind to let it be handled later */ goto parse_flags; - } + } /*FALLTHROUGH */ case '1': case '2': case '3': case '4': /* (?1) */ case '5': case '6': case '7': case '8': case '9': @@ -8986,7 +9748,7 @@ S_reg(pTHX_ RExC_state_t *pRExC_state, I RExC_parse++; while (isDIGIT(*RExC_parse)) RExC_parse++; - if (*RExC_parse!=')') + if (*RExC_parse!=')') vFAIL("Expecting close bracket"); gen_recurse_regop: @@ -9020,11 +9782,12 @@ S_reg(pTHX_ RExC_state_t *pRExC_state, I ARG2L_SET( ret, RExC_recurse_count++); RExC_emit++; DEBUG_OPTIMISE_MORE_r(PerlIO_printf(Perl_debug_log, - "Recurse #%"UVuf" to %"IVdf"\n", (UV)ARG(ret), (IV)ARG2L(ret))); + "Recurse #%"UVuf" to %"IVdf"\n", + (UV)ARG(ret), (IV)ARG2L(ret))); } else { RExC_size++; } - RExC_seen |= REG_SEEN_RECURSE; + RExC_seen |= REG_RECURSE_SEEN; Set_Node_Length(ret, 1 + regarglen[OP(ret)]); /* MJD */ Set_Node_Offset(ret, parse_start); /* MJD */ @@ -9038,7 +9801,10 @@ S_reg(pTHX_ RExC_state_t *pRExC_state, I is_logical = 1; if (*RExC_parse != '{') { RExC_parse++; - vFAIL3("Sequence (%.*s...) not recognized", RExC_parse-seqstart, seqstart); + /* diag_listed_as: Sequence (?%s...) not recognized in regex; marked by <-- HERE in m/%s/ */ + vFAIL2utf8f( + "Sequence (%"UTF8f"...) not recognized", + UTF8fARG(UTF, RExC_parse-seqstart, seqstart)); /*NOTREACHED*/ } *flagp |= POSTPONED; @@ -9067,14 +9833,14 @@ S_reg(pTHX_ RExC_state_t *pRExC_state, I if (!SIZE_ONLY) { OP *o = cb->block; if (cb->src_regex) { - n = add_data(pRExC_state, 2, "rl"); + n = add_data(pRExC_state, STR_WITH_LEN("rl")); RExC_rxi->data->data[n] = (void*)SvREFCNT_inc((SV*)cb->src_regex); RExC_rxi->data->data[n+1] = (void*)o; } else { - n = add_data(pRExC_state, 1, - (RExC_pm_flags & PMf_HAS_CV) ? "L" : "l"); + n = add_data(pRExC_state, + (RExC_pm_flags & PMf_HAS_CV) ? "L" : "l", 1); RExC_rxi->data->data[n] = (void*)o; } } @@ -9112,7 +9878,7 @@ S_reg(pTHX_ RExC_state_t *pRExC_state, I ret = reg_node(pRExC_state, LOGICAL); if (!SIZE_ONLY) ret->flags = 1; - + tail = reg(pRExC_state, 1, &flag, depth+1); if (flag & RESTART_UTF8) { *flagp = RESTART_UTF8; @@ -9135,7 +9901,7 @@ S_reg(pTHX_ RExC_state_t *pRExC_state, I (ch == '>' ? '<' : ch)); RExC_parse++; if (!SIZE_ONLY) { - num = add_data( pRExC_state, 1, "S" ); + num = add_data( pRExC_state, STR_WITH_LEN("S")); RExC_rxi->data->data[num]=(void*)sv_dat; SvREFCNT_inc_simple_void(sv_dat); } @@ -9165,15 +9931,18 @@ S_reg(pTHX_ RExC_state_t *pRExC_state, I SV *sv_dat; RExC_parse++; sv_dat = reg_scan_name(pRExC_state, - SIZE_ONLY ? REG_RSN_RETURN_NULL : REG_RSN_RETURN_DATA); + SIZE_ONLY + ? REG_RSN_RETURN_NULL + : REG_RSN_RETURN_DATA); parno = sv_dat ? *((I32 *)SvPVX(sv_dat)) : 0; } - ret = reganode(pRExC_state,INSUBP,parno); + ret = reganode(pRExC_state,INSUBP,parno); goto insert_if_check_paren; } else if (RExC_parse[0] >= '1' && RExC_parse[0] <= '9' ) { /* (?(1)...) */ char c; + char *tmp; parno = atoi(RExC_parse++); while (isDIGIT(*RExC_parse)) @@ -9181,8 +9950,14 @@ S_reg(pTHX_ RExC_state_t *pRExC_state, I ret = reganode(pRExC_state, GROUPP, parno); insert_if_check_paren: - if ((c = *nextchar(pRExC_state)) != ')') + if (*(tmp = nextchar(pRExC_state)) != ')') { + /* nextchar also skips comments, so undo its work + * and skip over the the next character. + */ + RExC_parse = tmp; + RExC_parse += UTF ? UTF8SKIP(RExC_parse) : 1; vFAIL("Switch condition not recognized"); + } insert_if: REGTAIL(pRExC_state, ret, reganode(pRExC_state, IFTHEN, 0)); br = regbranch(pRExC_state, &flags, 1,depth+1); @@ -9191,24 +9966,28 @@ S_reg(pTHX_ RExC_state_t *pRExC_state, I *flagp = RESTART_UTF8; return NULL; } - FAIL2("panic: regbranch returned NULL, flags=%#X", - flags); + FAIL2("panic: regbranch returned NULL, flags=%#"UVxf"", + (UV) flags); } else - REGTAIL(pRExC_state, br, reganode(pRExC_state, LONGJMP, 0)); + REGTAIL(pRExC_state, br, reganode(pRExC_state, + LONGJMP, 0)); c = *nextchar(pRExC_state); if (flags&HASWIDTH) *flagp |= HASWIDTH; if (c == '|') { - if (is_define) + if (is_define) vFAIL("(?(DEFINE)....) does not allow branches"); - lastbr = reganode(pRExC_state, IFTHEN, 0); /* Fake one for optimizer. */ + + /* Fake one for optimizer. */ + lastbr = reganode(pRExC_state, IFTHEN, 0); + if (!regbranch(pRExC_state, &flags, 1,depth+1)) { if (flags & RESTART_UTF8) { *flagp = RESTART_UTF8; return NULL; } - FAIL2("panic: regbranch returned NULL, flags=%#X", - flags); + FAIL2("panic: regbranch returned NULL, flags=%#"UVxf"", + (UV) flags); } REGTAIL(pRExC_state, ret, lastbr); if (flags&HASWIDTH) @@ -9233,7 +10012,8 @@ S_reg(pTHX_ RExC_state_t *pRExC_state, I return ret; } else { - vFAIL2("Unknown switch condition (?(%.2s", RExC_parse); + RExC_parse += UTF ? UTF8SKIP(RExC_parse) : 1; + vFAIL("Unknown switch condition (?(...))"); } } case '[': /* (?[ ... ]) */ @@ -9262,16 +10042,16 @@ S_reg(pTHX_ RExC_state_t *pRExC_state, I capturing_parens: parno = RExC_npar; RExC_npar++; - + ret = reganode(pRExC_state, OPEN, parno); if (!SIZE_ONLY ){ - if (!RExC_nestroot) + if (!RExC_nestroot) RExC_nestroot = parno; - if (RExC_seen & REG_SEEN_RECURSE + if (RExC_seen & REG_RECURSE_SEEN && !RExC_open_parens[parno-1]) { DEBUG_OPTIMISE_MORE_r(PerlIO_printf(Perl_debug_log, - "Setting open paren #%"IVdf" to %d\n", + "Setting open paren #%"IVdf" to %d\n", (IV)parno, REG_NODE_NUM(ret))); RExC_open_parens[parno-1]= ret; } @@ -9283,7 +10063,7 @@ S_reg(pTHX_ RExC_state_t *pRExC_state, I } else /* ! paren */ ret = NULL; - + parse_rest: /* Pick up the branches, linking them together. */ parse_start = RExC_parse; /* MJD */ @@ -9296,7 +10076,7 @@ S_reg(pTHX_ RExC_state_t *pRExC_state, I *flagp = RESTART_UTF8; return NULL; } - FAIL2("panic: regbranch returned NULL, flags=%#X", flags); + FAIL2("panic: regbranch returned NULL, flags=%#"UVxf"", (UV) flags); } if (*RExC_parse == '|') { if (!SIZE_ONLY && RExC_extralen) { @@ -9324,7 +10104,9 @@ S_reg(pTHX_ RExC_state_t *pRExC_state, I while (*RExC_parse == '|') { if (!SIZE_ONLY && RExC_extralen) { ender = reganode(pRExC_state, LONGJMP,0); - REGTAIL(pRExC_state, NEXTOPER(NEXTOPER(lastbr)), ender); /* Append to the previous. */ + + /* Append to the previous. */ + REGTAIL(pRExC_state, NEXTOPER(NEXTOPER(lastbr)), ender); } if (SIZE_ONLY) RExC_extralen += 2; /* Account for LONGJMP. */ @@ -9332,7 +10114,7 @@ S_reg(pTHX_ RExC_state_t *pRExC_state, I if (freeze_paren) { if (RExC_npar > after_freeze) after_freeze = RExC_npar; - RExC_npar = freeze_paren; + RExC_npar = freeze_paren; } br = regbranch(pRExC_state, &flags, 0, depth+1); @@ -9341,7 +10123,7 @@ S_reg(pTHX_ RExC_state_t *pRExC_state, I *flagp = RESTART_UTF8; return NULL; } - FAIL2("panic: regbranch returned NULL, flags=%#X", flags); + FAIL2("panic: regbranch returned NULL, flags=%#"UVxf"", (UV) flags); } REGTAIL(pRExC_state, lastbr, br); /* BRANCH -> BRANCH. */ lastbr = br; @@ -9356,14 +10138,14 @@ S_reg(pTHX_ RExC_state_t *pRExC_state, I break; case 1: case 2: ender = reganode(pRExC_state, CLOSE, parno); - if (!SIZE_ONLY && RExC_seen & REG_SEEN_RECURSE) { + if (!SIZE_ONLY && RExC_seen & REG_RECURSE_SEEN) { DEBUG_OPTIMISE_MORE_r(PerlIO_printf(Perl_debug_log, - "Setting close paren #%"IVdf" to %d\n", + "Setting close paren #%"IVdf" to %d\n", (IV)parno, REG_NODE_NUM(ender))); RExC_close_parens[parno-1]= ender; - if (RExC_nestroot == parno) + if (RExC_nestroot == parno) RExC_nestroot = 0; - } + } Set_Node_Offset(ender,RExC_parse+1); /* MJD */ Set_Node_Length(ender,1); /* MJD */ break; @@ -9388,8 +10170,8 @@ S_reg(pTHX_ RExC_state_t *pRExC_state, I SV * const mysv_val1=sv_newmortal(); SV * const mysv_val2=sv_newmortal(); DEBUG_PARSE_MSG("lsbr"); - regprop(RExC_rx, mysv_val1, lastbr); - regprop(RExC_rx, mysv_val2, ender); + regprop(RExC_rx, mysv_val1, lastbr, NULL); + regprop(RExC_rx, mysv_val2, ender, NULL); PerlIO_printf(Perl_debug_log, "~ tying lastbr %s (%"IVdf") to ender %s (%"IVdf") offset %"IVdf"\n", SvPV_nolen_const(mysv_val1), (IV)REG_NODE_NUM(lastbr), @@ -9403,20 +10185,22 @@ S_reg(pTHX_ RExC_state_t *pRExC_state, I if (have_branch && !SIZE_ONLY) { char is_nothing= 1; if (depth==1) - RExC_seen |= REG_TOP_LEVEL_BRANCHES; + RExC_seen |= REG_TOP_LEVEL_BRANCHES_SEEN; /* Hook the tails of the branches to the closing node. */ for (br = ret; br; br = regnext(br)) { const U8 op = PL_regkind[OP(br)]; if (op == BRANCH) { REGTAIL_STUDY(pRExC_state, NEXTOPER(br), ender); - if (OP(NEXTOPER(br)) != NOTHING || regnext(NEXTOPER(br)) != ender) + if ( OP(NEXTOPER(br)) != NOTHING + || regnext(NEXTOPER(br)) != ender) is_nothing= 0; } else if (op == BRANCHJ) { REGTAIL_STUDY(pRExC_state, NEXTOPER(NEXTOPER(br)), ender); /* for now we always disable this optimisation * / - if (OP(NEXTOPER(NEXTOPER(br))) != NOTHING || regnext(NEXTOPER(NEXTOPER(br))) != ender) + if ( OP(NEXTOPER(NEXTOPER(br))) != NOTHING + || regnext(NEXTOPER(NEXTOPER(br))) != ender) */ is_nothing= 0; } @@ -9427,8 +10211,8 @@ S_reg(pTHX_ RExC_state_t *pRExC_state, I SV * const mysv_val1=sv_newmortal(); SV * const mysv_val2=sv_newmortal(); DEBUG_PARSE_MSG("NADA"); - regprop(RExC_rx, mysv_val1, ret); - regprop(RExC_rx, mysv_val2, ender); + regprop(RExC_rx, mysv_val1, ret, NULL); + regprop(RExC_rx, mysv_val2, ender, NULL); PerlIO_printf(Perl_debug_log, "~ converting ret %s (%"IVdf") to ender %s (%"IVdf") offset %"IVdf"\n", SvPV_nolen_const(mysv_val1), (IV)REG_NODE_NUM(ret), @@ -9462,7 +10246,7 @@ S_reg(pTHX_ RExC_state_t *pRExC_state, I if (paren == '>') node = SUSPEND, flag = 0; reginsert(pRExC_state, node,ret, depth+1); - Set_Node_Cur_Length(ret); + Set_Node_Cur_Length(ret, parse_start); Set_Node_Offset(ret, parse_start + 1); ret->flags = flag; REGTAIL_STUDY(pRExC_state, ret, reg_node(pRExC_state, TAIL)); @@ -9546,7 +10330,7 @@ S_regbranch(pTHX_ RExC_state_t *pRExC_st *flagp = RESTART_UTF8; return NULL; } - FAIL2("panic: regpiece returned NULL, flags=%#X", flags); + FAIL2("panic: regpiece returned NULL, flags=%#"UVxf"", (UV) flags); } else if (ret == NULL) ret = latest; @@ -9616,7 +10400,7 @@ S_regpiece(pTHX_ RExC_state_t *pRExC_sta if (flags & (TRYAGAIN|RESTART_UTF8)) *flagp |= flags & (TRYAGAIN|RESTART_UTF8); else - FAIL2("panic: regatom returned NULL, flags=%#X", flags); + FAIL2("panic: regatom returned NULL, flags=%#"UVxf"", (UV) flags); return(NULL); } @@ -9670,13 +10454,26 @@ S_regpiece(pTHX_ RExC_state_t *pRExC_sta ret = reg_node(pRExC_state, OPFAIL); return ret; } + else if (min == max + && RExC_parse < RExC_end + && (*RExC_parse == '?' || *RExC_parse == '+')) + { + if (SIZE_ONLY) { + ckWARN2reg(RExC_parse + 1, + "Useless use of greediness modifier '%c'", + *RExC_parse); + } + /* Absorb the modifier, so later code doesn't see nor use + * it */ + nextchar(pRExC_state); + } do_curly: if ((flags&SIMPLE)) { RExC_naughty += 2 + RExC_naughty / 2; reginsert(pRExC_state, CURLY, ret, depth+1); Set_Node_Offset(ret, parse_start+1); /* MJD */ - Set_Node_Cur_Length(ret); + Set_Node_Cur_Length(ret, parse_start); } else { regnode * const w = reg_node(pRExC_state, WHILEM); @@ -9711,6 +10508,8 @@ S_regpiece(pTHX_ RExC_state_t *pRExC_sta ARG1_SET(ret, (U16)min); ARG2_SET(ret, (U16)max); } + if (max == REG_INFTY) + RExC_seen |= REG_UNBOUNDED_QUANTIFIER_SEEN; goto nest_check; } @@ -9748,6 +10547,7 @@ S_regpiece(pTHX_ RExC_state_t *pRExC_sta reginsert(pRExC_state, STAR, ret, depth+1); ret->flags = 0; RExC_naughty += 4; + RExC_seen |= REG_UNBOUNDED_QUANTIFIER_SEEN; } else if (op == '*') { min = 0; @@ -9757,6 +10557,7 @@ S_regpiece(pTHX_ RExC_state_t *pRExC_sta reginsert(pRExC_state, PLUS, ret, depth+1); ret->flags = 0; RExC_naughty += 3; + RExC_seen |= REG_UNBOUNDED_QUANTIFIER_SEEN; } else if (op == '+') { min = 1; @@ -9769,10 +10570,12 @@ S_regpiece(pTHX_ RExC_state_t *pRExC_sta nest_check: if (!SIZE_ONLY && !(flags&(HASWIDTH|POSTPONED)) && max > REG_INFTY/3) { SAVEFREESV(RExC_rx_sv); /* in case of fatal warnings */ - ckWARN3reg(RExC_parse, - "%.*s matches null string many times", - (int)(RExC_parse >= origparse ? RExC_parse - origparse : 0), - origparse); + ckWARN2reg(RExC_parse, + "%"UTF8f" matches null string many times", + UTF8fARG(UTF, (RExC_parse >= origparse + ? RExC_parse - origparse + : 0), + origparse)); (void)ReREFCNT_inc(RExC_rx_sv); } @@ -9781,9 +10584,7 @@ S_regpiece(pTHX_ RExC_state_t *pRExC_sta reginsert(pRExC_state, MINMOD, ret, depth+1); REGTAIL(pRExC_state, ret, ret + NODE_STEP_REGNODE); } -#ifndef REG_ALLOW_MINMOD_SUSPEND else -#endif if (RExC_parse < RExC_end && *RExC_parse == '+') { regnode *ender; nextchar(pRExC_state); @@ -9793,7 +10594,6 @@ S_regpiece(pTHX_ RExC_state_t *pRExC_sta ret->flags = 0; ender = reg_node(pRExC_state, TAIL); REGTAIL(pRExC_state, ret, ender); - /*ret= ender;*/ } if (RExC_parse < RExC_end && ISMULT2(RExC_parse)) { @@ -9805,11 +10605,12 @@ S_regpiece(pTHX_ RExC_state_t *pRExC_sta } STATIC bool -S_grok_bslash_N(pTHX_ RExC_state_t *pRExC_state, regnode** node_p, UV *valuep, I32 *flagp, U32 depth, bool in_char_class, - const bool strict /* Apply stricter parsing rules? */ +S_grok_bslash_N(pTHX_ RExC_state_t *pRExC_state, regnode** node_p, + UV *valuep, I32 *flagp, U32 depth, bool in_char_class, + const bool strict /* Apply stricter parsing rules? */ ) { - + /* This is expected to be called by a parser routine that has recognized '\N' and needs to handle the rest. RExC_parse is expected to point at the first char following the N at the time of the call. On successful return, @@ -9864,7 +10665,7 @@ S_grok_bslash_N(pTHX_ RExC_state_t *pREx more than one character */ GET_RE_DEBUG_FLAGS_DECL; - + PERL_ARGS_ASSERT_GROK_BSLASH_N; GET_RE_DEBUG_FLAGS; @@ -9872,7 +10673,8 @@ S_grok_bslash_N(pTHX_ RExC_state_t *pREx assert(cBOOL(node_p) ^ cBOOL(valuep)); /* Exactly one should be set */ /* The [^\n] meaning of \N ignores spaces and comments under the /x - * modifier. The other meaning does not */ + * modifier. The other meaning does not, so use a temporary until we find + * out which we are being called with */ p = (RExC_flags & RXf_PMf_EXTENDED) ? regwhite( pRExC_state, RExC_parse ) : RExC_parse; @@ -9882,17 +10684,18 @@ S_grok_bslash_N(pTHX_ RExC_state_t *pREx if (*p != '{' || regcurly(p, FALSE)) { RExC_parse = p; if (! node_p) { - /* no bare \N in a charclass */ + /* no bare \N allowed in a charclass */ if (in_char_class) { vFAIL("\\N in a character class must be a named character: \\N{...}"); } return FALSE; } + RExC_parse--; /* Need to back off so nextchar() doesn't skip the + current char */ nextchar(pRExC_state); *node_p = reg_node(pRExC_state, REG_ANY); *flagp |= HASWIDTH|SIMPLE; RExC_naughty++; - RExC_parse--; Set_Node_Length(*node_p, 1); /* MJD */ return TRUE; } @@ -9911,8 +10714,10 @@ S_grok_bslash_N(pTHX_ RExC_state_t *pREx if (! (endbrace = strchr(RExC_parse, '}')) /* no trailing brace */ || ! (endbrace == RExC_parse /* nothing between the {} */ - || (endbrace - RExC_parse >= 2 /* U+ (bad hex is checked below */ - && strnEQ(RExC_parse, "U+", 2)))) /* for a better error msg) */ + || (endbrace - RExC_parse >= 2 /* U+ (bad hex is checked below + */ + && strnEQ(RExC_parse, "U+", 2)))) /* for a better error msg) + */ { if (endbrace) RExC_parse = endbrace; /* position msg's '<--HERE' */ vFAIL("\\N{NAME} must be resolved by the lexer"); @@ -10048,9 +10853,9 @@ S_grok_bslash_N(pTHX_ RExC_state_t *pREx *flagp = RESTART_UTF8; return FALSE; } - FAIL2("panic: reg returned NULL to grok_bslash_N, flags=%#X", - flags); - } + FAIL2("panic: reg returned NULL to grok_bslash_N, flags=%#"UVxf"", + (UV) flags); + } *flagp |= flags&(HASWIDTH|SPSTART|SIMPLE|POSTPONED); RExC_parse = endbrace; @@ -10118,7 +10923,9 @@ S_compute_EXACTish(pTHX_ RExC_state_t *p } PERL_STATIC_INLINE void -S_alloc_maybe_populate_EXACT(pTHX_ RExC_state_t *pRExC_state, regnode *node, I32* flagp, STRLEN len, UV code_point) +S_alloc_maybe_populate_EXACT(pTHX_ RExC_state_t *pRExC_state, + regnode *node, I32* flagp, STRLEN len, UV code_point, + bool downgradable) { /* This knows the details about sizing an EXACTish node, setting flags for * it (by setting <*flagp>, and potentially populating it with a single @@ -10133,48 +10940,117 @@ S_alloc_maybe_populate_EXACT(pTHX_ RExC_ * If is zero, the function assumes that the node is to contain only * the single character given by and calculates what * should be. In pass 1, it sizes the node appropriately. In pass 2, it - * additionally will populate the node's STRING with , if - * is 0. In both cases <*flagp> is appropriately set + * additionally will populate the node's STRING with or its + * fold if folding. + * + * In both cases <*flagp> is appropriately set * * It knows that under FOLD, the Latin Sharp S and UTF characters above * 255, must be folded (the former only when the rules indicate it can - * match 'ss') */ + * match 'ss') + * + * When it does the populating, it looks at the flag 'downgradable'. If + * true with a node that folds, it checks if the single code point + * participates in a fold, and if not downgrades the node to an EXACT. + * This helps the optimizer */ bool len_passed_in = cBOOL(len != 0); U8 character[UTF8_MAXBYTES_CASE+1]; PERL_ARGS_ASSERT_ALLOC_MAYBE_POPULATE_EXACT; + /* Don't bother to check for downgrading in PASS1, as it doesn't make any + * sizing difference, and is extra work that is thrown away */ + if (downgradable && ! PASS2) { + downgradable = FALSE; + } + if (! len_passed_in) { if (UTF) { - if (FOLD && (! LOC || code_point > 255)) { - _to_uni_fold_flags(NATIVE_TO_UNI(code_point), + if (UNI_IS_INVARIANT(code_point)) { + if (LOC || ! FOLD) { /* /l defers folding until runtime */ + *character = (U8) code_point; + } + else { /* Here is /i and not /l (toFOLD() is defined on just + ASCII, which isn't the same thing as INVARIANT on + EBCDIC, but it works there, as the extra invariants + fold to themselves) */ + *character = toFOLD((U8) code_point); + + /* We can downgrade to an EXACT node if this character + * isn't a folding one. Note that this assumes that + * nothing above Latin1 folds to some other invariant than + * one of these alphabetics; otherwise we would also have + * to check: + * && (! HAS_NONLATIN1_FOLD_CLOSURE(code_point) + * || ASCII_FOLD_RESTRICTED)) + */ + if (downgradable && PL_fold[code_point] == code_point) { + OP(node) = EXACT; + } + } + len = 1; + } + else if (FOLD && (! LOC + || ! is_PROBLEMATIC_LOCALE_FOLD_cp(code_point))) + { /* Folding, and ok to do so now */ + UV folded = _to_uni_fold_flags( + code_point, character, &len, - FOLD_FLAGS_FULL | ((LOC) - ? FOLD_FLAGS_LOCALE - : (ASCII_FOLD_RESTRICTED) - ? FOLD_FLAGS_NOMIX_ASCII - : 0)); + FOLD_FLAGS_FULL | ((ASCII_FOLD_RESTRICTED) + ? FOLD_FLAGS_NOMIX_ASCII + : 0)); + if (downgradable + && folded == code_point + && ! _invlist_contains_cp(PL_utf8_foldable, code_point)) + { + OP(node) = EXACT; + } + } + else if (code_point <= MAX_UTF8_TWO_BYTE) { + + /* Not folding this cp, and can output it directly */ + *character = UTF8_TWO_BYTE_HI(code_point); + *(character + 1) = UTF8_TWO_BYTE_LO(code_point); + len = 2; } else { uvchr_to_utf8( character, code_point); len = UTF8SKIP(character); } - } - else if (! FOLD - || code_point != LATIN_SMALL_LETTER_SHARP_S - || ASCII_FOLD_RESTRICTED - || ! AT_LEAST_UNI_SEMANTICS) - { + } /* Else pattern isn't UTF8. */ + else if (! FOLD) { *character = (U8) code_point; len = 1; - } - else { + } /* Else is folded non-UTF8 */ + else if (LIKELY(code_point != LATIN_SMALL_LETTER_SHARP_S)) { + + /* We don't fold any non-UTF8 except possibly the Sharp s (see + * comments at join_exact()); */ + *character = (U8) code_point; + len = 1; + + /* Can turn into an EXACT node if we know the fold at compile time, + * and it folds to itself and doesn't particpate in other folds */ + if (downgradable + && ! LOC + && PL_fold_latin1[code_point] == code_point + && (! HAS_NONLATIN1_FOLD_CLOSURE(code_point) + || (isASCII(code_point) && ASCII_FOLD_RESTRICTED))) + { + OP(node) = EXACT; + } + } /* else is Sharp s. May need to fold it */ + else if (AT_LEAST_UNI_SEMANTICS && ! ASCII_FOLD_RESTRICTED) { *character = 's'; *(character + 1) = 's'; len = 2; } + else { + *character = LATIN_SMALL_LETTER_SHARP_S; + len = 1; + } } if (SIZE_ONLY) { @@ -10198,8 +11074,29 @@ S_alloc_maybe_populate_EXACT(pTHX_ RExC_ { *flagp |= SIMPLE; } + + /* The OP may not be well defined in PASS1 */ + if (PASS2 && OP(node) == EXACTFL) { + RExC_contains_locale = 1; + } +} + + +/* return atoi(p), unless it's too big to sensibly be a backref, + * in which case return I32_MAX (rather than possibly 32-bit wrapping) */ + +static I32 +S_backref_value(char *p) +{ + char *q = p; + + for (;isDIGIT(*q); q++); /* calculate length of num */ + if (q - p == 0 || q - p > 9) + return I32_MAX; + return atoi(p); } + /* - regatom - the lowest level @@ -10260,7 +11157,7 @@ S_alloc_maybe_populate_EXACT(pTHX_ RExC_ by the other. Returns NULL, setting *flagp to TRYAGAIN if reg() returns NULL with - TRYAGAIN. + TRYAGAIN. Returns NULL, setting *flagp to RESTART_UTF8 if the sizing scan needs to be restarted. Otherwise does not return NULL. @@ -10334,8 +11231,8 @@ tryagain: if (ret == NULL) { if (*flagp & RESTART_UTF8) return NULL; - FAIL2("panic: regclass returned NULL to regatom, flags=%#X", - *flagp); + FAIL2("panic: regclass returned NULL to regatom, flags=%#"UVxf"", + (UV) *flagp); } nextchar(pRExC_state); Set_Node_Length(ret, RExC_parse - oregcomp_parse + 1); /* MJD */ @@ -10357,7 +11254,8 @@ tryagain: *flagp = RESTART_UTF8; return NULL; } - FAIL2("panic: reg returned NULL to regatom, flags=%#X", flags); + FAIL2("panic: reg returned NULL to regatom, flags=%#"UVxf"", + (UV) flags); } *flagp |= flags&(HASWIDTH|SPSTART|SIMPLE|POSTPONED); break; @@ -10405,7 +11303,7 @@ tryagain: goto finish_meta_pat; case 'G': ret = reg_node(pRExC_state, GPOS); - RExC_seen |= REG_SEEN_GPOS; + RExC_seen |= REG_GPOS_SEEN; *flagp |= SIMPLE; goto finish_meta_pat; case 'K': @@ -10416,7 +11314,7 @@ tryagain: * be necessary here to avoid cases of memory corruption, as * with: C<$_="x" x 80; s/x\K/y/> -- rgs */ - RExC_seen |= REG_SEEN_LOOKBEHIND; + RExC_seen |= REG_LOOKBEHIND_SEEN; goto finish_meta_pat; case 'Z': ret = reg_node(pRExC_state, SEOL); @@ -10430,7 +11328,7 @@ tryagain: goto finish_meta_pat; case 'C': ret = reg_node(pRExC_state, CANY); - RExC_seen |= REG_SEEN_CANY; + RExC_seen |= REG_CANY_SEEN; *flagp |= HASWIDTH|SIMPLE; goto finish_meta_pat; case 'X': @@ -10447,30 +11345,38 @@ tryagain: case 'b': RExC_seen_zerolen++; - RExC_seen |= REG_SEEN_LOOKBEHIND; + RExC_seen |= REG_LOOKBEHIND_SEEN; op = BOUND + get_regex_charset(RExC_flags); if (op > BOUNDA) { /* /aa is same as /a */ op = BOUNDA; } + else if (op == BOUNDL) { + RExC_contains_locale = 1; + } ret = reg_node(pRExC_state, op); FLAGS(ret) = get_regex_charset(RExC_flags); *flagp |= SIMPLE; if (! SIZE_ONLY && (U8) *(RExC_parse + 1) == '{') { - ckWARNdep(RExC_parse, "\"\\b{\" is deprecated; use \"\\b\\{\" or \"\\b[{]\" instead"); + /* diag_listed_as: Use "%s" instead of "%s" */ + vFAIL("Use \"\\b\\{\" instead of \"\\b{\""); } goto finish_meta_pat; case 'B': RExC_seen_zerolen++; - RExC_seen |= REG_SEEN_LOOKBEHIND; + RExC_seen |= REG_LOOKBEHIND_SEEN; op = NBOUND + get_regex_charset(RExC_flags); if (op > NBOUNDA) { /* /aa is same as /a */ op = NBOUNDA; } + else if (op == NBOUNDL) { + RExC_contains_locale = 1; + } ret = reg_node(pRExC_state, op); FLAGS(ret) = get_regex_charset(RExC_flags); *flagp |= SIMPLE; if (! SIZE_ONLY && (U8) *(RExC_parse + 1) == '{') { - ckWARNdep(RExC_parse, "\"\\B{\" is deprecated; use \"\\B\\{\" or \"\\B[{]\" instead"); + /* diag_listed_as: Use "%s" instead of "%s" */ + vFAIL("Use \"\\B\\{\" instead of \"\\B{\""); } goto finish_meta_pat; @@ -10514,6 +11420,9 @@ tryagain: if (op > POSIXA) { /* /aa is same as /a */ op = POSIXA; } + else if (op == POSIXL) { + RExC_contains_locale = 1; + } join_posix_op_known: @@ -10529,10 +11438,10 @@ tryagain: *flagp |= HASWIDTH|SIMPLE; /* FALL THROUGH */ - finish_meta_pat: + finish_meta_pat: nextchar(pRExC_state); Set_Node_Length(ret, 2); /* MJD */ - break; + break; case 'p': case 'P': { @@ -10552,17 +11461,17 @@ tryagain: /* regclass() can only return RESTART_UTF8 if multi-char folds are allowed. */ if (!ret) - FAIL2("panic: regclass returned NULL to regatom, flags=%#X", - *flagp); + FAIL2("panic: regclass returned NULL to regatom, flags=%#"UVxf"", + (UV) *flagp); RExC_parse--; Set_Node_Offset(ret, parse_start + 2); - Set_Node_Cur_Length(ret); + Set_Node_Cur_Length(ret, parse_start); nextchar(pRExC_state); } break; - case 'N': + case 'N': /* Handle \N and \N{NAME} with multiple code points here and not * below because it can be multicharacter. join_exact() will join * them up later on. Also this makes sure that things like @@ -10584,10 +11493,11 @@ tryagain: break; case 'k': /* Handle \k and \k'NAME' */ parse_named_seq: - { - char ch= RExC_parse[1]; + { + char ch= RExC_parse[1]; if (ch != '<' && ch != '\'' && ch != '{') { RExC_parse++; + /* diag_listed_as: Sequence \%s... not terminated in regex; marked by <-- HERE in m/%s/ */ vFAIL2("Sequence %.2s... not terminated",parse_start); } else { /* this pretty much dupes the code for (?P=...) in reg(), if @@ -10598,10 +11508,11 @@ tryagain: SIZE_ONLY ? REG_RSN_RETURN_NULL : REG_RSN_RETURN_DATA); ch= (ch == '<') ? '>' : (ch == '{') ? '}' : '\''; if (RExC_parse == name_start || *RExC_parse != ch) + /* diag_listed_as: Sequence \%s... not terminated in regex; marked by <-- HERE in m/%s/ */ vFAIL2("Sequence %.3s... not terminated",parse_start); if (!SIZE_ONLY) { - num = add_data( pRExC_state, 1, "S" ); + num = add_data( pRExC_state, STR_WITH_LEN("S")); RExC_rxi->data->data[num]=(void*)sv_dat; SvREFCNT_inc_simple_void(sv_dat); } @@ -10622,21 +11533,22 @@ tryagain: /* override incorrect value set in reganode MJD */ Set_Node_Offset(ret, parse_start+1); - Set_Node_Cur_Length(ret); /* MJD */ + Set_Node_Cur_Length(ret, parse_start); nextchar(pRExC_state); } break; } - case 'g': + case 'g': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': { I32 num; - bool isg = *RExC_parse == 'g'; - bool isrel = 0; bool hasbrace = 0; - if (isg) { + + if (*RExC_parse == 'g') { + bool isrel = 0; + RExC_parse++; if (*RExC_parse == '{') { RExC_parse++; @@ -10648,31 +11560,52 @@ tryagain: } if (hasbrace && !isDIGIT(*RExC_parse)) { if (isrel) RExC_parse--; - RExC_parse -= 2; + RExC_parse -= 2; goto parse_named_seq; - } } - num = atoi(RExC_parse); - if (isg && num == 0) - vFAIL("Reference to invalid group 0"); - if (isrel) { - num = RExC_npar - num; - if (num < 1) - vFAIL("Reference to nonexistent or unclosed group"); + } + + num = S_backref_value(RExC_parse); + if (num == 0) + vFAIL("Reference to invalid group 0"); + else if (num == I32_MAX) { + if (isDIGIT(*RExC_parse)) + vFAIL("Reference to nonexistent group"); + else + vFAIL("Unterminated \\g... pattern"); + } + + if (isrel) { + num = RExC_npar - num; + if (num < 1) + vFAIL("Reference to nonexistent or unclosed group"); + } } - if (!isg && num > 9 && num >= RExC_npar) - /* Probably a character specified in octal, e.g. \35 */ - goto defchar; - else { + else { + num = S_backref_value(RExC_parse); + /* bare \NNN might be backref or octal - if it is larger than or equal + * RExC_npar then it is assumed to be and octal escape. + * Note RExC_npar is +1 from the actual number of parens*/ + if (num == I32_MAX || (num > 9 && num >= RExC_npar + && *RExC_parse != '8' && *RExC_parse != '9')) + { + /* Probably a character specified in octal, e.g. \35 */ + goto defchar; + } + } + + /* at this point RExC_parse definitely points to a backref + * number */ + { +#ifdef RE_TRACK_PATTERN_OFFSETS char * const parse_start = RExC_parse - 1; /* MJD */ +#endif while (isDIGIT(*RExC_parse)) RExC_parse++; - if (parse_start == RExC_parse - 1) - vFAIL("Unterminated \\g... pattern"); if (hasbrace) { - if (*RExC_parse != '}') + if (*RExC_parse != '}') vFAIL("Unterminated \\g{...} pattern"); RExC_parse++; - } + } if (!SIZE_ONLY) { if (num > (I32)RExC_rx->nparens) vFAIL("Reference to nonexistent group"); @@ -10693,7 +11626,7 @@ tryagain: /* override incorrect value set in reganode MJD */ Set_Node_Offset(ret, parse_start+1); - Set_Node_Cur_Length(ret); /* MJD */ + Set_Node_Cur_Length(ret, parse_start); RExC_parse--; nextchar(pRExC_state); } @@ -10726,25 +11659,35 @@ tryagain: defchar: { STRLEN len = 0; - UV ender; + UV ender = 0; char *p; char *s; #define MAX_NODE_STRING_SIZE 127 char foldbuf[MAX_NODE_STRING_SIZE+UTF8_MAXBYTES_CASE]; char *s0; U8 upper_parse = MAX_NODE_STRING_SIZE; - STRLEN foldlen; - U8 node_type; + U8 node_type = compute_EXACTish(pRExC_state); bool next_is_quantifier; char * oldp = NULL; + /* We can convert EXACTF nodes to EXACTFU if they contain only + * characters that match identically regardless of the target + * string's UTF8ness. The reason to do this is that EXACTF is not + * trie-able, EXACTFU is. + * + * Similarly, we can convert EXACTFL nodes to EXACTFU if they + * contain only above-Latin1 characters (hence must be in UTF8), + * which don't participate in folds with Latin1-range characters, + * as the latter's folds aren't known until runtime. (We don't + * need to figure this out until pass 2) */ + bool maybe_exactfu = PASS2 + && (node_type == EXACTF || node_type == EXACTFL); + /* If a folding node contains only code points that don't * participate in folds, it can be changed into an EXACT node, * which allows the optimizer more things to look for */ bool maybe_exact; - ender = 0; - node_type = compute_EXACTish(pRExC_state); ret = reg_node(pRExC_state, node_type); /* In pass1, folded, we use a temporary buffer instead of the @@ -10755,10 +11698,9 @@ tryagain: reparse: - /* We do the EXACTFish to EXACT node only if folding, and not if in - * locale, as whether a character folds or not isn't known until - * runtime */ - maybe_exact = FOLD && ! LOC; + /* We do the EXACTFish to EXACT node only if folding. (And we + * don't need to figure this out until pass 2) */ + maybe_exact = FOLD && PASS2; /* XXX The node can hold up to 255 bytes, yet this only goes to * 127. I (khw) do not know why. Keeping it somewhat less than @@ -10823,7 +11765,8 @@ tryagain: case 's': case 'S': /* space class */ case 'v': case 'V': /* VERTWS */ case 'w': case 'W': /* word class */ - case 'X': /* eXtended Unicode "combining character sequence" */ + case 'X': /* eXtended Unicode "combining + character sequence" */ case 'z': case 'Z': /* End of line/string assertion */ --p; goto loopdone; @@ -10871,7 +11814,7 @@ tryagain: p++; break; case 'a': - ender = ASCII_TO_NATIVE('\007'); + ender = '\a'; p++; break; case 'o': @@ -10934,12 +11877,36 @@ tryagain: } case 'c': p++; - ender = grok_bslash_c(*p++, UTF, SIZE_ONLY); + ender = grok_bslash_c(*p++, SIZE_ONLY); break; - case '0': case '1': case '2': case '3':case '4': + case '8': case '9': /* must be a backreference */ + --p; + goto loopdone; + case '1': case '2': case '3':case '4': case '5': case '6': case '7': - if (*p == '0' || - (isDIGIT(p[1]) && atoi(p) >= RExC_npar)) + /* When we parse backslash escapes there is ambiguity + * between backreferences and octal escapes. Any escape + * from \1 - \9 is a backreference, any multi-digit + * escape which does not start with 0 and which when + * evaluated as decimal could refer to an already + * parsed capture buffer is a backslash. Anything else + * is octal. + * + * Note this implies that \118 could be interpreted as + * 118 OR as "\11" . "8" depending on whether there + * were 118 capture buffers defined already in the + * pattern. */ + + /* NOTE, RExC_npar is 1 more than the actual number of + * parens we have seen so far, hence the < RExC_npar below. */ + + if ( !isDIGIT(p[1]) || S_backref_value(p) < RExC_npar) + { /* Not to be treated as an octal constant, go + find backref */ + --p; + goto loopdone; + } + case '0': { I32 flags = PERL_SCAN_SILENT_ILLDIGIT; STRLEN numlen = 3; @@ -10958,20 +11925,9 @@ tryagain: form_short_octal_warning(p, numlen)); } } - else { /* Not to be treated as an octal constant, go - find backref */ - --p; - goto loopdone; - } if (PL_encoding && ender < 0x100) goto recode_encoding; break; - case '8': case '9': /* These are illegal unless backrefs */ - if (atoi(p) <= RExC_npar) { - --p; /* backup to backslash; handle as backref */ - goto loopdone; - } - goto unrecognized; recode_encoding: if (! RExC_override_recoding) { SV* enc = PL_encoding; @@ -10986,7 +11942,6 @@ tryagain: FAIL("Trailing \\"); /* FALL THROUGH */ default: - unrecognized: if (!SIZE_ONLY&& isALPHANUMERIC(*p)) { /* Include any { following the alpha to emphasize * that it could be part of an escape at some point @@ -11001,8 +11956,8 @@ tryagain: if (! SIZE_ONLY && RExC_flags & RXf_PMf_EXTENDED - && ckWARN(WARN_DEPRECATED) - && is_PATWS_non_low(p, UTF)) + && ckWARN_d(WARN_DEPRECATED) + && is_PATWS_non_low_safe(p, RExC_end, UTF)) { vWARN_dep(p + ((UTF) ? UTF8SKIP(p) : 1), "Escape literal pattern white space under /x"); @@ -11040,98 +11995,122 @@ tryagain: goto loopdone; } - if (FOLD) { - if (UTF - /* See comments for join_exact() as to why we fold - * this non-UTF at compile time */ + if (! FOLD /* The simple case, just append the literal */ + || (LOC /* Also don't fold for tricky chars under /l */ + && is_PROBLEMATIC_LOCALE_FOLD_cp(ender))) + { + if (UTF) { + const STRLEN unilen = reguni(pRExC_state, ender, s); + if (unilen > 0) { + s += unilen; + len += unilen; + } + + /* The loop increments each time, as all but this + * path (and one other) through it add a single byte to + * the EXACTish node. But this one has changed len to + * be the correct final value, so subtract one to + * cancel out the increment that follows */ + len--; + } + else { + REGC((char)ender, s++); + } + + /* Can get here if folding only if is one of the /l + * characters whose fold depends on the locale. The + * occurrence of any of these indicate that we can't + * simplify things */ + if (FOLD) { + maybe_exact = FALSE; + maybe_exactfu = FALSE; + } + } + else /* FOLD */ + if (! ( UTF + /* See comments for join_exact() as to why we fold this + * non-UTF at compile time */ || (node_type == EXACTFU - && ender == LATIN_SMALL_LETTER_SHARP_S)) - { + && ender == LATIN_SMALL_LETTER_SHARP_S))) + { + /* Here, are folding and are not UTF-8 encoded; therefore + * the character must be in the range 0-255, and is not /l + * (Not /l because we already handled these under /l in + * is_PROBLEMATIC_LOCALE_FOLD_cp */ + if (IS_IN_SOME_FOLD_L1(ender)) { + maybe_exact = FALSE; + + /* See if the character's fold differs between /d and + * /u. This includes the multi-char fold SHARP S to + * 'ss' */ + if (maybe_exactfu + && (PL_fold[ender] != PL_fold_latin1[ender] + || ender == LATIN_SMALL_LETTER_SHARP_S + || (len > 0 + && isARG2_lower_or_UPPER_ARG1('s', ender) + && isARG2_lower_or_UPPER_ARG1('s', + *(s-1))))) + { + maybe_exactfu = FALSE; + } + } + /* Even when folding, we store just the input character, as + * we have an array that finds its fold quickly */ + *(s++) = (char) ender; + } + else { /* FOLD and UTF */ + /* Unlike the non-fold case, we do actually have to + * calculate the results here in pass 1. This is for two + * reasons, the folded length may be longer than the + * unfolded, and we have to calculate how many EXACTish + * nodes it will take; and we may run out of room in a node + * in the middle of a potential multi-char fold, and have + * to back off accordingly. (Hence we can't use REGC for + * the simple case just below.) */ + + UV folded; + if (isASCII(ender)) { + folded = toFOLD(ender); + *(s)++ = (U8) folded; + } + else { + STRLEN foldlen; - /* Prime the casefolded buffer. Locale rules, which - * apply only to code points < 256, aren't known until - * execution, so for them, just output the original - * character using utf8. If we start to fold non-UTF - * patterns, be sure to update join_exact() */ - if (LOC && ender < 256) { - if (UNI_IS_INVARIANT(ender)) { - *s = (U8) ender; - foldlen = 1; - } else { - *s = UTF8_TWO_BYTE_HI(ender); - *(s + 1) = UTF8_TWO_BYTE_LO(ender); - foldlen = 2; - } + folded = _to_uni_fold_flags( + ender, + (U8 *) s, + &foldlen, + FOLD_FLAGS_FULL | ((ASCII_FOLD_RESTRICTED) + ? FOLD_FLAGS_NOMIX_ASCII + : 0)); + s += foldlen; + + /* The loop increments each time, as all but this + * path (and one other) through it add a single byte to + * the EXACTish node. But this one has changed len to + * be the correct final value, so subtract one to + * cancel out the increment that follows */ + len += foldlen - 1; + } + /* If this node only contains non-folding code points so + * far, see if this new one is also non-folding */ + if (maybe_exact) { + if (folded != ender) { + maybe_exact = FALSE; } else { - UV folded = _to_uni_fold_flags( - ender, - (U8 *) s, - &foldlen, - FOLD_FLAGS_FULL - | ((LOC) ? FOLD_FLAGS_LOCALE - : (ASCII_FOLD_RESTRICTED) - ? FOLD_FLAGS_NOMIX_ASCII - : 0) - ); - - /* If this node only contains non-folding code - * points so far, see if this new one is also - * non-folding */ - if (maybe_exact) { - if (folded != ender) { - maybe_exact = FALSE; - } - else { - /* Here the fold is the original; we have - * to check further to see if anything - * folds to it */ - if (! PL_utf8_foldable) { - SV* swash = swash_init("utf8", - "_Perl_Any_Folds", - &PL_sv_undef, 1, 0); - PL_utf8_foldable = - _get_swash_invlist(swash); - SvREFCNT_dec_NN(swash); - } - if (_invlist_contains_cp(PL_utf8_foldable, - ender)) - { - maybe_exact = FALSE; - } - } + /* Here the fold is the original; we have to check + * further to see if anything folds to it */ + if (_invlist_contains_cp(PL_utf8_foldable, + ender)) + { + maybe_exact = FALSE; } - ender = folded; } - s += foldlen; - - /* The loop increments each time, as all but this - * path (and the one just below for UTF) through it add - * a single byte to the EXACTish node. But this one - * has changed len to be the correct final value, so - * subtract one to cancel out the increment that - * follows */ - len += foldlen - 1; - } - else { - *(s++) = (char) ender; - maybe_exact &= ! IS_IN_SOME_FOLD_L1(ender); } + ender = folded; } - else if (UTF) { - const STRLEN unilen = reguni(pRExC_state, ender, s); - if (unilen > 0) { - s += unilen; - len += unilen; - } - - /* See comment just above for - 1 */ - len--; - } - else { - REGC((char)ender, s++); - } if (next_is_quantifier) { @@ -11179,9 +12158,8 @@ tryagain: if (! UTF) { - /* These two have no multi-char folds to non-UTF characters - */ - if (ASCII_FOLD_RESTRICTED || LOC) { + /* This has no multi-char folds to non-UTF characters */ + if (ASCII_FOLD_RESTRICTED) { goto loopdone; } @@ -11212,12 +12190,8 @@ tryagain: } } else if (UTF8_IS_DOWNGRADEABLE_START(*s)) { - - /* No Latin1 characters participate in multi-char - * folds under /l */ - if (LOC - || ! IS_NON_FINAL_FOLD(TWO_BYTE_UTF8_TO_UNI( - *s, *(s+1)))) + if (! IS_NON_FINAL_FOLD(TWO_BYTE_UTF8_TO_NATIVE( + *s, *(s+1)))) { break; } @@ -11254,7 +12228,16 @@ tryagain: * do any better */ if (len == 0) { len = full_len; - } else { + + /* If the node ends in an 's' we make sure it stays EXACTF, + * as if it turns into an EXACTFU, it could later get + * joined with another 's' that would then wrongly match + * the sharp s */ + if (maybe_exactfu && isARG2_lower_or_UPPER_ARG1('s', ender)) + { + maybe_exactfu = FALSE; + } + } else { /* Here, the node does contain some characters that aren't * problematic. If one such is the final character in the @@ -11306,24 +12289,36 @@ tryagain: loopdone: /* Jumped to when encounters something that shouldn't be in the node */ - /* If 'maybe_exact' is still set here, means there are no - * code points in the node that participate in folds */ - if (FOLD && maybe_exact) { - OP(ret) = EXACT; - } - /* I (khw) don't know if you can get here with zero length, but the * old code handled this situation by creating a zero-length EXACT * node. Might as well be NOTHING instead */ if (len == 0) { OP(ret) = NOTHING; } - else{ - alloc_maybe_populate_EXACT(pRExC_state, ret, flagp, len, ender); + else { + if (FOLD) { + /* If 'maybe_exact' is still set here, means there are no + * code points in the node that participate in folds; + * similarly for 'maybe_exactfu' and code points that match + * differently depending on UTF8ness of the target string + * (for /u), or depending on locale for /l */ + if (maybe_exact) { + OP(ret) = EXACT; + } + else if (maybe_exactfu) { + OP(ret) = EXACTFU; + } + } + alloc_maybe_populate_EXACT(pRExC_state, ret, flagp, len, ender, + FALSE /* Don't look to see if could + be turned into an EXACT + node, as we have already + computed that */ + ); } RExC_parse = p - 1; - Set_Node_Cur_Length(ret); /* MJD */ + Set_Node_Cur_Length(ret, parse_start); nextchar(pRExC_state); { /* len is STRLEN which is unsigned, need to copy to signed */ @@ -11358,7 +12353,7 @@ S_regwhite( RExC_state_t *pRExC_state, c } } while (p < e); if (!ended) - RExC_seen |= REG_SEEN_RUN_ON_COMMENT; + RExC_seen |= REG_RUN_ON_COMMENT_SEEN; } else break; @@ -11372,7 +12367,7 @@ S_regpatws( RExC_state_t *pRExC_state, c /* Returns the next non-pattern-white space, non-comment character (the * latter only if 'recognize_comment is true) in the string p, which is * ended by RExC_end. If there is no line break ending a comment, - * RExC_seen has added the REG_SEEN_RUN_ON_COMMENT flag; */ + * RExC_seen has added the REG_RUN_ON_COMMENT_SEEN flag; */ const char *e = RExC_end; PERL_ARGS_ASSERT_REGPATWS; @@ -11392,7 +12387,7 @@ S_regpatws( RExC_state_t *pRExC_state, c } } while (p < e); if (!ended) - RExC_seen |= REG_SEEN_RUN_ON_COMMENT; + RExC_seen |= REG_RUN_ON_COMMENT_SEEN; } else break; @@ -11400,6 +12395,72 @@ S_regpatws( RExC_state_t *pRExC_state, c return p; } +STATIC void +S_populate_ANYOF_from_invlist(pTHX_ regnode *node, SV** invlist_ptr) +{ + /* Uses the inversion list '*invlist_ptr' to populate the ANYOF 'node'. It + * sets up the bitmap and any flags, removing those code points from the + * inversion list, setting it to NULL should it become completely empty */ + + PERL_ARGS_ASSERT_POPULATE_ANYOF_FROM_INVLIST; + assert(PL_regkind[OP(node)] == ANYOF); + + ANYOF_BITMAP_ZERO(node); + if (*invlist_ptr) { + + /* This gets set if we actually need to modify things */ + bool change_invlist = FALSE; + + UV start, end; + + /* Start looking through *invlist_ptr */ + invlist_iterinit(*invlist_ptr); + while (invlist_iternext(*invlist_ptr, &start, &end)) { + UV high; + int i; + + if (end == UV_MAX && start <= 256) { + ANYOF_FLAGS(node) |= ANYOF_ABOVE_LATIN1_ALL; + } + else if (end >= 256) { + ANYOF_FLAGS(node) |= ANYOF_UTF8; + } + + /* Quit if are above what we should change */ + if (start > 255) { + break; + } + + change_invlist = TRUE; + + /* Set all the bits in the range, up to the max that we are doing */ + high = (end < 255) ? end : 255; + for (i = start; i <= (int) high; i++) { + if (! ANYOF_BITMAP_TEST(node, i)) { + ANYOF_BITMAP_SET(node, i); + } + } + } + invlist_iterfinish(*invlist_ptr); + + /* Done with loop; remove any code points that are in the bitmap from + * *invlist_ptr; similarly for code points above latin1 if we have a + * flag to match all of them anyways */ + if (change_invlist) { + _invlist_subtract(*invlist_ptr, PL_Latin1, invlist_ptr); + } + if (ANYOF_FLAGS(node) & ANYOF_ABOVE_LATIN1_ALL) { + _invlist_intersection(*invlist_ptr, PL_Latin1, invlist_ptr); + } + + /* If have completely emptied it, remove it completely */ + if (_invlist_len(*invlist_ptr) == 0) { + SvREFCNT_dec_NN(*invlist_ptr); + *invlist_ptr = NULL; + } + } +} + /* Parse POSIX character classes: [[:foo:]], [[=foo=]], [[.foo.]]. Character classes ([:foo:]) can also be negated ([:^foo:]). Returns a named class id (ANYOF_XXX) if successful, -1 otherwise. @@ -11518,8 +12579,9 @@ S_regpposixcc(pTHX_ RExC_state_t *pRExC_ } if (namedclass == OOB_NAMEDCLASS) - Simple_vFAIL3("POSIX class [:%.*s:] unknown", - t - s - 1, s + 1); + vFAIL2utf8f( + "POSIX class [:%"UTF8f":] unknown", + UTF8fARG(UTF, t - s - 1, s + 1)); /* The #defines are structured so each complement is +1 to * the normal one */ @@ -11607,8 +12669,9 @@ S_could_it_be_a_POSIX_class(pTHX_ RExC_s } STATIC regnode * -S_handle_regex_sets(pTHX_ RExC_state_t *pRExC_state, SV** return_invlist, I32 *flagp, U32 depth, - char * const oregcomp_parse) +S_handle_regex_sets(pTHX_ RExC_state_t *pRExC_state, SV** return_invlist, + I32 *flagp, U32 depth, + char * const oregcomp_parse) { /* Handle the (?[...]) construct to do set operations */ @@ -11639,17 +12702,24 @@ S_handle_regex_sets(pTHX_ RExC_state_t * * these things, we need to realize that something preceded by a backslash * is escaped, so we have to keep track of backslashes */ if (SIZE_ONLY) { + UV depth = 0; /* how many nested (?[...]) constructs */ Perl_ck_warner_d(aTHX_ packWARN(WARN_EXPERIMENTAL__REGEX_SETS), "The regex_sets feature is experimental" REPORT_LOCATION, - (int) (RExC_parse - RExC_precomp) , RExC_precomp, RExC_parse); + UTF8fARG(UTF, (RExC_parse - RExC_precomp), RExC_precomp), + UTF8fARG(UTF, + RExC_end - RExC_start - (RExC_parse - RExC_precomp), + RExC_precomp + (RExC_parse - RExC_precomp))); while (RExC_parse < RExC_end) { SV* current = NULL; RExC_parse = regpatws(pRExC_state, RExC_parse, TRUE); /* means recognize comments */ switch (*RExC_parse) { + case '?': + if (RExC_parse[1] == '[') depth++, RExC_parse++; + /* FALL THROUGH */ default: break; case '\\': @@ -11683,8 +12753,8 @@ S_handle_regex_sets(pTHX_ RExC_state_t * FALSE, /* don't allow multi-char folds */ TRUE, /* silence non-portable warnings. */ ¤t)) - FAIL2("panic: regclass returned NULL to handle_sets, flags=%#X", - *flagp); + FAIL2("panic: regclass returned NULL to handle_sets, flags=%#"UVxf"", + (UV) *flagp); /* function call leaves parse pointing to the ']', except * if we faked it */ @@ -11697,6 +12767,7 @@ S_handle_regex_sets(pTHX_ RExC_state_t * } case ']': + if (depth--) break; RExC_parse++; if (RExC_parse < RExC_end && *RExC_parse == ')') @@ -11849,8 +12920,8 @@ S_handle_regex_sets(pTHX_ RExC_state_t * FALSE, /* don't allow multi-char folds */ FALSE, /* don't silence non-portable warnings. */ ¤t)) - FAIL2("panic: regclass returned NULL to handle_sets, flags=%#X", - *flagp); + FAIL2("panic: regclass returned NULL to handle_sets, flags=%#"UVxf"", + (UV) *flagp); /* regclass() will return with parsing just the \ sequence, * leaving the parse pointer at the next thing to parse */ RExC_parse--; @@ -11872,8 +12943,8 @@ S_handle_regex_sets(pTHX_ RExC_state_t * FALSE, /* don't allow multi-char folds */ FALSE, /* don't silence non-portable warnings. */ ¤t)) - FAIL2("panic: regclass returned NULL to handle_sets, flags=%#X", - *flagp); + FAIL2("panic: regclass returned NULL to handle_sets, flags=%#"UVxf"", + (UV) *flagp); /* function call leaves parse pointing to the ']', except if we * faked it */ if (is_posix_class) { @@ -12093,7 +13164,8 @@ S_handle_regex_sets(pTHX_ RExC_state_t * /* The names of properties whose definitions are not known at compile time are * stored in this SV, after a constant heading. So if the length has been * changed since initialization, then there is a run-time definition. */ -#define HAS_NONLOCALE_RUNTIME_PROPERTY_DEFINITION (SvCUR(listsv) != initial_listsv_len) +#define HAS_NONLOCALE_RUNTIME_PROPERTY_DEFINITION \ + (SvCUR(listsv) != initial_listsv_len) STATIC regnode * S_regclass(pTHX_ RExC_state_t *pRExC_state, I32 *flagp, U32 depth, @@ -12143,8 +13215,16 @@ S_regclass(pTHX_ RExC_state_t *pRExC_sta STRLEN initial_listsv_len = 0; /* Kind of a kludge to see if it is more than just initialized. */ SV* properties = NULL; /* Code points that match \p{} \P{} */ - SV* posixes = NULL; /* Code points that match classes like, [:word:], - extended beyond the Latin1 range */ + SV* posixes = NULL; /* Code points that match classes like [:word:], + extended beyond the Latin1 range. These have to + be kept separate from other code points for much + of this function because their handling is + different under /i, and for most classes under + /d as well */ + SV* nposixes = NULL; /* Similarly for [:^word:]. These are kept + separate for a while from the non-complemented + versions because of complications with /d + matching */ UV element_count = 0; /* Number of distinct elements in the class. Optimizations may be possible if this is tiny */ AV * multi_char_matches = NULL; /* Code points that fold to more than one @@ -12171,11 +13251,18 @@ S_regclass(pTHX_ RExC_state_t *pRExC_sta * string is in UTF-8. (Because is under /d) */ SV* depends_list = NULL; - /* inversion list of code points this node matches. For much of the - * function, it includes only those that match regardless of the utf8ness - * of the target string */ + /* Inversion list of code points this node matches regardless of things + * like locale, folding, utf8ness of the target string */ SV* cp_list = NULL; + /* Like cp_list, but code points on this list need to be checked for things + * that fold to/from them under /i */ + SV* cp_foldable_list = NULL; + + /* Like cp_list, but code points on this list are valid only when the + * runtime locale is UTF-8 */ + SV* only_utf8_locale_list = NULL; + #ifdef EBCDIC /* In a range, counts how many 0-2 of the ends of it came from literals, * not escapes. Thus we can tell if 'A' was input vs \x{C1} */ @@ -12183,14 +13270,13 @@ S_regclass(pTHX_ RExC_state_t *pRExC_sta #endif bool invert = FALSE; /* Is this class to be complemented */ - /* Is there any thing like \W or [:^digit:] that matches above the legal - * Unicode range? */ - bool runtime_posix_matches_above_Unicode = FALSE; + bool warn_super = ALWAYS_WARN_SUPER; regnode * const orig_emit = RExC_emit; /* Save the original RExC_emit in case we need to change the emitted regop to an EXACT. */ const char * orig_parse = RExC_parse; - const I32 orig_size = RExC_size; + const SSize_t orig_size = RExC_size; + bool posixl_matches_all = FALSE; /* Does /l class have both e.g. \W,\w ? */ GET_RE_DEBUG_FLAGS_DECL; PERL_ARGS_ASSERT_REGCLASS; @@ -12211,9 +13297,6 @@ S_regclass(pTHX_ RExC_state_t *pRExC_sta ANYOF_FLAGS(ret) = 0; RExC_emit += ANYOF_SKIP; - if (LOC) { - ANYOF_FLAGS(ret) |= ANYOF_LOCALE; - } listsv = newSVpvs_flags("# comment\n", SVs_TEMP); initial_listsv_len = SvCUR(listsv); SvTEMP_off(listsv); /* Grr, TEMPs and mortals are conflated. */ @@ -12335,7 +13418,7 @@ parseit: case 'H': namedclass = ANYOF_NHORIZWS; break; case 'N': /* Handle \N{NAME} in class */ { - /* We only pay attention to the first char of + /* We only pay attention to the first char of multichar strings being returned. I kinda wonder if this makes sense as it does change the behaviour from earlier versions, OTOH that behaviour was broken @@ -12356,7 +13439,12 @@ parseit: char *e; /* We will handle any undefined properties ourselves */ - U8 swash_init_flags = _CORE_SWASH_INIT_RETURN_IF_UNDEF; + U8 swash_init_flags = _CORE_SWASH_INIT_RETURN_IF_UNDEF + /* And we actually would prefer to get + * the straight inversion list of the + * swash, since we will be accessing it + * anyway, to save a little time */ + |_CORE_SWASH_INIT_ACCEPT_INVLIST; if (RExC_parse >= RExC_end) vFAIL2("Empty \\%c{}", (U8)value); @@ -12379,6 +13467,7 @@ parseit: } if (!SIZE_ONLY) { SV* invlist; + char* formatted; char* name; if (UCHARAT(RExC_parse) == '^') { @@ -12399,14 +13488,14 @@ parseit: * will have its name be <__NAME_i>. The design is * discussed in commit * 2f833f5208e26b208886e51e09e2c072b5eabb46 */ - Newx(name, n + sizeof("_i__\n"), char); - - sprintf(name, "%s%.*s%s\n", - (FOLD) ? "__" : "", - (int)n, - RExC_parse, - (FOLD) ? "_i" : "" - ); + formatted = Perl_form(aTHX_ + "%s%.*s%s\n", + (FOLD) ? "__" : "", + (int)n, + RExC_parse, + (FOLD) ? "_i" : "" + ); + name = savepvn(formatted, strlen(formatted)); /* Look up the property name, and get its swash and * inversion list, if the property is found */ @@ -12431,11 +13520,13 @@ parseit: * otherwise add it to the list for run-time look up */ if (ret_invlist) { RExC_parse = e + 1; - vFAIL3("Property '%.*s' is unknown", (int) n, name); + vFAIL2utf8f( + "Property '%"UTF8f"' is unknown", + UTF8fARG(UTF, n, name)); } - Perl_sv_catpvf(aTHX_ listsv, "%cutf8::%s\n", + Perl_sv_catpvf(aTHX_ listsv, "%cutf8::%"UTF8f"\n", (value == 'p' ? '+' : '!'), - name); + UTF8fARG(UTF, n, name)); has_user_defined_property = TRUE; /* We don't know yet, so have to assume that the @@ -12444,7 +13535,7 @@ parseit: * would cause things in to match * inappropriately, except that any \p{}, including * this one forces Unicode semantics, which means there - * is */ + * is no */ ANYOF_FLAGS(ret) |= ANYOF_NONBITMAP_NON_UTF8; } else { @@ -12452,9 +13543,23 @@ parseit: /* Here, did get the swash and its inversion list. If * the swash is from a user-defined property, then this * whole character class should be regarded as such */ - has_user_defined_property = - (swash_init_flags - & _CORE_SWASH_INIT_USER_DEFINED_PROPERTY); + if (swash_init_flags + & _CORE_SWASH_INIT_USER_DEFINED_PROPERTY) + { + has_user_defined_property = TRUE; + } + else if + /* We warn on matching an above-Unicode code point + * if the match would return true, except don't + * warn for \p{All}, which has exactly one element + * = 0 */ + (_invlist_contains_cp(invlist, 0x110000) + && (! (_invlist_len(invlist) == 1 + && *invlist_array(invlist) == 0))) + { + warn_super = TRUE; + } + /* Invert if asking for the complement */ if (value == 'P') { @@ -12488,7 +13593,7 @@ parseit: case 'f': value = '\f'; break; case 'b': value = '\b'; break; case 'e': value = ASCII_TO_NATIVE('\033');break; - case 'a': value = ASCII_TO_NATIVE('\007');break; + case 'a': value = '\a'; break; case 'o': RExC_parse--; /* function expects to be pointed at the 'o' */ { @@ -12528,7 +13633,7 @@ parseit: goto recode_encoding; break; case 'c': - value = grok_bslash_c(*RExC_parse++, UTF, SIZE_ONLY); + value = grok_bslash_c(*RExC_parse++, SIZE_ONLY); break; case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': @@ -12600,31 +13705,8 @@ parseit: /* Here, we have the current token in 'value' */ - /* What matches in a locale is not known until runtime. This includes - * what the Posix classes (like \w, [:space:]) match. Room must be - * reserved (one time per class) to store such classes, either if Perl - * is compiled so that locale nodes always should have this space, or - * if there is such class info to be stored. The space will contain a - * bit for each named class that is to be matched against. This isn't - * needed for \p{} and pseudo-classes, as they are not affected by - * locale, and hence are dealt with separately */ - if (LOC - && ! need_class - && (ANYOF_LOCALE == ANYOF_CLASS - || (namedclass > OOB_NAMEDCLASS && namedclass < ANYOF_MAX))) - { - need_class = 1; - if (SIZE_ONLY) { - RExC_size += ANYOF_CLASS_SKIP - ANYOF_SKIP; - } - else { - RExC_emit += ANYOF_CLASS_SKIP - ANYOF_SKIP; - ANYOF_CLASS_ZERO(ret); - } - ANYOF_FLAGS(ret) |= ANYOF_CLASS; - } - if (namedclass > OOB_NAMEDCLASS) { /* this is a named class \blah */ + U8 classnum; /* a bad range like a-\d, a-[:digit:]. The '-' is taken as a * literal, as is the character that began the false range, i.e. @@ -12635,16 +13717,19 @@ parseit: ? RExC_parse - rangebegin : 0; if (strict) { - vFAIL4("False [] range \"%*.*s\"", w, w, rangebegin); + vFAIL2utf8f( + "False [] range \"%"UTF8f"\"", + UTF8fARG(UTF, w, rangebegin)); } else { SAVEFREESV(RExC_rx_sv); /* in case of fatal warnings */ - ckWARN4reg(RExC_parse, - "False [] range \"%*.*s\"", - w, w, rangebegin); + ckWARN2reg(RExC_parse, + "False [] range \"%"UTF8f"\"", + UTF8fARG(UTF, w, rangebegin)); (void)ReREFCNT_inc(RExC_rx_sv); cp_list = add_cp_to_invlist(cp_list, '-'); - cp_list = add_cp_to_invlist(cp_list, prevvalue); + cp_foldable_list = add_cp_to_invlist(cp_foldable_list, + prevvalue); } } @@ -12652,16 +13737,89 @@ parseit: element_count += 2; /* So counts for three values */ } - if (! SIZE_ONLY) { - U8 classnum = namedclass_to_classnum(namedclass); - if (namedclass >= ANYOF_MAX) { /* If a special class */ + classnum = namedclass_to_classnum(namedclass); + + if (LOC && namedclass < ANYOF_POSIXL_MAX +#ifndef HAS_ISASCII + && classnum != _CC_ASCII +#endif + ) { + /* What the Posix classes (like \w, [:space:]) match in locale + * isn't knowable under locale until actual match time. Room + * must be reserved (one time per outer bracketed class) to + * store such classes. The space will contain a bit for each + * named class that is to be matched against. This isn't + * needed for \p{} and pseudo-classes, as they are not affected + * by locale, and hence are dealt with separately */ + if (! need_class) { + need_class = 1; + if (SIZE_ONLY) { + RExC_size += ANYOF_POSIXL_SKIP - ANYOF_SKIP; + } + else { + RExC_emit += ANYOF_POSIXL_SKIP - ANYOF_SKIP; + } + ANYOF_FLAGS(ret) |= ANYOF_POSIXL; + ANYOF_POSIXL_ZERO(ret); + } + + /* See if it already matches the complement of this POSIX + * class */ + if ((ANYOF_FLAGS(ret) & ANYOF_POSIXL) + && ANYOF_POSIXL_TEST(ret, namedclass + ((namedclass % 2) + ? -1 + : 1))) + { + posixl_matches_all = TRUE; + break; /* No need to continue. Since it matches both + e.g., \w and \W, it matches everything, and the + bracketed class can be optimized into qr/./s */ + } + + /* Add this class to those that should be checked at runtime */ + ANYOF_POSIXL_SET(ret, namedclass); + + /* The above-Latin1 characters are not subject to locale rules. + * Just add them, in the second pass, to the + * unconditionally-matched list */ + if (! SIZE_ONLY) { + SV* scratch_list = NULL; + + /* Get the list of the above-Latin1 code points this + * matches */ + _invlist_intersection_maybe_complement_2nd(PL_AboveLatin1, + PL_XPosix_ptrs[classnum], + + /* Odd numbers are complements, like + * NDIGIT, NASCII, ... */ + namedclass % 2 != 0, + &scratch_list); + /* Checking if 'cp_list' is NULL first saves an extra + * clone. Its reference count will be decremented at the + * next union, etc, or if this is the only instance, at the + * end of the routine */ + if (! cp_list) { + cp_list = scratch_list; + } + else { + _invlist_union(cp_list, scratch_list, &cp_list); + SvREFCNT_dec_NN(scratch_list); + } + continue; /* Go get next character */ + } + } + else if (! SIZE_ONLY) { + + /* Here, not in pass1 (in that pass we skip calculating the + * contents of this class), and is /l, or is a POSIX class for + * which /l doesn't matter (or is a Unicode property, which is + * skipped here). */ + if (namedclass >= ANYOF_POSIXL_MAX) { /* If a special class */ if (namedclass != ANYOF_UNIPROP) { /* UNIPROP = \p and \P */ - /* Here, should be \h, \H, \v, or \V. Neither /d nor - * /l make a difference in what these match. There - * would be problems if these characters had folds - * other than themselves, as cp_list is subject to - * folding. */ + /* Here, should be \h, \H, \v, or \V. None of /d, /i + * nor /l make a difference in what these match, + * therefore we just add what they match to cp_list. */ if (classnum != _CC_VERTSPACE) { assert( namedclass == ANYOF_HORIZWS || namedclass == ANYOF_NHORIZWS); @@ -12674,255 +13832,25 @@ parseit: _invlist_union_maybe_complement_2nd( cp_list, PL_XPosix_ptrs[classnum], - cBOOL(namedclass % 2), /* Complement if odd + namedclass % 2 != 0, /* Complement if odd (NHORIZWS, NVERTWS) */ &cp_list); } } - else if (classnum == _CC_ASCII) { -#ifdef HAS_ISASCII - if (LOC) { - ANYOF_CLASS_SET(ret, namedclass); - } - else -#endif /* Not isascii(); just use the hard-coded definition for it */ - { - _invlist_union_maybe_complement_2nd( - posixes, - PL_ASCII, - cBOOL(namedclass % 2), /* Complement if odd - (NASCII) */ - &posixes); - - /* The code points 128-255 added above will be - * subtracted out below under /d, so the flag needs to - * be set */ - if (namedclass == ANYOF_NASCII && DEPENDS_SEMANTICS) { - ANYOF_FLAGS(ret) |= ANYOF_NON_UTF8_LATIN1_ALL; - } - } - } - else { /* Garden variety class */ - - /* The ascii range inversion list */ - SV* ascii_source = PL_Posix_ptrs[classnum]; - - /* The full Latin1 range inversion list */ - SV* l1_source = PL_L1Posix_ptrs[classnum]; - - /* This code is structured into two major clauses. The - * first is for classes whose complete definitions may not - * already be known. It not, the Latin1 definition - * (guaranteed to already known) is used plus code is - * generated to load the rest at run-time (only if needed). - * If the complete definition is known, it drops down to - * the second clause, where the complete definition is - * known */ - - if (classnum < _FIRST_NON_SWASH_CC) { - - /* Here, the class has a swash, which may or not - * already be loaded */ - - /* The name of the property to use to match the full - * eXtended Unicode range swash for this character - * class */ - const char *Xname = swash_property_names[classnum]; - - /* If returning the inversion list, we can't defer - * getting this until runtime */ - if (ret_invlist && ! PL_utf8_swash_ptrs[classnum]) { - PL_utf8_swash_ptrs[classnum] = - _core_swash_init("utf8", Xname, &PL_sv_undef, - 1, /* binary */ - 0, /* not tr/// */ - NULL, /* No inversion list */ - NULL /* No flags */ - ); - assert(PL_utf8_swash_ptrs[classnum]); - } - if ( ! PL_utf8_swash_ptrs[classnum]) { - if (namedclass % 2 == 0) { /* A non-complemented - class */ - /* If not /a matching, there are code points we - * don't know at compile time. Arrange for the - * unknown matches to be loaded at run-time, if - * needed */ - if (! AT_LEAST_ASCII_RESTRICTED) { - Perl_sv_catpvf(aTHX_ listsv, "+utf8::%s\n", - Xname); - } - if (LOC) { /* Under locale, set run-time - lookup */ - ANYOF_CLASS_SET(ret, namedclass); - } - else { - /* Add the current class's code points to - * the running total */ - _invlist_union(posixes, - (AT_LEAST_ASCII_RESTRICTED) - ? ascii_source - : l1_source, - &posixes); - } - } - else { /* A complemented class */ - if (AT_LEAST_ASCII_RESTRICTED) { - /* Under /a should match everything above - * ASCII, plus the complement of the set's - * ASCII matches */ - _invlist_union_complement_2nd(posixes, - ascii_source, - &posixes); - } - else { - /* Arrange for the unknown matches to be - * loaded at run-time, if needed */ - Perl_sv_catpvf(aTHX_ listsv, "!utf8::%s\n", - Xname); - runtime_posix_matches_above_Unicode = TRUE; - if (LOC) { - ANYOF_CLASS_SET(ret, namedclass); - } - else { - - /* We want to match everything in - * Latin1, except those things that - * l1_source matches */ - SV* scratch_list = NULL; - _invlist_subtract(PL_Latin1, l1_source, - &scratch_list); - - /* Add the list from this class to the - * running total */ - if (! posixes) { - posixes = scratch_list; - } - else { - _invlist_union(posixes, - scratch_list, - &posixes); - SvREFCNT_dec_NN(scratch_list); - } - if (DEPENDS_SEMANTICS) { - ANYOF_FLAGS(ret) - |= ANYOF_NON_UTF8_LATIN1_ALL; - } - } - } - } - goto namedclass_done; - } - - /* Here, there is a swash loaded for the class. If no - * inversion list for it yet, get it */ - if (! PL_XPosix_ptrs[classnum]) { - PL_XPosix_ptrs[classnum] - = _swash_to_invlist(PL_utf8_swash_ptrs[classnum]); - } - } - - /* Here there is an inversion list already loaded for the - * entire class */ - - if (namedclass % 2 == 0) { /* A non-complemented class, - like ANYOF_PUNCT */ - if (! LOC) { - /* For non-locale, just add it to any existing list - * */ - _invlist_union(posixes, - (AT_LEAST_ASCII_RESTRICTED) - ? ascii_source - : PL_XPosix_ptrs[classnum], - &posixes); - } - else { /* Locale */ - SV* scratch_list = NULL; - - /* For above Latin1 code points, we use the full - * Unicode range */ - _invlist_intersection(PL_AboveLatin1, - PL_XPosix_ptrs[classnum], - &scratch_list); - /* And set the output to it, adding instead if - * there already is an output. Checking if - * 'posixes' is NULL first saves an extra clone. - * Its reference count will be decremented at the - * next union, etc, or if this is the only - * instance, at the end of the routine */ - if (! posixes) { - posixes = scratch_list; - } - else { - _invlist_union(posixes, scratch_list, &posixes); - SvREFCNT_dec_NN(scratch_list); - } - -#ifndef HAS_ISBLANK - if (namedclass != ANYOF_BLANK) { -#endif - /* Set this class in the node for runtime - * matching */ - ANYOF_CLASS_SET(ret, namedclass); -#ifndef HAS_ISBLANK - } - else { - /* No isblank(), use the hard-coded ASCII-range - * blanks, adding them to the running total. */ - - _invlist_union(posixes, ascii_source, &posixes); - } -#endif - } - } - else { /* A complemented class, like ANYOF_NPUNCT */ - if (! LOC) { - _invlist_union_complement_2nd( - posixes, - (AT_LEAST_ASCII_RESTRICTED) - ? ascii_source - : PL_XPosix_ptrs[classnum], - &posixes); - /* Under /d, everything in the upper half of the - * Latin1 range matches this complement */ - if (DEPENDS_SEMANTICS) { - ANYOF_FLAGS(ret) |= ANYOF_NON_UTF8_LATIN1_ALL; - } - } - else { /* Locale */ - SV* scratch_list = NULL; - _invlist_subtract(PL_AboveLatin1, - PL_XPosix_ptrs[classnum], - &scratch_list); - if (! posixes) { - posixes = scratch_list; - } - else { - _invlist_union(posixes, scratch_list, &posixes); - SvREFCNT_dec_NN(scratch_list); - } -#ifndef HAS_ISBLANK - if (namedclass != ANYOF_NBLANK) { -#endif - ANYOF_CLASS_SET(ret, namedclass); -#ifndef HAS_ISBLANK - } - else { - /* Get the list of all code points in Latin1 - * that are not ASCII blanks, and add them to - * the running total */ - _invlist_subtract(PL_Latin1, ascii_source, - &scratch_list); - _invlist_union(posixes, scratch_list, &posixes); - SvREFCNT_dec_NN(scratch_list); - } -#endif - } - } + else { /* Garden variety class. If is NASCII, NDIGIT, ... + complement and use nposixes */ + SV** posixes_ptr = namedclass % 2 == 0 + ? &posixes + : &nposixes; + SV** source_ptr = &PL_XPosix_ptrs[classnum]; + _invlist_union_maybe_complement_2nd( + *posixes_ptr, + *source_ptr, + namedclass % 2 != 0, + posixes_ptr); } - namedclass_done: - continue; /* Go get next character */ + continue; /* Go get next character */ } } /* end of namedclass \blah */ @@ -12941,7 +13869,9 @@ parseit: if (range) { if (prevvalue > value) /* b-a */ { const int w = RExC_parse - rangebegin; - Simple_vFAIL4("Invalid [] range \"%*.*s\"", w, w, rangebegin); + vFAIL2utf8f( + "Invalid [] range \"%"UTF8f"\"", + UTF8fARG(UTF, w, rangebegin)); range = 0; /* not a valid range */ } } @@ -13022,11 +13952,9 @@ parseit: value, foldbuf, &foldlen, - FOLD_FLAGS_FULL - | ((LOC) ? FOLD_FLAGS_LOCALE - : (ASCII_FOLD_RESTRICTED) - ? FOLD_FLAGS_NOMIX_ASCII - : 0) + FOLD_FLAGS_FULL | (ASCII_FOLD_RESTRICTED + ? FOLD_FLAGS_NOMIX_ASCII + : 0) ); /* Here, should be the first character of the @@ -13057,17 +13985,17 @@ parseit: /* is actually an array of arrays. * There will be one or two top-level elements: [2], * and/or [3]. The [2] element is an array, each - * element thereof is a character which folds to two - * characters; likewise for [3]. (Unicode guarantees a - * maximum of 3 characters in any fold.) When we - * rewrite the character class below, we will do so - * such that the longest folds are written first, so - * that it prefers the longest matching strings first. - * This is done even if it turns out that any - * quantifier is non-greedy, out of programmer - * laziness. Tom Christiansen has agreed that this is - * ok. This makes the test for the ligature 'ffi' come - * before the test for 'ff' */ + * element thereof is a character which folds to TWO + * characters; [3] is for folds to THREE characters. + * (Unicode guarantees a maximum of 3 characters in any + * fold.) When we rewrite the character class below, + * we will do so such that the longest folds are + * written first, so that it prefers the longest + * matching strings first. This is done even if it + * turns out that any quantifier is non-greedy, out of + * programmer laziness. Tom Christiansen has agreed + * that this is ok. This makes the test for the + * ligature 'ffi' come before the test for 'ff' */ if (av_exists(multi_char_matches, cp_count)) { this_array_ptr = (AV**) av_fetch(multi_char_matches, cp_count, FALSE); @@ -13094,7 +14022,8 @@ parseit: /* Deal with this element of the class */ if (! SIZE_ONLY) { #ifndef EBCDIC - cp_list = _add_range_to_invlist(cp_list, prevvalue, value); + cp_foldable_list = _add_range_to_invlist(cp_foldable_list, + prevvalue, value); #else SV* this_range = _new_invlist(1); _append_range_to_invlist(this_range, prevvalue, value); @@ -13108,13 +14037,18 @@ parseit: * included. literal_endpoint==2 means both ends of the range used * a literal character, not \x{foo} */ if (literal_endpoint == 2 - && (prevvalue >= 'a' && value <= 'z') - || (prevvalue >= 'A' && value <= 'Z')) + && ((prevvalue >= 'a' && value <= 'z') + || (prevvalue >= 'A' && value <= 'Z'))) { - _invlist_intersection(this_range, PL_Posix_ptrs[_CC_ALPHA], + _invlist_intersection(this_range, PL_ASCII, + &this_range); + + /* Since this above only contains ascii, the intersection of it + * with anything will still yield only ascii */ + _invlist_intersection(this_range, PL_XPosix_ptrs[_CC_ALPHA], &this_range); } - _invlist_union(cp_list, this_range, &cp_list); + _invlist_union(cp_foldable_list, this_range, &cp_foldable_list); literal_endpoint = 0; #endif } @@ -13144,7 +14078,7 @@ parseit: #endif /* Look at the longest folds first */ - for (cp_count = av_len(multi_char_matches); cp_count > 0; cp_count--) { + for (cp_count = av_tindex(multi_char_matches); cp_count > 0; cp_count--) { if (av_exists(multi_char_matches, cp_count)) { AV** this_array_ptr; @@ -13199,15 +14133,29 @@ parseit: return ret; } - /* If the character class contains only a single element, it may be - * optimizable into another node type which is smaller and runs faster. - * Check if this is the case for this class */ - if (element_count == 1 && ! ret_invlist) { + /* Here, we've gone through the entire class and dealt with multi-char + * folds. We are now in a position that we can do some checks to see if we + * can optimize this ANYOF node into a simpler one, even in Pass 1. + * Currently we only do two checks: + * 1) is in the unlikely event that the user has specified both, eg. \w and + * \W under /l, then the class matches everything. (This optimization + * is done only to make the optimizer code run later work.) + * 2) if the character class contains only a single element (including a + * single range), we see if there is an equivalent node for it. + * Other checks are possible */ + if (! ret_invlist /* Can't optimize if returning the constructed + inversion list */ + && (UNLIKELY(posixl_matches_all) || element_count == 1)) + { U8 op = END; U8 arg = 0; - if (namedclass > OOB_NAMEDCLASS) { /* this is a named class, like \w or - [:digit:] or \p{foo} */ + if (UNLIKELY(posixl_matches_all)) { + op = SANY; + } + else if (namedclass > OOB_NAMEDCLASS) { /* this is a named class, like + \w or [:digit:] or \p{foo} + */ /* All named classes are mapped into POSIXish nodes, with its FLAG * argument giving which class it is */ @@ -13263,14 +14211,6 @@ parseit: if (op > POSIXA) { /* /aa is same as /a */ op = POSIXA; } -#ifndef HAS_ISBLANK - if (op == POSIXL - && (namedclass == ANYOF_BLANK - || namedclass == ANYOF_NBLANK)) - { - op = POSIXA; - } -#endif join_posix: /* The odd numbered ones are the complements of the @@ -13325,13 +14265,16 @@ parseit: /* To get locale nodes to not use the full ANYOF size would * require moving the code above that writes the portions * of it that aren't in other nodes to after this point. - * e.g. ANYOF_CLASS_SET */ + * e.g. ANYOF_POSIXL_SET */ RExC_size = orig_size; } } else { RExC_emit = (regnode *)orig_emit; if (PL_regkind[op] == POSIXD) { + if (op == POSIXL) { + RExC_contains_locale = 1; + } if (invert) { op += NPOSIXD - POSIXD; } @@ -13347,13 +14290,17 @@ parseit: *flagp |= HASWIDTH|SIMPLE; } else if (PL_regkind[op] == EXACT) { - alloc_maybe_populate_EXACT(pRExC_state, ret, flagp, 0, value); + alloc_maybe_populate_EXACT(pRExC_state, ret, flagp, 0, value, + TRUE /* downgradable to EXACT */ + ); } RExC_parse = (char *) cur_parse; SvREFCNT_dec(posixes); + SvREFCNT_dec(nposixes); SvREFCNT_dec(cp_list); + SvREFCNT_dec(cp_foldable_list); return ret; } } @@ -13364,239 +14311,260 @@ parseit: /* If folding, we calculate all characters that could fold to or from the * ones already on the list */ - if (FOLD && cp_list) { - UV start, end; /* End points of code point ranges */ + if (cp_foldable_list) { + if (FOLD) { + UV start, end; /* End points of code point ranges */ + + SV* fold_intersection = NULL; + SV** use_list; + + /* Our calculated list will be for Unicode rules. For locale + * matching, we have to keep a separate list that is consulted at + * runtime only when the locale indicates Unicode rules. For + * non-locale, we just use to the general list */ + if (LOC) { + use_list = &only_utf8_locale_list; + } + else { + use_list = &cp_list; + } - SV* fold_intersection = NULL; + /* Only the characters in this class that participate in folds need + * be checked. Get the intersection of this class and all the + * possible characters that are foldable. This can quickly narrow + * down a large class */ + _invlist_intersection(PL_utf8_foldable, cp_foldable_list, + &fold_intersection); - /* If the highest code point is within Latin1, we can use the - * compiled-in Alphas list, and not have to go out to disk. This - * yields two false positives, the masculine and feminine ordinal - * indicators, which are weeded out below using the - * IS_IN_SOME_FOLD_L1() macro */ - if (invlist_highest(cp_list) < 256) { - _invlist_intersection(PL_L1Posix_ptrs[_CC_ALPHA], cp_list, - &fold_intersection); - } - else { + /* The folds for all the Latin1 characters are hard-coded into this + * program, but we have to go out to disk to get the others. */ + if (invlist_highest(cp_foldable_list) >= 256) { + + /* This is a hash that for a particular fold gives all + * characters that are involved in it */ + if (! PL_utf8_foldclosures) { - /* Here, there are non-Latin1 code points, so we will have to go - * fetch the list of all the characters that participate in folds - */ - if (! PL_utf8_foldable) { - SV* swash = swash_init("utf8", "_Perl_Any_Folds", - &PL_sv_undef, 1, 0); - PL_utf8_foldable = _get_swash_invlist(swash); - SvREFCNT_dec_NN(swash); - } - - /* This is a hash that for a particular fold gives all characters - * that are involved in it */ - if (! PL_utf8_foldclosures) { - - /* If we were unable to find any folds, then we likely won't be - * able to find the closures. So just create an empty list. - * Folding will effectively be restricted to the non-Unicode - * rules hard-coded into Perl. (This case happens legitimately - * during compilation of Perl itself before the Unicode tables - * are generated) */ - if (_invlist_len(PL_utf8_foldable) == 0) { - PL_utf8_foldclosures = newHV(); - } - else { /* If the folds haven't been read in, call a fold function * to force that */ if (! PL_utf8_tofold) { - U8 dummy[UTF8_MAXBYTES+1]; + U8 dummy[UTF8_MAXBYTES_CASE+1]; /* This string is just a short named one above \xff */ to_utf8_fold((U8*) HYPHEN_UTF8, dummy, NULL); assert(PL_utf8_tofold); /* Verify that worked */ } - PL_utf8_foldclosures = - _swash_inversion_hash(PL_utf8_tofold); + PL_utf8_foldclosures + = _swash_inversion_hash(PL_utf8_tofold); } } - /* Only the characters in this class that participate in folds need - * be checked. Get the intersection of this class and all the - * possible characters that are foldable. This can quickly narrow - * down a large class */ - _invlist_intersection(PL_utf8_foldable, cp_list, - &fold_intersection); - } - - /* Now look at the foldable characters in this class individually */ - invlist_iterinit(fold_intersection); - while (invlist_iternext(fold_intersection, &start, &end)) { - UV j; - - /* Locale folding for Latin1 characters is deferred until runtime */ - if (LOC && start < 256) { - start = 256; - } - - /* Look at every character in the range */ - for (j = start; j <= end; j++) { - - U8 foldbuf[UTF8_MAXBYTES_CASE+1]; - STRLEN foldlen; - SV** listp; - - if (j < 256) { - - /* We have the latin1 folding rules hard-coded here so that - * an innocent-looking character class, like /[ks]/i won't - * have to go out to disk to find the possible matches. - * XXX It would be better to generate these via regen, in - * case a new version of the Unicode standard adds new - * mappings, though that is not really likely, and may be - * caught by the default: case of the switch below. */ - - if (IS_IN_SOME_FOLD_L1(j)) { - - /* ASCII is always matched; non-ASCII is matched only - * under Unicode rules */ - if (isASCII(j) || AT_LEAST_UNI_SEMANTICS) { - cp_list = - add_cp_to_invlist(cp_list, PL_fold_latin1[j]); - } - else { - depends_list = - add_cp_to_invlist(depends_list, PL_fold_latin1[j]); + /* Now look at the foldable characters in this class individually */ + invlist_iterinit(fold_intersection); + while (invlist_iternext(fold_intersection, &start, &end)) { + UV j; + + /* Look at every character in the range */ + for (j = start; j <= end; j++) { + U8 foldbuf[UTF8_MAXBYTES_CASE+1]; + STRLEN foldlen; + SV** listp; + + if (j < 256) { + + /* We have the latin1 folding rules hard-coded here so + * that an innocent-looking character class, like + * /[ks]/i won't have to go out to disk to find the + * possible matches. XXX It would be better to + * generate these via regen, in case a new version of + * the Unicode standard adds new mappings, though that + * is not really likely, and may be caught by the + * default: case of the switch below. */ + + if (IS_IN_SOME_FOLD_L1(j)) { + + /* ASCII is always matched; non-ASCII is matched + * only under Unicode rules (which could happen + * under /l if the locale is a UTF-8 one */ + if (isASCII(j) || ! DEPENDS_SEMANTICS) { + *use_list = add_cp_to_invlist(*use_list, + PL_fold_latin1[j]); + } + else { + depends_list = + add_cp_to_invlist(depends_list, + PL_fold_latin1[j]); + } } - } - if (HAS_NONLATIN1_FOLD_CLOSURE(j) - && (! isASCII(j) || ! ASCII_FOLD_RESTRICTED)) - { - /* Certain Latin1 characters have matches outside - * Latin1. To get here, is one of those - * characters. None of these matches is valid for - * ASCII characters under /aa, which is why the 'if' - * just above excludes those. These matches only - * happen when the target string is utf8. The code - * below adds the single fold closures for to the - * inversion list. */ - switch (j) { - case 'k': - case 'K': - cp_list = - add_cp_to_invlist(cp_list, KELVIN_SIGN); - break; - case 's': - case 'S': - cp_list = add_cp_to_invlist(cp_list, + if (HAS_NONLATIN1_FOLD_CLOSURE(j) + && (! isASCII(j) || ! ASCII_FOLD_RESTRICTED)) + { + /* Certain Latin1 characters have matches outside + * Latin1. To get here, is one of those + * characters. None of these matches is valid for + * ASCII characters under /aa, which is why the 'if' + * just above excludes those. These matches only + * happen when the target string is utf8. The code + * below adds the single fold closures for to the + * inversion list. */ + + switch (j) { + case 'k': + case 'K': + *use_list = + add_cp_to_invlist(*use_list, KELVIN_SIGN); + break; + case 's': + case 'S': + *use_list = add_cp_to_invlist(*use_list, LATIN_SMALL_LETTER_LONG_S); - break; - case MICRO_SIGN: - cp_list = add_cp_to_invlist(cp_list, - GREEK_CAPITAL_LETTER_MU); - cp_list = add_cp_to_invlist(cp_list, - GREEK_SMALL_LETTER_MU); - break; - case LATIN_CAPITAL_LETTER_A_WITH_RING_ABOVE: - case LATIN_SMALL_LETTER_A_WITH_RING_ABOVE: - cp_list = - add_cp_to_invlist(cp_list, ANGSTROM_SIGN); - break; - case LATIN_SMALL_LETTER_Y_WITH_DIAERESIS: - cp_list = add_cp_to_invlist(cp_list, + break; + case MICRO_SIGN: + *use_list = add_cp_to_invlist(*use_list, + GREEK_CAPITAL_LETTER_MU); + *use_list = add_cp_to_invlist(*use_list, + GREEK_SMALL_LETTER_MU); + break; + case LATIN_CAPITAL_LETTER_A_WITH_RING_ABOVE: + case LATIN_SMALL_LETTER_A_WITH_RING_ABOVE: + *use_list = + add_cp_to_invlist(*use_list, ANGSTROM_SIGN); + break; + case LATIN_SMALL_LETTER_Y_WITH_DIAERESIS: + *use_list = add_cp_to_invlist(*use_list, LATIN_CAPITAL_LETTER_Y_WITH_DIAERESIS); - break; - case LATIN_SMALL_LETTER_SHARP_S: - cp_list = add_cp_to_invlist(cp_list, - LATIN_CAPITAL_LETTER_SHARP_S); - break; - case 'F': case 'f': - case 'I': case 'i': - case 'L': case 'l': - case 'T': case 't': - case 'A': case 'a': - case 'H': case 'h': - case 'J': case 'j': - case 'N': case 'n': - case 'W': case 'w': - case 'Y': case 'y': - /* These all are targets of multi-character - * folds from code points that require UTF8 to - * express, so they can't match unless the - * target string is in UTF-8, so no action here - * is necessary, as regexec.c properly handles - * the general case for UTF-8 matching and - * multi-char folds */ - break; - default: - /* Use deprecated warning to increase the - * chances of this being output */ - ckWARN2regdep(RExC_parse, "Perl folding rules are not up-to-date for 0x%"UVXf"; please use the perlbug utility to report;", j); - break; + break; + case LATIN_SMALL_LETTER_SHARP_S: + *use_list = add_cp_to_invlist(*use_list, + LATIN_CAPITAL_LETTER_SHARP_S); + break; + case 'F': case 'f': + case 'I': case 'i': + case 'L': case 'l': + case 'T': case 't': + case 'A': case 'a': + case 'H': case 'h': + case 'J': case 'j': + case 'N': case 'n': + case 'W': case 'w': + case 'Y': case 'y': + /* These all are targets of multi-character + * folds from code points that require UTF8 + * to express, so they can't match unless + * the target string is in UTF-8, so no + * action here is necessary, as regexec.c + * properly handles the general case for + * UTF-8 matching and multi-char folds */ + break; + default: + /* Use deprecated warning to increase the + * chances of this being output */ + ckWARN2reg_d(RExC_parse, "Perl folding rules are not up-to-date for 0x%"UVXf"; please use the perlbug utility to report;", j); + break; + } } + continue; } - continue; - } - /* Here is an above Latin1 character. We don't have the rules - * hard-coded for it. First, get its fold. This is the simple - * fold, as the multi-character folds have been handled earlier - * and separated out */ - _to_uni_fold_flags(j, foldbuf, &foldlen, - ((LOC) - ? FOLD_FLAGS_LOCALE - : (ASCII_FOLD_RESTRICTED) - ? FOLD_FLAGS_NOMIX_ASCII - : 0)); - - /* Single character fold of above Latin1. Add everything in - * its fold closure to the list that this node should match. - * The fold closures data structure is a hash with the keys - * being the UTF-8 of every character that is folded to, like - * 'k', and the values each an array of all code points that - * fold to its key. e.g. [ 'k', 'K', KELVIN_SIGN ]. - * Multi-character folds are not included */ - if ((listp = hv_fetch(PL_utf8_foldclosures, - (char *) foldbuf, foldlen, FALSE))) - { - AV* list = (AV*) *listp; - IV k; - for (k = 0; k <= av_len(list); k++) { - SV** c_p = av_fetch(list, k, FALSE); - UV c; - if (c_p == NULL) { - Perl_croak(aTHX_ "panic: invalid PL_utf8_foldclosures structure"); - } - c = SvUV(*c_p); - - /* /aa doesn't allow folds between ASCII and non-; /l - * doesn't allow them between above and below 256 */ - if ((ASCII_FOLD_RESTRICTED - && (isASCII(c) != isASCII(j))) - || (LOC && ((c < 256) != (j < 256)))) - { - continue; - } + /* Here is an above Latin1 character. We don't have the + * rules hard-coded for it. First, get its fold. This is + * the simple fold, as the multi-character folds have been + * handled earlier and separated out */ + _to_uni_fold_flags(j, foldbuf, &foldlen, + (ASCII_FOLD_RESTRICTED) + ? FOLD_FLAGS_NOMIX_ASCII + : 0); + + /* Single character fold of above Latin1. Add everything in + * its fold closure to the list that this node should match. + * The fold closures data structure is a hash with the keys + * being the UTF-8 of every character that is folded to, like + * 'k', and the values each an array of all code points that + * fold to its key. e.g. [ 'k', 'K', KELVIN_SIGN ]. + * Multi-character folds are not included */ + if ((listp = hv_fetch(PL_utf8_foldclosures, + (char *) foldbuf, foldlen, FALSE))) + { + AV* list = (AV*) *listp; + IV k; + for (k = 0; k <= av_tindex(list); k++) { + SV** c_p = av_fetch(list, k, FALSE); + UV c; + if (c_p == NULL) { + Perl_croak(aTHX_ "panic: invalid PL_utf8_foldclosures structure"); + } + c = SvUV(*c_p); - /* Folds involving non-ascii Latin1 characters - * under /d are added to a separate list */ - if (isASCII(c) || c > 255 || AT_LEAST_UNI_SEMANTICS) - { - cp_list = add_cp_to_invlist(cp_list, c); - } - else { - depends_list = add_cp_to_invlist(depends_list, c); + /* /aa doesn't allow folds between ASCII and non- */ + if ((ASCII_FOLD_RESTRICTED + && (isASCII(c) != isASCII(j)))) + { + continue; + } + + /* Folds under /l which cross the 255/256 boundary + * are added to a separate list. (These are valid + * only when the locale is UTF-8.) */ + if (c < 256 && LOC) { + *use_list = add_cp_to_invlist(*use_list, c); + continue; + } + + if (isASCII(c) || c > 255 || AT_LEAST_UNI_SEMANTICS) + { + cp_list = add_cp_to_invlist(cp_list, c); + } + else { + /* Similarly folds involving non-ascii Latin1 + * characters under /d are added to their list */ + depends_list = add_cp_to_invlist(depends_list, + c); + } } } } } - } - SvREFCNT_dec_NN(fold_intersection); + SvREFCNT_dec_NN(fold_intersection); + } + + /* Now that we have finished adding all the folds, there is no reason + * to keep the foldable list separate */ + _invlist_union(cp_list, cp_foldable_list, &cp_list); + SvREFCNT_dec_NN(cp_foldable_list); } /* And combine the result (if any) with any inversion list from posix * classes. The lists are kept separate up to now because we don't want to * fold the classes (folding of those is automatically handled by the swash * fetching code) */ - if (posixes) { + if (posixes || nposixes) { + if (posixes && AT_LEAST_ASCII_RESTRICTED) { + /* Under /a and /aa, nothing above ASCII matches these */ + _invlist_intersection(posixes, + PL_XPosix_ptrs[_CC_ASCII], + &posixes); + } + if (nposixes) { + if (DEPENDS_SEMANTICS) { + /* Under /d, everything in the upper half of the Latin1 range + * matches these complements */ + ANYOF_FLAGS(ret) |= ANYOF_NON_UTF8_NON_ASCII_ALL; + } + else if (AT_LEAST_ASCII_RESTRICTED) { + /* Under /a and /aa, everything above ASCII matches these + * complements */ + _invlist_union_complement_2nd(nposixes, + PL_XPosix_ptrs[_CC_ASCII], + &nposixes); + } + if (posixes) { + _invlist_union(posixes, nposixes, &posixes); + SvREFCNT_dec_NN(nposixes); + } + else { + posixes = nposixes; + } + } if (! DEPENDS_SEMANTICS) { if (cp_list) { _invlist_union(cp_list, posixes, &cp_list); @@ -13610,10 +14578,8 @@ parseit: /* Under /d, we put into a separate list the Latin1 things that * match only when the target string is utf8 */ SV* nonascii_but_latin1_properties = NULL; - _invlist_intersection(posixes, PL_Latin1, + _invlist_intersection(posixes, PL_UpperLatin1, &nonascii_but_latin1_properties); - _invlist_subtract(nonascii_but_latin1_properties, PL_ASCII, - &nonascii_but_latin1_properties); _invlist_subtract(posixes, nonascii_but_latin1_properties, &posixes); if (cp_list) { @@ -13647,7 +14613,6 @@ parseit: * , because having a Unicode property forces Unicode * semantics */ if (properties) { - bool warn_super = ! has_user_defined_property; if (cp_list) { /* If it matters to the final outcome, see if a non-property @@ -13658,14 +14623,8 @@ parseit: * are using above-Unicode code points indicates they should know * the issues involved */ if (warn_super) { - bool non_prop_matches_above_Unicode = - runtime_posix_matches_above_Unicode - | (invlist_highest(cp_list) > PERL_UNICODE_MAX); - if (invert) { - non_prop_matches_above_Unicode = - ! non_prop_matches_above_Unicode; - } - warn_super = ! non_prop_matches_above_Unicode; + warn_super = ! (invert + ^ (invlist_highest(cp_list) > PERL_UNICODE_MAX)); } _invlist_union(properties, cp_list, &cp_list); @@ -13676,7 +14635,7 @@ parseit: } if (warn_super) { - OP(ret) = ANYOF_WARN_SUPER; + ANYOF_FLAGS(ret) |= ANYOF_WARN_SUPER; } } @@ -13689,12 +14648,33 @@ parseit: * shouldn't. Therefore we can't invert folded locale now, as it won't be * folded until runtime */ + /* If we didn't do folding, it's because some information isn't available + * until runtime; set the run-time fold flag for these. (We don't have to + * worry about properties folding, as that is taken care of by the swash + * fetching). We know to set the flag if we have a non-NULL list for UTF-8 + * locales, or the class matches at least one 0-255 range code point */ + if (LOC && FOLD) { + if (only_utf8_locale_list) { + ANYOF_FLAGS(ret) |= ANYOF_LOC_FOLD; + } + else if (cp_list) { /* Look to see if there a 0-255 code point is in + the list */ + UV start, end; + invlist_iterinit(cp_list); + if (invlist_iternext(cp_list, &start, &end) && start < 256) { + ANYOF_FLAGS(ret) |= ANYOF_LOC_FOLD; + } + invlist_iterfinish(cp_list); + } + } + /* Optimize inverted simple patterns (e.g. [^a-z]) when everything is known * at compile time. Besides not inverting folded locale now, we can't * invert if there are things such as \w, which aren't known until runtime * */ - if (invert - && ! (LOC && (FOLD || (ANYOF_FLAGS(ret) & ANYOF_CLASS))) + if (cp_list + && invert + && ! (ANYOF_FLAGS(ret) & (ANYOF_LOCALE_FLAGS)) && ! depends_list && ! HAS_NONLOCALE_RUNTIME_PROPERTY_DEFINITION) { @@ -13724,15 +14704,6 @@ parseit: return orig_emit; } - /* If we didn't do folding, it's because some information isn't available - * until runtime; set the run-time fold flag for these. (We don't have to - * worry about properties folding, as that is taken care of by the swash - * fetching) */ - if (FOLD && LOC) - { - ANYOF_FLAGS(ret) |= ANYOF_LOC_FOLD; - } - /* Some character classes are equivalent to other nodes. Such nodes take * up less room and generally fewer operations to execute than ANYOF nodes. * Above, we checked for and optimized into some such equivalents for @@ -13751,8 +14722,13 @@ parseit: if (cp_list && ! invert && ! depends_list - && ! (ANYOF_FLAGS(ret) & ANYOF_CLASS) - && ! HAS_NONLOCALE_RUNTIME_PROPERTY_DEFINITION) + && ! (ANYOF_FLAGS(ret) & (ANYOF_LOCALE_FLAGS)) + && ! HAS_NONLOCALE_RUNTIME_PROPERTY_DEFINITION + + /* We don't optimize if we are supposed to make sure all non-Unicode + * code points raise a warning, as only ANYOF nodes have this check. + * */ + && ! ((ANYOF_FLAGS(ret) | ANYOF_WARN_SUPER) && ALWAYS_WARN_SUPER)) { UV start, end; U8 op = END; /* The optimzation node-type */ @@ -13776,7 +14752,7 @@ parseit: && (start < 256 || UTF)) { /* Here, the list contains a single code point. Can optimize - * into an EXACT node */ + * into an EXACTish node */ value = start; @@ -13806,12 +14782,6 @@ parseit: } } else { - if (! PL_utf8_foldable) { - SV* swash = swash_init("utf8", "_Perl_Any_Folds", - &PL_sv_undef, 1, 0); - PL_utf8_foldable = _get_swash_invlist(swash); - SvREFCNT_dec_NN(swash); - } if (_invlist_contains_cp(PL_utf8_foldable, value)) { op = EXACT; } @@ -13851,7 +14821,9 @@ parseit: RExC_parse = (char *)cur_parse; if (PL_regkind[op] == EXACT) { - alloc_maybe_populate_EXACT(pRExC_state, ret, flagp, 0, value); + alloc_maybe_populate_EXACT(pRExC_state, ret, flagp, 0, value, + TRUE /* downgradable to EXACT */ + ); } SvREFCNT_dec_NN(cp_list); @@ -13864,55 +14836,8 @@ parseit: * for things that belong in the bitmap, put them there, and delete from * . While we are at it, see if everything above 255 is in the * list, and if so, set a flag to speed up execution */ - ANYOF_BITMAP_ZERO(ret); - if (cp_list) { - - /* This gets set if we actually need to modify things */ - bool change_invlist = FALSE; - - UV start, end; - - /* Start looking through */ - invlist_iterinit(cp_list); - while (invlist_iternext(cp_list, &start, &end)) { - UV high; - int i; - - if (end == UV_MAX && start <= 256) { - ANYOF_FLAGS(ret) |= ANYOF_UNICODE_ALL; - } - - /* Quit if are above what we should change */ - if (start > 255) { - break; - } - change_invlist = TRUE; - - /* Set all the bits in the range, up to the max that we are doing */ - high = (end < 255) ? end : 255; - for (i = start; i <= (int) high; i++) { - if (! ANYOF_BITMAP_TEST(ret, i)) { - ANYOF_BITMAP_SET(ret, i); - prevvalue = value; - value = i; - } - } - } - invlist_iterfinish(cp_list); - - /* Done with loop; remove any code points that are in the bitmap from - * */ - if (change_invlist) { - _invlist_subtract(cp_list, PL_Latin1, &cp_list); - } - - /* If have completely emptied it, remove it completely */ - if (_invlist_len(cp_list) == 0) { - SvREFCNT_dec_NN(cp_list); - cp_list = NULL; - } - } + populate_ANYOF_from_invlist(ret, &cp_list); if (invert) { ANYOF_FLAGS(ret) |= ANYOF_INVERT; @@ -13929,6 +14854,7 @@ parseit: else { cp_list = depends_list; } + ANYOF_FLAGS(ret) |= ANYOF_UTF8; } /* If there is a swash and more than one element, we can't use the swash in @@ -13938,56 +14864,104 @@ parseit: swash = NULL; } - if (! cp_list - && ! HAS_NONLOCALE_RUNTIME_PROPERTY_DEFINITION) - { - ARG_SET(ret, ANYOF_NONBITMAP_EMPTY); + set_ANYOF_arg(pRExC_state, ret, cp_list, + (HAS_NONLOCALE_RUNTIME_PROPERTY_DEFINITION) + ? listsv : NULL, + only_utf8_locale_list, + swash, has_user_defined_property); + + *flagp |= HASWIDTH|SIMPLE; + + if (ANYOF_FLAGS(ret) & ANYOF_LOCALE_FLAGS) { + RExC_contains_locale = 1; + } + + return ret; +} + +#undef HAS_NONLOCALE_RUNTIME_PROPERTY_DEFINITION + +STATIC void +S_set_ANYOF_arg(pTHX_ RExC_state_t* const pRExC_state, + regnode* const node, + SV* const cp_list, + SV* const runtime_defns, + SV* const only_utf8_locale_list, + SV* const swash, + const bool has_user_defined_property) +{ + /* Sets the arg field of an ANYOF-type node 'node', using information about + * the node passed-in. If there is nothing outside the node's bitmap, the + * arg is set to ANYOF_NONBITMAP_EMPTY. Otherwise, it sets the argument to + * the count returned by add_data(), having allocated and stored an array, + * av, that that count references, as follows: + * av[0] stores the character class description in its textual form. + * This is used later (regexec.c:Perl_regclass_swash()) to + * initialize the appropriate swash, and is also useful for dumping + * the regnode. This is set to &PL_sv_undef if the textual + * description is not needed at run-time (as happens if the other + * elements completely define the class) + * av[1] if &PL_sv_undef, is a placeholder to later contain the swash + * computed from av[0]. But if no further computation need be done, + * the swash is stored here now (and av[0] is &PL_sv_undef). + * av[2] stores the inversion list of code points that match only if the + * current locale is UTF-8 + * av[3] stores the cp_list inversion list for use in addition or instead + * of av[0]; used only if cp_list exists and av[1] is &PL_sv_undef. + * (Otherwise everything needed is already in av[0] and av[1]) + * av[4] is set if any component of the class is from a user-defined + * property; used only if av[3] exists */ + + UV n; + + PERL_ARGS_ASSERT_SET_ANYOF_ARG; + + if (! cp_list && ! runtime_defns && ! only_utf8_locale_list) { + assert(! (ANYOF_FLAGS(node) + & (ANYOF_UTF8|ANYOF_NONBITMAP_NON_UTF8))); + ARG_SET(node, ANYOF_NONBITMAP_EMPTY); } else { - /* av[0] stores the character class description in its textual form: - * used later (regexec.c:Perl_regclass_swash()) to initialize the - * appropriate swash, and is also useful for dumping the regnode. - * av[1] if NULL, is a placeholder to later contain the swash computed - * from av[0]. But if no further computation need be done, the - * swash is stored there now. - * av[2] stores the cp_list inversion list for use in addition or - * instead of av[0]; used only if av[1] is NULL - * av[3] is set if any component of the class is from a user-defined - * property; used only if av[1] is NULL */ AV * const av = newAV(); SV *rv; - av_store(av, 0, (HAS_NONLOCALE_RUNTIME_PROPERTY_DEFINITION) - ? SvREFCNT_inc(listsv) : &PL_sv_undef); + assert(ANYOF_FLAGS(node) + & (ANYOF_UTF8|ANYOF_NONBITMAP_NON_UTF8|ANYOF_LOC_FOLD)); + + av_store(av, 0, (runtime_defns) + ? SvREFCNT_inc(runtime_defns) : &PL_sv_undef); if (swash) { av_store(av, 1, swash); SvREFCNT_dec_NN(cp_list); } else { - av_store(av, 1, NULL); + av_store(av, 1, &PL_sv_undef); if (cp_list) { - av_store(av, 2, cp_list); - av_store(av, 3, newSVuv(has_user_defined_property)); + av_store(av, 3, cp_list); + av_store(av, 4, newSVuv(has_user_defined_property)); } } + if (only_utf8_locale_list) { + av_store(av, 2, only_utf8_locale_list); + } + else { + av_store(av, 2, &PL_sv_undef); + } + rv = newRV_noinc(MUTABLE_SV(av)); - n = add_data(pRExC_state, 1, "s"); + n = add_data(pRExC_state, STR_WITH_LEN("s")); RExC_rxi->data->data[n] = (void*)rv; - ARG_SET(ret, n); + ARG_SET(node, n); } - - *flagp |= HASWIDTH|SIMPLE; - return ret; } -#undef HAS_NONLOCALE_RUNTIME_PROPERTY_DEFINITION /* reg_skipcomment() Absorbs an /x style # comments from the input stream. Returns true if there is more text remaining in the stream. - Will set the REG_SEEN_RUN_ON_COMMENT flag if the comment + Will set the REG_RUN_ON_COMMENT_SEEN flag if the comment terminates the pattern without including a newline. Note its the callers responsibility to ensure that we are @@ -14010,7 +14984,7 @@ S_reg_skipcomment(pTHX_ RExC_state_t *pR if (!ended) { /* we ran off the end of the pattern without ending the comment, so we have to add an \n when wrapping */ - RExC_seen |= REG_SEEN_RUN_ON_COMMENT; + RExC_seen |= REG_RUN_ON_COMMENT_SEEN; return 0; } else return 1; @@ -14091,14 +15065,15 @@ S_reg_node(pTHX_ RExC_state_t *pRExC_sta FILL_ADVANCE_NODE(ptr, op); #ifdef RE_TRACK_PATTERN_OFFSETS if (RExC_offsets) { /* MJD */ - MJD_OFFSET_DEBUG(("%s:%d: (op %s) %s %"UVuf" (len %"UVuf") (max %"UVuf").\n", - "reg_node", __LINE__, + MJD_OFFSET_DEBUG( + ("%s:%d: (op %s) %s %"UVuf" (len %"UVuf") (max %"UVuf").\n", + "reg_node", __LINE__, PL_reg_name[op], - (UV)(RExC_emit - RExC_emit_start) > RExC_offsets[0] + (UV)(RExC_emit - RExC_emit_start) > RExC_offsets[0] ? "Overwriting end of array!\n" : "OK", (UV)(RExC_emit - RExC_emit_start), (UV)(RExC_parse - RExC_start), - (UV)RExC_offsets[0])); + (UV)RExC_offsets[0])); Set_Node_Offset(RExC_emit, RExC_parse + (op == END)); } #endif @@ -14122,16 +15097,16 @@ S_reganode(pTHX_ RExC_state_t *pRExC_sta if (SIZE_ONLY) { SIZE_ALIGN(RExC_size); RExC_size += 2; - /* + /* We can't do this: - - assert(2==regarglen[op]+1); + + assert(2==regarglen[op]+1); Anything larger than this has to allocate the extra amount. If we changed this to be: - + RExC_size += (1 + regarglen[op]); - + then it wouldn't matter. Its not clear what side effect might come from that so its not done so far. -- dmq @@ -14147,18 +15122,19 @@ S_reganode(pTHX_ RExC_state_t *pRExC_sta FILL_ADVANCE_NODE_ARG(ptr, op, arg); #ifdef RE_TRACK_PATTERN_OFFSETS if (RExC_offsets) { /* MJD */ - MJD_OFFSET_DEBUG(("%s(%d): (op %s) %s %"UVuf" <- %"UVuf" (max %"UVuf").\n", + MJD_OFFSET_DEBUG( + ("%s(%d): (op %s) %s %"UVuf" <- %"UVuf" (max %"UVuf").\n", "reganode", __LINE__, PL_reg_name[op], - (UV)(RExC_emit - RExC_emit_start) > RExC_offsets[0] ? + (UV)(RExC_emit - RExC_emit_start) > RExC_offsets[0] ? "Overwriting end of array!\n" : "OK", (UV)(RExC_emit - RExC_emit_start), (UV)(RExC_parse - RExC_start), - (UV)RExC_offsets[0])); + (UV)RExC_offsets[0])); Set_Cur_Node_Offset; } -#endif +#endif RExC_emit = ptr; return(ret); } @@ -14166,7 +15142,7 @@ S_reganode(pTHX_ RExC_state_t *pRExC_sta /* - reguni - emit (if appropriate) a Unicode character */ -STATIC STRLEN +PERL_STATIC_INLINE STRLEN S_reguni(pTHX_ const RExC_state_t *pRExC_state, UV uv, char* s) { dVAR; @@ -14227,30 +15203,32 @@ S_reginsert(pTHX_ RExC_state_t *pRExC_st StructCopy(--src, --dst, regnode); #ifdef RE_TRACK_PATTERN_OFFSETS if (RExC_offsets) { /* MJD 20010112 */ - MJD_OFFSET_DEBUG(("%s(%d): (op %s) %s copy %"UVuf" -> %"UVuf" (max %"UVuf").\n", + MJD_OFFSET_DEBUG( + ("%s(%d): (op %s) %s copy %"UVuf" -> %"UVuf" (max %"UVuf").\n", "reg_insert", __LINE__, PL_reg_name[op], - (UV)(dst - RExC_emit_start) > RExC_offsets[0] + (UV)(dst - RExC_emit_start) > RExC_offsets[0] ? "Overwriting end of array!\n" : "OK", (UV)(src - RExC_emit_start), (UV)(dst - RExC_emit_start), - (UV)RExC_offsets[0])); + (UV)RExC_offsets[0])); Set_Node_Offset_To_R(dst-RExC_emit_start, Node_Offset(src)); Set_Node_Length_To_R(dst-RExC_emit_start, Node_Length(src)); } #endif } - + place = opnd; /* Op node, where operand used to be. */ #ifdef RE_TRACK_PATTERN_OFFSETS if (RExC_offsets) { /* MJD */ - MJD_OFFSET_DEBUG(("%s(%d): (op %s) %s %"UVuf" <- %"UVuf" (max %"UVuf").\n", + MJD_OFFSET_DEBUG( + ("%s(%d): (op %s) %s %"UVuf" <- %"UVuf" (max %"UVuf").\n", "reginsert", __LINE__, PL_reg_name[op], - (UV)(place - RExC_emit_start) > RExC_offsets[0] + (UV)(place - RExC_emit_start) > RExC_offsets[0] ? "Overwriting end of array!\n" : "OK", (UV)(place - RExC_emit_start), (UV)(RExC_parse - RExC_start), @@ -14258,7 +15236,7 @@ S_reginsert(pTHX_ RExC_state_t *pRExC_st Set_Node_Offset(place, RExC_parse); Set_Node_Length(place, 1); } -#endif +#endif src = NEXTOPER(place); FILL_ADVANCE_NODE(place, op); Zero(src, offset, regnode); @@ -14270,7 +15248,8 @@ S_reginsert(pTHX_ RExC_state_t *pRExC_st */ /* TODO: All three parms should be const */ STATIC void -S_regtail(pTHX_ RExC_state_t *pRExC_state, regnode *p, const regnode *val,U32 depth) +S_regtail(pTHX_ RExC_state_t *pRExC_state, regnode *p, + const regnode *val,U32 depth) { dVAR; regnode *scan; @@ -14291,7 +15270,7 @@ S_regtail(pTHX_ RExC_state_t *pRExC_stat DEBUG_PARSE_r({ SV * const mysv=sv_newmortal(); DEBUG_PARSE_MSG((scan==p ? "tail" : "")); - regprop(RExC_rx, mysv, scan); + regprop(RExC_rx, mysv, scan, NULL); PerlIO_printf(Perl_debug_log, "~ %s (%d) %s %s\n", SvPV_nolen_const(mysv), REG_NODE_NUM(scan), (temp == NULL ? "->" : ""), @@ -14317,7 +15296,7 @@ S_regtail(pTHX_ RExC_state_t *pRExC_stat - Look for optimizable sequences at the same time. - currently only looks for EXACT chains. -This is experimental code. The idea is to use this routine to perform +This is experimental code. The idea is to use this routine to perform in place optimizations on branches and groups as they are constructed, with the long term intention of removing optimization from study_chunk so that it is purely analytical. @@ -14329,7 +15308,8 @@ to control which is which. /* TODO: All four parms should be const */ STATIC U8 -S_regtail_study(pTHX_ RExC_state_t *pRExC_state, regnode *p, const regnode *val,U32 depth) +S_regtail_study(pTHX_ RExC_state_t *pRExC_state, regnode *p, + const regnode *val,U32 depth) { dVAR; regnode *scan; @@ -14352,8 +15332,9 @@ S_regtail_study(pTHX_ RExC_state_t *pREx regnode * const temp = regnext(scan); #ifdef EXPERIMENTAL_INPLACESCAN if (PL_regkind[OP(scan)] == EXACT) { - bool has_exactf_sharp_s; /* Unexamined in this routine */ - if (join_exact(pRExC_state,scan,&min, &has_exactf_sharp_s, 1,val,depth+1)) + bool unfolded_multi_char; /* Unexamined in this routine */ + if (join_exact(pRExC_state, scan, &min, + &unfolded_multi_char, 1, val, depth+1)) return EXACT; } #endif @@ -14361,10 +15342,10 @@ S_regtail_study(pTHX_ RExC_state_t *pREx switch (OP(scan)) { case EXACT: case EXACTF: + case EXACTFA_NO_TRIE: case EXACTFA: case EXACTFU: case EXACTFU_SS: - case EXACTFU_TRICKYFOLD: case EXACTFL: if( exact == PSEUDO ) exact= OP(scan); @@ -14379,7 +15360,7 @@ S_regtail_study(pTHX_ RExC_state_t *pREx DEBUG_PARSE_r({ SV * const mysv=sv_newmortal(); DEBUG_PARSE_MSG((scan==p ? "tsdy" : "")); - regprop(RExC_rx, mysv, scan); + regprop(RExC_rx, mysv, scan, NULL); PerlIO_printf(Perl_debug_log, "~ %s (%d) -> %s\n", SvPV_nolen_const(mysv), REG_NODE_NUM(scan), @@ -14392,8 +15373,9 @@ S_regtail_study(pTHX_ RExC_state_t *pREx DEBUG_PARSE_r({ SV * const mysv_val=sv_newmortal(); DEBUG_PARSE_MSG(""); - regprop(RExC_rx, mysv_val, val); - PerlIO_printf(Perl_debug_log, "~ attach to %s (%"IVdf") offset to %"IVdf"\n", + regprop(RExC_rx, mysv_val, val, NULL); + PerlIO_printf(Perl_debug_log, + "~ attach to %s (%"IVdf") offset to %"IVdf"\n", SvPV_nolen_const(mysv_val), (IV)REG_NODE_NUM(val), (IV)(val - scan) @@ -14414,23 +15396,49 @@ S_regtail_study(pTHX_ RExC_state_t *pREx - regdump - dump a regexp onto Perl_debug_log in vaguely comprehensible form */ #ifdef DEBUGGING -static void + +static void +S_regdump_intflags(pTHX_ const char *lead, const U32 flags) +{ + int bit; + int set=0; + + ASSUME(REG_INTFLAGS_NAME_SIZE <= sizeof(flags)*8); + + for (bit=0; bitanchored_substr) { - RE_PV_QUOTED_DECL(s, 0, dsv, SvPVX_const(r->anchored_substr), + RE_PV_QUOTED_DECL(s, 0, dsv, SvPVX_const(r->anchored_substr), RE_SV_DUMPLEN(r->anchored_substr), 30); PerlIO_printf(Perl_debug_log, "anchored %s%s at %"IVdf" ", s, RE_SV_TAIL(r->anchored_substr), (IV)r->anchored_offset); } else if (r->anchored_utf8) { - RE_PV_QUOTED_DECL(s, 1, dsv, SvPVX_const(r->anchored_utf8), + RE_PV_QUOTED_DECL(s, 1, dsv, SvPVX_const(r->anchored_utf8), RE_SV_DUMPLEN(r->anchored_utf8), 30); PerlIO_printf(Perl_debug_log, "anchored utf8 %s%s at %"IVdf" ", s, RE_SV_TAIL(r->anchored_utf8), (IV)r->anchored_offset); - } + } if (r->float_substr) { - RE_PV_QUOTED_DECL(s, 0, dsv, SvPVX_const(r->float_substr), + RE_PV_QUOTED_DECL(s, 0, dsv, SvPVX_const(r->float_substr), RE_SV_DUMPLEN(r->float_substr), 30); PerlIO_printf(Perl_debug_log, "floating %s%s at %"IVdf"..%"UVuf" ", s, RE_SV_TAIL(r->float_substr), (IV)r->float_min_offset, (UV)r->float_max_offset); } else if (r->float_utf8) { - RE_PV_QUOTED_DECL(s, 1, dsv, SvPVX_const(r->float_utf8), + RE_PV_QUOTED_DECL(s, 1, dsv, SvPVX_const(r->float_utf8), RE_SV_DUMPLEN(r->float_utf8), 30); PerlIO_printf(Perl_debug_log, "floating utf8 %s%s at %"IVdf"..%"UVuf" ", @@ -14513,7 +15521,7 @@ Perl_regdump(pTHX_ const regexp *r) (r->check_substr == r->float_substr && r->check_utf8 == r->float_utf8 ? "(checking floating" : "(checking anchored")); - if (r->extflags & RXf_NOSCAN) + if (r->intflags & PREGf_NOSCAN) PerlIO_printf(Perl_debug_log, " noscan"); if (r->extflags & RXf_CHECK_ALL) PerlIO_printf(Perl_debug_log, " isall"); @@ -14521,22 +15529,22 @@ Perl_regdump(pTHX_ const regexp *r) PerlIO_printf(Perl_debug_log, ") "); if (ri->regstclass) { - regprop(r, sv, ri->regstclass); + regprop(r, sv, ri->regstclass, NULL); PerlIO_printf(Perl_debug_log, "stclass %s ", SvPVX_const(sv)); } - if (r->extflags & RXf_ANCH) { + if (r->intflags & PREGf_ANCH) { PerlIO_printf(Perl_debug_log, "anchored"); - if (r->extflags & RXf_ANCH_BOL) + if (r->intflags & PREGf_ANCH_BOL) PerlIO_printf(Perl_debug_log, "(BOL)"); - if (r->extflags & RXf_ANCH_MBOL) + if (r->intflags & PREGf_ANCH_MBOL) PerlIO_printf(Perl_debug_log, "(MBOL)"); - if (r->extflags & RXf_ANCH_SBOL) + if (r->intflags & PREGf_ANCH_SBOL) PerlIO_printf(Perl_debug_log, "(SBOL)"); - if (r->extflags & RXf_ANCH_GPOS) + if (r->intflags & PREGf_ANCH_GPOS) PerlIO_printf(Perl_debug_log, "(GPOS)"); PerlIO_putc(Perl_debug_log, ' '); } - if (r->extflags & RXf_GPOS_SEEN) + if (r->intflags & PREGf_GPOS_SEEN) PerlIO_printf(Perl_debug_log, "GPOS:%"UVuf" ", (UV)r->gofs); if (r->intflags & PREGf_SKIP) PerlIO_printf(Perl_debug_log, "plus "); @@ -14546,7 +15554,10 @@ Perl_regdump(pTHX_ const regexp *r) if (r->extflags & RXf_EVAL_SEEN) PerlIO_printf(Perl_debug_log, "with eval "); PerlIO_printf(Perl_debug_log, "\n"); - DEBUG_FLAGS_r(regdump_extflags("r->extflags: ",r->extflags)); + DEBUG_FLAGS_r({ + regdump_extflags("r->extflags: ",r->extflags); + regdump_intflags("r->intflags: ",r->intflags); + }); #else PERL_ARGS_ASSERT_REGDUMP; PERL_UNUSED_CONTEXT; @@ -14555,21 +15566,11 @@ Perl_regdump(pTHX_ const regexp *r) } /* -- regprop - printable representation of opcode +- regprop - printable representation of opcode, with run time support */ -#define EMIT_ANYOF_TEST_SEPARATOR(do_sep,sv,flags) \ -STMT_START { \ - if (do_sep) { \ - Perl_sv_catpvf(aTHX_ sv,"%s][%s",PL_colors[1],PL_colors[0]); \ - if (flags & ANYOF_INVERT) \ - /*make sure the invert info is in each */ \ - sv_catpvs(sv, "^"); \ - do_sep = 0; \ - } \ -} STMT_END void -Perl_regprop(pTHX_ const regexp *prog, SV *sv, const regnode *o) +Perl_regprop(pTHX_ const regexp *prog, SV *sv, const regnode *o, const regmatch_info *reginfo) { #ifdef DEBUGGING dVAR; @@ -14585,10 +15586,10 @@ Perl_regprop(pTHX_ const regexp *prog, S || _CC_VERTSPACE != 16 #error Need to adjust order of anyofs[] #endif - "[\\w]", - "[\\W]", - "[\\d]", - "[\\D]", + "\\w", + "\\W", + "\\d", + "\\D", "[:alpha:]", "[:^alpha:]", "[:lower:]", @@ -14605,8 +15606,8 @@ Perl_regprop(pTHX_ const regexp *prog, S "[:^graph:]", "[:cased:]", "[:^cased:]", - "[\\s]", - "[\\S]", + "\\s", + "\\S", "[:blank:]", "[:^blank:]", "[:xdigit:]", @@ -14617,12 +15618,12 @@ Perl_regprop(pTHX_ const regexp *prog, S "[:^cntrl:]", "[:ascii:]", "[:^ascii:]", - "[\\v]", - "[\\V]" + "\\v", + "\\V" }; RXi_GET_DECL(prog,progi); GET_RE_DEBUG_FLAGS_DECL; - + PERL_ARGS_ASSERT_REGPROP; sv_setpvs(sv, ""); @@ -14630,16 +15631,17 @@ Perl_regprop(pTHX_ const regexp *prog, S if (OP(o) > REGNODE_MAX) /* regnode.type is unsigned */ /* It would be nice to FAIL() here, but this may be called from regexec.c, and it would be hard to supply pRExC_state. */ - Perl_croak(aTHX_ "Corrupted regexp opcode %d > %d", (int)OP(o), (int)REGNODE_MAX); + Perl_croak(aTHX_ "Corrupted regexp opcode %d > %d", + (int)OP(o), (int)REGNODE_MAX); sv_catpv(sv, PL_reg_name[OP(o)]); /* Take off const! */ k = PL_regkind[OP(o)]; if (k == EXACT) { sv_catpvs(sv, " "); - /* Using is_utf8_string() (via PERL_PV_UNI_DETECT) - * is a crude hack but it may be the best for now since - * we have no flag "this EXACTish node was UTF-8" + /* Using is_utf8_string() (via PERL_PV_UNI_DETECT) + * is a crude hack but it may be the best for now since + * we have no flag "this EXACTish node was UTF-8" * --jhi */ pv_pretty(sv, STRING(o), STR_LEN(o), 60, PL_colors[0], PL_colors[1], PERL_PV_ESCAPE_UNI_DETECT | @@ -14658,44 +15660,28 @@ Perl_regprop(pTHX_ const regexp *prog, S NULL; const reg_trie_data * const trie = (reg_trie_data*)progi->data->data[!IS_TRIE_AC(op) ? n : ac->trie]; - + Perl_sv_catpvf(aTHX_ sv, "-%s",PL_reg_name[o->flags]); DEBUG_TRIE_COMPILE_r( - Perl_sv_catpvf(aTHX_ sv, - "", - (UV)trie->startstate, - (IV)trie->statecount-1, /* -1 because of the unused 0 element */ - (UV)trie->wordcount, - (UV)trie->minlen, - (UV)trie->maxlen, - (UV)TRIE_CHARCOUNT(trie), - (UV)trie->uniquecharcount - ) + Perl_sv_catpvf(aTHX_ sv, + "", + (UV)trie->startstate, + (IV)trie->statecount-1, /* -1 because of the unused 0 element */ + (UV)trie->wordcount, + (UV)trie->minlen, + (UV)trie->maxlen, + (UV)TRIE_CHARCOUNT(trie), + (UV)trie->uniquecharcount + ); ); if ( IS_ANYOF_TRIE(op) || trie->bitmap ) { - int i; - int rangestart = -1; - U8* bitmap = IS_ANYOF_TRIE(op) ? (U8*)ANYOF_BITMAP(o) : (U8*)TRIE_BITMAP(trie); sv_catpvs(sv, "["); - for (i = 0; i <= 256; i++) { - if (i < 256 && BITMAP_TEST(bitmap,i)) { - if (rangestart == -1) - rangestart = i; - } else if (rangestart != -1) { - if (i <= rangestart + 3) - for (; rangestart < i; rangestart++) - put_byte(sv, rangestart); - else { - put_byte(sv, rangestart); - sv_catpvs(sv, "-"); - put_byte(sv, i - 1); - } - rangestart = -1; - } - } + (void) put_latin1_charclass_innards(sv, IS_ANYOF_TRIE(op) + ? ANYOF_BITMAP(o) + : TRIE_BITMAP(trie)); sv_catpvs(sv, "]"); - } - + } + } else if (k == CURLY) { if (OP(o) == CURLYM || OP(o) == CURLYN || OP(o) == CURLYX) Perl_sv_catpvf(aTHX_ sv, "[%d]", o->flags); /* Parenth number */ @@ -14703,7 +15689,9 @@ Perl_regprop(pTHX_ const regexp *prog, S } else if (k == WHILEM && o->flags) /* Ordinal/of */ Perl_sv_catpvf(aTHX_ sv, "[%d/%d]", o->flags & 0xf, o->flags>>4); - else if (k == REF || k == OPEN || k == CLOSE || k == GROUPP || OP(o)==ACCEPT) { + else if (k == REF || k == OPEN || k == CLOSE + || k == GROUPP || OP(o)==ACCEPT) + { Perl_sv_catpvf(aTHX_ sv, "%d", (int)ARG(o)); /* Parenth number */ if ( RXp_PAREN_NAMES(prog) ) { if ( k != REF || (OP(o) < NREF)) { @@ -14711,7 +15699,7 @@ Perl_regprop(pTHX_ const regexp *prog, S SV **name= av_fetch(list, ARG(o), 0 ); if (name) Perl_sv_catpvf(aTHX_ sv, " '%"SVf"'", SVfARG(*name)); - } + } else { AV *list= MUTABLE_AV(progi->data->data[ progi->name_list_idx ]); SV *sv_dat= MUTABLE_SV(progi->data->data[ ARG( o ) ]); @@ -14726,22 +15714,37 @@ Perl_regprop(pTHX_ const regexp *prog, S Perl_sv_catpvf(aTHX_ sv, " '%"SVf"'", SVfARG(*name)); } } - } - } else if (k == GOSUB) - Perl_sv_catpvf(aTHX_ sv, "%d[%+d]", (int)ARG(o),(int)ARG2L(o)); /* Paren and offset */ + } + if ( k == REF && reginfo) { + U32 n = ARG(o); /* which paren pair */ + I32 ln = prog->offs[n].start; + if (prog->lastparen < n || ln == -1) + Perl_sv_catpvf(aTHX_ sv, ": FAIL"); + else if (ln == prog->offs[n].end) + Perl_sv_catpvf(aTHX_ sv, ": ACCEPT - EMPTY STRING"); + else { + const char *s = reginfo->strbeg + ln; + Perl_sv_catpvf(aTHX_ sv, ": "); + Perl_pv_pretty( aTHX_ sv, s, prog->offs[n].end - prog->offs[n].start, 32, 0, 0, + PERL_PV_ESCAPE_UNI_DETECT|PERL_PV_PRETTY_NOCLEAR|PERL_PV_PRETTY_ELLIPSES|PERL_PV_PRETTY_QUOTE ); + } + } + } else if (k == GOSUB) + /* Paren and offset */ + Perl_sv_catpvf(aTHX_ sv, "%d[%+d]", (int)ARG(o),(int)ARG2L(o)); else if (k == VERB) { - if (!o->flags) - Perl_sv_catpvf(aTHX_ sv, ":%"SVf, + if (!o->flags) + Perl_sv_catpvf(aTHX_ sv, ":%"SVf, SVfARG((MUTABLE_SV(progi->data->data[ ARG( o ) ])))); } else if (k == LOGICAL) - Perl_sv_catpvf(aTHX_ sv, "[%d]", o->flags); /* 2: embedded, otherwise 1 */ + /* 2: embedded, otherwise 1 */ + Perl_sv_catpvf(aTHX_ sv, "[%d]", o->flags); else if (k == ANYOF) { - int i, rangestart = -1; const U8 flags = ANYOF_FLAGS(o); int do_sep = 0; - if (flags & ANYOF_LOCALE) + if (flags & ANYOF_LOCALE_FLAGS) sv_catpvs(sv, "{loc}"); if (flags & ANYOF_LOC_FOLD) sv_catpvs(sv, "{i}"); @@ -14750,140 +15753,137 @@ Perl_regprop(pTHX_ const regexp *prog, S sv_catpvs(sv, "^"); /* output what the standard cp 0-255 bitmap matches */ - for (i = 0; i <= 256; i++) { - if (i < 256 && ANYOF_BITMAP_TEST(o,i)) { - if (rangestart == -1) - rangestart = i; - } else if (rangestart != -1) { - if (i <= rangestart + 3) - for (; rangestart < i; rangestart++) - put_byte(sv, rangestart); - else { - put_byte(sv, rangestart); - sv_catpvs(sv, "-"); - put_byte(sv, i - 1); - } - do_sep = 1; - rangestart = -1; - } - } - - EMIT_ANYOF_TEST_SEPARATOR(do_sep,sv,flags); - /* output any special charclass tests (used entirely under use locale) */ - if (ANYOF_CLASS_TEST_ANY_SET(o)) - for (i = 0; i < (int)(sizeof(anyofs)/sizeof(char*)); i++) - if (ANYOF_CLASS_TEST(o,i)) { + do_sep = put_latin1_charclass_innards(sv, ANYOF_BITMAP(o)); + + /* output any special charclass tests (used entirely under use + * locale) * */ + if (ANYOF_POSIXL_TEST_ANY_SET(o)) { + int i; + for (i = 0; i < ANYOF_POSIXL_MAX; i++) { + if (ANYOF_POSIXL_TEST(o,i)) { sv_catpv(sv, anyofs[i]); do_sep = 1; } - - EMIT_ANYOF_TEST_SEPARATOR(do_sep,sv,flags); - - if (flags & ANYOF_NON_UTF8_LATIN1_ALL) { - sv_catpvs(sv, "{non-utf8-latin1-all}"); - } - - /* output information about the unicode matching */ - if (flags & ANYOF_UNICODE_ALL) - sv_catpvs(sv, "{unicode_all}"); - else if (ANYOF_NONBITMAP(o)) - sv_catpvs(sv, "{unicode}"); - if (flags & ANYOF_NONBITMAP_NON_UTF8) - sv_catpvs(sv, "{outside bitmap}"); - - if (ANYOF_NONBITMAP(o)) { - SV *lv; /* Set if there is something outside the bit map */ - SV * const sw = regclass_swash(prog, o, FALSE, &lv, NULL); - bool byte_output = FALSE; /* If something in the bitmap has been - output */ - - if (lv && lv != &PL_sv_undef) { - if (sw) { - U8 s[UTF8_MAXBYTES_CASE+1]; - - for (i = 0; i <= 256; i++) { /* Look at chars in bitmap */ - uvchr_to_utf8(s, i); - - if (i < 256 - && ! ANYOF_BITMAP_TEST(o, i) /* Don't duplicate - things already - output as part - of the bitmap */ - && swash_fetch(sw, s, TRUE)) - { - if (rangestart == -1) - rangestart = i; - } else if (rangestart != -1) { - byte_output = TRUE; - if (i <= rangestart + 3) - for (; rangestart < i; rangestart++) { - put_byte(sv, rangestart); - } - else { - put_byte(sv, rangestart); - sv_catpvs(sv, "-"); - put_byte(sv, i-1); - } - rangestart = -1; - } - } - } + } + } - { - char *s = savesvpv(lv); - char * const origs = s; + if ((flags & (ANYOF_ABOVE_LATIN1_ALL + |ANYOF_UTF8 + |ANYOF_NONBITMAP_NON_UTF8 + |ANYOF_LOC_FOLD))) + { + if (do_sep) { + Perl_sv_catpvf(aTHX_ sv,"%s][%s",PL_colors[1],PL_colors[0]); + if (flags & ANYOF_INVERT) + /*make sure the invert info is in each */ + sv_catpvs(sv, "^"); + } + + if (flags & ANYOF_NON_UTF8_NON_ASCII_ALL) { + sv_catpvs(sv, "{non-utf8-latin1-all}"); + } + + /* output information about the unicode matching */ + if (flags & ANYOF_ABOVE_LATIN1_ALL) + sv_catpvs(sv, "{unicode_all}"); + else if (ARG(o) != ANYOF_NONBITMAP_EMPTY) { + SV *lv; /* Set if there is something outside the bit map. */ + bool byte_output = FALSE; /* If something in the bitmap has + been output */ + SV *only_utf8_locale; + + /* Get the stuff that wasn't in the bitmap */ + (void) _get_regclass_nonbitmap_data(prog, o, FALSE, + &lv, &only_utf8_locale); + if (lv && lv != &PL_sv_undef) { + char *s = savesvpv(lv); + char * const origs = s; - while (*s && *s != '\n') - s++; + while (*s && *s != '\n') + s++; - if (*s == '\n') { - const char * const t = ++s; + if (*s == '\n') { + const char * const t = ++s; + + if (flags & ANYOF_NONBITMAP_NON_UTF8) { + sv_catpvs(sv, "{outside bitmap}"); + } + else { + sv_catpvs(sv, "{utf8}"); + } if (byte_output) { sv_catpvs(sv, " "); } - while (*s) { - if (*s == '\n') { + while (*s) { + if (*s == '\n') { /* Truncate very long output */ - if (s - origs > 256) { - Perl_sv_catpvf(aTHX_ sv, - "%.*s...", - (int) (s - origs - 1), - t); - goto out_dump; - } - *s = ' '; - } - else if (*s == '\t') { - *s = '-'; - } - s++; - } - if (s[-1] == ' ') - s[-1] = 0; + if (s - origs > 256) { + Perl_sv_catpvf(aTHX_ sv, + "%.*s...", + (int) (s - origs - 1), + t); + goto out_dump; + } + *s = ' '; + } + else if (*s == '\t') { + *s = '-'; + } + s++; + } + if (s[-1] == ' ') + s[-1] = 0; - sv_catpv(sv, t); - } + sv_catpv(sv, t); + } - out_dump: + out_dump: - Safefree(origs); - } - SvREFCNT_dec_NN(lv); - } + Safefree(origs); + SvREFCNT_dec_NN(lv); + } + + if ((flags & ANYOF_LOC_FOLD) + && only_utf8_locale + && only_utf8_locale != &PL_sv_undef) + { + UV start, end; + int max_entries = 256; + + sv_catpvs(sv, "{utf8 locale}"); + invlist_iterinit(only_utf8_locale); + while (invlist_iternext(only_utf8_locale, + &start, &end)) { + put_range(sv, start, end); + max_entries --; + if (max_entries < 0) { + sv_catpvs(sv, "..."); + break; + } + } + invlist_iterfinish(only_utf8_locale); + } + } } Perl_sv_catpvf(aTHX_ sv, "%s]", PL_colors[1]); } else if (k == POSIXD || k == NPOSIXD) { U8 index = FLAGS(o) * 2; - if (index > (sizeof(anyofs) / sizeof(anyofs[0]))) { - Perl_sv_catpvf(aTHX_ sv, "[illegal type=%d])", index); + if (index < C_ARRAY_LENGTH(anyofs)) { + if (*anyofs[index] != '[') { + sv_catpv(sv, "["); + } + sv_catpv(sv, anyofs[index]); + if (*anyofs[index] != '[') { + sv_catpv(sv, "]"); + } } else { - sv_catpv(sv, anyofs[index]); + Perl_sv_catpvf(aTHX_ sv, "[illegal type=%d])", index); } } else if (k == BRANCHJ && (OP(o) == UNLESSM || OP(o) == IFMATCH)) @@ -14893,9 +15893,12 @@ Perl_regprop(pTHX_ const regexp *prog, S PERL_UNUSED_ARG(sv); PERL_UNUSED_ARG(o); PERL_UNUSED_ARG(prog); + PERL_UNUSED_ARG(reginfo); #endif /* DEBUGGING */ } + + SV * Perl_re_intuit_string(pTHX_ REGEXP * const r) { /* Assume that RE_INTUIT is set */ @@ -14925,17 +15928,17 @@ Perl_re_intuit_string(pTHX_ REGEXP * con return prog->check_substr ? prog->check_substr : prog->check_utf8; } -/* - pregfree() - - handles refcounting and freeing the perl core regexp structure. When - it is necessary to actually free the structure the first thing it +/* + pregfree() + + handles refcounting and freeing the perl core regexp structure. When + it is necessary to actually free the structure the first thing it does is call the 'free' method of the regexp_engine associated to - the regexp, allowing the handling of the void *pprivate; member - first. (This routine is not overridable by extensions, which is why + the regexp, allowing the handling of the void *pprivate; member + first. (This routine is not overridable by extensions, which is why the extensions free is called first.) - - See regdupe and regdupe_internal if you change anything here. + + See regdupe and regdupe_internal if you change anything here. */ #ifndef PERL_IN_XSUB_RE void @@ -14959,7 +15962,7 @@ Perl_pregfree2(pTHX_ REGEXP *rx) CALLREGFREE_PVT(rx); /* free the private data */ SvREFCNT_dec(RXp_PAREN_NAMES(r)); Safefree(r->xpv_len_u.xpvlenu_pv); - } + } if (r->substrs) { SvREFCNT_dec(r->anchored_substr); SvREFCNT_dec(r->anchored_utf8); @@ -14977,22 +15980,22 @@ Perl_pregfree2(pTHX_ REGEXP *rx) } /* reg_temp_copy() - + This is a hacky workaround to the structural issue of match results being stored in the regexp structure which is in turn stored in PL_curpm/PL_reg_curpm. The problem is that due to qr// the pattern could be PL_curpm in multiple contexts, and could require multiple result sets being associated with the pattern simultaneously, such as when doing a recursive match with (??{$qr}) - - The solution is to make a lightweight copy of the regexp structure + + The solution is to make a lightweight copy of the regexp structure when a qr// is returned from the code executed by (??{$qr}) this lightweight copy doesn't actually own any of its data except for - the starp/end and the actual regexp structure itself. - -*/ - - + the starp/end and the actual regexp structure itself. + +*/ + + REGEXP * Perl_reg_temp_copy (pTHX_ REGEXP *ret_x, REGEXP *rx) { @@ -15025,7 +16028,7 @@ Perl_reg_temp_copy (pTHX_ REGEXP *ret_x, sv_force_normal(sv) is called. */ SvFAKE_on(ret_x); ret = ReANY(ret_x); - + SvFLAGS(ret_x) |= SvUTF8(rx); /* We share the same string buffer as the original regexp, on which we hold a reference count, incremented when mother_re is set below. @@ -15056,23 +16059,23 @@ Perl_reg_temp_copy (pTHX_ REGEXP *ret_x, #endif ret->mother_re = ReREFCNT_inc(r->mother_re ? r->mother_re : rx); SvREFCNT_inc_void(ret->qr_anoncv); - + return ret_x; } #endif -/* regfree_internal() +/* regfree_internal() + + Free the private data in a regexp. This is overloadable by + extensions. Perl takes care of the regexp structure in pregfree(), + this covers the *pprivate pointer which technically perl doesn't + know about, however of course we have to handle the + regexp_internal structure when no extension is in use. - Free the private data in a regexp. This is overloadable by - extensions. Perl takes care of the regexp structure in pregfree(), - this covers the *pprivate pointer which technically perl doesn't - know about, however of course we have to handle the - regexp_internal structure when no extension is in use. - - Note this is called before freeing anything in the regexp - structure. + Note this is called before freeing anything in the regexp + structure. */ - + void Perl_regfree_internal(pTHX_ REGEXP * const rx) { @@ -15090,7 +16093,7 @@ Perl_regfree_internal(pTHX_ REGEXP * con SV *dsv= sv_newmortal(); RE_PV_QUOTED_DECL(s, RX_UTF8(rx), dsv, RX_PRECOMP(rx), RX_PRELEN(rx), 60); - PerlIO_printf(Perl_debug_log,"%sFreeing REx:%s %s\n", + PerlIO_printf(Perl_debug_log,"%sFreeing REx:%s %s\n", PL_colors[4],PL_colors[5],s); } }); @@ -15124,7 +16127,7 @@ Perl_regfree_internal(pTHX_ REGEXP * con case 'l': case 'L': break; - case 'T': + case 'T': { /* Aho Corasick add-on structure for a trie node. Used in stclass optimization only */ U32 refcount; @@ -15164,7 +16167,8 @@ Perl_regfree_internal(pTHX_ REGEXP * con } break; default: - Perl_croak(aTHX_ "panic: regfree data code '%c'", ri->data->what[n]); + Perl_croak(aTHX_ "panic: regfree data code '%c'", + ri->data->what[n]); } } Safefree(ri->data->what); @@ -15178,9 +16182,9 @@ Perl_regfree_internal(pTHX_ REGEXP * con #define hv_dup_inc(s,t) MUTABLE_HV(sv_dup_inc((const SV *)s,t)) #define SAVEPVN(p,n) ((p) ? savepvn(p,n) : NULL) -/* - re_dup - duplicate a regexp. - +/* + re_dup - duplicate a regexp. + This routine is expected to clone a given regexp structure. It is only compiled under USE_ITHREADS. @@ -15189,7 +16193,7 @@ Perl_regfree_internal(pTHX_ REGEXP * con stored in the *pprivate pointer. This allows extensions to handle any duplication it needs to do. - See pregfree() and regfree_internal() if you change anything here. + See pregfree() and regfree_internal() if you change anything here. */ #if defined(USE_ITHREADS) #ifndef PERL_IN_XSUB_RE @@ -15200,7 +16204,7 @@ Perl_re_dup_guts(pTHX_ const REGEXP *sst I32 npar; const struct regexp *r = ReANY(sstr); struct regexp *ret = ReANY(dstr); - + PERL_ARGS_ASSERT_RE_DUP_GUTS; npar = r->nparens+1; @@ -15267,21 +16271,20 @@ Perl_re_dup_guts(pTHX_ const REGEXP *sst so we need to copy it locally. */ RX_WRAPPED(dstr) = SAVEPVN(RX_WRAPPED(sstr), SvCUR(sstr)+1); ret->mother_re = NULL; - ret->gofs = 0; } #endif /* PERL_IN_XSUB_RE */ /* regdupe_internal() - + This is the internal complement to regdupe() which is used to copy the structure pointed to by the *pprivate pointer in the regexp. This is the core version of the extension overridable cloning hook. The regexp structure being duplicated will be copied by perl prior - to this and will be provided as the regexp *r argument, however + to this and will be provided as the regexp *r argument, however with the /old/ structures pprivate pointer value. Thus this routine may override any copying normally done by perl. - + It returns a pointer to the new regexp_internal structure. */ @@ -15295,10 +16298,11 @@ Perl_regdupe_internal(pTHX_ REGEXP * con RXi_GET_DECL(r,ri); PERL_ARGS_ASSERT_REGDUPE_INTERNAL; - + len = ProgLen(ri); - - Newxc(reti, sizeof(regexp_internal) + len*sizeof(regnode), char, regexp_internal); + + Newxc(reti, sizeof(regexp_internal) + len*sizeof(regnode), + char, regexp_internal); Copy(ri->program, reti->program, len+1, regnode); reti->num_code_blocks = ri->num_code_blocks; @@ -15340,9 +16344,8 @@ Perl_regdupe_internal(pTHX_ REGEXP * con break; case 'f': /* This is cheating. */ - Newx(d->data[i], 1, struct regnode_charclass_class); - StructCopy(ri->data->data[i], d->data[i], - struct regnode_charclass_class); + Newx(d->data[i], 1, regnode_ssc); + StructCopy(ri->data->data[i], d->data[i], regnode_ssc); reti->regstclass = (regnode*)d->data[i]; break; case 'T': @@ -15362,7 +16365,8 @@ Perl_regdupe_internal(pTHX_ REGEXP * con d->data[i] = ri->data->data[i]; break; default: - Perl_croak(aTHX_ "panic: re_dup unknown data code '%c'", ri->data->what[i]); + Perl_croak(aTHX_ "panic: re_dup unknown data code '%c'", + ri->data->what[i]); } } @@ -15402,7 +16406,8 @@ Perl_regnext(pTHX_ regnode *p) return(NULL); if (OP(p) > REGNODE_MAX) { /* regnode.type is unsigned */ - Perl_croak(aTHX_ "Corrupted regexp opcode %d > %d", (int)OP(p), (int)REGNODE_MAX); + Perl_croak(aTHX_ "Corrupted regexp opcode %d > %d", + (int)OP(p), (int)REGNODE_MAX); } offset = (reg_off_by_arg[OP(p)] ? ARG(p) : NEXT_OFF(p)); @@ -15414,7 +16419,7 @@ Perl_regnext(pTHX_ regnode *p) #endif STATIC void -S_re_croak2(pTHX_ const char* pat1,const char* pat2,...) +S_re_croak2(pTHX_ bool utf8, const char* pat1,const char* pat2,...) { va_list args; STRLEN l1 = strlen(pat1); @@ -15433,20 +16438,15 @@ S_re_croak2(pTHX_ const char* pat1,const Copy(pat2, buf + l1, l2 , char); buf[l1 + l2] = '\n'; buf[l1 + l2 + 1] = '\0'; -#ifdef I_STDARG - /* ANSI variant takes additional second argument */ va_start(args, pat2); -#else - va_start(args); -#endif msv = vmess(buf, &args); va_end(args); message = SvPV_const(msv,l1); if (l1 > 512) l1 = 512; Copy(message, buf, l1 , char); - buf[l1-1] = '\0'; /* Overwrite \n */ - Perl_croak(aTHX_ "%s", buf); + /* l1-1 to avoid \n */ + Perl_croak(aTHX_ "%"UTF8f, UTF8fARG(utf8, l1-1, buf)); } /* XXX Here's a total kludge. But we need to re-enter for swash routines. */ @@ -15457,29 +16457,6 @@ Perl_save_re_context(pTHX) { dVAR; - struct re_save_state *state; - - SAVEVPTR(PL_curcop); - SSGROW(SAVESTACK_ALLOC_FOR_RE_SAVE_STATE + 1); - - state = (struct re_save_state *)(PL_savestack + PL_savestack_ix); - PL_savestack_ix += SAVESTACK_ALLOC_FOR_RE_SAVE_STATE; - SSPUSHUV(SAVEt_RE_STATE); - - Copy(&PL_reg_state, state, 1, struct re_save_state); - - PL_reg_oldsaved = NULL; - PL_reg_oldsavedlen = 0; - PL_reg_oldsavedoffset = 0; - PL_reg_oldsavedcoffset = 0; - PL_reg_maxiter = 0; - PL_reg_leftiter = 0; - PL_reg_poscache = NULL; - PL_reg_poscache_size = 0; -#ifdef PERL_ANY_COW - PL_nrs = NULL; -#endif - /* Save $1..$n (#18107: UTF-8 s/(\w+)/uc($1)/e); AMS 20021106. */ if (PL_curpm) { const REGEXP * const rx = PM_GETRE(PL_curpm); @@ -15487,7 +16464,8 @@ Perl_save_re_context(pTHX) U32 i; for (i = 1; i <= RX_NPARENS(rx); i++) { char digits[TYPE_CHARS(long)]; - const STRLEN len = my_snprintf(digits, sizeof(digits), "%lu", (long)i); + const STRLEN len = my_snprintf(digits, sizeof(digits), + "%lu", (long)i); GV *const *const gvp = (GV**)hv_fetch(PL_defstash, digits, len, 0); @@ -15509,26 +16487,18 @@ S_put_byte(pTHX_ SV *sv, int c) { PERL_ARGS_ASSERT_PUT_BYTE; - /* Our definition of isPRINT() ignores locales, so only bytes that are - not part of UTF-8 are considered printable. I assume that the same - holds for UTF-EBCDIC. - Also, code point 255 is not printable in either (it's E0 in EBCDIC, - which Wikipedia says: - - EO, or Eight Ones, is an 8-bit EBCDIC character code represented as all - ones (binary 1111 1111, hexadecimal FF). It is similar, but not - identical, to the ASCII delete (DEL) or rubout control character. ... - it is typically mapped to hexadecimal code 9F, in order to provide a - unique character mapping in both directions) - - So the old condition can be simplified to !isPRINT(c) */ if (!isPRINT(c)) { - if (c < 256) { - Perl_sv_catpvf(aTHX_ sv, "\\x%02x", c); - } - else { - Perl_sv_catpvf(aTHX_ sv, "\\x{%x}", c); - } + switch (c) { + case '\r': Perl_sv_catpvf(aTHX_ sv, "\\r"); break; + case '\n': Perl_sv_catpvf(aTHX_ sv, "\\n"); break; + case '\t': Perl_sv_catpvf(aTHX_ sv, "\\t"); break; + case '\f': Perl_sv_catpvf(aTHX_ sv, "\\f"); break; + case '\a': Perl_sv_catpvf(aTHX_ sv, "\\a"); break; + + default: + Perl_sv_catpvf(aTHX_ sv, "\\x{%x}", c); + break; + } } else { const char string = c; @@ -15538,25 +16508,104 @@ S_put_byte(pTHX_ SV *sv, int c) } } +STATIC void +S_put_range(pTHX_ SV *sv, UV start, UV end) +{ + + /* Appends to 'sv' a displayable version of the range of code points from + * 'start' to 'end' */ + + assert(start <= end); + + PERL_ARGS_ASSERT_PUT_RANGE; + + if (end - start < 3) { /* Individual chars in short ranges */ + for (; start <= end; start++) + put_byte(sv, start); + } + else if ( end > 255 + || ! isALPHANUMERIC(start) + || ! isALPHANUMERIC(end) + || isDIGIT(start) != isDIGIT(end) + || isUPPER(start) != isUPPER(end) + || isLOWER(start) != isLOWER(end) + + /* This final test should get optimized out except on EBCDIC + * platforms, where it causes ranges that cross discontinuities + * like i/j to be shown as hex instead of the misleading, + * e.g. H-K (since that range includes more than H, I, J, K). + * */ + || (end - start) != NATIVE_TO_ASCII(end) - NATIVE_TO_ASCII(start)) + { + Perl_sv_catpvf(aTHX_ sv, "\\x{%02" UVXf "}-\\x{%02" UVXf "}", + start, + (end < 256) ? end : 255); + } + else { /* Here, the ends of the range are both digits, or both uppercase, + or both lowercase; and there's no discontinuity in the range + (which could happen on EBCDIC platforms) */ + put_byte(sv, start); + sv_catpvs(sv, "-"); + put_byte(sv, end); + } +} + +STATIC bool +S_put_latin1_charclass_innards(pTHX_ SV *sv, char *bitmap) +{ + /* Appends to 'sv' a displayable version of the innards of the bracketed + * character class whose bitmap is 'bitmap'; Returns 'TRUE' if it actually + * output anything */ + + int i; + bool has_output_anything = FALSE; + + PERL_ARGS_ASSERT_PUT_LATIN1_CHARCLASS_INNARDS; + + for (i = 0; i < 256; i++) { + if (BITMAP_TEST((U8 *) bitmap,i)) { + + /* The character at index i should be output. Find the next + * character that should NOT be output */ + int j; + for (j = i + 1; j < 256; j++) { + if (! BITMAP_TEST((U8 *) bitmap, j)) { + break; + } + } + + /* Everything between them is a single range that should be output + * */ + put_range(sv, i, j - 1); + has_output_anything = TRUE; + i = j; + } + } + + return has_output_anything; +} #define CLEAR_OPTSTART \ - if (optstart) STMT_START { \ - DEBUG_OPTIMISE_r(PerlIO_printf(Perl_debug_log, " (%"IVdf" nodes)\n", (IV)(node - optstart))); \ - optstart=NULL; \ + if (optstart) STMT_START { \ + DEBUG_OPTIMISE_r(PerlIO_printf(Perl_debug_log, \ + " (%"IVdf" nodes)\n", (IV)(node - optstart))); \ + optstart=NULL; \ } STMT_END -#define DUMPUNTIL(b,e) CLEAR_OPTSTART; node=dumpuntil(r,start,(b),(e),last,sv,indent+1,depth+1); +#define DUMPUNTIL(b,e) \ + CLEAR_OPTSTART; \ + node=dumpuntil(r,start,(b),(e),last,sv,indent+1,depth+1); STATIC const regnode * S_dumpuntil(pTHX_ const regexp *r, const regnode *start, const regnode *node, - const regnode *last, const regnode *plast, + const regnode *last, const regnode *plast, SV* sv, I32 indent, U32 depth) { dVAR; U8 op = PSEUDO; /* Arbitrary non-END op. */ const regnode *next; const regnode *optstart= NULL; - + RXi_GET_DECL(r,ri); GET_RE_DEBUG_FLAGS_DECL; @@ -15566,8 +16615,8 @@ S_dumpuntil(pTHX_ const regexp *r, const PerlIO_printf(Perl_debug_log, "--- %d : %d - %d - %d\n",indent,node-start, last ? last-start : 0,plast ? plast-start : 0); #endif - - if (plast && plast < last) + + if (plast && plast < last) last= plast; while (PL_regkind[op] != END && (!last || node < last)) { @@ -15587,20 +16636,21 @@ S_dumpuntil(pTHX_ const regexp *r, const } else CLEAR_OPTSTART; - regprop(r, sv, node); + regprop(r, sv, node, NULL); PerlIO_printf(Perl_debug_log, "%4"IVdf":%*s%s", (IV)(node - start), (int)(2*indent + 1), "", SvPVX_const(sv)); - - if (OP(node) != OPTIMIZED) { + + if (OP(node) != OPTIMIZED) { if (next == NULL) /* Next ptr. */ PerlIO_printf(Perl_debug_log, " (0)"); - else if (PL_regkind[(U8)op] == BRANCH && PL_regkind[OP(next)] != BRANCH ) + else if (PL_regkind[(U8)op] == BRANCH + && PL_regkind[OP(next)] != BRANCH ) PerlIO_printf(Perl_debug_log, " (FAIL)"); - else + else PerlIO_printf(Perl_debug_log, " (%"IVdf")", (IV)(next - start)); - (void)PerlIO_putc(Perl_debug_log, '\n'); + (void)PerlIO_putc(Perl_debug_log, '\n'); } - + after_print: if (PL_regkind[(U8)op] == BRANCHJ) { assert(next); @@ -15627,7 +16677,8 @@ S_dumpuntil(pTHX_ const regexp *r, const const reg_trie_data * const trie = (reg_trie_data*)ri->data->data[optrie]; #ifdef DEBUGGING - AV *const trie_words = MUTABLE_AV(ri->data->data[n + TRIE_WORDS_OFFSET]); + AV *const trie_words + = MUTABLE_AV(ri->data->data[n + TRIE_WORDS_OFFSET]); #endif const regnode *nextbranch= NULL; I32 word_idx; @@ -15637,21 +16688,25 @@ S_dumpuntil(pTHX_ const regexp *r, const PerlIO_printf(Perl_debug_log, "%*s%s ", (int)(2*(indent+3)), "", - elem_ptr ? pv_pretty(sv, SvPV_nolen_const(*elem_ptr), SvCUR(*elem_ptr), 60, - PL_colors[0], PL_colors[1], - (SvUTF8(*elem_ptr) ? PERL_PV_ESCAPE_UNI : 0) | - PERL_PV_PRETTY_ELLIPSES | - PERL_PV_PRETTY_LTGT + elem_ptr + ? pv_pretty(sv, SvPV_nolen_const(*elem_ptr), + SvCUR(*elem_ptr), 60, + PL_colors[0], PL_colors[1], + (SvUTF8(*elem_ptr) + ? PERL_PV_ESCAPE_UNI + : 0) + | PERL_PV_PRETTY_ELLIPSES + | PERL_PV_PRETTY_LTGT ) - : "???" + : "???" ); if (trie->jump) { U16 dist= trie->jump[word_idx+1]; PerlIO_printf(Perl_debug_log, "(%"UVuf")\n", - (UV)((dist ? this_trie + dist : next) - start)); + (UV)((dist ? this_trie + dist : next) - start)); if (dist) { if (!nextbranch) - nextbranch= this_trie + trie->jump[0]; + nextbranch= this_trie + trie->jump[0]; DUMPUNTIL(this_trie + dist, nextbranch); } if (nextbranch && PL_regkind[OP(nextbranch)]==BRANCH) @@ -15678,8 +16733,9 @@ S_dumpuntil(pTHX_ const regexp *r, const } else if (PL_regkind[(U8)op] == ANYOF) { /* arglen 1 + class block */ - node += 1 + ((ANYOF_FLAGS(node) & ANYOF_CLASS) - ? ANYOF_CLASS_SKIP : ANYOF_SKIP); + node += 1 + ((ANYOF_FLAGS(node) & ANYOF_POSIXL) + ? ANYOF_POSIXL_SKIP + : ANYOF_SKIP); node = NEXTOPER(node); } else if (PL_regkind[(U8)op] == EXACT) { @@ -15695,7 +16751,7 @@ S_dumpuntil(pTHX_ const regexp *r, const indent++; } CLEAR_OPTSTART; -#ifdef DEBUG_DUMPUNTIL +#ifdef DEBUG_DUMPUNTIL PerlIO_printf(Perl_debug_log, "--- %d\n", (int)indent); #endif return node; Index: gnu/usr.bin/perl/regcomp.h =================================================================== RCS file: /mnt/memory/perl/importit/cvs/src/gnu/usr.bin/perl/regcomp.h,v retrieving revision 1.13 diff -u -p -u -p -r1.13 regcomp.h --- gnu/usr.bin/perl/regcomp.h 24 Mar 2014 15:05:13 -0000 1.13 +++ gnu/usr.bin/perl/regcomp.h 16 Nov 2014 03:22:24 -0000 @@ -26,13 +26,6 @@ #define RE_TRACK_PATTERN_OFFSETS #endif -/* Unless the next line is uncommented it is illegal to combine lazy - matching with possessive matching. Frankly it doesn't make much sense - to allow it as X*?+ matches nothing, X+?+ matches a single char only, - and X{min,max}?+ matches min times only. - */ -/* #define REG_ALLOW_MINMOD_SUSPEND */ - /* * The "internal use only" fields in regexp.h are present to pass info from * compile to execute that permits the execute phase to run lots faster on @@ -132,13 +125,28 @@ * * See regexp.h for flags used externally to the regexp engine */ +#define RXp_INTFLAGS(rx) ((rx)->intflags) +#define RX_INTFLAGS(prog) RXp_INTFLAGS(ReANY(prog)) + #define PREGf_SKIP 0x00000001 #define PREGf_IMPLICIT 0x00000002 /* Converted .* to ^.* */ #define PREGf_NAUGHTY 0x00000004 /* how exponential is this pattern? */ #define PREGf_VERBARG_SEEN 0x00000008 #define PREGf_CUTGROUP_SEEN 0x00000010 #define PREGf_USE_RE_EVAL 0x00000020 /* compiled with "use re 'eval'" */ +/* these used to be extflags, but are now intflags */ +#define PREGf_NOSCAN 0x00000040 +#define PREGf_CANY_SEEN 0x00000080 +#define PREGf_GPOS_SEEN 0x00000100 +#define PREGf_GPOS_FLOAT 0x00000200 + +#define PREGf_ANCH_BOL 0x00000400 +#define PREGf_ANCH_MBOL 0x00000800 +#define PREGf_ANCH_SBOL 0x00001000 +#define PREGf_ANCH_GPOS 0x00002000 +#define PREGf_ANCH (PREGf_ANCH_SBOL | PREGf_ANCH_GPOS | \ + PREGf_ANCH_MBOL | PREGf_ANCH_BOL ) /* this is where the old regcomp.h started */ @@ -177,27 +185,73 @@ struct regnode_2 { }; -#define ANYOF_BITMAP_SIZE 32 /* 256 b/(8 b/B) */ +#define ANYOF_BITMAP_SIZE (256 / 8) /* 8 bits/Byte */ + +/* Note that these form structs which are supersets of the next smaller one, by + * appending fields. Alignment problems can occur if one of those optional + * fields requires stricter alignment than the base struct. And formal + * parameters that can really be two or more of the structs should be + * declared as the smallest one it could be. See commit message for + * 7dcac5f6a5195002b55c935ee1d67f67e1df280b. Regnode allocation is done + * without regard to alignment, and changing it to would also require changing + * the code that inserts and deletes regnodes. The basic single-argument + * regnode has a U32, which is what reganode() allocates as a unit. Therefore + * no field can require stricter alignment than U32. */ /* also used by trie */ struct regnode_charclass { U8 flags; U8 type; U16 next_off; - U32 arg1; /* used as ptr in S_regclass */ + U32 arg1; char bitmap[ANYOF_BITMAP_SIZE]; /* only compile-time */ }; /* has runtime (locale) \d, \w, ..., [:posix:] classes */ struct regnode_charclass_class { - U8 flags; /* ANYOF_CLASS bit must go here */ + U8 flags; /* ANYOF_POSIXL bit must go here */ U8 type; U16 next_off; - U32 arg1; /* used as ptr in S_regclass */ + U32 arg1; char bitmap[ANYOF_BITMAP_SIZE]; /* both compile-time */ U32 classflags; /* and run-time */ }; +/* A synthetic start class (SSC); is a regnode_charclass_posixl_fold, plus an + * extra SV*, used only during its construction and which is not used by + * regexec.c. Note that the 'next_off' field is unused, as the SSC stands + * alone, so there is never a next node. Also, there is no alignment issue, + * becase these are declared or allocated as a complete unit so the compiler + * takes care of alignment. This is unlike the other regnodes which are + * allocated in terms of multiples of a single-argument regnode. SSC nodes can + * have a pointer field because there is no alignment issue, and because it is + * set to NULL after construction, before any cloning of the pattern */ +struct regnode_ssc { + U8 flags; /* ANYOF_POSIXL bit must go here */ + U8 type; + U16 next_off; + U32 arg1; + char bitmap[ANYOF_BITMAP_SIZE]; /* both compile-time */ + U32 classflags; /* and run-time */ + + /* Auxiliary, only used during construction; NULL afterwards: list of code + * points matched */ + SV* invlist; +}; + +/* We take advantage of 'next_off' not otherwise being used in the SSC by + * actually using it: by setting it to 1. This allows us to test and + * distinguish between an SSC and other ANYOF node types, as 'next_off' cannot + * otherwise be 1, because it is the offset to the next regnode expressed in + * units of regnodes. Since an ANYOF node contains extra fields, it adds up + * to 12 regnode units on 32-bit systems, (hence the minimum this can be (if + * not 0) is 11 there. Even if things get tightly packed on a 64-bit system, + * it still would be more than 1. */ +#define set_ANYOF_SYNTHETIC(n) STMT_START{ OP(n) = ANYOF; \ + NEXT_OFF(n) = 1; \ + } STMT_END +#define is_ANYOF_SYNTHETIC(n) (OP(n) == ANYOF && NEXT_OFF(n) == 1) + /* XXX fix this description. Impose a limit of REG_INFTY on various pattern matching operations to limit stack growth and to avoid "infinite" recursions. @@ -288,75 +342,79 @@ struct regnode_charclass_class { #define REG_MAGIC 0234 -#define SIZE_ONLY (RExC_emit == &PL_regdummy) +#define SIZE_ONLY (RExC_emit == (regnode *) & RExC_emit_dummy) +#define PASS1 SIZE_ONLY +#define PASS2 (! SIZE_ONLY) /* If the bitmap doesn't fully represent what this ANYOF node can match, the * ARG is set to this special value (since 0, 1, ... are legal, but will never * reach this high). */ #define ANYOF_NONBITMAP_EMPTY ((U32) -1) -/* The information used to be stored as as combination of the ANYOF_UTF8 and - * ANYOF_NONBITMAP_NON_UTF8 bits in the flags field, but was moved out of there - * to free up a bit for other uses. This tries to hide the change from - * existing code as much as possible. Now, the data structure that goes in ARG - * is not allocated unless it is needed, and that is what is used to determine - * if there is something outside the bitmap. The code now assumes that if - * that structure exists, that any UTF-8 encoded string should be tried against - * it, but a non-UTF8-encoded string will be tried only if the - * ANYOF_NONBITMAP_NON_UTF8 bit is also set. */ -#define ANYOF_NONBITMAP(node) (ARG(node) != ANYOF_NONBITMAP_EMPTY) - -/* Flags for node->flags of ANYOF. These are in short supply, but there is one - * currently available. If more than this are needed, the ANYOF_LOCALE and - * ANYOF_CLASS bits could be shared, making a space penalty for all locale nodes. - * Also, the UNICODE_ALL bit could be freed up by resorting to creating a swash - * containing everything above 255. This introduces a performance penalty. - * Better would be to split it off into a separate node, which actually would - * improve performance a bit by allowing regexec.c to test for a UTF-8 - * character being above 255 without having to call a function nor calculate - * its code point value. However, this solution might need to have a second - * node type, ANYOF_SYNTHETIC_ABOVE_LATIN1_ALL */ - -#define ANYOF_LOCALE 0x01 /* /l modifier */ +/* Flags for node->flags of ANYOF. These are in short supply, with none + * currently available. The ABOVE_LATIN1_ALL bit could be freed up + * by resorting to creating a swash containing everything above 255. This + * introduces a performance penalty. An option that wouldn't slow things down + * would be to split one of the two LOC flags out into a separate + * node, like what was done with ANYOF_NON_UTF8_NON_ASCII_ALL in commit + * 34fdef848b1687b91892ba55e9e0c3430e0770f6 (but which was reverted because it + * wasn't the best option available at the time), and using a LOC flag is + * probably better than that commit anyway. But it could be reinstated if we + * need a bit. The LOC flags are only for /l nodes; the reverted commit was + * only for /d, so there are no combinatorial issues. The LOC flag to use is + * probably the POSIXL one. + * Several flags are not used in synthetic start class (SSC) nodes, so could be + * shared should new flags be needed for SSCs, like ANYOF_EMPTY_STRING now. */ + +/* regexec.c is expecting this to be in the low bit */ +#define ANYOF_INVERT 0x01 + +/* For the SSC node only, which cannot be inverted, so is shared with that bit. + * This means "Does this SSC match an empty string?" This is used only during + * regex compilation. */ +#define ANYOF_EMPTY_STRING ANYOF_INVERT + +/* Are there things that will match only if the target string is encoded in + * UTF-8? (This is not set if ANYOF_AOVE_LATIN1_ALL is set) */ +#define ANYOF_UTF8 0x02 /* The fold is calculated and stored in the bitmap where possible at compile * time. However under locale, the actual folding varies depending on * what the locale is at the time of execution, so it has to be deferred until * then */ -#define ANYOF_LOC_FOLD 0x02 - -#define ANYOF_INVERT 0x04 +#define ANYOF_LOC_FOLD 0x04 -/* Set if this is a struct regnode_charclass_class vs a regnode_charclass. This +/* Set if this is a regnode_charclass_posixl vs a regnode_charclass. This * is used for runtime \d, \w, [:posix:], ..., which are used only in locale * and the optimizer's synthetic start class. Non-locale \d, etc are resolved - * at compile-time. Could be shared with ANYOF_LOCALE, forcing all locale - * nodes to be large */ -#define ANYOF_CLASS 0x08 -#define ANYOF_LARGE ANYOF_CLASS /* Same; name retained for back compat */ + * at compile-time */ +#define ANYOF_POSIXL 0x08 +#define ANYOF_CLASS ANYOF_POSIXL +#define ANYOF_LARGE ANYOF_POSIXL -/* Unused: 0x10. When using, be sure to change ANYOF_FLAGS_ALL below */ +/* Should we raise a warning if matching against an above-Unicode code point? + * */ +#define ANYOF_WARN_SUPER 0x10 /* Can match something outside the bitmap that isn't in utf8 */ #define ANYOF_NONBITMAP_NON_UTF8 0x20 /* Matches every code point 0x100 and above*/ -#define ANYOF_UNICODE_ALL 0x40 +#define ANYOF_ABOVE_LATIN1_ALL 0x40 +#define ANYOF_UNICODE_ALL ANYOF_ABOVE_LATIN1_ALL /* Match all Latin1 characters that aren't ASCII when the target string is not * in utf8. */ -#define ANYOF_NON_UTF8_LATIN1_ALL 0x80 +#define ANYOF_NON_UTF8_NON_ASCII_ALL 0x80 + +#define ANYOF_FLAGS_ALL (0xff) -#define ANYOF_FLAGS_ALL (0xff & ~0x10) +#define ANYOF_LOCALE_FLAGS (ANYOF_LOC_FOLD | ANYOF_POSIXL) -/* These are the flags that ANYOF_INVERT being set or not doesn't affect - * whether they are operative or not. e.g., the node still has LOCALE - * regardless of being inverted; whereas ANYOF_UNICODE_ALL means something - * different if inverted */ -#define INVERSION_UNAFFECTED_FLAGS (ANYOF_LOCALE \ - |ANYOF_LOC_FOLD \ - |ANYOF_CLASS \ - |ANYOF_NONBITMAP_NON_UTF8) +/* These are the flags that apply to both regular ANYOF nodes and synthetic + * start class nodes during construction of the SSC. During finalization of + * the SSC, other of the flags could be added to it */ +#define ANYOF_COMMON_FLAGS (ANYOF_WARN_SUPER|ANYOF_UTF8) /* Character classes for node->classflags of ANYOF */ /* Should be synchronized with a table in regprop() */ @@ -408,19 +466,21 @@ struct regnode_charclass_class { # error Problem with handy.h _HIGHEST_REGCOMP_DOT_H_SYNC #define #endif -#define ANYOF_MAX (ANYOF_VERTWS) /* So upper loop limit is written: - * '< ANYOF_MAX' - * Hence doesn't include VERTWS, as that - * is a pseudo class */ -#if (ANYOF_MAX > 32) /* Must fit in 32-bit word */ +#define ANYOF_POSIXL_MAX (ANYOF_VERTWS) /* So upper loop limit is written: + * '< ANYOF_MAX' + * Hence doesn't include VERTWS, as that + * is a pseudo class */ +#define ANYOF_MAX ANYOF_POSIXL_MAX + +#if (ANYOF_POSIXL_MAX > 32) /* Must fit in 32-bit word */ # error Problem with handy.h _CC_foo #defines #endif -#define ANYOF_HORIZWS ((ANYOF_MAX)+2) /* = (ANYOF_NVERTWS + 1) */ -#define ANYOF_NHORIZWS ((ANYOF_MAX)+3) +#define ANYOF_HORIZWS ((ANYOF_POSIXL_MAX)+2) /* = (ANYOF_NVERTWS + 1) */ +#define ANYOF_NHORIZWS ((ANYOF_POSIXL_MAX)+3) -#define ANYOF_UNIPROP ((ANYOF_MAX)+4) /* Used to indicate a Unicode - property: \p{} or \P{} */ +#define ANYOF_UNIPROP ((ANYOF_POSIXL_MAX)+4) /* Used to indicate a Unicode + property: \p{} or \P{} */ /* Backward source code compatibility. */ @@ -434,22 +494,51 @@ struct regnode_charclass_class { /* Utility macros for the bitmap and classes of ANYOF */ #define ANYOF_SIZE (sizeof(struct regnode_charclass)) -#define ANYOF_CLASS_SIZE (sizeof(struct regnode_charclass_class)) +#define ANYOF_POSIXL_SIZE (sizeof(regnode_charclass_posixl)) +#define ANYOF_CLASS_SIZE ANYOF_POSIXL_SIZE #define ANYOF_FLAGS(p) ((p)->flags) #define ANYOF_BIT(c) (1 << ((c) & 7)) -#define ANYOF_CLASS_SET(p, c) (((struct regnode_charclass_class*) (p))->classflags |= (1U << (c))) -#define ANYOF_CLASS_CLEAR(p, c) (((struct regnode_charclass_class*) (p))->classflags &= ~ (1U <<(c))) -#define ANYOF_CLASS_TEST(p, c) (((struct regnode_charclass_class*) (p))->classflags & (1U << (c))) +#define ANYOF_POSIXL_SET(p, c) (((regnode_charclass_posixl*) (p))->classflags |= (1U << (c))) +#define ANYOF_CLASS_SET(p, c) ANYOF_POSIXL_SET((p), (c)) + +#define ANYOF_POSIXL_CLEAR(p, c) (((regnode_charclass_posixl*) (p))->classflags &= ~ (1U <<(c))) +#define ANYOF_CLASS_CLEAR(p, c) ANYOF_POSIXL_CLEAR((p), (c)) + +#define ANYOF_POSIXL_TEST(p, c) (((regnode_charclass_posixl*) (p))->classflags & (1U << (c))) +#define ANYOF_CLASS_TEST(p, c) ANYOF_POSIXL_TEST((p), (c)) -#define ANYOF_CLASS_ZERO(ret) STMT_START { ((struct regnode_charclass_class*) (ret))->classflags = 0; } STMT_END +#define ANYOF_POSIXL_ZERO(ret) STMT_START { ((regnode_charclass_posixl*) (ret))->classflags = 0; } STMT_END +#define ANYOF_CLASS_ZERO(ret) ANYOF_POSIXL_ZERO(ret) /* Shifts a bit to get, eg. 0x4000_0000, then subtracts 1 to get 0x3FFF_FFFF */ -#define ANYOF_CLASS_SETALL(ret) STMT_START { ((struct regnode_charclass_class*) (ret))->classflags = ((1U << ((ANYOF_MAX) - 1))) - 1; } STMT_END +#define ANYOF_POSIXL_SETALL(ret) STMT_START { ((regnode_charclass_posixl*) (ret))->classflags = ((1U << ((ANYOF_POSIXL_MAX) - 1))) - 1; } STMT_END +#define ANYOF_CLASS_SETALL(ret) ANYOF_POSIXL_SETALL(ret) -#define ANYOF_CLASS_OR(source, dest) STMT_START { (dest)->classflags |= source->classflags ; } STMT_END +#define ANYOF_POSIXL_TEST_ANY_SET(p) \ + ((ANYOF_FLAGS(p) & ANYOF_POSIXL) \ + && (((regnode_charclass_posixl*)(p))->classflags)) +#define ANYOF_CLASS_TEST_ANY_SET(p) ANYOF_POSIXL_TEST_ANY_SET(p) + +/* Since an SSC always has this field, we don't have to test for that; nor do + * we want to because the bit isn't set for SSC during its construction */ +#define ANYOF_POSIXL_SSC_TEST_ANY_SET(p) \ + cBOOL(((regnode_ssc*)(p))->classflags) +#define ANYOF_POSIXL_SSC_TEST_ALL_SET(p) /* Are all bits set? */ \ + (((regnode_ssc*) (p))->classflags \ + == ((1U << ((ANYOF_POSIXL_MAX) - 1))) - 1) + +#define ANYOF_POSIXL_TEST_ALL_SET(p) \ + ((ANYOF_FLAGS(p) & ANYOF_POSIXL) \ + && ((regnode_charclass_posixl*) (p))->classflags \ + == ((1U << ((ANYOF_POSIXL_MAX) - 1))) - 1) + +#define ANYOF_POSIXL_OR(source, dest) STMT_START { (dest)->classflags |= (source)->classflags ; } STMT_END +#define ANYOF_CLASS_OR(source, dest) ANYOF_POSIXL_OR((source), (dest)) + +#define ANYOF_POSIXL_AND(source, dest) STMT_START { (dest)->classflags &= (source)->classflags ; } STMT_END #define ANYOF_BITMAP_ZERO(ret) Zero(((struct regnode_charclass*)(ret))->bitmap, ANYOF_BITMAP_SIZE, char) #define ANYOF_BITMAP(p) (((struct regnode_charclass*)(p))->bitmap) @@ -467,14 +556,8 @@ struct regnode_charclass_class { memEQ (ANYOF_BITMAP(p), "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377", ANYOF_BITMAP_SIZE) #define ANYOF_SKIP ((ANYOF_SIZE - 1)/sizeof(regnode)) -#define ANYOF_CLASS_SKIP ((ANYOF_CLASS_SIZE - 1)/sizeof(regnode)) - -#define ANYOF_CLASS_TEST_ANY_SET(p) \ - ((ANYOF_FLAGS(p) & ANYOF_CLASS) \ - && (((struct regnode_charclass_class*)(p))->classflags)) -/*#define ANYOF_CLASS_ADD_SKIP (ANYOF_CLASS_SKIP - ANYOF_SKIP) - * */ - +#define ANYOF_POSIXL_SKIP ((ANYOF_POSIXL_SIZE - 1)/sizeof(regnode)) +#define ANYOF_CLASS_SKIP ANYOF_POSIXL_SKIP /* * Utility definitions. @@ -487,18 +570,20 @@ struct regnode_charclass_class { #define EXTRA_SIZE(guy) ((sizeof(guy)-1)/sizeof(struct regnode)) -#define REG_SEEN_ZERO_LEN 0x00000001 -#define REG_SEEN_LOOKBEHIND 0x00000002 -#define REG_SEEN_GPOS 0x00000004 +#define REG_ZERO_LEN_SEEN 0x00000001 +#define REG_LOOKBEHIND_SEEN 0x00000002 +#define REG_GPOS_SEEN 0x00000004 /* spare */ -#define REG_SEEN_CANY 0x00000010 -#define REG_SEEN_SANY REG_SEEN_CANY /* src bckwrd cmpt */ -#define REG_SEEN_RECURSE 0x00000020 -#define REG_TOP_LEVEL_BRANCHES 0x00000040 -#define REG_SEEN_VERBARG 0x00000080 -#define REG_SEEN_CUTGROUP 0x00000100 -#define REG_SEEN_RUN_ON_COMMENT 0x00000200 -#define REG_SEEN_EXACTF_SHARP_S 0x00000400 +#define REG_CANY_SEEN 0x00000010 +#define REG_RECURSE_SEEN 0x00000020 +#define REG_TOP_LEVEL_BRANCHES_SEEN 0x00000040 +#define REG_VERBARG_SEEN 0x00000080 +#define REG_CUTGROUP_SEEN 0x00000100 +#define REG_RUN_ON_COMMENT_SEEN 0x00000200 +#define REG_UNFOLDED_MULTI_SEEN 0x00000400 +#define REG_GOSTART_SEEN 0x00000800 +#define REG_UNBOUNDED_QUANTIFIER_SEEN 0x00001000 + START_EXTERN_C Index: gnu/usr.bin/perl/regcomp.sym =================================================================== RCS file: /mnt/memory/perl/importit/cvs/src/gnu/usr.bin/perl/regcomp.sym,v retrieving revision 1.1.1.6 diff -u -p -u -p -r1.1.1.6 regcomp.sym --- gnu/usr.bin/perl/regcomp.sym 24 Mar 2014 14:58:47 -0000 1.1.1.6 +++ gnu/usr.bin/perl/regcomp.sym 16 Nov 2014 03:22:24 -0000 @@ -38,15 +38,15 @@ SEOL EOL, no ; Same # in regcomp.c uses the enum value of the modifier as an offset from the /d # version. The complements must come after the non-complements. # BOUND, POSIX and their complements are affected, as well as EXACTF. -BOUND BOUND, no ; Match "" at any word boundary using native charset semantics for non-utf8 +BOUND BOUND, no ; Match "" at any word boundary using native charset rules for non-utf8 BOUNDL BOUND, no ; Match "" at any locale word boundary -BOUNDU BOUND, no ; Match "" at any word boundary using Unicode semantics -BOUNDA BOUND, no ; Match "" at any word boundary using ASCII semantics +BOUNDU BOUND, no ; Match "" at any word boundary using Unicode rules +BOUNDA BOUND, no ; Match "" at any word boundary using ASCII rules # All NBOUND nodes are required by code in regexec.c to be greater than all BOUND ones -NBOUND NBOUND, no ; Match "" at any word non-boundary using native charset semantics for non-utf8 +NBOUND NBOUND, no ; Match "" at any word non-boundary using native charset rules for non-utf8 NBOUNDL NBOUND, no ; Match "" at any locale word non-boundary -NBOUNDU NBOUND, no ; Match "" at any word non-boundary using Unicode semantics -NBOUNDA NBOUND, no ; Match "" at any word non-boundary using ASCII semantics +NBOUNDU NBOUND, no ; Match "" at any word non-boundary using Unicode rules +NBOUNDA NBOUND, no ; Match "" at any word non-boundary using ASCII rules GPOS GPOS, no ; Matches where last m//g left off. #* [Special] alternatives: @@ -55,8 +55,6 @@ REG_ANY REG_ANY, no 0 S ; Matc SANY REG_ANY, no 0 S ; Match any one character. CANY REG_ANY, no 0 S ; Match any one byte. ANYOF ANYOF, sv 0 S ; Match character in (or not in) this class, single char match only -ANYOF_WARN_SUPER ANYOF, sv 0 S ; Match character in (or not in) this class, warn (if enabled) upon matching a char above Unicode max; -ANYOF_SYNTHETIC ANYOF, sv 0 S ; Synthetic start class # Order of the below is important. See ordering comment above. POSIXD POSIXD, none 0 S ; Some [[:class:]] under /d; the FLAGS field gives which one @@ -100,7 +98,7 @@ EXACTFL EXACT, str ; Matc EXACTFU EXACT, str ; Match this string (folded iff in UTF-8, length in folding doesn't change if not in UTF-8) using /iu rules (w/len). EXACTFA EXACT, str ; Match this string (not guaranteed to be folded) using /iaa rules (w/len). EXACTFU_SS EXACT, str ; Match this string (folded iff in UTF-8, length in folding may change even if not in UTF-8) using /iu rules (w/len). -EXACTFU_TRICKYFOLD EXACT, str ; Match this folded UTF-8 string using /iu rules +EXACTFA_NO_TRIE EXACT, str ; Match this string (which is not trie-able; not guaranteed to be folded) using /iaa rules (w/len). #*Do nothing types @@ -133,21 +131,21 @@ OPEN OPEN, num 1 ; Mark CLOSE CLOSE, num 1 ; Analogous to OPEN. REF REF, num 1 V ; Match some already matched string -REFF REF, num 1 V ; Match already matched string, folded using native charset semantics for non-utf8 +REFF REF, num 1 V ; Match already matched string, folded using native charset rules for non-utf8 REFFL REF, num 1 V ; Match already matched string, folded in loc. # N?REFF[AU] could have been implemented using the FLAGS field of the # regnode, but by having a separate node type, we can use the existing switch # statement to avoid some tests -REFFU REF, num 1 V ; Match already matched string, folded using unicode semantics for non-utf8 -REFFA REF, num 1 V ; Match already matched string, folded using unicode semantics for non-utf8, no mixing ASCII, non-ASCII +REFFU REF, num 1 V ; Match already matched string, folded using unicode rules for non-utf8 +REFFA REF, num 1 V ; Match already matched string, folded using unicode rules for non-utf8, no mixing ASCII, non-ASCII #*Named references. Code in regcomp.c assumes that these all are after #*the numbered references NREF REF, no-sv 1 V ; Match some already matched string -NREFF REF, no-sv 1 V ; Match already matched string, folded using native charset semantics for non-utf8 +NREFF REF, no-sv 1 V ; Match already matched string, folded using native charset rules for non-utf8 NREFFL REF, no-sv 1 V ; Match already matched string, folded in loc. -NREFFU REF, num 1 V ; Match already matched string, folded using unicode semantics for non-utf8 -NREFFA REF, num 1 V ; Match already matched string, folded using unicode semantics for non-utf8, no mixing ASCII, non-ASCII +NREFFU REF, num 1 V ; Match already matched string, folded using unicode rules for non-utf8 +NREFFA REF, num 1 V ; Match already matched string, folded using unicode rules for non-utf8, no mixing ASCII, non-ASCII IFMATCH BRANCHJ, off 1 . 2 ; Succeeds if the following matches. UNLESSM BRANCHJ, off 1 . 2 ; Fails if the following matches. Index: gnu/usr.bin/perl/regen.pl =================================================================== RCS file: /mnt/memory/perl/importit/cvs/src/gnu/usr.bin/perl/regen.pl,v retrieving revision 1.1.1.6 diff -u -p -u -p -r1.1.1.6 regen.pl --- gnu/usr.bin/perl/regen.pl 25 Mar 2013 20:06:39 -0000 1.1.1.6 +++ gnu/usr.bin/perl/regen.pl 16 Nov 2014 03:22:24 -0000 @@ -1,6 +1,6 @@ #!/usr/bin/perl -w # -# regen.pl - a wrapper that runs all *.pl scripts to to autogenerate files +# regen.pl - a wrapper that runs all *.pl scripts to autogenerate files require 5.004; # keep this compatible, an old perl is all we may have before # we build the new one @@ -13,9 +13,15 @@ require 5.004; # keep this compatible, a use strict; -# Which scripts to run. +my $tap = $ARGV[0] && $ARGV[0] eq '--tap' ? '# ' : ''; +foreach my $pl (map {chomp; "regen/$_"} ) { + my @command = ($^X, $pl, @ARGV); + print "$tap@command\n"; + system @command + and die "@command failed: $?" +} -my @scripts = qw( +__END__ mg_vtable.pl opcode.pl overload.pl @@ -24,11 +30,3 @@ regcomp.pl warnings.pl embed.pl feature.pl -); - -my $tap = $ARGV[0] && $ARGV[0] eq '--tap' ? '# ' : ''; -foreach my $pl (map {"regen/$_"} @scripts) { - my @command = ($^X, $pl, @ARGV); - print "$tap@command\n"; - system @command; -} Index: gnu/usr.bin/perl/regexec.c =================================================================== RCS file: /mnt/memory/perl/importit/cvs/src/gnu/usr.bin/perl/regexec.c,v retrieving revision 1.16 diff -u -p -u -p -r1.16 regexec.c --- gnu/usr.bin/perl/regexec.c 24 Mar 2014 15:05:13 -0000 1.16 +++ gnu/usr.bin/perl/regexec.c 16 Nov 2014 03:22:24 -0000 @@ -37,16 +37,6 @@ #include "re_top.h" #endif -/* At least one required character in the target string is expressible only in - * UTF-8. */ -static const char* const non_utf8_target_but_utf8_required - = "Can't match, because target string needs to be in UTF-8\n"; - -#define NON_UTF8_TARGET_BUT_UTF8_REQUIRED(target) STMT_START { \ - DEBUG_EXECUTE_r(PerlIO_printf(Perl_debug_log, "%s", non_utf8_target_but_utf8_required));\ - goto target; \ -} STMT_END - /* * pregcomp and pregexec -- regsub and regerror are not used in perl * @@ -93,16 +83,28 @@ static const char* const non_utf8_target #include "inline_invlist.c" #include "unicode_constants.h" +#ifdef DEBUGGING +/* At least one required character in the target string is expressible only in + * UTF-8. */ +static const char* const non_utf8_target_but_utf8_required + = "Can't match, because target string needs to be in UTF-8\n"; +#endif + +#define NON_UTF8_TARGET_BUT_UTF8_REQUIRED(target) STMT_START { \ + DEBUG_EXECUTE_r(PerlIO_printf(Perl_debug_log, "%s", non_utf8_target_but_utf8_required));\ + goto target; \ +} STMT_END + #define HAS_NONLATIN1_FOLD_CLOSURE(i) _HAS_NONLATIN1_FOLD_CLOSURE_ONLY_FOR_USE_BY_REGCOMP_DOT_C_AND_REGEXEC_DOT_C(i) #ifndef STATIC #define STATIC static #endif -/* Valid for non-utf8 strings: avoids the reginclass +/* Valid only for non-utf8 strings: avoids the reginclass * call if there are no complications: i.e., if everything matchable is * straight forward in the bitmap */ -#define REGINCLASS(prog,p,c) (ANYOF_FLAGS(p) ? reginclass(prog,p,c,0) \ +#define REGINCLASS(prog,p,c) (ANYOF_FLAGS(p) ? reginclass(prog,p,c,c+1,0) \ : ANYOF_BITMAP_TEST(p,*(c))) /* @@ -110,39 +112,59 @@ static const char* const non_utf8_target */ #define CHR_SVLEN(sv) (utf8_target ? sv_len_utf8(sv) : SvCUR(sv)) -#define CHR_DIST(a,b) (PL_reg_match_utf8 ? utf8_distance(a,b) : a - b) +#define CHR_DIST(a,b) (reginfo->is_utf8_target ? utf8_distance(a,b) : a - b) #define HOPc(pos,off) \ - (char *)(PL_reg_match_utf8 \ - ? reghop3((U8*)pos, off, (U8*)(off >= 0 ? PL_regeol : PL_bostr)) \ + (char *)(reginfo->is_utf8_target \ + ? reghop3((U8*)pos, off, \ + (U8*)(off >= 0 ? reginfo->strend : reginfo->strbeg)) \ : (U8*)(pos + off)) + #define HOPBACKc(pos, off) \ - (char*)(PL_reg_match_utf8\ - ? reghopmaybe3((U8*)pos, -off, (U8*)PL_bostr) \ - : (pos - off >= PL_bostr) \ + (char*)(reginfo->is_utf8_target \ + ? reghopmaybe3((U8*)pos, -off, (U8*)(reginfo->strbeg)) \ + : (pos - off >= reginfo->strbeg) \ ? (U8*)pos - off \ : NULL) -#define HOP3(pos,off,lim) (PL_reg_match_utf8 ? reghop3((U8*)(pos), off, (U8*)(lim)) : (U8*)(pos + off)) +#define HOP3(pos,off,lim) (reginfo->is_utf8_target ? reghop3((U8*)(pos), off, (U8*)(lim)) : (U8*)(pos + off)) #define HOP3c(pos,off,lim) ((char*)HOP3(pos,off,lim)) +/* lim must be +ve. Returns NULL on overshoot */ +#define HOPMAYBE3(pos,off,lim) \ + (reginfo->is_utf8_target \ + ? reghopmaybe3((U8*)pos, off, (U8*)(lim)) \ + : ((U8*)pos + off <= lim) \ + ? (U8*)pos + off \ + : NULL) + +/* like HOP3, but limits the result to <= lim even for the non-utf8 case. + * off must be >=0; args should be vars rather than expressions */ +#define HOP3lim(pos,off,lim) (reginfo->is_utf8_target \ + ? reghop3((U8*)(pos), off, (U8*)(lim)) \ + : (U8*)((pos + off) > lim ? lim : (pos + off))) + +#define HOP4(pos,off,llim, rlim) (reginfo->is_utf8_target \ + ? reghop4((U8*)(pos), off, (U8*)(llim), (U8*)(rlim)) \ + : (U8*)(pos + off)) +#define HOP4c(pos,off,llim, rlim) ((char*)HOP4(pos,off,llim, rlim)) #define NEXTCHR_EOS -10 /* nextchr has fallen off the end */ #define NEXTCHR_IS_EOS (nextchr < 0) #define SET_nextchr \ - nextchr = ((locinput < PL_regeol) ? UCHARAT(locinput) : NEXTCHR_EOS) + nextchr = ((locinput < reginfo->strend) ? UCHARAT(locinput) : NEXTCHR_EOS) #define SET_locinput(p) \ locinput = (p); \ SET_nextchr -#define LOAD_UTF8_CHARCLASS(swash_ptr, property_name) STMT_START { \ +#define LOAD_UTF8_CHARCLASS(swash_ptr, property_name, invlist) STMT_START { \ if (!swash_ptr) { \ U8 flags = _CORE_SWASH_INIT_ACCEPT_INVLIST; \ swash_ptr = _core_swash_init("utf8", property_name, &PL_sv_undef, \ - 1, 0, NULL, &flags); \ + 1, 0, invlist, &flags); \ assert(swash_ptr); \ } \ } STMT_END @@ -151,28 +173,33 @@ static const char* const non_utf8_target #ifdef DEBUGGING # define LOAD_UTF8_CHARCLASS_DEBUG_TEST(swash_ptr, \ property_name, \ + invlist, \ utf8_char_in_property) \ - LOAD_UTF8_CHARCLASS(swash_ptr, property_name); \ + LOAD_UTF8_CHARCLASS(swash_ptr, property_name, invlist); \ assert(swash_fetch(swash_ptr, (U8 *) utf8_char_in_property, TRUE)); #else # define LOAD_UTF8_CHARCLASS_DEBUG_TEST(swash_ptr, \ property_name, \ + invlist, \ utf8_char_in_property) \ - LOAD_UTF8_CHARCLASS(swash_ptr, property_name) + LOAD_UTF8_CHARCLASS(swash_ptr, property_name, invlist) #endif #define LOAD_UTF8_CHARCLASS_ALNUM() LOAD_UTF8_CHARCLASS_DEBUG_TEST( \ PL_utf8_swash_ptrs[_CC_WORDCHAR], \ - swash_property_names[_CC_WORDCHAR], \ - GREEK_SMALL_LETTER_IOTA_UTF8) + "", \ + PL_XPosix_ptrs[_CC_WORDCHAR], \ + LATIN_CAPITAL_LETTER_SHARP_S_UTF8); #define LOAD_UTF8_CHARCLASS_GCB() /* Grapheme cluster boundaries */ \ STMT_START { \ LOAD_UTF8_CHARCLASS_DEBUG_TEST(PL_utf8_X_regular_begin, \ "_X_regular_begin", \ - GREEK_SMALL_LETTER_IOTA_UTF8); \ + NULL, \ + LATIN_CAPITAL_LETTER_SHARP_S_UTF8); \ LOAD_UTF8_CHARCLASS_DEBUG_TEST(PL_utf8_X_extend, \ "_X_extend", \ + NULL, \ COMBINING_GRAVE_ACCENT_UTF8); \ } STMT_END @@ -189,14 +216,14 @@ static const char* const non_utf8_target * although it may be done at run time beause of the REF possibility - more * investigation required. -- demerphq */ -#define JUMPABLE(rn) ( \ - OP(rn) == OPEN || \ +#define JUMPABLE(rn) ( \ + OP(rn) == OPEN || \ (OP(rn) == CLOSE && (!cur_eval || cur_eval->u.eval.close_paren != ARG(rn))) || \ - OP(rn) == EVAL || \ - OP(rn) == SUSPEND || OP(rn) == IFMATCH || \ - OP(rn) == PLUS || OP(rn) == MINMOD || \ - OP(rn) == KEEPS || \ - (PL_regkind[OP(rn)] == CURLY && ARG1(rn) > 0) \ + OP(rn) == EVAL || \ + OP(rn) == SUSPEND || OP(rn) == IFMATCH || \ + OP(rn) == PLUS || OP(rn) == MINMOD || \ + OP(rn) == KEEPS || \ + (PL_regkind[OP(rn)] == CURLY && ARG1(rn) > 0) \ ) #define IS_EXACT(rn) (PL_regkind[OP(rn)] == EXACT) @@ -206,13 +233,13 @@ static const char* const non_utf8_target /* Currently these are only used when PL_regkind[OP(rn)] == EXACT so we don't need this definition. */ #define IS_TEXT(rn) ( OP(rn)==EXACT || OP(rn)==REF || OP(rn)==NREF ) -#define IS_TEXTF(rn) ( OP(rn)==EXACTFU || OP(rn)==EXACTFU_SS || OP(rn)==EXACTFU_TRICKYFOLD || OP(rn)==EXACTFA || OP(rn)==EXACTF || OP(rn)==REFF || OP(rn)==NREFF ) +#define IS_TEXTF(rn) ( OP(rn)==EXACTFU || OP(rn)==EXACTFU_SS || OP(rn)==EXACTFA || OP(rn)==EXACTFA_NO_TRIE || OP(rn)==EXACTF || OP(rn)==REFF || OP(rn)==NREFF ) #define IS_TEXTFL(rn) ( OP(rn)==EXACTFL || OP(rn)==REFFL || OP(rn)==NREFFL ) #else /* ... so we use this as its faster. */ #define IS_TEXT(rn) ( OP(rn)==EXACT ) -#define IS_TEXTFU(rn) ( OP(rn)==EXACTFU || OP(rn)==EXACTFU_SS || OP(rn)==EXACTFU_TRICKYFOLD || OP(rn) == EXACTFA) +#define IS_TEXTFU(rn) ( OP(rn)==EXACTFU || OP(rn)==EXACTFU_SS || OP(rn) == EXACTFA || OP(rn) == EXACTFA_NO_TRIE) #define IS_TEXTF(rn) ( OP(rn)==EXACTF ) #define IS_TEXTFL(rn) ( OP(rn)==EXACTFL ) @@ -222,7 +249,7 @@ static const char* const non_utf8_target Search for mandatory following text node; for lookahead, the text must follow but for lookbehind (rn->flags != 0) we skip to the next step. */ -#define FIND_NEXT_IMPT(rn) STMT_START { \ +#define FIND_NEXT_IMPT(rn) STMT_START { \ while (JUMPABLE(rn)) { \ const OPCODE type = OP(rn); \ if (type == SUSPEND || PL_regkind[type] == CURLY) \ @@ -245,7 +272,12 @@ static const char* const non_utf8_target #define SCount 11172 /* Length of block */ #define TCount 28 -static void restore_pos(pTHX_ void *arg); +#define SLAB_FIRST(s) (&(s)->states[0]) +#define SLAB_LAST(s) (&(s)->states[PERL_REGMATCH_SLAB_SLOTS-1]) + +static void S_setup_eval_state(pTHX_ regmatch_info *const reginfo); +static void S_cleanup_regmatch_info_aux(pTHX_ void *arg); +static regmatch_state * S_push_slab(pTHX); #define REGCP_PAREN_ELEMS 3 #define REGCP_OTHER_ELEMS 3 @@ -268,8 +300,8 @@ S_regcppush(pTHX_ const regexp *rex, I32 PERL_ARGS_ASSERT_REGCPPUSH; if (paren_elems_to_push < 0) - Perl_croak(aTHX_ "panic: paren_elems_to_push, %i < 0", - paren_elems_to_push); + Perl_croak(aTHX_ "panic: paren_elems_to_push, %i < 0, maxopenparen: %i parenfloor: %i REGCP_PAREN_ELEMS: %i", + paren_elems_to_push, maxopenparen, parenfloor, REGCP_PAREN_ELEMS); if ((elems_shifted >> SAVE_TIGHT_SHIFT) != total_elems) Perl_croak(aTHX_ "panic: paren_elems_to_push offset %"UVuf @@ -290,8 +322,8 @@ S_regcppush(pTHX_ const regexp *rex, I32 ); for (p = parenfloor+1; p <= (I32)maxopenparen; p++) { /* REGCP_PARENS_ELEMS are pushed per pairs of parentheses. */ - SSPUSHINT(rex->offs[p].end); - SSPUSHINT(rex->offs[p].start); + SSPUSHIV(rex->offs[p].end); + SSPUSHIV(rex->offs[p].start); SSPUSHINT(rex->offs[p].start_tmp); DEBUG_BUFFERS_r(PerlIO_printf(Perl_debug_log, " \\%"UVuf": %"IVdf"(%"IVdf")..%"IVdf"\n", @@ -363,10 +395,10 @@ S_regcppop(pTHX_ regexp *rex, U32 *maxop ); paren = *maxopenparen_p; for ( ; i > 0; i -= REGCP_PAREN_ELEMS) { - I32 tmps; + SSize_t tmps; rex->offs[paren].start_tmp = SSPOPINT; - rex->offs[paren].start = SSPOPINT; - tmps = SSPOPINT; + rex->offs[paren].start = SSPOPIV; + tmps = SSPOPIV; if (paren <= rex->lastparen) rex->offs[paren].end = tmps; DEBUG_BUFFERS_r( PerlIO_printf(Perl_debug_log, @@ -478,7 +510,7 @@ S_isFOO_utf8_lc(pTHX_ const U8 classnum, } else if (UTF8_IS_DOWNGRADEABLE_START(*character)) { return isFOO_lc(classnum, - TWO_BYTE_UTF8_TO_UNI(*character, *(character + 1))); + TWO_BYTE_UTF8_TO_NATIVE(*character, *(character + 1))); } if (classnum < _FIRST_NON_SWASH_CC) { @@ -486,8 +518,11 @@ S_isFOO_utf8_lc(pTHX_ const U8 classnum, /* Initialize the swash unless done already */ if (! PL_utf8_swash_ptrs[classnum]) { U8 flags = _CORE_SWASH_INIT_ACCEPT_INVLIST; - PL_utf8_swash_ptrs[classnum] = _core_swash_init("utf8", - swash_property_names[classnum], &PL_sv_undef, 1, 0, NULL, &flags); + PL_utf8_swash_ptrs[classnum] = + _core_swash_init("utf8", + "", + &PL_sv_undef, 1, 0, + PL_XPosix_ptrs[classnum], &flags); } return cBOOL(swash_fetch(PL_utf8_swash_ptrs[classnum], (U8 *) @@ -520,7 +555,7 @@ S_isFOO_utf8_lc(pTHX_ const U8 classnum, */ I32 Perl_pregexec(pTHX_ REGEXP * const prog, char* stringarg, char *strend, - char *strbeg, I32 minend, SV *screamer, U32 nosave) + char *strbeg, SSize_t minend, SV *screamer, U32 nosave) /* stringarg: the point in the string at which to begin matching */ /* strend: pointer to null at end of string */ /* strbeg: real beginning of string */ @@ -537,119 +572,150 @@ Perl_pregexec(pTHX_ REGEXP * const prog, } #endif -/* - * Need to implement the following flags for reg_anch: - * - * USE_INTUIT_NOML - Useful to call re_intuit_start() first - * USE_INTUIT_ML - * INTUIT_AUTORITATIVE_NOML - Can trust a positive answer - * INTUIT_AUTORITATIVE_ML - * INTUIT_ONCE_NOML - Intuit can match in one location only. - * INTUIT_ONCE_ML - * - * Another flag for this function: SECOND_TIME (so that float substrs - * with giant delta may be not rechecked). - */ - -/* Assumptions: if ANCH_GPOS, then strpos is anchored. XXXX Check GPOS logic */ -/* If SCREAM, then SvPVX_const(sv) should be compatible with strpos and strend. - Otherwise, only SvCUR(sv) is used to get strbeg. */ -/* XXXX We assume that strpos is strbeg unless sv. */ - -/* XXXX Some places assume that there is a fixed substring. - An update may be needed if optimizer marks as "INTUITable" - RExen without fixed substrings. Similarly, it is assumed that - lengths of all the strings are no more than minlen, thus they - cannot come from lookahead. - (Or minlen should take into account lookahead.) - NOTE: Some of this comment is not correct. minlen does now take account - of lookahead/behind. Further research is required. -- demerphq - -*/ - -/* A failure to find a constant substring means that there is no need to make - an expensive call to REx engine, thus we celebrate a failure. Similarly, - finding a substring too deep into the string means that fewer calls to - regtry() should be needed. - - REx compiler's optimizer found 4 possible hints: - a) Anchored substring; - b) Fixed substring; - c) Whether we are anchored (beginning-of-line or \G); - d) First node (of those at offset 0) which may distinguish positions; - We use a)b)d) and multiline-part of c), and try to find a position in the - string which does not contradict any of them. +/* re_intuit_start(): + * + * Based on some optimiser hints, try to find the earliest position in the + * string where the regex could match. + * + * rx: the regex to match against + * sv: the SV being matched: only used for utf8 flag; the string + * itself is accessed via the pointers below. Note that on + * something like an overloaded SV, SvPOK(sv) may be false + * and the string pointers may point to something unrelated to + * the SV itself. + * strbeg: real beginning of string + * strpos: the point in the string at which to begin matching + * strend: pointer to the byte following the last char of the string + * flags currently unused; set to 0 + * data: currently unused; set to NULL + * + * The basic idea of re_intuit_start() is to use some known information + * about the pattern, namely: + * + * a) the longest known anchored substring (i.e. one that's at a + * constant offset from the beginning of the pattern; but not + * necessarily at a fixed offset from the beginning of the + * string); + * b) the longest floating substring (i.e. one that's not at a constant + * offset from the beginning of the pattern); + * c) Whether the pattern is anchored to the string; either + * an absolute anchor: /^../, or anchored to \n: /^.../m, + * or anchored to pos(): /\G/; + * d) A start class: a real or synthetic character class which + * represents which characters are legal at the start of the pattern; + * + * to either quickly reject the match, or to find the earliest position + * within the string at which the pattern might match, thus avoiding + * running the full NFA engine at those earlier locations, only to + * eventually fail and retry further along. + * + * Returns NULL if the pattern can't match, or returns the address within + * the string which is the earliest place the match could occur. + * + * The longest of the anchored and floating substrings is called 'check' + * and is checked first. The other is called 'other' and is checked + * second. The 'other' substring may not be present. For example, + * + * /(abc|xyz)ABC\d{0,3}DEFG/ + * + * will have + * + * check substr (float) = "DEFG", offset 6..9 chars + * other substr (anchored) = "ABC", offset 3..3 chars + * stclass = [ax] + * + * Be aware that during the course of this function, sometimes 'anchored' + * refers to a substring being anchored relative to the start of the + * pattern, and sometimes to the pattern itself being anchored relative to + * the string. For example: + * + * /\dabc/: "abc" is anchored to the pattern; + * /^\dabc/: "abc" is anchored to the pattern and the string; + * /\d+abc/: "abc" is anchored to neither the pattern nor the string; + * /^\d+abc/: "abc" is anchored to neither the pattern nor the string, + * but the pattern is anchored to the string. */ -/* Most of decisions we do here should have been done at compile time. - The nodes of the REx which we used for the search should have been - deleted from the finite automaton. */ - char * -Perl_re_intuit_start(pTHX_ REGEXP * const rx, SV *sv, char *strpos, - char *strend, const U32 flags, re_scream_pos_data *data) +Perl_re_intuit_start(pTHX_ + REGEXP * const rx, + SV *sv, + const char * const strbeg, + char *strpos, + char *strend, + const U32 flags, + re_scream_pos_data *data) { dVAR; struct regexp *const prog = ReANY(rx); - I32 start_shift = 0; + SSize_t start_shift = prog->check_offset_min; /* Should be nonnegative! */ - I32 end_shift = 0; - char *s; + SSize_t end_shift = 0; + /* current lowest pos in string where the regex can start matching */ + char *rx_origin = strpos; SV *check; - char *strbeg; - char *t; const bool utf8_target = (sv && SvUTF8(sv)) ? 1 : 0; /* if no sv we have to assume bytes */ - I32 ml_anch; - char *other_last = NULL; /* other substr checked before this */ + U8 other_ix = 1 - prog->substrs->check_ix; + bool ml_anch = 0; + char *other_last = strpos;/* latest pos 'other' substr already checked to */ char *check_at = NULL; /* check substr found at this pos */ - char *checked_upto = NULL; /* how far into the string we have already checked using find_byclass*/ const I32 multiline = prog->extflags & RXf_PMf_MULTILINE; RXi_GET_DECL(prog,progi); - bool is_utf8_pat; -#ifdef DEBUGGING - const char * const i_strpos = strpos; -#endif + regmatch_info reginfo_buf; /* create some info to pass to find_byclass */ + regmatch_info *const reginfo = ®info_buf; GET_RE_DEBUG_FLAGS_DECL; PERL_ARGS_ASSERT_RE_INTUIT_START; PERL_UNUSED_ARG(flags); PERL_UNUSED_ARG(data); - RX_MATCH_UTF8_set(rx,utf8_target); + DEBUG_EXECUTE_r(PerlIO_printf(Perl_debug_log, + "Intuit: trying to determine minimum start position...\n")); - is_utf8_pat = cBOOL(RX_UTF8(rx)); - - DEBUG_EXECUTE_r( - debug_start_match(rx, utf8_target, strpos, strend, - sv ? "Guessing start of match in sv for" - : "Guessing start of match in string for"); - ); - - /* CHR_DIST() would be more correct here but it makes things slow. */ + /* for now, assume that all substr offsets are positive. If at some point + * in the future someone wants to do clever things with look-behind and + * -ve offsets, they'll need to fix up any code in this function + * which uses these offsets. See the thread beginning + * <20140113145929.GF27210@iabyn.com> + */ + assert(prog->substrs->data[0].min_offset >= 0); + assert(prog->substrs->data[0].max_offset >= 0); + assert(prog->substrs->data[1].min_offset >= 0); + assert(prog->substrs->data[1].max_offset >= 0); + assert(prog->substrs->data[2].min_offset >= 0); + assert(prog->substrs->data[2].max_offset >= 0); + + /* for now, assume that if both present, that the floating substring + * doesn't start before the anchored substring. + * If you break this assumption (e.g. doing better optimisations + * with lookahead/behind), then you'll need to audit the code in this + * function carefully first + */ + assert( + ! ( (prog->anchored_utf8 || prog->anchored_substr) + && (prog->float_utf8 || prog->float_substr)) + || (prog->float_min_offset >= prog->anchored_offset)); + + /* byte rather than char calculation for efficiency. It fails + * to quickly reject some cases that can't match, but will reject + * them later after doing full char arithmetic */ if (prog->minlen > strend - strpos) { DEBUG_EXECUTE_r(PerlIO_printf(Perl_debug_log, - "String too short... [re_intuit_start]\n")); + " String too short...\n")); goto fail; } - /* XXX we need to pass strbeg as a separate arg: the following is - * guesswork and can be wrong... */ - if (sv && SvPOK(sv)) { - char * p = SvPVX(sv); - STRLEN cur = SvCUR(sv); - if (p <= strpos && strpos < p + cur) { - strbeg = p; - assert(p <= strend && strend <= p + cur); - } - else - strbeg = strend - cur; - } - else - strbeg = strpos; + reginfo->is_utf8_target = cBOOL(utf8_target); + reginfo->info_aux = NULL; + reginfo->strbeg = strbeg; + reginfo->strend = strend; + reginfo->is_utf8_pat = cBOOL(RX_UTF8(rx)); + reginfo->intuit = 1; + /* not actually used within intuit, but zero for safety anyway */ + reginfo->poscache_maxiter = 0; - PL_regeol = strend; if (utf8_target) { if (!prog->check_utf8 && prog->check_substr) to_utf8_substr(prog); @@ -662,403 +728,672 @@ Perl_re_intuit_start(pTHX_ REGEXP * cons } check = prog->check_substr; } - if (prog->extflags & RXf_ANCH) { /* Match at beg-of-str or after \n */ - ml_anch = !( (prog->extflags & RXf_ANCH_SINGLE) - || ( (prog->extflags & RXf_ANCH_BOL) - && !multiline ) ); /* Check after \n? */ - - if (!ml_anch) { - if ( !(prog->extflags & RXf_ANCH_GPOS) /* Checked by the caller */ - && !(prog->intflags & PREGf_IMPLICIT) /* not a real BOL */ - /* SvCUR is not set on references: SvRV and SvPVX_const overlap */ - && sv && !SvROK(sv) - && (strpos != strbeg)) { - DEBUG_EXECUTE_r(PerlIO_printf(Perl_debug_log, "Not at start...\n")); - goto fail; - } - if (prog->check_offset_min == prog->check_offset_max - && !(prog->extflags & RXf_CANY_SEEN) - && ! multiline) /* /m can cause \n's to match that aren't - accounted for in the string max length. - See [perl #115242] */ - { - /* Substring at constant offset from beg-of-str... */ - I32 slen; - s = HOP3c(strpos, prog->check_offset_min, strend); + /* dump the various substring data */ + DEBUG_OPTIMISE_MORE_r({ + int i; + for (i=0; i<=2; i++) { + SV *sv = (utf8_target ? prog->substrs->data[i].utf8_substr + : prog->substrs->data[i].substr); + if (!sv) + continue; + + PerlIO_printf(Perl_debug_log, + " substrs[%d]: min=%"IVdf" max=%"IVdf" end shift=%"IVdf + " useful=%"IVdf" utf8=%d [%s]\n", + i, + (IV)prog->substrs->data[i].min_offset, + (IV)prog->substrs->data[i].max_offset, + (IV)prog->substrs->data[i].end_shift, + BmUSEFUL(sv), + utf8_target ? 1 : 0, + SvPEEK(sv)); + } + }); + + if (prog->intflags & PREGf_ANCH) { /* Match at \G, beg-of-str or after \n */ + + /* ml_anch: check after \n? + * + * A note about IMPLICIT: on an un-anchored pattern beginning + * with /.*.../, these flags will have been added by the + * compiler: + * /.*abc/, /.*abc/m: PREGf_IMPLICIT | PREGf_ANCH_MBOL + * /.*abc/s: PREGf_IMPLICIT | PREGf_ANCH_SBOL + */ + ml_anch = (prog->intflags & PREGf_ANCH_MBOL) + && !(prog->intflags & PREGf_IMPLICIT); + + if (!ml_anch && !(prog->intflags & PREGf_IMPLICIT)) { + /* we are only allowed to match at BOS or \G */ + + /* trivially reject if there's a BOS anchor and we're not at BOS. + * + * Note that we don't try to do a similar quick reject for + * \G, since generally the caller will have calculated strpos + * based on pos() and gofs, so the string is already correctly + * anchored by definition; and handling the exceptions would + * be too fiddly (e.g. REXEC_IGNOREPOS). + */ + if ( strpos != strbeg + && (prog->intflags & (PREGf_ANCH_BOL|PREGf_ANCH_SBOL))) + { + DEBUG_EXECUTE_r(PerlIO_printf(Perl_debug_log, + " Not at start...\n")); + goto fail; + } + + /* in the presence of an anchor, the anchored (relative to the + * start of the regex) substr must also be anchored relative + * to strpos. So quickly reject if substr isn't found there. + * This works for \G too, because the caller will already have + * subtracted gofs from pos, and gofs is the offset from the + * \G to the start of the regex. For example, in /.abc\Gdef/, + * where substr="abcdef", pos()=3, gofs=4, offset_min=1: + * caller will have set strpos=pos()-4; we look for the substr + * at position pos()-4+1, which lines up with the "a" */ + + if (prog->check_offset_min == prog->check_offset_max + && !(prog->intflags & PREGf_CANY_SEEN)) + { + /* Substring at constant offset from beg-of-str... */ + SSize_t slen = SvCUR(check); + char *s = HOP3c(strpos, prog->check_offset_min, strend); - if (SvTAIL(check)) { - slen = SvCUR(check); /* >= 1 */ + DEBUG_EXECUTE_r(PerlIO_printf(Perl_debug_log, + " Looking for check substr at fixed offset %"IVdf"...\n", + (IV)prog->check_offset_min)); + + if (SvTAIL(check)) { + /* In this case, the regex is anchored at the end too. + * Unless it's a multiline match, the lengths must match + * exactly, give or take a \n. NB: slen >= 1 since + * the last char of check is \n */ + if (!multiline + && ( strend - s > slen + || strend - s < slen - 1 + || (strend - s == slen && strend[-1] != '\n'))) + { + DEBUG_EXECUTE_r(PerlIO_printf(Perl_debug_log, + " String too long...\n")); + goto fail_finish; + } + /* Now should match s[0..slen-2] */ + slen--; + } + if (slen && (*SvPVX_const(check) != *s + || (slen > 1 && memNE(SvPVX_const(check), s, slen)))) + { + DEBUG_EXECUTE_r(PerlIO_printf(Perl_debug_log, + " String not equal...\n")); + goto fail_finish; + } - if ( strend - s > slen || strend - s < slen - 1 - || (strend - s == slen && strend[-1] != '\n')) { - DEBUG_EXECUTE_r(PerlIO_printf(Perl_debug_log, "String too long...\n")); - goto fail_finish; - } - /* Now should match s[0..slen-2] */ - slen--; - if (slen && (*SvPVX_const(check) != *s - || (slen > 1 - && memNE(SvPVX_const(check), s, slen)))) { - report_neq: - DEBUG_EXECUTE_r(PerlIO_printf(Perl_debug_log, "String not equal...\n")); - goto fail_finish; - } - } - else if (*SvPVX_const(check) != *s - || ((slen = SvCUR(check)) > 1 - && memNE(SvPVX_const(check), s, slen))) - goto report_neq; - check_at = s; - goto success_at_start; - } - } - /* Match is anchored, but substr is not anchored wrt beg-of-str. */ - s = strpos; - start_shift = prog->check_offset_min; /* okay to underestimate on CC */ - end_shift = prog->check_end_shift; - - if (!ml_anch) { - const I32 end = prog->check_offset_max + CHR_SVLEN(check) - - (SvTAIL(check) != 0); - const I32 eshift = CHR_DIST((U8*)strend, (U8*)s) - end; - - if (end_shift < eshift) - end_shift = eshift; + check_at = s; + goto success_at_start; + } } } - else { /* Can match at random position */ - ml_anch = 0; - s = strpos; - start_shift = prog->check_offset_min; /* okay to underestimate on CC */ - end_shift = prog->check_end_shift; - - /* end shift should be non negative here */ - } -#ifdef QDEBUGGING /* 7/99: reports of failure (with the older version) */ + end_shift = prog->check_end_shift; + +#ifdef DEBUGGING /* 7/99: reports of failure (with the older version) */ if (end_shift < 0) Perl_croak(aTHX_ "panic: end_shift: %"IVdf" pattern:\n%s\n ", (IV)end_shift, RX_PRECOMP(prog)); #endif restart: - /* Find a possible match in the region s..strend by looking for - the "check" substring in the region corrected by start/end_shift. */ + /* This is the (re)entry point of the main loop in this function. + * The goal of this loop is to: + * 1) find the "check" substring in the region rx_origin..strend + * (adjusted by start_shift / end_shift). If not found, reject + * immediately. + * 2) If it exists, look for the "other" substr too if defined; for + * example, if the check substr maps to the anchored substr, then + * check the floating substr, and vice-versa. If not found, go + * back to (1) with rx_origin suitably incremented. + * 3) If we find an rx_origin position that doesn't contradict + * either of the substrings, then check the possible additional + * constraints on rx_origin of /^.../m or a known start class. + * If these fail, then depending on which constraints fail, jump + * back to here, or to various other re-entry points further along + * that skip some of the first steps. + * 4) If we pass all those tests, update the BmUSEFUL() count on the + * substring. If the start position was determined to be at the + * beginning of the string - so, not rejected, but not optimised, + * since we have to run regmatch from position 0 - decrement the + * BmUSEFUL() count. Otherwise increment it. + */ + + + /* first, look for the 'check' substring */ + { - I32 srch_start_shift = start_shift; - I32 srch_end_shift = end_shift; U8* start_point; U8* end_point; - if (srch_start_shift < 0 && strbeg - s > srch_start_shift) { - srch_end_shift -= ((strbeg - s) - srch_start_shift); - srch_start_shift = strbeg - s; - } - DEBUG_OPTIMISE_MORE_r({ - PerlIO_printf(Perl_debug_log, "Check offset min: %"IVdf" Start shift: %"IVdf" End shift %"IVdf" Real End Shift: %"IVdf"\n", - (IV)prog->check_offset_min, - (IV)srch_start_shift, - (IV)srch_end_shift, - (IV)prog->check_end_shift); - }); + + DEBUG_OPTIMISE_MORE_r({ + PerlIO_printf(Perl_debug_log, + " At restart: rx_origin=%"IVdf" Check offset min: %"IVdf + " Start shift: %"IVdf" End shift %"IVdf + " Real end Shift: %"IVdf"\n", + (IV)(rx_origin - strpos), + (IV)prog->check_offset_min, + (IV)start_shift, + (IV)end_shift, + (IV)prog->check_end_shift); + }); - if (prog->extflags & RXf_CANY_SEEN) { - start_point= (U8*)(s + srch_start_shift); - end_point= (U8*)(strend - srch_end_shift); + if (prog->intflags & PREGf_CANY_SEEN) { + start_point= (U8*)(rx_origin + start_shift); + end_point= (U8*)(strend - end_shift); + if (start_point > end_point) + goto fail_finish; } else { - start_point= HOP3(s, srch_start_shift, srch_start_shift < 0 ? strbeg : strend); - end_point= HOP3(strend, -srch_end_shift, strbeg); + end_point = HOP3(strend, -end_shift, strbeg); + start_point = HOPMAYBE3(rx_origin, start_shift, end_point); + if (!start_point) + goto fail_finish; } + + + /* If the regex is absolutely anchored to either the start of the + * string (BOL,SBOL) or to pos() (ANCH_GPOS), then + * check_offset_max represents an upper bound on the string where + * the substr could start. For the ANCH_GPOS case, we assume that + * the caller of intuit will have already set strpos to + * pos()-gofs, so in this case strpos + offset_max will still be + * an upper bound on the substr. + */ + if (!ml_anch + && prog->intflags & PREGf_ANCH + && prog->check_offset_max != SSize_t_MAX) + { + SSize_t len = SvCUR(check) - !!SvTAIL(check); + const char * const anchor = + (prog->intflags & PREGf_ANCH_GPOS ? strpos : strbeg); + + /* do a bytes rather than chars comparison. It's conservative; + * so it skips doing the HOP if the result can't possibly end + * up earlier than the old value of end_point. + */ + if ((char*)end_point - anchor > prog->check_offset_max) { + end_point = HOP3lim((U8*)anchor, + prog->check_offset_max, + end_point -len) + + len; + } + } + DEBUG_OPTIMISE_MORE_r({ - PerlIO_printf(Perl_debug_log, "fbm_instr len=%d str=<%.*s>\n", + PerlIO_printf(Perl_debug_log, " fbm_instr len=%d str=<%.*s>\n", (int)(end_point - start_point), (int)(end_point - start_point) > 20 ? 20 : (int)(end_point - start_point), start_point); }); - s = fbm_instr( start_point, end_point, + check_at = fbm_instr( start_point, end_point, check, multiline ? FBMrf_MULTILINE : 0); - } - /* Update the count-of-usability, remove useless subpatterns, - unshift s. */ - DEBUG_EXECUTE_r({ - RE_PV_QUOTED_DECL(quoted, utf8_target, PERL_DEBUG_PAD_ZERO(0), - SvPVX_const(check), RE_SV_DUMPLEN(check), 30); - PerlIO_printf(Perl_debug_log, "%s %s substr %s%s%s", - (s ? "Found" : "Did not find"), - (check == (utf8_target ? prog->anchored_utf8 : prog->anchored_substr) - ? "anchored" : "floating"), - quoted, - RE_SV_TAIL(check), - (s ? " at offset " : "...\n") ); - }); + /* Update the count-of-usability, remove useless subpatterns, + unshift s. */ - if (!s) - goto fail_finish; - /* Finish the diagnostic message */ - DEBUG_EXECUTE_r(PerlIO_printf(Perl_debug_log, "%ld...\n", (long)(s - i_strpos)) ); - - /* XXX dmq: first branch is for positive lookbehind... - Our check string is offset from the beginning of the pattern. - So we need to do any stclass tests offset forward from that - point. I think. :-( - */ - - - - check_at=s; - + DEBUG_EXECUTE_r({ + RE_PV_QUOTED_DECL(quoted, utf8_target, PERL_DEBUG_PAD_ZERO(0), + SvPVX_const(check), RE_SV_DUMPLEN(check), 30); + PerlIO_printf(Perl_debug_log, " %s %s substr %s%s%s", + (check_at ? "Found" : "Did not find"), + (check == (utf8_target ? prog->anchored_utf8 : prog->anchored_substr) + ? "anchored" : "floating"), + quoted, + RE_SV_TAIL(check), + (check_at ? " at offset " : "...\n") ); + }); - /* Got a candidate. Check MBOL anchoring, and the *other* substr. - Start with the other substr. - XXXX no SCREAM optimization yet - and a very coarse implementation - XXXX /ttx+/ results in anchored="ttx", floating="x". floating will - *always* match. Probably should be marked during compile... - Probably it is right to do no SCREAM here... - */ + if (!check_at) + goto fail_finish; + /* Finish the diagnostic message */ + DEBUG_EXECUTE_r(PerlIO_printf(Perl_debug_log, "%ld...\n", (long)(check_at - strpos)) ); + + /* set rx_origin to the minimum position where the regex could start + * matching, given the constraint of the just-matched check substring. + * But don't set it lower than previously. + */ + + if (check_at - rx_origin > prog->check_offset_max) + rx_origin = HOP3c(check_at, -prog->check_offset_max, rx_origin); + } + + + /* now look for the 'other' substring if defined */ - if (utf8_target ? (prog->float_utf8 && prog->anchored_utf8) - : (prog->float_substr && prog->anchored_substr)) + if (utf8_target ? prog->substrs->data[other_ix].utf8_substr + : prog->substrs->data[other_ix].substr) { /* Take into account the "other" substring. */ - /* XXXX May be hopelessly wrong for UTF... */ - if (!other_last) - other_last = strpos; - if (check == (utf8_target ? prog->float_utf8 : prog->float_substr)) { - do_other_anchored: - { - char * const last = HOP3c(s, -start_shift, strbeg); - char *last1, *last2; - char * const saved_s = s; - SV* must; - - t = s - prog->check_offset_max; - if (s - strpos > prog->check_offset_max /* signed-corrected t > strpos */ - && (!utf8_target - || ((t = (char*)reghopmaybe3((U8*)s, -(prog->check_offset_max), (U8*)strpos)) - && t > strpos))) - NOOP; - else - t = strpos; - t = HOP3c(t, prog->anchored_offset, strend); - if (t < other_last) /* These positions already checked */ - t = other_last; - last2 = last1 = HOP3c(strend, -prog->minlen, strbeg); - if (last < last1) - last1 = last; - /* XXXX It is not documented what units *_offsets are in. - We assume bytes, but this is clearly wrong. - Meaning this code needs to be carefully reviewed for errors. - dmq. - */ - - /* On end-of-str: see comment below. */ - must = utf8_target ? prog->anchored_utf8 : prog->anchored_substr; - if (must == &PL_sv_undef) { - s = (char*)NULL; - DEBUG_r(must = prog->anchored_utf8); /* for debug */ - } - else - s = fbm_instr( - (unsigned char*)t, - HOP3(HOP3(last1, prog->anchored_offset, strend) - + SvCUR(must), -(SvTAIL(must)!=0), strbeg), - must, - multiline ? FBMrf_MULTILINE : 0 - ); - DEBUG_EXECUTE_r({ - RE_PV_QUOTED_DECL(quoted, utf8_target, PERL_DEBUG_PAD_ZERO(0), - SvPVX_const(must), RE_SV_DUMPLEN(must), 30); - PerlIO_printf(Perl_debug_log, "%s anchored substr %s%s", - (s ? "Found" : "Contradicts"), - quoted, RE_SV_TAIL(must)); - }); - - - if (!s) { - if (last1 >= last2) { - DEBUG_EXECUTE_r(PerlIO_printf(Perl_debug_log, - ", giving up...\n")); - goto fail_finish; - } - DEBUG_EXECUTE_r(PerlIO_printf(Perl_debug_log, - ", trying floating at offset %ld...\n", - (long)(HOP3c(saved_s, 1, strend) - i_strpos))); - other_last = HOP3c(last1, prog->anchored_offset+1, strend); - s = HOP3c(last, 1, strend); - goto restart; - } - else { - DEBUG_EXECUTE_r(PerlIO_printf(Perl_debug_log, " at offset %ld...\n", - (long)(s - i_strpos))); - t = HOP3c(s, -prog->anchored_offset, strbeg); - other_last = HOP3c(s, 1, strend); - s = saved_s; - if (t == strpos) - goto try_at_start; - goto try_at_offset; - } - } - } - else { /* Take into account the floating substring. */ - char *last, *last1; - char * const saved_s = s; - SV* must; - - t = HOP3c(s, -start_shift, strbeg); - last1 = last = - HOP3c(strend, -prog->minlen + prog->float_min_offset, strbeg); - if (CHR_DIST((U8*)last, (U8*)t) > prog->float_max_offset) - last = HOP3c(t, prog->float_max_offset, strend); - s = HOP3c(t, prog->float_min_offset, strend); - if (s < other_last) - s = other_last; - /* XXXX It is not documented what units *_offsets are in. Assume bytes. */ - must = utf8_target ? prog->float_utf8 : prog->float_substr; - /* fbm_instr() takes into account exact value of end-of-str - if the check is SvTAIL(ed). Since false positives are OK, - and end-of-str is not later than strend we are OK. */ - if (must == &PL_sv_undef) { - s = (char*)NULL; - DEBUG_r(must = prog->float_utf8); /* for debug message */ - } - else - s = fbm_instr((unsigned char*)s, - (unsigned char*)last + SvCUR(must) - - (SvTAIL(must)!=0), - must, multiline ? FBMrf_MULTILINE : 0); - DEBUG_EXECUTE_r({ - RE_PV_QUOTED_DECL(quoted, utf8_target, PERL_DEBUG_PAD_ZERO(0), - SvPVX_const(must), RE_SV_DUMPLEN(must), 30); - PerlIO_printf(Perl_debug_log, "%s floating substr %s%s", - (s ? "Found" : "Contradicts"), - quoted, RE_SV_TAIL(must)); - }); - if (!s) { - if (last1 == last) { - DEBUG_EXECUTE_r(PerlIO_printf(Perl_debug_log, - ", giving up...\n")); - goto fail_finish; - } - DEBUG_EXECUTE_r(PerlIO_printf(Perl_debug_log, - ", trying anchored starting at offset %ld...\n", - (long)(saved_s + 1 - i_strpos))); - other_last = last; - s = HOP3c(t, 1, strend); - goto restart; + char *last, *last1; + char *s; + SV* must; + struct reg_substr_datum *other; + + do_other_substr: + other = &prog->substrs->data[other_ix]; + + /* if "other" is anchored: + * we've previously found a floating substr starting at check_at. + * This means that the regex origin must lie somewhere + * between min (rx_origin): HOP3(check_at, -check_offset_max) + * and max: HOP3(check_at, -check_offset_min) + * (except that min will be >= strpos) + * So the fixed substr must lie somewhere between + * HOP3(min, anchored_offset) + * HOP3(max, anchored_offset) + SvCUR(substr) + */ + + /* if "other" is floating + * Calculate last1, the absolute latest point where the + * floating substr could start in the string, ignoring any + * constraints from the earlier fixed match. It is calculated + * as follows: + * + * strend - prog->minlen (in chars) is the absolute latest + * position within the string where the origin of the regex + * could appear. The latest start point for the floating + * substr is float_min_offset(*) on from the start of the + * regex. last1 simply combines thee two offsets. + * + * (*) You might think the latest start point should be + * float_max_offset from the regex origin, and technically + * you'd be correct. However, consider + * /a\d{2,4}bcd\w/ + * Here, float min, max are 3,5 and minlen is 7. + * This can match either + * /a\d\dbcd\w/ + * /a\d\d\dbcd\w/ + * /a\d\d\d\dbcd\w/ + * In the first case, the regex matches minlen chars; in the + * second, minlen+1, in the third, minlen+2. + * In the first case, the floating offset is 3 (which equals + * float_min), in the second, 4, and in the third, 5 (which + * equals float_max). In all cases, the floating string bcd + * can never start more than 4 chars from the end of the + * string, which equals minlen - float_min. As the substring + * starts to match more than float_min from the start of the + * regex, it makes the regex match more than minlen chars, + * and the two cancel each other out. So we can always use + * float_min - minlen, rather than float_max - minlen for the + * latest position in the string. + * + * Note that -minlen + float_min_offset is equivalent (AFAIKT) + * to CHR_SVLEN(must) - !!SvTAIL(must) + prog->float_end_shift + */ + + assert(prog->minlen >= other->min_offset); + last1 = HOP3c(strend, + other->min_offset - prog->minlen, strbeg); + + if (other_ix) {/* i.e. if (other-is-float) */ + /* last is the latest point where the floating substr could + * start, *given* any constraints from the earlier fixed + * match. This constraint is that the floating string starts + * <= float_max_offset chars from the regex origin (rx_origin). + * If this value is less than last1, use it instead. + */ + assert(rx_origin <= last1); + last = + /* this condition handles the offset==infinity case, and + * is a short-cut otherwise. Although it's comparing a + * byte offset to a char length, it does so in a safe way, + * since 1 char always occupies 1 or more bytes, + * so if a string range is (last1 - rx_origin) bytes, + * it will be less than or equal to (last1 - rx_origin) + * chars; meaning it errs towards doing the accurate HOP3 + * rather than just using last1 as a short-cut */ + (last1 - rx_origin) < other->max_offset + ? last1 + : (char*)HOP3lim(rx_origin, other->max_offset, last1); + } + else { + assert(strpos + start_shift <= check_at); + last = HOP4c(check_at, other->min_offset - start_shift, + strbeg, strend); + } + + s = HOP3c(rx_origin, other->min_offset, strend); + if (s < other_last) /* These positions already checked */ + s = other_last; + + must = utf8_target ? other->utf8_substr : other->substr; + assert(SvPOK(must)); + s = fbm_instr( + (unsigned char*)s, + (unsigned char*)last + SvCUR(must) - (SvTAIL(must)!=0), + must, + multiline ? FBMrf_MULTILINE : 0 + ); + DEBUG_EXECUTE_r({ + RE_PV_QUOTED_DECL(quoted, utf8_target, PERL_DEBUG_PAD_ZERO(0), + SvPVX_const(must), RE_SV_DUMPLEN(must), 30); + PerlIO_printf(Perl_debug_log, " %s %s substr %s%s", + s ? "Found" : "Contradicts", + other_ix ? "floating" : "anchored", + quoted, RE_SV_TAIL(must)); + }); + + + if (!s) { + /* last1 is latest possible substr location. If we didn't + * find it before there, we never will */ + if (last >= last1) { + DEBUG_EXECUTE_r(PerlIO_printf(Perl_debug_log, + ", giving up...\n")); + goto fail_finish; + } + + /* try to find the check substr again at a later + * position. Maybe next time we'll find the "other" substr + * in range too */ + DEBUG_EXECUTE_r(PerlIO_printf(Perl_debug_log, + ", trying %s at offset %ld...\n", + (other_ix ? "floating" : "anchored"), + (long)(HOP3c(check_at, 1, strend) - strpos))); + + other_last = HOP3c(last, 1, strend) /* highest failure */; + rx_origin = + other_ix /* i.e. if other-is-float */ + ? HOP3c(rx_origin, 1, strend) + : HOP4c(last, 1 - other->min_offset, strbeg, strend); + goto restart; + } + else { + DEBUG_EXECUTE_r(PerlIO_printf(Perl_debug_log, " at offset %ld...\n", + (long)(s - strpos))); + + if (other_ix) { /* if (other-is-float) */ + /* other_last is set to s, not s+1, since its possible for + * a floating substr to fail first time, then succeed + * second time at the same floating position; e.g.: + * "-AB--AABZ" =~ /\wAB\d*Z/ + * The first time round, anchored and float match at + * "-(AB)--AAB(Z)" then fail on the initial \w character + * class. Second time round, they match at "-AB--A(AB)(Z)". + */ + other_last = s; + } + else { + rx_origin = HOP3c(s, -other->min_offset, strbeg); + other_last = HOP3c(s, 1, strend); + } + } + } + else { + DEBUG_OPTIMISE_MORE_r( + PerlIO_printf(Perl_debug_log, + " Check-only match: offset min:%"IVdf" max:%"IVdf + " check_at:%"IVdf" rx_origin:%"IVdf" rx_origin-check_at:%"IVdf + " strend-strpos:%"IVdf"\n", + (IV)prog->check_offset_min, + (IV)prog->check_offset_max, + (IV)(check_at-strpos), + (IV)(rx_origin-strpos), + (IV)(rx_origin-check_at), + (IV)(strend-strpos) + ) + ); + } + + postprocess_substr_matches: + + /* handle the extra constraint of /^.../m if present */ + + if (ml_anch && rx_origin != strbeg && rx_origin[-1] != '\n') { + char *s; + + DEBUG_EXECUTE_r(PerlIO_printf(Perl_debug_log, + " looking for /^/m anchor")); + + /* we have failed the constraint of a \n before rx_origin. + * Find the next \n, if any, even if it's beyond the current + * anchored and/or floating substrings. Whether we should be + * scanning ahead for the next \n or the next substr is debatable. + * On the one hand you'd expect rare substrings to appear less + * often than \n's. On the other hand, searching for \n means + * we're effectively flipping been check_substr and "\n" on each + * iteration as the current "rarest" string candidate, which + * means for example that we'll quickly reject the whole string if + * hasn't got a \n, rather than trying every substr position + * first + */ + + s = HOP3c(strend, - prog->minlen, strpos); + if (s <= rx_origin || + ! ( rx_origin = (char *)memchr(rx_origin, '\n', s - rx_origin))) + { + DEBUG_EXECUTE_r(PerlIO_printf(Perl_debug_log, + " Did not find /%s^%s/m...\n", + PL_colors[0], PL_colors[1])); + goto fail_finish; + } + + /* earliest possible origin is 1 char after the \n. + * (since *rx_origin == '\n', it's safe to ++ here rather than + * HOP(rx_origin, 1)) */ + rx_origin++; + + if (prog->substrs->check_ix == 0 /* check is anchored */ + || rx_origin >= HOP3c(check_at, - prog->check_offset_min, strpos)) + { + /* Position contradicts check-string; either because + * check was anchored (and thus has no wiggle room), + * or check was float and rx_origin is above the float range */ + DEBUG_EXECUTE_r(PerlIO_printf(Perl_debug_log, + " Found /%s^%s/m, restarting lookup for check-string at offset %ld...\n", + PL_colors[0], PL_colors[1], (long)(rx_origin - strpos))); + goto restart; + } + + /* if we get here, the check substr must have been float, + * is in range, and we may or may not have had an anchored + * "other" substr which still contradicts */ + assert(prog->substrs->check_ix); /* check is float */ + + if (utf8_target ? prog->anchored_utf8 : prog->anchored_substr) { + /* whoops, the anchored "other" substr exists, so we still + * contradict. On the other hand, the float "check" substr + * didn't contradict, so just retry the anchored "other" + * substr */ + DEBUG_EXECUTE_r(PerlIO_printf(Perl_debug_log, + " Found /%s^%s/m at offset %ld, rescanning for anchored from offset %ld...\n", + PL_colors[0], PL_colors[1], + (long)(rx_origin - strpos), + (long)(rx_origin - strpos + prog->anchored_offset))); + goto do_other_substr; + } + + /* success: we don't contradict the found floating substring + * (and there's no anchored substr). */ + DEBUG_EXECUTE_r(PerlIO_printf(Perl_debug_log, + " Found /%s^%s/m at offset %ld...\n", + PL_colors[0], PL_colors[1], (long)(rx_origin - strpos))); + } + else { + DEBUG_EXECUTE_r(PerlIO_printf(Perl_debug_log, + " (multiline anchor test skipped)\n")); + } + + success_at_start: + + + /* if we have a starting character class, then test that extra constraint. + * (trie stclasses are too expensive to use here, we are better off to + * leave it to regmatch itself) */ + + if (progi->regstclass && PL_regkind[OP(progi->regstclass)]!=TRIE) { + const U8* const str = (U8*)STRING(progi->regstclass); + + /* XXX this value could be pre-computed */ + const int cl_l = (PL_regkind[OP(progi->regstclass)] == EXACT + ? (reginfo->is_utf8_pat + ? utf8_distance(str + STR_LEN(progi->regstclass), str) + : STR_LEN(progi->regstclass)) + : 1); + char * endpos; + char *s; + /* latest pos that a matching float substr constrains rx start to */ + char *rx_max_float = NULL; + + /* if the current rx_origin is anchored, either by satisfying an + * anchored substring constraint, or a /^.../m constraint, then we + * can reject the current origin if the start class isn't found + * at the current position. If we have a float-only match, then + * rx_origin is constrained to a range; so look for the start class + * in that range. if neither, then look for the start class in the + * whole rest of the string */ + + /* XXX DAPM it's not clear what the minlen test is for, and why + * it's not used in the floating case. Nothing in the test suite + * causes minlen == 0 here. See <20140313134639.GS12844@iabyn.com>. + * Here are some old comments, which may or may not be correct: + * + * minlen == 0 is possible if regstclass is \b or \B, + * and the fixed substr is ''$. + * Since minlen is already taken into account, rx_origin+1 is + * before strend; accidentally, minlen >= 1 guaranties no false + * positives at rx_origin + 1 even for \b or \B. But (minlen? 1 : + * 0) below assumes that regstclass does not come from lookahead... + * If regstclass takes bytelength more than 1: If charlength==1, OK. + * This leaves EXACTF-ish only, which are dealt with in + * find_byclass(). + */ + + if (prog->anchored_substr || prog->anchored_utf8 || ml_anch) + endpos= HOP3c(rx_origin, (prog->minlen ? cl_l : 0), strend); + else if (prog->float_substr || prog->float_utf8) { + rx_max_float = HOP3c(check_at, -start_shift, strbeg); + endpos= HOP3c(rx_max_float, cl_l, strend); + } + else + endpos= strend; + + DEBUG_EXECUTE_r(PerlIO_printf(Perl_debug_log, + " looking for class: start_shift: %"IVdf" check_at: %"IVdf + " rx_origin: %"IVdf" endpos: %"IVdf"\n", + (IV)start_shift, (IV)(check_at - strbeg), + (IV)(rx_origin - strbeg), (IV)(endpos - strbeg))); + + s = find_byclass(prog, progi->regstclass, rx_origin, endpos, + reginfo); + if (!s) { + if (endpos == strend) { + DEBUG_EXECUTE_r( PerlIO_printf(Perl_debug_log, + " Could not match STCLASS...\n") ); + goto fail; } + DEBUG_EXECUTE_r( PerlIO_printf(Perl_debug_log, + " This position contradicts STCLASS...\n") ); + if ((prog->intflags & PREGf_ANCH) && !ml_anch + && !(prog->intflags & PREGf_IMPLICIT)) + goto fail; + + /* Contradict one of substrings */ + if (prog->anchored_substr || prog->anchored_utf8) { + if (prog->substrs->check_ix == 1) { /* check is float */ + /* Have both, check_string is floating */ + assert(rx_origin + start_shift <= check_at); + if (rx_origin + start_shift != check_at) { + /* not at latest position float substr could match: + * Recheck anchored substring, but not floating. + * The condition above is in bytes rather than + * chars for efficiency. It's conservative, in + * that it errs on the side of doing 'goto + * do_other_substr', where a more accurate + * char-based calculation will be done */ + DEBUG_EXECUTE_r( PerlIO_printf(Perl_debug_log, + " Looking for anchored substr starting at offset %ld...\n", + (long)(other_last - strpos)) ); + goto do_other_substr; + } + } + } else { - DEBUG_EXECUTE_r(PerlIO_printf(Perl_debug_log, " at offset %ld...\n", - (long)(s - i_strpos))); - other_last = s; /* Fix this later. --Hugo */ - s = saved_s; - if (t == strpos) - goto try_at_start; - goto try_at_offset; - } + /* float-only */ + + if (ml_anch) { + /* In the presence of ml_anch, we might be able to + * find another \n without breaking the current float + * constraint. */ + + /* strictly speaking this should be HOP3c(..., 1, ...), + * but since we goto a block of code that's going to + * search for the next \n if any, its safe here */ + rx_origin++; + DEBUG_EXECUTE_r( PerlIO_printf(Perl_debug_log, + " Looking for /%s^%s/m starting at offset %ld...\n", + PL_colors[0], PL_colors[1], + (long)(rx_origin - strpos)) ); + goto postprocess_substr_matches; + } + + /* strictly speaking this can never be true; but might + * be if we ever allow intuit without substrings */ + if (!(utf8_target ? prog->float_utf8 : prog->float_substr)) + goto fail; + + rx_origin = rx_max_float; + } + + /* at this point, any matching substrings have been + * contradicted. Start again... */ + + rx_origin = HOP3c(rx_origin, 1, strend); + + /* uses bytes rather than char calculations for efficiency. + * It's conservative: it errs on the side of doing 'goto restart', + * where there is code that does a proper char-based test */ + if (rx_origin + start_shift + end_shift > strend) { + DEBUG_EXECUTE_r( PerlIO_printf(Perl_debug_log, + " Could not match STCLASS...\n") ); + goto fail; + } + DEBUG_EXECUTE_r( PerlIO_printf(Perl_debug_log, + " Looking for %s substr starting at offset %ld...\n", + (prog->substrs->check_ix ? "floating" : "anchored"), + (long)(rx_origin + start_shift - strpos)) ); + goto restart; } + + /* Success !!! */ + + if (rx_origin != s) { + DEBUG_EXECUTE_r(PerlIO_printf(Perl_debug_log, + " By STCLASS: moving %ld --> %ld\n", + (long)(rx_origin - strpos), (long)(s - strpos)) + ); + } + else { + DEBUG_EXECUTE_r(PerlIO_printf(Perl_debug_log, + " Does not contradict STCLASS...\n"); + ); + } } - - t= (char*)HOP3( s, -prog->check_offset_max, (prog->check_offset_max<0) ? strend : strpos); - - DEBUG_OPTIMISE_MORE_r( - PerlIO_printf(Perl_debug_log, - "Check offset min:%"IVdf" max:%"IVdf" S:%"IVdf" t:%"IVdf" D:%"IVdf" end:%"IVdf"\n", - (IV)prog->check_offset_min, - (IV)prog->check_offset_max, - (IV)(s-strpos), - (IV)(t-strpos), - (IV)(t-s), - (IV)(strend-strpos) - ) - ); + /* Decide whether using the substrings helped */ - if (s - strpos > prog->check_offset_max /* signed-corrected t > strpos */ - && (!utf8_target - || ((t = (char*)reghopmaybe3((U8*)s, -prog->check_offset_max, (U8*) ((prog->check_offset_max<0) ? strend : strpos))) - && t > strpos))) - { + if (rx_origin != strpos) { /* Fixed substring is found far enough so that the match cannot start at strpos. */ - try_at_offset: - if (ml_anch && t[-1] != '\n') { - /* Eventually fbm_*() should handle this, but often - anchored_offset is not 0, so this check will not be wasted. */ - /* XXXX In the code below we prefer to look for "^" even in - presence of anchored substrings. And we search even - beyond the found float position. These pessimizations - are historical artefacts only. */ - find_anchor: - while (t < strend - prog->minlen) { - if (*t == '\n') { - if (t < check_at - prog->check_offset_min) { - if (utf8_target ? prog->anchored_utf8 : prog->anchored_substr) { - /* Since we moved from the found position, - we definitely contradict the found anchored - substr. Due to the above check we do not - contradict "check" substr. - Thus we can arrive here only if check substr - is float. Redo checking for "other"=="fixed". - */ - strpos = t + 1; - DEBUG_EXECUTE_r(PerlIO_printf(Perl_debug_log, "Found /%s^%s/m at offset %ld, rescanning for anchored from offset %ld...\n", - PL_colors[0], PL_colors[1], (long)(strpos - i_strpos), (long)(strpos - i_strpos + prog->anchored_offset))); - goto do_other_anchored; - } - /* We don't contradict the found floating substring. */ - /* XXXX Why not check for STCLASS? */ - s = t + 1; - DEBUG_EXECUTE_r(PerlIO_printf(Perl_debug_log, "Found /%s^%s/m at offset %ld...\n", - PL_colors[0], PL_colors[1], (long)(s - i_strpos))); - goto set_useful; - } - /* Position contradicts check-string */ - /* XXXX probably better to look for check-string - than for "\n", so one should lower the limit for t? */ - DEBUG_EXECUTE_r(PerlIO_printf(Perl_debug_log, "Found /%s^%s/m, restarting lookup for check-string at offset %ld...\n", - PL_colors[0], PL_colors[1], (long)(t + 1 - i_strpos))); - other_last = strpos = s = t + 1; - goto restart; - } - t++; - } - DEBUG_EXECUTE_r(PerlIO_printf(Perl_debug_log, "Did not find /%s^%s/m...\n", - PL_colors[0], PL_colors[1])); - goto fail_finish; - } - else { - DEBUG_EXECUTE_r(PerlIO_printf(Perl_debug_log, "Starting position does not contradict /%s^%s/m...\n", - PL_colors[0], PL_colors[1])); - } - s = t; - set_useful: + + DEBUG_EXECUTE_r(PerlIO_printf(Perl_debug_log, " try at offset...\n")); ++BmUSEFUL(utf8_target ? prog->check_utf8 : prog->check_substr); /* hooray/5 */ } else { - /* The found string does not prohibit matching at strpos, - - no optimization of calling REx engine can be performed, - unless it was an MBOL and we are not after MBOL, - or a future STCLASS check will fail this. */ - try_at_start: - /* Even in this situation we may use MBOL flag if strpos is offset - wrt the start of the string. */ - if (ml_anch && sv && !SvROK(sv) /* See prev comment on SvROK */ - && (strpos != strbeg) && strpos[-1] != '\n' - /* May be due to an implicit anchor of m{.*foo} */ - && !(prog->intflags & PREGf_IMPLICIT)) - { - t = strpos; - goto find_anchor; - } - DEBUG_EXECUTE_r( if (ml_anch) - PerlIO_printf(Perl_debug_log, "Position at offset %ld does not contradict /%s^%s/m...\n", - (long)(strpos - i_strpos), PL_colors[0], PL_colors[1]); - ); - success_at_start: - if (!(prog->intflags & PREGf_NAUGHTY) /* XXXX If strpos moved? */ + /* The found rx_origin position does not prohibit matching at + * strpos, so calling intuit didn't gain us anything. Decrement + * the BmUSEFUL() count on the check substring, and if we reach + * zero, free it. */ + if (!(prog->intflags & PREGf_NAUGHTY) && (utf8_target ? ( prog->check_utf8 /* Could be deleted already */ && --BmUSEFUL(prog->check_utf8) < 0 @@ -1070,146 +1405,25 @@ Perl_re_intuit_start(pTHX_ REGEXP * cons ))) { /* If flags & SOMETHING - do not do it many times on the same match */ - DEBUG_EXECUTE_r(PerlIO_printf(Perl_debug_log, "... Disabling check substring...\n")); + DEBUG_EXECUTE_r(PerlIO_printf(Perl_debug_log, " ... Disabling check substring...\n")); /* XXX Does the destruction order has to change with utf8_target? */ SvREFCNT_dec(utf8_target ? prog->check_utf8 : prog->check_substr); SvREFCNT_dec(utf8_target ? prog->check_substr : prog->check_utf8); prog->check_substr = prog->check_utf8 = NULL; /* disable */ prog->float_substr = prog->float_utf8 = NULL; /* clear */ check = NULL; /* abort */ - s = strpos; - /* XXXX If the check string was an implicit check MBOL, then we need to unset the relevant flag - see http://bugs.activestate.com/show_bug.cgi?id=87173 */ - if (prog->intflags & PREGf_IMPLICIT) - prog->extflags &= ~RXf_ANCH_MBOL; /* XXXX This is a remnant of the old implementation. It looks wasteful, since now INTUIT can use many other heuristics. */ prog->extflags &= ~RXf_USE_INTUIT; - /* XXXX What other flags might need to be cleared in this branch? */ } - else - s = strpos; } - /* Last resort... */ - /* XXXX BmUSEFUL already changed, maybe multiple change is meaningful... */ - /* trie stclasses are too expensive to use here, we are better off to - leave it to regmatch itself */ - if (progi->regstclass && PL_regkind[OP(progi->regstclass)]!=TRIE) { - /* minlen == 0 is possible if regstclass is \b or \B, - and the fixed substr is ''$. - Since minlen is already taken into account, s+1 is before strend; - accidentally, minlen >= 1 guaranties no false positives at s + 1 - even for \b or \B. But (minlen? 1 : 0) below assumes that - regstclass does not come from lookahead... */ - /* If regstclass takes bytelength more than 1: If charlength==1, OK. - This leaves EXACTF-ish only, which are dealt with in find_byclass(). */ - const U8* const str = (U8*)STRING(progi->regstclass); - const int cl_l = (PL_regkind[OP(progi->regstclass)] == EXACT - ? CHR_DIST(str+STR_LEN(progi->regstclass), str) - : 1); - char * endpos; - if (prog->anchored_substr || prog->anchored_utf8 || ml_anch) - endpos= HOP3c(s, (prog->minlen ? cl_l : 0), strend); - else if (prog->float_substr || prog->float_utf8) - endpos= HOP3c(HOP3c(check_at, -start_shift, strbeg), cl_l, strend); - else - endpos= strend; - - if (checked_upto < s) - checked_upto = s; - DEBUG_EXECUTE_r(PerlIO_printf(Perl_debug_log, "start_shift: %"IVdf" check_at: %"IVdf" s: %"IVdf" endpos: %"IVdf" checked_upto: %"IVdf"\n", - (IV)start_shift, (IV)(check_at - strbeg), (IV)(s - strbeg), (IV)(endpos - strbeg), (IV)(checked_upto- strbeg))); - - t = s; - s = find_byclass(prog, progi->regstclass, checked_upto, endpos, - NULL, is_utf8_pat); - if (s) { - checked_upto = s; - } else { -#ifdef DEBUGGING - const char *what = NULL; -#endif - if (endpos == strend) { - DEBUG_EXECUTE_r( PerlIO_printf(Perl_debug_log, - "Could not match STCLASS...\n") ); - goto fail; - } - DEBUG_EXECUTE_r( PerlIO_printf(Perl_debug_log, - "This position contradicts STCLASS...\n") ); - if ((prog->extflags & RXf_ANCH) && !ml_anch) - goto fail; - checked_upto = HOPBACKc(endpos, start_shift); - DEBUG_EXECUTE_r(PerlIO_printf(Perl_debug_log, "start_shift: %"IVdf" check_at: %"IVdf" endpos: %"IVdf" checked_upto: %"IVdf"\n", - (IV)start_shift, (IV)(check_at - strbeg), (IV)(endpos - strbeg), (IV)(checked_upto- strbeg))); - /* Contradict one of substrings */ - if (prog->anchored_substr || prog->anchored_utf8) { - if ((utf8_target ? prog->anchored_utf8 : prog->anchored_substr) == check) { - DEBUG_EXECUTE_r( what = "anchored" ); - hop_and_restart: - s = HOP3c(t, 1, strend); - if (s + start_shift + end_shift > strend) { - /* XXXX Should be taken into account earlier? */ - DEBUG_EXECUTE_r( PerlIO_printf(Perl_debug_log, - "Could not match STCLASS...\n") ); - goto fail; - } - if (!check) - goto giveup; - DEBUG_EXECUTE_r( PerlIO_printf(Perl_debug_log, - "Looking for %s substr starting at offset %ld...\n", - what, (long)(s + start_shift - i_strpos)) ); - goto restart; - } - /* Have both, check_string is floating */ - if (t + start_shift >= check_at) /* Contradicts floating=check */ - goto retry_floating_check; - /* Recheck anchored substring, but not floating... */ - s = check_at; - if (!check) - goto giveup; - DEBUG_EXECUTE_r( PerlIO_printf(Perl_debug_log, - "Looking for anchored substr starting at offset %ld...\n", - (long)(other_last - i_strpos)) ); - goto do_other_anchored; - } - /* Another way we could have checked stclass at the - current position only: */ - if (ml_anch) { - s = t = t + 1; - if (!check) - goto giveup; - DEBUG_EXECUTE_r( PerlIO_printf(Perl_debug_log, - "Looking for /%s^%s/m starting at offset %ld...\n", - PL_colors[0], PL_colors[1], (long)(t - i_strpos)) ); - goto try_at_offset; - } - if (!(utf8_target ? prog->float_utf8 : prog->float_substr)) /* Could have been deleted */ - goto fail; - /* Check is floating substring. */ - retry_floating_check: - t = check_at - start_shift; - DEBUG_EXECUTE_r( what = "floating" ); - goto hop_and_restart; - } - if (t != s) { - DEBUG_EXECUTE_r(PerlIO_printf(Perl_debug_log, - "By STCLASS: moving %ld --> %ld\n", - (long)(t - i_strpos), (long)(s - i_strpos)) - ); - } - else { - DEBUG_EXECUTE_r(PerlIO_printf(Perl_debug_log, - "Does not contradict STCLASS...\n"); - ); - } - } - giveup: - DEBUG_EXECUTE_r(PerlIO_printf(Perl_debug_log, "%s%s:%s match at offset %ld\n", - PL_colors[4], (check ? "Guessed" : "Giving up"), - PL_colors[5], (long)(s - i_strpos)) ); - return s; + DEBUG_EXECUTE_r(PerlIO_printf(Perl_debug_log, + "Intuit: %sSuccessfully guessed:%s match at offset %ld\n", + PL_colors[4], PL_colors[5], (long)(rx_origin - strpos)) ); + + return rx_origin; fail_finish: /* Substring not found */ if (prog->check_substr || prog->check_utf8) /* could be removed already */ @@ -1220,46 +1434,57 @@ Perl_re_intuit_start(pTHX_ REGEXP * cons return NULL; } + #define DECL_TRIE_TYPE(scan) \ - const enum { trie_plain, trie_utf8, trie_utf8_fold, trie_latin_utf8_fold } \ + const enum { trie_plain, trie_utf8, trie_utf8_fold, trie_latin_utf8_fold, \ + trie_utf8_exactfa_fold, trie_latin_utf8_exactfa_fold } \ trie_type = ((scan->flags == EXACT) \ ? (utf8_target ? trie_utf8 : trie_plain) \ - : (utf8_target ? trie_utf8_fold : trie_latin_utf8_fold)) + : (scan->flags == EXACTFA) \ + ? (utf8_target ? trie_utf8_exactfa_fold : trie_latin_utf8_exactfa_fold) \ + : (utf8_target ? trie_utf8_fold : trie_latin_utf8_fold)) #define REXEC_TRIE_READ_CHAR(trie_type, trie, widecharmap, uc, uscan, len, uvc, charid, foldlen, foldbuf, uniflags) \ -STMT_START { \ +STMT_START { \ STRLEN skiplen; \ + U8 flags = FOLD_FLAGS_FULL; \ switch (trie_type) { \ + case trie_utf8_exactfa_fold: \ + flags |= FOLD_FLAGS_NOMIX_ASCII; \ + /* FALL THROUGH */ \ case trie_utf8_fold: \ if ( foldlen>0 ) { \ - uvc = utf8n_to_uvuni( (const U8*) uscan, UTF8_MAXLEN, &len, uniflags ); \ + uvc = utf8n_to_uvchr( (const U8*) uscan, UTF8_MAXLEN, &len, uniflags ); \ foldlen -= len; \ uscan += len; \ len=0; \ } else { \ - uvc = to_utf8_fold( (const U8*) uc, foldbuf, &foldlen ); \ + uvc = _to_utf8_fold_flags( (const U8*) uc, foldbuf, &foldlen, flags); \ len = UTF8SKIP(uc); \ skiplen = UNISKIP( uvc ); \ foldlen -= skiplen; \ uscan = foldbuf + skiplen; \ } \ break; \ + case trie_latin_utf8_exactfa_fold: \ + flags |= FOLD_FLAGS_NOMIX_ASCII; \ + /* FALL THROUGH */ \ case trie_latin_utf8_fold: \ if ( foldlen>0 ) { \ - uvc = utf8n_to_uvuni( (const U8*) uscan, UTF8_MAXLEN, &len, uniflags ); \ + uvc = utf8n_to_uvchr( (const U8*) uscan, UTF8_MAXLEN, &len, uniflags ); \ foldlen -= len; \ uscan += len; \ len=0; \ } else { \ len = 1; \ - uvc = _to_fold_latin1( (U8) *uc, foldbuf, &foldlen, 1); \ + uvc = _to_fold_latin1( (U8) *uc, foldbuf, &foldlen, flags); \ skiplen = UNISKIP( uvc ); \ foldlen -= skiplen; \ uscan = foldbuf + skiplen; \ } \ break; \ case trie_utf8: \ - uvc = utf8n_to_uvuni( (const U8*) uc, UTF8_MAXLEN, &len, uniflags ); \ + uvc = utf8n_to_uvchr( (const U8*) uc, UTF8_MAXLEN, &len, uniflags ); \ break; \ case trie_plain: \ uvc = (UV)*uc; \ @@ -1284,7 +1509,7 @@ STMT_START { while (s <= e) { \ if ( (CoNd) \ && (ln == 1 || folder(s, pat_string, ln)) \ - && (!reginfo || regtry(reginfo, &s)) ) \ + && (reginfo->intuit || regtry(reginfo, &s)) )\ goto got_it; \ s++; \ } \ @@ -1309,7 +1534,7 @@ STMT_START { #define REXEC_FBC_UTF8_CLASS_SCAN(CoNd) \ REXEC_FBC_UTF8_SCAN( \ if (CoNd) { \ - if (tmp && (!reginfo || regtry(reginfo, &s))) \ + if (tmp && (reginfo->intuit || regtry(reginfo, &s))) \ goto got_it; \ else \ tmp = doevery; \ @@ -1321,7 +1546,7 @@ REXEC_FBC_UTF8_SCAN( #define REXEC_FBC_CLASS_SCAN(CoNd) \ REXEC_FBC_SCAN( \ if (CoNd) { \ - if (tmp && (!reginfo || regtry(reginfo, &s))) \ + if (tmp && (reginfo->intuit || regtry(reginfo, &s))) \ goto got_it; \ else \ tmp = doevery; \ @@ -1330,27 +1555,28 @@ REXEC_FBC_SCAN( tmp = 1; \ ) -#define REXEC_FBC_TRYIT \ -if ((!reginfo || regtry(reginfo, &s))) \ +#define REXEC_FBC_TRYIT \ +if ((reginfo->intuit || regtry(reginfo, &s))) \ goto got_it #define REXEC_FBC_CSCAN(CoNdUtF8,CoNd) \ - if (utf8_target) { \ + if (utf8_target) { \ REXEC_FBC_UTF8_CLASS_SCAN(CoNdUtF8); \ } \ else { \ REXEC_FBC_CLASS_SCAN(CoNd); \ } -#define DUMP_EXEC_POS(li,s,doutf8) \ - dump_exec_pos(li,s,(PL_regeol),(PL_bostr),(PL_reg_starttry),doutf8) +#define DUMP_EXEC_POS(li,s,doutf8) \ + dump_exec_pos(li,s,(reginfo->strend),(reginfo->strbeg), \ + startpos, doutf8) -#define UTF8_NOLOAD(TEST_NON_UTF8, IF_SUCCESS, IF_FAIL) \ - tmp = (s != PL_bostr) ? UCHARAT(s - 1) : '\n'; \ +#define UTF8_NOLOAD(TEST_NON_UTF8, IF_SUCCESS, IF_FAIL) \ + tmp = (s != reginfo->strbeg) ? UCHARAT(s - 1) : '\n'; \ tmp = TEST_NON_UTF8(tmp); \ REXEC_FBC_UTF8_SCAN( \ - if (tmp == ! TEST_NON_UTF8((U8) *s)) { \ + if (tmp == ! TEST_NON_UTF8((U8) *s)) { \ tmp = !tmp; \ IF_SUCCESS; \ } \ @@ -1359,18 +1585,19 @@ if ((!reginfo || regtry(reginfo, &s))) \ } \ ); \ -#define UTF8_LOAD(TeSt1_UtF8, TeSt2_UtF8, IF_SUCCESS, IF_FAIL) \ - if (s == PL_bostr) { \ +#define UTF8_LOAD(TeSt1_UtF8, TeSt2_UtF8, IF_SUCCESS, IF_FAIL) \ + if (s == reginfo->strbeg) { \ tmp = '\n'; \ } \ else { \ - U8 * const r = reghop3((U8*)s, -1, (U8*)PL_bostr); \ - tmp = utf8n_to_uvchr(r, UTF8SKIP(r), 0, UTF8_ALLOW_DEFAULT); \ + U8 * const r = reghop3((U8*)s, -1, (U8*)reginfo->strbeg); \ + tmp = utf8n_to_uvchr(r, (U8*) reginfo->strend - r, \ + 0, UTF8_ALLOW_DEFAULT); \ } \ tmp = TeSt1_UtF8; \ - LOAD_UTF8_CHARCLASS_ALNUM(); \ + LOAD_UTF8_CHARCLASS_ALNUM(); \ REXEC_FBC_UTF8_SCAN( \ - if (tmp == ! (TeSt2_UtF8)) { \ + if (tmp == ! (TeSt2_UtF8)) { \ tmp = !tmp; \ IF_SUCCESS; \ } \ @@ -1405,12 +1632,12 @@ if ((!reginfo || regtry(reginfo, &s))) \ * one, and compare it with the wordness of this one. If they differ, we have * a boundary. At the beginning of the string, pretend that the previous * character was a new-line */ -#define FBC_BOUND_COMMON(UTF8_CODE, TEST_NON_UTF8, IF_SUCCESS, IF_FAIL) \ +#define FBC_BOUND_COMMON(UTF8_CODE, TEST_NON_UTF8, IF_SUCCESS, IF_FAIL) \ if (utf8_target) { \ - UTF8_CODE \ + UTF8_CODE \ } \ else { /* Not utf8 */ \ - tmp = (s != PL_bostr) ? UCHARAT(s - 1) : '\n'; \ + tmp = (s != reginfo->strbeg) ? UCHARAT(s - 1) : '\n'; \ tmp = TEST_NON_UTF8(tmp); \ REXEC_FBC_SCAN( \ if (tmp == ! TEST_NON_UTF8((U8) *s)) { \ @@ -1422,17 +1649,17 @@ if ((!reginfo || regtry(reginfo, &s))) \ } \ ); \ } \ - if ((!prog->minlen && tmp) && (!reginfo || regtry(reginfo, &s))) \ + if ((!prog->minlen && tmp) && (reginfo->intuit || regtry(reginfo, &s))) \ goto got_it; /* We know what class REx starts with. Try to find this position... */ -/* if reginfo is NULL, its a dryrun */ +/* if reginfo->intuit, its a dryrun */ /* annoyingly all the vars in this routine have different names from their counterparts in regmatch. /grrr */ STATIC char * S_find_byclass(pTHX_ regexp * prog, const regnode *c, char *s, - const char *strend, regmatch_info *reginfo, bool is_utf8_pat) + const char *strend, regmatch_info *reginfo) { dVAR; const I32 doevery = (prog->intflags & PREGf_SKIP) == 0; @@ -1446,8 +1673,9 @@ S_find_byclass(pTHX_ regexp * prog, cons U8 c2; char *e; I32 tmp = 1; /* Scratch variable? */ - const bool utf8_target = PL_reg_match_utf8; + const bool utf8_target = reginfo->is_utf8_target; UV utf8_fold_flags = 0; + const bool is_utf8_pat = reginfo->is_utf8_pat; bool to_complement = FALSE; /* Invert the result? Taking the xor of this with a result inverts that result, as 0^1 = 1 and 1^1 = 0 */ @@ -1460,11 +1688,9 @@ S_find_byclass(pTHX_ regexp * prog, cons /* We know what class it must start with. */ switch (OP(c)) { case ANYOF: - case ANYOF_SYNTHETIC: - case ANYOF_WARN_SUPER: if (utf8_target) { REXEC_FBC_UTF8_CLASS_SCAN( - reginclass(prog, c, (U8*)s, utf8_target)); + reginclass(prog, c, (U8*)s, (U8*) strend, utf8_target)); } else { REXEC_FBC_CLASS_SCAN(REGINCLASS(prog, c, (U8*)s)); @@ -1472,13 +1698,16 @@ S_find_byclass(pTHX_ regexp * prog, cons break; case CANY: REXEC_FBC_SCAN( - if (tmp && (!reginfo || regtry(reginfo, &s))) + if (tmp && (reginfo->intuit || regtry(reginfo, &s))) goto got_it; else tmp = doevery; ); break; + case EXACTFA_NO_TRIE: /* This node only generated for non-utf8 patterns */ + assert(! is_utf8_pat); + /* FALL THROUGH */ case EXACTFA: if (is_utf8_pat || utf8_target) { utf8_fold_flags = FOLDEQ_UTF8_NOMIX_ASCII; @@ -1488,10 +1717,9 @@ S_find_byclass(pTHX_ regexp * prog, cons folder = foldEQ_latin1; /* /a, except the sharp s one which */ goto do_exactf_non_utf8; /* isn't dealt with by these */ - case EXACTF: + case EXACTF: /* This node only generated for non-utf8 patterns */ + assert(! is_utf8_pat); if (utf8_target) { - - /* regcomp.c already folded this if pattern is in UTF-8 */ utf8_fold_flags = 0; goto do_exactf_utf8; } @@ -1500,8 +1728,8 @@ S_find_byclass(pTHX_ regexp * prog, cons goto do_exactf_non_utf8; case EXACTFL: - if (is_utf8_pat || utf8_target) { - utf8_fold_flags = FOLDEQ_UTF8_LOCALE; + if (is_utf8_pat || utf8_target || IN_UTF8_CTYPE_LOCALE) { + utf8_fold_flags = FOLDEQ_LOCALE; goto do_exactf_utf8; } fold_array = PL_fold_locale; @@ -1514,7 +1742,6 @@ S_find_byclass(pTHX_ regexp * prog, cons } goto do_exactf_utf8; - case EXACTFU_TRICKYFOLD: case EXACTFU: if (is_utf8_pat || utf8_target) { utf8_fold_flags = is_utf8_pat ? FOLDEQ_S2_ALREADY_FOLDED : 0; @@ -1547,9 +1774,9 @@ S_find_byclass(pTHX_ regexp * prog, cons * characters, and there are only 2 availabe, we know without * trying that it will fail; so don't start a match past the * required minimum number from the far end */ - e = HOP3c(strend, -((I32)ln), s); + e = HOP3c(strend, -((SSize_t)ln), s); - if (!reginfo && e < s) { + if (reginfo->intuit && e < s) { e = s; /* Due to minlen logic of intuit() */ } @@ -1593,9 +1820,9 @@ S_find_byclass(pTHX_ regexp * prog, cons * only 2 are left, it's guaranteed to fail, so don't start a * match that would require us to go beyond the end of the string */ - e = HOP3c(strend, -((I32)lnc), s); + e = HOP3c(strend, -((SSize_t)lnc), s); - if (!reginfo && e < s) { + if (reginfo->intuit && e < s) { e = s; /* Due to minlen logic of intuit() */ } @@ -1610,7 +1837,7 @@ S_find_byclass(pTHX_ regexp * prog, cons char *my_strend= (char *)strend; if (foldEQ_utf8_flags(s, &my_strend, 0, utf8_target, pat_string, NULL, ln, is_utf8_pat, utf8_fold_flags) - && (!reginfo || regtry(reginfo, &s)) ) + && (reginfo->intuit || regtry(reginfo, &s)) ) { goto got_it; } @@ -1619,15 +1846,13 @@ S_find_byclass(pTHX_ regexp * prog, cons break; } case BOUNDL: - RXp_MATCH_TAINTED_on(prog); FBC_BOUND(isWORDCHAR_LC, - isWORDCHAR_LC_uvchr(UNI_TO_NATIVE(tmp)), + isWORDCHAR_LC_uvchr(tmp), isWORDCHAR_LC_utf8((U8*)s)); break; case NBOUNDL: - RXp_MATCH_TAINTED_on(prog); FBC_NBOUND(isWORDCHAR_LC, - isWORDCHAR_LC_uvchr(UNI_TO_NATIVE(tmp)), + isWORDCHAR_LC_uvchr(tmp), isWORDCHAR_LC_utf8((U8*)s)); break; case BOUND: @@ -1674,7 +1899,6 @@ S_find_byclass(pTHX_ regexp * prog, cons /* FALLTHROUGH */ case POSIXL: - RXp_MATCH_TAINTED_on(prog); REXEC_FBC_CSCAN(to_complement ^ cBOOL(isFOO_utf8_lc(FLAGS(c), (U8 *) s)), to_complement ^ cBOOL(isFOO_lc(FLAGS(c), *s))); break; @@ -1738,10 +1962,11 @@ S_find_byclass(pTHX_ regexp * prog, cons classnum))) || (UTF8_IS_DOWNGRADEABLE_START(*s) && to_complement ^ cBOOL( - _generic_isCC(TWO_BYTE_UTF8_TO_UNI(*s, *(s + 1)), + _generic_isCC(TWO_BYTE_UTF8_TO_NATIVE(*s, + *(s + 1)), classnum)))) { - if (tmp && (!reginfo || regtry(reginfo, &s))) + if (tmp && (reginfo->intuit || regtry(reginfo, &s))) goto got_it; else { tmp = doevery; @@ -1796,8 +2021,10 @@ S_find_byclass(pTHX_ regexp * prog, cons if (! PL_utf8_swash_ptrs[classnum]) { U8 flags = _CORE_SWASH_INIT_ACCEPT_INVLIST; PL_utf8_swash_ptrs[classnum] = - _core_swash_init("utf8", swash_property_names[classnum], - &PL_sv_undef, 1, 0, NULL, &flags); + _core_swash_init("utf8", + "", + &PL_sv_undef, 1, 0, + PL_XPosix_ptrs[classnum], &flags); } /* This is a copy of the loop above for swash classes, though using the @@ -2011,7 +2238,7 @@ S_find_byclass(pTHX_ regexp * prog, cons (UV)accepted_word, (IV)(s - real_start) ); }); - if (!reginfo || regtry(reginfo, &s)) { + if (reginfo->intuit || regtry(reginfo, &s)) { FREETMPS; LEAVE; goto got_it; @@ -2039,13 +2266,163 @@ S_find_byclass(pTHX_ regexp * prog, cons return s; } +/* set RX_SAVED_COPY, RX_SUBBEG etc. + * flags have same meanings as with regexec_flags() */ + +static void +S_reg_set_capture_string(pTHX_ REGEXP * const rx, + char *strbeg, + char *strend, + SV *sv, + U32 flags, + bool utf8_target) +{ + struct regexp *const prog = ReANY(rx); + + if (flags & REXEC_COPY_STR) { +#ifdef PERL_ANY_COW + if (SvCANCOW(sv)) { + if (DEBUG_C_TEST) { + PerlIO_printf(Perl_debug_log, + "Copy on write: regexp capture, type %d\n", + (int) SvTYPE(sv)); + } + /* Create a new COW SV to share the match string and store + * in saved_copy, unless the current COW SV in saved_copy + * is valid and suitable for our purpose */ + if (( prog->saved_copy + && SvIsCOW(prog->saved_copy) + && SvPOKp(prog->saved_copy) + && SvIsCOW(sv) + && SvPOKp(sv) + && SvPVX(sv) == SvPVX(prog->saved_copy))) + { + /* just reuse saved_copy SV */ + if (RXp_MATCH_COPIED(prog)) { + Safefree(prog->subbeg); + RXp_MATCH_COPIED_off(prog); + } + } + else { + /* create new COW SV to share string */ + RX_MATCH_COPY_FREE(rx); + prog->saved_copy = sv_setsv_cow(prog->saved_copy, sv); + } + prog->subbeg = (char *)SvPVX_const(prog->saved_copy); + assert (SvPOKp(prog->saved_copy)); + prog->sublen = strend - strbeg; + prog->suboffset = 0; + prog->subcoffset = 0; + } else +#endif + { + SSize_t min = 0; + SSize_t max = strend - strbeg; + SSize_t sublen; + + if ( (flags & REXEC_COPY_SKIP_POST) + && !(prog->extflags & RXf_PMf_KEEPCOPY) /* //p */ + && !(PL_sawampersand & SAWAMPERSAND_RIGHT) + ) { /* don't copy $' part of string */ + U32 n = 0; + max = -1; + /* calculate the right-most part of the string covered + * by a capture. Due to look-ahead, this may be to + * the right of $&, so we have to scan all captures */ + while (n <= prog->lastparen) { + if (prog->offs[n].end > max) + max = prog->offs[n].end; + n++; + } + if (max == -1) + max = (PL_sawampersand & SAWAMPERSAND_LEFT) + ? prog->offs[0].start + : 0; + assert(max >= 0 && max <= strend - strbeg); + } + + if ( (flags & REXEC_COPY_SKIP_PRE) + && !(prog->extflags & RXf_PMf_KEEPCOPY) /* //p */ + && !(PL_sawampersand & SAWAMPERSAND_LEFT) + ) { /* don't copy $` part of string */ + U32 n = 0; + min = max; + /* calculate the left-most part of the string covered + * by a capture. Due to look-behind, this may be to + * the left of $&, so we have to scan all captures */ + while (min && n <= prog->lastparen) { + if ( prog->offs[n].start != -1 + && prog->offs[n].start < min) + { + min = prog->offs[n].start; + } + n++; + } + if ((PL_sawampersand & SAWAMPERSAND_RIGHT) + && min > prog->offs[0].end + ) + min = prog->offs[0].end; + + } + + assert(min >= 0 && min <= max && min <= strend - strbeg); + sublen = max - min; + + if (RX_MATCH_COPIED(rx)) { + if (sublen > prog->sublen) + prog->subbeg = + (char*)saferealloc(prog->subbeg, sublen+1); + } + else + prog->subbeg = (char*)safemalloc(sublen+1); + Copy(strbeg + min, prog->subbeg, sublen, char); + prog->subbeg[sublen] = '\0'; + prog->suboffset = min; + prog->sublen = sublen; + RX_MATCH_COPIED_on(rx); + } + prog->subcoffset = prog->suboffset; + if (prog->suboffset && utf8_target) { + /* Convert byte offset to chars. + * XXX ideally should only compute this if @-/@+ + * has been seen, a la PL_sawampersand ??? */ + + /* If there's a direct correspondence between the + * string which we're matching and the original SV, + * then we can use the utf8 len cache associated with + * the SV. In particular, it means that under //g, + * sv_pos_b2u() will use the previously cached + * position to speed up working out the new length of + * subcoffset, rather than counting from the start of + * the string each time. This stops + * $x = "\x{100}" x 1E6; 1 while $x =~ /(.)/g; + * from going quadratic */ + if (SvPOKp(sv) && SvPVX(sv) == strbeg) + prog->subcoffset = sv_pos_b2u_flags(sv, prog->subcoffset, + SV_GMAGIC|SV_CONST_RETURN); + else + prog->subcoffset = utf8_length((U8*)strbeg, + (U8*)(strbeg+prog->suboffset)); + } + } + else { + RX_MATCH_COPY_FREE(rx); + prog->subbeg = strbeg; + prog->suboffset = 0; + prog->subcoffset = 0; + prog->sublen = strend - strbeg; + } +} + + + /* - regexec_flags - match a regexp against a string */ I32 Perl_regexec_flags(pTHX_ REGEXP * const rx, char *stringarg, char *strend, - char *strbeg, I32 minend, SV *sv, void *data, U32 flags) + char *strbeg, SSize_t minend, SV *sv, void *data, U32 flags) /* stringarg: the point in the string at which to begin matching */ /* strend: pointer to null at end of string */ /* strbeg: real beginning of string */ @@ -2053,54 +2430,154 @@ Perl_regexec_flags(pTHX_ REGEXP * const /* sv: SV being matched: only used for utf8 flag, pos() etc; string * itself is accessed via the pointers above */ /* data: May be used for some additional optimizations. - Currently its only used, with a U32 cast, for transmitting - the ganch offset when doing a /g match. This will change */ -/* nosave: For optimizations. */ + Currently unused. */ +/* flags: For optimizations. See REXEC_* in regexp.h */ { dVAR; struct regexp *const prog = ReANY(rx); char *s; regnode *c; - char *startpos = stringarg; - I32 minlen; /* must match at least this many chars */ - I32 dontbother = 0; /* how many characters not to try at end */ - I32 end_shift = 0; /* Same for the end. */ /* CC */ - I32 scream_pos = -1; /* Internal iterator of scream. */ - char *scream_olds = NULL; + char *startpos; + SSize_t minlen; /* must match at least this many chars */ + SSize_t dontbother = 0; /* how many characters not to try at end */ const bool utf8_target = cBOOL(DO_UTF8(sv)); I32 multiline; RXi_GET_DECL(prog,progi); - regmatch_info reginfo; /* create some info to pass to regtry etc */ + regmatch_info reginfo_buf; /* create some info to pass to regtry etc */ + regmatch_info *const reginfo = ®info_buf; regexp_paren_pair *swap = NULL; + I32 oldsave; GET_RE_DEBUG_FLAGS_DECL; - PERL_ARGS_ASSERT_REGEXEC_FLAGS; - PERL_UNUSED_ARG(data); + PERL_ARGS_ASSERT_REGEXEC_FLAGS; + PERL_UNUSED_ARG(data); + + /* Be paranoid... */ + if (prog == NULL || stringarg == NULL) { + Perl_croak(aTHX_ "NULL regexp parameter"); + return 0; + } + + DEBUG_EXECUTE_r( + debug_start_match(rx, utf8_target, stringarg, strend, + "Matching"); + ); + + startpos = stringarg; + + if (prog->intflags & PREGf_GPOS_SEEN) { + MAGIC *mg; + + /* set reginfo->ganch, the position where \G can match */ + + reginfo->ganch = + (flags & REXEC_IGNOREPOS) + ? stringarg /* use start pos rather than pos() */ + : (sv && (mg = mg_find_mglob(sv)) && mg->mg_len >= 0) + /* Defined pos(): */ + ? strbeg + MgBYTEPOS(mg, sv, strbeg, strend-strbeg) + : strbeg; /* pos() not defined; use start of string */ + + DEBUG_GPOS_r(PerlIO_printf(Perl_debug_log, + "GPOS ganch set to strbeg[%"IVdf"]\n", (IV)(reginfo->ganch - strbeg))); + + /* in the presence of \G, we may need to start looking earlier in + * the string than the suggested start point of stringarg: + * if prog->gofs is set, then that's a known, fixed minimum + * offset, such as + * /..\G/: gofs = 2 + * /ab|c\G/: gofs = 1 + * or if the minimum offset isn't known, then we have to go back + * to the start of the string, e.g. /w+\G/ + */ + + if (prog->intflags & PREGf_ANCH_GPOS) { + startpos = reginfo->ganch - prog->gofs; + if (startpos < + ((flags & REXEC_FAIL_ON_UNDERFLOW) ? stringarg : strbeg)) + { + DEBUG_r(PerlIO_printf(Perl_debug_log, + "fail: ganch-gofs before earliest possible start\n")); + return 0; + } + } + else if (prog->gofs) { + if (startpos - prog->gofs < strbeg) + startpos = strbeg; + else + startpos -= prog->gofs; + } + else if (prog->intflags & PREGf_GPOS_FLOAT) + startpos = strbeg; + } + + minlen = prog->minlen; + if ((startpos + minlen) > strend || startpos < strbeg) { + DEBUG_r(PerlIO_printf(Perl_debug_log, + "Regex match can't succeed, so not even tried\n")); + return 0; + } + + /* at the end of this function, we'll do a LEAVE_SCOPE(oldsave), + * which will call destuctors to reset PL_regmatch_state, free higher + * PL_regmatch_slabs, and clean up regmatch_info_aux and + * regmatch_info_aux_eval */ + + oldsave = PL_savestack_ix; + + s = startpos; - /* Be paranoid... */ - if (prog == NULL || startpos == NULL) { - Perl_croak(aTHX_ "NULL regexp parameter"); - return 0; + if ((prog->extflags & RXf_USE_INTUIT) + && !(flags & REXEC_CHECKED)) + { + s = re_intuit_start(rx, sv, strbeg, startpos, strend, + flags, NULL); + if (!s) + return 0; + + if (prog->extflags & RXf_CHECK_ALL) { + /* we can match based purely on the result of INTUIT. + * Set up captures etc just for $& and $-[0] + * (an intuit-only match wont have $1,$2,..) */ + assert(!prog->nparens); + + /* s/// doesn't like it if $& is earlier than where we asked it to + * start searching (which can happen on something like /.\G/) */ + if ( (flags & REXEC_FAIL_ON_UNDERFLOW) + && (s < stringarg)) + { + /* this should only be possible under \G */ + assert(prog->intflags & PREGf_GPOS_SEEN); + DEBUG_EXECUTE_r(PerlIO_printf(Perl_debug_log, + "matched, but failing for REXEC_FAIL_ON_UNDERFLOW\n")); + goto phooey; + } + + /* match via INTUIT shouldn't have any captures. + * Let @-, @+, $^N know */ + prog->lastparen = prog->lastcloseparen = 0; + RX_MATCH_UTF8_set(rx, utf8_target); + prog->offs[0].start = s - strbeg; + prog->offs[0].end = utf8_target + ? (char*)utf8_hop((U8*)s, prog->minlenret) - strbeg + : s - strbeg + prog->minlenret; + if ( !(flags & REXEC_NOT_FIRST) ) + S_reg_set_capture_string(aTHX_ rx, + strbeg, strend, + sv, flags, utf8_target); + + return 1; + } } multiline = prog->extflags & RXf_PMf_MULTILINE; - reginfo.prog = rx; /* Yes, sorry that this is confusing. */ - - RX_MATCH_UTF8_set(rx, utf8_target); - DEBUG_EXECUTE_r( - debug_start_match(rx, utf8_target, startpos, strend, - "Matching"); - ); - - minlen = prog->minlen; - if (strend - startpos < (minlen+(prog->check_offset_min<0?prog->check_offset_min:0))) { + if (strend - s < (minlen+(prog->check_offset_min<0?prog->check_offset_min:0))) { DEBUG_EXECUTE_r(PerlIO_printf(Perl_debug_log, "String too short [regexec_flags]...\n")); goto phooey; } - /* Check validity of program. */ if (UCHARAT(progi->program) != REG_MAGIC) { @@ -2108,60 +2585,84 @@ Perl_regexec_flags(pTHX_ REGEXP * const } RX_MATCH_TAINTED_off(rx); - PL_reg_state.re_state_eval_setup_done = FALSE; - PL_reg_maxiter = 0; - reginfo.is_utf8_pat = cBOOL(RX_UTF8(rx)); - reginfo.warned = FALSE; - /* Mark beginning of line for ^ and lookbehind. */ - reginfo.bol = startpos; /* XXX not used ??? */ - PL_bostr = strbeg; - reginfo.sv = sv; + reginfo->prog = rx; /* Yes, sorry that this is confusing. */ + reginfo->intuit = 0; + reginfo->is_utf8_target = cBOOL(utf8_target); + reginfo->is_utf8_pat = cBOOL(RX_UTF8(rx)); + reginfo->warned = FALSE; + reginfo->strbeg = strbeg; + reginfo->sv = sv; + reginfo->poscache_maxiter = 0; /* not yet started a countdown */ + reginfo->strend = strend; + /* see how far we have to get to not match where we matched before */ + reginfo->till = stringarg + minend; - /* Mark end of line for $ (and such) */ - PL_regeol = strend; + if (prog->extflags & RXf_EVAL_SEEN && SvPADTMP(sv)) { + /* SAVEFREESV, not sv_mortalcopy, as this SV must last until after + S_cleanup_regmatch_info_aux has executed (registered by + SAVEDESTRUCTOR_X below). S_cleanup_regmatch_info_aux modifies + magic belonging to this SV. + Not newSVsv, either, as it does not COW. + */ + assert(!IS_PADGV(sv)); + reginfo->sv = newSV(0); + SvSetSV_nosteal(reginfo->sv, sv); + SAVEFREESV(reginfo->sv); + } - /* see how far we have to get to not match where we matched before */ - reginfo.till = startpos+minend; + /* reserve next 2 or 3 slots in PL_regmatch_state: + * slot N+0: may currently be in use: skip it + * slot N+1: use for regmatch_info_aux struct + * slot N+2: use for regmatch_info_aux_eval struct if we have (?{})'s + * slot N+3: ready for use by regmatch() + */ - /* If there is a "must appear" string, look for it. */ - s = startpos; + { + regmatch_state *old_regmatch_state; + regmatch_slab *old_regmatch_slab; + int i, max = (prog->extflags & RXf_EVAL_SEEN) ? 2 : 1; - if (prog->extflags & RXf_GPOS_SEEN) { /* Need to set reginfo->ganch */ - MAGIC *mg; - if (flags & REXEC_IGNOREPOS){ /* Means: check only at start */ - reginfo.ganch = startpos + prog->gofs; - DEBUG_GPOS_r(PerlIO_printf(Perl_debug_log, - "GPOS IGNOREPOS: reginfo.ganch = startpos + %"UVxf"\n",(UV)prog->gofs)); - } else if (sv && SvTYPE(sv) >= SVt_PVMG - && SvMAGIC(sv) - && (mg = mg_find(sv, PERL_MAGIC_regex_global)) - && mg->mg_len >= 0) { - reginfo.ganch = strbeg + mg->mg_len; /* Defined pos() */ - DEBUG_GPOS_r(PerlIO_printf(Perl_debug_log, - "GPOS MAGIC: reginfo.ganch = strbeg + %"IVdf"\n",(IV)mg->mg_len)); - - if (prog->extflags & RXf_ANCH_GPOS) { - if (s > reginfo.ganch) - goto phooey; - s = reginfo.ganch - prog->gofs; - DEBUG_GPOS_r(PerlIO_printf(Perl_debug_log, - "GPOS ANCH_GPOS: s = ganch - %"UVxf"\n",(UV)prog->gofs)); - if (s < strbeg) - goto phooey; - } - } - else if (data) { - reginfo.ganch = strbeg + PTR2UV(data); - DEBUG_GPOS_r(PerlIO_printf(Perl_debug_log, - "GPOS DATA: reginfo.ganch= strbeg + %"UVxf"\n",PTR2UV(data))); - - } else { /* pos() not defined */ - reginfo.ganch = strbeg; - DEBUG_GPOS_r(PerlIO_printf(Perl_debug_log, - "GPOS: reginfo.ganch = strbeg\n")); - } + /* on first ever match, allocate first slab */ + if (!PL_regmatch_slab) { + Newx(PL_regmatch_slab, 1, regmatch_slab); + PL_regmatch_slab->prev = NULL; + PL_regmatch_slab->next = NULL; + PL_regmatch_state = SLAB_FIRST(PL_regmatch_slab); + } + + old_regmatch_state = PL_regmatch_state; + old_regmatch_slab = PL_regmatch_slab; + + for (i=0; i <= max; i++) { + if (i == 1) + reginfo->info_aux = &(PL_regmatch_state->u.info_aux); + else if (i ==2) + reginfo->info_aux_eval = + reginfo->info_aux->info_aux_eval = + &(PL_regmatch_state->u.info_aux_eval); + + if (++PL_regmatch_state > SLAB_LAST(PL_regmatch_slab)) + PL_regmatch_state = S_push_slab(aTHX); + } + + /* note initial PL_regmatch_state position; at end of match we'll + * pop back to there and free any higher slabs */ + + reginfo->info_aux->old_regmatch_state = old_regmatch_state; + reginfo->info_aux->old_regmatch_slab = old_regmatch_slab; + reginfo->info_aux->poscache = NULL; + + SAVEDESTRUCTOR_X(S_cleanup_regmatch_info_aux, reginfo->info_aux); + + if ((prog->extflags & RXf_EVAL_SEEN)) + S_setup_eval_state(aTHX_ reginfo); + else + reginfo->info_aux_eval = reginfo->info_aux->info_aux_eval = NULL; } + + /* If there is a "must appear" string, look for it. */ + if (PL_curpm && (PM_GETRE(PL_curpm) == rx)) { /* We have to be careful. If the previous successful match was from this regex we don't want a subsequent partially @@ -2180,27 +2681,13 @@ Perl_regexec_flags(pTHX_ REGEXP * const PTR2UV(prog->offs) )); } - if (!(flags & REXEC_CHECKED) && (prog->check_substr != NULL || prog->check_utf8 != NULL)) { - re_scream_pos_data d; - - d.scream_olds = &scream_olds; - d.scream_pos = &scream_pos; - s = re_intuit_start(rx, sv, s, strend, flags, &d); - if (!s) { - DEBUG_EXECUTE_r(PerlIO_printf(Perl_debug_log, "Not present...\n")); - goto phooey; /* not present */ - } - } - - /* Simplest case: anchored match need be tried only once. */ /* [unless only anchor is BOL and multiline is set] */ - if (prog->extflags & (RXf_ANCH & ~RXf_ANCH_GPOS)) { - if (s == startpos && regtry(®info, &startpos)) + if (prog->intflags & (PREGf_ANCH & ~PREGf_ANCH_GPOS)) { + if (s == startpos && regtry(reginfo, &s)) goto got_it; - else if (multiline || (prog->intflags & PREGf_IMPLICIT) - || (prog->extflags & RXf_ANCH_MBOL)) /* XXXX SBOL? */ + else if (multiline || (prog->intflags & (PREGf_IMPLICIT | PREGf_ANCH_MBOL))) /* XXXX SBOL? */ { char *end; @@ -2215,7 +2702,7 @@ Perl_regexec_flags(pTHX_ REGEXP * const if (s == startpos) goto after_try_utf8; while (1) { - if (regtry(®info, &s)) { + if (regtry(reginfo, &s)) { goto got_it; } after_try_utf8: @@ -2223,7 +2710,8 @@ Perl_regexec_flags(pTHX_ REGEXP * const goto phooey; } if (prog->extflags & RXf_USE_INTUIT) { - s = re_intuit_start(rx, sv, s + UTF8SKIP(s), strend, flags, NULL); + s = re_intuit_start(rx, sv, strbeg, + s + UTF8SKIP(s), strend, flags, NULL); if (!s) { goto phooey; } @@ -2238,7 +2726,7 @@ Perl_regexec_flags(pTHX_ REGEXP * const goto after_try_latin; } while (1) { - if (regtry(®info, &s)) { + if (regtry(reginfo, &s)) { goto got_it; } after_try_latin: @@ -2246,7 +2734,8 @@ Perl_regexec_flags(pTHX_ REGEXP * const goto phooey; } if (prog->extflags & RXf_USE_INTUIT) { - s = re_intuit_start(rx, sv, s + 1, strend, flags, NULL); + s = re_intuit_start(rx, sv, strbeg, + s + 1, strend, flags, NULL); if (!s) { goto phooey; } @@ -2265,21 +2754,22 @@ Perl_regexec_flags(pTHX_ REGEXP * const /* We can use a more efficient search as newlines are the same in unicode as they are in latin */ while (s <= end) { /* note it could be possible to match at the end of the string */ if (*s++ == '\n') { /* don't need PL_utf8skip here */ - if (regtry(®info, &s)) + if (regtry(reginfo, &s)) goto got_it; } } } /* end search for newline */ } /* end anchored/multiline check string search */ goto phooey; - } else if (RXf_GPOS_CHECK == (prog->extflags & RXf_GPOS_CHECK)) + } else if (prog->intflags & PREGf_ANCH_GPOS) { - /* the warning about reginfo.ganch being used without initialization - is bogus -- we set it above, when prog->extflags & RXf_GPOS_SEEN - and we only enter this block when the same bit is set. */ - char *tmp_s = reginfo.ganch - prog->gofs; - - if (tmp_s >= strbeg && regtry(®info, &tmp_s)) + /* PREGf_ANCH_GPOS should never be true if PREGf_GPOS_SEEN is not true */ + assert(prog->intflags & PREGf_GPOS_SEEN); + /* For anchored \G, the only position it can match from is + * (ganch-gofs); we already set startpos to this above; if intuit + * moved us on from there, we can't possibly succeed */ + assert(startpos == reginfo->ganch - prog->gofs); + if (s == startpos && regtry(reginfo, &s)) goto got_it; goto phooey; } @@ -2300,7 +2790,7 @@ Perl_regexec_flags(pTHX_ REGEXP * const REXEC_FBC_SCAN( if (*s == ch) { DEBUG_EXECUTE_r( did_match = 1 ); - if (regtry(®info, &s)) goto got_it; + if (regtry(reginfo, &s)) goto got_it; s += UTF8SKIP(s); while (s < strend && *s == ch) s += UTF8SKIP(s); @@ -2318,7 +2808,7 @@ Perl_regexec_flags(pTHX_ REGEXP * const REXEC_FBC_SCAN( if (*s == ch) { DEBUG_EXECUTE_r( did_match = 1 ); - if (regtry(®info, &s)) goto got_it; + if (regtry(reginfo, &s)) goto got_it; s++; while (s < strend && *s == ch) s++; @@ -2335,8 +2825,8 @@ Perl_regexec_flags(pTHX_ REGEXP * const || ((prog->float_substr != NULL || prog->float_utf8 != NULL) && prog->float_max_offset < strend - s)) { SV *must; - I32 back_max; - I32 back_min; + SSize_t back_max; + SSize_t back_min; char *last; char *last1; /* Last position checked before */ #ifdef DEBUGGING @@ -2381,21 +2871,20 @@ Perl_regexec_flags(pTHX_ REGEXP * const last = strend; } else { last = HOP3c(strend, /* Cannot start after this */ - -(I32)(CHR_SVLEN(must) + -(SSize_t)(CHR_SVLEN(must) - (SvTAIL(must) != 0) + back_min), strbeg); } - if (s > PL_bostr) + if (s > reginfo->strbeg) last1 = HOPc(s, -1); else last1 = s - 1; /* bogus */ /* XXXX check_substr already used to find "s", can optimize if check_substr==must. */ - scream_pos = -1; - dontbother = end_shift; + dontbother = 0; strend = HOPc(strend, -dontbother); while ( (s <= last) && - (s = fbm_instr((unsigned char*)HOP3(s, back_min, (back_min<0 ? strbeg : strend)), + (s = fbm_instr((unsigned char*)HOP4c(s, back_min, strbeg, strend), (unsigned char*)strend, must, multiline ? FBMrf_MULTILINE : 0)) ) { DEBUG_EXECUTE_r( did_match = 1 ); @@ -2404,14 +2893,15 @@ Perl_regexec_flags(pTHX_ REGEXP * const s = HOPc(s, -back_max); } else { - char * const t = (last1 >= PL_bostr) ? HOPc(last1, 1) : last1 + 1; + char * const t = (last1 >= reginfo->strbeg) + ? HOPc(last1, 1) : last1 + 1; last1 = HOPc(s, -back_min); s = t; } if (utf8_target) { while (s <= last1) { - if (regtry(®info, &s)) + if (regtry(reginfo, &s)) goto got_it; if (s >= last1) { s++; /* to break out of outer loop */ @@ -2422,7 +2912,7 @@ Perl_regexec_flags(pTHX_ REGEXP * const } else { while (s <= last1) { - if (regtry(®info, &s)) + if (regtry(reginfo, &s)) goto got_it; s++; } @@ -2447,7 +2937,7 @@ Perl_regexec_flags(pTHX_ REGEXP * const } DEBUG_EXECUTE_r({ SV * const prop = sv_newmortal(); - regprop(prog, prop, c); + regprop(prog, prop, c, reginfo); { RE_PV_QUOTED_DECL(quoted,utf8_target,PERL_DEBUG_PAD_ZERO(1), s,strend-s,60); @@ -2457,7 +2947,7 @@ Perl_regexec_flags(pTHX_ REGEXP * const quoted, (int)(strend - s)); } }); - if (find_byclass(prog, c, s, strend, ®info, reginfo.is_utf8_pat)) + if (find_byclass(prog, c, s, strend, reginfo)) goto got_it; DEBUG_EXECUTE_r(PerlIO_printf(Perl_debug_log, "Contradicts stclass... [regexec_flags]\n")); } @@ -2565,7 +3055,7 @@ Perl_regexec_flags(pTHX_ REGEXP * const /* We don't know much -- general case. */ if (utf8_target) { for (;;) { - if (regtry(®info, &s)) + if (regtry(reginfo, &s)) goto got_it; if (s >= strend) break; @@ -2574,7 +3064,7 @@ Perl_regexec_flags(pTHX_ REGEXP * const } else { do { - if (regtry(®info, &s)) + if (regtry(reginfo, &s)) goto got_it; } while (s++ < strend); } @@ -2584,6 +3074,18 @@ Perl_regexec_flags(pTHX_ REGEXP * const goto phooey; got_it: + /* s/// doesn't like it if $& is earlier than where we asked it to + * start searching (which can happen on something like /.\G/) */ + if ( (flags & REXEC_FAIL_ON_UNDERFLOW) + && (prog->offs[0].start < stringarg - strbeg)) + { + /* this should only be possible under \G */ + assert(prog->intflags & PREGf_GPOS_SEEN); + DEBUG_EXECUTE_r(PerlIO_printf(Perl_debug_log, + "matched, but failing for REXEC_FAIL_ON_UNDERFLOW\n")); + goto phooey; + } + DEBUG_BUFFERS_r( if (swap) PerlIO_printf(Perl_debug_log, @@ -2594,135 +3096,35 @@ got_it: ); Safefree(swap); - if (PL_reg_state.re_state_eval_setup_done) - restore_pos(aTHX_ prog); - if (RXp_PAREN_NAMES(prog)) - (void)hv_iterinit(RXp_PAREN_NAMES(prog)); + /* clean up; this will trigger destructors that will free all slabs + * above the current one, and cleanup the regmatch_info_aux + * and regmatch_info_aux_eval sructs */ - /* make sure $`, $&, $', and $digit will work later */ - if ( !(flags & REXEC_NOT_FIRST) ) { - if (flags & REXEC_COPY_STR) { -#ifdef PERL_ANY_COW - if (SvCANCOW(sv)) { - if (DEBUG_C_TEST) { - PerlIO_printf(Perl_debug_log, - "Copy on write: regexp capture, type %d\n", - (int) SvTYPE(sv)); - } - RX_MATCH_COPY_FREE(rx); - prog->saved_copy = sv_setsv_cow(prog->saved_copy, sv); - prog->subbeg = (char *)SvPVX_const(prog->saved_copy); - assert (SvPOKp(prog->saved_copy)); - prog->sublen = PL_regeol - strbeg; - prog->suboffset = 0; - prog->subcoffset = 0; - } else -#endif - { - I32 min = 0; - I32 max = PL_regeol - strbeg; - I32 sublen; - - if ( (flags & REXEC_COPY_SKIP_POST) - && !(RX_EXTFLAGS(rx) & RXf_PMf_KEEPCOPY) /* //p */ - && !(PL_sawampersand & SAWAMPERSAND_RIGHT) - ) { /* don't copy $' part of string */ - U32 n = 0; - max = -1; - /* calculate the right-most part of the string covered - * by a capture. Due to look-ahead, this may be to - * the right of $&, so we have to scan all captures */ - while (n <= prog->lastparen) { - if (prog->offs[n].end > max) - max = prog->offs[n].end; - n++; - } - if (max == -1) - max = (PL_sawampersand & SAWAMPERSAND_LEFT) - ? prog->offs[0].start - : 0; - assert(max >= 0 && max <= PL_regeol - strbeg); - } - - if ( (flags & REXEC_COPY_SKIP_PRE) - && !(RX_EXTFLAGS(rx) & RXf_PMf_KEEPCOPY) /* //p */ - && !(PL_sawampersand & SAWAMPERSAND_LEFT) - ) { /* don't copy $` part of string */ - U32 n = 0; - min = max; - /* calculate the left-most part of the string covered - * by a capture. Due to look-behind, this may be to - * the left of $&, so we have to scan all captures */ - while (min && n <= prog->lastparen) { - if ( prog->offs[n].start != -1 - && prog->offs[n].start < min) - { - min = prog->offs[n].start; - } - n++; - } - if ((PL_sawampersand & SAWAMPERSAND_RIGHT) - && min > prog->offs[0].end - ) - min = prog->offs[0].end; + LEAVE_SCOPE(oldsave); - } + if (RXp_PAREN_NAMES(prog)) + (void)hv_iterinit(RXp_PAREN_NAMES(prog)); - assert(min >= 0 && min <= max && min <= PL_regeol - strbeg); - sublen = max - min; + RX_MATCH_UTF8_set(rx, utf8_target); - if (RX_MATCH_COPIED(rx)) { - if (sublen > prog->sublen) - prog->subbeg = - (char*)saferealloc(prog->subbeg, sublen+1); - } - else - prog->subbeg = (char*)safemalloc(sublen+1); - Copy(strbeg + min, prog->subbeg, sublen, char); - prog->subbeg[sublen] = '\0'; - prog->suboffset = min; - prog->sublen = sublen; - RX_MATCH_COPIED_on(rx); - } - prog->subcoffset = prog->suboffset; - if (prog->suboffset && utf8_target) { - /* Convert byte offset to chars. - * XXX ideally should only compute this if @-/@+ - * has been seen, a la PL_sawampersand ??? */ - - /* If there's a direct correspondence between the - * string which we're matching and the original SV, - * then we can use the utf8 len cache associated with - * the SV. In particular, it means that under //g, - * sv_pos_b2u() will use the previously cached - * position to speed up working out the new length of - * subcoffset, rather than counting from the start of - * the string each time. This stops - * $x = "\x{100}" x 1E6; 1 while $x =~ /(.)/g; - * from going quadratic */ - if (SvPOKp(sv) && SvPVX(sv) == strbeg) - sv_pos_b2u(sv, &(prog->subcoffset)); - else - prog->subcoffset = utf8_length((U8*)strbeg, - (U8*)(strbeg+prog->suboffset)); - } - } - else { - RX_MATCH_COPY_FREE(rx); - prog->subbeg = strbeg; - prog->suboffset = 0; - prog->subcoffset = 0; - prog->sublen = PL_regeol - strbeg; /* strend may have been modified */ - } - } + /* make sure $`, $&, $', and $digit will work later */ + if ( !(flags & REXEC_NOT_FIRST) ) + S_reg_set_capture_string(aTHX_ rx, + strbeg, reginfo->strend, + sv, flags, utf8_target); return 1; phooey: DEBUG_EXECUTE_r(PerlIO_printf(Perl_debug_log, "%sMatch failed%s\n", PL_colors[4], PL_colors[5])); - if (PL_reg_state.re_state_eval_setup_done) - restore_pos(aTHX_ prog); + + /* clean up; this will trigger destructors that will free all slabs + * above the current one, and cleanup the regmatch_info_aux + * and regmatch_info_aux_eval sructs */ + + LEAVE_SCOPE(oldsave); + if (swap) { /* we failed :-( roll it back */ DEBUG_BUFFERS_r(PerlIO_printf(Perl_debug_log, @@ -2738,10 +3140,10 @@ phooey: } -/* Set which rex is pointed to by PL_reg_state, handling ref counting. +/* Set which rex is pointed to by PL_reg_curpm, handling ref counting. * Do inc before dec, in case old and new rex are the same */ -#define SET_reg_curpm(Re2) \ - if (PL_reg_state.re_state_eval_setup_done) { \ +#define SET_reg_curpm(Re2) \ + if (reginfo->info_aux_eval) { \ (void)ReREFCNT_inc(Re2); \ ReREFCNT_dec(PM_GETRE(PL_reg_curpm)); \ PM_SETRE((PL_reg_curpm), (Re2)); \ @@ -2758,7 +3160,7 @@ S_regtry(pTHX_ regmatch_info *reginfo, c CHECKPOINT lastcp; REGEXP *const rx = reginfo->prog; regexp *const prog = ReANY(rx); - I32 result; + SSize_t result; RXi_GET_DECL(prog,progi); GET_RE_DEBUG_FLAGS_DECL; @@ -2766,74 +3168,7 @@ S_regtry(pTHX_ regmatch_info *reginfo, c reginfo->cutpoint=NULL; - if ((prog->extflags & RXf_EVAL_SEEN) - && !PL_reg_state.re_state_eval_setup_done) - { - MAGIC *mg; - - PL_reg_state.re_state_eval_setup_done = TRUE; - if (reginfo->sv) { - /* Make $_ available to executed code. */ - if (reginfo->sv != DEFSV) { - SAVE_DEFSV; - DEFSV_set(reginfo->sv); - } - - if (!(SvTYPE(reginfo->sv) >= SVt_PVMG && SvMAGIC(reginfo->sv) - && (mg = mg_find(reginfo->sv, PERL_MAGIC_regex_global)))) { - /* prepare for quick setting of pos */ -#ifdef PERL_OLD_COPY_ON_WRITE - if (SvIsCOW(reginfo->sv)) - sv_force_normal_flags(reginfo->sv, 0); -#endif - mg = sv_magicext(reginfo->sv, NULL, PERL_MAGIC_regex_global, - &PL_vtbl_mglob, NULL, 0); - mg->mg_len = -1; - } - PL_reg_magic = mg; - PL_reg_oldpos = mg->mg_len; - SAVEDESTRUCTOR_X(restore_pos, prog); - } - if (!PL_reg_curpm) { - Newxz(PL_reg_curpm, 1, PMOP); -#ifdef USE_ITHREADS - { - SV* const repointer = &PL_sv_undef; - /* this regexp is also owned by the new PL_reg_curpm, which - will try to free it. */ - av_push(PL_regex_padav, repointer); - PL_reg_curpm->op_pmoffset = av_len(PL_regex_padav); - PL_regex_pad = AvARRAY(PL_regex_padav); - } -#endif - } - SET_reg_curpm(rx); - PL_reg_oldcurpm = PL_curpm; - PL_curpm = PL_reg_curpm; - if (RXp_MATCH_COPIED(prog)) { - /* Here is a serious problem: we cannot rewrite subbeg, - since it may be needed if this match fails. Thus - $` inside (?{}) could fail... */ - PL_reg_oldsaved = prog->subbeg; - PL_reg_oldsavedlen = prog->sublen; - PL_reg_oldsavedoffset = prog->suboffset; - PL_reg_oldsavedcoffset = prog->suboffset; -#ifdef PERL_ANY_COW - PL_nrs = prog->saved_copy; -#endif - RXp_MATCH_COPIED_off(prog); - } - else - PL_reg_oldsaved = NULL; - prog->subbeg = PL_bostr; - prog->suboffset = 0; - prog->subcoffset = 0; - prog->sublen = PL_regeol - PL_bostr; /* strend may have been modified */ - } -#ifdef DEBUGGING - PL_reg_starttry = *startposp; -#endif - prog->offs[0].start = *startposp - PL_bostr; + prog->offs[0].start = *startposp - reginfo->strbeg; prog->lastparen = 0; prog->lastcloseparen = 0; @@ -2882,7 +3217,7 @@ S_regtry(pTHX_ regmatch_info *reginfo, c "unreachable code" warnings, which are bogus, but distracting. */ #define CACHEsayNO \ if (ST.cache_mask) \ - PL_reg_poscache[ST.cache_offset] |= ST.cache_mask; \ + reginfo->info_aux->poscache[ST.cache_offset] |= ST.cache_mask; \ sayNO /* this is used to determine how far from the left messages like @@ -2897,9 +3232,6 @@ S_regtry(pTHX_ regmatch_info *reginfo, c #define CHRTEST_NOT_A_CP_1 -999 #define CHRTEST_NOT_A_CP_2 -998 -#define SLAB_FIRST(s) (&(s)->states[0]) -#define SLAB_LAST(s) (&(s)->states[PERL_REGMATCH_SLAB_SLOTS-1]) - /* grab a new slab and return the first slot in it */ STATIC regmatch_state * @@ -3075,11 +3407,11 @@ regmatch(), slabs allocated since entry #define DEBUG_STATE_pp(pp) \ DEBUG_STATE_r({ \ - DUMP_EXEC_POS(locinput, scan, utf8_target); \ + DUMP_EXEC_POS(locinput, scan, utf8_target); \ PerlIO_printf(Perl_debug_log, \ " %*s"pp" %s%s%s%s%s\n", \ depth*2, "", \ - PL_reg_name[st->resume_state], \ + PL_reg_name[st->resume_state], \ ((st==yes_state||st==mark_state) ? "[" : ""), \ ((st==yes_state) ? "Y" : ""), \ ((st==mark_state) ? "M" : ""), \ @@ -3215,26 +3547,9 @@ S_reg_check_named_buff_matched(pTHX_ con } -/* free all slabs above current one - called during LEAVE_SCOPE */ - -STATIC void -S_clear_backtrack_stack(pTHX_ void *p) -{ - regmatch_slab *s = PL_regmatch_slab->next; - PERL_UNUSED_ARG(p); - - if (!s) - return; - PL_regmatch_slab->next = NULL; - while (s) { - regmatch_slab * const osl = s; - s = s->next; - Safefree(osl); - } -} static bool S_setup_EXACTISH_ST_c1_c2(pTHX_ const regnode * const text_node, int *c1p, - U8* c1_utf8, int *c2p, U8* c2_utf8, bool is_utf8_pat) + U8* c1_utf8, int *c2p, U8* c2_utf8, regmatch_info *reginfo) { /* This function determines if there are one or two characters that match * the first character of the passed-in EXACTish node , and if @@ -3286,11 +3601,12 @@ S_setup_EXACTISH_ST_c1_c2(pTHX_ const re * point (unless inappropriately coerced to unsigned). * will equal * * if and only if and are the same. */ - const bool utf8_target = PL_reg_match_utf8; + const bool utf8_target = reginfo->is_utf8_target; UV c1 = CHRTEST_NOT_A_CP_1; UV c2 = CHRTEST_NOT_A_CP_2; bool use_chrtest_void = FALSE; + const bool is_utf8_pat = reginfo->is_utf8_pat; /* Used when we have both utf8 input and utf8 output, to avoid converting * to/from code points */ @@ -3299,6 +3615,7 @@ S_setup_EXACTISH_ST_c1_c2(pTHX_ const re dVAR; U8 *pat = (U8*)STRING(text_node); + U8 folded[UTF8_MAX_FOLD_CHAR_EXPAND * UTF8_MAXBYTES_CASE + 1] = { '\0' }; if (OP(text_node) == EXACT) { @@ -3318,136 +3635,193 @@ S_setup_EXACTISH_ST_c1_c2(pTHX_ const re c2 = c1 = valid_utf8_to_uvchr(pat, NULL); } } - else /* an EXACTFish node */ - if ((is_utf8_pat - && is_MULTI_CHAR_FOLD_utf8_safe(pat, - pat + STR_LEN(text_node))) - || (!is_utf8_pat - && is_MULTI_CHAR_FOLD_latin1_safe(pat, - pat + STR_LEN(text_node)))) - { - /* Multi-character folds require more context to sort out. Also - * PL_utf8_foldclosures used below doesn't handle them, so have to be - * handled outside this routine */ - use_chrtest_void = TRUE; - } - else { /* an EXACTFish node which doesn't begin with a multi-char fold */ - c1 = is_utf8_pat ? valid_utf8_to_uvchr(pat, NULL) : *pat; - if (c1 > 256) { - /* Load the folds hash, if not already done */ - SV** listp; - if (! PL_utf8_foldclosures) { - if (! PL_utf8_tofold) { - U8 dummy[UTF8_MAXBYTES+1]; - - /* Force loading this by folding an above-Latin1 char */ - to_utf8_fold((U8*) HYPHEN_UTF8, dummy, NULL); - assert(PL_utf8_tofold); /* Verify that worked */ - } - PL_utf8_foldclosures = _swash_inversion_hash(PL_utf8_tofold); - } - - /* The fold closures data structure is a hash with the keys being - * the UTF-8 of every character that is folded to, like 'k', and - * the values each an array of all code points that fold to its - * key. e.g. [ 'k', 'K', KELVIN_SIGN ]. Multi-character folds are - * not included */ - if ((! (listp = hv_fetch(PL_utf8_foldclosures, - (char *) pat, - UTF8SKIP(pat), - FALSE)))) - { - /* Not found in the hash, therefore there are no folds - * containing it, so there is only a single character that - * could match */ - c2 = c1; - } - else { /* Does participate in folds */ - AV* list = (AV*) *listp; - if (av_len(list) != 1) { + else { /* an EXACTFish node */ + U8 *pat_end = pat + STR_LEN(text_node); - /* If there aren't exactly two folds to this, it is outside - * the scope of this function */ - use_chrtest_void = TRUE; + /* An EXACTFL node has at least some characters unfolded, because what + * they match is not known until now. So, now is the time to fold + * the first few of them, as many as are needed to determine 'c1' and + * 'c2' later in the routine. If the pattern isn't UTF-8, we only need + * to fold if in a UTF-8 locale, and then only the Sharp S; everything + * else is 1-1 and isn't assumed to be folded. In a UTF-8 pattern, we + * need to fold as many characters as a single character can fold to, + * so that later we can check if the first ones are such a multi-char + * fold. But, in such a pattern only locale-problematic characters + * aren't folded, so we can skip this completely if the first character + * in the node isn't one of the tricky ones */ + if (OP(text_node) == EXACTFL) { + + if (! is_utf8_pat) { + if (IN_UTF8_CTYPE_LOCALE && *pat == LATIN_SMALL_LETTER_SHARP_S) + { + folded[0] = folded[1] = 's'; + pat = folded; + pat_end = folded + 2; } - else { /* There are two. Get them */ - SV** c_p = av_fetch(list, 0, FALSE); - if (c_p == NULL) { - Perl_croak(aTHX_ "panic: invalid PL_utf8_foldclosures structure"); - } - c1 = SvUV(*c_p); - - c_p = av_fetch(list, 1, FALSE); - if (c_p == NULL) { - Perl_croak(aTHX_ "panic: invalid PL_utf8_foldclosures structure"); - } - c2 = SvUV(*c_p); - - /* Folds that cross the 255/256 boundary are forbidden if - * EXACTFL, or EXACTFA and one is ASCIII. Since the - * pattern character is above 256, and its only other match - * is below 256, the only legal match will be to itself. - * We have thrown away the original, so have to compute - * which is the one above 255 */ - if ((c1 < 256) != (c2 < 256)) { - if (OP(text_node) == EXACTFL - || (OP(text_node) == EXACTFA - && (isASCII(c1) || isASCII(c2)))) - { - if (c1 < 256) { - c1 = c2; - } - else { - c2 = c1; - } - } + } + else if (is_PROBLEMATIC_LOCALE_FOLDEDS_START_utf8(pat)) { + U8 *s = pat; + U8 *d = folded; + int i; + + for (i = 0; i < UTF8_MAX_FOLD_CHAR_EXPAND && s < pat_end; i++) { + if (isASCII(*s)) { + *(d++) = (U8) toFOLD_LC(*s); + s++; + } + else { + STRLEN len; + _to_utf8_fold_flags(s, + d, + &len, + FOLD_FLAGS_FULL | FOLD_FLAGS_LOCALE); + d += len; + s += UTF8SKIP(s); } } + + pat = folded; + pat_end = d; } } - else /* Here, c1 is < 255 */ - if (utf8_target - && HAS_NONLATIN1_FOLD_CLOSURE(c1) - && OP(text_node) != EXACTFL - && (OP(text_node) != EXACTFA || ! isASCII(c1))) + + if ((is_utf8_pat && is_MULTI_CHAR_FOLD_utf8_safe(pat, pat_end)) + || (!is_utf8_pat && is_MULTI_CHAR_FOLD_latin1_safe(pat, pat_end))) { - /* Here, there could be something above Latin1 in the target which - * folds to this character in the pattern. All such cases except - * LATIN SMALL LETTER Y WITH DIAERESIS have more than two characters - * involved in their folds, so are outside the scope of this - * function */ - if (UNLIKELY(c1 == LATIN_SMALL_LETTER_Y_WITH_DIAERESIS)) { - c2 = LATIN_CAPITAL_LETTER_Y_WITH_DIAERESIS; + /* Multi-character folds require more context to sort out. Also + * PL_utf8_foldclosures used below doesn't handle them, so have to + * be handled outside this routine */ + use_chrtest_void = TRUE; + } + else { /* an EXACTFish node which doesn't begin with a multi-char fold */ + c1 = is_utf8_pat ? valid_utf8_to_uvchr(pat, NULL) : *pat; + if (c1 > 256) { + /* Load the folds hash, if not already done */ + SV** listp; + if (! PL_utf8_foldclosures) { + if (! PL_utf8_tofold) { + U8 dummy[UTF8_MAXBYTES_CASE+1]; + + /* Force loading this by folding an above-Latin1 char */ + to_utf8_fold((U8*) HYPHEN_UTF8, dummy, NULL); + assert(PL_utf8_tofold); /* Verify that worked */ + } + PL_utf8_foldclosures = _swash_inversion_hash(PL_utf8_tofold); + } + + /* The fold closures data structure is a hash with the keys + * being the UTF-8 of every character that is folded to, like + * 'k', and the values each an array of all code points that + * fold to its key. e.g. [ 'k', 'K', KELVIN_SIGN ]. + * Multi-character folds are not included */ + if ((! (listp = hv_fetch(PL_utf8_foldclosures, + (char *) pat, + UTF8SKIP(pat), + FALSE)))) + { + /* Not found in the hash, therefore there are no folds + * containing it, so there is only a single character that + * could match */ + c2 = c1; + } + else { /* Does participate in folds */ + AV* list = (AV*) *listp; + if (av_tindex(list) != 1) { + + /* If there aren't exactly two folds to this, it is + * outside the scope of this function */ + use_chrtest_void = TRUE; + } + else { /* There are two. Get them */ + SV** c_p = av_fetch(list, 0, FALSE); + if (c_p == NULL) { + Perl_croak(aTHX_ "panic: invalid PL_utf8_foldclosures structure"); + } + c1 = SvUV(*c_p); + + c_p = av_fetch(list, 1, FALSE); + if (c_p == NULL) { + Perl_croak(aTHX_ "panic: invalid PL_utf8_foldclosures structure"); + } + c2 = SvUV(*c_p); + + /* Folds that cross the 255/256 boundary are forbidden + * if EXACTFL (and isnt a UTF8 locale), or EXACTFA and + * one is ASCIII. Since the pattern character is above + * 256, and its only other match is below 256, the only + * legal match will be to itself. We have thrown away + * the original, so have to compute which is the one + * above 255 */ + if ((c1 < 256) != (c2 < 256)) { + if ((OP(text_node) == EXACTFL + && ! IN_UTF8_CTYPE_LOCALE) + || ((OP(text_node) == EXACTFA + || OP(text_node) == EXACTFA_NO_TRIE) + && (isASCII(c1) || isASCII(c2)))) + { + if (c1 < 256) { + c1 = c2; + } + else { + c2 = c1; + } + } + } + } + } } - else { - use_chrtest_void = TRUE; + else /* Here, c1 is < 255 */ + if (utf8_target + && HAS_NONLATIN1_FOLD_CLOSURE(c1) + && ( ! (OP(text_node) == EXACTFL && ! IN_UTF8_CTYPE_LOCALE)) + && ((OP(text_node) != EXACTFA + && OP(text_node) != EXACTFA_NO_TRIE) + || ! isASCII(c1))) + { + /* Here, there could be something above Latin1 in the target + * which folds to this character in the pattern. All such + * cases except LATIN SMALL LETTER Y WITH DIAERESIS have more + * than two characters involved in their folds, so are outside + * the scope of this function */ + if (UNLIKELY(c1 == LATIN_SMALL_LETTER_Y_WITH_DIAERESIS)) { + c2 = LATIN_CAPITAL_LETTER_Y_WITH_DIAERESIS; + } + else { + use_chrtest_void = TRUE; + } } - } - else { /* Here nothing above Latin1 can fold to the pattern character */ - switch (OP(text_node)) { + else { /* Here nothing above Latin1 can fold to the pattern + character */ + switch (OP(text_node)) { - case EXACTFL: /* /l rules */ - c2 = PL_fold_locale[c1]; - break; + case EXACTFL: /* /l rules */ + c2 = PL_fold_locale[c1]; + break; - case EXACTF: - if (! utf8_target) { /* /d rules */ - c2 = PL_fold[c1]; + case EXACTF: /* This node only generated for non-utf8 + patterns */ + assert(! is_utf8_pat); + if (! utf8_target) { /* /d rules */ + c2 = PL_fold[c1]; + break; + } + /* FALLTHROUGH */ + /* /u rules for all these. This happens to work for + * EXACTFA as nothing in Latin1 folds to ASCII */ + case EXACTFA_NO_TRIE: /* This node only generated for + non-utf8 patterns */ + assert(! is_utf8_pat); + /* FALL THROUGH */ + case EXACTFA: + case EXACTFU_SS: + case EXACTFU: + c2 = PL_fold_latin1[c1]; break; - } - /* FALLTHROUGH */ - /* /u rules for all these. This happens to work for - * EXACTFA as nothing in Latin1 folds to ASCII */ - case EXACTFA: - case EXACTFU_TRICKYFOLD: - case EXACTFU_SS: - case EXACTFU: - c2 = PL_fold_latin1[c1]; - break; - default: - Perl_croak(aTHX_ "panic: Unexpected op %u", OP(text_node)); - assert(0); /* NOTREACHED */ + default: + Perl_croak(aTHX_ "panic: Unexpected op %u", OP(text_node)); + assert(0); /* NOTREACHED */ + } } } } @@ -3489,26 +3863,25 @@ S_setup_EXACTISH_ST_c1_c2(pTHX_ const re } /* returns -1 on failure, $+[0] on success */ -STATIC I32 +STATIC SSize_t S_regmatch(pTHX_ regmatch_info *reginfo, char *startpos, regnode *prog) { #if PERL_VERSION < 9 && !defined(PERL_CORE) dMY_CXT; #endif dVAR; - const bool utf8_target = PL_reg_match_utf8; + const bool utf8_target = reginfo->is_utf8_target; const U32 uniflags = UTF8_ALLOW_DEFAULT; REGEXP *rex_sv = reginfo->prog; regexp *rex = ReANY(rex_sv); RXi_GET_DECL(rex,rexi); - I32 oldsave; /* the current state. This is a cached copy of PL_regmatch_state */ regmatch_state *st; /* cache heavy used fields of st in registers */ regnode *scan; regnode *next; U32 n = 0; /* general value; init to avoid compiler warning */ - I32 ln = 0; /* len or last; init to avoid compiler warning */ + SSize_t ln = 0; /* len or last; init to avoid compiler warning */ char *locinput = startpos; char *pushinput; /* where to continue after a PUSH */ I32 nextchr; /* is always set to UCHARAT(locinput) */ @@ -3536,7 +3909,7 @@ S_regmatch(pTHX_ regmatch_info *reginfo, during a successful match */ U32 lastopen = 0; /* last open we saw */ bool has_cutgroup = RX_HAS_CUTGROUP(rex) ? 1 : 0; - SV* const oreplsv = GvSV(PL_replgv); + SV* const oreplsv = GvSVn(PL_replgv); /* these three flags are set by various ops to signal information to * the very next op. They have a useful lifetime of exactly one loop * iteration, and are not preserved or restored by state pushes/pops @@ -3566,6 +3939,9 @@ S_regmatch(pTHX_ regmatch_info *reginfo, GET_RE_DEBUG_FLAGS_DECL; #endif + /* protect against undef(*^R) */ + SAVEFREESV(SvREFCNT_inc_simple_NN(oreplsv)); + /* shut up 'may be used uninitialized' compiler warnings for dMULTICALL */ multicall_oldcatch = 0; multicall_cv = NULL; @@ -3579,23 +3955,8 @@ S_regmatch(pTHX_ regmatch_info *reginfo, DEBUG_OPTIMISE_r( DEBUG_EXECUTE_r({ PerlIO_printf(Perl_debug_log,"regmatch start\n"); })); - /* on first ever call to regmatch, allocate first slab */ - if (!PL_regmatch_slab) { - Newx(PL_regmatch_slab, 1, regmatch_slab); - PL_regmatch_slab->prev = NULL; - PL_regmatch_slab->next = NULL; - PL_regmatch_state = SLAB_FIRST(PL_regmatch_slab); - } - oldsave = PL_savestack_ix; - SAVEDESTRUCTOR_X(S_clear_backtrack_stack, NULL); - SAVEVPTR(PL_regmatch_slab); - SAVEVPTR(PL_regmatch_state); - - /* grab next free state slot */ - st = ++PL_regmatch_state; - if (st > SLAB_LAST(PL_regmatch_slab)) - st = PL_regmatch_state = S_push_slab(aTHX); + st = PL_regmatch_state; /* Note that nextchr is a byte even in UTF */ SET_nextchr; @@ -3606,7 +3967,7 @@ S_regmatch(pTHX_ regmatch_info *reginfo, SV * const prop = sv_newmortal(); regnode *rnext=regnext(scan); DUMP_EXEC_POS( locinput, scan, utf8_target ); - regprop(rex, prop, scan); + regprop(rex, prop, scan, reginfo); PerlIO_printf(Perl_debug_log, "%3"IVdf":%*s%s(%"IVdf")\n", @@ -3628,27 +3989,20 @@ S_regmatch(pTHX_ regmatch_info *reginfo, assert(nextchr < 256 && (nextchr >= 0 || nextchr == NEXTCHR_EOS)); switch (state_num) { - case BOL: /* /^../ */ - if (locinput == PL_bostr) - { - /* reginfo->till = reginfo->bol; */ + case BOL: /* /^../ */ + case SBOL: /* /^../s */ + if (locinput == reginfo->strbeg) break; - } sayNO; case MBOL: /* /^../m */ - if (locinput == PL_bostr || + if (locinput == reginfo->strbeg || (!NEXTCHR_IS_EOS && locinput[-1] == '\n')) { break; } sayNO; - case SBOL: /* /^../s */ - if (locinput == PL_bostr) - break; - sayNO; - case GPOS: /* \G */ if (locinput == reginfo->ganch) break; @@ -3657,7 +4011,7 @@ S_regmatch(pTHX_ regmatch_info *reginfo, case KEEPS: /* \K */ /* update the startpoint */ st->u.keeper.val = rex->offs[0].start; - rex->offs[0].start = locinput - PL_bostr; + rex->offs[0].start = locinput - reginfo->strbeg; PUSH_STATE_GOTO(KEEPS_next, next, locinput); assert(0); /*NOTREACHED*/ case KEEPS_next_fail: @@ -3666,19 +4020,17 @@ S_regmatch(pTHX_ regmatch_info *reginfo, sayNO_SILENT; assert(0); /*NOTREACHED*/ - case EOL: /* /..$/ */ - goto seol; - case MEOL: /* /..$/m */ if (!NEXTCHR_IS_EOS && nextchr != '\n') sayNO; break; + case EOL: /* /..$/ */ + /* FALL THROUGH */ case SEOL: /* /..$/s */ - seol: if (!NEXTCHR_IS_EOS && nextchr != '\n') sayNO; - if (PL_regeol - locinput > 1) + if (reginfo->strend - locinput > 1) sayNO; break; @@ -3816,7 +4168,7 @@ S_regmatch(pTHX_ regmatch_info *reginfo, shortest accept state and the wordnum of the longest accept state */ - while ( state && uc <= (U8*)PL_regeol ) { + while ( state && uc <= (U8*)(reginfo->strend) ) { U32 base = trie->states[ state ].trans.base; UV uvc = 0; U16 charid = 0; @@ -3850,7 +4202,7 @@ S_regmatch(pTHX_ regmatch_info *reginfo, }); /* read a char and goto next state */ - if ( base && (foldlen || uc < (U8*)PL_regeol)) { + if ( base && (foldlen || uc < (U8*)(reginfo->strend))) { I32 offset; REXEC_TRIE_READ_CHAR(trie_type, trie, widecharmap, uc, uscan, len, uvc, charid, foldlen, @@ -3973,7 +4325,7 @@ S_regmatch(pTHX_ regmatch_info *reginfo, while (chars) { if (utf8_target) { - uvc = utf8n_to_uvuni((U8*)uc, UTF8_MAXLEN, &len, + uvc = utf8n_to_uvchr((U8*)uc, UTF8_MAXLEN, &len, uniflags); uc += len; } @@ -3986,7 +4338,7 @@ S_regmatch(pTHX_ regmatch_info *reginfo, while (foldlen) { if (!--chars) break; - uvc = utf8n_to_uvuni(uscan, UTF8_MAXLEN, &len, + uvc = utf8n_to_uvchr(uscan, UTF8_MAXLEN, &len, uniflags); uscan += len; foldlen -= len; @@ -4065,7 +4417,9 @@ S_regmatch(pTHX_ regmatch_info *reginfo, * is an invariant, but there are tests in the test suite * dealing with (??{...}) which violate this) */ while (s < e) { - if (l >= PL_regeol || UTF8_IS_ABOVE_LATIN1(* (U8*) l)) { + if (l >= reginfo->strend + || UTF8_IS_ABOVE_LATIN1(* (U8*) l)) + { sayNO; } if (UTF8_IS_INVARIANT(*(U8*)l)) { @@ -4075,7 +4429,8 @@ S_regmatch(pTHX_ regmatch_info *reginfo, l++; } else { - if (TWO_BYTE_UTF8_TO_UNI(*l, *(l+1)) != * (U8*) s) { + if (TWO_BYTE_UTF8_TO_NATIVE(*l, *(l+1)) != * (U8*) s) + { sayNO; } l += 2; @@ -4086,7 +4441,8 @@ S_regmatch(pTHX_ regmatch_info *reginfo, else { /* The target is not utf8, the pattern is utf8. */ while (s < e) { - if (l >= PL_regeol || UTF8_IS_ABOVE_LATIN1(* (U8*) s)) + if (l >= reginfo->strend + || UTF8_IS_ABOVE_LATIN1(* (U8*) s)) { sayNO; } @@ -4097,7 +4453,8 @@ S_regmatch(pTHX_ regmatch_info *reginfo, s++; } else { - if (TWO_BYTE_UTF8_TO_UNI(*s, *(s+1)) != * (U8*) l) { + if (TWO_BYTE_UTF8_TO_NATIVE(*s, *(s+1)) != * (U8*) l) + { sayNO; } s += 2; @@ -4110,7 +4467,7 @@ S_regmatch(pTHX_ regmatch_info *reginfo, else { /* The target and the pattern have the same utf8ness. */ /* Inline the first character, for speed. */ - if (PL_regeol - locinput < ln + if (reginfo->strend - locinput < ln || UCHARAT(s) != nextchr || (ln > 1 && memNE(s, locinput, ln))) { @@ -4127,27 +4484,31 @@ S_regmatch(pTHX_ regmatch_info *reginfo, const char * s; U32 fold_utf8_flags; - RX_MATCH_TAINTED_on(reginfo->prog); folder = foldEQ_locale; fold_array = PL_fold_locale; - fold_utf8_flags = FOLDEQ_UTF8_LOCALE; + fold_utf8_flags = FOLDEQ_LOCALE; goto do_exactf; case EXACTFU_SS: /* /\x{df}/iu */ - case EXACTFU_TRICKYFOLD: /* /\x{390}/iu */ case EXACTFU: /* /abc/iu */ folder = foldEQ_latin1; fold_array = PL_fold_latin1; fold_utf8_flags = is_utf8_pat ? FOLDEQ_S1_ALREADY_FOLDED : 0; goto do_exactf; + case EXACTFA_NO_TRIE: /* This node only generated for non-utf8 + patterns */ + assert(! is_utf8_pat); + /* FALL THROUGH */ case EXACTFA: /* /abc/iaa */ folder = foldEQ_latin1; fold_array = PL_fold_latin1; fold_utf8_flags = FOLDEQ_UTF8_NOMIX_ASCII; goto do_exactf; - case EXACTF: /* /abc/i */ + case EXACTF: /* /abc/i This node only generated for + non-utf8 patterns */ + assert(! is_utf8_pat); folder = foldEQ; fold_array = PL_fold; fold_utf8_flags = 0; @@ -4156,11 +4517,15 @@ S_regmatch(pTHX_ regmatch_info *reginfo, s = STRING(scan); ln = STR_LEN(scan); - if (utf8_target || is_utf8_pat || state_num == EXACTFU_SS) { + if (utf8_target + || is_utf8_pat + || state_num == EXACTFU_SS + || (state_num == EXACTFL && IN_UTF8_CTYPE_LOCALE)) + { /* Either target or the pattern are utf8, or has the issue where * the fold lengths may differ. */ const char * const l = locinput; - char *e = PL_regeol; + char *e = reginfo->strend; if (! foldEQ_utf8_flags(s, 0, ln, is_utf8_pat, l, &e, 0, utf8_target, fold_utf8_flags)) @@ -4178,7 +4543,7 @@ S_regmatch(pTHX_ regmatch_info *reginfo, { sayNO; } - if (PL_regeol - locinput < ln) + if (reginfo->strend - locinput < ln) sayNO; if (ln > 1 && ! folder(s, locinput, ln)) sayNO; @@ -4191,8 +4556,6 @@ S_regmatch(pTHX_ regmatch_info *reginfo, * have to set the FLAGS fields of these */ case BOUNDL: /* /\b/l */ case NBOUNDL: /* /\B/l */ - RX_MATCH_TAINTED_on(reginfo->prog); - /* FALL THROUGH */ case BOUND: /* /\b/ */ case BOUNDU: /* /\b/u */ case BOUNDA: /* /\b/a */ @@ -4204,12 +4567,14 @@ S_regmatch(pTHX_ regmatch_info *reginfo, && FLAGS(scan) != REGEX_ASCII_RESTRICTED_CHARSET && FLAGS(scan) != REGEX_ASCII_MORE_RESTRICTED_CHARSET) { - if (locinput == PL_bostr) + if (locinput == reginfo->strbeg) ln = '\n'; else { - const U8 * const r = reghop3((U8*)locinput, -1, (U8*)PL_bostr); + const U8 * const r = + reghop3((U8*)locinput, -1, (U8*)(reginfo->strbeg)); - ln = utf8n_to_uvchr(r, UTF8SKIP(r), 0, uniflags); + ln = utf8n_to_uvchr(r, (U8*) reginfo->strend - r, + 0, uniflags); } if (FLAGS(scan) != REGEX_LOCALE_CHARSET) { ln = isWORDCHAR_uni(ln); @@ -4222,7 +4587,7 @@ S_regmatch(pTHX_ regmatch_info *reginfo, } } else { - ln = isWORDCHAR_LC_uvchr(UNI_TO_NATIVE(ln)); + ln = isWORDCHAR_LC_uvchr(ln); n = NEXTCHR_IS_EOS ? 0 : isWORDCHAR_LC_utf8((U8*)locinput); } } @@ -4239,7 +4604,7 @@ S_regmatch(pTHX_ regmatch_info *reginfo, * byte is never mistakable for ASCII, and so the test * will say it is not a word character, which is the * correct answer. */ - ln = (locinput != PL_bostr) ? + ln = (locinput != reginfo->strbeg) ? UCHARAT(locinput - 1) : '\n'; switch (FLAGS(scan)) { case REGEX_UNICODE_CHARSET: @@ -4271,11 +4636,11 @@ S_regmatch(pTHX_ regmatch_info *reginfo, break; case ANYOF: /* /[abc]/ */ - case ANYOF_WARN_SUPER: if (NEXTCHR_IS_EOS) sayNO; if (utf8_target) { - if (!reginclass(rex, scan, (U8*)locinput, utf8_target)) + if (!reginclass(rex, scan, (U8*)locinput, (U8*)reginfo->strend, + utf8_target)) sayNO; locinput += UTF8SKIP(locinput); } @@ -4297,10 +4662,6 @@ S_regmatch(pTHX_ regmatch_info *reginfo, if (NEXTCHR_IS_EOS) sayNO; - /* The locale hasn't influenced the outcome before this, so defer - * tainting until now */ - RX_MATCH_TAINTED_on(reginfo->prog); - /* Use isFOO_lc() for characters within Latin1. (Note that * UTF8_IS_INVARIANT works even on non-UTF-8 strings, or else * wouldn't be invariant) */ @@ -4311,7 +4672,7 @@ S_regmatch(pTHX_ regmatch_info *reginfo, } else if (UTF8_IS_DOWNGRADEABLE_START(nextchr)) { if (! (to_complement ^ cBOOL(isFOO_lc(FLAGS(scan), - (U8) TWO_BYTE_UTF8_TO_UNI(nextchr, + (U8) TWO_BYTE_UTF8_TO_NATIVE(nextchr, *(locinput + 1)))))) { sayNO; @@ -4392,9 +4753,9 @@ S_regmatch(pTHX_ regmatch_info *reginfo, } else if (UTF8_IS_DOWNGRADEABLE_START(nextchr)) { if (! (to_complement - ^ cBOOL(_generic_isCC(TWO_BYTE_UTF8_TO_UNI(nextchr, + ^ cBOOL(_generic_isCC(TWO_BYTE_UTF8_TO_NATIVE(nextchr, *(locinput + 1)), - FLAGS(scan))))) + FLAGS(scan))))) { sayNO; } @@ -4410,8 +4771,9 @@ S_regmatch(pTHX_ regmatch_info *reginfo, U8 flags = _CORE_SWASH_INIT_ACCEPT_INVLIST; PL_utf8_swash_ptrs[classnum] = _core_swash_init("utf8", - swash_property_names[classnum], - &PL_sv_undef, 1, 0, NULL, &flags); + "", + &PL_sv_undef, 1, 0, + PL_XPosix_ptrs[classnum], &flags); } if (! (to_complement ^ cBOOL(swash_fetch(PL_utf8_swash_ptrs[classnum], @@ -4508,7 +4870,7 @@ S_regmatch(pTHX_ regmatch_info *reginfo, locinput++; /* Match the . or CR */ if (nextchr == '\r' /* And if it was CR, and the next is LF, match the LF */ - && locinput < PL_regeol + && locinput < reginfo->strend && UCHARAT(locinput) == '\n') { locinput++; @@ -4517,8 +4879,8 @@ S_regmatch(pTHX_ regmatch_info *reginfo, else { /* Utf8: See if is ( CR LF ); already know that locinput < - * PL_regeol, so locinput+1 is in bounds */ - if ( nextchr == '\r' && locinput+1 < PL_regeol + * reginfo->strend, so locinput+1 is in bounds */ + if ( nextchr == '\r' && locinput+1 < reginfo->strend && UCHARAT(locinput + 1) == '\n') { locinput += 2; @@ -4535,7 +4897,7 @@ S_regmatch(pTHX_ regmatch_info *reginfo, LOAD_UTF8_CHARCLASS_GCB(); /* Match (prepend)* */ - while (locinput < PL_regeol + while (locinput < reginfo->strend && (len = is_GCB_Prepend_utf8(locinput))) { previous_prepend = locinput; @@ -4546,7 +4908,7 @@ S_regmatch(pTHX_ regmatch_info *reginfo, * the next thing won't match, back off the last prepend we * matched, as it is guaranteed to match the begin */ if (previous_prepend - && (locinput >= PL_regeol + && (locinput >= reginfo->strend || (! swash_fetch(PL_utf8_X_regular_begin, (U8*)locinput, utf8_target) && ! is_GCB_SPECIAL_BEGIN_START_utf8(locinput))) @@ -4555,7 +4917,7 @@ S_regmatch(pTHX_ regmatch_info *reginfo, locinput = previous_prepend; } - /* Note that here we know PL_regeol > locinput, as we + /* Note that here we know reginfo->strend > locinput, as we * tested that upon input to this switch case, and if we * moved locinput forward, we tested the result just above * and it either passed, or we backed off so that it will @@ -4578,7 +4940,7 @@ S_regmatch(pTHX_ regmatch_info *reginfo, * RI+ */ if ((len = is_GCB_RI_utf8(locinput))) { locinput += len; - while (locinput < PL_regeol + while (locinput < reginfo->strend && (len = is_GCB_RI_utf8(locinput))) { locinput += len; @@ -4586,7 +4948,7 @@ S_regmatch(pTHX_ regmatch_info *reginfo, } else if ((len = is_GCB_T_utf8(locinput))) { /* Another possibility is T+ */ locinput += len; - while (locinput < PL_regeol + while (locinput < reginfo->strend && (len = is_GCB_T_utf8(locinput))) { locinput += len; @@ -4599,7 +4961,7 @@ S_regmatch(pTHX_ regmatch_info *reginfo, * L* (L | LVT T* | V * V* T* | LV V* T*) */ /* Match L* */ - while (locinput < PL_regeol + while (locinput < reginfo->strend && (len = is_GCB_L_utf8(locinput))) { locinput += len; @@ -4611,7 +4973,7 @@ S_regmatch(pTHX_ regmatch_info *reginfo, * equation, we have a complete hangul syllable. * Are done. */ - if (locinput < PL_regeol + if (locinput < reginfo->strend && is_GCB_LV_LVT_V_utf8(locinput)) { /* Otherwise keep going. Must be LV, LVT or V. @@ -4629,7 +4991,7 @@ S_regmatch(pTHX_ regmatch_info *reginfo, /* Must be V or LV. Take it, then match * V* */ locinput += UTF8SKIP(locinput); - while (locinput < PL_regeol + while (locinput < reginfo->strend && (len = is_GCB_V_utf8(locinput))) { locinput += len; @@ -4638,7 +5000,7 @@ S_regmatch(pTHX_ regmatch_info *reginfo, /* And any of LV, LVT, or V can be followed * by T* */ - while (locinput < PL_regeol + while (locinput < reginfo->strend && (len = is_GCB_T_utf8(locinput))) { locinput += len; @@ -4648,7 +5010,7 @@ S_regmatch(pTHX_ regmatch_info *reginfo, } /* Match any extender */ - while (locinput < PL_regeol + while (locinput < reginfo->strend && swash_fetch(PL_utf8_X_extend, (U8*)locinput, utf8_target)) { @@ -4656,7 +5018,7 @@ S_regmatch(pTHX_ regmatch_info *reginfo, } } exit_utf8: - if (locinput > PL_regeol) sayNO; + if (locinput > reginfo->strend) sayNO; } break; @@ -4667,17 +5029,16 @@ S_regmatch(pTHX_ regmatch_info *reginfo, op. */ /* don't initialize these in the declaration, it makes C++ unhappy */ - char *s; + const char *s; char type; re_fold_t folder; const U8 *fold_array; UV utf8_fold_flags; - RX_MATCH_TAINTED_on(reginfo->prog); folder = foldEQ_locale; fold_array = PL_fold_locale; type = REFFL; - utf8_fold_flags = FOLDEQ_UTF8_LOCALE; + utf8_fold_flags = FOLDEQ_LOCALE; goto do_nref; case NREFFA: /* /\g{name}/iaa */ @@ -4718,10 +5079,9 @@ S_regmatch(pTHX_ regmatch_info *reginfo, goto do_nref_ref_common; case REFFL: /* /\1/il */ - RX_MATCH_TAINTED_on(reginfo->prog); folder = foldEQ_locale; fold_array = PL_fold_locale; - utf8_fold_flags = FOLDEQ_UTF8_LOCALE; + utf8_fold_flags = FOLDEQ_LOCALE; goto do_ref; case REFFA: /* /\1/iaa */ @@ -4753,23 +5113,23 @@ S_regmatch(pTHX_ regmatch_info *reginfo, do_nref_ref_common: ln = rex->offs[n].start; - PL_reg_leftiter = PL_reg_maxiter; /* Void cache */ + reginfo->poscache_iter = reginfo->poscache_maxiter; /* Void cache */ if (rex->lastparen < n || ln == -1) sayNO; /* Do not match unless seen CLOSEn. */ if (ln == rex->offs[n].end) break; - s = PL_bostr + ln; + s = reginfo->strbeg + ln; if (type != REF /* REF can do byte comparison */ - && (utf8_target || type == REFFU)) - { /* XXX handle REFFL better */ - char * limit = PL_regeol; + && (utf8_target || type == REFFU || type == REFFL)) + { + char * limit = reginfo->strend; /* This call case insensitively compares the entire buffer * at s, with the current input starting at locinput, but - * not going off the end given by PL_regeol, and returns in - * upon success, how much of the current input was - * matched */ + * not going off the end given by reginfo->strend, and + * returns in upon success, how much of the + * current input was matched */ if (! foldEQ_utf8_flags(s, NULL, rex->offs[n].end - ln, utf8_target, locinput, &limit, 0, utf8_target, utf8_fold_flags)) { @@ -4786,7 +5146,7 @@ S_regmatch(pTHX_ regmatch_info *reginfo, UCHARAT(s) != fold_array[nextchr])) sayNO; ln = rex->offs[n].end - ln; - if (locinput + ln > PL_regeol) + if (locinput + ln > reginfo->strend) sayNO; if (ln > 1 && (type == REF ? memNE(s, locinput, ln) @@ -4836,7 +5196,14 @@ S_regmatch(pTHX_ regmatch_info *reginfo, startpoint = rei->program+1; ST.close_paren = 0; } + + /* Save all the positions seen so far. */ + ST.cp = regcppush(rex, 0, maxopenparen); + REGCP_SET(ST.lastcp); + + /* and then jump to the code we share with EVAL */ goto eval_recurse_doit; + assert(0); /* NOTREACHED */ case EVAL: /* /(?{A})B/ /(??{A})B/ and /(?(?{A})X|Y)B/ */ @@ -4854,30 +5221,12 @@ S_regmatch(pTHX_ regmatch_info *reginfo, OP * const oop = PL_op; COP * const ocurcop = PL_curcop; OP *nop; - char *saved_regeol = PL_regeol; - struct re_save_state saved_state; CV *newcv; /* save *all* paren positions */ regcppush(rex, 0, maxopenparen); REGCP_SET(runops_cp); - /* To not corrupt the existing regex state while executing the - * eval we would normally put it on the save stack, like with - * save_re_context. However, re-evals have a weird scoping so we - * can't just add ENTER/LEAVE here. With that, things like - * - * (?{$a=2})(a(?{local$a=$a+1}))*aak*c(?{$b=$a}) - * - * would break, as they expect the localisation to be unwound - * only when the re-engine backtracks through the bit that - * localised it. - * - * What we do instead is just saving the state in a local c - * variable. - */ - Copy(&PL_reg_state, &saved_state, 1, struct re_save_state); - if (!caller_cv) caller_cv = find_runcv(NULL); @@ -4964,7 +5313,11 @@ S_regmatch(pTHX_ regmatch_info *reginfo, DEBUG_STATE_r( PerlIO_printf(Perl_debug_log, " re EVAL PL_op=0x%"UVxf"\n", PTR2UV(nop)) ); - rex->offs[0].end = PL_reg_magic->mg_len = locinput - PL_bostr; + rex->offs[0].end = locinput - reginfo->strbeg; + if (reginfo->info_aux_eval->pos_magic) + MgBYTEPOS_set(reginfo->info_aux_eval->pos_magic, + reginfo->sv, reginfo->strbeg, + locinput - reginfo->strbeg); if (sv_yes_mark) { SV *sv_mrk = get_sv("REGMARK", 1); @@ -5002,20 +5355,22 @@ S_regmatch(pTHX_ regmatch_info *reginfo, else { /* /(??{}) */ /* if its overloaded, let the regex compiler handle * it; otherwise extract regex, or stringify */ + if (SvGMAGICAL(ret)) + ret = sv_mortalcopy(ret); if (!SvAMAGIC(ret)) { SV *sv = ret; if (SvROK(sv)) sv = SvRV(sv); if (SvTYPE(sv) == SVt_REGEXP) re_sv = (REGEXP*) sv; - else if (SvSMAGICAL(sv)) { - MAGIC *mg = mg_find(sv, PERL_MAGIC_qr); + else if (SvSMAGICAL(ret)) { + MAGIC *mg = mg_find(ret, PERL_MAGIC_qr); if (mg) re_sv = (REGEXP *) mg->mg_obj; } - /* force any magic, undef warnings here */ - if (!re_sv) { + /* force any undef warnings here */ + if (!re_sv && !SvPOK(ret) && !SvNIOK(ret)) { ret = sv_mortalcopy(ret); (void) SvPV_force_nolen(ret); } @@ -5023,16 +5378,14 @@ S_regmatch(pTHX_ regmatch_info *reginfo, } - Copy(&saved_state, &PL_reg_state, 1, struct re_save_state); - /* *** Note that at this point we don't restore * PL_comppad, (or pop the CxSUB) on the assumption it may * be used again soon. This is safe as long as nothing * in the regexp code uses the pad ! */ PL_op = oop; PL_curcop = ocurcop; - PL_regeol = saved_regeol; S_regcp_restore(aTHX_ rex, runops_cp, &maxopenparen); + PL_curpm = PL_reg_curpm; if (logical != 2) break; @@ -5071,17 +5424,13 @@ S_regmatch(pTHX_ regmatch_info *reginfo, pm_flags); if (!(SvFLAGS(ret) - & (SVs_TEMP | SVs_PADTMP | SVf_READONLY - | SVs_GMG))) { + & (SVs_TEMP | SVs_GMG | SVf_ROK)) + && (!SvPADTMP(ret) || SvREADONLY(ret))) { /* This isn't a first class regexp. Instead, it's caching a regexp onto an existing, Perl visible scalar. */ sv_magic(ret, MUTABLE_SV(re_sv), PERL_MAGIC_qr, 0, 0); } - /* safe to do now that any $1 etc has been - * interpolated into the new pattern string and - * compiled */ - S_regcp_restore(aTHX_ rex, runops_cp, &maxopenparen); } SAVEFREESV(re_sv); re = ReANY(re_sv); @@ -5091,31 +5440,38 @@ S_regmatch(pTHX_ regmatch_info *reginfo, re->sublen = rex->sublen; re->suboffset = rex->suboffset; re->subcoffset = rex->subcoffset; + re->lastparen = 0; + re->lastcloseparen = 0; rei = RXi_GET(re); DEBUG_EXECUTE_r( - debug_start_match(re_sv, utf8_target, locinput, PL_regeol, - "Matching embedded"); + debug_start_match(re_sv, utf8_target, locinput, + reginfo->strend, "Matching embedded"); ); startpoint = rei->program + 1; ST.close_paren = 0; /* only used for GOSUB */ + /* Save all the seen positions so far. */ + ST.cp = regcppush(rex, 0, maxopenparen); + REGCP_SET(ST.lastcp); + /* and set maxopenparen to 0, since we are starting a "fresh" match */ + maxopenparen = 0; + /* run the pattern returned from (??{...}) */ + + eval_recurse_doit: /* Share code with GOSUB below this line + * At this point we expect the stack context to be + * set up correctly */ + + /* invalidate the S-L poscache. We're now executing a + * different set of WHILEM ops (and their associated + * indexes) against the same string, so the bits in the + * cache are meaningless. Setting maxiter to zero forces + * the cache to be invalidated and zeroed before reuse. + * XXX This is too dramatic a measure. Ideally we should + * save the old cache and restore when running the outer + * pattern again */ + reginfo->poscache_maxiter = 0; - eval_recurse_doit: /* Share code with GOSUB below this line */ - /* run the pattern returned from (??{...}) */ - - /* Save *all* the positions. */ - ST.cp = regcppush(rex, 0, maxopenparen); - REGCP_SET(ST.lastcp); - - re->lastparen = 0; - re->lastcloseparen = 0; - - maxopenparen = 0; - - /* XXXX This is too dramatic a measure... */ - PL_reg_maxiter = 0; - - ST.saved_utf8_pat = is_utf8_pat; - is_utf8_pat = cBOOL(RX_UTF8(re_sv)); + /* the new regexp might have a different is_utf8_pat than we do */ + is_utf8_pat = reginfo->is_utf8_pat = cBOOL(RX_UTF8(re_sv)); ST.prev_rex = rex_sv; ST.prev_curlyx = cur_curlyx; @@ -5134,17 +5490,24 @@ S_regmatch(pTHX_ regmatch_info *reginfo, case EVAL_AB: /* cleanup after a successful (??{A})B */ /* note: this is called twice; first after popping B, then A */ - is_utf8_pat = ST.saved_utf8_pat; rex_sv = ST.prev_rex; + is_utf8_pat = reginfo->is_utf8_pat = cBOOL(RX_UTF8(rex_sv)); SET_reg_curpm(rex_sv); rex = ReANY(rex_sv); rexi = RXi_GET(rex); - regcpblow(ST.cp); + { + /* preserve $^R across LEAVE's. See Bug 121070. */ + SV *save_sv= GvSV(PL_replgv); + SvREFCNT_inc(save_sv); + regcpblow(ST.cp); /* LEAVE in disguise */ + sv_setsv(GvSV(PL_replgv), save_sv); + SvREFCNT_dec(save_sv); + } cur_eval = ST.prev_eval; cur_curlyx = ST.prev_curlyx; - /* XXXX This is too dramatic a measure... */ - PL_reg_maxiter = 0; + /* Invalidate cache. See "invalidate" comment above. */ + reginfo->poscache_maxiter = 0; if ( nochange_depth ) nochange_depth--; sayYES; @@ -5152,8 +5515,8 @@ S_regmatch(pTHX_ regmatch_info *reginfo, case EVAL_AB_fail: /* unsuccessfully ran A or B in (??{A})B */ /* note: this is called twice; first after popping B, then A */ - is_utf8_pat = ST.saved_utf8_pat; rex_sv = ST.prev_rex; + is_utf8_pat = reginfo->is_utf8_pat = cBOOL(RX_UTF8(rex_sv)); SET_reg_curpm(rex_sv); rex = ReANY(rex_sv); rexi = RXi_GET(rex); @@ -5162,8 +5525,8 @@ S_regmatch(pTHX_ regmatch_info *reginfo, regcppop(rex, &maxopenparen); cur_eval = ST.prev_eval; cur_curlyx = ST.prev_curlyx; - /* XXXX This is too dramatic a measure... */ - PL_reg_maxiter = 0; + /* Invalidate cache. See "invalidate" comment above. */ + reginfo->poscache_maxiter = 0; if ( nochange_depth ) nochange_depth--; sayNO_SILENT; @@ -5171,7 +5534,7 @@ S_regmatch(pTHX_ regmatch_info *reginfo, case OPEN: /* ( */ n = ARG(scan); /* which paren pair */ - rex->offs[n].start_tmp = locinput - PL_bostr; + rex->offs[n].start_tmp = locinput - reginfo->strbeg; if (n > maxopenparen) maxopenparen = n; DEBUG_BUFFERS_r(PerlIO_printf(Perl_debug_log, @@ -5188,7 +5551,7 @@ S_regmatch(pTHX_ regmatch_info *reginfo, /* XXX really need to log other places start/end are set too */ #define CLOSE_CAPTURE \ rex->offs[n].start = rex->offs[n].start_tmp; \ - rex->offs[n].end = locinput - PL_bostr; \ + rex->offs[n].end = locinput - reginfo->strbeg; \ DEBUG_BUFFERS_r(PerlIO_printf(Perl_debug_log, \ "rex=0x%"UVxf" offs=0x%"UVxf": \\%"UVuf": set %"IVdf"..%"IVdf"\n", \ PTR2UV(rex), \ @@ -5253,7 +5616,7 @@ S_regmatch(pTHX_ regmatch_info *reginfo, break; case IFTHEN: /* (?(cond)A|B) */ - PL_reg_leftiter = PL_reg_maxiter; /* Void cache */ + reginfo->poscache_iter = reginfo->poscache_maxiter; /* Void cache */ if (sw) next = NEXTOPER(NEXTOPER(scan)); else { @@ -5441,33 +5804,66 @@ NULL goto do_whilem_B_max; } - /* super-linear cache processing */ + /* super-linear cache processing. + * + * The idea here is that for certain types of CURLYX/WHILEM - + * principally those whose upper bound is infinity (and + * excluding regexes that have things like \1 and other very + * non-regular expresssiony things), then if a pattern like + * /....A*.../ fails and we backtrack to the WHILEM, then we + * make a note that this particular WHILEM op was at string + * position 47 (say) when the rest of pattern failed. Then, if + * we ever find ourselves back at that WHILEM, and at string + * position 47 again, we can just fail immediately rather than + * running the rest of the pattern again. + * + * This is very handy when patterns start to go + * 'super-linear', like in (a+)*(a+)*(a+)*, where you end up + * with a combinatorial explosion of backtracking. + * + * The cache is implemented as a bit array, with one bit per + * string byte position per WHILEM op (up to 16) - so its + * between 0.25 and 2x the string size. + * + * To avoid allocating a poscache buffer every time, we do an + * initially countdown; only after we have executed a WHILEM + * op (string-length x #WHILEMs) times do we allocate the + * cache. + * + * The top 4 bits of scan->flags byte say how many different + * relevant CURLLYX/WHILEM op pairs there are, while the + * bottom 4-bits is the identifying index number of this + * WHILEM. + */ if (scan->flags) { - if (!PL_reg_maxiter) { + if (!reginfo->poscache_maxiter) { /* start the countdown: Postpone detection until we * know the match is not *that* much linear. */ - PL_reg_maxiter = (PL_regeol - PL_bostr + 1) * (scan->flags>>4); + reginfo->poscache_maxiter + = (reginfo->strend - reginfo->strbeg + 1) + * (scan->flags>>4); /* possible overflow for long strings and many CURLYX's */ - if (PL_reg_maxiter < 0) - PL_reg_maxiter = I32_MAX; - PL_reg_leftiter = PL_reg_maxiter; + if (reginfo->poscache_maxiter < 0) + reginfo->poscache_maxiter = I32_MAX; + reginfo->poscache_iter = reginfo->poscache_maxiter; } - if (PL_reg_leftiter-- == 0) { + if (reginfo->poscache_iter-- == 0) { /* initialise cache */ - const I32 size = (PL_reg_maxiter + 7)/8; - if (PL_reg_poscache) { - if ((I32)PL_reg_poscache_size < size) { - Renew(PL_reg_poscache, size, char); - PL_reg_poscache_size = size; + const SSize_t size = (reginfo->poscache_maxiter + 7)/8; + regmatch_info_aux *const aux = reginfo->info_aux; + if (aux->poscache) { + if ((SSize_t)reginfo->poscache_size < size) { + Renew(aux->poscache, size, char); + reginfo->poscache_size = size; } - Zero(PL_reg_poscache, size, char); + Zero(aux->poscache, size, char); } else { - PL_reg_poscache_size = size; - Newxz(PL_reg_poscache, size, char); + reginfo->poscache_size = size; + Newxz(aux->poscache, size, char); } DEBUG_EXECUTE_r( PerlIO_printf(Perl_debug_log, "%swhilem: Detected a super-linear match, switching on caching%s...\n", @@ -5475,14 +5871,17 @@ NULL ); } - if (PL_reg_leftiter < 0) { + if (reginfo->poscache_iter < 0) { /* have we already failed at this position? */ - I32 offset, mask; + SSize_t offset, mask; + + reginfo->poscache_iter = -1; /* stop eventual underflow */ offset = (scan->flags & 0xf) - 1 - + (locinput - PL_bostr) * (scan->flags>>4); + + (locinput - reginfo->strbeg) + * (scan->flags>>4); mask = 1 << (offset % 8); offset /= 8; - if (PL_reg_poscache[offset] & mask) { + if (reginfo->info_aux->poscache[offset] & mask) { DEBUG_EXECUTE_r( PerlIO_printf(Perl_debug_log, "%*s whilem: (cache) already tried at this position...\n", REPORT_CODE_OFF+depth*2, "") @@ -5717,7 +6116,7 @@ NULL ST.count++; /* after first match, determine A's length: u.curlym.alen */ if (ST.count == 1) { - if (PL_reg_match_utf8) { + if (reginfo->is_utf8_target) { char *s = st->locinput; while (s < locinput) { ST.alen++; @@ -5777,7 +6176,7 @@ NULL if (PL_regkind[OP(text_node)] == EXACT) { if (! S_setup_EXACTISH_ST_c1_c2(aTHX_ text_node, &ST.c1, ST.c1_utf8, &ST.c2, ST.c2_utf8, - is_utf8_pat)) + reginfo)) { sayNO; } @@ -5799,7 +6198,7 @@ NULL /* simulate B failing */ DEBUG_OPTIMISE_r( PerlIO_printf(Perl_debug_log, - "%*s CURLYM Fast bail next target=U+%"UVXf" c1=U+%"UVXf" c2=U+%"UVXf"\n", + "%*s CURLYM Fast bail next target=0x%"UVXf" c1=0x%"UVXf" c2=0x%"UVXf"\n", (int)(REPORT_CODE_OFF+(depth*2)),"", valid_utf8_to_uvchr((U8 *) locinput, NULL), valid_utf8_to_uvchr(ST.c1_utf8, NULL), @@ -5813,7 +6212,7 @@ NULL /* simulate B failing */ DEBUG_OPTIMISE_r( PerlIO_printf(Perl_debug_log, - "%*s CURLYM Fast bail next target=U+%X c1=U+%X c2=U+%X\n", + "%*s CURLYM Fast bail next target=0x%X c1=0x%X c2=0x%X\n", (int)(REPORT_CODE_OFF+(depth*2)),"", (int) nextchr, ST.c1, ST.c2) ); @@ -5827,8 +6226,8 @@ NULL I32 paren = ST.me->flags; if (ST.count) { rex->offs[paren].start - = HOPc(locinput, -ST.alen) - PL_bostr; - rex->offs[paren].end = locinput - PL_bostr; + = HOPc(locinput, -ST.alen) - reginfo->strbeg; + rex->offs[paren].end = locinput - reginfo->strbeg; if ((U32)paren > rex->lastparen) rex->lastparen = paren; rex->lastcloseparen = paren; @@ -5870,8 +6269,8 @@ NULL #define CURLY_SETPAREN(paren, success) \ if (paren) { \ if (success) { \ - rex->offs[paren].start = HOPc(locinput, -1) - PL_bostr; \ - rex->offs[paren].end = locinput - PL_bostr; \ + rex->offs[paren].start = HOPc(locinput, -1) - reginfo->strbeg; \ + rex->offs[paren].end = locinput - reginfo->strbeg; \ if (paren > rex->lastparen) \ rex->lastparen = paren; \ rex->lastcloseparen = paren; \ @@ -5954,7 +6353,7 @@ NULL friends need to change. */ if (! S_setup_EXACTISH_ST_c1_c2(aTHX_ text_node, &ST.c1, ST.c1_utf8, &ST.c2, ST.c2_utf8, - is_utf8_pat)) + reginfo)) { sayNO; } @@ -5968,7 +6367,7 @@ NULL char *li = locinput; minmod = 0; if (ST.min && - regrepeat(rex, &li, ST.A, ST.min, depth, is_utf8_pat) + regrepeat(rex, &li, ST.A, reginfo, ST.min, depth) < ST.min) sayNO; SET_locinput(li); @@ -5982,7 +6381,7 @@ NULL /* set ST.maxpos to the furthest point along the * string that could possibly match */ if (ST.max == REG_INFTY) { - ST.maxpos = PL_regeol - 1; + ST.maxpos = reginfo->strend - 1; if (utf8_target) while (UTF8_IS_CONTINUATION(*(U8*)ST.maxpos)) ST.maxpos--; @@ -5990,13 +6389,13 @@ NULL else if (utf8_target) { int m = ST.max - ST.min; for (ST.maxpos = locinput; - m >0 && ST.maxpos < PL_regeol; m--) + m >0 && ST.maxpos < reginfo->strend; m--) ST.maxpos += UTF8SKIP(ST.maxpos); } else { ST.maxpos = locinput + ST.max - ST.min; - if (ST.maxpos >= PL_regeol) - ST.maxpos = PL_regeol - 1; + if (ST.maxpos >= reginfo->strend) + ST.maxpos = reginfo->strend - 1; } goto curly_try_B_min_known; @@ -6005,8 +6404,7 @@ NULL /* avoid taking address of locinput, so it can remain * a register var */ char *li = locinput; - ST.count = regrepeat(rex, &li, ST.A, ST.max, depth, - is_utf8_pat); + ST.count = regrepeat(rex, &li, ST.A, reginfo, ST.max, depth); if (ST.count < ST.min) sayNO; SET_locinput(li); @@ -6090,7 +6488,7 @@ NULL * locinput matches */ char *li = ST.oldloc; ST.count += n; - if (regrepeat(rex, &li, ST.A, n, depth, is_utf8_pat) < n) + if (regrepeat(rex, &li, ST.A, reginfo, n, depth) < n) sayNO; assert(n == REG_INFTY || locinput == li); } @@ -6114,7 +6512,7 @@ NULL /* failed -- move forward one */ { char *li = locinput; - if (!regrepeat(rex, &li, ST.A, 1, depth, is_utf8_pat)) { + if (!regrepeat(rex, &li, ST.A, reginfo, 1, depth)) { sayNO; } locinput = li; @@ -6144,7 +6542,7 @@ NULL goto fake_end; } { - bool could_match = locinput < PL_regeol; + bool could_match = locinput < reginfo->strend; /* If it could work, try it. */ if (ST.c1 != CHRTEST_VOID && could_match) { @@ -6189,14 +6587,13 @@ NULL fake_end: if (cur_eval) { /* we've just finished A in /(??{A})B/; now continue with B */ - st->u.eval.saved_utf8_pat = is_utf8_pat; - is_utf8_pat = cur_eval->u.eval.saved_utf8_pat; st->u.eval.prev_rex = rex_sv; /* inner */ /* Save *all* the positions. */ st->u.eval.cp = regcppush(rex, 0, maxopenparen); rex_sv = cur_eval->u.eval.prev_rex; + is_utf8_pat = reginfo->is_utf8_pat = cBOOL(RX_UTF8(rex_sv)); SET_reg_curpm(rex_sv); rex = ReANY(rex_sv); rexi = RXi_GET(rex); @@ -6225,8 +6622,8 @@ NULL DEBUG_EXECUTE_r(PerlIO_printf(Perl_debug_log, "%sMatch possible, but length=%ld is smaller than requested=%ld, failing!%s\n", PL_colors[4], - (long)(locinput - PL_reg_starttry), - (long)(reginfo->till - PL_reg_starttry), + (long)(locinput - startpos), + (long)(reginfo->till - startpos), PL_colors[5])); sayNO_SILENT; /* Cannot match: too short. */ @@ -6318,7 +6715,7 @@ NULL break; case COMMIT: /* (*COMMIT) */ - reginfo->cutpoint = PL_regeol; + reginfo->cutpoint = reginfo->strend; /* FALLTHROUGH */ case PRUNE: /* (*PRUNE) */ @@ -6418,7 +6815,7 @@ NULL #undef ST case LNBREAK: /* \R */ - if ((n=is_LNBREAK_safe(locinput, PL_regeol, utf8_target))) { + if ((n=is_LNBREAK_safe(locinput, reginfo->strend, utf8_target))) { locinput += n; } else sayNO; @@ -6436,7 +6833,7 @@ NULL if (utf8_target) { locinput += PL_utf8skip[nextchr]; /* locinput is allowed to go 1 char off the end, but not 2+ */ - if (locinput > PL_regeol) + if (locinput > reginfo->strend) sayNO; } else @@ -6548,12 +6945,16 @@ yes: DEBUG_EXECUTE_r(PerlIO_printf(Perl_debug_log, "%sMatch successful!%s\n", PL_colors[4], PL_colors[5])); - if (PL_reg_state.re_state_eval_setup_done) { + if (reginfo->info_aux_eval) { /* each successfully executed (?{...}) block does the equivalent of * local $^R = do {...} * When popping the save stack, all these locals would be undone; * bypass this by setting the outermost saved $^R to the latest * value */ + /* I dont know if this is needed or works properly now. + * see code related to PL_replgv elsewhere in this file. + * Yves + */ if (oreplsv != GvSV(PL_replgv)) sv_setsv(oreplsv, GvSV(PL_replgv)); } @@ -6620,11 +7021,8 @@ no_silent: PERL_UNUSED_VAR(SP); } - /* clean up; in particular, free all slabs above current one */ - LEAVE_SCOPE(oldsave); - - assert(!result || locinput - PL_bostr >= 0); - return result ? locinput - PL_bostr : -1; + assert(!result || locinput - reginfo->strbeg >= 0); + return result ? locinput - reginfo->strbeg : -1; } /* @@ -6637,19 +7035,20 @@ no_silent: * to point to the byte following the highest successful * match. * p - the regnode to be repeatedly matched against. + * reginfo - struct holding match state, such as strend * max - maximum number of things to match. * depth - (for debugging) backtracking depth. */ STATIC I32 S_regrepeat(pTHX_ regexp *prog, char **startposp, const regnode *p, - I32 max, int depth, bool is_utf8_pat) + regmatch_info *const reginfo, I32 max, int depth) { dVAR; char *scan; /* Pointer to current position in target string */ I32 c; - char *loceol = PL_regeol; /* local version */ + char *loceol = reginfo->strend; /* local version */ I32 hardcount = 0; /* How many matches so far */ - bool utf8_target = PL_reg_match_utf8; + bool utf8_target = reginfo->is_utf8_target; int to_complement = 0; /* Invert the result? */ UV utf8_flags; _char_class_number classnum; @@ -6721,7 +7120,7 @@ S_regrepeat(pTHX_ regexp *prog, char **s } break; case EXACT: - assert(STR_LEN(p) == is_utf8_pat ? UTF8SKIP(STRING(p)) : 1); + assert(STR_LEN(p) == reginfo->is_utf8_pat ? UTF8SKIP(STRING(p)) : 1); c = (U8)*STRING(p); @@ -6729,7 +7128,7 @@ S_regrepeat(pTHX_ regexp *prog, char **s * under UTF-8, or both target and pattern aren't UTF-8. Note that we * can use UTF8_IS_INVARIANT() even if the pattern isn't UTF-8, as it's * true iff it doesn't matter if the argument is in UTF-8 or not */ - if (UTF8_IS_INVARIANT(c) || (! utf8_target && ! is_utf8_pat)) { + if (UTF8_IS_INVARIANT(c) || (! utf8_target && ! reginfo->is_utf8_pat)) { if (utf8_target && loceol - scan > max) { /* We didn't adjust because is UTF-8, but ok to do so, * since here, to match at all, 1 char == 1 byte */ @@ -6739,7 +7138,7 @@ S_regrepeat(pTHX_ regexp *prog, char **s scan++; } } - else if (is_utf8_pat) { + else if (reginfo->is_utf8_pat) { if (utf8_target) { STRLEN scan_char_len; @@ -6758,7 +7157,7 @@ S_regrepeat(pTHX_ regexp *prog, char **s /* Target isn't utf8; convert the character in the UTF-8 * pattern to non-UTF8, and do a simple loop */ - c = TWO_BYTE_UTF8_TO_UNI(c, *(STRING(p) + 1)); + c = TWO_BYTE_UTF8_TO_NATIVE(c, *(STRING(p) + 1)); while (scan < loceol && UCHARAT(scan) == c) { scan++; } @@ -6785,44 +7184,46 @@ S_regrepeat(pTHX_ regexp *prog, char **s } break; + case EXACTFA_NO_TRIE: /* This node only generated for non-utf8 patterns */ + assert(! reginfo->is_utf8_pat); + /* FALL THROUGH */ case EXACTFA: - utf8_flags = FOLDEQ_UTF8_NOMIX_ASCII; + utf8_flags = FOLDEQ_UTF8_NOMIX_ASCII; goto do_exactf; case EXACTFL: - RXp_MATCH_TAINTED_on(prog); - utf8_flags = FOLDEQ_UTF8_LOCALE; + utf8_flags = FOLDEQ_LOCALE; goto do_exactf; - case EXACTF: - utf8_flags = 0; - goto do_exactf; + case EXACTF: /* This node only generated for non-utf8 patterns */ + assert(! reginfo->is_utf8_pat); + utf8_flags = 0; + goto do_exactf; case EXACTFU_SS: - case EXACTFU_TRICKYFOLD: case EXACTFU: - utf8_flags = is_utf8_pat ? FOLDEQ_S2_ALREADY_FOLDED : 0; + utf8_flags = reginfo->is_utf8_pat ? FOLDEQ_S2_ALREADY_FOLDED : 0; do_exactf: { int c1, c2; U8 c1_utf8[UTF8_MAXBYTES+1], c2_utf8[UTF8_MAXBYTES+1]; - assert(STR_LEN(p) == is_utf8_pat ? UTF8SKIP(STRING(p)) : 1); + assert(STR_LEN(p) == reginfo->is_utf8_pat ? UTF8SKIP(STRING(p)) : 1); if (S_setup_EXACTISH_ST_c1_c2(aTHX_ p, &c1, c1_utf8, &c2, c2_utf8, - is_utf8_pat)) + reginfo)) { if (c1 == CHRTEST_VOID) { /* Use full Unicode fold matching */ - char *tmpeol = PL_regeol; - STRLEN pat_len = is_utf8_pat ? UTF8SKIP(STRING(p)) : 1; + char *tmpeol = reginfo->strend; + STRLEN pat_len = reginfo->is_utf8_pat ? UTF8SKIP(STRING(p)) : 1; while (hardcount < max && foldEQ_utf8_flags(scan, &tmpeol, 0, utf8_target, STRING(p), NULL, pat_len, - is_utf8_pat, utf8_flags)) + reginfo->is_utf8_pat, utf8_flags)) { scan = tmpeol; - tmpeol = PL_regeol; + tmpeol = reginfo->strend; hardcount++; } } @@ -6863,11 +7264,10 @@ S_regrepeat(pTHX_ regexp *prog, char **s break; } case ANYOF: - case ANYOF_WARN_SUPER: if (utf8_target) { while (hardcount < max && scan < loceol - && reginclass(prog, p, (U8*)scan, utf8_target)) + && reginclass(prog, p, (U8*)scan, (U8*) loceol, utf8_target)) { scan += UTF8SKIP(scan); hardcount++; @@ -6885,7 +7285,6 @@ S_regrepeat(pTHX_ regexp *prog, char **s /* FALLTHROUGH */ case POSIXL: - RXp_MATCH_TAINTED_on(prog); if (! utf8_target) { while (scan < loceol && to_complement ^ cBOOL(isFOO_lc(FLAGS(p), *scan))) @@ -6985,8 +7384,8 @@ S_regrepeat(pTHX_ regexp *prog, char **s } else if (UTF8_IS_DOWNGRADEABLE_START(*scan)) { if (! (to_complement - ^ cBOOL(_generic_isCC(TWO_BYTE_UTF8_TO_UNI(*scan, - *(scan + 1)), + ^ cBOOL(_generic_isCC(TWO_BYTE_UTF8_TO_NATIVE(*scan, + *(scan + 1)), classnum)))) { break; @@ -7068,8 +7467,10 @@ S_regrepeat(pTHX_ regexp *prog, char **s if (! PL_utf8_swash_ptrs[classnum]) { U8 flags = _CORE_SWASH_INIT_ACCEPT_INVLIST; PL_utf8_swash_ptrs[classnum] = _core_swash_init( - "utf8", swash_property_names[classnum], - &PL_sv_undef, 1, 0, NULL, &flags); + "utf8", + "", + &PL_sv_undef, 1, 0, + PL_XPosix_ptrs[classnum], &flags); } while (hardcount < max && scan < loceol @@ -7096,7 +7497,7 @@ S_regrepeat(pTHX_ regexp *prog, char **s /* LNBREAK can match one or two latin chars, which is ok, but we * have to use hardcount in this situation, and throw away the * adjustment to done before the switch statement */ - loceol = PL_regeol; + loceol = reginfo->strend; while (scan < loceol && (c=is_LNBREAK_latin1_safe(scan, loceol))) { scan+=c; hardcount++; @@ -7137,7 +7538,7 @@ S_regrepeat(pTHX_ regexp *prog, char **s GET_RE_DEBUG_FLAGS_DECL; DEBUG_EXECUTE_r({ SV * const prop = sv_newmortal(); - regprop(prog, prop, p); + regprop(prog, prop, p, reginfo); PerlIO_printf(Perl_debug_log, "%*s %s can match %"IVdf" times out of %"IVdf"...\n", REPORT_CODE_OFF + depth*2, "", SvPVX_const(prop),(IV)c,(IV)max); @@ -7163,31 +7564,39 @@ Perl_regclass_swash(pTHX_ const regexp * *altsvp = NULL; } - return newSVsv(core_regclass_swash(prog, node, doinit, listsvp)); + return newSVsv(_get_regclass_nonbitmap_data(prog, node, doinit, listsvp, NULL)); } -#endif -STATIC SV * -S_core_regclass_swash(pTHX_ const regexp *prog, const regnode* node, bool doinit, SV** listsvp) +SV * +Perl__get_regclass_nonbitmap_data(pTHX_ const regexp *prog, + const regnode* node, + bool doinit, + SV** listsvp, + SV** only_utf8_locale_ptr) { - /* Returns the swash for the input 'node' in the regex 'prog'. - * If is true, will attempt to create the swash if not already + /* For internal core use only. + * Returns the swash for the input 'node' in the regex 'prog'. + * If is 'true', will attempt to create the swash if not already * done. - * If is non-null, will return the swash initialization string in - * it. + * If is non-null, will return the printable contents of the + * swash. This can be used to get debugging information even before the + * swash exists, by calling this function with 'doinit' set to false, in + * which case the components that will be used to eventually create the + * swash are returned (in a printable form). * Tied intimately to how regcomp.c sets up the data structure */ dVAR; SV *sw = NULL; - SV *si = NULL; + SV *si = NULL; /* Input swash initialization string */ SV* invlist = NULL; RXi_GET_DECL(prog,progi); const struct reg_data * const data = prog ? progi->data : NULL; - PERL_ARGS_ASSERT_CORE_REGCLASS_SWASH; + PERL_ARGS_ASSERT__GET_REGCLASS_NONBITMAP_DATA; - assert(ANYOF_NONBITMAP(node)); + assert(ANYOF_FLAGS(node) + & (ANYOF_UTF8|ANYOF_NONBITMAP_NON_UTF8|ANYOF_LOC_FOLD)); if (data && data->count) { const U32 n = ARG(node); @@ -7200,25 +7609,38 @@ S_core_regclass_swash(pTHX_ const regexp si = *ary; /* ary[0] = the string to initialize the swash with */ - /* Elements 2 and 3 are either both present or both absent. [2] is - * any inversion list generated at compile time; [3] indicates if + /* Elements 3 and 4 are either both present or both absent. [3] is + * any inversion list generated at compile time; [4] indicates if * that inversion list has any user-defined properties in it. */ - if (av_len(av) >= 2) { - invlist = ary[2]; - if (SvUV(ary[3])) { - swash_init_flags |= _CORE_SWASH_INIT_USER_DEFINED_PROPERTY; + if (av_tindex(av) >= 2) { + if (only_utf8_locale_ptr + && ary[2] + && ary[2] != &PL_sv_undef) + { + *only_utf8_locale_ptr = ary[2]; + } + else { + *only_utf8_locale_ptr = NULL; + } + + if (av_tindex(av) >= 3) { + invlist = ary[3]; + if (SvUV(ary[4])) { + swash_init_flags |= _CORE_SWASH_INIT_USER_DEFINED_PROPERTY; + } + } + else { + invlist = NULL; } - } - else { - invlist = NULL; } /* Element [1] is reserved for the set-up swash. If already there, * return it; if not, create it and store it there */ - if (SvROK(ary[1])) { + if (ary[1] && SvROK(ary[1])) { sw = ary[1]; } - else if (si && doinit) { + else if (doinit && ((si && si != &PL_sv_undef) + || (invlist && invlist != &PL_sv_undef))) { sw = _core_swash_init("utf8", /* the utf8 package */ "", /* nameless */ @@ -7232,16 +7654,18 @@ S_core_regclass_swash(pTHX_ const regexp } } + /* If requested, return a printable version of what this swash matches */ if (listsvp) { SV* matches_string = newSVpvn("", 0); - /* Use the swash, if any, which has to have incorporated into it all - * possibilities */ + /* The swash should be used, if possible, to get the data, as it + * contains the resolved data. But this function can be called at + * compile-time, before everything gets resolved, in which case we + * return the currently best available information, which is the string + * that will eventually be used to do that resolving, 'si' */ if ((! sw || (invlist = _get_swash_invlist(sw)) == NULL) && (si && si != &PL_sv_undef)) { - - /* If no swash, use the input initialization string, if available */ sv_catsv(matches_string, si); } @@ -7255,12 +7679,14 @@ S_core_regclass_swash(pTHX_ const regexp return sw; } +#endif /* !defined(PERL_IN_XSUB_RE) || defined(PLUGGABLE_RE_EXTENSION) */ /* - reginclass - determine if a character falls into a character class n is the ANYOF regnode p is the target string + p_end points to one byte beyond the end of the target string utf8_target tells whether p is in UTF-8. Returns true if matched; false otherwise. @@ -7272,7 +7698,7 @@ S_core_regclass_swash(pTHX_ const regexp */ STATIC bool -S_reginclass(pTHX_ regexp * const prog, const regnode * const n, const U8* const p, const bool utf8_target) +S_reginclass(pTHX_ regexp * const prog, const regnode * const n, const U8* const p, const U8* const p_end, const bool utf8_target) { dVAR; const char flags = ANYOF_FLAGS(n); @@ -7285,7 +7711,7 @@ S_reginclass(pTHX_ regexp * const prog, * UTF8_IS_INVARIANT() works even if not in UTF-8 */ if (! UTF8_IS_INVARIANT(c) && utf8_target) { STRLEN c_len = 0; - c = utf8n_to_uvchr(p, UTF8_MAXBYTES, &c_len, + c = utf8n_to_uvchr(p, p_end - p, &c_len, (UTF8_ALLOW_DEFAULT & UTF8_ALLOW_ANYUV) | UTF8_ALLOW_FFFF | UTF8_CHECK_ONLY); /* see [perl #37836] for UTF8_ALLOW_ANYUV; [perl #38293] for @@ -7298,21 +7724,19 @@ S_reginclass(pTHX_ regexp * const prog, if (c < 256) { if (ANYOF_BITMAP_TEST(n, c)) match = TRUE; - else if (flags & ANYOF_NON_UTF8_LATIN1_ALL + else if (flags & ANYOF_NON_UTF8_NON_ASCII_ALL && ! utf8_target && ! isASCII(c)) { match = TRUE; } - else if (flags & ANYOF_LOCALE) { - RXp_MATCH_TAINTED_on(prog); - - if ((flags & ANYOF_LOC_FOLD) - && ANYOF_BITMAP_TEST(n, PL_fold_locale[c])) - { - match = TRUE; - } - else if (ANYOF_CLASS_TEST_ANY_SET(n)) { + else if (flags & ANYOF_LOCALE_FLAGS) { + if (flags & ANYOF_LOC_FOLD) { + if (ANYOF_BITMAP_TEST(n, PL_fold_locale[c])) { + match = TRUE; + } + } + if (! match && ANYOF_POSIXL_TEST_ANY_SET(n)) { /* The data structure is arranged so bits 0, 2, 4, ... are set * if the class includes the Posix character class given by @@ -7346,8 +7770,9 @@ S_reginclass(pTHX_ regexp * const prog, int count = 0; int to_complement = 0; + while (count < ANYOF_MAX) { - if (ANYOF_CLASS_TEST(n, count) + if (ANYOF_POSIXL_TEST(n, count) && to_complement ^ cBOOL(isFOO_lc(count/2, (U8) c))) { match = TRUE; @@ -7360,27 +7785,22 @@ S_reginclass(pTHX_ regexp * const prog, } } + /* If the bitmap didn't (or couldn't) match, and something outside the - * bitmap could match, try that. Locale nodes specify completely the - * behavior of code points in the bit map (otherwise, a utf8 target would - * cause them to be treated as Unicode and not locale), except in - * the very unlikely event when this node is a synthetic start class, which - * could be a combination of locale and non-locale nodes. So allow locale - * to match for the synthetic start class, which will give a false - * positive that will be resolved when the match is done again as not part - * of the synthetic start class */ + * bitmap could match, try that. */ if (!match) { - if (utf8_target && (flags & ANYOF_UNICODE_ALL) && c >= 256) { + if (c >= 256 && (flags & ANYOF_ABOVE_LATIN1_ALL)) { match = TRUE; /* Everything above 255 matches */ } - else if (ANYOF_NONBITMAP(n) - && ((flags & ANYOF_NONBITMAP_NON_UTF8) - || (utf8_target - && (c >=256 - || (! (flags & ANYOF_LOCALE)) - || OP(n) == ANYOF_SYNTHETIC)))) - { - SV * const sw = core_regclass_swash(prog, n, TRUE, 0); + else if ((flags & ANYOF_NONBITMAP_NON_UTF8) + || (utf8_target && (flags & ANYOF_UTF8)) + || ((flags & ANYOF_LOC_FOLD) + && IN_UTF8_CTYPE_LOCALE + && ARG(n) != ANYOF_NONBITMAP_EMPTY)) + { + SV* only_utf8_locale = NULL; + SV * const sw = _get_regclass_nonbitmap_data(prog, n, TRUE, 0, + &only_utf8_locale); if (sw) { U8 * utf8_p; if (utf8_target) { @@ -7397,23 +7817,32 @@ S_reginclass(pTHX_ regexp * const prog, /* If we allocated a string above, free it */ if (! utf8_target) Safefree(utf8_p); } + if (! match && only_utf8_locale && IN_UTF8_CTYPE_LOCALE) { + match = _invlist_contains_cp(only_utf8_locale, c); + } } if (UNICODE_IS_SUPER(c) - && OP(n) == ANYOF_WARN_SUPER + && (flags & ANYOF_WARN_SUPER) && ckWARN_d(WARN_NON_UNICODE)) { Perl_warner(aTHX_ packWARN(WARN_NON_UNICODE), - "Code point 0x%04"UVXf" is not Unicode, all \\p{} matches fail; all \\P{} matches succeed", c); + "Matched non-Unicode code point 0x%04"UVXf" against Unicode property; may not be portable", c); } } +#if ANYOF_INVERT != 1 + /* Depending on compiler optimization cBOOL takes time, so if don't have to + * use it, don't */ +# error ANYOF_INVERT needs to be set to 1, or guarded with cBOOL below, +#endif + /* The xor complements the return if to invert: 1^1 = 0, 1^0 = 1 */ - return cBOOL(flags & ANYOF_INVERT) ^ match; + return (flags & ANYOF_INVERT) ^ match; } STATIC U8 * -S_reghop3(U8 *s, I32 off, const U8* lim) +S_reghop3(U8 *s, SSize_t off, const U8* lim) { /* return the position 'off' UTF-8 characters away from 's', forward if * 'off' >= 0, backwards if negative. But don't go outside of position @@ -7442,13 +7871,8 @@ S_reghop3(U8 *s, I32 off, const U8* lim) return s; } -#ifdef XXX_dmq -/* there are a bunch of places where we use two reghop3's that should - be replaced with this routine. but since thats not done yet - we ifdef it out - dmq -*/ STATIC U8 * -S_reghop4(U8 *s, I32 off, const U8* llim, const U8* rlim) +S_reghop4(U8 *s, SSize_t off, const U8* llim, const U8* rlim) { dVAR; @@ -7472,10 +7896,12 @@ S_reghop4(U8 *s, I32 off, const U8* llim } return s; } -#endif + +/* like reghop3, but returns NULL on overrun, rather than returning last + * char pos */ STATIC U8 * -S_reghopmaybe3(U8* s, I32 off, const U8* lim) +S_reghopmaybe3(U8* s, SSize_t off, const U8* lim) { dVAR; @@ -7504,27 +7930,148 @@ S_reghopmaybe3(U8* s, I32 off, const U8* return s; } + +/* when executing a regex that may have (?{}), extra stuff needs setting + up that will be visible to the called code, even before the current + match has finished. In particular: + + * $_ is localised to the SV currently being matched; + * pos($_) is created if necessary, ready to be updated on each call-out + to code; + * a fake PMOP is created that can be set to PL_curpm (normally PL_curpm + isn't set until the current pattern is successfully finished), so that + $1 etc of the match-so-far can be seen; + * save the old values of subbeg etc of the current regex, and set then + to the current string (again, this is normally only done at the end + of execution) +*/ + +static void +S_setup_eval_state(pTHX_ regmatch_info *const reginfo) +{ + MAGIC *mg; + regexp *const rex = ReANY(reginfo->prog); + regmatch_info_aux_eval *eval_state = reginfo->info_aux_eval; + + eval_state->rex = rex; + + if (reginfo->sv) { + /* Make $_ available to executed code. */ + if (reginfo->sv != DEFSV) { + SAVE_DEFSV; + DEFSV_set(reginfo->sv); + } + + if (!(mg = mg_find_mglob(reginfo->sv))) { + /* prepare for quick setting of pos */ + mg = sv_magicext_mglob(reginfo->sv); + mg->mg_len = -1; + } + eval_state->pos_magic = mg; + eval_state->pos = mg->mg_len; + eval_state->pos_flags = mg->mg_flags; + } + else + eval_state->pos_magic = NULL; + + if (!PL_reg_curpm) { + /* PL_reg_curpm is a fake PMOP that we can attach the current + * regex to and point PL_curpm at, so that $1 et al are visible + * within a /(?{})/. It's just allocated once per interpreter the + * first time its needed */ + Newxz(PL_reg_curpm, 1, PMOP); +#ifdef USE_ITHREADS + { + SV* const repointer = &PL_sv_undef; + /* this regexp is also owned by the new PL_reg_curpm, which + will try to free it. */ + av_push(PL_regex_padav, repointer); + PL_reg_curpm->op_pmoffset = av_tindex(PL_regex_padav); + PL_regex_pad = AvARRAY(PL_regex_padav); + } +#endif + } + SET_reg_curpm(reginfo->prog); + eval_state->curpm = PL_curpm; + PL_curpm = PL_reg_curpm; + if (RXp_MATCH_COPIED(rex)) { + /* Here is a serious problem: we cannot rewrite subbeg, + since it may be needed if this match fails. Thus + $` inside (?{}) could fail... */ + eval_state->subbeg = rex->subbeg; + eval_state->sublen = rex->sublen; + eval_state->suboffset = rex->suboffset; + eval_state->subcoffset = rex->subcoffset; +#ifdef PERL_ANY_COW + eval_state->saved_copy = rex->saved_copy; +#endif + RXp_MATCH_COPIED_off(rex); + } + else + eval_state->subbeg = NULL; + rex->subbeg = (char *)reginfo->strbeg; + rex->suboffset = 0; + rex->subcoffset = 0; + rex->sublen = reginfo->strend - reginfo->strbeg; +} + + +/* destructor to clear up regmatch_info_aux and regmatch_info_aux_eval */ + static void -restore_pos(pTHX_ void *arg) +S_cleanup_regmatch_info_aux(pTHX_ void *arg) { dVAR; - regexp * const rex = (regexp *)arg; - if (PL_reg_state.re_state_eval_setup_done) { - if (PL_reg_oldsaved) { - rex->subbeg = PL_reg_oldsaved; - rex->sublen = PL_reg_oldsavedlen; - rex->suboffset = PL_reg_oldsavedoffset; - rex->subcoffset = PL_reg_oldsavedcoffset; + regmatch_info_aux *aux = (regmatch_info_aux *) arg; + regmatch_info_aux_eval *eval_state = aux->info_aux_eval; + regmatch_slab *s; + + Safefree(aux->poscache); + + if (eval_state) { + + /* undo the effects of S_setup_eval_state() */ + + if (eval_state->subbeg) { + regexp * const rex = eval_state->rex; + rex->subbeg = eval_state->subbeg; + rex->sublen = eval_state->sublen; + rex->suboffset = eval_state->suboffset; + rex->subcoffset = eval_state->subcoffset; #ifdef PERL_ANY_COW - rex->saved_copy = PL_nrs; + rex->saved_copy = eval_state->saved_copy; #endif - RXp_MATCH_COPIED_on(rex); - } - PL_reg_magic->mg_len = PL_reg_oldpos; - PL_reg_state.re_state_eval_setup_done = FALSE; - PL_curpm = PL_reg_oldcurpm; - } + RXp_MATCH_COPIED_on(rex); + } + if (eval_state->pos_magic) + { + eval_state->pos_magic->mg_len = eval_state->pos; + eval_state->pos_magic->mg_flags = + (eval_state->pos_magic->mg_flags & ~MGf_BYTES) + | (eval_state->pos_flags & MGf_BYTES); + } + + PL_curpm = eval_state->curpm; + } + + PL_regmatch_state = aux->old_regmatch_state; + PL_regmatch_slab = aux->old_regmatch_slab; + + /* free all slabs above current one - this must be the last action + * of this function, as aux and eval_state are allocated within + * slabs and may be freed here */ + + s = PL_regmatch_slab->next; + if (s) { + PL_regmatch_slab->next = NULL; + while (s) { + regmatch_slab * const osl = s; + s = s->next; + Safefree(osl); + } + } } + STATIC void S_to_utf8_substr(pTHX_ regexp *prog) Index: gnu/usr.bin/perl/regexp.h =================================================================== RCS file: /mnt/memory/perl/importit/cvs/src/gnu/usr.bin/perl/regexp.h,v retrieving revision 1.12 diff -u -p -u -p -r1.12 regexp.h --- gnu/usr.bin/perl/regexp.h 24 Mar 2014 15:05:13 -0000 1.12 +++ gnu/usr.bin/perl/regexp.h 16 Nov 2014 03:22:24 -0000 @@ -36,13 +36,14 @@ struct regexp_engine; struct regexp; struct reg_substr_datum { - I32 min_offset; - I32 max_offset; + SSize_t min_offset; /* min pos (in chars) that substr must appear */ + SSize_t max_offset /* max pos (in chars) that substr must appear */; SV *substr; /* non-utf8 variant */ SV *utf8_substr; /* utf8 variant */ - I32 end_shift; + SSize_t end_shift; /* how many fixed chars must end the string */ }; struct reg_substr_data { + U8 check_ix; /* index into data[] of check substr */ struct reg_substr_datum data[3]; /* Actual array */ }; @@ -55,15 +56,15 @@ struct reg_substr_data { /* offsets within a string of a particular /(.)/ capture */ typedef struct regexp_paren_pair { - I32 start; - I32 end; + SSize_t start; + SSize_t end; /* 'start_tmp' records a new opening position before the matching end * has been found, so that the old start and end values are still * valid, e.g. * "abc" =~ /(.(?{print "[$1]"}))+/ *outputs [][a][b] * This field is not part of the API. */ - I32 start_tmp; + SSize_t start_tmp; } regexp_paren_pair; #if defined(PERL_IN_REGCOMP_C) || defined(PERL_IN_UTF8_C) @@ -104,9 +105,9 @@ struct reg_code_block { /* Information about the match that the perl core uses to */ \ /* manage things */ \ U32 extflags; /* Flags used both externally and internally */ \ - I32 minlen; /* mininum possible number of chars in string to match */\ - I32 minlenret; /* mininum possible number of chars in $& */ \ - U32 gofs; /* chars left of pos that we search from */ \ + SSize_t minlen; /* mininum possible number of chars in string to match */\ + SSize_t minlenret; /* mininum possible number of chars in $& */ \ + STRLEN gofs; /* chars left of pos that we search from */ \ /* substring data about strings that must appear in the */ \ /* final match, used for optimisations */ \ struct reg_substr_data *substrs; \ @@ -124,10 +125,11 @@ struct reg_code_block { /* saved or original string so \digit works forever. */ \ char *subbeg; \ SV_SAVED_COPY /* If non-NULL, SV which is COW from original */\ - I32 sublen; /* Length of string pointed by subbeg */ \ - I32 suboffset; /* byte offset of subbeg from logical start of str */ \ - I32 subcoffset; /* suboffset equiv, but in chars (for @-/@+) */ \ + SSize_t sublen; /* Length of string pointed by subbeg */ \ + SSize_t suboffset; /* byte offset of subbeg from logical start of str */ \ + SSize_t subcoffset; /* suboffset equiv, but in chars (for @-/@+) */ \ /* Information about the match that isn't often used */ \ + SSize_t maxlen; /* mininum possible number of chars in string to match */\ /* offset from wrapped to the start of precomp */ \ PERL_BITFIELD32 pre_prefix:4; \ /* original flags used to compile the pattern, may differ */ \ @@ -146,7 +148,7 @@ typedef struct regexp { typedef struct re_scream_pos_data_s { char **scream_olds; /* match pos */ - I32 *scream_pos; /* Internal iterator of scream. */ + SSize_t *scream_pos; /* Internal iterator of scream. */ } re_scream_pos_data; /* regexp_engine structure. This is the dispatch table for regexes. @@ -155,10 +157,15 @@ typedef struct re_scream_pos_data_s typedef struct regexp_engine { REGEXP* (*comp) (pTHX_ SV * const pattern, U32 flags); I32 (*exec) (pTHX_ REGEXP * const rx, char* stringarg, char* strend, - char* strbeg, I32 minend, SV* screamer, + char* strbeg, SSize_t minend, SV* sv, void* data, U32 flags); - char* (*intuit) (pTHX_ REGEXP * const rx, SV *sv, char *strpos, - char *strend, const U32 flags, + char* (*intuit) (pTHX_ + REGEXP * const rx, + SV *sv, + const char * const strbeg, + char *strpos, + char *strend, + const U32 flags, re_scream_pos_data *data); SV* (*checkstr) (pTHX_ REGEXP * const rx); void (*free) (pTHX_ REGEXP * const rx); @@ -225,7 +232,7 @@ typedef struct regexp_engine { =for apidoc Am|REGEXP *|SvRX|SV *sv -Convenience macro to get the REGEXP from a SV. This is approximately +Convenience macro to get the REGEXP from a SV. This is approximately equivalent to the following snippet: if (SvMAGICAL(sv)) @@ -379,29 +386,25 @@ get_regex_charset_name(const U32 flags, } } -/* Anchor and GPOS related stuff */ -#define RXf_ANCH_BOL (1<<(RXf_BASE_SHIFT+0)) -#define RXf_ANCH_MBOL (1<<(RXf_BASE_SHIFT+1)) -#define RXf_ANCH_SBOL (1<<(RXf_BASE_SHIFT+2)) -#define RXf_ANCH_GPOS (1<<(RXf_BASE_SHIFT+3)) -#define RXf_GPOS_SEEN (1<<(RXf_BASE_SHIFT+4)) -#define RXf_GPOS_FLOAT (1<<(RXf_BASE_SHIFT+5)) -/* two bits here */ -#define RXf_ANCH (RXf_ANCH_BOL|RXf_ANCH_MBOL|RXf_ANCH_GPOS|RXf_ANCH_SBOL) -#define RXf_GPOS_CHECK (RXf_GPOS_SEEN|RXf_ANCH_GPOS) -#define RXf_ANCH_SINGLE (RXf_ANCH_SBOL|RXf_ANCH_GPOS) +/* Do we have some sort of anchor? */ +#define RXf_IS_ANCHORED (1<<(RXf_BASE_SHIFT+0)) +#define RXf_UNUSED1 (1<<(RXf_BASE_SHIFT+1)) +#define RXf_UNUSED2 (1<<(RXf_BASE_SHIFT+2)) +#define RXf_UNUSED3 (1<<(RXf_BASE_SHIFT+3)) +#define RXf_UNUSED4 (1<<(RXf_BASE_SHIFT+4)) +#define RXf_UNUSED5 (1<<(RXf_BASE_SHIFT+5)) /* What we have seen */ #define RXf_NO_INPLACE_SUBST (1<<(RXf_BASE_SHIFT+6)) #define RXf_EVAL_SEEN (1<<(RXf_BASE_SHIFT+7)) -#define RXf_CANY_SEEN (1<<(RXf_BASE_SHIFT+8)) +#define RXf_UNUSED8 (1<<(RXf_BASE_SHIFT+8)) /* Special */ -#define RXf_NOSCAN (1<<(RXf_BASE_SHIFT+9)) +#define RXf_UNBOUNDED_QUANTIFIER_SEEN (1<<(RXf_BASE_SHIFT+9)) #define RXf_CHECK_ALL (1<<(RXf_BASE_SHIFT+10)) /* UTF8 related */ -#define RXf_MATCH_UTF8 (1<<(RXf_BASE_SHIFT+11)) +#define RXf_MATCH_UTF8 (1<<(RXf_BASE_SHIFT+11)) /* $1 etc are utf8 */ /* Intuit related */ #define RXf_USE_INTUIT_NOML (1<<(RXf_BASE_SHIFT+12)) @@ -412,8 +415,7 @@ get_regex_charset_name(const U32 flags, /* Copy and tainted info */ #define RXf_COPY_DONE (1<<(RXf_BASE_SHIFT+16)) -/* during execution: pattern temporarily tainted by executing locale ops; - * post-execution: $1 et al are tainted */ +/* post-execution: $1 et al are tainted */ #define RXf_TAINTED_SEEN (1<<(RXf_BASE_SHIFT+17)) /* this pattern was tainted during compilation */ #define RXf_TAINTED (1<<(RXf_BASE_SHIFT+18)) @@ -433,7 +435,7 @@ get_regex_charset_name(const U32 flags, * */ -#if NO_TAINT_SUPPORT +#ifdef NO_TAINT_SUPPORT # define RX_ISTAINTED(prog) 0 # define RX_TAINT_on(prog) NOOP # define RXp_MATCH_TAINTED(prog) 0 @@ -496,6 +498,10 @@ get_regex_charset_name(const U32 flags, #define RX_LASTPAREN(prog) (ReANY(prog)->lastparen) #define RX_LASTCLOSEPAREN(prog) (ReANY(prog)->lastcloseparen) #define RX_SAVED_COPY(prog) (ReANY(prog)->saved_copy) +/* last match was zero-length */ +#define RX_ZERO_LEN(prog) \ + (RX_OFFS(prog)[0].start + (SSize_t)RX_GOFS(prog) \ + == RX_OFFS(prog)[0].end) #endif /* PLUGGABLE_RE_EXTENSION */ @@ -523,22 +529,30 @@ get_regex_charset_name(const U32 flags, #define RX_MATCH_UTF8_on(prog) (RX_EXTFLAGS(prog) |= RXf_MATCH_UTF8) #define RX_MATCH_UTF8_off(prog) (RX_EXTFLAGS(prog) &= ~RXf_MATCH_UTF8) #define RX_MATCH_UTF8_set(prog, t) ((t) \ - ? (RX_MATCH_UTF8_on(prog), (PL_reg_match_utf8 = 1)) \ - : (RX_MATCH_UTF8_off(prog), (PL_reg_match_utf8 = 0))) + ? RX_MATCH_UTF8_on(prog) \ + : RX_MATCH_UTF8_off(prog)) /* Whether the pattern stored at RX_WRAPPED is in UTF-8 */ #define RX_UTF8(prog) SvUTF8(prog) -#define REXEC_COPY_STR 0x01 /* Need to copy the string. */ -#define REXEC_CHECKED 0x02 /* check_substr already checked. */ -#define REXEC_SCREAM 0x04 /* use scream table. */ -#define REXEC_IGNOREPOS 0x08 /* \G matches at start. */ -#define REXEC_NOT_FIRST 0x10 /* This is another iteration of //g. */ - /* under REXEC_COPY_STR, it's ok for the - * engine (modulo PL_sawamperand etc) - * to skip copying ... */ -#define REXEC_COPY_SKIP_PRE 0x20 /* ...the $` part of the string, or */ -#define REXEC_COPY_SKIP_POST 0x40 /* ...the $' part of the string */ + +/* bits in flags arg of Perl_regexec_flags() */ + +#define REXEC_COPY_STR 0x01 /* Need to copy the string for captures. */ +#define REXEC_CHECKED 0x02 /* re_intuit_start() already called. */ +#define REXEC_SCREAM 0x04 /* currently unused. */ +#define REXEC_IGNOREPOS 0x08 /* use stringarg, not pos(), for \G match */ +#define REXEC_NOT_FIRST 0x10 /* This is another iteration of //g: + no need to copy string again */ + + /* under REXEC_COPY_STR, it's ok for the + engine (modulo PL_sawamperand etc) + to skip copying: ... */ +#define REXEC_COPY_SKIP_PRE 0x20 /* ...the $` part of the string, or */ +#define REXEC_COPY_SKIP_POST 0x40 /* ...the $' part of the string */ +#define REXEC_FAIL_ON_UNDERFLOW 0x80 /* fail the match if $& would start before + the start pos (so s/.\G// would fail + on second iteration */ #if defined(__GNUC__) && !defined(PERL_GCC_BRACE_GROUPS_FORBIDDEN) # define ReREFCNT_inc(re) \ @@ -571,17 +585,64 @@ get_regex_charset_name(const U32 flags, #define FBMrf_MULTILINE 1 +struct regmatch_state; +struct regmatch_slab; + +/* like regmatch_info_aux, but contains extra fields only needed if the + * pattern contains (?{}). If used, is snuck into the second slot in the + * regmatch_state stack at the start of execution */ + +typedef struct { + regexp *rex; + PMOP *curpm; /* saved PL_curpm */ +#ifdef PERL_ANY_COW + SV *saved_copy; /* saved saved_copy field from rex */ +#endif + char *subbeg; /* saved subbeg field from rex */ + STRLEN sublen; /* saved sublen field from rex */ + STRLEN suboffset; /* saved suboffset field from rex */ + STRLEN subcoffset; /* saved subcoffset field from rex */ + MAGIC *pos_magic; /* pos() magic attached to $_ */ + SSize_t pos; /* the original value of pos() in pos_magic */ + U8 pos_flags; /* flags to be restored; currently only MGf_BYTES*/ +} regmatch_info_aux_eval; + + +/* fields that logically live in regmatch_info, but which need cleaning + * up on croak(), and so are instead are snuck into the first slot in + * the regmatch_state stack at the start of execution */ + +typedef struct { + regmatch_info_aux_eval *info_aux_eval; + struct regmatch_state *old_regmatch_state; /* saved PL_regmatch_state */ + struct regmatch_slab *old_regmatch_slab; /* saved PL_regmatch_slab */ + char *poscache; /* S-L cache of fail positions of WHILEMs */ +} regmatch_info_aux; + + /* some basic information about the current match that is created by - * Perl_regexec_flags and then passed to regtry(), regmatch() etc */ + * Perl_regexec_flags and then passed to regtry(), regmatch() etc. + * It is allocated as a local var on the stack, so nothing should be + * stored in it that needs preserving or clearing up on croak(). + * For that, see the aux_info and aux_info_eval members of the + * regmatch_state union. */ typedef struct { - REGEXP *prog; - char *bol; - char *till; - SV *sv; - char *ganch; - char *cutpoint; - bool is_utf8_pat; + REGEXP *prog; /* the regex being executed */ + const char * strbeg; /* real start of string */ + char *strend; /* one byte beyond last char of match string */ + char *till; /* matches shorter than this fail (see minlen arg) */ + SV *sv; /* the SV string currently being matched */ + char *ganch; /* position of \G anchor */ + char *cutpoint; /* (*COMMIT) position (if any) */ + regmatch_info_aux *info_aux; /* extra fields that need cleanup */ + regmatch_info_aux_eval *info_aux_eval; /* extra saved state for (?{}) */ + I32 poscache_maxiter; /* how many whilems todo before S-L cache kicks in */ + I32 poscache_iter; /* current countdown from _maxiter to zero */ + STRLEN poscache_size; /* size of regmatch_info_aux.poscache */ + bool intuit; /* re_intuit_start() is the top-level caller */ + bool is_utf8_pat; /* regex is utf8 */ + bool is_utf8_target; /* string being matched is utf8 */ bool warned; /* we have issued a recursion warning; no need for more */ } regmatch_info; @@ -600,6 +661,29 @@ typedef struct regmatch_state { union { + /* the 'info_aux' and 'info_aux_eval' union members are cuckoos in + * the nest. They aren't saved backtrack state; rather they + * represent one or two extra chunks of data that need allocating + * at the start of a match. These fields would logically live in + * the regmatch_info struct, except that is allocated on the + * C stack, and these fields are all things that require cleanup + * after a croak(), when the stack is lost. + * As a convenience, we just use the first 1 or 2 regmatch_state + * slots to store this info, as we will be allocating a slab of + * these anyway. Otherwise we'd have to malloc and then free them, + * or allocate them on the save stack (where they will get + * realloced if the save stack grows). + * info_aux contains the extra fields that are always needed; + * info_aux_eval contains extra fields that only needed if + * the pattern contains code blocks + * We split them into two separate structs to avoid increasing + * the size of the union. + */ + + regmatch_info_aux info_aux; + + regmatch_info_aux_eval info_aux_eval; + /* this is a fake union member that matches the first element * of each member that needs to store positive backtrack * information */ @@ -654,7 +738,6 @@ typedef struct regmatch_state { struct regmatch_state *prev_eval; struct regmatch_state *prev_curlyx; REGEXP *prev_rex; - bool saved_utf8_pat; /* saved copy of is_utf8_pat */ CHECKPOINT cp; /* remember current savestack indexes */ CHECKPOINT lastcp; U32 close_paren; /* which close bracket is our end */ @@ -755,50 +838,7 @@ typedef struct regmatch_slab { struct regmatch_slab *prev, *next; } regmatch_slab; -#define PL_bostr PL_reg_state.re_state_bostr -#define PL_regeol PL_reg_state.re_state_regeol -#define PL_reg_match_utf8 PL_reg_state.re_state_reg_match_utf8 -#define PL_reg_magic PL_reg_state.re_state_reg_magic -#define PL_reg_oldpos PL_reg_state.re_state_reg_oldpos -#define PL_reg_oldcurpm PL_reg_state.re_state_reg_oldcurpm -#define PL_reg_curpm PL_reg_state.re_state_reg_curpm -#define PL_reg_oldsaved PL_reg_state.re_state_reg_oldsaved -#define PL_reg_oldsavedlen PL_reg_state.re_state_reg_oldsavedlen -#define PL_reg_oldsavedoffset PL_reg_state.re_state_reg_oldsavedoffset -#define PL_reg_oldsavedcoffset PL_reg_state.re_state_reg_oldsavedcoffset -#define PL_reg_maxiter PL_reg_state.re_state_reg_maxiter -#define PL_reg_leftiter PL_reg_state.re_state_reg_leftiter -#define PL_reg_poscache PL_reg_state.re_state_reg_poscache -#define PL_reg_poscache_size PL_reg_state.re_state_reg_poscache_size -#define PL_reg_starttry PL_reg_state.re_state_reg_starttry -#define PL_nrs PL_reg_state.re_state_nrs - -struct re_save_state { - bool re_state_eval_setup_done; /* from regexec.c */ - bool re_state_reg_match_utf8; /* from regexec.c */ - /* Space for U8 */ - I32 re_state_reg_oldpos; /* from regexec.c */ - I32 re_state_reg_maxiter; /* max wait until caching pos */ - I32 re_state_reg_leftiter; /* wait until caching pos */ - char *re_state_bostr; - char *re_state_regeol; /* End of input, for $ check. */ - MAGIC *re_state_reg_magic; /* from regexec.c */ - PMOP *re_state_reg_oldcurpm; /* from regexec.c */ - PMOP *re_state_reg_curpm; /* from regexec.c */ - char *re_state_reg_oldsaved; /* old saved substr during match */ - STRLEN re_state_reg_oldsavedlen; /* old length of saved substr during match */ - STRLEN re_state_reg_oldsavedoffset; /* old offset of saved substr during match */ - STRLEN re_state_reg_oldsavedcoffset;/* old coffset of saved substr during match */ - STRLEN re_state_reg_poscache_size; /* size of pos cache of WHILEM */ - char *re_state_reg_poscache; /* cache of pos of WHILEM */ - char *re_state_reg_starttry; /* from regexec.c */ -#ifdef PERL_ANY_COW - SV *re_state_nrs; /* was placeholder: unused since 5.8.0 (5.7.2 patch #12027 for bug ID 20010815.012). Used to save rx->saved_copy */ -#endif -}; -#define SAVESTACK_ALLOC_FOR_RE_SAVE_STATE \ - (1 + ((sizeof(struct re_save_state) - 1) / sizeof(*PL_savestack))) /* * Local variables: Index: gnu/usr.bin/perl/regnodes.h =================================================================== RCS file: /mnt/memory/perl/importit/cvs/src/gnu/usr.bin/perl/regnodes.h,v retrieving revision 1.1.1.9 diff -u -p -u -p -r1.1.1.9 regnodes.h --- gnu/usr.bin/perl/regnodes.h 24 Mar 2014 14:58:47 -0000 1.1.1.9 +++ gnu/usr.bin/perl/regnodes.h 16 Nov 2014 03:22:24 -0000 @@ -6,8 +6,8 @@ /* Regops and State definitions */ -#define REGNODE_MAX 95 -#define REGMATCH_STATE_MAX 135 +#define REGNODE_MAX 93 +#define REGMATCH_STATE_MAX 133 #define END 0 /* 0000 End of program. */ #define SUCCEED 1 /* 0x01 Return from a subroutine, basically. */ @@ -18,93 +18,91 @@ #define EOL 6 /* 0x06 Match "" at end of line. */ #define MEOL 7 /* 0x07 Same, assuming multiline. */ #define SEOL 8 /* 0x08 Same, assuming singleline. */ -#define BOUND 9 /* 0x09 Match "" at any word boundary using native charset semantics for non-utf8 */ +#define BOUND 9 /* 0x09 Match "" at any word boundary using native charset rules for non-utf8 */ #define BOUNDL 10 /* 0x0a Match "" at any locale word boundary */ -#define BOUNDU 11 /* 0x0b Match "" at any word boundary using Unicode semantics */ -#define BOUNDA 12 /* 0x0c Match "" at any word boundary using ASCII semantics */ -#define NBOUND 13 /* 0x0d Match "" at any word non-boundary using native charset semantics for non-utf8 */ +#define BOUNDU 11 /* 0x0b Match "" at any word boundary using Unicode rules */ +#define BOUNDA 12 /* 0x0c Match "" at any word boundary using ASCII rules */ +#define NBOUND 13 /* 0x0d Match "" at any word non-boundary using native charset rules for non-utf8 */ #define NBOUNDL 14 /* 0x0e Match "" at any locale word non-boundary */ -#define NBOUNDU 15 /* 0x0f Match "" at any word non-boundary using Unicode semantics */ -#define NBOUNDA 16 /* 0x10 Match "" at any word non-boundary using ASCII semantics */ +#define NBOUNDU 15 /* 0x0f Match "" at any word non-boundary using Unicode rules */ +#define NBOUNDA 16 /* 0x10 Match "" at any word non-boundary using ASCII rules */ #define GPOS 17 /* 0x11 Matches where last m//g left off. */ #define REG_ANY 18 /* 0x12 Match any one character (except newline). */ #define SANY 19 /* 0x13 Match any one character. */ #define CANY 20 /* 0x14 Match any one byte. */ #define ANYOF 21 /* 0x15 Match character in (or not in) this class, single char match only */ -#define ANYOF_WARN_SUPER 22 /* 0x16 Match character in (or not in) this class, warn (if enabled) upon matching a char above Unicode max; */ -#define ANYOF_SYNTHETIC 23 /* 0x17 Synthetic start class */ -#define POSIXD 24 /* 0x18 Some [[:class:]] under /d; the FLAGS field gives which one */ -#define POSIXL 25 /* 0x19 Some [[:class:]] under /l; the FLAGS field gives which one */ -#define POSIXU 26 /* 0x1a Some [[:class:]] under /u; the FLAGS field gives which one */ -#define POSIXA 27 /* 0x1b Some [[:class:]] under /a; the FLAGS field gives which one */ -#define NPOSIXD 28 /* 0x1c complement of POSIXD, [[:^class:]] */ -#define NPOSIXL 29 /* 0x1d complement of POSIXL, [[:^class:]] */ -#define NPOSIXU 30 /* 0x1e complement of POSIXU, [[:^class:]] */ -#define NPOSIXA 31 /* 0x1f complement of POSIXA, [[:^class:]] */ -#define CLUMP 32 /* 0x20 Match any extended grapheme cluster sequence */ -#define BRANCH 33 /* 0x21 Match this alternative, or the next... */ -#define BACK 34 /* 0x22 Match "", "next" ptr points backward. */ -#define EXACT 35 /* 0x23 Match this string (preceded by length). */ -#define EXACTF 36 /* 0x24 Match this non-UTF-8 string (not guaranteed to be folded) using /id rules (w/len). */ -#define EXACTFL 37 /* 0x25 Match this string (not guaranteed to be folded) using /il rules (w/len). */ -#define EXACTFU 38 /* 0x26 Match this string (folded iff in UTF-8, length in folding doesn't change if not in UTF-8) using /iu rules (w/len). */ -#define EXACTFA 39 /* 0x27 Match this string (not guaranteed to be folded) using /iaa rules (w/len). */ -#define EXACTFU_SS 40 /* 0x28 Match this string (folded iff in UTF-8, length in folding may change even if not in UTF-8) using /iu rules (w/len). */ -#define EXACTFU_TRICKYFOLD 41 /* 0x29 Match this folded UTF-8 string using /iu rules */ -#define NOTHING 42 /* 0x2a Match empty string. */ -#define TAIL 43 /* 0x2b Match empty string. Can jump here from outside. */ -#define STAR 44 /* 0x2c Match this (simple) thing 0 or more times. */ -#define PLUS 45 /* 0x2d Match this (simple) thing 1 or more times. */ -#define CURLY 46 /* 0x2e Match this simple thing {n,m} times. */ -#define CURLYN 47 /* 0x2f Capture next-after-this simple thing */ -#define CURLYM 48 /* 0x30 Capture this medium-complex thing {n,m} times. */ -#define CURLYX 49 /* 0x31 Match this complex thing {n,m} times. */ -#define WHILEM 50 /* 0x32 Do curly processing and see if rest matches. */ -#define OPEN 51 /* 0x33 Mark this point in input as start of #n. */ -#define CLOSE 52 /* 0x34 Analogous to OPEN. */ -#define REF 53 /* 0x35 Match some already matched string */ -#define REFF 54 /* 0x36 Match already matched string, folded using native charset semantics for non-utf8 */ -#define REFFL 55 /* 0x37 Match already matched string, folded in loc. */ -#define REFFU 56 /* 0x38 Match already matched string, folded using unicode semantics for non-utf8 */ -#define REFFA 57 /* 0x39 Match already matched string, folded using unicode semantics for non-utf8, no mixing ASCII, non-ASCII */ -#define NREF 58 /* 0x3a Match some already matched string */ -#define NREFF 59 /* 0x3b Match already matched string, folded using native charset semantics for non-utf8 */ -#define NREFFL 60 /* 0x3c Match already matched string, folded in loc. */ -#define NREFFU 61 /* 0x3d Match already matched string, folded using unicode semantics for non-utf8 */ -#define NREFFA 62 /* 0x3e Match already matched string, folded using unicode semantics for non-utf8, no mixing ASCII, non-ASCII */ -#define IFMATCH 63 /* 0x3f Succeeds if the following matches. */ -#define UNLESSM 64 /* 0x40 Fails if the following matches. */ -#define SUSPEND 65 /* 0x41 "Independent" sub-RE. */ -#define IFTHEN 66 /* 0x42 Switch, should be preceded by switcher. */ -#define GROUPP 67 /* 0x43 Whether the group matched. */ -#define LONGJMP 68 /* 0x44 Jump far away. */ -#define BRANCHJ 69 /* 0x45 BRANCH with long offset. */ -#define EVAL 70 /* 0x46 Execute some Perl code. */ -#define MINMOD 71 /* 0x47 Next operator is not greedy. */ -#define LOGICAL 72 /* 0x48 Next opcode should set the flag only. */ -#define RENUM 73 /* 0x49 Group with independently numbered parens. */ -#define TRIE 74 /* 0x4a Match many EXACT(F[ALU]?)? at once. flags==type */ -#define TRIEC 75 /* 0x4b Same as TRIE, but with embedded charclass data */ -#define AHOCORASICK 76 /* 0x4c Aho Corasick stclass. flags==type */ -#define AHOCORASICKC 77 /* 0x4d Same as AHOCORASICK, but with embedded charclass data */ -#define GOSUB 78 /* 0x4e recurse to paren arg1 at (signed) ofs arg2 */ -#define GOSTART 79 /* 0x4f recurse to start of pattern */ -#define NGROUPP 80 /* 0x50 Whether the group matched. */ -#define INSUBP 81 /* 0x51 Whether we are in a specific recurse. */ -#define DEFINEP 82 /* 0x52 Never execute directly. */ -#define ENDLIKE 83 /* 0x53 Used only for the type field of verbs */ -#define OPFAIL 84 /* 0x54 Same as (?!) */ -#define ACCEPT 85 /* 0x55 Accepts the current matched string. */ -#define VERB 86 /* 0x56 Used only for the type field of verbs */ -#define PRUNE 87 /* 0x57 Pattern fails at this startpoint if no-backtracking through this */ -#define MARKPOINT 88 /* 0x58 Push the current location for rollback by cut. */ -#define SKIP 89 /* 0x59 On failure skip forward (to the mark) before retrying */ -#define COMMIT 90 /* 0x5a Pattern fails outright if backtracking through this */ -#define CUTGROUP 91 /* 0x5b On failure go to the next alternation in the group */ -#define KEEPS 92 /* 0x5c $& begins here. */ -#define LNBREAK 93 /* 0x5d generic newline pattern */ -#define OPTIMIZED 94 /* 0x5e Placeholder for dump. */ -#define PSEUDO 95 /* 0x5f Pseudo opcode for internal use. */ +#define POSIXD 22 /* 0x16 Some [[:class:]] under /d; the FLAGS field gives which one */ +#define POSIXL 23 /* 0x17 Some [[:class:]] under /l; the FLAGS field gives which one */ +#define POSIXU 24 /* 0x18 Some [[:class:]] under /u; the FLAGS field gives which one */ +#define POSIXA 25 /* 0x19 Some [[:class:]] under /a; the FLAGS field gives which one */ +#define NPOSIXD 26 /* 0x1a complement of POSIXD, [[:^class:]] */ +#define NPOSIXL 27 /* 0x1b complement of POSIXL, [[:^class:]] */ +#define NPOSIXU 28 /* 0x1c complement of POSIXU, [[:^class:]] */ +#define NPOSIXA 29 /* 0x1d complement of POSIXA, [[:^class:]] */ +#define CLUMP 30 /* 0x1e Match any extended grapheme cluster sequence */ +#define BRANCH 31 /* 0x1f Match this alternative, or the next... */ +#define BACK 32 /* 0x20 Match "", "next" ptr points backward. */ +#define EXACT 33 /* 0x21 Match this string (preceded by length). */ +#define EXACTF 34 /* 0x22 Match this non-UTF-8 string (not guaranteed to be folded) using /id rules (w/len). */ +#define EXACTFL 35 /* 0x23 Match this string (not guaranteed to be folded) using /il rules (w/len). */ +#define EXACTFU 36 /* 0x24 Match this string (folded iff in UTF-8, length in folding doesn't change if not in UTF-8) using /iu rules (w/len). */ +#define EXACTFA 37 /* 0x25 Match this string (not guaranteed to be folded) using /iaa rules (w/len). */ +#define EXACTFU_SS 38 /* 0x26 Match this string (folded iff in UTF-8, length in folding may change even if not in UTF-8) using /iu rules (w/len). */ +#define EXACTFA_NO_TRIE 39 /* 0x27 Match this string (which is not trie-able; not guaranteed to be folded) using /iaa rules (w/len). */ +#define NOTHING 40 /* 0x28 Match empty string. */ +#define TAIL 41 /* 0x29 Match empty string. Can jump here from outside. */ +#define STAR 42 /* 0x2a Match this (simple) thing 0 or more times. */ +#define PLUS 43 /* 0x2b Match this (simple) thing 1 or more times. */ +#define CURLY 44 /* 0x2c Match this simple thing {n,m} times. */ +#define CURLYN 45 /* 0x2d Capture next-after-this simple thing */ +#define CURLYM 46 /* 0x2e Capture this medium-complex thing {n,m} times. */ +#define CURLYX 47 /* 0x2f Match this complex thing {n,m} times. */ +#define WHILEM 48 /* 0x30 Do curly processing and see if rest matches. */ +#define OPEN 49 /* 0x31 Mark this point in input as start of #n. */ +#define CLOSE 50 /* 0x32 Analogous to OPEN. */ +#define REF 51 /* 0x33 Match some already matched string */ +#define REFF 52 /* 0x34 Match already matched string, folded using native charset rules for non-utf8 */ +#define REFFL 53 /* 0x35 Match already matched string, folded in loc. */ +#define REFFU 54 /* 0x36 Match already matched string, folded using unicode rules for non-utf8 */ +#define REFFA 55 /* 0x37 Match already matched string, folded using unicode rules for non-utf8, no mixing ASCII, non-ASCII */ +#define NREF 56 /* 0x38 Match some already matched string */ +#define NREFF 57 /* 0x39 Match already matched string, folded using native charset rules for non-utf8 */ +#define NREFFL 58 /* 0x3a Match already matched string, folded in loc. */ +#define NREFFU 59 /* 0x3b Match already matched string, folded using unicode rules for non-utf8 */ +#define NREFFA 60 /* 0x3c Match already matched string, folded using unicode rules for non-utf8, no mixing ASCII, non-ASCII */ +#define IFMATCH 61 /* 0x3d Succeeds if the following matches. */ +#define UNLESSM 62 /* 0x3e Fails if the following matches. */ +#define SUSPEND 63 /* 0x3f "Independent" sub-RE. */ +#define IFTHEN 64 /* 0x40 Switch, should be preceded by switcher. */ +#define GROUPP 65 /* 0x41 Whether the group matched. */ +#define LONGJMP 66 /* 0x42 Jump far away. */ +#define BRANCHJ 67 /* 0x43 BRANCH with long offset. */ +#define EVAL 68 /* 0x44 Execute some Perl code. */ +#define MINMOD 69 /* 0x45 Next operator is not greedy. */ +#define LOGICAL 70 /* 0x46 Next opcode should set the flag only. */ +#define RENUM 71 /* 0x47 Group with independently numbered parens. */ +#define TRIE 72 /* 0x48 Match many EXACT(F[ALU]?)? at once. flags==type */ +#define TRIEC 73 /* 0x49 Same as TRIE, but with embedded charclass data */ +#define AHOCORASICK 74 /* 0x4a Aho Corasick stclass. flags==type */ +#define AHOCORASICKC 75 /* 0x4b Same as AHOCORASICK, but with embedded charclass data */ +#define GOSUB 76 /* 0x4c recurse to paren arg1 at (signed) ofs arg2 */ +#define GOSTART 77 /* 0x4d recurse to start of pattern */ +#define NGROUPP 78 /* 0x4e Whether the group matched. */ +#define INSUBP 79 /* 0x4f Whether we are in a specific recurse. */ +#define DEFINEP 80 /* 0x50 Never execute directly. */ +#define ENDLIKE 81 /* 0x51 Used only for the type field of verbs */ +#define OPFAIL 82 /* 0x52 Same as (?!) */ +#define ACCEPT 83 /* 0x53 Accepts the current matched string. */ +#define VERB 84 /* 0x54 Used only for the type field of verbs */ +#define PRUNE 85 /* 0x55 Pattern fails at this startpoint if no-backtracking through this */ +#define MARKPOINT 86 /* 0x56 Push the current location for rollback by cut. */ +#define SKIP 87 /* 0x57 On failure skip forward (to the mark) before retrying */ +#define COMMIT 88 /* 0x58 Pattern fails outright if backtracking through this */ +#define CUTGROUP 89 /* 0x59 On failure go to the next alternation in the group */ +#define KEEPS 90 /* 0x5a $& begins here. */ +#define LNBREAK 91 /* 0x5b generic newline pattern */ +#define OPTIMIZED 92 /* 0x5c Placeholder for dump. */ +#define PSEUDO 93 /* 0x5d Pseudo opcode for internal use. */ /* ------------ States ------------- */ #define TRIE_next (REGNODE_MAX + 1) /* state for TRIE */ #define TRIE_next_fail (REGNODE_MAX + 2) /* state for TRIE */ @@ -175,8 +173,6 @@ EXTCONST U8 PL_regkind[] = { REG_ANY, /* SANY */ REG_ANY, /* CANY */ ANYOF, /* ANYOF */ - ANYOF, /* ANYOF_WARN_SUPER */ - ANYOF, /* ANYOF_SYNTHETIC */ POSIXD, /* POSIXD */ POSIXD, /* POSIXL */ POSIXD, /* POSIXU */ @@ -194,7 +190,7 @@ EXTCONST U8 PL_regkind[] = { EXACT, /* EXACTFU */ EXACT, /* EXACTFA */ EXACT, /* EXACTFU_SS */ - EXACT, /* EXACTFU_TRICKYFOLD */ + EXACT, /* EXACTFA_NO_TRIE */ NOTHING, /* NOTHING */ NOTHING, /* TAIL */ STAR, /* STAR */ @@ -319,8 +315,6 @@ static const U8 regarglen[] = { 0, /* SANY */ 0, /* CANY */ 0, /* ANYOF */ - 0, /* ANYOF_WARN_SUPER */ - 0, /* ANYOF_SYNTHETIC */ 0, /* POSIXD */ 0, /* POSIXL */ 0, /* POSIXU */ @@ -338,7 +332,7 @@ static const U8 regarglen[] = { 0, /* EXACTFU */ 0, /* EXACTFA */ 0, /* EXACTFU_SS */ - 0, /* EXACTFU_TRICKYFOLD */ + 0, /* EXACTFA_NO_TRIE */ 0, /* NOTHING */ 0, /* TAIL */ 0, /* STAR */ @@ -420,8 +414,6 @@ static const char reg_off_by_arg[] = { 0, /* SANY */ 0, /* CANY */ 0, /* ANYOF */ - 0, /* ANYOF_WARN_SUPER */ - 0, /* ANYOF_SYNTHETIC */ 0, /* POSIXD */ 0, /* POSIXL */ 0, /* POSIXU */ @@ -439,7 +431,7 @@ static const char reg_off_by_arg[] = { 0, /* EXACTFU */ 0, /* EXACTFA */ 0, /* EXACTFU_SS */ - 0, /* EXACTFU_TRICKYFOLD */ + 0, /* EXACTFA_NO_TRIE */ 0, /* NOTHING */ 0, /* TAIL */ 0, /* STAR */ @@ -526,80 +518,78 @@ EXTCONST char * const PL_reg_name[] = { "SANY", /* 0x13 */ "CANY", /* 0x14 */ "ANYOF", /* 0x15 */ - "ANYOF_WARN_SUPER", /* 0x16 */ - "ANYOF_SYNTHETIC", /* 0x17 */ - "POSIXD", /* 0x18 */ - "POSIXL", /* 0x19 */ - "POSIXU", /* 0x1a */ - "POSIXA", /* 0x1b */ - "NPOSIXD", /* 0x1c */ - "NPOSIXL", /* 0x1d */ - "NPOSIXU", /* 0x1e */ - "NPOSIXA", /* 0x1f */ - "CLUMP", /* 0x20 */ - "BRANCH", /* 0x21 */ - "BACK", /* 0x22 */ - "EXACT", /* 0x23 */ - "EXACTF", /* 0x24 */ - "EXACTFL", /* 0x25 */ - "EXACTFU", /* 0x26 */ - "EXACTFA", /* 0x27 */ - "EXACTFU_SS", /* 0x28 */ - "EXACTFU_TRICKYFOLD", /* 0x29 */ - "NOTHING", /* 0x2a */ - "TAIL", /* 0x2b */ - "STAR", /* 0x2c */ - "PLUS", /* 0x2d */ - "CURLY", /* 0x2e */ - "CURLYN", /* 0x2f */ - "CURLYM", /* 0x30 */ - "CURLYX", /* 0x31 */ - "WHILEM", /* 0x32 */ - "OPEN", /* 0x33 */ - "CLOSE", /* 0x34 */ - "REF", /* 0x35 */ - "REFF", /* 0x36 */ - "REFFL", /* 0x37 */ - "REFFU", /* 0x38 */ - "REFFA", /* 0x39 */ - "NREF", /* 0x3a */ - "NREFF", /* 0x3b */ - "NREFFL", /* 0x3c */ - "NREFFU", /* 0x3d */ - "NREFFA", /* 0x3e */ - "IFMATCH", /* 0x3f */ - "UNLESSM", /* 0x40 */ - "SUSPEND", /* 0x41 */ - "IFTHEN", /* 0x42 */ - "GROUPP", /* 0x43 */ - "LONGJMP", /* 0x44 */ - "BRANCHJ", /* 0x45 */ - "EVAL", /* 0x46 */ - "MINMOD", /* 0x47 */ - "LOGICAL", /* 0x48 */ - "RENUM", /* 0x49 */ - "TRIE", /* 0x4a */ - "TRIEC", /* 0x4b */ - "AHOCORASICK", /* 0x4c */ - "AHOCORASICKC", /* 0x4d */ - "GOSUB", /* 0x4e */ - "GOSTART", /* 0x4f */ - "NGROUPP", /* 0x50 */ - "INSUBP", /* 0x51 */ - "DEFINEP", /* 0x52 */ - "ENDLIKE", /* 0x53 */ - "OPFAIL", /* 0x54 */ - "ACCEPT", /* 0x55 */ - "VERB", /* 0x56 */ - "PRUNE", /* 0x57 */ - "MARKPOINT", /* 0x58 */ - "SKIP", /* 0x59 */ - "COMMIT", /* 0x5a */ - "CUTGROUP", /* 0x5b */ - "KEEPS", /* 0x5c */ - "LNBREAK", /* 0x5d */ - "OPTIMIZED", /* 0x5e */ - "PSEUDO", /* 0x5f */ + "POSIXD", /* 0x16 */ + "POSIXL", /* 0x17 */ + "POSIXU", /* 0x18 */ + "POSIXA", /* 0x19 */ + "NPOSIXD", /* 0x1a */ + "NPOSIXL", /* 0x1b */ + "NPOSIXU", /* 0x1c */ + "NPOSIXA", /* 0x1d */ + "CLUMP", /* 0x1e */ + "BRANCH", /* 0x1f */ + "BACK", /* 0x20 */ + "EXACT", /* 0x21 */ + "EXACTF", /* 0x22 */ + "EXACTFL", /* 0x23 */ + "EXACTFU", /* 0x24 */ + "EXACTFA", /* 0x25 */ + "EXACTFU_SS", /* 0x26 */ + "EXACTFA_NO_TRIE", /* 0x27 */ + "NOTHING", /* 0x28 */ + "TAIL", /* 0x29 */ + "STAR", /* 0x2a */ + "PLUS", /* 0x2b */ + "CURLY", /* 0x2c */ + "CURLYN", /* 0x2d */ + "CURLYM", /* 0x2e */ + "CURLYX", /* 0x2f */ + "WHILEM", /* 0x30 */ + "OPEN", /* 0x31 */ + "CLOSE", /* 0x32 */ + "REF", /* 0x33 */ + "REFF", /* 0x34 */ + "REFFL", /* 0x35 */ + "REFFU", /* 0x36 */ + "REFFA", /* 0x37 */ + "NREF", /* 0x38 */ + "NREFF", /* 0x39 */ + "NREFFL", /* 0x3a */ + "NREFFU", /* 0x3b */ + "NREFFA", /* 0x3c */ + "IFMATCH", /* 0x3d */ + "UNLESSM", /* 0x3e */ + "SUSPEND", /* 0x3f */ + "IFTHEN", /* 0x40 */ + "GROUPP", /* 0x41 */ + "LONGJMP", /* 0x42 */ + "BRANCHJ", /* 0x43 */ + "EVAL", /* 0x44 */ + "MINMOD", /* 0x45 */ + "LOGICAL", /* 0x46 */ + "RENUM", /* 0x47 */ + "TRIE", /* 0x48 */ + "TRIEC", /* 0x49 */ + "AHOCORASICK", /* 0x4a */ + "AHOCORASICKC", /* 0x4b */ + "GOSUB", /* 0x4c */ + "GOSTART", /* 0x4d */ + "NGROUPP", /* 0x4e */ + "INSUBP", /* 0x4f */ + "DEFINEP", /* 0x50 */ + "ENDLIKE", /* 0x51 */ + "OPFAIL", /* 0x52 */ + "ACCEPT", /* 0x53 */ + "VERB", /* 0x54 */ + "PRUNE", /* 0x55 */ + "MARKPOINT", /* 0x56 */ + "SKIP", /* 0x57 */ + "COMMIT", /* 0x58 */ + "CUTGROUP", /* 0x59 */ + "KEEPS", /* 0x5a */ + "LNBREAK", /* 0x5b */ + "OPTIMIZED", /* 0x5c */ + "PSEUDO", /* 0x5d */ /* ------------ States ------------- */ "TRIE_next", /* REGNODE_MAX +0x01 */ "TRIE_next_fail", /* REGNODE_MAX +0x02 */ @@ -660,16 +650,16 @@ EXTCONST char * const PL_reg_extflags_na "CHARSET1", /* 0x00000040 : "CHARSET" - 0x000000e0 */ "CHARSET2", /* 0x00000080 : "CHARSET" - 0x000000e0 */ "SPLIT", /* 0x00000100 */ - "ANCH_BOL", /* 0x00000200 */ - "ANCH_MBOL", /* 0x00000400 */ - "ANCH_SBOL", /* 0x00000800 */ - "ANCH_GPOS", /* 0x00001000 */ - "GPOS_SEEN", /* 0x00002000 */ - "GPOS_FLOAT", /* 0x00004000 */ + "IS_ANCHORED", /* 0x00000200 */ + "UNUSED1", /* 0x00000400 */ + "UNUSED2", /* 0x00000800 */ + "UNUSED3", /* 0x00001000 */ + "UNUSED4", /* 0x00002000 */ + "UNUSED5", /* 0x00004000 */ "NO_INPLACE_SUBST", /* 0x00008000 */ "EVAL_SEEN", /* 0x00010000 */ - "CANY_SEEN", /* 0x00020000 */ - "NOSCAN", /* 0x00040000 */ + "UNUSED8", /* 0x00020000 */ + "UNBOUNDED_QUANTIFIER_SEEN",/* 0x00040000 */ "CHECK_ALL", /* 0x00080000 */ "MATCH_UTF8", /* 0x00100000 */ "USE_INTUIT_NOML", /* 0x00200000 */ @@ -686,6 +676,37 @@ EXTCONST char * const PL_reg_extflags_na }; #endif /* DOINIT */ +#ifdef DEBUGGING +# define REG_EXTFLAGS_NAME_SIZE 32 +#endif + +/* PL_reg_intflags_name[] - Opcode/state names in string form, for debugging */ + +#ifndef DOINIT +EXTCONST char * PL_reg_intflags_name[]; +#else +EXTCONST char * const PL_reg_intflags_name[] = { + "SKIP", /* 0x00000001 - PREGf_SKIP */ + "IMPLICIT", /* 0x00000002 - PREGf_IMPLICIT - Converted .* to ^.* */ + "NAUGHTY", /* 0x00000004 - PREGf_NAUGHTY - how exponential is this pattern? */ + "VERBARG_SEEN", /* 0x00000008 - PREGf_VERBARG_SEEN */ + "CUTGROUP_SEEN", /* 0x00000010 - PREGf_CUTGROUP_SEEN */ + "USE_RE_EVAL", /* 0x00000020 - PREGf_USE_RE_EVAL - compiled with "use re 'eval'" */ + "NOSCAN", /* 0x00000040 - PREGf_NOSCAN */ + "CANY_SEEN", /* 0x00000080 - PREGf_CANY_SEEN */ + "GPOS_SEEN", /* 0x00000100 - PREGf_GPOS_SEEN */ + "GPOS_FLOAT", /* 0x00000200 - PREGf_GPOS_FLOAT */ + "ANCH_BOL", /* 0x00000400 - PREGf_ANCH_BOL */ + "ANCH_MBOL", /* 0x00000800 - PREGf_ANCH_MBOL */ + "ANCH_SBOL", /* 0x00001000 - PREGf_ANCH_SBOL */ + "ANCH_GPOS", /* 0x00002000 - PREGf_ANCH_GPOS */ +}; +#endif /* DOINIT */ + +#ifdef DEBUGGING +# define REG_INTFLAGS_NAME_SIZE 14 +#endif + /* The following have no fixed length. U8 so we can do strchr() on it. */ #define REGNODE_VARIES(node) (PL_varies_bitmask[(node) >> 3] & (1 << ((node) & 7))) @@ -704,7 +725,7 @@ EXTCONST U8 PL_varies[] __attribute__dep EXTCONST U8 PL_varies_bitmask[]; #else EXTCONST U8 PL_varies_bitmask[] = { - 0x00, 0x00, 0x00, 0x00, 0x07, 0xF0, 0xE7, 0x7F, 0x26, 0x00, 0x00, 0x00 + 0x00, 0x00, 0x00, 0xC0, 0x01, 0xFC, 0xF9, 0x9F, 0x09, 0x00, 0x00, 0x00 }; #endif /* DOINIT */ @@ -716,8 +737,8 @@ EXTCONST U8 PL_varies_bitmask[] = { EXTCONST U8 PL_simple[] __attribute__deprecated__; #else EXTCONST U8 PL_simple[] __attribute__deprecated__ = { - REG_ANY, SANY, CANY, ANYOF, ANYOF_WARN_SUPER, ANYOF_SYNTHETIC, POSIXD, - POSIXL, POSIXU, POSIXA, NPOSIXD, NPOSIXL, NPOSIXU, NPOSIXA, + REG_ANY, SANY, CANY, ANYOF, POSIXD, POSIXL, POSIXU, POSIXA, NPOSIXD, + NPOSIXL, NPOSIXU, NPOSIXA, 0 }; #endif /* DOINIT */ @@ -726,7 +747,7 @@ EXTCONST U8 PL_simple[] __attribute__dep EXTCONST U8 PL_simple_bitmask[]; #else EXTCONST U8 PL_simple_bitmask[] = { - 0x00, 0x00, 0xFC, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + 0x00, 0x00, 0xFC, 0x3F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; #endif /* DOINIT */ Index: gnu/usr.bin/perl/runtests.SH =================================================================== RCS file: /mnt/memory/perl/importit/cvs/src/gnu/usr.bin/perl/runtests.SH,v retrieving revision 1.1.1.2 diff -u -p -u -p -r1.1.1.2 runtests.SH --- gnu/usr.bin/perl/runtests.SH 24 Mar 2014 14:58:47 -0000 1.1.1.2 +++ gnu/usr.bin/perl/runtests.SH 16 Nov 2014 03:22:24 -0000 @@ -16,21 +16,26 @@ case "$0" in esac echo "Extracting runtests (with variable substitutions)" rm -f runtests + $spitshell >runtests <>runtests <<'!NO!SUBS!' -export PATH || (echo "OOPS, this isn't sh. Desperation time. I will feed myself to sh."; sh \$0; kill \$\$) +export PATH || (echo "OOPS, this isn't sh. Desperation time. I will feed myself to sh."; sh $0; kill $$) -case \$# in +case $# in 0) echo "runtests tty_flag ..." exit 1 ;; esac -case \$1 in +case $1 in tty) tty=Y ;; @@ -50,23 +55,31 @@ case \$1 in ;; esac -if test X"\$TESTFILE" = X; then +if test X"$TESTFILE" = X; then TESTFILE=TEST fi -if test X"\$PERL" = X; then - PERL=./perl$_exe - export PERL -fi - cd t +# If this is run under an old shell that doesn't automatically +# update PWD, then we must update it. Otherwise, t/io/fs.t gets +# mixed up about what directory we are in. +case "$PWD" in + '') ;; # Do nothing if it isn't set at all. + */t) ;; # Leave it alone if it's properly updated. + *) PWD=${PWD}/t; export PWD ;; # Otherwise, fix it. +esac + +!NO!SUBS! + +## In the following, dollars and backticks do need the extra backslash. +$spitshell >>runtests < rantests Index: gnu/usr.bin/perl/scope.c =================================================================== RCS file: /mnt/memory/perl/importit/cvs/src/gnu/usr.bin/perl/scope.c,v retrieving revision 1.15 diff -u -p -u -p -r1.15 scope.c --- gnu/usr.bin/perl/scope.c 24 Mar 2014 15:05:13 -0000 1.15 +++ gnu/usr.bin/perl/scope.c 16 Nov 2014 03:22:24 -0000 @@ -27,7 +27,7 @@ #include "perl.h" SV** -Perl_stack_grow(pTHX_ SV **sp, SV **p, int n) +Perl_stack_grow(pTHX_ SV **sp, SV **p, SSize_t n) { dVAR; @@ -88,7 +88,7 @@ void Perl_push_scope(pTHX) { dVAR; - if (PL_scopestack_ix == PL_scopestack_max) { + if (UNLIKELY(PL_scopestack_ix == PL_scopestack_max)) { PL_scopestack_max = GROW(PL_scopestack_max); Renew(PL_scopestack, PL_scopestack_max, I32); #ifdef DEBUGGING @@ -141,7 +141,7 @@ Perl_savestack_grow_cnt(pTHX_ I32 need) #undef GROW void -Perl_tmps_grow(pTHX_ I32 n) +Perl_tmps_grow(pTHX_ SSize_t n) { dVAR; #ifndef STRESS_REALLOC @@ -158,13 +158,13 @@ Perl_free_tmps(pTHX) { dVAR; /* XXX should tmps_floor live in cxstack? */ - const I32 myfloor = PL_tmps_floor; + const SSize_t myfloor = PL_tmps_floor; while (PL_tmps_ix > myfloor) { /* clean up after last statement */ SV* const sv = PL_tmps_stack[PL_tmps_ix--]; #ifdef PERL_POISON PoisonWith(PL_tmps_stack + PL_tmps_ix + 1, 1, SV *, 0xAB); #endif - if (sv && sv != &PL_sv_undef) { + if (LIKELY(sv && sv != &PL_sv_undef)) { SvTEMP_off(sv); SvREFCNT_dec_NN(sv); /* note, can modify tmps_ix!!! */ } @@ -214,7 +214,7 @@ Perl_save_scalar(pTHX_ GV *gv) PERL_ARGS_ASSERT_SAVE_SCALAR; - if (SvGMAGICAL(*sptr)) { + if (UNLIKELY(SvGMAGICAL(*sptr))) { PL_localizing = 1; (void)mg_get(*sptr); PL_localizing = 0; @@ -321,13 +321,13 @@ Perl_save_ary(pTHX_ GV *gv) PERL_ARGS_ASSERT_SAVE_ARY; - if (!AvREAL(oav) && AvREIFY(oav)) + if (UNLIKELY(!AvREAL(oav) && AvREIFY(oav))) av_reify(oav); save_pushptrptr(SvREFCNT_inc_simple_NN(gv), oav, SAVEt_AV); GvAV(gv) = NULL; av = GvAVn(gv); - if (SvMAGIC(oav)) + if (UNLIKELY(SvMAGIC(oav))) mg_localize(MUTABLE_SV(oav), MUTABLE_SV(av), TRUE); return av; } @@ -346,7 +346,7 @@ Perl_save_hash(pTHX_ GV *gv) GvHV(gv) = NULL; hv = GvHVn(gv); - if (SvMAGIC(ohv)) + if (UNLIKELY(SvMAGIC(ohv))) mg_localize(MUTABLE_SV(ohv), MUTABLE_SV(hv), TRUE); return hv; } @@ -400,7 +400,7 @@ Perl_save_int(pTHX_ int *intp) PERL_ARGS_ASSERT_SAVE_INT; - if ((int)(type >> SAVE_TIGHT_SHIFT) != i) { + if (UNLIKELY((int)(type >> SAVE_TIGHT_SHIFT) != i)) { SS_ADD_INT(i); type = SAVEt_INT; size++; @@ -447,7 +447,7 @@ Perl_save_I32(pTHX_ I32 *intp) PERL_ARGS_ASSERT_SAVE_I32; - if ((I32)(type >> SAVE_TIGHT_SHIFT) != i) { + if (UNLIKELY((I32)(type >> SAVE_TIGHT_SHIFT) != i)) { SS_ADD_INT(i); type = SAVEt_I32; size++; @@ -457,6 +457,20 @@ Perl_save_I32(pTHX_ I32 *intp) SS_ADD_END(size); } +void +Perl_save_strlen(pTHX_ STRLEN *ptr) +{ + dVAR; + dSS_ADD; + + PERL_ARGS_ASSERT_SAVE_STRLEN; + + SS_ADD_IV(*ptr); + SS_ADD_PTR(ptr); + SS_ADD_UV(SAVEt_STRLEN); + SS_ADD_END(3); +} + /* Cannot use save_sptr() to store a char* since the SV** cast will * force word-alignment and we'll miss the pointer. */ @@ -545,7 +559,7 @@ Perl_save_clearsv(pTHX_ SV **svp) ASSERT_CURPAD_ACTIVE("save_clearsv"); SvPADSTALE_off(*svp); /* mark lexical as active */ - if ((offset_shifted >> SAVE_TIGHT_SHIFT) != offset) { + if (UNLIKELY((offset_shifted >> SAVE_TIGHT_SHIFT) != offset)) { Perl_croak(aTHX_ "panic: pad offset %"UVuf" out of range (%p-%p)", offset, svp, PL_curpad); } @@ -583,14 +597,18 @@ Perl_save_hdelete(pTHX_ HV *hv, SV *keys } void -Perl_save_adelete(pTHX_ AV *av, I32 key) +Perl_save_adelete(pTHX_ AV *av, SSize_t key) { dVAR; + dSS_ADD; PERL_ARGS_ASSERT_SAVE_ADELETE; SvREFCNT_inc_void(av); - save_pushi32ptr(key, av, SAVEt_ADELETE); + SS_ADD_UV(key); + SS_ADD_PTR(av); + SS_ADD_IV(SAVEt_ADELETE); + SS_ADD_END(3); } void @@ -647,19 +665,23 @@ S_save_pushptri32ptr(pTHX_ void *const p } void -Perl_save_aelem_flags(pTHX_ AV *av, I32 idx, SV **sptr, const U32 flags) +Perl_save_aelem_flags(pTHX_ AV *av, SSize_t idx, SV **sptr, + const U32 flags) { - dVAR; + dVAR; dSS_ADD; SV *sv; PERL_ARGS_ASSERT_SAVE_AELEM_FLAGS; SvGETMAGIC(*sptr); - save_pushptri32ptr(SvREFCNT_inc_simple(av), idx, SvREFCNT_inc(*sptr), - SAVEt_AELEM); + SS_ADD_PTR(SvREFCNT_inc_simple(av)); + SS_ADD_IV(idx); + SS_ADD_PTR(SvREFCNT_inc(*sptr)); + SS_ADD_UV(SAVEt_AELEM); + SS_ADD_END(4); /* The array needs to hold a reference count on its new element, so it must be AvREAL. */ - if (!AvREAL(av) && AvREIFY(av)) + if (UNLIKELY(!AvREAL(av) && AvREIFY(av))) av_reify(av); save_scalar_at(sptr, flags); /* XXX - FIXME - see #60360 */ if (flags & SAVEf_KEEPOLDELEM) @@ -669,7 +691,7 @@ Perl_save_aelem_flags(pTHX_ AV *av, I32 * won't actually be stored in the array - so it won't get * reaped when the localize ends. Ensure it gets reaped by * mortifying it instead. DAPM */ - if (SvTIED_mg((const SV *)av, PERL_MAGIC_tied)) + if (UNLIKELY(SvTIED_mg((const SV *)av, PERL_MAGIC_tied))) sv_2mortal(sv); } @@ -698,7 +720,7 @@ Perl_save_helem_flags(pTHX_ HV *hv, SV * * won't actually be stored in the hash - so it won't get * reaped when the localize ends. Ensure it gets reaped by * mortifying it instead. DAPM */ - if (SvTIED_mg((const SV *)hv, PERL_MAGIC_tied)) + if (UNLIKELY(SvTIED_mg((const SV *)hv, PERL_MAGIC_tied))) sv_2mortal(sv); } @@ -723,7 +745,7 @@ Perl_save_alloc(pTHX_ I32 size, I32 pad) const UV elems = 1 + ((size + pad - 1) / sizeof(*PL_savestack)); const UV elems_shifted = elems << SAVE_TIGHT_SHIFT; - if ((elems_shifted >> SAVE_TIGHT_SHIFT) != elems) + if (UNLIKELY((elems_shifted >> SAVE_TIGHT_SHIFT) != elems)) Perl_croak(aTHX_ "panic: save_alloc elems %"UVuf" out of range (%"IVdf"-%"IVdf")", elems, (IV)size, (IV)pad); @@ -776,7 +798,7 @@ Perl_leave_scope(pTHX_ I32 base) arg1.any_ptr = NULL; arg2.any_ptr = NULL; - if (base < -1) + if (UNLIKELY(base < -1)) Perl_croak(aTHX_ "panic: corrupt saved stack index %ld", (long) base); DEBUG_l(Perl_deb(aTHX_ "savestack: releasing items %ld -> %ld\n", (long)PL_savestack_ix, (long)base)); @@ -811,7 +833,7 @@ Perl_leave_scope(pTHX_ I32 base) switch (type) { case SAVEt_ITEM: /* normal string */ sv_replace(ARG1_SV, ARG0_SV); - if (SvSMAGICAL(ARG1_SV)) { + if (UNLIKELY(SvSMAGICAL(ARG1_SV))) { PL_localizing = 2; mg_set(ARG1_SV); PL_localizing = 0; @@ -833,7 +855,7 @@ Perl_leave_scope(pTHX_ I32 base) SV * const sv = *svp; *svp = ARG0_SV; SvREFCNT_dec(sv); - if (SvSMAGICAL(ARG0_SV)) { + if (UNLIKELY(SvSMAGICAL(ARG0_SV))) { PL_localizing = 2; mg_set(ARG0_SV); PL_localizing = 0; @@ -891,7 +913,7 @@ Perl_leave_scope(pTHX_ I32 base) case SAVEt_AV: /* array reference */ SvREFCNT_dec(GvAV(ARG1_GV)); GvAV(ARG1_GV) = ARG0_AV; - if (SvSMAGICAL(ARG0_SV)) { + if (UNLIKELY(SvSMAGICAL(ARG0_SV))) { PL_localizing = 2; mg_set(ARG0_SV); PL_localizing = 0; @@ -901,7 +923,7 @@ Perl_leave_scope(pTHX_ I32 base) case SAVEt_HV: /* hash reference */ SvREFCNT_dec(GvHV(ARG1_GV)); GvHV(ARG1_GV) = ARG0_HV; - if (SvSMAGICAL(ARG0_SV)) { + if (UNLIKELY(SvSMAGICAL(ARG0_SV))) { PL_localizing = 2; mg_set(ARG0_SV); PL_localizing = 0; @@ -914,12 +936,15 @@ Perl_leave_scope(pTHX_ I32 base) case SAVEt_INT: /* int reference */ *(int*)ARG0_PTR = (int)ARG1_I32; break; + case SAVEt_STRLEN: /* STRLEN/size_t ref */ + *(STRLEN*)ARG0_PTR = (STRLEN)arg1.any_iv; + break; case SAVEt_BOOL: /* bool reference */ *(bool*)ARG0_PTR = cBOOL(uv >> 8); #ifdef NO_TAINT_SUPPORT PERL_UNUSED_VAR(was); #else - if (ARG0_PTR == &(TAINT_get)) { + if (UNLIKELY(ARG0_PTR == &(TAINT_get))) { /* If we don't update , to reflect what was saved on the * stack for PL_tainted, then we will overwrite this attempt to * restore it when we exit this routine. Note that this won't @@ -1011,28 +1036,46 @@ Perl_leave_scope(pTHX_ I32 base) (SvREFCNT(sv) <= 1 && !SvOBJECT(sv)) ? "clear" : "abandon" )); + assert(SvPADMY(sv)); + /* Can clear pad variable in place? */ - if (SvREFCNT(sv) <= 1 && !SvOBJECT(sv)) { - /* - * if a my variable that was made readonly is going out of - * scope, we want to remove the readonlyness so that it can - * go out of scope quietly - */ - if (SvPADMY(sv) && !SvFAKE(sv)) - SvREADONLY_off(sv); - - if (SvTHINKFIRST(sv)) - sv_force_normal_flags(sv, SV_IMMEDIATE_UNREF - |SV_COW_DROP_PV); - if (SvTYPE(sv) == SVt_PVHV) - Perl_hv_kill_backrefs(aTHX_ MUTABLE_HV(sv)); - if (SvMAGICAL(sv)) + if (SvREFCNT(sv) == 1 && !SvOBJECT(sv)) { + + /* these flags are the union of all the relevant flags + * in the individual conditions within */ + if (UNLIKELY(SvFLAGS(sv) & ( + SVf_READONLY /* for SvREADONLY_off() */ + | (SVs_GMG|SVs_SMG|SVs_RMG) /* SvMAGICAL() */ + | SVf_OOK + | SVf_THINKFIRST))) { - sv_unmagic(sv, PERL_MAGIC_backref); - if (SvTYPE(sv) != SVt_PVCV) - mg_free(sv); - } + /* if a my variable that was made readonly is + * going out of scope, we want to remove the + * readonlyness so that it can go out of scope + * quietly + */ + if (SvREADONLY(sv) && !SvFAKE(sv)) + SvREADONLY_off(sv); + + if (SvOOK(sv)) { /* OOK or HvAUX */ + if (SvTYPE(sv) == SVt_PVHV) + Perl_hv_kill_backrefs(aTHX_ MUTABLE_HV(sv)); + else + sv_backoff(sv); + } + + if (SvMAGICAL(sv)) { + /* note that backrefs (either in HvAUX or magic) + * must be removed before other magic */ + sv_unmagic(sv, PERL_MAGIC_backref); + if (SvTYPE(sv) != SVt_PVCV) + mg_free(sv); + } + if (SvTHINKFIRST(sv)) + sv_force_normal_flags(sv, SV_IMMEDIATE_UNREF + |SV_COW_DROP_PV); + } switch (SvTYPE(sv)) { case SVt_NULL: break; @@ -1052,7 +1095,12 @@ Perl_leave_scope(pTHX_ I32 base) break; } default: - SvOK_off(sv); + /* This looks odd, but these two macros are for use in + expressions and finish with a trailing comma, so + adding a ; after them would be wrong. */ + assert_not_ROK(sv) + assert_not_glob(sv) + SvFLAGS(sv) &=~ (SVf_OK|SVf_IVisUV|SVf_UTF8); break; } SvPADSTALE_on(sv); /* mark as no longer live */ @@ -1090,7 +1138,7 @@ Perl_leave_scope(pTHX_ I32 base) Safefree(arg2.any_ptr); break; case SAVEt_ADELETE: - (void)av_delete(ARG0_AV, ARG1_I32, G_DISCARD); + (void)av_delete(ARG0_AV, arg1.any_iv, G_DISCARD); SvREFCNT_dec(ARG0_AV); break; case SAVEt_DESTRUCTOR_X: @@ -1104,17 +1152,14 @@ Perl_leave_scope(pTHX_ I32 base) case SAVEt_STACK_POS: /* Position on Perl stack */ PL_stack_sp = PL_stack_base + arg0.any_i32; break; - case SAVEt_STACK_CXPOS: /* blk_oldsp on context stack */ - cxstack[ARG0_I32].blk_oldsp = ARG1_I32; - break; case SAVEt_AELEM: /* array element */ - svp = av_fetch(ARG2_AV, ARG1_I32, 1); - if (!AvREAL(ARG2_AV) && AvREIFY(ARG2_AV)) /* undo reify guard */ + svp = av_fetch(ARG2_AV, arg1.any_iv, 1); + if (UNLIKELY(!AvREAL(ARG2_AV) && AvREIFY(ARG2_AV))) /* undo reify guard */ SvREFCNT_dec(ARG0_SV); - if (svp) { + if (LIKELY(svp)) { SV * const sv = *svp; - if (sv && sv != &PL_sv_undef) { - if (SvTIED_mg((const SV *)ARG2_AV, PERL_MAGIC_tied)) + if (LIKELY(sv && sv != &PL_sv_undef)) { + if (UNLIKELY(SvTIED_mg((const SV *)ARG2_AV, PERL_MAGIC_tied))) SvREFCNT_inc_void_NN(sv); refsv = ARG2_SV; goto restore_sv; @@ -1127,11 +1172,11 @@ Perl_leave_scope(pTHX_ I32 base) { HE * const he = hv_fetch_ent(ARG2_HV, ARG1_SV, 1, 0); SvREFCNT_dec(ARG1_SV); - if (he) { + if (LIKELY(he)) { const SV * const oval = HeVAL(he); - if (oval && oval != &PL_sv_undef) { + if (LIKELY(oval && oval != &PL_sv_undef)) { svp = &HeVAL(he); - if (SvTIED_mg((const SV *)ARG2_HV, PERL_MAGIC_tied)) + if (UNLIKELY(SvTIED_mg((const SV *)ARG2_HV, PERL_MAGIC_tied))) SvREFCNT_inc_void(*svp); refsv = ARG2_SV; /* what to refcnt_dec */ goto restore_sv; @@ -1170,7 +1215,7 @@ Perl_leave_scope(pTHX_ I32 base) break; case SAVEt_COMPPAD: PL_comppad = (PAD*)ARG0_PTR; - if (PL_comppad) + if (LIKELY(PL_comppad)) PL_curpad = AvARRAY(PL_comppad); else PL_curpad = NULL; @@ -1225,22 +1270,11 @@ Perl_leave_scope(pTHX_ I32 base) PL_compiling.cop_warnings = (STRLEN*)ARG0_PTR; break; - case SAVEt_RE_STATE: - { - const struct re_save_state *const state - = (struct re_save_state *) - (PL_savestack + PL_savestack_ix - - SAVESTACK_ALLOC_FOR_RE_SAVE_STATE); - PL_savestack_ix -= SAVESTACK_ALLOC_FOR_RE_SAVE_STATE; - - if (PL_reg_poscache != state->re_state_reg_poscache) { - Safefree(PL_reg_poscache); - } - Copy(state, &PL_reg_state, 1, struct re_save_state); - } - break; case SAVEt_PARSER: parser_free((yy_parser *) ARG0_PTR); + break; + case SAVEt_READONLY_OFF: + SvREADONLY_off(ARG0_SV); break; default: Perl_croak(aTHX_ "panic: leave_scope inconsistency %u", type); Index: gnu/usr.bin/perl/scope.h =================================================================== RCS file: /mnt/memory/perl/importit/cvs/src/gnu/usr.bin/perl/scope.h,v retrieving revision 1.15 diff -u -p -u -p -r1.15 scope.h --- gnu/usr.bin/perl/scope.h 24 Mar 2014 15:05:13 -0000 1.15 +++ gnu/usr.bin/perl/scope.h 16 Nov 2014 03:22:24 -0000 @@ -16,7 +16,7 @@ #define SAVEt_CLEARPADRANGE 1 #define SAVEt_CLEARSV 2 #define SAVEt_REGCONTEXT 3 -#define SAVEt_RE_STATE 4 +/*** SPARE 4 ***/ #define SAVEt_ARG0_MAX 4 @@ -38,12 +38,12 @@ #define SAVEt_OP 18 #define SAVEt_PARSER 19 #define SAVEt_STACK_POS 20 +#define SAVEt_READONLY_OFF 21 -#define SAVEt_ARG1_MAX 20 +#define SAVEt_ARG1_MAX 21 /* two args */ -#define SAVEt_ADELETE 21 #define SAVEt_APTR 22 #define SAVEt_AV 23 #define SAVEt_DESTRUCTOR 24 @@ -64,21 +64,22 @@ #define SAVEt_SAVESWITCHSTACK 39 #define SAVEt_SHARED_PVREF 40 #define SAVEt_SPTR 41 -#define SAVEt_STACK_CXPOS 42 +#define SAVEt_STRLEN 42 #define SAVEt_SV 43 #define SAVEt_SVREF 44 #define SAVEt_VPTR 45 +#define SAVEt_ADELETE 46 -#define SAVEt_ARG2_MAX 45 +#define SAVEt_ARG2_MAX 46 /* three args */ -#define SAVEt_AELEM 46 #define SAVEt_DELETE 47 #define SAVEt_HELEM 48 #define SAVEt_PADSV_AND_MORTALIZE 49 #define SAVEt_SET_SVFLAGS 50 #define SAVEt_GVSLOT 51 +#define SAVEt_AELEM 52 #define SAVEf_SETMAGIC 1 #define SAVEf_KEEPOLDELEM 2 @@ -97,8 +98,8 @@ * macros */ #define SS_MAXPUSH 4 -#define SSCHECK(need) if (PL_savestack_ix + (I32)(need) + SS_MAXPUSH > PL_savestack_max) savestack_grow() -#define SSGROW(need) if (PL_savestack_ix + (I32)(need) + SS_MAXPUSH > PL_savestack_max) savestack_grow_cnt(need + SS_MAXPUSH) +#define SSCHECK(need) if (UNLIKELY(PL_savestack_ix + (I32)(need) + SS_MAXPUSH > PL_savestack_max)) savestack_grow() +#define SSGROW(need) if (UNLIKELY(PL_savestack_ix + (I32)(need) + SS_MAXPUSH > PL_savestack_max)) savestack_grow_cnt(need + SS_MAXPUSH) #define SSPUSHINT(i) (PL_savestack[PL_savestack_ix++].any_i32 = (I32)(i)) #define SSPUSHLONG(i) (PL_savestack[PL_savestack_ix++].any_long = (long)(i)) #define SSPUSHBOOL(p) (PL_savestack[PL_savestack_ix++].any_bool = (p)) @@ -122,14 +123,14 @@ #define dSS_ADD \ I32 ix = PL_savestack_ix; \ - ANY *ssp = &PL_savestack[ix]; + ANY *ssp = &PL_savestack[ix] #define SS_ADD_END(need) \ assert((need) <= SS_MAXPUSH); \ ix += (need); \ PL_savestack_ix = ix; \ assert(ix <= PL_savestack_max); \ - if ((ix + SS_MAXPUSH) > PL_savestack_max) savestack_grow(); \ + if (UNLIKELY((ix + SS_MAXPUSH) > PL_savestack_max)) savestack_grow(); \ assert(PL_savestack_ix + SS_MAXPUSH <= PL_savestack_max); #define SS_ADD_INT(i) ((ssp++)->any_i32 = (I32)(i)) @@ -185,7 +186,8 @@ scope has the given name. Name must be a =cut */ -#define SAVETMPS save_int((int*)&PL_tmps_floor), PL_tmps_floor = PL_tmps_ix +#define SAVETMPS Perl_save_strlen(aTHX_ (STRLEN *)&PL_tmps_floor), \ + PL_tmps_floor = PL_tmps_ix #define FREETMPS if (PL_tmps_ix > PL_tmps_floor) free_tmps() #ifdef DEBUGGING @@ -252,7 +254,7 @@ scope has the given name. Name must be a #define SAVEHDELETE(h,s) \ save_hdelete(MUTABLE_HV(h), (s)) #define SAVEADELETE(a,k) \ - save_adelete(MUTABLE_AV(a), (I32)(k)) + save_adelete(MUTABLE_AV(a), (SSize_t)(k)) #define SAVEDESTRUCTOR(f,p) \ save_destructor((DESTRUCTORFUNC_NOCONTEXT_t)(f), (void*)(p)) @@ -286,15 +288,6 @@ scope has the given name. Name must be a as it simplifies the code that does the saves, and reduces the load on the save stack. */ #define SAVECOMPILEWARNINGS() save_pushptr(PL_compiling.cop_warnings, SAVEt_COMPILE_WARNINGS) - -#define SAVESTACK_CXPOS() \ - STMT_START { \ - dSS_ADD; \ - SS_ADD_INT(cxstack[cxstack_ix].blk_oldsp); \ - SS_ADD_INT(cxstack_ix); \ - SS_ADD_UV(SAVEt_STACK_CXPOS); \ - SS_ADD_END(3); \ - } STMT_END #define SAVEPARSER(p) save_pushptr((p), SAVEt_PARSER) Index: gnu/usr.bin/perl/shlib_version =================================================================== RCS file: /mnt/memory/perl/importit/cvs/src/gnu/usr.bin/perl/shlib_version,v retrieving revision 1.16 diff -u -p -u -p -r1.16 shlib_version --- gnu/usr.bin/perl/shlib_version 24 Mar 2014 15:05:13 -0000 1.16 +++ gnu/usr.bin/perl/shlib_version 16 Nov 2014 03:22:24 -0000 @@ -1,2 +1,2 @@ -major=15 -minor=0 +major=16 +minor=90 Index: gnu/usr.bin/perl/sv.c =================================================================== RCS file: /mnt/memory/perl/importit/cvs/src/gnu/usr.bin/perl/sv.c,v retrieving revision 1.19 diff -u -p -u -p -r1.19 sv.c --- gnu/usr.bin/perl/sv.c 24 Mar 2014 15:05:13 -0000 1.19 +++ gnu/usr.bin/perl/sv.c 16 Nov 2014 03:22:24 -0000 @@ -33,21 +33,86 @@ #include "regcomp.h" #ifndef HAS_C99 -# if __STDC_VERSION__ >= 199901L && !defined(VMS) +# if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L && !defined(VMS) # define HAS_C99 1 # endif #endif -#if HAS_C99 +#ifdef HAS_C99 # include #endif -#define FCALL *f - #ifdef __Lynx__ /* Missing proto on LynxOS */ char *gconvert(double, int, int, char *); #endif +#ifdef PERL_NEW_COPY_ON_WRITE +# ifndef SV_COW_THRESHOLD +# define SV_COW_THRESHOLD 0 /* COW iff len > K */ +# endif +# ifndef SV_COWBUF_THRESHOLD +# define SV_COWBUF_THRESHOLD 1250 /* COW iff len > K */ +# endif +# ifndef SV_COW_MAX_WASTE_THRESHOLD +# define SV_COW_MAX_WASTE_THRESHOLD 80 /* COW iff (len - cur) < K */ +# endif +# ifndef SV_COWBUF_WASTE_THRESHOLD +# define SV_COWBUF_WASTE_THRESHOLD 80 /* COW iff (len - cur) < K */ +# endif +# ifndef SV_COW_MAX_WASTE_FACTOR_THRESHOLD +# define SV_COW_MAX_WASTE_FACTOR_THRESHOLD 2 /* COW iff len < (cur * K) */ +# endif +# ifndef SV_COWBUF_WASTE_FACTOR_THRESHOLD +# define SV_COWBUF_WASTE_FACTOR_THRESHOLD 2 /* COW iff len < (cur * K) */ +# endif +#endif +/* Work around compiler warnings about unsigned >= THRESHOLD when thres- + hold is 0. */ +#if SV_COW_THRESHOLD +# define GE_COW_THRESHOLD(cur) ((cur) >= SV_COW_THRESHOLD) +#else +# define GE_COW_THRESHOLD(cur) 1 +#endif +#if SV_COWBUF_THRESHOLD +# define GE_COWBUF_THRESHOLD(cur) ((cur) >= SV_COWBUF_THRESHOLD) +#else +# define GE_COWBUF_THRESHOLD(cur) 1 +#endif +#if SV_COW_MAX_WASTE_THRESHOLD +# define GE_COW_MAX_WASTE_THRESHOLD(cur,len) (((len)-(cur)) < SV_COW_MAX_WASTE_THRESHOLD) +#else +# define GE_COW_MAX_WASTE_THRESHOLD(cur,len) 1 +#endif +#if SV_COWBUF_WASTE_THRESHOLD +# define GE_COWBUF_WASTE_THRESHOLD(cur,len) (((len)-(cur)) < SV_COWBUF_WASTE_THRESHOLD) +#else +# define GE_COWBUF_WASTE_THRESHOLD(cur,len) 1 +#endif +#if SV_COW_MAX_WASTE_FACTOR_THRESHOLD +# define GE_COW_MAX_WASTE_FACTOR_THRESHOLD(cur,len) ((len) < SV_COW_MAX_WASTE_FACTOR_THRESHOLD * (cur)) +#else +# define GE_COW_MAX_WASTE_FACTOR_THRESHOLD(cur,len) 1 +#endif +#if SV_COWBUF_WASTE_FACTOR_THRESHOLD +# define GE_COWBUF_WASTE_FACTOR_THRESHOLD(cur,len) ((len) < SV_COWBUF_WASTE_FACTOR_THRESHOLD * (cur)) +#else +# define GE_COWBUF_WASTE_FACTOR_THRESHOLD(cur,len) 1 +#endif + +#define CHECK_COW_THRESHOLD(cur,len) (\ + GE_COW_THRESHOLD((cur)) && \ + GE_COW_MAX_WASTE_THRESHOLD((cur),(len)) && \ + GE_COW_MAX_WASTE_FACTOR_THRESHOLD((cur),(len)) \ +) +#define CHECK_COWBUF_THRESHOLD(cur,len) (\ + GE_COWBUF_THRESHOLD((cur)) && \ + GE_COWBUF_WASTE_THRESHOLD((cur),(len)) && \ + GE_COWBUF_WASTE_FACTOR_THRESHOLD((cur),(len)) \ +) +/* void Gconvert: on Linux at least, gcvt (which Gconvert gets deffed to), + * has a mandatory return value, even though that value is just the same + * as the buf arg */ + #ifdef PERL_UTF8_CACHE_ASSERT /* if adding more checks watch out for the following tests: * t/op/index.t t/op/length.t t/op/pat.t t/op/substr.t @@ -419,7 +484,7 @@ S_visit(pTHX_ SVFUNC_t f, const U32 flag && (sv->sv_flags & mask) == flags && SvREFCNT(sv)) { - (FCALL)(aTHX_ sv); + (*f)(aTHX_ sv); ++visited; } } @@ -772,19 +837,19 @@ is "not there", because you'll be overwr preceding structure in memory.) We calculate the correction using the STRUCT_OFFSET macro on the first -member present. If the allocated structure is smaller (no initial NV +member present. If the allocated structure is smaller (no initial NV actually allocated) then the net effect is to subtract the size of the NV from the pointer, to return a new pointer as if an initial NV were actually -allocated. (We were using structures named *_allocated for this, but +allocated. (We were using structures named *_allocated for this, but this turned out to be a subtle bug, because a structure without an NV could have a lower alignment constraint, but the compiler is allowed to optimised accesses based on the alignment constraint of the actual pointer to the full structure, for example, using a single 64 bit load instruction because it "knows" that two adjacent 32 bit members will be 8-byte aligned.) -This is the same trick as was used for NV and IV bodies. Ironically it +This is the same trick as was used for NV and IV bodies. Ironically it doesn't need to be used for NV bodies any more, because NV is now at -the start of the structure. IV bodies don't need it either, because +the start of the structure. IV bodies don't need it either, because they are no longer allocated. In turn, the new_body_* allocators call S_new_body(), which invokes @@ -881,11 +946,6 @@ static const struct body_details bodies_ /* HEs use this offset for their arena. */ { 0, 0, 0, SVt_NULL, FALSE, NONV, NOARENA, 0 }, - /* The bind placeholder pretends to be an RV for now. - Also it's marked as "can't upgrade" to stop anyone using it before it's - implemented. */ - { 0, 0, 0, SVt_BIND, TRUE, NONV, NOARENA, 0 }, - /* IVs are in the head, so the allocation size is 0. */ { 0, sizeof(IV), /* This is used to copy out the IV body. */ @@ -903,6 +963,12 @@ static const struct body_details bodies_ SVt_PV, FALSE, NONV, HASARENA, FIT_ARENA(0, sizeof(XPV) - STRUCT_OFFSET(XPV, xpv_cur)) }, + { sizeof(XINVLIST) - STRUCT_OFFSET(XPV, xpv_cur), + copy_length(XINVLIST, is_offset) - STRUCT_OFFSET(XPV, xpv_cur), + + STRUCT_OFFSET(XPV, xpv_cur), + SVt_INVLIST, TRUE, NONV, HASARENA, + FIT_ARENA(0, sizeof(XINVLIST) - STRUCT_OFFSET(XPV, xpv_cur)) }, + { sizeof(XPVIV) - STRUCT_OFFSET(XPV, xpv_cur), copy_length(XPVIV, xiv_u) - STRUCT_OFFSET(XPV, xpv_cur), + STRUCT_OFFSET(XPV, xpv_cur), @@ -921,7 +987,7 @@ static const struct body_details bodies_ { sizeof(regexp), sizeof(regexp), 0, - SVt_REGEXP, FALSE, NONV, HASARENA, + SVt_REGEXP, TRUE, NONV, HASARENA, FIT_ARENA(0, sizeof(regexp)) }, @@ -1308,7 +1374,8 @@ Perl_sv_upgrade(pTHX_ SV *const sv, svty #ifndef NODEFAULT_SHAREKEYS HvSHAREKEYS_on(sv); /* key-sharing on by default */ #endif - HvMAX(sv) = 7; /* (start with 8 buckets) */ + /* start with PERL_HASH_DEFAULT_HvMAX+1 buckets: */ + HvMAX(sv) = PERL_HASH_DEFAULT_HvMAX; } /* SVt_NULL isn't the only thing upgraded to AV or HV. @@ -1339,6 +1406,7 @@ Perl_sv_upgrade(pTHX_ SV *const sv, svty case SVt_PVGV: case SVt_PVCV: case SVt_PVLV: + case SVt_INVLIST: case SVt_REGEXP: case SVt_PVMG: case SVt_PVNV: @@ -1467,6 +1535,8 @@ Use the C wrapper instead. =cut */ +static void S_sv_uncow(pTHX_ SV * const sv, const U32 flags); + char * Perl_sv_grow(pTHX_ SV *const sv, STRLEN newlen) { @@ -1474,17 +1544,6 @@ Perl_sv_grow(pTHX_ SV *const sv, STRLEN PERL_ARGS_ASSERT_SV_GROW; - if (PL_madskills && newlen >= 0x100000) { - PerlIO_printf(Perl_debug_log, - "Allocation too large: %"UVxf"\n", (UV)newlen); - } -#ifdef HAS_64K_LIMIT - if (newlen >= 0x10000) { - PerlIO_printf(Perl_debug_log, - "Allocation too large: %"UVxf"\n", (UV)newlen); - my_exit(1); - } -#endif /* HAS_64K_LIMIT */ if (SvROK(sv)) sv_unref(sv); if (SvTYPE(sv) < SVt_PV) { @@ -1496,24 +1555,38 @@ Perl_sv_grow(pTHX_ SV *const sv, STRLEN s = SvPVX_mutable(sv); if (newlen > SvLEN(sv)) newlen += 10 * (newlen - SvCUR(sv)); /* avoid copy each time */ -#ifdef HAS_64K_LIMIT - if (newlen >= 0x10000) - newlen = 0xFFFF; -#endif } else { - if (SvIsCOW(sv)) sv_force_normal(sv); + if (SvIsCOW(sv)) S_sv_uncow(aTHX_ sv, 0); s = SvPVX_mutable(sv); } +#ifdef PERL_NEW_COPY_ON_WRITE + /* the new COW scheme uses SvPVX(sv)[SvLEN(sv)-1] (if spare) + * to store the COW count. So in general, allocate one more byte than + * asked for, to make it likely this byte is always spare: and thus + * make more strings COW-able. + * If the new size is a big power of two, don't bother: we assume the + * caller wanted a nice 2^N sized block and will be annoyed at getting + * 2^N+1 */ + if (newlen & 0xff) + newlen++; +#endif + +#if defined(PERL_USE_MALLOC_SIZE) && defined(Perl_safesysmalloc_size) +#define PERL_UNWARANTED_CHUMMINESS_WITH_MALLOC +#endif + if (newlen > SvLEN(sv)) { /* need more room? */ STRLEN minlen = SvCUR(sv); minlen += (minlen >> PERL_STRLEN_EXPAND_SHIFT) + 10; if (newlen < minlen) newlen = minlen; -#ifndef Perl_safesysmalloc_size - newlen = PERL_STRLEN_ROUNDUP(newlen); +#ifndef PERL_UNWARANTED_CHUMMINESS_WITH_MALLOC + if (SvLEN(sv)) { + newlen = PERL_STRLEN_ROUNDUP(newlen); + } #endif if (SvLEN(sv) && s) { s = (char*)saferealloc(s, newlen); @@ -1525,7 +1598,7 @@ Perl_sv_grow(pTHX_ SV *const sv, STRLEN } } SvPV_set(sv, s); -#ifdef Perl_safesysmalloc_size +#ifdef PERL_UNWARANTED_CHUMMINESS_WITH_MALLOC /* Do this here, do it once, do it right, and then we will never get called back into sv_grow() unless there really is some growing needed. */ @@ -1738,10 +1811,12 @@ S_not_a_number(pTHX_ SV *const sv) const char * const end = s + SvCUR(sv); for ( ; s < end && d < limit; s++ ) { int ch = *s & 0xFF; - if (ch & 128 && !isPRINT_LC(ch)) { + if (! isASCII(ch) && !isPRINT_LC(ch)) { *d++ = 'M'; *d++ = '-'; - ch &= 127; + + /* Map to ASCII "equivalent" of Latin1 */ + ch = LATIN1_TO_NATIVE(NATIVE_TO_LATIN1(ch) & 127); } if (ch == '\n') { *d++ = '\\'; @@ -2231,10 +2306,8 @@ S_sv_2iuv_common(pTHX_ SV *const sv) if (isGV_with_GP(sv)) return glob_2number(MUTABLE_GV(sv)); - if (!SvPADTMP(sv)) { - if (!PL_localizing && ckWARN(WARN_UNINITIALIZED)) + if (!PL_localizing && ckWARN(WARN_UNINITIALIZED)) report_uninit(sv); - } if (SvTYPE(sv) < SVt_IV) /* Typically the caller expects that sv_any is not NULL now. */ sv_upgrade(sv, SVt_IV); @@ -2259,8 +2332,10 @@ Perl_sv_2iv_flags(pTHX_ SV *const sv, co { dVAR; - if (!sv) - return 0; + PERL_ARGS_ASSERT_SV_2IV_FLAGS; + + assert (SvTYPE(sv) != SVt_PVAV && SvTYPE(sv) != SVt_PVHV + && SvTYPE(sv) != SVt_PVFM); if (SvGMAGICAL(sv) && (flags & SV_GMAGIC)) mg_get(sv); @@ -2352,8 +2427,7 @@ Perl_sv_2uv_flags(pTHX_ SV *const sv, co { dVAR; - if (!sv) - return 0; + PERL_ARGS_ASSERT_SV_2UV_FLAGS; if (SvGMAGICAL(sv) && (flags & SV_GMAGIC)) mg_get(sv); @@ -2434,8 +2508,11 @@ NV Perl_sv_2nv_flags(pTHX_ SV *const sv, const I32 flags) { dVAR; - if (!sv) - return 0.0; + + PERL_ARGS_ASSERT_SV_2NV_FLAGS; + + assert (SvTYPE(sv) != SVt_PVAV && SvTYPE(sv) != SVt_PVHV + && SvTYPE(sv) != SVt_PVFM); if (SvGMAGICAL(sv) || SvVALID(sv) || isREGEXP(sv)) { /* FBMs use the space for SvIVX and SvNVX for other purposes, and use the same flag bit as SVf_IVisUV, so must not let them cache NVs. @@ -2633,7 +2710,7 @@ Perl_sv_2nv_flags(pTHX_ SV *const sv, co return 0.0; } - if (!PL_localizing && !SvPADTMP(sv) && ckWARN(WARN_UNINITIALIZED)) + if (!PL_localizing && ckWARN(WARN_UNINITIALIZED)) report_uninit(sv); assert (SvTYPE(sv) >= SVt_NV); /* Typically the caller expects that sv_any is not NULL now. */ @@ -2736,11 +2813,10 @@ Perl_sv_2pv_flags(pTHX_ SV *const sv, ST dVAR; char *s; - if (!sv) { - if (lp) - *lp = 0; - return (char *)""; - } + PERL_ARGS_ASSERT_SV_2PV_FLAGS; + + assert (SvTYPE(sv) != SVt_PVAV && SvTYPE(sv) != SVt_PVHV + && SvTYPE(sv) != SVt_PVFM); if (SvGMAGICAL(sv) && (flags & SV_GMAGIC)) mg_get(sv); if (SvROK(sv)) { @@ -2894,6 +2970,7 @@ Perl_sv_2pv_flags(pTHX_ SV *const sv, ST Move(ptr, s, len, char); s += len; *s = '\0'; + SvPOK_on(sv); } else if (SvNOK(sv)) { if (SvTYPE(sv) < SVt_PVNV) @@ -2907,14 +2984,34 @@ Perl_sv_2pv_flags(pTHX_ SV *const sv, ST /* The +20 is pure guesswork. Configure test needed. --jhi */ s = SvGROW_mutable(sv, NV_DIG + 20); /* some Xenix systems wipe out errno here */ - Gconvert(SvNVX(sv), NV_DIG, 0, s); + +#ifndef USE_LOCALE_NUMERIC + PERL_UNUSED_RESULT(Gconvert(SvNVX(sv), NV_DIG, 0, s)); + SvPOK_on(sv); +#else + { + DECLARE_STORE_LC_NUMERIC_SET_TO_NEEDED(); + PERL_UNUSED_RESULT(Gconvert(SvNVX(sv), NV_DIG, 0, s)); + + /* If the radix character is UTF-8, and actually is in the + * output, turn on the UTF-8 flag for the scalar */ + if (PL_numeric_local + && PL_numeric_radix_sv && SvUTF8(PL_numeric_radix_sv) + && instr(s, SvPVX_const(PL_numeric_radix_sv))) + { + SvUTF8_on(sv); + } + RESTORE_LC_NUMERIC(); + } + + /* We don't call SvPOK_on(), because it may come to pass that the + * locale changes so that the stringification we just did is no + * longer correct. We will have to re-stringify every time it is + * needed */ +#endif RESTORE_ERRNO; while (*s) s++; } -#ifdef hcx - if (s[-1] == '.') - *--s = '\0'; -#endif } else if (isGV_with_GP(sv)) { GV *const gv = MUTABLE_GV(sv); @@ -2938,7 +3035,7 @@ Perl_sv_2pv_flags(pTHX_ SV *const sv, ST *lp = 0; if (flags & SV_UNDEF_RETURNS_NULL) return NULL; - if (!PL_localizing && !SvPADTMP(sv) && ckWARN(WARN_UNINITIALIZED)) + if (!PL_localizing && ckWARN(WARN_UNINITIALIZED)) report_uninit(sv); /* Typically the caller expects that sv_any is not NULL now. */ if (!SvREADONLY(sv) && SvTYPE(sv) < SVt_PV) @@ -2952,7 +3049,6 @@ Perl_sv_2pv_flags(pTHX_ SV *const sv, ST *lp = len; SvCUR_set(sv, len); } - SvPOK_on(sv); DEBUG_c(PerlIO_printf(Perl_debug_log, "0x%"UVxf" 2pv(%s)\n", PTR2UV(sv),SvPVX_const(sv))); if (flags & SV_CONST_RETURN) @@ -3028,13 +3124,13 @@ Perl_sv_2pvbyte(pTHX_ SV *sv, STRLEN *co { PERL_ARGS_ASSERT_SV_2PVBYTE; + SvGETMAGIC(sv); if (((SvREADONLY(sv) || SvFAKE(sv)) && !SvIsCOW(sv)) || isGV_with_GP(sv) || SvROK(sv)) { SV *sv2 = sv_newmortal(); - sv_copypv(sv2,sv); + sv_copypv_nomg(sv2,sv); sv = sv2; } - else SvGETMAGIC(sv); sv_utf8_downgrade(sv,0); return lp ? SvPV_nomg(sv,*lp) : SvPV_nomg_nolen(sv); } @@ -3083,12 +3179,13 @@ contain SV_GMAGIC, then it does an mg_ge */ bool -Perl_sv_2bool_flags(pTHX_ SV *const sv, const I32 flags) +Perl_sv_2bool_flags(pTHX_ SV *sv, I32 flags) { dVAR; PERL_ARGS_ASSERT_SV_2BOOL_FLAGS; + restart: if(flags & SV_GMAGIC) SvGETMAGIC(sv); if (!SvOK(sv)) @@ -3096,11 +3193,36 @@ Perl_sv_2bool_flags(pTHX_ SV *const sv, if (SvROK(sv)) { if (SvAMAGIC(sv)) { SV * const tmpsv = AMG_CALLunary(sv, bool__amg); - if (tmpsv && (!SvROK(tmpsv) || (SvRV(tmpsv) != SvRV(sv)))) - return cBOOL(SvTRUE(tmpsv)); + if (tmpsv && (!SvROK(tmpsv) || (SvRV(tmpsv) != SvRV(sv)))) { + bool svb; + sv = tmpsv; + if(SvGMAGICAL(sv)) { + flags = SV_GMAGIC; + goto restart; /* call sv_2bool */ + } + /* expanded SvTRUE_common(sv, (flags = 0, goto restart)) */ + else if(!SvOK(sv)) { + svb = 0; + } + else if(SvPOK(sv)) { + svb = SvPVXtrue(sv); + } + else if((SvFLAGS(sv) & (SVf_IOK|SVf_NOK))) { + svb = (SvIOK(sv) && SvIVX(sv) != 0) + || (SvNOK(sv) && SvNVX(sv) != 0.0); + } + else { + flags = 0; + goto restart; /* call sv_2bool_nomg */ + } + return cBOOL(svb); + } } return SvRV(sv) != 0; } + if (isREGEXP(sv)) + return + RX_WRAPLEN(sv) > 1 || (RX_WRAPLEN(sv) && *RX_WRAPPED(sv) != '0'); return SvTRUE_common(sv, isGV_with_GP(sv) ? 1 : 0); } @@ -3129,39 +3251,43 @@ Always sets the SvUTF8 flag to avoid fut if all the bytes are invariant in UTF-8. If C has C bit set, will C on C if appropriate, else not. -Returns the number of bytes in the converted string -C and -C are implemented in terms of this function. + +If C has SV_FORCE_UTF8_UPGRADE set, this function assumes that the PV +will expand when converted to UTF-8, and skips the extra work of checking for +that. Typically this flag is used by a routine that has already parsed the +string and found such characters, and passes this information on so that the +work doesn't have to be repeated. + +Returns the number of bytes in the converted string. This is not a general purpose byte encoding to Unicode interface: use the Encode extension for that. -=cut +=for apidoc sv_utf8_upgrade_flags_grow + +Like sv_utf8_upgrade_flags, but has an additional parameter C, which is +the number of unused bytes the string of 'sv' is guaranteed to have free after +it upon return. This allows the caller to reserve extra space that it intends +to fill, to avoid extra grows. + +C, C, and C +are implemented in terms of this function. + +Returns the number of bytes in the converted string (not including the spares). -The grow version is currently not externally documented. It adds a parameter, -extra, which is the number of unused bytes the string of 'sv' is guaranteed to -have free after it upon return. This allows the caller to reserve extra space -that it intends to fill, to avoid extra grows. - -Also externally undocumented for the moment is the flag SV_FORCE_UTF8_UPGRADE, -which can be used to tell this function to not first check to see if there are -any characters that are different in UTF-8 (variant characters) which would -force it to allocate a new string to sv, but to assume there are. Typically -this flag is used by a routine that has already parsed the string to find that -there are such characters, and passes this information on so that the work -doesn't have to be repeated. +=cut (One might think that the calling routine could pass in the position of the -first such variant, so it wouldn't have to be found again. But that is not the -case, because typically when the caller is likely to use this flag, it won't be -calling this routine unless it finds something that won't fit into a byte. -Otherwise it tries to not upgrade and just use bytes. But some things that -do fit into a byte are variants in utf8, and the caller may not have been -keeping track of these.) - -If the routine itself changes the string, it adds a trailing NUL. Such a NUL -isn't guaranteed due to having other routines do the work in some input cases, -or if the input is already flagged as being in utf8. +first variant character when it has set SV_FORCE_UTF8_UPGRADE, so it wouldn't +have to be found again. But that is not the case, because typically when the +caller is likely to use this flag, it won't be calling this routine unless it +finds something that won't fit into a byte. Otherwise it tries to not upgrade +and just use bytes. But some things that do fit into a byte are variants in +utf8, and the caller may not have been keeping track of these.) + +If the routine itself changes the string, it adds a trailing C. Such a +C isn't guaranteed due to having other routines do the work in some input +cases, or if the input is already flagged as being in utf8. The speed of this could perhaps be improved for many cases if someone wanted to write a fast function that counts the number of variant characters in a string, @@ -3197,7 +3323,7 @@ Perl_sv_utf8_upgrade_flags_grow(pTHX_ SV } if (SvIsCOW(sv)) { - sv_force_normal_flags(sv, 0); + S_sv_uncow(aTHX_ sv, 0); } if (PL_encoding && !(flags & SV_UTF8_NO_ENCODING)) { @@ -3227,7 +3353,7 @@ Perl_sv_utf8_upgrade_flags_grow(pTHX_ SV while (t < e) { const U8 ch = *t++; - if (NATIVE_IS_INVARIANT(ch)) continue; + if (NATIVE_BYTE_IS_INVARIANT(ch)) continue; t--; /* t already incremented; re-point to first variant */ two_byte_count = 1; @@ -3335,13 +3461,8 @@ must_be_utf8: } while (t < e) { - const UV uv = NATIVE8_TO_UNI(*t++); - if (UNI_IS_INVARIANT(uv)) - *d++ = (U8)UNI_TO_NATIVE(uv); - else { - *d++ = (U8)UTF8_EIGHT_BIT_HI(uv); - *d++ = (U8)UTF8_EIGHT_BIT_LO(uv); - } + append_utf8_from_native_byte(*t, &d); + t++; } *d = '\0'; SvPV_free(sv); /* No longer using pre-existing string */ @@ -3367,7 +3488,7 @@ must_be_utf8: while (d < e) { const U8 chr = *d++; - if (! NATIVE_IS_INVARIANT(chr)) two_byte_count++; + if (! NATIVE_BYTE_IS_INVARIANT(chr)) two_byte_count++; } /* The string will expand by just the number of bytes that @@ -3387,34 +3508,26 @@ must_be_utf8: e--; while (e >= t) { - const U8 ch = NATIVE8_TO_UNI(*e--); - if (UNI_IS_INVARIANT(ch)) { - *d-- = UNI_TO_NATIVE(ch); + if (NATIVE_BYTE_IS_INVARIANT(*e)) { + *d-- = *e; } else { - *d-- = (U8)UTF8_EIGHT_BIT_LO(ch); - *d-- = (U8)UTF8_EIGHT_BIT_HI(ch); + *d-- = UTF8_EIGHT_BIT_LO(*e); + *d-- = UTF8_EIGHT_BIT_HI(*e); } + e--; } } if (SvTYPE(sv) >= SVt_PVMG && SvMAGIC(sv)) { /* Update pos. We do it at the end rather than during * the upgrade, to avoid slowing down the common case - * (upgrade without pos) */ + * (upgrade without pos). + * pos can be stored as either bytes or characters. Since + * this was previously a byte string we can just turn off + * the bytes flag. */ MAGIC * mg = mg_find(sv, PERL_MAGIC_regex_global); if (mg) { - I32 pos = mg->mg_len; - if (pos > 0 && (U32)pos > invariant_head) { - U8 *d = (U8*) SvPVX(sv) + invariant_head; - STRLEN n = (U32)pos - invariant_head; - while (n > 0) { - if (UTF8_IS_START(*d)) - d++; - d++; - n--; - } - mg->mg_len = d - (U8*)SvPVX(sv); - } + mg->mg_flags &= ~MGf_BYTES; } if ((mg = mg_find(sv, PERL_MAGIC_utf8))) magic_setutf8(sv,mg); /* clear UTF8 cache */ @@ -3456,18 +3569,15 @@ Perl_sv_utf8_downgrade(pTHX_ SV *const s int mg_flags = SV_GMAGIC; if (SvIsCOW(sv)) { - sv_force_normal_flags(sv, 0); + S_sv_uncow(aTHX_ sv, 0); } if (SvTYPE(sv) >= SVt_PVMG && SvMAGIC(sv)) { /* update pos */ MAGIC * mg = mg_find(sv, PERL_MAGIC_regex_global); - if (mg) { - I32 pos = mg->mg_len; - if (pos > 0) { - sv_pos_b2u(sv, &pos); + if (mg && mg->mg_len > 0 && mg->mg_flags & MGf_BYTES) { + mg->mg_len = sv_pos_b2u_flags(sv, mg->mg_len, + SV_GMAGIC|SV_CONST_RETURN); mg_flags = 0; /* sv_pos_b2u does get magic */ - mg->mg_len = pos; - } } if ((mg = mg_find(sv, PERL_MAGIC_utf8))) magic_setutf8(sv,mg); /* clear UTF8 cache */ @@ -3556,6 +3666,9 @@ Perl_sv_utf8_decode(pTHX_ SV *const sv) } } if (SvTYPE(sv) >= SVt_PVMG && SvMAGIC(sv)) { + /* XXX Is this dead code? XS_utf8_decode calls SvSETMAGIC + after this, clearing pos. Does anything on CPAN + need this? */ /* adjust pos to the start of a UTF8 char sequence */ MAGIC * mg = mg_find(sv, PERL_MAGIC_regex_global); if (mg) { @@ -3580,9 +3693,10 @@ Perl_sv_utf8_decode(pTHX_ SV *const sv) Copies the contents of the source SV C into the destination SV C. The source SV may be destroyed if it is mortal, so don't use this -function if the source SV needs to be reused. Does not handle 'set' magic. -Loosely speaking, it performs a copy-by-value, obliterating any previous -content of the destination. +function if the source SV needs to be reused. Does not handle 'set' magic on +destination SV. Calls 'get' magic on source SV. Loosely speaking, it +performs a copy-by-value, obliterating any previous content of the +destination. You probably want to use one of the assortment of wrappers, such as C, C, C and @@ -3597,7 +3711,7 @@ Loosely speaking, it performs a copy-by- content of the destination. If the C parameter has the C bit set, will C on C if appropriate, else not. If the C -parameter has the C bit set then the +parameter has the C bit set then the buffers of temps will not be stolen. and C are implemented in terms of this function. @@ -3631,8 +3745,6 @@ S_glob_assign_glob(pTHX_ SV *const dstr, } SvUPGRADE(dstr, SVt_PVGV); (void)SvOK_off(dstr); - /* We have to turn this on here, even though we turn it off - below, as GvSTASH will fail an assertion otherwise. */ isGV_with_GP_on(dstr); } GvSTASH(dstr) = GvSTASH(sstr); @@ -3693,12 +3805,11 @@ S_glob_assign_glob(pTHX_ SV *const dstr, ); } } + + SvREFCNT_inc_simple_void_NN(sv_2mortal(dstr)); } gp_free(MUTABLE_GV(dstr)); - isGV_with_GP_off(dstr); /* SvOK_off does not like globs. */ - (void)SvOK_off(dstr); - isGV_with_GP_on(dstr); GvINTRO_off(dstr); /* one-shot flag */ GvGP_set(dstr, gp_ref(GvGP(sstr))); if (SvTAINTED(sstr)) @@ -3734,6 +3845,15 @@ S_glob_assign_glob(pTHX_ SV *const dstr, ); } else if(mro_changes) mro_method_changed_in(GvSTASH(dstr)); + if (GvIO(dstr) && dtype == SVt_PVGV) { + DEBUG_o(Perl_deb(aTHX_ + "glob_assign_glob clearing PL_stashcache\n")); + /* It's a cache. It will rebuild itself quite happily. + It's a lot of effort to work out exactly which key (or keys) + might be invalidated by the creation of the this file handle. + */ + hv_clear(PL_stashcache); + } return; } @@ -3929,17 +4049,49 @@ S_glob_assign_ref(pTHX_ SV *const dstr, return; } -/* Work around compiler warnings about unsigned >= THRESHOLD when thres- - hold is 0. */ -#if SV_COW_THRESHOLD -# define GE_COW_THRESHOLD(len) ((len) >= SV_COW_THRESHOLD) -#else -# define GE_COW_THRESHOLD(len) 1 -#endif -#if SV_COWBUF_THRESHOLD -# define GE_COWBUF_THRESHOLD(len) ((len) >= SV_COWBUF_THRESHOLD) + + + +#ifdef PERL_DEBUG_READONLY_COW +# include + +# ifndef PERL_MEMORY_DEBUG_HEADER_SIZE +# define PERL_MEMORY_DEBUG_HEADER_SIZE 0 +# endif + +void +Perl_sv_buf_to_ro(pTHX_ SV *sv) +{ + struct perl_memory_debug_header * const header = + (struct perl_memory_debug_header *)(SvPVX(sv)-PERL_MEMORY_DEBUG_HEADER_SIZE); + const MEM_SIZE len = header->size; + PERL_ARGS_ASSERT_SV_BUF_TO_RO; +# ifdef PERL_TRACK_MEMPOOL + if (!header->readonly) header->readonly = 1; +# endif + if (mprotect(header, len, PROT_READ)) + Perl_warn(aTHX_ "mprotect RW for COW string %p %lu failed with %d", + header, len, errno); +} + +static void +S_sv_buf_to_rw(pTHX_ SV *sv) +{ + struct perl_memory_debug_header * const header = + (struct perl_memory_debug_header *)(SvPVX(sv)-PERL_MEMORY_DEBUG_HEADER_SIZE); + const MEM_SIZE len = header->size; + PERL_ARGS_ASSERT_SV_BUF_TO_RW; + if (mprotect(header, len, PROT_READ|PROT_WRITE)) + Perl_warn(aTHX_ "mprotect for COW string %p %lu failed with %d", + header, len, errno); +# ifdef PERL_TRACK_MEMPOOL + header->readonly = 0; +# endif +} + #else -# define GE_COWBUF_THRESHOLD(len) 1 +# define sv_buf_to_ro(sv) NOOP +# define sv_buf_to_rw(sv) NOOP #endif void @@ -4073,7 +4225,7 @@ Perl_sv_setsv_flags(pTHX_ SV *dstr, SV* } break; - /* case SVt_BIND: */ + case SVt_INVLIST: case SVt_PVLV: case SVt_PVGV: case SVt_PVMG: @@ -4184,8 +4336,10 @@ Perl_sv_setsv_flags(pTHX_ SV *dstr, SV* reset_isa = TRUE; } - if (GvGP(dstr)) + if (GvGP(dstr)) { + SvREFCNT_inc_simple_void_NN(sv_2mortal(dstr)); gp_free(MUTABLE_GV(dstr)); + } GvGP_set(dstr, gp_ref(GvGP(gv))); if (reset_isa) { @@ -4206,18 +4360,50 @@ Perl_sv_setsv_flags(pTHX_ SV *dstr, SV* reg_temp_copy((REGEXP*)dstr, (REGEXP*)sstr); } else if (sflags & SVp_POK) { - bool isSwipe = 0; const STRLEN cur = SvCUR(sstr); const STRLEN len = SvLEN(sstr); /* - * Check to see if we can just swipe the string. If so, it's a - * possible small lose on short strings, but a big win on long ones. - * It might even be a win on short strings if SvPVX_const(dstr) - * has to be allocated and SvPVX_const(sstr) has to be freed. - * Likewise if we can set up COW rather than doing an actual copy, we - * drop to the else clause, as the swipe code and the COW setup code - * have much in common. + * We have three basic ways to copy the string: + * + * 1. Swipe + * 2. Copy-on-write + * 3. Actual copy + * + * Which we choose is based on various factors. The following + * things are listed in order of speed, fastest to slowest: + * - Swipe + * - Copying a short string + * - Copy-on-write bookkeeping + * - malloc + * - Copying a long string + * + * We swipe the string (steal the string buffer) if the SV on the + * rhs is about to be freed anyway (TEMP and refcnt==1). This is a + * big win on long strings. It should be a win on short strings if + * SvPVX_const(dstr) has to be allocated. If not, it should not + * slow things down, as SvPVX_const(sstr) would have been freed + * soon anyway. + * + * We also steal the buffer from a PADTMP (operator target) if it + * is ‘long enough’. For short strings, a swipe does not help + * here, as it causes more malloc calls the next time the target + * is used. Benchmarks show that even if SvPVX_const(dstr) has to + * be allocated it is still not worth swiping PADTMPs for short + * strings, as the savings here are small. + * + * If the rhs is already flagged as a copy-on-write string and COW + * is possible here, we use copy-on-write and make both SVs share + * the string buffer. + * + * If the rhs is not flagged as copy-on-write, then we see whether + * it is worth upgrading it to such. If the lhs already has a buf- + * fer big enough and the string is short, we skip it and fall back + * to method 3, since memcpy is faster for short strings than the + * later bookkeeping overhead that copy-on-write entails. + * + * If there is no buffer on the left, or the buffer is too small, + * then we use copy-on-write. */ /* Whichever path we take through the next code, we want this true, @@ -4225,86 +4411,70 @@ Perl_sv_setsv_flags(pTHX_ SV *dstr, SV* (void)SvPOK_only(dstr); if ( - /* If we're already COW then this clause is not true, and if COW - is allowed then we drop down to the else and make dest COW - with us. If caller hasn't said that we're allowed to COW - shared hash keys then we don't do the COW setup, even if the - source scalar is a shared hash key scalar. */ - (((flags & SV_COW_SHARED_HASH_KEYS) - ? !(sflags & SVf_IsCOW) -#ifdef PERL_NEW_COPY_ON_WRITE - || (len && - ((!GE_COWBUF_THRESHOLD(cur) && SvLEN(dstr) > cur) - /* If this is a regular (non-hek) COW, only so many COW - "copies" are possible. */ - || CowREFCNT(sstr) == SV_COW_REFCNT_MAX)) -#endif - : 1 /* If making a COW copy is forbidden then the behaviour we - desire is as if the source SV isn't actually already - COW, even if it is. So we act as if the source flags - are not COW, rather than actually testing them. */ - ) -#ifndef PERL_ANY_COW - /* The change that added SV_COW_SHARED_HASH_KEYS makes the logic - when PERL_OLD_COPY_ON_WRITE is defined a little wrong. - Conceptually PERL_OLD_COPY_ON_WRITE being defined should - override SV_COW_SHARED_HASH_KEYS, because it means "always COW" - but in turn, it's somewhat dead code, never expected to go - live, but more kept as a placeholder on how to do it better - in a newer implementation. */ - /* If we are COW and dstr is a suitable target then we drop down - into the else and make dest a COW of us. */ - || (SvFLAGS(dstr) & SVf_BREAK) -#endif - ) - && - !(isSwipe = -#ifdef PERL_NEW_COPY_ON_WRITE + ( /* Either ... */ /* slated for free anyway (and not COW)? */ - (sflags & (SVs_TEMP|SVf_IsCOW)) == SVs_TEMP && -#else - (sflags & SVs_TEMP) && /* slated for free anyway? */ -#endif + (sflags & (SVs_TEMP|SVf_IsCOW)) == SVs_TEMP + /* or a swipable TARG */ + || ((sflags & (SVs_PADTMP|SVf_READONLY|SVf_IsCOW)) + == SVs_PADTMP + /* whose buffer is worth stealing */ + && CHECK_COWBUF_THRESHOLD(cur,len) + ) + ) && !(sflags & SVf_OOK) && /* and not involved in OOK hack? */ (!(flags & SV_NOSTEAL)) && /* and we're allowed to steal temps */ SvREFCNT(sstr) == 1 && /* and no other references to it? */ len) /* and really is a string */ -#ifdef PERL_ANY_COW - && ((flags & SV_COW_SHARED_HASH_KEYS) - ? (!((sflags & CAN_COW_MASK) == CAN_COW_FLAGS -# ifdef PERL_OLD_COPY_ON_WRITE + { /* Passes the swipe test. */ + if (SvPVX_const(dstr)) /* we know that dtype >= SVt_PV */ + SvPV_free(dstr); + SvPV_set(dstr, SvPVX_mutable(sstr)); + SvLEN_set(dstr, SvLEN(sstr)); + SvCUR_set(dstr, SvCUR(sstr)); + + SvTEMP_off(dstr); + (void)SvOK_off(sstr); /* NOTE: nukes most SvFLAGS on sstr */ + SvPV_set(sstr, NULL); + SvLEN_set(sstr, 0); + SvCUR_set(sstr, 0); + SvTEMP_off(sstr); + } + else if (flags & SV_COW_SHARED_HASH_KEYS + && +#ifdef PERL_OLD_COPY_ON_WRITE + ( sflags & SVf_IsCOW + || ( (sflags & CAN_COW_MASK) == CAN_COW_FLAGS && (SvFLAGS(dstr) & CAN_COW_MASK) == CAN_COW_FLAGS - && SvTYPE(sstr) >= SVt_PVIV -# else + && SvTYPE(sstr) >= SVt_PVIV && len + ) + ) +#elif defined(PERL_NEW_COPY_ON_WRITE) + (sflags & SVf_IsCOW + ? (!len || + ( (CHECK_COWBUF_THRESHOLD(cur,len) || SvLEN(dstr) < cur+1) + /* If this is a regular (non-hek) COW, only so + many COW "copies" are possible. */ + && CowREFCNT(sstr) != SV_COW_REFCNT_MAX )) + : ( (sflags & CAN_COW_MASK) == CAN_COW_FLAGS && !(SvFLAGS(dstr) & SVf_BREAK) - && !(sflags & SVf_IsCOW) - && GE_COW_THRESHOLD(cur) && cur+1 < len - && (GE_COWBUF_THRESHOLD(cur) || SvLEN(dstr) < cur+1) -# endif + && CHECK_COW_THRESHOLD(cur,len) && cur+1 < len + && (CHECK_COWBUF_THRESHOLD(cur,len) || SvLEN(dstr) < cur+1) )) - : 1) +#else + sflags & SVf_IsCOW + && !(SvFLAGS(dstr) & SVf_BREAK) #endif ) { - /* Failed the swipe test, and it's not a shared hash key either. - Have to copy the string. */ - SvGROW(dstr, cur + 1); /* inlined from sv_setpvn */ - Move(SvPVX_const(sstr),SvPVX(dstr),cur,char); - SvCUR_set(dstr, cur); - *SvEND(dstr) = '\0'; - } else { - /* If PERL_OLD_COPY_ON_WRITE is not defined, then isSwipe will always - be true in here. */ /* Either it's a shared hash key, or it's suitable for - copy-on-write or we can swipe the string. */ + copy-on-write. */ if (DEBUG_C_TEST) { PerlIO_printf(Perl_debug_log, "Copy on write: sstr --> dstr\n"); sv_dump(sstr); sv_dump(dstr); } #ifdef PERL_ANY_COW - if (!isSwipe) { - if (!(sflags & SVf_IsCOW)) { + if (!(sflags & SVf_IsCOW)) { SvIsCOW_on(sstr); # ifdef PERL_OLD_COPY_ON_WRITE /* Make the source SV into a loop of 1. @@ -4313,18 +4483,14 @@ Perl_sv_setsv_flags(pTHX_ SV *dstr, SV* # else CowREFCNT(sstr) = 0; # endif - } } #endif - /* Initial code is common. */ if (SvPVX_const(dstr)) { /* we know that dtype >= SVt_PV */ SvPV_free(dstr); } - if (!isSwipe) { - /* making another shared SV. */ #ifdef PERL_ANY_COW - if (len) { + if (len) { # ifdef PERL_OLD_COPY_ON_WRITE assert (SvTYPE(dstr) >= SVt_PVIV); /* SvIsCOW_normal */ @@ -4332,12 +4498,16 @@ Perl_sv_setsv_flags(pTHX_ SV *dstr, SV* SV_COW_NEXT_SV_SET(dstr, SV_COW_NEXT_SV(sstr)); SV_COW_NEXT_SV_SET(sstr, dstr); # else + if (sflags & SVf_IsCOW) { + sv_buf_to_rw(sstr); + } CowREFCNT(sstr)++; # endif SvPV_set(dstr, SvPVX_mutable(sstr)); - } else + sv_buf_to_ro(sstr); + } else #endif - { + { /* SvIsCOW_shared_hash */ DEBUG_C(PerlIO_printf(Perl_debug_log, "Copy on write: Sharing hash\n")); @@ -4345,24 +4515,17 @@ Perl_sv_setsv_flags(pTHX_ SV *dstr, SV* assert (SvTYPE(dstr) >= SVt_PV); SvPV_set(dstr, HEK_KEY(share_hek_hek(SvSHARED_HEK_FROM_PV(SvPVX_const(sstr))))); - } - SvLEN_set(dstr, len); - SvCUR_set(dstr, cur); - SvIsCOW_on(dstr); - } - else - { /* Passes the swipe test. */ - SvPV_set(dstr, SvPVX_mutable(sstr)); - SvLEN_set(dstr, SvLEN(sstr)); - SvCUR_set(dstr, SvCUR(sstr)); - - SvTEMP_off(dstr); - (void)SvOK_off(sstr); /* NOTE: nukes most SvFLAGS on sstr */ - SvPV_set(sstr, NULL); - SvLEN_set(sstr, 0); - SvCUR_set(sstr, 0); - SvTEMP_off(sstr); - } + } + SvLEN_set(dstr, len); + SvCUR_set(dstr, cur); + SvIsCOW_on(dstr); + } else { + /* Failed the swipe test, and we cannot do copy-on-write either. + Have to copy the string. */ + SvGROW(dstr, cur + 1); /* inlined from sv_setpvn */ + Move(SvPVX_const(sstr),SvPVX(dstr),cur,char); + SvCUR_set(dstr, cur); + *SvEND(dstr) = '\0'; } if (sflags & SVp_NOK) { SvNV_set(dstr, SvNVX(sstr)); @@ -4435,6 +4598,9 @@ Perl_sv_setsv_cow(pTHX_ SV *dstr, SV *ss STRLEN cur = SvCUR(sstr); STRLEN len = SvLEN(sstr); char *new_pv; +#if defined(PERL_DEBUG_READONLY_COW) && defined(PERL_NEW_COPY_ON_WRITE) + const bool already = cBOOL(SvIsCOW(sstr)); +#endif PERL_ARGS_ASSERT_SV_SETSV_COW; @@ -4495,9 +4661,13 @@ Perl_sv_setsv_cow(pTHX_ SV *dstr, SV *ss # ifdef PERL_OLD_COPY_ON_WRITE SV_COW_NEXT_SV_SET(sstr, dstr); # else +# ifdef PERL_DEBUG_READONLY_COW + if (already) sv_buf_to_rw(sstr); +# endif CowREFCNT(sstr)++; # endif new_pv = SvPVX_mutable(sstr); + sv_buf_to_ro(sstr); common_exit: SvPV_set(dstr, new_pv); @@ -4516,7 +4686,8 @@ Perl_sv_setsv_cow(pTHX_ SV *dstr, SV *ss /* =for apidoc sv_setpvn -Copies a string into an SV. The C parameter indicates the number of +Copies a string (possibly containing embedded C characters) into an SV. +The C parameter indicates the number of bytes to be copied. If the C argument is NULL the SV will become undefined. Does not handle 'set' magic. See C. @@ -4574,8 +4745,9 @@ Perl_sv_setpvn_mg(pTHX_ SV *const sv, co /* =for apidoc sv_setpv -Copies a string into an SV. The string must be null-terminated. Does not -handle 'set' magic. See C. +Copies a string into an SV. The string must be terminated with a C +character. +Does not handle 'set' magic. See C. =cut */ @@ -4653,7 +4825,7 @@ Perl_sv_sethek(pTHX_ SV *const sv, const { SV_CHECK_THINKFIRST_COW_DROP(sv); SvUPGRADE(sv, SVt_PV); - Safefree(SvPVX(sv)); + SvPV_free(sv); SvPV_set(sv,(char *)HEK_KEY(share_hek_hek(hek))); SvCUR_set(sv, HEK_LEN(hek)); SvLEN_set(sv, 0); @@ -4672,18 +4844,20 @@ Perl_sv_sethek(pTHX_ SV *const sv, const =for apidoc sv_usepvn_flags Tells an SV to use C to find its string value. Normally the -string is stored inside the SV but sv_usepvn allows the SV to use an +string is stored inside the SV, but sv_usepvn allows the SV to use an outside string. The C should point to memory that was allocated -by C. It must be the start of a mallocked block -of memory, and not a pointer to the middle of it. The -string length, C, must be supplied. By default -this function will realloc (i.e. move) the memory pointed to by C, +by L. It must be +the start of a Newx-ed block of memory, and not a pointer to the +middle of it (beware of L and copy-on-write), +and not be from a non-Newx memory allocator like C. The +string length, C, must be supplied. By default this function +will C (i.e. realloc, move) the memory pointed to by C, so that pointer should not be freed or used by the programmer after giving it to sv_usepvn, and neither should any pointers from "behind" that pointer (e.g. ptr + 1) be used. If C & SV_SMAGIC is true, will call SvSETMAGIC. If C & -SV_HAS_TRAILING_NUL is true, then C must be NUL, and the realloc +SV_HAS_TRAILING_NUL is true, then C must be C, and the realloc will be skipped (i.e. the buffer is actually at least 1 byte longer than C, and already meets the requirements for storing in C). @@ -4772,6 +4946,7 @@ S_sv_release_COW(pTHX_ SV *sv, const cha in the loop.) Hence other SV is no longer copy on write either. */ SvIsCOW_off(after); + sv_buf_to_rw(after); } else { /* We need to follow the pointers around the loop. */ SV *next; @@ -4805,22 +4980,21 @@ the C parameter gets passed to C< when unreffing. C calls this function with flags set to 0. +This function is expected to be used to signal to perl that this SV is +about to be written to, and any extra book-keeping needs to be taken care +of. Hence, it croaks on read-only values. + =cut */ -void -Perl_sv_force_normal_flags(pTHX_ SV *const sv, const U32 flags) +static void +S_sv_uncow(pTHX_ SV * const sv, const U32 flags) { dVAR; - PERL_ARGS_ASSERT_SV_FORCE_NORMAL_FLAGS; - + assert(SvIsCOW(sv)); + { #ifdef PERL_ANY_COW - if (SvREADONLY(sv)) { - if (IN_PERL_RUNTIME) - Perl_croak_no_modify(); - } - else if (SvIsCOW(sv)) { const char * const pvx = SvPVX_const(sv); const STRLEN len = SvLEN(sv); const STRLEN cur = SvCUR(sv); @@ -4841,7 +5015,7 @@ Perl_sv_force_normal_flags(pTHX_ SV *con # ifdef PERL_NEW_COPY_ON_WRITE if (len && CowREFCNT(sv) == 0) /* We own the buffer ourselves. */ - NOOP; + sv_buf_to_rw(sv); else # endif { @@ -4849,9 +5023,14 @@ Perl_sv_force_normal_flags(pTHX_ SV *con /* This SV doesn't own the buffer, so need to Newx() a new one: */ # ifdef PERL_NEW_COPY_ON_WRITE /* Must do this first, since the macro uses SvPVX. */ - if (len) CowREFCNT(sv)--; + if (len) { + sv_buf_to_rw(sv); + CowREFCNT(sv)--; + sv_buf_to_ro(sv); + } # endif SvPV_set(sv, NULL); + SvCUR_set(sv, 0); SvLEN_set(sv, 0); if (flags & SV_COW_DROP_PV) { /* OK, so we don't need to copy our buffer. */ @@ -4873,14 +5052,7 @@ Perl_sv_force_normal_flags(pTHX_ SV *con sv_dump(sv); } } - } #else - if (SvREADONLY(sv)) { - if (IN_PERL_RUNTIME) - Perl_croak_no_modify(); - } - else - if (SvIsCOW(sv)) { const char * const pvx = SvPVX_const(sv); const STRLEN len = SvCUR(sv); SvIsCOW_off(sv); @@ -4895,8 +5067,19 @@ Perl_sv_force_normal_flags(pTHX_ SV *con *SvEND(sv) = '\0'; } unshare_hek(SvSHARED_HEK_FROM_PV(pvx)); - } #endif + } +} + +void +Perl_sv_force_normal_flags(pTHX_ SV *const sv, const U32 flags) +{ + PERL_ARGS_ASSERT_SV_FORCE_NORMAL_FLAGS; + + if (SvREADONLY(sv)) + Perl_croak_no_modify(); + else if (SvIsCOW(sv)) + S_sv_uncow(aTHX_ sv, flags); if (SvROK(sv)) sv_unref_flags(sv, flags); else if (SvFAKE(sv) && isGV_with_GP(sv)) @@ -5031,8 +5214,14 @@ Perl_sv_chop(pTHX_ SV *const sv, const c evacp = p - evacn; #endif + /* This sets 'delta' to the accumulated value of all deltas so far */ delta += old_delta; assert(delta); + + /* If 'delta' fits in a byte, store it just prior to the new beginning of + * the string; otherwise store a 0 byte there and store 'delta' just prior + * to that, using as many bytes as a STRLEN occupies. Thus it overwrites a + * portion of the chopped part of the string */ if (delta < 0x100) { *--p = (U8) delta; } else { @@ -5107,13 +5296,8 @@ Perl_sv_catpvn_flags(pTHX_ SV *const dsv d = (U8 *)SvPVX(dsv) + dlen; while (sstr < send) { - const UV uv = NATIVE_TO_ASCII((U8)*sstr++); - if (UNI_IS_INVARIANT(uv)) - *d++ = (U8)UTF_TO_NATIVE(uv); - else { - *d++ = (U8)UTF8_EIGHT_BIT_HI(uv); - *d++ = (U8)UTF8_EIGHT_BIT_LO(uv); - } + append_utf8_from_native_byte(*sstr, &d); + sstr++; } SvCUR_set(dsv, d-(const U8 *)SvPVX(dsv)); } @@ -5167,7 +5351,8 @@ Perl_sv_catsv_flags(pTHX_ SV *const dsv, /* =for apidoc sv_catpv -Concatenates the string onto the end of the string which is in the SV. +Concatenates the C-terminated string onto the end of the string which is +in the SV. If the SV has the UTF-8 status set, then the bytes appended should be valid UTF-8. Handles 'get' magic, but not 'set' magic. See C. @@ -5199,7 +5384,8 @@ Perl_sv_catpv(pTHX_ SV *const sv, const /* =for apidoc sv_catpv_flags -Concatenates the string onto the end of the string which is in the SV. +Concatenates the C-terminated string onto the end of the string which is +in the SV. If the SV has the UTF-8 status set, then the bytes appended should be valid UTF-8. If C has the C bit set, will C on the modified SV if appropriate. @@ -5236,7 +5422,7 @@ Perl_sv_catpv_mg(pTHX_ SV *const sv, con Creates a new SV. A non-zero C parameter indicates the number of bytes of preallocated string space the SV should have. An extra byte for a -trailing NUL is also reserved. (SvPOK is not set for the SV even if string +trailing C is also reserved. (SvPOK is not set for the SV even if string space is allocated.) The reference count for the new SV is set to 1. In 5.9.3, newSV() replaces the older NEWSV() API, and drops the first @@ -5289,6 +5475,8 @@ Perl_sv_magicext(pTHX_ SV *const sv, SV PERL_ARGS_ASSERT_SV_MAGICEXT; + if (SvTYPE(sv)==SVt_PVAV) { assert (!AvPAD_NAMELIST(sv)); } + SvUPGRADE(sv, SVt_PVMG); Newxz(mg, 1, MAGIC); mg->mg_moremagic = SvMAGIC(sv); @@ -5352,6 +5540,24 @@ Perl_sv_magicext(pTHX_ SV *const sv, SV return mg; } +MAGIC * +Perl_sv_magicext_mglob(pTHX_ SV *sv) +{ + PERL_ARGS_ASSERT_SV_MAGICEXT_MGLOB; + if (SvTYPE(sv) == SVt_PVLV && LvTYPE(sv) == 'y') { + /* This sv is only a delegate. //g magic must be attached to + its target. */ + vivify_defelem(sv); + sv = LvTARG(sv); + } +#ifdef PERL_OLD_COPY_ON_WRITE + if (SvIsCOW(sv)) + sv_force_normal_flags(sv, 0); +#endif + return sv_magicext(sv, NULL, PERL_MAGIC_regex_global, + &PL_vtbl_mglob, 0, 0); +} + /* =for apidoc sv_magic @@ -5380,7 +5586,7 @@ Perl_sv_magic(pTHX_ SV *const sv, SV *co PERL_ARGS_ASSERT_SV_MAGIC; - if (how < 0 || (unsigned)how > C_ARRAY_LENGTH(PL_magic_data) + if (how < 0 || (unsigned)how >= C_ARRAY_LENGTH(PL_magic_data) || ((flags = PL_magic_data[how]), (vtable_index = flags & PERL_MAGIC_VTABLE_MASK) > magic_vtable_max)) @@ -5394,17 +5600,13 @@ Perl_sv_magic(pTHX_ SV *const sv, SV *co vtable = (vtable_index == magic_vtable_max) ? NULL : PL_magic_vtables + vtable_index; -#ifdef PERL_ANY_COW +#ifdef PERL_OLD_COPY_ON_WRITE if (SvIsCOW(sv)) sv_force_normal_flags(sv, 0); #endif if (SvREADONLY(sv)) { if ( - /* its okay to attach magic to shared strings */ - !SvIsCOW(sv) - - && IN_PERL_RUNTIME - && !PERL_MAGIC_TYPE_READONLY_ACCEPTABLE(how) + !PERL_MAGIC_TYPE_READONLY_ACCEPTABLE(how) ) { Perl_croak_no_modify(); @@ -5421,6 +5623,16 @@ Perl_sv_magic(pTHX_ SV *const sv, SV *co } } + /* Force pos to be stored as characters, not bytes. */ + if (SvMAGICAL(sv) && DO_UTF8(sv) + && (mg = mg_find(sv, PERL_MAGIC_regex_global)) + && mg->mg_len != -1 + && mg->mg_flags & MGf_BYTES) { + mg->mg_len = (SSize_t)sv_pos_b2u_flags(sv, (STRLEN)mg->mg_len, + SV_CONST_RETURN); + mg->mg_flags &= ~MGf_BYTES; + } + /* Rest of work is done else where */ mg = sv_magicext(sv,obj,how,vtable,name,namlen); @@ -5585,12 +5797,10 @@ Perl_sv_add_backref(pTHX_ SV *const tsv, if (SvTYPE(tsv) == SVt_PVHV) { svp = (SV**)Perl_hv_backreferences_p(aTHX_ MUTABLE_HV(tsv)); } else { - if (! ((mg = - (SvMAGICAL(tsv) ? mg_find(tsv, PERL_MAGIC_backref) : NULL)))) - { - sv_magic(tsv, NULL, PERL_MAGIC_backref, NULL, 0); - mg = mg_find(tsv, PERL_MAGIC_backref); - } + if (SvMAGICAL(tsv)) + mg = mg_find(tsv, PERL_MAGIC_backref); + if (!mg) + mg = sv_magicext(tsv, NULL, PERL_MAGIC_backref, &PL_vtbl_backref, NULL, 0); svp = &(mg->mg_obj); } @@ -5600,32 +5810,32 @@ Perl_sv_add_backref(pTHX_ SV *const tsv, || (*svp && SvTYPE(*svp) != SVt_PVAV) ) { /* create array */ + if (mg) + mg->mg_flags |= MGf_REFCOUNTED; av = newAV(); AvREAL_off(av); - SvREFCNT_inc_simple_void(av); + SvREFCNT_inc_simple_void_NN(av); /* av now has a refcnt of 2; see discussion above */ + av_extend(av, *svp ? 2 : 1); if (*svp) { /* move single existing backref to the array */ - av_extend(av, 1); AvARRAY(av)[++AvFILLp(av)] = *svp; /* av_push() */ } *svp = (SV*)av; - if (mg) - mg->mg_flags |= MGf_REFCOUNTED; } - else + else { av = MUTABLE_AV(*svp); - - if (!av) { - /* optimisation: store single backref directly in HvAUX or mg_obj */ - *svp = sv; - return; + if (!av) { + /* optimisation: store single backref directly in HvAUX or mg_obj */ + *svp = sv; + return; + } + assert(SvTYPE(av) == SVt_PVAV); + if (AvFILLp(av) >= AvMAX(av)) { + av_extend(av, AvFILLp(av)+1); + } } /* push new backref */ - assert(SvTYPE(av) == SVt_PVAV); - if (AvFILLp(av) >= AvMAX(av)) { - av_extend(av, AvFILLp(av)+1); - } AvARRAY(av)[++AvFILLp(av)] = sv; /* av_push() */ } @@ -6126,6 +6336,9 @@ Perl_sv_clear(pTHX_ SV *const orig_sv) } else if (type == SVt_PVMG && SvPAD_OUR(sv)) { SvREFCNT_dec(SvOURSTASH(sv)); + } + else if (type == SVt_PVAV && AvPAD_NAMELIST(sv)) { + assert(!SvMAGICAL(sv)); } else if (SvMAGIC(sv)) { /* Free back-references before other types of magic. */ sv_unmagic(sv, PERL_MAGIC_backref); @@ -6136,7 +6349,7 @@ Perl_sv_clear(pTHX_ SV *const orig_sv) SvREFCNT_dec(SvSTASH(sv)); } switch (type) { - /* case SVt_BIND: */ + /* case SVt_INVLIST: */ case SVt_PVIO: if (IoIFP(sv) && IoIFP(sv) != PerlIO_stdin() && @@ -6183,8 +6396,8 @@ Perl_sv_clear(pTHX_ SV *const orig_sv) if (PL_stashcache) { DEBUG_o(Perl_deb(aTHX_ "sv_clear clearing PL_stashcache for '%"SVf"'\n", sv)); - (void)hv_delete(PL_stashcache, name, - HvNAMEUTF8((HV*)sv) ? -HvNAMELEN_get((HV*)sv) : HvNAMELEN_get((HV*)sv), G_DISCARD); + (void)hv_deletehek(PL_stashcache, + HvNAME_HEK((HV*)sv), G_DISCARD); } hv_name_set((HV*)sv, NULL, 0, 0); } @@ -6262,6 +6475,7 @@ Perl_sv_clear(pTHX_ SV *const orig_sv) case SVt_PVMG: case SVt_PVNV: case SVt_PVIV: + case SVt_INVLIST: case SVt_PV: freescalar: /* Don't bother with SvOOK_off(sv); as we're only going to @@ -6297,7 +6511,9 @@ Perl_sv_clear(pTHX_ SV *const orig_sv) sv_release_COW(sv, SvPVX_const(sv), SV_COW_NEXT_SV(sv)); # else if (CowREFCNT(sv)) { + sv_buf_to_rw(sv); CowREFCNT(sv)--; + sv_buf_to_ro(sv); SvLEN_set(sv, 0); } # endif @@ -6570,7 +6786,7 @@ Perl_sv_free2(pTHX_ SV *const sv, const PERL_ARGS_ASSERT_SV_FREE2; - if (rc == 1) { + if (LIKELY( rc == 1 )) { /* normal case */ SvREFCNT(sv) = 0; @@ -6905,7 +7121,7 @@ S_sv_pos_u2b_cached(pTHX_ SV *const sv, /* =for apidoc sv_pos_u2b_flags -Converts the value pointed to by offsetp from a count of UTF-8 chars from +Converts the offset from a count of UTF-8 chars from the start of the string, to a count of the equivalent number of bytes; if lenp is non-zero, it does the same to lenp, but this time starting from the offset, rather than from the start @@ -7014,9 +7230,6 @@ S_utf8_mg_len_cache_update(pTHX_ SV *con assert(*mgp); (*mgp)->mg_len = ulen; - /* For now, treat "overflowed" as "still unknown". See RT #72924. */ - if (ulen != (STRLEN) (*mgp)->mg_len) - (*mgp)->mg_len = -1; } /* Create and update the UTF8 magic offset cache, with the proffered utf8/ @@ -7194,44 +7407,41 @@ S_sv_pos_b2u_midway(pTHX_ const U8 *cons } /* -=for apidoc sv_pos_b2u +=for apidoc sv_pos_b2u_flags -Converts the value pointed to by offsetp from a count of bytes from the -start of the string, to a count of the equivalent number of UTF-8 chars. -Handles magic and type coercion. +Converts the offset from a count of bytes from the start of the string, to +a count of the equivalent number of UTF-8 chars. Handles type coercion. +I is passed to C, and usually should be +C to handle magic. =cut */ /* - * sv_pos_b2u() uses, like sv_pos_u2b(), the mg_ptr of the potential - * PERL_MAGIC_utf8 of the sv to store the mapping between UTF-8 and - * byte offsets. + * sv_pos_b2u_flags() uses, like sv_pos_u2b_flags(), the mg_ptr of the + * potential PERL_MAGIC_utf8 of the sv to store the mapping between UTF-8 + * and byte offsets. * */ -void -Perl_sv_pos_b2u(pTHX_ SV *const sv, I32 *const offsetp) +STRLEN +Perl_sv_pos_b2u_flags(pTHX_ SV *const sv, STRLEN const offset, U32 flags) { const U8* s; - const STRLEN byte = *offsetp; STRLEN len = 0; /* Actually always set, but let's keep gcc happy. */ STRLEN blen; MAGIC* mg = NULL; const U8* send; bool found = FALSE; - PERL_ARGS_ASSERT_SV_POS_B2U; - - if (!sv) - return; + PERL_ARGS_ASSERT_SV_POS_B2U_FLAGS; - s = (const U8*)SvPV_const(sv, blen); + s = (const U8*)SvPV_flags(sv, blen, flags); - if (blen < byte) + if (blen < offset) Perl_croak(aTHX_ "panic: sv_pos_b2u: bad byte offset, blen=%"UVuf - ", byte=%"UVuf, (UV)blen, (UV)byte); + ", byte=%"UVuf, (UV)blen, (UV)offset); - send = s + byte; + send = s + offset; if (!SvREADONLY(sv) && PL_utf8cache @@ -7240,18 +7450,16 @@ Perl_sv_pos_b2u(pTHX_ SV *const sv, I32 { if (mg->mg_ptr) { STRLEN * const cache = (STRLEN *) mg->mg_ptr; - if (cache[1] == byte) { + if (cache[1] == offset) { /* An exact match. */ - *offsetp = cache[0]; - return; + return cache[0]; } - if (cache[3] == byte) { + if (cache[3] == offset) { /* An exact match. */ - *offsetp = cache[2]; - return; + return cache[2]; } - if (cache[1] < byte) { + if (cache[1] < offset) { /* We already know part of the way. */ if (mg->mg_len != -1) { /* Actually, we know the end too. */ @@ -7262,7 +7470,7 @@ Perl_sv_pos_b2u(pTHX_ SV *const sv, I32 len = cache[0] + utf8_length(s + cache[1], send); } } - else if (cache[3] < byte) { + else if (cache[3] < offset) { /* We're between the two cached pairs, so we do the calculation offset by the byte/utf-8 positions for the earlier pair, then add the utf-8 characters from the string start to @@ -7272,7 +7480,7 @@ Perl_sv_pos_b2u(pTHX_ SV *const sv, I32 + cache[2]; } - else { /* cache[3] > byte */ + else { /* cache[3] > offset */ len = S_sv_pos_b2u_midway(aTHX_ s, send, s + cache[3], cache[2]); @@ -7291,14 +7499,46 @@ Perl_sv_pos_b2u(pTHX_ SV *const sv, I32 assert_uft8_cache_coherent("sv_pos_b2u", len, real_len, sv); len = real_len; } - *offsetp = len; if (PL_utf8cache) { - if (blen == byte) + if (blen == offset) utf8_mg_len_cache_update(sv, &mg, len); else - utf8_mg_pos_cache_update(sv, &mg, byte, len, blen); + utf8_mg_pos_cache_update(sv, &mg, offset, len, blen); } + + return len; +} + +/* +=for apidoc sv_pos_b2u + +Converts the value pointed to by offsetp from a count of bytes from the +start of the string, to a count of the equivalent number of UTF-8 chars. +Handles magic and type coercion. + +Use C in preference, which correctly handles strings +longer than 2Gb. + +=cut +*/ + +/* + * sv_pos_b2u() uses, like sv_pos_u2b(), the mg_ptr of the potential + * PERL_MAGIC_utf8 of the sv to store the mapping between UTF-8 and + * byte offsets. + * + */ +void +Perl_sv_pos_b2u(pTHX_ SV *const sv, I32 *const offsetp) +{ + PERL_ARGS_ASSERT_SV_POS_B2U; + + if (!sv) + return; + + *offsetp = (I32)sv_pos_b2u_flags(sv, (STRLEN)*offsetp, + SV_GMAGIC|SV_CONST_RETURN); } static void @@ -7578,6 +7818,8 @@ Perl_sv_cmp_locale_flags(pTHX_ SV *const raw_compare: /*FALLTHROUGH*/ +#else + PERL_UNUSED_ARG(flags); #endif /* USE_LOCALE_COLLATE */ return sv_cmp(sv1, sv2); @@ -7789,8 +8031,8 @@ S_sv_gets_read_record(pTHX_ SV *const sv =for apidoc sv_gets Get a line from the filehandle and store it into the SV, optionally -appending to the currently-stored string. If C is not 0, the -line is appended to the SV instead of overwriting it. C should +appending to the currently-stored string. If C is not 0, the +line is appended to the SV instead of overwriting it. C should be set to the byte offset that the appended string should start at in the SV (typically, C is a suitable choice). @@ -7805,9 +8047,9 @@ Perl_sv_gets(pTHX_ SV *const sv, PerlIO STRLEN rslen; STDCHAR rslast; STDCHAR *bp; - I32 cnt; - I32 i = 0; - I32 rspara = 0; + SSize_t cnt; + int i = 0; + int rspara = 0; PERL_ARGS_ASSERT_SV_GETS; @@ -7821,6 +8063,7 @@ Perl_sv_gets(pTHX_ SV *const sv, PerlIO SvUPGRADE(sv, SVt_PV); if (append) { + /* line is going to be appended to the existing buffer in the sv */ if (PerlIO_isutf8(fp)) { if (!SvUTF8(sv)) { sv_utf8_upgrade_nomg(sv); @@ -7833,6 +8076,8 @@ Perl_sv_gets(pTHX_ SV *const sv, PerlIO SvPOK_only(sv); if (!append) { + /* not appending - "clear" the string by setting SvCUR to 0, + * the pv is still avaiable. */ SvCUR_set(sv,0); } if (PerlIO_isutf8(fp)) @@ -7853,7 +8098,13 @@ Perl_sv_gets(pTHX_ SV *const sv, PerlIO if (!PerlLIO_fstat(PerlIO_fileno(fp), &st) && S_ISREG(st.st_mode)) { const Off_t offset = PerlIO_tell(fp); if (offset != (Off_t) -1 && st.st_size + append > offset) { - (void) SvGROW(sv, (STRLEN)((st.st_size - offset) + append + 1)); +#ifdef PERL_NEW_COPY_ON_WRITE + /* Add an extra byte for the sake of copy-on-write's + * buffer reference count. */ + (void) SvGROW(sv, (STRLEN)((st.st_size - offset) + append + 2)); +#else + (void) SvGROW(sv, (STRLEN)((st.st_size - offset) + append + 1)); +#endif } } rsptr = NULL; @@ -7878,10 +8129,14 @@ Perl_sv_gets(pTHX_ SV *const sv, PerlIO Perl_croak(aTHX_ "Wide character in $/"); } } + /* extract the raw pointer to the record separator */ rsptr = SvPV_const(PL_rs, rslen); } } + /* rslast is the last character in the record separator + * note we don't use rslast except when rslen is true, so the + * null assign is a placeholder. */ rslast = rslen ? rsptr[rslen - 1] : '\0'; if (rspara) { /* have to do this both before and after */ @@ -7907,14 +8162,28 @@ Perl_sv_gets(pTHX_ SV *const sv, PerlIO */ if (PerlIO_fast_gets(fp)) { + /* + * We can do buffer based IO operations on this filehandle. + * + * This means we can bypass a lot of subcalls and process + * the buffer directly, it also means we know the upper bound + * on the amount of data we might read of the current buffer + * into our sv. Knowing this allows us to preallocate the pv + * to be able to hold that maximum, which allows us to simplify + * a lot of logic. */ /* * We're going to steal some values from the stdio struct * and put EVERYTHING in the innermost loop into registers. */ - STDCHAR *ptr; - STRLEN bpx; - I32 shortbuffered; + STDCHAR *ptr; /* pointer into fp's read-ahead buffer */ + STRLEN bpx; /* length of the data in the target sv + used to fix pointers after a SvGROW */ + I32 shortbuffered; /* If the pv buffer is shorter than the amount + of data left in the read-ahead buffer. + If 0 then the pv buffer can hold the full + amount left, otherwise this is the amount it + can hold. */ #if defined(VMS) && defined(PERLIO_IS_STDIO) /* An ungetc()d char is handled separately from the regular @@ -7928,7 +8197,64 @@ Perl_sv_gets(pTHX_ SV *const sv, PerlIO /* Here is some breathtakingly efficient cheating */ - cnt = PerlIO_get_cnt(fp); /* get count into register */ + /* When you read the following logic resist the urge to think + * of record separators that are 1 byte long. They are an + * uninteresting special (simple) case. + * + * Instead think of record separators which are at least 2 bytes + * long, and keep in mind that we need to deal with such + * separators when they cross a read-ahead buffer boundary. + * + * Also consider that we need to gracefully deal with separators + * that may be longer than a single read ahead buffer. + * + * Lastly do not forget we want to copy the delimiter as well. We + * are copying all data in the file _up_to_and_including_ the separator + * itself. + * + * Now that you have all that in mind here is what is happening below: + * + * 1. When we first enter the loop we do some memory book keeping to see + * how much free space there is in the target SV. (This sub assumes that + * it is operating on the same SV most of the time via $_ and that it is + * going to be able to reuse the same pv buffer each call.) If there is + * "enough" room then we set "shortbuffered" to how much space there is + * and start reading forward. + * + * 2. When we scan forward we copy from the read-ahead buffer to the target + * SV's pv buffer. While we go we watch for the end of the read-ahead buffer, + * and the end of the of pv, as well as for the "rslast", which is the last + * char of the separator. + * + * 3. When scanning forward if we see rslast then we jump backwards in *pv* + * (which has a "complete" record up to the point we saw rslast) and check + * it to see if it matches the separator. If it does we are done. If it doesn't + * we continue on with the scan/copy. + * + * 4. If we run out of read-ahead buffer (cnt goes to 0) then we have to get + * the IO system to read the next buffer. We do this by doing a getc(), which + * returns a single char read (or EOF), and prefills the buffer, and also + * allows us to find out how full the buffer is. We use this information to + * SvGROW() the sv to the size remaining in the buffer, after which we copy + * the returned single char into the target sv, and then go back into scan + * forward mode. + * + * 5. If we run out of write-buffer then we SvGROW() it by the size of the + * remaining space in the read-buffer. + * + * Note that this code despite its twisty-turny nature is pretty darn slick. + * It manages single byte separators, multi-byte cross boundary separators, + * and cross-read-buffer separators cleanly and efficiently at the cost + * of potentially greatly overallocating the target SV. + * + * Yves + */ + + + /* get the number of bytes remaining in the read-ahead buffer + * on first call on a given fp this will return 0.*/ + cnt = PerlIO_get_cnt(fp); + /* make sure we have the room */ if ((I32)(SvLEN(sv) - append) <= cnt + 1) { /* Not room for all of it @@ -7940,32 +8266,48 @@ Perl_sv_gets(pTHX_ SV *const sv, PerlIO cnt -= shortbuffered; } else { + /* ensure that the target sv has enough room to hold + * the rest of the read-ahead buffer */ shortbuffered = 0; /* remember that cnt can be negative */ SvGROW(sv, (STRLEN)(append + (cnt <= 0 ? 2 : (cnt + 1)))); } } - else + else { + /* we have enough room to hold the full buffer, lets scream */ shortbuffered = 0; + } + + /* extract the pointer to sv's string buffer, offset by append as necessary */ bp = (STDCHAR*)SvPVX_const(sv) + append; /* move these two too to registers */ + /* extract the point to the read-ahead buffer */ ptr = (STDCHAR*)PerlIO_get_ptr(fp); + + /* some trace debug output */ DEBUG_P(PerlIO_printf(Perl_debug_log, "Screamer: entering, ptr=%"UVuf", cnt=%ld\n",PTR2UV(ptr),(long)cnt)); DEBUG_P(PerlIO_printf(Perl_debug_log, - "Screamer: entering: PerlIO * thinks ptr=%"UVuf", cnt=%ld, base=%"UVuf"\n", - PTR2UV(PerlIO_get_ptr(fp)), (long)PerlIO_get_cnt(fp), + "Screamer: entering: PerlIO * thinks ptr=%"UVuf", cnt=%zd, base=%" + UVuf"\n", + PTR2UV(PerlIO_get_ptr(fp)), PerlIO_get_cnt(fp), PTR2UV(PerlIO_has_base(fp) ? PerlIO_get_base(fp) : 0))); + for (;;) { screamer: + /* if there is stuff left in the read-ahead buffer */ if (cnt > 0) { + /* if there is a separator */ if (rslen) { + /* loop until we hit the end of the read-ahead buffer */ while (cnt > 0) { /* this | eat */ + /* scan forward copying and searching for rslast as we go */ cnt--; if ((*bp++ = *ptr++) == rslast) /* really | dust */ goto thats_all_folks; /* screams | sed :-) */ } } else { + /* no separator, slurp the full buffer */ Copy(ptr, bp, cnt, char); /* this | eat */ bp += cnt; /* screams | dust */ ptr += cnt; /* louder | sed :-) */ @@ -7976,56 +8318,74 @@ Perl_sv_gets(pTHX_ SV *const sv, PerlIO } if (shortbuffered) { /* oh well, must extend */ + /* we didnt have enough room to fit the line into the target buffer + * so we must extend the target buffer and keep going */ cnt = shortbuffered; shortbuffered = 0; bpx = bp - (STDCHAR*)SvPVX_const(sv); /* box up before relocation */ SvCUR_set(sv, bpx); + /* extned the target sv's buffer so it can hold the full read-ahead buffer */ SvGROW(sv, SvLEN(sv) + append + cnt + 2); bp = (STDCHAR*)SvPVX_const(sv) + bpx; /* unbox after relocation */ continue; } cannot_be_shortbuffered: + /* we need to refill the read-ahead buffer if possible */ + DEBUG_P(PerlIO_printf(Perl_debug_log, - "Screamer: going to getc, ptr=%"UVuf", cnt=%ld\n", - PTR2UV(ptr),(long)cnt)); + "Screamer: going to getc, ptr=%"UVuf", cnt=%zd\n", + PTR2UV(ptr),cnt)); PerlIO_set_ptrcnt(fp, (STDCHAR*)ptr, cnt); /* deregisterize cnt and ptr */ DEBUG_Pv(PerlIO_printf(Perl_debug_log, - "Screamer: pre: FILE * thinks ptr=%"UVuf", cnt=%ld, base=%"UVuf"\n", - PTR2UV(PerlIO_get_ptr(fp)), (long)PerlIO_get_cnt(fp), + "Screamer: pre: FILE * thinks ptr=%"UVuf", cnt=%zd, base=%"UVuf"\n", + PTR2UV(PerlIO_get_ptr(fp)), PerlIO_get_cnt(fp), PTR2UV(PerlIO_has_base (fp) ? PerlIO_get_base(fp) : 0))); - /* This used to call 'filbuf' in stdio form, but as that behaves like - getc when cnt <= 0 we use PerlIO_getc here to avoid introducing - another abstraction. */ + /* + call PerlIO_getc() to let it prefill the lookahead buffer + + This used to call 'filbuf' in stdio form, but as that behaves like + getc when cnt <= 0 we use PerlIO_getc here to avoid introducing + another abstraction. + + Note we have to deal with the char in 'i' if we are not at EOF + */ i = PerlIO_getc(fp); /* get more characters */ DEBUG_Pv(PerlIO_printf(Perl_debug_log, - "Screamer: post: FILE * thinks ptr=%"UVuf", cnt=%ld, base=%"UVuf"\n", - PTR2UV(PerlIO_get_ptr(fp)), (long)PerlIO_get_cnt(fp), + "Screamer: post: FILE * thinks ptr=%"UVuf", cnt=%zd, base=%"UVuf"\n", + PTR2UV(PerlIO_get_ptr(fp)), PerlIO_get_cnt(fp), PTR2UV(PerlIO_has_base (fp) ? PerlIO_get_base(fp) : 0))); + /* find out how much is left in the read-ahead buffer, and rextract its pointer */ cnt = PerlIO_get_cnt(fp); ptr = (STDCHAR*)PerlIO_get_ptr(fp); /* reregisterize cnt and ptr */ DEBUG_P(PerlIO_printf(Perl_debug_log, - "Screamer: after getc, ptr=%"UVuf", cnt=%ld\n",PTR2UV(ptr),(long)cnt)); + "Screamer: after getc, ptr=%"UVuf", cnt=%zd\n", + PTR2UV(ptr),cnt)); if (i == EOF) /* all done for ever? */ goto thats_really_all_folks; + /* make sure we have enough space in the target sv */ bpx = bp - (STDCHAR*)SvPVX_const(sv); /* box up before relocation */ SvCUR_set(sv, bpx); SvGROW(sv, bpx + cnt + 2); bp = (STDCHAR*)SvPVX_const(sv) + bpx; /* unbox after relocation */ + /* copy of the char we got from getc() */ *bp++ = (STDCHAR)i; /* store character from PerlIO_getc */ + /* make sure we deal with the i being the last character of a separator */ if (rslen && (STDCHAR)i == rslast) /* all done for now? */ goto thats_all_folks; } thats_all_folks: + /* check if we have actually found the separator - only really applies + * when rslen > 1 */ if ((rslen > 1 && (STRLEN)(bp - (STDCHAR*)SvPVX_const(sv)) < rslen) || memNE((char*)bp - rslen, rsptr, rslen)) goto screamer; /* go back to the fray */ @@ -8033,11 +8393,12 @@ thats_really_all_folks: if (shortbuffered) cnt += shortbuffered; DEBUG_P(PerlIO_printf(Perl_debug_log, - "Screamer: quitting, ptr=%"UVuf", cnt=%ld\n",PTR2UV(ptr),(long)cnt)); + "Screamer: quitting, ptr=%"UVuf", cnt=%zd\n",PTR2UV(ptr),cnt)); PerlIO_set_ptrcnt(fp, (STDCHAR*)ptr, cnt); /* put these back or we're in trouble */ DEBUG_P(PerlIO_printf(Perl_debug_log, - "Screamer: end: FILE * thinks ptr=%"UVuf", cnt=%ld, base=%"UVuf"\n", - PTR2UV(PerlIO_get_ptr(fp)), (long)PerlIO_get_cnt(fp), + "Screamer: end: FILE * thinks ptr=%"UVuf", cnt=%zd, base=%"UVuf + "\n", + PTR2UV(PerlIO_get_ptr(fp)), PerlIO_get_cnt(fp), PTR2UV(PerlIO_has_base (fp) ? PerlIO_get_base(fp) : 0))); *bp = '\0'; SvCUR_set(sv, bp - (STDCHAR*)SvPVX_const(sv)); /* set length */ @@ -8158,10 +8519,7 @@ Perl_sv_inc_nomg(pTHX_ SV *const sv) if (!sv) return; if (SvTHINKFIRST(sv)) { - if (SvIsCOW(sv) || isGV_with_GP(sv)) - sv_force_normal_flags(sv, 0); if (SvREADONLY(sv)) { - if (IN_PERL_RUNTIME) Perl_croak_no_modify(); } if (SvROK(sv)) { @@ -8172,6 +8530,7 @@ Perl_sv_inc_nomg(pTHX_ SV *const sv) sv_unref(sv); sv_setiv(sv, i); } + else sv_force_normal_flags(sv, 0); } flags = SvFLAGS(sv); if ((flags & (SVp_NOK|SVp_IOK)) == SVp_NOK) { @@ -8340,10 +8699,7 @@ Perl_sv_dec_nomg(pTHX_ SV *const sv) if (!sv) return; if (SvTHINKFIRST(sv)) { - if (SvIsCOW(sv) || isGV_with_GP(sv)) - sv_force_normal_flags(sv, 0); if (SvREADONLY(sv)) { - if (IN_PERL_RUNTIME) Perl_croak_no_modify(); } if (SvROK(sv)) { @@ -8354,6 +8710,7 @@ Perl_sv_dec_nomg(pTHX_ SV *const sv) sv_unref(sv); sv_setiv(sv, i); } + else sv_force_normal_flags(sv, 0); } /* Unlike sv_inc we don't have to worry about string-never-numbers and keeping them magic. But we mustn't warn on punting */ @@ -8512,7 +8869,8 @@ Perl_sv_newmortal(pTHX) /* =for apidoc newSVpvn_flags -Creates a new SV and copies a string into it. The reference count for the +Creates a new SV and copies a string (which may contain C (C<\0>) +characters) into it. The reference count for the SV is set to 1. Note that if C is zero, Perl will create a zero length string. You are responsible for ensuring that the source string is at least C bytes long. If the C argument is NULL the new SV will be undefined. @@ -8541,13 +8899,13 @@ Perl_newSVpvn_flags(pTHX_ const char *co new_SV(sv); sv_setpvn(sv,s,len); - /* This code used to a sv_2mortal(), however we now unroll the call to sv_2mortal() - * and do what it does ourselves here. - * Since we have asserted that flags can only have the SVf_UTF8 and/or SVs_TEMP flags - * set above we can use it to enable the sv flags directly (bypassing SvTEMP_on), which - * in turn means we dont need to mask out the SVf_UTF8 flag below, which means that we - * eliminate quite a few steps than it looks - Yves (explaining patch by gfx) - */ + /* This code used to do a sv_2mortal(), however we now unroll the call to + * sv_2mortal() and do what it does ourselves here. Since we have asserted + * that flags can only have the SVf_UTF8 and/or SVs_TEMP flags set above we + * can use it to enable the sv flags directly (bypassing SvTEMP_on), which + * in turn means we dont need to mask out the SVf_UTF8 flag below, which + * means that we eliminate quite a few steps than it looks - Yves + * (explaining patch by gfx) */ SvFLAGS(sv) |= flags; @@ -8586,9 +8944,13 @@ Perl_sv_2mortal(pTHX_ SV *const sv) /* =for apidoc newSVpv -Creates a new SV and copies a string into it. The reference count for the +Creates a new SV and copies a string (which may contain C (C<\0>) +characters) into it. The reference count for the SV is set to 1. If C is zero, Perl will compute the length using -strlen(). For efficiency, consider using C instead. +strlen(), (which means if you use this option, that C can't have embedded +C characters and has to have a terminating C byte). + +For efficiency, consider using C instead. =cut */ @@ -8607,7 +8969,7 @@ Perl_newSVpv(pTHX_ const char *const s, /* =for apidoc newSVpvn -Creates a new SV and copies a buffer into it, which may contain NUL characters +Creates a new SV and copies a string into it, which may contain C characters (C<\0>) and other binary data. The reference count for the SV is set to 1. Note that if C is zero, Perl will create a zero length (Perl) string. You are responsible for ensuring that the source buffer is at least @@ -8746,7 +9108,7 @@ Perl_newSVpvn_share(pTHX_ const char *sr /* =for apidoc newSVpv_share -Like C, but takes a nul-terminated string instead of a +Like C, but takes a C-terminated string instead of a string/length pair. =cut @@ -8989,7 +9351,7 @@ Perl_sv_resetpvn(pTHX_ const char *s, ST char todo[PERL_UCHAR_MAX+1]; const char *send; - if (!stash) + if (!stash || SvTYPE(stash) != SVt_PVHV) return; if (!s) { /* reset ?? searches */ @@ -9041,35 +9403,15 @@ Perl_sv_resetpvn(pTHX_ const char *s, ST continue; gv = MUTABLE_GV(HeVAL(entry)); sv = GvSV(gv); - if (sv) { - if (SvTHINKFIRST(sv)) { - if (!SvREADONLY(sv) && SvROK(sv)) - sv_unref(sv); - /* XXX Is this continue a bug? Why should THINKFIRST - exempt us from resetting arrays and hashes? */ - continue; - } - SvOK_off(sv); - if (SvTYPE(sv) >= SVt_PV) { - SvCUR_set(sv, 0); - if (SvPVX_const(sv) != NULL) - *SvPVX(sv) = '\0'; - SvTAINT(sv); - } + if (sv && !SvREADONLY(sv)) { + SV_CHECK_THINKFIRST_COW_DROP(sv); + if (!isGV(sv)) SvOK_off(sv); } if (GvAV(gv)) { av_clear(GvAV(gv)); } if (GvHV(gv) && !HvNAME_get(GvHV(gv))) { -#if defined(VMS) - Perl_die(aTHX_ "Can't reset %%ENV on this system"); -#else /* ! VMS */ hv_clear(GvHV(gv)); -# if defined(USE_ENVIRON_ARRAY) - if (gv == PL_envgv) - my_clearenv(); -# endif /* USE_ENVIRON_ARRAY */ -#endif /* VMS */ } } } @@ -9279,7 +9621,7 @@ Perl_sv_pvn_force_flags(pTHX_ SV *const PERL_ARGS_ASSERT_SV_PVN_FORCE_FLAGS; if (flags & SV_GMAGIC) SvGETMAGIC(sv); - if (SvTHINKFIRST(sv) && !SvROK(sv)) + if (SvTHINKFIRST(sv) && (!SvROK(sv) || SvREADONLY(sv))) sv_force_normal_flags(sv, 0); if (SvPOK(sv)) { @@ -9290,14 +9632,6 @@ Perl_sv_pvn_force_flags(pTHX_ SV *const char *s; STRLEN len; - if (SvREADONLY(sv) && !(flags & SV_MUTABLE_RETURN)) { - const char * const ref = sv_reftype(sv,0); - if (PL_op) - Perl_croak(aTHX_ "Can't coerce readonly %s to string in %s", - ref, OP_DESC(PL_op)); - else - Perl_croak(aTHX_ "Can't coerce readonly %s to string", ref); - } if (SvTYPE(sv) > SVt_PVLV || isGV_with_GP(sv)) /* diag_listed_as: Can't coerce %s to %s in %s */ @@ -9310,7 +9644,8 @@ Perl_sv_pvn_force_flags(pTHX_ SV *const if (lp) *lp = len; - if (s != SvPVX_const(sv)) { /* Almost, but not quite, sv_setpvn() */ + if (SvTYPE(sv) < SVt_PV || + s != SvPVX_const(sv)) { /* Almost, but not quite, sv_setpvn() */ if (SvROK(sv)) sv_unref(sv); SvUPGRADE(sv, SVt_PV); /* Never FALSE */ @@ -9386,6 +9721,14 @@ Perl_sv_reftype(pTHX_ const SV *const sv return SvPV_nolen_const(sv_ref(NULL, sv, ob)); } else { + /* WARNING - There is code, for instance in mg.c, that assumes that + * the only reason that sv_reftype(sv,0) would return a string starting + * with 'L' or 'S' is that it is a LVALUE or a SCALAR. + * Yes this a dodgy way to do type checking, but it saves practically reimplementing + * this routine inside other subs, and it saves time. + * Do not change this assumption without searching for "dodgy type check" in + * the code. + * - Yves */ switch (SvTYPE(sv)) { case SVt_NULL: case SVt_IV: @@ -9413,7 +9756,7 @@ Perl_sv_reftype(pTHX_ const SV *const sv ? "GLOB" : "SCALAR"); case SVt_PVFM: return "FORMAT"; case SVt_PVIO: return "IO"; - case SVt_BIND: return "BIND"; + case SVt_INVLIST: return "INVLIST"; case SVt_REGEXP: return "REGEXP"; default: return "UNKNOWN"; } @@ -9510,7 +9853,7 @@ Perl_sv_isa(pTHX_ SV *sv, const char *co Creates a new SV for the existing RV, C, to point to. If C is not an RV then it will be upgraded to one. If C is non-null then the new SV will be blessed in the specified package. The new SV is returned and its -reference count is 1. The reference count 1 is owned by C. +reference count is 1. The reference count 1 is owned by C. =cut */ @@ -9552,6 +9895,19 @@ Perl_newSVrv(pTHX_ SV *const rv, const c return sv; } +SV * +Perl_newSVavdefelem(pTHX_ AV *av, SSize_t ix, bool extendible) +{ + SV * const lv = newSV_type(SVt_PVLV); + PERL_ARGS_ASSERT_NEWSVAVDEFELEM; + LvTYPE(lv) = 'y'; + sv_magic(lv, NULL, PERL_MAGIC_defelem, NULL, 0); + LvTARG(lv) = SvREFCNT_inc_simple_NN(av); + LvSTARGOFF(lv) = ix; + LvTARGLEN(lv) = extendible ? 1 : (STRLEN)UV_MAX; + return lv; +} + /* =for apidoc sv_setref_pv @@ -9689,22 +10045,25 @@ Perl_sv_bless(pTHX_ SV *const sv, HV *co { dVAR; SV *tmpRef; + HV *oldstash = NULL; PERL_ARGS_ASSERT_SV_BLESS; + SvGETMAGIC(sv); if (!SvROK(sv)) Perl_croak(aTHX_ "Can't bless non-reference value"); tmpRef = SvRV(sv); if (SvFLAGS(tmpRef) & (SVs_OBJECT|SVf_READONLY)) { - if (SvREADONLY(tmpRef) && !SvIsCOW(tmpRef)) + if (SvREADONLY(tmpRef)) Perl_croak_no_modify(); if (SvOBJECT(tmpRef)) { - SvREFCNT_dec(SvSTASH(tmpRef)); + oldstash = SvSTASH(tmpRef); } } SvOBJECT_on(tmpRef); SvUPGRADE(tmpRef, SVt_PVMG); SvSTASH_set(tmpRef, MUTABLE_HV(SvREFCNT_inc_simple(stash))); + SvREFCNT_dec(oldstash); if(SvSMAGICAL(tmpRef)) if(mg_find(tmpRef, PERL_MAGIC_ext) || mg_find(tmpRef, PERL_MAGIC_uvar)) @@ -9734,6 +10093,7 @@ S_sv_unglob(pTHX_ SV *const sv, U32 flag if (!(flags & SV_COW_DROP_PV)) gv_efullname3(temp, MUTABLE_GV(sv), "*"); + SvREFCNT_inc_simple_void_NN(sv_2mortal(sv)); if (GvGP(sv)) { if(GvCVu((const GV *)sv) && (stash = GvSTASH(MUTABLE_GV(sv))) && HvNAME_get(stash)) @@ -10022,7 +10382,7 @@ Perl_sv_catpvf_nocontext(SV *const sv, c PERL_ARGS_ASSERT_SV_CATPVF_NOCONTEXT; va_start(args, pat); - sv_vcatpvf(sv, pat, &args); + sv_vcatpvfn_flags(sv, pat, strlen(pat), &args, NULL, 0, NULL, SV_GMAGIC|SV_SMAGIC); va_end(args); } @@ -10040,7 +10400,8 @@ Perl_sv_catpvf_mg_nocontext(SV *const sv PERL_ARGS_ASSERT_SV_CATPVF_MG_NOCONTEXT; va_start(args, pat); - sv_vcatpvf_mg(sv, pat, &args); + sv_vcatpvfn_flags(sv, pat, strlen(pat), &args, NULL, 0, NULL, SV_GMAGIC|SV_SMAGIC); + SvSETMAGIC(sv); va_end(args); } #endif @@ -10066,7 +10427,7 @@ Perl_sv_catpvf(pTHX_ SV *const sv, const PERL_ARGS_ASSERT_SV_CATPVF; va_start(args, pat); - sv_vcatpvf(sv, pat, &args); + sv_vcatpvfn_flags(sv, pat, strlen(pat), &args, NULL, 0, NULL, SV_GMAGIC|SV_SMAGIC); va_end(args); } @@ -10086,7 +10447,7 @@ Perl_sv_vcatpvf(pTHX_ SV *const sv, cons { PERL_ARGS_ASSERT_SV_VCATPVF; - sv_vcatpvfn(sv, pat, strlen(pat), args, NULL, 0, NULL); + sv_vcatpvfn_flags(sv, pat, strlen(pat), args, NULL, 0, NULL, SV_GMAGIC|SV_SMAGIC); } /* @@ -10105,7 +10466,8 @@ Perl_sv_catpvf_mg(pTHX_ SV *const sv, co PERL_ARGS_ASSERT_SV_CATPVF_MG; va_start(args, pat); - sv_vcatpvf_mg(sv, pat, &args); + sv_vcatpvfn_flags(sv, pat, strlen(pat), &args, NULL, 0, NULL, SV_GMAGIC|SV_SMAGIC); + SvSETMAGIC(sv); va_end(args); } @@ -10273,6 +10635,8 @@ Perl_sv_vcatpvfn_flags(pTHX_ SV *const s /* large enough for "%#.#f" --chip */ /* what about long double NVs? --jhi */ + DECLARATION_FOR_STORE_LC_NUMERIC_SET_TO_NEEDED; + PERL_ARGS_ASSERT_SV_VCATPVFN_FLAGS; PERL_UNUSED_ARG(maybe_tainted); @@ -10324,7 +10688,8 @@ Perl_sv_vcatpvfn_flags(pTHX_ SV *const s a Configure test for this. */ if (digits && digits < sizeof(ebuf) - NV_DIG - 10) { /* 0, point, slack */ - Gconvert(nv, (int)digits, 0, ebuf); + STORE_LC_NUMERIC_SET_TO_NEEDED(); + PERL_UNUSED_RESULT(Gconvert(nv, (int)digits, 0, ebuf)); sv_catpv_nomg(sv, ebuf); if (*ebuf) /* May return an empty string for digits==0 */ return; @@ -10440,7 +10805,8 @@ Perl_sv_vcatpvfn_flags(pTHX_ SV *const s %-p include an SV with precision %2p include a HEK %3p include a HEK with precision of 256 - %p (where num != 2 or 3) reserved for future + %4p char* preceded by utf8 flag and length + %p (where num is 1 or > 4) reserved for future extensions Robin Barker 2005-07-14 (but modified since) @@ -10452,6 +10818,15 @@ Perl_sv_vcatpvfn_flags(pTHX_ SV *const s STRLEN n = 0; if (*q == '-') sv = *q++; + else if (strnEQ(q, UTF8f, sizeof(UTF8f)-1)) { /* UTF8f */ + /* The argument has already gone through cBOOL, so the cast + is safe. */ + is_utf8 = (bool)va_arg(*args, int); + elen = va_arg(*args, UV); + eptr = va_arg(*args, char *); + q += sizeof(UTF8f)-1; + goto string; + } n = expect_number(&q); if (*q++ == 'p') { if (sv) { /* SVf */ @@ -10667,10 +11042,10 @@ Perl_sv_vcatpvfn_flags(pTHX_ SV *const s q++; break; #endif -#if defined(HAS_QUAD) || defined(HAS_LONG_DOUBLE) +#if IVSIZE >= 8 || defined(HAS_LONG_DOUBLE) case 'L': /* Ld */ /*FALLTHROUGH*/ -#ifdef HAS_QUAD +#if IVSIZE >= 8 case 'q': /* qd */ #endif intsize = 'q'; @@ -10679,7 +11054,7 @@ Perl_sv_vcatpvfn_flags(pTHX_ SV *const s #endif case 'l': ++q; -#if defined(HAS_QUAD) || defined(HAS_LONG_DOUBLE) +#if IVSIZE >= 8 || defined(HAS_LONG_DOUBLE) if (*q == 'l') { /* lld, llf */ intsize = 'q'; ++q; @@ -10699,7 +11074,7 @@ Perl_sv_vcatpvfn_flags(pTHX_ SV *const s case 'V': case 'z': case 't': -#if HAS_C99 +#ifdef HAS_C99 case 'j': #endif intsize = *q++; @@ -10738,7 +11113,7 @@ Perl_sv_vcatpvfn_flags(pTHX_ SV *const s goto unknown; uv = (args) ? va_arg(*args, int) : SvIV(argsv); if ((uv > 255 || - (!UNI_IS_INVARIANT(uv) && SvUTF8(sv))) + (!UVCHR_IS_INVARIANT(uv) && SvUTF8(sv))) && !IN_BYTES) { eptr = (char*)utf8buf; elen = uvchr_to_utf8((U8*)eptr, uv) - utf8buf; @@ -10807,9 +11182,6 @@ Perl_sv_vcatpvfn_flags(pTHX_ SV *const s /*FALLTHROUGH*/ case 'd': case 'i': -#if vdNUMBER - format_vd: -#endif if (vectorize) { STRLEN ulen; if (!veclen) @@ -10835,11 +11207,11 @@ Perl_sv_vcatpvfn_flags(pTHX_ SV *const s case 'z': iv = va_arg(*args, SSize_t); break; case 't': iv = va_arg(*args, ptrdiff_t); break; default: iv = va_arg(*args, int); break; -#if HAS_C99 +#ifdef HAS_C99 case 'j': iv = va_arg(*args, intmax_t); break; #endif case 'q': -#ifdef HAS_QUAD +#if IVSIZE >= 8 iv = va_arg(*args, Quad_t); break; #else goto unknown; @@ -10855,7 +11227,7 @@ Perl_sv_vcatpvfn_flags(pTHX_ SV *const s case 'V': default: iv = tiv; break; case 'q': -#ifdef HAS_QUAD +#if IVSIZE >= 8 iv = (Quad_t)tiv; break; #else goto unknown; @@ -10932,12 +11304,12 @@ Perl_sv_vcatpvfn_flags(pTHX_ SV *const s case 'V': uv = va_arg(*args, UV); break; case 'z': uv = va_arg(*args, Size_t); break; case 't': uv = va_arg(*args, ptrdiff_t); break; /* will sign extend, but there is no uptrdiff_t, so oh well */ -#if HAS_C99 +#ifdef HAS_C99 case 'j': uv = va_arg(*args, uintmax_t); break; #endif default: uv = va_arg(*args, unsigned); break; case 'q': -#ifdef HAS_QUAD +#if IVSIZE >= 8 uv = va_arg(*args, Uquad_t); break; #else goto unknown; @@ -10953,7 +11325,7 @@ Perl_sv_vcatpvfn_flags(pTHX_ SV *const s case 'V': default: uv = tuv; break; case 'q': -#ifdef HAS_QUAD +#if IVSIZE >= 8 uv = (Uquad_t)tuv; break; #else goto unknown; @@ -11174,7 +11546,8 @@ Perl_sv_vcatpvfn_flags(pTHX_ SV *const s /* See earlier comment about buggy Gconvert when digits, aka precis is 0 */ if ( c == 'g' && precis) { - Gconvert((NV)nv, (int)precis, 0, PL_efloatbuf); + STORE_LC_NUMERIC_SET_TO_NEEDED(); + PERL_UNUSED_RESULT(Gconvert((NV)nv, (int)precis, 0, PL_efloatbuf)); /* May return an empty string for digits==0 */ if (*PL_efloatbuf) { elen = strlen(PL_efloatbuf); @@ -11222,6 +11595,12 @@ Perl_sv_vcatpvfn_flags(pTHX_ SV *const s /* No taint. Otherwise we are in the strange situation * where printf() taints but print($float) doesn't. * --jhi */ + + STORE_LC_NUMERIC_SET_TO_NEEDED(); + + /* hopefully the above makes ptr a very constrained format + * that is safe to use, even though it's not literal */ + GCC_DIAG_IGNORE(-Wformat-nonliteral); #if defined(HAS_LONG_DOUBLE) elen = ((intsize == 'q') ? my_snprintf(PL_efloatbuf, PL_efloatsize, ptr, nv) @@ -11229,9 +11608,21 @@ Perl_sv_vcatpvfn_flags(pTHX_ SV *const s #else elen = my_sprintf(PL_efloatbuf, ptr, nv); #endif + GCC_DIAG_RESTORE; } float_converted: eptr = PL_efloatbuf; + +#ifdef USE_LOCALE_NUMERIC + /* If the decimal point character in the string is UTF-8, make the + * output utf8 */ + if (PL_numeric_radix_sv && SvUTF8(PL_numeric_radix_sv) + && instr(eptr, SvPVX_const(PL_numeric_radix_sv))) + { + is_utf8 = TRUE; + } +#endif + break; /* SPECIAL */ @@ -11249,11 +11640,11 @@ Perl_sv_vcatpvfn_flags(pTHX_ SV *const s case 'V': *(va_arg(*args, IV*)) = i; break; case 'z': *(va_arg(*args, SSize_t*)) = i; break; case 't': *(va_arg(*args, ptrdiff_t*)) = i; break; -#if HAS_C99 +#ifdef HAS_C99 case 'j': *(va_arg(*args, intmax_t*)) = i; break; #endif case 'q': -#ifdef HAS_QUAD +#if IVSIZE >= 8 *(va_arg(*args, Quad_t*)) = i; break; #else goto unknown; @@ -11332,13 +11723,13 @@ Perl_sv_vcatpvfn_flags(pTHX_ SV *const s have = esignlen + zeros + elen; if (have < zeros) - Perl_croak_memory_wrap(); + croak_memory_wrap(); need = (have > width ? have : width); gap = need - have; if (need >= (((STRLEN)~0) - SvCUR(sv) - dotstrlen - 1)) - Perl_croak_memory_wrap(); + croak_memory_wrap(); SvGROW(sv, SvCUR(sv) + need + dotstrlen + 1); p = SvEND(sv); if (esignlen && fill == '0') { @@ -11388,6 +11779,9 @@ Perl_sv_vcatpvfn_flags(pTHX_ SV *const s } } SvTAINT(sv); + + RESTORE_LC_NUMERIC(); /* Done outside loop, so don't have to save/restore + each iteration. */ } /* ========================================================================= @@ -11583,7 +11977,7 @@ Perl_dirp_dup(pTHX_ DIR *const dp, CLONE { DIR *ret; -#ifdef HAS_FCHDIR +#if defined(HAS_FCHDIR) && defined(HAS_TELLDIR) && defined(HAS_SEEKDIR) DIR *pwd; const Direntry_t *dirent; char smallbuf[256]; @@ -11603,7 +11997,7 @@ Perl_dirp_dup(pTHX_ DIR *const dp, CLONE if (ret) return ret; -#ifdef HAS_FCHDIR +#if defined(HAS_FCHDIR) && defined(HAS_TELLDIR) && defined(HAS_SEEKDIR) PERL_UNUSED_ARG(param); @@ -11620,7 +12014,8 @@ Perl_dirp_dup(pTHX_ DIR *const dp, CLONE /* Now we should have two dir handles pointing to the same dir. */ /* Be nice to the calling code and chdir back to where we were. */ - fchdir(my_dirfd(pwd)); /* If this fails, then what? */ + /* XXX If this fails, then what? */ + PERL_UNUSED_RESULT(fchdir(my_dirfd(pwd))); /* We have no need of the pwd handle any more. */ PerlDir_close(pwd); @@ -11846,7 +12241,9 @@ Perl_ptr_table_fetch(pTHX_ PTR_TBL_t *co return tblent ? tblent->newval : NULL; } -/* add a new entry to a pointer-mapping table */ +/* add a new entry to a pointer-mapping table 'tbl'. In hash terms, 'oldsv' is + * the key; 'newsv' is the value. The names "old" and "new" are specific to + * the core's typical use of ptr_tables in thread cloning. */ void Perl_ptr_table_store(pTHX_ PTR_TBL_t *const tbl, const void *const oldsv, void *const newsv) @@ -11868,8 +12265,7 @@ Perl_ptr_table_store(pTHX_ PTR_TBL_t *co new_arena->next = tbl->tbl_arena; tbl->tbl_arena = new_arena; tbl->tbl_arena_next = new_arena->array; - tbl->tbl_arena_end = new_arena->array - + sizeof(new_arena->array) / sizeof(new_arena->array[0]); + tbl->tbl_arena_end = C_ARRAY_END(new_arena->array); } tblent = tbl->tbl_arena_next++; @@ -12140,7 +12536,6 @@ S_sv_dup_common(pTHX_ const SV *const ss SvANY(dstr) = new_XNV(); SvNV_set(dstr, SvNVX(sstr)); break; - /* case SVt_BIND: */ default: { /* These are all the types that need complex bodies allocating. */ @@ -12165,6 +12560,7 @@ S_sv_dup_common(pTHX_ const SV *const ss case SVt_PVMG: case SVt_PVNV: case SVt_PVIV: + case SVt_INVLIST: case SVt_PV: assert(sv_type_details->body_size); if (sv_type_details->arena) { @@ -12202,6 +12598,8 @@ S_sv_dup_common(pTHX_ const SV *const ss if (sv_type >= SVt_PVMG) { if ((sv_type == SVt_PVMG) && SvPAD_OUR(dstr)) { SvOURSTASH_set(dstr, hv_dup_inc(SvOURSTASH(dstr), param)); + } else if (sv_type == SVt_PVAV && AvPAD_NAMELIST(dstr)) { + NOOP; } else if (SvMAGIC(dstr)) SvMAGIC_set(dstr, mg_dup(SvMAGIC(dstr), param)); if (SvOBJECT(dstr) && SvSTASH(dstr)) @@ -12356,6 +12754,12 @@ S_sv_dup_common(pTHX_ const SV *const ss } daux->xhv_name_count = saux->xhv_name_count; + daux->xhv_fill_lazy = saux->xhv_fill_lazy; + daux->xhv_aux_flags = saux->xhv_aux_flags; +#ifdef PERL_HASH_RANDOMIZE_KEYS + daux->xhv_rand = saux->xhv_rand; + daux->xhv_last_rand = saux->xhv_last_rand; +#endif daux->xhv_riter = saux->xhv_riter; daux->xhv_eiter = saux->xhv_eiter ? he_dup(saux->xhv_eiter, @@ -12383,7 +12787,6 @@ S_sv_dup_common(pTHX_ const SV *const ss daux->xhv_mro_meta = saux->xhv_mro_meta ? mro_meta_dup(saux->xhv_mro_meta, param) : 0; - daux->xhv_super = NULL; /* Record stashes for possible cloning in Perl_clone(). */ if (HvNAME(sstr)) @@ -12514,8 +12917,10 @@ Perl_cx_dup(pTHX_ PERL_CONTEXT *cxs, I32 ? av_dup_inc(ncx->blk_sub.argarray, param) : NULL); - ncx->blk_sub.savearray = av_dup_inc(ncx->blk_sub.savearray, - param); + ncx->blk_sub.savearray = (CxHASARGS(ncx) + ? av_dup_inc(ncx->blk_sub.savearray, + param) + : NULL); ncx->blk_sub.oldcomppad = (PAD*)ptr_table_fetch(PL_ptr_table, ncx->blk_sub.oldcomppad); break; @@ -12700,6 +13105,7 @@ Perl_ss_dup(pTHX_ PerlInterpreter *proto /* fall through */ case SAVEt_FREESV: case SAVEt_MORTALIZESV: + case SAVEt_READONLY_OFF: sv = (const SV *)POPPTR(ss,ix); TOPPTR(nss,ix) = sv_dup_inc(sv, param); break; @@ -12753,6 +13159,7 @@ Perl_ss_dup(pTHX_ PerlInterpreter *proto TOPINT(nss,ix) = i; break; case SAVEt_IV: /* IV reference */ + case SAVEt_STRLEN: /* STRLEN/size_t ref */ ptr = POPPTR(ss,ix); TOPPTR(nss,ix) = any_dup(ptr, proto_perl); iv = POPIV(ss,ix); @@ -12822,6 +13229,12 @@ Perl_ss_dup(pTHX_ PerlInterpreter *proto ptr = POPPTR(ss,ix); TOPPTR(nss,ix) = cophh_copy((COPHH *)ptr); break; + case SAVEt_ADELETE: + av = (const AV *)POPPTR(ss,ix); + TOPPTR(nss,ix) = av_dup_inc(av, param); + i = POPINT(ss,ix); + TOPINT(nss,ix) = i; + break; case SAVEt_DELETE: hv = (const HV *)POPPTR(ss,ix); TOPPTR(nss,ix) = hv_dup_inc(hv, param); @@ -12895,43 +13308,6 @@ Perl_ss_dup(pTHX_ PerlInterpreter *proto sv = (const SV *)POPPTR(ss,ix); TOPPTR(nss,ix) = sv_dup(sv, param); break; - case SAVEt_RE_STATE: - { - const struct re_save_state *const old_state - = (struct re_save_state *) - (ss + ix - SAVESTACK_ALLOC_FOR_RE_SAVE_STATE); - struct re_save_state *const new_state - = (struct re_save_state *) - (nss + ix - SAVESTACK_ALLOC_FOR_RE_SAVE_STATE); - - Copy(old_state, new_state, 1, struct re_save_state); - ix -= SAVESTACK_ALLOC_FOR_RE_SAVE_STATE; - - new_state->re_state_bostr - = pv_dup(old_state->re_state_bostr); - new_state->re_state_regeol - = pv_dup(old_state->re_state_regeol); -#ifdef PERL_ANY_COW - new_state->re_state_nrs - = sv_dup(old_state->re_state_nrs, param); -#endif - new_state->re_state_reg_magic - = (MAGIC*) any_dup(old_state->re_state_reg_magic, - proto_perl); - new_state->re_state_reg_oldcurpm - = (PMOP*) any_dup(old_state->re_state_reg_oldcurpm, - proto_perl); - new_state->re_state_reg_curpm - = (PMOP*) any_dup(old_state->re_state_reg_curpm, - proto_perl); - new_state->re_state_reg_oldsaved - = pv_dup(old_state->re_state_reg_oldsaved); - new_state->re_state_reg_poscache - = pv_dup(old_state->re_state_reg_poscache); - new_state->re_state_reg_starttry - = pv_dup(old_state->re_state_reg_starttry); - break; - } case SAVEt_COMPILE_WARNINGS: ptr = POPPTR(ss,ix); TOPPTR(nss,ix) = DUP_WARNINGS((STRLEN*)ptr); @@ -13148,7 +13524,7 @@ perl_clone_using(PerlInterpreter *proto_ PL_origargc = proto_perl->Iorigargc; PL_origargv = proto_perl->Iorigargv; -#if !NO_TAINT_SUPPORT +#ifndef NO_TAINT_SUPPORT /* Set tainting stuff before PerlIO_debug can possibly get called */ PL_tainting = proto_perl->Itainting; PL_taint_warn = proto_perl->Itaint_warn; @@ -13189,8 +13565,8 @@ perl_clone_using(PerlInterpreter *proto_ #endif /* RE engine related */ - Zero(&PL_reg_state, 1, struct re_save_state); PL_regmatch_slab = NULL; + PL_reg_curpm = NULL; PL_sub_generation = proto_perl->Isub_generation; @@ -13242,8 +13618,6 @@ perl_clone_using(PerlInterpreter *proto_ PL_cryptseen = proto_perl->Icryptseen; #endif - PL_hints = proto_perl->Ihints; - #ifdef USE_LOCALE_COLLATE PL_collation_ix = proto_perl->Icollation_ix; PL_collation_standard = proto_perl->Icollation_standard; @@ -13258,6 +13632,7 @@ perl_clone_using(PerlInterpreter *proto_ /* Did the locale setup indicate UTF-8? */ PL_utf8locale = proto_perl->Iutf8locale; + PL_in_utf8_CTYPE_locale = proto_perl->Iin_utf8_CTYPE_locale; /* Unicode features (see perlrun/-C) */ PL_unicode = proto_perl->Iunicode; @@ -13295,6 +13670,7 @@ perl_clone_using(PerlInterpreter *proto_ PL_last_swash_slen = 0; PL_srand_called = proto_perl->Isrand_called; + Copy(&(proto_perl->Irandom_state), &PL_random_state, 1, PL_RANDOM_STATE_TYPE); if (flags & CLONEf_COPY_STACKS) { /* next allocation will be PL_tmps_stack[PL_tmps_ix+1] */ @@ -13325,11 +13701,7 @@ perl_clone_using(PerlInterpreter *proto_ PL_statbuf = proto_perl->Istatbuf; PL_statcache = proto_perl->Istatcache; -#ifdef HAS_TIMES - PL_timesbuf = proto_perl->Itimesbuf; -#endif - -#if !NO_TAINT_SUPPORT +#ifndef NO_TAINT_SUPPORT PL_tainted = proto_perl->Itainted; #else PL_tainted = FALSE; @@ -13355,7 +13727,6 @@ perl_clone_using(PerlInterpreter *proto_ /* regex stuff */ - PL_regdummy = proto_perl->Iregdummy; PL_colorset = 0; /* reinits PL_colors[] */ /*PL_colors[6] = {0,0,0,0,0,0};*/ @@ -13388,6 +13759,8 @@ perl_clone_using(PerlInterpreter *proto_ hv_ksplit(PL_strtab, HvTOTALKEYS(proto_perl->Istrtab)); ptr_table_store(PL_ptr_table, proto_perl->Istrtab, PL_strtab); + Zero(PL_sv_consts, SV_CONSTS_COUNT, SV*); + /* This PV will be free'd special way so must set it same way op.c does */ PL_compiling.cop_file = savesharedpv(PL_compiling.cop_file); ptr_table_store(PL_ptr_table, proto_perl->Icompiling.cop_file, PL_compiling.cop_file); @@ -13415,9 +13788,9 @@ perl_clone_using(PerlInterpreter *proto_ PerlIO_clone(aTHX_ proto_perl, param); #endif - PL_envgv = gv_dup(proto_perl->Ienvgv, param); - PL_incgv = gv_dup(proto_perl->Iincgv, param); - PL_hintgv = gv_dup(proto_perl->Ihintgv, param); + PL_envgv = gv_dup_inc(proto_perl->Ienvgv, param); + PL_incgv = gv_dup_inc(proto_perl->Iincgv, param); + PL_hintgv = gv_dup_inc(proto_perl->Ihintgv, param); PL_origfilename = SAVEPV(proto_perl->Iorigfilename); PL_diehook = sv_dup_inc(proto_perl->Idiehook, param); PL_warnhook = sv_dup_inc(proto_perl->Iwarnhook, param); @@ -13459,20 +13832,20 @@ perl_clone_using(PerlInterpreter *proto_ PL_stdingv = gv_dup(proto_perl->Istdingv, param); PL_stderrgv = gv_dup(proto_perl->Istderrgv, param); PL_defgv = gv_dup(proto_perl->Idefgv, param); - PL_argvgv = gv_dup(proto_perl->Iargvgv, param); + PL_argvgv = gv_dup_inc(proto_perl->Iargvgv, param); PL_argvoutgv = gv_dup(proto_perl->Iargvoutgv, param); PL_argvout_stack = av_dup_inc(proto_perl->Iargvout_stack, param); /* shortcuts to regexp stuff */ - PL_replgv = gv_dup(proto_perl->Ireplgv, param); + PL_replgv = gv_dup_inc(proto_perl->Ireplgv, param); /* shortcuts to misc objects */ PL_errgv = gv_dup(proto_perl->Ierrgv, param); /* shortcuts to debugging objects */ - PL_DBgv = gv_dup(proto_perl->IDBgv, param); - PL_DBline = gv_dup(proto_perl->IDBline, param); - PL_DBsub = gv_dup(proto_perl->IDBsub, param); + PL_DBgv = gv_dup_inc(proto_perl->IDBgv, param); + PL_DBline = gv_dup_inc(proto_perl->IDBline, param); + PL_DBsub = gv_dup_inc(proto_perl->IDBsub, param); PL_DBsingle = sv_dup(proto_perl->IDBsingle, param); PL_DBtrace = sv_dup(proto_perl->IDBtrace, param); PL_DBsignal = sv_dup(proto_perl->IDBsignal, param); @@ -13581,19 +13954,18 @@ perl_clone_using(PerlInterpreter *proto_ #endif /* !USE_LOCALE_NUMERIC */ /* Unicode inversion lists */ - PL_ASCII = sv_dup_inc(proto_perl->IASCII, param); PL_Latin1 = sv_dup_inc(proto_perl->ILatin1, param); + PL_UpperLatin1 = sv_dup_inc(proto_perl->IUpperLatin1, param); + PL_AboveLatin1 = sv_dup_inc(proto_perl->IAboveLatin1, param); PL_NonL1NonFinalFold = sv_dup_inc(proto_perl->INonL1NonFinalFold, param); - PL_HasMultiCharFold= sv_dup_inc(proto_perl->IHasMultiCharFold, param); + PL_HasMultiCharFold = sv_dup_inc(proto_perl->IHasMultiCharFold, param); /* utf8 character class swashes */ for (i = 0; i < POSIX_SWASH_COUNT; i++) { PL_utf8_swash_ptrs[i] = sv_dup_inc(proto_perl->Iutf8_swash_ptrs[i], param); } for (i = 0; i < POSIX_CC_COUNT; i++) { - PL_Posix_ptrs[i] = sv_dup_inc(proto_perl->IPosix_ptrs[i], param); - PL_L1Posix_ptrs[i] = sv_dup_inc(proto_perl->IL1Posix_ptrs[i], param); PL_XPosix_ptrs[i] = sv_dup_inc(proto_perl->IXPosix_ptrs[i], param); } PL_utf8_mark = sv_dup_inc(proto_perl->Iutf8_mark, param); @@ -13612,9 +13984,6 @@ perl_clone_using(PerlInterpreter *proto_ PL_utf8_foldable = sv_dup_inc(proto_perl->Iutf8_foldable, param); PL_utf8_charname_begin = sv_dup_inc(proto_perl->Iutf8_charname_begin, param); PL_utf8_charname_continue = sv_dup_inc(proto_perl->Iutf8_charname_continue, param); - PL_ASCII = sv_dup_inc(proto_perl->IASCII, param); - PL_AboveLatin1 = sv_dup_inc(proto_perl->IAboveLatin1, param); - PL_Latin1 = sv_dup_inc(proto_perl->ILatin1, param); if (proto_perl->Ipsig_pend) { Newxz(PL_psig_pend, SIG_SIZE, int); @@ -13697,9 +14066,8 @@ perl_clone_using(PerlInterpreter *proto_ PL_errors = sv_dup_inc(proto_perl->Ierrors, param); PL_sortcop = (OP*)any_dup(proto_perl->Isortcop, proto_perl); - PL_sortstash = hv_dup(proto_perl->Isortstash, param); - PL_firstgv = gv_dup(proto_perl->Ifirstgv, param); - PL_secondgv = gv_dup(proto_perl->Isecondgv, param); + PL_firstgv = gv_dup_inc(proto_perl->Ifirstgv, param); + PL_secondgv = gv_dup_inc(proto_perl->Isecondgv, param); PL_stashcache = newHV(); @@ -13720,7 +14088,7 @@ perl_clone_using(PerlInterpreter *proto_ /* Call the ->CLONE method, if it exists, for each of the stashes identified by sv_dup() above. */ - while(av_len(param->stashes) != -1) { + while(av_tindex(param->stashes) != -1) { HV* const stash = MUTABLE_HV(av_shift(param->stashes)); GV* const cloner = gv_fetchmethod_autoload(stash, "CLONE", 0); if (cloner && GvCV(cloner)) { @@ -13923,13 +14291,19 @@ Perl_sv_recode_to_utf8(pTHX_ SV *sv, SV STRLEN len; const char *s; dSP; + SV *nsv = sv; ENTER; + PUSHSTACK; SAVETMPS; + if (SvPADTMP(nsv)) { + nsv = sv_newmortal(); + SvSetSV_nosteal(nsv, sv); + } save_re_context(); PUSHMARK(sp); EXTEND(SP, 3); PUSHs(encoding); - PUSHs(sv); + PUSHs(nsv); /* NI-S 2002/07/09 Passing sv_yes is wrong - it needs to be or'ed set of constants @@ -13952,6 +14326,7 @@ Perl_sv_recode_to_utf8(pTHX_ SV *sv, SV SvCUR_set(sv, len); } FREETMPS; + POPSTACK; LEAVE; if (SvTYPE(sv) >= SVt_PVMG && SvMAGIC(sv)) { /* clear pos and any utf8 cache */ @@ -14284,12 +14659,12 @@ S_find_uninit_var(pTHX_ const OP *const AV *av = MUTABLE_AV(PAD_SV(obase->op_targ)); if (!av || SvRMAGICAL(av)) break; - svp = av_fetch(av, (I32)obase->op_private, FALSE); + svp = av_fetch(av, (I8)obase->op_private, FALSE); if (!svp || *svp != uninit_sv) break; } return varname(NULL, '$', obase->op_targ, - NULL, (I32)obase->op_private, FUV_SUBSCRIPT_ARRAY); + NULL, (I8)obase->op_private, FUV_SUBSCRIPT_ARRAY); case OP_AELEMFAST: { gv = cGVOPx_gv(obase); @@ -14300,12 +14675,12 @@ S_find_uninit_var(pTHX_ const OP *const AV *const av = GvAV(gv); if (!av || SvRMAGICAL(av)) break; - svp = av_fetch(av, (I32)obase->op_private, FALSE); + svp = av_fetch(av, (I8)obase->op_private, FALSE); if (!svp || *svp != uninit_sv) break; } return varname(gv, '$', 0, - NULL, (I32)obase->op_private, FUV_SUBSCRIPT_ARRAY); + NULL, (I8)obase->op_private, FUV_SUBSCRIPT_ARRAY); } break; @@ -14369,8 +14744,10 @@ S_find_uninit_var(pTHX_ const OP *const break; } else { + SV * const opsv = cSVOPx_sv(kid); + const IV opsviv = SvIV(opsv); SV * const * const svp = av_fetch(MUTABLE_AV(sv), - negate ? - SvIV(cSVOPx_sv(kid)) : SvIV(cSVOPx_sv(kid)), + negate ? - opsviv : opsviv, FALSE); if (!svp || *svp != uninit_sv) break; @@ -14648,14 +15025,21 @@ Perl_report_uninit(pTHX_ const SV *unini if (varname) sv_insert(varname, 0, 0, " ", 1); } + /* PL_warn_uninit_sv is constant */ + GCC_DIAG_IGNORE(-Wformat-nonliteral); /* diag_listed_as: Use of uninitialized value%s */ Perl_warner(aTHX_ packWARN(WARN_UNINITIALIZED), PL_warn_uninit_sv, SVfARG(varname ? varname : &PL_sv_no), " in ", OP_DESC(PL_op)); + GCC_DIAG_RESTORE; } - else + else { + /* PL_warn_uninit is constant */ + GCC_DIAG_IGNORE(-Wformat-nonliteral); Perl_warner(aTHX_ packWARN(WARN_UNINITIALIZED), PL_warn_uninit, "", "", ""); + GCC_DIAG_RESTORE; + } } /* Index: gnu/usr.bin/perl/sv.h =================================================================== RCS file: /mnt/memory/perl/importit/cvs/src/gnu/usr.bin/perl/sv.h,v retrieving revision 1.16 diff -u -p -u -p -r1.16 sv.h --- gnu/usr.bin/perl/sv.h 24 Mar 2014 15:05:13 -0000 1.16 +++ gnu/usr.bin/perl/sv.h 16 Nov 2014 03:22:24 -0000 @@ -22,7 +22,6 @@ in the C enum. Test these flags The types are: SVt_NULL - SVt_BIND (unused) SVt_IV SVt_NV SVt_RV @@ -30,6 +29,7 @@ The types are: SVt_PVIV SVt_PVNV SVt_PVMG + SVt_INVLIST SVt_REGEXP SVt_PVGV SVt_PVLV @@ -57,7 +57,9 @@ typeglob has been assigned. Assigning t a typeglob. SVt_PVLV represents a scalar that delegates to another scalar behind the scenes. It is used, e.g., for the return value of C and for tied hash and array elements. It can hold any scalar value, including -a typeglob. SVt_REGEXP is for regular expressions. +a typeglob. SVt_REGEXP is for regular +expressions. SVt_INVLIST is for Perl +core internal use only. SVt_PVMG represents a "normal" scalar (not a typeglob, regular expression, or delegate). Since most scalars do not need all the internal fields of a @@ -91,6 +93,9 @@ Type flag for scalars. See L. =for apidoc AmU||SVt_PVMG Type flag for scalars. See L. +=for apidoc AmU||SVt_INVLIST +Type flag for scalars. See L. + =for apidoc AmU||SVt_REGEXP Type flag for regular expressions. See L. @@ -116,15 +121,22 @@ Type flag for formats. See L. Type flag for I/O objects. See L. =cut + + These are ordered so that the simpler types have a lower value; SvUPGRADE + doesn't allow you to upgrade from a higher numbered type to a lower numbered + one; also there is code that assumes that anything that has as a PV component + has a type numbered >= SVt_PV. */ + typedef enum { SVt_NULL, /* 0 */ - SVt_BIND, /* 1 */ - SVt_IV, /* 2 */ - SVt_NV, /* 3 */ + /* BIND was here, before INVLIST replaced it. */ + SVt_IV, /* 1 */ + SVt_NV, /* 2 */ /* RV was here, before it was merged with IV. */ - SVt_PV, /* 4 */ + SVt_PV, /* 3 */ + SVt_INVLIST, /* 4, implemented as a PV */ SVt_PVIV, /* 5 */ SVt_PVNV, /* 6 */ SVt_PVMG, /* 7 */ @@ -141,13 +153,15 @@ typedef enum { } svtype; /* *** any alterations to the SV types above need to be reflected in - * SVt_MASK and the various PL_valid_types_* tables */ + * SVt_MASK and the various PL_valid_types_* tables. As of this writing those + * tables are in perl.h. There are also two affected names tables in dump.c, + * one in B.xs, and 'bodies_by_type[]' in sv.c */ #define SVt_MASK 0xf /* smallest bitmask that covers all types */ #ifndef PERL_CORE /* Although Fast Boyer Moore tables are now being stored in PVGVs, for most - purposes eternal code wanting to consider PVBM probably needs to think of + purposes external code wanting to consider PVBM probably needs to think of PVMG instead. */ # define SVt_PVBM SVt_PVMG /* Anything wanting to create a reference from clean should ensure that it has @@ -284,7 +298,7 @@ to return a meaningful value, or check f and faster. =for apidoc Am|void|SvREFCNT_dec|SV* sv -Decrements the reference count of the given SV. I may be NULL. +Decrements the reference count of the given SV. I may be NULL. =for apidoc Am|void|SvREFCNT_dec_NN|SV* sv Same as SvREFCNT_dec, but can only be used if you know I @@ -347,6 +361,7 @@ perform the upgrade if necessary. See C subroutine in another package. Set the GvIMPORTED_CV_on() if it needs to be expanded to a real GV */ +#define SVpad_NAMELIST SVp_SCREAM /* AV is a padnamelist */ #define SVf_IsCOW 0x00010000 /* copy on write (shared hash key if SvLEN == 0) */ #define SVs_PADTMP 0x00020000 /* in use as tmp; only if ! SVs_PADMY */ @@ -390,21 +405,24 @@ perform the upgrade if necessary. See C #define SVf_AMAGIC 0x10000000 /* has magical overloaded methods */ +/* note that SVf_AMAGIC is now only set on stashes, so this bit is free + * for non-HV SVs */ + /* Ensure this value does not clash with the GV_ADD* flags in gv.h: */ #define SVf_UTF8 0x20000000 /* SvPV is UTF-8 encoded This is also set on RVs whose overloaded stringification is UTF-8. This might only happen as a side effect of SvPV() */ - - -/* Some private flags. */ +/* PVHV */ +#define SVphv_SHAREKEYS 0x20000000 /* PVHV keys live on shared string table */ /* PVAV could probably use 0x2000000 without conflict. I assume that PVFM can be UTF-8 encoded, and PVCVs could well have UTF-8 prototypes. PVIOs haven't been restructured, so sometimes get used as string buffers. */ -/* PVHV */ -#define SVphv_SHAREKEYS 0x20000000 /* PVHV keys live on shared string table */ + +/* Some private flags. */ + /* PVNV, PVMG only, and only used in pads. Should be safe to test on any scalar SV, as the core is careful to avoid setting both. @@ -463,10 +481,6 @@ union _xnvu { U32 xlow; U32 xhigh; } xpad_cop_seq; /* used by pad.c for cop_sequence */ - struct { - I32 xbm_useful; - U8 xbm_rare; /* rarest character in string */ - } xbm_s; /* fields from PVBM */ }; union _xivu { @@ -479,7 +493,7 @@ union _xmgu { MAGIC* xmg_magic; /* linked list of magicalness */ HV* xmg_ourstash; /* Stash for our (when SvPAD_OUR is true) */ STRLEN xmg_hash_index; /* used while freeing hash entries */ -}; +}; /* also used by PadnamelistMAXNAMED */ struct xpv { _XPV_HEAD; @@ -516,7 +530,10 @@ struct xpvlv { _XPV_HEAD; union _xivu xiv_u; union _xnvu xnv_u; - STRLEN xlv_targoff; + union { + STRLEN xlvu_targoff; + SSize_t xlvu_stargoff; + } xlv_targoff_u; STRLEN xlv_targlen; SV* xlv_targ; char xlv_type; /* k=keys .=pos x=substr v=vec /=join/re @@ -524,6 +541,15 @@ struct xpvlv { char xlv_flags; /* 1 = negative offset 2 = negative len */ }; +#define xlv_targoff xlv_targoff_u.xlvu_targoff + +struct xpvinvlist { + _XPV_HEAD; + IV prev_index; + STRLEN iterator; + bool is_offset; /* */ +}; + /* This structure works in 3 ways - regular scalar, GV with GP, or fast Boyer-Moore. */ struct xpvgv { @@ -532,7 +558,7 @@ struct xpvgv { union _xnvu xnv_u; }; -typedef U16 cv_flags_t; +typedef U32 cv_flags_t; #define _XPVCV_COMMON \ HV * xcv_stash; \ @@ -624,7 +650,7 @@ double. Checks the B setting. Unsets the NV/IV status of an SV. =for apidoc Am|U32|SvOK|SV* sv -Returns a U32 value indicating whether the value is defined. This is +Returns a U32 value indicating whether the value is defined. This is only meaningful for scalars. =for apidoc Am|U32|SvIOKp|SV* sv @@ -730,7 +756,8 @@ Only use when you are sure SvNOK is true =for apidoc Am|char*|SvPVX|SV* sv Returns a pointer to the physical string in the SV. The SV must contain a -string. Prior to 5.9.3 it is not safe to execute this macro unless the SV's +string. Prior to 5.9.3 it is not safe +to execute this macro unless the SV's type >= SVt_PV. This is also used to store the name of an autoloaded subroutine in an XS @@ -746,7 +773,7 @@ attributable to C. See C. =for apidoc Am|char*|SvEND|SV* sv Returns a pointer to the spot just after the last character in the string which is in the SV, where there is usually a trailing -null (even though Perl scalars do not strictly require it). +C character (even though Perl scalars do not strictly require it). See C. Access the character as *(SvEND(sv)). Warning: If C is equal to C, then C points to @@ -765,7 +792,8 @@ C instead of the lvalue assign Set the value of the NV pointer in sv to val. See C. =for apidoc Am|void|SvPV_set|SV* sv|char* val -Set the value of the PV pointer in sv to val. See also C. +Set the value of the PV pointer in C to the C-terminated string +C. See also C. Beware that the existing pointer may be involved in copy-on-write or other mischief, so do C and use C or @@ -932,6 +960,7 @@ in gv.h: */ #define HvAMAGIC_off(hv) (SvFLAGS(hv) &=~ SVf_AMAGIC) +/* "nog" means "doesn't have get magic" */ #define SvPOK_nog(sv) ((SvFLAGS(sv) & (SVf_POK|SVs_GMG)) == SVf_POK) #define SvIOK_nog(sv) ((SvFLAGS(sv) & (SVf_IOK|SVs_GMG)) == SVf_IOK) #define SvUOK_nog(sv) ((SvFLAGS(sv) & (SVf_IOK|SVf_IVisUV|SVs_GMG)) == (SVf_IOK|SVf_IVisUV)) @@ -1056,27 +1085,30 @@ sv_force_normal does nothing. #if defined (DEBUGGING) && defined(__GNUC__) && !defined(PERL_GCC_BRACE_GROUPS_FORBIDDEN) # define SvVALID(sv) ({ const SV *const _svvalid = (const SV*)(sv); \ - if (SvFLAGS(_svvalid) & SVpbm_VALID) \ + if (SvFLAGS(_svvalid) & SVpbm_VALID && !SvSCREAM(_svvalid)) \ assert(!isGV_with_GP(_svvalid)); \ (SvFLAGS(_svvalid) & SVpbm_VALID); \ }) # define SvVALID_on(sv) ({ SV *const _svvalid = MUTABLE_SV(sv); \ assert(!isGV_with_GP(_svvalid)); \ + assert(!SvSCREAM(_svvalid)); \ (SvFLAGS(_svvalid) |= SVpbm_VALID); \ }) # define SvVALID_off(sv) ({ SV *const _svvalid = MUTABLE_SV(sv); \ assert(!isGV_with_GP(_svvalid)); \ + assert(!SvSCREAM(_svvalid)); \ (SvFLAGS(_svvalid) &= ~SVpbm_VALID); \ }) # define SvTAIL(sv) ({ const SV *const _svtail = (const SV *)(sv); \ - assert(SvTYPE(_svtail) != SVt_PVAV); \ - assert(SvTYPE(_svtail) != SVt_PVHV); \ + assert(SvTYPE(_svtail) != SVt_PVAV); \ + assert(SvTYPE(_svtail) != SVt_PVHV); \ + assert(!SvSCREAM(_svtail)); \ (SvFLAGS(sv) & (SVpbm_TAIL|SVpbm_VALID)) \ == (SVpbm_TAIL|SVpbm_VALID); \ }) #else -# define SvVALID(sv) (SvFLAGS(sv) & SVpbm_VALID) +# define SvVALID(sv) ((SvFLAGS(sv) & SVpbm_VALID) && !SvSCREAM(sv)) # define SvVALID_on(sv) (SvFLAGS(sv) |= SVpbm_VALID) # define SvVALID_off(sv) (SvFLAGS(sv) &= ~SVpbm_VALID) # define SvTAIL(sv) ((SvFLAGS(sv) & (SVpbm_TAIL|SVpbm_VALID)) \ @@ -1331,7 +1363,7 @@ sv_force_normal does nothing. assert(SvTYPE(sv) >= SVt_PV); \ if (SvLEN(sv)) { \ assert(!SvROK(sv)); \ - if(SvOOK(sv)) { \ + if(UNLIKELY(SvOOK(sv))) { \ STRLEN zok; \ SvOOK_offset(sv, zok); \ SvPV_set(sv, SvPVX_mutable(sv) - zok); \ @@ -1361,30 +1393,21 @@ sv_force_normal does nothing. #endif #if defined (DEBUGGING) && defined(__GNUC__) && !defined(PERL_GCC_BRACE_GROUPS_FORBIDDEN) -# define BmRARE(sv) \ - (*({ SV *const _bmrare = MUTABLE_SV(sv); \ - assert(SvTYPE(_bmrare) == SVt_PVMG); \ - assert(SvVALID(_bmrare)); \ - &(((XPVMG*) SvANY(_bmrare))->xnv_u.xbm_s.xbm_rare); \ - })) # define BmUSEFUL(sv) \ (*({ SV *const _bmuseful = MUTABLE_SV(sv); \ - assert(SvTYPE(_bmuseful) == SVt_PVMG); \ + assert(SvTYPE(_bmuseful) >= SVt_PVIV); \ assert(SvVALID(_bmuseful)); \ assert(!SvIOK(_bmuseful)); \ - &(((XPVMG*) SvANY(_bmuseful))->xnv_u.xbm_s.xbm_useful); \ - })) -# define BmPREVIOUS(sv) \ - (*({ SV *const _bmprevious = MUTABLE_SV(sv); \ - assert(SvTYPE(_bmprevious) == SVt_PVMG); \ - assert(SvVALID(_bmprevious)); \ - &(((XPVMG*) SvANY(_bmprevious))->xiv_u.xivu_uv); \ + &(((XPVIV*) SvANY(_bmuseful))->xiv_u.xivu_iv); \ })) #else -# define BmRARE(sv) ((XPVMG*) SvANY(sv))->xnv_u.xbm_s.xbm_rare -# define BmUSEFUL(sv) ((XPVMG*) SvANY(sv))->xnv_u.xbm_s.xbm_useful -# define BmPREVIOUS(sv) ((XPVMG*) SvANY(sv))->xiv_u.xivu_uv +# define BmUSEFUL(sv) ((XPVIV*) SvANY(sv))->xiv_u.xivu_iv + +#endif +#ifndef PERL_CORE +# define BmRARE(sv) 0 +# define BmPREVIOUS(sv) 0 #endif #define FmLINES(sv) ((XPVIV*) SvANY(sv))->xiv_iv @@ -1392,6 +1415,7 @@ sv_force_normal does nothing. #define LvTYPE(sv) ((XPVLV*) SvANY(sv))->xlv_type #define LvTARG(sv) ((XPVLV*) SvANY(sv))->xlv_targ #define LvTARGOFF(sv) ((XPVLV*) SvANY(sv))->xlv_targoff +#define LvSTARGOFF(sv) ((XPVLV*) SvANY(sv))->xlv_targoff_u.xlvu_stargoff #define LvTARGLEN(sv) ((XPVLV*) SvANY(sv))->xlv_targlen #define LvFLAGS(sv) ((XPVLV*) SvANY(sv))->xlv_flags @@ -1436,7 +1460,7 @@ Marks an SV as tainted if tainting is en Untaints an SV. Be I careful with this routine, as it short-circuits some of Perl's fundamental security features. XS module authors should not use this function unless they fully understand all the implications of -unconditionally untainting the value. Untainting should be done in the +unconditionally untainting the value. Untainting should be done in the standard perl fashion, via a carefully crafted regexp, rather than directly untainting variables. @@ -1452,18 +1476,18 @@ attention to precisely which outputs are #define sv_taint(sv) sv_magic((sv), NULL, PERL_MAGIC_taint, NULL, 0) -#if NO_TAINT_SUPPORT +#ifdef NO_TAINT_SUPPORT # define SvTAINTED(sv) 0 #else # define SvTAINTED(sv) (SvMAGICAL(sv) && sv_tainted(sv)) #endif -#define SvTAINTED_on(sv) STMT_START{ if(TAINTING_get){sv_taint(sv);} }STMT_END -#define SvTAINTED_off(sv) STMT_START{ if(TAINTING_get){sv_untaint(sv);} }STMT_END +#define SvTAINTED_on(sv) STMT_START{ if(UNLIKELY(TAINTING_get)){sv_taint(sv);} }STMT_END +#define SvTAINTED_off(sv) STMT_START{ if(UNLIKELY(TAINTING_get)){sv_untaint(sv);} }STMT_END #define SvTAINT(sv) \ STMT_START { \ - if (TAINTING_get) { \ - if (TAINT_get) \ + if (UNLIKELY(TAINTING_get)) { \ + if (UNLIKELY(TAINT_get)) \ SvTAINTED_on(sv); \ } \ } STMT_END @@ -1475,7 +1499,7 @@ only a string (C), by hook o going to update the C directly. Processes get magic. Note that coercing an arbitrary scalar into a plain PV will potentially -strip useful data from it. For example if the SV was C, then the +strip useful data from it. For example if the SV was C, then the referent will have its reference count decremented, and the SV itself may be converted to an C scalar with a string buffer containing a value such as C<"ARRAY(0x1234)">. @@ -1486,13 +1510,15 @@ Like C, but doesn't process =for apidoc Am|char*|SvPV|SV* sv|STRLEN len Returns a pointer to the string in the SV, or a stringified form of the SV if the SV does not contain a string. The SV may cache the -stringified version becoming C. Handles 'get' magic. See also -C for a version which guarantees to evaluate sv only once. +stringified version becoming C. Handles 'get' magic. The +C variable will be set to the length of the string (this is a macro, so +don't use C<&len>). See also C for a version which guarantees to +evaluate sv only once. Note that there is no guarantee that the return value of C is equal to C, or that C contains valid data, or that -successive calls to C will return the same pointer value each +time. This is due to the way that things like overloading and Copy-On-Write are handled. In these cases, the return value may point to a temporary buffer or similar. If you absolutely need the SvPVX field to be valid (for example, if you intend to write to it), then see @@ -1599,8 +1625,8 @@ Like C, but converts sv to byte re Guarantees to evaluate sv only once; use the more efficient C otherwise. -=for apidoc Am|bool|SvIsCOW|SV* sv -Returns a boolean indicating whether the SV is Copy-On-Write (either shared +=for apidoc Am|U32|SvIsCOW|SV* sv +Returns a U32 value indicating whether the SV is Copy-On-Write (either shared hash key scalars, or full Copy On Write scalars if 5.9.0 is configured for COW). @@ -1682,6 +1708,7 @@ Like sv_utf8_upgrade, but doesn't do mag (SvPOK_nog(sv) \ ? SvPVX(sv) : sv_2pv_flags(sv, 0, SV_GMAGIC)) +/* "_nomg" in these defines means no mg_get() */ #define SvPV_nomg_nolen(sv) \ (SvPOK_nog(sv) \ ? SvPVX(sv) : sv_2pv_flags(sv, 0, 0)) @@ -1732,9 +1759,9 @@ Like sv_utf8_upgrade, but doesn't do mag #define SvPVutf8x_force(sv, lp) sv_pvutf8n_force(sv, &lp) #define SvPVbytex_force(sv, lp) sv_pvbyten_force(sv, &lp) -#define SvTRUE(sv) ((sv) && (SvGMAGICAL(sv) ? sv_2bool(sv) : SvTRUE_common(sv, sv_2bool_nomg(sv)))) -#define SvTRUE_nomg(sv) ((sv) && ( SvTRUE_common(sv, sv_2bool_nomg(sv)))) -#define SvTRUE_NN(sv) (SvGMAGICAL(sv) ? sv_2bool(sv) : SvTRUE_common(sv, sv_2bool_nomg(sv))) +#define SvTRUE(sv) (LIKELY(sv) && (UNLIKELY(SvGMAGICAL(sv)) ? sv_2bool(sv) : SvTRUE_common(sv, sv_2bool_nomg(sv)))) +#define SvTRUE_nomg(sv) (LIKELY(sv) && ( SvTRUE_common(sv, sv_2bool_nomg(sv)))) +#define SvTRUE_NN(sv) (UNLIKELY(SvGMAGICAL(sv)) ? sv_2bool(sv) : SvTRUE_common(sv, sv_2bool_nomg(sv))) #define SvTRUE_nomg_NN(sv) ( SvTRUE_common(sv, sv_2bool_nomg(sv))) #define SvTRUE_common(sv,fallback) ( \ !SvOK(sv) \ @@ -1885,12 +1912,6 @@ mg.c:1024: warning: left-hand operand of /* Note: To allow 256 COW "copies", a refcnt of 0 means 1. */ # define CowREFCNT(sv) (*(U8 *)(SvPVX(sv)+SvLEN(sv)-1)) # define SV_COW_REFCNT_MAX ((1 << sizeof(U8)*8) - 1) -# ifndef SV_COW_THRESHOLD -# define SV_COW_THRESHOLD 0 /* min string length for cow */ -# endif -# ifndef SV_COWBUF_THRESHOLD -# define SV_COWBUF_THRESHOLD 1250 /* min string length for cow */ -# endif /* over existing buffer */ # define CAN_COW_MASK (SVf_POK|SVf_ROK|SVp_POK|SVf_FAKE| \ SVf_OOK|SVf_BREAK|SVf_READONLY) # endif @@ -1959,12 +1980,11 @@ mg.c:1024: warning: left-hand operand of #define sv_catpvn_nomg_maybeutf8(dsv, sstr, slen, is_utf8) \ sv_catpvn_flags(dsv, sstr, slen, (is_utf8)?SV_CATUTF8:SV_CATBYTES) -#ifdef PERL_CORE +#if defined(PERL_CORE) || defined(PERL_EXT) # define sv_or_pv_len_utf8(sv, pv, bytelen) \ (SvGAMAGIC(sv) \ ? utf8_length((U8 *)(pv), (U8 *)(pv)+(bytelen)) \ : sv_len_utf8(sv)) -# define sv_or_pv_pos_u2b(sv,s,p,lp) S_sv_or_pv_pos_u2b(aTHX_ sv,s,p,lp) #endif /* @@ -1994,15 +2014,15 @@ after modifying a scalar, in case it is or a tied variable (it calls C). This macro evaluates its argument more than once. -=for apidoc Am|void|SvSetSV|SV* dsb|SV* ssv +=for apidoc Am|void|SvSetSV|SV* dsv|SV* ssv Calls C if dsv is not the same as ssv. May evaluate arguments -more than once. +more than once. Does not handle 'set' magic on the destination SV. =for apidoc Am|void|SvSetSV_nosteal|SV* dsv|SV* ssv Calls a non-destructive version of C if dsv is not the same as ssv. May evaluate arguments more than once. -=for apidoc Am|void|SvSetMagicSV|SV* dsb|SV* ssv +=for apidoc Am|void|SvSetMagicSV|SV* dsv|SV* ssv Like C, but does any set magic required afterwards. =for apidoc Am|void|SvSetMagicSV_nosteal|SV* dsv|SV* ssv @@ -2025,8 +2045,9 @@ has been loaded. =for apidoc Am|char *|SvGROW|SV* sv|STRLEN len Expands the character buffer in the SV so that it has room for the indicated number of bytes (remember to reserve space for an extra trailing -NUL character). Calls C to perform the expansion if necessary. -Returns a pointer to the character buffer. SV must be of type >= SVt_PV. One +C character). Calls C to perform the expansion if necessary. +Returns a pointer to the character +buffer. SV must be of type >= SVt_PV. One alternative is to call C if you are not sure of the type of SV. =cut @@ -2037,19 +2058,19 @@ alternative is to call C if you #define SvUNLOCK(sv) PL_unlockhook(aTHX_ sv) #define SvDESTROYABLE(sv) PL_destroyhook(aTHX_ sv) -#define SvGETMAGIC(x) ((void)(SvGMAGICAL(x) && mg_get(x))) -#define SvSETMAGIC(x) STMT_START { if (SvSMAGICAL(x)) mg_set(x); } STMT_END +#define SvGETMAGIC(x) ((void)(UNLIKELY(SvGMAGICAL(x)) && mg_get(x))) +#define SvSETMAGIC(x) STMT_START { if (UNLIKELY(SvSMAGICAL(x))) mg_set(x); } STMT_END #define SvSetSV_and(dst,src,finally) \ STMT_START { \ - if ((dst) != (src)) { \ + if (LIKELY((dst) != (src))) { \ sv_setsv(dst, src); \ finally; \ } \ } STMT_END #define SvSetSV_nosteal_and(dst,src,finally) \ STMT_START { \ - if ((dst) != (src)) { \ + if (LIKELY((dst) != (src))) { \ sv_setsv_flags(dst, src, SV_GMAGIC | SV_NOSTEAL | SV_DO_COW_SVSETSV); \ finally; \ } \ @@ -2117,7 +2138,7 @@ See also C and C. == (SVt_PVLV|SVf_FAKE)) -#ifdef PERL_NEW_COPY_ON_WRITE +#ifdef PERL_ANY_COW # define SvGROW(sv,len) \ (SvIsCOW(sv) || SvLEN(sv) < (len) ? sv_grow(sv,len) : SvPVX(sv)) #else @@ -2143,7 +2164,8 @@ struct clone_params { /* =for apidoc Am|SV*|newSVpvn_utf8|NULLOK const char* s|STRLEN len|U32 utf8 -Creates a new SV and copies a string into it. If utf8 is true, calls +Creates a new SV and copies a string (which may contain C (C<\0>) +characters) into it. If utf8 is true, calls C on the new SV. Implemented as a wrapper around C. =cut @@ -2219,6 +2241,54 @@ Evaluates I more than once. Sets I< #endif #define newIO() MUTABLE_IO(newSV_type(SVt_PVIO)) + +#define SV_CONST(name) \ + PL_sv_consts[SV_CONST_##name] \ + ? PL_sv_consts[SV_CONST_##name] \ + : (PL_sv_consts[SV_CONST_##name] = newSVpv_share(#name, 0)) + +#define SV_CONST_TIESCALAR 0 +#define SV_CONST_TIEARRAY 1 +#define SV_CONST_TIEHASH 2 +#define SV_CONST_TIEHANDLE 3 + +#define SV_CONST_FETCH 4 +#define SV_CONST_FETCHSIZE 5 +#define SV_CONST_STORE 6 +#define SV_CONST_STORESIZE 7 +#define SV_CONST_EXISTS 8 + +#define SV_CONST_PUSH 9 +#define SV_CONST_POP 10 +#define SV_CONST_SHIFT 11 +#define SV_CONST_UNSHIFT 12 +#define SV_CONST_SPLICE 13 +#define SV_CONST_EXTEND 14 + +#define SV_CONST_FIRSTKEY 15 +#define SV_CONST_NEXTKEY 16 +#define SV_CONST_SCALAR 17 + +#define SV_CONST_OPEN 18 +#define SV_CONST_WRITE 19 +#define SV_CONST_PRINT 20 +#define SV_CONST_PRINTF 21 +#define SV_CONST_READ 22 +#define SV_CONST_READLINE 23 +#define SV_CONST_GETC 24 +#define SV_CONST_SEEK 25 +#define SV_CONST_TELL 26 +#define SV_CONST_EOF 27 +#define SV_CONST_BINMODE 28 +#define SV_CONST_FILENO 29 +#define SV_CONST_CLOSE 30 + +#define SV_CONST_DELETE 31 +#define SV_CONST_CLEAR 32 +#define SV_CONST_UNTIE 33 +#define SV_CONST_DESTROY 34 + +#define SV_CONSTS_COUNT 35 /* * Local variables: Index: gnu/usr.bin/perl/taint.c =================================================================== RCS file: /mnt/memory/perl/importit/cvs/src/gnu/usr.bin/perl/taint.c,v retrieving revision 1.15 diff -u -p -u -p -r1.15 taint.c --- gnu/usr.bin/perl/taint.c 24 Mar 2014 15:05:13 -0000 1.15 +++ gnu/usr.bin/perl/taint.c 16 Nov 2014 03:22:24 -0000 @@ -31,25 +31,14 @@ Perl_taint_proper(pTHX_ const char *f, c PERL_ARGS_ASSERT_TAINT_PROPER; -# if Uid_t_size == 1 { - const UV uid = PerlProc_getuid(); - const UV euid = PerlProc_geteuid(); + const Uid_t uid = PerlProc_getuid(); + const Uid_t euid = PerlProc_geteuid(); DEBUG_u(PerlIO_printf(Perl_debug_log, - "%s %d %"UVuf" %"UVuf"\n", + "%s %d %"Uid_t_f" %"Uid_t_f"\n", s, TAINT_get, uid, euid)); } -# else - { - const IV uid = PerlProc_getuid(); - const IV euid = PerlProc_geteuid(); - - DEBUG_u(PerlIO_printf(Perl_debug_log, - "%s %d %"IVdf" %"IVdf"\n", - s, TAINT_get, uid, euid)); - } -# endif #endif if (TAINT_get) { @@ -65,12 +54,19 @@ Perl_taint_proper(pTHX_ const char *f, c ug = " while running with -t switch"; else ug = " while running with -T switch"; + + /* XXX because taint_proper adds extra format args, we can't + * get the caller to check properly; o we just silence the warning + * and hope the callers aren't naughty */ + GCC_DIAG_IGNORE(-Wformat-nonliteral); if (PL_unsafe || TAINT_WARN_get) { Perl_ck_warner_d(aTHX_ packWARN(WARN_TAINT), f, s, ug); } else { Perl_croak(aTHX_ f, s, ug); } + GCC_DIAG_RESTORE; + } } Index: gnu/usr.bin/perl/thread.h =================================================================== RCS file: /mnt/memory/perl/importit/cvs/src/gnu/usr.bin/perl/thread.h,v retrieving revision 1.1.1.11 diff -u -p -u -p -r1.1.1.11 thread.h --- gnu/usr.bin/perl/thread.h 24 Mar 2014 14:58:48 -0000 1.1.1.11 +++ gnu/usr.bin/perl/thread.h 16 Nov 2014 03:22:24 -0000 @@ -91,10 +91,6 @@ # endif #endif -#ifdef DGUX -# define THREAD_CREATE_NEEDS_STACK (32*1024) -#endif - #ifdef __VMS /* Default is 1024 on VAX, 8192 otherwise */ # ifdef __ia64 @@ -340,7 +336,7 @@ # define ALLOC_THREAD_KEY \ STMT_START { \ if (pthread_key_create(&PL_thr_key, 0)) { \ - write(2, STR_WITH_LEN("panic: pthread_key_create failed\n")); \ + PERL_UNUSED_RESULT(write(2, STR_WITH_LEN("panic: pthread_key_create failed\n"))); \ exit(1); \ } \ } STMT_END Index: gnu/usr.bin/perl/time64.c =================================================================== RCS file: /mnt/memory/perl/importit/cvs/src/gnu/usr.bin/perl/time64.c,v retrieving revision 1.1.1.3 diff -u -p -u -p -r1.1.1.3 time64.c --- gnu/usr.bin/perl/time64.c 24 Mar 2014 14:58:48 -0000 1.1.1.3 +++ gnu/usr.bin/perl/time64.c 16 Nov 2014 03:22:24 -0000 @@ -41,17 +41,17 @@ S_gmtime64_r() is a 64-bit equivalent of #include "time64.h" -static const int days_in_month[2][12] = { +static const char days_in_month[2][12] = { {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}, {31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}, }; -static const int julian_days_by_month[2][12] = { +static const short julian_days_by_month[2][12] = { {0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334}, {0, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335}, }; -static const int length_of_year[2] = { 365, 366 }; +static const short length_of_year[2] = { 365, 366 }; /* Number of days in a 400 year Gregorian cycle */ static const Year years_in_gregorian_cycle = 400; @@ -59,7 +59,7 @@ static const int days_in_gregorian_cycle /* 28 year calendar cycle between 2010 and 2037 */ #define SOLAR_CYCLE_LENGTH 28 -static const int safe_years[SOLAR_CYCLE_LENGTH] = { +static const short safe_years[SOLAR_CYCLE_LENGTH] = { 2016, 2017, 2018, 2019, 2020, 2021, 2022, 2023, 2024, 2025, 2026, 2027, @@ -69,7 +69,7 @@ static const int safe_years[SOLAR_CYCLE_ 2012, 2013, 2014, 2015 }; -static const int dow_year_start[SOLAR_CYCLE_LENGTH] = { +static const char dow_year_start[SOLAR_CYCLE_LENGTH] = { 5, 0, 1, 2, /* 0 2016 - 2019 */ 3, 5, 6, 0, /* 4 */ 1, 3, 4, 5, /* 8 */ Index: gnu/usr.bin/perl/time64.h =================================================================== RCS file: /mnt/memory/perl/importit/cvs/src/gnu/usr.bin/perl/time64.h,v retrieving revision 1.1.1.1 diff -u -p -u -p -r1.1.1.1 time64.h --- gnu/usr.bin/perl/time64.h 24 Sep 2010 14:48:25 -0000 1.1.1.1 +++ gnu/usr.bin/perl/time64.h 16 Nov 2014 03:22:24 -0000 @@ -28,11 +28,14 @@ struct TM64 { #endif #ifdef HAS_TM_TM_ZONE -# ifdef __GLIBC__ - const char *tm_zone; -# else - char *tm_zone; +/* If glibc is defined or we are on QNX, use const. + * Otherwise, if we are on android, use const but + * not with g++. + */ +# if defined(__GLIBC__) || (defined(__ANDROID__) && !defined(__cplusplus)) || defined(__QNX__) + const # endif + char *tm_zone; #endif }; Index: gnu/usr.bin/perl/toke.c =================================================================== RCS file: /mnt/memory/perl/importit/cvs/src/gnu/usr.bin/perl/toke.c,v retrieving revision 1.17 diff -u -p -u -p -r1.17 toke.c --- gnu/usr.bin/perl/toke.c 24 Mar 2014 15:05:13 -0000 1.17 +++ gnu/usr.bin/perl/toke.c 16 Nov 2014 03:22:24 -0000 @@ -137,7 +137,7 @@ static const char* const ident_too_long * 1999-02-27 mjd-perl-patch@plover.com */ #define isCONTROLVAR(x) (isUPPER(x) || strchr("[\\]^_?", (x))) -#define SPACE_OR_TAB(c) ((c)==' '||(c)=='\t') +#define SPACE_OR_TAB(c) isBLANK_A(c) /* LEX_* are values for PL_lex_state, the state of the lexer. * They are arranged oddly so that the guard on the switch statement @@ -182,17 +182,10 @@ static const char* const lex_state_names }; #endif -#ifdef ff_next -#undef ff_next -#endif - #include "keywords.h" /* CLINE is a macro that ensures PL_copline has a sane value */ -#ifdef CLINE -#undef CLINE -#endif #define CLINE (PL_copline = (CopLINE(PL_curcop) < PL_copline ? CopLINE(PL_curcop) : PL_copline)) #ifdef PERL_MAD @@ -218,6 +211,7 @@ static const char* const lex_state_names * PRETERMBLOCK : beginning a non-code-defining {} block (eg, hash ref) * PREREF : *EXPR where EXPR is not a simple identifier * TERM : expression term + * POSTDEREF : postfix dereference (->$* ->@[...] etc.) * LOOPX : loop exiting command (goto, last, dump, etc) * FTST : file test operator * FUN0 : zero-argument function @@ -249,6 +243,7 @@ static const char* const lex_state_names #define PRETERMBLOCK(retval) return (PL_expect = XTERMBLOCK,PL_bufptr = s, REPORT(retval)) #define PREREF(retval) return (PL_expect = XREF,PL_bufptr = s, REPORT(retval)) #define TERM(retval) return (CLINE, PL_expect = XOPERATOR, PL_bufptr = s, REPORT(retval)) +#define POSTDEREF(f) return (PL_bufptr = s, S_postderef(aTHX_ REPORT(f),s[1])) #define LOOPX(f) return (pl_yylval.ival=f, PL_expect=XTERM, PL_bufptr=s, REPORT((int)LOOPEX)) #define FTST(f) return (pl_yylval.ival=f, PL_expect=XTERMORDORDOR, PL_bufptr=s, REPORT((int)UNIOP)) #define FUN0(f) return (pl_yylval.ival=f, PL_expect=XOPERATOR, PL_bufptr=s, REPORT((int)FUNC0)) @@ -303,9 +298,17 @@ static const char* const lex_state_names #define COPLINE_INC_WITH_HERELINES \ STMT_START { \ CopLINE_inc(PL_curcop); \ - if (PL_parser->lex_shared->herelines) \ - CopLINE(PL_curcop) += PL_parser->lex_shared->herelines, \ - PL_parser->lex_shared->herelines = 0; \ + if (PL_parser->herelines) \ + CopLINE(PL_curcop) += PL_parser->herelines, \ + PL_parser->herelines = 0; \ + } STMT_END +/* Called after scan_str to update CopLINE(PL_curcop), but only when there + * is no sublex_push to follow. */ +#define COPLINE_SET_FROM_MULTI_END \ + STMT_START { \ + CopLINE_set(PL_curcop, PL_multi_end); \ + if (PL_multi_end != PL_multi_start) \ + PL_parser->herelines = 0; \ } STMT_END @@ -376,6 +379,7 @@ static struct debug_tokens { { PLUGEXPR, TOKENTYPE_OPVAL, "PLUGEXPR" }, { PLUGSTMT, TOKENTYPE_OPVAL, "PLUGSTMT" }, { PMFUNC, TOKENTYPE_OPVAL, "PMFUNC" }, + { POSTJOIN, TOKENTYPE_NONE, "POSTJOIN" }, { POSTDEC, TOKENTYPE_NONE, "POSTDEC" }, { POSTINC, TOKENTYPE_NONE, "POSTINC" }, { POWOP, TOKENTYPE_OPNUM, "POWOP" }, @@ -427,7 +431,11 @@ S_tokereport(pTHX_ I32 rv, const YYSTYPE if (name) Perl_sv_catpv(aTHX_ report, name); else if ((char)rv > ' ' && (char)rv <= '~') + { Perl_sv_catpvf(aTHX_ report, "'%c'", (char)rv); + if ((char)rv == 'p') + sv_catpvs(report, " (pending identifier)"); + } else if (!rv) sv_catpvs(report, "EOF"); else @@ -474,7 +482,9 @@ S_printbuf(pTHX_ const char *const fmt, PERL_ARGS_ASSERT_PRINTBUF; + GCC_DIAG_IGNORE(-Wformat-nonliteral); /* fmt checked by caller */ PerlIO_printf(Perl_debug_log, fmt, pv_display(tmp, s, strlen(s), 0, 60)); + GCC_DIAG_RESTORE; SvREFCNT_dec(tmp); } @@ -549,16 +559,14 @@ S_no_op(pTHX_ const char *const what, ch NOOP; if (t < PL_bufptr && isSPACE(*t)) Perl_warner(aTHX_ packWARN(WARN_SYNTAX), - "\t(Do you need to predeclare %"SVf"?)\n", - SVfARG(newSVpvn_flags(PL_oldoldbufptr, (STRLEN)(t - PL_oldoldbufptr), - SVs_TEMP | (UTF ? SVf_UTF8 : 0)))); + "\t(Do you need to predeclare %"UTF8f"?)\n", + UTF8fARG(UTF, t - PL_oldoldbufptr, PL_oldoldbufptr)); } else { assert(s >= oldbp); Perl_warner(aTHX_ packWARN(WARN_SYNTAX), - "\t(Missing operator before %"SVf"?)\n", - SVfARG(newSVpvn_flags(oldbp, (STRLEN)(s - oldbp), - SVs_TEMP | (UTF ? SVf_UTF8 : 0)))); + "\t(Missing operator before %"UTF8f"?)\n", + UTF8fARG(UTF, s - oldbp, oldbp)); } } PL_bufptr = oldbp; @@ -584,7 +592,7 @@ S_missingterm(pTHX_ char *s) if (nl) *nl = '\0'; } - else if (isCNTRL(PL_multi_close)) { + else if ((U8) PL_multi_close < 32) { *tmpbuf = '^'; tmpbuf[1] = (char)toCTRL(PL_multi_close); tmpbuf[2] = '\0'; @@ -727,7 +735,7 @@ Perl_lex_start(pTHX_ SV *line, PerlIO *r parser->nexttoke = 0; #endif parser->error_count = oparser ? oparser->error_count : 0; - parser->copline = NOLINE; + parser->copline = parser->preambling = NOLINE; parser->lex_state = LEX_NORMAL; parser->expect = XSTATE; parser->rsfp = rsfp; @@ -751,9 +759,9 @@ Perl_lex_start(pTHX_ SV *line, PerlIO *r parser->linestr = flags & LEX_START_COPIED ? SvREFCNT_inc_simple_NN(line) : newSVpvn_flags(s, len, SvUTF8(line)); - sv_catpvs(parser->linestr, "\n;"); + sv_catpvn(parser->linestr, "\n;", rsfp ? 1 : 2); } else { - parser->linestr = newSVpvs("\n;"); + parser->linestr = newSVpvn("\n;", rsfp ? 1 : 2); } parser->oldoldbufptr = parser->oldbufptr = @@ -761,8 +769,11 @@ Perl_lex_start(pTHX_ SV *line, PerlIO *r parser->linestart = SvPVX(parser->linestr); parser->bufend = parser->bufptr + SvCUR(parser->linestr); parser->last_lop = parser->last_uni = NULL; - parser->lex_flags = flags & (LEX_IGNORE_UTF8_HINTS|LEX_EVALBYTES - |LEX_DONT_CLOSE_RSFP); + + assert(FITS_IN_8_BITS(LEX_IGNORE_UTF8_HINTS|LEX_EVALBYTES + |LEX_DONT_CLOSE_RSFP)); + parser->lex_flags = (U8) (flags & (LEX_IGNORE_UTF8_HINTS|LEX_EVALBYTES + |LEX_DONT_CLOSE_RSFP)); parser->in_pod = parser->filtered = 0; } @@ -858,7 +869,7 @@ through normal scalar means. Direct pointer to the end of the chunk of text currently being lexed, the end of the lexer buffer. This is equal to Clinestr) -+ SvCUR(PL_parser-Elinestr)>. A NUL character (zero octet) is ++ SvCUR(PL_parser-Elinestr)>. A C character (zero octet) is always located at the end of the buffer, and does not count as part of the buffer's contents. @@ -925,7 +936,7 @@ Perl_lex_bufutf8(pTHX) =for apidoc Amx|char *|lex_grow_linestr|STRLEN len Reallocates the lexer buffer (Llinestr>) to accommodate -at least I octets (including terminating NUL). Returns a +at least I octets (including terminating C). Returns a pointer to the reallocated buffer. This is necessary before making any direct modification of the buffer that would increase its length. L provides a more convenient way to insert text into @@ -1051,7 +1062,7 @@ Perl_lex_stuff_pvn(pTHX_ const char *pv, ENTER; SAVESPTR(PL_warnhook); PL_warnhook = PERL_WARNHOOK_FATAL; - utf8n_to_uvuni((U8*)p, e-p, NULL, 0); + utf8n_to_uvchr((U8*)p, e-p, NULL, 0); LEAVE; } } @@ -1071,7 +1082,7 @@ Perl_lex_stuff_pvn(pTHX_ const char *pv, } else { assert(p < e -1 ); - *bufptr++ = TWO_BYTE_UTF8_TO_UNI(*p, *(p+1)); + *bufptr++ = TWO_BYTE_UTF8_TO_NATIVE(*p, *(p+1)); p += 2; } } @@ -1374,6 +1385,10 @@ Perl_lex_next_chunk(pTHX_ U32 flags) PL_parser->last_uni = buf + last_uni_pos; if (PL_parser->last_lop) PL_parser->last_lop = buf + last_lop_pos; + if (PL_parser->preambling != NOLINE) { + CopLINE_set(PL_curcop, PL_parser->preambling + 1); + PL_parser->preambling = NOLINE; + } if (got_some_for_debugger && (PERLDB_LINE || PERLDB_SAVESRC) && PL_curstash != PL_debstash) { /* debugger active and we're not compiling the debugger code, @@ -1435,13 +1450,13 @@ Perl_lex_peek_unichar(pTHX_ U32 flags) bufend = PL_parser->bufend; } } - unichar = utf8n_to_uvuni((U8*)s, bufend-s, &retlen, UTF8_CHECK_ONLY); + unichar = utf8n_to_uvchr((U8*)s, bufend-s, &retlen, UTF8_CHECK_ONLY); if (retlen == (STRLEN)-1) { /* malformed UTF-8 */ ENTER; SAVESPTR(PL_warnhook); PL_warnhook = PERL_WARNHOOK_FATAL; - utf8n_to_uvuni((U8*)s, bufend-s, NULL, 0); + utf8n_to_uvchr((U8*)s, bufend-s, NULL, 0); LEAVE; } return unichar; @@ -1510,14 +1525,16 @@ chunk will not be discarded. =cut */ +#define LEX_NO_INCLINE 0x40000000 #define LEX_NO_NEXT_CHUNK 0x80000000 void Perl_lex_read_space(pTHX_ U32 flags) { char *s, *bufend; + const bool can_incline = !(flags & LEX_NO_INCLINE); bool need_incline = 0; - if (flags & ~(LEX_KEEP_PREVIOUS|LEX_NO_NEXT_CHUNK)) + if (flags & ~(LEX_KEEP_PREVIOUS|LEX_NO_NEXT_CHUNK|LEX_NO_INCLINE)) Perl_croak(aTHX_ "Lexing code internal error (%s)", "lex_read_space"); #ifdef PERL_MAD if (PL_skipwhite) { @@ -1537,15 +1554,18 @@ Perl_lex_read_space(pTHX_ U32 flags) } while (!(c == '\n' || (c == 0 && s == bufend))); } else if (c == '\n') { s++; - PL_parser->linestart = s; - if (s == bufend) - need_incline = 1; - else - incline(s); + if (can_incline) { + PL_parser->linestart = s; + if (s == bufend) + need_incline = 1; + else + incline(s); + } } else if (isSPACE(c)) { s++; } else if (c == 0 && s == bufend) { bool got_more; + line_t l; #ifdef PERL_MAD if (PL_madskills) sv_catpvn(PL_skipwhite, PL_parser->bufptr, s-PL_parser->bufptr); @@ -1553,14 +1573,15 @@ Perl_lex_read_space(pTHX_ U32 flags) if (flags & LEX_NO_NEXT_CHUNK) break; PL_parser->bufptr = s; - COPLINE_INC_WITH_HERELINES; + l = CopLINE(PL_curcop); + CopLINE(PL_curcop) += PL_parser->herelines + 1; got_more = lex_next_chunk(flags); - CopLINE_dec(PL_curcop); + CopLINE_set(PL_curcop, l); s = PL_parser->bufptr; bufend = PL_parser->bufend; if (!got_more) break; - if (need_incline && PL_parser->rsfp) { + if (can_incline && need_incline && PL_parser->rsfp) { incline(s); need_incline = 0; } @@ -1576,6 +1597,107 @@ Perl_lex_read_space(pTHX_ U32 flags) } /* + +=for apidoc EXMp|bool|validate_proto|SV *name|SV *proto|bool warn + +This function performs syntax checking on a prototype, C. +If C is true, any illegal characters or mismatched brackets +will trigger illegalproto warnings, declaring that they were +detected in the prototype for C. + +The return value is C if this is a valid prototype, and +C if it is not, regardless of whether C was C or +C. + +Note that C is a valid C and will always return C. + +=cut + + */ + +bool +Perl_validate_proto(pTHX_ SV *name, SV *proto, bool warn) +{ + STRLEN len, origlen; + char *p = proto ? SvPV(proto, len) : NULL; + bool bad_proto = FALSE; + bool in_brackets = FALSE; + bool after_slash = FALSE; + char greedy_proto = ' '; + bool proto_after_greedy_proto = FALSE; + bool must_be_last = FALSE; + bool underscore = FALSE; + bool bad_proto_after_underscore = FALSE; + + PERL_ARGS_ASSERT_VALIDATE_PROTO; + + if (!proto) + return TRUE; + + origlen = len; + for (; len--; p++) { + if (!isSPACE(*p)) { + if (must_be_last) + proto_after_greedy_proto = TRUE; + if (underscore) { + if (!strchr(";@%", *p)) + bad_proto_after_underscore = TRUE; + underscore = FALSE; + } + if (!strchr("$@%*;[]&\\_+", *p) || *p == '\0') { + bad_proto = TRUE; + } + else { + if (*p == '[') + in_brackets = TRUE; + else if (*p == ']') + in_brackets = FALSE; + else if ((*p == '@' || *p == '%') && + !after_slash && + !in_brackets ) { + must_be_last = TRUE; + greedy_proto = *p; + } + else if (*p == '_') + underscore = TRUE; + } + if (*p == '\\') + after_slash = TRUE; + else + after_slash = FALSE; + } + } + + if (warn) { + SV *tmpsv = newSVpvs_flags("", SVs_TEMP); + p -= origlen; + p = SvUTF8(proto) + ? sv_uni_display(tmpsv, newSVpvn_flags(p, origlen, SVs_TEMP | SVf_UTF8), + origlen, UNI_DISPLAY_ISPRINT) + : pv_pretty(tmpsv, p, origlen, 60, NULL, NULL, PERL_PV_ESCAPE_NONASCII); + + if (proto_after_greedy_proto) + Perl_warner(aTHX_ packWARN(WARN_ILLEGALPROTO), + "Prototype after '%c' for %"SVf" : %s", + greedy_proto, SVfARG(name), p); + if (in_brackets) + Perl_warner(aTHX_ packWARN(WARN_ILLEGALPROTO), + "Missing ']' in prototype for %"SVf" : %s", + SVfARG(name), p); + if (bad_proto) + Perl_warner(aTHX_ packWARN(WARN_ILLEGALPROTO), + "Illegal character in prototype for %"SVf" : %s", + SVfARG(name), p); + if (bad_proto_after_underscore) + Perl_warner(aTHX_ packWARN(WARN_ILLEGALPROTO), + "Illegal character after '_' in prototype for %"SVf" : %s", + SVfARG(name), p); + } + + return (! (proto_after_greedy_proto || bad_proto) ); +} + +/* * S_incline * This subroutine has nothing to do with tilting, whether at windmills * or pinball tables. Its name is short for "increment line". It @@ -1646,37 +1768,16 @@ S_incline(pTHX_ const char *s) if (t - s > 0) { const STRLEN len = t - s; - SV *const temp_sv = CopFILESV(PL_curcop); - const char *cf; - STRLEN tmplen; - - if (temp_sv) { - cf = SvPVX(temp_sv); - tmplen = SvCUR(temp_sv); - } else { - cf = NULL; - tmplen = 0; - } if (!PL_rsfp && !PL_parser->filtered) { /* must copy *{"::_<(eval N)[oldfilename:L]"} * to *{"::_ 0) { @@ -1723,7 +1820,6 @@ S_incline(pTHX_ const char *s) if (tmpbuf2 != smallbuf) Safefree(tmpbuf2); } - if (tmpbuf != smallbuf) Safefree(tmpbuf); } CopFILE_free(PL_curcop); CopFILE_setn(PL_curcop, s, len); @@ -1731,6 +1827,8 @@ S_incline(pTHX_ const char *s) CopLINE_set(PL_curcop, line_num); } +#define skipspace(s) skipspace_flags(s, 0) + #ifdef PERL_MAD /* skip space before PL_thistoken */ @@ -1786,13 +1884,11 @@ STATIC char * S_skipspace2(pTHX_ char *s, SV **svp) { char *start; - const I32 bufptroff = PL_bufptr - SvPVX(PL_linestr); const I32 startoff = s - SvPVX(PL_linestr); PERL_ARGS_ASSERT_SKIPSPACE2; s = skipspace(s); - PL_bufptr = SvPVX(PL_linestr) + bufptroff; if (!PL_madskills || !svp) return s; start = SvPVX(PL_linestr) + startoff; @@ -1818,14 +1914,23 @@ S_update_debugger_info(pTHX_ SV *orig_sv { AV *av = CopFILEAVx(PL_curcop); if (av) { - SV * const sv = newSV_type(SVt_PVMG); + SV * sv; + if (PL_parser->preambling == NOLINE) sv = newSV_type(SVt_PVMG); + else { + sv = *av_fetch(av, 0, 1); + SvUPGRADE(sv, SVt_PVMG); + } + if (!SvPOK(sv)) sv_setpvs(sv,""); if (orig_sv) - sv_setsv(sv, orig_sv); + sv_catsv(sv, orig_sv); else - sv_setpvn(sv, buf, len); - (void)SvIOK_on(sv); - SvIV_set(sv, 0); - av_store(av, (I32)CopLINE(PL_curcop), sv); + sv_catpvn(sv, buf, len); + if (!SvIOK(sv)) { + (void)SvIOK_on(sv); + SvIV_set(sv, 0); + } + if (PL_parser->preambling == NOLINE) + av_store(av, CopLINE(PL_curcop), sv); } } @@ -1836,12 +1941,12 @@ S_update_debugger_info(pTHX_ SV *orig_sv */ STATIC char * -S_skipspace(pTHX_ char *s) +S_skipspace_flags(pTHX_ char *s, U32 flags) { #ifdef PERL_MAD char *start = s; #endif /* PERL_MAD */ - PERL_ARGS_ASSERT_SKIPSPACE; + PERL_ARGS_ASSERT_SKIPSPACE_FLAGS; #ifdef PERL_MAD if (PL_skipwhite) { sv_free(PL_skipwhite); @@ -1854,7 +1959,7 @@ S_skipspace(pTHX_ char *s) } else { STRLEN bufptr_pos = PL_bufptr - SvPVX(PL_linestr); PL_bufptr = s; - lex_read_space(LEX_KEEP_PREVIOUS | + lex_read_space(flags | LEX_KEEP_PREVIOUS | (PL_sublex_info.sub_inwhat || PL_lex_state == LEX_FORMLINE ? LEX_NO_NEXT_CHUNK : 0)); s = PL_bufptr; @@ -2058,6 +2163,43 @@ S_force_next(pTHX_ I32 type) #endif } +/* + * S_postderef + * + * This subroutine handles postfix deref syntax after the arrow has already + * been emitted. @* $* etc. are emitted as two separate token right here. + * @[ @{ %[ %{ *{ are emitted also as two tokens, but this function emits + * only the first, leaving yylex to find the next. + */ + +static int +S_postderef(pTHX_ int const funny, char const next) +{ + dVAR; + assert(funny == DOLSHARP || strchr("$@%&*", funny)); + assert(strchr("*[{", next)); + if (next == '*') { + PL_expect = XOPERATOR; + if (PL_lex_state == LEX_INTERPNORMAL && !PL_lex_brackets) { + assert('@' == funny || '$' == funny || DOLSHARP == funny); + PL_lex_state = LEX_INTERPEND; + start_force(PL_curforce); + force_next(POSTJOIN); + } + start_force(PL_curforce); + force_next(next); + PL_bufptr+=2; + } + else { + if ('@' == funny && PL_lex_state == LEX_INTERPNORMAL + && !PL_lex_brackets) + PL_lex_dojoin = 2; + PL_expect = XOPERATOR; + PL_bufptr++; + } + return funny; +} + void Perl_yyunlex(pTHX) { @@ -2110,7 +2252,7 @@ S_newSV_maybe_utf8(pTHX_ const char *con */ STATIC char * -S_force_word(pTHX_ char *start, int token, int check_keyword, int allow_pack, int allow_initial_tick) +S_force_word(pTHX_ char *start, int token, int check_keyword, int allow_pack) { dVAR; char *s; @@ -2121,12 +2263,16 @@ S_force_word(pTHX_ char *start, int toke start = SKIPSPACE1(start); s = start; if (isIDFIRST_lazy_if(s,UTF) || - (allow_pack && *s == ':') || - (allow_initial_tick && *s == '\'') ) + (allow_pack && *s == ':') ) { s = scan_word(s, PL_tokenbuf, sizeof PL_tokenbuf, allow_pack, &len); - if (check_keyword && keyword(PL_tokenbuf, len, 0)) + if (check_keyword) { + char *s2 = PL_tokenbuf; + if (allow_pack && len > 6 && strnEQ(s2, "CORE::", 6)) + s2 += 6, len -= 6; + if (keyword(s2, len, 0)) return start; + } start_force(PL_curforce); if (PL_madskills) curmad('X', newSVpvn(start,s-start)); @@ -2261,15 +2407,7 @@ S_force_version(pTHX_ char *s, int guess #endif if (*d == ';' || isSPACE(*d) || *d == '{' || *d == '}' || !*d) { SV *ver; -#ifdef USE_LOCALE_NUMERIC - char *loc = savepv(setlocale(LC_NUMERIC, NULL)); - setlocale(LC_NUMERIC, "C"); -#endif s = scan_num(s, &pl_yylval); -#ifdef USE_LOCALE_NUMERIC - setlocale(LC_NUMERIC, loc); - Safefree(loc); -#endif version = pl_yylval.opval; ver = cSVOPx(version)->op_sv; if (SvPOK(ver) && !SvNIOK(ver)) { @@ -2369,18 +2507,17 @@ S_tokeq(pTHX_ SV *sv) char *s; char *send; char *d; - STRLEN len = 0; SV *pv = sv; PERL_ARGS_ASSERT_TOKEQ; - if (!SvLEN(sv)) + assert (SvPOK(sv)); + assert (SvLEN(sv)); + assert (!SvIsCOW(sv)); + if (SvTYPE(sv) >= SVt_PVIV && SvIVX(sv) == -1) /* <<'heredoc' */ goto finish; - - s = SvPV_force(sv, len); - if (SvTYPE(sv) >= SVt_PVIV && SvIVX(sv) == -1) - goto finish; - send = s + len; + s = SvPVX(sv); + send = SvEND(sv); /* This is relying on the SV being "well formed" with a trailing '\0' */ while (s < send && !(*s == '\\' && s[1] == '\\')) s++; @@ -2388,7 +2525,8 @@ S_tokeq(pTHX_ SV *sv) goto finish; d = s; if ( PL_hints & HINT_NEW_STRING ) { - pv = newSVpvn_flags(SvPVX_const(pv), len, SVs_TEMP | SvUTF8(sv)); + pv = newSVpvn_flags(SvPVX_const(pv), SvCUR(sv), + SVs_TEMP | SvUTF8(sv)); } while (s < send) { if (*s == '\\') { @@ -2444,7 +2582,7 @@ S_sublex_start(pTHX) PL_lex_op = NULL; return THING; } - if (op_type == OP_CONST || op_type == OP_READLINE) { + if (op_type == OP_CONST) { SV *sv = tokeq(PL_lex_stuff); if (SvTYPE(sv) == SVt_PVIV) { @@ -2457,17 +2595,6 @@ S_sublex_start(pTHX) } pl_yylval.opval = (OP*)newSVOP(op_type, 0, sv); PL_lex_stuff = NULL; - /* Allow // "foo" */ - if (op_type == OP_READLINE) - PL_expect = XTERMORDORDOR; - return THING; - } - else if (op_type == OP_BACKTICK && PL_lex_op) { - /* readpipe() vas overriden */ - cSVOPx(cLISTOPx(cUNOPx(PL_lex_op)->op_first)->op_first->op_sibling)->op_sv = tokeq(PL_lex_stuff); - pl_yylval.opval = PL_lex_op; - PL_lex_op = NULL; - PL_lex_stuff = NULL; return THING; } @@ -2499,10 +2626,11 @@ S_sublex_push(pTHX) { dVAR; LEXSHARED *shared; + const bool is_heredoc = PL_multi_close == '<'; ENTER; PL_lex_state = PL_sublex_info.super_state; - SAVEBOOL(PL_lex_dojoin); + SAVEI8(PL_lex_dojoin); SAVEI32(PL_lex_brackets); SAVEI32(PL_lex_allbrackets); SAVEI32(PL_lex_formbrack); @@ -2513,7 +2641,14 @@ S_sublex_push(pTHX) SAVESPTR(PL_lex_repl); SAVEVPTR(PL_lex_inpat); SAVEI16(PL_lex_inwhat); - SAVECOPLINE(PL_curcop); + if (is_heredoc) + { + SAVECOPLINE(PL_curcop); + SAVEI32(PL_multi_end); + SAVEI32(PL_parser->herelines); + PL_parser->herelines = 0; + } + SAVEI8(PL_multi_close); SAVEPPTR(PL_bufptr); SAVEPPTR(PL_bufend); SAVEPPTR(PL_oldbufptr); @@ -2526,6 +2661,7 @@ S_sublex_push(pTHX) SAVEGENERICPV(PL_lex_casestack); SAVEGENERICPV(PL_parser->lex_shared); SAVEBOOL(PL_parser->lex_re_reparsing); + SAVEI32(PL_copline); /* The here-doc parser needs to be able to peek into outer lexing scopes to find the body of the here-doc. So we put PL_linestr and @@ -2556,7 +2692,9 @@ S_sublex_push(pTHX) *PL_lex_casestack = '\0'; PL_lex_starts = 0; PL_lex_state = LEX_INTERPCONCAT; - CopLINE_set(PL_curcop, (line_t)PL_multi_start); + if (is_heredoc) + CopLINE_set(PL_curcop, (line_t)PL_multi_start); + PL_copline = NOLINE; Newxz(shared, 1, LEXSHARED); shared->ls_prev = PL_parser->lex_shared; @@ -2600,7 +2738,8 @@ S_sublex_done(pTHX) /* Is there a right-hand side to take care of? (s//RHS/ or tr//RHS/) */ assert(PL_lex_inwhat != OP_TRANSR); - if (PL_lex_repl && (PL_lex_inwhat == OP_SUBST || PL_lex_inwhat == OP_TRANS)) { + if (PL_lex_repl) { + assert (PL_lex_inwhat == OP_SUBST || PL_lex_inwhat == OP_TRANS); PL_linestr = PL_lex_repl; PL_lex_inpat = 0; PL_bufend = PL_bufptr = PL_oldbufptr = PL_oldoldbufptr = PL_linestart = SvPVX(PL_linestr); @@ -2625,9 +2764,16 @@ S_sublex_done(pTHX) PL_lex_state = LEX_INTERPCONCAT; PL_lex_repl = NULL; } + if (SvTYPE(PL_linestr) >= SVt_PVNV) { + CopLINE(PL_curcop) += + ((XPVNV*)SvANY(PL_linestr))->xnv_u.xpad_cop_seq.xlow + + PL_parser->herelines; + PL_parser->herelines = 0; + } return ','; } else { + const line_t l = CopLINE(PL_curcop); #ifdef PERL_MAD if (PL_madskills) { if (PL_thiswhite) { @@ -2643,6 +2789,8 @@ S_sublex_done(pTHX) } #endif LEAVE; + if (PL_multi_close == '<') + PL_parser->herelines += l - PL_multi_end; PL_bufend = SvPVX(PL_linestr); PL_bufend += SvCUR(PL_linestr); PL_expect = XOPERATOR; @@ -2676,7 +2824,7 @@ S_get_and_check_backslash_N_name(pTHX_ c { /* If warnings are on, this will print a more detailed analysis of what * is wrong than the error message below */ - utf8n_to_uvuni(first_bad_char_loc, + utf8n_to_uvchr(first_bad_char_loc, e - ((char *) first_bad_char_loc), NULL, 0); @@ -2702,11 +2850,12 @@ S_get_and_check_backslash_N_name(pTHX_ c * validation. */ table = GvHV(PL_hintgv); /* ^H */ cvp = hv_fetchs(table, "charnames", FALSE); - if (cvp && (cv = *cvp) && SvROK(cv) && ((rv = SvRV(cv)) != NULL) - && SvTYPE(rv) == SVt_PVCV && ((stash = CvSTASH(rv)) != NULL)) + if (cvp && (cv = *cvp) && SvROK(cv) && (rv = SvRV(cv), + SvTYPE(rv) == SVt_PVCV) && ((stash = CvSTASH(rv)) != NULL)) { const char * const name = HvNAME(stash); - if strEQ(name, "_charnames") { + if (HvNAMELEN(stash) == sizeof("_charnames")-1 + && strEQ(name, "_charnames")) { return res; } } @@ -2728,13 +2877,17 @@ S_get_and_check_backslash_N_name(pTHX_ c if (! isCHARNAME_CONT(*s)) { goto bad_charname; } - if (*s == ' ' && *(s-1) == ' ' && ckWARN(WARN_DEPRECATED)) { - Perl_warn(aTHX_ "A sequence of multiple spaces in a charnames alias definition is deprecated"); + if (*s == ' ' && *(s-1) == ' ' && ckWARN_d(WARN_DEPRECATED)) { + Perl_warner(aTHX_ packWARN(WARN_DEPRECATED), + "A sequence of multiple spaces in a charnames " + "alias definition is deprecated"); } s++; } - if (*(s-1) == ' ' && ckWARN(WARN_DEPRECATED)) { - Perl_warn(aTHX_ "Trailing white-space in a charnames alias definition is deprecated"); + if (*(s-1) == ' ' && ckWARN_d(WARN_DEPRECATED)) { + Perl_warner(aTHX_ packWARN(WARN_DEPRECATED), + "Trailing white-space in a charnames alias " + "definition is deprecated"); } } else { @@ -2747,7 +2900,7 @@ S_get_and_check_backslash_N_name(pTHX_ c } s++; } else if (UTF8_IS_DOWNGRADEABLE_START(*s)) { - if (! isALPHAU(UNI_TO_NATIVE(TWO_BYTE_UTF8_TO_UNI(*s, *(s+1))))) { + if (! isALPHAU(TWO_BYTE_UTF8_TO_NATIVE(*s, *(s+1)))) { goto bad_charname; } s += 2; @@ -2771,14 +2924,16 @@ S_get_and_check_backslash_N_name(pTHX_ c if (! isCHARNAME_CONT(*s)) { goto bad_charname; } - if (*s == ' ' && *(s-1) == ' ' && ckWARN(WARN_DEPRECATED)) { - Perl_warn(aTHX_ "A sequence of multiple spaces in a charnames alias definition is deprecated"); + if (*s == ' ' && *(s-1) == ' ' + && ckWARN_d(WARN_DEPRECATED)) { + Perl_warner(aTHX_ packWARN(WARN_DEPRECATED), + "A sequence of multiple spaces in a charnam" + "es alias definition is deprecated"); } s++; } else if (UTF8_IS_DOWNGRADEABLE_START(*s)) { - if (! isCHARNAME_CONT(UNI_TO_NATIVE(TWO_BYTE_UTF8_TO_UNI(*s, - *(s+1))))) + if (! isCHARNAME_CONT(TWO_BYTE_UTF8_TO_NATIVE(*s, *(s+1)))) { goto bad_charname; } @@ -2798,8 +2953,10 @@ S_get_and_check_backslash_N_name(pTHX_ c s += UTF8SKIP(s); } } - if (*(s-1) == ' ' && ckWARN(WARN_DEPRECATED)) { - Perl_warn(aTHX_ "Trailing white-space in a charnames alias definition is deprecated"); + if (*(s-1) == ' ' && ckWARN_d(WARN_DEPRECATED)) { + Perl_warner(aTHX_ packWARN(WARN_DEPRECATED), + "Trailing white-space in a charnames alias " + "definition is deprecated"); } } @@ -2810,7 +2967,7 @@ S_get_and_check_backslash_N_name(pTHX_ c if (! is_utf8_string_loc((U8 *) str, len, &first_bad_char_loc)) { /* If warnings are on, this will print a more detailed analysis of * what is wrong than the error message below */ - utf8n_to_uvuni(first_bad_char_loc, + utf8n_to_uvchr(first_bad_char_loc, (char *) first_bad_char_loc - str, NULL, 0); @@ -3011,7 +3168,7 @@ S_scan_const(pTHX_ char *start) char *e = d++; while (e-- > c) *(e + 1) = *e; - *c = (char)UTF_TO_NATIVE(0xff); + *c = (char) ILLEGAL_UTF8_BYTE; /* mark the range as done, and continue */ dorange = FALSE; didrange = TRUE; @@ -3065,16 +3222,12 @@ S_scan_const(pTHX_ char *start) #ifdef EBCDIC if (literal_endpoint == 2 && - ((isLOWER(min) && isLOWER(max)) || - (isUPPER(min) && isUPPER(max)))) { - if (isLOWER(min)) { - for (i = min; i <= max; i++) - if (isLOWER(i)) - *d++ = NATIVE_TO_NEED(has_utf8,i); - } else { - for (i = min; i <= max; i++) - if (isUPPER(i)) - *d++ = NATIVE_TO_NEED(has_utf8,i); + ((isLOWER_A(min) && isLOWER_A(max)) || + (isUPPER_A(min) && isUPPER_A(max)))) + { + for (i = min; i <= max; i++) { + if (isALPHA_A(i)) + *d++ = i; } } else @@ -3082,13 +3235,7 @@ S_scan_const(pTHX_ char *start) for (i = min; i <= max; i++) #ifdef EBCDIC if (has_utf8) { - const U8 ch = (U8)NATIVE_TO_UTF(i); - if (UNI_IS_INVARIANT(ch)) - *d++ = (U8)i; - else { - *d++ = (U8)UTF8_EIGHT_BIT_HI(ch); - *d++ = (U8)UTF8_EIGHT_BIT_LO(ch); - } + append_utf8_from_native_byte(i, &d); } else #endif @@ -3098,7 +3245,7 @@ S_scan_const(pTHX_ char *start) if (uvmax) { d = (char*)uvchr_to_utf8((U8*)d, 0x100); if (uvmax > 0x101) - *d++ = (char)UTF_TO_NATIVE(0xff); + *d++ = (char) ILLEGAL_UTF8_BYTE; if (uvmax > 0x100) d = (char*)uvchr_to_utf8((U8*)d, uvmax); } @@ -3123,7 +3270,7 @@ S_scan_const(pTHX_ char *start) && !native_range #endif ) { - *d++ = (char)UTF_TO_NATIVE(0xff); /* use illegal utf8 byte--see pmtrans */ + *d++ = (char) ILLEGAL_UTF8_BYTE; /* use illegal utf8 byte--see pmtrans */ s++; continue; } @@ -3166,7 +3313,7 @@ S_scan_const(pTHX_ char *start) else if (*s == '(' && PL_lex_inpat && s[1] == '?' && !in_charclass) { if (s[2] == '#') { while (s+1 < send && *s != ')') - *d++ = NATIVE_TO_NEED(has_utf8,*s++); + *d++ = *s++; } else if (!PL_lex_casemods && ( s[2] == '{' /* This should match regcomp.c */ @@ -3177,23 +3324,10 @@ S_scan_const(pTHX_ char *start) } /* likewise skip #-initiated comments in //x patterns */ - else if (*s == '#' && PL_lex_inpat && + else if (*s == '#' && PL_lex_inpat && !in_charclass && ((PMOP*)PL_lex_inpat)->op_pmflags & RXf_PMf_EXTENDED) { - while (s+1 < send && *s != '\n') { - /* for maint-5.18, half-fix #-in-charclass bug: - * *do* recognise codeblocks: /[#](?{})/ - * *don't* recognise interpolated vars: /[#$x]/ - */ - if (in_charclass && !PL_lex_casemods && s+3 < send && - s[0] == '(' && - s[1] == '?' && - ( s[2] == '{' - || (s[2] == '?' && s[3] == '{'))) - break; - *d++ = NATIVE_TO_NEED(has_utf8,*s++); - } - if (s+ 1 < send && *s != '\n') - break; /* we stopped on (?{}), not EOL */ + while (s+1 < send && *s != '\n') + *d++ = *s++; } /* no further processing of single-quoted regex */ @@ -3240,6 +3374,7 @@ S_scan_const(pTHX_ char *start) if (PL_lex_inwhat == OP_SUBST && !PL_lex_inpat && isDIGIT(*s) && *s != '0' && !isDIGIT(s[1])) { + /* diag_listed_as: \%d better written as $%d */ Perl_ck_warner(aTHX_ packWARN(WARN_SYNTAX), "\\%c better written as $%c", *s, *s); *--s = '$'; break; @@ -3268,7 +3403,7 @@ S_scan_const(pTHX_ char *start) || s[1] != '{' || regcurly(s + 1, FALSE))) { - *d++ = NATIVE_TO_NEED(has_utf8,'\\'); + *d++ = '\\'; goto default_action; } @@ -3297,7 +3432,7 @@ S_scan_const(pTHX_ char *start) { I32 flags = PERL_SCAN_SILENT_ILLDIGIT; STRLEN len = 3; - uv = NATIVE_TO_UNI(grok_oct(s, &len, &flags, NULL)); + uv = grok_oct(s, &len, &flags, NULL); s += len; if (len < 3 && s < send && isDIGIT(*s) && ckWARN(WARN_MISC)) @@ -3349,9 +3484,8 @@ S_scan_const(pTHX_ char *start) * UTF-8 sequence they can end up as, except if they force us * to recode the rest of the string into utf8 */ - /* Here uv is the ordinal of the next character being added in - * unicode (converted from native). */ - if (!UNI_IS_INVARIANT(uv)) { + /* Here uv is the ordinal of the next character being added */ + if (!UVCHR_IS_INVARIANT(uv)) { if (!has_utf8 && uv > 255) { /* Might need to recode whatever we have accumulated so * far if it contains any chars variant in utf8 or @@ -3369,7 +3503,7 @@ S_scan_const(pTHX_ char *start) } if (has_utf8) { - d = (char*)uvuni_to_utf8((U8*)d, uv); + d = (char*)uvchr_to_utf8((U8*)d, uv); if (PL_lex_inwhat == OP_TRANS && PL_sublex_info.sub_op) { PL_sublex_info.sub_op->op_private |= @@ -3402,16 +3536,6 @@ S_scan_const(pTHX_ char *start) * now, while preserving the fact that it was a named character * so that the regex compiler knows this */ - /* This section of code doesn't generally use the - * NATIVE_TO_NEED() macro to transform the input. I (khw) did - * a close examination of this macro and determined it is a - * no-op except on utfebcdic variant characters. Every - * character generated by this that would normally need to be - * enclosed by this macro is invariant, so the macro is not - * needed, and would complicate use of copy(). XXX There are - * other parts of this file where the macro is used - * inconsistently, but are saved by it being a no-op */ - /* The structure of this section of code (besides checking for * errors and upgrading to utf8) is: * Further disambiguate between the two meanings of \N, and if @@ -3438,7 +3562,7 @@ S_scan_const(pTHX_ char *start) if (! PL_lex_inpat) { yyerror("Missing right brace on \\N{}"); } else { - yyerror("Missing right brace on \\N{} or unescaped left brace after \\N."); + yyerror("Missing right brace on \\N{} or unescaped left brace after \\N"); } continue; } @@ -3499,11 +3623,13 @@ S_scan_const(pTHX_ char *start) has_utf8 = TRUE; } - /* Add the string to the output */ + /* Add the (Unicode) code point to the output. */ if (UNI_IS_INVARIANT(uv)) { - *d++ = (char) uv; + *d++ = (char) LATIN1_TO_NATIVE(uv); } - else d = (char*)uvuni_to_utf8((U8*)d, uv); + else { + d = (char*) uvoffuni_to_utf8_flags((U8*)d, uv, 0); + } } } else /* Here is \N{NAME} but not \N{U+...}. */ @@ -3563,19 +3689,16 @@ S_scan_const(pTHX_ char *start) char hex_string[2 * UTF8_MAXBYTES + 5]; /* Get the first character of the result. */ - U32 uv = utf8n_to_uvuni((U8 *) str, + U32 uv = utf8n_to_uvchr((U8 *) str, len, &char_length, UTF8_ALLOW_ANYUV); /* Convert first code point to hex, including - * the boiler plate before it. For all these, - * we convert to native format so that - * downstream code can continue to assume the - * input is native */ + * the boiler plate before it. */ output_length = my_snprintf(hex_string, sizeof(hex_string), - "\\N{U+%X", - (unsigned int) UNI_TO_NATIVE(uv)); + "\\N{U+%X", + (unsigned int) uv); /* Make sure there is enough space to hold it */ d = off + SvGROW(sv, off @@ -3590,15 +3713,15 @@ S_scan_const(pTHX_ char *start) * its ordinal in hex */ while ((str += char_length) < str_end) { const STRLEN off = d - SvPVX_const(sv); - U32 uv = utf8n_to_uvuni((U8 *) str, + U32 uv = utf8n_to_uvchr((U8 *) str, str_end - str, &char_length, UTF8_ALLOW_ANYUV); output_length = my_snprintf(hex_string, - sizeof(hex_string), - ".%X", - (unsigned int) UNI_TO_NATIVE(uv)); + sizeof(hex_string), + ".%X", + (unsigned int) uv); d = off + SvGROW(sv, off + output_length @@ -3654,7 +3777,7 @@ S_scan_const(pTHX_ char *start) case 'c': s++; if (s < send) { - *d++ = grok_bslash_c(*s++, has_utf8, 1); + *d++ = grok_bslash_c(*s++, 1); } else { yyerror("Missing control char name in \\c"); @@ -3663,25 +3786,25 @@ S_scan_const(pTHX_ char *start) /* printf-style backslashes, formfeeds, newlines, etc */ case 'b': - *d++ = NATIVE_TO_NEED(has_utf8,'\b'); + *d++ = '\b'; break; case 'n': - *d++ = NATIVE_TO_NEED(has_utf8,'\n'); + *d++ = '\n'; break; case 'r': - *d++ = NATIVE_TO_NEED(has_utf8,'\r'); + *d++ = '\r'; break; case 'f': - *d++ = NATIVE_TO_NEED(has_utf8,'\f'); + *d++ = '\f'; break; case 't': - *d++ = NATIVE_TO_NEED(has_utf8,'\t'); + *d++ = '\t'; break; case 'e': - *d++ = ASCII_TO_NEED(has_utf8,'\033'); + *d++ = ASCII_TO_NATIVE('\033'); break; case 'a': - *d++ = ASCII_TO_NEED(has_utf8,'\007'); + *d++ = '\a'; break; } /* end switch */ @@ -3696,7 +3819,7 @@ S_scan_const(pTHX_ char *start) default_action: /* If we started with encoded form, or already know we want it, then encode the next character */ - if (! NATIVE_IS_INVARIANT((U8)(*s)) && (this_utf8 || has_utf8)) { + if (! NATIVE_BYTE_IS_INVARIANT((U8)(*s)) && (this_utf8 || has_utf8)) { STRLEN len = 1; @@ -3707,8 +3830,10 @@ S_scan_const(pTHX_ char *start) * routine that does the conversion checks for errors like * malformed utf8 */ - const UV nextuv = (this_utf8) ? utf8n_to_uvchr((U8*)s, send - s, &len, 0) : (UV) ((U8) *s); - const STRLEN need = UNISKIP(NATIVE_TO_UNI(nextuv)); + const UV nextuv = (this_utf8) + ? utf8n_to_uvchr((U8*)s, send - s, &len, 0) + : (UV) ((U8) *s); + const STRLEN need = UNISKIP(nextuv); if (!has_utf8) { SvCUR_set(sv, d - SvPVX_const(sv)); SvPOK_on(sv); @@ -3735,7 +3860,7 @@ S_scan_const(pTHX_ char *start) #endif } else { - *d++ = NATIVE_TO_NEED(has_utf8,*s++); + *d++ = *s++; } } /* while loop to process each character */ @@ -3766,7 +3891,12 @@ S_scan_const(pTHX_ char *start) } /* return the substring (via pl_yylval) only if we parsed anything */ - if (s > PL_bufptr) { + if (s > start) { + char *s2 = start; + for (; s2 < s; s2++) { + if (*s2 == '\n') + COPLINE_INC_WITH_HERELINES; + } SvREFCNT_inc_simple_void_NN(sv); if ( (PL_hints & ( PL_lex_inpat ? HINT_NEW_RE : HINT_NEW_STRING )) && ! PL_parser->lex_re_reparsing) @@ -3806,6 +3936,7 @@ S_scan_const(pTHX_ char *start) * It deals with "$foo[3]" and /$foo[3]/ and /$foo[0123456789$]+/ * * ->[ and ->{ return TRUE + * ->$* ->$#* ->@* ->@[ ->@{ return TRUE if postderef_qq is enabled * { and [ outside a pattern are always subscripts, so return TRUE * if we're outside a pattern and it's not { or [, then return FALSE * if we're in a pattern and the first char is a { @@ -3831,6 +3962,11 @@ S_intuit_more(pTHX_ char *s) return TRUE; if (*s == '-' && s[1] == '>' && (s[2] == '[' || s[2] == '{')) return TRUE; + if (*s == '-' && s[1] == '>' + && FEATURE_POSTDEREF_QQ_IS_ENABLED + && ( (s[2] == '$' && (s[3] == '*' || (s[3] == '#' && s[4] == '*'))) + ||(s[2] == '@' && strchr("*[{",s[3])) )) + return TRUE; if (*s != '{' && *s != '[') return FALSE; if (!PL_lex_inpat) @@ -3883,7 +4019,10 @@ S_intuit_more(pTHX_ char *s) weight -= seen[un_char] * 10; if (isWORDCHAR_lazy_if(s+1,UTF)) { int len; - scan_ident(s, send, tmpbuf, sizeof tmpbuf, FALSE); + char *tmp = PL_bufend; + PL_bufend = (char*)send; + scan_ident(s, tmpbuf, sizeof tmpbuf, FALSE); + PL_bufend = tmp; len = (int)strlen(tmpbuf); if (len > 1 && gv_fetchpvn_flags(tmpbuf, len, UTF ? SVf_UTF8 : 0, SVt_PV)) @@ -3991,19 +4130,14 @@ S_intuit_method(pTHX_ char *start, GV *g if (gv && SvTYPE(gv) == SVt_PVGV && GvIO(gv)) return 0; if (cv && SvPOK(cv)) { - const char *proto = CvPROTO(cv); - if (proto) { - if (*proto == ';') - proto++; - if (*proto == '*') - return 0; - } + const char *proto = CvPROTO(cv); + if (proto) { + while (*proto && (isSPACE(*proto) || *proto == ';')) + proto++; + if (*proto == '*') + return 0; + } } - s = scan_word(s, tmpbuf, sizeof tmpbuf, TRUE, &len); - /* start is the beginning of the possible filehandle/object, - * and s is the end of it - * tmpbuf is a copy of it - */ if (*start == '$') { if (cv || PL_last_lop_op == OP_PRINT || PL_last_lop_op == OP_SAY || @@ -4020,6 +4154,13 @@ S_intuit_method(pTHX_ char *start, GV *g PL_expect = XREF; return *s == '(' ? FUNCMETH : METHOD; } + + s = scan_word(s, tmpbuf, sizeof tmpbuf, TRUE, &len); + /* start is the beginning of the possible filehandle/object, + * and s is the end of it + * tmpbuf is a copy of it (but with single quotes as double colons) + */ + if (!keyword(tmpbuf, len, 0)) { if (len > 2 && tmpbuf[len - 2] == ':' && tmpbuf[len - 1] == ':') { len -= 2; @@ -4183,14 +4324,7 @@ Perl_filter_read(pTHX_ int idx, SV *buf_ /* This API is bad. It should have been using unsigned int for maxlen. Not sure if we want to change the API, but if not we should sanity check the value here. */ - unsigned int correct_length - = maxlen < 0 ? -#ifdef PERL_MICRO - 0x7FFFFFFF -#else - INT_MAX -#endif - : maxlen; + unsigned int correct_length = maxlen < 0 ? PERL_INT_MAX : maxlen; PERL_ARGS_ASSERT_FILTER_READ; @@ -4324,31 +4458,6 @@ S_find_in_my_stash(pTHX_ const char *pkg return gv_stashpvn(pkgname, len, UTF ? SVf_UTF8 : 0); } -/* - * S_readpipe_override - * Check whether readpipe() is overridden, and generates the appropriate - * optree, provided sublex_start() is called afterwards. - */ -STATIC void -S_readpipe_override(pTHX) -{ - GV **gvp; - GV *gv_readpipe = gv_fetchpvs("readpipe", GV_NOTQUAL, SVt_PVCV); - pl_yylval.ival = OP_BACKTICK; - if ((gv_readpipe - && GvCVu(gv_readpipe) && GvIMPORTED_CV(gv_readpipe)) - || - ((gvp = (GV**)hv_fetchs(PL_globalstash, "readpipe", FALSE)) - && (gv_readpipe = *gvp) && isGV_with_GP(gv_readpipe) - && GvCVu(gv_readpipe) && GvIMPORTED_CV(gv_readpipe))) - { - PL_lex_op = (OP*)newUNOP(OP_ENTERSUB, OPf_STACKED, - op_append_elem(OP_LIST, - newSVOP(OP_CONST, 0, &PL_sv_undef), /* value will be read later */ - newCVREF(0, newGVOP(OP_GV, 0, gv_readpipe)))); - } -} - #ifdef PERL_MAD /* * Perl_madlex @@ -4550,12 +4659,12 @@ S_tokenize_use(pTHX_ int is_use, char *s force_next(WORD); } else if (*s == 'v') { - s = force_word(s,WORD,FALSE,TRUE,FALSE); + s = force_word(s,WORD,FALSE,TRUE); s = force_version(s, FALSE); } } else { - s = force_word(s,WORD,FALSE,TRUE,FALSE); + s = force_word(s,WORD,FALSE,TRUE); s = force_version(s, FALSE); } pl_yylval.ival = is_use; @@ -4564,7 +4673,7 @@ S_tokenize_use(pTHX_ int is_use, char *s #ifdef DEBUGGING static const char* const exp_name[] = { "OPERATOR", "TERM", "REF", "STATE", "BLOCK", "ATTRBLOCK", - "ATTRTERM", "TERMBLOCK", "TERMORDORDOR" + "ATTRTERM", "TERMBLOCK", "POSTDEREF", "TERMORDORDOR" }; #endif @@ -4578,6 +4687,20 @@ S_word_takes_any_delimeter(char *p, STRL (p[0] == 'q' && strchr("qwxr", p[1])))); } +static void +S_check_scalar_slice(pTHX_ char *s) +{ + s++; + while (*s == ' ' || *s == '\t') s++; + if (*s == 'q' && s[1] == 'w' + && !isWORDCHAR_lazy_if(s+2,UTF)) + return; + while (*s && (isWORDCHAR_lazy_if(s,UTF) || strchr(" \t$#+-'\"", *s))) + s += UTF ? UTF8SKIP(s) : 1; + if (*s == '}' || *s == ']') + pl_yylval.ival = OPpSLICEWARNING; +} + /* yylex @@ -4623,9 +4746,6 @@ S_word_takes_any_delimeter(char *p, STRL */ -#ifdef __SC__ -#pragma segment Perl_yylex -#endif int Perl_yylex(pTHX) { @@ -4634,6 +4754,7 @@ Perl_yylex(pTHX) char *d; STRLEN len; bool bof = FALSE; + const bool saw_infix_sigil = cBOOL(PL_parser->saw_infix_sigil); U8 formbrack = 0; U32 fake_eof = 0; @@ -4655,11 +4776,9 @@ Perl_yylex(pTHX) } ); switch (PL_lex_state) { -#ifdef COMMENTARY - case LEX_NORMAL: /* Some compilers will produce faster */ - case LEX_INTERPNORMAL: /* code if we comment these out. */ + case LEX_NORMAL: + case LEX_INTERPNORMAL: break; -#endif /* when we've already built the next token, just pull it out of the queue */ case LEX_KNOWNEXT: @@ -4917,6 +5036,7 @@ Perl_yylex(pTHX) case LEX_INTERPEND: if (PL_lex_dojoin) { + const U8 dojoin_was = PL_lex_dojoin; PL_lex_dojoin = FALSE; PL_lex_state = LEX_INTERPCONCAT; #ifdef PERL_MAD @@ -4927,7 +5047,7 @@ Perl_yylex(pTHX) } #endif PL_lex_allbrackets--; - return REPORT(')'); + return REPORT(dojoin_was == 1 ? ')' : POSTJOIN); } if (PL_lex_inwhat == OP_SUBST && PL_linestr == PL_lex_repl && SvEVALED(PL_lex_repl)) @@ -5033,9 +5153,12 @@ Perl_yylex(pTHX) return yylex(); } + /* We really do *not* want PL_linestr ever becoming a COW. */ + assert (!SvIsCOW(PL_linestr)); s = PL_bufptr; PL_oldoldbufptr = PL_oldbufptr; PL_oldbufptr = s; + PL_parser->saw_infix_sigil = 0; retry: #ifdef PERL_MAD @@ -5051,22 +5174,20 @@ Perl_yylex(pTHX) goto keylookup; { SV *dsv = newSVpvs_flags("", SVs_TEMP); - const char *c = UTF ? savepv(sv_uni_display(dsv, newSVpvn_flags(s, + const char *c = UTF ? sv_uni_display(dsv, newSVpvn_flags(s, UTF8SKIP(s), SVs_TEMP | SVf_UTF8), - 10, UNI_DISPLAY_ISPRINT)) + 10, UNI_DISPLAY_ISPRINT) : Perl_form(aTHX_ "\\x%02X", (unsigned char)*s); len = UTF ? Perl_utf8_length(aTHX_ (U8 *) PL_linestart, (U8 *) s) : (STRLEN) (s - PL_linestart); if (len > UNRECOGNIZED_PRECEDE_COUNT) { d = UTF ? (char *) Perl_utf8_hop(aTHX_ (U8 *) s, -UNRECOGNIZED_PRECEDE_COUNT) : s - UNRECOGNIZED_PRECEDE_COUNT; } else { d = PL_linestart; - } - *s = '\0'; - sv_setpv(dsv, d); - if (UTF) - SvUTF8_on(dsv); - Perl_croak(aTHX_ "Unrecognized character %s; marked by <-- HERE after %"SVf"<-- HERE near column %d", c, SVfARG(dsv), (int) len + 1); + } + Perl_croak(aTHX_ "Unrecognized character %s; marked by <-- HERE after %"UTF8f"<-- HERE near column %d", c, + UTF8fARG(UTF, (s - d), d), + (int) len + 1); } case 4: case 26: @@ -5115,6 +5236,7 @@ Perl_yylex(pTHX) SETERRNO(0,SS_NORMAL); sv_setpvs(PL_linestr, "BEGIN { require 'perl5db.pl' };"); } + PL_parser->preambling = CopLINE(PL_curcop); } else sv_setpvs(PL_linestr,""); if (PL_preambleav) { @@ -5194,7 +5316,7 @@ Perl_yylex(pTHX) * check if it in fact is. */ if (bof && PL_rsfp && (*s == 0 || - *(U8*)s == 0xEF || + *(U8*)s == BOM_UTF8_FIRST_BYTE || *(U8*)s >= 0xFE || s[1] == 0)) { Off_t offset = (IV)PerlIO_tell(PL_rsfp); @@ -5506,14 +5628,19 @@ Perl_yylex(pTHX) s = SKIPSPACE0(s); } else { -/* if (PL_madskills && PL_lex_formbrack) { */ - d = s; - while (d < PL_bufend && *d != '\n') - d++; - if (d < PL_bufend) - d++; - else if (d > PL_bufend) /* Found by Ilya: feed random input to Perl. */ +#endif + if (PL_madskills) d = s; + while (s < PL_bufend && *s != '\n') + s++; + if (s < PL_bufend) + { + s++; + if (s < PL_bufend) + incline(s); + } + else if (s > PL_bufend) /* Found by Ilya: feed random input to Perl. */ Perl_croak(aTHX_ "panic: input overflow"); +#ifdef PERL_MAD if (PL_madskills && CopLINE(PL_curcop) >= 1) { if (!PL_thiswhite) PL_thiswhite = newSVpvs(""); @@ -5521,16 +5648,9 @@ Perl_yylex(pTHX) sv_setpvs(PL_thiswhite, ""); PL_faketokens = 0; } - sv_catpvn(PL_thiswhite, s, d - s); + sv_catpvn(PL_thiswhite, d, s - d); } - s = d; -/* } - *s = '\0'; - PL_bufend = s; */ } -#else - *s = '\0'; - PL_bufend = s; #endif } goto retry; @@ -5547,11 +5667,10 @@ Perl_yylex(pTHX) s++; if (strnEQ(s,"=>",2)) { - s = force_word(PL_bufptr,WORD,FALSE,FALSE,FALSE); + s = force_word(PL_bufptr,WORD,FALSE,FALSE); DEBUG_T( { printbuf("### Saw unary minus before =>, forcing word %s\n", s); } ); OPERATOR('-'); /* unary minus */ } - PL_last_uni = PL_oldbufptr; switch (tmp) { case 'r': ftst = OP_FTEREAD; break; case 'w': ftst = OP_FTEWRITE; break; @@ -5590,6 +5709,7 @@ Perl_yylex(pTHX) break; } if (ftst) { + PL_last_uni = PL_oldbufptr; PL_last_lop_op = (OPCODE)ftst; DEBUG_T( { PerlIO_printf(Perl_debug_log, "### Saw file test %c\n", (int)tmp); @@ -5618,8 +5738,22 @@ Perl_yylex(pTHX) else if (*s == '>') { s++; s = SKIPSPACE1(s); + if (FEATURE_POSTDEREF_IS_ENABLED && ( + ((*s == '$' || *s == '&') && s[1] == '*') + ||(*s == '$' && s[1] == '#' && s[2] == '*') + ||((*s == '@' || *s == '%') && strchr("*[{", s[1])) + ||(*s == '*' && (s[1] == '*' || s[1] == '{')) + )) + { + Perl_ck_warner_d(aTHX_ + packWARN(WARN_EXPERIMENTAL__POSTDEREF), + "Postfix dereference is experimental" + ); + PL_expect = XPOSTDEREF; + TOKEN(ARROW); + } if (isIDFIRST_lazy_if(s,UTF)) { - s = force_word(s,METHOD,FALSE,TRUE,FALSE); + s = force_word(s,METHOD,FALSE,TRUE); TOKEN(ARROW); } else if (*s == '$') @@ -5668,8 +5802,9 @@ Perl_yylex(pTHX) } case '*': + if (PL_expect == XPOSTDEREF) POSTDEREF('*'); if (PL_expect != XOPERATOR) { - s = scan_ident(s, PL_bufend, PL_tokenbuf, sizeof PL_tokenbuf, TRUE); + s = scan_ident(s, PL_tokenbuf, sizeof PL_tokenbuf, TRUE); PL_expect = XOPERATOR; force_ident(PL_tokenbuf, '*'); if (!*PL_tokenbuf) @@ -5691,26 +5826,35 @@ Perl_yylex(pTHX) s--; TOKEN(0); } + PL_parser->saw_infix_sigil = 1; Mop(OP_MULTIPLY); case '%': + { if (PL_expect == XOPERATOR) { if (s[1] == '=' && !PL_lex_allbrackets && PL_lex_fakeeof >= LEX_FAKEEOF_ASSIGN) TOKEN(0); ++s; + PL_parser->saw_infix_sigil = 1; Mop(OP_MODULO); } + else if (PL_expect == XPOSTDEREF) POSTDEREF('%'); PL_tokenbuf[0] = '%'; - s = scan_ident(s, PL_bufend, PL_tokenbuf + 1, + s = scan_ident(s, PL_tokenbuf + 1, sizeof PL_tokenbuf - 1, FALSE); + pl_yylval.ival = 0; if (!PL_tokenbuf[1]) { PREREF('%'); } + if ((PL_expect != XREF || PL_oldoldbufptr == PL_last_lop) && intuit_more(s)) { + if (*s == '[') + PL_tokenbuf[0] = '@'; + } PL_expect = XOPERATOR; force_ident_maybe_lex('%'); TERM('%'); - + } case '^': if (!PL_lex_allbrackets && PL_lex_fakeeof >= (s[1] == '=' ? LEX_FAKEEOF_ASSIGN : LEX_FAKEEOF_BITWISE)) @@ -5798,7 +5942,8 @@ Perl_yylex(pTHX) } sv = newSVpvn_flags(s, len, UTF ? SVf_UTF8 : 0); if (*d == '(') { - d = scan_str(d,TRUE,TRUE,FALSE, FALSE); + d = scan_str(d,TRUE,TRUE,FALSE,FALSE,NULL); + COPLINE_SET_FROM_MULTI_END; if (!d) { /* MUST advance bufptr here to avoid bogus "at end of line" context messages from yyerror(). @@ -5865,14 +6010,14 @@ Perl_yylex(pTHX) /* XXX losing whitespace on sequential attributes here */ } { - const char tmp - = (PL_expect == XOPERATOR ? '=' : '{'); /*'}(' for vi */ - if (*s != ';' && *s != '}' && *s != tmp - && (tmp != '=' || *s != ')')) { + if (*s != ';' && *s != '}' && + !(PL_expect == XOPERATOR + ? (*s == '=' || *s == ')') + : (*s == '{' || *s == '('))) { const char q = ((*s == '\'') ? '"' : '\''); /* If here for an expression, and parsed no attrs, back off. */ - if (tmp == '=' && !attrs) { + if (PL_expect == XOPERATOR && !attrs) { s = PL_bufptr; break; } @@ -5940,6 +6085,7 @@ Perl_yylex(pTHX) TOKEN(0); s++; if (PL_lex_brackets <= 0) + /* diag_listed_as: Unmatched right %s bracket */ yyerror("Unmatched right square bracket"); else --PL_lex_brackets; @@ -5982,7 +6128,7 @@ Perl_yylex(pTHX) d++; if (*d == '}') { const char minus = (PL_tokenbuf[0] == '-'); - s = force_word(s + minus, WORD, FALSE, TRUE, FALSE); + s = force_word(s + minus, WORD, FALSE, TRUE); if (minus) force_next('-'); } @@ -6118,6 +6264,7 @@ Perl_yylex(pTHX) rightbracket: s++; if (PL_lex_brackets <= 0) + /* diag_listed_as: Unmatched right %s bracket */ yyerror("Unmatched right curly bracket"); else PL_expect = (expectation)PL_lex_brackstack[--PL_lex_brackets]; @@ -6169,6 +6316,7 @@ Perl_yylex(pTHX) } TOKEN(';'); case '&': + if (PL_expect == XPOSTDEREF) POSTDEREF('&'); s++; if (*s++ == '&') { if (!PL_lex_allbrackets && PL_lex_fakeeof >= @@ -6192,11 +6340,12 @@ Perl_yylex(pTHX) s--; TOKEN(0); } + PL_parser->saw_infix_sigil = 1; BAop(OP_BIT_AND); } PL_tokenbuf[0] = '&'; - s = scan_ident(s - 1, PL_bufend, PL_tokenbuf + 1, + s = scan_ident(s - 1, PL_tokenbuf + 1, sizeof PL_tokenbuf - 1, TRUE); if (PL_tokenbuf[1]) { PL_expect = XOPERATOR; @@ -6426,10 +6575,17 @@ Perl_yylex(pTHX) return deprecate_commaless_var_list(); } } + else if (PL_expect == XPOSTDEREF) { + if (s[1] == '#') { + s++; + POSTDEREF(DOLSHARP); + } + POSTDEREF('$'); + } if (s[1] == '#' && (isIDFIRST_lazy_if(s+2,UTF) || strchr("{$:+-@", s[2]))) { PL_tokenbuf[0] = '@'; - s = scan_ident(s + 1, PL_bufend, PL_tokenbuf + 1, + s = scan_ident(s + 1, PL_tokenbuf + 1, sizeof PL_tokenbuf - 1, FALSE); if (PL_expect == XOPERATOR) no_op("Array length", s); @@ -6441,7 +6597,7 @@ Perl_yylex(pTHX) } PL_tokenbuf[0] = '$'; - s = scan_ident(s, PL_bufend, PL_tokenbuf + 1, + s = scan_ident(s, PL_tokenbuf + 1, sizeof PL_tokenbuf - 1, FALSE); if (PL_expect == XOPERATOR) no_op("Scalar", s); @@ -6495,9 +6651,8 @@ Perl_yylex(pTHX) if (*t == ';' && get_cvn_flags(tmpbuf, len, UTF ? SVf_UTF8 : 0)) Perl_warner(aTHX_ packWARN(WARN_SYNTAX), - "You need to quote \"%"SVf"\"", - SVfARG(newSVpvn_flags(tmpbuf, len, - SVs_TEMP | (UTF ? SVf_UTF8 : 0)))); + "You need to quote \"%"UTF8f"\"", + UTF8fARG(UTF, len, tmpbuf)); } } } @@ -6560,8 +6715,10 @@ Perl_yylex(pTHX) case '@': if (PL_expect == XOPERATOR) no_op("Array", s); + else if (PL_expect == XPOSTDEREF) POSTDEREF('@'); PL_tokenbuf[0] = '@'; - s = scan_ident(s, PL_bufend, PL_tokenbuf + 1, sizeof PL_tokenbuf - 1, FALSE); + s = scan_ident(s, PL_tokenbuf + 1, sizeof PL_tokenbuf - 1, FALSE); + pl_yylval.ival = 0; if (!PL_tokenbuf[1]) { PREREF('@'); } @@ -6574,20 +6731,7 @@ Perl_yylex(pTHX) /* Warn about @ where they meant $. */ if (*s == '[' || *s == '{') { if (ckWARN(WARN_SYNTAX)) { - const char *t = s + 1; - while (*t && (isWORDCHAR_lazy_if(t,UTF) || strchr(" \t$#+-'\"", *t))) - t += UTF ? UTF8SKIP(t) : 1; - if (*t == '}' || *t == ']') { - t++; - PL_bufptr = PEEKSPACE(PL_bufptr); /* XXX can realloc */ - /* diag_listed_as: Scalar value @%s[%s] better written as $%s[%s] */ - Perl_warner(aTHX_ packWARN(WARN_SYNTAX), - "Scalar value %"SVf" better written as $%"SVf, - SVfARG(newSVpvn_flags(PL_bufptr, (STRLEN)(t-PL_bufptr), - SVs_TEMP | (UTF ? SVf_UTF8 : 0 ))), - SVfARG(newSVpvn_flags(PL_bufptr+1, (STRLEN)(t-PL_bufptr-1), - SVs_TEMP | (UTF ? SVf_UTF8 : 0 )))); - } + S_check_scalar_slice(aTHX_ s); } } } @@ -6703,7 +6847,10 @@ Perl_yylex(pTHX) TERM(THING); case '\'': - s = scan_str(s,!!PL_madskills,FALSE,FALSE, FALSE); + s = scan_str(s,!!PL_madskills,FALSE,FALSE,FALSE,NULL); + if (!s) + missingterm(NULL); + COPLINE_SET_FROM_MULTI_END; DEBUG_T( { printbuf("### Saw string before %s\n", s); } ); if (PL_expect == XOPERATOR) { if (PL_lex_formbrack && PL_lex_brackets == PL_lex_formbrack) { @@ -6712,14 +6859,18 @@ Perl_yylex(pTHX) else no_op("String",s); } - if (!s) - missingterm(NULL); pl_yylval.ival = OP_CONST; TERM(sublex_start()); case '"': - s = scan_str(s,!!PL_madskills,FALSE,FALSE, FALSE); - DEBUG_T( { printbuf("### Saw string before %s\n", s); } ); + s = scan_str(s,!!PL_madskills,FALSE,FALSE,FALSE,NULL); + DEBUG_T( { + if (s) + printbuf("### Saw string before %s\n", s); + else + PerlIO_printf(Perl_debug_log, + "### Saw unterminated string\n"); + } ); if (PL_expect == XOPERATOR) { if (PL_lex_formbrack && PL_lex_brackets == PL_lex_formbrack) { return deprecate_commaless_var_list(); @@ -6738,21 +6889,24 @@ Perl_yylex(pTHX) break; } } + if (pl_yylval.ival == OP_CONST) + COPLINE_SET_FROM_MULTI_END; TERM(sublex_start()); case '`': - s = scan_str(s,!!PL_madskills,FALSE,FALSE, FALSE); + s = scan_str(s,!!PL_madskills,FALSE,FALSE,FALSE,NULL); DEBUG_T( { printbuf("### Saw backtick string before %s\n", s); } ); if (PL_expect == XOPERATOR) no_op("Backticks",s); if (!s) missingterm(NULL); - readpipe_override(); + pl_yylval.ival = OP_BACKTICK; TERM(sublex_start()); case '\\': s++; - if (PL_lex_inwhat && isDIGIT(*s)) + if (PL_lex_inwhat == OP_SUBST && PL_lex_repl == PL_linestr + && isDIGIT(*s)) Perl_ck_warner(aTHX_ packWARN(WARN_SYNTAX),"Can't use \\%c to mean $%c in expression", *s, *s); if (PL_expect == XOPERATOR) @@ -6849,8 +7003,10 @@ Perl_yylex(pTHX) anydelim = word_takes_any_delimeter(PL_tokenbuf, len); /* x::* is just a word, unless x is "CORE" */ - if (!anydelim && *s == ':' && s[1] == ':' && strNE(PL_tokenbuf, "CORE")) + if (!anydelim && *s == ':' && s[1] == ':') { + if (strEQ(PL_tokenbuf, "CORE")) goto case_KEY_CORE; goto just_a_word; + } d = s; while (d < PL_bufend && isSPACE(*d)) @@ -6858,6 +7014,7 @@ Perl_yylex(pTHX) /* Is this a word before a => operator? */ if (*d == '=' && d[1] == '>') { + fat_arrow: CLINE; pl_yylval.opval = (OP*)newSVOP(OP_CONST, 0, @@ -6948,7 +7105,8 @@ Perl_yylex(pTHX) if (PL_expect != XOPERATOR && (*s != ':' || s[1] != ':')) { CV *cv; if ((gv = gv_fetchpvn_flags(PL_tokenbuf, len, - UTF ? SVf_UTF8 : 0, SVt_PVCV)) && + (UTF ? SVf_UTF8 : 0)|GV_NOTQUAL, + SVt_PVCV)) && (cv = GvCVu(gv))) { if (GvIMPORTED_CV(gv)) @@ -6958,9 +7116,14 @@ Perl_yylex(pTHX) } if (!ogv && (gvp = (GV**)hv_fetch(PL_globalstash, PL_tokenbuf, - UTF ? -(I32)len : (I32)len, FALSE)) && - (gv = *gvp) && isGV_with_GP(gv) && - GvCVu(gv) && GvIMPORTED_CV(gv)) + len, FALSE)) && + (gv = *gvp) && ( + isGV_with_GP(gv) + ? GvCVu(gv) && GvIMPORTED_CV(gv) + : SvPCS_IMPORTED(gv) + && (gv_init(gv, PL_globalstash, PL_tokenbuf, + len, 0), 1) + )) { ogv = gv; } @@ -6983,7 +7146,7 @@ Perl_yylex(pTHX) } gv = NULL; gvp = 0; - if (hgv && tmp != KEY_x && tmp != KEY_CORE) /* never ambiguous */ + if (hgv && tmp != KEY_x) /* never ambiguous */ Perl_ck_warner(aTHX_ packWARN(WARN_AMBIGUOUS), "Ambiguous call resolved as CORE::%s(), " "qualify as such or use &", @@ -6991,6 +7154,21 @@ Perl_yylex(pTHX) } } + if (tmp && tmp != KEY___DATA__ && tmp != KEY___END__ + && (!anydelim || *s != '#')) { + /* no override, and not s### either; skipspace is safe here + * check for => on following line */ + bool arrow; + STRLEN bufoff = PL_bufptr - SvPVX(PL_linestr); + STRLEN soff = s - SvPVX(PL_linestr); + s = skipspace_flags(s, LEX_NO_INCLINE); + arrow = *s == '=' && s[1] == '>'; + PL_bufptr = SvPVX(PL_linestr) + bufoff; + s = SvPVX(PL_linestr) + soff; + if (arrow) + goto fat_arrow; + } + reserved_word: switch (tmp) { @@ -7029,9 +7207,8 @@ Perl_yylex(pTHX) s = scan_word(s, PL_tokenbuf + len, sizeof PL_tokenbuf - len, TRUE, &morelen); if (!morelen) - Perl_croak(aTHX_ "Bad name after %"SVf"%s", - SVfARG(newSVpvn_flags(PL_tokenbuf, len, - (UTF ? SVf_UTF8 : 0) | SVs_TEMP )), + Perl_croak(aTHX_ "Bad name after %"UTF8f"%s", + UTF8fARG(UTF, len, PL_tokenbuf), *s == '\'' ? "'" : "::"); len += morelen; pkgname = 1; @@ -7058,9 +7235,8 @@ Perl_yylex(pTHX) if (ckWARN(WARN_BAREWORD) && ! gv_fetchpvn_flags(PL_tokenbuf, len, UTF ? SVf_UTF8 : 0, SVt_PVHV)) Perl_warner(aTHX_ packWARN(WARN_BAREWORD), - "Bareword \"%"SVf"\" refers to nonexistent package", - SVfARG(newSVpvn_flags(PL_tokenbuf, len, - (UTF ? SVf_UTF8 : 0) | SVs_TEMP))); + "Bareword \"%"UTF8f"\" refers to nonexistent package", + UTF8fARG(UTF, len, PL_tokenbuf)); len -= 2; PL_tokenbuf[len] = '\0'; gv = NULL; @@ -7176,9 +7352,13 @@ Perl_yylex(pTHX) if (*s == '=' && s[1] == '>' && !pkgname) { op_free(rv2cv_op); CLINE; + /* This is our own scalar, created a few lines above, + so this is safe. */ + SvREADONLY_off(cSVOPx(pl_yylval.opval)->op_sv); sv_setpv(((SVOP*)pl_yylval.opval)->op_sv, PL_tokenbuf); if (UTF && !IN_BYTES && is_utf8_string((U8*)PL_tokenbuf, len)) SvUTF8_on(((SVOP*)pl_yylval.opval)->op_sv); + SvREADONLY_on(cSVOPx(pl_yylval.opval)->op_sv); TERM(WORD); } @@ -7189,7 +7369,7 @@ Perl_yylex(pTHX) d = s + 1; while (SPACE_OR_TAB(*d)) d++; - if (*d == ')' && (sv = cv_const_sv(cv))) { + if (*d == ')' && (sv = cv_const_sv_or_av(cv))) { s = d + 1; goto its_constant; } @@ -7246,19 +7426,26 @@ Perl_yylex(pTHX) if (cv) { if (lastchar == '-' && penultchar != '-') { - const SV *tmpsv = newSVpvn_flags( PL_tokenbuf, len ? len : strlen(PL_tokenbuf), (UTF ? SVf_UTF8 : 0) | SVs_TEMP ); + const STRLEN l = len ? len : strlen(PL_tokenbuf); Perl_ck_warner_d(aTHX_ packWARN(WARN_AMBIGUOUS), - "Ambiguous use of -%"SVf" resolved as -&%"SVf"()", - SVfARG(tmpsv), SVfARG(tmpsv)); + "Ambiguous use of -%"UTF8f" resolved as -&%"UTF8f"()", + UTF8fARG(UTF, l, PL_tokenbuf), + UTF8fARG(UTF, l, PL_tokenbuf)); } /* Check for a constant sub */ - if ((sv = cv_const_sv(cv))) { + if ((sv = cv_const_sv_or_av(cv))) { its_constant: op_free(rv2cv_op); SvREFCNT_dec(((SVOP*)pl_yylval.opval)->op_sv); ((SVOP*)pl_yylval.opval)->op_sv = SvREFCNT_inc_simple(sv); - pl_yylval.opval->op_private = OPpCONST_FOLDED; - pl_yylval.opval->op_flags |= OPf_SPECIAL; + if (SvTYPE(sv) == SVt_PVAV) + pl_yylval.opval = newUNOP(OP_RV2AV, OPf_PARENS, + pl_yylval.opval); + else { + pl_yylval.opval->op_private = 0; + pl_yylval.opval->op_folded = 1; + pl_yylval.opval->op_flags |= OPf_SPECIAL; + } TOKEN(WORD); } @@ -7278,6 +7465,7 @@ Perl_yylex(pTHX) STRLEN protolen = CvPROTOLEN(cv); const char *proto = CvPROTO(cv); bool optional; + proto = S_strip_spaces(aTHX_ proto, &protolen); if (!protolen) TERM(FUNC0SUB); if ((optional = *proto == ';')) @@ -7414,20 +7602,26 @@ Perl_yylex(pTHX) while (isLOWER(*d)) d++; if (!*d && !gv_stashpv(PL_tokenbuf, UTF ? SVf_UTF8 : 0)) + { + /* PL_warn_reserved is constant */ + GCC_DIAG_IGNORE(-Wformat-nonliteral); Perl_warner(aTHX_ packWARN(WARN_RESERVED), PL_warn_reserved, PL_tokenbuf); + GCC_DIAG_RESTORE; + } } } } op_free(rv2cv_op); safe_bareword: - if ((lastchar == '*' || lastchar == '%' || lastchar == '&')) { + if ((lastchar == '*' || lastchar == '%' || lastchar == '&') + && saw_infix_sigil) { Perl_ck_warner_d(aTHX_ packWARN(WARN_AMBIGUOUS), - "Operator or semicolon missing before %c%"SVf, - lastchar, SVfARG(newSVpvn_flags(PL_tokenbuf, - strlen(PL_tokenbuf), - SVs_TEMP | (UTF ? SVf_UTF8 : 0)))); + "Operator or semicolon missing before %c%"UTF8f, + lastchar, + UTF8fARG(UTF, strlen(PL_tokenbuf), + PL_tokenbuf)); Perl_ck_warner_d(aTHX_ packWARN(WARN_AMBIGUOUS), "Ambiguous use of %c resolved as operator %c", lastchar, lastchar); @@ -7458,21 +7652,12 @@ Perl_yylex(pTHX) case KEY___END__: { GV *gv; if (PL_rsfp && (!PL_in_eval || PL_tokenbuf[2] == 'D')) { - const char *pname = "main"; - STRLEN plen = 4; - U32 putf8 = 0; - if (PL_tokenbuf[2] == 'D') - { - HV * const stash = - PL_curstash ? PL_curstash : PL_defstash; - pname = HvNAME_get(stash); - plen = HvNAMELEN (stash); - if(HvNAMEUTF8(stash)) putf8 = SVf_UTF8; - } - gv = gv_fetchpvn_flags( - Perl_form(aTHX_ "%*s::DATA", (int)plen, pname), - plen+6, GV_ADD|putf8, SVt_PVIO - ); + HV * const stash = PL_tokenbuf[2] == 'D' && PL_curstash + ? PL_curstash + : PL_defstash; + gv = (GV *)*hv_fetchs(stash, "DATA", 1); + if (!isGV(gv)) + gv_init(gv,stash,"DATA",4,0); GvMULTI_on(gv); if (!GvIO(gv)) GvIOp(gv) = newIO(); @@ -7521,7 +7706,6 @@ Perl_yylex(pTHX) ENTER; SAVETMPS; PUSHMARK(sp); - EXTEND(SP, 1); XPUSHs(PL_encoding); PUTBACK; call_method("name", G_SCALAR); @@ -7572,8 +7756,8 @@ Perl_yylex(pTHX) } goto just_a_word; - case KEY_CORE: - if (*s == ':' && s[1] == ':') { + case_KEY_CORE: + { STRLEN olen = len; d = s; s += 2; @@ -7587,9 +7771,8 @@ Perl_yylex(pTHX) goto just_a_word; } if (!tmp) - Perl_croak(aTHX_ "CORE::%"SVf" is not a keyword", - SVfARG(newSVpvn_flags(PL_tokenbuf, len, - (UTF ? SVf_UTF8 : 0) | SVs_TEMP))); + Perl_croak(aTHX_ "CORE::%"UTF8f" is not a keyword", + UTF8fARG(UTF, len, PL_tokenbuf)); if (tmp < 0) tmp = -tmp; else if (tmp == KEY_require || tmp == KEY_do @@ -7598,7 +7781,6 @@ Perl_yylex(pTHX) orig_keyword = tmp; goto reserved_word; } - goto just_a_word; case KEY_abs: UNI(OP_ABS); @@ -7701,7 +7883,8 @@ Perl_yylex(pTHX) *PL_tokenbuf = '&'; d = scan_word(s, PL_tokenbuf + 1, sizeof PL_tokenbuf - 1, 1, &len); - if (len && !keyword(PL_tokenbuf + 1, len, 0)) { + if (len && (len != 4 || strNE(PL_tokenbuf+1, "CORE")) + && !keyword(PL_tokenbuf + 1, len, 0)) { d = SKIPSPACE1(d); if (*d == '(') { force_ident_maybe_lex('&'); @@ -7742,7 +7925,7 @@ Perl_yylex(pTHX) case KEY_dump: PL_expect = XOPERATOR; - s = force_word(s,WORD,TRUE,FALSE,FALSE); + s = force_word(s,WORD,TRUE,FALSE); LOOPX(OP_DUMP); case KEY_else: @@ -7829,9 +8012,9 @@ Perl_yylex(pTHX) strnEQ(p, "our", 3) && isSPACE(*(p + 3))) p += 3; p = PEEKSPACE(p); + /* skip optional package name, as in "for my abc $x (..)" */ if (isIDFIRST_lazy_if(p,UTF)) { - p = scan_ident(p, PL_bufend, - PL_tokenbuf, sizeof PL_tokenbuf, TRUE); + p = scan_word(p, PL_tokenbuf, sizeof PL_tokenbuf, TRUE, &len); p = PEEKSPACE(p); } if (*p != '$') @@ -7875,7 +8058,7 @@ Perl_yylex(pTHX) case KEY_goto: PL_expect = XOPERATOR; - s = force_word(s,WORD,TRUE,FALSE,FALSE); + s = force_word(s,WORD,TRUE,FALSE); LOOPX(OP_GOTO); case KEY_gmtime: @@ -7968,7 +8151,7 @@ Perl_yylex(pTHX) case KEY_glob: LOP( - orig_keyword==KEY_glob ? (orig_keyword=0, -OP_GLOB) : OP_GLOB, + orig_keyword==KEY_glob ? -OP_GLOB : OP_GLOB, XTERM ); @@ -8001,7 +8184,7 @@ Perl_yylex(pTHX) case KEY_last: PL_expect = XOPERATOR; - s = force_word(s,WORD,TRUE,FALSE,FALSE); + s = force_word(s,WORD,TRUE,FALSE); LOOPX(OP_LAST); case KEY_lc: @@ -8109,7 +8292,7 @@ Perl_yylex(pTHX) case KEY_next: PL_expect = XOPERATOR; - s = force_word(s,WORD,TRUE,FALSE,FALSE); + s = force_word(s,WORD,TRUE,FALSE); LOOPX(OP_NEXT); case KEY_ne: @@ -8145,11 +8328,9 @@ Perl_yylex(pTHX) && !(t[0] == ':' && t[1] == ':') && !keyword(s, d-s, 0) ) { - SV *tmpsv = newSVpvn_flags(s, (STRLEN)(d-s), - SVs_TEMP | (UTF ? SVf_UTF8 : 0)); Perl_warner(aTHX_ packWARN(WARN_PRECEDENCE), - "Precedence problem: open %"SVf" should be open(%"SVf")", - SVfARG(tmpsv), SVfARG(tmpsv)); + "Precedence problem: open %"UTF8f" should be open(%"UTF8f")", + UTF8fARG(UTF, d-s, s), UTF8fARG(UTF, d-s, s)); } } LOP(OP_OPEN,XTERM); @@ -8193,7 +8374,7 @@ Perl_yylex(pTHX) LOP(OP_PACK,XTERM); case KEY_package: - s = force_word(s,WORD,FALSE,TRUE,FALSE); + s = force_word(s,WORD,FALSE,TRUE); s = SKIPSPACE1(s); s = force_strict_version(s); PL_lex_expect = XBLOCK; @@ -8203,9 +8384,10 @@ Perl_yylex(pTHX) LOP(OP_PIPE_OP,XTERM); case KEY_q: - s = scan_str(s,!!PL_madskills,FALSE,FALSE, FALSE); + s = scan_str(s,!!PL_madskills,FALSE,FALSE,FALSE,NULL); if (!s) missingterm(NULL); + COPLINE_SET_FROM_MULTI_END; pl_yylval.ival = OP_CONST; TERM(sublex_start()); @@ -8214,9 +8396,10 @@ Perl_yylex(pTHX) case KEY_qw: { OP *words = NULL; - s = scan_str(s,!!PL_madskills,FALSE,FALSE, FALSE); + s = scan_str(s,!!PL_madskills,FALSE,FALSE,FALSE,NULL); if (!s) missingterm(NULL); + COPLINE_SET_FROM_MULTI_END; PL_expect = XOPERATOR; if (SvCUR(PL_lex_stuff)) { int warned_comma = !ckWARN(WARN_QW); @@ -8264,7 +8447,7 @@ Perl_yylex(pTHX) } case KEY_qq: - s = scan_str(s,!!PL_madskills,FALSE,FALSE, FALSE); + s = scan_str(s,!!PL_madskills,FALSE,FALSE,FALSE,NULL); if (!s) missingterm(NULL); pl_yylval.ival = OP_STRINGIFY; @@ -8277,10 +8460,10 @@ Perl_yylex(pTHX) TERM(sublex_start()); case KEY_qx: - s = scan_str(s,!!PL_madskills,FALSE,FALSE, FALSE); + s = scan_str(s,!!PL_madskills,FALSE,FALSE,FALSE,NULL); if (!s) missingterm(NULL); - readpipe_override(); + pl_yylval.ival = OP_BACKTICK; TERM(sublex_start()); case KEY_return: @@ -8296,7 +8479,7 @@ Perl_yylex(pTHX) || (s = force_version(s, TRUE), *s == 'v')) { *PL_tokenbuf = '\0'; - s = force_word(s,WORD,TRUE,TRUE,FALSE); + s = force_word(s,WORD,TRUE,TRUE); if (isIDFIRST_lazy_if(PL_tokenbuf,UTF)) gv_stashpvn(PL_tokenbuf, strlen(PL_tokenbuf), GV_ADD | (UTF ? SVf_UTF8 : 0)); @@ -8321,7 +8504,7 @@ Perl_yylex(pTHX) case KEY_redo: PL_expect = XOPERATOR; - s = force_word(s,WORD,TRUE,FALSE,FALSE); + s = force_word(s,WORD,TRUE,FALSE); LOOPX(OP_REDO); case KEY_rename: @@ -8462,7 +8645,7 @@ Perl_yylex(pTHX) checkcomma(s,PL_tokenbuf,"subroutine name"); s = SKIPSPACE1(s); PL_expect = XTERM; - s = force_word(s,WORD,TRUE,TRUE,FALSE); + s = force_word(s,WORD,TRUE,TRUE); LOP(OP_SORT,XREF); case KEY_split: @@ -8494,10 +8677,12 @@ Perl_yylex(pTHX) really_sub: { char * const tmpbuf = PL_tokenbuf + 1; - SSize_t tboffset = 0; expectation attrful; bool have_name, have_proto; const int key = tmp; +#ifndef PERL_MAD + SV *format_name = NULL; +#endif #ifdef PERL_MAD SV *tmpwhite = 0; @@ -8524,13 +8709,14 @@ Perl_yylex(pTHX) PL_expect = XBLOCK; attrful = XATTRBLOCK; - /* remember buffer pos'n for later force_word */ - tboffset = s - PL_oldbufptr; d = scan_word(s, tmpbuf, sizeof PL_tokenbuf - 1, TRUE, &len); #ifdef PERL_MAD if (PL_madskills) nametoke = newSVpvn_flags(s, d - s, SvUTF8(PL_linestr)); +#else + if (key == KEY_format) + format_name = S_newSV_maybe_utf8(aTHX_ s, d - s); #endif *PL_tokenbuf = '&'; if (memchr(tmpbuf, ':', len) || key != KEY_sub @@ -8577,89 +8763,25 @@ Perl_yylex(pTHX) #ifdef PERL_MAD PL_thistoken = subtoken; s = d; - PERL_UNUSED_VAR(tboffset); #else - if (have_name) - (void) force_word(PL_oldbufptr + tboffset, WORD, - FALSE, TRUE, TRUE); + if (format_name) { + start_force(PL_curforce); + NEXTVAL_NEXTTOKE.opval + = (OP*)newSVOP(OP_CONST,0, format_name); + NEXTVAL_NEXTTOKE.opval->op_private |= OPpCONST_BARE; + force_next(WORD); + } #endif PREBLOCK(FORMAT); } /* Look for a prototype */ - if (*s == '(') { - char *p; - bool bad_proto = FALSE; - bool in_brackets = FALSE; - char greedy_proto = ' '; - bool proto_after_greedy_proto = FALSE; - bool must_be_last = FALSE; - bool underscore = FALSE; - bool seen_underscore = FALSE; - const bool warnillegalproto = ckWARN(WARN_ILLEGALPROTO); - STRLEN tmplen; - - s = scan_str(s,!!PL_madskills,FALSE,FALSE, FALSE); + if (*s == '(' && !FEATURE_SIGNATURES_IS_ENABLED) { + s = scan_str(s,!!PL_madskills,FALSE,FALSE,FALSE,NULL); + COPLINE_SET_FROM_MULTI_END; if (!s) Perl_croak(aTHX_ "Prototype not terminated"); - /* strip spaces and check for bad characters */ - d = SvPV(PL_lex_stuff, tmplen); - tmp = 0; - for (p = d; tmplen; tmplen--, ++p) { - if (!isSPACE(*p)) { - d[tmp++] = *p; - - if (warnillegalproto) { - if (must_be_last) - proto_after_greedy_proto = TRUE; - if (!strchr("$@%*;[]&\\_+", *p) || *p == '\0') { - bad_proto = TRUE; - } - else { - if ( underscore ) { - if ( !strchr(";@%", *p) ) - bad_proto = TRUE; - underscore = FALSE; - } - if ( *p == '[' ) { - in_brackets = TRUE; - } - else if ( *p == ']' ) { - in_brackets = FALSE; - } - else if ( (*p == '@' || *p == '%') && - ( tmp < 2 || d[tmp-2] != '\\' ) && - !in_brackets ) { - must_be_last = TRUE; - greedy_proto = *p; - } - else if ( *p == '_' ) { - underscore = seen_underscore = TRUE; - } - } - } - } - } - d[tmp] = '\0'; - if (proto_after_greedy_proto) - Perl_warner(aTHX_ packWARN(WARN_ILLEGALPROTO), - "Prototype after '%c' for %"SVf" : %s", - greedy_proto, SVfARG(PL_subname), d); - if (bad_proto) { - SV *dsv = newSVpvs_flags("", SVs_TEMP); - Perl_warner(aTHX_ packWARN(WARN_ILLEGALPROTO), - "Illegal character %sin prototype for %"SVf" : %s", - seen_underscore ? "after '_' " : "", - SVfARG(PL_subname), - SvUTF8(PL_lex_stuff) - ? sv_uni_display(dsv, - newSVpvn_flags(d, tmp, SVs_TEMP | SVf_UTF8), - tmp, - UNI_DISPLAY_ISPRINT) - : pv_pretty(dsv, d, tmp, 60, NULL, NULL, - PERL_PV_ESCAPE_NONASCII)); - } - SvCUR_set(PL_lex_stuff, tmp); + (void)validate_proto(PL_subname, PL_lex_stuff, ckWARN(WARN_ILLEGALPROTO)); have_proto = TRUE; #ifdef PERL_MAD @@ -8683,7 +8805,7 @@ Perl_yylex(pTHX) if (*s == ':' && s[1] != ':') PL_expect = attrful; - else if (*s != '{' && key == KEY_sub) { + else if ((*s != '{' && *s != '(') && key == KEY_sub) { if (!have_name) Perl_croak(aTHX_ "Illegal declaration of anonymous subroutine"); else if (*s != ';' && *s != '}') @@ -8847,17 +8969,9 @@ Perl_yylex(pTHX) FUN0(OP_WANTARRAY); case KEY_write: -#ifdef EBCDIC - { - char ctl_l[2]; - ctl_l[0] = toCTRL('L'); - ctl_l[1] = '\0'; - gv_fetchpvn_flags(ctl_l, 1, GV_ADD|GV_NOTQUAL, SVt_PV); - } -#else - /* Make sure $^L is defined */ - gv_fetchpvs("\f", GV_ADD|GV_NOTQUAL, SVt_PV); -#endif + /* Make sure $^L is defined. 0x0C is CTRL-L on ASCII platforms, and + * we use the same number on EBCDIC */ + gv_fetchpvs("\x0C", GV_ADD|GV_NOTQUAL, SVt_PV); UNI(OP_ENTERWRITE); case KEY_x: @@ -8878,9 +8992,6 @@ Perl_yylex(pTHX) } }} } -#ifdef __SC__ -#pragma segment Main -#endif /* S_pending_ident @@ -8930,10 +9041,14 @@ S_pending_ident(pTHX) tmp = allocmy(PL_tokenbuf, tokenbuf_len, UTF ? SVf_UTF8 : 0); } else { - if (has_colon) + if (has_colon) { + /* PL_no_myglob is constant */ + GCC_DIAG_IGNORE(-Wformat-nonliteral); yyerror_pv(Perl_form(aTHX_ PL_no_myglob, PL_in_my == KEY_my ? "my" : "state", PL_tokenbuf), UTF ? SVf_UTF8 : 0); + GCC_DIAG_RESTORE; + } pl_yylval.opval = newOP(OP_PADANY, 0); pl_yylval.opval->op_targ = allocmy(PL_tokenbuf, tokenbuf_len, @@ -8996,9 +9111,9 @@ S_pending_ident(pTHX) { /* Downgraded from fatal to warning 20000522 mjd */ Perl_warner(aTHX_ packWARN(WARN_AMBIGUOUS), - "Possible unintended interpolation of %"SVf" in string", - SVfARG(newSVpvn_flags(PL_tokenbuf, tokenbuf_len, - SVs_TEMP | ( UTF ? SVf_UTF8 : 0 )))); + "Possible unintended interpolation of %"UTF8f + " in string", + UTF8fARG(UTF, tokenbuf_len, PL_tokenbuf)); } } @@ -9125,7 +9240,7 @@ S_new_constant(pTHX_ const char *s, STRL newSVpvs(":full"), newSVpvs(":short"), NULL); - SPAGAIN; + assert(sp == PL_stack_sp); table = GvHV(PL_hintgv); if (table && (PL_hints & HINT_LOCALIZE_HH) @@ -9286,14 +9401,16 @@ S_scan_word(pTHX_ char *s, char *dest, S } STATIC char * -S_scan_ident(pTHX_ char *s, const char *send, char *dest, STRLEN destlen, I32 ck_uni) +S_scan_ident(pTHX_ char *s, char *dest, STRLEN destlen, I32 ck_uni) { dVAR; - char *bracket = NULL; + I32 herelines = PL_parser->herelines; + SSize_t bracket = -1; char funny = *s++; char *d = dest; char * const e = d + destlen - 3; /* two-character token, ending NUL */ bool is_utf8 = cBOOL(UTF); + I32 orig_copline = 0, tmp_copline = 0; PERL_ARGS_ASSERT_SCAN_IDENT; @@ -9312,6 +9429,8 @@ S_scan_ident(pTHX_ char *s, const char * *d = '\0'; d = dest; if (*d) { + /* Either a digit variable, or parse_ident() found an identifier + (anything valid as a bareword), so job done and return. */ if (PL_lex_state != LEX_NORMAL) PL_lex_state = LEX_INTERPENDMAYBE; return s; @@ -9323,22 +9442,44 @@ S_scan_ident(pTHX_ char *s, const char * || s[1] == '{' || strnEQ(s+1,"::",2)) ) { + /* Dereferencing a value in a scalar variable. + The alternatives are different syntaxes for a scalar variable. + Using ' as a leading package separator isn't allowed. :: is. */ return s; } + /* Handle the opening { of @{...}, &{...}, *{...}, %{...}, ${...} */ if (*s == '{') { - bracket = s; + bracket = s - SvPVX(PL_linestr); s++; - while (s < send && SPACE_OR_TAB(*s)) - s++; + orig_copline = CopLINE(PL_curcop); + if (s < PL_bufend && isSPACE(*s)) { + s = PEEKSPACE(s); + } } -#define VALID_LEN_ONE_IDENT(d, u) (isPUNCT_A((U8)*(d)) \ - || isCNTRL_A((U8)*(d)) \ - || isDIGIT_A((U8)*(d)) \ - || (!(u) && !UTF8_IS_INVARIANT((U8)*(d)))) - if (s < send - && (isIDFIRST_lazy_if(s, is_utf8) || VALID_LEN_ONE_IDENT(s, is_utf8))) +/* Is the byte 'd' a legal single character identifier name? 'u' is true + * iff Unicode semantics are to be used. The legal ones are any of: + * a) ASCII digits + * b) ASCII punctuation + * c) When not under Unicode rules, any upper Latin1 character + * d) \c?, \c\, \c^, \c_, and \cA..\cZ, minus the ones that have traditionally + * been matched by \s on ASCII platforms. That is: \c?, plus 1-32, minus + * the \s ones. */ +#define VALID_LEN_ONE_IDENT(d, u) (isPUNCT_A((U8)(d)) \ + || isDIGIT_A((U8)(d)) \ + || (!(u) && !isASCII((U8)(d))) \ + || ((((U8)(d)) < 32) \ + && (((((U8)(d)) >= 14) \ + || (((U8)(d)) <= 8 && (d) != 0) \ + || (((U8)(d)) == 13)))) \ + || (((U8)(d)) == toCTRL('?'))) + if (s < PL_bufend + && (isIDFIRST_lazy_if(s, is_utf8) || VALID_LEN_ONE_IDENT(*s, is_utf8))) { + if ( isCNTRL_A((U8)*s) ) { + deprecate("literal control characters in variable names"); + } + if (is_utf8) { const STRLEN skip = UTF8SKIP(s); STRLEN i; @@ -9351,28 +9492,42 @@ S_scan_ident(pTHX_ char *s, const char * d[1] = '\0'; } } + /* Convert $^F, ${^F} and the ^F of ${^FOO} to control characters */ if (*d == '^' && *s && isCONTROLVAR(*s)) { *d = toCTRL(*s); s++; } - else if (ck_uni && !bracket) + /* Warn about ambiguous code after unary operators if {...} notation isn't + used. There's no difference in ambiguity; it's merely a heuristic + about when not to warn. */ + else if (ck_uni && bracket == -1) check_uni(); - if (bracket) { + if (bracket != -1) { + /* If we were processing {...} notation then... */ if (isIDFIRST_lazy_if(d,is_utf8)) { + /* if it starts as a valid identifier, assume that it is one. + (the later check for } being at the expected point will trap + cases where this doesn't pan out.) */ d += is_utf8 ? UTF8SKIP(d) : 1; parse_ident(&s, &d, e, 1, is_utf8); *d = '\0'; - while (s < send && SPACE_OR_TAB(*s)) - s++; + tmp_copline = CopLINE(PL_curcop); + if (s < PL_bufend && isSPACE(*s)) { + s = PEEKSPACE(s); + } if ((*s == '[' || (*s == '{' && strNE(dest, "sub")))) { + /* ${foo[0]} and ${foo{bar}} notation. */ if (ckWARN(WARN_AMBIGUOUS) && keyword(dest, d - dest, 0)) { const char * const brack = (const char *) ((*s == '[') ? "[...]" : "{...}"); + orig_copline = CopLINE(PL_curcop); + CopLINE_set(PL_curcop, tmp_copline); /* diag_listed_as: Ambiguous use of %c{%s[...]} resolved to %c%s[...] */ Perl_warner(aTHX_ packWARN(WARN_AMBIGUOUS), "Ambiguous use of %c{%s%s} resolved to %c%s%s", funny, dest, brack, funny, dest, brack); + CopLINE_set(PL_curcop, orig_copline); } bracket++; PL_lex_brackstack[PL_lex_brackets++] = (char)(XOPERATOR | XFAKEBRACK); @@ -9382,7 +9537,7 @@ S_scan_ident(pTHX_ char *s, const char * } /* Handle extended ${^Foo} variables * 1999-02-27 mjd-perl-patch@plover.com */ - else if (!isWORDCHAR(*d) && !isPRINT(*d) /* isCTRL(d) */ + else if (! isPRINT(*d) /* isCNTRL(d), plus all non-ASCII */ && isWORDCHAR(*s)) { d++; @@ -9394,9 +9549,14 @@ S_scan_ident(pTHX_ char *s, const char * *d = '\0'; } - while (s < send && SPACE_OR_TAB(*s)) - s++; - + if ( !tmp_copline ) + tmp_copline = CopLINE(PL_curcop); + if (s < PL_bufend && isSPACE(*s)) { + s = PEEKSPACE(s); + } + + /* Expect to find a closing } after consuming any trailing whitespace. + */ if (*s == '}') { s++; if (PL_lex_state == LEX_INTERPNORMAL && !PL_lex_brackets) { @@ -9412,14 +9572,21 @@ S_scan_ident(pTHX_ char *s, const char * SVs_TEMP | (is_utf8 ? SVf_UTF8 : 0) ); if (funny == '#') funny = '@'; + orig_copline = CopLINE(PL_curcop); + CopLINE_set(PL_curcop, tmp_copline); Perl_warner(aTHX_ packWARN(WARN_AMBIGUOUS), "Ambiguous use of %c{%"SVf"} resolved to %c%"SVf, funny, tmp, funny, tmp); + CopLINE_set(PL_curcop, orig_copline); } } } else { - s = bracket; /* let the parser handle it */ + /* Didn't find the closing } at the point we expected, so restore + state such that the next thing to process is the opening { and */ + s = SvPVX(PL_linestr) + bracket; /* let the parser handle it */ + CopLINE_set(PL_curcop, orig_copline); + PL_parser->herelines = herelines; *dest = '\0'; } } @@ -9513,6 +9680,7 @@ S_pmflag(pTHX_ const char* const valid_f yyerror(Perl_form(aTHX_ "Regexp modifiers \"/%c\" and \"/%c\" are mutually exclusive", *charset, c)); } else if (c == 'a') { + /* diag_listed_as: Regexp modifier "/%c" may appear a maximum of twice */ yyerror("Regexp modifier \"/a\" may appear a maximum of twice"); } else { @@ -9540,7 +9708,7 @@ S_scan_pat(pTHX_ char *start, I32 type) PERL_ARGS_ASSERT_SCAN_PAT; s = scan_str(start,!!PL_madskills,FALSE, (PL_in_eval & EVAL_RE_REPARSING), - TRUE /* look for escaped bracketed metas */ ); + TRUE /* look for escaped bracketed metas */, NULL); if (!s) { const char * const delimiter = skipspace(start); @@ -9622,24 +9790,25 @@ S_scan_subst(pTHX_ char *start) char *s; PMOP *pm; I32 first_start; + line_t first_line; I32 es = 0; char charset = '\0'; /* character set modifier */ #ifdef PERL_MAD char *modstart; #endif + char *t; PERL_ARGS_ASSERT_SCAN_SUBST; pl_yylval.ival = OP_NULL; s = scan_str(start,!!PL_madskills,FALSE,FALSE, - TRUE /* look for escaped bracketed metas */ ); + TRUE /* look for escaped bracketed metas */, &t); if (!s) Perl_croak(aTHX_ "Substitution pattern not terminated"); - if (s[-1] == PL_multi_open) - s--; + s = t; #ifdef PERL_MAD if (PL_madskills) { CURMAD('q', PL_thisopen); @@ -9651,7 +9820,8 @@ S_scan_subst(pTHX_ char *start) #endif first_start = PL_multi_start; - s = scan_str(s,!!PL_madskills,FALSE,FALSE, FALSE); + first_line = CopLINE(PL_curcop); + s = scan_str(s,!!PL_madskills,FALSE,FALSE,FALSE,NULL); if (!s) { if (PL_lex_stuff) { SvREFCNT_dec(PL_lex_stuff); @@ -9713,6 +9883,12 @@ S_scan_subst(pTHX_ char *start) SvREFCNT_dec(PL_sublex_info.repl); PL_sublex_info.repl = repl; } + if (CopLINE(PL_curcop) != first_line) { + sv_upgrade(PL_sublex_info.repl, SVt_PVNV); + ((XPVNV*)SvANY(PL_sublex_info.repl))->xnv_u.xpad_cop_seq.xlow = + CopLINE(PL_curcop) - first_line; + CopLINE_set(PL_curcop, first_line); + } PL_lex_op = (OP*)pm; pl_yylval.ival = OP_SUBST; @@ -9732,17 +9908,17 @@ S_scan_trans(pTHX_ char *start) #ifdef PERL_MAD char *modstart; #endif + char *t; PERL_ARGS_ASSERT_SCAN_TRANS; pl_yylval.ival = OP_NULL; - s = scan_str(start,!!PL_madskills,FALSE,FALSE, FALSE); + s = scan_str(start,!!PL_madskills,FALSE,FALSE,FALSE,&t); if (!s) Perl_croak(aTHX_ "Transliteration pattern not terminated"); - if (s[-1] == PL_multi_open) - s--; + s = t; #ifdef PERL_MAD if (PL_madskills) { CURMAD('q', PL_thisopen); @@ -9753,7 +9929,7 @@ S_scan_trans(pTHX_ char *start) } #endif - s = scan_str(s,!!PL_madskills,FALSE,FALSE, FALSE); + s = scan_str(s,!!PL_madskills,FALSE,FALSE,FALSE,NULL); if (!s) { if (PL_lex_stuff) { SvREFCNT_dec(PL_lex_stuff); @@ -9849,6 +10025,7 @@ S_scan_heredoc(pTHX_ char *s) char *e; char *peek; const bool infile = PL_rsfp || PL_parser->filtered; + const line_t origline = CopLINE(PL_curcop); LEXSHARED *shared = PL_parser->lex_shared; #ifdef PERL_MAD I32 stuffstart = s - SvPVX(PL_linestr); @@ -9950,7 +10127,7 @@ S_scan_heredoc(pTHX_ char *s) SvIV_set(tmpstr, '\\'); } - PL_multi_start = CopLINE(PL_curcop) + 1; + PL_multi_start = origline + 1 + PL_parser->herelines; PL_multi_open = PL_multi_close = '<'; /* inside a string eval or quote-like operator */ if (!infile || PL_lex_inwhat) { @@ -9976,7 +10153,7 @@ S_scan_heredoc(pTHX_ char *s) /* shared is only null if we have gone beyond the outermost lexing scope. In a file, we will have broken out of the loop in the previous iteration. In an eval, the string buf- - fer ends with "\n;", so the while condition below will have + fer ends with "\n;", so the while condition above will have evaluated to false. So shared can never be null. */ assert(shared); /* A LEXSHARED struct with a null ls_prev pointer is the outer- @@ -9997,7 +10174,7 @@ S_scan_heredoc(pTHX_ char *s) while (s < bufend - len + 1 && memNE(s,PL_tokenbuf,len) ) { if (*s++ == '\n') - ++shared->herelines; + ++PL_parser->herelines; } if (s >= bufend - len + 1) { goto interminable; @@ -10014,7 +10191,7 @@ S_scan_heredoc(pTHX_ char *s) #endif s += len - 1; /* the preceding stmt passes a newline */ - shared->herelines++; + PL_parser->herelines++; /* s now points to the newline after the heredoc terminator. d points to the newline before the body of the heredoc. @@ -10072,22 +10249,25 @@ S_scan_heredoc(pTHX_ char *s) #endif PL_bufptr = PL_bufend; CopLINE_set(PL_curcop, - PL_multi_start + shared->herelines); + origline + 1 + PL_parser->herelines); if (!lex_next_chunk(LEX_NO_TERM) && (!SvCUR(tmpstr) || SvEND(tmpstr)[-1] != '\n')) { SvREFCNT_dec(linestr_save); goto interminable; } - CopLINE_set(PL_curcop, (line_t)PL_multi_start - 1); + CopLINE_set(PL_curcop, origline); if (!SvCUR(PL_linestr) || PL_bufend[-1] != '\n') { - lex_grow_linestr(SvCUR(PL_linestr) + 2); + s = lex_grow_linestr(SvLEN(PL_linestr) + 3); + /* ^That should be enough to avoid this needing to grow: */ sv_catpvs(PL_linestr, "\n\0"); + assert(s == SvPVX(PL_linestr)); + PL_bufend = SvEND(PL_linestr); } s = PL_bufptr; #ifdef PERL_MAD stuffstart = s - SvPVX(PL_linestr); #endif - shared->herelines++; + PL_parser->herelines++; PL_last_lop = PL_last_uni = NULL; #ifndef PERL_STRICT_CR if (PL_bufend - PL_linestart >= 2) { @@ -10117,7 +10297,7 @@ S_scan_heredoc(pTHX_ char *s) } } } - PL_multi_end = CopLINE(PL_curcop); + PL_multi_end = origline + PL_parser->herelines; if (SvCUR(tmpstr) + 5 < SvLEN(tmpstr)) { SvPV_shrink_to_cur(tmpstr); } @@ -10133,7 +10313,7 @@ S_scan_heredoc(pTHX_ char *s) interminable: SvREFCNT_dec(tmpstr); - CopLINE_set(PL_curcop, (line_t)PL_multi_start - 1); + CopLINE_set(PL_curcop, origline); missingterm(PL_tokenbuf + 1); } @@ -10202,7 +10382,7 @@ S_scan_inputsymbol(pTHX_ char *start) if (d - PL_tokenbuf != len) { pl_yylval.ival = OP_GLOB; - s = scan_str(start,!!PL_madskills,FALSE,FALSE, FALSE); + s = scan_str(start,!!PL_madskills,FALSE,FALSE,FALSE,NULL); if (!s) Perl_croak(aTHX_ "Glob not terminated"); return s; @@ -10210,7 +10390,6 @@ S_scan_inputsymbol(pTHX_ char *start) else { bool readline_overriden = FALSE; GV *gv_readline; - GV **gvp; /* we're in a filehandle read situation */ d = PL_tokenbuf; @@ -10220,12 +10399,7 @@ S_scan_inputsymbol(pTHX_ char *start) /* Check whether readline() is overriden */ gv_readline = gv_fetchpvs("readline", GV_NOTQUAL, SVt_PVCV); - if ((gv_readline - && GvCVu(gv_readline) && GvIMPORTED_CV(gv_readline)) - || - ((gvp = (GV**)hv_fetchs(PL_globalstash, "readline", FALSE)) - && (gv_readline = *gvp) && isGV_with_GP(gv_readline) - && GvCVu(gv_readline) && GvIMPORTED_CV(gv_readline))) + if ((gv_readline = gv_override("readline",8))) readline_overriden = TRUE; /* if <$fh>, create the ops to turn the variable into a @@ -10299,11 +10473,20 @@ intro_sym: /* scan_str - takes: start position in buffer - keep_quoted preserve \ on the embedded delimiter(s) - keep_delims preserve the delimiters around the string - re_reparse compiling a run-time /(?{})/: - collapse // to /, and skip encoding src + takes: + start position in buffer + keep_quoted preserve \ on the embedded delimiter(s) + keep_delims preserve the delimiters around the string + re_reparse compiling a run-time /(?{})/: + collapse // to /, and skip encoding src + deprecate_escaped_meta issue a deprecation warning for cer- + tain paired metacharacters that appear + escaped within it + delimp if non-null, this is set to the position of + the closing delimiter, or just after it if + the closing and opening delimiters differ + (i.e., the opening delimiter of a substitu- + tion replacement) returns: position to continue reading from buffer side-effects: multi_start, multi_close, lex_repl or lex_stuff, and updates the read buffer. @@ -10345,9 +10528,7 @@ intro_sym: STATIC char * S_scan_str(pTHX_ char *start, int keep_quoted, int keep_delims, int re_reparse, - bool deprecate_escaped_meta /* Should we issue a deprecation warning - for certain paired metacharacters that - appear escaped within it */ + bool deprecate_escaped_meta, char **delimp ) { dVAR; @@ -10363,6 +10544,7 @@ S_scan_str(pTHX_ char *start, int keep_q STRLEN termlen; /* length of terminating string */ int last_off = 0; /* last position for nesting bracket */ char *escaped_open = NULL; + line_t herelines; #ifdef PERL_MAD int stuffstart; char *tstart; @@ -10402,6 +10584,7 @@ S_scan_str(pTHX_ char *start, int keep_q /* mark where we are */ PL_multi_start = CopLINE(PL_curcop); PL_multi_open = term; + herelines = PL_parser->herelines; /* find corresponding closing delimiter */ if (term && (tmps = strchr("([{< )]}> )]}>",term))) @@ -10415,8 +10598,8 @@ S_scan_str(pTHX_ char *start, int keep_q * happen for <>, as they aren't metas. */ if (deprecate_escaped_meta && (PL_multi_open == PL_multi_close - || ! ckWARN_d(WARN_DEPRECATED) - || PL_multi_open == '<')) + || PL_multi_open == '<' + || ! ckWARN_d(WARN_DEPRECATED))) { deprecate_escaped_meta = FALSE; } @@ -10447,8 +10630,49 @@ S_scan_str(pTHX_ char *start, int keep_q int offset = s - SvPVX_const(PL_linestr); const bool found = sv_cat_decode(sv, PL_encoding, PL_linestr, &offset, (char*)termstr, termlen); - const char * const ns = SvPVX_const(PL_linestr) + offset; - char * const svlast = SvEND(sv) - 1; + const char *ns; + char *svlast; + + if (SvIsCOW(PL_linestr)) { + STRLEN bufend_pos, bufptr_pos, oldbufptr_pos; + STRLEN oldoldbufptr_pos, linestart_pos, last_uni_pos; + STRLEN last_lop_pos, re_eval_start_pos, s_pos; + char *buf = SvPVX(PL_linestr); + bufend_pos = PL_parser->bufend - buf; + bufptr_pos = PL_parser->bufptr - buf; + oldbufptr_pos = PL_parser->oldbufptr - buf; + oldoldbufptr_pos = PL_parser->oldoldbufptr - buf; + linestart_pos = PL_parser->linestart - buf; + last_uni_pos = PL_parser->last_uni + ? PL_parser->last_uni - buf + : 0; + last_lop_pos = PL_parser->last_lop + ? PL_parser->last_lop - buf + : 0; + re_eval_start_pos = + PL_parser->lex_shared->re_eval_start ? + PL_parser->lex_shared->re_eval_start - buf : 0; + s_pos = s - buf; + + sv_force_normal(PL_linestr); + + buf = SvPVX(PL_linestr); + PL_parser->bufend = buf + bufend_pos; + PL_parser->bufptr = buf + bufptr_pos; + PL_parser->oldbufptr = buf + oldbufptr_pos; + PL_parser->oldoldbufptr = buf + oldoldbufptr_pos; + PL_parser->linestart = buf + linestart_pos; + if (PL_parser->last_uni) + PL_parser->last_uni = buf + last_uni_pos; + if (PL_parser->last_lop) + PL_parser->last_lop = buf + last_lop_pos; + if (PL_parser->lex_shared->re_eval_start) + PL_parser->lex_shared->re_eval_start = + buf + re_eval_start_pos; + s = buf + s_pos; + } + ns = SvPVX_const(PL_linestr) + offset; + svlast = SvEND(sv) - 1; for (; s < ns; s++) { if (*s == '\n' && !PL_rsfp && !PL_parser->filtered) @@ -10569,26 +10793,39 @@ S_scan_str(pTHX_ char *start, int keep_q * context where the delimiter is also a metacharacter, * the backslash is useless, and deprecated. () and [] * are meta in any context. {} are meta only when - * appearing in a quantifier or in things like '\p{'. - * They also aren't meta unless there is a matching - * closed, escaped char later on within the string. - * If 's' points to an open, set a flag; if to a close, - * test that flag, and raise a warning if it was set */ + * appearing in a quantifier or in things like '\p{' + * (but '\\p{' isn't meta). They also aren't meta + * unless there is a matching closed, escaped char + * later on within the string. If 's' points to an + * open, set a flag; if to a close, test that flag, and + * raise a warning if it was set */ if (deprecate_escaped_meta) { if (*s == PL_multi_open) { if (*s != '{') { escaped_open = s; } - else if (regcurly(s, - TRUE /* Look for a closing - '\}' */) - || (s - start > 2 /* Look for e.g. - '\x{' */ - && _generic_isCC(*(s-2), _CC_BACKSLASH_FOO_LBRACE_IS_META))) - { + /* Look for a closing '\}' */ + else if (regcurly(s, TRUE)) { escaped_open = s; } + /* Look for e.g. '\x{' */ + else if (s - start > 2 + && _generic_isCC(*(s-2), + _CC_BACKSLASH_FOO_LBRACE_IS_META)) + { /* Exclude '\\x', '\\\\x', etc. */ + char *lookbehind = s - 4; + bool is_meta = TRUE; + while (lookbehind >= start + && *lookbehind == '\\') + { + is_meta = ! is_meta; + lookbehind--; + } + if (is_meta) { + escaped_open = s; + } + } } else if (escaped_open) { Perl_warner(aTHX_ packWARN(WARN_DEPRECATED), @@ -10701,6 +10938,8 @@ S_scan_str(pTHX_ char *start, int keep_q SvUTF8_on(sv); PL_multi_end = CopLINE(PL_curcop); + CopLINE_set(PL_curcop, PL_multi_start); + PL_parser->herelines = herelines; /* if we allocated too much space, give some back */ if (SvCUR(sv) + 5 < SvLEN(sv)) { @@ -10716,6 +10955,7 @@ S_scan_str(pTHX_ char *start, int keep_q PL_sublex_info.repl = sv; else PL_lex_stuff = sv; + if (delimp) *delimp = PL_multi_open == PL_multi_close ? s-termlen : s; return s; } @@ -11081,9 +11321,11 @@ Perl_scan_num(pTHX_ const char *start, Y floatit = TRUE; } if (floatit) { + STORE_NUMERIC_LOCAL_SET_STANDARD(); /* terminate the string */ *d = '\0'; nv = Atof(PL_tokenbuf); + RESTORE_NUMERIC_LOCAL(); sv = newSVnv(nv); } @@ -11211,6 +11453,16 @@ S_scan_formline(pTHX_ char *s) if (SvCUR(stuff)) { PL_expect = XSTATE; if (needargs) { + const char *s2 = s; + while (*s2 == '\r' || *s2 == ' ' || *s2 == '\t' || *s2 == '\f' + || *s2 == 013) + s2++; + if (*s2 == '{') { + start_force(PL_curforce); + PL_expect = XTERMBLOCK; + NEXTVAL_NEXTTOKE.ival = 0; + force_next(DO); + } start_force(PL_curforce); NEXTVAL_NEXTTOKE.ival = 0; force_next(FORMLBRACK); @@ -11267,9 +11519,6 @@ Perl_start_subparse(pTHX_ I32 is_format, return oldsavestack_ix; } -#ifdef __SC__ -#pragma segment Perl_yylex -#endif static int S_yywarn(pTHX_ const char *const s, U32 flags) { @@ -11368,11 +11617,13 @@ Perl_yyerror_pvn(pTHX_ const char *const } msg = newSVpvn_flags(s, len, (flags & SVf_UTF8) | SVs_TEMP); Perl_sv_catpvf(aTHX_ msg, " at %s line %"IVdf", ", - OutCopFILE(PL_curcop), (IV)CopLINE(PL_curcop)); + OutCopFILE(PL_curcop), + (IV)(PL_parser->preambling == NOLINE + ? CopLINE(PL_curcop) + : PL_parser->preambling)); if (context) - Perl_sv_catpvf(aTHX_ msg, "near \"%"SVf"\"\n", - SVfARG(newSVpvn_flags(context, contlen, - SVs_TEMP | (UTF ? SVf_UTF8 : 0)))); + Perl_sv_catpvf(aTHX_ msg, "near \"%"UTF8f"\"\n", + UTF8fARG(UTF, contlen, context)); else Perl_sv_catpvf(aTHX_ msg, "%"SVf"\n", SVfARG(where_sv)); if (PL_multi_start < PL_multi_end && (U32)(CopLINE(PL_curcop) - PL_multi_end) <= 1) { @@ -11399,9 +11650,6 @@ Perl_yyerror_pvn(pTHX_ const char *const PL_in_my_stash = NULL; return 0; } -#ifdef __SC__ -#pragma segment Main -#endif STATIC char* S_swallow_bom(pTHX_ U8 *s) @@ -11444,12 +11692,14 @@ S_swallow_bom(pTHX_ U8 *s) #endif } break; - case 0xEF: - if (slen > 2 && s[1] == 0xBB && s[2] == 0xBF) { - if (DEBUG_p_TEST || DEBUG_T_TEST) PerlIO_printf(Perl_debug_log, "UTF-8 script encoding (BOM)\n"); - s += 3; /* UTF-8 */ - } - break; + case BOM_UTF8_FIRST_BYTE: { + const STRLEN len = sizeof(BOM_UTF8_TAIL) - 1; /* Exclude trailing NUL */ + if (slen > len && memEQ(s+1, BOM_UTF8_TAIL, len)) { + if (DEBUG_p_TEST || DEBUG_T_TEST) PerlIO_printf(Perl_debug_log, "UTF-8 script encoding (BOM)\n"); + s += len + 1; /* UTF-8 */ + } + break; + } case 0: if (slen > 3) { if (s[1] == 0) { @@ -11472,14 +11722,6 @@ S_swallow_bom(pTHX_ U8 *s) #endif } } -#ifdef EBCDIC - case 0xDD: - if (slen > 3 && s[1] == 0x73 && s[2] == 0x66 && s[3] == 0x73) { - if (DEBUG_p_TEST || DEBUG_T_TEST) PerlIO_printf(Perl_debug_log, "UTF-8 script encoding (BOM)\n"); - s += 4; /* UTF-8 */ - } - break; -#endif default: if (slen > 3 && s[1] == 0 && s[2] != 0 && s[3] == 0) { @@ -11724,7 +11966,7 @@ Perl_scan_vstring(pTHX_ const char *s, c /* Append native character for the rev point */ tmpend = uvchr_to_utf8(tmpbuf, rev); sv_catpvn(sv, (const char*)tmpbuf, tmpend - tmpbuf); - if (!UNI_IS_INVARIANT(NATIVE_TO_UNI(rev))) + if (!UVCHR_IS_INVARIANT(rev)) SvUTF8_on(sv); if (pos + 1 < e && *pos == '.' && isDIGIT(pos[1])) s = ++pos; @@ -12149,6 +12391,206 @@ Perl_parse_stmtseq(pTHX_ U32 flags) if (c != -1 && c != /*{*/'}') qerror(Perl_mess(aTHX_ "Parse error")); return stmtseqop; +} + +#define lex_token_boundary() S_lex_token_boundary(aTHX) +static void +S_lex_token_boundary(pTHX) +{ + PL_oldoldbufptr = PL_oldbufptr; + PL_oldbufptr = PL_bufptr; +} + +#define parse_opt_lexvar() S_parse_opt_lexvar(aTHX) +static OP * +S_parse_opt_lexvar(pTHX) +{ + I32 sigil, c; + char *s, *d; + OP *var; + lex_token_boundary(); + sigil = lex_read_unichar(0); + if (lex_peek_unichar(0) == '#') { + qerror(Perl_mess(aTHX_ "Parse error")); + return NULL; + } + lex_read_space(0); + c = lex_peek_unichar(0); + if (c == -1 || !(UTF ? isIDFIRST_uni(c) : isIDFIRST_A(c))) + return NULL; + s = PL_bufptr; + d = PL_tokenbuf + 1; + PL_tokenbuf[0] = (char)sigil; + parse_ident(&s, &d, PL_tokenbuf + sizeof(PL_tokenbuf) - 1, 0, cBOOL(UTF)); + PL_bufptr = s; + if (d == PL_tokenbuf+1) + return NULL; + *d = 0; + var = newOP(sigil == '$' ? OP_PADSV : sigil == '@' ? OP_PADAV : OP_PADHV, + OPf_MOD | (OPpLVAL_INTRO<<8)); + var->op_targ = allocmy(PL_tokenbuf, d - PL_tokenbuf, UTF ? SVf_UTF8 : 0); + return var; +} + +OP * +Perl_parse_subsignature(pTHX) +{ + I32 c; + int prev_type = 0, pos = 0, min_arity = 0, max_arity = 0; + OP *initops = NULL; + lex_read_space(0); + c = lex_peek_unichar(0); + while (c != /*(*/')') { + switch (c) { + case '$': { + OP *var, *expr; + if (prev_type == 2) + qerror(Perl_mess(aTHX_ "Slurpy parameter not last")); + var = parse_opt_lexvar(); + expr = var ? + newBINOP(OP_AELEM, 0, + ref(newUNOP(OP_RV2AV, 0, newGVOP(OP_GV, 0, PL_defgv)), + OP_RV2AV), + newSVOP(OP_CONST, 0, newSViv(pos))) : + NULL; + lex_read_space(0); + c = lex_peek_unichar(0); + if (c == '=') { + lex_token_boundary(); + lex_read_unichar(0); + lex_read_space(0); + c = lex_peek_unichar(0); + if (c == ',' || c == /*(*/')') { + if (var) + qerror(Perl_mess(aTHX_ "Optional parameter " + "lacks default expression")); + } else { + OP *defexpr = parse_termexpr(0); + if (defexpr->op_type == OP_UNDEF && + !(defexpr->op_flags & OPf_KIDS)) { + op_free(defexpr); + } else { + OP *ifop = + newBINOP(OP_GE, 0, + scalar(newUNOP(OP_RV2AV, 0, + newGVOP(OP_GV, 0, PL_defgv))), + newSVOP(OP_CONST, 0, newSViv(pos+1))); + expr = var ? + newCONDOP(0, ifop, expr, defexpr) : + newLOGOP(OP_OR, 0, ifop, defexpr); + } + } + prev_type = 1; + } else { + if (prev_type == 1) + qerror(Perl_mess(aTHX_ "Mandatory parameter " + "follows optional parameter")); + prev_type = 0; + min_arity = pos + 1; + } + if (var) expr = newASSIGNOP(OPf_STACKED, var, 0, expr); + if (expr) + initops = op_append_list(OP_LINESEQ, initops, + newSTATEOP(0, NULL, expr)); + max_arity = ++pos; + } break; + case '@': + case '%': { + OP *var; + if (prev_type == 2) + qerror(Perl_mess(aTHX_ "Slurpy parameter not last")); + var = parse_opt_lexvar(); + if (c == '%') { + OP *chkop = newLOGOP((pos & 1) ? OP_OR : OP_AND, 0, + newBINOP(OP_BIT_AND, 0, + scalar(newUNOP(OP_RV2AV, 0, + newGVOP(OP_GV, 0, PL_defgv))), + newSVOP(OP_CONST, 0, newSViv(1))), + newLISTOP(OP_DIE, 0, newOP(OP_PUSHMARK, 0), + newSVOP(OP_CONST, 0, + newSVpvs("Odd name/value argument " + "for subroutine")))); + if (pos != min_arity) + chkop = newLOGOP(OP_AND, 0, + newBINOP(OP_GT, 0, + scalar(newUNOP(OP_RV2AV, 0, + newGVOP(OP_GV, 0, PL_defgv))), + newSVOP(OP_CONST, 0, newSViv(pos))), + chkop); + initops = op_append_list(OP_LINESEQ, + newSTATEOP(0, NULL, chkop), + initops); + } + if (var) { + OP *slice = pos ? + op_prepend_elem(OP_ASLICE, + newOP(OP_PUSHMARK, 0), + newLISTOP(OP_ASLICE, 0, + list(newRANGE(0, + newSVOP(OP_CONST, 0, newSViv(pos)), + newUNOP(OP_AV2ARYLEN, 0, + ref(newUNOP(OP_RV2AV, 0, + newGVOP(OP_GV, 0, PL_defgv)), + OP_AV2ARYLEN)))), + ref(newUNOP(OP_RV2AV, 0, + newGVOP(OP_GV, 0, PL_defgv)), + OP_ASLICE))) : + newUNOP(OP_RV2AV, 0, newGVOP(OP_GV, 0, PL_defgv)); + initops = op_append_list(OP_LINESEQ, initops, + newSTATEOP(0, NULL, + newASSIGNOP(OPf_STACKED, var, 0, slice))); + } + prev_type = 2; + max_arity = -1; + } break; + default: + parse_error: + qerror(Perl_mess(aTHX_ "Parse error")); + return NULL; + } + lex_read_space(0); + c = lex_peek_unichar(0); + switch (c) { + case /*(*/')': break; + case ',': + do { + lex_token_boundary(); + lex_read_unichar(0); + lex_read_space(0); + c = lex_peek_unichar(0); + } while (c == ','); + break; + default: + goto parse_error; + } + } + if (min_arity != 0) { + initops = op_append_list(OP_LINESEQ, + newSTATEOP(0, NULL, + newLOGOP(OP_OR, 0, + newBINOP(OP_GE, 0, + scalar(newUNOP(OP_RV2AV, 0, + newGVOP(OP_GV, 0, PL_defgv))), + newSVOP(OP_CONST, 0, newSViv(min_arity))), + newLISTOP(OP_DIE, 0, newOP(OP_PUSHMARK, 0), + newSVOP(OP_CONST, 0, + newSVpvs("Too few arguments for subroutine"))))), + initops); + } + if (max_arity != -1) { + initops = op_append_list(OP_LINESEQ, + newSTATEOP(0, NULL, + newLOGOP(OP_OR, 0, + newBINOP(OP_LE, 0, + scalar(newUNOP(OP_RV2AV, 0, + newGVOP(OP_GV, 0, PL_defgv))), + newSVOP(OP_CONST, 0, newSViv(max_arity))), + newLISTOP(OP_DIE, 0, newOP(OP_PUSHMARK, 0), + newSVOP(OP_CONST, 0, + newSVpvs("Too many arguments for subroutine"))))), + initops); + } + return initops; } /* Index: gnu/usr.bin/perl/uconfig.h =================================================================== RCS file: /mnt/memory/perl/importit/cvs/src/gnu/usr.bin/perl/uconfig.h,v retrieving revision 1.3 diff -u -p -u -p -r1.3 uconfig.h --- gnu/usr.bin/perl/uconfig.h 24 Mar 2014 15:05:13 -0000 1.3 +++ gnu/usr.bin/perl/uconfig.h 16 Nov 2014 03:22:24 -0000 @@ -226,6 +226,12 @@ */ /*#define HAS_LOCALECONV / **/ +/* HAS_LC_MONETARY_2008: + * This symbol, if defined, indicates that the localeconv routine is + * available and has the additional members added in POSIX 1003.1-2008. + */ +/*#define HAS_LC_MONETARY_2008 / **/ + /* HAS_LOCKF: * This symbol, if defined, indicates that the lockf routine is * available to do file locking. @@ -703,12 +709,6 @@ */ /*#define I_NETINET_IN / **/ -/* I_SFIO: - * This symbol, if defined, indicates to the C program that it should - * include . - */ -/*#define I_SFIO / **/ - /* I_STDDEF: * This symbol, if defined, indicates that exists and should * be included. @@ -811,26 +811,6 @@ */ /*#define I_SYS_WAIT / **/ -/* I_TERMIO: - * This symbol, if defined, indicates that the program should include - * rather than . There are also differences in - * the ioctl() calls that depend on the value of this symbol. - */ -/* I_TERMIOS: - * This symbol, if defined, indicates that the program should include - * the POSIX termios.h rather than sgtty.h or termio.h. - * There are also differences in the ioctl() calls that depend on the - * value of this symbol. - */ -/* I_SGTTY: - * This symbol, if defined, indicates that the program should include - * rather than . There are also differences in - * the ioctl() calls that depend on the value of this symbol. - */ -/*#define I_TERMIO / **/ -/*#define I_TERMIOS / **/ -/*#define I_SGTTY / **/ - /* I_UNISTD: * This symbol, if defined, indicates to the C program that it should * include . @@ -892,18 +872,6 @@ #define OSNAME "unknown" /**/ #define OSVERS "unknown" /**/ -/* USE_CROSS_COMPILE: - * This symbol, if defined, indicates that Perl is being cross-compiled. - */ -/* PERL_TARGETARCH: - * This symbol, if defined, indicates the target architecture - * Perl has been cross-compiled to. Undefined if not a cross-compile. - */ -#ifndef USE_CROSS_COMPILE -/*#define USE_CROSS_COMPILE / **/ -#define PERL_TARGETARCH "" /**/ -#endif - /* MULTIARCH: * This symbol, if defined, signifies that the build * process will produce some binary files that are going to be @@ -934,8 +902,8 @@ * This symbol contains the ~name expanded version of ARCHLIB, to be used * in programs that are not prepared to deal with ~ expansion at run-time. */ -/*#define ARCHLIB "/usr/local/lib/perl5/5.18/unknown" / **/ -/*#define ARCHLIB_EXP "/usr/local/lib/perl5/5.18/unknown" / **/ +/*#define ARCHLIB "/usr/local/lib/perl5/5.20/unknown" / **/ +/*#define ARCHLIB_EXP "/usr/local/lib/perl5/5.20/unknown" / **/ /* ARCHNAME: * This symbol holds a string representing the architecture name. @@ -993,7 +961,7 @@ * so the default case (for NeXT) is big endian to catch them. * This might matter for NeXT 3.0. */ -#if defined(USE_CROSS_COMPILE) || defined(MULTIARCH) +#if defined(MULTIARCH) # ifdef __LITTLE_ENDIAN__ # if LONGSIZE == 4 # define BYTEORDER 0x1234 @@ -3045,8 +3013,8 @@ * This symbol contains the ~name expanded version of PRIVLIB, to be used * in programs that are not prepared to deal with ~ expansion at run-time. */ -#define PRIVLIB "/usr/local/lib/perl5/5.18" /**/ -#define PRIVLIB_EXP "/usr/local/lib/perl5/5.18" /**/ +#define PRIVLIB "/usr/local/lib/perl5/5.20" /**/ +#define PRIVLIB_EXP "/usr/local/lib/perl5/5.20" /**/ /* CAN_PROTOTYPE: * If defined, this macro indicates that the C compiler can handle @@ -3112,9 +3080,9 @@ * function used to generate normalized random numbers. * Values include 15, 16, 31, and 48. */ -#define Drand01() ((rand() & 0x7FFF) / (double) ((unsigned long)1 << 15)) /**/ -#define Rand_seed_t int /**/ -#define seedDrand01(x) srand((Rand_seed_t)x) /**/ +#define Drand01() Perl_drand48() /**/ +#define Rand_seed_t U32 /**/ +#define seedDrand01(x) Perl_drand48_init((Rand_seed_t)x) /**/ #define RANDBITS 48 /**/ /* Select_fd_set_t: @@ -3189,8 +3157,8 @@ * This symbol contains the ~name expanded version of SITEARCH, to be used * in programs that are not prepared to deal with ~ expansion at run-time. */ -/*#define SITEARCH "/usr/local/lib/perl5/5.18/unknown" / **/ -/*#define SITEARCH_EXP "/usr/local/lib/perl5/5.18/unknown" / **/ +/*#define SITEARCH "/usr/local/lib/perl5/5.20/unknown" / **/ +/*#define SITEARCH_EXP "/usr/local/lib/perl5/5.20/unknown" / **/ /* SITELIB: * This symbol contains the name of the private library for this package. @@ -3212,8 +3180,8 @@ * removed. The elements in inc_version_list (inc_version_list.U) can * be tacked onto this variable to generate a list of directories to search. */ -#define SITELIB "/usr/local/lib/perl5/5.18" /**/ -#define SITELIB_EXP "/usr/local/lib/perl5/5.18" /**/ +#define SITELIB "/usr/local/lib/perl5/5.20" /**/ +#define SITELIB_EXP "/usr/local/lib/perl5/5.20" /**/ #define SITELIB_STEM "/usr/local/lib/perl5" /**/ /* Size_t_size: @@ -3330,29 +3298,36 @@ /*#define PERL_VENDORLIB_EXP "" / **/ /*#define PERL_VENDORLIB_STEM "" / **/ -/* VOIDFLAGS: - * This symbol indicates how much support of the void type is given by this - * compiler. What various bits mean: - * - * 1 = supports declaration of void - * 2 = supports arrays of pointers to functions returning void - * 4 = supports comparisons between pointers to void functions and - * addresses of void functions - * 8 = supports declaration of generic void pointers - * - * The package designer should define VOIDUSED to indicate the requirements - * of the package. This can be done either by #defining VOIDUSED before - * including config.h, or by defining defvoidused in Myinit.U. If the - * latter approach is taken, only those flags will be tested. If the - * level of void support necessary is not present, defines void to int. +/* I_TERMIO: + * This symbol, if defined, indicates that the program should include + * rather than . There are also differences in + * the ioctl() calls that depend on the value of this symbol. */ -#ifndef VOIDUSED -#define VOIDUSED 1 -#endif -#define VOIDFLAGS 1 -#if (VOIDFLAGS & VOIDUSED) != VOIDUSED -#define void int /* is void to be avoided? */ -#define M_VOID /* Xenix strikes again */ +/* I_TERMIOS: + * This symbol, if defined, indicates that the program should include + * the POSIX termios.h rather than sgtty.h or termio.h. + * There are also differences in the ioctl() calls that depend on the + * value of this symbol. + */ +/* I_SGTTY: + * This symbol, if defined, indicates that the program should include + * rather than . There are also differences in + * the ioctl() calls that depend on the value of this symbol. + */ +/*#define I_TERMIO / **/ +/*#define I_TERMIOS / **/ +/*#define I_SGTTY / **/ + +/* USE_CROSS_COMPILE: + * This symbol, if defined, indicates that Perl is being cross-compiled. + */ +/* PERL_TARGETARCH: + * This symbol, if defined, indicates the target architecture + * Perl has been cross-compiled to. Undefined if not a cross-compile. + */ +#ifndef USE_CROSS_COMPILE +/*#define USE_CROSS_COMPILE / **/ +#define PERL_TARGETARCH "" /**/ #endif /* PERL_USE_DEVEL: @@ -3917,12 +3892,6 @@ */ /*#define HAS_SETPROCTITLE / **/ -/* USE_SFIO: - * This symbol, if defined, indicates that sfio should - * be used. - */ -/*#define USE_SFIO / **/ - /* HAS_SIGNBIT: * This symbol, if defined, indicates that the signbit routine is * available to check if the given number has the sign bit set. @@ -4188,8 +4157,10 @@ /*#define USE_DYNAMIC_LOADING / **/ /* FFLUSH_NULL: - * This symbol, if defined, tells that fflush(NULL) does flush - * all pending stdio output. + * This symbol, if defined, tells that fflush(NULL) correctly + * flushes all pending stdio output without side effects. In + * particular, on some platforms calling fflush(NULL) *still* + * corrupts STDIN if it is a pipe. */ /* FFLUSH_ALL: * This symbol, if defined, tells that to flush @@ -4753,6 +4724,6 @@ #endif /* Generated from: - * 2c9dc3f21d37b1665f6a59dfc6d79e6cb08bdf36a9c3e427d11d6b9ddffe2439 config_h.SH - * 26ab9b4aa382d32761cb91084ba59e7e4b190799502a43366ccb3d2f584783ca uconfig.sh + * 1efb97c1f4b2c9e6bb17b9172f43cc7f281124904ecca38fa6561d6800432847 config_h.SH + * 87143cb3dacf7a54fe1df682d22e85daae58d626055b7bd02efa3d12d3f05c27 uconfig.sh * ex: set ro: */ Index: gnu/usr.bin/perl/uconfig.sh =================================================================== RCS file: /mnt/memory/perl/importit/cvs/src/gnu/usr.bin/perl/uconfig.sh,v retrieving revision 1.3 diff -u -p -u -p -r1.3 uconfig.sh --- gnu/usr.bin/perl/uconfig.sh 24 Mar 2014 15:05:13 -0000 1.3 +++ gnu/usr.bin/perl/uconfig.sh 16 Nov 2014 03:22:24 -0000 @@ -6,8 +6,8 @@ afs='false' afsroot='/afs' alignbytes='4' aphostname='/bin/hostname' -archlib='/usr/local/lib/perl5/5.18/unknown' -archlibexp='/usr/local/lib/perl5/5.18/unknown' +archlib='/usr/local/lib/perl5/5.20/unknown' +archlibexp='/usr/local/lib/perl5/5.20/unknown' archname='unknown' asctime_r_proto='0' bin='/usr/local/bin' @@ -235,6 +235,7 @@ d_isinf='undef' d_isnan='undef' d_isnanl='undef' d_killpg='undef' +d_lc_monetary_2008='undef' d_lchown='undef' d_ldbl_dig='undef' d_libm_lib_version='undef' @@ -378,7 +379,6 @@ d_setsent='undef' d_setservent_r='undef' d_setsid='undef' d_setvbuf='undef' -d_sfio='undef' d_shm='undef' d_shmat='undef' d_shmatprototype='undef' @@ -488,10 +488,9 @@ db_prefixtype='size_t' db_version_major='0' db_version_minor='0' db_version_patch='0' -defvoidused=1 direntrytype='struct dirent' doublesize='8' -drand01="((rand() & 0x7FFF) / (double) ((unsigned long)1 << 15))" +drand01="Perl_drand48()" drand48_r_proto='0' dtrace='' eagain='EAGAIN' @@ -553,7 +552,6 @@ i_crypt='undef' i_db='undef' i_dbm='undef' i_dirent='define' -i_dld='undef' i_dlfcn='undef' i_fcntl='undef' i_float='undef' @@ -585,7 +583,6 @@ i_prot='undef' i_pthread='undef' i_pwd='undef' i_rpcsvcdbm='undef' -i_sfio='undef' i_sgtty='undef' i_shadow='undef' i_socks='undef' @@ -684,17 +681,17 @@ package='perl5' perl_static_inline='static' phostname='hostname' pidtype=int -privlib='/usr/local/lib/perl5/5.18' -privlibexp='/usr/local/lib/perl5/5.18' +privlib='/usr/local/lib/perl5/5.20' +privlibexp='/usr/local/lib/perl5/5.20' procselfexe='' prototype='undef' ptrsize='4' quadkind='4' quadtype='int64_t' randbits='48' -randfunc='drand48' +randfunc='Perl_drand48' random_r_proto='0' -randseedtype='int' +randseedtype='U32' rd_nodata='-1' readdir64_r_proto='0' readdir_r_proto='0' @@ -718,7 +715,7 @@ sSCNfldbl='"llf"' sched_yield='sched_yield()' scriptdir='/usr/local/bin' scriptdirexp='/usr/local/bin' -seedfunc='srand' +seedfunc='Perl_drand48_init' selectminbits='32' selecttype=int setgrent_r_proto='0' @@ -735,11 +732,11 @@ sig_name_init='0' sig_num_init='0' sig_size='1' signal_t=int -sitearch='/usr/local/lib/perl5/5.18/unknown' -sitearchexp='/usr/local/lib/perl5/5.18/unknown' -sitelib='/usr/local/lib/perl5/5.18' +sitearch='/usr/local/lib/perl5/5.20/unknown' +sitearchexp='/usr/local/lib/perl5/5.20/unknown' +sitelib='/usr/local/lib/perl5/5.20' sitelib_stem='/usr/local/lib/perl5' -sitelibexp='/usr/local/lib/perl5/5.18' +sitelibexp='/usr/local/lib/perl5/5.20' sizesize=4 sizetype='size_t' socksizetype='int' @@ -759,6 +756,7 @@ stdio_ptr='((fp)->_IO_read_ptr)' stdio_stream_array='' strerror_r_proto='0' targetarch='' +targetsh='/bin/sh' timetype=time_t tmpnam_r_proto='0' touch='touch' @@ -799,7 +797,6 @@ useperlio='undef' useposix='true' usereentrant='undef' userelocatableinc='undef' -usesfio='false' useshrplib='false' usesitecustomize='undef' usesocks='undef' @@ -818,5 +815,4 @@ vendorarchexp='' vendorlib_stem='' vendorlibexp='' versiononly='undef' -voidflags=1 zip='' Index: gnu/usr.bin/perl/uconfig64.sh =================================================================== RCS file: /mnt/memory/perl/importit/cvs/src/gnu/usr.bin/perl/uconfig64.sh,v retrieving revision 1.3 diff -u -p -u -p -r1.3 uconfig64.sh --- gnu/usr.bin/perl/uconfig64.sh 24 Mar 2014 15:05:13 -0000 1.3 +++ gnu/usr.bin/perl/uconfig64.sh 16 Nov 2014 03:22:24 -0000 @@ -7,8 +7,8 @@ afsroot='/afs' alignbytes='8' ansi2knr='' aphostname='/bin/hostname' -archlib='/usr/local/lib/perl5/5.18/unknown' -archlibexp='/usr/local/lib/perl5/5.18/unknown' +archlib='/usr/local/lib/perl5/5.20/unknown' +archlibexp='/usr/local/lib/perl5/5.20/unknown' archname='unknown64' asctime_r_proto='0' bin='/usr/local/bin' @@ -236,6 +236,7 @@ d_isinf='undef' d_isnan='undef' d_isnanl='undef' d_killpg='undef' +d_lc_monetary_2008='undef' d_lchown='undef' d_ldbl_dig='undef' d_libm_lib_version='undef' @@ -379,7 +380,6 @@ d_setsent='undef' d_setservent_r='undef' d_setsid='undef' d_setvbuf='undef' -d_sfio='undef' d_shm='undef' d_shmat='undef' d_shmatprototype='undef' @@ -489,7 +489,6 @@ db_prefixtype='size_t' db_version_major='0' db_version_minor='0' db_version_patch='0' -defvoidused=1 direntrytype='struct dirent' doublesize='8' drand01="((rand() & 0x7FFF) / (double) ((unsigned long)1 << 15))" @@ -554,7 +553,6 @@ i_crypt='undef' i_db='undef' i_dbm='undef' i_dirent='define' -i_dld='undef' i_dlfcn='undef' i_fcntl='undef' i_float='undef' @@ -586,7 +584,6 @@ i_prot='undef' i_pthread='undef' i_pwd='undef' i_rpcsvcdbm='undef' -i_sfio='undef' i_sgtty='undef' i_shadow='undef' i_socks='undef' @@ -684,8 +681,8 @@ package='perl5' perl_static_inline='static' phostname='hostname' pidtype=int -privlib='/usr/local/lib/perl5/5.18' -privlibexp='/usr/local/lib/perl5/5.18' +privlib='/usr/local/lib/perl5/5.20' +privlibexp='/usr/local/lib/perl5/5.20' procselfexe='' prototype='undef' ptrsize='8' @@ -735,11 +732,11 @@ sig_name_init='0' sig_num_init='0' sig_size='1' signal_t=int -sitearch='/usr/local/lib/perl5/5.18/unknown' -sitearchexp='/usr/local/lib/perl5/5.18/unknown' -sitelib='/usr/local/lib/perl5/5.18' +sitearch='/usr/local/lib/perl5/5.20/unknown' +sitearchexp='/usr/local/lib/perl5/5.20/unknown' +sitelib='/usr/local/lib/perl5/5.20' sitelib_stem='/usr/local/lib/perl5' -sitelibexp='/usr/local/lib/perl5/5.18' +sitelibexp='/usr/local/lib/perl5/5.20' sizesize=4 sizetype='size_t' socksizetype='int' @@ -759,6 +756,7 @@ stdio_ptr='((fp)->_IO_read_ptr)' stdio_stream_array='' strerror_r_proto='0' targetarch='' +targetsh='/bin/sh' timetype=time_t tmpnam_r_proto='0' touch='touch' @@ -799,7 +797,6 @@ useperlio='undef' useposix='true' usereentrant='undef' userelocatableinc='undef' -usesfio='false' useshrplib='false' usesitecustomize='undef' usesocks='undef' @@ -818,5 +815,4 @@ vendorarchexp='' vendorlib_stem='' vendorlibexp='' versiononly='undef' -voidflags=1 zip='' Index: gnu/usr.bin/perl/unicode_constants.h =================================================================== RCS file: /mnt/memory/perl/importit/cvs/src/gnu/usr.bin/perl/unicode_constants.h,v retrieving revision 1.1.1.1 diff -u -p -u -p -r1.1.1.1 unicode_constants.h --- gnu/usr.bin/perl/unicode_constants.h 24 Mar 2014 14:58:48 -0000 1.1.1.1 +++ gnu/usr.bin/perl/unicode_constants.h 16 Nov 2014 03:22:24 -0000 @@ -20,19 +20,26 @@ * "_TAIL" if instead it represents all but the first byte. This, and * with no additional suffix are both string constants */ +#define LATIN_SMALL_LETTER_LONG_S_UTF8 "\xC5\xBF" /* U+017F */ #define COMBINING_GRAVE_ACCENT_UTF8 "\xCC\x80" /* U+0300 */ -#define COMBINING_ACUTE_ACCENT_UTF8 "\xCC\x81" /* U+0301 */ -#define COMBINING_DIAERESIS_UTF8 "\xCC\x88" /* U+0308 */ -#define GREEK_SMALL_LETTER_IOTA_UTF8 "\xCE\xB9" /* U+03B9 */ +#define GREEK_CAPITAL_LETTER_IOTA_UTF8 "\xCE\x99" /* U+0399 */ +#define GREEK_SMALL_LETTER_MU_UTF8 "\xCE\xBC" /* U+03BC */ -#define GREEK_SMALL_LETTER_UPSILON_UTF8 "\xCF\x85" /* U+03C5 */ +#define LATIN_CAPITAL_LETTER_SHARP_S_UTF8 "\xE1\xBA\x9E" /* U+1E9E */ + +#define LATIN_SMALL_LIGATURE_LONG_S_T_UTF8 "\xEF\xAC\x85" /* U+FB05 */ +#define LATIN_SMALL_LIGATURE_ST_UTF8 "\xEF\xAC\x86" /* U+FB06 */ #define HYPHEN_UTF8 "\xE2\x80\x90" /* U+2010 */ #define FIRST_SURROGATE_UTF8_FIRST_BYTE 0xED /* U+D800 */ +#define BOM_UTF8_FIRST_BYTE 0xEF /* U+FEFF */ +#define BOM_UTF8_TAIL "\xBB\xBF" /* U+FEFF */ #define DEL_NATIVE 0x7F /* U+007F */ +#define CR_NATIVE 0x0D /* U+000D */ +#define LF_NATIVE 0x0A /* U+000A */ #define LATIN_SMALL_LETTER_SHARP_S_NATIVE 0xDF /* U+00DF */ #define LATIN_SMALL_LETTER_A_WITH_RING_ABOVE_NATIVE 0xE5 /* U+00E5 */ #define LATIN_CAPITAL_LETTER_A_WITH_RING_ABOVE_NATIVE 0xC5 /* U+00C5 */ Index: gnu/usr.bin/perl/universal.c =================================================================== RCS file: /mnt/memory/perl/importit/cvs/src/gnu/usr.bin/perl/universal.c,v retrieving revision 1.16 diff -u -p -u -p -r1.16 universal.c --- gnu/usr.bin/perl/universal.c 24 Mar 2014 15:05:13 -0000 1.16 +++ gnu/usr.bin/perl/universal.c 16 Nov 2014 03:22:24 -0000 @@ -29,7 +29,7 @@ #define PERL_IN_UNIVERSAL_C #include "perl.h" -#ifdef USE_PERLIO +#if defined(USE_PERLIO) #include "perliol.h" /* For the PERLIO_F_XXX */ #endif @@ -160,15 +160,19 @@ Perl_sv_derived_from_pvn(pTHX_ SV *sv, c type = sv_reftype(sv,0); if (type && strEQ(type,name)) return TRUE; - stash = SvOBJECT(sv) ? SvSTASH(sv) : NULL; + if (!SvOBJECT(sv)) + return FALSE; + stash = SvSTASH(sv); } else { stash = gv_stashsv(sv, 0); - if (!stash) - stash = gv_stashpvs("UNIVERSAL", 0); } - return stash ? isa_lookup(stash, name, len, flags) : FALSE; + if (stash && isa_lookup(stash, name, len, flags)) + return TRUE; + + stash = gv_stashpvs("UNIVERSAL", 0); + return stash && isa_lookup(stash, name, len, flags); } /* @@ -290,7 +294,7 @@ A specialised variant of C for croak_xs_usage(cv, "eee_yow"); works out the package name and subroutine name from C, and then calls -C. Hence if C is C<&ouch::awk>, it would call C as: +C. Hence if C is C<&ouch::awk>, it would call C as: Perl_croak(aTHX_ "Usage: %"SVf"::%"SVf"(%s)", "ouch" "awk", "eee_yow"); @@ -308,19 +312,23 @@ Perl_croak_xs_usage(const CV *const cv, const HV *const stash = GvSTASH(gv); if (HvNAME_get(stash)) + /* diag_listed_as: SKIPME */ Perl_croak_nocontext("Usage: %"HEKf"::%"HEKf"(%s)", HEKfARG(HvNAME_HEK(stash)), HEKfARG(GvNAME_HEK(gv)), params); else + /* diag_listed_as: SKIPME */ Perl_croak_nocontext("Usage: %"HEKf"(%s)", HEKfARG(GvNAME_HEK(gv)), params); } else { /* Pants. I don't think that it should be possible to get here. */ + /* diag_listed_as: SKIPME */ Perl_croak_nocontext("Usage: CODE(0x%"UVxf")(%s)", PTR2UV(cv), params); } } +XS(XS_UNIVERSAL_isa); /* prototype to pass -Wmissing-prototypes */ XS(XS_UNIVERSAL_isa) { dVAR; @@ -341,6 +349,7 @@ XS(XS_UNIVERSAL_isa) } } +XS(XS_UNIVERSAL_can); /* prototype to pass -Wmissing-prototypes */ XS(XS_UNIVERSAL_can) { dVAR; @@ -348,6 +357,7 @@ XS(XS_UNIVERSAL_can) SV *sv; SV *rv; HV *pkg = NULL; + GV *iogv; if (items != 2) croak_xs_usage(cv, "object-ref, method"); @@ -356,8 +366,10 @@ XS(XS_UNIVERSAL_can) SvGETMAGIC(sv); - if (!SvOK(sv) || !(SvROK(sv) || SvNIOK(sv) || (SvPOK(sv) && SvCUR(sv)) - )) + /* Reject undef and empty string. Note that the string form takes + precedence here over the numeric form, as (!1)->foo treats the + invocant as the empty string, though it is a dualvar. */ + if (!SvOK(sv) || (SvPOK(sv) && !SvCUR(sv))) XSRETURN_UNDEF; rv = &PL_sv_undef; @@ -366,7 +378,13 @@ XS(XS_UNIVERSAL_can) sv = MUTABLE_SV(SvRV(sv)); if (SvOBJECT(sv)) pkg = SvSTASH(sv); + else if (isGV_with_GP(sv) && GvIO(sv)) + pkg = SvSTASH(GvIO(sv)); } + else if (isGV_with_GP(sv) && GvIO(sv)) + pkg = SvSTASH(GvIO(sv)); + else if ((iogv = gv_fetchsv_nomg(sv, 0, SVt_PVIO)) && GvIO(iogv)) + pkg = SvSTASH(GvIO(iogv)); else { pkg = gv_stashsv(sv, 0); if (!pkg) @@ -383,6 +401,7 @@ XS(XS_UNIVERSAL_can) XSRETURN(1); } +XS(XS_UNIVERSAL_DOES); /* prototype to pass -Wmissing-prototypes */ XS(XS_UNIVERSAL_DOES) { dVAR; @@ -400,372 +419,7 @@ XS(XS_UNIVERSAL_DOES) } } -XS(XS_UNIVERSAL_VERSION) -{ - dVAR; - dXSARGS; - HV *pkg; - GV **gvp; - GV *gv; - SV *sv; - const char *undef; - PERL_UNUSED_ARG(cv); - - if (SvROK(ST(0))) { - sv = MUTABLE_SV(SvRV(ST(0))); - if (!SvOBJECT(sv)) - Perl_croak(aTHX_ "Cannot find version of an unblessed reference"); - pkg = SvSTASH(sv); - } - else { - pkg = gv_stashsv(ST(0), 0); - } - - gvp = pkg ? (GV**)hv_fetchs(pkg, "VERSION", FALSE) : NULL; - - if (gvp && isGV(gv = *gvp) && (sv = GvSV(gv)) && SvOK(sv)) { - SV * const nsv = sv_newmortal(); - sv_setsv(nsv, sv); - sv = nsv; - if ( !sv_isobject(sv) || !sv_derived_from(sv, "version")) - upg_version(sv, FALSE); - - undef = NULL; - } - else { - sv = &PL_sv_undef; - undef = "(undef)"; - } - - if (items > 1) { - SV *req = ST(1); - - if (undef) { - if (pkg) { - const HEK * const name = HvNAME_HEK(pkg); - Perl_croak(aTHX_ - "%"HEKf" does not define $%"HEKf - "::VERSION--version check failed", - HEKfARG(name), HEKfARG(name)); - } else { - Perl_croak(aTHX_ - "%"SVf" defines neither package nor VERSION--version check failed", - SVfARG(ST(0)) ); - } - } - - if ( !sv_isobject(req) || !sv_derived_from(req, "version")) { - /* req may very well be R/O, so create a new object */ - req = sv_2mortal( new_version(req) ); - } - - if ( vcmp( req, sv ) > 0 ) { - if ( hv_exists(MUTABLE_HV(SvRV(req)), "qv", 2 ) ) { - Perl_croak(aTHX_ "%"HEKf" version %"SVf" required--" - "this is only version %"SVf"", - HEKfARG(HvNAME_HEK(pkg)), - SVfARG(sv_2mortal(vnormal(req))), - SVfARG(sv_2mortal(vnormal(sv)))); - } else { - Perl_croak(aTHX_ "%"HEKf" version %"SVf" required--" - "this is only version %"SVf, - HEKfARG(HvNAME_HEK(pkg)), - SVfARG(sv_2mortal(vstringify(req))), - SVfARG(sv_2mortal(vstringify(sv)))); - } - } - - } - - if ( SvOK(sv) && sv_derived_from(sv, "version") ) { - ST(0) = sv_2mortal(vstringify(sv)); - } else { - ST(0) = sv; - } - - XSRETURN(1); -} - -XS(XS_version_new) -{ - dVAR; - dXSARGS; - if (items > 3 || items < 1) - croak_xs_usage(cv, "class, version"); - SP -= items; - { - SV *vs = ST(1); - SV *rv; - STRLEN len; - const char *classname; - U32 flags; - if ( sv_isobject(ST(0)) ) { /* get the class if called as an object method */ - const HV * stash = SvSTASH(SvRV(ST(0))); - classname = HvNAME(stash); - len = HvNAMELEN(stash); - flags = HvNAMEUTF8(stash) ? SVf_UTF8 : 0; - } - else { - classname = SvPV(ST(0), len); - flags = SvUTF8(ST(0)); - } - - if ( items == 1 || ! SvOK(vs) ) { /* no param or explicit undef */ - /* create empty object */ - vs = sv_newmortal(); - sv_setpvs(vs, "0"); - } - else if ( items == 3 ) { - vs = sv_newmortal(); - Perl_sv_setpvf(aTHX_ vs,"v%s",SvPV_nolen_const(ST(2))); - } - - rv = new_version(vs); - if ( strnNE(classname,"version", len) ) /* inherited new() */ - sv_bless(rv, gv_stashpvn(classname, len, GV_ADD | flags)); - - mPUSHs(rv); - PUTBACK; - return; - } -} - -XS(XS_version_stringify) -{ - dVAR; - dXSARGS; - if (items < 1) - croak_xs_usage(cv, "lobj, ..."); - SP -= items; - { - SV * lobj = ST(0); - - if (sv_isobject(lobj) && sv_derived_from(lobj, "version")) { - lobj = SvRV(lobj); - } - else - Perl_croak(aTHX_ "lobj is not of type version"); - - mPUSHs(vstringify(lobj)); - - PUTBACK; - return; - } -} - -XS(XS_version_numify) -{ - dVAR; - dXSARGS; - if (items < 1) - croak_xs_usage(cv, "lobj, ..."); - SP -= items; - { - SV * lobj = ST(0); - - if (sv_isobject(lobj) && sv_derived_from(lobj, "version")) { - lobj = SvRV(lobj); - } - else - Perl_croak(aTHX_ "lobj is not of type version"); - - mPUSHs(vnumify(lobj)); - - PUTBACK; - return; - } -} - -XS(XS_version_normal) -{ - dVAR; - dXSARGS; - if (items < 1) - croak_xs_usage(cv, "lobj, ..."); - SP -= items; - { - SV * lobj = ST(0); - - if (sv_isobject(lobj) && sv_derived_from(lobj, "version")) { - lobj = SvRV(lobj); - } - else - Perl_croak(aTHX_ "lobj is not of type version"); - - mPUSHs(vnormal(lobj)); - - PUTBACK; - return; - } -} - -XS(XS_version_vcmp) -{ - dVAR; - dXSARGS; - if (items < 1) - croak_xs_usage(cv, "lobj, ..."); - SP -= items; - { - SV * lobj = ST(0); - - if (sv_isobject(lobj) && sv_derived_from(lobj, "version")) { - lobj = SvRV(lobj); - } - else - Perl_croak(aTHX_ "lobj is not of type version"); - - { - SV *rs; - SV *rvs; - SV * robj = ST(1); - const IV swap = (IV)SvIV(ST(2)); - - if ( !sv_isobject(robj) || !sv_derived_from(robj, "version") ) - { - robj = new_version(SvOK(robj) ? robj : newSVpvs_flags("0", SVs_TEMP)); - sv_2mortal(robj); - } - rvs = SvRV(robj); - - if ( swap ) - { - rs = newSViv(vcmp(rvs,lobj)); - } - else - { - rs = newSViv(vcmp(lobj,rvs)); - } - - mPUSHs(rs); - } - - PUTBACK; - return; - } -} - -XS(XS_version_boolean) -{ - dVAR; - dXSARGS; - if (items < 1) - croak_xs_usage(cv, "lobj, ..."); - SP -= items; - if (sv_isobject(ST(0)) && sv_derived_from(ST(0), "version")) { - SV * const lobj = SvRV(ST(0)); - SV * const rs = - newSViv( vcmp(lobj, - sv_2mortal(new_version( - sv_2mortal(newSVpvs("0")) - )) - ) - ); - mPUSHs(rs); - PUTBACK; - return; - } - else - Perl_croak(aTHX_ "lobj is not of type version"); -} - -XS(XS_version_noop) -{ - dVAR; - dXSARGS; - if (items < 1) - croak_xs_usage(cv, "lobj, ..."); - if (sv_isobject(ST(0)) && sv_derived_from(ST(0), "version")) - Perl_croak(aTHX_ "operation not supported with version object"); - else - Perl_croak(aTHX_ "lobj is not of type version"); -#ifndef HASATTRIBUTE_NORETURN - XSRETURN_EMPTY; -#endif -} - -XS(XS_version_is_alpha) -{ - dVAR; - dXSARGS; - if (items != 1) - croak_xs_usage(cv, "lobj"); - SP -= items; - if (sv_isobject(ST(0)) && sv_derived_from(ST(0), "version")) { - SV * const lobj = ST(0); - if ( hv_exists(MUTABLE_HV(SvRV(lobj)), "alpha", 5 ) ) - XSRETURN_YES; - else - XSRETURN_NO; - PUTBACK; - return; - } - else - Perl_croak(aTHX_ "lobj is not of type version"); -} - -XS(XS_version_qv) -{ - dVAR; - dXSARGS; - PERL_UNUSED_ARG(cv); - SP -= items; - { - SV * ver = ST(0); - SV * rv; - STRLEN len = 0; - const char * classname = ""; - U32 flags = 0; - if ( items == 2 && SvOK(ST(1)) ) { - ver = ST(1); - if ( sv_isobject(ST(0)) ) { /* class called as an object method */ - const HV * stash = SvSTASH(SvRV(ST(0))); - classname = HvNAME(stash); - len = HvNAMELEN(stash); - flags = HvNAMEUTF8(stash) ? SVf_UTF8 : 0; - } - else { - classname = SvPV(ST(0), len); - flags = SvUTF8(ST(0)); - } - } - if ( !SvVOK(ver) ) { /* not already a v-string */ - rv = sv_newmortal(); - sv_setsv(rv,ver); /* make a duplicate */ - upg_version(rv, TRUE); - } else { - rv = sv_2mortal(new_version(ver)); - } - if ( items == 2 - && strnNE(classname,"version", len) ) { /* inherited new() */ - sv_bless(rv, gv_stashpvn(classname, len, GV_ADD | flags)); - } - PUSHs(rv); - } - PUTBACK; - return; -} - -XS(XS_version_is_qv) -{ - dVAR; - dXSARGS; - if (items != 1) - croak_xs_usage(cv, "lobj"); - SP -= items; - if (sv_isobject(ST(0)) && sv_derived_from(ST(0), "version")) { - SV * const lobj = ST(0); - if ( hv_exists(MUTABLE_HV(SvRV(lobj)), "qv", 2 ) ) - XSRETURN_YES; - else - XSRETURN_NO; - PUTBACK; - return; - } - else - Perl_croak(aTHX_ "lobj is not of type version"); -} - +XS(XS_utf8_is_utf8); /* prototype to pass -Wmissing-prototypes */ XS(XS_utf8_is_utf8) { dVAR; @@ -783,6 +437,7 @@ XS(XS_utf8_is_utf8) XSRETURN_EMPTY; } +XS(XS_utf8_valid); /* prototype to pass -Wmissing-prototypes */ XS(XS_utf8_valid) { dVAR; @@ -801,6 +456,7 @@ XS(XS_utf8_valid) XSRETURN_EMPTY; } +XS(XS_utf8_encode); /* prototype to pass -Wmissing-prototypes */ XS(XS_utf8_encode) { dVAR; @@ -812,6 +468,7 @@ XS(XS_utf8_encode) XSRETURN_EMPTY; } +XS(XS_utf8_decode); /* prototype to pass -Wmissing-prototypes */ XS(XS_utf8_decode) { dVAR; @@ -829,6 +486,7 @@ XS(XS_utf8_decode) XSRETURN(1); } +XS(XS_utf8_upgrade); /* prototype to pass -Wmissing-prototypes */ XS(XS_utf8_upgrade) { dVAR; @@ -846,6 +504,7 @@ XS(XS_utf8_upgrade) XSRETURN(1); } +XS(XS_utf8_downgrade); /* prototype to pass -Wmissing-prototypes */ XS(XS_utf8_downgrade) { dVAR; @@ -862,6 +521,7 @@ XS(XS_utf8_downgrade) XSRETURN(1); } +XS(XS_utf8_native_to_unicode); /* prototype to pass -Wmissing-prototypes */ XS(XS_utf8_native_to_unicode) { dVAR; @@ -875,6 +535,7 @@ XS(XS_utf8_native_to_unicode) XSRETURN(1); } +XS(XS_utf8_unicode_to_native); /* prototype to pass -Wmissing-prototypes */ XS(XS_utf8_unicode_to_native) { dVAR; @@ -888,6 +549,7 @@ XS(XS_utf8_unicode_to_native) XSRETURN(1); } +XS(XS_Internals_SvREADONLY); /* prototype to pass -Wmissing-prototypes */ XS(XS_Internals_SvREADONLY) /* This is dangerous stuff. */ { dVAR; @@ -903,25 +565,60 @@ XS(XS_Internals_SvREADONLY) /* This is d sv = SvRV(svz); if (items == 1) { - if (SvREADONLY(sv) && !SvIsCOW(sv)) + if (SvREADONLY(sv)) XSRETURN_YES; else XSRETURN_NO; } else if (items == 2) { if (SvTRUE(ST(1))) { +#ifdef PERL_OLD_COPY_ON_WRITE if (SvIsCOW(sv)) sv_force_normal(sv); +#endif SvREADONLY_on(sv); XSRETURN_YES; } else { /* I hope you really know what you are doing. */ - if (!SvIsCOW(sv)) SvREADONLY_off(sv); + SvREADONLY_off(sv); XSRETURN_NO; } } XSRETURN_UNDEF; /* Can't happen. */ } + +XS(XS_constant__make_const); /* prototype to pass -Wmissing-prototypes */ +XS(XS_constant__make_const) /* This is dangerous stuff. */ +{ + dVAR; + dXSARGS; + SV * const svz = ST(0); + SV * sv; + PERL_UNUSED_ARG(cv); + + /* [perl #77776] - called as &foo() not foo() */ + if (!SvROK(svz) || items != 1) + croak_xs_usage(cv, "SCALAR"); + + sv = SvRV(svz); + +#ifdef PERL_OLD_COPY_ON_WRITE + if (SvIsCOW(sv)) sv_force_normal(sv); +#endif + SvREADONLY_on(sv); + if (SvTYPE(sv) == SVt_PVAV && AvFILLp(sv) != -1) { + /* for constant.pm; nobody else should be calling this + on arrays anyway. */ + SV **svp; + for (svp = AvARRAY(sv) + AvFILLp(sv) + ; svp >= AvARRAY(sv) + ; --svp) + if (*svp) SvPADTMP_on(*svp); + } + XSRETURN(0); +} + +XS(XS_Internals_SvREFCNT); /* prototype to pass -Wmissing-prototypes */ XS(XS_Internals_SvREFCNT) /* This is dangerous stuff. */ { dVAR; @@ -947,6 +644,7 @@ XS(XS_Internals_SvREFCNT) /* This is dan } +XS(XS_Internals_hv_clear_placehold); /* prototype to pass -Wmissing-prototypes */ XS(XS_Internals_hv_clear_placehold) { dVAR; @@ -961,13 +659,14 @@ XS(XS_Internals_hv_clear_placehold) } } +XS(XS_PerlIO_get_layers); /* prototype to pass -Wmissing-prototypes */ XS(XS_PerlIO_get_layers) { dVAR; dXSARGS; if (items < 1 || items % 2 == 0) croak_xs_usage(cv, "filehandle[,args]"); -#ifdef USE_PERLIO +#if defined(USE_PERLIO) { SV * sv; GV * gv; @@ -1022,9 +721,9 @@ XS(XS_PerlIO_get_layers) if (gv && (io = GvIO(gv))) { AV* const av = PerlIO_get_layers(aTHX_ input ? IoIFP(io) : IoOFP(io)); - I32 i; - const I32 last = av_len(av); - I32 nitem = 0; + SSize_t i; + const SSize_t last = av_tindex(av); + SSize_t nitem = 0; for (i = last; i >= 0; i -= 3) { SV * const * const namsvp = av_fetch(av, i - 2, FALSE); @@ -1087,6 +786,7 @@ XS(XS_PerlIO_get_layers) } +XS(XS_re_is_regexp); /* prototype to pass -Wmissing-prototypes */ XS(XS_re_is_regexp) { dVAR; @@ -1103,6 +803,7 @@ XS(XS_re_is_regexp) } } +XS(XS_re_regnames_count); /* prototype to pass -Wmissing-prototypes */ XS(XS_re_regnames_count) { REGEXP *rx = PL_curpm ? PM_GETRE(PL_curpm) : NULL; @@ -1126,6 +827,7 @@ XS(XS_re_regnames_count) XSRETURN(1); } +XS(XS_re_regname); /* prototype to pass -Wmissing-prototypes */ XS(XS_re_regname) { dVAR; @@ -1158,6 +860,7 @@ XS(XS_re_regname) } +XS(XS_re_regnames); /* prototype to pass -Wmissing-prototypes */ XS(XS_re_regnames) { dVAR; @@ -1166,8 +869,8 @@ XS(XS_re_regnames) U32 flags; SV *ret; AV *av; - I32 length; - I32 i; + SSize_t length; + SSize_t i; SV **entry; if (items > 1) @@ -1195,7 +898,7 @@ XS(XS_re_regnames) XSRETURN_UNDEF; av = MUTABLE_AV(SvRV(ret)); - length = av_len(av); + length = av_tindex(av); EXTEND(SP, length+1); /* better extend stack just once */ for (i = 0; i <= length; i++) { @@ -1213,6 +916,7 @@ XS(XS_re_regnames) return; } +XS(XS_re_regexp_pattern); /* prototype to pass -Wmissing-prototypes */ XS(XS_re_regexp_pattern) { dVAR; @@ -1313,45 +1017,22 @@ XS(XS_re_regexp_pattern) /* NOT-REACHED */ } +#include "vutil.h" +#include "vxs.inc" + struct xsub_details { const char *name; XSUBADDR_t xsub; const char *proto; }; -const struct xsub_details details[] = { +static const struct xsub_details details[] = { {"UNIVERSAL::isa", XS_UNIVERSAL_isa, NULL}, {"UNIVERSAL::can", XS_UNIVERSAL_can, NULL}, {"UNIVERSAL::DOES", XS_UNIVERSAL_DOES, NULL}, - {"UNIVERSAL::VERSION", XS_UNIVERSAL_VERSION, NULL}, - {"version::()", XS_version_noop, NULL}, - {"version::new", XS_version_new, NULL}, - {"version::parse", XS_version_new, NULL}, - {"version::(\"\"", XS_version_stringify, NULL}, - {"version::stringify", XS_version_stringify, NULL}, - {"version::(0+", XS_version_numify, NULL}, - {"version::numify", XS_version_numify, NULL}, - {"version::normal", XS_version_normal, NULL}, - {"version::(cmp", XS_version_vcmp, NULL}, - {"version::(<=>", XS_version_vcmp, NULL}, - {"version::vcmp", XS_version_vcmp, NULL}, - {"version::(bool", XS_version_boolean, NULL}, - {"version::boolean", XS_version_boolean, NULL}, - {"version::(+", XS_version_noop, NULL}, - {"version::(-", XS_version_noop, NULL}, - {"version::(*", XS_version_noop, NULL}, - {"version::(/", XS_version_noop, NULL}, - {"version::(+=", XS_version_noop, NULL}, - {"version::(-=", XS_version_noop, NULL}, - {"version::(*=", XS_version_noop, NULL}, - {"version::(/=", XS_version_noop, NULL}, - {"version::(abs", XS_version_noop, NULL}, - {"version::(nomethod", XS_version_noop, NULL}, - {"version::noop", XS_version_noop, NULL}, - {"version::is_alpha", XS_version_is_alpha, NULL}, - {"version::qv", XS_version_qv, NULL}, - {"version::declare", XS_version_qv, NULL}, - {"version::is_qv", XS_version_is_qv, NULL}, +#define VXS_XSUB_DETAILS +#include "vxs.inc" +#undef VXS_XSUB_DETAILS {"utf8::is_utf8", XS_utf8_is_utf8, NULL}, {"utf8::valid", XS_utf8_valid, NULL}, {"utf8::encode", XS_utf8_encode, NULL}, @@ -1361,6 +1042,7 @@ const struct xsub_details details[] = { {"utf8::native_to_unicode", XS_utf8_native_to_unicode, NULL}, {"utf8::unicode_to_native", XS_utf8_unicode_to_native, NULL}, {"Internals::SvREADONLY", XS_Internals_SvREADONLY, "\\[$%@];$"}, + {"constant::_make_const", XS_constant__make_const, "\\[$@]"}, {"Internals::SvREFCNT", XS_Internals_SvREFCNT, "\\[$%@];$"}, {"Internals::hv_clear_placeholders", XS_Internals_hv_clear_placehold, "\\%"}, {"PerlIO::get_layers", XS_PerlIO_get_layers, "*;@"}, @@ -1377,8 +1059,7 @@ Perl_boot_core_UNIVERSAL(pTHX) dVAR; static const char file[] = __FILE__; const struct xsub_details *xsub = details; - const struct xsub_details *end - = details + sizeof(details) / sizeof(details[0]); + const struct xsub_details *end = C_ARRAY_END(details); do { newXS_flags(xsub->name, xsub->xsub, file, xsub->proto, 0); Index: gnu/usr.bin/perl/utf8.c =================================================================== RCS file: /mnt/memory/perl/importit/cvs/src/gnu/usr.bin/perl/utf8.c,v retrieving revision 1.1.1.12 diff -u -p -u -p -r1.1.1.12 utf8.c --- gnu/usr.bin/perl/utf8.c 24 Mar 2014 14:58:48 -0000 1.1.1.12 +++ gnu/usr.bin/perl/utf8.c 16 Nov 2014 03:22:24 -0000 @@ -32,14 +32,7 @@ #define PERL_IN_UTF8_C #include "perl.h" #include "inline_invlist.c" - -#ifndef EBCDIC -/* Separate prototypes needed because in ASCII systems these are - * usually macros but they still are compiled as code, too. */ -PERL_CALLCONV UV Perl_utf8n_to_uvchr(pTHX_ const U8 *s, STRLEN curlen, STRLEN *retlen, U32 flags); -PERL_CALLCONV UV Perl_valid_utf8_to_uvchr(pTHX_ const U8 *s, STRLEN *retlen); -PERL_CALLCONV U8* Perl_uvchr_to_utf8(pTHX_ U8 *d, UV uv); -#endif +#include "charclass_invlists.h" static const char unees[] = "Malformed UTF-8 character (unexpected end of string)"; @@ -48,7 +41,7 @@ static const char unees[] = =head1 Unicode Support This file contains various utility functions for manipulating UTF8-encoded -strings. For the uninitiated, this is a method of representing arbitrary +strings. For the uninitiated, this is a method of representing arbitrary Unicode characters as a variable number of bytes, in such a way that characters in the ASCII range are unmodified, and a zero byte never appears within non-zero characters. @@ -64,7 +57,9 @@ or not the string is encoded in UTF-8 (o is, if they are invariant. On ASCII-ish machines, only ASCII characters fit this definition, hence the function's name. -If C is 0, it will be calculated using C. +If C is 0, it will be calculated using C, (which means if you +use this option, that C can't have embedded C characters and has to +have a terminating C byte). See also L(), L(), and L(). @@ -88,65 +83,34 @@ Perl_is_ascii_string(const U8 *s, STRLEN } /* -=for apidoc uvuni_to_utf8_flags - -Adds the UTF-8 representation of the Unicode code point C to the end -of the string C; C should have at least C free -bytes available. The return value is the pointer to the byte after the -end of the new character. In other words, - - d = uvuni_to_utf8_flags(d, uv, flags); - -or, in most cases, - - d = uvuni_to_utf8(d, uv); - -(which is equivalent to) - - d = uvuni_to_utf8_flags(d, uv, 0); - -This is the recommended Unicode-aware way of saying - - *(d++) = uv; - -where uv is a code point expressed in Latin-1 or above, not the platform's -native character set. B -or L>. - -This function will convert to UTF-8 (and not warn) even code points that aren't -legal Unicode or are problematic, unless C contains one or more of the -following flags: - -If C is a Unicode surrogate code point and UNICODE_WARN_SURROGATE is set, -the function will raise a warning, provided UTF8 warnings are enabled. If instead -UNICODE_DISALLOW_SURROGATE is set, the function will fail and return NULL. -If both flags are set, the function will both warn and return NULL. +=for apidoc uvoffuni_to_utf8_flags -The UNICODE_WARN_NONCHAR and UNICODE_DISALLOW_NONCHAR flags correspondingly -affect how the function handles a Unicode non-character. And likewise, the -UNICODE_WARN_SUPER and UNICODE_DISALLOW_SUPER flags, affect the handling of -code points that are -above the Unicode maximum of 0x10FFFF. Code points above 0x7FFF_FFFF (which are -even less portable) can be warned and/or disallowed even if other above-Unicode -code points are accepted by the UNICODE_WARN_FE_FF and UNICODE_DISALLOW_FE_FF -flags. +THIS FUNCTION SHOULD BE USED IN ONLY VERY SPECIALIZED CIRCUMSTANCES. +Instead, B or +L>. -And finally, the flag UNICODE_WARN_ILLEGAL_INTERCHANGE selects all four of the -above WARN flags; and UNICODE_DISALLOW_ILLEGAL_INTERCHANGE selects all four -DISALLOW flags. +This function is like them, but the input is a strict Unicode +(as opposed to native) code point. Only in very rare circumstances should code +not be using the native code point. +For details, see the description for L>. =cut */ U8 * -Perl_uvuni_to_utf8_flags(pTHX_ U8 *d, UV uv, UV flags) +Perl_uvoffuni_to_utf8_flags(pTHX_ U8 *d, UV uv, UV flags) { - PERL_ARGS_ASSERT_UVUNI_TO_UTF8_FLAGS; + PERL_ARGS_ASSERT_UVOFFUNI_TO_UTF8_FLAGS; + + if (UNI_IS_INVARIANT(uv)) { + *d++ = (U8) LATIN1_TO_NATIVE(uv); + return d; + } /* The first problematic code point is the first surrogate */ if (uv >= UNICODE_SURROGATE_FIRST - && ckWARN4_d(WARN_UTF8, WARN_SURROGATE, WARN_NON_UNICODE, WARN_NONCHAR)) + && ckWARN3_d(WARN_SURROGATE, WARN_NON_UNICODE, WARN_NONCHAR)) { if (UNICODE_IS_SURROGATE(uv)) { if (flags & UNICODE_WARN_SURROGATE) { @@ -181,19 +145,16 @@ Perl_uvuni_to_utf8_flags(pTHX_ U8 *d, UV } } } - if (UNI_IS_INVARIANT(uv)) { - *d++ = (U8)UTF_TO_NATIVE(uv); - return d; - } + #if defined(EBCDIC) - else { - STRLEN len = UNISKIP(uv); + { + STRLEN len = OFFUNISKIP(uv); U8 *p = d+len-1; while (p > d) { - *p-- = (U8)UTF_TO_NATIVE((uv & UTF_CONTINUATION_MASK) | UTF_CONTINUATION_MARK); + *p-- = (U8) I8_TO_NATIVE_UTF8((uv & UTF_CONTINUATION_MASK) | UTF_CONTINUATION_MARK); uv >>= UTF_ACCUMULATION_SHIFT; } - *p = (U8)UTF_TO_NATIVE((uv & UTF_START_MASK(len)) | UTF_START_MARK(len)); + *p = (U8) I8_TO_NATIVE_UTF8((uv & UTF_START_MASK(len)) | UTF_START_MARK(len)); return d+len; } #else /* Non loop style */ @@ -232,7 +193,7 @@ Perl_uvuni_to_utf8_flags(pTHX_ U8 *d, UV *d++ = (U8)(( uv & 0x3f) | 0x80); return d; } -#ifdef HAS_QUAD +#ifdef UTF8_QUAD_MAX if (uv < UTF8_QUAD_MAX) #endif { @@ -245,7 +206,7 @@ Perl_uvuni_to_utf8_flags(pTHX_ U8 *d, UV *d++ = (U8)(( uv & 0x3f) | 0x80); return d; } -#ifdef HAS_QUAD +#ifdef UTF8_QUAD_MAX { *d++ = 0xff; /* Can't match U+FFFE! */ *d++ = 0x80; /* 6 Reserved bits */ @@ -265,12 +226,92 @@ Perl_uvuni_to_utf8_flags(pTHX_ U8 *d, UV #endif #endif /* Non loop style */ } +/* +=for apidoc uvchr_to_utf8 + +Adds the UTF-8 representation of the native code point C to the end +of the string C; C should have at least C (up to +C) free bytes available. The return value is the pointer to +the byte after the end of the new character. In other words, + + d = uvchr_to_utf8(d, uv); + +is the recommended wide native character-aware way of saying + + *(d++) = uv; + +This function accepts any UV as input. To forbid or warn on non-Unicode code +points, or those that may be problematic, see L. + +=cut +*/ + +/* This is also a macro */ +PERL_CALLCONV U8* Perl_uvchr_to_utf8(pTHX_ U8 *d, UV uv); + +U8 * +Perl_uvchr_to_utf8(pTHX_ U8 *d, UV uv) +{ + return uvchr_to_utf8(d, uv); +} + +/* +=for apidoc uvchr_to_utf8_flags + +Adds the UTF-8 representation of the native code point C to the end +of the string C; C should have at least C (up to +C) free bytes available. The return value is the pointer to +the byte after the end of the new character. In other words, + + d = uvchr_to_utf8_flags(d, uv, flags); + +or, in most cases, + + d = uvchr_to_utf8_flags(d, uv, 0); + +This is the Unicode-aware way of saying + + *(d++) = uv; + +This function will convert to UTF-8 (and not warn) even code points that aren't +legal Unicode or are problematic, unless C contains one or more of the +following flags: + +If C is a Unicode surrogate code point and UNICODE_WARN_SURROGATE is set, +the function will raise a warning, provided UTF8 warnings are enabled. If instead +UNICODE_DISALLOW_SURROGATE is set, the function will fail and return NULL. +If both flags are set, the function will both warn and return NULL. + +The UNICODE_WARN_NONCHAR and UNICODE_DISALLOW_NONCHAR flags +affect how the function handles a Unicode non-character. And likewise, the +UNICODE_WARN_SUPER and UNICODE_DISALLOW_SUPER flags affect the handling of +code points that are +above the Unicode maximum of 0x10FFFF. Code points above 0x7FFF_FFFF (which are +even less portable) can be warned and/or disallowed even if other above-Unicode +code points are accepted, by the UNICODE_WARN_FE_FF and UNICODE_DISALLOW_FE_FF +flags. + +And finally, the flag UNICODE_WARN_ILLEGAL_INTERCHANGE selects all four of the +above WARN flags; and UNICODE_DISALLOW_ILLEGAL_INTERCHANGE selects all four +DISALLOW flags. + +=cut +*/ + +/* This is also a macro */ +PERL_CALLCONV U8* Perl_uvchr_to_utf8_flags(pTHX_ U8 *d, UV uv, UV flags); + +U8 * +Perl_uvchr_to_utf8_flags(pTHX_ U8 *d, UV uv, UV flags) +{ + return uvchr_to_utf8_flags(d, uv, flags); +} /* Tests if the first C bytes of string C form a valid UTF-8 -character. Note that an INVARIANT (i.e. ASCII) character is a valid -UTF-8 character. The number of bytes in the UTF-8 character +character. Note that an INVARIANT (i.e. ASCII on non-EBCDIC) character is a +valid UTF-8 character. The number of bytes in the UTF-8 character will be returned if it is valid, otherwise 0. This is the "slow" version as opposed to the "fast" version which is @@ -293,7 +334,7 @@ S_is_utf8_char_slow(const U8 *s, const S PERL_ARGS_ASSERT_IS_UTF8_CHAR_SLOW; - utf8n_to_uvuni(s, len, &actual_len, UTF8_CHECK_ONLY); + utf8n_to_uvchr(s, len, &actual_len, UTF8_CHECK_ONLY); return (actual_len == (STRLEN) -1) ? 0 : actual_len; } @@ -328,18 +369,14 @@ Perl_is_utf8_char_buf(const U8 *buf, con len = UTF8SKIP(buf); } -#ifdef IS_UTF8_CHAR if (IS_UTF8_CHAR_FAST(len)) return IS_UTF8_CHAR(buf, len) ? len : 0; -#endif /* #ifdef IS_UTF8_CHAR */ return is_utf8_char_slow(buf, len); } /* =for apidoc is_utf8_char -DEPRECATED! - Tests if some arbitrary number of bytes begins in a valid UTF-8 character. Note that an INVARIANT (i.e. ASCII on non-EBCDIC machines) character is a valid UTF-8 character. The actual number of bytes in the UTF-8 @@ -366,9 +403,9 @@ Perl_is_utf8_char(const U8 *s) Returns true if the first C bytes of string C form a valid UTF-8 string, false otherwise. If C is 0, it will be calculated -using C (which means if you use this option, that C has to have a -terminating NUL byte). Note that all characters being ASCII constitute 'a -valid UTF-8 string'. +using C (which means if you use this option, that C can't have +embedded C characters and has to have a terminating C byte). Note +that all characters being ASCII constitute 'a valid UTF-8 string'. See also L(), L(), and L(). @@ -480,10 +517,13 @@ Perl_is_utf8_string_loclen(const U8 *s, /* -=for apidoc utf8n_to_uvuni +=for apidoc utf8n_to_uvchr + +THIS FUNCTION SHOULD BE USED IN ONLY VERY SPECIALIZED CIRCUMSTANCES. +Most code should use L() rather than call this directly. Bottom level UTF-8 decode routine. -Returns the code point value of the first character in the string C, +Returns the native code point value of the first character in the string C, which is assumed to be in UTF-8 (or UTF-EBCDIC) encoding, and no longer than C bytes; C<*retlen> (if C isn't NULL) will be set to the length, in bytes, of that character. @@ -510,11 +550,11 @@ flags) malformation is found. If this f the caller will raise a warning, and this function will silently just set C to C<-1> (cast to C) and return zero. -Note that this API requires disambiguation between successful decoding a NUL +Note that this API requires disambiguation between successful decoding a C character, and an error return (unless the UTF8_CHECK_ONLY flag is set), as in both cases, 0 is returned. To disambiguate, upon a zero return, see if the -first byte of C is 0 as well. If so, the input was a NUL; if not, the input -had an error. +first byte of C is 0 as well. If so, the input was a C; if not, the +input had an error. Certain code points are considered problematic. These are Unicode surrogates, Unicode non-characters, and code points above the Unicode maximum of 0x10FFFF. @@ -545,20 +585,19 @@ The UTF-8 encoding on ASCII platforms fo byte containing 0xFE or 0xFF. The UTF8_DISALLOW_FE_FF flag will cause them to be treated as malformations, while allowing smaller above-Unicode code points. (Of course UTF8_DISALLOW_SUPER will treat all above-Unicode code points, -including these, as malformations.) Similarly, UTF8_WARN_FE_FF acts just like +including these, as malformations.) +Similarly, UTF8_WARN_FE_FF acts just like the other WARN flags, but applies just to these code points. All other code points corresponding to Unicode characters, including private use and those yet to be assigned, are never considered malformed and never warn. -Most code should use L() rather than call this directly. - =cut */ UV -Perl_utf8n_to_uvuni(pTHX_ const U8 *s, STRLEN curlen, STRLEN *retlen, U32 flags) +Perl_utf8n_to_uvchr(pTHX_ const U8 *s, STRLEN curlen, STRLEN *retlen, U32 flags) { dVAR; const U8 * const s0 = s; @@ -576,7 +615,7 @@ Perl_utf8n_to_uvuni(pTHX_ const U8 *s, S const char* const malformed_text = "Malformed UTF-8 character"; - PERL_ARGS_ASSERT_UTF8N_TO_UVUNI; + PERL_ARGS_ASSERT_UTF8N_TO_UVCHR; /* The order of malformation tests here is important. We should consume as * few bytes as possible in order to not skip any valid character. This is @@ -593,7 +632,7 @@ Perl_utf8n_to_uvuni(pTHX_ const U8 *s, S * We also should not consume too few bytes, otherwise someone could inject * things. For example, an input could be deliberately designed to * overflow, and if this code bailed out immediately upon discovering that, - * returning to the caller *retlen pointing to the very next byte (one + * returning to the caller C<*retlen> pointing to the very next byte (one * which is actually part of of the overflowing sequence), that could look * legitimate to the caller, which could discard the initial partial * sequence and process the rest, inappropriately */ @@ -625,7 +664,7 @@ Perl_utf8n_to_uvuni(pTHX_ const U8 *s, S /* An invariant is trivially well-formed */ if (UTF8_IS_INVARIANT(uv)) { - return (UV) (NATIVE_TO_UTF(*s)); + return uv; } /* A continuation character can't start a valid sequence */ @@ -644,13 +683,13 @@ Perl_utf8n_to_uvuni(pTHX_ const U8 *s, S goto malformed; } -#ifdef EBCDIC - uv = NATIVE_TO_UTF(uv); -#endif - /* Here is not a continuation byte, nor an invariant. The only thing left * is a start byte (possibly for an overlong) */ +#ifdef EBCDIC + uv = NATIVE_UTF8_TO_I8(uv); +#endif + /* Remove the leading bits that indicate the number of bytes in the * character's whole UTF-8 sequence, leaving just the bits that are part of * the value */ @@ -742,39 +781,15 @@ Perl_utf8n_to_uvuni(pTHX_ const U8 *s, S } } -#ifndef EBCDIC /* EBCDIC allows FE, FF, can't overflow */ - if ((*s0 & 0xFE) == 0xFE /* matches both FE, FF */ - && (flags & (UTF8_WARN_FE_FF|UTF8_DISALLOW_FE_FF))) - { - /* By adding UTF8_CHECK_ONLY to the test, we avoid unnecessary - * generation of the sv, since no warnings are raised under CHECK */ - if ((flags & (UTF8_WARN_FE_FF|UTF8_CHECK_ONLY)) == UTF8_WARN_FE_FF - && ckWARN_d(WARN_UTF8)) - { - /* This message is deliberately not of the same syntax as the other - * messages for malformations, for backwards compatibility in the - * unlikely event that code is relying on its precise earlier text - */ - sv = sv_2mortal(Perl_newSVpvf(aTHX_ "%s Code point beginning with byte 0x%02X is not Unicode, and not portable", malformed_text, *s0)); - pack_warn = packWARN(WARN_UTF8); - } - if (flags & UTF8_DISALLOW_FE_FF) { - goto malformed; - } - } +#ifndef EBCDIC /* EBCDIC can't overflow */ if (UNLIKELY(overflowed)) { - - /* If the first byte is FF, it will overflow a 32-bit word. If the - * first byte is FE, it will overflow a signed 32-bit word. The - * above preserves backward compatibility, since its message was used - * in earlier versions of this code in preference to overflow */ sv = sv_2mortal(Perl_newSVpvf(aTHX_ "%s (overflow at byte 0x%02x, after start byte 0x%02x)", malformed_text, overflow_byte, *s0)); goto malformed; } #endif if (do_overlong_test - && expectlen > (STRLEN)UNISKIP(uv) + && expectlen > (STRLEN) OFFUNISKIP(uv) && ! (flags & UTF8_ALLOW_LONG)) { /* The overlong malformation has lower precedence than the others. @@ -782,23 +797,26 @@ Perl_utf8n_to_uvuni(pTHX_ const U8 *s, S * value, instead of the replacement character. This is because this * value is actually well-defined. */ if (! (flags & UTF8_CHECK_ONLY)) { - sv = sv_2mortal(Perl_newSVpvf(aTHX_ "%s (%d byte%s, need %d, after start byte 0x%02x)", malformed_text, (int)expectlen, expectlen == 1 ? "": "s", UNISKIP(uv), *s0)); + sv = sv_2mortal(Perl_newSVpvf(aTHX_ "%s (%d byte%s, need %d, after start byte 0x%02x)", malformed_text, (int)expectlen, expectlen == 1 ? "": "s", OFFUNISKIP(uv), *s0)); } goto malformed; } - /* Here, the input is considered to be well-formed , but could be a + /* Here, the input is considered to be well-formed, but it still could be a * problematic code point that is not allowed by the input parameters. */ if (uv >= UNICODE_SURROGATE_FIRST /* isn't problematic if < this */ && (flags & (UTF8_DISALLOW_ILLEGAL_INTERCHANGE |UTF8_WARN_ILLEGAL_INTERCHANGE))) { if (UNICODE_IS_SURROGATE(uv)) { + + /* By adding UTF8_CHECK_ONLY to the test, we avoid unnecessary + * generation of the sv, since no warnings are raised under CHECK */ if ((flags & (UTF8_WARN_SURROGATE|UTF8_CHECK_ONLY)) == UTF8_WARN_SURROGATE - && ckWARN2_d(WARN_UTF8, WARN_SURROGATE)) + && ckWARN_d(WARN_SURROGATE)) { sv = sv_2mortal(Perl_newSVpvf(aTHX_ "UTF-16 surrogate U+%04"UVXf"", uv)); - pack_warn = packWARN2(WARN_UTF8, WARN_SURROGATE); + pack_warn = packWARN(WARN_SURROGATE); } if (flags & UTF8_DISALLOW_SURROGATE) { goto disallowed; @@ -806,21 +824,42 @@ Perl_utf8n_to_uvuni(pTHX_ const U8 *s, S } else if ((uv > PERL_UNICODE_MAX)) { if ((flags & (UTF8_WARN_SUPER|UTF8_CHECK_ONLY)) == UTF8_WARN_SUPER - && ckWARN2_d(WARN_UTF8, WARN_NON_UNICODE)) + && ckWARN_d(WARN_NON_UNICODE)) { sv = sv_2mortal(Perl_newSVpvf(aTHX_ "Code point 0x%04"UVXf" is not Unicode, may not be portable", uv)); - pack_warn = packWARN2(WARN_UTF8, WARN_NON_UNICODE); + pack_warn = packWARN(WARN_NON_UNICODE); } +#ifndef EBCDIC /* EBCDIC always allows FE, FF */ + + /* The first byte being 0xFE or 0xFF is a subset of the SUPER code + * points. We test for these after the regular SUPER ones, and + * before possibly bailing out, so that the more dire warning + * overrides the regular one, if applicable */ + if ((*s0 & 0xFE) == 0xFE /* matches both FE, FF */ + && (flags & (UTF8_WARN_FE_FF|UTF8_DISALLOW_FE_FF))) + { + if ((flags & (UTF8_WARN_FE_FF|UTF8_CHECK_ONLY)) + == UTF8_WARN_FE_FF + && ckWARN_d(WARN_UTF8)) + { + sv = sv_2mortal(Perl_newSVpvf(aTHX_ "Code point 0x%"UVXf" is not Unicode, and not portable", uv)); + pack_warn = packWARN(WARN_UTF8); + } + if (flags & UTF8_DISALLOW_FE_FF) { + goto disallowed; + } + } +#endif if (flags & UTF8_DISALLOW_SUPER) { goto disallowed; } } else if (UNICODE_IS_NONCHAR(uv)) { if ((flags & (UTF8_WARN_NONCHAR|UTF8_CHECK_ONLY)) == UTF8_WARN_NONCHAR - && ckWARN2_d(WARN_UTF8, WARN_NONCHAR)) + && ckWARN_d(WARN_NONCHAR)) { sv = sv_2mortal(Perl_newSVpvf(aTHX_ "Unicode non-character U+%04"UVXf" is illegal for open interchange", uv)); - pack_warn = packWARN2(WARN_UTF8, WARN_NONCHAR); + pack_warn = packWARN(WARN_NONCHAR); } if (flags & UTF8_DISALLOW_NONCHAR) { goto disallowed; @@ -828,7 +867,9 @@ Perl_utf8n_to_uvuni(pTHX_ const U8 *s, S } if (sv) { - outlier_ret = uv; + outlier_ret = uv; /* Note we don't bother to convert to native, + as all the outlier code points are the same + in both ASCII and EBCDIC */ goto do_warn; } @@ -836,7 +877,7 @@ Perl_utf8n_to_uvuni(pTHX_ const U8 *s, S * to return it */ } - return uv; + return UNI_TO_NATIVE(uv); /* There are three cases which get to beyond this point. In all 3 cases: * if not null points to a string to print as a warning. @@ -910,7 +951,7 @@ NULL) to -1. If those warnings are off, (or the Unicode REPLACEMENT CHARACTER if not), is silently returned, and C<*retlen> is set (if C isn't NULL) so that (S + C<*retlen>>) is the next possible position in C that could begin a non-malformed character. -See L for details on when the REPLACEMENT CHARACTER is +See L for details on when the REPLACEMENT CHARACTER is returned. =cut @@ -920,8 +961,6 @@ returned. UV Perl_utf8_to_uvchr_buf(pTHX_ const U8 *s, const U8 *send, STRLEN *retlen) { - PERL_ARGS_ASSERT_UTF8_TO_UVCHR_BUF; - assert(s < send); return utf8n_to_uvchr(s, send - s, retlen, @@ -930,24 +969,48 @@ Perl_utf8_to_uvchr_buf(pTHX_ const U8 *s /* Like L(), but should only be called when it is known that * there are no malformations in the input UTF-8 string C. surrogates, - * non-character code points, and non-Unicode code points are allowed. A macro - * in utf8.h is used to normally avoid this function wrapper */ + * non-character code points, and non-Unicode code points are allowed. */ UV Perl_valid_utf8_to_uvchr(pTHX_ const U8 *s, STRLEN *retlen) { - const UV uv = valid_utf8_to_uvuni(s, retlen); + UV expectlen = UTF8SKIP(s); + const U8* send = s + expectlen; + UV uv = *s; PERL_ARGS_ASSERT_VALID_UTF8_TO_UVCHR; + if (retlen) { + *retlen = expectlen; + } + + /* An invariant is trivially returned */ + if (expectlen == 1) { + return uv; + } + +#ifdef EBCDIC + uv = NATIVE_UTF8_TO_I8(uv); +#endif + + /* Remove the leading bits that indicate the number of bytes, leaving just + * the bits that are part of the value */ + uv &= UTF_START_MASK(expectlen); + + /* Now, loop through the remaining bytes, accumulating each into the + * working total as we go. (I khw tried unrolling the loop for up to 4 + * bytes, but there was no performance improvement) */ + for (++s; s < send; s++) { + uv = UTF8_ACCUMULATE(uv, *s); + } + return UNI_TO_NATIVE(uv); + } /* =for apidoc utf8_to_uvchr -DEPRECATED! - Returns the native code point of the first character in the string C which is assumed to be in UTF-8 encoding; C will be set to the length, in bytes, of that character. @@ -962,7 +1025,7 @@ NULL) to -1. If those warnings are off, the Unicode REPLACEMENT CHARACTER, if not) is silently returned, and C<*retlen> is set (if C isn't NULL) so that (S + C<*retlen>>) is the next possible position in C that could begin a non-malformed character. -See L for details on when the REPLACEMENT CHARACTER is returned. +See L for details on when the REPLACEMENT CHARACTER is returned. =cut */ @@ -978,20 +1041,22 @@ Perl_utf8_to_uvchr(pTHX_ const U8 *s, ST /* =for apidoc utf8_to_uvuni_buf -Returns the Unicode code point of the first character in the string C which +Only in very rare circumstances should code need to be dealing in Unicode +(as opposed to native) code points. In those few cases, use +C> instead. + +Returns the Unicode (not-native) code point of the first character in the +string C which is assumed to be in UTF-8 encoding; C points to 1 beyond the end of C. C will be set to the length, in bytes, of that character. -This function should only be used when the returned UV is considered -an index into the Unicode semantic tables (e.g. swashes). - If C does not point to a well-formed UTF-8 character and UTF8 warnings are enabled, zero is returned and C<*retlen> is set (if C isn't NULL) to -1. If those warnings are off, the computed value if well-defined (or the Unicode REPLACEMENT CHARACTER, if not) is silently returned, and C<*retlen> is set (if C isn't NULL) so that (S + C<*retlen>>) is the next possible position in C that could begin a non-malformed character. -See L for details on when the REPLACEMENT CHARACTER is returned. +See L for details on when the REPLACEMENT CHARACTER is returned. =cut */ @@ -1004,61 +1069,35 @@ Perl_utf8_to_uvuni_buf(pTHX_ const U8 *s assert(send > s); /* Call the low level routine asking for checks */ - return Perl_utf8n_to_uvuni(aTHX_ s, send -s, retlen, - ckWARN_d(WARN_UTF8) ? 0 : UTF8_ALLOW_ANY); + return NATIVE_TO_UNI(Perl_utf8n_to_uvchr(aTHX_ s, send -s, retlen, + ckWARN_d(WARN_UTF8) ? 0 : UTF8_ALLOW_ANY)); } -/* Like L(), but should only be called when it is known that +/* DEPRECATED! + * Like L(), but should only be called when it is known that * there are no malformations in the input UTF-8 string C. Surrogates, * non-character code points, and non-Unicode code points are allowed */ UV Perl_valid_utf8_to_uvuni(pTHX_ const U8 *s, STRLEN *retlen) { - UV expectlen = UTF8SKIP(s); - const U8* send = s + expectlen; - UV uv = NATIVE_TO_UTF(*s); - PERL_ARGS_ASSERT_VALID_UTF8_TO_UVUNI; - if (retlen) { - *retlen = expectlen; - } - - /* An invariant is trivially returned */ - if (expectlen == 1) { - return uv; - } - - /* Remove the leading bits that indicate the number of bytes, leaving just - * the bits that are part of the value */ - uv &= UTF_START_MASK(expectlen); - - /* Now, loop through the remaining bytes, accumulating each into the - * working total as we go. (I khw tried unrolling the loop for up to 4 - * bytes, but there was no performance improvement) */ - for (++s; s < send; s++) { - uv = UTF8_ACCUMULATE(uv, *s); - } - - return uv; + return NATIVE_TO_UNI(valid_utf8_to_uvchr(s, retlen)); } /* =for apidoc utf8_to_uvuni -DEPRECATED! - Returns the Unicode code point of the first character in the string C which is assumed to be in UTF-8 encoding; C will be set to the length, in bytes, of that character. -This function should only be used when the returned UV is considered -an index into the Unicode semantic tables (e.g. swashes). - Some, but not all, UTF-8 malformations are detected, and in fact, some malformed input could cause reading beyond the end of the input buffer, which -is why this function is deprecated. Use L instead. +is one reason why this function is deprecated. The other is that only in +extremely limited circumstances should the Unicode versus native code point be +of any interest to you. See L for alternatives. If C points to one of the detected malformations, and UTF8 warnings are enabled, zero is returned and C<*retlen> is set (if C doesn't point to @@ -1066,7 +1105,7 @@ NULL) to -1. If those warnings are off, the Unicode REPLACEMENT CHARACTER, if not) is silently returned, and C<*retlen> is set (if C isn't NULL) so that (S + C<*retlen>>) is the next possible position in C that could begin a non-malformed character. -See L for details on when the REPLACEMENT CHARACTER is returned. +See L for details on when the REPLACEMENT CHARACTER is returned. =cut */ @@ -1076,7 +1115,7 @@ Perl_utf8_to_uvuni(pTHX_ const U8 *s, ST { PERL_ARGS_ASSERT_UTF8_TO_UVUNI; - return valid_utf8_to_uvuni(s, retlen); + return NATIVE_TO_UNI(valid_utf8_to_uvchr(s, retlen)); } /* @@ -1182,12 +1221,14 @@ Perl_utf8_hop(pTHX_ const U8 *s, I32 off =for apidoc bytes_cmp_utf8 Compares the sequence of characters (stored as octets) in C, C with the -sequence of characters (stored as UTF-8) in C, C. Returns 0 if they are +sequence of characters (stored as UTF-8) +in C, C. Returns 0 if they are equal, -1 or -2 if the first string is less than the second string, +1 or +2 if the first string is greater than the second string. -1 or +1 is returned if the shorter string was identical to the start of the -longer string. -2 or +2 is returned if the was a difference between characters +longer string. -2 or +2 is returned if +there was a difference between characters within the strings. =cut @@ -1210,7 +1251,7 @@ Perl_bytes_cmp_utf8(pTHX_ const U8 *b, S if (u < uend) { U8 c1 = *u++; if (UTF8_IS_CONTINUATION(c1)) { - c = UNI_TO_NATIVE(TWO_BYTE_UTF8_TO_UNI(c, c1)); + c = TWO_BYTE_UTF8_TO_NATIVE(c, c1); } else { Perl_ck_warner_d(aTHX_ packWARN(WARN_UTF8), "Malformed UTF-8 character " @@ -1270,21 +1311,25 @@ Perl_utf8_to_bytes(pTHX_ U8 *s, STRLEN * /* ensure valid UTF-8 and chars < 256 before updating string */ while (s < send) { - U8 c = *s++; - - if (!UTF8_IS_INVARIANT(c) && - (!UTF8_IS_DOWNGRADEABLE_START(c) || (s >= send) - || !(c = *s++) || !UTF8_IS_CONTINUATION(c))) { - *len = ((STRLEN) -1); - return 0; + if (! UTF8_IS_INVARIANT(*s)) { + if (! UTF8_IS_NEXT_CHAR_DOWNGRADEABLE(s, send)) { + *len = ((STRLEN) -1); + return 0; + } + s++; } + s++; } d = s = save; while (s < send) { - STRLEN ulen; - *d++ = (U8)utf8_to_uvchr_buf(s, send, &ulen); - s += ulen; + U8 c = *s++; + if (! UTF8_IS_INVARIANT(c)) { + /* Then it is two-byte encoded */ + c = TWO_BYTE_UTF8_TO_NATIVE(c, *s); + s++; + } + *d++ = c; } *d = '\0'; *len = d - save; @@ -1298,7 +1343,7 @@ Converts a string C of length C Unlike L but like L, returns a pointer to the newly-created string, and updates C to contain the new length. Returns the original string if no conversion occurs, C -is unchanged. Do nothing if C points to 0. Sets C to +is unchanged. Do nothing if C points to 0. Sets C to 0 if C is converted or consisted entirely of characters that are invariant in utf8 (i.e., US-ASCII on non-EBCDIC machines). @@ -1321,14 +1366,14 @@ Perl_bytes_from_utf8(pTHX_ const U8 *s, /* ensure valid UTF-8 and chars < 256 before converting string */ for (send = s + *len; s < send;) { - U8 c = *s++; - if (!UTF8_IS_INVARIANT(c)) { - if (UTF8_IS_DOWNGRADEABLE_START(c) && s < send && - (c = *s++) && UTF8_IS_CONTINUATION(c)) - count++; - else + if (! UTF8_IS_INVARIANT(*s)) { + if (! UTF8_IS_NEXT_CHAR_DOWNGRADEABLE(s, send)) { return (U8 *)start; + } + count++; + s++; } + s++; } *is_utf8 = FALSE; @@ -1337,9 +1382,10 @@ Perl_bytes_from_utf8(pTHX_ const U8 *s, s = start; start = d; while (s < send) { U8 c = *s++; - if (!UTF8_IS_INVARIANT(c)) { + if (! UTF8_IS_INVARIANT(c)) { /* Then it is two-byte encoded */ - c = UNI_TO_NATIVE(TWO_BYTE_UTF8_TO_UNI(c, *s++)); + c = TWO_BYTE_UTF8_TO_NATIVE(c, *s); + s++; } *d++ = c; } @@ -1356,7 +1402,7 @@ UTF-8. Returns a pointer to the newly-created string, and sets C to reflect the new length in bytes. -A NUL character will be written after the end of the string. +A C character will be written after the end of the string. If you want to convert to UTF-8 from encodings other than the native (Latin1 or EBCDIC), @@ -1382,13 +1428,8 @@ Perl_bytes_to_utf8(pTHX_ const U8 *s, ST dst = d; while (s < send) { - const UV uv = NATIVE_TO_ASCII(*s++); - if (UNI_IS_INVARIANT(uv)) - *d++ = (U8)UTF_TO_NATIVE(uv); - else { - *d++ = (U8)UTF8_EIGHT_BIT_HI(uv); - *d++ = (U8)UTF8_EIGHT_BIT_LO(uv); - } + append_utf8_from_native_byte(*s, &d); + s++; } *d = '\0'; *len = d-dst; @@ -1417,32 +1458,36 @@ Perl_utf16_to_utf8(pTHX_ U8* p, U8* d, I while (p < pend) { UV uv = (p[0] << 8) + p[1]; /* UTF-16BE */ p += 2; - if (uv < 0x80) { -#ifdef EBCDIC - *d++ = UNI_TO_NATIVE(uv); -#else - *d++ = (U8)uv; -#endif + if (UNI_IS_INVARIANT(uv)) { + *d++ = LATIN1_TO_NATIVE((U8) uv); continue; } - if (uv < 0x800) { - *d++ = (U8)(( uv >> 6) | 0xc0); - *d++ = (U8)(( uv & 0x3f) | 0x80); + if (uv <= MAX_UTF8_TWO_BYTE) { + *d++ = UTF8_TWO_BYTE_HI(UNI_TO_NATIVE(uv)); + *d++ = UTF8_TWO_BYTE_LO(UNI_TO_NATIVE(uv)); continue; } - if (uv >= 0xd800 && uv <= 0xdbff) { /* surrogates */ +#define FIRST_HIGH_SURROGATE UNICODE_SURROGATE_FIRST +#define LAST_HIGH_SURROGATE 0xDBFF +#define FIRST_LOW_SURROGATE 0xDC00 +#define LAST_LOW_SURROGATE UNICODE_SURROGATE_LAST + if (uv >= FIRST_HIGH_SURROGATE && uv <= LAST_HIGH_SURROGATE) { if (p >= pend) { Perl_croak(aTHX_ "Malformed UTF-16 surrogate"); } else { UV low = (p[0] << 8) + p[1]; p += 2; - if (low < 0xdc00 || low > 0xdfff) + if (low < FIRST_LOW_SURROGATE || low > LAST_LOW_SURROGATE) Perl_croak(aTHX_ "Malformed UTF-16 surrogate"); - uv = ((uv - 0xd800) << 10) + (low - 0xdc00) + 0x10000; + uv = ((uv - FIRST_HIGH_SURROGATE) << 10) + + (low - FIRST_LOW_SURROGATE) + 0x10000; } - } else if (uv >= 0xdc00 && uv <= 0xdfff) { + } else if (uv >= FIRST_LOW_SURROGATE && uv <= LAST_LOW_SURROGATE) { Perl_croak(aTHX_ "Malformed UTF-16 surrogate"); } +#ifdef EBCDIC + d = uvoffuni_to_utf8_flags(d, uv, 0); +#else if (uv < 0x10000) { *d++ = (U8)(( uv >> 12) | 0xe0); *d++ = (U8)(((uv >> 6) & 0x3f) | 0x80); @@ -1456,6 +1501,7 @@ Perl_utf16_to_utf8(pTHX_ U8* p, U8* d, I *d++ = (U8)(( uv & 0x3f) | 0x80); continue; } +#endif } *newlen = d - dstart; return d; @@ -1492,26 +1538,6 @@ Perl__is_uni_FOO(pTHX_ const U8 classnum return _is_utf8_FOO(classnum, tmpbuf); } -/* for now these are all defined (inefficiently) in terms of the utf8 versions. - * Note that the macros in handy.h that call these short-circuit calling them - * for Latin-1 range inputs */ - -bool -Perl_is_uni_alnum(pTHX_ UV c) -{ - U8 tmpbuf[UTF8_MAXBYTES+1]; - uvchr_to_utf8(tmpbuf, c); - return _is_utf8_FOO(_CC_WORDCHAR, tmpbuf); -} - -bool -Perl_is_uni_alnumc(pTHX_ UV c) -{ - U8 tmpbuf[UTF8_MAXBYTES+1]; - uvchr_to_utf8(tmpbuf, c); - return _is_utf8_FOO(_CC_ALPHANUMERIC, tmpbuf); -} - /* Internal function so we can deprecate the external one, and call this one from other deprecated functions in this file */ @@ -1523,7 +1549,7 @@ S_is_utf8_idfirst(pTHX_ const U8 *p) if (*p == '_') return TRUE; /* is_utf8_idstart would be more logical. */ - return is_utf8_common(p, &PL_utf8_idstart, "IdStart"); + return is_utf8_common(p, &PL_utf8_idstart, "IdStart", NULL); } bool @@ -1550,113 +1576,27 @@ Perl__is_uni_perl_idstart(pTHX_ UV c) return _is_utf8_perl_idstart(tmpbuf); } -bool -Perl_is_uni_alpha(pTHX_ UV c) -{ - U8 tmpbuf[UTF8_MAXBYTES+1]; - uvchr_to_utf8(tmpbuf, c); - return _is_utf8_FOO(_CC_ALPHA, tmpbuf); -} - -bool -Perl_is_uni_ascii(pTHX_ UV c) +UV +Perl__to_upper_title_latin1(pTHX_ const U8 c, U8* p, STRLEN *lenp, const char S_or_s) { - return isASCII(c); -} + /* We have the latin1-range values compiled into the core, so just use + * those, converting the result to utf8. The only difference between upper + * and title case in this range is that LATIN_SMALL_LETTER_SHARP_S is + * either "SS" or "Ss". Which one to use is passed into the routine in + * 'S_or_s' to avoid a test */ -bool -Perl_is_uni_blank(pTHX_ UV c) -{ - return isBLANK_uni(c); -} + UV converted = toUPPER_LATIN1_MOD(c); -bool -Perl_is_uni_space(pTHX_ UV c) -{ - return isSPACE_uni(c); -} + PERL_ARGS_ASSERT__TO_UPPER_TITLE_LATIN1; -bool -Perl_is_uni_digit(pTHX_ UV c) -{ - U8 tmpbuf[UTF8_MAXBYTES+1]; - uvchr_to_utf8(tmpbuf, c); - return _is_utf8_FOO(_CC_DIGIT, tmpbuf); -} + assert(S_or_s == 'S' || S_or_s == 's'); -bool -Perl_is_uni_upper(pTHX_ UV c) -{ - U8 tmpbuf[UTF8_MAXBYTES+1]; - uvchr_to_utf8(tmpbuf, c); - return _is_utf8_FOO(_CC_UPPER, tmpbuf); -} - -bool -Perl_is_uni_lower(pTHX_ UV c) -{ - U8 tmpbuf[UTF8_MAXBYTES+1]; - uvchr_to_utf8(tmpbuf, c); - return _is_utf8_FOO(_CC_LOWER, tmpbuf); -} - -bool -Perl_is_uni_cntrl(pTHX_ UV c) -{ - return isCNTRL_L1(c); -} - -bool -Perl_is_uni_graph(pTHX_ UV c) -{ - U8 tmpbuf[UTF8_MAXBYTES+1]; - uvchr_to_utf8(tmpbuf, c); - return _is_utf8_FOO(_CC_GRAPH, tmpbuf); -} - -bool -Perl_is_uni_print(pTHX_ UV c) -{ - U8 tmpbuf[UTF8_MAXBYTES+1]; - uvchr_to_utf8(tmpbuf, c); - return _is_utf8_FOO(_CC_PRINT, tmpbuf); -} - -bool -Perl_is_uni_punct(pTHX_ UV c) -{ - U8 tmpbuf[UTF8_MAXBYTES+1]; - uvchr_to_utf8(tmpbuf, c); - return _is_utf8_FOO(_CC_PUNCT, tmpbuf); -} - -bool -Perl_is_uni_xdigit(pTHX_ UV c) -{ - return isXDIGIT_uni(c); -} - -UV -Perl__to_upper_title_latin1(pTHX_ const U8 c, U8* p, STRLEN *lenp, const char S_or_s) -{ - /* We have the latin1-range values compiled into the core, so just use - * those, converting the result to utf8. The only difference between upper - * and title case in this range is that LATIN_SMALL_LETTER_SHARP_S is - * either "SS" or "Ss". Which one to use is passed into the routine in - * 'S_or_s' to avoid a test */ - - UV converted = toUPPER_LATIN1_MOD(c); - - PERL_ARGS_ASSERT__TO_UPPER_TITLE_LATIN1; - - assert(S_or_s == 'S' || S_or_s == 's'); - - if (UNI_IS_INVARIANT(converted)) { /* No difference between the two for - characters in this range */ - *p = (U8) converted; - *lenp = 1; - return converted; - } + if (UVCHR_IS_INVARIANT(converted)) { /* No difference between the two for + characters in this range */ + *p = (U8) converted; + *lenp = 1; + return converted; + } /* toUPPER_LATIN1_MOD gives the correct results except for three outliers, * which it maps to one of them, so as to only have to have one check for @@ -1695,14 +1635,14 @@ Perl__to_upper_title_latin1(pTHX_ const * LENP will be set to the length in bytes of the string of changed characters * * The functions return the ordinal of the first character in the string of OUTP */ -#define CALL_UPPER_CASE(INP, OUTP, LENP) Perl_to_utf8_case(aTHX_ INP, OUTP, LENP, &PL_utf8_toupper, "ToUc", "utf8::ToSpecUc") -#define CALL_TITLE_CASE(INP, OUTP, LENP) Perl_to_utf8_case(aTHX_ INP, OUTP, LENP, &PL_utf8_totitle, "ToTc", "utf8::ToSpecTc") -#define CALL_LOWER_CASE(INP, OUTP, LENP) Perl_to_utf8_case(aTHX_ INP, OUTP, LENP, &PL_utf8_tolower, "ToLc", "utf8::ToSpecLc") +#define CALL_UPPER_CASE(INP, OUTP, LENP) Perl_to_utf8_case(aTHX_ INP, OUTP, LENP, &PL_utf8_toupper, "ToUc", "") +#define CALL_TITLE_CASE(INP, OUTP, LENP) Perl_to_utf8_case(aTHX_ INP, OUTP, LENP, &PL_utf8_totitle, "ToTc", "") +#define CALL_LOWER_CASE(INP, OUTP, LENP) Perl_to_utf8_case(aTHX_ INP, OUTP, LENP, &PL_utf8_tolower, "ToLc", "") /* This additionally has the input parameter SPECIALS, which if non-zero will * cause this to use the SPECIALS hash for folding (meaning get full case * folding); otherwise, when zero, this implies a simple case fold */ -#define CALL_FOLD_CASE(INP, OUTP, LENP, SPECIALS) Perl_to_utf8_case(aTHX_ INP, OUTP, LENP, &PL_utf8_tofold, "ToCf", (SPECIALS) ? "utf8::ToSpecCf" : NULL) +#define CALL_FOLD_CASE(INP, OUTP, LENP, SPECIALS) Perl_to_utf8_case(aTHX_ INP, OUTP, LENP, &PL_utf8_tofold, "ToCf", (SPECIALS) ? "" : NULL) UV Perl_to_uni_upper(pTHX_ UV c, U8* p, STRLEN *lenp) @@ -1752,7 +1692,7 @@ S_to_lower_latin1(pTHX_ const U8 c, U8* U8 converted = toLOWER_LATIN1(c); if (p != NULL) { - if (UNI_IS_INVARIANT(converted)) { + if (NATIVE_BYTE_IS_INVARIANT(converted)) { *p = converted; *lenp = 1; } @@ -1781,30 +1721,48 @@ Perl_to_uni_lower(pTHX_ UV c, U8* p, STR } UV -Perl__to_fold_latin1(pTHX_ const U8 c, U8* p, STRLEN *lenp, const bool flags) +Perl__to_fold_latin1(pTHX_ const U8 c, U8* p, STRLEN *lenp, const unsigned int flags) { - /* Corresponds to to_lower_latin1(), is TRUE if to use full case - * folding */ + /* Corresponds to to_lower_latin1(); bits meanings: + * FOLD_FLAGS_NOMIX_ASCII iff non-ASCII to ASCII folds are prohibited + * FOLD_FLAGS_FULL iff full folding is to be used; + * + * Not to be used for locale folds + */ UV converted; PERL_ARGS_ASSERT__TO_FOLD_LATIN1; + assert (! (flags & FOLD_FLAGS_LOCALE)); + if (c == MICRO_SIGN) { converted = GREEK_SMALL_LETTER_MU; } - else if (flags && c == LATIN_SMALL_LETTER_SHARP_S) { - *(p)++ = 's'; - *p = 's'; - *lenp = 2; - return 's'; + else if ((flags & FOLD_FLAGS_FULL) && c == LATIN_SMALL_LETTER_SHARP_S) { + + /* If can't cross 127/128 boundary, can't return "ss"; instead return + * two U+017F characters, as fc("\df") should eq fc("\x{17f}\x{17f}") + * under those circumstances. */ + if (flags & FOLD_FLAGS_NOMIX_ASCII) { + *lenp = 2 * sizeof(LATIN_SMALL_LETTER_LONG_S_UTF8) - 2; + Copy(LATIN_SMALL_LETTER_LONG_S_UTF8 LATIN_SMALL_LETTER_LONG_S_UTF8, + p, *lenp, U8); + return LATIN_SMALL_LETTER_LONG_S; + } + else { + *(p)++ = 's'; + *p = 's'; + *lenp = 2; + return 's'; + } } else { /* In this range the fold of all other characters is their lower case */ converted = toLOWER_LATIN1(c); } - if (UNI_IS_INVARIANT(converted)) { + if (UVCHR_IS_INVARIANT(converted)) { *p = (U8) converted; *lenp = 1; } @@ -1818,509 +1776,183 @@ Perl__to_fold_latin1(pTHX_ const U8 c, U } UV -Perl__to_uni_fold_flags(pTHX_ UV c, U8* p, STRLEN *lenp, const U8 flags) +Perl__to_uni_fold_flags(pTHX_ UV c, U8* p, STRLEN *lenp, U8 flags) { /* Not currently externally documented, and subject to change * bits meanings: * FOLD_FLAGS_FULL iff full folding is to be used; - * FOLD_FLAGS_LOCALE iff in locale - * FOLD_FLAGS_NOMIX_ASCII iff non-ASCII to ASCII folds are prohibited - */ - - PERL_ARGS_ASSERT__TO_UNI_FOLD_FLAGS; - - if (c < 256) { - UV result = _to_fold_latin1((U8) c, p, lenp, - cBOOL(((flags & FOLD_FLAGS_FULL) - /* If ASCII-safe, don't allow full folding, - * as that could include SHARP S => ss; - * otherwise there is no crossing of - * ascii/non-ascii in the latin1 range */ - && ! (flags & FOLD_FLAGS_NOMIX_ASCII)))); - /* It is illegal for the fold to cross the 255/256 boundary under - * locale; in this case return the original */ - return (result > 256 && flags & FOLD_FLAGS_LOCALE) - ? c - : result; - } - - /* If no special needs, just use the macro */ - if ( ! (flags & (FOLD_FLAGS_LOCALE|FOLD_FLAGS_NOMIX_ASCII))) { - uvchr_to_utf8(p, c); - return CALL_FOLD_CASE(p, p, lenp, flags & FOLD_FLAGS_FULL); - } - else { /* Otherwise, _to_utf8_fold_flags has the intelligence to deal with - the special flags. */ - U8 utf8_c[UTF8_MAXBYTES + 1]; - uvchr_to_utf8(utf8_c, c); - return _to_utf8_fold_flags(utf8_c, p, lenp, flags, NULL); - } -} - -bool -Perl_is_uni_alnum_lc(pTHX_ UV c) -{ - if (c < 256) { - return isALNUM_LC(UNI_TO_NATIVE(c)); - } - return _is_uni_FOO(_CC_WORDCHAR, c); -} - -bool -Perl_is_uni_alnumc_lc(pTHX_ UV c) -{ - if (c < 256) { - return isALPHANUMERIC_LC(UNI_TO_NATIVE(c)); - } - return _is_uni_FOO(_CC_ALPHANUMERIC, c); -} - -bool -Perl_is_uni_idfirst_lc(pTHX_ UV c) -{ - if (c < 256) { - return isIDFIRST_LC(UNI_TO_NATIVE(c)); - } - return _is_uni_perl_idstart(c); -} - -bool -Perl_is_uni_alpha_lc(pTHX_ UV c) -{ - if (c < 256) { - return isALPHA_LC(UNI_TO_NATIVE(c)); - } - return _is_uni_FOO(_CC_ALPHA, c); -} - -bool -Perl_is_uni_ascii_lc(pTHX_ UV c) -{ - if (c < 256) { - return isASCII_LC(UNI_TO_NATIVE(c)); - } - return 0; -} - -bool -Perl_is_uni_blank_lc(pTHX_ UV c) -{ - if (c < 256) { - return isBLANK_LC(UNI_TO_NATIVE(c)); - } - return isBLANK_uni(c); -} - -bool -Perl_is_uni_space_lc(pTHX_ UV c) -{ - if (c < 256) { - return isSPACE_LC(UNI_TO_NATIVE(c)); - } - return isSPACE_uni(c); -} - -bool -Perl_is_uni_digit_lc(pTHX_ UV c) -{ - if (c < 256) { - return isDIGIT_LC(UNI_TO_NATIVE(c)); - } - return _is_uni_FOO(_CC_DIGIT, c); -} - -bool -Perl_is_uni_upper_lc(pTHX_ UV c) -{ - if (c < 256) { - return isUPPER_LC(UNI_TO_NATIVE(c)); - } - return _is_uni_FOO(_CC_UPPER, c); -} - -bool -Perl_is_uni_lower_lc(pTHX_ UV c) -{ - if (c < 256) { - return isLOWER_LC(UNI_TO_NATIVE(c)); - } - return _is_uni_FOO(_CC_LOWER, c); -} - -bool -Perl_is_uni_cntrl_lc(pTHX_ UV c) -{ - if (c < 256) { - return isCNTRL_LC(UNI_TO_NATIVE(c)); - } - return 0; -} - -bool -Perl_is_uni_graph_lc(pTHX_ UV c) -{ - if (c < 256) { - return isGRAPH_LC(UNI_TO_NATIVE(c)); - } - return _is_uni_FOO(_CC_GRAPH, c); -} - -bool -Perl_is_uni_print_lc(pTHX_ UV c) -{ - if (c < 256) { - return isPRINT_LC(UNI_TO_NATIVE(c)); - } - return _is_uni_FOO(_CC_PRINT, c); -} - -bool -Perl_is_uni_punct_lc(pTHX_ UV c) -{ - if (c < 256) { - return isPUNCT_LC(UNI_TO_NATIVE(c)); - } - return _is_uni_FOO(_CC_PUNCT, c); -} - -bool -Perl_is_uni_xdigit_lc(pTHX_ UV c) -{ - if (c < 256) { - return isXDIGIT_LC(UNI_TO_NATIVE(c)); - } - return isXDIGIT_uni(c); -} - -U32 -Perl_to_uni_upper_lc(pTHX_ U32 c) -{ - /* XXX returns only the first character -- do not use XXX */ - /* XXX no locale support yet */ - STRLEN len; - U8 tmpbuf[UTF8_MAXBYTES_CASE+1]; - return (U32)to_uni_upper(c, tmpbuf, &len); -} - -U32 -Perl_to_uni_title_lc(pTHX_ U32 c) -{ - /* XXX returns only the first character XXX -- do not use XXX */ - /* XXX no locale support yet */ - STRLEN len; - U8 tmpbuf[UTF8_MAXBYTES_CASE+1]; - return (U32)to_uni_title(c, tmpbuf, &len); -} - -U32 -Perl_to_uni_lower_lc(pTHX_ U32 c) -{ - /* XXX returns only the first character -- do not use XXX */ - /* XXX no locale support yet */ - STRLEN len; - U8 tmpbuf[UTF8_MAXBYTES_CASE+1]; - return (U32)to_uni_lower(c, tmpbuf, &len); -} - -PERL_STATIC_INLINE bool -S_is_utf8_common(pTHX_ const U8 *const p, SV **swash, - const char *const swashname) -{ - /* returns a boolean giving whether or not the UTF8-encoded character that - * starts at

is in the swash indicated by . - * contains a pointer to where the swash indicated by - * is to be stored; which this routine will do, so that future calls will - * look at <*swash> and only generate a swash if it is not null - * - * Note that it is assumed that the buffer length of

is enough to - * contain all the bytes that comprise the character. Thus, <*p> should - * have been checked before this call for mal-formedness enough to assure - * that. */ - - dVAR; - - PERL_ARGS_ASSERT_IS_UTF8_COMMON; - - /* The API should have included a length for the UTF-8 character in

, - * but it doesn't. We therefore assume that p has been validated at least - * as far as there being enough bytes available in it to accommodate the - * character without reading beyond the end, and pass that number on to the - * validating routine */ - if (! is_utf8_char_buf(p, p + UTF8SKIP(p))) { - if (ckWARN_d(WARN_UTF8)) { - Perl_warner(aTHX_ packWARN2(WARN_DEPRECATED,WARN_UTF8), - "Passing malformed UTF-8 to \"%s\" is deprecated", swashname); - if (ckWARN(WARN_UTF8)) { /* This will output details as to the - what the malformation is */ - utf8_to_uvchr_buf(p, p + UTF8SKIP(p), NULL); - } - } - return FALSE; - } - if (!*swash) { - U8 flags = _CORE_SWASH_INIT_ACCEPT_INVLIST; - *swash = _core_swash_init("utf8", swashname, &PL_sv_undef, 1, 0, NULL, &flags); - } - - return swash_fetch(*swash, p, TRUE) != 0; -} - -bool -Perl__is_utf8_FOO(pTHX_ const U8 classnum, const U8 *p) -{ - dVAR; - - PERL_ARGS_ASSERT__IS_UTF8_FOO; - - assert(classnum < _FIRST_NON_SWASH_CC); - - return is_utf8_common(p, &PL_utf8_swash_ptrs[classnum], swash_property_names[classnum]); -} - -bool -Perl_is_utf8_alnum(pTHX_ const U8 *p) -{ - dVAR; - - PERL_ARGS_ASSERT_IS_UTF8_ALNUM; - - /* NOTE: "IsWord", not "IsAlnum", since Alnum is a true - * descendant of isalnum(3), in other words, it doesn't - * contain the '_'. --jhi */ - return is_utf8_common(p, &PL_utf8_swash_ptrs[_CC_WORDCHAR], "IsWord"); -} - -bool -Perl_is_utf8_alnumc(pTHX_ const U8 *p) -{ - dVAR; - - PERL_ARGS_ASSERT_IS_UTF8_ALNUMC; - - return is_utf8_common(p, &PL_utf8_swash_ptrs[_CC_ALPHANUMERIC], "IsAlnum"); -} - -bool -Perl_is_utf8_idfirst(pTHX_ const U8 *p) /* The naming is historical. */ -{ - dVAR; - - PERL_ARGS_ASSERT_IS_UTF8_IDFIRST; - - return S_is_utf8_idfirst(aTHX_ p); -} - -bool -Perl_is_utf8_xidfirst(pTHX_ const U8 *p) /* The naming is historical. */ -{ - dVAR; - - PERL_ARGS_ASSERT_IS_UTF8_XIDFIRST; - - if (*p == '_') - return TRUE; - /* is_utf8_idstart would be more logical. */ - return is_utf8_common(p, &PL_utf8_xidstart, "XIdStart"); -} - -bool -Perl__is_utf8_perl_idstart(pTHX_ const U8 *p) -{ - dVAR; - - PERL_ARGS_ASSERT__IS_UTF8_PERL_IDSTART; - - return is_utf8_common(p, &PL_utf8_perl_idstart, "_Perl_IDStart"); -} - -bool -Perl__is_utf8_perl_idcont(pTHX_ const U8 *p) -{ - dVAR; - - PERL_ARGS_ASSERT__IS_UTF8_PERL_IDCONT; - - return is_utf8_common(p, &PL_utf8_perl_idcont, "_Perl_IDCont"); -} - - -bool -Perl_is_utf8_idcont(pTHX_ const U8 *p) -{ - dVAR; - - PERL_ARGS_ASSERT_IS_UTF8_IDCONT; - - return is_utf8_common(p, &PL_utf8_idcont, "IdContinue"); -} - -bool -Perl_is_utf8_xidcont(pTHX_ const U8 *p) -{ - dVAR; - - PERL_ARGS_ASSERT_IS_UTF8_XIDCONT; - - return is_utf8_common(p, &PL_utf8_idcont, "XIdContinue"); -} - -bool -Perl_is_utf8_alpha(pTHX_ const U8 *p) -{ - dVAR; - - PERL_ARGS_ASSERT_IS_UTF8_ALPHA; - - return is_utf8_common(p, &PL_utf8_swash_ptrs[_CC_ALPHA], "IsAlpha"); -} - -bool -Perl_is_utf8_ascii(pTHX_ const U8 *p) -{ - dVAR; - - PERL_ARGS_ASSERT_IS_UTF8_ASCII; - - /* ASCII characters are the same whether in utf8 or not. So the macro - * works on both utf8 and non-utf8 representations. */ - return isASCII(*p); -} - -bool -Perl_is_utf8_blank(pTHX_ const U8 *p) -{ - dVAR; - - PERL_ARGS_ASSERT_IS_UTF8_BLANK; - - return isBLANK_utf8(p); -} - -bool -Perl_is_utf8_space(pTHX_ const U8 *p) -{ - dVAR; - - PERL_ARGS_ASSERT_IS_UTF8_SPACE; - - return isSPACE_utf8(p); -} - -bool -Perl_is_utf8_perl_space(pTHX_ const U8 *p) -{ - dVAR; - - PERL_ARGS_ASSERT_IS_UTF8_PERL_SPACE; + * FOLD_FLAGS_LOCALE is set iff the rules from the current underlying + * locale are to be used. + * FOLD_FLAGS_NOMIX_ASCII iff non-ASCII to ASCII folds are prohibited + */ - /* Only true if is an ASCII space-like character, and ASCII is invariant - * under utf8, so can just use the macro */ - return isSPACE_A(*p); -} + PERL_ARGS_ASSERT__TO_UNI_FOLD_FLAGS; -bool -Perl_is_utf8_perl_word(pTHX_ const U8 *p) -{ - dVAR; + /* Tread a UTF-8 locale as not being in locale at all */ + if (IN_UTF8_CTYPE_LOCALE) { + flags &= ~FOLD_FLAGS_LOCALE; + } - PERL_ARGS_ASSERT_IS_UTF8_PERL_WORD; + if (c < 256) { + UV result = _to_fold_latin1((U8) c, p, lenp, + flags & (FOLD_FLAGS_FULL | FOLD_FLAGS_NOMIX_ASCII)); + /* It is illegal for the fold to cross the 255/256 boundary under + * locale; in this case return the original */ + return (result > 256 && flags & FOLD_FLAGS_LOCALE) + ? c + : result; + } - /* Only true if is an ASCII word character, and ASCII is invariant - * under utf8, so can just use the macro */ - return isWORDCHAR_A(*p); + /* If no special needs, just use the macro */ + if ( ! (flags & (FOLD_FLAGS_LOCALE|FOLD_FLAGS_NOMIX_ASCII))) { + uvchr_to_utf8(p, c); + return CALL_FOLD_CASE(p, p, lenp, flags & FOLD_FLAGS_FULL); + } + else { /* Otherwise, _to_utf8_fold_flags has the intelligence to deal with + the special flags. */ + U8 utf8_c[UTF8_MAXBYTES + 1]; + uvchr_to_utf8(utf8_c, c); + return _to_utf8_fold_flags(utf8_c, p, lenp, flags); + } } -bool -Perl_is_utf8_digit(pTHX_ const U8 *p) +PERL_STATIC_INLINE bool +S_is_utf8_common(pTHX_ const U8 *const p, SV **swash, + const char *const swashname, SV* const invlist) { + /* returns a boolean giving whether or not the UTF8-encoded character that + * starts at

is in the swash indicated by . + * contains a pointer to where the swash indicated by + * is to be stored; which this routine will do, so that future calls will + * look at <*swash> and only generate a swash if it is not null. + * is NULL or an inversion list that defines the swash. If not null, it + * saves time during initialization of the swash. + * + * Note that it is assumed that the buffer length of

is enough to + * contain all the bytes that comprise the character. Thus, <*p> should + * have been checked before this call for mal-formedness enough to assure + * that. */ + dVAR; - PERL_ARGS_ASSERT_IS_UTF8_DIGIT; + PERL_ARGS_ASSERT_IS_UTF8_COMMON; - return is_utf8_common(p, &PL_utf8_swash_ptrs[_CC_DIGIT], "IsDigit"); -} + /* The API should have included a length for the UTF-8 character in

, + * but it doesn't. We therefore assume that p has been validated at least + * as far as there being enough bytes available in it to accommodate the + * character without reading beyond the end, and pass that number on to the + * validating routine */ + if (! is_utf8_char_buf(p, p + UTF8SKIP(p))) { + if (ckWARN_d(WARN_UTF8)) { + Perl_warner(aTHX_ packWARN2(WARN_DEPRECATED,WARN_UTF8), + "Passing malformed UTF-8 to \"%s\" is deprecated", swashname); + if (ckWARN(WARN_UTF8)) { /* This will output details as to the + what the malformation is */ + utf8_to_uvchr_buf(p, p + UTF8SKIP(p), NULL); + } + } + return FALSE; + } + if (!*swash) { + U8 flags = _CORE_SWASH_INIT_ACCEPT_INVLIST; + *swash = _core_swash_init("utf8", -bool -Perl_is_utf8_posix_digit(pTHX_ const U8 *p) -{ - dVAR; + /* Only use the name if there is no inversion + * list; otherwise will go out to disk */ + (invlist) ? "" : swashname, - PERL_ARGS_ASSERT_IS_UTF8_POSIX_DIGIT; + &PL_sv_undef, 1, 0, invlist, &flags); + } - /* Only true if is an ASCII digit character, and ASCII is invariant - * under utf8, so can just use the macro */ - return isDIGIT_A(*p); + return swash_fetch(*swash, p, TRUE) != 0; } bool -Perl_is_utf8_upper(pTHX_ const U8 *p) +Perl__is_utf8_FOO(pTHX_ const U8 classnum, const U8 *p) { dVAR; - PERL_ARGS_ASSERT_IS_UTF8_UPPER; + PERL_ARGS_ASSERT__IS_UTF8_FOO; + + assert(classnum < _FIRST_NON_SWASH_CC); - return is_utf8_common(p, &PL_utf8_swash_ptrs[_CC_UPPER], "IsUppercase"); + return is_utf8_common(p, + &PL_utf8_swash_ptrs[classnum], + swash_property_names[classnum], + PL_XPosix_ptrs[classnum]); } bool -Perl_is_utf8_lower(pTHX_ const U8 *p) +Perl_is_utf8_idfirst(pTHX_ const U8 *p) /* The naming is historical. */ { dVAR; - PERL_ARGS_ASSERT_IS_UTF8_LOWER; + PERL_ARGS_ASSERT_IS_UTF8_IDFIRST; - return is_utf8_common(p, &PL_utf8_swash_ptrs[_CC_LOWER], "IsLowercase"); + return S_is_utf8_idfirst(aTHX_ p); } bool -Perl_is_utf8_cntrl(pTHX_ const U8 *p) +Perl_is_utf8_xidfirst(pTHX_ const U8 *p) /* The naming is historical. */ { dVAR; - PERL_ARGS_ASSERT_IS_UTF8_CNTRL; + PERL_ARGS_ASSERT_IS_UTF8_XIDFIRST; - return isCNTRL_utf8(p); + if (*p == '_') + return TRUE; + /* is_utf8_idstart would be more logical. */ + return is_utf8_common(p, &PL_utf8_xidstart, "XIdStart", NULL); } bool -Perl_is_utf8_graph(pTHX_ const U8 *p) +Perl__is_utf8_perl_idstart(pTHX_ const U8 *p) { dVAR; + SV* invlist = NULL; - PERL_ARGS_ASSERT_IS_UTF8_GRAPH; + PERL_ARGS_ASSERT__IS_UTF8_PERL_IDSTART; - return is_utf8_common(p, &PL_utf8_swash_ptrs[_CC_GRAPH], "IsGraph"); + if (! PL_utf8_perl_idstart) { + invlist = _new_invlist_C_array(_Perl_IDStart_invlist); + } + return is_utf8_common(p, &PL_utf8_perl_idstart, "", invlist); } bool -Perl_is_utf8_print(pTHX_ const U8 *p) +Perl__is_utf8_perl_idcont(pTHX_ const U8 *p) { dVAR; + SV* invlist = NULL; - PERL_ARGS_ASSERT_IS_UTF8_PRINT; + PERL_ARGS_ASSERT__IS_UTF8_PERL_IDCONT; - return is_utf8_common(p, &PL_utf8_swash_ptrs[_CC_PRINT], "IsPrint"); + if (! PL_utf8_perl_idcont) { + invlist = _new_invlist_C_array(_Perl_IDCont_invlist); + } + return is_utf8_common(p, &PL_utf8_perl_idcont, "", invlist); } + bool -Perl_is_utf8_punct(pTHX_ const U8 *p) +Perl_is_utf8_idcont(pTHX_ const U8 *p) { dVAR; - PERL_ARGS_ASSERT_IS_UTF8_PUNCT; + PERL_ARGS_ASSERT_IS_UTF8_IDCONT; - return is_utf8_common(p, &PL_utf8_swash_ptrs[_CC_PUNCT], "IsPunct"); + return is_utf8_common(p, &PL_utf8_idcont, "IdContinue", NULL); } bool -Perl_is_utf8_xdigit(pTHX_ const U8 *p) +Perl_is_utf8_xidcont(pTHX_ const U8 *p) { dVAR; - PERL_ARGS_ASSERT_IS_UTF8_XDIGIT; + PERL_ARGS_ASSERT_IS_UTF8_XIDCONT; - return is_XDIGIT_utf8(p); + return is_utf8_common(p, &PL_utf8_idcont, "XIdContinue", NULL); } bool @@ -2330,42 +1962,32 @@ Perl__is_utf8_mark(pTHX_ const U8 *p) PERL_ARGS_ASSERT__IS_UTF8_MARK; - return is_utf8_common(p, &PL_utf8_mark, "IsM"); -} - - -bool -Perl_is_utf8_mark(pTHX_ const U8 *p) -{ - dVAR; - - PERL_ARGS_ASSERT_IS_UTF8_MARK; - - return _is_utf8_mark(p); + return is_utf8_common(p, &PL_utf8_mark, "IsM", NULL); } /* =for apidoc to_utf8_case -The C

contains the pointer to the UTF-8 string encoding +C

contains the pointer to the UTF-8 string encoding the character that is being converted. This routine assumes that the character at C

is well-formed. -The C is a pointer to the character buffer to put the -conversion result to. The C is a pointer to the length +C is a pointer to the character buffer to put the +conversion result to. C is a pointer to the length of the result. -The C is a pointer to the swash to use. +C is a pointer to the swash to use. Both the special and normal mappings are stored in F, -and loaded by SWASHNEW, using F. The C (usually, +and loaded by SWASHNEW, using F. C (usually, but not always, a multicharacter mapping), is tried first. -The C is a string like "utf8::ToSpecLower", which means the -hash %utf8::ToSpecLower. The access to the hash is through -Perl_to_utf8_case(). +C is a string, normally C or C<"">. C means to not use +any special mappings; C<""> means to use the special mappings. Values other +than these two are treated as the name of the hash containing the special +mappings, like C<"utf8::ToSpecLower">. -The C is a string like "ToLower" which means the swash +C is a string like "ToLower" which means the swash %utf8::ToLower. =cut */ @@ -2375,13 +1997,8 @@ Perl_to_utf8_case(pTHX_ const U8 *p, U8* SV **swashp, const char *normal, const char *special) { dVAR; - U8 tmpbuf[UTF8_MAXBYTES_CASE+1]; STRLEN len = 0; - const UV uv0 = valid_utf8_to_uvchr(p, NULL); - /* The NATIVE_TO_UNI() and UNI_TO_NATIVE() mappings - * are necessary in EBCDIC, they are redundant no-ops - * in ASCII-ish platforms, and hopefully optimized away. */ - const UV uv1 = NATIVE_TO_UNI(uv0); + const UV uv1 = valid_utf8_to_uvchr(p, NULL); PERL_ARGS_ASSERT_TO_UTF8_CASE; @@ -2407,68 +2024,49 @@ Perl_to_utf8_case(pTHX_ const U8 *p, U8* * be given */ } - uvuni_to_utf8(tmpbuf, uv1); - if (!*swashp) /* load on-demand */ *swashp = _core_swash_init("utf8", normal, &PL_sv_undef, 4, 0, NULL, NULL); if (special) { /* It might be "special" (sometimes, but not always, * a multicharacter mapping) */ - HV * const hv = get_hv(special, 0); + HV *hv = NULL; SV **svp; - if (hv && - (svp = hv_fetch(hv, (const char*)tmpbuf, UNISKIP(uv1), FALSE)) && - (*svp)) { + /* If passed in the specials name, use that; otherwise use any + * given in the swash */ + if (*special != '\0') { + hv = get_hv(special, 0); + } + else { + svp = hv_fetchs(MUTABLE_HV(SvRV(*swashp)), "SPECIALS", 0); + if (svp) { + hv = MUTABLE_HV(SvRV(*svp)); + } + } + + if (hv + && (svp = hv_fetch(hv, (const char*)p, UNISKIP(uv1), FALSE)) + && (*svp)) + { const char *s; s = SvPV_const(*svp, len); if (len == 1) - len = uvuni_to_utf8(ustrp, NATIVE_TO_UNI(*(U8*)s)) - ustrp; + /* EIGHTBIT */ + len = uvchr_to_utf8(ustrp, *(U8*)s) - ustrp; else { -#ifdef EBCDIC - /* If we have EBCDIC we need to remap the characters - * since any characters in the low 256 are Unicode - * code points, not EBCDIC. */ - U8 *t = (U8*)s, *tend = t + len, *d; - - d = tmpbuf; - if (SvUTF8(*svp)) { - STRLEN tlen = 0; - - while (t < tend) { - const UV c = utf8_to_uvchr_buf(t, tend, &tlen); - if (tlen > 0) { - d = uvchr_to_utf8(d, UNI_TO_NATIVE(c)); - t += tlen; - } - else - break; - } - } - else { - while (t < tend) { - d = uvchr_to_utf8(d, UNI_TO_NATIVE(*t)); - t++; - } - } - len = d - tmpbuf; - Copy(tmpbuf, ustrp, len, U8); -#else Copy(s, ustrp, len, U8); -#endif } } } if (!len && *swashp) { - const UV uv2 = swash_fetch(*swashp, tmpbuf, TRUE /* => is utf8 */); + const UV uv2 = swash_fetch(*swashp, p, TRUE /* => is utf8 */); if (uv2) { /* It was "normal" (a single character mapping). */ - const UV uv3 = UNI_TO_NATIVE(uv2); - len = uvchr_to_utf8(ustrp, uv3) - ustrp; + len = uvchr_to_utf8(ustrp, uv2) - ustrp; } } @@ -2489,7 +2087,7 @@ Perl_to_utf8_case(pTHX_ const U8 *p, U8* if (lenp) *lenp = len; - return uv0; + return uv1; } @@ -2497,9 +2095,10 @@ STATIC UV S_check_locale_boundary_crossing(pTHX_ const U8* const p, const UV result, U8* const ustrp, STRLEN *lenp) { /* This is called when changing the case of a utf8-encoded character above - * the Latin1 range, and the operation is in locale. If the result - * contains a character that crosses the 255/256 boundary, disallow the - * change, and return the original code point. See L for why; + * the Latin1 range, and the operation is in a non-UTF-8 locale. If the + * result contains a character that crosses the 255/256 boundary, disallow + * the change, and return the original code point. See L for + * why; * * p points to the original string whose case was changed; assumed * by this routine to be well-formed @@ -2511,7 +2110,7 @@ S_check_locale_boundary_crossing(pTHX_ c PERL_ARGS_ASSERT_CHECK_LOCALE_BOUNDARY_CROSSING; - assert(! UTF8_IS_INVARIANT(*p) && ! UTF8_IS_DOWNGRADEABLE_START(*p)); + assert(UTF8_IS_ABOVE_LATIN1(*p)); /* We know immediately if the first character in the string crosses the * boundary, so can skip */ @@ -2522,8 +2121,7 @@ S_check_locale_boundary_crossing(pTHX_ c U8* s = ustrp + UTF8SKIP(ustrp); U8* e = ustrp + *lenp; while (s < e) { - if (UTF8_IS_INVARIANT(*s) || UTF8_IS_DOWNGRADEABLE_START(*s)) - { + if (! UTF8_IS_ABOVE_LATIN1(*s)) { goto bad_crossing; } s += UTF8SKIP(s); @@ -2544,25 +2142,16 @@ bad_crossing: /* =for apidoc to_utf8_upper -Convert the UTF-8 encoded character at C

to its uppercase version and -store that in UTF-8 in C and its length in bytes in C. Note -that the ustrp needs to be at least UTF8_MAXBYTES_CASE+1 bytes since -the uppercase version may be longer than the original character. - -The first character of the uppercased version is returned -(but note, as explained above, that there may be more.) - -The character at C

is assumed by this routine to be well-formed. +Instead use L. =cut */ /* Not currently externally documented, and subject to change: - * is set iff locale semantics are to be used for code points < 256 - * if non-null, *tainted_ptr will be set TRUE iff locale rules - * were used in the calculation; otherwise unchanged. */ + * is set iff iff the rules from the current underlying locale are to + * be used. */ UV -Perl__to_utf8_upper_flags(pTHX_ const U8 *p, U8* ustrp, STRLEN *lenp, const bool flags, bool* tainted_ptr) +Perl__to_utf8_upper_flags(pTHX_ const U8 *p, U8* ustrp, STRLEN *lenp, bool flags) { dVAR; @@ -2570,6 +2159,10 @@ Perl__to_utf8_upper_flags(pTHX_ const U8 PERL_ARGS_ASSERT__TO_UTF8_UPPER_FLAGS; + if (flags && IN_UTF8_CTYPE_LOCALE) { + flags = FALSE; + } + if (UTF8_IS_INVARIANT(*p)) { if (flags) { result = toUPPER_LC(*p); @@ -2580,10 +2173,11 @@ Perl__to_utf8_upper_flags(pTHX_ const U8 } else if UTF8_IS_DOWNGRADEABLE_START(*p) { if (flags) { - result = toUPPER_LC(TWO_BYTE_UTF8_TO_UNI(*p, *(p+1))); + U8 c = TWO_BYTE_UTF8_TO_NATIVE(*p, *(p+1)); + result = toUPPER_LC(c); } else { - return _to_upper_title_latin1(TWO_BYTE_UTF8_TO_UNI(*p, *(p+1)), + return _to_upper_title_latin1(TWO_BYTE_UTF8_TO_NATIVE(*p, *(p+1)), ustrp, lenp, 'S'); } } @@ -2602,41 +2196,29 @@ Perl__to_utf8_upper_flags(pTHX_ const U8 *lenp = 1; } else { - *ustrp = UTF8_EIGHT_BIT_HI(result); - *(ustrp + 1) = UTF8_EIGHT_BIT_LO(result); + *ustrp = UTF8_EIGHT_BIT_HI((U8) result); + *(ustrp + 1) = UTF8_EIGHT_BIT_LO((U8) result); *lenp = 2; } - if (tainted_ptr) { - *tainted_ptr = TRUE; - } return result; } /* =for apidoc to_utf8_title -Convert the UTF-8 encoded character at C

to its titlecase version and -store that in UTF-8 in C and its length in bytes in C. Note -that the C needs to be at least UTF8_MAXBYTES_CASE+1 bytes since the -titlecase version may be longer than the original character. - -The first character of the titlecased version is returned -(but note, as explained above, that there may be more.) - -The character at C

is assumed by this routine to be well-formed. +Instead use L. =cut */ /* Not currently externally documented, and subject to change: - * is set iff locale semantics are to be used for code points < 256 - * Since titlecase is not defined in POSIX, uppercase is used instead - * for these/ - * if non-null, *tainted_ptr will be set TRUE iff locale rules - * were used in the calculation; otherwise unchanged. */ + * is set iff the rules from the current underlying locale are to be + * used. Since titlecase is not defined in POSIX, for other than a + * UTF-8 locale, uppercase is used instead for code points < 256. + */ UV -Perl__to_utf8_title_flags(pTHX_ const U8 *p, U8* ustrp, STRLEN *lenp, const bool flags, bool* tainted_ptr) +Perl__to_utf8_title_flags(pTHX_ const U8 *p, U8* ustrp, STRLEN *lenp, bool flags) { dVAR; @@ -2644,6 +2226,10 @@ Perl__to_utf8_title_flags(pTHX_ const U8 PERL_ARGS_ASSERT__TO_UTF8_TITLE_FLAGS; + if (flags && IN_UTF8_CTYPE_LOCALE) { + flags = FALSE; + } + if (UTF8_IS_INVARIANT(*p)) { if (flags) { result = toUPPER_LC(*p); @@ -2654,10 +2240,11 @@ Perl__to_utf8_title_flags(pTHX_ const U8 } else if UTF8_IS_DOWNGRADEABLE_START(*p) { if (flags) { - result = toUPPER_LC(TWO_BYTE_UTF8_TO_UNI(*p, *(p+1))); + U8 c = TWO_BYTE_UTF8_TO_NATIVE(*p, *(p+1)); + result = toUPPER_LC(c); } else { - return _to_upper_title_latin1(TWO_BYTE_UTF8_TO_UNI(*p, *(p+1)), + return _to_upper_title_latin1(TWO_BYTE_UTF8_TO_NATIVE(*p, *(p+1)), ustrp, lenp, 's'); } } @@ -2676,39 +2263,28 @@ Perl__to_utf8_title_flags(pTHX_ const U8 *lenp = 1; } else { - *ustrp = UTF8_EIGHT_BIT_HI(result); - *(ustrp + 1) = UTF8_EIGHT_BIT_LO(result); + *ustrp = UTF8_EIGHT_BIT_HI((U8) result); + *(ustrp + 1) = UTF8_EIGHT_BIT_LO((U8) result); *lenp = 2; } - if (tainted_ptr) { - *tainted_ptr = TRUE; - } return result; } /* =for apidoc to_utf8_lower -Convert the UTF-8 encoded character at C

to its lowercase version and -store that in UTF-8 in ustrp and its length in bytes in C. Note -that the C needs to be at least UTF8_MAXBYTES_CASE+1 bytes since the -lowercase version may be longer than the original character. - -The first character of the lowercased version is returned -(but note, as explained above, that there may be more.) - -The character at C

is assumed by this routine to be well-formed. +Instead use L. =cut */ /* Not currently externally documented, and subject to change: - * is set iff locale semantics are to be used for code points < 256 - * if non-null, *tainted_ptr will be set TRUE iff locale rules - * were used in the calculation; otherwise unchanged. */ + * is set iff iff the rules from the current underlying locale are to + * be used. + */ UV -Perl__to_utf8_lower_flags(pTHX_ const U8 *p, U8* ustrp, STRLEN *lenp, const bool flags, bool* tainted_ptr) +Perl__to_utf8_lower_flags(pTHX_ const U8 *p, U8* ustrp, STRLEN *lenp, bool flags) { UV result; @@ -2716,6 +2292,10 @@ Perl__to_utf8_lower_flags(pTHX_ const U8 PERL_ARGS_ASSERT__TO_UTF8_LOWER_FLAGS; + if (flags && IN_UTF8_CTYPE_LOCALE) { + flags = FALSE; + } + if (UTF8_IS_INVARIANT(*p)) { if (flags) { result = toLOWER_LC(*p); @@ -2726,10 +2306,11 @@ Perl__to_utf8_lower_flags(pTHX_ const U8 } else if UTF8_IS_DOWNGRADEABLE_START(*p) { if (flags) { - result = toLOWER_LC(TWO_BYTE_UTF8_TO_UNI(*p, *(p+1))); + U8 c = TWO_BYTE_UTF8_TO_NATIVE(*p, *(p+1)); + result = toLOWER_LC(c); } else { - return to_lower_latin1(TWO_BYTE_UTF8_TO_UNI(*p, *(p+1)), + return to_lower_latin1(TWO_BYTE_UTF8_TO_NATIVE(*p, *(p+1)), ustrp, lenp); } } @@ -2749,47 +2330,33 @@ Perl__to_utf8_lower_flags(pTHX_ const U8 *lenp = 1; } else { - *ustrp = UTF8_EIGHT_BIT_HI(result); - *(ustrp + 1) = UTF8_EIGHT_BIT_LO(result); + *ustrp = UTF8_EIGHT_BIT_HI((U8) result); + *(ustrp + 1) = UTF8_EIGHT_BIT_LO((U8) result); *lenp = 2; } - if (tainted_ptr) { - *tainted_ptr = TRUE; - } return result; } /* =for apidoc to_utf8_fold -Convert the UTF-8 encoded character at C

to its foldcase version and -store that in UTF-8 in C and its length in bytes in C. Note -that the C needs to be at least UTF8_MAXBYTES_CASE+1 bytes since the -foldcase version may be longer than the original character (up to -three characters). - -The first character of the foldcased version is returned -(but note, as explained above, that there may be more.) - -The character at C

is assumed by this routine to be well-formed. +Instead use L. =cut */ /* Not currently externally documented, and subject to change, * in - * bit FOLD_FLAGS_LOCALE is set iff locale semantics are to be used for code - * points < 256. Since foldcase is not defined in - * POSIX, lowercase is used instead + * bit FOLD_FLAGS_LOCALE is set iff the rules from the current underlying + * locale are to be used. * bit FOLD_FLAGS_FULL is set iff full case folds are to be used; * otherwise simple folds * bit FOLD_FLAGS_NOMIX_ASCII is set iff folds of non-ASCII to ASCII are * prohibited - * if non-null, *tainted_ptr will be set TRUE iff locale rules - * were used in the calculation; otherwise unchanged. */ + */ UV -Perl__to_utf8_fold_flags(pTHX_ const U8 *p, U8* ustrp, STRLEN *lenp, U8 flags, bool* tainted_ptr) +Perl__to_utf8_fold_flags(pTHX_ const U8 *p, U8* ustrp, STRLEN *lenp, U8 flags) { dVAR; @@ -2802,35 +2369,49 @@ Perl__to_utf8_fold_flags(pTHX_ const U8 assert(p != ustrp); /* Otherwise overwrites */ + if (flags & FOLD_FLAGS_LOCALE && IN_UTF8_CTYPE_LOCALE) { + flags &= ~FOLD_FLAGS_LOCALE; + } + if (UTF8_IS_INVARIANT(*p)) { if (flags & FOLD_FLAGS_LOCALE) { - result = toLOWER_LC(*p); + result = toFOLD_LC(*p); } else { return _to_fold_latin1(*p, ustrp, lenp, - cBOOL(flags & FOLD_FLAGS_FULL)); + flags & (FOLD_FLAGS_FULL | FOLD_FLAGS_NOMIX_ASCII)); } } else if UTF8_IS_DOWNGRADEABLE_START(*p) { if (flags & FOLD_FLAGS_LOCALE) { - result = toLOWER_LC(TWO_BYTE_UTF8_TO_UNI(*p, *(p+1))); + U8 c = TWO_BYTE_UTF8_TO_NATIVE(*p, *(p+1)); + result = toFOLD_LC(c); } else { - return _to_fold_latin1(TWO_BYTE_UTF8_TO_UNI(*p, *(p+1)), - ustrp, lenp, - cBOOL((flags & FOLD_FLAGS_FULL - /* If ASCII safe, don't allow full - * folding, as that could include SHARP - * S => ss; otherwise there is no - * crossing of ascii/non-ascii in the - * latin1 range */ - && ! (flags & FOLD_FLAGS_NOMIX_ASCII)))); + return _to_fold_latin1(TWO_BYTE_UTF8_TO_NATIVE(*p, *(p+1)), + ustrp, lenp, + flags & (FOLD_FLAGS_FULL | FOLD_FLAGS_NOMIX_ASCII)); } } else { /* utf8, ord above 255 */ result = CALL_FOLD_CASE(p, ustrp, lenp, flags & FOLD_FLAGS_FULL); - if ((flags & FOLD_FLAGS_LOCALE)) { + if (flags & FOLD_FLAGS_LOCALE) { + + /* Special case these two characters, as what normally gets + * returned under locale doesn't work */ + if (UTF8SKIP(p) == sizeof(LATIN_CAPITAL_LETTER_SHARP_S_UTF8) - 1 + && memEQ((char *) p, LATIN_CAPITAL_LETTER_SHARP_S_UTF8, + sizeof(LATIN_CAPITAL_LETTER_SHARP_S_UTF8) - 1)) + { + goto return_long_s; + } + else if (UTF8SKIP(p) == sizeof(LATIN_SMALL_LIGATURE_LONG_S_T) - 1 + && memEQ((char *) p, LATIN_SMALL_LIGATURE_LONG_S_T_UTF8, + sizeof(LATIN_SMALL_LIGATURE_LONG_S_T_UTF8) - 1)) + { + goto return_ligature_st; + } return check_locale_boundary_crossing(p, result, ustrp, lenp); } else if (! (flags & FOLD_FLAGS_NOMIX_ASCII)) { @@ -2838,8 +2419,8 @@ Perl__to_utf8_fold_flags(pTHX_ const U8 } else { /* This is called when changing the case of a utf8-encoded - * character above the Latin1 range, and the result should not - * contain an ASCII character. */ + * character above the ASCII range, and the result should not + * contain an ASCII character. */ UV original; /* To store the first code point of

*/ @@ -2851,6 +2432,17 @@ Perl__to_utf8_fold_flags(pTHX_ const U8 if (isASCII(*s)) { /* Crossed, have to return the original */ original = valid_utf8_to_uvchr(p, lenp); + + /* But in these instances, there is an alternative we can + * return that is valid */ + if (original == LATIN_CAPITAL_LETTER_SHARP_S + || original == LATIN_SMALL_LETTER_SHARP_S) + { + goto return_long_s; + } + else if (original == LATIN_SMALL_LIGATURE_LONG_S_T) { + goto return_ligature_st; + } Copy(p, ustrp, *lenp, char); return original; } @@ -2868,15 +2460,32 @@ Perl__to_utf8_fold_flags(pTHX_ const U8 *lenp = 1; } else { - *ustrp = UTF8_EIGHT_BIT_HI(result); - *(ustrp + 1) = UTF8_EIGHT_BIT_LO(result); + *ustrp = UTF8_EIGHT_BIT_HI((U8) result); + *(ustrp + 1) = UTF8_EIGHT_BIT_LO((U8) result); *lenp = 2; } - if (tainted_ptr) { - *tainted_ptr = TRUE; - } return result; + + return_long_s: + /* Certain folds to 'ss' are prohibited by the options, but they do allow + * folds to a string of two of these characters. By returning this + * instead, then, e.g., + * fc("\x{1E9E}") eq fc("\x{17F}\x{17F}") + * works. */ + + *lenp = 2 * sizeof(LATIN_SMALL_LETTER_LONG_S_UTF8) - 2; + Copy(LATIN_SMALL_LETTER_LONG_S_UTF8 LATIN_SMALL_LETTER_LONG_S_UTF8, + ustrp, *lenp, U8); + return LATIN_SMALL_LETTER_LONG_S; + + return_ligature_st: + /* Two folds to 'st' are prohibited by the options; instead we pick one and + * have the other one fold to it */ + + *lenp = sizeof(LATIN_SMALL_LIGATURE_ST_UTF8) - 1; + Copy(LATIN_SMALL_LIGATURE_ST_UTF8, ustrp, *lenp, U8); + return LATIN_SMALL_LIGATURE_ST; } /* Note: @@ -2938,7 +2547,9 @@ Perl__core_swash_init(pTHX_ const char* * Thus there are three possible inputs to find the swash: , * , and . At least one must be specified. The result * will be the union of the specified ones, although 's various - * actions can intersect, etc. what gives. + * actions can intersect, etc. what gives. To avoid going out to + * disk at all, should specify completely what the swash should + * have, and should be &PL_sv_undef and should be "". * * is only valid for binary properties */ @@ -3120,7 +2731,7 @@ Perl__core_swash_init(pTHX_ const char* /* Here, we have computed the union of all the passed-in data. It may * be that there was an inversion list in the swash which didn't get - * touched; otherwise save the one computed one */ + * touched; otherwise save the computed one */ if (! invlist_in_swash_is_valid && (int) _invlist_len(swash_invlist) > invlist_swash_boundary) { @@ -3133,6 +2744,8 @@ Perl__core_swash_init(pTHX_ const char* else SvREFCNT_inc_simple_void_NN(swash_invlist); } + SvREADONLY_on(swash_invlist); + /* Use the inversion list stand-alone if small enough */ if ((int) _invlist_len(swash_invlist) <= invlist_swash_boundary) { SvREFCNT_dec(retval); @@ -3157,8 +2770,8 @@ Perl__core_swash_init(pTHX_ const char* /* Note: * Returns the value of property/mapping C for the first character * of the string C. If C is true, the string C is - * assumed to be in utf8. If C is false, the string C is - * assumed to be in native 8-bit encoding. Caches the swatch in C. + * assumed to be in well-formed utf8. If C is false, the string C + * is assumed to be in native 8-bit encoding. Caches the swatch in C. * * A "swash" is a hash which contains initially the keys/values set up by * SWASHNEW. The purpose is to be able to completely represent a Unicode @@ -3195,13 +2808,12 @@ Perl_swash_fetch(pTHX_ SV *swash, const HV *const hv = MUTABLE_HV(SvRV(swash)); U32 klen; U32 off; - STRLEN slen; + STRLEN slen = 0; STRLEN needents; const U8 *tmps = NULL; U32 bit; SV *swatch; - U8 tmputf8[2]; - const UV c = NATIVE_TO_ASCII(*ptr); + const U8 c = *ptr; PERL_ARGS_ASSERT_SWASH_FETCH; @@ -3214,31 +2826,60 @@ Perl_swash_fetch(pTHX_ SV *swash, const : c); } - /* Convert to utf8 if not already */ - if (!do_utf8 && !UNI_IS_INVARIANT(c)) { - tmputf8[0] = (U8)UTF8_EIGHT_BIT_HI(c); - tmputf8[1] = (U8)UTF8_EIGHT_BIT_LO(c); - ptr = tmputf8; - } - /* Given a UTF-X encoded char 0xAA..0xYY,0xZZ - * then the "swatch" is a vec() for all the chars which start - * with 0xAA..0xYY - * So the key in the hash (klen) is length of encoded char -1 - */ - klen = UTF8SKIP(ptr) - 1; - off = ptr[klen]; - - if (klen == 0) { - /* If char is invariant then swatch is for all the invariant chars - * In both UTF-8 and UTF-8-MOD that happens to be UTF_CONTINUATION_MARK - */ - needents = UTF_CONTINUATION_MARK; - off = NATIVE_TO_UTF(ptr[klen]); + /* We store the values in a "swatch" which is a vec() value in a swash + * hash. Code points 0-255 are a single vec() stored with key length + * (klen) 0. All other code points have a UTF-8 representation + * 0xAA..0xYY,0xZZ. A vec() is constructed containing all of them which + * share 0xAA..0xYY, which is the key in the hash to that vec. So the key + * length for them is the length of the encoded char - 1. ptr[klen] is the + * final byte in the sequence representing the character */ + if (!do_utf8 || UTF8_IS_INVARIANT(c)) { + klen = 0; + needents = 256; + off = c; + } + else if (UTF8_IS_DOWNGRADEABLE_START(c)) { + klen = 0; + needents = 256; + off = TWO_BYTE_UTF8_TO_NATIVE(c, *(ptr + 1)); } else { - /* If char is encoded then swatch is for the prefix */ + klen = UTF8SKIP(ptr) - 1; + + /* Each vec() stores 2**UTF_ACCUMULATION_SHIFT values. The offset into + * the vec is the final byte in the sequence. (In EBCDIC this is + * converted to I8 to get consecutive values.) To help you visualize + * all this: + * Straight 1047 After final byte + * UTF-8 UTF-EBCDIC I8 transform + * U+0400: \xD0\x80 \xB8\x41\x41 \xB8\x41\xA0 + * U+0401: \xD0\x81 \xB8\x41\x42 \xB8\x41\xA1 + * ... + * U+0409: \xD0\x89 \xB8\x41\x4A \xB8\x41\xA9 + * U+040A: \xD0\x8A \xB8\x41\x51 \xB8\x41\xAA + * ... + * U+0412: \xD0\x92 \xB8\x41\x59 \xB8\x41\xB2 + * U+0413: \xD0\x93 \xB8\x41\x62 \xB8\x41\xB3 + * ... + * U+041B: \xD0\x9B \xB8\x41\x6A \xB8\x41\xBB + * U+041C: \xD0\x9C \xB8\x41\x70 \xB8\x41\xBC + * ... + * U+041F: \xD0\x9F \xB8\x41\x73 \xB8\x41\xBF + * U+0420: \xD0\xA0 \xB8\x42\x41 \xB8\x42\x41 + * + * (There are no discontinuities in the elided (...) entries.) + * The UTF-8 key for these 33 code points is '\xD0' (which also is the + * key for the next 31, up through U+043F, whose UTF-8 final byte is + * \xBF). Thus in UTF-8, each key is for a vec() for 64 code points. + * The final UTF-8 byte, which ranges between \x80 and \xBF, is an + * index into the vec() swatch (after subtracting 0x80, which we + * actually do with an '&'). + * In UTF-EBCDIC, each key is for a 32 code point vec(). The first 32 + * code points above have key '\xB8\x41'. The final UTF-EBCDIC byte has + * dicontinuities which go away by transforming it into I8, and we + * effectively subtract 0xA0 to get the index. */ needents = (1 << UTF_ACCUMULATION_SHIFT); - off = NATIVE_TO_UTF(ptr[klen]) & UTF_CONTINUATION_MASK; + off = NATIVE_UTF8_TO_I8(ptr[klen]) & UTF_CONTINUATION_MASK; } /* @@ -3263,17 +2904,18 @@ Perl_swash_fetch(pTHX_ SV *swash, const /* If not cached, generate it via swatch_get */ if (!svp || !SvPOK(*svp) - || !(tmps = (const U8*)SvPV_const(*svp, slen))) { - /* We use utf8n_to_uvuni() as we want an index into - Unicode tables, not a native character number. - */ - const UV code_point = utf8n_to_uvuni(ptr, UTF8_MAXBYTES, 0, - ckWARN(WARN_UTF8) ? - 0 : UTF8_ALLOW_ANY); - swatch = swatch_get(swash, - /* On EBCDIC & ~(0xA0-1) isn't a useful thing to do */ - (klen) ? (code_point & ~((UV)needents - 1)) : 0, - needents); + || !(tmps = (const U8*)SvPV_const(*svp, slen))) + { + if (klen) { + const UV code_point = valid_utf8_to_uvchr(ptr, NULL); + swatch = swatch_get(swash, + code_point & ~((UV)needents - 1), + needents); + } + else { /* For the first 256 code points, the swatch has a key of + length 0 */ + swatch = swatch_get(swash, 0, needents); + } if (IN_PERL_COMPILETIME) CopHINTS_set(PL_curcop, PL_hints); @@ -3373,30 +3015,19 @@ S_swash_scan_list_line(pTHX_ U8* l, U8* *max = *min; /* Non-binary tables have a third entry: what the first element of the - * range maps to */ + * range maps to. The map for those currently read here is in hex */ if (wants_value) { if (isBLANK(*l)) { ++l; - - /* The ToLc, etc table mappings are not in hex, and must be - * corrected by adding the code point to them */ - if (typeto) { - char *after_strtol = (char *) lend; - *val = Strtol((char *)l, &after_strtol, 10); - l = (U8 *) after_strtol; - } - else { /* Other tables are in hex, and are the correct result - without tweaking */ - flags = PERL_SCAN_SILENT_ILLDIGIT - | PERL_SCAN_DISALLOW_PREFIX - | PERL_SCAN_SILENT_NON_PORTABLE; - numlen = lend - l; - *val = grok_hex((char *)l, &numlen, &flags, NULL); - if (numlen) - l += numlen; - else - *val = 0; - } + flags = PERL_SCAN_SILENT_ILLDIGIT + | PERL_SCAN_DISALLOW_PREFIX + | PERL_SCAN_SILENT_NON_PORTABLE; + numlen = lend - l; + *val = grok_hex((char *)l, &numlen, &flags, NULL); + if (numlen) + l += numlen; + else + *val = 0; } else { *val = 0; @@ -3765,9 +3396,12 @@ Perl__swash_inversion_hash(pTHX_ SV* con * * The returned hash would have two keys, the utf8 for 006B and the utf8 for * 006C. The value for each key is an array. For 006C, the array would - * have a two elements, the utf8 for itself, and for 004C. For 006B, there + * have two elements, the utf8 for itself, and for 004C. For 006B, there * would be three elements in its array, the utf8 for 006B, 004B and 212A. * + * Note that there are no elements in the hash for 004B, 004C, 212A. The + * keys are only code points that are folded-to, so it isn't a full closure. + * * Essentially, for any code point, it gives all the code points that map to * it, or the list of 'froms' for that point. * @@ -3887,13 +3521,13 @@ Perl__swash_inversion_hash(pTHX_ SV* con while ((from_list = (AV *) hv_iternextsv(specials_inverse, &char_to, &to_len))) { - if (av_len(from_list) > 0) { - int i; + if (av_tindex(from_list) > 0) { + SSize_t i; /* We iterate over all combinations of i,j to place each code * point on each list */ - for (i = 0; i <= av_len(from_list); i++) { - int j; + for (i = 0; i <= av_tindex(from_list); i++) { + SSize_t j; AV* i_list = newAV(); SV** entryp = av_fetch(from_list, i, FALSE); if (entryp == NULL) { @@ -3908,8 +3542,8 @@ Perl__swash_inversion_hash(pTHX_ SV* con Perl_croak(aTHX_ "panic: hv_store() unexpectedly failed"); } - /* For debugging: UV u = valid_utf8_to_uvchr((U8*) SvPVX(*entryp), 0);*/ - for (j = 0; j <= av_len(from_list); j++) { + /* For DEBUG_U: UV u = valid_utf8_to_uvchr((U8*) SvPVX(*entryp), 0);*/ + for (j = 0; j <= av_tindex(from_list); j++) { entryp = av_fetch(from_list, j, FALSE); if (entryp == NULL) { Perl_croak(aTHX_ "panic: av_fetch() unexpectedly failed"); @@ -3952,7 +3586,7 @@ Perl__swash_inversion_hash(pTHX_ SV* con /* The key is the inverse mapping */ char key[UTF8_MAXBYTES+1]; - char* key_end = (char *) uvuni_to_utf8((U8*) key, val); + char* key_end = (char *) uvchr_to_utf8((U8*) key, val); STRLEN key_len = key_end - key; /* Get the list for the map */ @@ -3968,7 +3602,7 @@ Perl__swash_inversion_hash(pTHX_ SV* con /* Look through list to see if this inverse mapping already is * listed, or if there is a mapping to itself already */ - for (i = 0; i <= av_len(list); i++) { + for (i = 0; i <= av_tindex(list); i++) { SV** entryp = av_fetch(list, i, FALSE); SV* entry; if (entryp == NULL) { @@ -4079,43 +3713,76 @@ Perl__swash_to_invlist(pTHX_ SV* const s loc = (char *) l; lend = l + lcur; - /* Scan the input to count the number of lines to preallocate array size - * based on worst possible case, which is each line in the input creates 2 - * elements in the inversion list: 1) the beginning of a range in the list; - * 2) the beginning of a range not in the list. */ - while ((loc = (strchr(loc, '\n'))) != NULL) { - elements += 2; - loc++; - } + if (*l == 'V') { /* Inversion list format */ + char *after_strtol = (char *) lend; + UV element0; + UV* other_elements_ptr; + + /* The first number is a count of the rest */ + l++; + elements = Strtoul((char *)l, &after_strtol, 10); + if (elements == 0) { + invlist = _new_invlist(0); + } + else { + l = (U8 *) after_strtol; - /* If the ending is somehow corrupt and isn't a new line, add another - * element for the final range that isn't in the inversion list */ - if (! (*lend == '\n' - || (*lend == '\0' && (lcur == 0 || *(lend - 1) == '\n')))) - { - elements++; + /* Get the 0th element, which is needed to setup the inversion list */ + element0 = (UV) Strtoul((char *)l, &after_strtol, 10); + l = (U8 *) after_strtol; + invlist = _setup_canned_invlist(elements, element0, &other_elements_ptr); + elements--; + + /* Then just populate the rest of the input */ + while (elements-- > 0) { + if (l > lend) { + Perl_croak(aTHX_ "panic: Expecting %"UVuf" more elements than available", elements); + } + *other_elements_ptr++ = (UV) Strtoul((char *)l, &after_strtol, 10); + l = (U8 *) after_strtol; + } + } } + else { - invlist = _new_invlist(elements); + /* Scan the input to count the number of lines to preallocate array + * size based on worst possible case, which is each line in the input + * creates 2 elements in the inversion list: 1) the beginning of a + * range in the list; 2) the beginning of a range not in the list. */ + while ((loc = (strchr(loc, '\n'))) != NULL) { + elements += 2; + loc++; + } - /* Now go through the input again, adding each range to the list */ - while (l < lend) { - UV start, end; - UV val; /* Not used by this function */ + /* If the ending is somehow corrupt and isn't a new line, add another + * element for the final range that isn't in the inversion list */ + if (! (*lend == '\n' + || (*lend == '\0' && (lcur == 0 || *(lend - 1) == '\n')))) + { + elements++; + } - l = S_swash_scan_list_line(aTHX_ l, lend, &start, &end, &val, - cBOOL(octets), typestr); + invlist = _new_invlist(elements); - if (l > lend) { - break; - } + /* Now go through the input again, adding each range to the list */ + while (l < lend) { + UV start, end; + UV val; /* Not used by this function */ - invlist = _add_range_to_invlist(invlist, start, end); + l = S_swash_scan_list_line(aTHX_ l, lend, &start, &end, &val, + cBOOL(octets), typestr); + + if (l > lend) { + break; + } + + invlist = _add_range_to_invlist(invlist, start, end); + } } /* Invert if the data says it should be */ if (invert_it_svp && SvUV(*invert_it_svp)) { - _invlist_invert_prop(invlist); + _invlist_invert(invlist); } /* This code is copied from swatch_get() @@ -4192,6 +3859,7 @@ Perl__swash_to_invlist(pTHX_ SV* const s sv_free(other); /* through with it! */ } + SvREADONLY_on(invlist); return invlist; } @@ -4220,68 +3888,6 @@ Perl__get_swash_invlist(pTHX_ SV* const return *ptr; } -/* -=for apidoc uvchr_to_utf8 - -Adds the UTF-8 representation of the Native code point C to the end -of the string C; C should have at least C free -bytes available. The return value is the pointer to the byte after the -end of the new character. In other words, - - d = uvchr_to_utf8(d, uv); - -is the recommended wide native character-aware way of saying - - *(d++) = uv; - -=cut -*/ - -/* On ASCII machines this is normally a macro but we want a - real function in case XS code wants it -*/ -U8 * -Perl_uvchr_to_utf8(pTHX_ U8 *d, UV uv) -{ - PERL_ARGS_ASSERT_UVCHR_TO_UTF8; - - return Perl_uvuni_to_utf8_flags(aTHX_ d, NATIVE_TO_UNI(uv), 0); -} - -U8 * -Perl_uvchr_to_utf8_flags(pTHX_ U8 *d, UV uv, UV flags) -{ - PERL_ARGS_ASSERT_UVCHR_TO_UTF8_FLAGS; - - return Perl_uvuni_to_utf8_flags(aTHX_ d, NATIVE_TO_UNI(uv), flags); -} - -/* -=for apidoc utf8n_to_uvchr - -Returns the native character value of the first character in the string -C -which is assumed to be in UTF-8 encoding; C will be set to the -length, in bytes, of that character. - -C and C are the same as L(). - -=cut -*/ -/* On ASCII machines this is normally a macro but we want - a real function in case XS code wants it -*/ -UV -Perl_utf8n_to_uvchr(pTHX_ const U8 *s, STRLEN curlen, STRLEN *retlen, -U32 flags) -{ - const UV uv = Perl_utf8n_to_uvuni(aTHX_ s, curlen, retlen, flags); - - PERL_ARGS_ASSERT_UTF8N_TO_UVCHR; - - return UNI_TO_NATIVE(uv); -} - bool Perl_check_utf8_print(pTHX_ const U8* s, const STRLEN len) { @@ -4488,13 +4094,11 @@ L or +L>. + +This function is a deprecated synonym for L, +which itself, while not deprecated, should be used only in isolated +circumstances. These functions were useful for code that wanted to handle +both EBCDIC and ASCII platforms with Unicode properties, but starting in Perl +v5.20, the distinctions between the platforms have mostly been made invisible +to most code, so this function is quite unlikely to be what you want. + +=cut +*/ + +U8 * +Perl_uvuni_to_utf8_flags(pTHX_ U8 *d, UV uv, UV flags) +{ + PERL_ARGS_ASSERT_UVUNI_TO_UTF8_FLAGS; + + return uvoffuni_to_utf8_flags(d, uv, flags); +} + +/* +=for apidoc utf8n_to_uvuni + +Instead use L, or rarely, L. + +This function was useful for code that wanted to handle both EBCDIC and +ASCII platforms with Unicode properties, but starting in Perl v5.20, the +distinctions between the platforms have mostly been made invisible to most +code, so this function is quite unlikely to be what you want. If you do need +this precise functionality, use instead +C> +or C>. + +=cut +*/ /* * Local variables: Index: gnu/usr.bin/perl/utf8.h =================================================================== RCS file: /mnt/memory/perl/importit/cvs/src/gnu/usr.bin/perl/utf8.h,v retrieving revision 1.1.1.10 diff -u -p -u -p -r1.1.1.10 utf8.h --- gnu/usr.bin/perl/utf8.h 24 Mar 2014 14:58:48 -0000 1.1.1.10 +++ gnu/usr.bin/perl/utf8.h 16 Nov 2014 03:22:24 -0000 @@ -26,6 +26,9 @@ # define USE_UTF8_IN_NAMES (PL_hints & HINT_UTF8) #endif +#include "regcharclass.h" +#include "unicode_constants.h" + /* For to_utf8_fold_flags, q.v. */ #define FOLD_FLAGS_LOCALE 0x1 #define FOLD_FLAGS_FULL 0x2 @@ -36,21 +39,26 @@ #define _CORE_SWASH_INIT_RETURN_IF_UNDEF 0x2 #define _CORE_SWASH_INIT_ACCEPT_INVLIST 0x4 +#define uvchr_to_utf8(a,b) uvchr_to_utf8_flags(a,b,0) +#define uvchr_to_utf8_flags(d,uv,flags) \ + uvoffuni_to_utf8_flags(d,NATIVE_TO_UNI(uv),flags) +#define utf8_to_uvchr_buf(s, e, lenp) \ + utf8n_to_uvchr(s, (U8*)(e) - (U8*)(s), lenp, \ + ckWARN_d(WARN_UTF8) ? 0 : UTF8_ALLOW_ANY) + #define to_uni_fold(c, p, lenp) _to_uni_fold_flags(c, p, lenp, FOLD_FLAGS_FULL) -#define to_utf8_fold(c, p, lenp) _to_utf8_fold_flags(c, p, lenp, \ - FOLD_FLAGS_FULL, NULL) -#define to_utf8_lower(a,b,c) _to_utf8_lower_flags(a,b,c,0, NULL) -#define to_utf8_upper(a,b,c) _to_utf8_upper_flags(a,b,c,0, NULL) -#define to_utf8_title(a,b,c) _to_utf8_title_flags(a,b,c,0, NULL) +#define to_utf8_fold(c, p, lenp) _to_utf8_fold_flags(c, p, lenp, FOLD_FLAGS_FULL) +#define to_utf8_lower(a,b,c) _to_utf8_lower_flags(a,b,c,0) +#define to_utf8_upper(a,b,c) _to_utf8_upper_flags(a,b,c,0) +#define to_utf8_title(a,b,c) _to_utf8_title_flags(a,b,c,0) /* Source backward compatibility. */ -#define uvuni_to_utf8(d, uv) uvuni_to_utf8_flags(d, uv, 0) #define is_utf8_string_loc(s, len, ep) is_utf8_string_loclen(s, len, ep, 0) #define foldEQ_utf8(s1, pe1, l1, u1, s2, pe2, l2, u2) \ foldEQ_utf8_flags(s1, pe1, l1, u1, s2, pe2, l2, u2, 0) -#define FOLDEQ_UTF8_NOMIX_ASCII (1 << 0) -#define FOLDEQ_UTF8_LOCALE (1 << 1) +#define FOLDEQ_UTF8_NOMIX_ASCII (1 << 0) +#define FOLDEQ_LOCALE (1 << 1) #define FOLDEQ_S1_ALREADY_FOLDED (1 << 2) #define FOLDEQ_S2_ALREADY_FOLDED (1 << 3) @@ -102,28 +110,23 @@ EXTCONST unsigned char PL_utf8skip[]; END_EXTERN_C -#include "regcharclass.h" -#include "unicode_constants.h" +/* Native character to/from iso-8859-1. Are the identity functions on ASCII + * platforms */ +#define NATIVE_TO_LATIN1(ch) (ch) +#define LATIN1_TO_NATIVE(ch) (ch) + +/* I8 is an intermediate version of UTF-8 used only in UTF-EBCDIC. We thus + * consider it to be identical to UTF-8 on ASCII platforms. Strictly speaking + * UTF-8 and UTF-EBCDIC are two different things, but we often conflate them + * because they are 8-bit encodings that serve the same purpose in Perl, and + * rarely do we need to distinguish them. The term "NATIVE_UTF8" applies to + * whichever one is applicable on the current platform */ +#define NATIVE_UTF8_TO_I8(ch) (ch) +#define I8_TO_NATIVE_UTF8(ch) (ch) -/* Native character to iso-8859-1 */ -#define NATIVE_TO_ASCII(ch) (ch) -#define ASCII_TO_NATIVE(ch) (ch) -/* Transform after encoding */ -#define NATIVE_TO_UTF(ch) (ch) -#define NATIVE_TO_I8(ch) NATIVE_TO_UTF(ch) /* a clearer synonym */ -#define UTF_TO_NATIVE(ch) (ch) -#define I8_TO_NATIVE(ch) UTF_TO_NATIVE(ch) /* Transforms in wide UV chars */ #define UNI_TO_NATIVE(ch) (ch) #define NATIVE_TO_UNI(ch) (ch) -/* Transforms in invariant space */ -#define NATIVE_TO_NEED(enc,ch) (ch) -#define ASCII_TO_NEED(enc,ch) (ch) - -/* As there are no translations, avoid the function wrapper */ -#define utf8n_to_uvchr utf8n_to_uvuni -#define valid_utf8_to_uvchr valid_utf8_to_uvuni -#define uvchr_to_utf8 uvuni_to_utf8 /* @@ -201,12 +204,12 @@ Perl's extended UTF-8 means we can have /* This defines the 1-bits that are to be in the first byte of a multi-byte * UTF-8 encoded character that give the number of bytes that comprise the - * character. - * */ -#define UTF_START_MARK(len) (((len) > 7) ? 0xFF : (0xFE << (7-(len)))) + * character. 'len' is the number of bytes in the multi-byte sequence. */ +#define UTF_START_MARK(len) (((len) > 7) ? 0xFF : (0xFF & (0xFE << (7-(len))))) /* Masks out the initial one bits in a start byte, leaving the real data ones. - * Doesn't work on an invariant byte */ + * Doesn't work on an invariant byte. 'len' is the number of bytes in the + * multi-byte sequence that comprises the character. */ #define UTF_START_MASK(len) (((len) >= 7) ? 0x00 : (0x1F >> ((len)-2))) /* This defines the bits that are to be in the continuation bytes of a multi-byte @@ -229,8 +232,11 @@ Perl's extended UTF-8 means we can have (((UV) UTF_CONTINUATION_MASK) << ((sizeof(UV) * CHARBITS) \ - UTF_ACCUMULATION_SHIFT)) -#ifdef HAS_QUAD -#define UNISKIP(uv) ( (uv) < 0x80 ? 1 : \ +#if UVSIZE >= 8 +# define UTF8_QUAD_MAX UINT64_C(0x1000000000) + +/* Input is a true Unicode (not-native) code point */ +#define OFFUNISKIP(uv) ( (uv) < 0x80 ? 1 : \ (uv) < 0x800 ? 2 : \ (uv) < 0x10000 ? 3 : \ (uv) < 0x200000 ? 4 : \ @@ -239,7 +245,7 @@ Perl's extended UTF-8 means we can have (uv) < UTF8_QUAD_MAX ? 7 : 13 ) #else /* No, I'm not even going to *TRY* putting #ifdef inside a #define */ -#define UNISKIP(uv) ( (uv) < 0x80 ? 1 : \ +#define OFFUNISKIP(uv) ( (uv) < 0x80 ? 1 : \ (uv) < 0x800 ? 2 : \ (uv) < 0x10000 ? 3 : \ (uv) < 0x200000 ? 4 : \ @@ -264,6 +270,8 @@ Perl's extended UTF-8 means we can have #error UTF8_MAXBYTES must be at least 12 #endif +#define MAX_UTF8_TWO_BYTE 0x7FF + #define UTF8_MAXBYTES_CASE UTF8_MAXBYTES #endif /* EBCDIC vs ASCII */ @@ -273,27 +281,53 @@ Perl's extended UTF-8 means we can have * this level; the macros that some of these call may have different * definitions in the two encodings */ -#define NATIVE8_TO_UNI(ch) NATIVE_TO_ASCII(ch) /* a clearer synonym */ +/* In domain restricted to ASCII, these may make more sense to the reader than + * the ones with Latin1 in the name */ +#define NATIVE_TO_ASCII(ch) NATIVE_TO_LATIN1(ch) +#define ASCII_TO_NATIVE(ch) LATIN1_TO_NATIVE(ch) + +/* More or less misleadingly-named defines, retained for back compat */ +#define NATIVE_TO_UTF(ch) NATIVE_UTF8_TO_I8(ch) +#define NATIVE_TO_I8(ch) NATIVE_UTF8_TO_I8(ch) +#define UTF_TO_NATIVE(ch) I8_TO_NATIVE_UTF8(ch) +#define I8_TO_NATIVE(ch) I8_TO_NATIVE_UTF8(ch) +#define NATIVE8_TO_UNI(ch) NATIVE_TO_LATIN1(ch) /* Adds a UTF8 continuation byte 'new' of information to a running total code * point 'old' of all the continuation bytes so far. This is designed to be - * used in a loop to convert from UTF-8 to the code point represented */ -#define UTF8_ACCUMULATE(old, new) (((old) << UTF_ACCUMULATION_SHIFT) \ - | (((U8)new) & UTF_CONTINUATION_MASK)) + * used in a loop to convert from UTF-8 to the code point represented. Note + * that this is asymmetric on EBCDIC platforms, in that the 'new' parameter is + * the UTF-EBCDIC byte, whereas the 'old' parameter is a Unicode (not EBCDIC) + * code point in process of being generated */ +#define UTF8_ACCUMULATE(old, new) (((old) << UTF_ACCUMULATION_SHIFT) \ + | ((NATIVE_UTF8_TO_I8((U8)new)) \ + & UTF_CONTINUATION_MASK)) /* This works in the face of malformed UTF-8. */ #define UTF8_IS_NEXT_CHAR_DOWNGRADEABLE(s, e) (UTF8_IS_DOWNGRADEABLE_START(*s) \ && ( (e) - (s) > 1) \ && UTF8_IS_CONTINUATION(*((s)+1))) -/* Convert a two (not one) byte utf8 character to a unicode code point value. +/* Number of bytes a code point occupies in UTF-8. */ +#define NATIVE_SKIP(uv) OFFUNISKIP(NATIVE_TO_UNI(uv)) + +/* Most code which says UNISKIP is really thinking in terms of native code + * points (0-255) plus all those beyond. This is an imprecise term, but having + * it means existing code continues to work. For precision, use NATIVE_SKIP + * and OFFUNISKIP */ +#define UNISKIP(uv) NATIVE_SKIP(uv) + +/* Convert a two (not one) byte utf8 character to a native code point value. * Needs just one iteration of accumulate. Should not be used unless it is * known that the two bytes are legal: 1) two-byte start, and 2) continuation. * Note that the result can be larger than 255 if the input character is not * downgradable */ -#define TWO_BYTE_UTF8_TO_UNI(HI, LO) \ - UTF8_ACCUMULATE((NATIVE_TO_UTF(HI) & UTF_START_MASK(2)), \ - NATIVE_TO_UTF(LO)) +#define TWO_BYTE_UTF8_TO_NATIVE(HI, LO) \ + UNI_TO_NATIVE(UTF8_ACCUMULATE((NATIVE_UTF8_TO_I8(HI) & UTF_START_MASK(2)), \ + (LO))) + +/* Should never be used, and be deprecated */ +#define TWO_BYTE_UTF8_TO_UNI(HI, LO) NATIVE_TO_UNI(TWO_BYTE_UTF8_TO_NATIVE(HI, LO)) /* How many bytes in the UTF-8 encoded character whose first (perhaps only) * byte is pointed to by 's' */ @@ -303,27 +337,63 @@ Perl's extended UTF-8 means we can have * works on both UTF-8 encoded strings and non-encoded, as it returns TRUE in * each for the exact same set of bit patterns. (And it works on any byte in a * UTF-8 encoded string) */ -#define UTF8_IS_INVARIANT(c) UNI_IS_INVARIANT(NATIVE_TO_UTF(c)) +#define UTF8_IS_INVARIANT(c) UNI_IS_INVARIANT(NATIVE_UTF8_TO_I8(c)) -#define NATIVE_IS_INVARIANT(c) UNI_IS_INVARIANT(NATIVE8_TO_UNI(c)) +/* Like the above, but its name implies a non-UTF8 input, and is implemented + * differently (for no particular reason) */ +#define NATIVE_BYTE_IS_INVARIANT(c) UNI_IS_INVARIANT(NATIVE_TO_LATIN1(c)) + +/* Like the above, but accepts any UV as input */ +#define UVCHR_IS_INVARIANT(uv) UNI_IS_INVARIANT(NATIVE_TO_UNI(uv)) #define MAX_PORTABLE_UTF8_TWO_BYTE 0x3FF /* constrained by EBCDIC */ -/* The macros in the next sets are used to generate the two utf8 or utfebcdic - * bytes from an ordinal that is known to fit into two bytes; it must be less - * than 0x3FF to work across both encodings. */ -/* Nocast allows these to be used in the case label of a switch statement */ -#define UTF8_TWO_BYTE_HI_nocast(c) NATIVE_TO_I8(((c) \ - >> UTF_ACCUMULATION_SHIFT) | (0xFF & UTF_START_MARK(2))) -#define UTF8_TWO_BYTE_LO_nocast(c) NATIVE_TO_I8(((c) & UTF_CONTINUATION_MASK) \ - | UTF_CONTINUATION_MARK) - -#define UTF8_TWO_BYTE_HI(c) ((U8) (UTF8_TWO_BYTE_HI_nocast(c))) -#define UTF8_TWO_BYTE_LO(c) ((U8) (UTF8_TWO_BYTE_LO_nocast(c))) - -/* This name is used when the source is a single byte */ -#define UTF8_EIGHT_BIT_HI(c) UTF8_TWO_BYTE_HI((U8)(c)) -#define UTF8_EIGHT_BIT_LO(c) UTF8_TWO_BYTE_LO((U8)(c)) +/* The macros in the next 4 sets are used to generate the two utf8 or utfebcdic + * bytes from an ordinal that is known to fit into exactly two (not one) bytes; + * it must be less than 0x3FF to work across both encodings. */ + +/* These two are helper macros for the other three sets, and should not be used + * directly anywhere else. 'translate_function' is either NATIVE_TO_LATIN1 + * (which works for code points up to 0xFF) or NATIVE_TO_UNI which works for any + * code point */ +#define __BASE_TWO_BYTE_HI(c, translate_function) \ + I8_TO_NATIVE_UTF8((translate_function(c) >> UTF_ACCUMULATION_SHIFT) \ + | UTF_START_MARK(2)) +#define __BASE_TWO_BYTE_LO(c, translate_function) \ + I8_TO_NATIVE_UTF8((translate_function(c) & UTF_CONTINUATION_MASK) \ + | UTF_CONTINUATION_MARK) + +/* The next two macros should not be used. They were designed to be usable as + * the case label of a switch statement, but this doesn't work for EBCDIC. Use + * regen/unicode_constants.pl instead */ +#define UTF8_TWO_BYTE_HI_nocast(c) __BASE_TWO_BYTE_HI(c, NATIVE_TO_UNI) +#define UTF8_TWO_BYTE_LO_nocast(c) __BASE_TWO_BYTE_LO(c, NATIVE_TO_UNI) + +/* The next two macros are used when the source should be a single byte + * character; checked for under DEBUGGING */ +#define UTF8_EIGHT_BIT_HI(c) (__ASSERT_(FITS_IN_8_BITS(c)) \ + ((U8) __BASE_TWO_BYTE_HI(c, NATIVE_TO_LATIN1))) +#define UTF8_EIGHT_BIT_LO(c) (__ASSERT_(FITS_IN_8_BITS(c)) \ + ((U8) __BASE_TWO_BYTE_LO(c, NATIVE_TO_LATIN1))) + +/* These final two macros in the series are used when the source can be any + * code point whose UTF-8 is known to occupy 2 bytes; they are less efficient + * than the EIGHT_BIT versions on EBCDIC platforms. We use the logical '~' + * operator instead of "<=" to avoid getting compiler warnings. + * MAX_PORTABLE_UTF8_TWO_BYTE should be exactly all one bits in the lower few + * places, so the ~ works */ +#define UTF8_TWO_BYTE_HI(c) \ + (__ASSERT_((sizeof(c) == 1) \ + || !(((WIDEST_UTYPE)(c)) & ~MAX_PORTABLE_UTF8_TWO_BYTE)) \ + ((U8) __BASE_TWO_BYTE_HI(c, NATIVE_TO_LATIN1))) +#define UTF8_TWO_BYTE_LO(c) \ + (__ASSERT_((sizeof(c) == 1) \ + || !(((WIDEST_UTYPE)(c)) & ~MAX_PORTABLE_UTF8_TWO_BYTE)) \ + ((U8) __BASE_TWO_BYTE_LO(c, NATIVE_TO_LATIN1))) + +/* This is illegal in any well-formed UTF-8 in both EBCDIC and ASCII + * as it is only in overlongs. */ +#define ILLEGAL_UTF8_BYTE I8_TO_NATIVE_UTF8(0xC1) /* * 'UTF' is whether or not p is encoded in UTF8. The names 'foo_lazy_if' stem @@ -376,7 +446,9 @@ Perl's extended UTF-8 means we can have #define UTF8_WARN_SUPER 0x0400 /* points above the legal max */ /* Code points which never were part of the original UTF-8 standard, the first - * byte of which is a FE or FF on ASCII platforms. */ + * byte of which is a FE or FF on ASCII platforms. If the first byte is FF, it + * will overflow a 32-bit word. If the first byte is FE, it will overflow a + * signed 32-bit word. */ #define UTF8_DISALLOW_FE_FF 0x0800 #define UTF8_WARN_FE_FF 0x1000 @@ -415,9 +487,9 @@ Perl's extended UTF-8 means we can have * U+110001: \xF4\x90\x80\x81 \xF9\xA2\xA0\xA0\xA1 */ #ifdef EBCDIC /* Both versions assume well-formed UTF8 */ -# define UTF8_IS_SUPER(s) (NATIVE_TO_I8(* (U8*) (s)) >= 0xF9 \ - && (NATIVE_TO_I8(* (U8*) (s)) > 0xF9 \ - || (NATIVE_TO_I8(* (U8*) ((s)) + 1 >= 0xA2)))) +# define UTF8_IS_SUPER(s) (NATIVE_UTF8_TO_I8(* (U8*) (s)) >= 0xF9 \ + && (NATIVE_UTF8_TO_I8(* (U8*) (s)) > 0xF9 \ + || (NATIVE_UTF8_TO_I8(* ((U8*) (s) + 1)) >= 0xA2))) #else # define UTF8_IS_SUPER(s) (*(U8*) (s) >= 0xF4 \ && (*(U8*) (s) > 0xF4 || (*((U8*) (s) + 1) >= 0x90))) @@ -471,10 +543,6 @@ Perl's extended UTF-8 means we can have #define UNICODE_IS_SUPER(c) ((c) > PERL_UNICODE_MAX) #define UNICODE_IS_FE_FF(c) ((c) > 0x7FFFFFFF) -#ifdef HAS_QUAD -# define UTF8_QUAD_MAX UINT64_C(0x1000000000) -#endif - #define LATIN_SMALL_LETTER_SHARP_S LATIN_SMALL_LETTER_SHARP_S_NATIVE #define LATIN_SMALL_LETTER_Y_WITH_DIAERESIS \ LATIN_SMALL_LETTER_Y_WITH_DIAERESIS_NATIVE @@ -487,12 +555,15 @@ Perl's extended UTF-8 means we can have #define UNICODE_GREEK_SMALL_LETTER_FINAL_SIGMA 0x03C2 #define UNICODE_GREEK_SMALL_LETTER_SIGMA 0x03C3 #define GREEK_SMALL_LETTER_MU 0x03BC -#define GREEK_CAPITAL_LETTER_MU 0x039C /* Upper and title case of MICRON */ -#define LATIN_CAPITAL_LETTER_Y_WITH_DIAERESIS 0x0178 /* Also is title case */ -#define LATIN_CAPITAL_LETTER_SHARP_S 0x1E9E -#define LATIN_SMALL_LETTER_LONG_S 0x017F -#define KELVIN_SIGN 0x212A -#define ANGSTROM_SIGN 0x212B +#define GREEK_CAPITAL_LETTER_MU 0x039C /* Upper and title case + of MICRON */ +#define LATIN_CAPITAL_LETTER_Y_WITH_DIAERESIS 0x0178 /* Also is title case */ +#define LATIN_CAPITAL_LETTER_SHARP_S 0x1E9E +#define LATIN_SMALL_LETTER_LONG_S 0x017F +#define LATIN_SMALL_LIGATURE_LONG_S_T 0xFB05 +#define LATIN_SMALL_LIGATURE_ST 0xFB06 +#define KELVIN_SIGN 0x212A +#define ANGSTROM_SIGN 0x212B #define UNI_DISPLAY_ISPRINT 0x0001 #define UNI_DISPLAY_BACKSLASH 0x0002 @@ -504,8 +575,8 @@ Perl's extended UTF-8 means we can have (ANYOF_NONBITMAP(node)) && \ (ANYOF_FLAGS(node) & ANYOF_LOC_NONBITMAP_FOLD) && \ ((end) > (input) + 1) && \ - toLOWER((input)[0]) == 's' && \ - toLOWER((input)[1]) == 's') + toFOLD((input)[0]) == 's' && \ + toFOLD((input)[1]) == 's') #define SHARP_S_SKIP 2 /* If you want to exclude surrogates, and beyond legal Unicode, see the blame Index: gnu/usr.bin/perl/utfebcdic.h =================================================================== RCS file: /mnt/memory/perl/importit/cvs/src/gnu/usr.bin/perl/utfebcdic.h,v retrieving revision 1.1.1.8 diff -u -p -u -p -r1.1.1.8 utfebcdic.h --- gnu/usr.bin/perl/utfebcdic.h 24 Mar 2014 14:58:48 -0000 1.1.1.8 +++ gnu/usr.bin/perl/utfebcdic.h 16 Nov 2014 03:22:24 -0000 @@ -43,7 +43,7 @@ * first byte of the final form of a variant will always have its upper * bit set (at least in the encodings that Perl recognizes, and probably * all). But note that the upper bit of some invariants is also 1. - * + * * If you're starting from Unicode, skip step 1. For UTF-EBCDIC to straight * EBCDIC, reverse the steps. * @@ -51,19 +51,19 @@ * equivalents have ordinal numbers less than 160, that is the same characters * that are expressible in ASCII, plus the C1 controls. So there are 160 * invariants instead of the 128 in UTF-8. (My guess is that this is because - * the C1 control NEL (and maybe others) is important in IBM.) + * the C1 control NEL (and maybe others) is important in IBM.) * * The purpose of Step 3 is to make the encoding be invariant for the chosen * characters. This messes up the convenient patterns found in step 2, so * generally, one has to undo step 3 into a temporary to use them. However, * a "shadow", or parallel table, PL_utf8skip, has been constructed so that for - * each byte, it says how long the sequence is if that byte were to begin it + * each byte, it says how long the sequence is if that byte were to begin it * * There are actually 3 slightly different UTF-EBCDIC encodings in this file, * one for each of the code pages recognized by Perl. That means that there * are actually three different sets of tables, one for each code page. (If * Perl is compiled on platforms using another EBCDIC code page, it may not - * compile, or Perl may silently mistake it for one of the three.) + * compile, or Perl may silently mistake it for one of the three.) * * EBCDIC characters above 0xFF are the same as Unicode in Perl's * implementation of all 3 encodings, so for those Step 1 is trivial. @@ -85,7 +85,7 @@ START_EXTERN_C as length 1 here so that we can recover. */ #if '^' == 95 /* if defined(__MVS__) || defined(??) (VM/ESA?) 1047 */ -EXTCONST unsigned char PL_utf8skip[] = { +EXTCONST U8 PL_utf8skip[] = { 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, @@ -106,7 +106,7 @@ EXTCONST unsigned char PL_utf8skip[] = { #endif #if '^' == 106 /* if defined(_OSD_POSIX) POSIX-BC */ -unsigned char PL_utf8skip[] = { +U8 PL_utf8skip[] = { 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, @@ -127,7 +127,7 @@ unsigned char PL_utf8skip[] = { #endif #if '^' == 176 /* if defined(??) (OS/400?) 037 */ -unsigned char PL_utf8skip[] = { +U8 PL_utf8skip[] = { 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, @@ -152,7 +152,7 @@ unsigned char PL_utf8skip[] = { * remains 'A' */ #if '^' == 95 /* if defined(__MVS__) || defined(??) (VM/ESA?) 1047 */ -EXTCONST unsigned char PL_utf2e[] = { /* I8 to UTFEBCDIC (IBM-1047) */ +EXTCONST U8 PL_utf2e[] = { /* I8 to UTFEBCDIC (IBM-1047) */ 0x00, 0x01, 0x02, 0x03, 0x37, 0x2D, 0x2E, 0x2F, 0x16, 0x05, 0x15, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, 0x10, 0x11, 0x12, 0x13, 0x3C, 0x3D, 0x32, 0x26, 0x18, 0x19, 0x3F, 0x27, 0x1C, 0x1D, 0x1E, 0x1F, 0x40, 0x5A, 0x7F, 0x7B, 0x5B, 0x6C, 0x50, 0x7D, 0x4D, 0x5D, 0x5C, 0x4E, 0x6B, 0x60, 0x4B, 0x61, @@ -171,7 +171,7 @@ EXTCONST unsigned char PL_utf2e[] = { /* 0xDC, 0xDD, 0xDE, 0xDF, 0xE1, 0xEA, 0xEB, 0xEC, 0xED, 0xEE, 0xEF, 0xFA, 0xFB, 0xFC, 0xFD, 0xFE }; -EXTCONST unsigned char PL_e2utf[] = { /* UTFEBCDIC (IBM-1047) to I8 */ +EXTCONST U8 PL_e2utf[] = { /* UTFEBCDIC (IBM-1047) to I8 */ 0x00, 0x01, 0x02, 0x03, 0x9C, 0x09, 0x86, 0x7F, 0x97, 0x8D, 0x8E, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, 0x10, 0x11, 0x12, 0x13, 0x9D, 0x0A, 0x08, 0x87, 0x18, 0x19, 0x92, 0x8F, 0x1C, 0x1D, 0x1E, 0x1F, 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x17, 0x1B, 0x88, 0x89, 0x8A, 0x8B, 0x8C, 0x05, 0x06, 0x07, @@ -192,7 +192,7 @@ EXTCONST unsigned char PL_e2utf[] = { /* #endif /* 1047 */ #if '^' == 106 /* if defined(_OSD_POSIX) POSIX-BC */ -unsigned char PL_utf2e[] = { /* I8 to UTFEBCDIC (POSIX-BC) */ +U8 PL_utf2e[] = { /* I8 to UTFEBCDIC (POSIX-BC) */ 0x00, 0x01, 0x02, 0x03, 0x37, 0x2D, 0x2E, 0x2F, 0x16, 0x05, 0x15, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, 0x10, 0x11, 0x12, 0x13, 0x3C, 0x3D, 0x32, 0x26, 0x18, 0x19, 0x3F, 0x27, 0x1C, 0x1D, 0x1E, 0x1F, 0x40, 0x5A, 0x7F, 0x7B, 0x5B, 0x6C, 0x50, 0x7D, 0x4D, 0x5D, 0x5C, 0x4E, 0x6B, 0x60, 0x4B, 0x61, @@ -211,7 +211,7 @@ unsigned char PL_utf2e[] = { /* I8 to UT 0xDC, 0xC0, 0xDE, 0xDF, 0xE1, 0xEA, 0xEB, 0xEC, 0xED, 0xEE, 0xEF, 0xFA, 0xDD, 0xFC, 0xE0, 0xFE }; -unsigned char PL_e2utf[] = { /* UTFEBCDIC (POSIX-BC) to I8 */ +U8 PL_e2utf[] = { /* UTFEBCDIC (POSIX-BC) to I8 */ 0x00, 0x01, 0x02, 0x03, 0x9C, 0x09, 0x86, 0x7F, 0x97, 0x8D, 0x8E, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, 0x10, 0x11, 0x12, 0x13, 0x9D, 0x0A, 0x08, 0x87, 0x18, 0x19, 0x92, 0x8F, 0x1C, 0x1D, 0x1E, 0x1F, 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x17, 0x1B, 0x88, 0x89, 0x8A, 0x8B, 0x8C, 0x05, 0x06, 0x07, @@ -232,7 +232,7 @@ unsigned char PL_e2utf[] = { /* UTFEBCDI #endif /* POSIX-BC */ #if '^' == 176 /* if defined(??) (OS/400?) 037 */ -unsigned char PL_utf2e[] = { /* I8 to UTFEBCDIC (IBM-037) */ +U8 PL_utf2e[] = { /* I8 to UTFEBCDIC (IBM-037) */ 0x00, 0x01, 0x02, 0x03, 0x37, 0x2D, 0x2E, 0x2F, 0x16, 0x05, 0x25, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, 0x10, 0x11, 0x12, 0x13, 0x3C, 0x3D, 0x32, 0x26, 0x18, 0x19, 0x3F, 0x27, 0x1C, 0x1D, 0x1E, 0x1F, 0x40, 0x5A, 0x7F, 0x7B, 0x5B, 0x6C, 0x50, 0x7D, 0x4D, 0x5D, 0x5C, 0x4E, 0x6B, 0x60, 0x4B, 0x61, @@ -251,7 +251,7 @@ unsigned char PL_utf2e[] = { /* I8 to UT 0xDC, 0xDD, 0xDE, 0xDF, 0xE1, 0xEA, 0xEB, 0xEC, 0xED, 0xEE, 0xEF, 0xFA, 0xFB, 0xFC, 0xFD, 0xFE }; -unsigned char PL_e2utf[] = { /* UTFEBCDIC (IBM-037) to I8 */ +U8 PL_e2utf[] = { /* UTFEBCDIC (IBM-037) to I8 */ 0x00, 0x01, 0x02, 0x03, 0x9C, 0x09, 0x86, 0x7F, 0x97, 0x8D, 0x8E, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, 0x10, 0x11, 0x12, 0x13, 0x9D, 0x85, 0x08, 0x87, 0x18, 0x19, 0x92, 0x8F, 0x1C, 0x1D, 0x1E, 0x1F, 0x80, 0x81, 0x82, 0x83, 0x84, 0x0A, 0x17, 0x1B, 0x88, 0x89, 0x8A, 0x8B, 0x8C, 0x05, 0x06, 0x07, @@ -276,7 +276,7 @@ unsigned char PL_e2utf[] = { /* UTFEBCDI */ #if '^' == 95 /* if defined(__MVS__) || defined(??) (VM/ESA?) 1047 */ -EXTCONST unsigned char PL_a2e[] = { /* ASCII (iso-8859-1) to EBCDIC (IBM-1047) */ +EXTCONST U8 PL_a2e[] = { /* ASCII (iso-8859-1) to EBCDIC (IBM-1047) */ 0x00, 0x01, 0x02, 0x03, 0x37, 0x2D, 0x2E, 0x2F, 0x16, 0x05, 0x15, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, 0x10, 0x11, 0x12, 0x13, 0x3C, 0x3D, 0x32, 0x26, 0x18, 0x19, 0x3F, 0x27, 0x1C, 0x1D, 0x1E, 0x1F, 0x40, 0x5A, 0x7F, 0x7B, 0x5B, 0x6C, 0x50, 0x7D, 0x4D, 0x5D, 0x5C, 0x4E, 0x6B, 0x60, 0x4B, 0x61, @@ -295,7 +295,7 @@ EXTCONST unsigned char PL_a2e[] = { /* A 0x8C, 0x49, 0xCD, 0xCE, 0xCB, 0xCF, 0xCC, 0xE1, 0x70, 0xDD, 0xDE, 0xDB, 0xDC, 0x8D, 0x8E, 0xDF }; -EXTCONST unsigned char PL_e2a[] = { /* EBCDIC (IBM-1047) to ASCII (iso-8859-1) */ +EXTCONST U8 PL_e2a[] = { /* EBCDIC (IBM-1047) to ASCII (iso-8859-1) */ 0x00, 0x01, 0x02, 0x03, 0x9C, 0x09, 0x86, 0x7F, 0x97, 0x8D, 0x8E, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, 0x10, 0x11, 0x12, 0x13, 0x9D, 0x0A, 0x08, 0x87, 0x18, 0x19, 0x92, 0x8F, 0x1C, 0x1D, 0x1E, 0x1F, 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x17, 0x1B, 0x88, 0x89, 0x8A, 0x8B, 0x8C, 0x05, 0x06, 0x07, @@ -314,8 +314,47 @@ EXTCONST unsigned char PL_e2a[] = { /* E 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0xB3, 0xDB, 0xDC, 0xD9, 0xDA, 0x9F }; -EXTCONST unsigned char PL_fold[] = { /* fast EBCDIC case folding table, 'A' => - 'a'; 'a' => 'A' */ +EXTCONST U8 PL_latin1_lc[] = { /* lowercasing */ + 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, + 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F, + 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2A, 0x2B, 0x2C, 0x2D, 0x2E, 0x2F, + 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x3A, 0x3B, 0x3C, 0x3D, 0x3E, 0x3F, + 0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49, 0x4A, 0x4B, 0x4C, 0x4D, 0x4E, 0x4F, + 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, 0x59, 0x5A, 0x5B, 0x5C, 0x5D, 0x5E, 0x5F, + 0x60, 0x61, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49, 0x6A, 0x6B, 0x6C, 0x6D, 0x6E, 0x6F, + 0x70, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, 0x79, 0x7A, 0x7B, 0x7C, 0x7D, 0x7E, 0x7F, + 0x70, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89, 0x8A, 0x8B, 0x8C, 0x8D, 0x8E, 0x8F, + 0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, 0x98, 0x99, 0x9A, 0x9B, 0x9C, 0x9D, 0x9C, 0x9F, + 0xA0, 0xA1, 0xA2, 0xA3, 0xA4, 0xA5, 0xA6, 0xA7, 0xA8, 0xA9, 0xAA, 0xAB, 0x8C, 0xAD, 0x8E, 0xAF, + 0xB0, 0xB1, 0xB2, 0xB3, 0xB4, 0xB5, 0xB6, 0xB7, 0xB8, 0xB9, 0x8D, 0xBB, 0xBC, 0xBD, 0xBE, 0xBF, + 0xC0, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89, 0xCA, 0xCB, 0xCC, 0xCD, 0xCE, 0xCF, + 0xD0, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, 0x98, 0x99, 0xDA, 0xDB, 0xDC, 0xDD, 0xDE, 0xDF, + 0xE0, 0xE1, 0xA2, 0xA3, 0xA4, 0xA5, 0xA6, 0xA7, 0xA8, 0xA9, 0xEA, 0xCB, 0xCC, 0xCD, 0xCE, 0xCF, + 0xF0, 0xF1, 0xF2, 0xF3, 0xF4, 0xF5, 0xF6, 0xF7, 0xF8, 0xF9, 0xFA, 0xDB, 0xDC, 0xDD, 0xDE, 0xFF +}; + +EXTCONST U8 PL_mod_latin1_uc[] = { /* uppercasing */ + 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, + 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F, + 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2A, 0x2B, 0x2C, 0x2D, 0x2E, 0x2F, + 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x3A, 0x3B, 0x3C, 0x3D, 0x3E, 0x3F, + 0x40, 0x41, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x4A, 0x4B, 0x4C, 0x4D, 0x4E, 0x4F, + 0x50, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, 0xDF, 0x5A, 0x5B, 0x5C, 0x5D, 0x5E, 0x5F, + 0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x6A, 0x6B, 0x6C, 0x6D, 0x6E, 0x6F, + 0x80, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, 0x79, 0x7A, 0x7B, 0x7C, 0x7D, 0x7E, 0x7F, + 0x80, 0xC1, 0xC2, 0xC3, 0xC4, 0xC5, 0xC6, 0xC7, 0xC8, 0xC9, 0x8A, 0x8B, 0xAC, 0xBA, 0xAE, 0x8F, + 0x90, 0xD1, 0xD2, 0xD3, 0xD4, 0xD5, 0xD6, 0xD7, 0xD8, 0xD9, 0x9A, 0x9B, 0x9E, 0x9D, 0x9E, 0x9F, + 0xDF, 0xA1, 0xE2, 0xE3, 0xE4, 0xE5, 0xE6, 0xE7, 0xE8, 0xE9, 0xAA, 0xAB, 0xAC, 0xAD, 0xAE, 0xAF, + 0xB0, 0xB1, 0xB2, 0xB3, 0xB4, 0xB5, 0xB6, 0xB7, 0xB8, 0xB9, 0xBA, 0xBB, 0xBC, 0xBD, 0xBE, 0xBF, + 0xC0, 0xC1, 0xC2, 0xC3, 0xC4, 0xC5, 0xC6, 0xC7, 0xC8, 0xC9, 0xCA, 0xEB, 0xEC, 0xED, 0xEE, 0xEF, + 0xD0, 0xD1, 0xD2, 0xD3, 0xD4, 0xD5, 0xD6, 0xD7, 0xD8, 0xD9, 0xDA, 0xFB, 0xFC, 0xFD, 0xFE, 0xDF, + 0xE0, 0xE1, 0xE2, 0xE3, 0xE4, 0xE5, 0xE6, 0xE7, 0xE8, 0xE9, 0xEA, 0xEB, 0xEC, 0xED, 0xEE, 0xEF, + 0xF0, 0xF1, 0xF2, 0xF3, 0xF4, 0xF5, 0xF6, 0xF7, 0xF8, 0xF9, 0xFA, 0xFB, 0xFC, 0xFD, 0xFE, 0xFF +}; + +EXTCONST U8 PL_fold_latin1[] = { /* fast EBCDIC case folding table, + 'A' => 'a'; 'a' => 'A'; full + 0-255 range */ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, @@ -352,7 +391,7 @@ EXTCONST unsigned char PL_fold[] = { /* #endif /* 1047 */ #if '^' == 106 /* if defined(_OSD_POSIX) POSIX-BC */ -EXTCONST unsigned char PL_a2e[] = { /* ASCII (ISO8859-1) to EBCDIC (POSIX-BC) */ +EXTCONST U8 PL_a2e[] = { /* ASCII (ISO8859-1) to EBCDIC (POSIX-BC) */ 0x00, 0x01, 0x02, 0x03, 0x37, 0x2D, 0x2E, 0x2F, 0x16, 0x05, 0x15, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, 0x10, 0x11, 0x12, 0x13, 0x3C, 0x3D, 0x32, 0x26, 0x18, 0x19, 0x3F, 0x27, 0x1C, 0x1D, 0x1E, 0x1F, 0x40, 0x5A, 0x7F, 0x7B, 0x5B, 0x6C, 0x50, 0x7D, 0x4D, 0x5D, 0x5C, 0x4E, 0x6B, 0x60, 0x4B, 0x61, @@ -371,7 +410,7 @@ EXTCONST unsigned char PL_a2e[] = { /* A 0x8C, 0x49, 0xCD, 0xCE, 0xCB, 0xCF, 0xCC, 0xE1, 0x70, 0xC0, 0xDE, 0xDB, 0xDC, 0x8D, 0x8E, 0xDF }; -EXTCONST unsigned char PL_e2a[] = { /* EBCDIC (POSIX-BC) to ASCII (ISO8859-1) */ +EXTCONST U8 PL_e2a[] = { /* EBCDIC (POSIX-BC) to ASCII (ISO8859-1) */ 0x00, 0x01, 0x02, 0x03, 0x9C, 0x09, 0x86, 0x7F, 0x97, 0x8D, 0x8E, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, 0x10, 0x11, 0x12, 0x13, 0x9D, 0x0A, 0x08, 0x87, 0x18, 0x19, 0x92, 0x8F, 0x1C, 0x1D, 0x1E, 0x1F, 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x17, 0x1B, 0x88, 0x89, 0x8A, 0x8B, 0x8C, 0x05, 0x06, 0x07, @@ -390,8 +429,47 @@ EXTCONST unsigned char PL_e2a[] = { /* E 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0xB3, 0x7B, 0xDC, 0x7D, 0xDA, 0x7E }; -EXTCONST unsigned char PL_fold[] = { /* fast EBCDIC case folding table, 'A' => - 'a'; 'a' => 'A' */ +EXTCONST U8 PL_latin1_lc[] = { /* lowercasing */ + 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, + 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F, + 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2A, 0x2B, 0x2C, 0x2D, 0x2E, 0x2F, + 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x3A, 0x3B, 0x3C, 0x3D, 0x3E, 0x3F, + 0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49, 0x4A, 0x4B, 0x4C, 0x4D, 0x4E, 0x4F, + 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, 0x59, 0x5A, 0x5B, 0x5C, 0x5D, 0x5E, 0x5F, + 0x60, 0x61, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49, 0x6A, 0x6B, 0x6C, 0x6D, 0x6E, 0x6F, + 0x70, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, 0x79, 0x7A, 0x7B, 0x7C, 0x7D, 0x7E, 0x7F, + 0x70, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89, 0x8A, 0x8B, 0x8C, 0x8D, 0x8E, 0x8F, + 0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, 0x98, 0x99, 0x9A, 0x9B, 0x9C, 0x9D, 0x9C, 0x9F, + 0xA0, 0xA1, 0xA2, 0xA3, 0xA4, 0xA5, 0xA6, 0xA7, 0xA8, 0xA9, 0xAA, 0xAB, 0x8C, 0x8D, 0x8E, 0xAF, + 0xB0, 0xB1, 0xB2, 0xB3, 0xB4, 0xB5, 0xB6, 0xB7, 0xB8, 0xB9, 0xBA, 0xBB, 0xBC, 0xBD, 0xBE, 0xBF, + 0xC0, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89, 0xCA, 0xCB, 0xCC, 0xCD, 0xCE, 0xCF, + 0xD0, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, 0x98, 0x99, 0xDA, 0xDB, 0xDC, 0xDB, 0xDE, 0xDF, + 0xC0, 0xE1, 0xA2, 0xA3, 0xA4, 0xA5, 0xA6, 0xA7, 0xA8, 0xA9, 0xEA, 0xCB, 0xCC, 0xCD, 0xCE, 0xCF, + 0xF0, 0xF1, 0xF2, 0xF3, 0xF4, 0xF5, 0xF6, 0xF7, 0xF8, 0xF9, 0xFA, 0xFB, 0xDC, 0xFD, 0xDE, 0xFF +}; + +EXTCONST U8 PL_mod_latin1_uc[] = { /* uppercasing */ + 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, + 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F, + 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2A, 0x2B, 0x2C, 0x2D, 0x2E, 0x2F, + 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x3A, 0x3B, 0x3C, 0x3D, 0x3E, 0x3F, + 0x40, 0x41, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x4A, 0x4B, 0x4C, 0x4D, 0x4E, 0x4F, + 0x50, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, 0xDF, 0x5A, 0x5B, 0x5C, 0x5D, 0x5E, 0x5F, + 0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x6A, 0x6B, 0x6C, 0x6D, 0x6E, 0x6F, + 0x80, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, 0x79, 0x7A, 0x7B, 0x7C, 0x7D, 0x7E, 0x7F, + 0x80, 0xC1, 0xC2, 0xC3, 0xC4, 0xC5, 0xC6, 0xC7, 0xC8, 0xC9, 0x8A, 0x8B, 0xAC, 0xAD, 0xAE, 0x8F, + 0x90, 0xD1, 0xD2, 0xD3, 0xD4, 0xD5, 0xD6, 0xD7, 0xD8, 0xD9, 0x9A, 0x9B, 0x9E, 0x9D, 0x9E, 0x9F, + 0xDF, 0xA1, 0xE2, 0xE3, 0xE4, 0xE5, 0xE6, 0xE7, 0xE8, 0xE9, 0xAA, 0xAB, 0xAC, 0xAD, 0xAE, 0xAF, + 0xB0, 0xB1, 0xB2, 0xB3, 0xB4, 0xB5, 0xB6, 0xB7, 0xB8, 0xB9, 0xBA, 0xBB, 0xBC, 0xBD, 0xBE, 0xBF, + 0xE0, 0xC1, 0xC2, 0xC3, 0xC4, 0xC5, 0xC6, 0xC7, 0xC8, 0xC9, 0xCA, 0xEB, 0xEC, 0xED, 0xEE, 0xEF, + 0xD0, 0xD1, 0xD2, 0xD3, 0xD4, 0xD5, 0xD6, 0xD7, 0xD8, 0xD9, 0xDA, 0xDD, 0xFC, 0xDD, 0xFE, 0xDF, + 0xE0, 0xE1, 0xE2, 0xE3, 0xE4, 0xE5, 0xE6, 0xE7, 0xE8, 0xE9, 0xEA, 0xEB, 0xEC, 0xED, 0xEE, 0xEF, + 0xF0, 0xF1, 0xF2, 0xF3, 0xF4, 0xF5, 0xF6, 0xF7, 0xF8, 0xF9, 0xFA, 0xFB, 0xFC, 0xFD, 0xFE, 0xFF +}; + +EXTCONST U8 PL_fold_latin1[] = { /* fast EBCDIC case folding table, + 'A' => 'a'; 'a' => 'A'; full + 0-255 range */ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, @@ -428,7 +506,7 @@ EXTCONST unsigned char PL_fold[] = { /* #endif /* POSIX-BC */ #if '^' == 176 /* if defined(??) (OS/400?) 037 */ -EXTCONST unsigned char PL_a2e[] = { /* ASCII (ISO8859-1) to EBCDIC (IBM-037) */ +EXTCONST U8 PL_a2e[] = { /* ASCII (ISO8859-1) to EBCDIC (IBM-037) */ 0x00, 0x01, 0x02, 0x03, 0x37, 0x2D, 0x2E, 0x2F, 0x16, 0x05, 0x25, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, 0x10, 0x11, 0x12, 0x13, 0x3C, 0x3D, 0x32, 0x26, 0x18, 0x19, 0x3F, 0x27, 0x1C, 0x1D, 0x1E, 0x1F, 0x40, 0x5A, 0x7F, 0x7B, 0x5B, 0x6C, 0x50, 0x7D, 0x4D, 0x5D, 0x5C, 0x4E, 0x6B, 0x60, 0x4B, 0x61, @@ -447,7 +525,7 @@ EXTCONST unsigned char PL_a2e[] = { /* A 0x8C, 0x49, 0xCD, 0xCE, 0xCB, 0xCF, 0xCC, 0xE1, 0x70, 0xDD, 0xDE, 0xDB, 0xDC, 0x8D, 0x8E, 0xDF }; -EXTCONST unsigned char PL_e2a[] = { /* EBCDIC (IBM-037) to ASCII (ISO8859-1) */ +EXTCONST U8 PL_e2a[] = { /* EBCDIC (IBM-037) to ASCII (ISO8859-1) */ 0x00, 0x01, 0x02, 0x03, 0x9C, 0x09, 0x86, 0x7F, 0x97, 0x8D, 0x8E, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, 0x10, 0x11, 0x12, 0x13, 0x9D, 0x85, 0x08, 0x87, 0x18, 0x19, 0x92, 0x8F, 0x1C, 0x1D, 0x1E, 0x1F, 0x80, 0x81, 0x82, 0x83, 0x84, 0x0A, 0x17, 0x1B, 0x88, 0x89, 0x8A, 0x8B, 0x8C, 0x05, 0x06, 0x07, @@ -466,8 +544,47 @@ EXTCONST unsigned char PL_e2a[] = { /* E 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0xB3, 0xDB, 0xDC, 0xD9, 0xDA, 0x9F }; -EXTCONST unsigned char PL_fold[] = { /* fast EBCDIC case folding table, 'A' => - 'a'; 'a' => 'A' */ +EXTCONST U8 PL_latin1_lc[] = { /* lowercasing */ + 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, + 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F, + 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2A, 0x2B, 0x2C, 0x2D, 0x2E, 0x2F, + 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x3A, 0x3B, 0x3C, 0x3D, 0x3E, 0x3F, + 0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49, 0x4A, 0x4B, 0x4C, 0x4D, 0x4E, 0x4F, + 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, 0x59, 0x5A, 0x5B, 0x5C, 0x5D, 0x5E, 0x5F, + 0x60, 0x61, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49, 0x6A, 0x6B, 0x6C, 0x6D, 0x6E, 0x6F, + 0x70, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, 0x79, 0x7A, 0x7B, 0x7C, 0x7D, 0x7E, 0x7F, + 0x70, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89, 0x8A, 0x8B, 0x8C, 0x8D, 0x8E, 0x8F, + 0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, 0x98, 0x99, 0x9A, 0x9B, 0x9C, 0x9D, 0x9C, 0x9F, + 0xA0, 0xA1, 0xA2, 0xA3, 0xA4, 0xA5, 0xA6, 0xA7, 0xA8, 0xA9, 0xAA, 0xAB, 0x8C, 0x8D, 0x8E, 0xAF, + 0xB0, 0xB1, 0xB2, 0xB3, 0xB4, 0xB5, 0xB6, 0xB7, 0xB8, 0xB9, 0xBA, 0xBB, 0xBC, 0xBD, 0xBE, 0xBF, + 0xC0, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89, 0xCA, 0xCB, 0xCC, 0xCD, 0xCE, 0xCF, + 0xD0, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, 0x98, 0x99, 0xDA, 0xDB, 0xDC, 0xDD, 0xDE, 0xDF, + 0xE0, 0xE1, 0xA2, 0xA3, 0xA4, 0xA5, 0xA6, 0xA7, 0xA8, 0xA9, 0xEA, 0xCB, 0xCC, 0xCD, 0xCE, 0xCF, + 0xF0, 0xF1, 0xF2, 0xF3, 0xF4, 0xF5, 0xF6, 0xF7, 0xF8, 0xF9, 0xFA, 0xDB, 0xDC, 0xDD, 0xDE, 0xFF +}; + +EXTCONST U8 PL_mod_latin1_uc[] = { /* uppercasing */ + 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, + 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F, + 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2A, 0x2B, 0x2C, 0x2D, 0x2E, 0x2F, + 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x3A, 0x3B, 0x3C, 0x3D, 0x3E, 0x3F, + 0x40, 0x41, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x4A, 0x4B, 0x4C, 0x4D, 0x4E, 0x4F, + 0x50, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, 0xDF, 0x5A, 0x5B, 0x5C, 0x5D, 0x5E, 0x5F, + 0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x6A, 0x6B, 0x6C, 0x6D, 0x6E, 0x6F, + 0x80, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, 0x79, 0x7A, 0x7B, 0x7C, 0x7D, 0x7E, 0x7F, + 0x80, 0xC1, 0xC2, 0xC3, 0xC4, 0xC5, 0xC6, 0xC7, 0xC8, 0xC9, 0x8A, 0x8B, 0xAC, 0xAD, 0xAE, 0x8F, + 0x90, 0xD1, 0xD2, 0xD3, 0xD4, 0xD5, 0xD6, 0xD7, 0xD8, 0xD9, 0x9A, 0x9B, 0x9E, 0x9D, 0x9E, 0x9F, + 0xDF, 0xA1, 0xE2, 0xE3, 0xE4, 0xE5, 0xE6, 0xE7, 0xE8, 0xE9, 0xAA, 0xAB, 0xAC, 0xAD, 0xAE, 0xAF, + 0xB0, 0xB1, 0xB2, 0xB3, 0xB4, 0xB5, 0xB6, 0xB7, 0xB8, 0xB9, 0xBA, 0xBB, 0xBC, 0xBD, 0xBE, 0xBF, + 0xC0, 0xC1, 0xC2, 0xC3, 0xC4, 0xC5, 0xC6, 0xC7, 0xC8, 0xC9, 0xCA, 0xEB, 0xEC, 0xED, 0xEE, 0xEF, + 0xD0, 0xD1, 0xD2, 0xD3, 0xD4, 0xD5, 0xD6, 0xD7, 0xD8, 0xD9, 0xDA, 0xFB, 0xFC, 0xFD, 0xFE, 0xDF, + 0xE0, 0xE1, 0xE2, 0xE3, 0xE4, 0xE5, 0xE6, 0xE7, 0xE8, 0xE9, 0xEA, 0xEB, 0xEC, 0xED, 0xEE, 0xEF, + 0xF0, 0xF1, 0xF2, 0xF3, 0xF4, 0xF5, 0xF6, 0xF7, 0xF8, 0xF9, 0xFA, 0xFB, 0xFC, 0xFD, 0xFE, 0xFF +}; + +EXTCONST U8 PL_fold_latin1[] = { /* fast EBCDIC case folding table, + 'A' => 'a'; 'a' => 'A'; full + 0-255 range */ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, @@ -503,38 +620,68 @@ EXTCONST unsigned char PL_fold[] = { /* }; #endif /* 037 */ -/* Since the EBCDIC code pages are isomorphic to Latin1, that table is merely a - * duplicate */ -EXTCONST unsigned char * PL_fold_latin1 = PL_fold; +/* This is the same in all code pages, as only A-Z, a-z are affected */ +EXTCONST U8 PL_fold[] = { /* fast EBCDIC case folding table, 'A' => + 'a'; 'a' => 'A' */ + 0, 1, 2, 3, 4, 5, 6, 7, + 8, 9, 10, 11, 12, 13, 14, 15, + 16, 17, 18, 19, 20, 21, 22, 23, + 24, 25, 26, 27, 28, 29, 30, 31, + 32, 33, 34, 35, 36, 37, 38, 39, + 40, 41, 42, 43, 44, 45, 46, 47, + 48, 49, 50, 51, 52, 53, 54, 55, + 56, 57, 58, 59, 60, 61, 62, 63, + 64, 65, 66, 67, 68, 69, 70, 71, + 72, 73, 74, 75, 76, 77, 78, 79, + 80, 81, 82, 83, 84, 85, 86, 87, + 88, 89, 90, 91, 92, 93, 94, 95, + 96, 97, 98, 99, 100, 101, 102, 103, + 104, 105, 106, 107, 108, 109, 110, 111, + 112, 113, 114, 115, 116, 117, 118, 119, + 120, 121, 122, 123, 124, 125, 126, 127, + 128, 'A', 'B', 'C', 'D', 'E', 'F', 'G', + 'H', 'I', 138, 139, 140, 141, 142, 143, + 144, 'J', 'K', 'L', 'M', 'N', 'O', 'P', + 'Q', 'R', 154, 155, 156, 157, 158, 159, + 160, 161, 'S', 'T', 'U', 'V', 'W', 'X', + 'Y', 'Z', 170, 171, 172, 173, 174, 175, + 176, 177, 178, 179, 180, 181, 182, 183, + 184, 185, 186, 187, 188, 189, 190, 191, + 192, 'a', 'b', 'c', 'd', 'e', 'f', 'g', + 'h', 'i', 202, 203, 204, 205, 206, 207, + 208, 'j', 'k', 'l', 'm', 'n', 'o', 'p', + 'q', 'r', 218, 219, 220, 221, 222, 223, + 224, 225, 's', 't', 'u', 'v', 'w', 'x', + 'y', 'z', 234, 235, 236, 237, 238, 239, + 240, 241, 242, 243, 244, 245, 246, 247, + 248, 249, 250, 251, 252, 253, 254, 255 +}; #else -EXTCONST unsigned char PL_utf8skip[]; -EXTCONST unsigned char PL_e2utf[]; -EXTCONST unsigned char PL_utf2e[]; -EXTCONST unsigned char PL_e2a[]; -EXTCONST unsigned char PL_a2e[]; -EXTCONST unsigned char PL_fold[]; -EXTCONST unsigned char * PL_fold_latin1; +EXTCONST U8 PL_utf8skip[]; +EXTCONST U8 PL_e2utf[]; +EXTCONST U8 PL_utf2e[]; +EXTCONST U8 PL_e2a[]; +EXTCONST U8 PL_a2e[]; +EXTCONST U8 PL_fold[]; +EXTCONST U8 PL_fold_latin1[]; +EXTCONST U8 PL_latin1_lc[]; +EXTCONST U8 PL_mod_latin1_uc[]; #endif END_EXTERN_C /* EBCDIC-happy ways of converting native code to UTF-8 */ -/* Native to iso-8859-1 */ -#define NATIVE_TO_ASCII(ch) PL_e2a[(U8)(ch)] -#define ASCII_TO_NATIVE(ch) PL_a2e[(U8)(ch)] -/* Transform after encoding, essentially converts to/from I8 */ -#define NATIVE_TO_UTF(ch) PL_e2utf[(U8)(ch)] /* to I8 */ -#define NATIVE_TO_I8(ch) NATIVE_TO_UTF(ch) /* synonym */ -#define UTF_TO_NATIVE(ch) PL_utf2e[(U8)(ch)] /* from I8 */ -#define I8_TO_NATIVE(ch) UTF_TO_NATIVE(ch) /* synonym */ -/* Transform in wide UV char space */ -#define NATIVE_TO_UNI(ch) (((ch) > 255) ? (ch) : NATIVE_TO_ASCII(ch)) -#define UNI_TO_NATIVE(ch) (((ch) > 255) ? (ch) : ASCII_TO_NATIVE(ch)) -/* Transform in invariant..byte space */ -#define NATIVE_TO_NEED(enc,ch) ((enc) ? UTF_TO_NATIVE(NATIVE_TO_ASCII(ch)) : (ch)) -#define ASCII_TO_NEED(enc,ch) ((enc) ? UTF_TO_NATIVE(ch) : ASCII_TO_NATIVE(ch)) +#define NATIVE_TO_LATIN1(ch) PL_e2a[(U8)(ch)] +#define LATIN1_TO_NATIVE(ch) PL_a2e[(U8)(ch)] + +#define NATIVE_UTF8_TO_I8(ch) PL_e2utf[(U8)(ch)] +#define I8_TO_NATIVE_UTF8(ch) PL_utf2e[(U8)(ch)] + +/* Transforms in wide UV chars */ +#define NATIVE_TO_UNI(ch) (((ch) > 255) ? (ch) : NATIVE_TO_LATIN1(ch)) +#define UNI_TO_NATIVE(ch) (((ch) > 255) ? (ch) : LATIN1_TO_NATIVE(ch)) /* The following table is adapted from tr16, it shows I8 encoding of Unicode code points. @@ -554,26 +701,37 @@ END_EXTERN_C */ -#define UNISKIP(uv) ( (uv) < 0xA0 ? 1 : \ +/* Input is a true Unicode (not-native) code point */ +#define OFFUNISKIP(uv) ( (uv) < 0xA0 ? 1 : \ (uv) < 0x400 ? 2 : \ (uv) < 0x4000 ? 3 : \ (uv) < 0x40000 ? 4 : \ (uv) < 0x400000 ? 5 : \ (uv) < 0x4000000 ? 6 : 7 ) -#define UNI_IS_INVARIANT(c) ((c) < 0xA0) +#define UNI_IS_INVARIANT(c) (((UV)(c)) < 0xA0) /* UTF-EBCDIC semantic macros - transform back into I8 and then compare * Comments as to the meaning of each are given at their corresponding utf8.h * definitions */ -#define UTF8_IS_START(c) (NATIVE_TO_UTF(c) >= 0xC5 && NATIVE_TO_UTF(c) != 0xE0) -#define UTF8_IS_CONTINUATION(c) ((NATIVE_TO_UTF(c) & 0xE0) == 0xA0) -#define UTF8_IS_CONTINUED(c) (NATIVE_TO_UTF(c) >= 0xA0) -#define UTF8_IS_DOWNGRADEABLE_START(c) (NATIVE_TO_UTF(c) >= 0xC5 && NATIVE_TO_UTF(c) <= 0xC7) -#define UTF8_IS_ABOVE_LATIN1(c) (NATIVE_TO_I8(c) >= 0xC8) +#define UTF8_IS_START(c) (NATIVE_UTF8_TO_I8(c) >= 0xC5 \ + && NATIVE_UTF8_TO_I8(c) != 0xE0) +#define UTF8_IS_CONTINUATION(c) ((NATIVE_UTF8_TO_I8(c) & 0xE0) == 0xA0) +#define UTF8_IS_CONTINUED(c) (NATIVE_UTF8_TO_I8(c) >= 0xA0) + +#define UTF8_IS_DOWNGRADEABLE_START(c) (NATIVE_UTF8_TO_I8(c) >= 0xC5 \ + && NATIVE_UTF8_TO_I8(c) <= 0xC7) +/* Saying it this way adds a runtime test, but removes 2 run-time lookups */ +/*#define UTF8_IS_DOWNGRADEABLE_START(c) ((c) == I8_TO_NATIVE_UTF8(0xC5) \ + || (c) == I8_TO_NATIVE_UTF8(0xC6) \ + || (c) == I8_TO_NATIVE_UTF8(0xC7)) +*/ +#define UTF8_IS_ABOVE_LATIN1(c) (NATIVE_UTF8_TO_I8(c) >= 0xC8) + +/* Can't exceed 7 on EBCDIC platforms */ +#define UTF_START_MARK(len) (0xFF & (0xFE << (7-(len)))) -#define UTF_START_MARK(len) (((len) > 7) ? 0xFF : ((U8)(0xFE << (7-(len))))) #define UTF_START_MASK(len) (((len) >= 6) ? 0x01 : (0x1F >> ((len)-2))) #define UTF_CONTINUATION_MARK 0xA0 #define UTF_CONTINUATION_MASK ((U8)0x1f) @@ -591,6 +749,8 @@ END_EXTERN_C * expansion is 3 characters. On EBCDIC platforms, the highest Unicode * character occupies 5 bytes, therefore this number is 15 */ #define UTF8_MAXBYTES_CASE 15 + +#define MAX_UTF8_TWO_BYTE 0x3FF /* * Local variables: Index: gnu/usr.bin/perl/util.c =================================================================== RCS file: /mnt/memory/perl/importit/cvs/src/gnu/usr.bin/perl/util.c,v retrieving revision 1.19 diff -u -p -u -p -r1.19 util.c --- gnu/usr.bin/perl/util.c 29 May 2014 04:57:47 -0000 1.19 +++ gnu/usr.bin/perl/util.c 16 Nov 2014 03:22:24 -0000 @@ -26,7 +26,7 @@ #include "perl.h" #include "reentr.h" -#ifdef USE_PERLIO +#if defined(USE_PERLIO) #include "perliol.h" /* For PerlIOUnix_refcnt */ #endif @@ -37,6 +37,9 @@ #endif #endif +#include +#include + #ifdef __Lynx__ /* Missing protos on LynxOS */ int putenv(char *); @@ -48,6 +51,10 @@ int putenv(char *); # endif #endif +#ifdef PERL_DEBUG_READONLY_COW +# include +#endif + #define FLUSH #if defined(HAS_FCNTL) && defined(F_SETFD) && !defined(FD_CLOEXEC) @@ -64,6 +71,40 @@ int putenv(char *); # define ALWAYS_NEED_THX #endif +#if defined(PERL_TRACK_MEMPOOL) && defined(PERL_DEBUG_READONLY_COW) +static void +S_maybe_protect_rw(pTHX_ struct perl_memory_debug_header *header) +{ + if (header->readonly + && mprotect(header, header->size, PROT_READ|PROT_WRITE)) + Perl_warn(aTHX_ "mprotect for COW string %p %lu failed with %d", + header, header->size, errno); +} + +static void +S_maybe_protect_ro(pTHX_ struct perl_memory_debug_header *header) +{ + if (header->readonly + && mprotect(header, header->size, PROT_READ)) + Perl_warn(aTHX_ "mprotect RW for COW string %p %lu failed with %d", + header, header->size, errno); +} +# define maybe_protect_rw(foo) S_maybe_protect_rw(aTHX_ foo) +# define maybe_protect_ro(foo) S_maybe_protect_ro(aTHX_ foo) +#else +# define maybe_protect_rw(foo) NOOP +# define maybe_protect_ro(foo) NOOP +#endif + +#if defined(PERL_TRACK_MEMPOOL) || defined(PERL_DEBUG_READONLY_COW) + /* Use memory_debug_header */ +# define USE_MDH +# if (defined(PERL_POISON) && defined(PERL_TRACK_MEMPOOL)) \ + || defined(PERL_DEBUG_READONLY_COW) +# define MDH_HAS_SIZE +# endif +#endif + /* paranoid version of system's malloc() */ Malloc_t @@ -73,24 +114,24 @@ Perl_safesysmalloc(MEM_SIZE size) dTHX; #endif Malloc_t ptr; -#ifdef HAS_64K_LIMIT - if (size > 0xffff) { - PerlIO_printf(Perl_error_log, - "Allocation too large: %lx\n", size) FLUSH; - my_exit(1); - } -#endif /* HAS_64K_LIMIT */ -#ifdef PERL_TRACK_MEMPOOL - size += sTHX; -#endif + size += PERL_MEMORY_DEBUG_HEADER_SIZE; #ifdef DEBUGGING if ((SSize_t)size < 0) Perl_croak_nocontext("panic: malloc, size=%"UVuf, (UV) size); #endif - ptr = (Malloc_t)PerlMem_malloc(size?size:1); /* malloc(0) is NASTY on our system */ + if (!size) size = 1; /* malloc(0) is NASTY on our system */ +#ifdef PERL_DEBUG_READONLY_COW + if ((ptr = mmap(0, size, PROT_READ|PROT_WRITE, + MAP_ANON|MAP_PRIVATE, -1, 0)) == MAP_FAILED) { + perror("mmap failed"); + abort(); + } +#else + ptr = (Malloc_t)PerlMem_malloc(size?size:1); +#endif PERL_ALLOC_CHECK(ptr); if (ptr != NULL) { -#ifdef PERL_TRACK_MEMPOOL +#ifdef USE_MDH struct perl_memory_debug_header *const header = (struct perl_memory_debug_header *)ptr; #endif @@ -105,12 +146,17 @@ Perl_safesysmalloc(MEM_SIZE size) header->prev = &PL_memory_debug_header; header->next = PL_memory_debug_header.next; PL_memory_debug_header.next = header; + maybe_protect_rw(header->next); header->next->prev = header; -# ifdef PERL_POISON - header->size = size; + maybe_protect_ro(header->next); +# ifdef PERL_DEBUG_READONLY_COW + header->readonly = 0; # endif - ptr = (Malloc_t)((char*)ptr+sTHX); #endif +#ifdef MDH_HAS_SIZE + header->size = size; +#endif + ptr = (Malloc_t)((char*)ptr+PERL_MEMORY_DEBUG_HEADER_SIZE); DEBUG_m(PerlIO_printf(Perl_debug_log, "0x%"UVxf": (%05ld) malloc %ld bytes\n",PTR2UV(ptr),(long)PL_an++,(long)size)); return ptr; } @@ -136,17 +182,15 @@ Perl_safesysrealloc(Malloc_t where,MEM_S dTHX; #endif Malloc_t ptr; +#ifdef PERL_DEBUG_READONLY_COW + const MEM_SIZE oldsize = where + ? ((struct perl_memory_debug_header *)((char *)where - PERL_MEMORY_DEBUG_HEADER_SIZE))->size + : 0; +#endif #if !defined(STANDARD_C) && !defined(HAS_REALLOC_PROTOTYPE) && !defined(PERL_MICRO) Malloc_t PerlMem_realloc(); #endif /* !defined(STANDARD_C) && !defined(HAS_REALLOC_PROTOTYPE) */ -#ifdef HAS_64K_LIMIT - if (size > 0xffff) { - PerlIO_printf(Perl_error_log, - "Reallocation too large: %lx\n", size) FLUSH; - my_exit(1); - } -#endif /* HAS_64K_LIMIT */ if (!size) { safesysfree(where); return NULL; @@ -154,13 +198,14 @@ Perl_safesysrealloc(Malloc_t where,MEM_S if (!where) return safesysmalloc(size); -#ifdef PERL_TRACK_MEMPOOL - where = (Malloc_t)((char*)where-sTHX); - size += sTHX; +#ifdef USE_MDH + where = (Malloc_t)((char*)where-PERL_MEMORY_DEBUG_HEADER_SIZE); + size += PERL_MEMORY_DEBUG_HEADER_SIZE; { struct perl_memory_debug_header *const header = (struct perl_memory_debug_header *)where; +# ifdef PERL_TRACK_MEMPOOL if (header->interpreter != aTHX) { Perl_croak_nocontext("panic: realloc from wrong pool, %p!=%p", header->interpreter, aTHX); @@ -173,22 +218,38 @@ Perl_safesysrealloc(Malloc_t where,MEM_S char *start_of_freed = ((char *)where) + size; PoisonFree(start_of_freed, freed_up, char); } - header->size = size; # endif +# endif +# ifdef MDH_HAS_SIZE + header->size = size; +# endif } #endif #ifdef DEBUGGING if ((SSize_t)size < 0) Perl_croak_nocontext("panic: realloc, size=%"UVuf, (UV)size); #endif +#ifdef PERL_DEBUG_READONLY_COW + if ((ptr = mmap(0, size, PROT_READ|PROT_WRITE, + MAP_ANON|MAP_PRIVATE, -1, 0)) == MAP_FAILED) { + perror("mmap failed"); + abort(); + } + Copy(where,ptr,oldsize < size ? oldsize : size,char); + if (munmap(where, oldsize)) { + perror("munmap failed"); + abort(); + } +#else ptr = (Malloc_t)PerlMem_realloc(where,size); +#endif PERL_ALLOC_CHECK(ptr); /* MUST do this fixup first, before doing ANYTHING else, as anything else might allocate memory/free/move memory, and until we do the fixup, it may well be chasing (and writing to) free memory. */ -#ifdef PERL_TRACK_MEMPOOL if (ptr != NULL) { +#ifdef PERL_TRACK_MEMPOOL struct perl_memory_debug_header *const header = (struct perl_memory_debug_header *)ptr; @@ -200,12 +261,15 @@ Perl_safesysrealloc(Malloc_t where,MEM_S } # endif + maybe_protect_rw(header->next); header->next->prev = header; + maybe_protect_ro(header->next); + maybe_protect_rw(header->prev); header->prev->next = header; - - ptr = (Malloc_t)((char*)ptr+sTHX); - } + maybe_protect_ro(header->prev); #endif + ptr = (Malloc_t)((char*)ptr+PERL_MEMORY_DEBUG_HEADER_SIZE); + } /* In particular, must do that fixup above before logging anything via *printf(), as it can reallocate memory, which can cause SEGVs. */ @@ -242,12 +306,16 @@ Perl_safesysfree(Malloc_t where) #endif DEBUG_m( PerlIO_printf(Perl_debug_log, "0x%"UVxf": (%05ld) free\n",PTR2UV(where),(long)PL_an++)); if (where) { -#ifdef PERL_TRACK_MEMPOOL - where = (Malloc_t)((char*)where-sTHX); +#ifdef USE_MDH + where = (Malloc_t)((char*)where-PERL_MEMORY_DEBUG_HEADER_SIZE); { struct perl_memory_debug_header *const header = (struct perl_memory_debug_header *)where; +# ifdef MDH_HAS_SIZE + const MEM_SIZE size = header->size; +# endif +# ifdef PERL_TRACK_MEMPOOL if (header->interpreter != aTHX) { Perl_croak_nocontext("panic: free from wrong pool, %p!=%p", header->interpreter, aTHX); @@ -264,16 +332,30 @@ Perl_safesysfree(Malloc_t where) header->prev->next); } /* Unlink us from the chain. */ + maybe_protect_rw(header->next); header->next->prev = header->prev; + maybe_protect_ro(header->next); + maybe_protect_rw(header->prev); header->prev->next = header->next; + maybe_protect_ro(header->prev); + maybe_protect_rw(header); # ifdef PERL_POISON - PoisonNew(where, header->size, char); + PoisonNew(where, size, char); # endif /* Trigger the duplicate free warning. */ header->next = NULL; +# endif +# ifdef PERL_DEBUG_READONLY_COW + if (munmap(where, size)) { + perror("munmap failed"); + abort(); + } +# endif } #endif +#ifndef PERL_DEBUG_READONLY_COW PerlMem_free(where); +#endif } } @@ -286,37 +368,36 @@ Perl_safesyscalloc(MEM_SIZE count, MEM_S dTHX; #endif Malloc_t ptr; -#if defined(PERL_TRACK_MEMPOOL) || defined(HAS_64K_LIMIT) || defined(DEBUGGING) +#if defined(USE_MDH) || defined(DEBUGGING) MEM_SIZE total_size = 0; #endif /* Even though calloc() for zero bytes is strange, be robust. */ if (size && (count <= MEM_SIZE_MAX / size)) { -#if defined(PERL_TRACK_MEMPOOL) || defined(HAS_64K_LIMIT) || defined(DEBUGGING) +#if defined(USE_MDH) || defined(DEBUGGING) total_size = size * count; #endif } else - Perl_croak_memory_wrap(); -#ifdef PERL_TRACK_MEMPOOL - if (sTHX <= MEM_SIZE_MAX - (MEM_SIZE)total_size) - total_size += sTHX; + croak_memory_wrap(); +#ifdef USE_MDH + if (PERL_MEMORY_DEBUG_HEADER_SIZE <= MEM_SIZE_MAX - (MEM_SIZE)total_size) + total_size += PERL_MEMORY_DEBUG_HEADER_SIZE; else - Perl_croak_memory_wrap(); + croak_memory_wrap(); #endif -#ifdef HAS_64K_LIMIT - if (total_size > 0xffff) { - PerlIO_printf(Perl_error_log, - "Allocation too large: %lx\n", total_size) FLUSH; - my_exit(1); - } -#endif /* HAS_64K_LIMIT */ #ifdef DEBUGGING if ((SSize_t)size < 0 || (SSize_t)count < 0) Perl_croak_nocontext("panic: calloc, size=%"UVuf", count=%"UVuf, (UV)size, (UV)count); #endif -#ifdef PERL_TRACK_MEMPOOL +#ifdef PERL_DEBUG_READONLY_COW + if ((ptr = mmap(0, total_size ? total_size : 1, PROT_READ|PROT_WRITE, + MAP_ANON|MAP_PRIVATE, -1, 0)) == MAP_FAILED) { + perror("mmap failed"); + abort(); + } +#elif defined(PERL_TRACK_MEMPOOL) /* Have to use malloc() because we've added some space for our tracking header. */ /* malloc(0) is non-portable. */ @@ -332,22 +413,31 @@ Perl_safesyscalloc(MEM_SIZE count, MEM_S PERL_ALLOC_CHECK(ptr); DEBUG_m(PerlIO_printf(Perl_debug_log, "0x%"UVxf": (%05ld) calloc %ld x %ld bytes\n",PTR2UV(ptr),(long)PL_an++,(long)count,(long)total_size)); if (ptr != NULL) { -#ifdef PERL_TRACK_MEMPOOL +#ifdef USE_MDH { struct perl_memory_debug_header *const header = (struct perl_memory_debug_header *)ptr; +# ifndef PERL_DEBUG_READONLY_COW memset((void*)ptr, 0, total_size); +# endif +# ifdef PERL_TRACK_MEMPOOL header->interpreter = aTHX; /* Link us into the list. */ header->prev = &PL_memory_debug_header; header->next = PL_memory_debug_header.next; PL_memory_debug_header.next = header; + maybe_protect_rw(header->next); header->next->prev = header; -# ifdef PERL_POISON + maybe_protect_ro(header->next); +# ifdef PERL_DEBUG_READONLY_COW + header->readonly = 0; +# endif +# endif +# ifdef MDH_HAS_SIZE header->size = total_size; # endif - ptr = (Malloc_t)((char*)ptr+sTHX); + ptr = (Malloc_t)((char*)ptr+PERL_MEMORY_DEBUG_HEADER_SIZE); } #endif return ptr; @@ -431,7 +521,8 @@ Perl_instr(const char *big, const char * PERL_ARGS_ASSERT_INSTR; - /* libc prior to 4.6.27 did not work properly on a NULL 'little' */ + /* libc prior to 4.6.27 (late 1994) did not work properly on a NULL + * 'little' */ if (!little) return (char*)big; return strstr((char*)big, (char*)little); @@ -521,13 +612,13 @@ Perl_fbm_compile(pTHX_ SV *sv, U32 flags const U8 *s; STRLEN i; STRLEN len; - STRLEN rarest = 0; U32 frequency = 256; MAGIC *mg; + PERL_DEB( STRLEN rarest = 0 ); PERL_ARGS_ASSERT_FBM_COMPILE; - if (isGV_with_GP(sv)) + if (isGV_with_GP(sv) || SvROK(sv)) return; if (SvVALID(sv)) @@ -539,7 +630,9 @@ Perl_fbm_compile(pTHX_ SV *sv, U32 flags if (mg && mg->mg_len >= 0) mg->mg_len++; } - s = (U8*)SvPV_force_mutable(sv, len); + if (!SvPOK(sv) || SvNIOKp(sv)) + s = (U8*)SvPV_force_mutable(sv, len); + else s = (U8 *)SvPV_mutable(sv, len); if (len == 0) /* TAIL might be on a zero-length string. */ return; SvUPGRADE(sv, SVt_PVMG); @@ -589,17 +682,15 @@ Perl_fbm_compile(pTHX_ SV *sv, U32 flags s = (const unsigned char*)(SvPVX_const(sv)); /* deeper magic */ for (i = 0; i < len; i++) { if (PL_freq[s[i]] < frequency) { - rarest = i; + PERL_DEB( rarest = i ); frequency = PL_freq[s[i]]; } } - BmRARE(sv) = s[rarest]; - BmPREVIOUS(sv) = rarest; BmUSEFUL(sv) = 100; /* Initial value */ if (flags & FBMcf_TAIL) SvTAIL_on(sv); DEBUG_r(PerlIO_printf(Perl_debug_log, "rarest char %c at %"UVuf"\n", - BmRARE(sv), BmPREVIOUS(sv))); + s[rarest], (UV)rarest)); } /* If SvTAIL(littlestr), it has a fake '\n' at end. */ @@ -909,10 +1000,15 @@ Perl_foldEQ_locale(const char *s1, const =for apidoc savepv -Perl's version of C. Returns a pointer to a newly allocated -string which is a duplicate of C. The size of the string is -determined by C. The memory allocated for the new string can -be freed with the C function. +Perl's version of C. Returns a pointer to a newly allocated +string which is a duplicate of C. The size of the string is +determined by C, which means it may not contain embedded C +characters and must have a trailing C. The memory allocated for the new +string can be freed with the C function. + +On some platforms, Windows for example, all allocated memory owned by a thread +is deallocated when that thread ends. So if you need that not to happen, you +need to use the shared memory functions, such as C>. =cut */ @@ -936,11 +1032,16 @@ Perl_savepv(pTHX_ const char *pv) /* =for apidoc savepvn -Perl's version of what C would be if it existed. Returns a +Perl's version of what C would be if it existed. Returns a pointer to a newly allocated string which is a duplicate of the first -C bytes from C, plus a trailing NUL byte. The memory allocated for +C bytes from C, plus a trailing +C byte. The memory allocated for the new string can be freed with the C function. +On some platforms, Windows for example, all allocated memory owned by a thread +is deallocated when that thread ends. So if you need that not to happen, you +need to use the shared memory functions, such as C>. + =cut */ @@ -992,7 +1093,7 @@ Perl_savesharedpv(pTHX_ const char *pv) =for apidoc savesharedpvn A version of C which allocates the duplicate string in memory -which is shared between threads. (With the specific difference that a NULL +which is shared between threads. (With the specific difference that a NULL pointer is not acceptable) =cut @@ -1017,6 +1118,10 @@ Perl_savesharedpvn(pTHX_ const char *con A version of C/C which gets the string to duplicate from the passed in SV using C +On some platforms, Windows for example, all allocated memory owned by a thread +is deallocated when that thread ends. So if you need that not to happen, you +need to use the shared memory functions, such as C>. + =cut */ @@ -1178,15 +1283,20 @@ Perl_mess(pTHX_ const char *pat, ...) return retval; } -STATIC const COP* -S_closest_cop(pTHX_ const COP *cop, const OP *o) +const COP* +Perl_closest_cop(pTHX_ const COP *cop, const OP *o, const OP *curop, + bool opnext) { dVAR; - /* Look for PL_op starting from o. cop is the last COP we've seen. */ + /* Look for curop starting from o. cop is the last COP we've seen. */ + /* opnext means that curop is actually the ->op_next of the op we are + seeking. */ PERL_ARGS_ASSERT_CLOSEST_COP; - if (!o || o == PL_op) + if (!o || !curop || ( + opnext ? o->op_next == curop && o->op_type != OP_SCOPE : o == curop + )) return cop; if (o->op_flags & OPf_KIDS) { @@ -1202,7 +1312,7 @@ S_closest_cop(pTHX_ const COP *cop, cons /* Keep searching, and return when we've found something. */ - new_cop = closest_cop(cop, kid); + new_cop = closest_cop(cop, kid, curop, opnext); if (new_cop) return new_cop; } @@ -1272,7 +1382,8 @@ Perl_mess_sv(pTHX_ SV *basemsg, bool con * from the sibling of PL_curcop. */ - const COP *cop = closest_cop(PL_curcop, PL_curcop->op_sibling); + const COP *cop = + closest_cop(PL_curcop, PL_curcop->op_sibling, PL_op, FALSE); if (!cop) cop = PL_curcop; @@ -1340,20 +1451,13 @@ Perl_write_to_stderr(pTHX_ SV* msv) if (PL_stderrgv && SvREFCNT(PL_stderrgv) && (io = GvIO(PL_stderrgv)) && (mg = SvTIED_mg((const SV *)io, PERL_MAGIC_tiedscalar))) - Perl_magic_methcall(aTHX_ MUTABLE_SV(io), mg, "PRINT", + Perl_magic_methcall(aTHX_ MUTABLE_SV(io), mg, SV_CONST(PRINT), G_SCALAR | G_DISCARD | G_WRITING_TO_STDERR, 1, msv); else { -#ifdef USE_SFIO - /* SFIO can really mess with your errno */ - dSAVED_ERRNO; -#endif PerlIO * const serr = Perl_error_log; do_print(msv, serr); (void)PerlIO_flush(serr); -#ifdef USE_SFIO - RESTORE_ERRNO; -#endif } } @@ -1588,14 +1692,14 @@ Perl_croak(pTHX_ const char *pat, ...) =for apidoc Am|void|croak_no_modify Exactly equivalent to C, but generates -terser object code than using C. Less code used on exception code +terser object code than using C. Less code used on exception code paths reduces CPU cache pressure. =cut */ void -Perl_croak_no_modify() +Perl_croak_no_modify(void) { Perl_croak_nocontext( "%s", PL_no_modify); } @@ -1604,24 +1708,15 @@ Perl_croak_no_modify() This is typically called when malloc returns NULL. */ void -Perl_croak_no_mem() +Perl_croak_no_mem(void) { dTHX; - /* Can't use PerlIO to write as it allocates memory */ - PerlLIO_write(PerlIO_fileno(Perl_error_log), - PL_no_mem, sizeof(PL_no_mem)-1); + PERL_UNUSED_RESULT(PerlLIO_write(PerlIO_fileno(Perl_error_log), + PL_no_mem, sizeof(PL_no_mem)-1)); my_exit(1); } -/* saves machine code for a common noreturn idiom typically used in Newx*() */ -void -Perl_croak_memory_wrap(void) -{ - Perl_croak_nocontext("%s",PL_memory_wrap); -} - - /* does not return, used only in POPSTACK */ void Perl_croak_popstack(void) @@ -1944,7 +2039,11 @@ Perl_my_setenv(pTHX_ const char *nam, co my_setenv_format(environ[i], nam, nlen, val, vlen); } else { # endif -# if defined(__CYGWIN__)|| defined(__SYMBIAN32__) || defined(__riscos__) + /* This next branch should only be called #if defined(HAS_SETENV), but + Configure doesn't test for that yet. For Solaris, setenv() and unsetenv() + were introduced in Solaris 9, so testing for HAS UNSETENV is sufficient. + */ +# if defined(__CYGWIN__)|| defined(__SYMBIAN32__) || defined(__riscos__) || (defined(__sun) && defined(HAS_UNSETENV)) # if defined(HAS_UNSETENV) if (val == NULL) { (void)unsetenv(nam); @@ -2160,335 +2259,6 @@ vsprintf(char *dest, const char *pat, vo #endif /* HAS_VPRINTF */ -#ifdef MYSWAP -#if BYTEORDER != 0x4321 -short -Perl_my_swap(pTHX_ short s) -{ -#if (BYTEORDER & 1) == 0 - short result; - - result = ((s & 255) << 8) + ((s >> 8) & 255); - return result; -#else - return s; -#endif -} - -long -Perl_my_htonl(pTHX_ long l) -{ - union { - long result; - char c[sizeof(long)]; - } u; - -#if BYTEORDER == 0x1234 || BYTEORDER == 0x12345678 -#if BYTEORDER == 0x12345678 - u.result = 0; -#endif - u.c[0] = (l >> 24) & 255; - u.c[1] = (l >> 16) & 255; - u.c[2] = (l >> 8) & 255; - u.c[3] = l & 255; - return u.result; -#else -#if ((BYTEORDER - 0x1111) & 0x444) || !(BYTEORDER & 0xf) - Perl_croak(aTHX_ "Unknown BYTEORDER\n"); -#else - I32 o; - I32 s; - - for (o = BYTEORDER - 0x1111, s = 0; s < (sizeof(long)*8); o >>= 4, s += 8) { - u.c[o & 0xf] = (l >> s) & 255; - } - return u.result; -#endif -#endif -} - -long -Perl_my_ntohl(pTHX_ long l) -{ - union { - long l; - char c[sizeof(long)]; - } u; - -#if BYTEORDER == 0x1234 - u.c[0] = (l >> 24) & 255; - u.c[1] = (l >> 16) & 255; - u.c[2] = (l >> 8) & 255; - u.c[3] = l & 255; - return u.l; -#else -#if ((BYTEORDER - 0x1111) & 0x444) || !(BYTEORDER & 0xf) - Perl_croak(aTHX_ "Unknown BYTEORDER\n"); -#else - I32 o; - I32 s; - - u.l = l; - l = 0; - for (o = BYTEORDER - 0x1111, s = 0; s < (sizeof(long)*8); o >>= 4, s += 8) { - l |= (u.c[o & 0xf] & 255) << s; - } - return l; -#endif -#endif -} - -#endif /* BYTEORDER != 0x4321 */ -#endif /* MYSWAP */ - -/* - * Little-endian byte order functions - 'v' for 'VAX', or 'reVerse'. - * If these functions are defined, - * the BYTEORDER is neither 0x1234 nor 0x4321. - * However, this is not assumed. - * -DWS - */ - -#define HTOLE(name,type) \ - type \ - name (type n) \ - { \ - union { \ - type value; \ - char c[sizeof(type)]; \ - } u; \ - U32 i; \ - U32 s = 0; \ - for (i = 0; i < sizeof(u.c); i++, s += 8) { \ - u.c[i] = (n >> s) & 0xFF; \ - } \ - return u.value; \ - } - -#define LETOH(name,type) \ - type \ - name (type n) \ - { \ - union { \ - type value; \ - char c[sizeof(type)]; \ - } u; \ - U32 i; \ - U32 s = 0; \ - u.value = n; \ - n = 0; \ - for (i = 0; i < sizeof(u.c); i++, s += 8) { \ - n |= ((type)(u.c[i] & 0xFF)) << s; \ - } \ - return n; \ - } - -/* - * Big-endian byte order functions. - */ - -#define HTOBE(name,type) \ - type \ - name (type n) \ - { \ - union { \ - type value; \ - char c[sizeof(type)]; \ - } u; \ - U32 i; \ - U32 s = 8*(sizeof(u.c)-1); \ - for (i = 0; i < sizeof(u.c); i++, s -= 8) { \ - u.c[i] = (n >> s) & 0xFF; \ - } \ - return u.value; \ - } - -#define BETOH(name,type) \ - type \ - name (type n) \ - { \ - union { \ - type value; \ - char c[sizeof(type)]; \ - } u; \ - U32 i; \ - U32 s = 8*(sizeof(u.c)-1); \ - u.value = n; \ - n = 0; \ - for (i = 0; i < sizeof(u.c); i++, s -= 8) { \ - n |= ((type)(u.c[i] & 0xFF)) << s; \ - } \ - return n; \ - } - -/* - * If we just can't do it... - */ - -#define NOT_AVAIL(name,type) \ - type \ - name (type n) \ - { \ - Perl_croak_nocontext(#name "() not available"); \ - return n; /* not reached */ \ - } - - -#if defined(HAS_HTOVS) && !defined(htovs) -HTOLE(htovs,short) -#endif -#if defined(HAS_HTOVL) && !defined(htovl) -HTOLE(htovl,long) -#endif -#if defined(HAS_VTOHS) && !defined(vtohs) -LETOH(vtohs,short) -#endif -#if defined(HAS_VTOHL) && !defined(vtohl) -LETOH(vtohl,long) -#endif - -#ifdef PERL_NEED_MY_HTOLE16 -# if U16SIZE == 2 -HTOLE(Perl_my_htole16,U16) -# else -NOT_AVAIL(Perl_my_htole16,U16) -# endif -#endif -#ifdef PERL_NEED_MY_LETOH16 -# if U16SIZE == 2 -LETOH(Perl_my_letoh16,U16) -# else -NOT_AVAIL(Perl_my_letoh16,U16) -# endif -#endif -#ifdef PERL_NEED_MY_HTOBE16 -# if U16SIZE == 2 -HTOBE(Perl_my_htobe16,U16) -# else -NOT_AVAIL(Perl_my_htobe16,U16) -# endif -#endif -#ifdef PERL_NEED_MY_BETOH16 -# if U16SIZE == 2 -BETOH(Perl_my_betoh16,U16) -# else -NOT_AVAIL(Perl_my_betoh16,U16) -# endif -#endif - -#ifdef PERL_NEED_MY_HTOLE32 -# if U32SIZE == 4 -HTOLE(Perl_my_htole32,U32) -# else -NOT_AVAIL(Perl_my_htole32,U32) -# endif -#endif -#ifdef PERL_NEED_MY_LETOH32 -# if U32SIZE == 4 -LETOH(Perl_my_letoh32,U32) -# else -NOT_AVAIL(Perl_my_letoh32,U32) -# endif -#endif -#ifdef PERL_NEED_MY_HTOBE32 -# if U32SIZE == 4 -HTOBE(Perl_my_htobe32,U32) -# else -NOT_AVAIL(Perl_my_htobe32,U32) -# endif -#endif -#ifdef PERL_NEED_MY_BETOH32 -# if U32SIZE == 4 -BETOH(Perl_my_betoh32,U32) -# else -NOT_AVAIL(Perl_my_betoh32,U32) -# endif -#endif - -#ifdef PERL_NEED_MY_HTOLE64 -# if U64SIZE == 8 -HTOLE(Perl_my_htole64,U64) -# else -NOT_AVAIL(Perl_my_htole64,U64) -# endif -#endif -#ifdef PERL_NEED_MY_LETOH64 -# if U64SIZE == 8 -LETOH(Perl_my_letoh64,U64) -# else -NOT_AVAIL(Perl_my_letoh64,U64) -# endif -#endif -#ifdef PERL_NEED_MY_HTOBE64 -# if U64SIZE == 8 -HTOBE(Perl_my_htobe64,U64) -# else -NOT_AVAIL(Perl_my_htobe64,U64) -# endif -#endif -#ifdef PERL_NEED_MY_BETOH64 -# if U64SIZE == 8 -BETOH(Perl_my_betoh64,U64) -# else -NOT_AVAIL(Perl_my_betoh64,U64) -# endif -#endif - -#ifdef PERL_NEED_MY_HTOLES -HTOLE(Perl_my_htoles,short) -#endif -#ifdef PERL_NEED_MY_LETOHS -LETOH(Perl_my_letohs,short) -#endif -#ifdef PERL_NEED_MY_HTOBES -HTOBE(Perl_my_htobes,short) -#endif -#ifdef PERL_NEED_MY_BETOHS -BETOH(Perl_my_betohs,short) -#endif - -#ifdef PERL_NEED_MY_HTOLEI -HTOLE(Perl_my_htolei,int) -#endif -#ifdef PERL_NEED_MY_LETOHI -LETOH(Perl_my_letohi,int) -#endif -#ifdef PERL_NEED_MY_HTOBEI -HTOBE(Perl_my_htobei,int) -#endif -#ifdef PERL_NEED_MY_BETOHI -BETOH(Perl_my_betohi,int) -#endif - -#ifdef PERL_NEED_MY_HTOLEL -HTOLE(Perl_my_htolel,long) -#endif -#ifdef PERL_NEED_MY_LETOHL -LETOH(Perl_my_letohl,long) -#endif -#ifdef PERL_NEED_MY_HTOBEL -HTOBE(Perl_my_htobel,long) -#endif -#ifdef PERL_NEED_MY_BETOHL -BETOH(Perl_my_betohl,long) -#endif - -void -Perl_my_swabn(void *ptr, int n) -{ - char *s = (char *)ptr; - char *e = s + (n-1); - char tc; - - PERL_ARGS_ASSERT_MY_SWABN; - - for (n /= 2; n > 0; s++, e--, n--) { - tc = *s; - *s = *e; - *e = tc; - } -} - PerlIO * Perl_my_popen_list(pTHX_ const char *mode, int n, SV **args) { @@ -2856,25 +2626,6 @@ Perl_my_fork(void) #endif /* HAS_FORK */ } -#ifdef DUMP_FDS -void -Perl_dump_fds(pTHX_ const char *const s) -{ - int fd; - Stat_t tmpstatbuf; - - PERL_ARGS_ASSERT_DUMP_FDS; - - PerlIO_printf(Perl_debug_log,"%s", s); - for (fd = 0; fd < 32; fd++) { - if (PerlLIO_fstat(fd,&tmpstatbuf) >= 0) - PerlIO_printf(Perl_debug_log," %d",fd); - } - PerlIO_printf(Perl_debug_log,"\n"); - return; -} -#endif /* DUMP_FDS */ - #ifndef HAS_DUP2 int dup2(int oldfd, int newfd) @@ -3067,7 +2818,6 @@ I32 Perl_my_pclose(pTHX_ PerlIO *ptr) { dVAR; - Sigsave_t hstat, istat, qstat; int status; SV **svp; Pid_t pid; @@ -3075,19 +2825,21 @@ Perl_my_pclose(pTHX_ PerlIO *ptr) bool close_failed; dSAVEDERRNO; const int fd = PerlIO_fileno(ptr); + bool should_wait; + + svp = av_fetch(PL_fdpid,fd,TRUE); + pid = (SvTYPE(*svp) == SVt_IV) ? SvIVX(*svp) : -1; + SvREFCNT_dec(*svp); + *svp = NULL; -#ifdef USE_PERLIO +#if defined(USE_PERLIO) /* Find out whether the refcount is low enough for us to wait for the child proc without blocking. */ - const bool should_wait = PerlIOUnix_refcnt(fd) == 1; + should_wait = PerlIOUnix_refcnt(fd) == 1 && pid > 0; #else - const bool should_wait = 1; + should_wait = pid > 0; #endif - svp = av_fetch(PL_fdpid,fd,TRUE); - pid = (SvTYPE(*svp) == SVt_IV) ? SvIVX(*svp) : -1; - SvREFCNT_dec(*svp); - *svp = &PL_sv_undef; #ifdef OS2 if (pid == -1) { /* Opened by popen. */ return my_syspclose(ptr); @@ -3095,19 +2847,9 @@ Perl_my_pclose(pTHX_ PerlIO *ptr) #endif close_failed = (PerlIO_close(ptr) == EOF); SAVE_ERRNO; -#ifndef PERL_MICRO - rsignal_save(SIGHUP, (Sighandler_t) SIG_IGN, &hstat); - rsignal_save(SIGINT, (Sighandler_t) SIG_IGN, &istat); - rsignal_save(SIGQUIT, (Sighandler_t) SIG_IGN, &qstat); -#endif if (should_wait) do { pid2 = wait4pid(pid, &status, 0); } while (pid2 == -1 && errno == EINTR); -#ifndef PERL_MICRO - rsignal_restore(SIGHUP, &hstat); - rsignal_restore(SIGINT, &istat); - rsignal_restore(SIGQUIT, &qstat); -#endif if (close_failed) { RESTORE_ERRNO; return -1; @@ -3135,9 +2877,16 @@ Perl_wait4pid(pTHX_ Pid_t pid, int *stat dVAR; I32 result = 0; PERL_ARGS_ASSERT_WAIT4PID; - if (!pid) - return -1; #ifdef PERL_USES_PL_PIDSTATUS + if (!pid) { + /* PERL_USES_PL_PIDSTATUS is only defined when neither + waitpid() nor wait4() is available, or on OS/2, which + doesn't appear to support waiting for a progress group + member, so we can only treat a 0 pid as an unknown child. + */ + errno = ECHILD; + return -1; + } { if (pid > 0) { /* The keys in PL_pidstatus are now the raw 4 (or 8) bytes of the @@ -3184,7 +2933,7 @@ Perl_wait4pid(pTHX_ Pid_t pid, int *stat goto finish; #endif #if !defined(HAS_WAITPID) && defined(HAS_WAIT4) - result = wait4((pid==-1)?0:pid,statusp,flags,NULL); + result = wait4(pid,statusp,flags,NULL); goto finish; #endif #ifdef PERL_USES_PL_PIDSTATUS @@ -3268,7 +3017,7 @@ Perl_repeatcpy(char *to, const char *fro assert(len >= 0); if (count < 0) - Perl_croak_memory_wrap(); + croak_memory_wrap(); if (len == 1) memset(to, *from, count); @@ -3666,13 +3415,13 @@ Perl_get_vtbl(pTHX_ int vtbl_id) PERL_UNUSED_CONTEXT; return (vtbl_id < 0 || vtbl_id >= magic_vtable_max) - ? NULL : PL_magic_vtables + vtbl_id; + ? NULL : (MGVTBL*)PL_magic_vtables + vtbl_id; } I32 Perl_my_fflush_all(pTHX) { -#if defined(USE_PERLIO) || defined(FFLUSH_NULL) || defined(USE_SFIO) +#if defined(USE_PERLIO) || defined(FFLUSH_NULL) return PerlIO_flush(NULL); #else # if defined(HAS__FWALK) @@ -3764,7 +3513,8 @@ Perl_report_evil_fh(pTHX_ const GV *gv) (const char *)(OP_IS_FILETEST(op) ? "" : "()"); const char * const func = (const char *) - (op == OP_READLINE ? "readline" : /* "" not nice */ + (op == OP_READLINE || op == OP_RCATLINE + ? "readline" : /* "" not nice */ op == OP_LEAVEWRITE ? "write" : /* "write exit" not nice */ PL_op_desc[op]); const char * const type = @@ -3796,7 +3546,7 @@ Perl_report_evil_fh(pTHX_ const GV *gv) * */ -#ifdef HAS_GNULIBC +#ifdef __GLIBC__ # ifndef STRUCT_TM_HASZONE # define STRUCT_TM_HASZONE # endif @@ -4053,7 +3803,11 @@ Perl_my_strftime(pTHX_ const char *fmt, #endif buflen = 64; Newx(buf, buflen, char); + + GCC_DIAG_IGNORE(-Wformat-nonliteral); /* fmt checked by caller */ len = strftime(buf, buflen, fmt, &mytm); + GCC_DIAG_RESTORE; + /* ** The following is needed to handle to the situation where ** tmpbuf overflows. Basically we want to allocate a buffer @@ -4077,7 +3831,11 @@ Perl_my_strftime(pTHX_ const char *fmt, Renew(buf, bufsize, char); while (buf) { + + GCC_DIAG_IGNORE(-Wformat-nonliteral); /* fmt checked by caller */ buflen = strftime(buf, bufsize, fmt, &mytm); + GCC_DIAG_RESTORE; + if (buflen > 0 && buflen < bufsize) break; /* heuristic to prevent out-of-memory errors */ @@ -4129,9 +3887,7 @@ Perl_getcwd_sv(pTHX_ SV *sv) { #ifndef PERL_MICRO dVAR; -#ifndef INCOMPLETE_TAINTS SvTAINTED_on(sv); -#endif PERL_ARGS_ASSERT_GETCWD_SV; @@ -4273,988 +4029,53 @@ Perl_getcwd_sv(pTHX_ SV *sv) #endif } -#define VERSION_MAX 0x7FFFFFFF - -/* -=for apidoc prescan_version - -Validate that a given string can be parsed as a version object, but doesn't -actually perform the parsing. Can use either strict or lax validation rules. -Can optionally set a number of hint variables to save the parsing code -some time when tokenizing. - -=cut -*/ -const char * -Perl_prescan_version(pTHX_ const char *s, bool strict, - const char **errstr, - bool *sqv, int *ssaw_decimal, int *swidth, bool *salpha) { - bool qv = (sqv ? *sqv : FALSE); - int width = 3; - int saw_decimal = 0; - bool alpha = FALSE; - const char *d = s; +#include "vutil.c" - PERL_ARGS_ASSERT_PRESCAN_VERSION; +#if !defined(HAS_SOCKETPAIR) && defined(HAS_SOCKET) && defined(AF_INET) && defined(PF_INET) && defined(SOCK_DGRAM) && defined(HAS_SELECT) +# define EMULATE_SOCKETPAIR_UDP +#endif - if (qv && isDIGIT(*d)) - goto dotted_decimal_version; +#ifdef EMULATE_SOCKETPAIR_UDP +static int +S_socketpair_udp (int fd[2]) { + dTHX; + /* Fake a datagram socketpair using UDP to localhost. */ + int sockets[2] = {-1, -1}; + struct sockaddr_in addresses[2]; + int i; + Sock_size_t size = sizeof(struct sockaddr_in); + unsigned short port; + int got; - if (*d == 'v') { /* explicit v-string */ - d++; - if (isDIGIT(*d)) { - qv = TRUE; - } - else { /* degenerate v-string */ - /* requires v1.2.3 */ - BADVERSION(s,errstr,"Invalid version format (dotted-decimal versions require at least three parts)"); - } + memset(&addresses, 0, sizeof(addresses)); + i = 1; + do { + sockets[i] = PerlSock_socket(AF_INET, SOCK_DGRAM, PF_INET); + if (sockets[i] == -1) + goto tidy_up_and_fail; -dotted_decimal_version: - if (strict && d[0] == '0' && isDIGIT(d[1])) { - /* no leading zeros allowed */ - BADVERSION(s,errstr,"Invalid version format (no leading zeros)"); - } + addresses[i].sin_family = AF_INET; + addresses[i].sin_addr.s_addr = htonl(INADDR_LOOPBACK); + addresses[i].sin_port = 0; /* kernel choses port. */ + if (PerlSock_bind(sockets[i], (struct sockaddr *) &addresses[i], + sizeof(struct sockaddr_in)) == -1) + goto tidy_up_and_fail; + } while (i--); - while (isDIGIT(*d)) /* integer part */ - d++; - - if (*d == '.') - { - saw_decimal++; - d++; /* decimal point */ - } - else - { - if (strict) { - /* require v1.2.3 */ - BADVERSION(s,errstr,"Invalid version format (dotted-decimal versions require at least three parts)"); - } - else { - goto version_prescan_finish; - } - } - - { - int i = 0; - int j = 0; - while (isDIGIT(*d)) { /* just keep reading */ - i++; - while (isDIGIT(*d)) { - d++; j++; - /* maximum 3 digits between decimal */ - if (strict && j > 3) { - BADVERSION(s,errstr,"Invalid version format (maximum 3 digits between decimals)"); - } - } - if (*d == '_') { - if (strict) { - BADVERSION(s,errstr,"Invalid version format (no underscores)"); - } - if ( alpha ) { - BADVERSION(s,errstr,"Invalid version format (multiple underscores)"); - } - d++; - alpha = TRUE; - } - else if (*d == '.') { - if (alpha) { - BADVERSION(s,errstr,"Invalid version format (underscores before decimal)"); - } - saw_decimal++; - d++; - } - else if (!isDIGIT(*d)) { - break; - } - j = 0; - } - - if (strict && i < 2) { - /* requires v1.2.3 */ - BADVERSION(s,errstr,"Invalid version format (dotted-decimal versions require at least three parts)"); - } - } - } /* end if dotted-decimal */ - else - { /* decimal versions */ - int j = 0; /* may need this later */ - /* special strict case for leading '.' or '0' */ - if (strict) { - if (*d == '.') { - BADVERSION(s,errstr,"Invalid version format (0 before decimal required)"); - } - if (*d == '0' && isDIGIT(d[1])) { - BADVERSION(s,errstr,"Invalid version format (no leading zeros)"); - } - } - - /* and we never support negative versions */ - if ( *d == '-') { - BADVERSION(s,errstr,"Invalid version format (negative version number)"); - } - - /* consume all of the integer part */ - while (isDIGIT(*d)) - d++; - - /* look for a fractional part */ - if (*d == '.') { - /* we found it, so consume it */ - saw_decimal++; - d++; - } - else if (!*d || *d == ';' || isSPACE(*d) || *d == '{' || *d == '}') { - if ( d == s ) { - /* found nothing */ - BADVERSION(s,errstr,"Invalid version format (version required)"); - } - /* found just an integer */ - goto version_prescan_finish; - } - else if ( d == s ) { - /* didn't find either integer or period */ - BADVERSION(s,errstr,"Invalid version format (non-numeric data)"); - } - else if (*d == '_') { - /* underscore can't come after integer part */ - if (strict) { - BADVERSION(s,errstr,"Invalid version format (no underscores)"); - } - else if (isDIGIT(d[1])) { - BADVERSION(s,errstr,"Invalid version format (alpha without decimal)"); - } - else { - BADVERSION(s,errstr,"Invalid version format (misplaced underscore)"); - } - } - else { - /* anything else after integer part is just invalid data */ - BADVERSION(s,errstr,"Invalid version format (non-numeric data)"); - } - - /* scan the fractional part after the decimal point*/ - - if (!isDIGIT(*d) && (strict || ! (!*d || *d == ';' || isSPACE(*d) || *d == '{' || *d == '}') )) { - /* strict or lax-but-not-the-end */ - BADVERSION(s,errstr,"Invalid version format (fractional part required)"); - } - - while (isDIGIT(*d)) { - d++; j++; - if (*d == '.' && isDIGIT(d[-1])) { - if (alpha) { - BADVERSION(s,errstr,"Invalid version format (underscores before decimal)"); - } - if (strict) { - BADVERSION(s,errstr,"Invalid version format (dotted-decimal versions must begin with 'v')"); - } - d = (char *)s; /* start all over again */ - qv = TRUE; - goto dotted_decimal_version; - } - if (*d == '_') { - if (strict) { - BADVERSION(s,errstr,"Invalid version format (no underscores)"); - } - if ( alpha ) { - BADVERSION(s,errstr,"Invalid version format (multiple underscores)"); - } - if ( ! isDIGIT(d[1]) ) { - BADVERSION(s,errstr,"Invalid version format (misplaced underscore)"); - } - width = j; - d++; - alpha = TRUE; - } - } - } - -version_prescan_finish: - while (isSPACE(*d)) - d++; - - if (!isDIGIT(*d) && (! (!*d || *d == ';' || *d == '{' || *d == '}') )) { - /* trailing non-numeric data */ - BADVERSION(s,errstr,"Invalid version format (non-numeric data)"); - } - - if (sqv) - *sqv = qv; - if (swidth) - *swidth = width; - if (ssaw_decimal) - *ssaw_decimal = saw_decimal; - if (salpha) - *salpha = alpha; - return d; -} - -/* -=for apidoc scan_version - -Returns a pointer to the next character after the parsed -version string, as well as upgrading the passed in SV to -an RV. - -Function must be called with an already existing SV like - - sv = newSV(0); - s = scan_version(s, SV *sv, bool qv); - -Performs some preprocessing to the string to ensure that -it has the correct characteristics of a version. Flags the -object if it contains an underscore (which denotes this -is an alpha version). The boolean qv denotes that the version -should be interpreted as if it had multiple decimals, even if -it doesn't. - -=cut -*/ - -const char * -Perl_scan_version(pTHX_ const char *s, SV *rv, bool qv) -{ - const char *start = s; - const char *pos; - const char *last; - const char *errstr = NULL; - int saw_decimal = 0; - int width = 3; - bool alpha = FALSE; - bool vinf = FALSE; - AV * av; - SV * hv; - - PERL_ARGS_ASSERT_SCAN_VERSION; - - while (isSPACE(*s)) /* leading whitespace is OK */ - s++; - - last = prescan_version(s, FALSE, &errstr, &qv, &saw_decimal, &width, &alpha); - if (errstr) { - /* "undef" is a special case and not an error */ - if ( ! ( *s == 'u' && strEQ(s,"undef")) ) { - Safefree(start); - Perl_croak(aTHX_ "%s", errstr); - } - } - - start = s; - if (*s == 'v') - s++; - pos = s; - - /* Now that we are through the prescan, start creating the object */ - av = newAV(); - hv = newSVrv(rv, "version"); /* create an SV and upgrade the RV */ - (void)sv_upgrade(hv, SVt_PVHV); /* needs to be an HV type */ - -#ifndef NODEFAULT_SHAREKEYS - HvSHAREKEYS_on(hv); /* key-sharing on by default */ -#endif - - if ( qv ) - (void)hv_stores(MUTABLE_HV(hv), "qv", newSViv(qv)); - if ( alpha ) - (void)hv_stores(MUTABLE_HV(hv), "alpha", newSViv(alpha)); - if ( !qv && width < 3 ) - (void)hv_stores(MUTABLE_HV(hv), "width", newSViv(width)); - - while (isDIGIT(*pos)) - pos++; - if (!isALPHA(*pos)) { - I32 rev; - - for (;;) { - rev = 0; - { - /* this is atoi() that delimits on underscores */ - const char *end = pos; - I32 mult = 1; - I32 orev; - - /* the following if() will only be true after the decimal - * point of a version originally created with a bare - * floating point number, i.e. not quoted in any way - */ - if ( !qv && s > start && saw_decimal == 1 ) { - mult *= 100; - while ( s < end ) { - orev = rev; - rev += (*s - '0') * mult; - mult /= 10; - if ( (PERL_ABS(orev) > PERL_ABS(rev)) - || (PERL_ABS(rev) > VERSION_MAX )) { - Perl_ck_warner(aTHX_ packWARN(WARN_OVERFLOW), - "Integer overflow in version %d",VERSION_MAX); - s = end - 1; - rev = VERSION_MAX; - vinf = 1; - } - s++; - if ( *s == '_' ) - s++; - } - } - else { - while (--end >= s) { - orev = rev; - rev += (*end - '0') * mult; - mult *= 10; - if ( (PERL_ABS(orev) > PERL_ABS(rev)) - || (PERL_ABS(rev) > VERSION_MAX )) { - Perl_ck_warner(aTHX_ packWARN(WARN_OVERFLOW), - "Integer overflow in version"); - end = s - 1; - rev = VERSION_MAX; - vinf = 1; - } - } - } - } - - /* Append revision */ - av_push(av, newSViv(rev)); - if ( vinf ) { - s = last; - break; - } - else if ( *pos == '.' ) - s = ++pos; - else if ( *pos == '_' && isDIGIT(pos[1]) ) - s = ++pos; - else if ( *pos == ',' && isDIGIT(pos[1]) ) - s = ++pos; - else if ( isDIGIT(*pos) ) - s = pos; - else { - s = pos; - break; - } - if ( qv ) { - while ( isDIGIT(*pos) ) - pos++; - } - else { - int digits = 0; - while ( ( isDIGIT(*pos) || *pos == '_' ) && digits < 3 ) { - if ( *pos != '_' ) - digits++; - pos++; - } - } - } - } - if ( qv ) { /* quoted versions always get at least three terms*/ - I32 len = av_len(av); - /* This for loop appears to trigger a compiler bug on OS X, as it - loops infinitely. Yes, len is negative. No, it makes no sense. - Compiler in question is: - gcc version 3.3 20030304 (Apple Computer, Inc. build 1640) - for ( len = 2 - len; len > 0; len-- ) - av_push(MUTABLE_AV(sv), newSViv(0)); - */ - len = 2 - len; - while (len-- > 0) - av_push(av, newSViv(0)); - } - - /* need to save off the current version string for later */ - if ( vinf ) { - SV * orig = newSVpvn("v.Inf", sizeof("v.Inf")-1); - (void)hv_stores(MUTABLE_HV(hv), "original", orig); - (void)hv_stores(MUTABLE_HV(hv), "vinf", newSViv(1)); - } - else if ( s > start ) { - SV * orig = newSVpvn(start,s-start); - if ( qv && saw_decimal == 1 && *start != 'v' ) { - /* need to insert a v to be consistent */ - sv_insert(orig, 0, 0, "v", 1); - } - (void)hv_stores(MUTABLE_HV(hv), "original", orig); - } - else { - (void)hv_stores(MUTABLE_HV(hv), "original", newSVpvs("0")); - av_push(av, newSViv(0)); - } - - /* And finally, store the AV in the hash */ - (void)hv_stores(MUTABLE_HV(hv), "version", newRV_noinc(MUTABLE_SV(av))); - - /* fix RT#19517 - special case 'undef' as string */ - if ( *s == 'u' && strEQ(s,"undef") ) { - s += 5; - } - - return s; -} - -/* -=for apidoc new_version - -Returns a new version object based on the passed in SV: - - SV *sv = new_version(SV *ver); - -Does not alter the passed in ver SV. See "upg_version" if you -want to upgrade the SV. - -=cut -*/ - -SV * -Perl_new_version(pTHX_ SV *ver) -{ - dVAR; - SV * const rv = newSV(0); - PERL_ARGS_ASSERT_NEW_VERSION; - if ( sv_isobject(ver) && sv_derived_from(ver, "version") ) - /* can just copy directly */ - { - I32 key; - AV * const av = newAV(); - AV *sav; - /* This will get reblessed later if a derived class*/ - SV * const hv = newSVrv(rv, "version"); - (void)sv_upgrade(hv, SVt_PVHV); /* needs to be an HV type */ -#ifndef NODEFAULT_SHAREKEYS - HvSHAREKEYS_on(hv); /* key-sharing on by default */ -#endif - - if ( SvROK(ver) ) - ver = SvRV(ver); - - /* Begin copying all of the elements */ - if ( hv_exists(MUTABLE_HV(ver), "qv", 2) ) - (void)hv_stores(MUTABLE_HV(hv), "qv", newSViv(1)); - - if ( hv_exists(MUTABLE_HV(ver), "alpha", 5) ) - (void)hv_stores(MUTABLE_HV(hv), "alpha", newSViv(1)); - - if ( hv_exists(MUTABLE_HV(ver), "width", 5 ) ) - { - const I32 width = SvIV(*hv_fetchs(MUTABLE_HV(ver), "width", FALSE)); - (void)hv_stores(MUTABLE_HV(hv), "width", newSViv(width)); - } - - if ( hv_exists(MUTABLE_HV(ver), "original", 8 ) ) - { - SV * pv = *hv_fetchs(MUTABLE_HV(ver), "original", FALSE); - (void)hv_stores(MUTABLE_HV(hv), "original", newSVsv(pv)); - } - - sav = MUTABLE_AV(SvRV(*hv_fetchs(MUTABLE_HV(ver), "version", FALSE))); - /* This will get reblessed later if a derived class*/ - for ( key = 0; key <= av_len(sav); key++ ) - { - const I32 rev = SvIV(*av_fetch(sav, key, FALSE)); - av_push(av, newSViv(rev)); - } - - (void)hv_stores(MUTABLE_HV(hv), "version", newRV_noinc(MUTABLE_SV(av))); - return rv; - } -#ifdef SvVOK - { - const MAGIC* const mg = SvVSTRING_mg(ver); - if ( mg ) { /* already a v-string */ - const STRLEN len = mg->mg_len; - char * const version = savepvn( (const char*)mg->mg_ptr, len); - sv_setpvn(rv,version,len); - /* this is for consistency with the pure Perl class */ - if ( isDIGIT(*version) ) - sv_insert(rv, 0, 0, "v", 1); - Safefree(version); - } - else { -#endif - sv_setsv(rv,ver); /* make a duplicate */ -#ifdef SvVOK - } - } -#endif - return upg_version(rv, FALSE); -} - -/* -=for apidoc upg_version - -In-place upgrade of the supplied SV to a version object. - - SV *sv = upg_version(SV *sv, bool qv); - -Returns a pointer to the upgraded SV. Set the boolean qv if you want -to force this SV to be interpreted as an "extended" version. - -=cut -*/ - -SV * -Perl_upg_version(pTHX_ SV *ver, bool qv) -{ - const char *version, *s; -#ifdef SvVOK - const MAGIC *mg; -#endif - - PERL_ARGS_ASSERT_UPG_VERSION; - - if ( SvNOK(ver) && !( SvPOK(ver) && sv_len(ver) == 3 ) ) - { - STRLEN len; - - /* may get too much accuracy */ - char tbuf[64]; -#ifdef __vax__ - SV *sv = SvNVX(ver) > 10e37 ? newSV(64) : 0; -#else - SV *sv = SvNVX(ver) > 10e50 ? newSV(64) : 0; -#endif - char *buf; -#ifdef USE_LOCALE_NUMERIC - char *loc = savepv(setlocale(LC_NUMERIC, NULL)); - setlocale(LC_NUMERIC, "C"); -#endif - if (sv) { - Perl_sv_setpvf(aTHX_ sv, "%.9"NVff, SvNVX(ver)); - buf = SvPV(sv, len); - } - else { - len = my_snprintf(tbuf, sizeof(tbuf), "%.9"NVff, SvNVX(ver)); - buf = tbuf; - } -#ifdef USE_LOCALE_NUMERIC - setlocale(LC_NUMERIC, loc); - Safefree(loc); -#endif - while (buf[len-1] == '0' && len > 0) len--; - if ( buf[len-1] == '.' ) len--; /* eat the trailing decimal */ - version = savepvn(buf, len); - SvREFCNT_dec(sv); - } -#ifdef SvVOK - else if ( (mg = SvVSTRING_mg(ver)) ) { /* already a v-string */ - version = savepvn( (const char*)mg->mg_ptr,mg->mg_len ); - qv = TRUE; - } -#endif - else /* must be a string or something like a string */ - { - STRLEN len; - version = savepv(SvPV(ver,len)); -#ifndef SvVOK -# if PERL_VERSION > 5 - /* This will only be executed for 5.6.0 - 5.8.0 inclusive */ - if ( len >= 3 && !instr(version,".") && !instr(version,"_")) { - /* may be a v-string */ - char *testv = (char *)version; - STRLEN tlen = len; - for (tlen=0; tlen < len; tlen++, testv++) { - /* if one of the characters is non-text assume v-string */ - if (testv[0] < ' ') { - SV * const nsv = sv_newmortal(); - const char *nver; - const char *pos; - int saw_decimal = 0; - sv_setpvf(nsv,"v%vd",ver); - pos = nver = savepv(SvPV_nolen(nsv)); - - /* scan the resulting formatted string */ - pos++; /* skip the leading 'v' */ - while ( *pos == '.' || isDIGIT(*pos) ) { - if ( *pos == '.' ) - saw_decimal++ ; - pos++; - } - - /* is definitely a v-string */ - if ( saw_decimal >= 2 ) { - Safefree(version); - version = nver; - } - break; - } - } - } -# endif -#endif - } - - s = scan_version(version, ver, qv); - if ( *s != '\0' ) - Perl_ck_warner(aTHX_ packWARN(WARN_MISC), - "Version string '%s' contains invalid data; " - "ignoring: '%s'", version, s); - Safefree(version); - return ver; -} - -/* -=for apidoc vverify - -Validates that the SV contains valid internal structure for a version object. -It may be passed either the version object (RV) or the hash itself (HV). If -the structure is valid, it returns the HV. If the structure is invalid, -it returns NULL. - - SV *hv = vverify(sv); - -Note that it only confirms the bare minimum structure (so as not to get -confused by derived classes which may contain additional hash entries): - -=over 4 - -=item * The SV is an HV or a reference to an HV - -=item * The hash contains a "version" key - -=item * The "version" key has a reference to an AV as its value - -=back - -=cut -*/ - -SV * -Perl_vverify(pTHX_ SV *vs) -{ - SV *sv; - - PERL_ARGS_ASSERT_VVERIFY; - - if ( SvROK(vs) ) - vs = SvRV(vs); - - /* see if the appropriate elements exist */ - if ( SvTYPE(vs) == SVt_PVHV - && hv_exists(MUTABLE_HV(vs), "version", 7) - && (sv = SvRV(*hv_fetchs(MUTABLE_HV(vs), "version", FALSE))) - && SvTYPE(sv) == SVt_PVAV ) - return vs; - else - return NULL; -} - -/* -=for apidoc vnumify - -Accepts a version object and returns the normalized floating -point representation. Call like: - - sv = vnumify(rv); - -NOTE: you can pass either the object directly or the SV -contained within the RV. - -The SV returned has a refcount of 1. - -=cut -*/ - -SV * -Perl_vnumify(pTHX_ SV *vs) -{ - I32 i, len, digit; - int width; - bool alpha = FALSE; - SV *sv; - AV *av; - - PERL_ARGS_ASSERT_VNUMIFY; - - /* extract the HV from the object */ - vs = vverify(vs); - if ( ! vs ) - Perl_croak(aTHX_ "Invalid version object"); - - /* see if various flags exist */ - if ( hv_exists(MUTABLE_HV(vs), "alpha", 5 ) ) - alpha = TRUE; - if ( hv_exists(MUTABLE_HV(vs), "width", 5 ) ) - width = SvIV(*hv_fetchs(MUTABLE_HV(vs), "width", FALSE)); - else - width = 3; - - - /* attempt to retrieve the version array */ - if ( !(av = MUTABLE_AV(SvRV(*hv_fetchs(MUTABLE_HV(vs), "version", FALSE))) ) ) { - return newSVpvs("0"); - } - - len = av_len(av); - if ( len == -1 ) - { - return newSVpvs("0"); - } - - digit = SvIV(*av_fetch(av, 0, 0)); - sv = Perl_newSVpvf(aTHX_ "%d.", (int)PERL_ABS(digit)); - for ( i = 1 ; i < len ; i++ ) - { - digit = SvIV(*av_fetch(av, i, 0)); - if ( width < 3 ) { - const int denom = (width == 2 ? 10 : 100); - const div_t term = div((int)PERL_ABS(digit),denom); - Perl_sv_catpvf(aTHX_ sv, "%0*d_%d", width, term.quot, term.rem); - } - else { - Perl_sv_catpvf(aTHX_ sv, "%0*d", width, (int)digit); - } - } - - if ( len > 0 ) - { - digit = SvIV(*av_fetch(av, len, 0)); - if ( alpha && width == 3 ) /* alpha version */ - sv_catpvs(sv,"_"); - Perl_sv_catpvf(aTHX_ sv, "%0*d", width, (int)digit); - } - else /* len == 0 */ - { - sv_catpvs(sv, "000"); - } - return sv; -} - -/* -=for apidoc vnormal - -Accepts a version object and returns the normalized string -representation. Call like: - - sv = vnormal(rv); - -NOTE: you can pass either the object directly or the SV -contained within the RV. - -The SV returned has a refcount of 1. - -=cut -*/ - -SV * -Perl_vnormal(pTHX_ SV *vs) -{ - I32 i, len, digit; - bool alpha = FALSE; - SV *sv; - AV *av; - - PERL_ARGS_ASSERT_VNORMAL; - - /* extract the HV from the object */ - vs = vverify(vs); - if ( ! vs ) - Perl_croak(aTHX_ "Invalid version object"); - - if ( hv_exists(MUTABLE_HV(vs), "alpha", 5 ) ) - alpha = TRUE; - av = MUTABLE_AV(SvRV(*hv_fetchs(MUTABLE_HV(vs), "version", FALSE))); - - len = av_len(av); - if ( len == -1 ) - { - return newSVpvs(""); - } - digit = SvIV(*av_fetch(av, 0, 0)); - sv = Perl_newSVpvf(aTHX_ "v%"IVdf, (IV)digit); - for ( i = 1 ; i < len ; i++ ) { - digit = SvIV(*av_fetch(av, i, 0)); - Perl_sv_catpvf(aTHX_ sv, ".%"IVdf, (IV)digit); - } - - if ( len > 0 ) - { - /* handle last digit specially */ - digit = SvIV(*av_fetch(av, len, 0)); - if ( alpha ) - Perl_sv_catpvf(aTHX_ sv, "_%"IVdf, (IV)digit); - else - Perl_sv_catpvf(aTHX_ sv, ".%"IVdf, (IV)digit); - } - - if ( len <= 2 ) { /* short version, must be at least three */ - for ( len = 2 - len; len != 0; len-- ) - sv_catpvs(sv,".0"); - } - return sv; -} - -/* -=for apidoc vstringify - -In order to maintain maximum compatibility with earlier versions -of Perl, this function will return either the floating point -notation or the multiple dotted notation, depending on whether -the original version contained 1 or more dots, respectively. - -The SV returned has a refcount of 1. - -=cut -*/ - -SV * -Perl_vstringify(pTHX_ SV *vs) -{ - PERL_ARGS_ASSERT_VSTRINGIFY; - - /* extract the HV from the object */ - vs = vverify(vs); - if ( ! vs ) - Perl_croak(aTHX_ "Invalid version object"); - - if (hv_exists(MUTABLE_HV(vs), "original", sizeof("original") - 1)) { - SV *pv; - pv = *hv_fetchs(MUTABLE_HV(vs), "original", FALSE); - if ( SvPOK(pv) ) - return newSVsv(pv); - else - return &PL_sv_undef; - } - else { - if ( hv_exists(MUTABLE_HV(vs), "qv", 2) ) - return vnormal(vs); - else - return vnumify(vs); - } -} - -/* -=for apidoc vcmp - -Version object aware cmp. Both operands must already have been -converted into version objects. - -=cut -*/ - -int -Perl_vcmp(pTHX_ SV *lhv, SV *rhv) -{ - I32 i,l,m,r,retval; - bool lalpha = FALSE; - bool ralpha = FALSE; - I32 left = 0; - I32 right = 0; - AV *lav, *rav; - - PERL_ARGS_ASSERT_VCMP; - - /* extract the HVs from the objects */ - lhv = vverify(lhv); - rhv = vverify(rhv); - if ( ! ( lhv && rhv ) ) - Perl_croak(aTHX_ "Invalid version object"); - - /* get the left hand term */ - lav = MUTABLE_AV(SvRV(*hv_fetchs(MUTABLE_HV(lhv), "version", FALSE))); - if ( hv_exists(MUTABLE_HV(lhv), "alpha", 5 ) ) - lalpha = TRUE; - - /* and the right hand term */ - rav = MUTABLE_AV(SvRV(*hv_fetchs(MUTABLE_HV(rhv), "version", FALSE))); - if ( hv_exists(MUTABLE_HV(rhv), "alpha", 5 ) ) - ralpha = TRUE; - - l = av_len(lav); - r = av_len(rav); - m = l < r ? l : r; - retval = 0; - i = 0; - while ( i <= m && retval == 0 ) - { - left = SvIV(*av_fetch(lav,i,0)); - right = SvIV(*av_fetch(rav,i,0)); - if ( left < right ) - retval = -1; - if ( left > right ) - retval = +1; - i++; - } - - /* tiebreaker for alpha with identical terms */ - if ( retval == 0 && l == r && left == right && ( lalpha || ralpha ) ) - { - if ( lalpha && !ralpha ) - { - retval = -1; - } - else if ( ralpha && !lalpha) - { - retval = +1; - } - } - - if ( l != r && retval == 0 ) /* possible match except for trailing 0's */ - { - if ( l < r ) - { - while ( i <= r && retval == 0 ) - { - if ( SvIV(*av_fetch(rav,i,0)) != 0 ) - retval = -1; /* not a match after all */ - i++; - } - } - else - { - while ( i <= l && retval == 0 ) - { - if ( SvIV(*av_fetch(lav,i,0)) != 0 ) - retval = +1; /* not a match after all */ - i++; - } - } - } - return retval; -} - -#if !defined(HAS_SOCKETPAIR) && defined(HAS_SOCKET) && defined(AF_INET) && defined(PF_INET) && defined(SOCK_DGRAM) && defined(HAS_SELECT) -# define EMULATE_SOCKETPAIR_UDP -#endif - -#ifdef EMULATE_SOCKETPAIR_UDP -static int -S_socketpair_udp (int fd[2]) { - dTHX; - /* Fake a datagram socketpair using UDP to localhost. */ - int sockets[2] = {-1, -1}; - struct sockaddr_in addresses[2]; - int i; - Sock_size_t size = sizeof(struct sockaddr_in); - unsigned short port; - int got; - - memset(&addresses, 0, sizeof(addresses)); - i = 1; - do { - sockets[i] = PerlSock_socket(AF_INET, SOCK_DGRAM, PF_INET); - if (sockets[i] == -1) - goto tidy_up_and_fail; - - addresses[i].sin_family = AF_INET; - addresses[i].sin_addr.s_addr = htonl(INADDR_LOOPBACK); - addresses[i].sin_port = 0; /* kernel choses port. */ - if (PerlSock_bind(sockets[i], (struct sockaddr *) &addresses[i], - sizeof(struct sockaddr_in)) == -1) - goto tidy_up_and_fail; - } while (i--); - - /* Now have 2 UDP sockets. Find out which port each is connected to, and - for each connect the other socket to it. */ - i = 1; - do { - if (PerlSock_getsockname(sockets[i], (struct sockaddr *) &addresses[i], - &size) == -1) - goto tidy_up_and_fail; - if (size != sizeof(struct sockaddr_in)) - goto abort_tidy_up_and_fail; - /* !1 is 0, !0 is 1 */ - if (PerlSock_connect(sockets[!i], (struct sockaddr *) &addresses[i], - sizeof(struct sockaddr_in)) == -1) - goto tidy_up_and_fail; - } while (i--); + /* Now have 2 UDP sockets. Find out which port each is connected to, and + for each connect the other socket to it. */ + i = 1; + do { + if (PerlSock_getsockname(sockets[i], (struct sockaddr *) &addresses[i], + &size) == -1) + goto tidy_up_and_fail; + if (size != sizeof(struct sockaddr_in)) + goto abort_tidy_up_and_fail; + /* !1 is 0, !0 is 1 */ + if (PerlSock_connect(sockets[!i], (struct sockaddr *) &addresses[i], + sizeof(struct sockaddr_in)) == -1) + goto tidy_up_and_fail; + } while (i--); /* Now we have 2 sockets connected to each other. I don't trust some other process not to have already sent a packet to us (by random) so send @@ -5478,7 +4299,8 @@ Perl_my_socketpair (int family, int type =for apidoc sv_nosharing Dummy routine which "shares" an SV when there is no sharing module present. -Or "locks" it. Or "unlocks" it. In other words, ignores its single SV argument. +Or "locks" it. Or "unlocks" it. In other +words, ignores its single SV argument. Exists to avoid test for a NULL function pointer and because it could potentially warn under some level of strict-ness. @@ -5759,8 +4581,8 @@ Perl_init_global_struct(pTHX) { struct perl_vars *plvarsp = NULL; # ifdef PERL_GLOBAL_STRUCT - const IV nppaddr = sizeof(Gppaddr)/sizeof(Perl_ppaddr_t); - const IV ncheck = sizeof(Gcheck) /sizeof(Perl_check_t); + const IV nppaddr = C_ARRAY_LENGTH(Gppaddr); + const IV ncheck = C_ARRAY_LENGTH(Gcheck); # ifdef PERL_GLOBAL_STRUCT_PRIVATE /* PerlMem_malloc() because can't use even safesysmalloc() this early. */ plvarsp = (struct perl_vars*)PerlMem_malloc(sizeof(struct perl_vars)); @@ -5799,6 +4621,10 @@ Perl_init_global_struct(pTHX) # ifdef PERL_SET_VARS PERL_SET_VARS(plvarsp); # endif +# ifdef PERL_GLOBAL_STRUCT_PRIVATE + plvarsp->Gsv_placeholder.sv_flags = 0; + memset(plvarsp->Ghash_seed, 0, sizeof(plvarsp->Ghash_seed)); +# endif # undef PERL_GLOBAL_STRUCT_INIT # endif return plvarsp; @@ -5811,11 +4637,15 @@ Perl_init_global_struct(pTHX) void Perl_free_global_struct(pTHX_ struct perl_vars *plvarsp) { + int veto = plvarsp->Gveto_cleanup; + PERL_ARGS_ASSERT_FREE_GLOBAL_STRUCT; # ifdef PERL_GLOBAL_STRUCT # ifdef PERL_UNSET_VARS PERL_UNSET_VARS(plvarsp); # endif + if (veto) + return; free(plvarsp->Gppaddr); free(plvarsp->Gcheck); # ifdef PERL_GLOBAL_STRUCT_PRIVATE @@ -6022,7 +4852,7 @@ Perl_mem_log_del_sv(const SV *sv, =for apidoc my_sprintf The C library C, wrapped if necessary, to ensure that it will return -the length of the string written to the buffer. Only rare pre-ANSI systems +the length of the string written to the buffer. Only rare pre-ANSI systems need the wrapper function - usually this is a direct call to C. =cut @@ -6103,6 +4933,7 @@ Perl_my_vsnprintf(char *buffer, const Si # else retval = vsprintf(buffer, format, apc); # endif + va_end(apc); #else # ifdef HAS_VSNPRINTF retval = vsnprintf(buffer, len, format, ap); @@ -6151,16 +4982,14 @@ Perl_my_clearenv(pTHX) (void)clearenv(); # elif defined(HAS_UNSETENV) int bsiz = 80; /* Most envvar names will be shorter than this. */ - int bufsiz = bsiz * sizeof(char); /* sizeof(char) paranoid? */ - char *buf = (char*)safesysmalloc(bufsiz); + char *buf = (char*)safesysmalloc(bsiz); while (*environ != NULL) { char *e = strchr(*environ, '='); int l = e ? e - *environ : (int)strlen(*environ); if (bsiz < l + 1) { (void)safesysfree(buf); bsiz = l + 1; /* + 1 for the \0. */ - bufsiz = bsiz * sizeof(char); /* keep bsiz and bufsiz in sync */ - buf = (char*)safesysmalloc(bufsiz); + buf = (char*)safesysmalloc(bsiz); } memcpy(buf, *environ, l); buf[l] = '\0'; @@ -6374,6 +5203,26 @@ Perl_xs_apiversion_bootcheck(pTHX_ SV *m Perl_croak_sv(aTHX_ xpt); } +/* +=for apidoc my_strlcat + +The C library C if available, or a Perl implementation of it. +This operates on C C-terminated strings. + +C appends string C to the end of C. It will append at +most S> characters. It will then C-terminate, +unless C is 0 or the original C string was longer than C (in +practice this should not happen as it means that either C is incorrect or +that C is not a proper C-terminated string). + +Note that C is the full size of the destination buffer and +the result is guaranteed to be C-terminated if there is room. Note that +room for the C should be included in C. + +=cut + +Description stolen from http://www.openbsd.org/cgi-bin/man.cgi?query=strlcat +*/ #ifndef HAS_STRLCAT Size_t Perl_my_strlcat(char *dst, const char *src, Size_t size) @@ -6391,6 +5240,20 @@ Perl_my_strlcat(char *dst, const char *s } #endif + +/* +=for apidoc my_strlcpy + +The C library C if available, or a Perl implementation of it. +This operates on C C-terminated strings. + +C copies up to S> characters from the string C +to C, C-terminating the result if C is not 0. + +=cut + +Description stolen from http://www.openbsd.org/cgi-bin/man.cgi?query=strlcpy +*/ #ifndef HAS_STRLCPY Size_t Perl_my_strlcpy(char *dst, const char *src, Size_t size) @@ -6419,9 +5282,8 @@ S_gv_has_usable_name(pTHX_ GV *gv) GV **gvp; return GvSTASH(gv) && HvENAME(GvSTASH(gv)) - && (gvp = (GV **)hv_fetch( - GvSTASH(gv), GvNAME(gv), - GvNAMEUTF8(gv) ? -GvNAMELEN(gv) : GvNAMELEN(gv), 0 + && (gvp = (GV **)hv_fetchhek( + GvSTASH(gv), GvNAME_HEK(gv), 0 )) && *gvp == gv; } @@ -6481,6 +5343,7 @@ Perl_get_db_sub(pTHX_ SV **svp, CV *cv) (void)SvIOK_on(dbsv); SvIV_set(dbsv, PTR2IV(cv)); /* Do it the quickest way */ } + SvSETMAGIC(dbsv); TAINT_IF(save_taint); #ifdef NO_TAINT_SUPPORT PERL_UNUSED_VAR(save_taint); @@ -6518,6 +5381,105 @@ Perl_get_re_arg(pTHX_ SV *sv) { return NULL; } + +/* + * This code is derived from drand48() implementation from FreeBSD, + * found in lib/libc/gen/_rand48.c. + * + * The U64 implementation is original, based on the POSIX + * specification for drand48(). + */ + +/* +* Copyright (c) 1993 Martin Birgmeier +* All rights reserved. +* +* You may redistribute unmodified or modified versions of this source +* code provided that the above copyright notice and this and the +* following conditions are retained. +* +* This software is provided ``as is'', and comes with no warranties +* of any kind. I shall in no event be liable for anything that happens +* to anyone/anything when using this software. +*/ + +#define FREEBSD_DRAND48_SEED_0 (0x330e) + +#ifdef PERL_DRAND48_QUAD + +#define DRAND48_MULT U64_CONST(0x5deece66d) +#define DRAND48_ADD 0xb +#define DRAND48_MASK U64_CONST(0xffffffffffff) + +#else + +#define FREEBSD_DRAND48_SEED_1 (0xabcd) +#define FREEBSD_DRAND48_SEED_2 (0x1234) +#define FREEBSD_DRAND48_MULT_0 (0xe66d) +#define FREEBSD_DRAND48_MULT_1 (0xdeec) +#define FREEBSD_DRAND48_MULT_2 (0x0005) +#define FREEBSD_DRAND48_ADD (0x000b) + +const unsigned short _rand48_mult[3] = { + FREEBSD_DRAND48_MULT_0, + FREEBSD_DRAND48_MULT_1, + FREEBSD_DRAND48_MULT_2 +}; +const unsigned short _rand48_add = FREEBSD_DRAND48_ADD; + +#endif + +void +Perl_drand48_init_r(perl_drand48_t *random_state, U32 seed) +{ + PERL_ARGS_ASSERT_DRAND48_INIT_R; + +#ifdef PERL_DRAND48_QUAD + *random_state = FREEBSD_DRAND48_SEED_0 + ((U64TYPE)seed << 16); +#else + random_state->seed[0] = FREEBSD_DRAND48_SEED_0; + random_state->seed[1] = (U16) seed; + random_state->seed[2] = (U16) (seed >> 16); +#endif +} + +double +Perl_drand48_r(perl_drand48_t *random_state) +{ + PERL_ARGS_ASSERT_DRAND48_R; + +#ifdef PERL_DRAND48_QUAD + *random_state = (*random_state * DRAND48_MULT + DRAND48_ADD) + & DRAND48_MASK; + + return ldexp((double)*random_state, -48); +#else + { + U32 accu; + U16 temp[2]; + + accu = (U32) _rand48_mult[0] * (U32) random_state->seed[0] + + (U32) _rand48_add; + temp[0] = (U16) accu; /* lower 16 bits */ + accu >>= sizeof(U16) * 8; + accu += (U32) _rand48_mult[0] * (U32) random_state->seed[1] + + (U32) _rand48_mult[1] * (U32) random_state->seed[0]; + temp[1] = (U16) accu; /* middle 16 bits */ + accu >>= sizeof(U16) * 8; + accu += _rand48_mult[0] * random_state->seed[2] + + _rand48_mult[1] * random_state->seed[1] + + _rand48_mult[2] * random_state->seed[0]; + random_state->seed[0] = temp[0]; + random_state->seed[1] = temp[1]; + random_state->seed[2] = (U16) accu; + + return ldexp((double) random_state->seed[0], -48) + + ldexp((double) random_state->seed[1], -32) + + ldexp((double) random_state->seed[2], -16); + } +#endif +} + /* * Local variables: Index: gnu/usr.bin/perl/util.h =================================================================== RCS file: /mnt/memory/perl/importit/cvs/src/gnu/usr.bin/perl/util.h,v retrieving revision 1.13 diff -u -p -u -p -r1.13 util.h --- gnu/usr.bin/perl/util.h 24 Mar 2014 15:05:13 -0000 1.13 +++ gnu/usr.bin/perl/util.h 16 Nov 2014 03:22:24 -0000 @@ -52,6 +52,36 @@ This is a synonym for (! foldEQ_locale() #define ibcmp(s1, s2, len) cBOOL(! foldEQ(s1, s2, len)) #define ibcmp_locale(s1, s2, len) cBOOL(! foldEQ_locale(s1, s2, len)) +/* outside the core, perl.h undefs HAS_QUAD if IV isn't 64-bit + We can't swap this to HAS_QUAD, because the logic here affects the type of + perl_drand48_t below, and that is visible outside of the core. */ +#if defined(U64TYPE) && !defined(USING_MSVC6) +/* use a faster implementation when quads are available, + * but not with VC6 on Windows */ +# define PERL_DRAND48_QUAD +#endif + +#ifdef PERL_DRAND48_QUAD + +/* U64 is only defined under PERL_CORE, but this needs to be visible + * elsewhere so the definition of PerlInterpreter is complete. + */ +typedef U64TYPE perl_drand48_t; + +#else + +struct PERL_DRAND48_T { + U16 seed[3]; +}; + +typedef struct PERL_DRAND48_T perl_drand48_t; + +#endif + +#define PL_RANDOM_STATE_TYPE perl_drand48_t + +#define Perl_drand48_init(seed) (Perl_drand48_init_r(&PL_random_state, (seed))) +#define Perl_drand48() (Perl_drand48_r(&PL_random_state)) /* * Local variables: Index: gnu/usr.bin/perl/utils.lst =================================================================== RCS file: /mnt/memory/perl/importit/cvs/src/gnu/usr.bin/perl/utils.lst,v retrieving revision 1.8 diff -u -p -u -p -r1.8 utils.lst --- gnu/usr.bin/perl/utils.lst 24 Mar 2014 15:05:13 -0000 1.8 +++ gnu/usr.bin/perl/utils.lst 16 Nov 2014 03:22:24 -0000 @@ -1,4 +1,3 @@ -cpan/Pod-LaTeX/blib/script/pod2latex cpan/podlators/blib/script/pod2man cpan/podlators/blib/script/pod2text cpan/Pod-Usage/blib/script/pod2usage @@ -13,16 +12,13 @@ utils/h2ph utils/h2xs utils/instmodsh utils/libnetcfg -utils/perlbug +utils/perlbug # link = utils/perlthanks utils/perldoc utils/perlivp utils/piconv utils/pl2pm utils/pod2html utils/prove -utils/cpanp-run-perl -utils/cpanp -utils/cpan2dist utils/splain utils/xsubpp x2p/a2p Index: gnu/usr.bin/perl/vutil.c =================================================================== RCS file: gnu/usr.bin/perl/vutil.c diff -N gnu/usr.bin/perl/vutil.c --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ gnu/usr.bin/perl/vutil.c 16 Nov 2014 03:22:24 -0000 @@ -0,0 +1,1088 @@ +/* This file is part of the "version" CPAN distribution. Please avoid + editing it in the perl core. */ + +#ifndef PERL_CORE +# define PERL_NO_GET_CONTEXT +# include "EXTERN.h" +# include "perl.h" +# include "XSUB.h" +# define NEED_my_snprintf +# define NEED_newRV_noinc +# define NEED_vnewSVpvf +# define NEED_newSVpvn_flags_GLOBAL +# define NEED_warner +# include "ppport.h" +#endif +#include "vutil.h" + +#define VERSION_MAX 0x7FFFFFFF + +/* +=for apidoc prescan_version + +Validate that a given string can be parsed as a version object, but doesn't +actually perform the parsing. Can use either strict or lax validation rules. +Can optionally set a number of hint variables to save the parsing code +some time when tokenizing. + +=cut +*/ +const char * +#ifdef VUTIL_REPLACE_CORE +Perl_prescan_version2(pTHX_ const char *s, bool strict, +#else +Perl_prescan_version(pTHX_ const char *s, bool strict, +#endif + const char **errstr, + bool *sqv, int *ssaw_decimal, int *swidth, bool *salpha) { + bool qv = (sqv ? *sqv : FALSE); + int width = 3; + int saw_decimal = 0; + bool alpha = FALSE; + const char *d = s; + + PERL_ARGS_ASSERT_PRESCAN_VERSION; + + if (qv && isDIGIT(*d)) + goto dotted_decimal_version; + + if (*d == 'v') { /* explicit v-string */ + d++; + if (isDIGIT(*d)) { + qv = TRUE; + } + else { /* degenerate v-string */ + /* requires v1.2.3 */ + BADVERSION(s,errstr,"Invalid version format (dotted-decimal versions require at least three parts)"); + } + +dotted_decimal_version: + if (strict && d[0] == '0' && isDIGIT(d[1])) { + /* no leading zeros allowed */ + BADVERSION(s,errstr,"Invalid version format (no leading zeros)"); + } + + while (isDIGIT(*d)) /* integer part */ + d++; + + if (*d == '.') + { + saw_decimal++; + d++; /* decimal point */ + } + else + { + if (strict) { + /* require v1.2.3 */ + BADVERSION(s,errstr,"Invalid version format (dotted-decimal versions require at least three parts)"); + } + else { + goto version_prescan_finish; + } + } + + { + int i = 0; + int j = 0; + while (isDIGIT(*d)) { /* just keep reading */ + i++; + while (isDIGIT(*d)) { + d++; j++; + /* maximum 3 digits between decimal */ + if (strict && j > 3) { + BADVERSION(s,errstr,"Invalid version format (maximum 3 digits between decimals)"); + } + } + if (*d == '_') { + if (strict) { + BADVERSION(s,errstr,"Invalid version format (no underscores)"); + } + if ( alpha ) { + BADVERSION(s,errstr,"Invalid version format (multiple underscores)"); + } + d++; + alpha = TRUE; + } + else if (*d == '.') { + if (alpha) { + BADVERSION(s,errstr,"Invalid version format (underscores before decimal)"); + } + saw_decimal++; + d++; + } + else if (!isDIGIT(*d)) { + break; + } + j = 0; + } + + if (strict && i < 2) { + /* requires v1.2.3 */ + BADVERSION(s,errstr,"Invalid version format (dotted-decimal versions require at least three parts)"); + } + } + } /* end if dotted-decimal */ + else + { /* decimal versions */ + int j = 0; /* may need this later */ + /* special strict case for leading '.' or '0' */ + if (strict) { + if (*d == '.') { + BADVERSION(s,errstr,"Invalid version format (0 before decimal required)"); + } + if (*d == '0' && isDIGIT(d[1])) { + BADVERSION(s,errstr,"Invalid version format (no leading zeros)"); + } + } + + /* and we never support negative versions */ + if ( *d == '-') { + BADVERSION(s,errstr,"Invalid version format (negative version number)"); + } + + /* consume all of the integer part */ + while (isDIGIT(*d)) + d++; + + /* look for a fractional part */ + if (*d == '.') { + /* we found it, so consume it */ + saw_decimal++; + d++; + } + else if (!*d || *d == ';' || isSPACE(*d) || *d == '{' || *d == '}') { + if ( d == s ) { + /* found nothing */ + BADVERSION(s,errstr,"Invalid version format (version required)"); + } + /* found just an integer */ + goto version_prescan_finish; + } + else if ( d == s ) { + /* didn't find either integer or period */ + BADVERSION(s,errstr,"Invalid version format (non-numeric data)"); + } + else if (*d == '_') { + /* underscore can't come after integer part */ + if (strict) { + BADVERSION(s,errstr,"Invalid version format (no underscores)"); + } + else if (isDIGIT(d[1])) { + BADVERSION(s,errstr,"Invalid version format (alpha without decimal)"); + } + else { + BADVERSION(s,errstr,"Invalid version format (misplaced underscore)"); + } + } + else { + /* anything else after integer part is just invalid data */ + BADVERSION(s,errstr,"Invalid version format (non-numeric data)"); + } + + /* scan the fractional part after the decimal point*/ + + if (!isDIGIT(*d) && (strict || ! (!*d || *d == ';' || isSPACE(*d) || *d == '{' || *d == '}') )) { + /* strict or lax-but-not-the-end */ + BADVERSION(s,errstr,"Invalid version format (fractional part required)"); + } + + while (isDIGIT(*d)) { + d++; j++; + if (*d == '.' && isDIGIT(d[-1])) { + if (alpha) { + BADVERSION(s,errstr,"Invalid version format (underscores before decimal)"); + } + if (strict) { + BADVERSION(s,errstr,"Invalid version format (dotted-decimal versions must begin with 'v')"); + } + d = (char *)s; /* start all over again */ + qv = TRUE; + goto dotted_decimal_version; + } + if (*d == '_') { + if (strict) { + BADVERSION(s,errstr,"Invalid version format (no underscores)"); + } + if ( alpha ) { + BADVERSION(s,errstr,"Invalid version format (multiple underscores)"); + } + if ( ! isDIGIT(d[1]) ) { + BADVERSION(s,errstr,"Invalid version format (misplaced underscore)"); + } + width = j; + d++; + alpha = TRUE; + } + } + } + +version_prescan_finish: + while (isSPACE(*d)) + d++; + + if (!isDIGIT(*d) && (! (!*d || *d == ';' || *d == '{' || *d == '}') )) { + /* trailing non-numeric data */ + BADVERSION(s,errstr,"Invalid version format (non-numeric data)"); + } + + if (sqv) + *sqv = qv; + if (swidth) + *swidth = width; + if (ssaw_decimal) + *ssaw_decimal = saw_decimal; + if (salpha) + *salpha = alpha; + return d; +} + +/* +=for apidoc scan_version + +Returns a pointer to the next character after the parsed +version string, as well as upgrading the passed in SV to +an RV. + +Function must be called with an already existing SV like + + sv = newSV(0); + s = scan_version(s, SV *sv, bool qv); + +Performs some preprocessing to the string to ensure that +it has the correct characteristics of a version. Flags the +object if it contains an underscore (which denotes this +is an alpha version). The boolean qv denotes that the version +should be interpreted as if it had multiple decimals, even if +it doesn't. + +=cut +*/ + +const char * +#ifdef VUTIL_REPLACE_CORE +Perl_scan_version2(pTHX_ const char *s, SV *rv, bool qv) +#else +Perl_scan_version(pTHX_ const char *s, SV *rv, bool qv) +#endif +{ + const char *start = s; + const char *pos; + const char *last; + const char *errstr = NULL; + int saw_decimal = 0; + int width = 3; + bool alpha = FALSE; + bool vinf = FALSE; + AV * av; + SV * hv; + + PERL_ARGS_ASSERT_SCAN_VERSION; + + while (isSPACE(*s)) /* leading whitespace is OK */ + s++; + + last = PRESCAN_VERSION(s, FALSE, &errstr, &qv, &saw_decimal, &width, &alpha); + if (errstr) { + /* "undef" is a special case and not an error */ + if ( ! ( *s == 'u' && strEQ(s+1,"ndef")) ) { + Perl_croak(aTHX_ "%s", errstr); + } + } + + start = s; + if (*s == 'v') + s++; + pos = s; + + /* Now that we are through the prescan, start creating the object */ + av = newAV(); + hv = newSVrv(rv, "version"); /* create an SV and upgrade the RV */ + (void)sv_upgrade(hv, SVt_PVHV); /* needs to be an HV type */ + +#ifndef NODEFAULT_SHAREKEYS + HvSHAREKEYS_on(hv); /* key-sharing on by default */ +#endif + + if ( qv ) + (void)hv_stores(MUTABLE_HV(hv), "qv", newSViv(qv)); + if ( alpha ) + (void)hv_stores(MUTABLE_HV(hv), "alpha", newSViv(alpha)); + if ( !qv && width < 3 ) + (void)hv_stores(MUTABLE_HV(hv), "width", newSViv(width)); + + while (isDIGIT(*pos)) + pos++; + if (!isALPHA(*pos)) { + I32 rev; + + for (;;) { + rev = 0; + { + /* this is atoi() that delimits on underscores */ + const char *end = pos; + I32 mult = 1; + I32 orev; + + /* the following if() will only be true after the decimal + * point of a version originally created with a bare + * floating point number, i.e. not quoted in any way + */ + if ( !qv && s > start && saw_decimal == 1 ) { + mult *= 100; + while ( s < end ) { + orev = rev; + rev += (*s - '0') * mult; + mult /= 10; + if ( (PERL_ABS(orev) > PERL_ABS(rev)) + || (PERL_ABS(rev) > VERSION_MAX )) { + Perl_ck_warner(aTHX_ packWARN(WARN_OVERFLOW), + "Integer overflow in version %d",VERSION_MAX); + s = end - 1; + rev = VERSION_MAX; + vinf = 1; + } + s++; + if ( *s == '_' ) + s++; + } + } + else { + while (--end >= s) { + orev = rev; + rev += (*end - '0') * mult; + mult *= 10; + if ( (PERL_ABS(orev) > PERL_ABS(rev)) + || (PERL_ABS(rev) > VERSION_MAX )) { + Perl_ck_warner(aTHX_ packWARN(WARN_OVERFLOW), + "Integer overflow in version"); + end = s - 1; + rev = VERSION_MAX; + vinf = 1; + } + } + } + } + + /* Append revision */ + av_push(av, newSViv(rev)); + if ( vinf ) { + s = last; + break; + } + else if ( *pos == '.' ) + s = ++pos; + else if ( *pos == '_' && isDIGIT(pos[1]) ) + s = ++pos; + else if ( *pos == ',' && isDIGIT(pos[1]) ) + s = ++pos; + else if ( isDIGIT(*pos) ) + s = pos; + else { + s = pos; + break; + } + if ( qv ) { + while ( isDIGIT(*pos) ) + pos++; + } + else { + int digits = 0; + while ( ( isDIGIT(*pos) || *pos == '_' ) && digits < 3 ) { + if ( *pos != '_' ) + digits++; + pos++; + } + } + } + } + if ( qv ) { /* quoted versions always get at least three terms*/ + SSize_t len = AvFILLp(av); + /* This for loop appears to trigger a compiler bug on OS X, as it + loops infinitely. Yes, len is negative. No, it makes no sense. + Compiler in question is: + gcc version 3.3 20030304 (Apple Computer, Inc. build 1640) + for ( len = 2 - len; len > 0; len-- ) + av_push(MUTABLE_AV(sv), newSViv(0)); + */ + len = 2 - len; + while (len-- > 0) + av_push(av, newSViv(0)); + } + + /* need to save off the current version string for later */ + if ( vinf ) { + SV * orig = newSVpvn("v.Inf", sizeof("v.Inf")-1); + (void)hv_stores(MUTABLE_HV(hv), "original", orig); + (void)hv_stores(MUTABLE_HV(hv), "vinf", newSViv(1)); + } + else if ( s > start ) { + SV * orig = newSVpvn(start,s-start); + if ( qv && saw_decimal == 1 && *start != 'v' ) { + /* need to insert a v to be consistent */ + sv_insert(orig, 0, 0, "v", 1); + } + (void)hv_stores(MUTABLE_HV(hv), "original", orig); + } + else { + (void)hv_stores(MUTABLE_HV(hv), "original", newSVpvs("0")); + av_push(av, newSViv(0)); + } + + /* And finally, store the AV in the hash */ + (void)hv_stores(MUTABLE_HV(hv), "version", newRV_noinc(MUTABLE_SV(av))); + + /* fix RT#19517 - special case 'undef' as string */ + if ( *s == 'u' && strEQ(s+1,"ndef") ) { + s += 5; + } + + return s; +} + +/* +=for apidoc new_version + +Returns a new version object based on the passed in SV: + + SV *sv = new_version(SV *ver); + +Does not alter the passed in ver SV. See "upg_version" if you +want to upgrade the SV. + +=cut +*/ + +SV * +#ifdef VUTIL_REPLACE_CORE +Perl_new_version2(pTHX_ SV *ver) +#else +Perl_new_version(pTHX_ SV *ver) +#endif +{ + dVAR; + SV * const rv = newSV(0); + PERL_ARGS_ASSERT_NEW_VERSION; + if ( ISA_VERSION_OBJ(ver) ) /* can just copy directly */ + { + SSize_t key; + AV * const av = newAV(); + AV *sav; + /* This will get reblessed later if a derived class*/ + SV * const hv = newSVrv(rv, "version"); + (void)sv_upgrade(hv, SVt_PVHV); /* needs to be an HV type */ +#ifndef NODEFAULT_SHAREKEYS + HvSHAREKEYS_on(hv); /* key-sharing on by default */ +#endif + + if ( SvROK(ver) ) + ver = SvRV(ver); + + /* Begin copying all of the elements */ + if ( hv_exists(MUTABLE_HV(ver), "qv", 2) ) + (void)hv_stores(MUTABLE_HV(hv), "qv", newSViv(1)); + + if ( hv_exists(MUTABLE_HV(ver), "alpha", 5) ) + (void)hv_stores(MUTABLE_HV(hv), "alpha", newSViv(1)); + { + SV ** svp = hv_fetchs(MUTABLE_HV(ver), "width", FALSE); + if(svp) { + const I32 width = SvIV(*svp); + (void)hv_stores(MUTABLE_HV(hv), "width", newSViv(width)); + } + } + { + SV ** svp = hv_fetchs(MUTABLE_HV(ver), "original", FALSE); + if(svp) + (void)hv_stores(MUTABLE_HV(hv), "original", newSVsv(*svp)); + } + sav = MUTABLE_AV(SvRV(*hv_fetchs(MUTABLE_HV(ver), "version", FALSE))); + /* This will get reblessed later if a derived class*/ + for ( key = 0; key <= av_len(sav); key++ ) + { + SV * const sv = *av_fetch(sav, key, FALSE); + const I32 rev = SvIV(sv); + av_push(av, newSViv(rev)); + } + + (void)hv_stores(MUTABLE_HV(hv), "version", newRV_noinc(MUTABLE_SV(av))); + return rv; + } +#ifdef SvVOK + { + const MAGIC* const mg = SvVSTRING_mg(ver); + if ( mg ) { /* already a v-string */ + const STRLEN len = mg->mg_len; + const char * const version = (const char*)mg->mg_ptr; + sv_setpvn(rv,version,len); + /* this is for consistency with the pure Perl class */ + if ( isDIGIT(*version) ) + sv_insert(rv, 0, 0, "v", 1); + } + else { +#endif + SvSetSV_nosteal(rv, ver); /* make a duplicate */ +#ifdef SvVOK + } + } +#endif + sv_2mortal(rv); /* in case upg_version croaks before it returns */ + return SvREFCNT_inc_NN(UPG_VERSION(rv, FALSE)); +} + +/* +=for apidoc upg_version + +In-place upgrade of the supplied SV to a version object. + + SV *sv = upg_version(SV *sv, bool qv); + +Returns a pointer to the upgraded SV. Set the boolean qv if you want +to force this SV to be interpreted as an "extended" version. + +=cut +*/ + +SV * +#ifdef VUTIL_REPLACE_CORE +Perl_upg_version2(pTHX_ SV *ver, bool qv) +#else +Perl_upg_version(pTHX_ SV *ver, bool qv) +#endif +{ + const char *version, *s; +#ifdef SvVOK + const MAGIC *mg; +#endif + +#if PERL_VERSION_LT(5,19,8) && defined(USE_ITHREADS) + ENTER; +#endif + PERL_ARGS_ASSERT_UPG_VERSION; + + if ( (SvUOK(ver) && SvUVX(ver) > VERSION_MAX) + || (SvIOK(ver) && SvIVX(ver) > VERSION_MAX) ) { + /* out of bounds [unsigned] integer */ + STRLEN len; + char tbuf[64]; + len = my_snprintf(tbuf, sizeof(tbuf), "%d", VERSION_MAX); + version = savepvn(tbuf, len); + SAVEFREEPV(version); + Perl_ck_warner(aTHX_ packWARN(WARN_OVERFLOW), + "Integer overflow in version %d",VERSION_MAX); + } + else if ( SvUOK(ver) || SvIOK(ver)) +#if PERL_VERSION_LT(5,17,2) +VER_IV: +#endif + { + version = savesvpv(ver); + SAVEFREEPV(version); + } + else if (SvNOK(ver) && !( SvPOK(ver) && SvCUR(ver) == 3 ) ) +#if PERL_VERSION_LT(5,17,2) +VER_NV: +#endif + { + STRLEN len; + + /* may get too much accuracy */ + char tbuf[64]; +#ifdef __vax__ + SV *sv = SvNVX(ver) > 10e37 ? newSV(64) : 0; +#else + SV *sv = SvNVX(ver) > 10e50 ? newSV(64) : 0; +#endif + char *buf; +#ifdef USE_LOCALE_NUMERIC + const char * const cur_numeric = setlocale(LC_NUMERIC, NULL); + assert(cur_numeric); + + /* XS code can set the locale without us knowing. To protect the + * version number parsing, which requires the radix character to be a + * dot, update our records as to what the locale is, so that our + * existing macro mechanism can correctly change it to a dot and back + * if necessary. This code is extremely unlikely to be in a loop, so + * the extra work will have a negligible performance impact. See [perl + * #121930]. + * + * If the current locale is a standard one, but we are expecting it to + * be a different, underlying locale, update our records to make the + * underlying locale this (standard) one. If the current locale is not + * a standard one, we should be expecting a non-standard one, the same + * one that we have recorded as the underlying locale. If not, update + * our records. */ + if (strEQ(cur_numeric, "C") || strEQ(cur_numeric, "POSIX")) { + if (! PL_numeric_standard) { + new_numeric(cur_numeric); + } + } + else if (PL_numeric_standard + || ! PL_numeric_name + || strNE(PL_numeric_name, cur_numeric)) + { + new_numeric(cur_numeric); + } +#endif + { /* Braces needed because macro just below declares a variable */ + STORE_NUMERIC_LOCAL_SET_STANDARD(); + if (sv) { + Perl_sv_catpvf(aTHX_ sv, "%.9"NVff, SvNVX(ver)); + len = SvCUR(sv); + buf = SvPVX(sv); + } + else { + len = my_snprintf(tbuf, sizeof(tbuf), "%.9"NVff, SvNVX(ver)); + buf = tbuf; + } + RESTORE_NUMERIC_LOCAL(); + } + while (buf[len-1] == '0' && len > 0) len--; + if ( buf[len-1] == '.' ) len--; /* eat the trailing decimal */ + version = savepvn(buf, len); + SAVEFREEPV(version); + SvREFCNT_dec(sv); + } +#ifdef SvVOK + else if ( (mg = SvVSTRING_mg(ver)) ) { /* already a v-string */ + version = savepvn( (const char*)mg->mg_ptr,mg->mg_len ); + SAVEFREEPV(version); + qv = TRUE; + } +#endif + else if ( SvPOK(ver))/* must be a string or something like a string */ +#if PERL_VERSION_LT(5,17,2) +VER_PV: +#endif + { + STRLEN len; + version = savepvn(SvPV(ver,len), SvCUR(ver)); + SAVEFREEPV(version); +#ifndef SvVOK +# if PERL_VERSION > 5 + /* This will only be executed for 5.6.0 - 5.8.0 inclusive */ + if ( len >= 3 && !instr(version,".") && !instr(version,"_")) { + /* may be a v-string */ + char *testv = (char *)version; + STRLEN tlen = len; + for (tlen=0; tlen < len; tlen++, testv++) { + /* if one of the characters is non-text assume v-string */ + if (testv[0] < ' ') { + SV * const nsv = sv_newmortal(); + const char *nver; + const char *pos; + int saw_decimal = 0; + sv_setpvf(nsv,"v%vd",ver); + pos = nver = savepv(SvPV_nolen(nsv)); + SAVEFREEPV(pos); + + /* scan the resulting formatted string */ + pos++; /* skip the leading 'v' */ + while ( *pos == '.' || isDIGIT(*pos) ) { + if ( *pos == '.' ) + saw_decimal++ ; + pos++; + } + + /* is definitely a v-string */ + if ( saw_decimal >= 2 ) { + version = nver; + } + break; + } + } + } +# endif +#endif + } +#if PERL_VERSION_LT(5,17,2) + else if (SvIOKp(ver)) { + goto VER_IV; + } + else if (SvNOKp(ver)) { + goto VER_NV; + } + else if (SvPOKp(ver)) { + goto VER_PV; + } +#endif + else + { + /* no idea what this is */ + Perl_croak(aTHX_ "Invalid version format (non-numeric data)"); + } + + s = SCAN_VERSION(version, ver, qv); + if ( *s != '\0' ) + Perl_ck_warner(aTHX_ packWARN(WARN_MISC), + "Version string '%s' contains invalid data; " + "ignoring: '%s'", version, s); + +#if PERL_VERSION_LT(5,19,8) && defined(USE_ITHREADS) + LEAVE; +#endif + + return ver; +} + +/* +=for apidoc vverify + +Validates that the SV contains valid internal structure for a version object. +It may be passed either the version object (RV) or the hash itself (HV). If +the structure is valid, it returns the HV. If the structure is invalid, +it returns NULL. + + SV *hv = vverify(sv); + +Note that it only confirms the bare minimum structure (so as not to get +confused by derived classes which may contain additional hash entries): + +=over 4 + +=item * The SV is an HV or a reference to an HV + +=item * The hash contains a "version" key + +=item * The "version" key has a reference to an AV as its value + +=back + +=cut +*/ + +SV * +#ifdef VUTIL_REPLACE_CORE +Perl_vverify2(pTHX_ SV *vs) +#else +Perl_vverify(pTHX_ SV *vs) +#endif +{ + SV *sv; + SV **svp; + + PERL_ARGS_ASSERT_VVERIFY; + + if ( SvROK(vs) ) + vs = SvRV(vs); + + /* see if the appropriate elements exist */ + if ( SvTYPE(vs) == SVt_PVHV + && (svp = hv_fetchs(MUTABLE_HV(vs), "version", FALSE)) + && (sv = SvRV(*svp)) + && SvTYPE(sv) == SVt_PVAV ) + return vs; + else + return NULL; +} + +/* +=for apidoc vnumify + +Accepts a version object and returns the normalized floating +point representation. Call like: + + sv = vnumify(rv); + +NOTE: you can pass either the object directly or the SV +contained within the RV. + +The SV returned has a refcount of 1. + +=cut +*/ + +SV * +#ifdef VUTIL_REPLACE_CORE +Perl_vnumify2(pTHX_ SV *vs) +#else +Perl_vnumify(pTHX_ SV *vs) +#endif +{ + SSize_t i, len; + I32 digit; + int width; + bool alpha = FALSE; + SV *sv; + AV *av; + + PERL_ARGS_ASSERT_VNUMIFY; + + /* extract the HV from the object */ + vs = VVERIFY(vs); + if ( ! vs ) + Perl_croak(aTHX_ "Invalid version object"); + + /* see if various flags exist */ + if ( hv_exists(MUTABLE_HV(vs), "alpha", 5 ) ) + alpha = TRUE; + { + SV ** svp = hv_fetchs(MUTABLE_HV(vs), "width", FALSE); + if ( svp ) + width = SvIV(*svp); + else + width = 3; + } + + + /* attempt to retrieve the version array */ + if ( !(av = MUTABLE_AV(SvRV(*hv_fetchs(MUTABLE_HV(vs), "version", FALSE))) ) ) { + return newSVpvs("0"); + } + + len = av_len(av); + if ( len == -1 ) + { + return newSVpvs("0"); + } + + { + SV * tsv = *av_fetch(av, 0, 0); + digit = SvIV(tsv); + } + sv = Perl_newSVpvf(aTHX_ "%d.", (int)PERL_ABS(digit)); + for ( i = 1 ; i < len ; i++ ) + { + SV * tsv = *av_fetch(av, i, 0); + digit = SvIV(tsv); + if ( width < 3 ) { + const int denom = (width == 2 ? 10 : 100); + const div_t term = div((int)PERL_ABS(digit),denom); + Perl_sv_catpvf(aTHX_ sv, "%0*d_%d", width, term.quot, term.rem); + } + else { + Perl_sv_catpvf(aTHX_ sv, "%0*d", width, (int)digit); + } + } + + if ( len > 0 ) + { + SV * tsv = *av_fetch(av, len, 0); + digit = SvIV(tsv); + if ( alpha && width == 3 ) /* alpha version */ + sv_catpvs(sv,"_"); + Perl_sv_catpvf(aTHX_ sv, "%0*d", width, (int)digit); + } + else /* len == 0 */ + { + sv_catpvs(sv, "000"); + } + return sv; +} + +/* +=for apidoc vnormal + +Accepts a version object and returns the normalized string +representation. Call like: + + sv = vnormal(rv); + +NOTE: you can pass either the object directly or the SV +contained within the RV. + +The SV returned has a refcount of 1. + +=cut +*/ + +SV * +#ifdef VUTIL_REPLACE_CORE +Perl_vnormal2(pTHX_ SV *vs) +#else +Perl_vnormal(pTHX_ SV *vs) +#endif +{ + I32 i, len, digit; + bool alpha = FALSE; + SV *sv; + AV *av; + + PERL_ARGS_ASSERT_VNORMAL; + + /* extract the HV from the object */ + vs = VVERIFY(vs); + if ( ! vs ) + Perl_croak(aTHX_ "Invalid version object"); + + if ( hv_exists(MUTABLE_HV(vs), "alpha", 5 ) ) + alpha = TRUE; + av = MUTABLE_AV(SvRV(*hv_fetchs(MUTABLE_HV(vs), "version", FALSE))); + + len = av_len(av); + if ( len == -1 ) + { + return newSVpvs(""); + } + { + SV * tsv = *av_fetch(av, 0, 0); + digit = SvIV(tsv); + } + sv = Perl_newSVpvf(aTHX_ "v%"IVdf, (IV)digit); + for ( i = 1 ; i < len ; i++ ) { + SV * tsv = *av_fetch(av, i, 0); + digit = SvIV(tsv); + Perl_sv_catpvf(aTHX_ sv, ".%"IVdf, (IV)digit); + } + + if ( len > 0 ) + { + /* handle last digit specially */ + SV * tsv = *av_fetch(av, len, 0); + digit = SvIV(tsv); + if ( alpha ) + Perl_sv_catpvf(aTHX_ sv, "_%"IVdf, (IV)digit); + else + Perl_sv_catpvf(aTHX_ sv, ".%"IVdf, (IV)digit); + } + + if ( len <= 2 ) { /* short version, must be at least three */ + for ( len = 2 - len; len != 0; len-- ) + sv_catpvs(sv,".0"); + } + return sv; +} + +/* +=for apidoc vstringify + +In order to maintain maximum compatibility with earlier versions +of Perl, this function will return either the floating point +notation or the multiple dotted notation, depending on whether +the original version contained 1 or more dots, respectively. + +The SV returned has a refcount of 1. + +=cut +*/ + +SV * +#ifdef VUTIL_REPLACE_CORE +Perl_vstringify2(pTHX_ SV *vs) +#else +Perl_vstringify(pTHX_ SV *vs) +#endif +{ + SV ** svp; + PERL_ARGS_ASSERT_VSTRINGIFY; + + /* extract the HV from the object */ + vs = VVERIFY(vs); + if ( ! vs ) + Perl_croak(aTHX_ "Invalid version object"); + + svp = hv_fetchs(MUTABLE_HV(vs), "original", FALSE); + if (svp) { + SV *pv; + pv = *svp; + if ( SvPOK(pv) ) + return newSVsv(pv); + else + return &PL_sv_undef; + } + else { + if ( hv_exists(MUTABLE_HV(vs), "qv", 2) ) + return VNORMAL(vs); + else + return VNUMIFY(vs); + } +} + +/* +=for apidoc vcmp + +Version object aware cmp. Both operands must already have been +converted into version objects. + +=cut +*/ + +int +#ifdef VUTIL_REPLACE_CORE +Perl_vcmp2(pTHX_ SV *lhv, SV *rhv) +#else +Perl_vcmp(pTHX_ SV *lhv, SV *rhv) +#endif +{ + SSize_t i,l,m,r; + I32 retval; + bool lalpha = FALSE; + bool ralpha = FALSE; + I32 left = 0; + I32 right = 0; + AV *lav, *rav; + + PERL_ARGS_ASSERT_VCMP; + + /* extract the HVs from the objects */ + lhv = VVERIFY(lhv); + rhv = VVERIFY(rhv); + if ( ! ( lhv && rhv ) ) + Perl_croak(aTHX_ "Invalid version object"); + + /* get the left hand term */ + lav = MUTABLE_AV(SvRV(*hv_fetchs(MUTABLE_HV(lhv), "version", FALSE))); + if ( hv_exists(MUTABLE_HV(lhv), "alpha", 5 ) ) + lalpha = TRUE; + + /* and the right hand term */ + rav = MUTABLE_AV(SvRV(*hv_fetchs(MUTABLE_HV(rhv), "version", FALSE))); + if ( hv_exists(MUTABLE_HV(rhv), "alpha", 5 ) ) + ralpha = TRUE; + + l = av_len(lav); + r = av_len(rav); + m = l < r ? l : r; + retval = 0; + i = 0; + while ( i <= m && retval == 0 ) + { + SV * const lsv = *av_fetch(lav,i,0); + SV * rsv; + left = SvIV(lsv); + rsv = *av_fetch(rav,i,0); + right = SvIV(rsv); + if ( left < right ) + retval = -1; + if ( left > right ) + retval = +1; + i++; + } + + /* tiebreaker for alpha with identical terms */ + if ( retval == 0 && l == r && left == right && ( lalpha || ralpha ) ) + { + if ( lalpha && !ralpha ) + { + retval = -1; + } + else if ( ralpha && !lalpha) + { + retval = +1; + } + } + + if ( l != r && retval == 0 ) /* possible match except for trailing 0's */ + { + if ( l < r ) + { + while ( i <= r && retval == 0 ) + { + SV * const rsv = *av_fetch(rav,i,0); + if ( SvIV(rsv) != 0 ) + retval = -1; /* not a match after all */ + i++; + } + } + else + { + while ( i <= l && retval == 0 ) + { + SV * const lsv = *av_fetch(lav,i,0); + if ( SvIV(lsv) != 0 ) + retval = +1; /* not a match after all */ + i++; + } + } + } + return retval; +} Index: gnu/usr.bin/perl/vutil.h =================================================================== RCS file: gnu/usr.bin/perl/vutil.h diff -N gnu/usr.bin/perl/vutil.h --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ gnu/usr.bin/perl/vutil.h 16 Nov 2014 03:22:24 -0000 @@ -0,0 +1,241 @@ +/* This file is part of the "version" CPAN distribution. Please avoid + editing it in the perl core. */ + +#ifndef PERL_CORE +# include "ppport.h" +#endif + +/* The MUTABLE_*() macros cast pointers to the types shown, in such a way + * (compiler permitting) that casting away const-ness will give a warning; + * e.g.: + * + * const SV *sv = ...; + * AV *av1 = (AV*)sv; <== BAD: the const has been silently cast away + * AV *av2 = MUTABLE_AV(sv); <== GOOD: it may warn + */ + +#ifndef MUTABLE_PTR +# if defined(__GNUC__) && !defined(PERL_GCC_BRACE_GROUPS_FORBIDDEN) +# define MUTABLE_PTR(p) ({ void *_p = (p); _p; }) +# else +# define MUTABLE_PTR(p) ((void *) (p)) +# endif + +# define MUTABLE_AV(p) ((AV *)MUTABLE_PTR(p)) +# define MUTABLE_CV(p) ((CV *)MUTABLE_PTR(p)) +# define MUTABLE_GV(p) ((GV *)MUTABLE_PTR(p)) +# define MUTABLE_HV(p) ((HV *)MUTABLE_PTR(p)) +# define MUTABLE_IO(p) ((IO *)MUTABLE_PTR(p)) +# define MUTABLE_SV(p) ((SV *)MUTABLE_PTR(p)) +#endif + +#ifndef SvPVx_nolen_const +# if defined(__GNUC__) && !defined(PERL_GCC_BRACE_GROUPS_FORBIDDEN) +# define SvPVx_nolen_const(sv) ({SV *_sv = (sv); SvPV_nolen_const(_sv); }) +# else +# define SvPVx_nolen_const(sv) (SvPV_nolen_const(sv)) +# endif +#endif + +#ifndef PERL_ARGS_ASSERT_CK_WARNER +static void Perl_ck_warner(pTHX_ U32 err, const char* pat, ...); + +# ifdef vwarner +static +void +Perl_ck_warner(pTHX_ U32 err, const char* pat, ...) +{ + va_list args; + + PERL_UNUSED_ARG(err); + if (ckWARN(err)) { + va_list args; + va_start(args, pat); + vwarner(err, pat, &args); + va_end(args); + } +} +# else +/* yes this replicates my_warner */ +static +void +Perl_ck_warner(pTHX_ U32 err, const char* pat, ...) +{ + SV *sv; + va_list args; + + PERL_UNUSED_ARG(err); + + va_start(args, pat); + sv = vnewSVpvf(pat, &args); + va_end(args); + sv_2mortal(sv); + warn("%s", SvPV_nolen(sv)); +} +# endif +#endif + +#define PERL_VERSION_DECIMAL(r,v,s) (r*1000000 + v*1000 + s) +#define PERL_DECIMAL_VERSION \ + PERL_VERSION_DECIMAL(PERL_REVISION,PERL_VERSION,PERL_SUBVERSION) +#define PERL_VERSION_LT(r,v,s) \ + (PERL_DECIMAL_VERSION < PERL_VERSION_DECIMAL(r,v,s)) +#define PERL_VERSION_GE(r,v,s) \ + (PERL_DECIMAL_VERSION >= PERL_VERSION_DECIMAL(r,v,s)) + +#if PERL_VERSION_LT(5,15,4) +# define ISA_VERSION_OBJ(v) (sv_isobject(v) && sv_derived_from(v,"version")) +#else +# define ISA_VERSION_OBJ(v) (sv_isobject(v) && sv_derived_from_pvn(v,"version",7,0)) +#endif + + +#ifndef PERL_ARGS_ASSERT_CROAK_XS_USAGE +#define PERL_ARGS_ASSERT_CROAK_XS_USAGE assert(cv); assert(params) + +/* prototype to pass -Wmissing-prototypes */ +STATIC void +S_croak_xs_usage(pTHX_ const CV *const cv, const char *const params); + +STATIC void +S_croak_xs_usage(pTHX_ const CV *const cv, const char *const params) +{ + const GV *const gv = CvGV(cv); + + PERL_ARGS_ASSERT_CROAK_XS_USAGE; + + if (gv) { + const char *const gvname = GvNAME(gv); + const HV *const stash = GvSTASH(gv); + const char *const hvname = stash ? HvNAME(stash) : NULL; + + if (hvname) + Perl_croak_nocontext("Usage: %s::%s(%s)", hvname, gvname, params); + else + Perl_croak_nocontext("Usage: %s(%s)", gvname, params); + } else { + /* Pants. I don't think that it should be possible to get here. */ + Perl_croak_nocontext("Usage: CODE(0x%"UVxf")(%s)", PTR2UV(cv), params); + } +} + +#ifdef PERL_IMPLICIT_CONTEXT +#define croak_xs_usage(a,b) S_croak_xs_usage(aTHX_ a,b) +#else +#define croak_xs_usage S_croak_xs_usage +#endif + +#endif + +#if PERL_VERSION_GE(5,9,0) && !defined(PERL_CORE) + +# define VUTIL_REPLACE_CORE 1 + +const char * Perl_scan_version2(pTHX_ const char *s, SV *rv, bool qv); +SV * Perl_new_version2(pTHX_ SV *ver); +SV * Perl_upg_version2(pTHX_ SV *sv, bool qv); +SV * Perl_vstringify2(pTHX_ SV *vs); +SV * Perl_vverify2(pTHX_ SV *vs); +SV * Perl_vnumify2(pTHX_ SV *vs); +SV * Perl_vnormal2(pTHX_ SV *vs); +SV * Perl_vstringify2(pTHX_ SV *vs); +int Perl_vcmp2(pTHX_ SV *lsv, SV *rsv); +const char * Perl_prescan_version2(pTHX_ const char *s, bool strict, const char** errstr, bool *sqv, int *ssaw_decimal, int *swidth, bool *salpha); + +# define SCAN_VERSION(a,b,c) Perl_scan_version2(aTHX_ a,b,c) +# define NEW_VERSION(a) Perl_new_version2(aTHX_ a) +# define UPG_VERSION(a,b) Perl_upg_version2(aTHX_ a, b) +# define VSTRINGIFY(a) Perl_vstringify2(aTHX_ a) +# define VVERIFY(a) Perl_vverify2(aTHX_ a) +# define VNUMIFY(a) Perl_vnumify2(aTHX_ a) +# define VNORMAL(a) Perl_vnormal2(aTHX_ a) +# define VCMP(a,b) Perl_vcmp2(aTHX_ a,b) +# define PRESCAN_VERSION(a,b,c,d,e,f,g) Perl_prescan_version2(aTHX_ a,b,c,d,e,f,g) +# undef is_LAX_VERSION +# define is_LAX_VERSION(a,b) \ + (a != Perl_prescan_version2(aTHX_ a, FALSE, b, NULL, NULL, NULL, NULL)) +# undef is_STRICT_VERSION +# define is_STRICT_VERSION(a,b) \ + (a != Perl_prescan_version2(aTHX_ a, TRUE, b, NULL, NULL, NULL, NULL)) + +#else + +const char * Perl_scan_version(pTHX_ const char *s, SV *rv, bool qv); +SV * Perl_new_version(pTHX_ SV *ver); +SV * Perl_upg_version(pTHX_ SV *sv, bool qv); +SV * Perl_vverify(pTHX_ SV *vs); +SV * Perl_vnumify(pTHX_ SV *vs); +SV * Perl_vnormal(pTHX_ SV *vs); +SV * Perl_vstringify(pTHX_ SV *vs); +int Perl_vcmp(pTHX_ SV *lsv, SV *rsv); +const char * Perl_prescan_version(pTHX_ const char *s, bool strict, const char** errstr, bool *sqv, int *ssaw_decimal, int *swidth, bool *salpha); + +# define SCAN_VERSION(a,b,c) Perl_scan_version(aTHX_ a,b,c) +# define NEW_VERSION(a) Perl_new_version(aTHX_ a) +# define UPG_VERSION(a,b) Perl_upg_version(aTHX_ a, b) +# define VSTRINGIFY(a) Perl_vstringify(aTHX_ a) +# define VVERIFY(a) Perl_vverify(aTHX_ a) +# define VNUMIFY(a) Perl_vnumify(aTHX_ a) +# define VNORMAL(a) Perl_vnormal(aTHX_ a) +# define VCMP(a,b) Perl_vcmp(aTHX_ a,b) + +# define PRESCAN_VERSION(a,b,c,d,e,f,g) Perl_prescan_version(aTHX_ a,b,c,d,e,f,g) +# ifndef is_LAX_VERSION +# define is_LAX_VERSION(a,b) \ + (a != Perl_prescan_version(aTHX_ a, FALSE, b, NULL, NULL, NULL, NULL)) +# endif +# ifndef is_STRICT_VERSION +# define is_STRICT_VERSION(a,b) \ + (a != Perl_prescan_version(aTHX_ a, TRUE, b, NULL, NULL, NULL, NULL)) +# endif + +#endif + +#if PERL_VERSION_LT(5,11,4) +# define BADVERSION(a,b,c) \ + if (b) { \ + *b = c; \ + } \ + return a; + +# define PERL_ARGS_ASSERT_PRESCAN_VERSION \ + assert(s); assert(sqv); assert(ssaw_decimal);\ + assert(swidth); assert(salpha); + +# define PERL_ARGS_ASSERT_SCAN_VERSION \ + assert(s); assert(rv) +# define PERL_ARGS_ASSERT_NEW_VERSION \ + assert(ver) +# define PERL_ARGS_ASSERT_UPG_VERSION \ + assert(ver) +# define PERL_ARGS_ASSERT_VVERIFY \ + assert(vs) +# define PERL_ARGS_ASSERT_VNUMIFY \ + assert(vs) +# define PERL_ARGS_ASSERT_VNORMAL \ + assert(vs) +# define PERL_ARGS_ASSERT_VSTRINGIFY \ + assert(vs) +# define PERL_ARGS_ASSERT_VCMP \ + assert(lhv); assert(rhv) +# define PERL_ARGS_ASSERT_CK_WARNER \ + assert(pat) +#endif + + +#if PERL_VERSION_LT(5,19,0) +# undef STORE_NUMERIC_LOCAL_SET_STANDARD +# undef RESTORE_NUMERIC_LOCAL +# ifdef USE_LOCALE +# define STORE_NUMERIC_LOCAL_SET_STANDARD()\ + char *loc = savepv(setlocale(LC_NUMERIC, NULL)); \ + SAVEFREEPV(loc); \ + setlocale(LC_NUMERIC, "C"); + +# define RESTORE_NUMERIC_LOCAL()\ + setlocale(LC_NUMERIC, loc); +# else +# define STORE_NUMERIC_LOCAL_SET_STANDARD() +# define RESTORE_NUMERIC_LOCAL() +# endif +#endif Index: gnu/usr.bin/perl/vxs.inc =================================================================== RCS file: gnu/usr.bin/perl/vxs.inc diff -N gnu/usr.bin/perl/vxs.inc --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ gnu/usr.bin/perl/vxs.inc 16 Nov 2014 03:22:24 -0000 @@ -0,0 +1,471 @@ +/* This file is part of the "version" CPAN distribution. Please avoid + editing it in the perl core. */ + +#ifdef PERL_CORE +# define VXS_CLASS "version" +# define VXSp(name) XS_##name +/* VXSXSDP = XSUB Details Proto */ +# define VXSXSDP(x) x +#else +# define VXS_CLASS "version::vxs" +# define VXSp(name) VXS_##name +/* proto member is unused in version, it is used in CORE by non version xsubs */ +# define VXSXSDP(x) +#endif +#define VXS(name) XS(VXSp(name)); XS(VXSp(name)) + +/* uses PUSHs, so SP must be at start, PUSHs sv on Perl stack, then returns from + xsub; this is a little more machine code/tailcall friendly than mPUSHs(foo); + PUTBACK; return; */ + +#define VXS_RETURN_M_SV(sv) \ + STMT_START { \ + SV * sv_vtc = sv; \ + PUSHs(sv_vtc); \ + PUTBACK; \ + sv_2mortal(sv_vtc); \ + return; \ + } STMT_END + + +#ifdef VXS_XSUB_DETAILS +# ifdef PERL_CORE + {"UNIVERSAL::VERSION", VXSp(universal_version), VXSXSDP(NULL)}, +# endif + {VXS_CLASS "::_VERSION", VXSp(universal_version), VXSXSDP(NULL)}, + {VXS_CLASS "::()", VXSp(version_noop), VXSXSDP(NULL)}, + {VXS_CLASS "::new", VXSp(version_new), VXSXSDP(NULL)}, + {VXS_CLASS "::parse", VXSp(version_new), VXSXSDP(NULL)}, + {VXS_CLASS "::(\"\"", VXSp(version_stringify), VXSXSDP(NULL)}, + {VXS_CLASS "::stringify", VXSp(version_stringify), VXSXSDP(NULL)}, + {VXS_CLASS "::(0+", VXSp(version_numify), VXSXSDP(NULL)}, + {VXS_CLASS "::numify", VXSp(version_numify), VXSXSDP(NULL)}, + {VXS_CLASS "::normal", VXSp(version_normal), VXSXSDP(NULL)}, + {VXS_CLASS "::(cmp", VXSp(version_vcmp), VXSXSDP(NULL)}, + {VXS_CLASS "::(<=>", VXSp(version_vcmp), VXSXSDP(NULL)}, +# ifdef PERL_CORE + {VXS_CLASS "::vcmp", XS_version_vcmp, VXSXSDP(NULL)}, +# else + {VXS_CLASS "::VCMP", VXS_version_vcmp, VXSXSDP(NULL)}, +# endif + {VXS_CLASS "::(bool", VXSp(version_boolean), VXSXSDP(NULL)}, + {VXS_CLASS "::boolean", VXSp(version_boolean), VXSXSDP(NULL)}, + {VXS_CLASS "::(+", VXSp(version_noop), VXSXSDP(NULL)}, + {VXS_CLASS "::(-", VXSp(version_noop), VXSXSDP(NULL)}, + {VXS_CLASS "::(*", VXSp(version_noop), VXSXSDP(NULL)}, + {VXS_CLASS "::(/", VXSp(version_noop), VXSXSDP(NULL)}, + {VXS_CLASS "::(+=", VXSp(version_noop), VXSXSDP(NULL)}, + {VXS_CLASS "::(-=", VXSp(version_noop), VXSXSDP(NULL)}, + {VXS_CLASS "::(*=", VXSp(version_noop), VXSXSDP(NULL)}, + {VXS_CLASS "::(/=", VXSp(version_noop), VXSXSDP(NULL)}, + {VXS_CLASS "::(abs", VXSp(version_noop), VXSXSDP(NULL)}, + {VXS_CLASS "::(nomethod", VXSp(version_noop), VXSXSDP(NULL)}, + {VXS_CLASS "::noop", VXSp(version_noop), VXSXSDP(NULL)}, + {VXS_CLASS "::is_alpha", VXSp(version_is_alpha), VXSXSDP(NULL)}, + {VXS_CLASS "::qv", VXSp(version_qv), VXSXSDP(NULL)}, + {VXS_CLASS "::declare", VXSp(version_qv), VXSXSDP(NULL)}, + {VXS_CLASS "::is_qv", VXSp(version_is_qv), VXSXSDP(NULL)}, +#else + +#ifndef dVAR +# define dVAR +#endif + +#ifdef HvNAME_HEK +typedef HEK HVNAME; +# ifndef HEKf +# define HEKfARG(arg) ((void*)(sv_2mortal(newSVhek(arg)))) +# define HEKf SVf +# endif +#else +typedef char HVNAME; +# define HvNAME_HEK HvNAME_get +# define HEKfARG(arg) arg +# define HEKf "s" +#endif + +VXS(universal_version) +{ + dVAR; + dXSARGS; + HV *pkg; + GV **gvp; + GV *gv; + SV *sv; + const char *undef; + PERL_UNUSED_ARG(cv); + + if (items < 1) + Perl_croak(aTHX_ "Usage: UNIVERSAL::VERSION(sv, ...)"); + + sv = ST(0); + + if (SvROK(sv)) { + sv = (SV*)SvRV(sv); + if (!SvOBJECT(sv)) + Perl_croak(aTHX_ "Cannot find version of an unblessed reference"); + pkg = SvSTASH(sv); + } + else { + pkg = gv_stashsv(sv, FALSE); + } + + gvp = pkg ? (GV**)hv_fetchs(pkg,"VERSION",FALSE) : (GV**)NULL; + + if (gvp && isGV(gv = *gvp) && (sv = GvSV(gv)) && SvOK(sv)) { + sv = sv_mortalcopy(sv); + if ( ! ISA_VERSION_OBJ(sv) ) + UPG_VERSION(sv, FALSE); + undef = NULL; + } + else { + sv = &PL_sv_undef; + undef = "(undef)"; + } + + if (items > 1) { + SV *req = ST(1); + + if (undef) { + if (pkg) { + const HVNAME* const name = HvNAME_HEK(pkg); +#if PERL_VERSION == 5 + Perl_croak(aTHX_ "%s version %s required--this is only version ", + name, SvPVx_nolen_const(req)); +#else + Perl_croak(aTHX_ + "%"HEKf" does not define $%"HEKf + "::VERSION--version check failed", + HEKfARG(name), HEKfARG(name)); +#endif + } + else { +#if PERL_VERSION >= 8 + Perl_croak(aTHX_ + "%"SVf" defines neither package nor VERSION--version check failed", + (void*)(ST(0)) ); +#else + Perl_croak(aTHX_ "%s does not define $%s::VERSION--version check failed", + SvPVx_nolen_const(ST(0)), + SvPVx_nolen_const(ST(0)) ); +#endif + } + } + + if ( ! ISA_VERSION_OBJ(req) ) { + /* req may very well be R/O, so create a new object */ + req = sv_2mortal( NEW_VERSION(req) ); + } + + if ( VCMP( req, sv ) > 0 ) { + if ( hv_exists(MUTABLE_HV(SvRV(req)), "qv", 2 ) ) { + req = VNORMAL(req); + sv = VNORMAL(sv); + } + else { + req = VSTRINGIFY(req); + sv = VSTRINGIFY(sv); + } + Perl_croak(aTHX_ "%"HEKf" version %"SVf" required--" + "this is only version %"SVf"", HEKfARG(HvNAME_HEK(pkg)), + SVfARG(sv_2mortal(req)), + SVfARG(sv_2mortal(sv))); + } + } + + /* if the package's $VERSION is not undef, it is upgraded to be a version object */ + if (ISA_VERSION_OBJ(sv)) { + ST(0) = sv_2mortal(VSTRINGIFY(sv)); + } else { + ST(0) = sv; + } + + XSRETURN(1); +} + +VXS(version_new) +{ + dVAR; + dXSARGS; + SV *vs; + SV *rv; + const char * classname = ""; + STRLEN len; + U32 flags = 0; + SV * svarg0 = NULL; + PERL_UNUSED_VAR(cv); + + SP -= items; + + switch((U32)items) { + case 3: { + SV * svarg2; + vs = sv_newmortal(); + svarg2 = ST(2); +#if PERL_VERSION == 5 + sv_setpvf(vs,"v%s",SvPV_nolen_const(svarg2)); +#else + Perl_sv_setpvf(aTHX_ vs,"v%s",SvPV_nolen_const(svarg2)); +#endif + break; + } + case 2: + vs = ST(1); + /* Just in case this is something like a tied hash */ + SvGETMAGIC(vs); + if(SvOK(vs)) + break; + /* drop through */ + case 1: + /* no param or explicit undef */ + /* create empty object */ + vs = sv_newmortal(); + sv_setpvs(vs,"undef"); + break; + default: + case 0: + Perl_croak_nocontext("Usage: version::new(class, version)"); + break; + } + + svarg0 = ST(0); + if ( sv_isobject(svarg0) ) { + /* get the class if called as an object method */ + const HV * stash = SvSTASH(SvRV(svarg0)); + classname = HvNAME_get(stash); + len = HvNAMELEN_get(stash); +#ifdef HvNAMEUTF8 + flags = HvNAMEUTF8(stash) ? SVf_UTF8 : 0; +#endif + } + else { + classname = SvPV_nomg(svarg0, len); + flags = SvUTF8(svarg0); + } + + rv = NEW_VERSION(vs); + if ( len != sizeof(VXS_CLASS)-1 + || strcmp(classname,VXS_CLASS) != 0 ) /* inherited new() */ +#if PERL_VERSION == 5 + sv_bless(rv, gv_stashpv((char *)classname, GV_ADD)); +#else + sv_bless(rv, gv_stashpvn(classname, len, GV_ADD | flags)); +#endif + + VXS_RETURN_M_SV(rv); +} + +#define VTYPECHECK(var, val, varname) \ + STMT_START { \ + SV * sv_vtc = val; \ + if (ISA_VERSION_OBJ(sv_vtc)) { \ + (var) = SvRV(sv_vtc); \ + } \ + else \ + Perl_croak_nocontext(varname " is not of type version"); \ + } STMT_END + +VXS(version_stringify) +{ + dVAR; + dXSARGS; + if (items < 1) + croak_xs_usage(cv, "lobj, ..."); + SP -= items; + { + SV * lobj; + VTYPECHECK(lobj, ST(0), "lobj"); + + VXS_RETURN_M_SV(VSTRINGIFY(lobj)); + } +} + +VXS(version_numify) +{ + dVAR; + dXSARGS; + if (items < 1) + croak_xs_usage(cv, "lobj, ..."); + SP -= items; + { + SV * lobj; + VTYPECHECK(lobj, ST(0), "lobj"); + VXS_RETURN_M_SV(VNUMIFY(lobj)); + } +} + +VXS(version_normal) +{ + dVAR; + dXSARGS; + if (items != 1) + croak_xs_usage(cv, "ver"); + SP -= items; + { + SV * ver; + VTYPECHECK(ver, ST(0), "ver"); + + VXS_RETURN_M_SV(VNORMAL(ver)); + } +} + +VXS(version_vcmp) +{ + dVAR; + dXSARGS; + if (items < 1) + croak_xs_usage(cv, "lobj, ..."); + SP -= items; + { + SV * lobj; + VTYPECHECK(lobj, ST(0), "lobj"); + { + SV *rs; + SV *rvs; + SV * robj = ST(1); + const IV swap = (IV)SvIV(ST(2)); + + if ( !ISA_VERSION_OBJ(robj) ) + { + robj = sv_2mortal(NEW_VERSION(SvOK(robj) ? robj : newSVpvs_flags("0", SVs_TEMP))); + } + rvs = SvRV(robj); + + if ( swap ) + { + rs = newSViv(VCMP(rvs,lobj)); + } + else + { + rs = newSViv(VCMP(lobj,rvs)); + } + + VXS_RETURN_M_SV(rs); + } + } +} + +VXS(version_boolean) +{ + dVAR; + dXSARGS; + SV *lobj; + if (items < 1) + croak_xs_usage(cv, "lobj, ..."); + SP -= items; + VTYPECHECK(lobj, ST(0), "lobj"); + { + SV * const rs = + newSViv( VCMP(lobj, + sv_2mortal(NEW_VERSION( + sv_2mortal(newSVpvs("0")) + )) + ) + ); + VXS_RETURN_M_SV(rs); + } +} + +VXS(version_noop) +{ + dVAR; + dXSARGS; + if (items < 1) + croak_xs_usage(cv, "lobj, ..."); + if (ISA_VERSION_OBJ(ST(0))) + Perl_croak(aTHX_ "operation not supported with version object"); + else + Perl_croak(aTHX_ "lobj is not of type version"); + XSRETURN_EMPTY; +} + +static +void +S_version_check_key(pTHX_ CV * cv, const char * key, int keylen) +{ + dVAR; + dXSARGS; + if (items != 1) + croak_xs_usage(cv, "lobj"); + { + SV *lobj = POPs; + SV *ret; + VTYPECHECK(lobj, lobj, "lobj"); + if ( hv_exists(MUTABLE_HV(lobj), key, keylen ) ) + ret = &PL_sv_yes; + else + ret = &PL_sv_no; + PUSHs(ret); + PUTBACK; + return; + } +} + +VXS(version_is_alpha) +{ + S_version_check_key(aTHX_ cv, "alpha", 5); +} + +VXS(version_qv) +{ + dVAR; + dXSARGS; + PERL_UNUSED_ARG(cv); + SP -= items; + { + SV * ver = ST(0); + SV * sv0 = ver; + SV * rv; + STRLEN len = 0; + const char * classname = ""; + U32 flags = 0; + if ( items == 2 ) { + SV * sv1 = ST(1); + SvGETMAGIC(sv1); + if (SvOK(sv1)) { + ver = sv1; + } + else { + Perl_croak(aTHX_ "Invalid version format (version required)"); + } + if ( sv_isobject(sv0) ) { /* class called as an object method */ + const HV * stash = SvSTASH(SvRV(sv0)); + classname = HvNAME_get(stash); + len = HvNAMELEN_get(stash); +#ifdef HvNAMEUTF8 + flags = HvNAMEUTF8(stash) ? SVf_UTF8 : 0; +#endif + } + else { + classname = SvPV(sv0, len); + flags = SvUTF8(sv0); + } + } + if ( !SvVOK(ver) ) { /* not already a v-string */ + rv = sv_newmortal(); + SvSetSV_nosteal(rv,ver); /* make a duplicate */ + UPG_VERSION(rv, TRUE); + } else { + rv = sv_2mortal(NEW_VERSION(ver)); + } + if ( items == 2 && (len != 7 + || strcmp(classname,"version")) ) { /* inherited new() */ +#if PERL_VERSION == 5 + sv_bless(rv, gv_stashpv((char *)classname, GV_ADD)); +#else + sv_bless(rv, gv_stashpvn(classname, len, GV_ADD | flags)); +#endif + } + PUSHs(rv); + } + PUTBACK; + return; +} + + +VXS(version_is_qv) +{ + S_version_check_key(aTHX_ cv, "qv", 2); +} + +#endif Index: gnu/usr.bin/perl/warnings.h =================================================================== RCS file: /mnt/memory/perl/importit/cvs/src/gnu/usr.bin/perl/warnings.h,v retrieving revision 1.1.1.8 diff -u -p -u -p -r1.1.1.8 warnings.h --- gnu/usr.bin/perl/warnings.h 24 Mar 2014 14:58:48 -0000 1.1.1.8 +++ gnu/usr.bin/perl/warnings.h 16 Nov 2014 03:22:24 -0000 @@ -95,9 +95,16 @@ #define WARN_EXPERIMENTAL__REGEX_SETS 54 #define WARN_EXPERIMENTAL__SMARTMATCH 55 -#define WARNsize 14 -#define WARN_ALLstring "\125\125\125\125\125\125\125\125\125\125\125\125\125\125" -#define WARN_NONEstring "\0\0\0\0\0\0\0\0\0\0\0\0\0\0" +/* Warnings Categories added in Perl 5.019 */ + +#define WARN_EXPERIMENTAL__AUTODEREF 56 +#define WARN_EXPERIMENTAL__POSTDEREF 57 +#define WARN_EXPERIMENTAL__SIGNATURES 58 +#define WARN_SYSCALLS 59 + +#define WARNsize 15 +#define WARN_ALLstring "\125\125\125\125\125\125\125\125\125\125\125\125\125\125\125" +#define WARN_NONEstring "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" #define isLEXWARN_on (PL_curcop->cop_warnings != pWARN_STD) #define isLEXWARN_off (PL_curcop->cop_warnings == pWARN_STD) @@ -111,6 +118,10 @@ char)) #define ckWARN(w) Perl_ckwarn(aTHX_ packWARN(w)) + +/* The w1, w2 ... should be independent warnings categories; one shouldn't be + * a subcategory of any other */ + #define ckWARN2(w1,w2) Perl_ckwarn(aTHX_ packWARN2(w1,w2)) #define ckWARN3(w1,w2,w3) Perl_ckwarn(aTHX_ packWARN3(w1,w2,w3)) #define ckWARN4(w1,w2,w3,w4) Perl_ckwarn(aTHX_ packWARN4(w1,w2,w3,w4)) @@ -123,6 +134,10 @@ #define WARNshift 8 #define packWARN(a) (a ) + +/* The a, b, ... should be independent warnings categories; one shouldn't be + * a subcategory of any other */ + #define packWARN2(a,b) ((a) | ((b)<<8) ) #define packWARN3(a,b,c) ((a) | ((b)<<8) | ((c)<<16) ) #define packWARN4(a,b,c,d) ((a) | ((b)<<8) | ((c)<<16) | ((d) <<24)) Index: gnu/usr.bin/perl/write_buildcustomize.pl =================================================================== RCS file: /mnt/memory/perl/importit/cvs/src/gnu/usr.bin/perl/write_buildcustomize.pl,v retrieving revision 1.1.1.1 diff -u -p -u -p -r1.1.1.1 write_buildcustomize.pl --- gnu/usr.bin/perl/write_buildcustomize.pl 25 Mar 2013 20:06:43 -0000 1.1.1.1 +++ gnu/usr.bin/perl/write_buildcustomize.pl 16 Nov 2014 03:22:24 -0000 @@ -1,14 +1,20 @@ #!./miniperl -w use strict; -if (@ARGV) { + +my $osname = $^O; +my $file = 'lib/buildcustomize.pl'; + +if ( @ARGV % 2 ) { my $dir = shift; chdir $dir or die "Can't chdir '$dir': $!"; unshift @INC, 'lib'; } -unshift @INC, ('dist/Cwd', 'dist/Cwd/lib'); -require File::Spec::Functions; +if ( @ARGV ) { + # Used during cross-compilation. + $osname = $ARGV[1]; +} # To clarify, this isn't the entire suite of modules considered "toolchain" # It's not even all modules needed to build ext/ @@ -21,7 +27,7 @@ require File::Spec::Functions; my @toolchain = qw(cpan/AutoLoader/lib dist/Carp/lib - dist/Cwd dist/Cwd/lib + dist/PathTools dist/PathTools/lib dist/ExtUtils-Command/lib dist/ExtUtils-Install/lib cpan/ExtUtils-MakeMaker/lib @@ -29,27 +35,74 @@ my @toolchain = qw(cpan/AutoLoader/lib cpan/File-Path/lib ext/re dist/Term-ReadLine/lib + dist/Exporter/lib + ext/File-Find/lib + cpan/Text-Tabs/lib + dist/constant/lib ); # Used only in ExtUtils::Liblist::Kid::_win32_ext() push @toolchain, 'cpan/Text-ParseWords/lib' if $^O eq 'MSWin32'; +push @toolchain, 'ext/VMS-Filespec/lib' if $^O eq 'VMS'; -# lib must be last, as the the toolchain modules write themselves into it +unshift @INC, @toolchain; +require File::Spec::Functions; + +# lib must be last, as the toolchain modules write themselves into it # as they build, and it's important that @INC order ensures that the partially # written files are always masked by the complete versions. my $inc = join ",\n ", map { "q\0$_\0" } - (map {File::Spec::Functions::rel2abs($_)} @toolchain, 'lib'), '.'; + (map {File::Spec::Functions::rel2abs($_)} ( +# faster build on the non-parallel Win32 build process + $^O eq 'MSWin32' ? ('lib', @toolchain ) : (@toolchain, 'lib') + )); + +open my $fh, '>', $file + or die "Can't open $file: $!"; + +my $error; # If any of the system's build tools are written in Perl, then this module # may well be loaded by a much older version than we are building. So keep it # as backwards compatible as is easy. -print <<"EOT"; +print $fh <<"EOT" or $error = "Can't print to $file: $!"; #!perl +# !!!!!!! DO NOT EDIT THIS FILE !!!!!!! +# This file is generated by write_buildcustomize.pl. +# Any changes made here will be lost! + # We are miniperl, building extensions -# Reset \@INC completely, adding the directories we need, and removing the -# installed directories (which we don't need to read, and may confuse us) -\@INC = ($inc); +# Replace the first entry of \@INC ("lib") with the list of +# directories we need. +${\($^O eq 'MSWin32' ? '${^WIN32_SLOPPY_STAT} = 1;':'')} +splice(\@INC, 0, 1, $inc); +\$^O = '$osname'; EOT + +if ($error) { + close $fh + or warn "Can't unlink $file after error: $!"; +} else { + if (close $fh) { + do $file and exit; + $error = "Can't load generated $file: $@"; + } else { + $error = "Can't close $file: $!"; + } +} + +# It's going very wrong, so try to remove the botched file. + +unlink $file + or warn "Can't unlink $file after error: $!"; +die $error; + +# Local variables: +# cperl-indent-level: 4 +# indent-tabs-mode: nil +# End: +# +# ex: set ts=8 sts=4 sw=4 et: Index: gnu/usr.bin/perl/Cross/Makefile-cross-SH =================================================================== RCS file: /mnt/memory/perl/importit/cvs/src/gnu/usr.bin/perl/Cross/Makefile-cross-SH,v retrieving revision 1.1.1.5 diff -u -p -u -p -r1.1.1.5 Makefile-cross-SH --- gnu/usr.bin/perl/Cross/Makefile-cross-SH 24 Mar 2014 14:58:59 -0000 1.1.1.5 +++ gnu/usr.bin/perl/Cross/Makefile-cross-SH 16 Nov 2014 03:22:23 -0000 @@ -67,7 +67,7 @@ true) sunos*) linklibperl="-lperl" ;; - netbsd*|freebsd[234]*|openbsd*|dragonfly*) + netbsd*|freebsd[234]*|openbsd*|dragonfly*|bitrig*) linklibperl="-L. -lperl" ;; interix*) @@ -957,7 +957,6 @@ _mopup: -@test -f vms/README_vms.pod && rm -f vms/README_vms.pod -rm -f perl.exp ext.libs extra.pods uni.data opmini.o -rm -f perl.export perl.dll perl.libexp perl.map perl.def - -rm -f perl.loadmap miniperl.loadmap perl.prelmap miniperl.prelmap -rm -f perl.third lib*.so.perl.third perl.3log t/perl.third t/perl.3log -rm -f perl.pixie lib*.so.perl.pixie lib*.so.Addrs -rm -f perl.Addrs perl.Counts t/perl.Addrs t/perl.Counts *perl.xok @@ -1281,12 +1280,6 @@ ctags: !NO!SUBS! $eunicefix $Makefile -case `pwd` in -*SH) - $rm -f ../$Makefile - $ln $Makefile ../$Makefile - ;; -esac $rm -f $firstmakefile # Now do any special processing required before building. Index: gnu/usr.bin/perl/Cross/config.sh-arm-linux =================================================================== RCS file: /mnt/memory/perl/importit/cvs/src/gnu/usr.bin/perl/Cross/config.sh-arm-linux,v retrieving revision 1.1.1.10 diff -u -p -u -p -r1.1.1.10 config.sh-arm-linux --- gnu/usr.bin/perl/Cross/config.sh-arm-linux 24 Mar 2014 14:58:59 -0000 1.1.1.10 +++ gnu/usr.bin/perl/Cross/config.sh-arm-linux 16 Nov 2014 03:22:23 -0000 @@ -33,11 +33,11 @@ ansi2knr='' aphostname='/bin/hostname' api_revision='5' api_subversion='0' -api_version='18' -api_versionstring='5.18.0' +api_version='20' +api_versionstring='5.20.1' ar='ar' -archlib='/usr/lib/perl5/5.18.2/armv4l-linux' -archlibexp='/usr/lib/perl5/5.18.2/armv4l-linux' +archlib='/usr/lib/perl5/5.20.1/armv4l-linux' +archlibexp='/usr/lib/perl5/5.20.1/armv4l-linux' archname64='' archname='armv4l-linux' archobjs='' @@ -56,7 +56,7 @@ castflags='0' cat='cat' cc='cc' cccdlflags='-fpic' -ccdlflags='-rdynamic -Wl,-rpath,/usr/lib/perl5/5.18.2/armv4l-linux/CORE' +ccdlflags='-rdynamic -Wl,-rpath,/usr/lib/perl5/5.20.1/armv4l-linux/CORE' ccflags='-fno-strict-aliasing -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64' ccflags_uselargefiles='-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64' ccname='arm-linux-gcc' @@ -296,6 +296,7 @@ d_isinf='define' d_isnan='define' d_isnanl='define' d_killpg='define' +d_lc_monetary_2008='undef' d_lchown='define' d_ldbl_dig='define' d_libm_lib_version='define' @@ -439,7 +440,6 @@ d_setsent='define' d_setservent_r='undef' d_setsid='define' d_setvbuf='define' -d_sfio='undef' d_shm='define' d_shmat='define' d_shmatprototype='define' @@ -551,12 +551,11 @@ db_prefixtype='size_t' db_version_major='' db_version_minor='' db_version_patch='' -defvoidused='15' direntrytype='struct dirent' dlext='so' dlsrc='dl_dlopen.xs' doublesize='8' -drand01='drand48()' +drand01='Perl_drand48()' drand48_r_proto='0' dtrace='' dynamic_ext='B ByteLoader Cwd Data/Dumper Devel/DProf Devel/PPPort Devel/Peek Digest/MD5 Encode Fcntl File/Glob Filter/Util/Call I18N/Langinfo IO IPC/SysV List/Util MIME/Base64 Opcode POSIX PerlIO/encoding PerlIO/scalar PerlIO/via SDBM_File Socket Storable Sys/Hostname Sys/Syslog Time/HiRes Unicode/Collate Unicode/Normalize XS/APItest XS/Typemap attributes re threads threads/shared' @@ -646,7 +645,6 @@ i_crypt='define' i_db='undef' i_dbm='undef' i_dirent='define' -i_dld='undef' i_dlfcn='define' i_fcntl='undef' i_float='define' @@ -678,7 +676,6 @@ i_prot='undef' i_pthread='define' i_pwd='define' i_rpcsvcdbm='undef' -i_sfio='undef' i_sgtty='undef' i_shadow='define' i_socks='undef' @@ -732,7 +729,7 @@ inc_version_list=' ' inc_version_list_init='0' incpath='' inews='' -installarchlib='./install_me_here/usr/lib/perl5/5.18.2/armv4l-linux' +installarchlib='./install_me_here/usr/lib/perl5/5.20.1/armv4l-linux' installbin='./install_me_here/usr/bin' installhtml1dir='' installhtml3dir='' @@ -740,13 +737,13 @@ installman1dir='./install_me_here/usr/sh installman3dir='./install_me_here/usr/share/man/man3' installprefix='./install_me_here/usr' installprefixexp='./install_me_here/usr' -installprivlib='./install_me_here/usr/lib/perl5/5.18.2' +installprivlib='./install_me_here/usr/lib/perl5/5.20.1' installscript='./install_me_here/usr/bin' -installsitearch='./install_me_here/usr/lib/perl5/site_perl/5.18.2/armv4l-linux' +installsitearch='./install_me_here/usr/lib/perl5/site_perl/5.20.1/armv4l-linux' installsitebin='./install_me_here/usr/bin' installsitehtml1dir='' installsitehtml3dir='' -installsitelib='./install_me_here/usr/lib/perl5/site_perl/5.18.2' +installsitelib='./install_me_here/usr/lib/perl5/site_perl/5.20.1' installsiteman1dir='./install_me_here/usr/share/man/man1' installsiteman3dir='./install_me_here/usr/share/man/man3' installsitescript='./install_me_here/usr/bin' @@ -782,7 +779,7 @@ libsdirs=' /usr/lib' libsfiles=' libnsl.so libdl.so libm.so libcrypt.so libutil.so libc.so' libsfound=' /usr/lib/libnsl.so /usr/lib/libdl.so /usr/lib/libm.so /usr/lib/libcrypt.so /usr/lib/libutil.so /usr/lib/libc.so' libspath=' /usr/local/lib /lib /usr/lib' -libswanted='sfio socket bind inet nsl nm ndbm gdbm dbm db malloc dl dld ld sun m crypt sec util c cposix posix ucb BSD' +libswanted='socket bind inet nsl nm ndbm gdbm dbm db malloc dl ld sun m crypt sec util c cposix posix ucb BSD' libswanted_uselargefiles='' line='' lint='' @@ -875,17 +872,17 @@ pmake='' pr='' prefix='/usr' prefixexp='/usr' -privlib='/usr/lib/perl5/5.18.2' -privlibexp='/usr/lib/perl5/5.18.2' +privlib='/usr/lib/perl5/5.20.1' +privlibexp='/usr/lib/perl5/5.20.1' procselfexe='"/proc/self/exe"' prototype='define' ptrsize='4' quadkind='3' quadtype='long long' randbits='48' -randfunc='drand48' +randfunc='Perl_drand48' random_r_proto='0' -randseedtype='long' +randseedtype='U32' ranlib=':' rd_nodata='-1' readdir64_r_proto='0' @@ -916,7 +913,7 @@ sched_yield='sched_yield()' scriptdir='/usr/bin' scriptdirexp='/usr/bin' sed='sed' -seedfunc='srand48' +seedfunc='Perl_drand48_init' selectminbits='32' selecttype='fd_set *' sendmail='' @@ -941,17 +938,17 @@ sig_num='0 1 2 3 4 5 6 7 8 9 10 11 12 13 sig_num_init='0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 6, 17, 29, 31, 0' sig_size='68' signal_t='void' -sitearch='/usr/lib/perl5/site_perl/5.18.2/armv4l-linux' -sitearchexp='/usr/lib/perl5/site_perl/5.18.2/armv4l-linux' +sitearch='/usr/lib/perl5/site_perl/5.20.1/armv4l-linux' +sitearchexp='/usr/lib/perl5/site_perl/5.20.1/armv4l-linux' sitebin='/usr/bin' sitebinexp='/usr/bin' sitehtml1dir='' sitehtml1direxp='' sitehtml3dir='' sitehtml3direxp='' -sitelib='/usr/lib/perl5/site_perl/5.18.2' +sitelib='/usr/lib/perl5/site_perl/5.20.1' sitelib_stem='/usr/lib/perl5/site_perl' -sitelibexp='/usr/lib/perl5/site_perl/5.18.2' +sitelibexp='/usr/lib/perl5/site_perl/5.20.1' siteman1dir='/usr/share/man/man1' siteman1direxp='/usr/share/man/man1' siteman3dir='/usr/share/man/man3' @@ -990,11 +987,12 @@ stdio_stream_array='' strerror_r_proto='0' strings='/usr/include/string.h' submit='' -subversion='2' +subversion='1' sysman='/usr/share/man/man1' tail='' tar='' targetarch='' +targetsh='/bin/sh' tbl='' tee='' test='test' @@ -1045,7 +1043,6 @@ useperlio='define' useposix='true' usereentrant='undef' userelocatableinc='undef' -usesfio='false' useshrplib='true' usesitecustomize='undef' usesocks='undef' @@ -1080,11 +1077,10 @@ vendorprefix='' vendorprefixexp='' vendorscript='' vendorscriptexp='' -version='5.18.2' -version_patchlevel_string='version 18 subversion 2' +version='5.20.1' +version_patchlevel_string='version 20 subversion 1' versiononly='undef' vi='' -voidflags='15' xlibpth='/usr/lib/386 /lib/386' yacc='yacc' yaccflags='' @@ -1095,10 +1091,10 @@ config_arg0='Configure' config_args='' config_argc=0 PERL_REVISION=5 -PERL_VERSION=18 -PERL_SUBVERSION=2 +PERL_VERSION=20 +PERL_SUBVERSION=1 PERL_API_REVISION=5 -PERL_API_VERSION=18 +PERL_API_VERSION=20 PERL_API_SUBVERSION=0 PERL_PATCHLEVEL= PERL_CONFIG_SH=true Index: gnu/usr.bin/perl/Cross/config.sh-arm-linux-n770 =================================================================== RCS file: /mnt/memory/perl/importit/cvs/src/gnu/usr.bin/perl/Cross/config.sh-arm-linux-n770,v retrieving revision 1.1.1.5 diff -u -p -u -p -r1.1.1.5 config.sh-arm-linux-n770 --- gnu/usr.bin/perl/Cross/config.sh-arm-linux-n770 24 Mar 2014 14:58:59 -0000 1.1.1.5 +++ gnu/usr.bin/perl/Cross/config.sh-arm-linux-n770 16 Nov 2014 03:22:23 -0000 @@ -33,11 +33,11 @@ ansi2knr='' aphostname='/bin/hostname' api_revision='5' api_subversion='0' -api_version='18' -api_versionstring='5.18.0' +api_version='20' +api_versionstring='5.20.1' ar='ar' -archlib='/usr/lib/perl5/5.18.2/armv4l-linux' -archlibexp='/usr/lib/perl5/5.18.2/armv4l-linux' +archlib='/usr/lib/perl5/5.20.1/armv4l-linux' +archlibexp='/usr/lib/perl5/5.20.1/armv4l-linux' archname64='' archname='armv4l-linux' archobjs='' @@ -55,7 +55,7 @@ castflags='0' cat='cat' cc='arm-none-linux-gnueabi-gcc' cccdlflags='-fpic' -ccdlflags='-rdynamic -Wl,-rpath,/usr/lib/perl5/5.18.2/armv4l-linux/CORE' +ccdlflags='-rdynamic -Wl,-rpath,/usr/lib/perl5/5.20.1/armv4l-linux/CORE' ccflags='-fno-strict-aliasing -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64' ccflags_uselargefiles='-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64' ccname='arm-linux-gcc' @@ -416,7 +416,6 @@ d_setsent='define' d_setservent_r='undef' d_setsid='define' d_setvbuf='define' -d_sfio='undef' d_shm='define' d_shmat='define' d_shmatprototype='define' @@ -524,12 +523,11 @@ db_prefixtype='size_t' db_version_major='' db_version_minor='' db_version_patch='' -defvoidused='15' direntrytype='struct dirent' dlext='so' dlsrc='dl_dlopen.xs' doublesize='8' -drand01='drand48()' +drand01='Perl_drand48()' drand48_r_proto='0' dynamic_ext='B ByteLoader Cwd Data/Dumper Devel/DProf Devel/PPPort Devel/Peek Digest/MD5 Encode Fcntl File/Glob Filter/Util/Call I18N/Langinfo IO IPC/SysV List/Util MIME/Base64 Opcode POSIX PerlIO/encoding PerlIO/scalar PerlIO/via SDBM_File Socket Storable Sys/Hostname Sys/Syslog Time/HiRes Unicode/Collate Unicode/Normalize XS/APItest XS/Typemap attributes re threads threads/shared' eagain='EAGAIN' @@ -618,7 +616,6 @@ i_crypt='define' i_db='undef' i_dbm='undef' i_dirent='define' -i_dld='undef' i_dlfcn='define' i_fcntl='undef' i_float='define' @@ -650,7 +647,6 @@ i_prot='undef' i_pthread='define' i_pwd='define' i_rpcsvcdbm='undef' -i_sfio='undef' i_sgtty='undef' i_shadow='define' i_socks='undef' @@ -703,7 +699,7 @@ inc_version_list=' ' inc_version_list_init='0' incpath='' inews='' -installarchlib='./install_me_here/usr/lib/perl5/5.18.2/armv4l-linux' +installarchlib='./install_me_here/usr/lib/perl5/5.20.1/armv4l-linux' installbin='./install_me_here/usr/bin' installhtml1dir='' installhtml3dir='' @@ -711,13 +707,13 @@ installman1dir='./install_me_here/usr/sh installman3dir='./install_me_here/usr/share/man/man3' installprefix='./install_me_here/usr' installprefixexp='./install_me_here/usr' -installprivlib='./install_me_here/usr/lib/perl5/5.18.2' +installprivlib='./install_me_here/usr/lib/perl5/5.20.1' installscript='./install_me_here/usr/bin' -installsitearch='./install_me_here/usr/lib/perl5/site_perl/5.18.2/armv4l-linux' +installsitearch='./install_me_here/usr/lib/perl5/site_perl/5.20.1/armv4l-linux' installsitebin='./install_me_here/usr/bin' installsitehtml1dir='' installsitehtml3dir='' -installsitelib='./install_me_here/usr/lib/perl5/site_perl/5.18.2' +installsitelib='./install_me_here/usr/lib/perl5/site_perl/5.20.1' installsiteman1dir='./install_me_here/usr/share/man/man1' installsiteman3dir='./install_me_here/usr/share/man/man3' installsitescript='./install_me_here/usr/bin' @@ -753,7 +749,7 @@ libsdirs=' /usr/lib' libsfiles=' libnsl.so libdl.so libm.so libcrypt.so libutil.so libc.so' libsfound=' /usr/lib/libnsl.so /usr/lib/libdl.so /usr/lib/libm.so /usr/lib/libcrypt.so /usr/lib/libutil.so /usr/lib/libc.so' libspath=' /usr/local/lib /lib /usr/lib' -libswanted='sfio socket bind inet nsl nm ndbm gdbm dbm db malloc dl dld ld sun m crypt sec util c cposix posix ucb BSD' +libswanted='socket bind inet nsl nm ndbm gdbm dbm db malloc dl ld sun m crypt sec util c cposix posix ucb BSD' libswanted_uselargefiles='' line='' lint='' @@ -845,17 +841,17 @@ pmake='' pr='' prefix='/usr' prefixexp='/usr' -privlib='/usr/lib/perl5/5.18.2' -privlibexp='/usr/lib/perl5/5.18.2' +privlib='/usr/lib/perl5/5.20.1' +privlibexp='/usr/lib/perl5/5.20.1' procselfexe='"/proc/self/exe"' prototype='define' ptrsize='4' quadkind='3' quadtype='long long' randbits='48' -randfunc='drand48' +randfunc='Perl_drand48' random_r_proto='0' -randseedtype='long' +randseedtype='U32' ranlib=':' rd_nodata='-1' readdir64_r_proto='0' @@ -882,7 +878,7 @@ sched_yield='sched_yield()' scriptdir='/usr/bin' scriptdirexp='/usr/bin' sed='sed' -seedfunc='srand48' +seedfunc='Perl_drand48_init' selectminbits='32' selecttype='fd_set *' sendmail='' @@ -907,17 +903,17 @@ sig_num='0 1 2 3 4 5 6 7 8 9 10 11 12 13 sig_num_init='0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 6, 17, 29, 31, 0' sig_size='68' signal_t='void' -sitearch='/usr/lib/perl5/site_perl/5.18.2/armv4l-linux' -sitearchexp='/usr/lib/perl5/site_perl/5.18.2/armv4l-linux' +sitearch='/usr/lib/perl5/site_perl/5.20.1/armv4l-linux' +sitearchexp='/usr/lib/perl5/site_perl/5.20.1/armv4l-linux' sitebin='/usr/bin' sitebinexp='/usr/bin' sitehtml1dir='' sitehtml1direxp='' sitehtml3dir='' sitehtml3direxp='' -sitelib='/usr/lib/perl5/site_perl/5.18.2' +sitelib='/usr/lib/perl5/site_perl/5.20.1' sitelib_stem='/usr/lib/perl5/site_perl' -sitelibexp='/usr/lib/perl5/site_perl/5.18.2' +sitelibexp='/usr/lib/perl5/site_perl/5.20.1' siteman1dir='/usr/share/man/man1' siteman1direxp='/usr/share/man/man1' siteman3dir='/usr/share/man/man3' @@ -954,7 +950,7 @@ stdio_stream_array='' strerror_r_proto='0' strings='/usr/include/string.h' submit='' -subversion='2' +subversion='1' sysman='/usr/share/man/man1' tail='' tar='' @@ -1006,7 +1002,6 @@ useperlio='define' useposix='true' usereentrant='undef' userelocatableinc='undef' -usesfio='false' useshrplib='true' usesitecustomize='undef' usesocks='undef' @@ -1040,11 +1035,10 @@ vendorprefix='' vendorprefixexp='' vendorscript='' vendorscriptexp='' -version='5.18.2' -version_patchlevel_string='version 18 subversion 2' +version='5.20.1' +version_patchlevel_string='version 20 subversion 1' versiononly='undef' vi='' -voidflags='15' xlibpth='/usr/lib/386 /lib/386' yacc='yacc' yaccflags='' @@ -1055,10 +1049,10 @@ config_arg0='Configure' config_args='' config_argc=0 PERL_REVISION=5 -PERL_VERSION=18 -PERL_SUBVERSION=2 +PERL_VERSION=20 +PERL_SUBVERSION=1 PERL_API_REVISION=5 -PERL_API_VERSION=18 +PERL_API_VERSION=20 PERL_API_SUBVERSION=0 PERL_PATCHLEVEL= PERL_CONFIG_SH=true Index: gnu/usr.bin/perl/NetWare/Makefile =================================================================== RCS file: /mnt/memory/perl/importit/cvs/src/gnu/usr.bin/perl/NetWare/Makefile,v retrieving revision 1.1.1.11 diff -u -p -u -p -r1.1.1.11 Makefile --- gnu/usr.bin/perl/NetWare/Makefile 24 Mar 2014 14:59:06 -0000 1.1.1.11 +++ gnu/usr.bin/perl/NetWare/Makefile 16 Nov 2014 03:22:23 -0000 @@ -86,7 +86,7 @@ NLM_VERSION = 3,20,0 # Here comes the CW tools - TO BE FILLED TO BUILD WITH CW - -MODULE_DESC = "Perl 5.18.2 for NetWare" +MODULE_DESC = "Perl 5.20.1 for NetWare" CCTYPE = CodeWarrior C_COMPILER = mwccnlm -c CPP_COMPILER = mwccnlm @@ -462,7 +462,7 @@ INST_NW_TOP2 = $(INST_NW_DRV)\perl # versioned installation can be obtained by setting INST_TOP above to a # path that includes an arbitrary version string. # -INST_VER = \5.18.2 +INST_VER = \5.20.1 # # Comment this out if you DON'T want your perl installation to have @@ -666,7 +666,6 @@ UTILS = \ ..\utils\h2xs \ ..\utils\perldoc \ ..\pod\pod2html \ - ..\pod\pod2latex \ ..\pod\pod2man \ ..\pod\pod2text \ ..\pod\pod2usage \ @@ -765,7 +764,6 @@ CORE_NOCFG_H = \ ..\perl.h \ ..\perlapi.h \ ..\perlsdio.h \ - ..\perlsfio.h \ ..\perly.h \ ..\pp.h \ ..\proto.h \ @@ -850,7 +848,6 @@ EXTENSION_NPM = \ POD2HTML = $(PODDIR)\pod2html POD2MAN = $(PODDIR)\pod2man -POD2LATEX = $(PODDIR)\pod2latex POD2TEXT = $(PODDIR)\pod2text # Index: gnu/usr.bin/perl/NetWare/config.wc =================================================================== RCS file: /mnt/memory/perl/importit/cvs/src/gnu/usr.bin/perl/NetWare/config.wc,v retrieving revision 1.1.1.9 diff -u -p -u -p -r1.1.1.9 config.wc --- gnu/usr.bin/perl/NetWare/config.wc 24 Mar 2014 14:59:06 -0000 1.1.1.9 +++ gnu/usr.bin/perl/NetWare/config.wc 16 Nov 2014 03:22:23 -0000 @@ -285,6 +285,7 @@ d_isinf='undef' d_isnan='undef' d_isnanl='undef' d_killpg='undef' +d_lc_monetary_2008='undef' d_lchown='undef' d_ldbl_dig='define' d_libm_lib_version='undef' @@ -429,7 +430,6 @@ d_setservent_r='undef' d_setsid='undef' d_setspent='undef' d_setvbuf='define' -d_sfio='undef' d_shm='undef' d_shmat='undef' d_shmatprototype='undef' @@ -542,12 +542,11 @@ db_version_minor='0' db_version_patch='0' def_perlroot='sys:\perl\scripts' def_temp='sys:\perl\temp' -defvoidused='15' direntrytype='DIR' dlext='nlm' dlsrc='dl_netware.xs' doublesize='8' -drand01='(rand()/(double)((unsigned)1<. - */ -/*#define I_SFIO /**/ - /* I_STDDEF: * This symbol, if defined, indicates that exists and should * be included. @@ -1029,7 +1023,7 @@ * double, or a long double when applicable. Usual values are 2, * 4 and 8. The default is eight, for safety. */ -#if defined(USE_CROSS_COMPILE) || defined(MULTIARCH) +#if defined(MULTIARCH) # define MEM_ALIGNBYTES 8 #else #define MEM_ALIGNBYTES 8 @@ -1048,7 +1042,7 @@ * This symbol contains the ~name expanded version of ARCHLIB, to be used * in programs that are not prepared to deal with ~ expansion at run-time. */ -#define ARCHLIB "c:\\perl\\5.18.2\\lib\\NetWare-x86-multi-thread" /**/ +#define ARCHLIB "c:\\perl\\5.20.1\\lib\\NetWare-x86-multi-thread" /**/ /*#define ARCHLIB_EXP "" /**/ /* ARCHNAME: @@ -1079,8 +1073,8 @@ * This symbol is the filename expanded version of the BIN symbol, for * programs that do not want to deal with that at run-time. */ -#define BIN "c:\\perl\\5.18.2\\bin\\NetWare-x86-multi-thread" /**/ -#define BIN_EXP "c:\\perl\\5.18.2\\bin\\NetWare-x86-multi-thread" /**/ +#define BIN "c:\\perl\\5.20.1\\bin\\NetWare-x86-multi-thread" /**/ +#define BIN_EXP "c:\\perl\\5.20.1\\bin\\NetWare-x86-multi-thread" /**/ /* BYTEORDER: * This symbol holds the hexadecimal constant defined in byteorder, @@ -1098,7 +1092,7 @@ * so the default case (for NeXT) is big endian to catch them. * This might matter for NeXT 3.0. */ -#if defined(USE_CROSS_COMPILE) || defined(MULTIARCH) +#if defined(MULTIARCH) # ifdef __LITTLE_ENDIAN__ # if LONGSIZE == 4 # define BYTEORDER 0x1234 @@ -1959,12 +1953,6 @@ */ #define HAS_SETVBUF /**/ -/* USE_SFIO: - * This symbol, if defined, indicates that sfio should - * be used. - */ -/*#define USE_SFIO /**/ - /* HAS_SHM: * This symbol, if defined, indicates that the entire shm*(2) library is * supported. @@ -3063,7 +3051,7 @@ * This symbol contains the ~name expanded version of SITEARCH, to be used * in programs that are not prepared to deal with ~ expansion at run-time. */ -#define SITEARCH "c:\\perl\\site\\5.18.2\\lib\\NetWare-x86-multi-thread" /**/ +#define SITEARCH "c:\\perl\\site\\5.20.1\\lib\\NetWare-x86-multi-thread" /**/ /*#define SITEARCH_EXP "" /**/ /* SITELIB: @@ -3086,7 +3074,7 @@ * removed. The elements in inc_version_list (inc_version_list.U) can * be tacked onto this variable to generate a list of directories to search. */ -#define SITELIB "c:\\perl\\site\\5.18.2\\lib" /**/ +#define SITELIB "c:\\perl\\site\\5.20.1\\lib" /**/ /*#define SITELIB_EXP "" /**/ #define SITELIB_STEM "" /**/ @@ -3296,31 +3284,6 @@ */ /*#define PERL_VENDORLIB_EXP "" /**/ /*#define PERL_VENDORLIB_STEM "" /**/ - -/* VOIDFLAGS: - * This symbol indicates how much support of the void type is given by this - * compiler. What various bits mean: - * - * 1 = supports declaration of void - * 2 = supports arrays of pointers to functions returning void - * 4 = supports comparisons between pointers to void functions and - * addresses of void functions - * 8 = supports declaration of generic void pointers - * - * The package designer should define VOIDUSED to indicate the requirements - * of the package. This can be done either by #defining VOIDUSED before - * including config.h, or by defining defvoidused in Myinit.U. If the - * latter approach is taken, only those flags will be tested. If the - * level of void support necessary is not present, defines void to int. - */ -#ifndef VOIDUSED -#define VOIDUSED 15 -#endif -#define VOIDFLAGS 15 -#if (VOIDFLAGS & VOIDUSED) != VOIDUSED -#define void int /* is void to be avoided? */ -#define M_VOID /* Xenix strikes again */ -#endif /* SETUID_SCRIPTS_ARE_SECURE_NOW: * This symbol, if defined, indicates that the bug that prevents Index: gnu/usr.bin/perl/NetWare/sv_nw.c =================================================================== RCS file: /mnt/memory/perl/importit/cvs/src/gnu/usr.bin/perl/NetWare/sv_nw.c,v retrieving revision 1.1.1.3 diff -u -p -u -p -r1.1.1.3 sv_nw.c --- gnu/usr.bin/perl/NetWare/sv_nw.c 24 Mar 2014 14:59:06 -0000 1.1.1.3 +++ gnu/usr.bin/perl/NetWare/sv_nw.c 16 Nov 2014 03:22:23 -0000 @@ -3,7 +3,6 @@ #include #include -#define FCALL *f #define SV_CHECK_THINKFIRST(sv) if (SvTHINKFIRST(sv)) sv_force_normal_flags(sv, 0) Index: gnu/usr.bin/perl/Porting/GitUtils.pm =================================================================== RCS file: /mnt/memory/perl/importit/cvs/src/gnu/usr.bin/perl/Porting/GitUtils.pm,v retrieving revision 1.1.1.1 diff -u -p -u -p -r1.1.1.1 GitUtils.pm --- gnu/usr.bin/perl/Porting/GitUtils.pm 12 Oct 2009 18:10:46 -0000 1.1.1.1 +++ gnu/usr.bin/perl/Porting/GitUtils.pm 16 Nov 2014 03:22:23 -0000 @@ -45,7 +45,7 @@ sub gen_dot_patch { last if $branch ne 'undefined'; } for ($branch) { - $_ ||= "error"; # hmm, we didnt get /anything/ from name-rev? + $_ ||= "error"; # hmm, we did not get /anything/ from name-rev? s!^\Q$reftype\E/!! || # strip off the reftype s!^refs/heads/!! || # possible other places it was found s!^refs/remotes/!! || # ... Index: gnu/usr.bin/perl/Porting/Glossary =================================================================== RCS file: /mnt/memory/perl/importit/cvs/src/gnu/usr.bin/perl/Porting/Glossary,v retrieving revision 1.13 diff -u -p -u -p -r1.13 Glossary --- gnu/usr.bin/perl/Porting/Glossary 24 Mar 2014 15:05:23 -0000 1.13 +++ gnu/usr.bin/perl/Porting/Glossary 16 Nov 2014 03:22:23 -0000 @@ -1335,6 +1335,12 @@ d_libm_lib_version (d_libm_lib_version.U which indicates to the C program that math.h defines _LIB_VERSION being available in libm +d_libname_unique (so.U): + This variable is defined if the target system insists on unique + basenames for shared library files. This is currently true on Android, + false everywhere else we know of. + Defaults to 'undef'. + d_link (d_link.U): This variable conditionally defines HAS_LINK if link() is available to create hard links. @@ -2047,10 +2053,6 @@ d_setvbuf (d_setvbuf.U): indicates to the C program that the setvbuf() routine is available to change buffering on an open stdio stream. -d_sfio (d_sfio.U): - This variable conditionally defines the USE_SFIO symbol, - and indicates whether sfio is available (and should be used). - d_shm (d_shm.U): This variable conditionally defines the HAS_SHM symbol, which indicates that the entire shm*(2) library is present. @@ -2552,9 +2554,6 @@ db_version_patch (i_db.U): Berkeley DB found in the header file. For DB version 1 this is always 0. -defvoidused (voidflags.U): - This variable contains the default value of the VOIDUSED symbol (15). - direntrytype (i_dirent.U): This symbol is set to 'struct direct' or 'struct dirent' depending on whether dirent is available or not. You should use this pseudo type to @@ -2666,7 +2665,7 @@ expr (Loc.U): extensions (Extensions.U): This variable holds a list of all extension files (both XS and - non-xs linked into the package. It is propagated to Config.pm + non-xs) installed with the package. It is propagated to Config.pm and is typically used to test whether a particular extension is available. @@ -2685,8 +2684,10 @@ fflushall (fflushall.U): even be probed for and will be left undefined. fflushNULL (fflushall.U): - This symbol, if defined, tells that fflush(NULL) does flush - all pending stdio output. + This symbol, if defined, tells that fflush(NULL) correctly + flushes all pending stdio output without side effects. In + particular, on some platforms calling fflush(NULL) *still* + corrupts STDIN if it is a pipe. find (Loc.U): This variable is defined but not used by Configure. @@ -2944,6 +2945,24 @@ hint (Oldconfig.U): Gives the type of hints used for previous answers. May be one of "default", "recommended" or "previous". +hostperl (Cross.U): + This variable contains the path to a miniperl binary that can be + run on the host OS when cross-compiling. Useful and available only + during Perl build. + Empty string '' if not cross-compiling. + +hostgenerate (Cross.U): + This variable contains the path to a generate_uudmap binary that + can be run on the host OS when cross-compiling. Useful and + available only during Perl build. + Empty string '' if not cross-compiling. + +hostosname (Cross.U): + This variable contains the original value of '$^O' for hostperl + when cross-compiling. This is useful to pick the proper tools + when running build code in the host. + Empty string '' if not cross-compiling. + hostcat (nis.U): This variable contains a command that produces the text of the /etc/hosts file. This is normally "cat /etc/hosts", but can be @@ -3027,11 +3046,6 @@ i_dirent (i_dirent.U): This variable conditionally defines I_DIRENT, which indicates to the C program that it should include . -i_dld (i_dld.U): - This variable conditionally defines the I_DLD symbol, which - indicates to the C program that (GNU dynamic loading) - exists and should be included. - i_dlfcn (i_dlfcn.U): This variable conditionally defines the I_DLFCN symbol, which indicates to the C program that exists and should @@ -3168,10 +3182,6 @@ i_rpcsvcdbm (i_dbm.U): indicates to the C program that exists and should be included. Some System V systems might need this instead of . -i_sfio (i_sfio.U): - This variable conditionally defines the I_SFIO symbol, - and indicates whether a C program should include . - i_sgtty (i_termio.U): This variable conditionally defines the I_SGTTY symbol, which indicates to the C program that it should include rather @@ -3409,6 +3419,11 @@ incpath (usrinc.U): right one, as in "$incpath/usr/include" or "$incpath/usr/lib". Value can be "" or "/bsd43" on mips. +incpth (libpth.U): + This variable must precede the normal include path to get the + right one, as in "$incpath/usr/include" or "$incpath/usr/lib". + Value can be "" or "/bsd43" on mips. + inews (Loc.U): This variable is defined but not used by Configure. The value is the empty string and is not useful. @@ -3620,8 +3635,12 @@ ivtype (perlxv.U): This variable contains the C type used for Perl's IV. known_extensions (Extensions.U): - This variable holds a list of all XS extensions included in - the package. + This variable holds a list of all extensions (both XS and non-xs) + included in the package source distribution. This information is + only really of use during the Perl build, as the list makes no + distinction between extensions which were build and installed, and + those which where not. See "extensions" for the list of extensions + actually built and available. ksh (Loc.U): This variable is defined but not used by Configure. @@ -3990,8 +4009,10 @@ nm_so_opt (usenm.U): Maybe Linux should just always set usenm=false. nonxs_ext (Extensions.U): - This variable holds a list of all non-xs extensions included - in the package. All of them will be built. + This variable holds a list of all non-xs extensions built and + installed by the package. By default, all non-xs extensions + distributed will be built, with the exception of platform-specific + extensions (currently only one VMS specific extension). nroff (Loc.U): This variable is used internally by Configure to determine the @@ -4873,6 +4894,12 @@ sysman (sysman.U): pages. Rather it is the place where Configure may look to find manual for unix commands (section 1 of the manual usually). See mansrc. +sysroot (Sysroot.U): + This variable is empty unless supplied by the Configure user. + It can contain a path to an alternative root directory, under which + headers and libraries for the compilation target can be found. This + is generally used when cross-compiling using a gcc-like compiler. + tail (Loc.U): This variable is defined but not used by Configure. The value is the empty string and is not useful. @@ -4885,6 +4912,37 @@ targetarch (Cross.U): If cross-compiling, this variable contains the target architecture. If not, this will be empty. +targetdir (Cross.U): + This variable contains a path that will be created on the target + host using targetmkdir, and then used to copy the cross-compiled + executables to. Defaults to '/tmp' if not set. + +targetenv (Cross.U): + If cross-compiling, this variable can be used to modify the + environment on the target system. + However, how and where it's used, and even if it's used at all, is + entirely dependent on both the transport mechanism (targetrun) and + what the target system is. Unless the relevant documentation says + otherwise, it is genereally not useful. + +targethost (Cross.U): + This variable contains the name of a separate host machine that + can be used to run compiled test programs and perl tests on. + Set to empty string if not in use. + +targetmkdir (Cross.U): + This variable contains the command used by Configure to create a + new directory on the target host. + +targetport (Cross.U): + This variable contains the number of a network port to be used to + connect to the host in targethost, if unset defaults to 22 for ssh. + +targetsh (Cross.U): + If cross-compiling, this variable contains the location of sh on the + target system. + If not, this will be the same as $sh. + tbl (Loc.U): This variable is defined but not used by Configure. The value is the empty string and is not useful. @@ -5122,13 +5180,6 @@ userelocatableinc (bin.U): containing the perl binary, and a logical cleanup of the path is then made around the join point (removing "dir/../" pairs) -usesfio (d_sfio.U): - This variable is set to true when the user agrees to use sfio. - It is set to false when sfio is not available or when the user - explicitly requests not to use sfio. It is here primarily so - that command-line settings can override the auto-detection of - d_sfio without running into a "WHOA THERE". - useshrplib (libperl.U): This variable is set to 'true' if the user wishes to build a shared libperl, and 'false' otherwise. @@ -5343,11 +5394,6 @@ versiononly (versiononly.U): vi (Loc.U): This variable is defined but not used by Configure. The value is the empty string and is not useful. - -voidflags (voidflags.U): - This variable contains the eventual value of the VOIDFLAGS symbol, - which indicates how much support of the void type is given by this - compiler. See VOIDFLAGS for more info. xlibpth (libpth.U): This variable holds extra path (space-separated) used to find Index: gnu/usr.bin/perl/Porting/Maintainers.pl =================================================================== RCS file: /mnt/memory/perl/importit/cvs/src/gnu/usr.bin/perl/Porting/Maintainers.pl,v retrieving revision 1.4 diff -u -p -u -p -r1.4 Maintainers.pl --- gnu/usr.bin/perl/Porting/Maintainers.pl 24 Mar 2014 15:05:23 -0000 1.4 +++ gnu/usr.bin/perl/Porting/Maintainers.pl 16 Nov 2014 03:22:23 -0000 @@ -11,92 +11,6 @@ package Maintainers; use utf8; use File::Glob qw(:case); -%Maintainers = ( - 'abergman' => 'Arthur Bergman ', - 'abigail' => 'Abigail ', - 'afresh1' => 'Andrew Fresh ', - 'ambs' => 'Alberto Simões ', - 'ams' => 'Abhijit Menon-Sen ', - 'andk' => 'Andreas J. Koenig ', - 'andya' => 'Andy Armstrong ', - 'arandal' => 'Allison Randal ', - 'audreyt' => 'Audrey Tang ', - 'avar' => 'Ævar Arnfjörð Bjarmason ', - 'bingos' => 'Chris Williams ', - 'chorny' => 'Alexandr Ciornii ', - 'corion' => 'Max Maischein ', - 'craig' => 'Craig Berry ', - 'dankogai' => 'Dan Kogai ', - 'dconway' => 'Damian Conway ', - 'dland' => 'David Landgren ', - 'dmanura' => 'David Manura ', - 'drolsky' => 'Dave Rolsky ', - 'elizabeth' => 'Elizabeth Mattijsen ', - 'ferreira' => 'Adriano Ferreira ', - 'gbarr' => 'Graham Barr ', - 'gaas' => 'Gisle Aas ', - 'gsar' => 'Gurusamy Sarathy ', - 'hmbrand' => 'H.Merijn Brand ', - 'ilyam' => 'Ilya Martynov ', - 'ilyaz' => 'Ilya Zakharevich ', - 'jand' => 'Jan Dubois ', - 'jdhedden' => 'Jerry D. Hedden ', - 'jesse' => 'Jesse Vincent ', - 'jhi' => 'Jarkko Hietaniemi ', - 'jjore' => 'Joshua ben Jore ', - 'jpeacock' => 'John Peacock ', - 'jstowe' => 'Jonathan Stowe ', - 'jv' => 'Johan Vromans ', - 'kane' => 'Jos Boumans ', - 'kwilliams' => 'Ken Williams ', - 'laun' => 'Wolfgang Laun ', - 'lstein' => 'Lincoln D. Stein ', - 'lwall' => 'Larry Wall ', - 'makamaka' => 'Makamaka Hannyaharamitu ', - 'mallen' => 'Mark Allen ', - 'marekr' => 'Marek Rouchal ', - 'markm' => 'Mark Mielke ', - 'mhx' => 'Marcus Holland-Moritz ', - 'mjd' => 'Mark-Jason Dominus ', - 'msergeant' => 'Matt Sergeant ', - 'mshelor' => 'Mark Shelor ', - 'muir' => 'David Muir Sharnoff ', - 'neilb' => 'Neil Bowers ', - 'nuffin' => 'Yuval Kogman ', - 'nwclark' => 'Nicholas Clark ', - 'osfameron' => 'Hakim Cassimally ', - 'p5p' => 'perl5-porters ', - 'perlfaq' => 'perlfaq-workers ', - 'petdance' => 'Andy Lester ', - 'pevans' => 'Paul Evans ', - 'pjf' => 'Paul Fenwick ', - 'pmqs' => 'Paul Marquess ', - 'pvhp' => 'Peter Prymmer ', - 'rafl' => 'Florian Ragwitz ', - 'rclamp' => 'Richard Clamp ', - 'rgarcia' => 'Rafael Garcia-Suarez ', - 'rkobes' => 'Randy Kobes ', - 'rmbarker' => 'Robin Barker ', - 'rra' => 'Russ Allbery ', - 'rurban' => 'Reini Urban ', - 'sadahiro' => 'SADAHIRO Tomoyuki ', - 'salva' => 'Salvador Fandiño García ', - 'saper' => 'Sébastien Aperghis-Tramoni ', - 'sartak' => 'Shawn M Moore ', - 'sbeck' => 'Sullivan Beck ', - 'sburke' => 'Sean Burke ', - 'mschwern' => 'Michael Schwern ', - 'simonw' => 'Simon Wistow ', - 'smccam' => 'Stephen McCamant ', - 'smpeters' => 'Steve Peters ', - 'smueller' => 'Steffen Mueller ', - 'tomhughes' => 'Tom Hughes ', - 'tjenness' => 'Tim Jenness ', - 'tyemq' => 'Tye McQueen ', - 'yves' => 'Yves Orton ', - 'zefram' => 'Andrew Main ', -); - # IGNORABLE: files which, if they appear in the root of a CPAN # distribution, need not appear in core (i.e. core-cpan-diff won't # complain if it can't find them) @@ -104,11 +18,11 @@ use File::Glob qw(:case); @IGNORABLE = qw( .cvsignore .dualLivedDiffConfig .gitignore ANNOUNCE Announce Artistic AUTHORS BENCHMARK BUGS Build.PL - CHANGELOG ChangeLog Changelog CHANGES Changes COPYING Copying CREDITS - dist.ini GOALS HISTORY INSTALL INSTALL.SKIP LICENSE Makefile.PL - MANIFEST MANIFEST.SKIP META.yml MYMETA.yml META.json MYMETA.json - NEW NOTES perlcritic.rc ppport.h README README.PATCHING SIGNATURE - THANKS TODO Todo VERSION WHATSNEW CONTRIBUTING + CHANGELOG ChangeLog Changelog CHANGES Changes CONTRIBUTING COPYING Copying + cpanfile CREDITS dist.ini GOALS HISTORY INSTALL INSTALL.SKIP LICENSE + Makefile.PL MANIFEST MANIFEST.SKIP META.json META.yml MYMETA.json + MYMETA.yml NEW NOTES perlcritic.rc ppport.h README README.PATCHING + SIGNATURE THANKS TODO Todo VERSION WHATSNEW .perlcriticrc.perltidyrc ); # Each entry in the %Modules hash roughly represents a distribution, @@ -122,19 +36,26 @@ use File::Glob qw(:case); # Archive-Extract-N.NN.tar.gz; the remaining keys are likely to be based # on the name of the distribution, e.g. 'Locale-Codes' for # Locale-Codes-N.NN.tar.gz'. -# + +# UPSTREAM indicates where patches should go. This is generally now +# inferred from the FILES: modules with files in dist/, ext/ and lib/ +# are understood to have UPSTREAM 'blead', meaning that the copy of the +# module in the blead sources is to be considered canonical, while +# modules with files in cpan/ are understood to have UPSTREAM 'cpan', +# meaning that the module on CPAN is to be patched first. + +# MAINTAINER has previously been used to indicate who the current maintainer +# of the module is, but this is no longer stated explicitly. It is now +# understood to be either the Perl 5 Porters if UPSTREAM is 'blead', or else +# the CPAN author whose PAUSE user ID forms the first part of the DISTRIBUTION +# value, e.g. 'BINGOS' in the case of 'BINGOS/Archive-Tar-1.96.tar.gz'. +# (PAUSE's View Permissions page may be consulted to find other authors who +# have owner or co-maint permissions for the module in question.) + # FILES is a list of filenames, glob patterns, and directory # names to be recursed down, which collectively generate a complete list # of the files associated with the distribution. -# UPSTREAM indicates where patches should go. undef implies -# that this hasn't been discussed for the module at hand. -# "blead" indicates that the copy of the module in the blead -# sources is to be considered canonical, "cpan" means that the -# module on CPAN is to be patched first. "first-come" means -# that blead can be patched freely if it is in sync with the -# latest release on CPAN. - # BUGS is an email or url to post bug reports. For modules with # UPSTREAM => 'blead', use perl5-porters@perl.org. rt.cpan.org # appears to automatically provide a URL for CPAN modules; any value @@ -156,7 +77,10 @@ use File::Glob qw(:case); # If the file in blead matches the file in the tarball from CPAN, # Porting/core-cpan-diff will warn about it, as it indicates an expected # customization might have been lost when updating from upstream. The -# path should be relative to the distribution directory. +# path should be relative to the distribution directory. If the upstream +# distribution should be modified to incorporate the change then be sure +# to raise a ticket for it on rt.cpan.org and add a comment alongside the +# list of CUSTOMIZED files noting the ticket number. # DEPRECATED contains the *first* version of Perl in which the module # was considered deprecated. It should only be present if the module is @@ -194,139 +118,70 @@ use File::Glob qw(:case); %Modules = ( - 'AnyDBM_File' => { - 'MAINTAINER' => 'p5p', - 'FILES' => q[lib/AnyDBM_File.{pm,t}], - 'UPSTREAM' => 'blead', - }, - - 'Archive::Extract' => { - 'MAINTAINER' => 'kane', - 'DISTRIBUTION' => 'BINGOS/Archive-Extract-0.68.tar.gz', - 'FILES' => q[cpan/Archive-Extract], - 'UPSTREAM' => 'cpan', - 'BUGS' => 'bug-archive-extract@rt.cpan.org', - 'DEPRECATED' => '5.017009', - }, - 'Archive::Tar' => { - 'MAINTAINER' => 'kane', - 'DISTRIBUTION' => 'BINGOS/Archive-Tar-1.90.tar.gz', + 'DISTRIBUTION' => 'BINGOS/Archive-Tar-1.96.tar.gz', 'FILES' => q[cpan/Archive-Tar], - 'EXCLUDED' => ['Makefile.PL'], - 'UPSTREAM' => 'cpan', 'BUGS' => 'bug-archive-tar@rt.cpan.org', }, 'Attribute::Handlers' => { - 'MAINTAINER' => 'rgarcia', - 'DISTRIBUTION' => 'SMUELLER/Attribute-Handlers-0.93.tar.gz', + 'DISTRIBUTION' => 'SMUELLER/Attribute-Handlers-0.96.tar.gz', 'FILES' => q[dist/Attribute-Handlers], - 'UPSTREAM' => 'blead', - }, - - 'attributes' => { - 'MAINTAINER' => 'p5p', - 'FILES' => q[ext/attributes], - 'UPSTREAM' => 'blead', }, 'autodie' => { - 'MAINTAINER' => 'pjf', - 'DISTRIBUTION' => 'PJF/autodie-2.13.tar.gz', + 'DISTRIBUTION' => 'PJF/autodie-2.23.tar.gz', 'FILES' => q[cpan/autodie], 'EXCLUDED' => [ - qr{^inc/Module/}, - + qr{benchmarks}, # All these tests depend upon external # modules that don't exist when we're # building the core. Hence, they can # never run, and should not be merged. - qw( t/boilerplate.t + qw( t/author-critic.t + t/boilerplate.t t/critic.t t/fork.t t/kwalitee.t t/lex58.t t/pod-coverage.t t/pod.t + t/release-pod-coverage.t + t/release-pod-syntax.t t/socket.t t/system.t ) ], - 'UPSTREAM' => 'cpan', + 'CUSTOMIZED' => [ + # Waiting to be merged upstream: see CPAN RT#87237 + qw( t/utf8_open.t ), + ], }, 'AutoLoader' => { - 'MAINTAINER' => 'smueller', - 'DISTRIBUTION' => 'SMUELLER/AutoLoader-5.73.tar.gz', + 'DISTRIBUTION' => 'SMUELLER/AutoLoader-5.74.tar.gz', 'FILES' => q[cpan/AutoLoader], 'EXCLUDED' => ['t/00pod.t'], - 'UPSTREAM' => 'cpan', }, 'autouse' => { - 'MAINTAINER' => 'p5p', 'DISTRIBUTION' => 'FLORA/autouse-1.07.tar.gz', 'FILES' => q[dist/autouse], 'EXCLUDED' => [qr{^t/release-.*\.t}], - 'UPSTREAM' => 'blead', - }, - - 'B' => { - 'MAINTAINER' => 'p5p', - 'FILES' => q[ext/B], - 'EXCLUDED' => [ - qw( B/Concise.pm - t/concise.t - ), - ], - 'UPSTREAM' => 'blead', - }, - - 'B::Concise' => { - 'MAINTAINER' => 'smccam', - 'FILES' => q[ext/B/B/Concise.pm ext/B/t/concise.t], - 'UPSTREAM' => 'blead', }, 'B::Debug' => { - 'MAINTAINER' => 'rurban', - 'DISTRIBUTION' => 'RURBAN/B-Debug-1.18.tar.gz', + 'DISTRIBUTION' => 'RURBAN/B-Debug-1.19.tar.gz', 'FILES' => q[cpan/B-Debug], 'EXCLUDED' => ['t/pod.t'], - 'UPSTREAM' => 'cpan', - }, - - 'B::Deparse' => { - 'MAINTAINER' => 'smccam', - 'FILES' => q[dist/B-Deparse], - 'UPSTREAM' => 'blead', - }, - - 'B::Lint' => { - 'MAINTAINER' => 'jjore', - 'DISTRIBUTION' => 'RJBS/B-Lint-1.17.tar.gz', - 'FILES' => q[cpan/B-Lint], - 'EXCLUDED' => ['t/test.pl'], - 'UPSTREAM' => 'cpan', - 'DEPRECATED' => '5.017009', }, 'base' => { - 'MAINTAINER' => 'rgarcia', 'DISTRIBUTION' => 'RGARCIA/base-2.18.tar.gz', 'FILES' => q[dist/base], - 'UPSTREAM' => 'blead', - }, - - 'Benchmark' => { - 'MAINTAINER' => 'p5p', - 'FILES' => q[lib/Benchmark.{pm,t}], - 'UPSTREAM' => 'blead', }, 'bignum' => { - 'MAINTAINER' => 'rafl', 'DISTRIBUTION' => 'FLORA/bignum-0.32.tar.gz', 'FILES' => q[dist/bignum], 'EXCLUDED' => [ @@ -335,71 +190,59 @@ use File::Glob qw(:case); t/pod_cov.t ), ], - 'UPSTREAM' => 'blead', }, 'Carp' => { - 'MAINTAINER' => 'zefram', - 'DISTRIBUTION' => 'ZEFRAM/Carp-1.26.tar.gz', + 'DISTRIBUTION' => 'ZEFRAM/Carp-1.3301.tar.gz', 'FILES' => q[dist/Carp], - 'UPSTREAM' => 'blead', }, 'CGI' => { - 'MAINTAINER' => 'lstein', - 'DISTRIBUTION' => 'MARKSTOS/CGI.pm-3.63.tar.gz', + 'DISTRIBUTION' => 'MARKSTOS/CGI.pm-3.65.tar.gz', 'FILES' => q[cpan/CGI], 'EXCLUDED' => [ + qr{^examples/}, qw( cgi_docs.html - examples/WORLD_WRITABLE/18.157.1.253.sav t/gen-tests/gen-start-end-tags.pl t/fast.t ), ], - 'UPSTREAM' => 'cpan', - }, - - 'Class::Struct' => { - 'MAINTAINER' => 'p5p', - 'FILES' => q[lib/Class/Struct.{pm,t}], - 'UPSTREAM' => 'blead', + 'DEPRECATED' => '5.019007', }, 'Compress::Raw::Bzip2' => { - 'MAINTAINER' => 'pmqs', - 'DISTRIBUTION' => 'PMQS/Compress-Raw-Bzip2-2.060.tar.gz', + 'DISTRIBUTION' => 'PMQS/Compress-Raw-Bzip2-2.064.tar.gz', 'FILES' => q[cpan/Compress-Raw-Bzip2], 'EXCLUDED' => [ qr{^t/Test/}, 'bzip2-src/bzip2-cpp.patch', ], - 'UPSTREAM' => 'cpan', }, 'Compress::Raw::Zlib' => { - 'MAINTAINER' => 'pmqs', - 'DISTRIBUTION' => 'PMQS/Compress-Raw-Zlib-2.060.tar.gz', + 'DISTRIBUTION' => 'PMQS/Compress-Raw-Zlib-2.065.tar.gz', 'FILES' => q[cpan/Compress-Raw-Zlib], 'EXCLUDED' => [ + qr{^examples/}, qr{^t/Test/}, qw( t/000prereq.t t/99pod.t ), ], - 'UPSTREAM' => 'cpan', }, 'Config::Perl::V' => { - 'MAINTAINER' => 'hmbrand', - 'DISTRIBUTION' => 'HMBRAND/Config-Perl-V-0.17.tgz', + 'DISTRIBUTION' => 'HMBRAND/Config-Perl-V-0.22.tgz', 'FILES' => q[cpan/Config-Perl-V], - 'EXCLUDED' => ['examples/show-v.pl'], - 'UPSTREAM' => 'cpan', + 'EXCLUDED' => [qw( + examples/show-v.pl + t/00_pod.t + t/01_pod.t + )], }, 'constant' => { - 'MAINTAINER' => 'saper', 'DISTRIBUTION' => 'SAPER/constant-1.27.tar.gz', 'FILES' => q[dist/constant], 'EXCLUDED' => [ @@ -410,20 +253,19 @@ use File::Glob qw(:case); eg/synopsis.pl ), ], - 'UPSTREAM' => 'blead', }, 'CPAN' => { - 'MAINTAINER' => 'andk', - 'DISTRIBUTION' => 'ANDK/CPAN-2.00.tar.gz', + 'DISTRIBUTION' => 'ANDK/CPAN-2.05.tar.gz', 'FILES' => q[cpan/CPAN], 'EXCLUDED' => [ qr{^distroprefs/}, qr{^inc/Test/}, - qr{^t/CPAN/authors/}, + qr{^t/CPAN/}, + qr{^t/data/}, qw( lib/CPAN/Admin.pm - Makefile.PL scripts/cpan-mirrors + PAUSE2015.pub SlayMakefile t/00signature.t t/04clean_load.t @@ -435,116 +277,62 @@ use File::Glob qw(:case); t/31sessions.t t/41distribution.t t/42distroprefs.t - t/44cpanmeta.t t/43distroprefspref.t + t/44cpanmeta.t t/50pod.t t/51pod.t t/52podcover.t t/60credentials.t t/70_critic.t - t/CPAN/CpanTestDummies-1.55.pm - t/CPAN/TestConfig.pm - t/CPAN/TestMirroredBy - t/CPAN/TestPatch.txt - t/CPAN/modules/02packages.details.txt - t/CPAN/modules/03modlist.data - t/data/META-dynamic.json - t/data/META-dynamic.yml - t/data/META-static.json - t/data/META-static.yml - t/data/MYMETA.json - t/data/MYMETA.yml + t/71_minimumversion.t t/local_utils.pm t/perlcriticrc t/yaml_code.yml ), ], - 'UPSTREAM' => 'cpan', - }, - - 'CPANPLUS' => { - 'MAINTAINER' => 'kane', - 'DISTRIBUTION' => 'BINGOS/CPANPLUS-0.9134.tar.gz', - 'FILES' => q[cpan/CPANPLUS], - 'EXCLUDED' => [ - qr{^inc/}, - qr{^t/dummy-.*\.hidden$}, - qr{^t/dummy-(cpanplus|perl|localmirror)/}, - 'bin/cpanp-boxed', - - # SQLite tests would be skipped in core, and - # the filenames are too long for VMS! - qw( t/031_CPANPLUS-Internals-Source-SQLite.t - t/032_CPANPLUS-Internals-Source-via-sqlite.t - ), - 'Makefile.PL', - ], - 'CUSTOMIZED' => ['Makefile.PL'], - 'UPSTREAM' => 'cpan', - 'BUGS' => 'bug-cpanplus@rt.cpan.org', - 'DEPRECATED' => '5.017009', - }, - - 'CPANPLUS::Dist::Build' => { - 'MAINTAINER' => 'bingos', - 'DISTRIBUTION' => 'BINGOS/CPANPLUS-Dist-Build-0.70.tar.gz', - 'FILES' => q[cpan/CPANPLUS-Dist-Build], - 'EXCLUDED' => [ - qr{^inc/}, - qw( t/99_pod.t - t/99_pod_coverage.t - ), - ], - 'UPSTREAM' => 'cpan', - 'DEPRECATED' => '5.017009', }, + # Note: When updating CPAN-Meta the META.* files will need to be regenerated + # perl -Icpan/CPAN-Meta/lib Porting/makemeta 'CPAN::Meta' => { - 'MAINTAINER' => 'dagolden', - 'DISTRIBUTION' => 'DAGOLDEN/CPAN-Meta-2.120921.tar.gz', + 'DISTRIBUTION' => 'DAGOLDEN/CPAN-Meta-2.140640.tar.gz', 'FILES' => q[cpan/CPAN-Meta], 'EXCLUDED' => [ - qw(t/00-compile.t), + qw[t/00-report-prereqs.t], + qr{t/README-data.txt}, qr{^xt}, qr{^history}, ], - 'UPSTREAM' => 'cpan', }, 'CPAN::Meta::Requirements' => { - 'MAINTAINER' => 'dagolden', - 'DISTRIBUTION' => 'DAGOLDEN/CPAN-Meta-Requirements-2.122.tar.gz', + 'DISTRIBUTION' => 'DAGOLDEN/CPAN-Meta-Requirements-2.125.tar.gz', 'FILES' => q[cpan/CPAN-Meta-Requirements], 'EXCLUDED' => [ qw(t/00-compile.t), + qw(t/00-report-prereqs.t), qr{^xt}, - qr{^history}, ], - 'UPSTREAM' => 'cpan', }, 'CPAN::Meta::YAML' => { - 'MAINTAINER' => 'dagolden', - 'DISTRIBUTION' => 'DAGOLDEN/CPAN-Meta-YAML-0.008.tar.gz', + 'DISTRIBUTION' => 'DAGOLDEN/CPAN-Meta-YAML-0.012.tar.gz', 'FILES' => q[cpan/CPAN-Meta-YAML], 'EXCLUDED' => [ 't/00-compile.t', + 't/00-report-prereqs.t', 't/04_scalar.t', # requires YAML.pm qr{^xt}, ], - 'UPSTREAM' => 'cpan', }, 'Data::Dumper' => { - 'MAINTAINER' => 'p5p', # Not gsar. Not ilyam. Not really smueller - 'DISTRIBUTION' => 'SMUELLER/Data-Dumper-2.145.tar.gz', + 'DISTRIBUTION' => 'SMUELLER/Data-Dumper-2.151.tar.gz', 'FILES' => q[dist/Data-Dumper], - 'UPSTREAM' => 'blead', }, 'DB_File' => { - 'MAINTAINER' => 'pmqs', - 'DISTRIBUTION' => 'PMQS/DB_File-1.827.tar.gz', + 'DISTRIBUTION' => 'PMQS/DB_File-1.831.tar.gz', 'FILES' => q[cpan/DB_File], 'EXCLUDED' => [ qr{^patches/}, @@ -553,62 +341,41 @@ use File::Glob qw(:case); fallback.xs ), ], - 'UPSTREAM' => 'cpan', }, - 'DBM_Filter' => { - 'MAINTAINER' => 'p5p', - 'FILES' => q[lib/DBM_Filter.pm lib/DBM_Filter], - 'UPSTREAM' => 'blead', + 'Devel::PPPort' => { + 'DISTRIBUTION' => 'MHX/Devel-PPPort-3.21.tar.gz', + # RJBS has asked MHX to have UPSTREAM be 'blead' + # (i.e. move this from cpan/ to dist/) + 'FILES' => q[cpan/Devel-PPPort], + 'EXCLUDED' => [ + 'PPPort.pm', # we use PPPort_pm.PL instead + 'README.md', + ] }, 'Devel::SelfStubber' => { - 'MAINTAINER' => 'p5p', 'DISTRIBUTION' => 'FLORA/Devel-SelfStubber-1.05.tar.gz', 'FILES' => q[dist/Devel-SelfStubber], 'EXCLUDED' => [qr{^t/release-.*\.t}], - 'UPSTREAM' => 'blead', - }, - - 'Devel::Peek' => { - 'MAINTAINER' => 'p5p', - 'FILES' => q[ext/Devel-Peek], - 'UPSTREAM' => 'blead', - }, - - 'Devel::PPPort' => { - 'MAINTAINER' => 'mhx', - 'DISTRIBUTION' => 'MHX/Devel-PPPort-3.20.tar.gz', - 'FILES' => q[cpan/Devel-PPPort], - 'EXCLUDED' => ['PPPort.pm'], # we use PPPort_pm.PL instead - 'UPSTREAM' => 'cpan', - }, - - 'diagnostics' => { - 'MAINTAINER' => 'p5p', - 'FILES' => q[lib/diagnostics.{pm,t}], - 'UPSTREAM' => 'blead', }, 'Digest' => { - 'MAINTAINER' => 'gaas', 'DISTRIBUTION' => 'GAAS/Digest-1.17.tar.gz', 'FILES' => q[cpan/Digest], 'EXCLUDED' => ['digest-bench'], - 'UPSTREAM' => "cpan", }, 'Digest::MD5' => { - 'MAINTAINER' => 'gaas', - 'DISTRIBUTION' => 'GAAS/Digest-MD5-2.52.tar.gz', + 'DISTRIBUTION' => 'GAAS/Digest-MD5-2.53.tar.gz', 'FILES' => q[cpan/Digest-MD5], 'EXCLUDED' => ['rfc1321.txt'], - 'UPSTREAM' => "cpan", + # Waiting to be merged upstream: see CPAN RT#89612 + 'CUSTOMIZED' => ['t/files.t'], }, 'Digest::SHA' => { - 'MAINTAINER' => 'mshelor', - 'DISTRIBUTION' => 'MSHELOR/Digest-SHA-5.84.tar.gz', + 'DISTRIBUTION' => 'MSHELOR/Digest-SHA-5.88.tar.gz', 'FILES' => q[cpan/Digest-SHA], 'EXCLUDED' => [ qw( t/pod.t @@ -616,109 +383,87 @@ use File::Glob qw(:case); examples/dups ), ], - 'UPSTREAM' => 'cpan', - }, - - 'DirHandle' => { - 'MAINTAINER' => 'p5p', - 'FILES' => q[lib/DirHandle.{pm,t}], - 'UPSTREAM' => 'blead', }, 'Dumpvalue' => { - 'MAINTAINER' => 'p5p', 'DISTRIBUTION' => 'FLORA/Dumpvalue-1.17.tar.gz', 'FILES' => q[dist/Dumpvalue], 'EXCLUDED' => [qr{^t/release-.*\.t}], - 'UPSTREAM' => 'blead', - }, - - 'DynaLoader' => { - 'MAINTAINER' => 'p5p', - 'FILES' => q[ext/DynaLoader], - 'UPSTREAM' => 'blead', }, 'Encode' => { - 'MAINTAINER' => 'dankogai', - 'DISTRIBUTION' => 'DANKOGAI/Encode-2.49.tar.gz', + 'DISTRIBUTION' => 'DANKOGAI/Encode-2.60.tar.gz', 'FILES' => q[cpan/Encode], - 'UPSTREAM' => 'cpan', + 'CUSTOMIZED' => [ + # Waiting to be merged upstream: see CPAN RT#95130 and + # Message-Id: <201405062058.s46KwdCZ013775@m-l.org> + qw( + Byte/Makefile.PL + CN/Makefile.PL + EBCDIC/Makefile.PL + Encode.pm + Encode.xs + Encode/Makefile_PL.e2x + JP/Makefile.PL + KR/Makefile.PL + Symbol/Makefile.PL + TW/Makefile.PL + bin/enc2xs + ), + ], + }, 'encoding::warnings' => { - 'MAINTAINER' => 'audreyt', 'DISTRIBUTION' => 'AUDREYT/encoding-warnings-0.11.tar.gz', 'FILES' => q[cpan/encoding-warnings], 'EXCLUDED' => [ qr{^inc/Module/}, - qw( t/0-signature.t - Makefile.PL - MANIFEST - META.yml - README - SIGNATURE - ), + qw(t/0-signature.t), ], - 'UPSTREAM' => undef, - }, - - 'English' => { - 'MAINTAINER' => 'p5p', - 'FILES' => q[lib/English.{pm,t}], - 'UPSTREAM' => 'blead', }, 'Env' => { - 'MAINTAINER' => 'p5p', 'DISTRIBUTION' => 'FLORA/Env-1.04.tar.gz', 'FILES' => q[dist/Env], 'EXCLUDED' => [qr{^t/release-.*\.t}], - 'UPSTREAM' => 'blead', }, - 'Errno' => { - 'MAINTAINER' => 'p5p', - 'FILES' => q[ext/Errno], - 'UPSTREAM' => 'blead', + 'experimental' => { + 'DISTRIBUTION' => 'LEONT/experimental-0.007.tar.gz', + 'FILES' => q[cpan/experimental], + 'EXCLUDED' => [ + qr{^t/release-.*\.t}, + 't/00-compile.t', + ], }, 'Exporter' => { - 'MAINTAINER' => 'ferreira', 'DISTRIBUTION' => 'TODDR/Exporter-5.68.tar.gz', - 'FILES' => q[lib/Exporter.pm - lib/Exporter.t - lib/Exporter/Heavy.pm - ], + 'FILES' => q[dist/Exporter], 'EXCLUDED' => [ qw( t/pod.t t/use.t ), ], - 'MAP' => { - 't/' => 'lib/', - 'lib/' => 'lib/', - }, - 'UPSTREAM' => 'blead', }, 'ExtUtils::CBuilder' => { - 'MAINTAINER' => 'ambs', - 'DISTRIBUTION' => 'DAGOLDEN/ExtUtils-CBuilder-0.280205.tar.gz', + 'DISTRIBUTION' => 'AMBS/ExtUtils/ExtUtils-CBuilder-0.280216.tar.gz', 'FILES' => q[dist/ExtUtils-CBuilder], - 'UPSTREAM' => 'blead', + 'EXCLUDED' => [ + qw(README.mkdn), + qr{^xt}, + ], }, 'ExtUtils::Command' => { - 'MAINTAINER' => 'p5p', - 'DISTRIBUTION' => 'FLORA/ExtUtils-Command-1.17.tar.gz', + 'DISTRIBUTION' => 'FLORA/ExtUtils-Command-1.18.tar.gz', 'FILES' => q[dist/ExtUtils-Command], 'EXCLUDED' => [qr{^t/release-}], - 'UPSTREAM' => 'blead', }, 'ExtUtils::Constant' => { - 'MAINTAINER' => 'nwclark', # Nick has confirmed that while we have diverged from CPAN, # this package isn't primarily maintained in core @@ -731,12 +476,10 @@ use File::Glob qw(:case); examples/perl_regcomp_posix_keyword.pl ), ], - 'UPSTREAM' => undef, }, 'ExtUtils::Install' => { - 'MAINTAINER' => 'yves', - 'DISTRIBUTION' => 'YVES/ExtUtils-Install-1.54.tar.gz', + 'DISTRIBUTION' => 'BINGOS/ExtUtils-Install-1.67.tar.gz', 'FILES' => q[dist/ExtUtils-Install], 'EXCLUDED' => [ qw( t/lib/Test/Builder.pm @@ -747,12 +490,10 @@ use File::Glob qw(:case); t/pod.t ), ], - 'UPSTREAM' => 'blead', }, 'ExtUtils::MakeMaker' => { - 'MAINTAINER' => 'mschwern', - 'DISTRIBUTION' => 'BINGOS/ExtUtils-MakeMaker-6.66.tar.gz', + 'DISTRIBUTION' => 'BINGOS/ExtUtils-MakeMaker-6.98.tar.gz', 'FILES' => q[cpan/ExtUtils-MakeMaker], 'EXCLUDED' => [ qr{^t/lib/Test/}, @@ -760,91 +501,28 @@ use File::Glob qw(:case); qr{^t/Liblist_Kid.t}, qr{^t/liblist/}, qr{^\.perlcriticrc}, + 'PATCHING', + 'README.packaging', ], - 'UPSTREAM' => 'first-come', }, 'ExtUtils::Manifest' => { - 'MAINTAINER' => 'p5p', - 'DISTRIBUTION' => 'FLORA/ExtUtils-Manifest-1.61.tar.gz', + 'DISTRIBUTION' => 'FLORA/ExtUtils-Manifest-1.63.tar.gz', 'FILES' => q[dist/ExtUtils-Manifest], 'EXCLUDED' => [qr(t/release-.*\.t)], - 'UPSTREAM' => 'blead', }, 'ExtUtils::ParseXS' => { - 'MAINTAINER' => 'smueller', - 'DISTRIBUTION' => 'SMUELLER/ExtUtils-ParseXS-3.18.tar.gz', + 'DISTRIBUTION' => 'SMUELLER/ExtUtils-ParseXS-3.24.tar.gz', 'FILES' => q[dist/ExtUtils-ParseXS], - 'UPSTREAM' => 'blead', - }, - - 'perlfaq' => { - 'MAINTAINER' => 'perlfaq', - 'DISTRIBUTION' => 'LLAP/perlfaq-5.0150042.tar.gz', - 'FILES' => q[cpan/perlfaq], - 'EXCLUDED' => [ - qw( t/release-pod-syntax.t - t/release-eol.t - t/release-no-tabs.t - ) - ], - 'UPSTREAM' => 'cpan', - }, - - 'File::Basename' => { - 'MAINTAINER' => 'p5p', - 'FILES' => q[lib/File/Basename.{pm,t}], - 'UPSTREAM' => 'blead', - }, - - 'File::Compare' => { - 'MAINTAINER' => 'p5p', - 'FILES' => q[lib/File/Compare.{pm,t}], - 'UPSTREAM' => 'blead', - }, - - 'File::Copy' => { - 'MAINTAINER' => 'p5p', - 'FILES' => q[lib/File/Copy.{pm,t}], - 'UPSTREAM' => 'blead', - }, - - 'File::CheckTree' => { - 'MAINTAINER' => 'p5p', - 'DISTRIBUTION' => 'RJBS/File-CheckTree-4.42.tar.gz', - 'FILES' => q[cpan/File-CheckTree], - 'EXCLUDED' => [qr{^t/release-.*\.t}], - 'UPSTREAM' => 'cpan', - }, - - 'File::DosGlob' => { - 'MAINTAINER' => 'p5p', - 'FILES' => q[ext/File-DosGlob], - 'UPSTREAM' => 'blead', }, 'File::Fetch' => { - 'MAINTAINER' => 'kane', - 'DISTRIBUTION' => 'BINGOS/File-Fetch-0.38.tar.gz', + 'DISTRIBUTION' => 'BINGOS/File-Fetch-0.48.tar.gz', 'FILES' => q[cpan/File-Fetch], - 'UPSTREAM' => 'cpan', - }, - - 'File::Find' => { - 'MAINTAINER' => 'p5p', - 'FILES' => q[lib/File/Find.pm lib/File/Find], - 'UPSTREAM' => 'blead', - }, - - 'File::Glob' => { - 'MAINTAINER' => 'p5p', - 'FILES' => q[ext/File-Glob], - 'UPSTREAM' => 'blead', }, 'File::Path' => { - 'MAINTAINER' => 'dland', 'DISTRIBUTION' => 'DLAND/File-Path-2.09.tar.gz', 'FILES' => q[cpan/File-Path], 'EXCLUDED' => [ @@ -856,53 +534,30 @@ use File::Glob qw(:case); '' => 'cpan/File-Path/lib/File/', 't/' => 'cpan/File-Path/t/', }, - 'UPSTREAM' => undef, - }, - - 'File::stat' => { - 'MAINTAINER' => 'p5p', - 'FILES' => q[lib/File/stat{.pm,*.t}], - 'UPSTREAM' => 'blead', }, 'File::Temp' => { - 'MAINTAINER' => 'tjenness', - 'DISTRIBUTION' => 'TJENNESS/File-Temp-0.23.tar.gz', + 'DISTRIBUTION' => 'DAGOLDEN/File-Temp-0.2304.tar.gz', 'FILES' => q[cpan/File-Temp], 'EXCLUDED' => [ qw( misc/benchmark.pl misc/results.txt ), + qw[t/00-report-prereqs.t], + qr{^xt}, ], - 'UPSTREAM' => 'cpan', - }, - - 'FileCache' => { - 'MAINTAINER' => 'p5p', - 'FILES' => q[ext/FileCache], - 'UPSTREAM' => 'blead', - }, - - 'FileHandle' => { - 'MAINTAINER' => 'p5p', - 'FILES' => q[lib/FileHandle.{pm,t}], - 'UPSTREAM' => 'blead', }, 'Filter::Simple' => { - 'MAINTAINER' => 'smueller', - 'DISTRIBUTION' => 'SMUELLER/Filter-Simple-0.88.tar.gz', + 'DISTRIBUTION' => 'SMUELLER/Filter-Simple-0.91.tar.gz', 'FILES' => q[dist/Filter-Simple], 'EXCLUDED' => [ - 'Makefile.PL', qr{^demo/} ], - 'UPSTREAM' => 'blead', }, 'Filter::Util::Call' => { - 'MAINTAINER' => 'pmqs', - 'DISTRIBUTION' => 'RURBAN/Filter-1.45.tar.gz', + 'DISTRIBUTION' => 'RURBAN/Filter-1.49.tar.gz', 'FILES' => q[cpan/Filter-Util-Call pod/perlfilter.pod ], @@ -920,9 +575,13 @@ use File::Glob qw(:case); t/decrypt.t t/exec.t t/order.t - t/pod.t t/sh.t t/tee.t + t/z_kwalitee.t + t/z_meta.t + t/z_perl_minimum_version.t + t/z_pod-coverage.t + t/z_pod.t ), ], 'MAP' => { @@ -931,30 +590,10 @@ use File::Glob qw(:case); 'perlfilter.pod' => 'pod/perlfilter.pod', '' => 'cpan/Filter-Util-Call/', }, - 'UPSTREAM' => 'cpan', - }, - - 'FindBin' => { - 'MAINTAINER' => 'p5p', - 'FILES' => q[lib/FindBin.{pm,t}], - 'UPSTREAM' => 'blead', - }, - - 'GDBM_File' => { - 'MAINTAINER' => 'p5p', - 'FILES' => q[ext/GDBM_File], - 'UPSTREAM' => 'blead', - }, - - 'Fcntl' => { - 'MAINTAINER' => 'p5p', - 'FILES' => q[ext/Fcntl], - 'UPSTREAM' => 'blead', }, 'Getopt::Long' => { - 'MAINTAINER' => 'jv', - 'DISTRIBUTION' => 'JV/Getopt-Long-2.39.tar.gz', + 'DISTRIBUTION' => 'JV/Getopt-Long-2.42.tar.gz', 'FILES' => q[cpan/Getopt-Long], 'EXCLUDED' => [ qr{^examples/}, @@ -963,30 +602,10 @@ use File::Glob qw(:case); t/gol-compat.t ), ], - 'UPSTREAM' => 'cpan', - }, - - 'Getopt::Std' => { - 'MAINTAINER' => 'p5p', - 'FILES' => q[lib/Getopt/Std.{pm,t}], - 'UPSTREAM' => 'blead', - }, - - 'Hash::Util::FieldHash' => { - 'MAINTAINER' => 'p5p', - 'FILES' => q[ext/Hash-Util-FieldHash], - 'UPSTREAM' => 'blead', - }, - - 'Hash::Util' => { - 'MAINTAINER' => 'p5p', - 'FILES' => q[ext/Hash-Util], - 'UPSTREAM' => 'blead', }, 'HTTP::Tiny' => { - 'MAINTAINER' => 'dagolden', - 'DISTRIBUTION' => 'DAGOLDEN/HTTP-Tiny-0.025.tar.gz', + 'DISTRIBUTION' => 'DAGOLDEN/HTTP-Tiny-0.043.tar.gz', 'FILES' => q[cpan/HTTP-Tiny], 'EXCLUDED' => [ 't/00-report-prereqs.t', @@ -996,100 +615,75 @@ use File::Glob qw(:case); qr/^eg/, qr/^xt/ ], - 'UPSTREAM' => 'cpan', }, 'I18N::Collate' => { - 'MAINTAINER' => 'p5p', 'DISTRIBUTION' => 'FLORA/I18N-Collate-1.02.tar.gz', 'FILES' => q[dist/I18N-Collate], 'EXCLUDED' => [qr{^t/release-.*\.t}], - 'UPSTREAM' => 'blead', }, - 'I18N::Langinfo' => { - 'MAINTAINER' => 'p5p', - 'FILES' => q[ext/I18N-Langinfo], - 'UPSTREAM' => 'blead', - }, - - # Sean has donated it to us. - # Nothing has changed since his last CPAN release. - # (not strictly true: there have been some trivial typo fixes; DAPM 6/2009) 'I18N::LangTags' => { - 'MAINTAINER' => 'p5p', - 'DISTRIBUTION' => 'SBURKE/I18N-LangTags-0.35.tar.gz', 'FILES' => q[dist/I18N-LangTags], - 'UPSTREAM' => 'blead', }, 'if' => { - 'MAINTAINER' => 'ilyaz', 'DISTRIBUTION' => 'ILYAZ/modules/if-0.0601.tar.gz', 'FILES' => q[dist/if], - 'UPSTREAM' => 'blead', }, 'IO' => { - 'MAINTAINER' => 'p5p', 'DISTRIBUTION' => 'GBARR/IO-1.25.tar.gz', 'FILES' => q[dist/IO/], 'EXCLUDED' => ['t/test.pl'], - 'UPSTREAM' => 'blead', }, 'IO-Compress' => { - 'MAINTAINER' => 'pmqs', - 'DISTRIBUTION' => 'PMQS/IO-Compress-2.060.tar.gz', + 'DISTRIBUTION' => 'PMQS/IO-Compress-2.064.tar.gz', 'FILES' => q[cpan/IO-Compress], - 'EXCLUDED' => [qr{t/Test/}], - 'UPSTREAM' => 'cpan', + 'EXCLUDED' => [ + qr{^examples/}, + qr{^t/Test/}, + 't/010examples-bzip2.t', + 't/010examples-zlib.t', + 't/cz-05examples.t', + ], + }, + + 'IO::Socket::IP' => { + 'DISTRIBUTION' => 'PEVANS/IO-Socket-IP-0.29.tar.gz', + 'FILES' => q[cpan/IO-Socket-IP], + 'EXCLUDED' => [ + qr{^examples/}, + ], }, 'IO::Zlib' => { - 'MAINTAINER' => 'tomhughes', 'DISTRIBUTION' => 'TOMHUGHES/IO-Zlib-1.10.tar.gz', 'FILES' => q[cpan/IO-Zlib], - 'UPSTREAM' => undef, }, 'IPC::Cmd' => { - 'MAINTAINER' => 'kane', - 'DISTRIBUTION' => 'BINGOS/IPC-Cmd-0.80.tar.gz', + 'DISTRIBUTION' => 'BINGOS/IPC-Cmd-0.92.tar.gz', 'FILES' => q[cpan/IPC-Cmd], - 'UPSTREAM' => 'cpan', - }, - - 'IPC::Open3' => { - 'MAINTAINER' => 'p5p', - 'FILES' => q[ext/IPC-Open3], - 'UPSTREAM' => 'blead', }, 'IPC::SysV' => { - 'MAINTAINER' => 'mhx', - 'DISTRIBUTION' => 'MHX/IPC-SysV-2.03.tar.gz', + 'DISTRIBUTION' => 'MHX/IPC-SysV-2.04.tar.gz', 'FILES' => q[cpan/IPC-SysV], 'EXCLUDED' => [ qw( const-c.inc const-xs.inc ), ], - 'UPSTREAM' => 'cpan', }, 'JSON::PP' => { - 'MAINTAINER' => 'makamaka', - 'DISTRIBUTION' => 'MAKAMAKA/JSON-PP-2.27202.tar.gz', + 'DISTRIBUTION' => 'MAKAMAKA/JSON-PP-2.27203.tar.gz', 'FILES' => q[cpan/JSON-PP], - 'EXCLUDED' => [ - 't/900_pod.t', # Pod testing - ], - 'UPSTREAM' => 'cpan', }, 'lib' => { - 'MAINTAINER' => 'smueller', 'DISTRIBUTION' => 'SMUELLER/lib-0.63.tar.gz', 'FILES' => q[dist/lib/], 'EXCLUDED' => [ @@ -1097,40 +691,38 @@ use File::Glob qw(:case); t/00pod.t ), ], - 'UPSTREAM' => 'blead', }, 'libnet' => { - 'MAINTAINER' => 'gbarr', - 'DISTRIBUTION' => 'GBARR/libnet-1.22.tar.gz', + 'DISTRIBUTION' => 'SHAY/libnet-1.25.tar.gz', 'FILES' => q[cpan/libnet], 'EXCLUDED' => [ qw( Configure install-nomake - Makefile.PL ), + qr(^demos/), ], + # Customized for perl since we cannot use either an auto-generated + # script or the version in the CPAN distro. 'CUSTOMIZED' => ['Makefile.PL'], - 'UPSTREAM' => undef, }, 'Locale-Codes' => { - 'MAINTAINER' => 'sbeck', - 'DISTRIBUTION' => 'SBECK/Locale-Codes-3.25.tar.gz', + 'DISTRIBUTION' => 'SBECK/Locale-Codes-3.30.tar.gz', 'FILES' => q[cpan/Locale-Codes], 'EXCLUDED' => [ - qw( t/pod_coverage.t + qw( README.first + t/pod_coverage.ign + t/pod_coverage.t t/pod.t), qr{^t/runtests}, qr{^t/runtests\.bat}, qr{^internal/}, qr{^examples/}, ], - 'UPSTREAM' => 'cpan', }, 'Locale::Maketext' => { - 'MAINTAINER' => 'ferreira', 'DISTRIBUTION' => 'TODDR/Locale-Maketext-1.23.tar.gz', 'FILES' => q[dist/Locale-Maketext], 'EXCLUDED' => [ @@ -1140,41 +732,14 @@ use File::Glob qw(:case); t/pod.t ), ], - 'UPSTREAM' => 'blead', }, 'Locale::Maketext::Simple' => { - 'MAINTAINER' => 'audreyt', 'DISTRIBUTION' => 'JESSE/Locale-Maketext-Simple-0.21.tar.gz', 'FILES' => q[cpan/Locale-Maketext-Simple], - 'EXCLUDED' => [qr{^inc/}], - 'UPSTREAM' => 'cpan', - }, - - 'Log::Message' => { - 'MAINTAINER' => 'kane', - 'DISTRIBUTION' => 'BINGOS/Log-Message-0.06.tar.gz', - 'FILES' => q[cpan/Log-Message], - 'UPSTREAM' => 'cpan', - 'DEPRECATED' => '5.017009', - }, - - 'Log::Message::Simple' => { - 'MAINTAINER' => 'kane', - 'DISTRIBUTION' => 'BINGOS/Log-Message-Simple-0.10.tar.gz', - 'FILES' => q[cpan/Log-Message-Simple], - 'UPSTREAM' => 'cpan', - 'DEPRECATED' => '5.017009', - }, - - 'mad' => { - 'MAINTAINER' => 'lwall', - 'FILES' => q[mad], - 'UPSTREAM' => undef, }, 'Math::BigInt' => { - 'MAINTAINER' => 'rafl', 'DISTRIBUTION' => 'PJACKLAM/Math-BigInt-1.997.tar.gz', 'FILES' => q[dist/Math-BigInt], 'EXCLUDED' => [ @@ -1186,11 +751,9 @@ use File::Glob qw(:case); t/03podcov.t ), ], - 'UPSTREAM' => 'blead', }, 'Math::BigInt::FastCalc' => { - 'MAINTAINER' => 'rafl', 'DISTRIBUTION' => 'PJACKLAM/Math-BigInt-FastCalc-0.30.tar.gz', 'FILES' => q[dist/Math-BigInt-FastCalc], 'EXCLUDED' => [ @@ -1211,11 +774,9 @@ use File::Glob qw(:case); t/mbimbf.t ), ], - 'UPSTREAM' => 'blead', }, 'Math::BigRat' => { - 'MAINTAINER' => 'rafl', 'DISTRIBUTION' => 'PJACKLAM/Math-BigRat-0.2602.tar.gz', 'FILES' => q[dist/Math-BigRat], 'EXCLUDED' => [ @@ -1226,11 +787,9 @@ use File::Glob qw(:case); t/03podcov.t ), ], - 'UPSTREAM' => 'blead', }, 'Math::Complex' => { - 'MAINTAINER' => 'zefram', 'DISTRIBUTION' => 'ZEFRAM/Math-Complex-1.59.tar.gz', 'FILES' => q[cpan/Math-Complex], 'EXCLUDED' => [ @@ -1238,23 +797,18 @@ use File::Glob qw(:case); t/pod-coverage.t ), ], - 'UPSTREAM' => 'cpan', }, 'Memoize' => { - 'MAINTAINER' => 'mjd', 'DISTRIBUTION' => 'MJD/Memoize-1.03.tgz', 'FILES' => q[cpan/Memoize], 'EXCLUDED' => ['article.html'], - 'UPSTREAM' => 'cpan', }, 'MIME::Base64' => { - 'MAINTAINER' => 'gaas', - 'DISTRIBUTION' => 'GAAS/MIME-Base64-3.13.tar.gz', + 'DISTRIBUTION' => 'GAAS/MIME-Base64-3.14.tar.gz', 'FILES' => q[cpan/MIME-Base64], 'EXCLUDED' => ['t/bad-sv.t'], - 'UPSTREAM' => 'cpan', }, # @@ -1263,8 +817,7 @@ use File::Glob qw(:case); # 'Module::Build' => { - 'MAINTAINER' => 'kwilliams', - 'DISTRIBUTION' => 'LEONT/Module-Build-0.4003.tar.gz', + 'DISTRIBUTION' => 'LEONT/Module-Build-0.4205.tar.gz', 'FILES' => q[cpan/Module-Build], 'EXCLUDED' => [ qw( t/par.t @@ -1273,323 +826,156 @@ use File::Glob qw(:case); qr{^contrib/}, qr{^inc}, ], + # Generated file, not part of the CPAN distro: 'CUSTOMIZED' => ['lib/Module/Build/ConfigData.pm'], - 'UPSTREAM' => 'cpan', + 'DEPRECATED' => '5.019000', }, 'Module::CoreList' => { - 'MAINTAINER' => 'bingos', - 'DISTRIBUTION' => 'BINGOS/Module-CoreList-2.85.tar.gz', + 'DISTRIBUTION' => 'BINGOS/Module-CoreList-3.10.tar.gz', 'FILES' => q[dist/Module-CoreList], - 'UPSTREAM' => 'blead', }, 'Module::Load' => { - 'MAINTAINER' => 'kane', - 'DISTRIBUTION' => 'BINGOS/Module-Load-0.24.tar.gz', + 'DISTRIBUTION' => 'BINGOS/Module-Load-0.32.tar.gz', 'FILES' => q[cpan/Module-Load], - 'UPSTREAM' => 'cpan', }, 'Module::Load::Conditional' => { - 'MAINTAINER' => 'kane', - 'DISTRIBUTION' => 'BINGOS/Module-Load-Conditional-0.54.tar.gz', + 'DISTRIBUTION' => 'BINGOS/Module-Load-Conditional-0.62.tar.gz', 'FILES' => q[cpan/Module-Load-Conditional], - 'UPSTREAM' => 'cpan', }, 'Module::Loaded' => { - 'MAINTAINER' => 'kane', 'DISTRIBUTION' => 'BINGOS/Module-Loaded-0.08.tar.gz', 'FILES' => q[cpan/Module-Loaded], - 'UPSTREAM' => 'cpan', }, 'Module::Metadata' => { - 'MAINTAINER' => 'dagolden', - 'DISTRIBUTION' => 'APEIRON/Module-Metadata-1.000011.tar.gz', + 'DISTRIBUTION' => 'ETHER/Module-Metadata-1.000019.tar.gz', 'FILES' => q[cpan/Module-Metadata], 'EXCLUDED' => [ qr{^maint}, qr{^xt}, ], - 'UPSTREAM' => 'cpan', - }, - - 'Module::Pluggable' => { - 'MAINTAINER' => 'simonw', - 'DISTRIBUTION' => 'SIMONW/Module-Pluggable-4.7.tar.gz', - 'FILES' => q[cpan/Module-Pluggable], - 'UPSTREAM' => 'cpan', - 'CUSTOMIZED' => ['Makefile.PL'], - 'DEPRECATED' => '5.017009', - }, - - 'mro' => { - 'MAINTAINER' => 'p5p', - 'FILES' => q[ext/mro], - 'UPSTREAM' => 'blead', - }, - - 'NDBM_File' => { - 'MAINTAINER' => 'p5p', - 'FILES' => q[ext/NDBM_File], - 'UPSTREAM' => 'blead', }, 'Net::Ping' => { - 'MAINTAINER' => 'smpeters', 'DISTRIBUTION' => 'SMPETERS/Net-Ping-2.41.tar.gz', 'FILES' => q[dist/Net-Ping], 'EXCLUDED' => [ qr{^.travis.yml}, qr{^README.md}, ], - 'UPSTREAM' => 'blead', }, 'NEXT' => { - 'MAINTAINER' => 'rafl', 'DISTRIBUTION' => 'FLORA/NEXT-0.65.tar.gz', 'FILES' => q[cpan/NEXT], 'EXCLUDED' => [qr{^demo/}], - 'UPSTREAM' => 'cpan', - }, - - 'Object::Accessor' => { - 'MAINTAINER' => 'kane', - 'DISTRIBUTION' => 'BINGOS/Object-Accessor-0.46.tar.gz', - 'FILES' => q[cpan/Object-Accessor], - 'UPSTREAM' => 'cpan', - 'DEPRECATED' => '5.017009', - }, - - 'ODBM_File' => { - 'MAINTAINER' => 'p5p', - 'FILES' => q[ext/ODBM_File], - 'UPSTREAM' => 'blead', - }, - - 'Opcode' => { - 'MAINTAINER' => 'p5p', - 'FILES' => q[ext/Opcode], - 'UPSTREAM' => 'blead', - }, - - 'overload' => { - 'MAINTAINER' => 'p5p', - 'FILES' => q[lib/overload{.pm,.t,64.t}], - 'UPSTREAM' => 'blead', }, 'Package::Constants' => { - 'MAINTAINER' => 'kane', - 'DISTRIBUTION' => 'KANE/Package-Constants-0.02.tar.gz', + 'DISTRIBUTION' => 'BINGOS/Package-Constants-0.04.tar.gz', 'FILES' => q[cpan/Package-Constants], - 'UPSTREAM' => 'cpan', + 'DEPRECATED' => '5.019006', }, 'Params::Check' => { - 'MAINTAINER' => 'kane', - 'DISTRIBUTION' => 'BINGOS/Params-Check-0.36.tar.gz', - 'EXCLUDED' => ['Params-Check-0.26.tar.gz'], + 'DISTRIBUTION' => 'BINGOS/Params-Check-0.38.tar.gz', 'FILES' => q[cpan/Params-Check], - 'UPSTREAM' => 'cpan', }, 'parent' => { - 'MAINTAINER' => 'corion', - 'DISTRIBUTION' => 'CORION/parent-0.225.tar.gz', + 'DISTRIBUTION' => 'CORION/parent-0.228.tar.gz', 'FILES' => q[cpan/parent], - 'UPSTREAM' => undef, }, 'Parse::CPAN::Meta' => { - 'MAINTAINER' => 'dagolden', - 'DISTRIBUTION' => 'DAGOLDEN/Parse-CPAN-Meta-1.4404.tar.gz', + 'DISTRIBUTION' => 'DAGOLDEN/Parse-CPAN-Meta-1.4414.tar.gz', 'FILES' => q[cpan/Parse-CPAN-Meta], - 'UPSTREAM' => 'cpan', + 'EXCLUDED' => [ + qw[t/00-report-prereqs.t], + qr{^xt}, + ], }, 'PathTools' => { - 'MAINTAINER' => 'kwilliams', - 'DISTRIBUTION' => 'SMUELLER/PathTools-3.40.tar.gz', - 'FILES' => q[dist/Cwd], + 'DISTRIBUTION' => 'SMUELLER/PathTools-3.47.tar.gz', + 'FILES' => q[dist/PathTools], 'EXCLUDED' => [qr{^t/lib/Test/}], - 'UPSTREAM' => "blead", - - # NOTE: PathTools is in dist/Cwd/ instead of dist/PathTools because it - # contains Cwd.xs and something, possibly Makefile.SH, makes an assumption - # that the leafname of some file corresponds with the pathname of the - # directory. - }, - - 'perldtrace' => { - 'MAINTAINER' => 'sartak', - 'FILES' => q[pod/perldtrace.pod], - 'UPSTREAM' => 'blead', - }, - - 'perlebcdic' => { - 'MAINTAINER' => 'pvhp', - 'FILES' => q[pod/perlebcdic.pod], - 'UPSTREAM' => undef, }, - 'PerlIO' => { - 'MAINTAINER' => 'p5p', - 'FILES' => q[lib/PerlIO.pm], - 'UPSTREAM' => undef, - }, - - 'PerlIO::encoding' => { - 'MAINTAINER' => 'p5p', - 'FILES' => q[ext/PerlIO-encoding], - 'UPSTREAM' => 'blead', - }, - - 'PerlIO::mmap' => { - 'MAINTAINER' => 'p5p', - 'FILES' => q[ext/PerlIO-mmap], - 'UPSTREAM' => 'blead', - }, - - 'PerlIO::scalar' => { - 'MAINTAINER' => 'p5p', - 'FILES' => q[ext/PerlIO-scalar], - 'UPSTREAM' => 'blead', + 'Perl::OSType' => { + 'DISTRIBUTION' => 'DAGOLDEN/Perl-OSType-1.007.tar.gz', + 'FILES' => q[cpan/Perl-OSType], + 'EXCLUDED' => [qw(tidyall.ini), qr/^xt/, qr{^t/00-}], }, - 'PerlIO::via' => { - 'MAINTAINER' => 'p5p', - 'FILES' => q[ext/PerlIO-via], - 'UPSTREAM' => 'blead', + 'perlfaq' => { + 'DISTRIBUTION' => 'LLAP/perlfaq-5.0150044.tar.gz', + 'FILES' => q[cpan/perlfaq], + 'EXCLUDED' => [ + qw( t/release-pod-syntax.t + t/release-eol.t + t/release-no-tabs.t + ) + ], }, 'PerlIO::via::QuotedPrint' => { - 'MAINTAINER' => 'elizabeth', 'DISTRIBUTION' => 'ELIZABETH/PerlIO-via-QuotedPrint-0.07.tar.gz', 'FILES' => q[cpan/PerlIO-via-QuotedPrint], - 'UPSTREAM' => undef, - }, - 'Perl::OSType' => { - 'MAINTAINER' => 'dagolden', - 'DISTRIBUTION' => 'DAGOLDEN/Perl-OSType-1.003.tar.gz', - 'FILES' => q[cpan/Perl-OSType], - 'EXCLUDED' => [qr/^xt/, qr{^t/00-}], - 'UPSTREAM' => 'cpan', - }, - - 'perlpacktut' => { - 'MAINTAINER' => 'laun', - 'FILES' => q[pod/perlpacktut.pod], - 'UPSTREAM' => undef, - }, - - 'perlpodspec' => { - 'MAINTAINER' => 'sburke', - 'FILES' => q[pod/perlpodspec.pod], - 'UPSTREAM' => undef, - }, - - 'perlre' => { - 'MAINTAINER' => 'abigail', - 'FILES' => q[pod/perlrecharclass.pod - pod/perlrebackslash.pod], - 'UPSTREAM' => undef, - }, - - 'perlreapi' => { - MAINTAINER => 'avar', - FILES => q[pod/perlreapi.pod], - 'UPSTREAM' => undef, - }, - - 'perlreftut' => { - 'MAINTAINER' => 'mjd', - 'FILES' => q[pod/perlreftut.pod], - 'UPSTREAM' => 'blead', - }, + # Waiting to be merged upstream: see CPAN RT#54047 + 'CUSTOMIZED' => [ + qw( t/QuotedPrint.t + ), + ], - 'perlthrtut' => { - 'MAINTAINER' => 'elizabeth', - 'FILES' => q[pod/perlthrtut.pod], - 'UPSTREAM' => undef, }, 'Pod::Checker' => { - 'MAINTAINER' => 'marekr', 'DISTRIBUTION' => 'MAREKR/Pod-Checker-1.60.tar.gz', 'FILES' => q[cpan/Pod-Checker], - 'UPSTREAM' => 'cpan', }, 'Pod::Escapes' => { - 'MAINTAINER' => 'arandal', - 'DISTRIBUTION' => 'SBURKE/Pod-Escapes-1.04.tar.gz', + 'DISTRIBUTION' => 'NEILB/Pod-Escapes-1.06.tar.gz', 'FILES' => q[cpan/Pod-Escapes], - 'UPSTREAM' => undef, - }, - - 'Pod::Functions' => { - 'MAINTAINER' => 'p5p', - 'FILES' => q[ext/Pod-Functions], - 'UPSTREAM' => 'blead', - }, - - 'Pod::Html' => { - 'MAINTAINER' => 'p5p', - 'FILES' => q[ext/Pod-Html], - 'UPSTREAM' => 'blead', - }, - - 'Pod::LaTeX' => { - 'MAINTAINER' => 'tjenness', - 'DISTRIBUTION' => 'TJENNESS/Pod-LaTeX-0.61.tar.gz', - 'FILES' => q[cpan/Pod-LaTeX], - 'EXCLUDED' => ['t/require.t'], - 'UPSTREAM' => undef, - 'DEPRECATED' => '5.017008', }, 'Pod::Parser' => { - 'MAINTAINER' => 'marekr', - 'DISTRIBUTION' => 'MAREKR/Pod-Parser-1.60.tar.gz', + 'DISTRIBUTION' => 'MAREKR/Pod-Parser-1.62.tar.gz', 'FILES' => q[cpan/Pod-Parser], - 'UPSTREAM' => 'cpan', }, 'Pod::Perldoc' => { - 'MAINTAINER' => 'mallen', - 'DISTRIBUTION' => 'MALLEN/Pod-Perldoc-3.19.tar.gz', + 'DISTRIBUTION' => 'MALLEN/Pod-Perldoc-3.23.tar.gz', 'FILES' => q[cpan/Pod-Perldoc], - # in blead, the perldoc executable is generated by perldoc.PL + # Note that we use the CPAN-provided Makefile.PL, since it + # contains special handling of the installation of perldoc.pod + + # In blead, the perldoc executable is generated by perldoc.PL # instead # XXX We can and should fix this, but clean up the DRY-failure in utils # first 'EXCLUDED' => ['perldoc'], - 'UPSTREAM' => 'cpan', }, 'Pod::Simple' => { - 'MAINTAINER' => 'arandal', 'DISTRIBUTION' => 'DWHEELER/Pod-Simple-3.28.tar.gz', 'FILES' => q[cpan/Pod-Simple], - 'UPSTREAM' => 'cpan', }, 'Pod::Usage' => { - 'MAINTAINER' => 'marekr', - 'DISTRIBUTION' => 'MAREKR/Pod-Usage-1.61.tar.gz', + 'DISTRIBUTION' => 'MAREKR/Pod-Usage-1.63.tar.gz', 'FILES' => q[cpan/Pod-Usage], - 'UPSTREAM' => 'cpan', }, 'podlators' => { - 'MAINTAINER' => 'rra', - 'DISTRIBUTION' => 'RRA/podlators-2.5.1.tar.gz', + 'DISTRIBUTION' => 'RRA/podlators-2.5.3.tar.gz', 'FILES' => q[cpan/podlators pod/perlpodstyle.pod], # The perl distribution has pod2man.PL and pod2text.PL, which are @@ -1609,98 +995,46 @@ use File::Glob qw(:case); # this file lives outside the cpan/ directory 'pod/perlpodstyle.pod' => 'pod/perlpodstyle.pod', }, - 'UPSTREAM' => 'cpan', - }, - - 'POSIX' => { - 'MAINTAINER' => 'p5p', - 'FILES' => q[ext/POSIX], - 'UPSTREAM' => 'blead', - }, - - 're' => { - 'MAINTAINER' => 'p5p', - 'FILES' => q[ext/re], - 'UPSTREAM' => 'blead', }, 'Safe' => { - 'MAINTAINER' => 'rgarcia', 'DISTRIBUTION' => 'RGARCIA/Safe-2.35.tar.gz', 'FILES' => q[dist/Safe], - 'UPSTREAM' => 'blead', }, 'Scalar-List-Utils' => { - 'MAINTAINER' => 'gbarr', - 'DISTRIBUTION' => 'PEVANS/Scalar-List-Utils-1.27.tar.gz', - - # Note that perl uses its own version of Makefile.PL - 'FILES' => q[cpan/List-Util], - 'EXCLUDED' => [ - qr{^inc/Module/}, - qr{^inc/Test/}, - 'mytypemap', - ], - 'UPSTREAM' => 'cpan', - }, - - 'SDBM_File' => { - 'MAINTAINER' => 'p5p', - 'FILES' => q[ext/SDBM_File], - 'UPSTREAM' => 'blead', + 'DISTRIBUTION' => 'PEVANS/Scalar-List-Utils-1.38.tar.gz', + 'FILES' => q[cpan/Scalar-List-Utils], }, 'Search::Dict' => { - 'MAINTAINER' => 'p5p', 'DISTRIBUTION' => 'DAGOLDEN/Search-Dict-1.07.tar.gz', 'FILES' => q[dist/Search-Dict], - 'EXCLUDED' => [qr{^t/release-.*\.t},qr{^README\..*}], - 'UPSTREAM' => 'blead', }, 'SelfLoader' => { - 'MAINTAINER' => 'smueller', 'DISTRIBUTION' => 'SMUELLER/SelfLoader-1.20.tar.gz', 'FILES' => q[dist/SelfLoader], 'EXCLUDED' => ['t/00pod.t'], - 'UPSTREAM' => 'blead', - }, - - 'sigtrap' => { - 'MAINTAINER' => 'p5p', - 'FILES' => q[lib/sigtrap.{pm,t}], - 'UPSTREAM' => 'blead', }, 'Socket' => { - 'MAINTAINER' => 'pevans', - 'DISTRIBUTION' => 'PEVANS/Socket-2.009.tar.gz', + 'DISTRIBUTION' => 'PEVANS/Socket-2.013.tar.gz', 'FILES' => q[cpan/Socket], - 'UPSTREAM' => 'cpan', }, 'Storable' => { - 'MAINTAINER' => 'ams', - 'DISTRIBUTION' => 'AMS/Storable-2.39.tar.gz', + 'DISTRIBUTION' => 'AMS/Storable-2.45.tar.gz', 'FILES' => q[dist/Storable], - 'EXCLUDED' => [qr{^t/Test/}], - 'UPSTREAM' => 'blead', - }, - - 'Sys::Hostname' => { - 'MAINTAINER' => 'p5p', - 'FILES' => q[ext/Sys-Hostname], - 'UPSTREAM' => 'blead', }, 'Sys::Syslog' => { - 'MAINTAINER' => 'saper', - 'DISTRIBUTION' => 'SAPER/Sys-Syslog-0.32.tar.gz', + 'DISTRIBUTION' => 'SAPER/Sys-Syslog-0.33.tar.gz', 'FILES' => q[cpan/Sys-Syslog], 'EXCLUDED' => [ qr{^eg/}, - qw( t/data-validation.t + qw( README.win32 + t/data-validation.t t/distchk.t t/pod.t t/podcover.t @@ -1709,15 +1043,12 @@ use File::Glob qw(:case); win32/PerlLog.RES ), ], - 'UPSTREAM' => 'cpan', }, 'Term::ANSIColor' => { - 'MAINTAINER' => 'rra', 'DISTRIBUTION' => 'RRA/Term-ANSIColor-4.02.tar.gz', 'FILES' => q[cpan/Term-ANSIColor], 'EXCLUDED' => [ - qr{^tests/}, qr{^examples/}, qr{^t/data/}, qw( t/aliases-env.t @@ -1730,50 +1061,32 @@ use File::Glob qw(:case); t/synopsis.t ), ], - 'UPSTREAM' => 'cpan', }, 'Term::Cap' => { - 'MAINTAINER' => 'jstowe', - 'DISTRIBUTION' => 'JSTOWE/Term-Cap-1.12.tar.gz', + 'DISTRIBUTION' => 'JSTOWE/Term-Cap-1.15.tar.gz', 'FILES' => q[cpan/Term-Cap], - 'UPSTREAM' => undef, }, 'Term::Complete' => { - 'MAINTAINER' => 'p5p', 'DISTRIBUTION' => 'FLORA/Term-Complete-1.402.tar.gz', 'FILES' => q[dist/Term-Complete], 'EXCLUDED' => [qr{^t/release-.*\.t}], - 'UPSTREAM' => 'blead', }, 'Term::ReadLine' => { - 'MAINTAINER' => 'p5p', - 'DISTRIBUTION' => 'FLORA/Term-ReadLine-1.10.tar.gz', + 'DISTRIBUTION' => 'FLORA/Term-ReadLine-1.14.tar.gz', 'FILES' => q[dist/Term-ReadLine], 'EXCLUDED' => [qr{^t/release-.*\.t}], - 'UPSTREAM' => 'blead', - }, - - 'Term::UI' => { - 'MAINTAINER' => 'kane', - 'DISTRIBUTION' => 'BINGOS/Term-UI-0.34.tar.gz', - 'FILES' => q[cpan/Term-UI], - 'UPSTREAM' => 'cpan', - 'DEPRECATED' => '5.017009', }, 'Test' => { - 'MAINTAINER' => 'jesse', 'DISTRIBUTION' => 'JESSE/Test-1.26.tar.gz', 'FILES' => q[cpan/Test], - 'UPSTREAM' => 'cpan', }, 'Test::Harness' => { - 'MAINTAINER' => 'andya', - 'DISTRIBUTION' => 'OVID/Test-Harness-3.26.tar.gz', + 'DISTRIBUTION' => 'LEONT/Test-Harness-3.30.tar.gz', 'FILES' => q[cpan/Test-Harness], 'EXCLUDED' => [ qr{^examples/}, @@ -1781,23 +1094,25 @@ use File::Glob qw(:case); qr{^t/lib/Test/}, qr{^xt/}, qw( Changes-2.64 + MANIFEST.CUMMULATIVE NotBuild.PL HACKING.pod perlcriticrc + t/000-load.t t/lib/if.pm ), ], - 'CUSTOMIZED' => [ 't/source.t' ], - 'UPSTREAM' => 'cpan', }, 'Test::Simple' => { - 'MAINTAINER' => 'mschwern', - 'DISTRIBUTION' => 'MSCHWERN/Test-Simple-0.98.tar.gz', + 'DISTRIBUTION' => 'RJBS/Test-Simple-1.001002.tar.gz', 'FILES' => q[cpan/Test-Simple], 'EXCLUDED' => [ + qr{^t/xt}, qw( .perlcriticrc .perltidyrc + examples/indent.pl + examples/subtest.t t/00compile.t t/pod.t t/pod-coverage.t @@ -1805,19 +1120,15 @@ use File::Glob qw(:case); lib/Test/Builder/IO/Scalar.pm ), ], - 'UPSTREAM' => 'cpan', }, 'Text::Abbrev' => { - 'MAINTAINER' => 'p5p', 'DISTRIBUTION' => 'FLORA/Text-Abbrev-1.02.tar.gz', 'FILES' => q[dist/Text-Abbrev], 'EXCLUDED' => [qr{^t/release-.*\.t}], - 'UPSTREAM' => 'blead', }, 'Text::Balanced' => { - 'MAINTAINER' => 'dmanura', 'DISTRIBUTION' => 'ADAMK/Text-Balanced-2.02.tar.gz', 'FILES' => q[cpan/Text-Balanced], 'EXCLUDED' => [ @@ -1826,6 +1137,8 @@ use File::Glob qw(:case); t/99_pmv.t ), ], + + # Waiting to be merged upstream: see CPAN RT#87788 'CUSTOMIZED' => [ qw( t/01_compile.t t/02_extbrk.t @@ -1838,40 +1151,28 @@ use File::Glob qw(:case); t/09_gentag.t ), ], - 'UPSTREAM' => 'cpan', + }, 'Text::ParseWords' => { - 'MAINTAINER' => 'chorny', - 'DISTRIBUTION' => 'CHORNY/Text-ParseWords-3.28.tar.gz', + 'DISTRIBUTION' => 'CHORNY/Text-ParseWords-3.29.tar.gz', 'FILES' => q[cpan/Text-ParseWords], - 'EXCLUDED' => ['t/pod.t'], + + # Waiting to be merged upstream: see CPAN RT#50929 + 'CUSTOMIZED' => [ + qw( t/ParseWords.t + t/taint.t + ), + ], # For the benefit of make_ext.pl, we have to have this accessible: 'MAP' => { 'ParseWords.pm' => 'cpan/Text-ParseWords/lib/Text/ParseWords.pm', '' => 'cpan/Text-ParseWords/', }, - 'UPSTREAM' => undef, - }, - - 'Text::Soundex' => { - 'MAINTAINER' => 'markm', - 'DISTRIBUTION' => 'RJBS/Text-Soundex-3.04.tar.gz', - 'FILES' => q[cpan/Text-Soundex], - 'MAP' => { - '' => 'cpan/Text-Soundex/', - - # XXX these two files are clearly related, - # but they appear to have diverged - # considerably over the years - 'test.pl' => 'cpan/Text-Soundex/t/Soundex.t', - }, - 'UPSTREAM' => undef, }, 'Text-Tabs+Wrap' => { - 'MAINTAINER' => 'muir', 'DISTRIBUTION' => 'MUIR/modules/Text-Tabs+Wrap-2013.0523.tar.gz', 'FILES' => q[cpan/Text-Tabs], 'EXCLUDED' => [ @@ -1883,12 +1184,14 @@ use File::Glob qw(:case); 'lib.modern/Text/Tabs.pm' => 'cpan/Text-Tabs/lib/Text/Tabs.pm', 'lib.modern/Text/Wrap.pm' => 'cpan/Text-Tabs/lib/Text/Wrap.pm', }, - 'UPSTREAM' => 'cpan', }, + # Jerry Hedden does take patches that are applied to blead first, even + # though that can be hard to discern from the Git history; so it's + # correct for this (and Thread::Semaphore, threads, and threads::shared) + # to be under dist/ rather than cpan/ 'Thread::Queue' => { - 'MAINTAINER' => 'jdhedden', - 'DISTRIBUTION' => 'JDHEDDEN/Thread-Queue-3.02.tar.gz', + 'DISTRIBUTION' => 'JDHEDDEN/Thread-Queue-3.05.tar.gz', 'FILES' => q[dist/Thread-Queue], 'EXCLUDED' => [ qr{^examples/}, @@ -1897,11 +1200,9 @@ use File::Glob qw(:case); t/test.pl ), ], - 'UPSTREAM' => 'blead', }, 'Thread::Semaphore' => { - 'MAINTAINER' => 'jdhedden', 'DISTRIBUTION' => 'JDHEDDEN/Thread-Semaphore-2.12.tar.gz', 'FILES' => q[dist/Thread-Semaphore], 'EXCLUDED' => [ @@ -1911,12 +1212,10 @@ use File::Glob qw(:case); t/test.pl ), ], - 'UPSTREAM' => 'blead', }, 'threads' => { - 'MAINTAINER' => 'jdhedden', - 'DISTRIBUTION' => 'JDHEDDEN/threads-1.86.tar.gz', + 'DISTRIBUTION' => 'JDHEDDEN/threads-1.92.tar.gz', 'FILES' => q[dist/threads], 'EXCLUDED' => [ qr{^examples/}, @@ -1925,12 +1224,10 @@ use File::Glob qw(:case); threads.h ), ], - 'UPSTREAM' => 'blead', }, 'threads::shared' => { - 'MAINTAINER' => 'jdhedden', - 'DISTRIBUTION' => 'JDHEDDEN/threads-shared-1.43.tar.gz', + 'DISTRIBUTION' => 'JDHEDDEN/threads-shared-1.46.tar.gz', 'FILES' => q[dist/threads-shared], 'EXCLUDED' => [ qw( examples/class.pl @@ -1939,71 +1236,38 @@ use File::Glob qw(:case); t/test.pl ), ], - 'UPSTREAM' => 'blead', }, 'Tie::File' => { - 'MAINTAINER' => 'mjd', 'DISTRIBUTION' => 'TODDR/Tie-File-0.98.tar.gz', 'FILES' => q[dist/Tie-File], - 'UPSTREAM' => 'blead', - }, - - 'Tie::Hash' => { - 'MAINTAINER' => 'p5p', - 'FILES' => q[lib/Tie/Hash.{pm,t}], - 'UPSTREAM' => 'blead', - }, - - 'Tie::Hash::NamedCapture' => { - 'MAINTAINER' => 'p5p', - 'FILES' => q[ext/Tie-Hash-NamedCapture], - 'UPSTREAM' => 'blead', - }, - - 'Tie::Memoize' => { - 'MAINTAINER' => 'p5p', - 'FILES' => q[ext/Tie-Memoize], - 'UPSTREAM' => 'blead', }, 'Tie::RefHash' => { - 'MAINTAINER' => 'nuffin', 'DISTRIBUTION' => 'FLORA/Tie-RefHash-1.39.tar.gz', 'FILES' => q[cpan/Tie-RefHash], - 'UPSTREAM' => 'cpan', }, 'Time::HiRes' => { - 'MAINTAINER' => 'zefram', - 'DISTRIBUTION' => 'ZEFRAM/Time-HiRes-1.9725.tar.gz', + 'DISTRIBUTION' => 'ZEFRAM/Time-HiRes-1.9726.tar.gz', 'FILES' => q[cpan/Time-HiRes], - 'UPSTREAM' => 'cpan', }, 'Time::Local' => { - 'MAINTAINER' => 'drolsky', 'DISTRIBUTION' => 'DROLSKY/Time-Local-1.2300.tar.gz', 'FILES' => q[cpan/Time-Local], 'EXCLUDED' => [ - qw( t/pod-coverage.t - t/pod.t - ), qr{^t/release-.*\.t}, ], - 'UPSTREAM' => 'cpan', }, 'Time::Piece' => { - 'MAINTAINER' => 'msergeant', - 'DISTRIBUTION' => 'MSERGEANT/Time-Piece-1.20.tar.gz', + 'DISTRIBUTION' => 'RJBS/Time-Piece-1.27.tar.gz', 'FILES' => q[cpan/Time-Piece], - 'UPSTREAM' => undef, }, 'Unicode::Collate' => { - 'MAINTAINER' => 'sadahiro', - 'DISTRIBUTION' => 'SADAHIRO/Unicode-Collate-0.97.tar.gz', + 'DISTRIBUTION' => 'SADAHIRO/Unicode-Collate-1.04.tar.gz', 'FILES' => q[cpan/Unicode-Collate], 'EXCLUDED' => [ qr{N$}, @@ -2014,12 +1278,10 @@ use File::Glob qw(:case); mklocale ), ], - 'UPSTREAM' => 'first-come', }, 'Unicode::Normalize' => { - 'MAINTAINER' => 'sadahiro', - 'DISTRIBUTION' => 'SADAHIRO/Unicode-Normalize-1.16.tar.gz', + 'DISTRIBUTION' => 'SADAHIRO/Unicode-Normalize-1.17.tar.gz', 'FILES' => q[cpan/Unicode-Normalize], 'EXCLUDED' => [ qw( MANIFEST.N @@ -2028,111 +1290,71 @@ use File::Glob qw(:case); enableXS ), ], - 'UPSTREAM' => 'first-come', - }, - - 'Unicode::UCD' => { - 'MAINTAINER' => 'blead', - 'FILES' => q[lib/Unicode/UCD.{pm,t}], - 'UPSTREAM' => 'blead', }, 'version' => { - 'MAINTAINER' => 'jpeacock', - 'DISTRIBUTION' => 'JPEACOCK/version-0.9902.tar.gz', - 'FILES' => q[lib/version.pm lib/version.pod lib/version], + 'DISTRIBUTION' => 'JPEACOCK/version-0.9909.tar.gz', + 'FILES' => q[cpan/version vutil.c vutil.h vxs.inc], 'EXCLUDED' => [ - qr{^t/.*\.t$}, - qr{^vutil/}, - 'lib/version/typemap', + qr{^vutil/lib/}, + 'vutil/Makefile.PL', + 'vutil/ppport.h', + 'vutil/vxs.xs', 't/survey_locales', - 'vperl/vpp.pm', ], - 'MAP' => { - 'lib/' => 'lib/', - 't/' => 'lib/version/t/' - }, - 'UPSTREAM' => undef, - }, - 'vms' => { - 'MAINTAINER' => 'craig', - 'FILES' => q[vms configure.com README.vms], - 'UPSTREAM' => undef, - }, - - 'VMS::DCLsym' => { - 'MAINTAINER' => 'craig', - 'FILES' => q[ext/VMS-DCLsym], - 'UPSTREAM' => undef, - }, + # When adding the CPAN-distributed files for version.pm, it is necessary + # to delete an entire block out of lib/version.pm, since that code is + # only necessary with the CPAN release. + 'CUSTOMIZED' => [ + qw( lib/version.pm + ), + ], - 'VMS::Stdio' => { - 'MAINTAINER' => 'craig', - 'FILES' => q[ext/VMS-Stdio], - 'UPSTREAM' => undef, + 'MAP' => { + 'vperl/' => 'cpan/version/lib/version/', + 'vutil/' => '', + '' => 'cpan/version/', + }, }, 'warnings' => { - 'MAINTAINER' => 'pmqs', - 'FILES' => q[regen/warnings.pl - lib/warnings.{pm,t} + 'FILES' => q[ lib/warnings + lib/warnings.{pm,t} + regen/warnings.pl t/lib/warnings - ], - 'UPSTREAM' => 'blead', - }, - - 'win32' => { - 'MAINTAINER' => 'jand', - 'FILES' => q[win32 t/win32 README.win32 ext/Win32CORE], - 'UPSTREAM' => undef, + ], }, 'Win32' => { - 'MAINTAINER' => 'jand', - 'DISTRIBUTION' => "JDB/Win32-0.47.tar.gz", + 'DISTRIBUTION' => "JDB/Win32-0.49.tar.gz", 'FILES' => q[cpan/Win32], - 'UPSTREAM' => 'cpan', }, 'Win32API::File' => { - 'MAINTAINER' => 'chorny', 'DISTRIBUTION' => 'CHORNY/Win32API-File-0.1201.tar.gz', 'FILES' => q[cpan/Win32API-File], 'EXCLUDED' => [ qr{^ex/}, 't/pod.t', ], - 'UPSTREAM' => 'cpan', - }, - - 'XS::Typemap' => { - 'MAINTAINER' => 'p5p', - 'FILES' => q[ext/XS-Typemap], - 'UPSTREAM' => 'blead', }, 'XSLoader' => { - 'MAINTAINER' => 'saper', 'DISTRIBUTION' => 'SAPER/XSLoader-0.16.tar.gz', 'FILES' => q[dist/XSLoader], 'EXCLUDED' => [ qr{^eg/}, - qw( t/pod.t + qw( t/00-load.t + t/01-api.t + t/distchk.t + t/pod.t t/podcover.t t/portfs.t ), 'XSLoader.pm', # we use XSLoader_pm.PL ], - # Revert UPSTREAM to 'blead' after 0.17 is released - 'UPSTREAM' => undef, - }, - - 's2p' => { - 'MAINTAINER' => 'laun', - 'FILES' => q[x2p/s2p.PL], - 'UPSTREAM' => undef, }, # this pseudo-module represents all the files under ext/ and lib/ @@ -2144,23 +1366,75 @@ use File::Glob qw(:case); # perl Porting/Maintainers --checkmani '_PERLLIB' => { - 'MAINTAINER' => 'p5p', - 'FILES' => q[ - ext/arybase/ + 'FILES' => q[ + ext/B/ + ext/Devel-Peek/ + ext/DynaLoader/ + ext/Errno/ + ext/ExtUtils-Miniperl/ + ext/Fcntl/ + ext/File-DosGlob/ + ext/File-Find/ + ext/File-Glob/ + ext/FileCache/ + ext/GDBM_File/ + ext/Hash-Util-FieldHash/ + ext/Hash-Util/ + ext/I18N-Langinfo/ + ext/IPC-Open3/ + ext/NDBM_File/ + ext/ODBM_File/ + ext/Opcode/ + ext/POSIX/ + ext/PerlIO-encoding/ + ext/PerlIO-mmap/ + ext/PerlIO-scalar/ + ext/PerlIO-via/ + ext/Pod-Functions/ + ext/Pod-Html/ + ext/SDBM_File/ + ext/Sys-Hostname/ + ext/Tie-Hash-NamedCapture/ + ext/Tie-Memoize/ + ext/VMS-DCLsym/ + ext/VMS-Filespec/ + ext/VMS-Stdio/ + ext/Win32CORE/ ext/XS-APItest/ + ext/XS-Typemap/ + ext/arybase/ + ext/attributes/ + ext/mro/ + ext/re/ + lib/AnyDBM_File.{pm,t} + lib/Benchmark.{pm,t} + lib/B/Deparse{.pm,.t,-core.t} lib/CORE.pod + lib/Class/Struct.{pm,t} lib/Config.t lib/Config/Extensions.{pm,t} lib/DB.{pm,t} + lib/DBM_Filter.pm + lib/DBM_Filter/ + lib/DirHandle.{pm,t} + lib/English.{pm,t} lib/ExtUtils/Embed.pm lib/ExtUtils/XSSymSet.pm lib/ExtUtils/t/Embed.t lib/ExtUtils/typemap + lib/File/Basename.{pm,t} + lib/File/Compare.{pm,t} + lib/File/Copy.{pm,t} + lib/File/stat{.pm,.t,-7896.t} + lib/FileHandle.{pm,t} + lib/FindBin.{pm,t} + lib/Getopt/Std.{pm,t} lib/Internals.t lib/Net/hostent.{pm,t} lib/Net/netent.{pm,t} lib/Net/protoent.{pm,t} lib/Net/servent.{pm,t} + lib/PerlIO.pm lib/Pod/t/InputObjects.t lib/Pod/t/Select.t lib/Pod/t/Usage.t @@ -2173,6 +1447,7 @@ use File::Glob qw(:case); lib/Tie/ExtraHash.t lib/Tie/Handle.pm lib/Tie/Handle/ + lib/Tie/Hash.{pm,t} lib/Tie/Scalar.{pm,t} lib/Tie/StdHandle.pm lib/Tie/SubstrHash.{pm,t} @@ -2181,15 +1456,17 @@ use File::Glob qw(:case); lib/Time/tm.pm lib/UNIVERSAL.pm lib/Unicode/README + lib/Unicode/UCD.{pm,t} lib/User/grent.{pm,t} lib/User/pwent.{pm,t} + lib/_charnames.pm lib/blib.{pm,t} lib/bytes.{pm,t} lib/bytes_heavy.pl - lib/_charnames.pm lib/charnames.{pm,t} lib/dbm_filter_util.pl lib/deprecate.pm + lib/diagnostics.{pm,t} lib/dumpvar.{pl,t} lib/feature.{pm,t} lib/feature/ @@ -2202,8 +1479,10 @@ use File::Glob qw(:case); lib/open.{pm,t} lib/overload/numbers.pm lib/overloading.{pm,t} + lib/overload{.pm,.t,64.t} lib/perl5db.{pl,t} lib/perl5db/ + lib/sigtrap.{pm,t} lib/sort.{pm,t} lib/strict.{pm,t} lib/subs.{pm,t} @@ -2213,19 +1492,50 @@ use File::Glob qw(:case); lib/vars{.pm,.t,_carp.t} lib/vmsish.{pm,t} ], - 'UPSTREAM' => 'blead', }, - 'openbsd' => { - 'MAINTAINER' => 'afresh1', 'FILES' => q[lib/Config_git.pl], - 'UPSTREAM' => undef, }, ); # legacy CPAN flag for ( values %Modules ) { $_->{CPAN} = !!$_->{DISTRIBUTION}; +} + +# legacy UPSTREAM flag +for ( keys %Modules ) { + # Keep any existing UPSTREAM flag so that "overrides" can be applied + next if exists $Modules{$_}{UPSTREAM}; + + if ($_ eq '_PERLLIB' or $Modules{$_}{FILES} =~ m{^\s*(?:dist|ext|lib)/}) { + $Modules{$_}{UPSTREAM} = 'blead'; + } + elsif ($Modules{$_}{FILES} =~ m{^\s*cpan/}) { + $Modules{$_}{UPSTREAM} = 'cpan'; + } + else { + warn "Unexpected location of FILES for module $_: $Modules{$_}{FILES}"; + } +} + +# legacy MAINTAINER field +for ( keys %Modules ) { + # Keep any existing MAINTAINER flag so that "overrides" can be applied + next if exists $Modules{$_}{MAINTAINER}; + + if ($Modules{$_}{UPSTREAM} eq 'blead') { + $Modules{$_}{MAINTAINER} = 'P5P'; + $Maintainers{P5P} = 'perl5-porters '; + } + elsif (exists $Modules{$_}{DISTRIBUTION}) { + (my $pause_id = $Modules{$_}{DISTRIBUTION}) =~ s{/.*$}{}; + $Modules{$_}{MAINTAINER} = $pause_id; + $Maintainers{$pause_id} = "<$pause_id\@cpan.org>"; + } + else { + warn "No DISTRIBUTION for non-blead module $_"; + } } 1; Index: gnu/usr.bin/perl/Porting/Maintainers.pm =================================================================== RCS file: /mnt/memory/perl/importit/cvs/src/gnu/usr.bin/perl/Porting/Maintainers.pm,v retrieving revision 1.1.1.7 diff -u -p -u -p -r1.1.1.7 Maintainers.pm --- gnu/usr.bin/perl/Porting/Maintainers.pm 24 Mar 2014 14:59:09 -0000 1.1.1.7 +++ gnu/usr.bin/perl/Porting/Maintainers.pm 16 Nov 2014 03:22:23 -0000 @@ -22,7 +22,7 @@ use vars qw(@ISA @EXPORT_OK $VERSION); show_results process_options files_to_modules finish_tap_output reload_manifest); -$VERSION = 0.09; +$VERSION = 0.10; require Exporter; @@ -64,7 +64,7 @@ sub get_module_pat { split ' ', $Modules{$m}{FILES}; } -# exand dir/ or foo* into a full list of files +# expand dir/ or foo* into a full list of files # sub expand_glob { sort { lc $a cmp lc $b } @@ -236,7 +236,7 @@ sub files_to_modules { if (@ToDo) { # Try prefix matching. - # Need to try longst prefixes first, else lib/CPAN may match + # Need to try longest prefixes first, else lib/CPAN may match # lib/CPANPLUS/... and similar my @OrderedModuleByPat Index: gnu/usr.bin/perl/Porting/README.pod =================================================================== RCS file: /mnt/memory/perl/importit/cvs/src/gnu/usr.bin/perl/Porting/README.pod,v retrieving revision 1.1.1.1 diff -u -p -u -p -r1.1.1.1 README.pod --- gnu/usr.bin/perl/Porting/README.pod 24 Mar 2014 14:59:09 -0000 1.1.1.1 +++ gnu/usr.bin/perl/Porting/README.pod 16 Nov 2014 03:22:23 -0000 @@ -16,7 +16,7 @@ text. Program to prepare dual-life distributions for insertion into the Perl 5 F and F directories. Now thought to be largely superseded. -=head2 F, F and F +=head2 F, F and F Use C to pinpoint changes. @@ -30,23 +30,14 @@ number in various files within the perl Performs pathname portability checks, including whether there are naming conflicts when names are truncated to the DOSish, case-ignoring 8.3 format. -=head2 F - -Used by F to ensure the F list is up to date. - -=head2 F - -Checks that all the URLs in the Perl source are valid. - -=head2 F - -Used by F to ensure changed modules have had their -versions updated. - =head2 F Check source code for ANSI-C violations. +=head2 F + +Used by F to ensure the F list is up to date. + =head2 F Check that the various F-clones have (at least) all the same @@ -69,6 +60,15 @@ F). Check if POD files contain non-ASCII without specifying encoding. Run it as: C. +=head2 F + +Checks that all the URLs in the Perl source are valid. + +=head2 F + +Used by F to ensure changed modules have had their +versions updated. + =head2 F Command line tool to update cherrymaint; a tool for selecting commits from @@ -114,16 +114,16 @@ same version than the corresponding modu Prints a table of differences between two Perl versions with respect to modules included in the distribution. -=head2 F - -Generates info for Module::CoreList from this perl tree. - =head2 F Generates a list of the module changes for the Perl you are currently building. Also generates a diff between the corelist sections of two F files. +=head2 F + +Generates info for Module::CoreList from this perl tree. + =head2 F List of Perl release epigraphs. @@ -146,13 +146,6 @@ Expand C macros using the C preprocessor This script finds reentrant variants of functions used in an executable and shared objects. -=head2 F - -This script contains the subroutine to generate a F<.patch file> for a -committish (the SHA1 checksum of a commit, a number made of 40 hexadecimal -digits which acts the internal unique identifier for this commit -(lilypond.org). Related file: F - =head2 F This script, a rough draft, aids in generating a perldelta file @@ -167,6 +160,13 @@ id. This script creates a tag for every p4raw-id. +=head2 F + +This script contains the subroutine to generate a F<.patch file> for a +committish (the SHA1 checksum of a commit, a number made of 40 hexadecimal +digits which acts the internal unique identifier for this commit +(lilypond.org). Related file: F + =head2 F This file is built by F. This file contains a description of all @@ -201,31 +201,31 @@ F, F A package to search and show information about which core files/modules are associated with maintainers. Related files: F, F -=head2 F - -This script creates a release checklist as a simple HTML document. - =head2 F Generate a F<.patch> file to STDOUT for a commit ID specified on the command-line. +=head2 F + +This script creates F and F files. + =head2 F This script generates the list of registered CPAN sites in F. -=head2 F +=head2 F -This script is a quick and dirty snapshot generator for the perl5.git.perl.org -web page to use to generate the snapshot files. +This script builds a Perl release tarball. -=head2 F +=head2 F -This script creates F and F files. +This script creates a release checklist as a simple HTML document. -=head2 F +=head2 F -This script builds a Perl release tarball. +This script is a quick and dirty snapshot generator for the perl5.git.perl.org +web page to use to generate the snapshot files. =head2 F @@ -279,6 +279,13 @@ Pumpkin - Notes on handling the Perl Pat Many of these are out of date or superseded by other documents in this directory. +=head2 F + +This file. An exhaustive list of the contents of the F +directory along with a description of each file. +The test F ensures that this lists every file +and that every file is listed. + =head2 F The y2038 implementation for perl. This is an implementation of POSIX time.h @@ -288,7 +295,7 @@ L. =head2 F -Release announcment for minor releasements of the 5.17 development series. +Release announcement for minor releasements of the 5.19 development series. =head2 F @@ -312,18 +319,9 @@ This is a script for sorting the warning F. POD formatting, printf-style escapes, non-letter characters, and case are ignored, as explained in L. -=head2 F - -Test suite profiling on Tru 64. - -=head2 F - -Script for cleaning out the "known noise" from Third Degree reports: either -noise caused by F itself, or F leaks. - -=head2 F on CPAN (on a fast mirror) to ensure that links to -the new tarballs have appeared. There should be links in C -(which is accumulating all new versions), and an appropriate mention in -C (which describes the latest versions in each branch, with links). +the new tarballs have appeared: There should be links in C +(which is accumulating all new versions), and (for BLEAD-FINAL and +MAINT only) an appropriate mention in C (which describes +the latest versions in each stable branch, with links). -These links should appear automatically, some hours after upload. +The C links should appear automatically, some hours after upload. If they don't, or the C description is inadequate, ask Ask . @@ -1335,6 +1426,12 @@ and you cannot cajole anybody else into mail Leo as last resort. This repository can be found on L. + +=head3 update release manager's guide + +Go over your notes from the release (you did take some, right?) and update +F with any fixes or information that +will make life easier for the next release manager. =for checklist end Index: gnu/usr.bin/perl/Porting/release_schedule.pod =================================================================== RCS file: /mnt/memory/perl/importit/cvs/src/gnu/usr.bin/perl/Porting/release_schedule.pod,v retrieving revision 1.1.1.3 diff -u -p -u -p -r1.1.1.3 release_schedule.pod --- gnu/usr.bin/perl/Porting/release_schedule.pod 24 Mar 2014 14:59:09 -0000 1.1.1.3 +++ gnu/usr.bin/perl/Porting/release_schedule.pod 16 Nov 2014 03:22:23 -0000 @@ -1,5 +1,9 @@ =encoding utf8 +=head1 NAME + +release_schedule - Perl 5 release schedule + =head1 STABLE RELEASE SCHEDULE This schedule lists the projected or historical development and @@ -7,19 +11,22 @@ release schedules for the next, current of Perl. Dates with all question marks will only be releases if deemed necessary by the Pumpking. -=head2 Perl 5.18 +=head2 Perl 5.20 -Code freezes (which happen in the 5.17.X series) +Code freezes (which happen in the 5.19.X series) - 2013-01-20 5.17.8 Contentious changes freeze - 2013-02-20 5.17.9 User-visible changes freeze - 2013-03-20 5.17.10 Full code freeze + 2014-01-20 5.19.8 Contentious changes freeze + 2014-02-20 5.19.9 User-visible changes freeze + 2014-03-20 5.19.10 Full code freeze + 2014-05-20 5.20.0 Stable release! + +=head2 Perl 5.18 Release schedule (with release manager): - 2013-04-?? 5.18.0-RC0 Ricardo Signes - ...(interim RC releases)... - 2013-05-18 5.18.0 (final) Ricardo Signes + 2013-05-18 5.18.0 ✓ Ricardo Signes + 2013-08-12 5.18.1 ✓ Ricardo Signes + 2013-11-?? 5.18.2 Ricardo Signes (RC0 will be released once we think that all the blockers have been addressed. This typically means some time in April or May.) @@ -34,16 +41,6 @@ Release schedule (with release managers) 2013-03-11 5.16.3 ✓ Ricardo Signes ????-??-?? 5.16.4 ?? -=head2 Perl 5.14 - -Release schedule (with release managers): - - 2011-05-14 5.14.0 (final) Jesse Vincent - 2011-06-16 5.14.1 ✓ Jesse Vincent - 2011-09-14 5.14.2 ✓ Florian Ragwitz - 2012-10-12 5.14.3 ✓ Dominic Hargreaves - 2013-03-10 5.14.4 ✓ David Mitchell - =head1 DEVELOPMENT RELEASE SCHEDULE This schedule lists the release engineers for at least the next @@ -58,31 +55,35 @@ When shipping a release, you should incl the next four releases. If a stable version of Perl is released, you should reset the version numbers to the next blead series. -=head2 Perl 5.17 - - 2012-05-26 5.17.0 ✓ Zefram - 2012-06-20 5.17.1 ✓ Jesse Luehrs - 2012-07-20 5.17.2 ✓ Tony Cook - 2012-08-20 5.17.3 ✓ Steve Hay - 2012-09-20 5.17.4 ✓ Florian Ragwitz - 2012-10-20 5.17.5 ✓ Florian Ragwitz - 2012-11-20 5.17.6 ✓ Ricardo Signes - 2012-12-18 5.17.7 ✓ Dave Rolsky - 2013-01-20 5.17.8 ✓ Aaron Crane - 2013-02-20 5.17.9 ✓ Chris Williams - 2013-03-20 5.17.10 Max Maischein - 2013-04-20 5.17.11 - =head2 Perl 5.19 2013-05-20 5.19.0 Ricardo Signes 2013-06-20 5.19.1 David Golden 2013-07-20 5.19.2 Aristotle Pagaltzis 2013-08-20 5.19.3 Steve Hay - 2013-09-20 5.19.4 - 2013-10-20 5.19.5 - 2013-11-20 5.19.6 - 2013-12-20 5.19.7 + 2013-09-20 5.19.4 Steve Hay + 2013-10-20 5.19.5 Steve Hay + 2013-11-20 5.19.6 Chris Williams + 2013-12-20 5.19.7 Abigail + 2014-01-20 5.19.8 Ricardo Signes + 2014-02-20 5.19.9 Tony Cook + 2014-03-20 5.19.10 Aaron Crane + 2014-04-20 5.19.11 Steve Hay + +=head2 Perl 5.21 + + 2014-05-20 5.21.0 Ricardo Signes + 2014-06-20 5.21.1 Matthew Horsfall + 2014-07-20 5.21.2 Abigail + 2014-08-20 5.21.3 ? + 2014-09-20 5.21.4 ? + 2014-10-20 5.21.5 ? + 2014-11-20 5.21.6 ? + 2014-12-20 5.21.7 ? + 2015-01-20 5.21.8 ? + 2015-02-20 5.21.9 ? + 2015-03-20 5.21.10 ? + 2015-04-20 5.21.11 ? =head1 VICTIMS @@ -93,27 +94,29 @@ and can't find a substitute amongst this (Please do not add any names to this list without prior consent of the Pumpking.) +Abigail +Aristotle Pagaltzis +Ask Bjørn Hansen +Chris Williams +Dave Cross +Dave Rolsky +David Golden +Florian Ragwitz +Jesse Luehrs Jesse Vincent Leon Brocard -Yves Orton +Matt Trout +Max Maischein +Peter Martini +Philippe Bruhat Ricardo Signes +Stevan Little Steve Hay -Ask Bjørn Hansen -David Golden -Philippe Bruhat -Matt Trout -Florian Ragwitz Tatsuhiko Miyagawa -Chris Williams +Tony Cook +Yves Orton Zefram Ævar Arnfjörð Bjarmason -Stevan Little -Dave Rolsky -Abigail -Max Maischein -Dave Cross -Jesse Luehrs -Tony Cook =head1 AUTHOR Index: gnu/usr.bin/perl/Porting/rt_list_patches =================================================================== RCS file: /mnt/memory/perl/importit/cvs/src/gnu/usr.bin/perl/Porting/rt_list_patches,v retrieving revision 1.1.1.1 diff -u -p -u -p -r1.1.1.1 rt_list_patches --- gnu/usr.bin/perl/Porting/rt_list_patches 25 Mar 2013 20:09:31 -0000 1.1.1.1 +++ gnu/usr.bin/perl/Porting/rt_list_patches 16 Nov 2014 03:22:23 -0000 @@ -11,7 +11,7 @@ if [ -z "$RTPASSWD" ]; then fi -export RTSERVER=http://rt.perl.org/rt3 +export RTSERVER=https://rt.perl.org/ Index: gnu/usr.bin/perl/Porting/sync-with-cpan =================================================================== RCS file: /mnt/memory/perl/importit/cvs/src/gnu/usr.bin/perl/Porting/sync-with-cpan,v retrieving revision 1.1.1.2 diff -u -p -u -p -r1.1.1.2 sync-with-cpan --- gnu/usr.bin/perl/Porting/sync-with-cpan 24 Mar 2014 14:59:09 -0000 1.1.1.2 +++ gnu/usr.bin/perl/Porting/sync-with-cpan 16 Nov 2014 03:22:23 -0000 @@ -114,7 +114,7 @@ Handle complicated C This is an initial version; no attempt has been made yet to make this portable. It shells out instead of trying to find a Perl solution. -In particular, it assumes wget, git, tar, chmod, perl, make, and rm +In particular, it assumes git, perl, and make to be available. =cut @@ -127,6 +127,10 @@ use 5.010; use strict; use warnings; use Getopt::Long; +use Archive::Tar; +use File::Path qw( remove_tree ); +use File::Find; +use Config qw( %Config ); $| = 1; @@ -142,9 +146,11 @@ require "Porting/Maintainers.pl"; my %IGNORABLE = map {$_ => 1} @IGNORABLE; +my $tmpdir= $ENV{ TEMP } // '/tmp'; + my $package = "02packages.details.txt"; my $package_url = "http://www.cpan.org/modules/$package"; -my $package_file = "/tmp/$package"; +my $package_file = "$tmpdir/$package"; # this is a cache my @problematic = ( 'podlators', # weird CUSTOMIZED section due to .PL files @@ -158,6 +164,37 @@ GetOptions ('tarball=s' => \my $tarbal die "Usage: $0 module [args] [cpan package]" unless @ARGV == 1 || @ARGV == 2; +sub find_type_f { + my @res; + find( { no_chdir => 1, wanted => sub { + my $file= $File::Find::name; + return unless -f $file; + push @res, $file + }}, @_ ); + @res +}; + +# Equivalent of `chmod a-x` +sub de_exec { + for my $filename ( @_ ) { + my $mode= (stat $filename)[2] & 0777; + if( $mode & 0111 ) { # exec-bit set + chmod $mode & 0666, $filename; + }; + } +} + +sub make { + my @args= @_; + if( $^O eq 'MSWin32') { + chdir "Win32"; + system "$Config{make} @args> ..\\make.log 2>&1" and die "Running make failed, see make.log"; + chdir '..'; + } else { + system "$Config{make} @args> make.log 2>&1" and die "Running make failed, see make.log"; + }; +}; + my ($module) = shift; my $cpan_mod = @ARGV ? shift : $module; @@ -181,7 +218,7 @@ chdir "cpan"; my $pkg_dir = $files[0]; $pkg_dir =~ s!.*/!!; -my ($old_version) = $distribution =~ /-([0-9.]+)\.tar\.gz/; +my ($old_version) = $distribution =~ /-([0-9.]+(?:-TRIAL[0-9]*)?)\.tar\.gz/; my $o_module = $module; if ($cpan_mod =~ /-/ && $cpan_mod !~ /::/) { @@ -198,12 +235,17 @@ unless ($tarball) { # Poor man's cache # unless (-f $package_file && -M $package_file < 1) { - system wget => $package_url, '-qO', $package_file; + eval { + require HTTP::Tiny; + my $http= HTTP::Tiny->new(); + $http->mirror( $package_url => $package_file ); + 1 + } or system wget => $package_url, '-qO', $package_file; } - my $new_line = `grep '^$cpan_mod ' $package_file` + open my $fh, '<', $package_file; + (my $new_line) = grep {/^$cpan_mod/} <$fh> # Yes, this needs a lot of memory or die "Cannot find $cpan_mod on CPAN\n"; - chomp $new_line; (undef, $new_version, my $new_path) = split ' ', $new_line; if (defined $version) { $new_path =~ s/-$new_version\./-$version\./; @@ -216,11 +258,16 @@ unless ($tarball) { # # Fetch the new distro # - system wget => $url, '-qO', $new_file; + eval { + require HTTP::Tiny; + my $http= HTTP::Tiny->new(); + $http->mirror( $url => $new_file ); + 1 + } or system wget => $url, '-qO', $new_file; } else { $new_file = $tarball; - $new_version = $version // ($new_file =~ /-([0-9._]+)\.tar\.gz/) [0]; + $new_version = $version // ($new_file =~ /-([0-9._]+(?:-TRIAL[0-9]*)?)\.tar\.gz/) [0]; } my $old_dir = "$pkg_dir-$old_version"; @@ -229,11 +276,16 @@ say "Cleaning out old directory"; system git => 'clean', '-dfxq', $pkg_dir; say "Unpacking $new_file"; +Archive::Tar->extract_archive( $new_file ); -system tar => 'xfz', $new_file; (my $new_dir = $new_file) =~ s/\.tar\.gz//; # ensure 'make' will update all files -system('find', $new_dir, '-exec', 'touch', '{}', ';'); +my $t= time; +for my $file (find_type_f($new_dir)) { + open(my $fh,">>$file") || die "Cannot write $file:$!"; + close($fh); + utime($t,$t,$file); +}; say "Renaming directories"; rename $pkg_dir => $old_dir; @@ -252,8 +304,7 @@ if ($$info {EXCLUDED}) { } } -FILE: for my $file ( `find $new_dir -type f` ) { - chomp $file; +FILE: for my $file ( find_type_f( $new_dir )) { my $old_file = $file; $file =~ s{^$new_dir/}{}; @@ -290,21 +341,19 @@ FILE: for my $file ( `find $new_dir -typ rename $old_file => $file; } -system 'rm', '-rf', $new_dir; +remove_tree( $new_dir ); if (-f "$old_dir/.gitignore") { say "Restoring .gitignore"; system git => 'checkout', "$pkg_dir/.gitignore"; } -my @new_files = `find $pkg_dir -type f`; -chomp @new_files; +my @new_files = find_type_f( $pkg_dir ); @new_files = grep {$_ ne $pkg_dir} @new_files; s!^[^/]+/!! for @new_files; my %new_files = map {$_ => 1} @new_files; -my @old_files = `find $old_dir -type f`; -chomp @old_files; +my @old_files = find_type_f( $old_dir ); @old_files = grep {$_ ne $old_dir} @old_files; s!^[^/]+/!! for @old_files; my %old_files = map {$_ => 1} @old_files; @@ -331,8 +380,7 @@ foreach my $file (@old_files) { # # Find all files with an exec bit # -my @exec = `find $pkg_dir -type f -perm +111`; -chomp @exec; +my @exec = find_type_f( $pkg_dir ); my @de_exec; foreach my $file (@exec) { # Remove leading dir @@ -368,7 +416,7 @@ print "Hit return to continue; ^C to abo unlink "$pkg_dir/$_" for @delete; system git => 'add', "$pkg_dir/$_" for @commit; system git => 'rm', '-f', "$pkg_dir/$_" for @gone; -system chmod => 'a-x', "$pkg_dir/$_" for @de_exec; +de_exec( "$pkg_dir/$_" ) for @de_exec; # # Restore anything that is customized. @@ -396,40 +444,41 @@ if (@commit) { print "Running a make ... "; -system "make > make.log 2>&1" and die "Running make failed, see make.log"; +# Prepare for running (selected) tests +make 'test-prep'; print "done\n"; # # Must clean up, or else t/porting/FindExt.t will fail. -# Note that we can always retrieve the orginal directory with a git checkout. +# Note that we can always retrieve the original directory with a git checkout. # print "About to clean up; hit return or abort (^C) "; ; -chdir "cpan"; -system rm => '-r', $old_dir; -unlink $new_file unless $tarball; - +remove_tree( "cpan/$old_dir" ); +unlink "cpan/$new_file" unless $tarball; # # Run the tests. First the test belonging to the module, followed by the # the tests in t/porting # -chdir "../t"; +chdir "t"; say "Running module tests"; -my @test_files = `find ../cpan/$pkg_dir -name '*.t' -type f`; -chomp @test_files; -my $output = `./perl TEST @test_files`; +my @test_files = grep { /\.t$/ } find_type_f( $pkg_dir ); +my $exe_dir= $^O =~ /MSWin/ ? "..\\" : './'; +my $output = `${exe_dir}perl$Config{_exe} TEST @test_files`; unless ($output =~ /All tests successful/) { say $output; exit 1; } print "Running tests in t/porting "; -my @tests = `ls porting/*.t`; +my @tests = glob 'porting/*.t'; chomp @tests; my @failed; foreach my $t (@tests) { - my @not = `./perl -I../lib -I.. $t | grep ^not | grep -v "# TODO"`; + my @not = grep {!/# TODO/ } + grep { /^not/ } + `${exe_dir}perl -I../lib -I.. $t`; print @not ? '!' : '.'; push @failed => $t if @not; } @@ -470,7 +519,7 @@ while (<$Maintainers_pl>) { if ($found) { unlink 'Porting/Maintainers.pl'; rename 'Maintainers.pl' => 'Porting/Maintainers.pl'; - system chmod => 'a+x', 'Porting/Maintainers.pl'; + chmod 0755 => 'Porting/Maintainers.pl'; } else { say "Could not update Porting/Maintainers.pl."; Index: gnu/usr.bin/perl/Porting/testall.atom =================================================================== RCS file: gnu/usr.bin/perl/Porting/testall.atom diff -N gnu/usr.bin/perl/Porting/testall.atom --- gnu/usr.bin/perl/Porting/testall.atom 12 Oct 2009 18:10:46 -0000 1.1.1.2 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,91 +0,0 @@ -#!/bin/sh - -# -# testall.atom - test suite profiling on Tru 64 -# -# This script creates all.Counts file that can be fed to prof(1) -# to produce various basic block counting profiles. -# -# This script needs to be run at the top level of the Perl build -# directory after the "make all" and "make test" targets have been run. -# -# You will also need to have perl.pixie built, -# which means that you will also have Configured with -Doptimize=-g. -# -# After the script has been run (this will take several minutes) -# you will have a file called all.Counts, which contains the cumulative -# basic block counting results over the whole Perl test suite. -# You can produce various reports using prof(1); -# -# prof -pixie -all -L. perl all.Counts -# prof -pixie -heavy -all -L. perl all.Counts -# prof -pixie -invocations -all -L. perl all.Counts -# prof -pixie -lines -all -L. perl all.Counts -# prof -pixie -testcoverage -all -L. perl all.Counts -# prof -pixie -zero -all -L. perl all.Counts -# -# io/openpid and op/fork core on me, I don't know why and haven't -# taken a look yet. -# -# jhi@iki.fi -# - -if test ! -f /usr/bin/atom -then - echo "$0: no /usr/bin/atom" - exit 1 -fi - -if test ! -f perl; then echo "$0: no perl"; exit 1; fi -if test ! -f perl.pixie; then echo "$0: no perl.pixie; exit 1; fi -if test ! -f t/perl; then echo "$0: no t/perl; exit 1; fi - -LD_LIBRARY_PATH=`pwd` -export LD_LIBRARY_PATH - -cd t || exit 1 - -ln -sf ../perl.pixie . - -if test $# = 0; then - the_t=`echo base/*.t comp/*.t cmd/*.t run/*.t io/*.t; echo op/*.t uni/*.t pod/*.t x2p/*.t; find ../ext ../lib -name '*.t' -print` -else - the_t=$@ -fi - -PERL_DESTRUCT_LEVEL=2 -export PERL_DESTRUCT_LEVEL -PERL_CORE=1 -export PERL_CORE - -rm -f all.Counts - -for t in $the_t -do - case "$t" in - ext/*|lib/*) t=../$t ;; - t/*) t=`echo $t|sed 's:^t/::'` ;; - esac - echo $t|sed 's:\.t$::' - sw='' - case "`head -1 $t|egrep -e '^#.* -.*T'`" in - *-*T*) sw="$sw -T" ;; - esac - case "`head -1 $t|egrep -e '^#.* -.*t'`" in - *-*t*) sw="$sw -t" ;; - esac - ./perl.pixie -I../lib $sw $t > /dev/null - if cd .. - then - if test -f all.Counts - then - prof -pixie -merge new.Counts -L. -incobj libperl.so perl t/perl.Counts all.Counts - mv new.Counts all.Counts - else - mv t/perl.Counts all.Counts - fi - cd t - fi -done - -exit 0 Index: gnu/usr.bin/perl/Porting/thirdclean =================================================================== RCS file: gnu/usr.bin/perl/Porting/thirdclean diff -N gnu/usr.bin/perl/Porting/thirdclean --- gnu/usr.bin/perl/Porting/thirdclean 12 Oct 2009 18:10:45 -0000 1.1.1.3 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,91 +0,0 @@ -#!./perl - -# DAPM: this description is from the original commit message: -# this appears to be a HP leak detection thing: -# -# Add a script for cleaning out the "known noise" -# from Third Degree reports: either noise caused -# by libc itself, or Perl_yyparse leaks. - -local $/; -$_ = ; - -my @accv = /(^-+ \w+ -- \d+ --(?:.(?!^-))+)/msg; -my @leak = /(\d+ bytes? in \d+ leaks? .+? created at:(?:.(?!^[\d-]))+)/msg; - -$leak[ 0] =~ s/.* were found:\n\n//m; # Snip off totals. - -# Weed out the known access violations. - -@accv = grep { ! /-- ru[hs] --.+setlocale.+Perl_init_i18nl10n/s } @accv; -@accv = grep { ! /-- [rw][ui]s --.+_doprnt_dis/s } @accv; -@accv = grep { ! /-- (?:fon|ris) --.+__strxfrm/s } @accv; -@accv = grep { ! /-- rus --.+__catgets/s } @accv; -@accv = grep { ! /-- rus --.+__execvp/s } @accv; -@accv = grep { ! /-- rus --.+tmpnam.+tmpfile/s } @accv; -@accv = grep { ! /-- rus --.+__gethostbyname/s } @accv; -@accv = grep { ! /-- ris --.+__actual_atof/s } @accv; -@accv = grep { ! /-- ris --.+__strftime/s } @accv; - -# Weed out untraceable access violations. -@accv = grep { ! / ----- /s } @accv; -@accv = grep { ! /-- r[ui][hs] --.+proc_at_/s } @accv; -@accv = grep { ! /-- r[ui][hs] --.+pc = 0x/s } @accv; - -# The following look like being caused by the intrinsic inlined -# string handling functions reading one or few bytes beyond the -# actual length. -@accv = grep { ! /-- rih --.+(?:memmove|strcpy).+moreswitches/s } @accv; -@accv = grep { ! /-- (?:rih|rus) --.+strcpy.+gv_fetchfile/s } @accv; -@accv = grep { ! /-- rih --.+strcmp.+doopen_pm/s } @accv; -@accv = grep { ! /-- rih --.+strcmp.+gv_fetchpv/s } @accv; -@accv = grep { ! /-- r[ui]h --.+strcmp.+gv_fetchmeth/s } @accv; -@accv = grep { ! /-- rih --.+memmove.+my_setenv/s } @accv; -@accv = grep { ! /-- rih --.+memmove.+catpvn_flags/s } @accv; - -# yyparse. -@accv = grep { ! /Perl_yyparse/s } @accv; - -# Weed out the known memory leaks. - -@leak = grep { ! /setlocale.+Perl_init_i18nl10n/s } @leak; -@leak = grep { ! /setlocale.+set_numeric_standard/s } @leak; -@leak = grep { ! /_findiop.+fopen/s } @leak; -@leak = grep { ! /_findiop.+__fdopen/s } @leak; -@leak = grep { ! /__localtime/s } @leak; -@leak = grep { ! /__get_libc_context/s } @leak; -@leak = grep { ! /__sia_init/s } @leak; - -# Weed out untraceable memory leaks. -@leak = grep { ! / ----- /s } @leak; -@leak = grep { ! /pc = 0x/s } @leak; -@leak = grep { ! /_pc_range_table/s } @leak; -@leak = grep { ! /_add_gp_range/s } @leak; - -# yyparse. -@leak = grep { ! /Perl_yyparse/s } @leak; - -# Output the cleaned up report. - -# Access violations. - -for (my $i = 0; $i < @accv; $i++) { - $_ = $accv[$i]; - s/\d+/$i/; - print; -} - -# Memory leaks. - -my ($leakb, $leakn, $leaks); - -for (my $i = 0; $i < @leak; $i++) { - $_ = $leak[$i]; - print $_, "\n"; - /^(\d+) bytes? in (\d+) leak/; - $leakb += $1; - $leakn += $2; - $leaks += $1 if /including (\d+) super/; -} - -print "Bytes $leakb Leaks $leakn Super $leaks\n" if $leakb; Index: gnu/usr.bin/perl/Porting/todo.pod =================================================================== RCS file: /mnt/memory/perl/importit/cvs/src/gnu/usr.bin/perl/Porting/todo.pod,v retrieving revision 1.1.1.2 diff -u -p -u -p -r1.1.1.2 todo.pod --- gnu/usr.bin/perl/Porting/todo.pod 24 Mar 2014 14:59:09 -0000 1.1.1.2 +++ gnu/usr.bin/perl/Porting/todo.pod 16 Nov 2014 03:22:23 -0000 @@ -41,9 +41,9 @@ documentation. This would be a good way =head2 Classify bug tickets by type -Known bugs in Perl are tracked by L (which also +Known bugs in Perl are tracked by L (which also includes Perl 6). A summary can be found at -L. +L. It shows bugs classified by "type". However, the type of many of the bugs is "unknown". This greatly lowers the chances of them getting fixed, as the number of open bugs is overwhelming -- too many to wade @@ -59,7 +59,7 @@ the poster about it, asking for example problem. Such code should be added to the test suite as TODO tests, and the ticket should be classified by type. To get started on this task, look at the tickets that are marked as "New Issues" in -L. +L. =head2 Migrate t/ from custom TAP generation @@ -128,8 +128,9 @@ L =head2 fix tainting bugs -Fix the bugs revealed by running the test suite with the C<-t> switch (via -C). +Fix the bugs revealed by running the test suite with the C<-t> switch. +Setting the TEST_ARGS environment variable to C<-taintwarn> will accomplish +this. =head2 Dual life everything @@ -358,7 +359,7 @@ are needed to our current source code. P There are several scripts and tools for cross-compiling perl for other platforms. However, these are somewhat inconsistent and scattered across the codebase, none are documented well, none are clearly flexible enough to -be confident that they can support any TARGET/HOST plaform pair other than +be confident that they can support any TARGET/HOST platform pair other than that which they were developed on, and it's not clear how bitrotted they are. For example, C understands C<-Dusecrosscompile> option. This option @@ -370,7 +371,7 @@ ARM Linux targets, relying on hand curat is getting on for 5 years old, and requires insider knowledge of perl's build system to draft a F for a new platform. -Jess Robinson has sumbitted a grant to TPF to work on cleaning this up. +Jess Robinson has submitted a grant to TPF to work on cleaning this up. =head2 Split "linker" from "compiler" @@ -466,7 +467,7 @@ Natively 64-bit systems need neither -Du On these systems, it might be the default compilation mode, and there is currently no guarantee that passing no use64bitall option to the Configure process will build a 32bit perl. Implementing -Duse32bit* -options would be nice for perl 5.18.2. +options would be nice for perl 5.20.1. =head2 Profile Perl - am I hot or not? @@ -548,7 +549,8 @@ Maybe create a utility that checks after none of the above (nor sprintf(), vsprintf(), or *SHUDDER* gets()) ever creep back to libperl.a. - nm libperl.a | ./miniperl -alne '$o = $F[0] if /:$/; print "$o $F[1]" if $F[0] eq "U" && $F[1] =~ /^(?:strn?c(?:at|py)|v?sprintf|gets)$/' + nm libperl.a | ./miniperl -alne '$o = $F[0] if /:$/; + print "$o $F[1]" if $F[0] eq "U" && $F[1] =~ /^(?:strn?c(?:at|py)|v?sprintf|gets)$/' Note, of course, that this will only tell whether B platform is using those naughty interfaces. @@ -854,7 +856,7 @@ if available-- but B if available, have catgets(). For the really pure at heart, consider extending this item to cover -also the warning messages (see L, C). +also the warning messages (see L, F). =head1 Tasks that need a knowledge of the interpreter @@ -972,10 +974,11 @@ done." ssh and screen do this with named The old perltodo notes that lvalue functions don't work for list or hash slices. This would be good to fix. -=head2 regexp optimiser optional +=head2 regexp optimizer optional -The regexp optimiser is not optional. It should configurable to be, to allow -its performance to be measured, and its bugs to be easily demonstrated. +The regexp optimizer is not optional. It should be configurable to be optional +and to allow its performance to be measured and its bugs to be easily +demonstrated. =head2 C regex modifier @@ -1118,7 +1121,7 @@ would produce this output What might work is to have an optional line number in memory just before the BASEOP structure, with a flag bit in the op to say whether it's present. Initially during compile every OP would carry its line number. Then add a late -pass to the optimiser (potentially combined with L) which +pass to the optimizer (potentially combined with L) which looks at the two ops on every edge of the graph of the execution path. If the line number changes, flags the destination OP with this information. Once all paths are traced, replace every op with the flag with a @@ -1173,7 +1176,7 @@ L function (in sv.c:Perl_dirp_dup). Fix Perl_sv_dup, et al so that threads can return objects. - -=head2 Add class set operations to regexp engine - -Apparently these are quite useful. Anyway, Jeffery Friedl wants them. - -demerphq has this on his todo list, but right at the bottom. - =head1 Tasks for microperl Index: gnu/usr.bin/perl/cpan/Archive-Extract/lib/Archive/Extract.pm =================================================================== RCS file: gnu/usr.bin/perl/cpan/Archive-Extract/lib/Archive/Extract.pm diff -N gnu/usr.bin/perl/cpan/Archive-Extract/lib/Archive/Extract.pm --- gnu/usr.bin/perl/cpan/Archive-Extract/lib/Archive/Extract.pm 24 Mar 2014 14:58:48 -0000 1.1.1.3 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,1690 +0,0 @@ -package Archive::Extract; -use if $] > 5.017, 'deprecate'; - -use strict; - -use Cwd qw[cwd chdir]; -use Carp qw[carp]; -use IPC::Cmd qw[run can_run]; -use FileHandle; -use File::Path qw[mkpath]; -use File::Spec; -use File::Basename qw[dirname basename]; -use Params::Check qw[check]; -use Module::Load::Conditional qw[can_load check_install]; -use Locale::Maketext::Simple Style => 'gettext'; - -### solaris has silly /bin/tar output ### -use constant ON_SOLARIS => $^O eq 'solaris' ? 1 : 0; -use constant ON_NETBSD => $^O eq 'netbsd' ? 1 : 0; -use constant ON_OPENBSD => $^O eq 'openbsd' ? 1 : 0; -use constant ON_FREEBSD => $^O =~ m!^(free|midnight)bsd$! ? 1 : 0; -use constant ON_LINUX => $^O eq 'linux' ? 1 : 0; -use constant FILE_EXISTS => sub { -e $_[0] ? 1 : 0 }; - -### VMS may require quoting upper case command options -use constant ON_VMS => $^O eq 'VMS' ? 1 : 0; - -### Windows needs special treatment of Tar options -use constant ON_WIN32 => $^O eq 'MSWin32' ? 1 : 0; - -### we can't use this extraction method, because of missing -### modules/binaries: -use constant METHOD_NA => []; - -### If these are changed, update @TYPES and the new() POD -use constant TGZ => 'tgz'; -use constant TAR => 'tar'; -use constant GZ => 'gz'; -use constant ZIP => 'zip'; -use constant BZ2 => 'bz2'; -use constant TBZ => 'tbz'; -use constant Z => 'Z'; -use constant LZMA => 'lzma'; -use constant XZ => 'xz'; -use constant TXZ => 'txz'; - -use vars qw[$VERSION $PREFER_BIN $PROGRAMS $WARN $DEBUG - $_ALLOW_BIN $_ALLOW_PURE_PERL $_ALLOW_TAR_ITER - ]; - -$VERSION = '0.68'; -$PREFER_BIN = 0; -$WARN = 1; -$DEBUG = 0; -$_ALLOW_PURE_PERL = 1; # allow pure perl extractors -$_ALLOW_BIN = 1; # allow binary extractors -$_ALLOW_TAR_ITER = 1; # try to use Archive::Tar->iter if available - -# same as all constants -my @Types = ( TGZ, TAR, GZ, ZIP, BZ2, TBZ, Z, LZMA, XZ, TXZ ); - -local $Params::Check::VERBOSE = $Params::Check::VERBOSE = 1; - -=pod - -=head1 NAME - -Archive::Extract - A generic archive extracting mechanism - -=head1 SYNOPSIS - - use Archive::Extract; - - ### build an Archive::Extract object ### - my $ae = Archive::Extract->new( archive => 'foo.tgz' ); - - ### extract to cwd() ### - my $ok = $ae->extract; - - ### extract to /tmp ### - my $ok = $ae->extract( to => '/tmp' ); - - ### what if something went wrong? - my $ok = $ae->extract or die $ae->error; - - ### files from the archive ### - my $files = $ae->files; - - ### dir that was extracted to ### - my $outdir = $ae->extract_path; - - - ### quick check methods ### - $ae->is_tar # is it a .tar file? - $ae->is_tgz # is it a .tar.gz or .tgz file? - $ae->is_gz; # is it a .gz file? - $ae->is_zip; # is it a .zip file? - $ae->is_bz2; # is it a .bz2 file? - $ae->is_tbz; # is it a .tar.bz2 or .tbz file? - $ae->is_lzma; # is it a .lzma file? - $ae->is_xz; # is it a .xz file? - $ae->is_txz; # is it a .tar.xz or .txz file? - - ### absolute path to the archive you provided ### - $ae->archive; - - ### commandline tools, if found ### - $ae->bin_tar # path to /bin/tar, if found - $ae->bin_gzip # path to /bin/gzip, if found - $ae->bin_unzip # path to /bin/unzip, if found - $ae->bin_bunzip2 # path to /bin/bunzip2 if found - $ae->bin_unlzma # path to /bin/unlzma if found - $ae->bin_unxz # path to /bin/unxz if found - -=head1 DESCRIPTION - -Archive::Extract is a generic archive extraction mechanism. - -It allows you to extract any archive file of the type .tar, .tar.gz, -.gz, .Z, tar.bz2, .tbz, .bz2, .zip, .xz,, .txz, .tar.xz or .lzma -without having to worry how it -does so, or use different interfaces for each type by using either -perl modules, or commandline tools on your system. - -See the C section further down for details. - -=cut - - -### see what /bin/programs are available ### -$PROGRAMS = {}; -CMD: for my $pgm (qw[tar unzip gzip bunzip2 uncompress unlzma unxz]) { - if ( $pgm eq 'unzip' and ( ON_NETBSD or ON_FREEBSD ) ) { - local $IPC::Cmd::INSTANCES = 1; - ($PROGRAMS->{$pgm}) = grep { ON_NETBSD ? m!/usr/pkg/! : m!/usr/local! } can_run($pgm); - next CMD; - } - if ( $pgm eq 'unzip' and ON_LINUX ) { - # Check if 'unzip' is busybox masquerading - local $IPC::Cmd::INSTANCES = 1; - my $opt = ON_VMS ? '"-Z"' : '-Z'; - ($PROGRAMS->{$pgm}) = grep { scalar run(command=> [ $_, $opt, '-1' ]) } can_run($pgm); - next CMD; - } - if ( $pgm eq 'tar' and ON_OPENBSD || ON_SOLARIS ) { - # try gtar first - next CMD if $PROGRAMS->{$pgm} = can_run('gtar'); - } - $PROGRAMS->{$pgm} = can_run($pgm); -} - -### mapping from types to extractor methods ### -my $Mapping = { # binary program # pure perl module - is_tgz => { bin => '_untar_bin', pp => '_untar_at' }, - is_tar => { bin => '_untar_bin', pp => '_untar_at' }, - is_gz => { bin => '_gunzip_bin', pp => '_gunzip_cz' }, - is_zip => { bin => '_unzip_bin', pp => '_unzip_az' }, - is_tbz => { bin => '_untar_bin', pp => '_untar_at' }, - is_bz2 => { bin => '_bunzip2_bin', pp => '_bunzip2_bz2'}, - is_Z => { bin => '_uncompress_bin', pp => '_gunzip_cz' }, - is_lzma => { bin => '_unlzma_bin', pp => '_unlzma_cz' }, - is_xz => { bin => '_unxz_bin', pp => '_unxz_cz' }, - is_txz => { bin => '_untar_bin', pp => '_untar_at' }, -}; - -{ ### use subs so we re-generate array refs etc for the no-override flags - ### if we don't, then we reuse the same arrayref, meaning objects store - ### previous errors - my $tmpl = { - archive => sub { { required => 1, allow => FILE_EXISTS } }, - type => sub { { default => '', allow => [ @Types ] } }, - _error_msg => sub { { no_override => 1, default => [] } }, - _error_msg_long => sub { { no_override => 1, default => [] } }, - }; - - ### build accessors ### - for my $method( keys %$tmpl, - qw[_extractor _gunzip_to files extract_path], - ) { - no strict 'refs'; - *$method = sub { - my $self = shift; - $self->{$method} = $_[0] if @_; - return $self->{$method}; - } - } - -=head1 METHODS - -=head2 $ae = Archive::Extract->new(archive => '/path/to/archive',[type => TYPE]) - -Creates a new C object based on the archive file you -passed it. Automatically determines the type of archive based on the -extension, but you can override that by explicitly providing the -C argument. - -Valid values for C are: - -=over 4 - -=item tar - -Standard tar files, as produced by, for example, C. -Corresponds to a C<.tar> suffix. - -=item tgz - -Gzip compressed tar files, as produced by, for example C. -Corresponds to a C<.tgz> or C<.tar.gz> suffix. - -=item gz - -Gzip compressed file, as produced by, for example C. -Corresponds to a C<.gz> suffix. - -=item Z - -Lempel-Ziv compressed file, as produced by, for example C. -Corresponds to a C<.Z> suffix. - -=item zip - -Zip compressed file, as produced by, for example C. -Corresponds to a C<.zip>, C<.jar> or C<.par> suffix. - -=item bz2 - -Bzip2 compressed file, as produced by, for example, C. -Corresponds to a C<.bz2> suffix. - -=item tbz - -Bzip2 compressed tar file, as produced by, for example C. -Corresponds to a C<.tbz> or C<.tar.bz2> suffix. - -=item lzma - -Lzma compressed file, as produced by C. -Corresponds to a C<.lzma> suffix. - -=item xz - -Xz compressed file, as produced by C. -Corresponds to a C<.xz> suffix. - -=item txz - -Xz compressed tar file, as produced by, for example C. -Corresponds to a C<.txz> or C<.tar.xz> suffix. - -=back - -Returns a C object on success, or false on failure. - -=cut - - ### constructor ### - sub new { - my $class = shift; - my %hash = @_; - - ### see above why we use subs here and generate the template; - ### it's basically to not re-use arrayrefs - my %utmpl = map { $_ => $tmpl->{$_}->() } keys %$tmpl; - - my $parsed = check( \%utmpl, \%hash ) or return; - - ### make sure we have an absolute path ### - my $ar = $parsed->{archive} = File::Spec->rel2abs( $parsed->{archive} ); - - ### figure out the type, if it wasn't already specified ### - unless ( $parsed->{type} ) { - $parsed->{type} = - $ar =~ /.+?\.(?:tar\.gz|tgz)$/i ? TGZ : - $ar =~ /.+?\.gz$/i ? GZ : - $ar =~ /.+?\.tar$/i ? TAR : - $ar =~ /.+?\.(zip|jar|ear|war|par)$/i ? ZIP : - $ar =~ /.+?\.(?:tbz2?|tar\.bz2?)$/i ? TBZ : - $ar =~ /.+?\.bz2$/i ? BZ2 : - $ar =~ /.+?\.Z$/ ? Z : - $ar =~ /.+?\.lzma$/ ? LZMA : - $ar =~ /.+?\.(?:txz|tar\.xz)$/i ? TXZ : - $ar =~ /.+?\.xz$/ ? XZ : - ''; - - } - - bless $parsed, $class; - - ### don't know what type of file it is - ### XXX this *has* to be an object call, not a package call - return $parsed->_error(loc("Cannot determine file type for '%1'", - $parsed->{archive} )) unless $parsed->{type}; - return $parsed; - } -} - -=head2 $ae->extract( [to => '/output/path'] ) - -Extracts the archive represented by the C object to -the path of your choice as specified by the C argument. Defaults to -C. - -Since C<.gz> files never hold a directory, but only a single file; if -the C argument is an existing directory, the file is extracted -there, with its C<.gz> suffix stripped. -If the C argument is not an existing directory, the C argument -is understood to be a filename, if the archive type is C. -In the case that you did not specify a C argument, the output -file will be the name of the archive file, stripped from its C<.gz> -suffix, in the current working directory. - -C will try a pure perl solution first, and then fall back to -commandline tools if they are available. See the C -section below on how to alter this behaviour. - -It will return true on success, and false on failure. - -On success, it will also set the follow attributes in the object: - -=over 4 - -=item $ae->extract_path - -This is the directory that the files where extracted to. - -=item $ae->files - -This is an array ref with the paths of all the files in the archive, -relative to the C argument you specified. -To get the full path to an extracted file, you would use: - - File::Spec->catfile( $to, $ae->files->[0] ); - -Note that all files from a tar archive will be in unix format, as per -the tar specification. - -=back - -=cut - -sub extract { - my $self = shift; - my %hash = @_; - - ### reset error messages - $self->_error_msg( [] ); - $self->_error_msg_long( [] ); - - my $to; - my $tmpl = { - to => { default => '.', store => \$to } - }; - - check( $tmpl, \%hash ) or return; - - ### so 'to' could be a file or a dir, depending on whether it's a .gz - ### file, or basically anything else. - ### so, check that, then act accordingly. - ### set an accessor specifically so _gunzip can know what file to extract - ### to. - my $dir; - { ### a foo.gz file - if( $self->is_gz or $self->is_bz2 or $self->is_Z or $self->is_lzma or $self->is_xz ) { - - my $cp = $self->archive; $cp =~ s/\.(?:gz|bz2?|Z|lzma|xz)$//i; - - ### to is a dir? - if ( -d $to ) { - $dir = $to; - $self->_gunzip_to( basename($cp) ); - - ### then it's a filename - } else { - $dir = dirname($to); - $self->_gunzip_to( basename($to) ); - } - - ### not a foo.gz file - } else { - $dir = $to; - } - } - - ### make the dir if it doesn't exist ### - unless( -d $dir ) { - eval { mkpath( $dir ) }; - - return $self->_error(loc("Could not create path '%1': %2", $dir, $@)) - if $@; - } - - ### get the current dir, to restore later ### - my $cwd = cwd(); - - my $ok = 1; - EXTRACT: { - - ### chdir to the target dir ### - unless( chdir $dir ) { - $self->_error(loc("Could not chdir to '%1': %2", $dir, $!)); - $ok = 0; last EXTRACT; - } - - ### set files to an empty array ref, so there's always an array - ### ref IN the accessor, to avoid errors like: - ### Can't use an undefined value as an ARRAY reference at - ### ../lib/Archive/Extract.pm line 742. (rt #19815) - $self->files( [] ); - - ### find out the dispatch methods needed for this type of - ### archive. Do a $self->is_XXX to figure out the type, then - ### get the hashref with bin + pure perl dispatchers. - my ($map) = map { $Mapping->{$_} } grep { $self->$_ } keys %$Mapping; - - ### add pure perl extractor if allowed & add bin extractor if allowed - my @methods; - push @methods, $map->{'pp'} if $_ALLOW_PURE_PERL; - push @methods, $map->{'bin'} if $_ALLOW_BIN; - - ### reverse it if we prefer bin extractors - @methods = reverse @methods if $PREFER_BIN; - - my($na, $fail); - for my $method (@methods) { - $self->debug( "# Extracting with ->$method\n" ); - - my $rv = $self->$method; - - ### a positive extraction - if( $rv and $rv ne METHOD_NA ) { - $self->debug( "# Extraction succeeded\n" ); - $self->_extractor($method); - last; - - ### method is not available - } elsif ( $rv and $rv eq METHOD_NA ) { - $self->debug( "# Extraction method not available\n" ); - $na++; - } else { - $self->debug( "# Extraction method failed\n" ); - $fail++; - } - } - - ### warn something went wrong if we didn't get an extractor - unless( $self->_extractor ) { - my $diag = $fail ? loc("Extract failed due to errors") : - $na ? loc("Extract failed; no extractors available") : - ''; - - $self->_error($diag); - $ok = 0; - } - } - - ### and chdir back ### - unless( chdir $cwd ) { - $self->_error(loc("Could not chdir back to start dir '%1': %2'", - $cwd, $!)); - } - - return $ok; -} - -=pod - -=head1 ACCESSORS - -=head2 $ae->error([BOOL]) - -Returns the last encountered error as string. -Pass it a true value to get the C output instead. - -=head2 $ae->extract_path - -This is the directory the archive got extracted to. -See C for details. - -=head2 $ae->files - -This is an array ref holding all the paths from the archive. -See C for details. - -=head2 $ae->archive - -This is the full path to the archive file represented by this -C object. - -=head2 $ae->type - -This is the type of archive represented by this C -object. See accessors below for an easier way to use this. -See the C method for details. - -=head2 $ae->types - -Returns a list of all known C for C's -C method. - -=cut - -sub types { return @Types } - -=head2 $ae->is_tgz - -Returns true if the file is of type C<.tar.gz>. -See the C method for details. - -=head2 $ae->is_tar - -Returns true if the file is of type C<.tar>. -See the C method for details. - -=head2 $ae->is_gz - -Returns true if the file is of type C<.gz>. -See the C method for details. - -=head2 $ae->is_Z - -Returns true if the file is of type C<.Z>. -See the C method for details. - -=head2 $ae->is_zip - -Returns true if the file is of type C<.zip>. -See the C method for details. - -=head2 $ae->is_lzma - -Returns true if the file is of type C<.lzma>. -See the C method for details. - -=head2 $ae->is_xz - -Returns true if the file is of type C<.xz>. -See the C method for details. - -=cut - -### quick check methods ### -sub is_tgz { return $_[0]->type eq TGZ } -sub is_tar { return $_[0]->type eq TAR } -sub is_gz { return $_[0]->type eq GZ } -sub is_zip { return $_[0]->type eq ZIP } -sub is_tbz { return $_[0]->type eq TBZ } -sub is_bz2 { return $_[0]->type eq BZ2 } -sub is_Z { return $_[0]->type eq Z } -sub is_lzma { return $_[0]->type eq LZMA } -sub is_xz { return $_[0]->type eq XZ } -sub is_txz { return $_[0]->type eq TXZ } - -=pod - -=head2 $ae->bin_tar - -Returns the full path to your tar binary, if found. - -=head2 $ae->bin_gzip - -Returns the full path to your gzip binary, if found - -=head2 $ae->bin_unzip - -Returns the full path to your unzip binary, if found - -=head2 $ae->bin_unlzma - -Returns the full path to your unlzma binary, if found - -=head2 $ae->bin_unxz - -Returns the full path to your unxz binary, if found - -=cut - -### paths to commandline tools ### -sub bin_gzip { return $PROGRAMS->{'gzip'} if $PROGRAMS->{'gzip'} } -sub bin_unzip { return $PROGRAMS->{'unzip'} if $PROGRAMS->{'unzip'} } -sub bin_tar { return $PROGRAMS->{'tar'} if $PROGRAMS->{'tar'} } -sub bin_bunzip2 { return $PROGRAMS->{'bunzip2'} if $PROGRAMS->{'bunzip2'} } -sub bin_uncompress { return $PROGRAMS->{'uncompress'} - if $PROGRAMS->{'uncompress'} } -sub bin_unlzma { return $PROGRAMS->{'unlzma'} if $PROGRAMS->{'unlzma'} } -sub bin_unxz { return $PROGRAMS->{'unxz'} if $PROGRAMS->{'unxz'} } - -=head2 $bool = $ae->have_old_bunzip2 - -Older versions of C, from before the C release, -require all archive names to end in C<.bz2> or it will not extract -them. This method checks if you have a recent version of C -that allows any extension, or an older one that doesn't. - -=cut - -sub have_old_bunzip2 { - my $self = shift; - - ### no bunzip2? no old bunzip2 either :) - return unless $self->bin_bunzip2; - - ### if we can't run this, we can't be sure if it's too old or not - ### XXX stupid stupid stupid bunzip2 doesn't understand --version - ### is not a request to extract data: - ### $ bunzip2 --version - ### bzip2, a block-sorting file compressor. Version 1.0.2, 30-Dec-2001. - ### [...] - ### bunzip2: I won't read compressed data from a terminal. - ### bunzip2: For help, type: `bunzip2 --help'. - ### $ echo $? - ### 1 - ### HATEFUL! - - ### double hateful: bunzip2 --version also hangs if input is a pipe - ### See #32370: Archive::Extract will hang if stdin is a pipe [+PATCH] - ### So, we have to provide *another* argument which is a fake filename, - ### just so it wont try to read from stdin to print its version.. - ### *sigh* - ### Even if the file exists, it won't clobber or change it. - my $buffer; - scalar run( - command => [$self->bin_bunzip2, '--version', 'NoSuchFile'], - verbose => 0, - buffer => \$buffer - ); - - ### no output - return unless $buffer; - - my ($version) = $buffer =~ /version \s+ (\d+)/ix; - - return 1 if $version < 1; - return; -} - -################################# -# -# Untar code -# -################################# - -### annoying issue with (gnu) tar on win32, as illustrated by this -### bug: https://rt.cpan.org/Ticket/Display.html?id=40138 -### which shows that (gnu) tar will interpret a file name with a : -### in it as a remote file name, so C:\tmp\foo.txt is interpreted -### as a remote shell, and the extract fails. -{ my @ExtraTarFlags; - if( ON_WIN32 and my $cmd = __PACKAGE__->bin_tar ) { - - ### if this is gnu tar we are running, we need to use --force-local - push @ExtraTarFlags, '--force-local' if `$cmd --version` =~ /gnu tar/i; - } - - - ### use /bin/tar to extract ### - sub _untar_bin { - my $self = shift; - - ### check for /bin/tar ### - ### check for /bin/gzip if we need it ### - ### if any of the binaries are not available, return NA - { my $diag = !$self->bin_tar ? - loc("No '%1' program found", '/bin/tar') : - $self->is_tgz && !$self->bin_gzip ? - loc("No '%1' program found", '/bin/gzip') : - $self->is_tbz && !$self->bin_bunzip2 ? - loc("No '%1' program found", '/bin/bunzip2') : - $self->is_txz && !$self->bin_unxz ? - loc("No '%1' program found", '/bin/unxz') : - ''; - - if( $diag ) { - $self->_error( $diag ); - return METHOD_NA; - } - } - - ### XXX figure out how to make IPC::Run do this in one call -- - ### currently i don't know how to get output of a command after a pipe - ### trapped in a scalar. Mailed barries about this 5th of june 2004. - - ### see what command we should run, based on whether - ### it's a .tgz or .tar - - ### GNU tar can't handled VMS filespecs, but VMSTAR can handle Unix filespecs. - my $archive = $self->archive; - $archive = VMS::Filespec::unixify($archive) if ON_VMS; - - ### XXX solaris tar and bsdtar are having different outputs - ### depending whether you run with -x or -t - ### compensate for this insanity by running -t first, then -x - { my $cmd = - $self->is_tgz ? [$self->bin_gzip, '-cdf', $archive, '|', - $self->bin_tar, '-tf', '-'] : - $self->is_tbz ? [$self->bin_bunzip2, '-cd', $archive, '|', - $self->bin_tar, '-tf', '-'] : - $self->is_txz ? [$self->bin_unxz, '-cd', $archive, '|', - $self->bin_tar, '-tf', '-'] : - [$self->bin_tar, @ExtraTarFlags, '-tf', $archive]; - - ### run the command - ### newer versions of 'tar' (1.21 and up) now print record size - ### to STDERR as well if v OR t is given (used to be both). This - ### is a 'feature' according to the changelog, so we must now only - ### inspect STDOUT, otherwise, failures like these occur: - ### http://www.cpantesters.org/cpan/report/3230366 - my $buffer = ''; - my @out = run( command => $cmd, - buffer => \$buffer, - verbose => $DEBUG ); - - ### command was unsuccessful - unless( $out[0] ) { - return $self->_error(loc( - "Error listing contents of archive '%1': %2", - $archive, $buffer )); - } - - ### no buffers available? - if( !IPC::Cmd->can_capture_buffer and !$buffer ) { - $self->_error( $self->_no_buffer_files( $archive ) ); - - } else { - ### if we're on solaris we /might/ be using /bin/tar, which has - ### a weird output format... we might also be using - ### /usr/local/bin/tar, which is gnu tar, which is perfectly - ### fine... so we have to do some guessing here =/ - my @files = map { chomp; - !ON_SOLARIS ? $_ - : (m|^ x \s+ # 'xtract' -- sigh - (.+?), # the actual file name - \s+ [\d,.]+ \s bytes, - \s+ [\d,.]+ \s tape \s blocks - |x ? $1 : $_); - - ### only STDOUT, see above. Sometimes, extra whitespace - ### is present, so make sure we only pick lines with - ### a length - } grep { length } map { split $/, $_ } join '', @{$out[3]}; - - ### store the files that are in the archive ### - $self->files(\@files); - } - } - - ### now actually extract it ### - { my $cmd = - $self->is_tgz ? [$self->bin_gzip, '-cdf', $archive, '|', - $self->bin_tar, '-xf', '-'] : - $self->is_tbz ? [$self->bin_bunzip2, '-cd', $archive, '|', - $self->bin_tar, '-xf', '-'] : - $self->is_txz ? [$self->bin_unxz, '-cd', $archive, '|', - $self->bin_tar, '-xf', '-'] : - [$self->bin_tar, @ExtraTarFlags, '-xf', $archive]; - - my $buffer = ''; - unless( scalar run( command => $cmd, - buffer => \$buffer, - verbose => $DEBUG ) - ) { - return $self->_error(loc("Error extracting archive '%1': %2", - $archive, $buffer )); - } - - ### we might not have them, due to lack of buffers - if( $self->files ) { - ### now that we've extracted, figure out where we extracted to - my $dir = $self->__get_extract_dir( $self->files ); - - ### store the extraction dir ### - $self->extract_path( $dir ); - } - } - - ### we got here, no error happened - return 1; - } -} - - -### use archive::tar to extract ### -sub _untar_at { - my $self = shift; - - ### Loading Archive::Tar is going to set it to 1, so make it local - ### within this block, starting with its initial value. Whatever - ### Achive::Tar does will be undone when we return. - ### - ### Also, later, set $Archive::Tar::WARN to $Archive::Extract::WARN - ### so users don't have to even think about this variable. If they - ### do, they still get their set value outside of this call. - local $Archive::Tar::WARN = $Archive::Tar::WARN; - - ### we definitely need Archive::Tar, so load that first - { my $use_list = { 'Archive::Tar' => '0.0' }; - - unless( can_load( modules => $use_list ) ) { - - $self->_error(loc("You do not have '%1' installed - " . - "Please install it as soon as possible.", - 'Archive::Tar')); - - return METHOD_NA; - } - } - - ### we might pass it a filehandle if it's a .tbz file.. - my $fh_to_read = $self->archive; - - ### we will need Compress::Zlib too, if it's a tgz... and IO::Zlib - ### if A::T's version is 0.99 or higher - if( $self->is_tgz ) { - my $use_list = { 'Compress::Zlib' => '0.0' }; - $use_list->{ 'IO::Zlib' } = '0.0' - if $Archive::Tar::VERSION >= '0.99'; - - unless( can_load( modules => $use_list ) ) { - my $which = join '/', sort keys %$use_list; - - $self->_error(loc( - "You do not have '%1' installed - Please ". - "install it as soon as possible.", $which) - ); - - return METHOD_NA; - } - - } elsif ( $self->is_tbz ) { - my $use_list = { 'IO::Uncompress::Bunzip2' => '0.0' }; - unless( can_load( modules => $use_list ) ) { - $self->_error(loc( - "You do not have '%1' installed - Please " . - "install it as soon as possible.", - 'IO::Uncompress::Bunzip2') - ); - - return METHOD_NA; - } - - my $bz = IO::Uncompress::Bunzip2->new( $self->archive ) or - return $self->_error(loc("Unable to open '%1': %2", - $self->archive, - $IO::Uncompress::Bunzip2::Bunzip2Error)); - - $fh_to_read = $bz; - } elsif ( $self->is_txz ) { - my $use_list = { 'IO::Uncompress::UnXz' => '0.0' }; - unless( can_load( modules => $use_list ) ) { - $self->_error(loc( - "You do not have '%1' installed - Please " . - "install it as soon as possible.", - 'IO::Uncompress::UnXz') - ); - - return METHOD_NA; - } - - my $xz = IO::Uncompress::UnXz->new( $self->archive ) or - return $self->_error(loc("Unable to open '%1': %2", - $self->archive, - $IO::Uncompress::UnXz::UnXzError)); - - $fh_to_read = $xz; - } - - my @files; - { - ### $Archive::Tar::WARN is 1 by default in Archive::Tar, but we've - ### localized $Archive::Tar::WARN already. - $Archive::Tar::WARN = $Archive::Extract::WARN; - - ### only tell it it's compressed if it's a .tgz, as we give it a file - ### handle if it's a .tbz - my @read = ( $fh_to_read, ( $self->is_tgz ? 1 : 0 ) ); - - ### for version of Archive::Tar > 1.04 - local $Archive::Tar::CHOWN = 0; - - ### use the iterator if we can. it's a feature of A::T 1.40 and up - if ( $_ALLOW_TAR_ITER && Archive::Tar->can( 'iter' ) ) { - - my $next; - unless ( $next = Archive::Tar->iter( @read ) ) { - return $self->_error(loc( - "Unable to read '%1': %2", $self->archive, - $Archive::Tar::error)); - } - - while ( my $file = $next->() ) { - push @files, $file->full_path; - - $file->extract or return $self->_error(loc( - "Unable to read '%1': %2", - $self->archive, - $Archive::Tar::error)); - } - - ### older version, read the archive into memory - } else { - - my $tar = Archive::Tar->new(); - - unless( $tar->read( @read ) ) { - return $self->_error(loc("Unable to read '%1': %2", - $self->archive, $Archive::Tar::error)); - } - - ### workaround to prevent Archive::Tar from setting uid, which - ### is a potential security hole. -autrijus - ### have to do it here, since A::T needs to be /loaded/ first ### - { no strict 'refs'; local $^W; - - ### older versions of archive::tar <= 0.23 - *Archive::Tar::chown = sub {}; - } - - { local $^W; # quell 'splice() offset past end of array' warnings - # on older versions of A::T - - ### older archive::tar always returns $self, return value - ### slightly fux0r3d because of it. - $tar->extract or return $self->_error(loc( - "Unable to extract '%1': %2", - $self->archive, $Archive::Tar::error )); - } - - @files = $tar->list_files; - } - } - - my $dir = $self->__get_extract_dir( \@files ); - - ### store the files that are in the archive ### - $self->files(\@files); - - ### store the extraction dir ### - $self->extract_path( $dir ); - - ### check if the dir actually appeared ### - return 1 if -d $self->extract_path; - - ### no dir, we failed ### - return $self->_error(loc("Unable to extract '%1': %2", - $self->archive, $Archive::Tar::error )); -} - -################################# -# -# Gunzip code -# -################################# - -sub _gunzip_bin { - my $self = shift; - - ### check for /bin/gzip -- we need it ### - unless( $self->bin_gzip ) { - $self->_error(loc("No '%1' program found", '/bin/gzip')); - return METHOD_NA; - } - - my $fh = FileHandle->new('>'. $self->_gunzip_to) or - return $self->_error(loc("Could not open '%1' for writing: %2", - $self->_gunzip_to, $! )); - - my $cmd = [ $self->bin_gzip, '-cdf', $self->archive ]; - - my $buffer; - unless( scalar run( command => $cmd, - verbose => $DEBUG, - buffer => \$buffer ) - ) { - return $self->_error(loc("Unable to gunzip '%1': %2", - $self->archive, $buffer)); - } - - ### no buffers available? - if( !IPC::Cmd->can_capture_buffer and !$buffer ) { - $self->_error( $self->_no_buffer_content( $self->archive ) ); - } - - $self->_print($fh, $buffer) if defined $buffer; - - close $fh; - - ### set what files where extract, and where they went ### - $self->files( [$self->_gunzip_to] ); - $self->extract_path( File::Spec->rel2abs(cwd()) ); - - return 1; -} - -sub _gunzip_cz { - my $self = shift; - - my $use_list = { 'Compress::Zlib' => '0.0' }; - unless( can_load( modules => $use_list ) ) { - $self->_error(loc("You do not have '%1' installed - Please " . - "install it as soon as possible.", 'Compress::Zlib')); - return METHOD_NA; - } - - my $gz = Compress::Zlib::gzopen( $self->archive, "rb" ) or - return $self->_error(loc("Unable to open '%1': %2", - $self->archive, $Compress::Zlib::gzerrno)); - - my $fh = FileHandle->new('>'. $self->_gunzip_to) or - return $self->_error(loc("Could not open '%1' for writing: %2", - $self->_gunzip_to, $! )); - - my $buffer; - $self->_print($fh, $buffer) while $gz->gzread($buffer) > 0; - $fh->close; - - ### set what files where extract, and where they went ### - $self->files( [$self->_gunzip_to] ); - $self->extract_path( File::Spec->rel2abs(cwd()) ); - - return 1; -} - -################################# -# -# Uncompress code -# -################################# - -sub _uncompress_bin { - my $self = shift; - - ### check for /bin/gzip -- we need it ### - unless( $self->bin_uncompress ) { - $self->_error(loc("No '%1' program found", '/bin/uncompress')); - return METHOD_NA; - } - - my $fh = FileHandle->new('>'. $self->_gunzip_to) or - return $self->_error(loc("Could not open '%1' for writing: %2", - $self->_gunzip_to, $! )); - - my $cmd = [ $self->bin_uncompress, '-c', $self->archive ]; - - my $buffer; - unless( scalar run( command => $cmd, - verbose => $DEBUG, - buffer => \$buffer ) - ) { - return $self->_error(loc("Unable to uncompress '%1': %2", - $self->archive, $buffer)); - } - - ### no buffers available? - if( !IPC::Cmd->can_capture_buffer and !$buffer ) { - $self->_error( $self->_no_buffer_content( $self->archive ) ); - } - - $self->_print($fh, $buffer) if defined $buffer; - - close $fh; - - ### set what files where extract, and where they went ### - $self->files( [$self->_gunzip_to] ); - $self->extract_path( File::Spec->rel2abs(cwd()) ); - - return 1; -} - - -################################# -# -# Unzip code -# -################################# - - -sub _unzip_bin { - my $self = shift; - - ### check for /bin/gzip if we need it ### - unless( $self->bin_unzip ) { - $self->_error(loc("No '%1' program found", '/bin/unzip')); - return METHOD_NA; - } - - ### first, get the files.. it must be 2 different commands with 'unzip' :( - { ### on VMS, capital letter options have to be quoted. This is - ### reported by John Malmberg on P5P Tue 21 Aug 2007 05:05:11 - ### Subject: [patch@31735]Archive Extract fix on VMS. - my $opt = ON_VMS ? '"-Z"' : '-Z'; - my $cmd = [ $self->bin_unzip, $opt, '-1', $self->archive ]; - - my $buffer = ''; - unless( scalar run( command => $cmd, - verbose => $DEBUG, - buffer => \$buffer ) - ) { - return $self->_error(loc("Unable to unzip '%1': %2", - $self->archive, $buffer)); - } - - ### no buffers available? - if( !IPC::Cmd->can_capture_buffer and !$buffer ) { - $self->_error( $self->_no_buffer_files( $self->archive ) ); - - } else { - ### Annoyingly, pesky MSWin32 can either have 'native' tools - ### which have \r\n line endings or Cygwin-based tools which - ### have \n line endings. Jan Dubois suggested using this fix - local $/ = ON_WIN32 ? qr/\r?\n/ : "\n"; - $self->files( [split $/, $buffer] ); - } - } - - ### now, extract the archive ### - { my $cmd = [ $self->bin_unzip, '-qq', '-o', $self->archive ]; - - my $buffer; - unless( scalar run( command => $cmd, - verbose => $DEBUG, - buffer => \$buffer ) - ) { - return $self->_error(loc("Unable to unzip '%1': %2", - $self->archive, $buffer)); - } - - if( scalar @{$self->files} ) { - my $files = $self->files; - my $dir = $self->__get_extract_dir( $files ); - - $self->extract_path( $dir ); - } - } - - return 1; -} - -sub _unzip_az { - my $self = shift; - - my $use_list = { 'Archive::Zip' => '0.0' }; - unless( can_load( modules => $use_list ) ) { - $self->_error(loc("You do not have '%1' installed - Please " . - "install it as soon as possible.", 'Archive::Zip')); - return METHOD_NA; - } - - my $zip = Archive::Zip->new(); - - unless( $zip->read( $self->archive ) == &Archive::Zip::AZ_OK ) { - return $self->_error(loc("Unable to read '%1'", $self->archive)); - } - - my @files; - - - ### Address: #43278: Explicitly tell Archive::Zip where to put the files: - ### "In my BackPAN indexing, Archive::Zip was extracting things - ### in my script's directory instead of the current working directory. - ### I traced this back through Archive::Zip::_asLocalName which - ### eventually calls File::Spec::Win32::rel2abs which on Windows might - ### call Cwd::getdcwd. getdcwd returns the wrong directory in my - ### case, even though I think I'm on the same drive. - ### - ### To fix this, I pass the optional second argument to - ### extractMember using the cwd from Archive::Extract." --bdfoy - - ## store cwd() before looping; calls to cwd() can be expensive, and - ### it won't change during the loop - my $extract_dir = cwd(); - - ### have to extract every member individually ### - for my $member ($zip->members) { - push @files, $member->{fileName}; - - ### file to extract to, to avoid the above problem - my $to = File::Spec->catfile( $extract_dir, $member->{fileName} ); - - unless( $zip->extractMember($member, $to) == &Archive::Zip::AZ_OK ) { - return $self->_error(loc("Extraction of '%1' from '%2' failed", - $member->{fileName}, $self->archive )); - } - } - - my $dir = $self->__get_extract_dir( \@files ); - - ### set what files where extract, and where they went ### - $self->files( \@files ); - $self->extract_path( File::Spec->rel2abs($dir) ); - - return 1; -} - -sub __get_extract_dir { - my $self = shift; - my $files = shift || []; - - return unless scalar @$files; - - my($dir1, $dir2); - for my $aref ( [ \$dir1, 0 ], [ \$dir2, -1 ] ) { - my($dir,$pos) = @$aref; - - ### add a catdir(), so that any trailing slashes get - ### take care of (removed) - ### also, a catdir() normalises './dir/foo' to 'dir/foo'; - ### which was the problem in bug #23999 - my $res = -d $files->[$pos] - ? File::Spec->catdir( $files->[$pos], '' ) - : File::Spec->catdir( dirname( $files->[$pos] ) ); - - $$dir = $res; - } - - ### if the first and last dir don't match, make sure the - ### dirname is not set wrongly - my $dir; - - ### dirs are the same, so we know for sure what the extract dir is - if( $dir1 eq $dir2 ) { - $dir = $dir1; - - ### dirs are different.. do they share the base dir? - ### if so, use that, if not, fall back to '.' - } else { - my $base1 = [ File::Spec->splitdir( $dir1 ) ]->[0]; - my $base2 = [ File::Spec->splitdir( $dir2 ) ]->[0]; - - $dir = File::Spec->rel2abs( $base1 eq $base2 ? $base1 : '.' ); - } - - return File::Spec->rel2abs( $dir ); -} - -################################# -# -# Bunzip2 code -# -################################# - -sub _bunzip2_bin { - my $self = shift; - - ### check for /bin/gzip -- we need it ### - unless( $self->bin_bunzip2 ) { - $self->_error(loc("No '%1' program found", '/bin/bunzip2')); - return METHOD_NA; - } - - my $fh = FileHandle->new('>'. $self->_gunzip_to) or - return $self->_error(loc("Could not open '%1' for writing: %2", - $self->_gunzip_to, $! )); - - ### guard against broken bunzip2. See ->have_old_bunzip2() - ### for details - if( $self->have_old_bunzip2 and $self->archive !~ /\.bz2$/i ) { - return $self->_error(loc("Your bunzip2 version is too old and ". - "can only extract files ending in '%1'", - '.bz2')); - } - - my $cmd = [ $self->bin_bunzip2, '-cd', $self->archive ]; - - my $buffer; - unless( scalar run( command => $cmd, - verbose => $DEBUG, - buffer => \$buffer ) - ) { - return $self->_error(loc("Unable to bunzip2 '%1': %2", - $self->archive, $buffer)); - } - - ### no buffers available? - if( !IPC::Cmd->can_capture_buffer and !$buffer ) { - $self->_error( $self->_no_buffer_content( $self->archive ) ); - } - - $self->_print($fh, $buffer) if defined $buffer; - - close $fh; - - ### set what files where extract, and where they went ### - $self->files( [$self->_gunzip_to] ); - $self->extract_path( File::Spec->rel2abs(cwd()) ); - - return 1; -} - -### using cz2, the compact versions... this we use mainly in archive::tar -### extractor.. -# sub _bunzip2_cz1 { -# my $self = shift; -# -# my $use_list = { 'IO::Uncompress::Bunzip2' => '0.0' }; -# unless( can_load( modules => $use_list ) ) { -# return $self->_error(loc("You do not have '%1' installed - Please " . -# "install it as soon as possible.", -# 'IO::Uncompress::Bunzip2')); -# } -# -# my $bz = IO::Uncompress::Bunzip2->new( $self->archive ) or -# return $self->_error(loc("Unable to open '%1': %2", -# $self->archive, -# $IO::Uncompress::Bunzip2::Bunzip2Error)); -# -# my $fh = FileHandle->new('>'. $self->_gunzip_to) or -# return $self->_error(loc("Could not open '%1' for writing: %2", -# $self->_gunzip_to, $! )); -# -# my $buffer; -# $fh->print($buffer) while $bz->read($buffer) > 0; -# $fh->close; -# -# ### set what files where extract, and where they went ### -# $self->files( [$self->_gunzip_to] ); -# $self->extract_path( File::Spec->rel2abs(cwd()) ); -# -# return 1; -# } - -sub _bunzip2_bz2 { - my $self = shift; - - my $use_list = { 'IO::Uncompress::Bunzip2' => '0.0' }; - unless( can_load( modules => $use_list ) ) { - $self->_error(loc("You do not have '%1' installed - Please " . - "install it as soon as possible.", - 'IO::Uncompress::Bunzip2')); - return METHOD_NA; - } - - IO::Uncompress::Bunzip2::bunzip2($self->archive => $self->_gunzip_to) - or return $self->_error(loc("Unable to uncompress '%1': %2", - $self->archive, - $IO::Uncompress::Bunzip2::Bunzip2Error)); - - ### set what files where extract, and where they went ### - $self->files( [$self->_gunzip_to] ); - $self->extract_path( File::Spec->rel2abs(cwd()) ); - - return 1; -} - -################################# -# -# UnXz code -# -################################# - -sub _unxz_bin { - my $self = shift; - - ### check for /bin/unxz -- we need it ### - unless( $self->bin_unxz ) { - $self->_error(loc("No '%1' program found", '/bin/unxz')); - return METHOD_NA; - } - - my $fh = FileHandle->new('>'. $self->_gunzip_to) or - return $self->_error(loc("Could not open '%1' for writing: %2", - $self->_gunzip_to, $! )); - - my $cmd = [ $self->bin_unxz, '-cdf', $self->archive ]; - - my $buffer; - unless( scalar run( command => $cmd, - verbose => $DEBUG, - buffer => \$buffer ) - ) { - return $self->_error(loc("Unable to unxz '%1': %2", - $self->archive, $buffer)); - } - - ### no buffers available? - if( !IPC::Cmd->can_capture_buffer and !$buffer ) { - $self->_error( $self->_no_buffer_content( $self->archive ) ); - } - - $self->_print($fh, $buffer) if defined $buffer; - - close $fh; - - ### set what files where extract, and where they went ### - $self->files( [$self->_gunzip_to] ); - $self->extract_path( File::Spec->rel2abs(cwd()) ); - - return 1; -} - -sub _unxz_cz { - my $self = shift; - - my $use_list = { 'IO::Uncompress::UnXz' => '0.0' }; - unless( can_load( modules => $use_list ) ) { - $self->_error(loc("You do not have '%1' installed - Please " . - "install it as soon as possible.", - 'IO::Uncompress::UnXz')); - return METHOD_NA; - } - - IO::Uncompress::UnXz::unxz($self->archive => $self->_gunzip_to) - or return $self->_error(loc("Unable to uncompress '%1': %2", - $self->archive, - $IO::Uncompress::UnXz::UnXzError)); - - ### set what files where extract, and where they went ### - $self->files( [$self->_gunzip_to] ); - $self->extract_path( File::Spec->rel2abs(cwd()) ); - - return 1; -} - - -################################# -# -# unlzma code -# -################################# - -sub _unlzma_bin { - my $self = shift; - - ### check for /bin/unlzma -- we need it ### - unless( $self->bin_unlzma ) { - $self->_error(loc("No '%1' program found", '/bin/unlzma')); - return METHOD_NA; - } - - my $fh = FileHandle->new('>'. $self->_gunzip_to) or - return $self->_error(loc("Could not open '%1' for writing: %2", - $self->_gunzip_to, $! )); - - my $cmd = [ $self->bin_unlzma, '-c', $self->archive ]; - - my $buffer; - unless( scalar run( command => $cmd, - verbose => $DEBUG, - buffer => \$buffer ) - ) { - return $self->_error(loc("Unable to unlzma '%1': %2", - $self->archive, $buffer)); - } - - ### no buffers available? - if( !IPC::Cmd->can_capture_buffer and !$buffer ) { - $self->_error( $self->_no_buffer_content( $self->archive ) ); - } - - $self->_print($fh, $buffer) if defined $buffer; - - close $fh; - - ### set what files where extract, and where they went ### - $self->files( [$self->_gunzip_to] ); - $self->extract_path( File::Spec->rel2abs(cwd()) ); - - return 1; -} - -sub _unlzma_cz { - my $self = shift; - - my $use_list1 = { 'IO::Uncompress::UnLzma' => '0.0' }; - my $use_list2 = { 'Compress::unLZMA' => '0.0' }; - - if (can_load( modules => $use_list1 ) ) { - IO::Uncompress::UnLzma::unlzma($self->archive => $self->_gunzip_to) - or return $self->_error(loc("Unable to uncompress '%1': %2", - $self->archive, - $IO::Uncompress::UnLzma::UnLzmaError)); - } - elsif (can_load( modules => $use_list2 ) ) { - - my $fh = FileHandle->new('>'. $self->_gunzip_to) or - return $self->_error(loc("Could not open '%1' for writing: %2", - $self->_gunzip_to, $! )); - - my $buffer; - $buffer = Compress::unLZMA::uncompressfile( $self->archive ); - unless ( defined $buffer ) { - return $self->_error(loc("Could not unlzma '%1': %2", - $self->archive, $@)); - } - - $self->_print($fh, $buffer) if defined $buffer; - - close $fh; - } - else { - $self->_error(loc("You do not have '%1' or '%2' installed - Please " . - "install it as soon as possible.", 'Compress::unLZMA', 'IO::Uncompress::UnLzma')); - return METHOD_NA; - } - - ### set what files where extract, and where they went ### - $self->files( [$self->_gunzip_to] ); - $self->extract_path( File::Spec->rel2abs(cwd()) ); - - return 1; -} - -################################# -# -# Error code -# -################################# - -# For printing binaries that avoids interfering globals -sub _print { - my $self = shift; - my $fh = shift; - - local( $\, $", $, ) = ( undef, ' ', '' ); - return print $fh @_; -} - -sub _error { - my $self = shift; - my $error = shift; - my $lerror = Carp::longmess($error); - - push @{$self->_error_msg}, $error; - push @{$self->_error_msg_long}, $lerror; - - ### set $Archive::Extract::WARN to 0 to disable printing - ### of errors - if( $WARN ) { - carp $DEBUG ? $lerror : $error; - } - - return; -} - -sub error { - my $self = shift; - - ### make sure we have a fallback aref - my $aref = do { - shift() - ? $self->_error_msg_long - : $self->_error_msg - } || []; - - return join $/, @$aref; -} - -=head2 debug( MESSAGE ) - -This method outputs MESSAGE to the default filehandle if C<$DEBUG> is -true. It's a small method, but it's here if you'd like to subclass it -so you can so something else with any debugging output. - -=cut - -### this is really a stub for subclassing -sub debug { - return unless $DEBUG; - - print $_[1]; -} - -sub _no_buffer_files { - my $self = shift; - my $file = shift or return; - return loc("No buffer captured, unable to tell ". - "extracted files or extraction dir for '%1'", $file); -} - -sub _no_buffer_content { - my $self = shift; - my $file = shift or return; - return loc("No buffer captured, unable to get content for '%1'", $file); -} -1; - -=pod - -=head1 HOW IT WORKS - -C tries first to determine what type of archive you -are passing it, by inspecting its suffix. It does not do this by using -Mime magic, or something related. See C below. - -Once it has determined the file type, it knows which extraction methods -it can use on the archive. It will try a perl solution first, then fall -back to a commandline tool if that fails. If that also fails, it will -return false, indicating it was unable to extract the archive. -See the section on C to see how to alter this order. - -=head1 CAVEATS - -=head2 File Extensions - -C trusts on the extension of the archive to determine -what type it is, and what extractor methods therefore can be used. If -your archives do not have any of the extensions as described in the -C method, you will have to specify the type explicitly, or -C will not be able to extract the archive for you. - -=head2 Supporting Very Large Files - -C can use either pure perl modules or command line -programs under the hood. Some of the pure perl modules (like -C and Compress::unLZMA) take the entire contents of the archive into memory, -which may not be feasible on your system. Consider setting the global -variable C<$Archive::Extract::PREFER_BIN> to C<1>, which will prefer -the use of command line programs and won't consume so much memory. - -See the C section below for details. - -=head2 Bunzip2 support of arbitrary extensions. - -Older versions of C do not support arbitrary file -extensions and insist on a C<.bz2> suffix. Although we do our best -to guard against this, if you experience a bunzip2 error, it may -be related to this. For details, please see the C -method. - -=head1 GLOBAL VARIABLES - -=head2 $Archive::Extract::DEBUG - -Set this variable to C to have all calls to command line tools -be printed out, including all their output. -This also enables C errors, instead of the regular -C errors. - -Good for tracking down why things don't work with your particular -setup. - -Defaults to C. - -=head2 $Archive::Extract::WARN - -This variable controls whether errors encountered internally by -C should be C'd or not. - -Set to false to silence warnings. Inspect the output of the C -method manually to see what went wrong. - -Defaults to C. - -=head2 $Archive::Extract::PREFER_BIN - -This variables controls whether C should prefer the -use of perl modules, or commandline tools to extract archives. - -Set to C to have C prefer commandline tools. - -Defaults to C. - -=head1 TODO / CAVEATS - -=over 4 - -=item Mime magic support - -Maybe this module should use something like C to determine -the type, rather than blindly trust the suffix. - -=item Thread safety - -Currently, C does a C to the extraction dir before -extraction, and a C back again after. This is not necessarily -thread safe. See C bug C<#45671> for details. - -=back - -=head1 BUG REPORTS - -Please report bugs or other issues to Ebug-archive-extract@rt.cpan.orgE. - -=head1 AUTHOR - -This module by Jos Boumans Ekane@cpan.orgE. - -=head1 COPYRIGHT - -This library is free software; you may redistribute and/or modify it -under the same terms as Perl itself. - -=cut - -# Local variables: -# c-indentation-style: bsd -# c-basic-offset: 4 -# indent-tabs-mode: nil -# End: -# vim: expandtab shiftwidth=4: - Index: gnu/usr.bin/perl/cpan/Archive-Extract/t/01_Archive-Extract.t =================================================================== RCS file: gnu/usr.bin/perl/cpan/Archive-Extract/t/01_Archive-Extract.t diff -N gnu/usr.bin/perl/cpan/Archive-Extract/t/01_Archive-Extract.t --- gnu/usr.bin/perl/cpan/Archive-Extract/t/01_Archive-Extract.t 24 Mar 2014 14:58:48 -0000 1.1.1.3 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,557 +0,0 @@ -BEGIN { chdir 't' if -d 't' }; -BEGIN { mkdir 'out' unless -d 'out' }; - -### left behind, at least on Win32. See core patch #31904 -END { rmtree('out') }; - -use strict; -use lib qw[../lib]; - -use constant IS_WIN32 => $^O eq 'MSWin32' ? 1 : 0; -use constant IS_CYGWIN => $^O eq 'cygwin' ? 1 : 0; -use constant IS_VMS => $^O eq 'VMS' ? 1 : 0; - -use Cwd qw[cwd]; -use Test::More qw[no_plan]; -use File::Spec; -use File::Spec::Unix; -use File::Path; -use Data::Dumper; -use File::Basename qw[basename]; -use Module::Load::Conditional qw[check_install]; - -### uninitialized value in File::Spec warnings come from A::Zip: -# t/01_Archive-Extract....ok 135/0Use of uninitialized value in concatenation (.) or string at /opt/lib/perl5/5.8.3/File/Spec/Unix.pm line 313. -# File::Spec::Unix::catpath('File::Spec','','','undef') called at /opt/lib/perl5/site_perl/5.8.3/Archive/Zip.pm line 473 -# Archive::Zip::_asLocalName('') called at /opt/lib/perl5/site_perl/5.8.3/Archive/Zip.pm line 652 -# Archive::Zip::Archive::extractMember('Archive::Zip::Archive=HASH(0x9679c8)','Archive::Zip::ZipFileMember=HASH(0x9678fc)') called at ../lib/Archive/Extract.pm line 753 -# Archive::Extract::_unzip_az('Archive::Extract=HASH(0x966eac)') called at ../lib/Archive/Extract.pm line 674 -# Archive::Extract::_unzip('Archive::Extract=HASH(0x966eac)') called at ../lib/Archive/Extract.pm line 275 -# Archive::Extract::extract('Archive::Extract=HASH(0x966eac)','to','/Users/kane/sources/p4/other/archive-extract/t/out') called at t/01_Archive-Extract.t line 180 -#BEGIN { $SIG{__WARN__} = sub { require Carp; Carp::cluck(@_) } }; - -if ((IS_WIN32 or IS_CYGWIN) && ! $ENV{PERL_CORE}) { - diag( "Older versions of Archive::Zip may cause File::Spec warnings" ); - diag( "See bug #19713 in rt.cpan.org. It is safe to ignore them" ); -} - -my $Me = basename( $0 ); -my $Class = 'Archive::Extract'; - -use_ok($Class); - -### debug will always be enabled on dev versions -my $Debug = (not $ENV{PERL_CORE} and - ($ARGV[0] or $Archive::Extract::VERSION =~ /_/)) - ? 1 - : 0; - -my $Self = File::Spec->rel2abs( - IS_WIN32 ? &Win32::GetShortPathName( cwd() ) : cwd() - ); -my $SrcDir = File::Spec->catdir( $Self,'src' ); -my $OutDir = File::Spec->catdir( $Self,'out' ); - -### stupid stupid silly stupid warnings silly! ### -$Archive::Extract::DEBUG = $Archive::Extract::DEBUG = $Debug; -$Archive::Extract::WARN = $Archive::Extract::WARN = $Debug; - -diag( "\n\n*** DEBUG INFORMATION ENABLED ***\n\n" ) if $Debug; - -# Be as evil as possible to print -$\ = "ORS_FLAG"; -$, = "OFS_FLAG"; -$" = "LISTSEP_FLAG"; - -my $tmpl = { - ### plain files - 'x.bz2' => { programs => [qw[bunzip2]], - modules => [qw[IO::Uncompress::Bunzip2]], - method => 'is_bz2', - outfile => 'a', - }, - 'x.tgz' => { programs => [qw[gzip tar]], - modules => [qw[Archive::Tar IO::Zlib]], - method => 'is_tgz', - outfile => 'a', - }, - 'x.tar.gz' => { programs => [qw[gzip tar]], - modules => [qw[Archive::Tar IO::Zlib]], - method => 'is_tgz', - outfile => 'a', - }, - 'x.tar' => { programs => [qw[tar]], - modules => [qw[Archive::Tar]], - method => 'is_tar', - outfile => 'a', - }, - 'x.gz' => { programs => [qw[gzip]], - modules => [qw[Compress::Zlib]], - method => 'is_gz', - outfile => 'a', - }, - 'x.Z' => { programs => [qw[uncompress]], - modules => [qw[Compress::Zlib]], - method => 'is_Z', - outfile => 'a', - }, - 'x.zip' => { programs => [qw[unzip]], - modules => [qw[Archive::Zip]], - method => 'is_zip', - outfile => 'a', - }, - 'x.jar' => { programs => [qw[unzip]], - modules => [qw[Archive::Zip]], - method => 'is_zip', - outfile => 'a', - }, - 'x.ear' => { programs => [qw[unzip]], - modules => [qw[Archive::Zip]], - method => 'is_zip', - outfile => 'a', - }, - 'x.war' => { programs => [qw[unzip]], - modules => [qw[Archive::Zip]], - method => 'is_zip', - outfile => 'a', - }, - 'x.par' => { programs => [qw[unzip]], - modules => [qw[Archive::Zip]], - method => 'is_zip', - outfile => 'a', - }, - 'x.lzma' => { programs => [qw[unlzma]], - modules => [qw[Compress::unLZMA]], - method => 'is_lzma', - outfile => 'a', - }, - 'x.xz' => { programs => [qw[unxz]], - modules => [qw[IO::Uncompress::UnXz]], - method => 'is_xz', - outfile => 'a', - }, - 'x.txz' => { programs => [qw[unxz tar]], - modules => [qw[Archive::Tar - IO::Uncompress::UnXz]], - method => 'is_txz', - outfile => 'a', - }, - 'x.tar.xz'=> { programs => [qw[unxz tar]], - modules => [qw[Archive::Tar - IO::Uncompress::UnXz]], - method => 'is_txz', - outfile => 'a', - }, - ### with a directory - 'y.tbz' => { programs => [qw[bunzip2 tar]], - modules => [qw[Archive::Tar - IO::Uncompress::Bunzip2]], - method => 'is_tbz', - outfile => 'z', - outdir => 'y', - }, - 'y.tar.bz2' => { programs => [qw[bunzip2 tar]], - modules => [qw[Archive::Tar - IO::Uncompress::Bunzip2]], - method => 'is_tbz', - outfile => 'z', - outdir => 'y' - }, - 'y.txz' => { programs => [qw[unxz tar]], - modules => [qw[Archive::Tar - IO::Uncompress::UnXz]], - method => 'is_txz', - outfile => 'z', - outdir => 'y', - }, - 'y.tar.xz' => { programs => [qw[unxz tar]], - modules => [qw[Archive::Tar - IO::Uncompress::UnXz]], - method => 'is_txz', - outfile => 'z', - outdir => 'y' - }, - 'y.tgz' => { programs => [qw[gzip tar]], - modules => [qw[Archive::Tar IO::Zlib]], - method => 'is_tgz', - outfile => 'z', - outdir => 'y' - }, - 'y.tar.gz' => { programs => [qw[gzip tar]], - modules => [qw[Archive::Tar IO::Zlib]], - method => 'is_tgz', - outfile => 'z', - outdir => 'y' - }, - 'y.tar' => { programs => [qw[tar]], - modules => [qw[Archive::Tar]], - method => 'is_tar', - outfile => 'z', - outdir => 'y' - }, - 'y.zip' => { programs => [qw[unzip]], - modules => [qw[Archive::Zip]], - method => 'is_zip', - outfile => 'z', - outdir => 'y' - }, - 'y.par' => { programs => [qw[unzip]], - modules => [qw[Archive::Zip]], - method => 'is_zip', - outfile => 'z', - outdir => 'y' - }, - 'y.jar' => { programs => [qw[unzip]], - modules => [qw[Archive::Zip]], - method => 'is_zip', - outfile => 'z', - outdir => 'y' - }, - 'y.ear' => { programs => [qw[unzip]], - modules => [qw[Archive::Zip]], - method => 'is_zip', - outfile => 'z', - outdir => 'y' - }, - 'y.war' => { programs => [qw[unzip]], - modules => [qw[Archive::Zip]], - method => 'is_zip', - outfile => 'z', - outdir => 'y' - }, - ### with non-same top dir - 'double_dir.zip' => { - programs => [qw[unzip]], - modules => [qw[Archive::Zip]], - method => 'is_zip', - outfile => 'w', - outdir => 'x' - }, -}; - -### XXX special case: on older solaris boxes (8), -### bunzip2 is version 0.9.x. Older versions (pre 1), -### only extract files that end in .bz2, and nothing -### else. So remove that test case if we have an older -### bunzip2 :( -{ if( $Class->have_old_bunzip2 ) { - delete $tmpl->{'y.tbz'}; - diag "Old bunzip2 detected, skipping .tbz test"; - } -} - -### show us the tools IPC::Cmd will use to run binary programs -if( $Debug ) { - diag( "IPC::Run enabled: $IPC::Cmd::USE_IPC_RUN " ); - diag( "IPC::Run available: " . IPC::Cmd->can_use_ipc_run ); - diag( "IPC::Run vesion: $IPC::Run::VERSION" ); - diag( "IPC::Open3 enabled: $IPC::Cmd::USE_IPC_OPEN3 " ); - diag( "IPC::Open3 available: " . IPC::Cmd->can_use_ipc_open3 ); - diag( "IPC::Open3 vesion: $IPC::Open3::VERSION" ); -} - -### test all type specifications to new() -### this tests bug #24578: Wrong check for `type' argument -{ my $meth = 'types'; - - can_ok( $Class, $meth ); - - my @types = $Class->$meth; - ok( scalar(@types), " Got a list of types" ); - - for my $type ( @types ) { - my $obj = $Class->new( archive => $Me, type => $type ); - ok( $obj, " Object created based on '$type'" ); - ok( !$obj->error, " No error logged" ); - } - - ### test unknown type - { ### must turn on warnings to catch error here - local $Archive::Extract::WARN = 1; - - my $warnings; - local $SIG{__WARN__} = sub { $warnings .= "@_" }; - - my $ae = $Class->new( archive => $Me ); - ok( !$ae, " No archive created based on '$Me'" ); - ok( !$Class->error, " Error not captured in class method" ); - ok( $warnings, " Error captured as warning" ); - like( $warnings, qr/Cannot determine file type for/, - " Error is: unknown file type" ); - } -} - -### test multiple errors -### XXX whitebox test -{ ### grab a random file from the template, so we can make an object - my $ae = Archive::Extract->new( - archive => File::Spec->catfile($SrcDir,[keys %$tmpl]->[0]) - ); - ok( $ae, "Archive created" ); - ok( not($ae->error), " No errors yet" ); - - ### log a few errors - { local $Archive::Extract::WARN = 0; - $ae->_error( $_ ) for 1..5; - } - - my $err = $ae->error; - ok( $err, " Errors retrieved" ); - - my $expect = join $/, 1..5; - is( $err, $expect, " As expected" ); - - ### this resets the errors - ### override the 'check' routine to return false, so we bail out of - ### extract() early and just run the error reset code; - { no warnings qw[once redefine]; - local *Archive::Extract::check = sub { return }; - $ae->extract; - } - ok( not($ae->error), " Errors erased after ->extract() call" ); -} - -### XXX whitebox test -### test __get_extract_dir -SKIP: { my $meth = '__get_extract_dir'; - - ### get the right separator -- File::Spec does clean ups for - ### paths, so we need to join ourselves. - my $sep = [ split '', File::Spec->catfile( 'a', 'b' ) ]->[1]; - - ### bug #23999: Attempt to generate Makefile.PL gone awry - ### showed that dirs in the style of './dir/' were reported - ### to be unpacked in '.' rather than in 'dir'. here we test - ### for this. - for my $prefix ( '', '.' ) { - skip "Prepending ./ to a valid path doesn't give you another valid path on VMS", 2 - if IS_VMS && length($prefix); - - my $dir = basename( $SrcDir ); - - ### build a list like [dir, dir/file] and [./dir ./dir/file] - ### where the dir and file actually exist, which is important - ### for the method call - my @files = map { length $prefix - ? join $sep, $prefix, $_ - : $_ - } $dir, File::Spec->catfile( $dir, [keys %$tmpl]->[0] ); - - my $res = $Class->$meth( \@files ); - $res = &Win32::GetShortPathName( $res ) if IS_WIN32; - - ok( $res, "Found extraction dir '$res'" ); - is( $res, $SrcDir, " Is expected dir '$SrcDir'" ); - } -} - -### configuration to run in: allow perl or allow binaries -for my $switch ( [0,1], [1,0] ) { - my $cfg = "PP: $switch->[0] Bin: $switch->[1]"; - - local $Archive::Extract::_ALLOW_PURE_PERL = $switch->[0]; - local $Archive::Extract::_ALLOW_BIN = $switch->[1]; - - diag("Running extract with configuration: $cfg") if $Debug; - - for my $archive (keys %$tmpl) { - diag("Archive : $archive") if $Debug; - - ### check first if we can do the proper - - my $ae = Archive::Extract->new( - archive => File::Spec->catfile($SrcDir,$archive) ); - - ### Do an extra run with _ALLOW_TAR_ITER = 0 if it's a tar file of some - ### sort - my @with_tar_iter = ( 1 ); - push @with_tar_iter, 0 if grep { $ae->$_ } qw[is_tbz is_tgz is_txz is_tar]; - - for my $tar_iter (@with_tar_iter) { SKIP: { - - ### Doesn't matter unless .tar, .tbz, .tgz, .txz - local $Archive::Extract::_ALLOW_TAR_ITER = $tar_iter; - - diag("Archive::Tar->iter: $tar_iter") if $Debug; - - isa_ok( $ae, $Class ); - - my $method = $tmpl->{$archive}->{method}; - ok( $ae->$method(), "Archive type $method recognized properly" ); - - my $file = $tmpl->{$archive}->{outfile}; - my $dir = $tmpl->{$archive}->{outdir}; # can be undef - my $rel_path = File::Spec->catfile( grep { defined } $dir, $file ); - my $abs_path = File::Spec->catfile( $OutDir, $rel_path ); - my $abs_dir = File::Spec->catdir( - grep { defined } $OutDir, $dir ); - my $nix_path = File::Spec::Unix->catfile( - grep { defined } $dir, $file ); - - ### check if we can run this test ### - my $pgm_fail; my $mod_fail; - for my $pgm ( @{$tmpl->{$archive}->{programs}} ) { - ### no binary extract method - $pgm_fail++, next unless $pgm; - - ### we dont have the program - $pgm_fail++ unless $Archive::Extract::PROGRAMS->{$pgm} && - $Archive::Extract::PROGRAMS->{$pgm}; - - } - - for my $mod ( @{$tmpl->{$archive}->{modules}} ) { - ### no module extract method - $mod_fail++, next unless $mod; - - ### we dont have the module - $mod_fail++ unless check_install( module => $mod ); - } - - ### where to extract to -- try both dir and file for gz files - ### XXX test me! - #my @outs = $ae->is_gz ? ($abs_path, $OutDir) : ($OutDir); - my @outs = $ae->is_gz || $ae->is_bz2 || $ae->is_Z || $ae->is_lzma || $ae->is_xz - ? ($abs_path) - : ($OutDir); - - ### 10 tests from here on down ### - if( ($mod_fail && ($pgm_fail || !$Archive::Extract::_ALLOW_BIN)) - || - ($pgm_fail && ($mod_fail || !$Archive::Extract::_ALLOW_PURE_PERL)) - ) { - skip "No binaries or modules to extract ".$archive, - (10 * scalar @outs); - } - - ### we dont warnings spewed about missing modules, that might - ### be a problem... - local $IPC::Cmd::WARN = 0; - local $IPC::Cmd::WARN = 0; - - for my $use_buffer ( IPC::Cmd->can_capture_buffer , 0 ) { - - ### test buffers ### - my $turn_off = !$use_buffer && !$pgm_fail && - $Archive::Extract::_ALLOW_BIN; - - ### whitebox test ### - ### stupid warnings ### - local $IPC::Cmd::USE_IPC_RUN = 0 if $turn_off; - local $IPC::Cmd::USE_IPC_RUN = 0 if $turn_off; - local $IPC::Cmd::USE_IPC_OPEN3 = 0 if $turn_off; - local $IPC::Cmd::USE_IPC_OPEN3 = 0 if $turn_off; - - - ### try extracting ### - for my $to ( @outs ) { - - diag("Extracting to: $to") if $Debug; - diag("Buffers enabled: ".!$turn_off) if $Debug; - - my $rv = $ae->extract( to => $to ); - - SKIP: { - my $re = qr/^No buffer captured/; - my $err = $ae->error || ''; - - ### skip buffer tests if we dont have buffers or - ### explicitly turned them off - skip "No buffers available", 8 - if ( $turn_off || !IPC::Cmd->can_capture_buffer) - && $err =~ $re; - - ### skip tests if we dont have an extractor - skip "No extractor available", 8 - if $err =~ /Extract failed; no extractors available/; - - ### win32 + bin utils is notorious, and none of them are - ### officially supported by strawberry. So if we - ### encounter an error while extracting while running - ### with $PREFER_BIN on win32, just skip the tests. - ### See rt#46948: unable to install install on win32 - ### for details on the pain - skip "Binary tools on Win32 are very unreliable", 8 - if $err and $Archive::Extract::_ALLOW_BIN - and IS_WIN32; - - ok( $rv, "extract() for '$archive' reports success ($cfg)"); - - diag("Extractor was: " . $ae->_extractor) if $Debug; - - ### if we /should/ have buffers, there should be - ### no errors complaining we dont have them... - unlike( $err, $re, - "No errors capturing buffers" ); - - ### might be 1 or 2, depending whether we extracted - ### a dir too - my $files = $ae->files || []; - my $file_cnt = grep { defined } $file, $dir; - is( scalar @$files, $file_cnt, - "Found correct number of output files (@$files)" ); - - ### due to prototypes on is(), if there's no -1 index on - ### the array ref, it'll give a fatal exception: - ### "Modification of non-creatable array value attempted, - ### subscript -1 at -e line 1." So wrap it in do { } - is( do { $files->[-1] }, $nix_path, - "Found correct output file '$nix_path'" ); - - ok( -e $abs_path, - "Output file '$abs_path' exists" ); - ok( $ae->extract_path, - "Extract dir found" ); - ok( -d $ae->extract_path, - "Extract dir exists" ); - is( $ae->extract_path, $abs_dir, - "Extract dir is expected '$abs_dir'" ); - } - - SKIP: { - skip "Unlink tests are unreliable on Win32", 3 if IS_WIN32; - - 1 while unlink $abs_path; - ok( !(-e $abs_path), "Output file successfully removed" ); - - SKIP: { - skip "No extract path captured, can't remove paths", 2 - unless $ae->extract_path; - - ### if something went wrong with determining the out - ### path, don't go deleting stuff.. might be Really Bad - my $out_re = quotemeta( $OutDir ); - - ### VMS directory layout is different. Craig Berry - ### explains: - ### the test is trying to determine if C - ### is part of C. Except in VMS - ### syntax, that would mean trying to determine whether - ### C is part of C - ### Because we have both a directory delimiter - ### (dot) and a directory spec terminator (right - ### bracket), we have to trim the right bracket from - ### the first one to make it successfully match the - ### second one. Since we're asserting the same truth -- - ### that one path spec is the leading part of the other - ### -- it seems to me ok to have this in the test only. - ### - ### so we strip the ']' of the back of the regex - $out_re =~ s/\\\]// if IS_VMS; - - if( $ae->extract_path !~ /^$out_re/ ) { - ok( 0, "Extractpath WRONG (".$ae->extract_path.")"); - skip( "Unsafe operation -- skip cleanup!!!" ), 1; - } - - eval { rmtree( $ae->extract_path ) }; - ok( !$@, " rmtree gave no error" ); - ok( !(-d $ae->extract_path ), - " Extract dir successfully removed" ); - } - } - } - } - } } - } -} Index: gnu/usr.bin/perl/cpan/Archive-Extract/t/src/double_dir.zip =================================================================== RCS file: gnu/usr.bin/perl/cpan/Archive-Extract/t/src/double_dir.zip diff -N gnu/usr.bin/perl/cpan/Archive-Extract/t/src/double_dir.zip Binary files /tmp/cvsrfvqr5 and /dev/null differ Index: gnu/usr.bin/perl/cpan/Archive-Extract/t/src/x.Z =================================================================== RCS file: gnu/usr.bin/perl/cpan/Archive-Extract/t/src/x.Z diff -N gnu/usr.bin/perl/cpan/Archive-Extract/t/src/x.Z Binary files /tmp/cvskG10EK and /dev/null differ Index: gnu/usr.bin/perl/cpan/Archive-Extract/t/src/x.bz2 =================================================================== RCS file: gnu/usr.bin/perl/cpan/Archive-Extract/t/src/x.bz2 diff -N gnu/usr.bin/perl/cpan/Archive-Extract/t/src/x.bz2 Binary files /tmp/cvsvEgSyJ and /dev/null differ Index: gnu/usr.bin/perl/cpan/Archive-Extract/t/src/x.ear =================================================================== RCS file: gnu/usr.bin/perl/cpan/Archive-Extract/t/src/x.ear diff -N gnu/usr.bin/perl/cpan/Archive-Extract/t/src/x.ear Binary files /tmp/cvsHkXnQx and /dev/null differ Index: gnu/usr.bin/perl/cpan/Archive-Extract/t/src/x.gz =================================================================== RCS file: gnu/usr.bin/perl/cpan/Archive-Extract/t/src/x.gz diff -N gnu/usr.bin/perl/cpan/Archive-Extract/t/src/x.gz Binary files /tmp/cvs0Ad05c and /dev/null differ Index: gnu/usr.bin/perl/cpan/Archive-Extract/t/src/x.jar =================================================================== RCS file: gnu/usr.bin/perl/cpan/Archive-Extract/t/src/x.jar diff -N gnu/usr.bin/perl/cpan/Archive-Extract/t/src/x.jar Binary files /tmp/cvswWYqes and /dev/null differ Index: gnu/usr.bin/perl/cpan/Archive-Extract/t/src/x.lzma =================================================================== RCS file: gnu/usr.bin/perl/cpan/Archive-Extract/t/src/x.lzma diff -N gnu/usr.bin/perl/cpan/Archive-Extract/t/src/x.lzma Binary files /tmp/cvs9oTtdX and /dev/null differ Index: gnu/usr.bin/perl/cpan/Archive-Extract/t/src/x.par =================================================================== RCS file: gnu/usr.bin/perl/cpan/Archive-Extract/t/src/x.par diff -N gnu/usr.bin/perl/cpan/Archive-Extract/t/src/x.par Binary files /tmp/cvsDVtNdw and /dev/null differ Index: gnu/usr.bin/perl/cpan/Archive-Extract/t/src/x.tar =================================================================== RCS file: gnu/usr.bin/perl/cpan/Archive-Extract/t/src/x.tar diff -N gnu/usr.bin/perl/cpan/Archive-Extract/t/src/x.tar Binary files /tmp/cvsZ2jkmw and /dev/null differ Index: gnu/usr.bin/perl/cpan/Archive-Extract/t/src/x.tar.gz =================================================================== RCS file: gnu/usr.bin/perl/cpan/Archive-Extract/t/src/x.tar.gz diff -N gnu/usr.bin/perl/cpan/Archive-Extract/t/src/x.tar.gz Binary files /tmp/cvsotwsE4 and /dev/null differ Index: gnu/usr.bin/perl/cpan/Archive-Extract/t/src/x.tar.xz =================================================================== RCS file: gnu/usr.bin/perl/cpan/Archive-Extract/t/src/x.tar.xz diff -N gnu/usr.bin/perl/cpan/Archive-Extract/t/src/x.tar.xz Binary files /tmp/cvsFXr8dO and /dev/null differ Index: gnu/usr.bin/perl/cpan/Archive-Extract/t/src/x.tgz =================================================================== RCS file: gnu/usr.bin/perl/cpan/Archive-Extract/t/src/x.tgz diff -N gnu/usr.bin/perl/cpan/Archive-Extract/t/src/x.tgz Binary files /tmp/cvsdUgOD5 and /dev/null differ Index: gnu/usr.bin/perl/cpan/Archive-Extract/t/src/x.txz =================================================================== RCS file: gnu/usr.bin/perl/cpan/Archive-Extract/t/src/x.txz diff -N gnu/usr.bin/perl/cpan/Archive-Extract/t/src/x.txz Binary files /tmp/cvsE01xfW and /dev/null differ Index: gnu/usr.bin/perl/cpan/Archive-Extract/t/src/x.war =================================================================== RCS file: gnu/usr.bin/perl/cpan/Archive-Extract/t/src/x.war diff -N gnu/usr.bin/perl/cpan/Archive-Extract/t/src/x.war Binary files /tmp/cvsaLZ85J and /dev/null differ Index: gnu/usr.bin/perl/cpan/Archive-Extract/t/src/x.xz =================================================================== RCS file: gnu/usr.bin/perl/cpan/Archive-Extract/t/src/x.xz diff -N gnu/usr.bin/perl/cpan/Archive-Extract/t/src/x.xz Binary files /tmp/cvsMuL7gS and /dev/null differ Index: gnu/usr.bin/perl/cpan/Archive-Extract/t/src/x.zip =================================================================== RCS file: gnu/usr.bin/perl/cpan/Archive-Extract/t/src/x.zip diff -N gnu/usr.bin/perl/cpan/Archive-Extract/t/src/x.zip Binary files /tmp/cvsXGgW79 and /dev/null differ Index: gnu/usr.bin/perl/cpan/Archive-Extract/t/src/y.ear =================================================================== RCS file: gnu/usr.bin/perl/cpan/Archive-Extract/t/src/y.ear diff -N gnu/usr.bin/perl/cpan/Archive-Extract/t/src/y.ear Binary files /tmp/cvsp37ZRd and /dev/null differ Index: gnu/usr.bin/perl/cpan/Archive-Extract/t/src/y.jar =================================================================== RCS file: gnu/usr.bin/perl/cpan/Archive-Extract/t/src/y.jar diff -N gnu/usr.bin/perl/cpan/Archive-Extract/t/src/y.jar Binary files /tmp/cvsHcskiy and /dev/null differ Index: gnu/usr.bin/perl/cpan/Archive-Extract/t/src/y.par =================================================================== RCS file: gnu/usr.bin/perl/cpan/Archive-Extract/t/src/y.par diff -N gnu/usr.bin/perl/cpan/Archive-Extract/t/src/y.par Binary files /tmp/cvsUXiD53 and /dev/null differ Index: gnu/usr.bin/perl/cpan/Archive-Extract/t/src/y.tar =================================================================== RCS file: gnu/usr.bin/perl/cpan/Archive-Extract/t/src/y.tar diff -N gnu/usr.bin/perl/cpan/Archive-Extract/t/src/y.tar Binary files /tmp/cvsqB8FqS and /dev/null differ Index: gnu/usr.bin/perl/cpan/Archive-Extract/t/src/y.tar.bz2 =================================================================== RCS file: gnu/usr.bin/perl/cpan/Archive-Extract/t/src/y.tar.bz2 diff -N gnu/usr.bin/perl/cpan/Archive-Extract/t/src/y.tar.bz2 Binary files /tmp/cvs4fB6wF and /dev/null differ Index: gnu/usr.bin/perl/cpan/Archive-Extract/t/src/y.tar.gz =================================================================== RCS file: gnu/usr.bin/perl/cpan/Archive-Extract/t/src/y.tar.gz diff -N gnu/usr.bin/perl/cpan/Archive-Extract/t/src/y.tar.gz Binary files /tmp/cvsIqwCgP and /dev/null differ Index: gnu/usr.bin/perl/cpan/Archive-Extract/t/src/y.tar.xz =================================================================== RCS file: gnu/usr.bin/perl/cpan/Archive-Extract/t/src/y.tar.xz diff -N gnu/usr.bin/perl/cpan/Archive-Extract/t/src/y.tar.xz Binary files /tmp/cvscJ8Dsw and /dev/null differ Index: gnu/usr.bin/perl/cpan/Archive-Extract/t/src/y.tbz =================================================================== RCS file: gnu/usr.bin/perl/cpan/Archive-Extract/t/src/y.tbz diff -N gnu/usr.bin/perl/cpan/Archive-Extract/t/src/y.tbz Binary files /tmp/cvsRE5gAY and /dev/null differ Index: gnu/usr.bin/perl/cpan/Archive-Extract/t/src/y.tgz =================================================================== RCS file: gnu/usr.bin/perl/cpan/Archive-Extract/t/src/y.tgz diff -N gnu/usr.bin/perl/cpan/Archive-Extract/t/src/y.tgz Binary files /tmp/cvsNwnHUN and /dev/null differ Index: gnu/usr.bin/perl/cpan/Archive-Extract/t/src/y.txz =================================================================== RCS file: gnu/usr.bin/perl/cpan/Archive-Extract/t/src/y.txz diff -N gnu/usr.bin/perl/cpan/Archive-Extract/t/src/y.txz Binary files /tmp/cvs7FnRdk and /dev/null differ Index: gnu/usr.bin/perl/cpan/Archive-Extract/t/src/y.war =================================================================== RCS file: gnu/usr.bin/perl/cpan/Archive-Extract/t/src/y.war diff -N gnu/usr.bin/perl/cpan/Archive-Extract/t/src/y.war Binary files /tmp/cvsIj3zws and /dev/null differ Index: gnu/usr.bin/perl/cpan/Archive-Extract/t/src/y.zip =================================================================== RCS file: gnu/usr.bin/perl/cpan/Archive-Extract/t/src/y.zip diff -N gnu/usr.bin/perl/cpan/Archive-Extract/t/src/y.zip Binary files /tmp/cvsThP1yX and /dev/null differ Index: gnu/usr.bin/perl/cpan/Archive-Tar/lib/Archive/Tar.pm =================================================================== RCS file: /mnt/memory/perl/importit/cvs/src/gnu/usr.bin/perl/cpan/Archive-Tar/lib/Archive/Tar.pm,v retrieving revision 1.1.1.3 diff -u -p -u -p -r1.1.1.3 Tar.pm --- gnu/usr.bin/perl/cpan/Archive-Tar/lib/Archive/Tar.pm 24 Mar 2014 14:58:49 -0000 1.1.1.3 +++ gnu/usr.bin/perl/cpan/Archive-Tar/lib/Archive/Tar.pm 16 Nov 2014 03:22:23 -0000 @@ -23,7 +23,7 @@ require Exporter; use strict; use vars qw[$DEBUG $error $VERSION $WARN $FOLLOW_SYMLINK $CHOWN $CHMOD $DO_NOT_USE_PREFIX $HAS_PERLIO $HAS_IO_STRING $SAME_PERMISSIONS - $INSECURE_EXTRACT_MODE $ZERO_PAD_NUMBERS @ISA @EXPORT + $INSECURE_EXTRACT_MODE $ZERO_PAD_NUMBERS @ISA @EXPORT $RESOLVE_SYMLINK ]; @ISA = qw[Exporter]; @@ -31,13 +31,14 @@ use vars qw[$DEBUG $error $VERSION $WARN $DEBUG = 0; $WARN = 1; $FOLLOW_SYMLINK = 0; -$VERSION = "1.90"; +$VERSION = "1.96"; $CHOWN = 1; $CHMOD = 1; $SAME_PERMISSIONS = $> == 0 ? 1 : 0; $DO_NOT_USE_PREFIX = 0; $INSECURE_EXTRACT_MODE = 0; $ZERO_PAD_NUMBERS = 0; +$RESOLVE_SYMLINK = $ENV{'PERL5_AT_RESOLVE_SYMLINK'} || 'speed'; BEGIN { use Config; @@ -485,7 +486,7 @@ sub _read_tar { ### but that doesn't *always* happen.. so check if the last ### character is a control character, and if so remove it ### at any rate, we better remove that character here, or tests - ### like 'eq' and hashlook ups based on names will SO not work + ### like 'eq' and hash lookups based on names will SO not work ### remove it by calculating the proper size, and then ### tossing out everything that's longer than that size. @@ -956,7 +957,7 @@ sub _extract_special_file_as_plain_file my $err; TRY: { - my $orig = $self->_find_entry( $entry->linkname ); + my $orig = $self->_find_entry( $entry->linkname, $entry ); unless( $orig ) { $err = qq[Could not find file '] . $entry->linkname . @@ -965,7 +966,7 @@ sub _extract_special_file_as_plain_file } ### clone the entry, make it appear as a normal file ### - my $clone = $entry->clone; + my $clone = $orig->clone; $clone->_downgrade_to_plainfile; $self->_extract_file( $clone, $file ) or last TRY; @@ -1030,10 +1031,46 @@ sub _find_entry { ### it's an object already return $file if UNIVERSAL::isa( $file, 'Archive::Tar::File' ); - for my $entry ( @{$self->_data} ) { - my $path = $entry->full_path; - return $entry if $path eq $file; - } +seach_entry: + if($self->_data){ + for my $entry ( @{$self->_data} ) { + my $path = $entry->full_path; + return $entry if $path eq $file; + } + } + + if($Archive::Tar::RESOLVE_SYMLINK!~/none/){ + if(my $link_entry = shift()){#fallback mode when symlinks are using relative notations ( ../a/./b/text.bin ) + $file = _symlinks_resolver( $link_entry->name, $file ); + goto seach_entry if $self->_data; + + #this will be slower than never, but won't failed! + + my $iterargs = $link_entry->{'_archive'}; + if($Archive::Tar::RESOLVE_SYMLINK=~/speed/ && @$iterargs==3){ + #faster but whole archive will be read in memory + #read whole archive and share data + my $archive = Archive::Tar->new; + $archive->read( @$iterargs ); + push @$iterargs, $archive; #take a trace for destruction + if($archive->_data){ + $self->_data( $archive->_data ); + goto seach_entry; + } + }#faster + + {#slower but lower memory usage + # $iterargs = [$filename, $compressed, $opts]; + my $next = Archive::Tar->iter( @$iterargs ); + while(my $e = $next->()){ + if($e->full_path eq $file){ + undef $next; + return $e; + } + } + }#slower + } + } $self->_error( qq[No such file in archive: '$file'] ); return; @@ -1553,7 +1590,7 @@ sub add_data { =head2 $tar->error( [$BOOL] ) -Returns the current errorstring (usually, the last error reported). +Returns the current error string (usually, the last error reported). If a true value was specified, it will give the C equivalent of the error, in effect giving you a stacktrace. @@ -1729,6 +1766,7 @@ sub iter { ) or return; my @data; + my $CONSTRUCT_ARGS = [ $filename, $compressed, $opts ]; return sub { return shift(@data) if @data; # more than one file returned? return unless $handle; # handle exhausted? @@ -1736,12 +1774,25 @@ sub iter { ### read data, should only return file my $tarfile = $class->_read_tar($handle, { %$opts, limit => 1 }); @data = @$tarfile if ref $tarfile && ref $tarfile eq 'ARRAY'; + if($Archive::Tar::RESOLVE_SYMLINK!~/none/){ + foreach(@data){ + #may refine this heuristic for ON_UNIX? + if($_->linkname){ + #is there a better slot to store/share it ? + $_->{'_archive'} = $CONSTRUCT_ARGS; + } + } + } ### return one piece of data return shift(@data) if @data; ### data is exhausted, free the filehandle undef $handle; + if(@$CONSTRUCT_ARGS == 4){ + #free archive in memory + undef $CONSTRUCT_ARGS->[-1]; + } return; }; } @@ -1865,6 +1916,32 @@ sub no_string_support { croak("You have to install IO::String to support writing archives to strings"); } +sub _symlinks_resolver{ + my ($src, $trg) = @_; + my @src = split /[\/\\]/, $src; + my @trg = split /[\/\\]/, $trg; + pop @src; #strip out current object name + if(@trg and $trg[0] eq ''){ + shift @trg; + #restart path from scratch + @src = ( ); + } + foreach my $part ( @trg ){ + next if $part eq '.'; #ignore current + if($part eq '..'){ + #got to parent + pop @src; + } + else{ + #append it + push @src, $part; + } + } + my $path = join('/', @src); + warn "_symlinks_resolver('$src','$trg') = $path" if $DEBUG; + return $path; +} + 1; __END__ @@ -2006,6 +2083,30 @@ This variable holds a boolean indicating zero padded numbers for C, C and C. The default is C<0>, indicating that we will create space padded numbers. Added for compatibility with C implementations. + +=head2 Tuning the way RESOLVE_SYMLINK will works + + You can tune the behaviour by setting the $Archive::Tar::RESOLVE_SYMLINK variable, + or $ENV{PERL5_AT_RESOLVE_SYMLINK} before loading the module Archive::Tar. + + Values can be one of the following: + + none + Disable this mechanism and failed as it was in previous version (<1.88) + + speed (default) + If you prefer speed + this will read again the whole archive using read() so all entries + will be available + + memory + If you prefer memory + + Limitation + + It won't work for terminal, pipe or sockets or every non seekable source. + +=cut =head1 FAQ Index: gnu/usr.bin/perl/cpan/Archive-Tar/lib/Archive/Tar/Constant.pm =================================================================== RCS file: /mnt/memory/perl/importit/cvs/src/gnu/usr.bin/perl/cpan/Archive-Tar/lib/Archive/Tar/Constant.pm,v retrieving revision 1.1.1.3 diff -u -p -u -p -r1.1.1.3 Constant.pm --- gnu/usr.bin/perl/cpan/Archive-Tar/lib/Archive/Tar/Constant.pm 24 Mar 2014 14:58:49 -0000 1.1.1.3 +++ gnu/usr.bin/perl/cpan/Archive-Tar/lib/Archive/Tar/Constant.pm 16 Nov 2014 03:22:23 -0000 @@ -3,14 +3,13 @@ package Archive::Tar::Constant; BEGIN { require Exporter; - $VERSION = '1.90'; + $VERSION = '1.96'; @ISA = qw[Exporter]; require Time::Local if $^O eq "MacOS"; } -use Package::Constants; -@EXPORT = Package::Constants->list( __PACKAGE__ ); +@EXPORT = Archive::Tar::Constant->_list_consts( __PACKAGE__ ); use constant FILE => 0; use constant HARDLINK => 1; @@ -82,5 +81,30 @@ use constant CAN_CHOWN => sub { ($> use constant CAN_READLINK => ($^O ne 'MSWin32' and $^O !~ /RISC(?:[ _])?OS/i and $^O ne 'VMS'); use constant ON_UNIX => ($^O ne 'MSWin32' and $^O ne 'MacOS' and $^O ne 'VMS'); use constant ON_VMS => $^O eq 'VMS'; + +sub _list_consts { + my $class = shift; + my $pkg = shift; + return unless defined $pkg; # some joker might use '0' as a pkg... + + my @rv; + { no strict 'refs'; + my $stash = $pkg . '::'; + + for my $name (sort keys %$stash ) { + + ### is it a subentry? + my $sub = $pkg->can( $name ); + next unless defined $sub; + + next unless defined prototype($sub) and + not length prototype($sub); + + push @rv, $name; + } + } + + return sort @rv; +} 1; Index: gnu/usr.bin/perl/cpan/Archive-Tar/lib/Archive/Tar/File.pm =================================================================== RCS file: /mnt/memory/perl/importit/cvs/src/gnu/usr.bin/perl/cpan/Archive-Tar/lib/Archive/Tar/File.pm,v retrieving revision 1.1.1.3 diff -u -p -u -p -r1.1.1.3 File.pm --- gnu/usr.bin/perl/cpan/Archive-Tar/lib/Archive/Tar/File.pm 24 Mar 2014 14:58:49 -0000 1.1.1.3 +++ gnu/usr.bin/perl/cpan/Archive-Tar/lib/Archive/Tar/File.pm 16 Nov 2014 03:22:23 -0000 @@ -13,7 +13,7 @@ use Archive::Tar::Constant; use vars qw[@ISA $VERSION]; #@ISA = qw[Archive::Tar]; -$VERSION = '1.90'; +$VERSION = '1.96'; ### set value to 1 to oct() it during the unpack ### @@ -224,7 +224,7 @@ sub _new_from_chunk { if(substr($entry{'size'}, 0, 1) eq "\x80") { # binary size extension for files >8gigs (> octal 77777777777777) # cdrake - my @sz=unpack("aCSNN",$entry{'size'}); $entry{'size'}=$sz[4]+(2**32)*$sz[3]+$sz[2]*(2**64); # Use the low 80 bits (should use the upper 15 as well, but as at year 2011, that seems unlikley to ever be needed - the numbers are just too big...) # cdrake + my @sz=unpack("aCSNN",$entry{'size'}); $entry{'size'}=$sz[4]+(2**32)*$sz[3]+$sz[2]*(2**64); # Use the low 80 bits (should use the upper 15 as well, but as at year 2011, that seems unlikely to ever be needed - the numbers are just too big...) # cdrake } else { # cdrake ($entry{'size'})=($entry{'size'}=~/^([^\0]*)/); $entry{'size'}=oct $entry{'size'}; # cdrake } # cdrake @@ -481,7 +481,7 @@ concatenation of the C and Cname unless defined $self->prefix and length $self->prefix; ### or otherwise, catfile'd Index: gnu/usr.bin/perl/cpan/Archive-Tar/t/04_resolved_issues.t =================================================================== RCS file: /mnt/memory/perl/importit/cvs/src/gnu/usr.bin/perl/cpan/Archive-Tar/t/04_resolved_issues.t,v retrieving revision 1.1.1.2 diff -u -p -u -p -r1.1.1.2 04_resolved_issues.t --- gnu/usr.bin/perl/cpan/Archive-Tar/t/04_resolved_issues.t 25 Mar 2013 20:06:44 -0000 1.1.1.2 +++ gnu/usr.bin/perl/cpan/Archive-Tar/t/04_resolved_issues.t 16 Nov 2014 03:22:23 -0000 @@ -194,3 +194,56 @@ use_ok( $FileClass ); " Expected error reported" ); } +### bug #78030 +### tests for symlinks with relative paths +### seen on MSWin32 +{ ok( 1, "Testing bug 78030" ); + my $archname = 'tmp-symlink.tar.gz'; + { #build archive + unlink $archname if -e $archname; + local $Archive::Tar::DO_NOT_USE_PREFIX = 1; + my $t=Archive::Tar->new; + my $f = $t->add_data( 'tmp/a/b/link.txt', '', + { + linkname => '../c/ori.txt', + type => 2, + } ); + #why doesn't it keep my wish? + $f->{name} = 'tmp/a/b/link.txt'; + $f->{prefix} = ''; + $t->add_data( 'tmp/a/c/ori.txt', 'test case' ); + $t->write( $archname, 1 ); + } + + { #use case 1 - in memory extraction + my $t=Archive::Tar->new; + $t->read( $archname ); + my $r = eval{ $t->extract }; + ok( $r && !$@, " In memory extraction/symlinks" ); + ok((stat 'tmp/a/b/link.txt')[7] == 9, + " Linked content" ) unless $r; + clean_78030(); + } + + { #use case 2 - iter extraction + #$DB::single = 2; + my $next=Archive::Tar->iter( $archname, 1 ); + my $failed = 0; + #use Data::Dumper; + while(my $f = $next->() ){ + # print "\$f = ", Dumper( $f ), $/; + eval{ $f->extract } or $failed++; + } + ok( !$failed, " From disk extraction/symlinks" ); + ok((stat 'tmp/a/b/link.txt')[7] == 9, + " Linked content" ) unless $failed; + } + + #remove tmp files + sub clean_78030{ + unlink for ('tmp/a/c/ori.txt', 'tmp/a/b/link.txt'); + rmdir for ('tmp/a/c', 'tmp/a/b', 'tmp/a', 'tmp'); + } + clean_78030(); + unlink $archname; +} Index: gnu/usr.bin/perl/cpan/AutoLoader/lib/AutoLoader.pm =================================================================== RCS file: /mnt/memory/perl/importit/cvs/src/gnu/usr.bin/perl/cpan/AutoLoader/lib/AutoLoader.pm,v retrieving revision 1.1.1.3 diff -u -p -u -p -r1.1.1.3 AutoLoader.pm --- gnu/usr.bin/perl/cpan/AutoLoader/lib/AutoLoader.pm 24 Mar 2014 14:58:49 -0000 1.1.1.3 +++ gnu/usr.bin/perl/cpan/AutoLoader/lib/AutoLoader.pm 16 Nov 2014 03:22:23 -0000 @@ -15,7 +15,7 @@ BEGIN { $is_epoc = $^O eq 'epoc'; $is_vms = $^O eq 'VMS'; $is_macos = $^O eq 'MacOS'; - $VERSION = '5.73'; + $VERSION = '5.74'; } AUTOLOAD { @@ -400,7 +400,7 @@ This package has the same copyright and Copyright (C) 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, - 2011, 2012 + 2011, 2012, 2013 by Larry Wall and others All rights reserved. Index: gnu/usr.bin/perl/cpan/B-Debug/Debug.pm =================================================================== RCS file: /mnt/memory/perl/importit/cvs/src/gnu/usr.bin/perl/cpan/B-Debug/Debug.pm,v retrieving revision 1.1.1.3 diff -u -p -u -p -r1.1.1.3 Debug.pm --- gnu/usr.bin/perl/cpan/B-Debug/Debug.pm 24 Mar 2014 14:58:49 -0000 1.1.1.3 +++ gnu/usr.bin/perl/cpan/B-Debug/Debug.pm 16 Nov 2014 03:22:23 -0000 @@ -1,6 +1,6 @@ package B::Debug; -our $VERSION = '1.18'; +our $VERSION = '1.19'; use strict; require 5.006; @@ -181,7 +181,6 @@ sub B::SV::debug { printf <<'EOT', class($sv), $$sv, $sv->REFCNT; %s (0x%x) REFCNT %d - FLAGS 0x%x EOT printf "\tFLAGS\t\t0x%x", $sv->FLAGS; if ($have_B_Flags) { @@ -203,9 +202,10 @@ sub B::PV::debug { my ($sv) = @_; $sv->B::SV::debug(); my $pv = $sv->PV(); - printf <<'EOT', cstring($pv), length($pv); + printf <<'EOT', cstring($pv), $sv->CUR, $sv->LEN; xpv_pv %s xpv_cur %d + xpv_len %d EOT } @@ -258,17 +258,23 @@ sub B::CV::debug { my ($padlist) = $sv->PADLIST; my ($file) = $sv->FILE; my ($gv) = $sv->GV; - printf <<'EOT', $$stash, $$start, $$root, $$gv, $file, $sv->DEPTH, $padlist, ${$sv->OUTSIDE}; + printf <<'EOT', $$stash, $$start, $$root; STASH 0x%x START 0x%x ROOT 0x%x - GV 0x%x +EOT + if ( $]>5.017 && ($sv->FLAGS & 0x40000)) { #lexsub + printf("\tNAME\t%%s\n", $sv->NAME); + } else { + printf("\tGV\t%0x%x\t%s\n", $$gv, $gv->SAFENAME); + } + printf <<'EOT', $file, $sv->DEPTH, $padlist, ${$sv->OUTSIDE}; FILE %s DEPTH %d PADLIST 0x%x OUTSIDE 0x%x EOT - printf("\tOUTSIDE_SEQ\t%d\n", , $sv->OUTSIDE_SEQ) if $] > 5.007; + printf("\tOUTSIDE_SEQ\t%d\n", $sv->OUTSIDE_SEQ) if $] > 5.007; if ($have_B_Flags) { my $SVt_PVCV = $] < 5.010 ? 12 : 13; printf("\tCvFLAGS\t0x%x\t%s\n", $sv->CvFLAGS, @@ -407,7 +413,7 @@ Reini Urban C =head1 LICENSE Copyright (c) 1996, 1997 Malcolm Beattie -Copyright (c) 2008, 2010 Reini Urban +Copyright (c) 2008, 2010, 2013 Reini Urban This program is free software; you can redistribute it and/or modify it under the terms of either: Index: gnu/usr.bin/perl/cpan/B-Lint/lib/B/Lint.pm =================================================================== RCS file: gnu/usr.bin/perl/cpan/B-Lint/lib/B/Lint.pm diff -N gnu/usr.bin/perl/cpan/B-Lint/lib/B/Lint.pm --- gnu/usr.bin/perl/cpan/B-Lint/lib/B/Lint.pm 24 Mar 2014 15:05:23 -0000 1.3 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,793 +0,0 @@ -package B::Lint; -use if $] > 5.017, 'deprecate'; - -our $VERSION = '1.17'; ## no critic - -=head1 NAME - -B::Lint - Perl lint - -=head1 SYNOPSIS - -perl -MO=Lint[,OPTIONS] foo.pl - -=head1 DESCRIPTION - -The B::Lint module is equivalent to an extended version of the B<-w> -option of B. It is named after the program F which carries -out a similar process for C programs. - -=head1 OPTIONS AND LINT CHECKS - -Option words are separated by commas (not whitespace) and follow the -usual conventions of compiler backend options. Following any options -(indicated by a leading B<->) come lint check arguments. Each such -argument (apart from the special B and B options) is a -word representing one possible lint check (turning on that check) or -is B (turning off that check). Before processing the check -arguments, a standard list of checks is turned on. Later options -override earlier ones. Available options are: - -=over 8 - -=item B - -Produces a warning whenever the magic CE> readline is -used. Internally it uses perl's two-argument open which itself treats -filenames with special characters specially. This could allow -interestingly named files to have unexpected effects when reading. - - % touch 'rm *|' - % perl -pe 1 - -The above creates a file named C. When perl opens it with -CE> it actually executes the shell program C. This -makes CE> dangerous to use carelessly. - -=item B - -Produces a warning whenever an array is used in an implicit scalar -context. For example, both of the lines - - $foo = length(@bar); - $foo = @bar; - -will elicit a warning. Using an explicit B silences the -warning. For example, - - $foo = scalar(@bar); - -=item B and B - -These options produce a warning whenever an operation implicitly -reads or (respectively) writes to one of Perl's special variables. -For example, B will warn about these: - - /foo/; - -and B will warn about these: - - s/foo/bar/; - -Both B and B warn about this: - - for (@a) { ... } - -=item B - -This option warns whenever a bareword is implicitly quoted, but is also -the name of a subroutine in the current package. Typical mistakes that it will -trap are: - - use constant foo => 'bar'; - @a = ( foo => 1 ); - $b{foo} = 2; - -Neither of these will do what a naive user would expect. - -=item B - -This option warns whenever C<$_> is used either explicitly anywhere or -as the implicit argument of a B statement. - -=item B - -This option warns on each use of any variable, subroutine or -method name that lives in a non-current package but begins with -an underscore ("_"). Warnings aren't issued for the special case -of the single character name "_" by itself (e.g. C<$_> and C<@_>). - -=item B - -This option warns whenever an undefined subroutine is invoked. -This option will only catch explicitly invoked subroutines such -as C and not indirect invocations such as C<&$subref()> -or C<$obj-Emeth()>. Note that some programs or modules delay -definition of subs until runtime by means of the AUTOLOAD -mechanism. - -=item B - -This option warns whenever one of the regexp variables C<$`>, C<$&> or C<$'> -is used. Any occurrence of any of these variables in your -program can slow your whole program down. See L for -details. - -=item B - -Turn all warnings on. - -=item B - -Turn all warnings off. - -=back - -=head1 NON LINT-CHECK OPTIONS - -=over 8 - -=item B<-u Package> - -Normally, Lint only checks the main code of the program together -with all subs defined in package main. The B<-u> option lets you -include other package names whose subs are then checked by Lint. - -=back - -=head1 EXTENDING LINT - -Lint can be extended by with plugins. Lint uses L -to find available plugins. Plugins are expected but not required to -inform Lint of which checks they are adding. - -The C<< B::Lint->register_plugin( MyPlugin => \@new_checks ) >> method -adds the list of C<@new_checks> to the list of valid checks. If your -module wasn't loaded by L then your class name is -added to the list of plugins. - -You must create a C method in your plugin class or one -of its parents. It will be called on every op as a regular method call -with a hash ref of checks as its parameter. - -The class methods C<< B::Lint->file >> and C<< B::Lint->line >> contain -the current filename and line number. - - package Sample; - use B::Lint; - B::Lint->register_plugin( Sample => [ 'good_taste' ] ); - - sub match { - my ( $op, $checks_href ) = shift @_; - if ( $checks_href->{good_taste} ) { - ... - } - } - -=head1 TODO - -=over - -=item while() stomps $_ - -=item strict oo - -=item unchecked system calls - -=item more tests, validate against older perls - -=back - -=head1 BUGS - -This is only a very preliminary version. - -=head1 AUTHOR - -Malcolm Beattie, mbeattie@sable.ox.ac.uk. - -=head1 ACKNOWLEDGEMENTS - -Sebastien Aperghis-Tramoni - bug fixes - -=cut - -use strict; -use B qw( walkoptree_slow - main_root main_cv walksymtable parents - OPpOUR_INTRO - OPf_WANT_VOID OPf_WANT_LIST OPf_WANT OPf_STACKED SVf_POK ); -use Carp 'carp'; - -# The current M::P doesn't know about .pmc files. -use Module::Pluggable ( require => 1 ); - -use List::Util 'first'; -## no critic Prototypes -sub any (&@) { my $test = shift @_; $test->() and return 1 for @_; return 0 } - -BEGIN { - - # Import or create some constants from B. B doesn't provide - # everything I need so some things like OPpCONST_BARE are defined - # here. - for my $sym ( qw( begin_av check_av init_av end_av ), - [ 'OPpCONST_BARE' => 64 ] ) - { - my $val; - ( $sym, $val ) = @$sym if ref $sym; - - if ( any { $sym eq $_ } @B::EXPORT_OK, @B::EXPORT ) { - B->import($sym); - } - else { - require constant; - constant->import( $sym => $val ); - } - } -} - -my $file = "unknown"; # shadows current filename -my $line = 0; # shadows current line number -my $curstash = "main"; # shadows current stash -my $curcv; # shadows current B::CV for pad lookups - -sub file {$file} -sub line {$line} -sub curstash {$curstash} -sub curcv {$curcv} - -# Lint checks -my %check; -my %implies_ok_context; - -map( $implies_ok_context{$_}++, - qw(scalar av2arylen aelem aslice helem hslice - keys values hslice defined undef delete) ); - -# Lint checks turned on by default -my @default_checks - = qw(context magic_diamond undefined_subs regexp_variables); - -my %valid_check; - -# All valid checks -for my $check ( - qw(context implicit_read implicit_write dollar_underscore - private_names bare_subs undefined_subs regexp_variables - magic_diamond ) - ) -{ - $valid_check{$check} = __PACKAGE__; -} - -# Debugging options -my ($debug_op); - -my %done_cv; # used to mark which subs have already been linted -my @extra_packages; # Lint checks mainline code and all subs which are - # in main:: or in one of these packages. - -sub warning { - my $format = ( @_ < 2 ) ? "%s" : shift @_; - warn sprintf( "$format at %s line %d\n", @_, $file, $line ); - return undef; ## no critic undef -} - -# This gimme can't cope with context that's only determined -# at runtime via dowantarray(). -sub gimme { - my $op = shift @_; - my $flags = $op->flags; - if ( $flags & OPf_WANT ) { - return ( ( $flags & OPf_WANT ) == OPf_WANT_LIST ? 1 : 0 ); - } - return undef; ## no critic undef -} - -my @plugins = __PACKAGE__->plugins; - -sub inside_grepmap { - - # A boolean function to be used while inside a B::walkoptree_slow - # call. If we are in the EXPR part of C or C, this returns true. - return any { $_->name =~ m/\A(?:grep|map)/xms } @{ parents() }; -} - -sub inside_foreach_modifier { - - # TODO: use any() - - # A boolean function to be used while inside a B::walkoptree_slow - # call. If we are in the EXPR part of C this - # returns true. - for my $ancestor ( @{ parents() } ) { - next unless $ancestor->name eq 'leaveloop'; - - my $first = $ancestor->first; - next unless $first->name eq 'enteriter'; - - next if $first->redoop->name =~ m/\A(?:next|db|set)state\z/xms; - - return 1; - } - return 0; -} - -for ( - [qw[ B::PADOP::gv_harder gv padix]], - [qw[ B::SVOP::sv_harder sv targ]], - [qw[ B::SVOP::gv_harder gv padix]] - ) -{ - - # I'm generating some functions here because they're mostly - # similar. It's all for compatibility with threaded - # perl. Perhaps... this code should inspect $Config{usethreads} - # and generate a *specific* function. I'm leaving it generic for - # the moment. - # - # In threaded perl SVs and GVs aren't used directly in the optrees - # like they are in non-threaded perls. The ops that would use a SV - # or GV keep an index into the subroutine's scratchpad. I'm - # currently ignoring $cv->DEPTH and that might be at my peril. - - my ( $subname, $attr, $pad_attr ) = @$_; - my $target = do { ## no critic strict - no strict 'refs'; - \*$subname; - }; - *$target = sub { - my ($op) = @_; - - my $elt; - if ( not $op->isa('B::PADOP') ) { - $elt = $op->$attr; - } - return $elt if eval { $elt->isa('B::SV') }; - - my $ix = $op->$pad_attr; - my @entire_pad = $curcv->PADLIST->ARRAY; - my @elts = map +( $_->ARRAY )[$ix], @entire_pad; - ($elt) = first { - eval { $_->isa('B::SV') } ? $_ : (); - } - @elts[ 0, reverse 1 .. $#elts ]; - return $elt; - }; -} - -sub B::OP::lint { - my ($op) = @_; - - # This is a fallback ->lint for all the ops where I haven't - # defined something more specific. Nothing happens here. - - # Call all registered plugins - my $m; - $m = $_->can('match'), $op->$m( \%check ) for @plugins; - return; -} - -sub B::COP::lint { - my ($op) = @_; - - # nextstate ops sit between statements. Whenever I see one I - # update the current info on file, line, and stash. This code also - # updates it when it sees a dbstate or setstate op. I have no idea - # what those are but having seen them mentioned together in other - # parts of the perl I think they're kind of equivalent. - if ( $op->name =~ m/\A(?:next|db|set)state\z/ ) { - $file = $op->file; - $line = $op->line; - $curstash = $op->stash->NAME; - } - - # Call all registered plugins - my $m; - $m = $_->can('match'), $op->$m( \%check ) for @plugins; - return; -} - -sub B::UNOP::lint { - my ($op) = @_; - - my $opname = $op->name; - -CONTEXT: { - - # Check arrays and hashes in scalar or void context where - # scalar() hasn't been used. - - next - unless $check{context} - and $opname =~ m/\Arv2[ah]v\z/xms - and not gimme($op); - - my ( $parent, $gparent ) = @{ parents() }[ 0, 1 ]; - my $pname = $parent->name; - - next if $implies_ok_context{$pname}; - - # Three special cases to deal with: "foreach (@foo)", "delete - # $a{$b}", and "exists $a{$b}" null out the parent so we have to - # check for a parent of pp_null and a grandparent of - # pp_enteriter, pp_delete, pp_exists - - next - if $pname eq "null" - and $gparent->name =~ m/\A(?:delete|enteriter|exists)\z/xms; - - # our( @bar ); would also trigger this error so I exclude - # that. - next - if $op->private & OPpOUR_INTRO - and ( $op->flags & OPf_WANT ) == OPf_WANT_VOID; - - warning 'Implicit scalar context for %s in %s', - $opname eq "rv2av" ? "array" : "hash", $parent->desc; - } - -PRIVATE_NAMES: { - - # Looks for calls to methods with names that begin with _ and - # that aren't visible within the current package. Maybe this - # should look at @ISA. - next - unless $check{private_names} - and $opname =~ m/\Amethod/xms; - - my $methop = $op->first; - next unless $methop->name eq "const"; - - my $method = $methop->sv_harder->PV; - next - unless $method =~ m/\A_/xms - and not defined &{"$curstash\::$method"}; - - warning q[Illegal reference to private method name '%s'], $method; - } - - # Call all registered plugins - my $m; - $m = $_->can('match'), $op->$m( \%check ) for @plugins; - return; -} - -sub B::PMOP::lint { - my ($op) = @_; - -IMPLICIT_READ: { - - # Look for /.../ that doesn't use =~ to bind to something. - next - unless $check{implicit_read} - and $op->name eq "match" - and not( $op->flags & OPf_STACKED - or inside_grepmap() ); - warning 'Implicit match on $_'; - } - -IMPLICIT_WRITE: { - - # Look for s/.../.../ that doesn't use =~ to bind to - # something. - next - unless $check{implicit_write} - and $op->name eq "subst" - and not $op->flags & OPf_STACKED; - warning 'Implicit substitution on $_'; - } - - # Call all registered plugins - my $m; - $m = $_->can('match'), $op->$m( \%check ) for @plugins; - return; -} - -sub B::LOOP::lint { - my ($op) = @_; - -IMPLICIT_FOO: { - - # Look for C. - next - unless ( $check{implicit_read} or $check{implicit_write} ) - and $op->name eq "enteriter"; - - my $last = $op->last; - next - unless $last->name eq "gv" - and $last->gv_harder->NAME eq "_" - and $op->redoop->name =~ m/\A(?:next|db|set)state\z/xms; - - warning 'Implicit use of $_ in foreach'; - } - - # Call all registered plugins - my $m; - $m = $_->can('match'), $op->$m( \%check ) for @plugins; - return; -} - -# In threaded vs non-threaded perls you'll find that threaded perls -# use PADOP in place of SVOPs so they can do lookups into the -# scratchpad to find things. I suppose this is so a optree can be -# shared between threads and all symbol table muckery will just get -# written to a scratchpad. -*B::PADOP::lint = *B::PADOP::lint = \&B::SVOP::lint; - -sub B::SVOP::lint { - my ($op) = @_; - -MAGIC_DIAMOND: { - next - unless $check{magic_diamond} - and parents()->[0]->name eq 'readline' - and $op->gv_harder->NAME eq 'ARGV'; - - warning 'Use of <>'; - } - -BARE_SUBS: { - next - unless $check{bare_subs} - and $op->name eq 'const' - and $op->private & OPpCONST_BARE; - - my $sv = $op->sv_harder; - next unless $sv->FLAGS & SVf_POK; - - my $sub = $sv->PV; - my $subname = "$curstash\::$sub"; - - # I want to skip over things that were declared with the - # constant pragma. Well... sometimes. Hmm. I want to ignore - # C< ...>> but warn on C< ...>> - # later. The former is typical declaration syntax and the - # latter would be an error. - # - # Skipping over both could be handled by looking if - # $constant::declared{$subname} is true. - - # Check that it's a function. - next - unless exists &{"$curstash\::$sub"}; - - warning q[Bare sub name '%s' interpreted as string], $sub; - } - -PRIVATE_NAMES: { - next unless $check{private_names}; - - my $opname = $op->name; - if ( $opname =~ m/\Agv(?:sv)?\z/xms ) { - - # Looks for uses of variables and stuff that are named - # private and we're not in the same package. - my $gv = $op->gv_harder; - my $name = $gv->NAME; - next - unless $name =~ m/\A_./xms - and $gv->STASH->NAME ne $curstash; - - warning q[Illegal reference to private name '%s'], $name; - } - elsif ( $opname eq "method_named" ) { - my $method = $op->sv_harder->PV; - next unless $method =~ m/\A_./xms; - - warning q[Illegal reference to private method name '%s'], $method; - } - } - -DOLLAR_UNDERSCORE: { - - # Warn on uses of $_ with a few exceptions. I'm not warning on - # $_ inside grep, map, or statement modifier foreach because - # they localize $_ and it'd be impossible to use these - # features without getting warnings. - - next - unless $check{dollar_underscore} - and $op->name eq "gvsv" - and $op->gv_harder->NAME eq "_" - and not( inside_grepmap - or inside_foreach_modifier ); - - warning 'Use of $_'; - } - -REGEXP_VARIABLES: { - - # Look for any uses of $`, $&, or $'. - next - unless $check{regexp_variables} - and $op->name eq "gvsv"; - - my $name = $op->gv_harder->NAME; - next unless $name =~ m/\A[\&\'\`]\z/xms; - - warning 'Use of regexp variable $%s', $name; - } - -UNDEFINED_SUBS: { - - # Look for calls to functions that either don't exist or don't - # have a definition. - next - unless $check{undefined_subs} - and $op->name eq "gv" - and $op->next->name eq "entersub"; - - my $gv = $op->gv_harder; - my $subname = $gv->STASH->NAME . "::" . $gv->NAME; - - no strict 'refs'; ## no critic strict - if ( not exists &$subname ) { - $subname =~ s/\Amain:://; - warning q[Nonexistent subroutine '%s' called], $subname; - } - elsif ( not defined &$subname ) { - $subname =~ s/\A\&?main:://; - warning q[Undefined subroutine '%s' called], $subname; - } - } - - # Call all registered plugins - my $m; - $m = $_->can('match'), $op->$m( \%check ) for @plugins; - return; -} - -sub B::GV::lintcv { - - # Example: B::svref_2object( \ *A::Glob )->lintcv - - my $gv = shift @_; - my $cv = $gv->CV; - return unless $cv->can('lintcv'); - $cv->lintcv; - return; -} - -sub B::CV::lintcv { - - # Example: B::svref_2object( \ &foo )->lintcv - - # Write to the *global* $ - $curcv = shift @_; - - #warn sprintf("lintcv: %s::%s (done=%d)\n", - # $gv->STASH->NAME, $gv->NAME, $done_cv{$$curcv});#debug - return unless ref($curcv) and $$curcv and not $done_cv{$$curcv}++; - my $root = $curcv->ROOT; - - #warn " root = $root (0x$$root)\n";#debug - walkoptree_slow( $root, "lint" ) if $$root; - return; -} - -sub do_lint { - my %search_pack; - - # Copy to the global $curcv for use in pad lookups. - $curcv = main_cv; - walkoptree_slow( main_root, "lint" ) if ${ main_root() }; - - # Do all the miscellaneous non-sub blocks. - for my $av ( begin_av, init_av, check_av, end_av ) { - next unless eval { $av->isa('B::AV') }; - for my $cv ( $av->ARRAY ) { - next unless ref($cv) and $cv->FILE eq $0; - $cv->lintcv; - } - } - - walksymtable( - \%main::, - sub { - if ( $_[0]->FILE eq $0 ) { $_[0]->lintcv } - }, - sub {1} - ); - return; -} - -sub compile { - my @options = @_; - - # Turn on default lint checks - for my $opt (@default_checks) { - $check{$opt} = 1; - } - -OPTION: - while ( my $option = shift @options ) { - my ( $opt, $arg ); - unless ( ( $opt, $arg ) = $option =~ m/\A-(.)(.*)/xms ) { - unshift @options, $option; - last OPTION; - } - - if ( $opt eq "-" && $arg eq "-" ) { - shift @options; - last OPTION; - } - elsif ( $opt eq "D" ) { - $arg ||= shift @options; - foreach my $arg ( split //, $arg ) { - if ( $arg eq "o" ) { - B->debug(1); - } - elsif ( $arg eq "O" ) { - $debug_op = 1; - } - } - } - elsif ( $opt eq "u" ) { - $arg ||= shift @options; - push @extra_packages, $arg; - } - } - - foreach my $opt ( @default_checks, @options ) { - $opt =~ tr/-/_/; - if ( $opt eq "all" ) { - %check = %valid_check; - } - elsif ( $opt eq "none" ) { - %check = (); - } - else { - if ( $opt =~ s/\Ano_//xms ) { - $check{$opt} = 0; - } - else { - $check{$opt} = 1; - } - carp "No such check: $opt" - unless defined $valid_check{$opt}; - } - } - - # Remaining arguments are things to check. So why aren't I - # capturing them or something? I don't know. - - return \&do_lint; -} - -sub register_plugin { - my ( undef, $plugin, $new_checks ) = @_; - - # Allow the user to be lazy and not give us a name. - $plugin = caller unless defined $plugin; - - # Register the plugin's named checks, if any. - for my $check ( eval {@$new_checks} ) { - if ( not defined $check ) { - carp 'Undefined value in checks.'; - next; - } - if ( exists $valid_check{$check} ) { - carp - "$check is already registered as a $valid_check{$check} feature."; - next; - } - - $valid_check{$check} = $plugin; - } - - # Register a non-Module::Pluggable loaded module. @plugins already - # contains whatever M::P found on disk. The user might load a - # plugin manually from some arbitrary namespace and ask for it to - # be registered. - if ( not any { $_ eq $plugin } @plugins ) { - push @plugins, $plugin; - } - - return; -} - -1; Index: gnu/usr.bin/perl/cpan/B-Lint/lib/B/Lint/Debug.pm =================================================================== RCS file: gnu/usr.bin/perl/cpan/B-Lint/lib/B/Lint/Debug.pm diff -N gnu/usr.bin/perl/cpan/B-Lint/lib/B/Lint/Debug.pm --- gnu/usr.bin/perl/cpan/B-Lint/lib/B/Lint/Debug.pm 24 Mar 2014 15:05:23 -0000 1.3 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,73 +0,0 @@ -package B::Lint::Debug; -use if $] > 5.017, 'deprecate'; - -our $VERSION = '1.17'; - -=head1 NAME - -B::Lint::Debug - Adds debugging stringification to B:: - -=head1 DESCRIPTION - -This module injects stringification to a B::OP*/B::SPECIAL. This -should not be loaded unless you're debugging. - -=cut - -package # hide from PAUSE - B::SPECIAL; -use overload '""' => sub { - my $self = shift @_; - "SPECIAL($$self)"; -}; - -package # hide from PAUSE - B::OP; -use overload '""' => sub { - my $self = shift @_; - my $class = ref $self; - $class =~ s/\AB:://xms; - my $name = $self->name; - "$class($name)"; -}; - -package # hide from PAUSE - B::SVOP; -use overload '""' => sub { - my $self = shift @_; - my $class = ref $self; - $class =~ s/\AB:://xms; - my $name = $self->name; - "$class($name," . $self->sv . "," . $self->gv . ")"; -}; - -package # hide from PAUSE - B::SPECIAL; -sub DESTROY { } -our $AUTOLOAD; - -sub AUTOLOAD { - my $cx = 0; - print "AUTOLOAD $AUTOLOAD\n"; - - package # hide from PAUSE - DB; - while ( my @stuff = caller $cx ) { - - print "$cx: [@DB::args] [@stuff]\n"; - if ( ref $DB::args[0] ) { - if ( $DB::args[0]->can('padix') ) { - print " PADIX: " . $DB::args[0]->padix . "\n"; - } - if ( $DB::args[0]->can('targ') ) { - print " TARG: " . $DB::args[0]->targ . "\n"; - for ( B::Lint::cv()->PADLIST->ARRAY ) { - print +( $_->ARRAY )[ $DB::args[0]->targ ] . "\n"; - } - } - } - ++$cx; - } -} - -1; Index: gnu/usr.bin/perl/cpan/B-Lint/t/lint.t =================================================================== RCS file: gnu/usr.bin/perl/cpan/B-Lint/t/lint.t diff -N gnu/usr.bin/perl/cpan/B-Lint/t/lint.t --- gnu/usr.bin/perl/cpan/B-Lint/t/lint.t 24 Mar 2014 15:05:23 -0000 1.3 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,146 +0,0 @@ -#!./perl -w - -BEGIN { - unshift @INC, 't'; - push @INC, "../../t"; - require Config; - if ( ( $Config::Config{'extensions'} !~ /\bB\b/ ) ) { - print "1..0 # Skip -- Perl configured without B module\n"; - exit 0; - } - require 'test.pl'; -} - -use strict; -use warnings; - -plan tests => 29; - -# Runs a separate perl interpreter with the appropriate lint options -# turned on -sub runlint ($$$;$) { - my ( $opts, $prog, $result, $testname ) = @_; - my $res = runperl( - switches => ["-MO=Lint,$opts"], - prog => $prog, - stderr => 1, - ); - $res =~ s/-e syntax OK\n$//; - local $::Level = $::Level + 1; - is( $res, $result, $testname || $opts ); -} - -runlint 'magic-diamond', 'while(<>){}', <<'RESULT'; -Use of <> at -e line 1 -RESULT - -runlint 'magic-diamond', 'while(){}', <<'RESULT'; -Use of <> at -e line 1 -RESULT - -runlint 'magic-diamond', 'while(){}', <<'RESULT'; -RESULT - -runlint 'context', '$foo = @bar', <<'RESULT'; -Implicit scalar context for array in scalar assignment at -e line 1 -RESULT - -runlint 'context', '$foo = length @bar', <<'RESULT'; -Implicit scalar context for array in length at -e line 1 -RESULT - -runlint 'context', 'our @bar', ''; - -runlint 'context', 'exists $BAR{BAZ}', ''; - -runlint 'implicit-read', '/foo/', <<'RESULT'; -Implicit match on $_ at -e line 1 -RESULT - -runlint 'implicit-read', 'grep /foo/, ()', ''; - -runlint 'implicit-read', 'grep { /foo/ } ()', ''; - -runlint 'implicit-write', 's/foo/bar/', <<'RESULT'; -Implicit substitution on $_ at -e line 1 -RESULT - -runlint 'implicit-read', 'for ( @ARGV ) { 1 }', - <<'RESULT', 'implicit-read in foreach'; -Implicit use of $_ in foreach at -e line 1 -RESULT - -runlint 'implicit-read', '1 for @ARGV', '', 'implicit-read in foreach'; - -runlint 'dollar-underscore', '$_ = 1', <<'RESULT'; -Use of $_ at -e line 1 -RESULT - -runlint 'dollar-underscore', 'sub foo {}; foo( $_ ) for @A', ''; -runlint 'dollar-underscore', 'sub foo {}; map { foo( $_ ) } @A', ''; -runlint 'dollar-underscore', 'sub foo {}; grep { foo( $_ ) } @A', ''; - -runlint 'dollar-underscore', 'print', - <<'RESULT', 'dollar-underscore in print'; -Use of $_ at -e line 1 -RESULT - -runlint 'private-names', 'sub A::_f{};A::_f()', <<'RESULT'; -Illegal reference to private name '_f' at -e line 1 -RESULT - -runlint 'private-names', '$A::_x', <<'RESULT'; -Illegal reference to private name '_x' at -e line 1 -RESULT - -runlint 'private-names', 'sub A::_f{};A->_f()', <<'RESULT', -Illegal reference to private method name '_f' at -e line 1 -RESULT - 'private-names (method)'; - -runlint 'undefined-subs', 'foo()', <<'RESULT'; -Nonexistent subroutine 'foo' called at -e line 1 -RESULT - -runlint 'undefined-subs', 'foo();sub foo;', <<'RESULT'; -Undefined subroutine 'foo' called at -e line 1 -RESULT - -runlint 'regexp-variables', 'print $&', <<'RESULT'; -Use of regexp variable $& at -e line 1 -RESULT - -runlint 'regexp-variables', 's/./$&/', <<'RESULT'; -Use of regexp variable $& at -e line 1 -RESULT - -runlint 'bare-subs', 'sub bare(){1};$x=bare', ''; - -runlint 'bare-subs', 'sub bare(){1}; $x=[bare=>0]; $x=$y{bare}', <<'RESULT'; -Bare sub name 'bare' interpreted as string at -e line 1 -Bare sub name 'bare' interpreted as string at -e line 1 -RESULT - -{ - - # Check for backwards-compatible plugin support. This was where - # preloaded mdoules would register themselves with B::Lint. - my $res = runperl( - switches => ["-MB::Lint"], - prog => - 'BEGIN{B::Lint->register_plugin(X=>[q[x]])};use O(qw[Lint x]);sub X::match{warn qq[X ok.\n]};dummy()', - stderr => 1, - ); - like( $res, qr/X ok\./, 'Lint legacy plugin' ); -} - -{ - - # Check for Module::Plugin support - my $res = runperl( - switches => [ '-It/pluglib', '-MO=Lint,none' ], - prog => 1, - stderr => 1, - ); - like( $res, qr/Module::Pluggable ok\./, 'Lint uses Module::Pluggable' ); -} Index: gnu/usr.bin/perl/cpan/B-Lint/t/pluglib/B/Lint/Plugin/Test.pm =================================================================== RCS file: gnu/usr.bin/perl/cpan/B-Lint/t/pluglib/B/Lint/Plugin/Test.pm diff -N gnu/usr.bin/perl/cpan/B-Lint/t/pluglib/B/Lint/Plugin/Test.pm --- gnu/usr.bin/perl/cpan/B-Lint/t/pluglib/B/Lint/Plugin/Test.pm 24 Mar 2014 15:05:23 -0000 1.3 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,20 +0,0 @@ -package B::Lint::Plugin::Test; -use strict; -use warnings; - -# This package will be loaded automatically by Module::Plugin when -# B::Lint loads. -warn 'got here!'; - -sub match { - my $op = shift @_; - - # Prints to STDERR which will be picked up by the test running in - # lint.t - warn "Module::Pluggable ok.\n"; - - # Ignore this method once it happens once. - *match = sub { }; -} - -1; Index: gnu/usr.bin/perl/cpan/CGI/Changes =================================================================== RCS file: gnu/usr.bin/perl/cpan/CGI/Changes diff -N gnu/usr.bin/perl/cpan/CGI/Changes --- gnu/usr.bin/perl/cpan/CGI/Changes 24 Mar 2014 15:05:23 -0000 1.5 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,1785 +0,0 @@ -Version 3.63 Nov 12, 2012 - - [SECURITY] - - CR escaping for Set-Cookie and P3P headers was improved. There was potential - for newline injection in these headers. - (Thanks to anazawa, https://github.com/markstos/CGI.pm/pull/23) - -Version 3.62, Nov 9th, 2012 - - [INTERNALS] - - Changed how the deprecated endform function was defined for compatibilty - with the development version of Perl. - - Fix failures in t/tmpdir.t when run as root - https://github.com/markstos/CGI.pm/issues/22, RT#80659) - - - Made it possible to force a sorted order for things like hash - attributes so that tests are not dependent on a particular hash - ordering. This will be required in modern perls which will - change the ordering per process. (Yves, RT#80659) - -Version 3.61 Nov 2nd, 2012 - - (No code changes) - - [INTERNALS] - - formatting of CGI::Carp documentation was improved. Thanks to benkasminbullock. - - un-TODO some tests in t/tmpdir.t that were passing in most cases. - More on this: - https://github.com/markstos/CGI.pm/issues/19# - https://github.com/markstos/CGI.pm/commit/cc73dc9807b0fabb56b3cdf1a9726588b2eda0f7 - -Version 3.60 Aug 15th, 2012 - - [BUG FIXES] - - In some caes, When unescapeHTML() hit something it didn't recognize with an ampersand and - and semicolon, it would throw away the semicolon and ampersand. It now does a better job. - of preserving content it doesn't recognize. Thanks to CEBJYRE@cpan.org (RT#75595) - - Remove trailing newline after

tag inserted by startform and start_form. It can - cause rendering problems in some cases. Thanks to SJOHNSTON@cpan.org (RT#67719) - - Workaround "Insecure Dependency" warning generated by some versions of Perl (RT#53733). - Thanks to degatcpan@ntlworld.com, klchu@lbl.gov and Anonymous Monk - - [DOCUMENTATION] - - Clarify that when -status is used, the human-readable phase should be included, per RFC 2616. - Thanks to SREZIC@cpan.org (RT#76691). - - [INTERNALS] - - More tests for header(), thanks to Ryo Anazawa. - - t/url.t has been fixed on VMS. Thanks to cberry@cpan.org (RT#72380) - - MANIFEST patched so that t/multipart_init.t is included again. Thanks to shay@cpan.org (RT#76189) - -Version 3.59 Dec 29th, 2011 - - [BUG FIXES] - - We no longer read from STDIN when the Content-Length is not set, preventing - requests with no Content-Length from freezing in some cases. This is consistent - with the CGI RFC 3875, and is also consistent with CGI::Simple. However, the old - behavior may have been expected by some command-line uses of CGI.pm. - Thanks to Philip Potter and Yanick Champoux. See RT#52469 for details: - https://rt.cpan.org/Public/Bug/Display.html?id=52469 - - [INTERNALS] - - remove tmpdirs more aggressively. Thanks to rjbs (RT#73288) - - use Text::ParseWords instead of ancient shellwords.pl. Thanks to AlexBio. - - remove use of define(@arr). Thanks to rjbs. - - spelling fixes. Thanks to Gregor Herrmann and Alessandro Ghedini. - - fix test count and warning in t/fast.t. Thanks to Yanick. - -Version 3.58 Nov 11th, 2011 - - [DOCUMENTATION] - - Clarify that using query_string() only has defined behavior when using the GET method. (RT#60813) - -Version 3.57 Nov 9th, 2011 - [INTERNALS] - - test failure in t/fast.t introduced in 3.56 is fixed. (Thanks to zefram and chansen). - - Test::More requirement has been bumped to 0.98 - -Version 3.56 Nov 8th, 2011 - - [SECURITY] - Use public and documented FCGI.pm API in CGI::Fast - CGI::Fast was using an FCGI API that was deprecated and removed from - documentation more than ten years ago. Usage of this deprecated API with - FCGI >= 0.70 or FCGI <= 0.73 introduces a security issue. - - - (Thanks to chansen) - - [INTERNALS] - - tmp files are now cleaned up on VMS ( RT#69210, thanks to cberry@cpan.org ) - - Fixed test failure: done_testing() added to url.t (Thanks to Ryan Jendoubi) - - Clarify preferred bug submission location in docs, and note that Mark Stosberg - is the current maintainer. - -Version 3.55 June 3rd, 2011 - - [THINGS THAT MAY BREAK YOUR CODE] - url() was fixed to return "PATH_INFO" when it is explicitly requested - with either the path=>1 or path_info=>1 flag. - - If your code is running under mod_rewrite (or compatible) and you are calling self_url() or - you are calling url() and passing path_info=>1, These methods will actually be - returning PATH_INFO now, as you have explicitly requested, or has self_url() - has requested on your behalf. - - The PATH_INFO has been omitted in such URLs since the issue was introduced - in the 3.12 release in December, 2005. - - This bug is so old your application may have come to depend on it or - workaround it. Check for application before upgrading to this release. - - Examples of affected method calls: - - $q->url(-absolute => 1, -query => 1, -path_info => 1 ) - $q->url(-path=>1) - $q->url(-full=>1,-path=>1) - $q->url(-rewrite=>1,-path=>1) - $q->self_url(); - -Version 3.54, Apr 28, 2011 - No code changes - - [INTERNALS] - - Address test failures in t/tmpdir.t, thanks to Niko Tyni. - Some tests here are failing on some platforms and have been marked as TODO. - -Version 3.53, Apr 25, 2011 - - [NEW FEATURES] - - The DELETE HTTP verb is now supported. - (RT#52614, James Robson, Eduardo Ari�o de la Rubia) - - [INTERNALS] - - Correct t/tmpdir.t MANIFEST entry. (RT#64949) - - Update minimum required Perl version to be Perl 5.8.1, which - has been out since 2003. This allows us to drop some hacks - and exceptions (Mark Stosberg) - -Version 3.52, Jan 24, 2011 - - [DOCUMENTATION] - - The documentation for multi-line header handling was been updated to reflect - the changes in 3.51. (Mark Stosberg, ntyni@iki.fi) - - [INTERNALS] - - Add missing t/tmpfile.t file. (RT#64949) - - Fix warning in t/cookie.t (RT#64570, Chris Williams, Rainer Tammer, Mark Stosberg) - - Fixed logic bug in t/multipart_init.t (RT#64261, Niko Tyni) - -Version 3.51, Jan 5, 2011 - - [NEW FEATURES] - - A new option to set $CGI::Carp::TO_BROWSER = 0, allows you to explicitly - exclude a particular scope from triggering printing to the browser when - fatatlsToBrowser is set. (RT#62783, Thanks to papowell) - - The