List Info

Thread: Time::Piece & matherr on qnx4




Time::Piece & matherr on qnx4
user name
2007-10-08 07:10:04
Here's the second patch required to get Perl building on
QNX4.

The first couple of changes affect Time::Piece, pulling in
the
strptime function already written for win32 and skipping
some tests.

The second couple of chunks add a matherr callback to
silence noise from the
libraries which was making many tests fail incorrectly.

I've not checked that this does still build ok on win32, but
it's fine
on my linux system.  I've also removed an old version of me
from the
AUTHORS file.

diff -urN perl-orig/ext/Time/Piece/Piece.xs
perl-current/ext/Time/Piece/Piece.xs
--- perl-orig/ext/Time/Piece/Piece.xs	2007-10-08
11:42:52.000000000 +0000
+++ perl-current/ext/Time/Piece/Piece.xs	2007-10-08
11:45:17.000000000 +0000
 -241,9
+241,13 
     ptm->tm_wday = (jday + WEEKDAY_BIAS) % 7;
 }
 
-#if defined(WIN32) /* No strptime on Win32 */
+#if defined(WIN32) || (defined(__QNX__) &&
defined(__WATCOMC__)) /* No strptime on Win32 or QNX4 */
 #define strncasecmp(x,y,n) strnicmp(x,y,n)
+
+#if defined(WIN32)
 #define alloca _alloca
+#endif
+
 #include <time.h>
 #include <ctype.h>
 #include <string.h>
diff -urN perl-orig/ext/Time/Piece/t/02core.t
perl-current/ext/Time/Piece/t/02core.t
--- perl-orig/ext/Time/Piece/t/02core.t	2007-10-08
11:42:52.000000000 +0000
+++ perl-current/ext/Time/Piece/t/02core.t	2007-10-08
11:45:40.000000000 +0000
 -1,6
+1,7 
 use Test::More tests => 93;
 
 my $is_win32 = ($^O =~ /Win32/);
+my $is_qnx = ($^O eq 'qnx');
 BEGIN { use_ok('Time::Piece'); }
 ok(1);
 
 -60,8
+61,12 
 cmp_ok($t->strftime('%d'), '==', 29);
 
 SKIP: {
-  skip "can't strftime %D, %R, %T or %e on
Win32", 2 if $is_win32;
+  skip "can't strftime %D, %R, %T or %e on
Win32", 1 if $is_win32;
   cmp_ok($t->strftime('%D'), 'eq', '02/29/00'); # Yech!
+}
+SKIP:{
+  skip "can't strftime %D, %R, %T or %e on
Win32", 1 if $is_win32;
+  skip "can't strftime %e on QNX", 1 if $is_qnx;
   cmp_ok($t->strftime('%e'), 'eq', '29');       # should
test with < 10
 }
 
 -76,7
+81,7 
 # and are possibly unportable (am or AM or a.m., and so
on)
 
 SKIP: {
-  skip "can't strftime %R on Win32", 1 if
$is_win32;
+  skip "can't strftime %R on Win32 or QNX", 1 if
$is_win32 or $is_qnx;
   cmp_ok($t->strftime('%R'), 'eq', '12:34');    # should
test with > 12
 }
 
 -94,7
+99,7 
 cmp_ok($t->strftime('%U'), 'eq', '09'); # Sun cmp Mon
 
 SKIP: {
-    skip "can't strftime %V on Win32", 1 if
$is_win32;
+    skip "can't strftime %V on Win32 or QNX", 1
if $is_win32 or $is_qnx;
     # is this test really broken on Mac OS? -- rjbs,
2006-02-08
     cmp_ok($t->strftime('%V'), 'eq', '09'); # Sun cmp
Mon
 }
diff -urN perl-orig/hints/qnx.sh perl-current/hints/qnx.sh
--- perl-orig/hints/qnx.sh	2007-10-08 11:42:56.000000000
+0000
+++ perl-current/hints/qnx.sh	2007-10-08 11:50:28.000000000
+0000
 -9,7
