[svn:parrot] r38279 - in trunk: . config/gen/platform/netbsd include/parrot
Infinoid at svn.parrot.org
Infinoid at svn.parrot.org
Thu Apr 23 05:11:16 UTC 2009
Author: Infinoid
Date: Thu Apr 23 05:11:15 2009
New Revision: 38279
URL: https://trac.parrot.org/parrot/changeset/38279
Log:
[netbsd] Apply patch from he++ in TT #574.
* Catch SIGFPE on netbsd-alpha platform and ignore it
* Use math.h defines for PARROT_FLOATVAL_INF_POSITIVE and friends
This patch may be a starting point for further work in this direction, see doughera++'s comment on the ticket.
Added:
trunk/config/gen/platform/netbsd/misc.c
trunk/config/gen/platform/netbsd/misc.h
Modified:
trunk/MANIFEST
trunk/include/parrot/datatypes.h
Modified: trunk/MANIFEST
==============================================================================
--- trunk/MANIFEST Thu Apr 23 04:14:26 2009 (r38278)
+++ trunk/MANIFEST Thu Apr 23 05:11:15 2009 (r38279)
@@ -359,6 +359,8 @@
config/gen/platform/generic/time.c []
config/gen/platform/ia64/asm.s []
config/gen/platform/netbsd/math.c []
+config/gen/platform/netbsd/misc.c []
+config/gen/platform/netbsd/misc.h []
config/gen/platform/openbsd/math.c []
config/gen/platform/openbsd/memexec.c []
config/gen/platform/openbsd/misc.h []
Added: trunk/config/gen/platform/netbsd/misc.c
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ trunk/config/gen/platform/netbsd/misc.c Thu Apr 23 05:11:15 2009 (r38279)
@@ -0,0 +1,58 @@
+/*
+ * $Id$
+ * Copyright (C) 2009, Parrot Foundation.
+ */
+
+/*
+
+=head1 NAME
+
+config/gen/platform/netbsd/misc.c
+
+=head1 DESCRIPTION
+
+Miscellaneous helper functions that are specific to NetBSD.
+
+=head2 Functions
+
+=over 4
+
+=cut
+
+*/
+
+/*
+
+=item C<void Parrot_platform_init_code(void)>
+
+Initialize Parrot for the NetBSD platform.
+So far only turns off SIGFPE for Alpha.
+
+=cut
+
+*/
+
+#include <signal.h>
+
+void
+Parrot_platform_init_code(void)
+{
+#if defined(__alpha__)
+ signal(SIGFPE, SIG_IGN);
+#endif
+}
+
+/*
+
+=back
+
+=cut
+
+*/
+
+/*
+ * Local variables:
+ * c-file-style: "parrot"
+ * End:
+ * vim: expandtab shiftwidth=4:
+ */
Added: trunk/config/gen/platform/netbsd/misc.h
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ trunk/config/gen/platform/netbsd/misc.h Thu Apr 23 05:11:15 2009 (r38279)
@@ -0,0 +1,19 @@
+/*
+ * $Id$
+ * Copyright (C) 2009, Parrot Foundation.
+ */
+
+#ifndef PARROT_PLATFORM_NETBSD_MISC_H_GUARD
+# define PARROT_PLATFORM_NETBSD_MISC_H_GUARD
+
+# define PARROT_HAS_PLATFORM_INIT_CODE
+void Parrot_platform_init_code(void);
+
+#endif /* PARROT_PLATFORM_NETBSD_MISC_H_GUARD */
+
+/*
+ * Local variables:
+ * c-file-style: "parrot"
+ * End:
+ * vim: expandtab shiftwidth=4:
+ */
Modified: trunk/include/parrot/datatypes.h
==============================================================================
--- trunk/include/parrot/datatypes.h Thu Apr 23 04:14:26 2009 (r38278)
+++ trunk/include/parrot/datatypes.h Thu Apr 23 05:11:15 2009 (r38279)
@@ -123,9 +123,16 @@
};
#endif /* INSIDE_GLOBAL_SETUP */
-#define PARROT_FLOATVAL_INF_POSITIVE floatval_divide_by_zero(interp, 1.0)
-#define PARROT_FLOATVAL_INF_NEGATIVE floatval_divide_by_zero(interp, -1.0)
-#define PARROT_FLOATVAL_NAN_QUIET floatval_divide_by_zero(interp, 0.0)
+#if defined(__NetBSD__) && defined(__alpha__)
+# include <math.h>
+# define PARROT_FLOATVAL_INF_POSITIVE INFINITY
+# define PARROT_FLOATVAL_INF_NEGATIVE -INFINITY
+# define PARROT_FLOATVAL_NAN_QUIET NAN
+#else
+# define PARROT_FLOATVAL_INF_POSITIVE floatval_divide_by_zero(interp, 1.0)
+# define PARROT_FLOATVAL_INF_NEGATIVE floatval_divide_by_zero(interp, -1.0)
+# define PARROT_FLOATVAL_NAN_QUIET floatval_divide_by_zero(interp, 0.0)
+#endif
#define PARROT_CSTRING_INF_POSITIVE "Inf"
#define PARROT_CSTRING_INF_NEGATIVE "-Inf"
More information about the parrot-commits
mailing list