summaryrefslogtreecommitdiffstats
path: root/Modules/fpectlmodule.c
diff options
context:
space:
mode:
authorAntoine Pitrou <solipsis@pitrou.net>2010-05-09 15:52:27 (GMT)
committerAntoine Pitrou <solipsis@pitrou.net>2010-05-09 15:52:27 (GMT)
commitf95a1b3c53bdd678b64aa608d4375660033460c3 (patch)
treea8bee40b1b14e28ff5978ea519f3035a3c399912 /Modules/fpectlmodule.c
parentbd250300191133d276a71b395b6428081bf825b8 (diff)
downloadcpython-f95a1b3c53bdd678b64aa608d4375660033460c3.zip
cpython-f95a1b3c53bdd678b64aa608d4375660033460c3.tar.gz
cpython-f95a1b3c53bdd678b64aa608d4375660033460c3.tar.bz2
Recorded merge of revisions 81029 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk ........ r81029 | antoine.pitrou | 2010-05-09 16:46:46 +0200 (dim., 09 mai 2010) | 3 lines Untabify C files. Will watch buildbots. ........
Diffstat (limited to 'Modules/fpectlmodule.c')
-rw-r--r--Modules/fpectlmodule.c84
1 files changed, 42 insertions, 42 deletions
diff --git a/Modules/fpectlmodule.c b/Modules/fpectlmodule.c
index 6e6a616..1bb51cf 100644
--- a/Modules/fpectlmodule.c
+++ b/Modules/fpectlmodule.c
@@ -1,6 +1,6 @@
/*
- ---------------------------------------------------------------------
- / Copyright (c) 1996. \
+ ---------------------------------------------------------------------
+ / Copyright (c) 1996. \
| The Regents of the University of California. |
| All rights reserved. |
| |
@@ -32,12 +32,12 @@
| opinions of authors expressed herein do not necessarily state or |
| reflect those of the United States Government or the University |
| of California, and shall not be used for advertising or product |
- \ endorsement purposes. /
- ---------------------------------------------------------------------
+ \ endorsement purposes. /
+ ---------------------------------------------------------------------
*/
/*
- Floating point exception control module.
+ Floating point exception control module.
This Python module provides bare-bones control over floating point
units from several hardware manufacturers. Specifically, it allows
@@ -96,8 +96,8 @@ static PyObject *turnon_sigfpe (PyObject *self,PyObject *args);
static PyObject *turnoff_sigfpe (PyObject *self,PyObject *args);
static PyMethodDef fpectl_methods[] = {
- {"turnon_sigfpe", (PyCFunction) turnon_sigfpe, METH_VARARGS},
- {"turnoff_sigfpe", (PyCFunction) turnoff_sigfpe, METH_VARARGS},
+ {"turnon_sigfpe", (PyCFunction) turnon_sigfpe, METH_VARARGS},
+ {"turnoff_sigfpe", (PyCFunction) turnoff_sigfpe, METH_VARARGS},
{0,0}
};
@@ -122,19 +122,19 @@ static void fpe_reset(Sigfunc *handler)
* My usage doesn't follow the man page exactly. Maybe somebody
* else can explain handle_sigfpes to me....
* cc -c -I/usr/local/python/include fpectlmodule.c
- * ld -shared -o fpectlmodule.so fpectlmodule.o -lfpe
+ * ld -shared -o fpectlmodule.so fpectlmodule.o -lfpe
*/
#include <sigfpe.h>
typedef void user_routine (unsigned[5], int[2]);
typedef void abort_routine (unsigned long);
handle_sigfpes(_OFF, 0,
- (user_routine *)0,
- _TURN_OFF_HANDLER_ON_ERROR,
- NULL);
+ (user_routine *)0,
+ _TURN_OFF_HANDLER_ON_ERROR,
+ NULL);
handle_sigfpes(_ON, _EN_OVERFL | _EN_DIVZERO | _EN_INVALID,
- (user_routine *)0,
- _ABORT_ON_ERROR,
- NULL);
+ (user_routine *)0,
+ _ABORT_ON_ERROR,
+ NULL);
PyOS_setsig(SIGFPE, handler);
/*-- SunOS and Solaris ----------------------------------------------------*/
@@ -195,16 +195,16 @@ 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);
+ 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)
@@ -263,13 +263,13 @@ static PyObject *turnoff_sigfpe(PyObject *self,PyObject *args)
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);
+ 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
@@ -288,15 +288,15 @@ static void sigfpe_handler(int signo)
}
static struct PyModuleDef fpectlmodule = {
- PyModuleDef_HEAD_INIT,
- "fpectl",
- NULL,
- -1,
- fpectl_methods,
- NULL,
- NULL,
- NULL,
- NULL
+ PyModuleDef_HEAD_INIT,
+ "fpectl",
+ NULL,
+ -1,
+ fpectl_methods,
+ NULL,
+ NULL,
+ NULL,
+ NULL
};
PyMODINIT_FUNC PyInit_fpectl(void)
@@ -304,11 +304,11 @@ PyMODINIT_FUNC PyInit_fpectl(void)
PyObject *m, *d;
m = PyModule_Create(&fpectlmodule);
if (m == NULL)
- return NULL;
+ return NULL;
d = PyModule_GetDict(m);
fpe_error = PyErr_NewException("fpectl.error", NULL, NULL);
if (fpe_error != NULL)
- PyDict_SetItemString(d, "error", fpe_error);
+ PyDict_SetItemString(d, "error", fpe_error);
return m;
}