[Python-checkins] CVS: python/dist/src/RISCOS/Modules riscosmodule.c,1.2,1.3 swimodule.c,1.1,1.2
Guido van Rossum
gvanrossum@users.sourceforge.net
2001年10月24日 13:13:17 -0700
- Previous message: [Python-checkins] CVS: python/dist/src/RISCOS README,1.1,1.2 sleep.c,1.1,1.2 unixstuff.c,1.1,1.2 unixstuff.h,1.1,1.2
- Next message: [Python-checkins] CVS: python/dist/src/RISCOS/Python dynload_riscos.c,1.1,1.2 getmtime_riscos.c,1.1,1.2
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /cvsroot/python/python/dist/src/RISCOS/Modules
In directory usw-pr-cvs1:/tmp/cvs-serv11528/RISCOS/Modules
Modified Files:
riscosmodule.c swimodule.c
Log Message:
SF patch #474590 -- RISC OS support
Index: riscosmodule.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/RISCOS/Modules/riscosmodule.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** riscosmodule.c 2001年10月18日 20:34:25 1.2
--- riscosmodule.c 2001年10月24日 20:13:15 1.3
***************
*** 1,8 ****
/* RISCOS module implementation */
! #include "h.osfscontrol"
! #include "h.osgbpb"
! #include "h.os"
! #include "h.osfile"
#include "Python.h"
--- 1,9 ----
/* RISCOS module implementation */
! #include "oslib/osfscontrol.h"
! #include "oslib/osgbpb.h"
! #include "oslib/os.h"
! #include "oslib/osfile.h"
! #include "unixstuff.h"
#include "Python.h"
***************
*** 12,23 ****
static os_error *e;
! static PyObject *RiscosError; /* Exception riscos.error */
static PyObject *riscos_oserror(void)
! { PyErr_SetString(RiscosError,e->errmess);
! return 0;
}
- static PyObject *riscos_error(char *s) { PyErr_SetString(RiscosError,s);return 0;}
/* RISCOS file commands */
--- 13,29 ----
static os_error *e;
! /*static PyObject *RiscosError;*/ /* Exception riscos.error */
+ static PyObject *riscos_error(char *s)
+ {
+ PyErr_SetString(PyExc_OSError, s);
+ return NULL;
+ }
+
static PyObject *riscos_oserror(void)
! {
! return riscos_error(e->errmess);
}
/* RISCOS file commands */
***************
*** 26,30 ****
{ char *path1;
if (!PyArg_Parse(args, "s", &path1)) return NULL;
! if (remove(path1)) return PyErr_SetFromErrno(RiscosError);
Py_INCREF(Py_None);
return Py_None;
--- 32,36 ----
{ char *path1;
if (!PyArg_Parse(args, "s", &path1)) return NULL;
! if (remove(path1)) return PyErr_SetFromErrno(PyExc_OSError);
Py_INCREF(Py_None);
return Py_None;
***************
*** 34,38 ****
{ char *path1, *path2;
if (!PyArg_Parse(args, "(ss)", &path1, &path2)) return NULL;
! if (rename(path1,path2)) return PyErr_SetFromErrno(RiscosError);;
Py_INCREF(Py_None);
return Py_None;
--- 40,44 ----
{ char *path1, *path2;
if (!PyArg_Parse(args, "(ss)", &path1, &path2)) return NULL;
! if (rename(path1,path2)) return PyErr_SetFromErrno(PyExc_OSError);
Py_INCREF(Py_None);
return Py_None;
***************
*** 212,221 ****
}
static PyObject *riscos_utime(PyObject *self,PyObject *args)
! { char *path;
! int x,y;
! if (!PyArg_Parse(args, "(s(ii))", &path,&x,&y)) return NULL;
! e=xosfile_stamp(path);
! if(e) return riscos_oserror();
Py_INCREF(Py_None);
return Py_None;
--- 218,271 ----
}
+
static PyObject *riscos_utime(PyObject *self,PyObject *args)
! {
! char *path;
! long atime, mtime;
! PyObject* arg;
!
! if (!PyArg_ParseTuple(args, "sO:utime", &path, &arg))
! return NULL;
!
! if (arg == Py_None) {
! /* optional time values not given */
! Py_BEGIN_ALLOW_THREADS
! e=xosfile_stamp(path);
! Py_END_ALLOW_THREADS
! if(e) return riscos_oserror();
! }
! else if (!PyArg_Parse(arg, "(ll)", &atime, &mtime)) {
! PyErr_SetString(PyExc_TypeError,
! "utime() arg 2 must be a tuple (atime, mtime)");
! return NULL;
! }
! else {
! /* catalogue info*/
! fileswitch_object_type obj_type;
! bits load_addr, exec_addr;
! int size;
! fileswitch_attr attr;
!
! /* read old catalogue info */
! Py_BEGIN_ALLOW_THREADS
! e=xosfile_read_no_path(path, &obj_type, &load_addr, &exec_addr, &size, &attr);
! Py_END_ALLOW_THREADS
! if(e) return riscos_oserror();
!
! /* check if load and exec address really contain filetype and date */
! if ( (load_addr & 0xFFF00000U) != 0xFFF00000U)
! return riscos_error("can't set date for object with load and exec addresses");
!
! /* convert argument mtime to RISC OS load and exec address */
! if(acorntime(&exec_addr, &load_addr, (time_t) mtime))
! return riscos_oserror();
!
! /* write new load and exec address */
! Py_BEGIN_ALLOW_THREADS
! e = xosfile_write(path, load_addr, exec_addr, attr);
! Py_END_ALLOW_THREADS
! if(e) return riscos_oserror();
! }
!
Py_INCREF(Py_None);
return Py_None;
***************
*** 329,335 ****
/* Initialize riscos.error exception */
! RiscosError = PyString_FromString("riscos.error");
! if (RiscosError == NULL || PyDict_SetItemString(d, "error", RiscosError) != 0)
! Py_FatalError("can't define riscos.error");
PyStructSequence_InitType(&StatResultType, &stat_result_desc);
--- 379,383 ----
/* Initialize riscos.error exception */
! PyDict_SetItemString(d, "error", PyExc_OSError);
PyStructSequence_InitType(&StatResultType, &stat_result_desc);
Index: swimodule.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/RISCOS/Modules/swimodule.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** swimodule.c 2001年03月02日 05:57:54 1.1
--- swimodule.c 2001年10月24日 20:13:15 1.2
***************
*** 14,22 ****
*/
! #include "h.os"
! #include "h.kernel"
#include "Python.h"
- #include <errno.h>
#define PyBlock_Check(op) ((op)->ob_type == &PyBlockType)
--- 14,21 ----
*/
! #include "oslib/os.h"
! #include <kernel.h>
#include "Python.h"
#define PyBlock_Check(op) ((op)->ob_type == &PyBlockType)
- Previous message: [Python-checkins] CVS: python/dist/src/RISCOS README,1.1,1.2 sleep.c,1.1,1.2 unixstuff.c,1.1,1.2 unixstuff.h,1.1,1.2
- Next message: [Python-checkins] CVS: python/dist/src/RISCOS/Python dynload_riscos.c,1.1,1.2 getmtime_riscos.c,1.1,1.2
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]