+9,12 
 #  socket3r.lib Nov21 1996.
 # perl-5.7.3 fails 2 known tests under QNX6.1.0
 #
-# As with many unix ports, this one depends on a few
"standard"
+# perl-5.10.0-tobe compiles with Watcom C 10.6
+#                and QNX 4.25 patch G w/TCPSDK installed
+#  Some tests still fail, mostly to do with dynamic/static
+#  or unsuported features in QNX.
+# 
+## As with many unix ports, this one depends on a few
"standard"
 # unix utilities which are not necessarily standard for
QNX4.
 #
 # /bin/sh  This is used heavily by Configure and then by
 -229,6
+234,11 
 	  /usr/local/bin or some other suitable location.
 	EOF
   fi
+
+  # includes a matherr() to silence noise from watcom libc
+  archobjs="qnx.o"
+  test -f qnx.c || cp qnx/qnx.c .
+
 else
   # $^O eq nto
 
diff -urN perl-orig/MANIFEST perl-current/MANIFEST
--- perl-orig/MANIFEST	2007-10-08 11:42:57.000000000 +0000
+++ perl-current/MANIFEST	2007-10-08 11:46:45.000000000
+0000
 -3260,6
+3260,7 
 proto.h				Prototypes
 qnx/ar				QNX implementation of "ar" utility
 qnx/cpp				QNX implementation of preprocessor filter
+qnx/qnx.c			QNX silent matherr callback
 README				The Instructions
 README.aix			Perl notes for AIX
 README.amiga			Perl notes for AmigaOS
diff -urN perl-orig/qnx/qnx.c perl-current/qnx/qnx.c
--- perl-orig/qnx/qnx.c	1970-01-01 00:00:00.000000000 +0000
+++ perl-current/qnx/qnx.c	2007-10-08 11:44:30.000000000
+0000
 -0,0
+1,11 
+/* If we're compiling with watcom, we want to silence
domain errors */
+#if defined(__QNX__) && defined(__WATCOMC__)
+#include <math.h>
+
+/* Return default value and print no error message */
+int matherr( struct exception *err )
+  {
+	return 1;
+  }
+
+#endif

--- perl-orig/AUTHORS	2007-10-08 11:42:57.000000000 +0000
+++ perl-current/AUTHORS	2007-10-08 12:01:57.000000000
+0000
 -35,7
+35,6 
 Alessandro Forghieri		<alforion.it>
 Alexei Alexandrov		<alexei.alexandrovgmail.com>
 Alex Davies			<adaviesptc.com>
-Alex Gough			<alexrcon.rog>
 Alex Vandiver			<alexmvmit.edu>
 Alex Waugh			<alexalexwaugh.com>
 Alexander Gough			<alex-p5pearth.li>

Re: Time::Piece & matherr on qnx4
user name
2007-10-08 07:23:07
On Mon, 8 Oct 2007 13:10:04 +0100, Alex Gough
<alex-p5pearth.li> wrote:

> Here's the second patch required to get Perl building
on QNX4.

If you add qnx.c, isn't it easier to add a strcasecmp ()
wrapper
to it instead of the Piece.xs patch?
That way you'd catch all perl problems regarding this
function.

