summaryrefslogtreecommitdiffstats
path: root/Modules/fpectlmodule.c
diff options
context:
space:
mode:
authorNeal Norwitz <nnorwitz@gmail.com>2006-07-10 01:18:57 (GMT)
committerNeal Norwitz <nnorwitz@gmail.com>2006-07-10 01:18:57 (GMT)
commit2a30cd0ef0673710a1a4e188b50c11026c403b2a (patch)
treea95d41411e8f7d39a0fa6b6b73f99fc93573d8ea /Modules/fpectlmodule.c
parent4a5fbda66d3132af761e32e164ed398977f51694 (diff)
downloadcpython-2a30cd0ef0673710a1a4e188b50c11026c403b2a.zip
cpython-2a30cd0ef0673710a1a4e188b50c11026c403b2a.tar.gz
cpython-2a30cd0ef0673710a1a4e188b50c11026c403b2a.tar.bz2
Patch #1516912: improve Modules support for OpenVMS.
Diffstat (limited to 'Modules/fpectlmodule.c')
-rw-r--r--Modules/fpectlmodule.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/Modules/fpectlmodule.c b/Modules/fpectlmodule.c
index c6d4f77..74354ba 100644
--- a/Modules/fpectlmodule.c
+++ b/Modules/fpectlmodule.c
@@ -70,6 +70,10 @@ extern "C" {
#if defined(__FreeBSD__)
# include <ieeefp.h>
+#elif defined(__VMS)
+#define __NEW_STARLET
+#include <starlet.h>
+#include <ieeedef.h>
#endif
#ifndef WANT_SIGFPE_HANDLER
@@ -190,6 +194,19 @@ static void fpe_reset(Sigfunc *handler)
/*-- DEC ALPHA VMS --------------------------------------------------------*/
#elif defined(__ALPHA) && defined(__VMS)
+ IEEE clrmsk;
+ IEEE setmsk;
+ clrmsk.ieee$q_flags =
+ IEEE$M_TRAP_ENABLE_UNF | IEEE$M_TRAP_ENABLE_INE |
+ IEEE$M_MAP_UMZ;
+ setmsk.ieee$q_flags =
+ IEEE$M_TRAP_ENABLE_INV | IEEE$M_TRAP_ENABLE_DZE |
+ IEEE$M_TRAP_ENABLE_OVF;
+ sys$ieee_set_fp_control(&clrmsk, &setmsk, 0);
+ PyOS_setsig(SIGFPE, handler);
+
+/*-- HP IA64 VMS --------------------------------------------------------*/
+#elif defined(__ia64) && defined(__VMS)
PyOS_setsig(SIGFPE, handler);
/*-- Cray Unicos ----------------------------------------------------------*/
@@ -244,6 +261,14 @@ static PyObject *turnoff_sigfpe(PyObject *self,PyObject *args)
#ifdef __FreeBSD__
fpresetsticky(fpgetsticky());
fpsetmask(0);
+#elif defined(__VMS)
+ IEEE clrmsk;
+ clrmsk.ieee$q_flags =
+ IEEE$M_TRAP_ENABLE_UNF | IEEE$M_TRAP_ENABLE_INE |
+ IEEE$M_MAP_UMZ | IEEE$M_TRAP_ENABLE_INV |
+ IEEE$M_TRAP_ENABLE_DZE | IEEE$M_TRAP_ENABLE_OVF |
+ IEEE$M_INHERIT;
+ sys$ieee_set_fp_control(&clrmsk, 0, 0);
#else
fputs("Operation not implemented\n", stderr);
#endif