Patch #734231: Update RiscOS support. In particular, correct
riscospath.extsep, and use os.extsep throughout.
This commit is contained in:
parent
5467d4c0e3
commit
a94568a753
|
@ -147,6 +147,7 @@ typedef PY_LONG_LONG Py_intptr_t;
|
||||||
|
|
||||||
#ifdef RISCOS
|
#ifdef RISCOS
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
|
#include "unixstuff.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef DONT_HAVE_SYS_STAT_H
|
#ifndef DONT_HAVE_SYS_STAT_H
|
||||||
|
|
|
@ -15,7 +15,7 @@ as os.path.
|
||||||
# strings representing various path-related bits and pieces
|
# strings representing various path-related bits and pieces
|
||||||
curdir = '@'
|
curdir = '@'
|
||||||
pardir = '^'
|
pardir = '^'
|
||||||
extsep = '.'
|
extsep = '/'
|
||||||
sep = '.'
|
sep = '.'
|
||||||
pathsep = ','
|
pathsep = ','
|
||||||
defpath = '<Run$Dir>'
|
defpath = '<Run$Dir>'
|
||||||
|
|
|
@ -162,7 +162,7 @@ if sys.exec_prefix != sys.prefix:
|
||||||
prefixes.append(sys.exec_prefix)
|
prefixes.append(sys.exec_prefix)
|
||||||
for prefix in prefixes:
|
for prefix in prefixes:
|
||||||
if prefix:
|
if prefix:
|
||||||
if sys.platform == 'os2emx':
|
if sys.platform in ('os2emx', 'riscos'):
|
||||||
sitedirs = [os.path.join(prefix, "Lib", "site-packages")]
|
sitedirs = [os.path.join(prefix, "Lib", "site-packages")]
|
||||||
elif os.sep == '/':
|
elif os.sep == '/':
|
||||||
sitedirs = [os.path.join(prefix,
|
sitedirs = [os.path.join(prefix,
|
||||||
|
|
|
@ -96,7 +96,6 @@ if sys.platform.lower().startswith("win"):
|
||||||
errorTab[10065] = "The host is unreachable."
|
errorTab[10065] = "The host is unreachable."
|
||||||
__all__.append("errorTab")
|
__all__.append("errorTab")
|
||||||
|
|
||||||
del os, sys
|
|
||||||
|
|
||||||
|
|
||||||
def getfqdn(name=''):
|
def getfqdn(name=''):
|
||||||
|
@ -139,6 +138,9 @@ _socketmethods = (
|
||||||
'sendall', 'setblocking',
|
'sendall', 'setblocking',
|
||||||
'settimeout', 'gettimeout', 'shutdown')
|
'settimeout', 'gettimeout', 'shutdown')
|
||||||
|
|
||||||
|
if sys.platform == "riscos":
|
||||||
|
_socketmethods = _socketmethods + ('sleeptaskw',)
|
||||||
|
|
||||||
class _closedsocket(object):
|
class _closedsocket(object):
|
||||||
__slots__ = []
|
__slots__ = []
|
||||||
def _dummy(*args):
|
def _dummy(*args):
|
||||||
|
|
|
@ -726,8 +726,10 @@ _expectations = {
|
||||||
"""
|
"""
|
||||||
test_al
|
test_al
|
||||||
test_asynchat
|
test_asynchat
|
||||||
|
test_atexit
|
||||||
test_bsddb
|
test_bsddb
|
||||||
test_bsddb185
|
test_bsddb185
|
||||||
|
test_bsddb3
|
||||||
test_cd
|
test_cd
|
||||||
test_cl
|
test_cl
|
||||||
test_commands
|
test_commands
|
||||||
|
|
|
@ -11,7 +11,7 @@ import sys
|
||||||
import bz2
|
import bz2
|
||||||
from bz2 import BZ2File, BZ2Compressor, BZ2Decompressor
|
from bz2 import BZ2File, BZ2Compressor, BZ2Decompressor
|
||||||
|
|
||||||
has_cmdline_bunzip2 = sys.platform not in ("win32", "os2emx")
|
has_cmdline_bunzip2 = sys.platform not in ("win32", "os2emx", "riscos")
|
||||||
|
|
||||||
class BaseTest(unittest.TestCase):
|
class BaseTest(unittest.TestCase):
|
||||||
"Base for other testcases."
|
"Base for other testcases."
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
from test.test_support import TestFailed, TESTFN, unlink
|
from test.test_support import TestFailed, TESTFN, unlink
|
||||||
from types import ClassType
|
from types import ClassType
|
||||||
import warnings
|
import warnings
|
||||||
import sys, traceback
|
import sys, traceback, os
|
||||||
|
|
||||||
print '5. Built-in exceptions'
|
print '5. Built-in exceptions'
|
||||||
# XXX This is not really enough, each *operation* should be tested!
|
# XXX This is not really enough, each *operation* should be tested!
|
||||||
|
@ -185,7 +185,7 @@ def test_capi1():
|
||||||
exc, err, tb = sys.exc_info()
|
exc, err, tb = sys.exc_info()
|
||||||
co = tb.tb_frame.f_code
|
co = tb.tb_frame.f_code
|
||||||
assert co.co_name == "test_capi1"
|
assert co.co_name == "test_capi1"
|
||||||
assert co.co_filename.endswith('test_exceptions.py')
|
assert co.co_filename.endswith('test_exceptions'+os.extsep+'py')
|
||||||
else:
|
else:
|
||||||
print "Expected exception"
|
print "Expected exception"
|
||||||
|
|
||||||
|
@ -197,7 +197,7 @@ def test_capi2():
|
||||||
exc, err, tb = sys.exc_info()
|
exc, err, tb = sys.exc_info()
|
||||||
co = tb.tb_frame.f_code
|
co = tb.tb_frame.f_code
|
||||||
assert co.co_name == "__init__"
|
assert co.co_name == "__init__"
|
||||||
assert co.co_filename.endswith('test_exceptions.py')
|
assert co.co_filename.endswith('test_exceptions'+os.extsep+'py')
|
||||||
co2 = tb.tb_frame.f_back.f_code
|
co2 = tb.tb_frame.f_back.f_code
|
||||||
assert co2.co_name == "test_capi2"
|
assert co2.co_name == "test_capi2"
|
||||||
else:
|
else:
|
||||||
|
|
|
@ -78,7 +78,7 @@ os = imp.load_module("os", *x)
|
||||||
|
|
||||||
def test_module_with_large_stack(module):
|
def test_module_with_large_stack(module):
|
||||||
# create module w/list of 65000 elements to test bug #561858
|
# create module w/list of 65000 elements to test bug #561858
|
||||||
filename = module + '.py'
|
filename = module + os.extsep + 'py'
|
||||||
|
|
||||||
# create a file with a list of 65000 elements
|
# create a file with a list of 65000 elements
|
||||||
f = open(filename, 'w+')
|
f = open(filename, 'w+')
|
||||||
|
@ -102,8 +102,8 @@ def test_module_with_large_stack(module):
|
||||||
|
|
||||||
# cleanup
|
# cleanup
|
||||||
del sys.path[-1]
|
del sys.path[-1]
|
||||||
for ext in '.pyc', '.pyo':
|
for ext in 'pyc', 'pyo':
|
||||||
fname = module + ext
|
fname = module + os.extsep + ext
|
||||||
if os.path.exists(fname):
|
if os.path.exists(fname):
|
||||||
os.unlink(fname)
|
os.unlink(fname)
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,7 @@ import sys
|
||||||
import os
|
import os
|
||||||
from unicodedata import normalize
|
from unicodedata import normalize
|
||||||
|
|
||||||
TESTDATAFILE = "NormalizationTest.txt"
|
TESTDATAFILE = "NormalizationTest" + os.extsep + "txt"
|
||||||
|
|
||||||
# This search allows using a build directory just inside the source
|
# This search allows using a build directory just inside the source
|
||||||
# directory, and saving just one copy of the test data in the source
|
# directory, and saving just one copy of the test data in the source
|
||||||
|
|
|
@ -42,7 +42,7 @@ else:
|
||||||
|
|
||||||
def test():
|
def test():
|
||||||
import sys
|
import sys
|
||||||
if sys.platform[:3] in ('win', 'mac', 'os2'):
|
if sys.platform[:3] in ('win', 'mac', 'os2', 'riscos'):
|
||||||
if verbose:
|
if verbose:
|
||||||
print "Can't test select easily on", sys.platform
|
print "Can't test select easily on", sys.platform
|
||||||
return
|
return
|
||||||
|
|
|
@ -6,7 +6,7 @@ from test import test_support
|
||||||
|
|
||||||
class TestCase(unittest.TestCase):
|
class TestCase(unittest.TestCase):
|
||||||
|
|
||||||
fn = "shelftemp.db"
|
fn = "shelftemp" + os.extsep + "db"
|
||||||
|
|
||||||
def test_ascii_file_shelf(self):
|
def test_ascii_file_shelf(self):
|
||||||
try:
|
try:
|
||||||
|
|
|
@ -56,14 +56,14 @@ def forget(modname):
|
||||||
import os
|
import os
|
||||||
for dirname in sys.path:
|
for dirname in sys.path:
|
||||||
try:
|
try:
|
||||||
os.unlink(os.path.join(dirname, modname + '.pyc'))
|
os.unlink(os.path.join(dirname, modname + os.extsep + 'pyc'))
|
||||||
except os.error:
|
except os.error:
|
||||||
pass
|
pass
|
||||||
# Deleting the .pyo file cannot be within the 'try' for the .pyc since
|
# Deleting the .pyo file cannot be within the 'try' for the .pyc since
|
||||||
# the chance exists that there is no .pyc (and thus the 'try' statement
|
# the chance exists that there is no .pyc (and thus the 'try' statement
|
||||||
# is exited) but there is a .pyo file.
|
# is exited) but there is a .pyo file.
|
||||||
try:
|
try:
|
||||||
os.unlink(os.path.join(dirname, modname + '.pyo'))
|
os.unlink(os.path.join(dirname, modname + os.extsep + 'pyo'))
|
||||||
except os.error:
|
except os.error:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
@ -118,7 +118,9 @@ import os
|
||||||
if os.name == 'java':
|
if os.name == 'java':
|
||||||
# Jython disallows @ in module names
|
# Jython disallows @ in module names
|
||||||
TESTFN = '$test'
|
TESTFN = '$test'
|
||||||
elif os.name != 'riscos':
|
elif os.name == 'riscos':
|
||||||
|
TESTFN = 'testfile'
|
||||||
|
else:
|
||||||
TESTFN = '@test'
|
TESTFN = '@test'
|
||||||
# Unicode name only used if TEST_FN_ENCODING exists for the platform.
|
# Unicode name only used if TEST_FN_ENCODING exists for the platform.
|
||||||
if have_unicode:
|
if have_unicode:
|
||||||
|
@ -129,8 +131,6 @@ elif os.name != 'riscos':
|
||||||
else:
|
else:
|
||||||
TESTFN_UNICODE=unicode("@test-\xe0\xf2", "latin-1") # 2 latin characters.
|
TESTFN_UNICODE=unicode("@test-\xe0\xf2", "latin-1") # 2 latin characters.
|
||||||
TESTFN_ENCODING=sys.getfilesystemencoding()
|
TESTFN_ENCODING=sys.getfilesystemencoding()
|
||||||
else:
|
|
||||||
TESTFN = 'test'
|
|
||||||
|
|
||||||
# Make sure we can write to TESTFN, try in /tmp if we can't
|
# Make sure we can write to TESTFN, try in /tmp if we can't
|
||||||
fp = None
|
fp = None
|
||||||
|
|
|
@ -21,15 +21,15 @@ except ImportError:
|
||||||
def path(path):
|
def path(path):
|
||||||
return test_support.findfile(path)
|
return test_support.findfile(path)
|
||||||
|
|
||||||
testtar = path("testtar.tar")
|
testtar = path("testtar" + os.extsep + "tar")
|
||||||
tempdir = path("testtar.dir")
|
tempdir = path("testtar" + os.extsep + "dir")
|
||||||
tempname = path("testtar.tmp")
|
tempname = path("testtar" + os.extsep + "tmp")
|
||||||
membercount = 10
|
membercount = 10
|
||||||
|
|
||||||
def tarname(comp=""):
|
def tarname(comp=""):
|
||||||
if not comp:
|
if not comp:
|
||||||
return testtar
|
return testtar
|
||||||
return "%s.%s" % (testtar, comp)
|
return "%s%s%s" % (testtar, os.extsep, comp)
|
||||||
|
|
||||||
def dirname():
|
def dirname():
|
||||||
if not os.path.exists(tempdir):
|
if not os.path.exists(tempdir):
|
||||||
|
|
|
@ -37,7 +37,7 @@ else:
|
||||||
TESTMOD = "ziptestmodule"
|
TESTMOD = "ziptestmodule"
|
||||||
TESTPACK = "ziptestpackage"
|
TESTPACK = "ziptestpackage"
|
||||||
TESTPACK2 = "ziptestpackage2"
|
TESTPACK2 = "ziptestpackage2"
|
||||||
TEMP_ZIP = os.path.abspath("junk95142.zip")
|
TEMP_ZIP = os.path.abspath("junk95142" + os.extsep + "zip")
|
||||||
|
|
||||||
class UncompressedZipImportTestCase(ImportHooksBaseTestCase):
|
class UncompressedZipImportTestCase(ImportHooksBaseTestCase):
|
||||||
|
|
||||||
|
|
|
@ -221,9 +221,11 @@ typedef size_t socklen_t;
|
||||||
# ifndef RISCOS
|
# ifndef RISCOS
|
||||||
# include <fcntl.h>
|
# include <fcntl.h>
|
||||||
# else
|
# else
|
||||||
# include <sys/fcntl.h>
|
# include <sys/ioctl.h>
|
||||||
|
# include <socklib.h>
|
||||||
# define NO_DUP
|
# define NO_DUP
|
||||||
int h_errno; /* not used */
|
int h_errno; /* not used */
|
||||||
|
# define INET_ADDRSTRLEN 16
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
@ -464,6 +466,18 @@ set_error(void)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if defined(RISCOS)
|
||||||
|
if (_inet_error.errnum != NULL) {
|
||||||
|
PyObject *v;
|
||||||
|
v = Py_BuildValue("(is)", errno, _inet_err());
|
||||||
|
if (v != NULL) {
|
||||||
|
PyErr_SetObject(socket_error, v);
|
||||||
|
Py_DECREF(v);
|
||||||
|
}
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
return PyErr_SetFromErrno(socket_error);
|
return PyErr_SetFromErrno(socket_error);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -548,8 +562,11 @@ internal_setblocking(PySocketSockObject *s, int block)
|
||||||
block = !block;
|
block = !block;
|
||||||
ioctlsocket(s->sock_fd, FIONBIO, (u_long*)&block);
|
ioctlsocket(s->sock_fd, FIONBIO, (u_long*)&block);
|
||||||
#endif /* MS_WINDOWS */
|
#endif /* MS_WINDOWS */
|
||||||
#endif /* __BEOS__ */
|
#else /* RISCOS */
|
||||||
|
block = !block;
|
||||||
|
socketioctl(s->sock_fd, FIONBIO, (u_long*)&block);
|
||||||
#endif /* RISCOS */
|
#endif /* RISCOS */
|
||||||
|
#endif /* __BEOS__ */
|
||||||
Py_END_ALLOW_THREADS
|
Py_END_ALLOW_THREADS
|
||||||
|
|
||||||
/* Since these don't return anything */
|
/* Since these don't return anything */
|
||||||
|
@ -1211,11 +1228,11 @@ operations are disabled.");
|
||||||
/* s.sleeptaskw(1 | 0) method */
|
/* s.sleeptaskw(1 | 0) method */
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
sock_sleeptaskw(PySocketSockObject *s,PyObject *args)
|
sock_sleeptaskw(PySocketSockObject *s,PyObject *arg)
|
||||||
{
|
{
|
||||||
int block;
|
int block;
|
||||||
int delay_flag;
|
block = PyInt_AsLong(arg);
|
||||||
if (!PyArg_Parse(args, "i", &block))
|
if (block == -1 && PyErr_Occurred())
|
||||||
return NULL;
|
return NULL;
|
||||||
Py_BEGIN_ALLOW_THREADS
|
Py_BEGIN_ALLOW_THREADS
|
||||||
socketioctl(s->sock_fd, 0x80046679, (u_long*)&block);
|
socketioctl(s->sock_fd, 0x80046679, (u_long*)&block);
|
||||||
|
@ -2056,7 +2073,7 @@ static PyMethodDef sock_methods[] = {
|
||||||
{"shutdown", (PyCFunction)sock_shutdown, METH_O,
|
{"shutdown", (PyCFunction)sock_shutdown, METH_O,
|
||||||
shutdown_doc},
|
shutdown_doc},
|
||||||
#ifdef RISCOS
|
#ifdef RISCOS
|
||||||
{"sleeptaskw", (PyCFunction)sock_sleeptaskw, METH_VARARGS,
|
{"sleeptaskw", (PyCFunction)sock_sleeptaskw, METH_O,
|
||||||
sleeptaskw_doc},
|
sleeptaskw_doc},
|
||||||
#endif
|
#endif
|
||||||
{NULL, NULL} /* sentinel */
|
{NULL, NULL} /* sentinel */
|
||||||
|
@ -2858,8 +2875,11 @@ socket_inet_pton(PyObject *self, PyObject *args)
|
||||||
int af;
|
int af;
|
||||||
char* ip;
|
char* ip;
|
||||||
int retval;
|
int retval;
|
||||||
|
#ifdef ENABLE_IPV6
|
||||||
char packed[MAX(sizeof(struct in_addr), sizeof(struct in6_addr))];
|
char packed[MAX(sizeof(struct in_addr), sizeof(struct in6_addr))];
|
||||||
|
#else
|
||||||
|
char packed[sizeof(struct in_addr)];
|
||||||
|
#endif
|
||||||
if (!PyArg_ParseTuple(args, "is:inet_pton", &af, &ip)) {
|
if (!PyArg_ParseTuple(args, "is:inet_pton", &af, &ip)) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
@ -2875,9 +2895,11 @@ socket_inet_pton(PyObject *self, PyObject *args)
|
||||||
} else if (af == AF_INET) {
|
} else if (af == AF_INET) {
|
||||||
return PyString_FromStringAndSize(packed,
|
return PyString_FromStringAndSize(packed,
|
||||||
sizeof(struct in_addr));
|
sizeof(struct in_addr));
|
||||||
|
#ifdef ENABLE_IPV6
|
||||||
} else if (af == AF_INET6) {
|
} else if (af == AF_INET6) {
|
||||||
return PyString_FromStringAndSize(packed,
|
return PyString_FromStringAndSize(packed,
|
||||||
sizeof(struct in6_addr));
|
sizeof(struct in6_addr));
|
||||||
|
#endif
|
||||||
} else {
|
} else {
|
||||||
PyErr_SetString(socket_error, "unknown address family");
|
PyErr_SetString(socket_error, "unknown address family");
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -2896,7 +2918,11 @@ socket_inet_ntop(PyObject *self, PyObject *args)
|
||||||
char* packed;
|
char* packed;
|
||||||
int len;
|
int len;
|
||||||
const char* retval;
|
const char* retval;
|
||||||
|
#ifdef ENABLE_IPV6
|
||||||
char ip[MAX(INET_ADDRSTRLEN, INET6_ADDRSTRLEN) + 1];
|
char ip[MAX(INET_ADDRSTRLEN, INET6_ADDRSTRLEN) + 1];
|
||||||
|
#else
|
||||||
|
char ip[INET_ADDRSTRLEN + 1];
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Guarantee NUL-termination for PyString_FromString() below */
|
/* Guarantee NUL-termination for PyString_FromString() below */
|
||||||
memset((void *) &ip[0], '\0', sizeof(ip) + 1);
|
memset((void *) &ip[0], '\0', sizeof(ip) + 1);
|
||||||
|
@ -2911,12 +2937,14 @@ socket_inet_ntop(PyObject *self, PyObject *args)
|
||||||
"invalid length of packed IP address string");
|
"invalid length of packed IP address string");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
#ifdef ENABLE_IPV6
|
||||||
} else if (af == AF_INET6) {
|
} else if (af == AF_INET6) {
|
||||||
if (len != sizeof(struct in6_addr)) {
|
if (len != sizeof(struct in6_addr)) {
|
||||||
PyErr_SetString(PyExc_ValueError,
|
PyErr_SetString(PyExc_ValueError,
|
||||||
"invalid length of packed IP address string");
|
"invalid length of packed IP address string");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
} else {
|
} else {
|
||||||
PyErr_Format(PyExc_ValueError,
|
PyErr_Format(PyExc_ValueError,
|
||||||
"unknown address family %d", af);
|
"unknown address family %d", af);
|
||||||
|
@ -3235,7 +3263,7 @@ os_init(void)
|
||||||
_kernel_swi(0x43380, &r, &r);
|
_kernel_swi(0x43380, &r, &r);
|
||||||
taskwindow = r.r[0];
|
taskwindow = r.r[0];
|
||||||
|
|
||||||
return 0;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* RISCOS */
|
#endif /* RISCOS */
|
||||||
|
|
|
@ -78,6 +78,10 @@ static long main_thread;
|
||||||
#include <kernel/OS.h>
|
#include <kernel/OS.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef RISCOS
|
||||||
|
extern int riscos_sleep(double);
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Forward declarations */
|
/* Forward declarations */
|
||||||
static int floatsleep(double);
|
static int floatsleep(double);
|
||||||
static double floattime(void);
|
static double floattime(void);
|
||||||
|
@ -944,7 +948,7 @@ floatsleep(double secs)
|
||||||
return 0;
|
return 0;
|
||||||
Py_BEGIN_ALLOW_THREADS
|
Py_BEGIN_ALLOW_THREADS
|
||||||
/* This sleep *CAN BE* interrupted. */
|
/* This sleep *CAN BE* interrupted. */
|
||||||
if ( sleep(secs) )
|
if ( riscos_sleep(secs) )
|
||||||
return -1;
|
return -1;
|
||||||
Py_END_ALLOW_THREADS
|
Py_END_ALLOW_THREADS
|
||||||
#elif defined(PLAN9)
|
#elif defined(PLAN9)
|
||||||
|
|
|
@ -91,6 +91,7 @@ zipimporter_init(ZipImporter *self, PyObject *args, PyObject *kwds)
|
||||||
path = NULL;
|
path = NULL;
|
||||||
prefix = NULL;
|
prefix = NULL;
|
||||||
for (;;) {
|
for (;;) {
|
||||||
|
#ifndef RISCOS
|
||||||
struct stat statbuf;
|
struct stat statbuf;
|
||||||
int rv;
|
int rv;
|
||||||
|
|
||||||
|
@ -102,6 +103,15 @@ zipimporter_init(ZipImporter *self, PyObject *args, PyObject *kwds)
|
||||||
path = buf;
|
path = buf;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
if (object_exists(buf)) {
|
||||||
|
/* it exists */
|
||||||
|
if (isfile(buf))
|
||||||
|
/* it's a file */
|
||||||
|
path = buf;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
/* back up one path element */
|
/* back up one path element */
|
||||||
p = strrchr(buf, SEP);
|
p = strrchr(buf, SEP);
|
||||||
if (prefix != NULL)
|
if (prefix != NULL)
|
||||||
|
|
|
@ -5086,7 +5086,7 @@ update_one_slot(PyTypeObject *type, slotdef *p)
|
||||||
sanity checks and constructing a new argument
|
sanity checks and constructing a new argument
|
||||||
list. Cut all that nonsense short -- this speeds
|
list. Cut all that nonsense short -- this speeds
|
||||||
up instance creation tremendously. */
|
up instance creation tremendously. */
|
||||||
specific = type->tp_new;
|
specific = (void *)type->tp_new;
|
||||||
/* XXX I'm not 100% sure that there isn't a hole
|
/* XXX I'm not 100% sure that there isn't a hole
|
||||||
in this reasoning that requires additional
|
in this reasoning that requires additional
|
||||||
sanity checks. I'll buy the first person to
|
sanity checks. I'll buy the first person to
|
||||||
|
|
|
@ -9,6 +9,10 @@
|
||||||
#include "token.h"
|
#include "token.h"
|
||||||
#include "grammar.h"
|
#include "grammar.h"
|
||||||
|
|
||||||
|
#ifdef RISCOS
|
||||||
|
#include <unixlib.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
extern int Py_DebugFlag;
|
extern int Py_DebugFlag;
|
||||||
|
|
||||||
grammar *
|
grammar *
|
||||||
|
|
|
@ -420,7 +420,7 @@ optimize_code(PyObject *code, PyObject* consts)
|
||||||
goto exitUnchanged;
|
goto exitUnchanged;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
code = PyString_FromStringAndSize(codestr, codelen);
|
code = PyString_FromStringAndSize((char *)codestr, codelen);
|
||||||
PyMem_Free(codestr);
|
PyMem_Free(codestr);
|
||||||
return code;
|
return code;
|
||||||
|
|
||||||
|
|
|
@ -7,14 +7,15 @@ CLIB = $(LIBSROOT).clib
|
||||||
TCPIPLIB = $(LIBSROOT).TCPIPLibs
|
TCPIPLIB = $(LIBSROOT).TCPIPLibs
|
||||||
DLKLIB = $(LIBSROOT).dlk
|
DLKLIB = $(LIBSROOT).dlk
|
||||||
ZLIB = $(LIBSROOT).zlib
|
ZLIB = $(LIBSROOT).zlib
|
||||||
|
BZLIB = $(LIBSROOT).bzlib
|
||||||
EXPAT = $(LIBSROOT).expat.lib
|
EXPAT = $(LIBSROOT).expat.lib
|
||||||
|
|
||||||
OBJSCAN = objscan
|
OBJSCAN = $(DLKLIB).objscan
|
||||||
MAKEDLK = makedlk
|
MAKEDLK = $(DLKLIB).makedlk
|
||||||
|
|
||||||
# change from time to time (don't forget to change !Boot also)
|
# change from time to time (don't forget to change !Boot also)
|
||||||
TARGET=Python22
|
TARGET=Python23
|
||||||
BUILD=25
|
BUILD=40
|
||||||
|
|
||||||
|
|
||||||
#
|
#
|
||||||
|
@ -61,14 +62,16 @@ MODULES_DYNAMIC =\
|
||||||
@.^.Lib.array/pyd\
|
@.^.Lib.array/pyd\
|
||||||
@.^.Lib.audioop/pyd\
|
@.^.Lib.audioop/pyd\
|
||||||
@.^.Lib.binascii/pyd\
|
@.^.Lib.binascii/pyd\
|
||||||
|
@.^.Lib.bz2/pyd\
|
||||||
@.^.Lib.cmath/pyd\
|
@.^.Lib.cmath/pyd\
|
||||||
@.^.Lib.cPickle/pyd\
|
@.^.Lib.cPickle/pyd\
|
||||||
@.^.Lib.cStringIO/pyd\
|
@.^.Lib.cStringIO/pyd\
|
||||||
|
@.^.Lib.datetime/pyd\
|
||||||
@.^.Lib.errno/pyd\
|
@.^.Lib.errno/pyd\
|
||||||
@.^.Lib.imageop/pyd\
|
@.^.Lib.imageop/pyd\
|
||||||
|
@.^.Lib.itertools/pyd\
|
||||||
@.^.Lib.math/pyd\
|
@.^.Lib.math/pyd\
|
||||||
@.^.Lib.md5/pyd\
|
@.^.Lib.md5/pyd\
|
||||||
@.^.Lib.new/pyd\
|
|
||||||
@.^.Lib.operator/pyd\
|
@.^.Lib.operator/pyd\
|
||||||
@.^.Lib.parser/pyd\
|
@.^.Lib.parser/pyd\
|
||||||
@.^.Lib.pcre/pyd\
|
@.^.Lib.pcre/pyd\
|
||||||
|
@ -93,7 +96,10 @@ MODULES_DYNAMIC =\
|
||||||
@.^.Lib.plat-riscos.swi/pyd\
|
@.^.Lib.plat-riscos.swi/pyd\
|
||||||
@.^.Lib._sre/pyd\
|
@.^.Lib._sre/pyd\
|
||||||
@.^.Lib.xxsubtype/pyd\
|
@.^.Lib.xxsubtype/pyd\
|
||||||
@.^.Lib._symtable/pyd
|
@.^.Lib._symtable/pyd\
|
||||||
|
@.^.Lib._random/pyd\
|
||||||
|
@.^.Lib.zipimport/pyd\
|
||||||
|
@.^.Lib._csv/pyd
|
||||||
|
|
||||||
|
|
||||||
OBJECTS_PYTHON =\
|
OBJECTS_PYTHON =\
|
||||||
|
@ -125,7 +131,6 @@ OBJECTS_PYTHON =\
|
||||||
@.^.Python.o.ceval\
|
@.^.Python.o.ceval\
|
||||||
@.^.Python.o.bltinmodule\
|
@.^.Python.o.bltinmodule\
|
||||||
@.^.Python.o.exceptions\
|
@.^.Python.o.exceptions\
|
||||||
@.^.Python.o.hypot\
|
|
||||||
@.^.Python.o.codecs\
|
@.^.Python.o.codecs\
|
||||||
@.^.Python.o.symtable\
|
@.^.Python.o.symtable\
|
||||||
@.^.Python.o.future
|
@.^.Python.o.future
|
||||||
|
@ -145,16 +150,19 @@ OBJECTS_OBJECTS =\
|
||||||
@.^.Objects.o.sliceobject\
|
@.^.Objects.o.sliceobject\
|
||||||
@.^.Objects.o.rangeobject\
|
@.^.Objects.o.rangeobject\
|
||||||
@.^.Objects.o.object\
|
@.^.Objects.o.object\
|
||||||
|
@.^.Objects.o.obmalloc\
|
||||||
@.^.Objects.o.moduleobject\
|
@.^.Objects.o.moduleobject\
|
||||||
@.^.Objects.o.methodobject\
|
@.^.Objects.o.methodobject\
|
||||||
@.^.Objects.o.longobject\
|
@.^.Objects.o.longobject\
|
||||||
@.^.Objects.o.listobject\
|
@.^.Objects.o.listobject\
|
||||||
@.^.Objects.o.intobject\
|
@.^.Objects.o.intobject\
|
||||||
|
@.^.Objects.o.boolobject\
|
||||||
@.^.Objects.o.iterobject\
|
@.^.Objects.o.iterobject\
|
||||||
@.^.Objects.o.funcobject\
|
@.^.Objects.o.funcobject\
|
||||||
@.^.Objects.o.frameobject\
|
@.^.Objects.o.frameobject\
|
||||||
@.^.Objects.o.floatobject\
|
@.^.Objects.o.floatobject\
|
||||||
@.^.Objects.o.fileobject\
|
@.^.Objects.o.fileobject\
|
||||||
|
@.^.Objects.o.enumobject\
|
||||||
@.^.Objects.o.dictobject\
|
@.^.Objects.o.dictobject\
|
||||||
@.^.Objects.o.complexobject\
|
@.^.Objects.o.complexobject\
|
||||||
@.^.Objects.o.cobject\
|
@.^.Objects.o.cobject\
|
||||||
|
@ -244,16 +252,25 @@ $(LIB_PYTHON): $(OBJECTS)
|
||||||
@.^.Lib.cStringIO/pyd: @.^.Modules.o.cStringIO s.linktab
|
@.^.Lib.cStringIO/pyd: @.^.Modules.o.cStringIO s.linktab
|
||||||
$(MAKEDLK) -d @.^.Lib.cStringIO/pyd -s s.linktab -o @.^.Modules.o.cStringIO -e initcStringIO
|
$(MAKEDLK) -d @.^.Lib.cStringIO/pyd -s s.linktab -o @.^.Modules.o.cStringIO -e initcStringIO
|
||||||
|
|
||||||
|
@.^.Lib._csv/pyd: @.^.Modules.o._csv s.linktab
|
||||||
|
$(MAKEDLK) -d @.^.Lib._csv/pyd -s s.linktab -o @.^.Modules.o._csv -e init_csv
|
||||||
|
|
||||||
@.^.Lib.plat-riscos.drawf/pyd: Modules.o.drawfmodule #s.linktab
|
@.^.Lib.plat-riscos.drawf/pyd: Modules.o.drawfmodule #s.linktab
|
||||||
$(LINK) -aof -o Modules.o.drawflink Modules.o.drawfmodule $(OSLIB).o.OSLIB32
|
$(LINK) -aof -o Modules.o.drawflink Modules.o.drawfmodule $(OSLIB).o.OSLIB32
|
||||||
$(MAKEDLK) -d @.^.Lib.plat-riscos.drawf/pyd -s s.linktab -o Modules.o.drawflink -e initdrawf
|
$(MAKEDLK) -d @.^.Lib.plat-riscos.drawf/pyd -s s.linktab -o Modules.o.drawflink -e initdrawf
|
||||||
|
|
||||||
|
@.^.Lib.datetime/pyd: @.^.Modules.o.datetimemodule s.linktab
|
||||||
|
$(MAKEDLK) -d @.^.Lib.datetime/pyd -s s.linktab -o @.^.Modules.o.datetimemodule -e initdatetime
|
||||||
|
|
||||||
@.^.Lib.errno/pyd: @.^.Modules.o.errnomodule #s.linktab
|
@.^.Lib.errno/pyd: @.^.Modules.o.errnomodule #s.linktab
|
||||||
$(MAKEDLK) -d @.^.Lib.errno/pyd -s s.linktab -o @.^.Modules.o.errnomodule -e initerrno
|
$(MAKEDLK) -d @.^.Lib.errno/pyd -s s.linktab -o @.^.Modules.o.errnomodule -e initerrno
|
||||||
|
|
||||||
@.^.Lib.imageop/pyd: @.^.Modules.o.imageop s.linktab
|
@.^.Lib.imageop/pyd: @.^.Modules.o.imageop s.linktab
|
||||||
$(MAKEDLK) -d @.^.Lib.imageop/pyd -s s.linktab -o @.^.Modules.o.imageop -e initimageop
|
$(MAKEDLK) -d @.^.Lib.imageop/pyd -s s.linktab -o @.^.Modules.o.imageop -e initimageop
|
||||||
|
|
||||||
|
@.^.Lib.itertools/pyd: @.^.Modules.o.itertoolsmodule s.linktab
|
||||||
|
$(MAKEDLK) -d @.^.Lib.itertools/pyd -s s.linktab -o @.^.Modules.o.itertoolsmodule -e inititertools
|
||||||
|
|
||||||
@.^.Lib.math/pyd: @.^.Modules.o.mathmodule s.linktab
|
@.^.Lib.math/pyd: @.^.Modules.o.mathmodule s.linktab
|
||||||
$(MAKEDLK) -d @.^.Lib.math/pyd -s s.linktab -o @.^.Modules.o.mathmodule -e initmath
|
$(MAKEDLK) -d @.^.Lib.math/pyd -s s.linktab -o @.^.Modules.o.mathmodule -e initmath
|
||||||
|
|
||||||
|
@ -324,6 +341,9 @@ $(LIB_PYTHON): $(OBJECTS)
|
||||||
@.^.Lib.xxsubtype/pyd: @.^.Modules.o.xxsubtype s.linktab
|
@.^.Lib.xxsubtype/pyd: @.^.Modules.o.xxsubtype s.linktab
|
||||||
$(MAKEDLK) -d @.^.Lib.xxsubtype/pyd -s s.linktab -o @.^.Modules.o.xxsubtype -e initxxsubtype
|
$(MAKEDLK) -d @.^.Lib.xxsubtype/pyd -s s.linktab -o @.^.Modules.o.xxsubtype -e initxxsubtype
|
||||||
|
|
||||||
|
@.^.Lib._random/pyd: @.^.Modules.o._randommodule s.linktab
|
||||||
|
$(MAKEDLK) -d @.^.Lib._random/pyd -s s.linktab -o @.^.Modules.o._randommodule -e init_random
|
||||||
|
|
||||||
@.^.Lib._symtable/pyd: @.^.Modules.o.symtablemodule s.linktab
|
@.^.Lib._symtable/pyd: @.^.Modules.o.symtablemodule s.linktab
|
||||||
$(MAKEDLK) -d @.^.Lib._symtable/pyd -s s.linktab -o @.^.Modules.o.symtablemodule -e init_symtable
|
$(MAKEDLK) -d @.^.Lib._symtable/pyd -s s.linktab -o @.^.Modules.o.symtablemodule -e init_symtable
|
||||||
|
|
||||||
|
@ -332,14 +352,14 @@ $(LIB_PYTHON): $(OBJECTS)
|
||||||
# Dynamic Modules with other dependencies
|
# Dynamic Modules with other dependencies
|
||||||
#
|
#
|
||||||
@.^.Lib.select/pyd: @.^.Modules.o.selectmodule s.linktab
|
@.^.Lib.select/pyd: @.^.Modules.o.selectmodule s.linktab
|
||||||
$(LINK) -aof -o @.^.Modules.o.selectlink @.^.Modules.o.selectmodule $(TCPIPLIB).o.socklib
|
$(LINK) -aof -o @.^.Modules.o.selectlink @.^.Modules.o.selectmodule $(TCPIPLIB).o.socklib5
|
||||||
$(MAKEDLK) -d @.^.Lib.select/pyd -s s.linktab -o @.^.Modules.o.selectlink -e initselect
|
$(MAKEDLK) -d @.^.Lib.select/pyd -s s.linktab -o @.^.Modules.o.selectlink -e initselect
|
||||||
|
|
||||||
@.^.Modules.o.selectmodule: @.^.Modules.c.selectmodule
|
@.^.Modules.o.selectmodule: @.^.Modules.c.selectmodule
|
||||||
$(CC) -I$(TCPIPLIB).include -o $@ @.^.Modules.c.selectmodule
|
$(CC) -I$(TCPIPLIB).include -o $@ @.^.Modules.c.selectmodule
|
||||||
|
|
||||||
@.^.Lib._socket/pyd: @.^.Modules.o.socketmodule s.linktab
|
@.^.Lib._socket/pyd: @.^.Modules.o.socketmodule s.linktab
|
||||||
$(LINK) -aof -o @.^.Modules.o._socketlink @.^.Modules.o.socketmodule $(TCPIPLIB).o.inetlib $(TCPIPLIB).o.unixlib $(TCPIPLIB).o.socklib
|
$(LINK) -aof -o @.^.Modules.o._socketlink @.^.Modules.o.socketmodule $(TCPIPLIB).o.inetlib $(TCPIPLIB).o.unixlib $(TCPIPLIB).o.socklib5
|
||||||
$(MAKEDLK) -d @.^.Lib._socket/pyd -s s.linktab -o @.^.Modules.o._socketlink -e init_socket
|
$(MAKEDLK) -d @.^.Lib._socket/pyd -s s.linktab -o @.^.Modules.o._socketlink -e init_socket
|
||||||
|
|
||||||
@.^.Modules.o.socketmodule: @.^.Modules.c.socketmodule
|
@.^.Modules.o.socketmodule: @.^.Modules.c.socketmodule
|
||||||
|
@ -353,6 +373,12 @@ $(LIB_PYTHON): $(OBJECTS)
|
||||||
@.^.Modules.o.zlibmodule: @.^.Modules.c.zlibmodule
|
@.^.Modules.o.zlibmodule: @.^.Modules.c.zlibmodule
|
||||||
$(CC) -I$(ZLIB) -o $@ @.^.Modules.c.zlibmodule
|
$(CC) -I$(ZLIB) -o $@ @.^.Modules.c.zlibmodule
|
||||||
|
|
||||||
|
@.^.Lib.bz2/pyd: @.^.Modules.o.bz2module s.linktab
|
||||||
|
$(LINK) -aof -o @.^.Modules.o.bz2link @.^.Modules.o.bz2module $(BZLIB).bzlib
|
||||||
|
$(MAKEDLK) -d @.^.Lib.bz2/pyd -s s.linktab -o @.^.Modules.o.bz2link -e initbz2
|
||||||
|
|
||||||
|
@.^.Modules.o.bz2module: @.^.Modules.c.bz2module
|
||||||
|
$(CC) -I$(BZLIB) -o $@ @.^.Modules.c.bz2module
|
||||||
|
|
||||||
@.^.Lib.time/pyd: @.^.Modules.o.timemodule s.linktab @.o.sleep
|
@.^.Lib.time/pyd: @.^.Modules.o.timemodule s.linktab @.o.sleep
|
||||||
$(LINK) -aof -o @.^.Modules.o.timelink @.^.Modules.o.timemodule @.o.sleep $(OSLIB).o.OSLib32
|
$(LINK) -aof -o @.^.Modules.o.timelink @.^.Modules.o.timemodule @.o.sleep $(OSLIB).o.OSLib32
|
||||||
|
@ -370,6 +396,10 @@ $(LIB_PYTHON): $(OBJECTS)
|
||||||
@.^.Modules.o.pyexpat: @.^.Modules.c.pyexpat
|
@.^.Modules.o.pyexpat: @.^.Modules.c.pyexpat
|
||||||
$(CCEXPAT) -o $@ @.^.Modules.c.pyexpat
|
$(CCEXPAT) -o $@ @.^.Modules.c.pyexpat
|
||||||
|
|
||||||
|
@.^.Lib.zipimport/pyd: @.^.Modules.o.zipimport s.linktab
|
||||||
|
$(LINK) -aof -o @.^.Modules.o.zipimportlink @.^.Modules.o.zipimport o.unixstuff $(OSLIB).o.OSLib32
|
||||||
|
$(MAKEDLK) -d @.^.Lib.zipimport/pyd -s s.linktab -o @.^.Modules.o.zipimportlink -e initzipimport
|
||||||
|
|
||||||
|
|
||||||
##########################################################################
|
##########################################################################
|
||||||
# dynamic linking symbol table
|
# dynamic linking symbol table
|
||||||
|
|
|
@ -6,6 +6,8 @@
|
||||||
#include "oslib/osfile.h"
|
#include "oslib/osfile.h"
|
||||||
#include "unixstuff.h"
|
#include "unixstuff.h"
|
||||||
|
|
||||||
|
#include <sys/fcntl.h>
|
||||||
|
|
||||||
#include "Python.h"
|
#include "Python.h"
|
||||||
#include "structseq.h"
|
#include "structseq.h"
|
||||||
|
|
||||||
|
@ -368,6 +370,184 @@ static PyMethodDef riscos_methods[] = {
|
||||||
{NULL, NULL} /* Sentinel */
|
{NULL, NULL} /* Sentinel */
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static int
|
||||||
|
ins(PyObject *module, char *symbol, long value)
|
||||||
|
{
|
||||||
|
return PyModule_AddIntConstant(module, symbol, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static int
|
||||||
|
all_ins(PyObject *d)
|
||||||
|
{
|
||||||
|
#ifdef F_OK
|
||||||
|
if (ins(d, "F_OK", (long)F_OK)) return -1;
|
||||||
|
#endif
|
||||||
|
#ifdef R_OK
|
||||||
|
if (ins(d, "R_OK", (long)R_OK)) return -1;
|
||||||
|
#endif
|
||||||
|
#ifdef W_OK
|
||||||
|
if (ins(d, "W_OK", (long)W_OK)) return -1;
|
||||||
|
#endif
|
||||||
|
#ifdef X_OK
|
||||||
|
if (ins(d, "X_OK", (long)X_OK)) return -1;
|
||||||
|
#endif
|
||||||
|
#ifdef NGROUPS_MAX
|
||||||
|
if (ins(d, "NGROUPS_MAX", (long)NGROUPS_MAX)) return -1;
|
||||||
|
#endif
|
||||||
|
#ifdef TMP_MAX
|
||||||
|
if (ins(d, "TMP_MAX", (long)TMP_MAX)) return -1;
|
||||||
|
#endif
|
||||||
|
#ifdef WCONTINUED
|
||||||
|
if (ins(d, "WCONTINUED", (long)WCONTINUED)) return -1;
|
||||||
|
#endif
|
||||||
|
#ifdef WNOHANG
|
||||||
|
if (ins(d, "WNOHANG", (long)WNOHANG)) return -1;
|
||||||
|
#endif
|
||||||
|
#ifdef WUNTRACED
|
||||||
|
if (ins(d, "WUNTRACED", (long)WUNTRACED)) return -1;
|
||||||
|
#endif
|
||||||
|
#ifdef O_RDONLY
|
||||||
|
if (ins(d, "O_RDONLY", (long)O_RDONLY)) return -1;
|
||||||
|
#endif
|
||||||
|
#ifdef O_WRONLY
|
||||||
|
if (ins(d, "O_WRONLY", (long)O_WRONLY)) return -1;
|
||||||
|
#endif
|
||||||
|
#ifdef O_RDWR
|
||||||
|
if (ins(d, "O_RDWR", (long)O_RDWR)) return -1;
|
||||||
|
#endif
|
||||||
|
#ifdef O_NDELAY
|
||||||
|
if (ins(d, "O_NDELAY", (long)O_NDELAY)) return -1;
|
||||||
|
#endif
|
||||||
|
#ifdef O_NONBLOCK
|
||||||
|
if (ins(d, "O_NONBLOCK", (long)O_NONBLOCK)) return -1;
|
||||||
|
#endif
|
||||||
|
#ifdef O_APPEND
|
||||||
|
if (ins(d, "O_APPEND", (long)O_APPEND)) return -1;
|
||||||
|
#endif
|
||||||
|
#ifdef O_DSYNC
|
||||||
|
if (ins(d, "O_DSYNC", (long)O_DSYNC)) return -1;
|
||||||
|
#endif
|
||||||
|
#ifdef O_RSYNC
|
||||||
|
if (ins(d, "O_RSYNC", (long)O_RSYNC)) return -1;
|
||||||
|
#endif
|
||||||
|
#ifdef O_SYNC
|
||||||
|
if (ins(d, "O_SYNC", (long)O_SYNC)) return -1;
|
||||||
|
#endif
|
||||||
|
#ifdef O_NOCTTY
|
||||||
|
if (ins(d, "O_NOCTTY", (long)O_NOCTTY)) return -1;
|
||||||
|
#endif
|
||||||
|
#ifdef O_CREAT
|
||||||
|
if (ins(d, "O_CREAT", (long)O_CREAT)) return -1;
|
||||||
|
#endif
|
||||||
|
#ifdef O_EXCL
|
||||||
|
if (ins(d, "O_EXCL", (long)O_EXCL)) return -1;
|
||||||
|
#endif
|
||||||
|
#ifdef O_TRUNC
|
||||||
|
if (ins(d, "O_TRUNC", (long)O_TRUNC)) return -1;
|
||||||
|
#endif
|
||||||
|
#ifdef O_BINARY
|
||||||
|
if (ins(d, "O_BINARY", (long)O_BINARY)) return -1;
|
||||||
|
#endif
|
||||||
|
#ifdef O_TEXT
|
||||||
|
if (ins(d, "O_TEXT", (long)O_TEXT)) return -1;
|
||||||
|
#endif
|
||||||
|
#ifdef O_LARGEFILE
|
||||||
|
if (ins(d, "O_LARGEFILE", (long)O_LARGEFILE)) return -1;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* MS Windows */
|
||||||
|
#ifdef O_NOINHERIT
|
||||||
|
/* Don't inherit in child processes. */
|
||||||
|
if (ins(d, "O_NOINHERIT", (long)O_NOINHERIT)) return -1;
|
||||||
|
#endif
|
||||||
|
#ifdef _O_SHORT_LIVED
|
||||||
|
/* Optimize for short life (keep in memory). */
|
||||||
|
/* MS forgot to define this one with a non-underscore form too. */
|
||||||
|
if (ins(d, "O_SHORT_LIVED", (long)_O_SHORT_LIVED)) return -1;
|
||||||
|
#endif
|
||||||
|
#ifdef O_TEMPORARY
|
||||||
|
/* Automatically delete when last handle is closed. */
|
||||||
|
if (ins(d, "O_TEMPORARY", (long)O_TEMPORARY)) return -1;
|
||||||
|
#endif
|
||||||
|
#ifdef O_RANDOM
|
||||||
|
/* Optimize for random access. */
|
||||||
|
if (ins(d, "O_RANDOM", (long)O_RANDOM)) return -1;
|
||||||
|
#endif
|
||||||
|
#ifdef O_SEQUENTIAL
|
||||||
|
/* Optimize for sequential access. */
|
||||||
|
if (ins(d, "O_SEQUENTIAL", (long)O_SEQUENTIAL)) return -1;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* GNU extensions. */
|
||||||
|
#ifdef O_DIRECT
|
||||||
|
/* Direct disk access. */
|
||||||
|
if (ins(d, "O_DIRECT", (long)O_DIRECT)) return -1;
|
||||||
|
#endif
|
||||||
|
#ifdef O_DIRECTORY
|
||||||
|
/* Must be a directory. */
|
||||||
|
if (ins(d, "O_DIRECTORY", (long)O_DIRECTORY)) return -1;
|
||||||
|
#endif
|
||||||
|
#ifdef O_NOFOLLOW
|
||||||
|
/* Do not follow links. */
|
||||||
|
if (ins(d, "O_NOFOLLOW", (long)O_NOFOLLOW)) return -1;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* These come from sysexits.h */
|
||||||
|
#ifdef EX_OK
|
||||||
|
if (ins(d, "EX_OK", (long)EX_OK)) return -1;
|
||||||
|
#endif /* EX_OK */
|
||||||
|
#ifdef EX_USAGE
|
||||||
|
if (ins(d, "EX_USAGE", (long)EX_USAGE)) return -1;
|
||||||
|
#endif /* EX_USAGE */
|
||||||
|
#ifdef EX_DATAERR
|
||||||
|
if (ins(d, "EX_DATAERR", (long)EX_DATAERR)) return -1;
|
||||||
|
#endif /* EX_DATAERR */
|
||||||
|
#ifdef EX_NOINPUT
|
||||||
|
if (ins(d, "EX_NOINPUT", (long)EX_NOINPUT)) return -1;
|
||||||
|
#endif /* EX_NOINPUT */
|
||||||
|
#ifdef EX_NOUSER
|
||||||
|
if (ins(d, "EX_NOUSER", (long)EX_NOUSER)) return -1;
|
||||||
|
#endif /* EX_NOUSER */
|
||||||
|
#ifdef EX_NOHOST
|
||||||
|
if (ins(d, "EX_NOHOST", (long)EX_NOHOST)) return -1;
|
||||||
|
#endif /* EX_NOHOST */
|
||||||
|
#ifdef EX_UNAVAILABLE
|
||||||
|
if (ins(d, "EX_UNAVAILABLE", (long)EX_UNAVAILABLE)) return -1;
|
||||||
|
#endif /* EX_UNAVAILABLE */
|
||||||
|
#ifdef EX_SOFTWARE
|
||||||
|
if (ins(d, "EX_SOFTWARE", (long)EX_SOFTWARE)) return -1;
|
||||||
|
#endif /* EX_SOFTWARE */
|
||||||
|
#ifdef EX_OSERR
|
||||||
|
if (ins(d, "EX_OSERR", (long)EX_OSERR)) return -1;
|
||||||
|
#endif /* EX_OSERR */
|
||||||
|
#ifdef EX_OSFILE
|
||||||
|
if (ins(d, "EX_OSFILE", (long)EX_OSFILE)) return -1;
|
||||||
|
#endif /* EX_OSFILE */
|
||||||
|
#ifdef EX_CANTCREAT
|
||||||
|
if (ins(d, "EX_CANTCREAT", (long)EX_CANTCREAT)) return -1;
|
||||||
|
#endif /* EX_CANTCREAT */
|
||||||
|
#ifdef EX_IOERR
|
||||||
|
if (ins(d, "EX_IOERR", (long)EX_IOERR)) return -1;
|
||||||
|
#endif /* EX_IOERR */
|
||||||
|
#ifdef EX_TEMPFAIL
|
||||||
|
if (ins(d, "EX_TEMPFAIL", (long)EX_TEMPFAIL)) return -1;
|
||||||
|
#endif /* EX_TEMPFAIL */
|
||||||
|
#ifdef EX_PROTOCOL
|
||||||
|
if (ins(d, "EX_PROTOCOL", (long)EX_PROTOCOL)) return -1;
|
||||||
|
#endif /* EX_PROTOCOL */
|
||||||
|
#ifdef EX_NOPERM
|
||||||
|
if (ins(d, "EX_NOPERM", (long)EX_NOPERM)) return -1;
|
||||||
|
#endif /* EX_NOPERM */
|
||||||
|
#ifdef EX_CONFIG
|
||||||
|
if (ins(d, "EX_CONFIG", (long)EX_CONFIG)) return -1;
|
||||||
|
#endif /* EX_CONFIG */
|
||||||
|
#ifdef EX_NOTFOUND
|
||||||
|
if (ins(d, "EX_NOTFOUND", (long)EX_NOTFOUND)) return -1;
|
||||||
|
#endif /* EX_NOTFOUND */
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -376,10 +556,14 @@ initriscos()
|
||||||
PyObject *m, *d, *stat_m;
|
PyObject *m, *d, *stat_m;
|
||||||
|
|
||||||
m = Py_InitModule("riscos", riscos_methods);
|
m = Py_InitModule("riscos", riscos_methods);
|
||||||
|
|
||||||
|
if (all_ins(m))
|
||||||
|
return;
|
||||||
|
|
||||||
d = PyModule_GetDict(m);
|
d = PyModule_GetDict(m);
|
||||||
|
|
||||||
/* Initialize riscos.error exception */
|
Py_INCREF(PyExc_OSError);
|
||||||
PyDict_SetItemString(d, "error", PyExc_OSError);
|
PyModule_AddObject(m, "error", PyExc_OSError);
|
||||||
|
|
||||||
PyStructSequence_InitType(&StatResultType, &stat_result_desc);
|
PyStructSequence_InitType(&StatResultType, &stat_result_desc);
|
||||||
PyDict_SetItemString(d, "stat_result", (PyObject*) &StatResultType);
|
PyDict_SetItemString(d, "stat_result", (PyObject*) &StatResultType);
|
||||||
|
|
|
@ -11,6 +11,9 @@
|
||||||
* Added swi.ArgError which is generated for errors when the user passes invalid arguments to
|
* Added swi.ArgError which is generated for errors when the user passes invalid arguments to
|
||||||
functions etc
|
functions etc
|
||||||
* Added "errnum" attribute to swi.error, so one can now check to see what the error number was
|
* Added "errnum" attribute to swi.error, so one can now check to see what the error number was
|
||||||
|
|
||||||
|
1.02 03 March 2002 Dietmar Schwertberger
|
||||||
|
* Added string, integer, integers, tuple and tuples
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "oslib/os.h"
|
#include "oslib/os.h"
|
||||||
|
@ -412,13 +415,155 @@ static PyObject *swi_swi(PyObject *self,PyObject *args)
|
||||||
fail:Py_DECREF(result);return 0;
|
fail:Py_DECREF(result);return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static PyObject *swi_string(PyObject *self, PyObject *arg)
|
||||||
|
{ char *s;
|
||||||
|
int l=-1;
|
||||||
|
if(!PyArg_ParseTuple(arg,"i|i",(unsigned int *)&s, &l)) return NULL;
|
||||||
|
if (l==-1)
|
||||||
|
l = strlen(s);
|
||||||
|
return PyString_FromStringAndSize((char*)s, l);
|
||||||
|
}
|
||||||
|
|
||||||
|
static char swi_string__doc__[] =
|
||||||
|
"string(address[, length]) -> string\n\
|
||||||
|
Read a null terminated string from the given address.";
|
||||||
|
|
||||||
|
|
||||||
|
static PyObject *swi_integer(PyObject *self, PyObject *arg)
|
||||||
|
{ int *i;
|
||||||
|
|
||||||
|
if(!PyArg_ParseTuple(arg,"i",(unsigned int *)&i))
|
||||||
|
return NULL;
|
||||||
|
return PyInt_FromLong(*i);
|
||||||
|
}
|
||||||
|
|
||||||
|
static char swi_integer__doc__[] =
|
||||||
|
"integer(address) -> string\n\
|
||||||
|
Read an integer from the given address.";
|
||||||
|
|
||||||
|
|
||||||
|
static PyObject *swi_integers(PyObject *self, PyObject *arg)
|
||||||
|
{ int *i;
|
||||||
|
int c=-1;
|
||||||
|
PyObject *result, *result1;
|
||||||
|
|
||||||
|
if(!PyArg_ParseTuple(arg,"i|i",(unsigned int *)&i, &c)) return NULL;
|
||||||
|
result=PyList_New(0);
|
||||||
|
if (result) {
|
||||||
|
while ( c>0 || (c==-1 && *i) ) {
|
||||||
|
result1 = PyInt_FromLong((long)*i);
|
||||||
|
if (!result1) {
|
||||||
|
Py_DECREF(result);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
if (PyList_Append(result, result1)!=0) {
|
||||||
|
Py_DECREF(result);
|
||||||
|
Py_DECREF(result1);
|
||||||
|
return NULL;
|
||||||
|
};
|
||||||
|
i++;
|
||||||
|
if (c!=-1)
|
||||||
|
c--;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
static char swi_integers__doc__[] =
|
||||||
|
"integers(address[, count]) -> string\n\
|
||||||
|
Either read a null terminated list of integers or\n\
|
||||||
|
a list of given length from the given address.";
|
||||||
|
|
||||||
|
|
||||||
|
static PyObject *swi_tuples(PyObject *self, PyObject *arg)
|
||||||
|
{
|
||||||
|
unsigned char *i; /* points to current */
|
||||||
|
int c=-1, l=4, j, zero; /* count, length, index */
|
||||||
|
PyObject *result, *result1, *result11;
|
||||||
|
|
||||||
|
if(!PyArg_ParseTuple(arg,"i|ii",(unsigned int *)&i, &l, &c)) return NULL;
|
||||||
|
result=PyList_New(0);
|
||||||
|
if (result) {
|
||||||
|
while (c) {
|
||||||
|
result1 = PyTuple_New(l);
|
||||||
|
if (!result1) {
|
||||||
|
Py_DECREF(result);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
zero = (c==-1); /* check for zeros? */
|
||||||
|
for(j=0;j<l;j++) {
|
||||||
|
if (zero && *i)
|
||||||
|
zero = 0; /* non-zero found */
|
||||||
|
result11 = PyInt_FromLong((long)(*i));
|
||||||
|
if (!result11) {
|
||||||
|
Py_DECREF(result);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
PyTuple_SetItem(result1, j, result11);
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
if (c==-1 && zero) {
|
||||||
|
Py_DECREF(result1);
|
||||||
|
c = 0;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (PyList_Append(result, result1)!=0) {
|
||||||
|
Py_DECREF(result1);
|
||||||
|
Py_DECREF(result);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
if (c!=-1)
|
||||||
|
c--;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
static char swi_tuples__doc__[] =
|
||||||
|
"tuples(address[, length=4[, count]]) -> string\n\
|
||||||
|
Either read a null terminated list of byte tuples or\n\
|
||||||
|
a list of given length from the given address.";
|
||||||
|
|
||||||
|
|
||||||
|
static PyObject *swi_tuple(PyObject *self, PyObject *arg)
|
||||||
|
{
|
||||||
|
unsigned char *i; /* points to current */
|
||||||
|
int c=1, j;
|
||||||
|
PyObject *result, *result1;
|
||||||
|
|
||||||
|
if(!PyArg_ParseTuple(arg,"i|i",(unsigned int *)&i, &c)) return NULL;
|
||||||
|
result = PyTuple_New(c);
|
||||||
|
if (!result)
|
||||||
|
return NULL;
|
||||||
|
for(j=0;j<c;j++) {
|
||||||
|
result1 = PyInt_FromLong((long)(i[j]));
|
||||||
|
if (!result1) {
|
||||||
|
Py_DECREF(result);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
PyTuple_SetItem(result, j, result1);
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
static char swi_tuple__doc__[] =
|
||||||
|
"tuple(address[, count=1]]) -> tuple\n\
|
||||||
|
Read count bytes from given address.";
|
||||||
|
|
||||||
|
|
||||||
static PyMethodDef SwiMethods[]=
|
static PyMethodDef SwiMethods[]=
|
||||||
{ { "swi", swi_swi,1},
|
{ { "swi", swi_swi,1},
|
||||||
{ "block", PyBlock_New,1},
|
{ "block", PyBlock_New,1},
|
||||||
{ "register", PyRegister,1},
|
{ "register", PyRegister,1},
|
||||||
{ NULL,NULL} /* Sentinel */
|
{ "string", swi_string,METH_VARARGS, swi_string__doc__},
|
||||||
|
{ "integer", swi_integer,METH_VARARGS, swi_integer__doc__},
|
||||||
|
{ "integers", swi_integers,METH_VARARGS, swi_integers__doc__},
|
||||||
|
{ "tuples", swi_tuples,METH_VARARGS, swi_tuples__doc__},
|
||||||
|
{ "tuple", swi_tuple,METH_VARARGS, swi_tuple__doc__},
|
||||||
|
{ NULL,NULL,0,NULL} /* Sentinel */
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
void initswi()
|
void initswi()
|
||||||
{ PyObject *m, *d;
|
{ PyObject *m, *d;
|
||||||
m = Py_InitModule("swi", SwiMethods);
|
m = Py_InitModule("swi", SwiMethods);
|
||||||
|
|
|
@ -143,7 +143,7 @@
|
||||||
#undef HAVE_LARGEFILE_SUPPORT
|
#undef HAVE_LARGEFILE_SUPPORT
|
||||||
|
|
||||||
/* Define this if you have the type long long */
|
/* Define this if you have the type long long */
|
||||||
#undef HAVE_LONG_LONG
|
#define HAVE_LONG_LONG
|
||||||
|
|
||||||
/* Define if your compiler supports function prototypes */
|
/* Define if your compiler supports function prototypes */
|
||||||
#define HAVE_PROTOTYPES 1
|
#define HAVE_PROTOTYPES 1
|
||||||
|
@ -244,6 +244,9 @@
|
||||||
shared libraries */
|
shared libraries */
|
||||||
#undef WITH_DL_DLD
|
#undef WITH_DL_DLD
|
||||||
|
|
||||||
|
/* Define if you want to read files with foreign newlines. */
|
||||||
|
#define WITH_UNIVERSAL_NEWLINES 1
|
||||||
|
|
||||||
/* Define if you want documentation strings in extension modules */
|
/* Define if you want documentation strings in extension modules */
|
||||||
#define WITH_DOC_STRINGS 1
|
#define WITH_DOC_STRINGS 1
|
||||||
|
|
||||||
|
@ -253,7 +256,7 @@
|
||||||
#undef WITH_DYLD
|
#undef WITH_DYLD
|
||||||
|
|
||||||
/* Define if you want to compile in Python-specific mallocs */
|
/* Define if you want to compile in Python-specific mallocs */
|
||||||
#undef WITH_PYMALLOC
|
#define WITH_PYMALLOC 1
|
||||||
|
|
||||||
/* Define if you want to produce an OpenStep/Rhapsody framework
|
/* Define if you want to produce an OpenStep/Rhapsody framework
|
||||||
(shared library plus accessory files). */
|
(shared library plus accessory files). */
|
||||||
|
@ -291,7 +294,7 @@
|
||||||
#define SIZEOF_LONG 4
|
#define SIZEOF_LONG 4
|
||||||
|
|
||||||
/* The number of bytes in a long long. */
|
/* The number of bytes in a long long. */
|
||||||
#undef SIZEOF_LONG_LONG
|
#define SIZEOF_LONG_LONG 8
|
||||||
|
|
||||||
/* The number of bytes in a short. */
|
/* The number of bytes in a short. */
|
||||||
#define SIZEOF_SHORT 2
|
#define SIZEOF_SHORT 2
|
||||||
|
@ -396,7 +399,7 @@
|
||||||
#undef HAVE_GETNAMEINFO
|
#undef HAVE_GETNAMEINFO
|
||||||
|
|
||||||
/* Define if you have the getpeername function. */
|
/* Define if you have the getpeername function. */
|
||||||
#undef HAVE_GETPEERNAME
|
#define HAVE_GETPEERNAME
|
||||||
|
|
||||||
/* Define if you have the getpgid function. */
|
/* Define if you have the getpgid function. */
|
||||||
#undef HAVE_GETPGID
|
#undef HAVE_GETPGID
|
||||||
|
@ -423,7 +426,7 @@
|
||||||
#undef HAVE_HSTRERROR
|
#undef HAVE_HSTRERROR
|
||||||
|
|
||||||
/* Define if you have the hypot function. */
|
/* Define if you have the hypot function. */
|
||||||
#undef HAVE_HYPOT
|
#define HAVE_HYPOT
|
||||||
|
|
||||||
/* Define if you have the inet_pton function. */
|
/* Define if you have the inet_pton function. */
|
||||||
#define HAVE_INET_PTON 1
|
#define HAVE_INET_PTON 1
|
||||||
|
|
|
@ -7,11 +7,11 @@
|
||||||
#include "Python.h"
|
#include "Python.h"
|
||||||
|
|
||||||
|
|
||||||
int sleep(double delay)
|
int riscos_sleep(double delay)
|
||||||
{
|
{
|
||||||
os_t starttime, endtime, time; /* monotonic times (centiseconds) */
|
os_t starttime, endtime, time; /* monotonic times (centiseconds) */
|
||||||
int *pollword, ret;
|
int *pollword, ret;
|
||||||
bool claimed;
|
osbool claimed;
|
||||||
|
|
||||||
/* calculate end time */
|
/* calculate end time */
|
||||||
starttime = os_read_monotonic_time();
|
starttime = os_read_monotonic_time();
|
||||||
|
|
|
@ -6,7 +6,17 @@ IconSprites <Obey$Dir>.!Sprites
|
||||||
<Obey$Dir>.AddToPath Python$Path PythonApp:Lib
|
<Obey$Dir>.AddToPath Python$Path PythonApp:Lib
|
||||||
<Obey$Dir>.AddToPath Python$Path PythonApp:Lib.plat-riscos
|
<Obey$Dir>.AddToPath Python$Path PythonApp:Lib.plat-riscos
|
||||||
<Obey$Dir>.AddToPath Python$Path PythonApp:Lib.site-packages
|
<Obey$Dir>.AddToPath Python$Path PythonApp:Lib.site-packages
|
||||||
set Alias$@RunType_ae5 TaskWindow |"python %%*0|" -name |"Python|" -quit
|
set Alias$@RunType_ae5 TaskWindow |"python %%*0|" -name |"Python|" -quit -wimpslot 1248k
|
||||||
| -display
|
| -display
|
||||||
set File$Type_ae5 Python
|
set File$Type_ae5 Python
|
||||||
set Alias$Python Run <Python$Dir>.python22 %*0
|
|
||||||
|
| load modules for 32 bit compatibility
|
||||||
|
RMEnsure UtilityModule 3.10 Error This application requires RISC OS 3.10 or later
|
||||||
|
RMEnsure UtilityModule 3.70 RMEnsure CallASWI 0.02 RMLoad System:Modules.CallASWI
|
||||||
|
RMEnsure UtilityModule 3.70 RMEnsure CallASWI 0.02 Error This application requires CallASWI 0.02 or later
|
||||||
|
RMEnsure FPEmulator 4.03 RMLoad System:Modules.FPEmulator
|
||||||
|
RMEnsure FPEmulator 4.03 Error This application requires FPEmulator 4.03 or later
|
||||||
|
RMEnsure SharedCLibrary 5.17 RMLoad System:Modules.CLib
|
||||||
|
RMEnsure SharedCLibrary 5.34 Error This application requires SharedCLibrary 5.34 or later
|
||||||
|
|
||||||
|
set Alias$Python Run <Python$Dir>.python23 %*0
|
|
@ -1,2 +1,2 @@
|
||||||
<Obey$Dir>.!Boot
|
<Obey$Dir>.!Boot
|
||||||
TaskWindow "python" -name "Python" -quit -display
|
TaskWindow "python" -name "Python" -quit -display -wimpslot 1248k
|
Loading…
Reference in New Issue