source: trunk/essentials/dev-lang/python/RISCOS/Modules/swimodule.c@ 3368

Last change on this file since 3368 was 3225, checked in by bird, 19 years ago

Python 2.5

File size: 15.6 KB
Line 
1/* swi
2
3 RISC OS swi functions
4
5 1.00 Chris Stretch
6
7
8 1.01 12 May 1999 Laurence Tratt
9
10 * Changed swi.error to be a class based exception rather than string based
11 * Added swi.ArgError which is generated for errors when the user passes invalid arguments to
12 functions etc
13 * Added "errnum" attribute to swi.error, so one can now check to see what the error number was
14
15 1.02 03 March 2002 Dietmar Schwertberger
16 * Added string, integer, integers, tuple and tuples
17*/
18
19#include "oslib/os.h"
20#include <kernel.h>
21#include "Python.h"
22
23
24#define PyBlock_Check(op) ((op)->ob_type == &PyBlockType)
25
26
27static PyObject *SwiError; /* Exception swi.error */
28static PyObject *ArgError; /* Exception swi.ArgError */
29static os_error *e;
30
31static PyObject *swi_oserror(void)
32{ PyErr_SetString(SwiError,e->errmess);
33 PyObject_SetAttrString(PyErr_Occurred(), "errnum", PyInt_FromLong(e->errnum));
34 return 0;
35}
36
37static PyObject *swi_error(char *s)
38{ PyErr_SetString(ArgError,s);
39 return 0;
40}
41
42typedef struct
43{ PyObject_HEAD
44 void *block;