> The first couple of changes affect Time::Piece, pulling
in the
> strptime function already written for win32 and
skipping some tests.
> 
> The second couple of chunks add a matherr callback to
silence noise from the
> libraries which was making many tests fail
incorrectly.
> 
> I've not checked that this does still build ok on
win32, but it's fine
> on my linux system.  I've also removed an old version
of me from the
> AUTHORS file.
> 
> diff -urN perl-orig/ext/Time/Piece/Piece.xs
perl-current/ext/Time/Piece/Piece.xs
> --- perl-orig/ext/Time/Piece/Piece.xs	2007-10-08
11:42:52.000000000 +0000
> +++ perl-current/ext/Time/Piece/Piece.xs	2007-10-08
11:45:17.000000000 +0000
>  -241,9 +241,13 
>      ptm->tm_wday = (jday + WEEKDAY_BIAS) % 7;
>  }
>  
> -#if defined(WIN32) /* No strptime on Win32 */
> +#if defined(WIN32) || (defined(__QNX__) &&
defined(__WATCOMC__)) /* No strptime on Win32 or QNX4 */
>  #define strncasecmp(x,y,n) strnicmp(x,y,n)
> +
> +#if defined(WIN32)
>  #define alloca _alloca
> +#endif
> +
>  #include <time.h>
>  #include <ctype.h>
>  #include <string.h>
> diff -urN perl-orig/ext/Time/Piece/t/02core.t
perl-current/ext/Time/Piece/t/02core.t
> --- perl-orig/ext/Time/Piece/t/02core.t	2007-10-08
11:42:52.000000000 +0000
> +++ perl-current/ext/Time/Piece/t/02core.t	2007-10-08
11:45:40.000000000 +0000
>  -1,6 +1,7 
>  use Test::More tests => 93;
>  
>  my $is_win32 = ($^O =~ /Win32/);
> +my $is_qnx = ($^O eq 'qnx');
>  BEGIN { use_ok('Time::Piece'); }
>  ok(1);
>  
>  -60,8 +61,12 
>  cmp_ok($t->strftime('%d'), '==', 29);
>  
>  SKIP: {
> -  skip "can't strftime %D, %R, %T or %e on
Win32", 2 if $is_win32;
> +  skip "can't strftime %D, %R, %T or %e on
Win32", 1 if $is_win32;
>    cmp_ok($t->strftime('%D'), 'eq', '02/29/00'); #
Yech!
> +}
> +SKIP:{
> +  skip "can't strftime %D, %R, %T or %e on
Win32", 1 if $is_win32;
> +  skip "can't strftime %e on QNX", 1 if
$is_qnx;
>    cmp_ok($t->strftime('%e'), 'eq', '29');       #
should test with < 10
>  }
>  
>  -76,7 +81,7 
>  # and are possibly unportable (am or AM or a.m., and
so on)
>  
>  SKIP: {
> -  skip "can't strftime %R on Win32", 1 if
$is_win32;
> +  skip "can't strftime %R on Win32 or QNX",
1 if $is_win32 or $is_qnx;
>    cmp_ok($t->strftime('%R'), 'eq', '12:34');    #
should test with > 12
>  }
>  
>  -94,7 +99,7 
>  cmp_ok($t->strftime('%U'), 'eq', '09'); # Sun cmp
Mon
>  
>  SKIP: {
> -    skip "can't strftime %V on Win32", 1 if
$is_win32;
> +    skip "can't strftime %V on Win32 or
QNX", 1 if $is_win32 or $is_qnx;
>      # is this test really broken on Mac OS? -- rjbs,
2006-02-08
>      cmp_ok($t->strftime('%V'), 'eq', '09'); # Sun
cmp Mon
>  }
> diff -urN perl-orig/hints/qnx.sh
perl-current/hints/qnx.sh
> --- perl-orig/hints/qnx.sh	2007-10-08
11:42:56.000000000 +0000
> +++ perl-current/hints/qnx.sh	2007-10-08
11:50:28.000000000 +0000
>  -9,7 +9,12 
>  #  socket3r.lib Nov21 1996.
>  # perl-5.7.3 fails 2 known tests under QNX6.1.0
>  #
> -# As with many unix ports, this one depends on a few
"standard"
> +# perl-5.10.0-tobe compiles with Watcom C 10.6
> +#                and QNX 4.25 patch G w/TCPSDK
installed
> +#  Some tests still fail, mostly to do with
dynamic/static
> +#  or unsuported features in QNX.
> +# 
> +## As with many unix ports, this one depends on a few
"standard"
>  # unix utilities which are not necessarily standard
for QNX4.
>  #
>  # /bin/sh  This is used heavily by Configure and then
by
>  -229,6 +234,11 
>  	  /usr/local/bin or some other suitable location.
>  	EOF
>    fi
> +
> +  # includes a matherr() to silence noise from watcom
libc
> +  archobjs="qnx.o"
> +  test -f qnx.c || cp qnx/qnx.c .
> +
>  else
>    # $^O eq nto
>  
> diff -urN perl-orig/MANIFEST perl-current/MANIFEST
> --- perl-orig/MANIFEST	2007-10-08 11:42:57.000000000
+0000
> +++ perl-current/MANIFEST	2007-10-08 11:46:45.000000000
+0000
>  -3260,6 +3260,7 
>  proto.h				Prototypes
>  qnx/ar				QNX implementation of "ar"
utility
>  qnx/cpp				QNX implementation of preprocessor filter
> +qnx/qnx.c			QNX silent matherr callback
>  README				The Instructions
>  README.aix			Perl notes for AIX
>  README.amiga			Perl notes for AmigaOS
> diff -urN perl-orig/qnx/qnx.c perl-current/qnx/qnx.c
> --- perl-orig/qnx/qnx.c	1970-01-01 00:00:00.000000000
+0000
> +++ perl-current/qnx/qnx.c	2007-10-08
11:44:30.000000000 +0000
>  -0,0 +1,11 
> +/* If we're compiling with watcom, we want to silence
domain errors */
> +#if defined(__QNX__) && defined(__WATCOMC__)
> +#include <math.h>
> +
> +/* Return default value and print no error message */
> +int matherr( struct exception *err )
> +  {
> +	return 1;
> +  }
> +
> +#endif
> 
> --- perl-orig/AUTHORS	2007-10-08 11:42:57.000000000
+0000
> +++ perl-current/AUTHORS	2007-10-08 12:01:57.000000000
+0000
>  -35,7 +35,6 
>  Alessandro Forghieri		<alforion.it>
>  Alexei Alexandrov		<alexei.alexandrovgmail.com>
>  Alex Davies			<adaviesptc.com>
> -Alex Gough			<alexrcon.rog>
>  Alex Vandiver			<alexmvmit.edu>
>  Alex Waugh			<alexalexwaugh.com>
>  Alexander Gough			<alex-p5pearth.li>
> 


