From 576a648b82a08e8e4d3dfe36a4b545294bf4939d Mon Sep 17 00:00:00 2001 From: Jarkko Hietaniemi Date: Mon, 15 Feb 1999 13:04:50 +0000 Subject: OpenBSD sparc SHMLBA. p4raw-id: //depot/cfgperl@2945 --- ext/IPC/SysV/SysV.xs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ext/IPC/SysV/SysV.xs b/ext/IPC/SysV/SysV.xs index 06059186c6..f13e01a958 100644 --- a/ext/IPC/SysV/SysV.xs +++ b/ext/IPC/SysV/SysV.xs @@ -22,7 +22,7 @@ # ifndef HAS_SHMAT_PROTOTYPE extern Shmat_t shmat _((int, char *, int)); # endif -# if defined(__NetBSD__) && defined(__sparc__) +# if defined(__sparc__) && (defined(__NetBSD__) || defined(__OpenBSD__)) # undef SHMLBA /* not static: determined at boot time */ # define SHMLBA getpagesize() # endif -- cgit v1.2.1 From aec308ece910998e159036ec2a891cbba90806c9 Mon Sep 17 00:00:00 2001 From: Spider Boardman Date: Wed, 10 Feb 1999 18:33:31 -0500 Subject: Import Ultrix update, change #2864, To: perlbug@perl.com Subject: Not OK: perl 5.00503 +MAINT_TRIAL_5 on RISC-ultrix 4.4 (UNINSTALLED) Message-Id: <9902110433.AA12816@abyss.zk3.dec.com> p4raw-link: @2864 on //depot/maint-5.005/perl: b47ccd61abe27ff67b6495fce49fc0fe9fa4cc76 p4raw-id: //depot/cfgperl@2946 --- doio.c | 5 ++--- ext/IPC/SysV/SysV.xs | 10 +++++++--- hints/ultrix_4.sh | 8 ++++---- 3 files changed, 13 insertions(+), 10 deletions(-) diff --git a/doio.c b/doio.c index 1719bf16c1..79db3aa5fc 100644 --- a/doio.c +++ b/doio.c @@ -18,13 +18,12 @@ #include "perl.h" #if defined(HAS_MSG) || defined(HAS_SEM) || defined(HAS_SHM) +#ifndef HAS_SEM #include +#endif #ifdef HAS_MSG #include #endif -#ifdef HAS_SEM -#include -#endif #ifdef HAS_SHM #include # ifndef HAS_SHMAT_PROTOTYPE diff --git a/ext/IPC/SysV/SysV.xs b/ext/IPC/SysV/SysV.xs index f13e01a958..0aaf0527a1 100644 --- a/ext/IPC/SysV/SysV.xs +++ b/ext/IPC/SysV/SysV.xs @@ -7,13 +7,12 @@ # include #endif #if defined(HAS_MSG) || defined(HAS_SEM) || defined(HAS_SHM) +#ifndef HAS_SEM # include +#endif # ifdef HAS_MSG # include # endif -# ifdef HAS_SEM -# include -# endif # ifdef HAS_SHM # if defined(PERL_SCO) || defined(PERL_ISC) # include /* SHMLBA */ @@ -29,6 +28,11 @@ # endif #endif +/* Required to get 'struct pte' for SHMLBA on ULTRIX. */ +#if defined(__ultrix) || defined(__ultrix__) || defined(ultrix) +#include +#endif + /* Required in BSDI to get PAGE_SIZE definition for SHMLBA. * Ugly. More beautiful solutions welcome. * Shouting at BSDI sounds quite beautiful. */ diff --git a/hints/ultrix_4.sh b/hints/ultrix_4.sh index ed9fe5b9ed..9217cc35e5 100644 --- a/hints/ultrix_4.sh +++ b/hints/ultrix_4.sh @@ -34,16 +34,16 @@ case "$cc" in *gcc*) ;; *) case "$osvers" in - *4.1*) ccflags="$ccflags -DLANGUAGE_C -Olimit 3200" ;; - *4.2*) ccflags="$ccflags -DLANGUAGE_C -Olimit 3200" + *4.1*) ccflags="$ccflags -DLANGUAGE_C -Olimit 3400" ;; + *4.2*) ccflags="$ccflags -DLANGUAGE_C -Olimit 3400" # Prototypes sometimes cause compilation errors in 4.2. prototype=undef case "$myuname" in *risc*) d_volatile=undef ;; esac ;; - *4.3*) ccflags="$ccflags -std1 -DLANGUAGE_C -Olimit 3200" ;; - *) ccflags="$ccflags -std -Olimit 3200" ;; + *4.3*) ccflags="$ccflags -std1 -DLANGUAGE_C -Olimit 3400" ;; + *) ccflags="$ccflags -std -Olimit 3400" ;; esac ;; esac -- cgit v1.2.1 -- cgit v1.2.1 From 8e465e4efd4a2238e1ce273032f20e4219881f4b Mon Sep 17 00:00:00 2001 From: Jarkko Hietaniemi Date: Mon, 15 Feb 1999 13:46:56 +0000 Subject: AVAILABILITY from 5.005_03-tobe, will of course require updating when 5.006 comes out. p4raw-id: //depot/cfgperl@2951 --- pod/perl.pod | 70 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 70 insertions(+) diff --git a/pod/perl.pod b/pod/perl.pod index ecdaac71cd..db4508700f 100644 --- a/pod/perl.pod +++ b/pod/perl.pod @@ -245,6 +245,76 @@ optimized C code. Okay, that's I enough hype. +=head1 AVAILABILITY + +Perl is available for the vast majority of operating system platforms, +including most Unix-like platforms. The following situation is as of +February 1999 and Perl 5.005_03. + +The following platforms are able to build Perl from the standard +source code distribution available at +F + + AIX IRIX SCO ODT/OSR + A/UX Linux Solaris + BeOS MachTen SunOS + BSD/OS MPE/iX SVR4 + DG/UX NetBSD Ultrix + Digital UNIX NextSTEP UNICOS + DOS DJGPP 1) OpenBSD VMS + DYNIX/ptx OpenSTEP Windows 3.1 1) + FreeBSD OS/2 Windows 95 1) 3) + HP-UX OS390 2) Windows 98 1) 3) + Hurd PowerUX Windows NT 1) 3) + QNX VOS + + 1) in DOS mode either the DOS or OS/2 ports can be used + 2) formerly known as MVS + 3) compilers: Borland, Cygwin32, Mingw32 EGCS/GCC, VC++ + +The following platforms have been known to build Perl from the source +but for the Perl release 5.005_03 we haven't been able to verify them, +either because the hardware/software platforms are rather rare or +because we don't have an active champion on these platforms. + + 3b1 FPS Plan 9 + AmigaOS GENIX RISC/os + ConvexOS Greenhills Stellar + CX/UX ISC SVR2 + DC/OSx MachTen 68k TI1500 + DDE SMES MiNT TitanOS + DomainOS MPC UNICOS/mk + DOS EMX NEWS-OS Unisys Dynix + Dynix Opus Unixware + EP/IX + ESIX + +The following platforms are planned to be supported in the standard +source distribution of the Perl release 5.006 but are not +supported in the Perl release 5.005_03: + + BS2000 + VM/ESA + +The following platforms have their own source code distributions and +binaries available via F. + + Perl release + + AS/400 5.003 + MacOS 5.004_04 + Tandem Guardian 5.004 + +The following platforms have only binaries available via +F. + + Perl release + + Acorn RISCOS 5.001 + AOS 5.002 + LynxOS 5.004_02 + Netware 5.003_07 + =head1 ENVIRONMENT See L. -- cgit v1.2.1 From 726ea1832d97e828b8b876350acab4bc0387050a Mon Sep 17 00:00:00 2001 From: Jarkko Hietaniemi Date: Mon, 15 Feb 1999 13:50:07 +0000 Subject: Enhance the packnative patch: use the packnative code only if required. Also added hefty testing (hopefully I didn't assume too much...). Tested on alpha, ix86, sparc. p4raw-id: //depot/cfgperl@2952 --- pod/perlfunc.pod | 18 ++++++---- pp.c | 101 ++++++++++++++++++++++++++++++++++++++++++++++--------- t/op/pack.t | 78 ++++++++++++++++++++++++++++++++++++++++-- 3 files changed, 173 insertions(+), 24 deletions(-) diff --git a/pod/perlfunc.pod b/pod/perlfunc.pod index 07e2361def..1297e714ea 100644 --- a/pod/perlfunc.pod +++ b/pod/perlfunc.pod @@ -2592,19 +2592,25 @@ C<"P"> is C. =item * The integer types C<"s">, C<"S">, C<"l">, and C<"L"> may be -immediately followed by a C<"_"> to signify a native short or long--as +immediately followed by a C<"_"> to signify native shorts or longs--as you can see from above for example a bare C<"l"> does mean exactly 32 bits, the native C (as seen by the local C compiler) may be -larger. This is an issue mainly in 64-bit platforms. +larger. This is an issue mainly in 64-bit platforms. You can see +whether using C<"_"> makes any difference by + + print length(pack("s")), " ", length(pack("s_")), "\n"; + print length(pack("l")), " ", length(pack("l_")), "\n"; C<"i_"> and C<"I_"> also work but only because of completeness; they are identical to C<"i"> and C<"I">. -The actual size (in bytes) of native shorts, ints, and longs on -the platform where Perl was built are available from L: +The actual sizes (in bytes) of native shorts, ints, and longs on +the platform where Perl was built are available via L: use Config; print $Config{shortsize}, "\n"; + print $Config{intsize}, "\n"; + print $Config{longsize}, "\n"; =item * @@ -2632,8 +2638,8 @@ You can see your system's preference with print join(" ", map { sprintf "%#02x", $_ } unpack("C*",pack("L",0x12345678))), "\n"; -The actual byteorder on the platform where Perl was built are available -from L: +The actual byteorder on the platform where Perl was built is available +via L: use Config; print $Config{byteorder}, "\n"; diff --git a/pp.c b/pp.c index 985a3ed277..d5b7081754 100644 --- a/pp.c +++ b/pp.c @@ -78,6 +78,10 @@ typedef unsigned UBW; #define SIZE16 2 #define SIZE32 4 +#if SHORTSIZE != SIZE16 || LONGSIZE != SIZE32 +# define PERL_NATINT_PACK +#endif + #if BYTEORDER > 0xFFFF && defined(_CRAY) && !defined(_CRAYMPP) # if BYTEORDER == 0x12345678 # define OFF16(p) (char*)(p) @@ -3243,8 +3247,10 @@ PP(pp_unpack) register U32 culong; double cdouble; int commas = 0; +#ifdef PERL_NATINT_PACK int natint; /* native integer */ int unatint; /* unsigned native integer */ +#endif if (gimme != G_ARRAY) { /* arrange to do first one only */ /*SUPPRESS 530*/ @@ -3260,14 +3266,18 @@ PP(pp_unpack) while (pat < patend) { reparse: datumtype = *pat++ & 0xFF; +#ifdef PERL_NATINT_PACK natint = 0; +#endif if (isSPACE(datumtype)) continue; if (*pat == '_') { char *natstr = "sSiIlL"; if (strchr(natstr, datumtype)) { +#ifdef PERL_NATINT_PACK natint = 1; +#endif pat++; } else @@ -3517,10 +3527,15 @@ PP(pp_unpack) } break; case 's': +#if SHORTSIZE == SIZE16 + along = (strend - s) / SIZE16; +#else along = (strend - s) / (natint ? sizeof(short) : SIZE16); +#endif if (len > along) len = along; if (checksum) { +#if SHORTSIZE != SIZE16 if (natint) { while (len-- > 0) { COPYNN(s, &ashort, sizeof(short)); @@ -3529,7 +3544,9 @@ PP(pp_unpack) } } - else { + else +#endif + { while (len-- > 0) { COPY16(s, &ashort); s += SIZE16; @@ -3540,6 +3557,7 @@ PP(pp_unpack) else { EXTEND(SP, len); EXTEND_MORTAL(len); +#if SHORTSIZE != SIZE16 if (natint) { while (len-- > 0) { COPYNN(s, &ashort, sizeof(short)); @@ -3549,7 +3567,9 @@ PP(pp_unpack) PUSHs(sv_2mortal(sv)); } } - else { + else +#endif + { while (len-- > 0) { COPY16(s, &ashort); s += SIZE16; @@ -3563,11 +3583,16 @@ PP(pp_unpack) case 'v': case 'n': case 'S': +#if SHORTSIZE == SIZE16 + along = (strend - s) / SIZE16; +#else unatint = natint && datumtype == 'S'; along = (strend - s) / (unatint ? sizeof(unsigned short) : SIZE16); +#endif if (len > along) len = along; if (checksum) { +#if SHORTSIZE != SIZE16 if (unatint) { while (len-- > 0) { COPYNN(s, &aushort, sizeof(unsigned short)); @@ -3575,7 +3600,9 @@ PP(pp_unpack) culong += aushort; } } - else { + else +#endif + { while (len-- > 0) { COPY16(s, &aushort); s += SIZE16; @@ -3594,16 +3621,19 @@ PP(pp_unpack) else { EXTEND(SP, len); EXTEND_MORTAL(len); +#if SHORTSIZE != SIZE16 if (unatint) { while (len-- > 0) { COPYNN(s, &aushort, sizeof(unsigned short)); s += sizeof(unsigned short); sv = NEWSV(39, 0); - sv_setiv(sv, (IV)aushort); + sv_setiv(sv, (UV)aushort); PUSHs(sv_2mortal(sv)); } } - else { + else +#endif + { while (len-- > 0) { COPY16(s, &aushort); s += SIZE16; @@ -3616,7 +3646,7 @@ PP(pp_unpack) if (datumtype == 'v') aushort = vtohs(aushort); #endif - sv_setiv(sv, (IV)aushort); + sv_setiv(sv, (UV)aushort); PUSHs(sv_2mortal(sv)); } } @@ -3693,10 +3723,15 @@ PP(pp_unpack) } break; case 'l': +#if LONGSIZE == SIZE32 + along = (strend - s) / SIZE32; +#else along = (strend - s) / (natint ? sizeof(long) : SIZE32); +#endif if (len > along) len = along; if (checksum) { +#if LONGSIZE != SIZE32 if (natint) { while (len-- > 0) { COPYNN(s, &along, sizeof(long)); @@ -3707,7 +3742,9 @@ PP(pp_unpack) culong += along; } } - else { + else +#endif + { while (len-- > 0) { COPY32(s, &along); s += SIZE32; @@ -3721,6 +3758,7 @@ PP(pp_unpack) else { EXTEND(SP, len); EXTEND_MORTAL(len); +#if LONGSIZE != SIZE32 if (natint) { while (len-- > 0) { COPYNN(s, &along, sizeof(long)); @@ -3730,7 +3768,9 @@ PP(pp_unpack) PUSHs(sv_2mortal(sv)); } } - else { + else +#endif + { while (len-- > 0) { COPY32(s, &along); s += SIZE32; @@ -3744,11 +3784,16 @@ PP(pp_unpack) case 'V': case 'N': case 'L': - unatint = natint && datumtype; +#if LONGSIZE == SIZE32 + along = (strend - s) / SIZE32; +#else + unatint = natint && datumtype == 'L'; along = (strend - s) / (unatint ? sizeof(unsigned long) : SIZE32); +#endif if (len > along) len = along; if (checksum) { +#if LONGSIZE != SIZE32 if (unatint) { while (len-- > 0) { COPYNN(s, &aulong, sizeof(unsigned long)); @@ -3759,7 +3804,9 @@ PP(pp_unpack) culong += aulong; } } - else { + else +#endif + { while (len-- > 0) { COPY32(s, &aulong); s += SIZE32; @@ -3781,6 +3828,7 @@ PP(pp_unpack) else { EXTEND(SP, len); EXTEND_MORTAL(len); +#if LONGSIZE != SIZE32 if (unatint) { while (len-- > 0) { COPYNN(s, &aulong, sizeof(unsigned long)); @@ -3790,7 +3838,9 @@ PP(pp_unpack) PUSHs(sv_2mortal(sv)); } } - else { + else +#endif + { while (len-- > 0) { COPY32(s, &aulong); s += SIZE32; @@ -4210,7 +4260,9 @@ PP(pp_pack) float afloat; double adouble; int commas = 0; +#ifdef PERL_NATINT_PACK int natint; /* native integer */ +#endif items = SP - MARK; MARK++; @@ -4218,14 +4270,18 @@ PP(pp_pack) while (pat < patend) { #define NEXTFROM (items-- > 0 ? *MARK++ : &PL_sv_no) datumtype = *pat++ & 0xFF; +#ifdef PERL_NATINT_PACK natint = 0; +#endif if (isSPACE(datumtype)) continue; if (*pat == '_') { char *natstr = "sSiIlL"; if (strchr(natstr, datumtype)) { +#ifdef PERL_NATINT_PACK natint = 1; +#endif pat++; } else @@ -4475,6 +4531,7 @@ PP(pp_pack) } break; case 'S': +#if SHORTSIZE != SIZE16 if (natint) { unsigned short aushort; @@ -4484,17 +4541,21 @@ PP(pp_pack) sv_catpvn(cat, (char *)&aushort, sizeof(unsigned short)); } } - else { + else +#endif + { U16 aushort; while (len-- > 0) { fromstr = NEXTFROM; - aushort = (U16)SvIV(fromstr); + aushort = (U16)SvUV(fromstr); CAT16(cat, &aushort); } + } break; case 's': +#if SHORTSIZE != 2 if (natint) { while (len-- > 0) { fromstr = NEXTFROM; @@ -4502,7 +4563,9 @@ PP(pp_pack) sv_catpvn(cat, (char *)&ashort, sizeof(short)); } } - else { + else +#endif + { while (len-- > 0) { fromstr = NEXTFROM; ashort = (I16)SvIV(fromstr); @@ -4615,6 +4678,7 @@ PP(pp_pack) } break; case 'L': +#if LONGSIZE != SIZE32 if (natint) { while (len-- > 0) { fromstr = NEXTFROM; @@ -4622,7 +4686,9 @@ PP(pp_pack) sv_catpvn(cat, (char *)&aulong, sizeof(unsigned long)); } } - else { + else +#endif + { while (len-- > 0) { fromstr = NEXTFROM; aulong = SvUV(fromstr); @@ -4631,6 +4697,7 @@ PP(pp_pack) } break; case 'l': +#if LONGSIZE != SIZE32 if (natint) { while (len-- > 0) { fromstr = NEXTFROM; @@ -4638,7 +4705,9 @@ PP(pp_pack) sv_catpvn(cat, (char *)&along, sizeof(long)); } } - else { + else +#endif + { while (len-- > 0) { fromstr = NEXTFROM; along = SvIV(fromstr); diff --git a/t/op/pack.t b/t/op/pack.t index 82f2b1cdd3..3b8ee35b91 100755 --- a/t/op/pack.t +++ b/t/op/pack.t @@ -6,7 +6,7 @@ BEGIN { require Config; import Config; } -print "1..78\n"; +print "1..98\n"; $format = "c2 x5 C C x s d i l a6"; # Need the expression in here to force ary[5] to be numeric. This avoids @@ -246,7 +246,7 @@ print "ok ", $test++, "\n"; print "not " unless unpack('Z8', "foo\0bar \0") eq "foo"; print "ok ", $test++, "\n"; -# 73..77: packing native shorts/ints/longs +# 73..78: packing native shorts/ints/longs print "not " unless length(pack("s_", 0)) == $Config{shortsize}; print "ok ", $test++, "\n"; @@ -266,3 +266,77 @@ print "ok ", $test++, "\n"; print "not " unless length(pack("i_", 0)) == length(pack("i", 0)); print "ok ", $test++, "\n"; +# 79..94: test the limits + +print "not " unless unpack("c", pack("c", 127)) == 127; +print "ok ", $test++, "\n"; + +print "not " unless unpack("c", pack("c", -128)) == -128; +print "ok ", $test++, "\n"; + +print "not " unless unpack("C", pack("C", 255)) == 255; +print "ok ", $test++, "\n"; + +print "not " unless unpack("s", pack("s", 32767)) == 32767; +print "ok ", $test++, "\n"; + +print "not " unless unpack("s", pack("s", -32768)) == -32768; +print "ok ", $test++, "\n"; + +print "not " unless unpack("S", pack("S", 65535)) == 65535; +print "ok ", $test++, "\n"; + +print "not " unless unpack("i", pack("i", 2147483647)) == 2147483647; +print "ok ", $test++, "\n"; + +print "not " unless unpack("i", pack("i", -2147483648)) == -2147483648; +print "ok ", $test++, "\n"; + +print "not " unless unpack("I", pack("I", 4294967295)) == 4294967295; +print "ok ", $test++, "\n"; + +print "not " unless unpack("l", pack("l", 2147483647)) == 2147483647; +print "ok ", $test++, "\n"; + +print "not " unless unpack("l", pack("l", -2147483648)) == -2147483648; +print "ok ", $test++, "\n"; + +print "not " unless unpack("L", pack("L", 4294967295)) == 4294967295; +print "ok ", $test++, "\n"; + +print "not " unless unpack("n", pack("n", 65535)) == 65535; +print "ok ", $test++, "\n"; + +print "not " unless unpack("n", pack("v", 65535)) == 65535; +print "ok ", $test++, "\n"; + +print "not " unless unpack("N", pack("N", 4294967295)) == 4294967295; +print "ok ", $test++, "\n"; + +print "not " unless unpack("V", pack("V", 4294967295)) == 4294967295; +print "ok ", $test++, "\n"; + +# 95..98 test the n/v/N/V byteorder + +if ($Config{byteorder} =~ /^1234(5678)?$/ || + $Config{byteorder} =~ /^(8765)?4321$/) { + +print "not " unless pack("n", 0xdead) eq "\xde\xad"; +print "ok ", $test++, "\n"; + +print "not " unless pack("v", 0xdead) eq "\xad\xde"; +print "ok ", $test++, "\n"; + +print "not " unless pack("N", 0xdeadbeef) eq "\xde\xad\xbe\xef"; +print "ok ", $test++, "\n"; + +print "not " unless pack("V", 0xdeadbeef) eq "\xef\xbe\xad\xde"; +print "ok ", $test++, "\n"; + +} else { + # weird byteorders require more thought + foreach (95..98) { + print "ok ", $test++, " # skipped\n"; + } +} + -- cgit v1.2.1 From 9de70c85adb9a4d3b22d09bb8920e00bf4051bdb Mon Sep 17 00:00:00 2001 From: Jarkko Hietaniemi Date: Mon, 15 Feb 1999 16:15:03 +0000 Subject: The pack tests now better in C90 (after the packnative patches). p4raw-id: //depot/cfgperl@2955 --- t/op/pack.t | 112 ++++++++++++++++++++++++++++++++++++++++++++++++------------ 1 file changed, 90 insertions(+), 22 deletions(-) diff --git a/t/op/pack.t b/t/op/pack.t index 3b8ee35b91..3e31e361df 100755 --- a/t/op/pack.t +++ b/t/op/pack.t @@ -268,6 +268,24 @@ print "ok ", $test++, "\n"; # 79..94: test the limits +# Some possibilities for $Config{byteorder} and $Config{.*size}. +# Note that CPUs can feature at several places. +# +# Config +# +# byteorder +# +# 1234 x86, vax, (DEC) mips +# 12345678 alpha +# 4321 sparc, ppc, hppa, (IRIX) mips, motorola +# 87654321 sparc, mips, hppa, cray +# +# x86 alpha sparc cray +# shortsize 2 2 2 8 +# intsize 4 4 4 8 +# longsize 4 8 8 8 +# + print "not " unless unpack("c", pack("c", 127)) == 127; print "ok ", $test++, "\n"; @@ -280,8 +298,17 @@ print "ok ", $test++, "\n"; print "not " unless unpack("s", pack("s", 32767)) == 32767; print "ok ", $test++, "\n"; -print "not " unless unpack("s", pack("s", -32768)) == -32768; -print "ok ", $test++, "\n"; +if ($Config{shortsize} == 2) { + print "not " unless unpack("s", pack("s", -32768)) == -32768; + print "ok ", $test++, "\n"; +} else { + if ($Config{shortsize} == 8 && $Config{byteorder} eq '87654321') { + print "not " unless unpack("s_", pack("s_", -32768)) == -32768; + print "ok ", $test++, "\n"; + } else { + print "ok ", $test++, " # skipped\n"; + } +} print "not " unless unpack("S", pack("S", 65535)) == 65535; print "ok ", $test++, "\n"; @@ -298,8 +325,18 @@ print "ok ", $test++, "\n"; print "not " unless unpack("l", pack("l", 2147483647)) == 2147483647; print "ok ", $test++, "\n"; -print "not " unless unpack("l", pack("l", -2147483648)) == -2147483648; -print "ok ", $test++, "\n"; +if ($Config{longsize} == 4 || $Config{byteorder} eq '12345678') { + print "not " unless unpack("l", pack("l", -2147483648)) == -2147483648; + print "ok ", $test++, "\n"; +} else { + if ($Config{shortsize} == 8 && $Config{byteorder} eq '87654321') { + print "not " + unless unpack("l_", pack("l_", -2147483648)) == -2147483648; + print "ok ", $test++, "\n"; + } else { + print "ok ", $test++, " # skipped\n"; + } +} print "not " unless unpack("L", pack("L", 4294967295)) == 4294967295; print "ok ", $test++, "\n"; @@ -307,36 +344,67 @@ print "ok ", $test++, "\n"; print "not " unless unpack("n", pack("n", 65535)) == 65535; print "ok ", $test++, "\n"; -print "not " unless unpack("n", pack("v", 65535)) == 65535; -print "ok ", $test++, "\n"; +if ($Config{shortsize} == 2) { + print "not " unless unpack("v", pack("v", 65535)) == 65535; + print "ok ", $test++, "\n"; +} else { + print "ok ", $test++, " # skipped\n"; +} print "not " unless unpack("N", pack("N", 4294967295)) == 4294967295; print "ok ", $test++, "\n"; -print "not " unless unpack("V", pack("V", 4294967295)) == 4294967295; -print "ok ", $test++, "\n"; +if ($Config{longsize} == 4 || $Config{byteorder} eq '12345678') { + print "not " unless unpack("V", pack("V", 4294967295)) == 4294967295; + print "ok ", $test++, "\n"; +} else { + print "ok ", $test++, " # skipped\n"; +} # 95..98 test the n/v/N/V byteorder if ($Config{byteorder} =~ /^1234(5678)?$/ || $Config{byteorder} =~ /^(8765)?4321$/) { -print "not " unless pack("n", 0xdead) eq "\xde\xad"; -print "ok ", $test++, "\n"; - -print "not " unless pack("v", 0xdead) eq "\xad\xde"; -print "ok ", $test++, "\n"; - -print "not " unless pack("N", 0xdeadbeef) eq "\xde\xad\xbe\xef"; -print "ok ", $test++, "\n"; - -print "not " unless pack("V", 0xdeadbeef) eq "\xef\xbe\xad\xde"; -print "ok ", $test++, "\n"; - + if ($Config{shortsize} == 2 || + $Config{byteorder} eq '87654321') { + print "not " unless pack("n", 0xdead) eq "\xde\xad"; + print "ok ", $test++, "\n"; + + if ($Config{byteorder} ne '87654321') { + print "not " unless pack("v", 0xdead) eq "\xad\xde"; + print "ok ", $test++, "\n"; + } else { + print "ok ", $test++, " # skipped\n"; + } + } else { + # shortsize != 2 systems require more thought + foreach (95..96) { + print "ok ", $test++, " # skipped\n"; + } + } + + if ($Config{longsize} == 4 || + $Config{byteorder} eq '12345678' || + $Config{byteorder} eq '87654321') { + print "not " unless pack("N", 0xdeadbeef) eq "\xde\xad\xbe\xef"; + print "ok ", $test++, "\n"; + + if ($Config{byteorder} ne '87654321') { + print "not " unless pack("V", 0xdeadbeef) eq "\xef\xbe\xad\xde"; + print "ok ", $test++, "\n"; + } else { + print "ok ", $test++, " # skipped\n"; + } + } else { + # exotic longsize != 2 systems require more thought + foreach (97..98) { + print "ok ", $test++, " # skipped\n"; + } + } } else { - # weird byteorders require more thought + # exotic byteorder system require more thought foreach (95..98) { print "ok ", $test++, " # skipped\n"; } } - -- cgit v1.2.1