Changeset 391 for python/trunk/Modules/fpectlmodule.c
- Timestamp:
- Mar 19, 2014, 11:31:01 PM (11 years ago)
- Location:
- python/trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
python/trunk
-
Property svn:mergeinfo
set to
/python/vendor/Python-2.7.6 merged eligible /python/vendor/current merged eligible
-
Property svn:mergeinfo
set to
-
python/trunk/Modules/fpectlmodule.c
r2 r391 1 1 /* 2 --------------------------------------------------------------------- 3 / Copyright (c) 1996. \ 2 --------------------------------------------------------------------- 3 / Copyright (c) 1996. \ 4 4 | The Regents of the University of California. | 5 5 | All rights reserved. | … … 33 33 | reflect those of the United States Government or the University | 34 34 | of California, and shall not be used for advertising or product | 35 \ endorsement purposes. / 36 --------------------------------------------------------------------- 35 \ endorsement purposes. / 36 --------------------------------------------------------------------- 37 37 */ 38 38 39 39 /* 40 40 Floating point exception control module. 41 41 42 42 This Python module provides bare-bones control over floating point … … 96 96 97 97 static PyMethodDef fpectl_methods[] = { 98 {"turnon_sigfpe", (PyCFunction) turnon_sigfpe,METH_VARARGS},99 {"turnoff_sigfpe", (PyCFunction) turnoff_sigfpe,METH_VARARGS},98 {"turnon_sigfpe", (PyCFunction) turnon_sigfpe, METH_VARARGS}, 99 {"turnoff_sigfpe", (PyCFunction) turnoff_sigfpe, METH_VARARGS}, 100 100 {0,0} 101 101 }; … … 122 122 * else can explain handle_sigfpes to me.... 123 123 * cc -c -I/usr/local/python/include fpectlmodule.c 124 * ld -shared -o fpectlmodule.so fpectlmodule.o -lfpe 124 * ld -shared -o fpectlmodule.so fpectlmodule.o -lfpe 125 125 */ 126 126 #include <sigfpe.h> … … 128 128 typedef void abort_routine (unsigned long); 129 129 handle_sigfpes(_OFF, 0, 130 131 132 130 (user_routine *)0, 131 _TURN_OFF_HANDLER_ON_ERROR, 132 NULL); 133 133 handle_sigfpes(_ON, _EN_OVERFL | _EN_DIVZERO | _EN_INVALID, 134 135 136 134 (user_routine *)0, 135 _ABORT_ON_ERROR, 136 NULL); 137 137 PyOS_setsig(SIGFPE, handler); 138 138 … … 195 195 /*-- DEC ALPHA VMS --------------------------------------------------------*/ 196 196 #elif defined(__ALPHA) && defined(__VMS) 197 198 199 200 201 202 203 204 205 206 197 IEEE clrmsk; 198 IEEE setmsk; 199 clrmsk.ieee$q_flags = 200 IEEE$M_TRAP_ENABLE_UNF | IEEE$M_TRAP_ENABLE_INE | 201 IEEE$M_MAP_UMZ; 202 setmsk.ieee$q_flags = 203 IEEE$M_TRAP_ENABLE_INV | IEEE$M_TRAP_ENABLE_DZE | 204 IEEE$M_TRAP_ENABLE_OVF; 205 sys$ieee_set_fp_control(&clrmsk, &setmsk, 0); 206 PyOS_setsig(SIGFPE, handler); 207 207 208 208 /*-- HP IA64 VMS --------------------------------------------------------*/ … … 263 263 fpsetmask(0); 264 264 #elif defined(__VMS) 265 266 267 268 269 270 271 265 IEEE clrmsk; 266 clrmsk.ieee$q_flags = 267 IEEE$M_TRAP_ENABLE_UNF | IEEE$M_TRAP_ENABLE_INE | 268 IEEE$M_MAP_UMZ | IEEE$M_TRAP_ENABLE_INV | 269 IEEE$M_TRAP_ENABLE_DZE | IEEE$M_TRAP_ENABLE_OVF | 270 IEEE$M_INHERIT; 271 sys$ieee_set_fp_control(&clrmsk, 0, 0); 272 272 #else 273 273 fputs("Operation not implemented\n", stderr); … … 292 292 m = Py_InitModule("fpectl", fpectl_methods); 293 293 if (m == NULL) 294 294 return; 295 295 d = PyModule_GetDict(m); 296 296 fpe_error = PyErr_NewException("fpectl.error", NULL, NULL); 297 297 if (fpe_error != NULL) 298 298 PyDict_SetItemString(d, "error", fpe_error); 299 299 } 300 300
Note:
See TracChangeset
for help on using the changeset viewer.