-- 
H.Merijn Brand         Amsterdam Perl Mongers (http://amsterdam.pm.org/
)
using & porting perl 5.6.2, 5.8.x, 5.9.x   on HP-UX
10.20, 11.00, 11.11,
& 11.23, SuSE 10.0 & 10.2, AIX 4.3 & 5.2, and
Cygwin. http://qa.perl.org
http://mirrors.de
velooper.com/hpux/            http://www.test-smoke.org
                        http
://www.goldmark.org/jeff/stupid-disclaimers/

Re: Time::Piece & matherr on qnx4
user name
2007-10-08 07:35:39
#### [Mon, Oct 08, 2007 at 12:23:07PM +0000: H.Merijn
Brand]
> On Mon, 8 Oct 2007 13:10:04 +0100, Alex Gough
<alex-p5pearth.li> wrote:
> 
> > Here's the second patch required to get Perl
building on QNX4.
> 
> If you add qnx.c, isn't it easier to add a strcasecmp
() wrapper
> to it instead of the Piece.xs patch?
> That way you'd catch all perl problems regarding this
function.

The bit of Time::Piece you can't see has a custom strptime
function
which is what I was really after.  The strcasecmp define is
just
part of the prologue to that, and isn't needed elsewhere.

Alex Gough

Re: Time::Piece & matherr on qnx4
user name
2007-10-08 08:17:45
On 08/10/2007, Alex Gough <alex-p5pearth.li> wrote:
> Here's the second patch required to get Perl building
on QNX4.
>
> The first couple of changes affect Time::Piece, pulling
in the
> strptime function already written for win32 and
skipping some tests.
>
> The second couple of chunks add a matherr callback to
silence noise from the
> libraries which was making many tests fail
incorrectly.

Thanks, applied as #32069. I've also bumped the version
number of
Time::Piece in bleadperl to 1.11_03.

[1-4]

about | contact  Other archives ( Real Estate discussion Medical topics )