From 7a98be2efbdc44a6271e3bf6117a1e6c77828414 Mon Sep 17 00:00:00 2001 From: Skip Montanaro Date: Thu, 16 Aug 2007 14:35:24 +0000 Subject: Remove RISCOS support --- Doc/library/os.rst | 5 +- Include/osdefs.h | 7 - Include/pyport.h | 8 +- Lib/distutils/command/install_lib.py | 5 +- Lib/dumbdbm.py | 6 +- Lib/fileinput.py | 2 +- Lib/os.py | 4 +- Lib/pkgutil.py | 6 +- Lib/site.py | 2 +- Lib/test/regrtest.py | 4 +- Lib/test/test_exceptions.py | 4 +- Lib/test/test_import.py | 22 +- Lib/test/test_mailbox.py | 2 +- Lib/test/test_minidom.py | 2 +- Lib/test/test_normalization.py | 2 +- Lib/test/test_old_mailbox.py | 2 +- Lib/test/test_pkg.py | 54 +-- Lib/test/test_pkgimport.py | 4 +- Lib/test/test_repr.py | 14 +- Lib/test/test_runpy.py | 8 +- Lib/test/test_sax.py | 10 +- Lib/test/test_support.py | 4 +- Lib/test/test_tokenize.py | 4 +- Lib/test/test_zipfile.py | 32 +- Lib/test/test_zipimport.py | 2 +- Lib/whichdb.py | 12 +- Misc/HISTORY | 7 +- Modules/_localemodule.c | 4 - Modules/main.c | 22 -- Modules/socketmodule.c | 89 ----- Modules/timemodule.c | 12 - Modules/zipimport.c | 10 - Modules/zlib/README | 2 +- Modules/zlib/example.c | 2 +- Modules/zlib/minigzip.c | 5 - Modules/zlib/zutil.h | 2 +- Parser/grammar.c | 4 - Parser/intrcheck.c | 4 - Parser/myreadline.c | 13 - Python/bltinmodule.c | 4 - Python/import.c | 106 ------ Python/sysmodule.c | 4 - README | 1 - RISCOS/Makefile | 445 ---------------------- RISCOS/Modules/config.c | 72 ---- RISCOS/Modules/drawfmodule.c | 664 -------------------------------- RISCOS/Modules/getpath_riscos.c | 60 --- RISCOS/Modules/riscosmodule.c | 603 ----------------------------- RISCOS/Modules/swimodule.c | 575 ---------------------------- RISCOS/Python/dynload_riscos.c | 63 --- RISCOS/Python/getcwd_riscos.c | 5 - RISCOS/Python/getmtime_riscos.c | 20 - RISCOS/README | 36 -- RISCOS/pyconfig.h | 715 ----------------------------------- RISCOS/sleep.c | 41 -- RISCOS/support/!Boot | 22 -- RISCOS/support/!Run | 2 - RISCOS/support/!Sprites | Bin 1532 -> 0 bytes RISCOS/support/!Sprites22 | Bin 2876 -> 0 bytes RISCOS/support/AddToPath | Bin 256 -> 0 bytes RISCOS/unixstuff.c | 74 ---- RISCOS/unixstuff.h | 14 - 62 files changed, 106 insertions(+), 3823 deletions(-) delete mode 100644 RISCOS/Makefile delete mode 100644 RISCOS/Modules/config.c delete mode 100644 RISCOS/Modules/drawfmodule.c delete mode 100644 RISCOS/Modules/getpath_riscos.c delete mode 100644 RISCOS/Modules/riscosmodule.c delete mode 100644 RISCOS/Modules/swimodule.c delete mode 100644 RISCOS/Python/dynload_riscos.c delete mode 100644 RISCOS/Python/getcwd_riscos.c delete mode 100644 RISCOS/Python/getmtime_riscos.c delete mode 100644 RISCOS/README delete mode 100644 RISCOS/pyconfig.h delete mode 100644 RISCOS/sleep.c delete mode 100644 RISCOS/support/!Boot delete mode 100644 RISCOS/support/!Run delete mode 100644 RISCOS/support/!Sprites delete mode 100644 RISCOS/support/!Sprites22 delete mode 100644 RISCOS/support/AddToPath delete mode 100644 RISCOS/unixstuff.c delete mode 100644 RISCOS/unixstuff.h diff --git a/Doc/library/os.rst b/Doc/library/os.rst index 5d057f1..f443941 100644 --- a/Doc/library/os.rst +++ b/Doc/library/os.rst @@ -64,7 +64,7 @@ module. The name of the operating system dependent module imported. The following names have currently been registered: ``'posix'``, ``'nt'``, ``'mac'``, ``'os2'``, - ``'ce'``, ``'java'``, ``'riscos'``. + ``'ce'``, ``'java'``. .. data:: path @@ -1058,9 +1058,6 @@ Files and Directories On Mac OS systems, the following attributes may also be available: :attr:`st_rsize`, :attr:`st_creator`, :attr:`st_type`. - On RISCOS systems, the following attributes are also available: :attr:`st_ftype` - (file type), :attr:`st_attrs` (attributes), :attr:`st_obtype` (object type). - .. index:: module: stat For backward compatibility, the return value of :func:`stat` is also accessible diff --git a/Include/osdefs.h b/Include/osdefs.h index 6937659..d0305e9 100644 --- a/Include/osdefs.h +++ b/Include/osdefs.h @@ -23,13 +23,6 @@ extern "C" { #endif #endif -#ifdef RISCOS -#define SEP '.' -#define MAXPATHLEN 256 -#define DELIM ',' -#endif - - /* Filename separator */ #ifndef SEP #define SEP '/' diff --git a/Include/pyport.h b/Include/pyport.h index febc21e..410c955 100644 --- a/Include/pyport.h +++ b/Include/pyport.h @@ -261,11 +261,6 @@ typedef Py_intptr_t Py_ssize_t; #define HAVE_FSTAT #endif -#ifdef RISCOS -#include -#include "unixstuff.h" -#endif - #ifdef HAVE_SYS_STAT_H #if defined(PYOS_OS2) && defined(PYCC_GCC) #include @@ -677,8 +672,7 @@ extern double hypot(double, double); * Hide GCC attributes from compilers that don't support them. */ #if (!defined(__GNUC__) || __GNUC__ < 2 || \ - (__GNUC__ == 2 && __GNUC_MINOR__ < 7) ) && \ - !defined(RISCOS) + (__GNUC__ == 2 && __GNUC_MINOR__ < 7) ) #define Py_GCC_ATTRIBUTE(x) #else #define Py_GCC_ATTRIBUTE(x) __attribute__(x) diff --git a/Lib/distutils/command/install_lib.py b/Lib/distutils/command/install_lib.py index 65d25f7..4efaf9c 100644 --- a/Lib/distutils/command/install_lib.py +++ b/Lib/distutils/command/install_lib.py @@ -9,10 +9,7 @@ from distutils.errors import DistutilsOptionError # Extension for Python source files. -if hasattr(os, 'extsep'): - PYTHON_SOURCE_EXTENSION = os.extsep + "py" -else: - PYTHON_SOURCE_EXTENSION = ".py" +PYTHON_SOURCE_EXTENSION = ".py" class install_lib (Command): diff --git a/Lib/dumbdbm.py b/Lib/dumbdbm.py index 6cfda1c..07fd1b3 100644 --- a/Lib/dumbdbm.py +++ b/Lib/dumbdbm.py @@ -51,14 +51,14 @@ class _Database(UserDict.DictMixin): # where key is the string key, pos is the offset into the dat # file of the associated value's first byte, and siz is the number # of bytes in the associated value. - self._dirfile = filebasename + _os.extsep + 'dir' + self._dirfile = filebasename + '.dir' # The data file is a binary file pointed into by the directory # file, and holds the values associated with keys. Each value # begins at a _BLOCKSIZE-aligned byte offset, and is a raw # binary 8-bit string value. - self._datfile = filebasename + _os.extsep + 'dat' - self._bakfile = filebasename + _os.extsep + 'bak' + self._datfile = filebasename + '.dat' + self._bakfile = filebasename + '.bak' # The index is an in-memory dict, mirroring the directory file. self._index = None # maps keys to (pos, siz) pairs diff --git a/Lib/fileinput.py b/Lib/fileinput.py index 53e7c09..0080f78 100644 --- a/Lib/fileinput.py +++ b/Lib/fileinput.py @@ -315,7 +315,7 @@ class FileInput: else: if self._inplace: self._backupfilename = ( - self._filename + (self._backup or os.extsep+"bak")) + self._filename + (self._backup or ".bak")) try: os.unlink(self._backupfilename) except os.error: pass # The next few lines may raise IOError diff --git a/Lib/os.py b/Lib/os.py index f13850b..48bcea2 100644 --- a/Lib/os.py +++ b/Lib/os.py @@ -7,7 +7,6 @@ This exports: - os.curdir is a string representing the current directory ('.' or ':') - os.pardir is a string representing the parent directory ('..' or '::') - os.sep is the (or a most common) pathname separator ('/' or ':' or '\\') - - os.extsep is the extension separator ('.' or '/') - os.altsep is the alternate pathname separator (None or '/') - os.pathsep is the component separator used in $PATH etc - os.linesep is the line separator in text files ('\r' or '\n' or '\r\n') @@ -131,8 +130,7 @@ else: raise ImportError, 'no os specific module found' sys.modules['os.path'] = path -from os.path import (curdir, pardir, sep, pathsep, defpath, extsep, altsep, - devnull) +from os.path import curdir, pardir, sep, pathsep, defpath, altsep, devnull del _names diff --git a/Lib/pkgutil.py b/Lib/pkgutil.py index 5b6b169..6e93a3e 100644 --- a/Lib/pkgutil.py +++ b/Lib/pkgutil.py @@ -510,10 +510,8 @@ def extend_path(path, name): return path pname = os.path.join(*name.split('.')) # Reconstitute as relative path - # Just in case os.extsep != '.' - sname = os.extsep.join(name.split('.')) - sname_pkg = sname + os.extsep + "pkg" - init_py = "__init__" + os.extsep + "py" + sname_pkg = name + ".pkg" + init_py = "__init__.py" path = path[:] # Start with a copy of the existing path diff --git a/Lib/site.py b/Lib/site.py index 1d3183a..47a46f6 100644 --- a/Lib/site.py +++ b/Lib/site.py @@ -167,7 +167,7 @@ def addsitedir(sitedir, known_paths=None): return names.sort() for name in names: - if name.endswith(os.extsep + "pth"): + if name.endswith(".pth"): addpackage(sitedir, name, known_paths) if reset: known_paths = None diff --git a/Lib/test/regrtest.py b/Lib/test/regrtest.py index 07c49ad..e7596a5 100755 --- a/Lib/test/regrtest.py +++ b/Lib/test/regrtest.py @@ -509,7 +509,7 @@ def findtests(testdir=None, stdtests=STDTESTS, nottests=NOTTESTS): names = os.listdir(testdir) tests = [] for name in names: - if name[:5] == "test_" and name[-3:] == os.extsep+"py": + if name[:5] == "test_" and name[-3:] == ".py": modname = name[:-3] if modname not in stdtests and modname not in nottests: tests.append(modname) @@ -799,7 +799,7 @@ def findtestdir(): return testdir def removepy(name): - if name.endswith(os.extsep + "py"): + if name.endswith(".py"): name = name[:-3] return name diff --git a/Lib/test/test_exceptions.py b/Lib/test/test_exceptions.py index 0988098..ed1d6dc 100644 --- a/Lib/test/test_exceptions.py +++ b/Lib/test/test_exceptions.py @@ -155,7 +155,7 @@ class ExceptionTests(unittest.TestCase): exc, err, tb = sys.exc_info() co = tb.tb_frame.f_code self.assertEquals(co.co_name, "test_capi1") - self.assert_(co.co_filename.endswith('test_exceptions'+os.extsep+'py')) + self.assert_(co.co_filename.endswith('test_exceptions.py')) else: self.fail("Expected exception") @@ -167,7 +167,7 @@ class ExceptionTests(unittest.TestCase): exc, err, tb = sys.exc_info() co = tb.tb_frame.f_code self.assertEquals(co.co_name, "__init__") - self.assert_(co.co_filename.endswith('test_exceptions'+os.extsep+'py')) + self.assert_(co.co_filename.endswith('test_exceptions.py')) co2 = tb.tb_frame.f_back.f_code self.assertEquals(co2.co_name, "test_capi2") else: diff --git a/Lib/test/test_import.py b/Lib/test/test_import.py index 193de40..884d052 100644 --- a/Lib/test/test_import.py +++ b/Lib/test/test_import.py @@ -10,10 +10,10 @@ from test.test_support import unlink def remove_files(name): - for f in (name + os.extsep + "py", - name + os.extsep + "pyc", - name + os.extsep + "pyo", - name + os.extsep + "pyw", + for f in (name + ".py", + name + ".pyc", + name + ".pyo", + name + ".pyw", name + "$py.class"): if os.path.exists(f): os.remove(f) @@ -39,11 +39,11 @@ class ImportTest(unittest.TestCase): def test_with_extension(ext): # ext normally ".py"; perhaps ".pyw" source = TESTFN + ext - pyo = TESTFN + os.extsep + "pyo" + pyo = TESTFN + ".pyo" if sys.platform.startswith('java'): pyc = TESTFN + "$py.class" else: - pyc = TESTFN + os.extsep + "pyc" + pyc = TESTFN + ".pyc" f = open(source, "w") print("# This tests Python's ability to import a", ext, "file.", file=f) @@ -71,7 +71,7 @@ class ImportTest(unittest.TestCase): sys.path.insert(0, os.curdir) try: - test_with_extension(os.extsep + "py") + test_with_extension(".py") if sys.platform.startswith("win"): for ext in ".PY", ".Py", ".pY", ".pyw", ".PYW", ".pYw": test_with_extension(ext) @@ -86,7 +86,7 @@ class ImportTest(unittest.TestCase): def test_module_with_large_stack(self, module='longlist'): # create module w/list of 65000 elements to test bug #561858 - filename = module + os.extsep + 'py' + filename = module + '.py' # create a file with a list of 65000 elements f = open(filename, 'w+') @@ -110,13 +110,13 @@ class ImportTest(unittest.TestCase): # cleanup del sys.path[-1] - for ext in 'pyc', 'pyo': - fname = module + os.extsep + ext + for ext in '.pyc', '.pyo': + fname = module + ext if os.path.exists(fname): os.unlink(fname) def test_failing_import_sticks(self): - source = TESTFN + os.extsep + "py" + source = TESTFN + ".py" f = open(source, "w") print("a = 1/0", file=f) f.close() diff --git a/Lib/test/test_mailbox.py b/Lib/test/test_mailbox.py index 59def94..64ed07c 100644 --- a/Lib/test/test_mailbox.py +++ b/Lib/test/test_mailbox.py @@ -1687,7 +1687,7 @@ class MaildirTestCase(unittest.TestCase): t = int(time.time() % 1000000) pid = self._counter self._counter += 1 - filename = os.extsep.join((str(t), str(pid), "myhostname", "mydomain")) + filename = ".".join((str(t), str(pid), "myhostname", "mydomain")) tmpname = os.path.join(self._dir, "tmp", filename) newname = os.path.join(self._dir, dir, filename) fp = open(tmpname, "w") diff --git a/Lib/test/test_minidom.py b/Lib/test/test_minidom.py index fb3b098..d1a72bd 100644 --- a/Lib/test/test_minidom.py +++ b/Lib/test/test_minidom.py @@ -20,7 +20,7 @@ if __name__ == "__main__": base = sys.argv[0] else: base = __file__ -tstfile = os.path.join(os.path.dirname(base), "test"+os.extsep+"xml") +tstfile = os.path.join(os.path.dirname(base), "test.xml") del base # The tests of DocumentType importing use these helpers to construct diff --git a/Lib/test/test_normalization.py b/Lib/test/test_normalization.py index 1331e51..f07a87d 100644 --- a/Lib/test/test_normalization.py +++ b/Lib/test/test_normalization.py @@ -5,7 +5,7 @@ import sys import os from unicodedata import normalize -TESTDATAFILE = "NormalizationTest" + os.extsep + "txt" +TESTDATAFILE = "NormalizationTest.txt" TESTDATAURL = "http://www.unicode.org/Public/4.1.0/ucd/" + TESTDATAFILE class RangeError(Exception): diff --git a/Lib/test/test_old_mailbox.py b/Lib/test/test_old_mailbox.py index 3176310..4b6a735 100644 --- a/Lib/test/test_old_mailbox.py +++ b/Lib/test/test_old_mailbox.py @@ -45,7 +45,7 @@ class MaildirTestCase(unittest.TestCase): t = int(time.time() % 1000000) pid = self._counter self._counter += 1 - filename = os.extsep.join((str(t), str(pid), "myhostname", "mydomain")) + filename = ".".join((str(t), str(pid), "myhostname", "mydomain")) tmpname = os.path.join(self._dir, "tmp", filename) newname = os.path.join(self._dir, dir, filename) fp = open(tmpname, "w") diff --git a/Lib/test/test_pkg.py b/Lib/test/test_pkg.py index 907359b..467ca97 100644 --- a/Lib/test/test_pkg.py +++ b/Lib/test/test_pkg.py @@ -1,7 +1,7 @@ # Test packages (dotted-name import) import sys, os, tempfile, traceback -from os import mkdir, rmdir, extsep # Can't test if these fail +from os import mkdir, rmdir # Can't test if these fail del mkdir, rmdir from test.test_support import verify, verbose, TestFailed @@ -77,15 +77,15 @@ def runtest(hier, code): # Test descriptions tests = [ - ("t1", [("t1", None), ("t1 __init__"+os.extsep+"py", "")], "import t1"), + ("t1", [("t1", None), ("t1 __init__.py", "")], "import t1"), ("t2", [ ("t2", None), - ("t2 __init__"+os.extsep+"py", "'doc for t2'; print(__name__, 'loading')"), + ("t2 __init__.py", "'doc for t2'; print(__name__, 'loading')"), ("t2 sub", None), - ("t2 sub __init__"+os.extsep+"py", ""), + ("t2 sub __init__.py", ""), ("t2 sub subsub", None), - ("t2 sub subsub __init__"+os.extsep+"py", "print(__name__, 'loading'); spam = 1"), + ("t2 sub subsub __init__.py", "print(__name__, 'loading'); spam = 1"), ], """ import t2 @@ -111,11 +111,11 @@ print(dir()) ("t3", [ ("t3", None), - ("t3 __init__"+os.extsep+"py", "print(__name__, 'loading')"), + ("t3 __init__.py", "print(__name__, 'loading')"), ("t3 sub", None), - ("t3 sub __init__"+os.extsep+"py", ""), + ("t3 sub __init__.py", ""), ("t3 sub subsub", None), - ("t3 sub subsub __init__"+os.extsep+"py", "print(__name__, 'loading'); spam = 1"), + ("t3 sub subsub __init__.py", "print(__name__, 'loading'); spam = 1"), ], """ import t3.sub.subsub @@ -123,15 +123,15 @@ print(t3.__name__, t3.sub.__name__, t3.sub.subsub.__name__) """), ("t4", [ - ("t4"+os.extsep+"py", "print('THIS SHOULD NOT BE PRINTED (t4"+os.extsep+"py)')"), + ("t4.py", "print('THIS SHOULD NOT BE PRINTED (t4.py)')"), ("t4", None), - ("t4 __init__"+os.extsep+"py", "print(__name__, 'loading')"), - ("t4 sub"+os.extsep+"py", "print('THIS SHOULD NOT BE PRINTED (sub"+os.extsep+"py)')"), + ("t4 __init__.py", "print(__name__, 'loading')"), + ("t4 sub.py", "print('THIS SHOULD NOT BE PRINTED (sub.py)')"), ("t4 sub", None), - ("t4 sub __init__"+os.extsep+"py", ""), - ("t4 sub subsub"+os.extsep+"py", "print('THIS SHOULD NOT BE PRINTED (subsub"+os.extsep+"py)')"), + ("t4 sub __init__.py", ""), + ("t4 sub subsub.py", "print('THIS SHOULD NOT BE PRINTED (subsub.py)')"), ("t4 sub subsub", None), - ("t4 sub subsub __init__"+os.extsep+"py", "print(__name__, 'loading'); spam = 1"), + ("t4 sub subsub __init__.py", "print(__name__, 'loading'); spam = 1"), ], """ from t4.sub.subsub import * @@ -140,9 +140,9 @@ print("t4.sub.subsub.spam =", spam) ("t5", [ ("t5", None), - ("t5 __init__"+os.extsep+"py", "import t5.foo"), - ("t5 string"+os.extsep+"py", "print(__name__, 'loading'); spam = 1"), - ("t5 foo"+os.extsep+"py", + ("t5 __init__.py", "import t5.foo"), + ("t5 string.py", "print(__name__, 'loading'); spam = 1"), + ("t5 foo.py", "print(__name__, 'loading'); from . import string; print(string.spam)"), ], """ @@ -157,10 +157,10 @@ print(fixdir(dir(t5.string))) ("t6", [ ("t6", None), - ("t6 __init__"+os.extsep+"py", "__all__ = ['spam', 'ham', 'eggs']"), - ("t6 spam"+os.extsep+"py", "print(__name__, 'loading')"), - ("t6 ham"+os.extsep+"py", "print(__name__, 'loading')"), - ("t6 eggs"+os.extsep+"py", "print(__name__, 'loading')"), + ("t6 __init__.py", "__all__ = ['spam', 'ham', 'eggs']"), + ("t6 spam.py", "print(__name__, 'loading')"), + ("t6 ham.py", "print(__name__, 'loading')"), + ("t6 eggs.py", "print(__name__, 'loading')"), ], """ import t6 @@ -171,15 +171,15 @@ print(dir()) """), ("t7", [ - ("t7"+os.extsep+"py", "print('Importing t7"+os.extsep+"py')"), + ("t7.py", "print('Importing t7.py')"), ("t7", None), - ("t7 __init__"+os.extsep+"py", "print(__name__, 'loading')"), - ("t7 sub"+os.extsep+"py", "print('THIS SHOULD NOT BE PRINTED (sub"+os.extsep+"py)')"), + ("t7 __init__.py", "print(__name__, 'loading')"), + ("t7 sub.py", "print('THIS SHOULD NOT BE PRINTED (sub.py)')"), ("t7 sub", None), - ("t7 sub __init__"+os.extsep+"py", ""), - ("t7 sub subsub"+os.extsep+"py", "print('THIS SHOULD NOT BE PRINTED (subsub"+os.extsep+"py)')"), + ("t7 sub __init__.py", ""), + ("t7 sub subsub.py", "print('THIS SHOULD NOT BE PRINTED (subsub.py)')"), ("t7 sub subsub", None), - ("t7 sub subsub __init__"+os.extsep+"py", "print(__name__, 'loading'); spam = 1"), + ("t7 sub subsub __init__.py", "print(__name__, 'loading'); spam = 1"), ], """ t7, sub, subsub = None, None, None diff --git a/Lib/test/test_pkgimport.py b/Lib/test/test_pkgimport.py index 789f4d3..574d1db 100644 --- a/Lib/test/test_pkgimport.py +++ b/Lib/test/test_pkgimport.py @@ -22,8 +22,8 @@ class TestImport(unittest.TestCase): self.package_dir = os.path.join(self.test_dir, self.package_name) os.mkdir(self.package_dir) - open(os.path.join(self.package_dir, '__init__'+os.extsep+'py'), 'w') - self.module_path = os.path.join(self.package_dir, 'foo'+os.extsep+'py') + open(os.path.join(self.package_dir, '__init__.py'), 'w') + self.module_path = os.path.join(self.package_dir, 'foo.py') def tearDown(self): for file in os.listdir(self.package_dir): diff --git a/Lib/test/test_repr.py b/Lib/test/test_repr.py index d4db894..7e8292b 100644 --- a/Lib/test/test_repr.py +++ b/Lib/test/test_repr.py @@ -205,10 +205,10 @@ class LongReprTest(unittest.TestCase): # Make the package and subpackage shutil.rmtree(self.pkgname, ignore_errors=True) os.mkdir(self.pkgname) - touch(os.path.join(self.pkgname, '__init__'+os.extsep+'py')) + touch(os.path.join(self.pkgname, '__init__.py')) shutil.rmtree(self.subpkgname, ignore_errors=True) os.mkdir(self.subpkgname) - touch(os.path.join(self.subpkgname, '__init__'+os.extsep+'py')) + touch(os.path.join(self.subpkgname, '__init__.py')) # Remember where we are self.here = os.getcwd() sys.path.insert(0, self.here) @@ -228,7 +228,7 @@ class LongReprTest(unittest.TestCase): def test_module(self): eq = self.assertEquals - touch(os.path.join(self.subpkgname, self.pkgname + os.extsep + 'py')) + touch(os.path.join(self.subpkgname, self.pkgname + '.py')) from areallylongpackageandmodulenametotestreprtruncation.areallylongpackageandmodulenametotestreprtruncation import areallylongpackageandmodulenametotestreprtruncation eq(repr(areallylongpackageandmodulenametotestreprtruncation), "" % (areallylongpackageandmodulenametotestreprtruncation.__name__, areallylongpackageandmodulenametotestreprtruncation.__file__)) @@ -236,7 +236,7 @@ class LongReprTest(unittest.TestCase): def test_type(self): eq = self.assertEquals - touch(os.path.join(self.subpkgname, 'foo'+os.extsep+'py'), '''\ + touch(os.path.join(self.subpkgname, 'foo.py'), '''\ class foo(object): pass ''') @@ -250,7 +250,7 @@ class foo(object): pass def test_class(self): - touch(os.path.join(self.subpkgname, 'bar'+os.extsep+'py'), '''\ + touch(os.path.join(self.subpkgname, 'bar.py'), '''\ class bar: pass ''') @@ -259,7 +259,7 @@ class bar: self.assertEquals(repr(bar.bar), "" % bar.__name__) def test_instance(self): - touch(os.path.join(self.subpkgname, 'baz'+os.extsep+'py'), '''\ + touch(os.path.join(self.subpkgname, 'baz.py'), '''\ class baz: pass ''') @@ -270,7 +270,7 @@ class baz: def test_method(self): eq = self.assertEquals - touch(os.path.join(self.subpkgname, 'qux'+os.extsep+'py'), '''\ + touch(os.path.join(self.subpkgname, 'qux.py'), '''\ class aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa: def amethod(self): pass ''') diff --git a/Lib/test/test_runpy.py b/Lib/test/test_runpy.py index d10e40f..0fcec1e 100644 --- a/Lib/test/test_runpy.py +++ b/Lib/test/test_runpy.py @@ -103,14 +103,14 @@ class RunModuleTest(unittest.TestCase): def _add_pkg_dir(self, pkg_dir): os.mkdir(pkg_dir) - pkg_fname = os.path.join(pkg_dir, "__init__"+os.extsep+"py") + pkg_fname = os.path.join(pkg_dir, "__init__.py") pkg_file = open(pkg_fname, "w") pkg_file.close() return pkg_fname def _make_pkg(self, source, depth): pkg_name = "__runpy_pkg__" - test_fname = "runpy_test"+os.extsep+"py" + test_fname = "runpy_test.py" pkg_dir = sub_dir = tempfile.mkdtemp() if verbose: print(" Package tree in:", sub_dir) sys.path.insert(0, pkg_dir) @@ -182,7 +182,7 @@ class RunModuleTest(unittest.TestCase): parent_dir = module_dir module_dir = os.path.join(module_dir, pkg_name) # Add sibling module - sibling_fname = os.path.join(module_dir, "sibling"+os.extsep+"py") + sibling_fname = os.path.join(module_dir, "sibling.py") sibling_file = open(sibling_fname, "w") sibling_file.close() if verbose: print(" Added sibling module:", sibling_fname) @@ -193,7 +193,7 @@ class RunModuleTest(unittest.TestCase): cousin_dir = os.path.join(uncle_dir, "cousin") self._add_pkg_dir(cousin_dir) if verbose: print(" Added cousin package:", cousin_dir) - nephew_fname = os.path.join(cousin_dir, "nephew"+os.extsep+"py") + nephew_fname = os.path.join(cousin_dir, "nephew.py") nephew_file = open(nephew_fname, "w") nephew_file.close() if verbose: print(" Added nephew module:", nephew_fname) diff --git a/Lib/test/test_sax.py b/Lib/test/test_sax.py index e2639fa..a411bfd 100644 --- a/Lib/test/test_sax.py +++ b/Lib/test/test_sax.py @@ -311,7 +311,7 @@ class XMLFilterBaseTest(unittest.TestCase): # # =========================================================================== -xml_test_out = open(findfile("test"+os.extsep+"xml"+os.extsep+"out")).read() +xml_test_out = open(findfile("test.xml.out")).read() class ExpatReaderTest(XmlTestBase): @@ -323,7 +323,7 @@ class ExpatReaderTest(XmlTestBase): xmlgen = XMLGenerator(result) parser.setContentHandler(xmlgen) - parser.parse(open(findfile("test"+os.extsep+"xml"))) + parser.parse(open(findfile("test.xml"))) self.assertEquals(result.getvalue(), xml_test_out) @@ -452,7 +452,7 @@ class ExpatReaderTest(XmlTestBase): xmlgen = XMLGenerator(result) parser.setContentHandler(xmlgen) - parser.parse(findfile("test"+os.extsep+"xml")) + parser.parse(findfile("test.xml")) self.assertEquals(result.getvalue(), xml_test_out) @@ -462,7 +462,7 @@ class ExpatReaderTest(XmlTestBase): xmlgen = XMLGenerator(result) parser.setContentHandler(xmlgen) - parser.parse(InputSource(findfile("test"+os.extsep+"xml"))) + parser.parse(InputSource(findfile("test.xml"))) self.assertEquals(result.getvalue(), xml_test_out) @@ -473,7 +473,7 @@ class ExpatReaderTest(XmlTestBase): parser.setContentHandler(xmlgen) inpsrc = InputSource() - inpsrc.setByteStream(open(findfile("test"+os.extsep+"xml"))) + inpsrc.setByteStream(open(findfile("test.xml"))) parser.parse(inpsrc) self.assertEquals(result.getvalue(), xml_test_out) diff --git a/Lib/test/test_support.py b/Lib/test/test_support.py index 6a1fa86..698507f 100644 --- a/Lib/test/test_support.py +++ b/Lib/test/test_support.py @@ -70,11 +70,11 @@ def forget(modname): deleting any .pyc and .pyo files.''' unload(modname) for dirname in sys.path: - unlink(os.path.join(dirname, modname + os.extsep + 'pyc')) + unlink(os.path.join(dirname, modname + '.pyc')) # 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 # is exited) but there is a .pyo file. - unlink(os.path.join(dirname, modname + os.extsep + 'pyo')) + unlink(os.path.join(dirname, modname + '.pyo')) def is_resource_enabled(resource): """Test whether a resource is enabled. Known resources are set by diff --git a/Lib/test/test_tokenize.py b/Lib/test/test_tokenize.py index 9ef6563..8ef9000 100644 --- a/Lib/test/test_tokenize.py +++ b/Lib/test/test_tokenize.py @@ -186,14 +186,14 @@ def test_main(): # This displays the tokenization of tokenize_tests.py to stdout, and # regrtest.py checks that this equals the expected output (in the # test/output/ directory). - f = open(findfile('tokenize_tests' + os.extsep + 'txt')) + f = open(findfile('tokenize_tests.txt')) tokenize(f.readline) f.close() # Now run test_roundtrip() over tokenize_test.py too, and over all # (if the "compiler" resource is enabled) or a small random sample (if # "compiler" is not enabled) of the test*.py files. - f = findfile('tokenize_tests' + os.extsep + 'txt') + f = findfile('tokenize_tests.txt') test_roundtrip(f) testdir = os.path.dirname(f) or os.curdir diff --git a/Lib/test/test_zipfile.py b/Lib/test/test_zipfile.py index 98fe3c9..ef3987a 100644 --- a/Lib/test/test_zipfile.py +++ b/Lib/test/test_zipfile.py @@ -29,7 +29,7 @@ class TestsWithSourceFile(unittest.TestCase): def makeTestArchive(self, f, compression): # Create the ZIP archive zipfp = zipfile.ZipFile(f, "w", compression) - zipfp.write(TESTFN, "another"+os.extsep+"name") + zipfp.write(TESTFN, "another.name") zipfp.write(TESTFN, TESTFN) zipfp.writestr("strfile", self.data) zipfp.close() @@ -40,7 +40,7 @@ class TestsWithSourceFile(unittest.TestCase): # Read the ZIP archive zipfp = zipfile.ZipFile(f, "r", compression) self.assertEqual(zipfp.read(TESTFN), self.data) - self.assertEqual(zipfp.read("another"+os.extsep+"name"), self.data) + self.assertEqual(zipfp.read("another.name"), self.data) self.assertEqual(zipfp.read("strfile"), self.data) # Print the ZIP directory @@ -64,7 +64,7 @@ class TestsWithSourceFile(unittest.TestCase): names = zipfp.namelist() self.assertEquals(len(names), 3) self.assert_(TESTFN in names) - self.assert_("another"+os.extsep+"name" in names) + self.assert_("another.name" in names) self.assert_("strfile" in names) # Check infolist @@ -72,13 +72,13 @@ class TestsWithSourceFile(unittest.TestCase): names = [ i.filename for i in infos ] self.assertEquals(len(names), 3) self.assert_(TESTFN in names) - self.assert_("another"+os.extsep+"name" in names) + self.assert_("another.name" in names) self.assert_("strfile" in names) for i in infos: self.assertEquals(i.file_size, len(self.data)) # check getinfo - for nm in (TESTFN, "another"+os.extsep+"name", "strfile"): + for nm in (TESTFN, "another.name", "strfile"): info = zipfp.getinfo(nm) self.assertEquals(info.filename, nm) self.assertEquals(info.file_size, len(self.data)) @@ -105,7 +105,7 @@ class TestsWithSourceFile(unittest.TestCase): zipdata1.append(read_data) zipdata2 = [] - zipopen2 = zipfp.open("another"+os.extsep+"name") + zipopen2 = zipfp.open("another.name") while 1: read_data = zipopen2.read(256) if not read_data: @@ -313,13 +313,13 @@ class TestZip64InSmallFiles(unittest.TestCase): def largeFileExceptionTest(self, f, compression): zipfp = zipfile.ZipFile(f, "w", compression) self.assertRaises(zipfile.LargeZipFile, - zipfp.write, TESTFN, "another"+os.extsep+"name") + zipfp.write, TESTFN, "another.name") zipfp.close() def largeFileExceptionTest2(self, f, compression): zipfp = zipfile.ZipFile(f, "w", compression) self.assertRaises(zipfile.LargeZipFile, - zipfp.writestr, "another"+os.extsep+"name", self.data) + zipfp.writestr, "another.name", self.data) zipfp.close() def testLargeFileException(self): @@ -330,7 +330,7 @@ class TestZip64InSmallFiles(unittest.TestCase): def zipTest(self, f, compression): # Create the ZIP archive zipfp = zipfile.ZipFile(f, "w", compression, allowZip64=True) - zipfp.write(TESTFN, "another"+os.extsep+"name") + zipfp.write(TESTFN, "another.name") zipfp.write(TESTFN, TESTFN) zipfp.writestr("strfile", self.data) zipfp.close() @@ -338,7 +338,7 @@ class TestZip64InSmallFiles(unittest.TestCase): # Read the ZIP archive zipfp = zipfile.ZipFile(f, "r", compression) self.assertEqual(zipfp.read(TESTFN), self.data) - self.assertEqual(zipfp.read("another"+os.extsep+"name"), self.data) + self.assertEqual(zipfp.read("another.name"), self.data) self.assertEqual(zipfp.read("strfile"), self.data) # Print the ZIP directory @@ -362,7 +362,7 @@ class TestZip64InSmallFiles(unittest.TestCase): names = zipfp.namelist() self.assertEquals(len(names), 3) self.assert_(TESTFN in names) - self.assert_("another"+os.extsep+"name" in names) + self.assert_("another.name" in names) self.assert_("strfile" in names) # Check infolist @@ -370,13 +370,13 @@ class TestZip64InSmallFiles(unittest.TestCase): names = [ i.filename for i in infos ] self.assertEquals(len(names), 3) self.assert_(TESTFN in names) - self.assert_("another"+os.extsep+"name" in names) + self.assert_("another.name" in names) self.assert_("strfile" in names) for i in infos: self.assertEquals(i.file_size, len(self.data)) # check getinfo - for nm in (TESTFN, "another"+os.extsep+"name", "strfile"): + for nm in (TESTFN, "another.name", "strfile"): info = zipfp.getinfo(nm) self.assertEquals(info.filename, nm) self.assertEquals(info.file_size, len(self.data)) @@ -675,7 +675,7 @@ class TestsWithRandomBinaryFiles(unittest.TestCase): def makeTestArchive(self, f, compression): # Create the ZIP archive zipfp = zipfile.ZipFile(f, "w", compression) - zipfp.write(TESTFN, "another"+os.extsep+"name") + zipfp.write(TESTFN, "another.name") zipfp.write(TESTFN, TESTFN) zipfp.close() @@ -687,7 +687,7 @@ class TestsWithRandomBinaryFiles(unittest.TestCase): testdata = zipfp.read(TESTFN) self.assertEqual(len(testdata), len(self.data)) self.assertEqual(testdata, self.data) - self.assertEqual(zipfp.read("another"+os.extsep+"name"), self.data) + self.assertEqual(zipfp.read("another.name"), self.data) zipfp.close() def testStored(self): @@ -708,7 +708,7 @@ class TestsWithRandomBinaryFiles(unittest.TestCase): zipdata1.append(read_data) zipdata2 = [] - zipopen2 = zipfp.open("another"+os.extsep+"name") + zipopen2 = zipfp.open("another.name") while 1: read_data = zipopen2.read(256) if not read_data: diff --git a/Lib/test/test_zipimport.py b/Lib/test/test_zipimport.py index f36cbf4..17d5bb9 100644 --- a/Lib/test/test_zipimport.py +++ b/Lib/test/test_zipimport.py @@ -51,7 +51,7 @@ else: TESTMOD = "ziptestmodule" TESTPACK = "ziptestpackage" TESTPACK2 = "ziptestpackage2" -TEMP_ZIP = os.path.abspath("junk95142" + os.extsep + "zip") +TEMP_ZIP = os.path.abspath("junk95142.zip") class UncompressedZipImportTestCase(ImportHooksBaseTestCase): diff --git a/Lib/whichdb.py b/Lib/whichdb.py index 752bbb1..ca9c736 100644 --- a/Lib/whichdb.py +++ b/Lib/whichdb.py @@ -30,18 +30,18 @@ def whichdb(filename): # Check for dbm first -- this has a .pag and a .dir file try: - f = io.open(filename + os.extsep + "pag", "rb") + f = io.open(filename + ".pag", "rb") f.close() # dbm linked with gdbm on OS/2 doesn't have .dir file if not (dbm.library == "GNU gdbm" and sys.platform == "os2emx"): - f = io.open(filename + os.extsep + "dir", "rb") + f = io.open(filename + ".dir", "rb") f.close() return "dbm" except IOError: # some dbm emulations based on Berkeley DB generate a .db file # some do not, but they should be caught by the dbhash checks try: - f = io.open(filename + os.extsep + "db", "rb") + f = io.open(filename + ".db", "rb") f.close() # guarantee we can actually open the file using dbm # kind of overkill, but since we are dealing with emulations @@ -56,12 +56,12 @@ def whichdb(filename): # Check for dumbdbm next -- this has a .dir and a .dat file try: # First check for presence of files - os.stat(filename + os.extsep + "dat") - size = os.stat(filename + os.extsep + "dir").st_size + os.stat(filename + ".dat") + size = os.stat(filename + ".dir").st_size # dumbdbm files with no keys are empty if size == 0: return "dumbdbm" - f = io.open(filename + os.extsep + "dir", "rb") + f = io.open(filename + ".dir", "rb") try: if f.read(1) in (b"'", b'"'): return "dumbdbm" diff --git a/Misc/HISTORY b/Misc/HISTORY index f2452f2..7ab7e37 100644 --- a/Misc/HISTORY +++ b/Misc/HISTORY @@ -2611,7 +2611,7 @@ Library - The distutils "register" command now uses http://www.python.org/pypi as the default repository. (See PEP 301.) -- the platform dependent path related variables sep, altsep, extsep, +- the platform dependent path related variables sep, altsep, pathsep, curdir, pardir and defpath are now defined in the platform dependent path modules (e.g. ntpath.py) rather than os.py, so these variables are now available via os.path. They continue to be @@ -4196,11 +4196,6 @@ Library cycles created by casual use of sys.exc_info() no longer cause permanent memory leaks (provided garbage collection is enabled). -- os.extsep -- a new variable needed by the RISCOS support. It is the - separator used by extensions, and is '.' on all platforms except - RISCOS, where it is '/'. There is no need to use this variable - unless you have a masochistic desire to port your code to RISCOS. - - mimetypes.py has optional support for non-standard, but commonly found types. guess_type() and guess_extension() now accept an optional 'strict' flag, defaulting to true, which controls whether diff --git a/Modules/_localemodule.c b/Modules/_localemodule.c index d963e40..f45b85e 100644 --- a/Modules/_localemodule.c +++ b/Modules/_localemodule.c @@ -41,10 +41,6 @@ This software comes with no warranty. Use at your own risk. #include #endif -#ifdef RISCOS -char *strdup(const char *); -#endif - PyDoc_STRVAR(locale__doc__, "Support for POSIX locales."); static PyObject *Error; diff --git a/Modules/main.c b/Modules/main.c index 0bcd0f4..22f5c0a 100644 --- a/Modules/main.c +++ b/Modules/main.c @@ -41,15 +41,7 @@ static int orig_argc; /* command line options */ #define BASE_OPTS "c:dEhim:OStuvVW:xX?" -#ifndef RISCOS #define PROGRAM_OPTS BASE_OPTS -#else /*RISCOS*/ -/* extra option saying that we are running under a special task window - frontend; especially my_readline will behave different */ -#define PROGRAM_OPTS BASE_OPTS "w" -/* corresponding flag */ -extern int Py_RISCOSWimpFlag; -#endif /*RISCOS*/ /* Short usage message (with %s for argv0) */ static char *usage_line = @@ -227,10 +219,6 @@ Py_Main(int argc, char **argv) orig_argc = argc; /* For Py_GetArgcArgv() */ orig_argv = argv; -#ifdef RISCOS - Py_RISCOSWimpFlag = 0; -#endif - PySys_ResetWarnOptions(); while ((c = _PyOS_GetOpt(argc, argv, PROGRAM_OPTS)) != EOF) { @@ -295,12 +283,6 @@ Py_Main(int argc, char **argv) Py_VerboseFlag++; break; -#ifdef RISCOS - case 'w': - Py_RISCOSWimpFlag = 1; - break; -#endif - case 'x': skipfirstline = 1; break; @@ -513,10 +495,6 @@ Py_Main(int argc, char **argv) WaitForThreadShutdown(); Py_Finalize(); -#ifdef RISCOS - if (Py_RISCOSWimpFlag) - fprintf(stderr, "\x0cq\x0c"); /* make frontend quit */ -#endif #ifdef __INSURE__ /* Insure++ is a memory analysis tool that aids in discovering diff --git a/Modules/socketmodule.c b/Modules/socketmodule.c index 3ddb0a7..d8ea423 100644 --- a/Modules/socketmodule.c +++ b/Modules/socketmodule.c @@ -251,15 +251,7 @@ typedef size_t socklen_t; # include # endif -# ifndef RISCOS # include -# else -# include -# include -# define NO_DUP -int h_errno; /* not used */ -# define INET_ADDRSTRLEN 16 -# endif #else @@ -417,11 +409,6 @@ static PyObject *socket_herror; static PyObject *socket_gaierror; static PyObject *socket_timeout; -#ifdef RISCOS -/* Global variable which is !=0 if Python is running in a RISC OS taskwindow */ -static int taskwindow; -#endif - /* A forward reference to the socket type object. The sock_type variable contains pointers to various functions, some of which call new_sockobject(), which uses sock_type, so @@ -582,18 +569,6 @@ set_error(void) } #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); } @@ -670,11 +645,9 @@ sendsegmented(int sock_fd, char *buf, int len, int flags) static int internal_setblocking(PySocketSockObject *s, int block) { -#ifndef RISCOS #ifndef MS_WINDOWS int delay_flag; #endif -#endif Py_BEGIN_ALLOW_THREADS #ifdef __BEOS__ @@ -682,7 +655,6 @@ internal_setblocking(PySocketSockObject *s, int block) setsockopt(s->sock_fd, SOL_SOCKET, SO_NONBLOCK, (void *)(&block), sizeof(int)); #else -#ifndef RISCOS #ifndef MS_WINDOWS #if defined(PYOS_OS2) && !defined(PYCC_GCC) block = !block; @@ -702,10 +674,6 @@ internal_setblocking(PySocketSockObject *s, int block) block = !block; ioctlsocket(s->sock_fd, FIONBIO, (u_long*)&block); #endif /* MS_WINDOWS */ -#else /* RISCOS */ - block = !block; - socketioctl(s->sock_fd, FIONBIO, (u_long*)&block); -#endif /* RISCOS */ #endif /* __BEOS__ */ Py_END_ALLOW_THREADS @@ -778,9 +746,6 @@ PyMODINIT_FUNC init_sockobject(PySocketSockObject *s, SOCKET_T fd, int family, int type, int proto) { -#ifdef RISCOS - int block = 1; -#endif s->sock_fd = fd; s->sock_family = family; s->sock_type = type; @@ -792,10 +757,6 @@ init_sockobject(PySocketSockObject *s, if (defaulttimeout >= 0.0) internal_setblocking(s, 0); -#ifdef RISCOS - if (taskwindow) - socketioctl(s->sock_fd, 0x80046679, (u_long*)&block); -#endif } @@ -1700,30 +1661,6 @@ Returns the timeout in floating seconds associated with socket \n\ operations. A timeout of None indicates that timeouts on socket \n\ operations are disabled."); -#ifdef RISCOS -/* s.sleeptaskw(1 | 0) method */ - -static PyObject * -sock_sleeptaskw(PySocketSockObject *s,PyObject *arg) -{ - int block; - block = PyInt_AsLong(arg); - if (block == -1 && PyErr_Occurred()) - return NULL; - Py_BEGIN_ALLOW_THREADS - socketioctl(s->sock_fd, 0x80046679, (u_long*)&block); - Py_END_ALLOW_THREADS - - Py_INCREF(Py_None); - return Py_None; -} -PyDoc_STRVAR(sleeptaskw_doc, -"sleeptaskw(flag)\n\ -\n\ -Allow sleeps in taskwindows."); -#endif - - /* s.setsockopt() method. With an integer third argument, sets an integer option. With a string third argument, sets an option from a buffer; @@ -2749,10 +2686,6 @@ static PyMethodDef sock_methods[] = { setsockopt_doc}, {"shutdown", (PyCFunction)sock_shutdown, METH_O, shutdown_doc}, -#ifdef RISCOS - {"sleeptaskw", (PyCFunction)sock_sleeptaskw, METH_O, - sleeptaskw_doc}, -#endif {NULL, NULL} /* sentinel */ }; @@ -2963,11 +2896,7 @@ gethost_common(struct hostent *h, struct sockaddr *addr, int alen, int af) if (h == NULL) { /* Let's get real error message to return */ -#ifndef RISCOS set_herror(h_errno); -#else - PyErr_SetString(socket_error, "host not found"); -#endif return NULL; } @@ -4016,24 +3945,6 @@ static PyMethodDef socket_methods[] = { }; -#ifdef RISCOS -#define OS_INIT_DEFINED - -static int -os_init(void) -{ - _kernel_swi_regs r; - - r.r[0] = 0; - _kernel_swi(0x43380, &r, &r); - taskwindow = r.r[0]; - - return 1; -} - -#endif /* RISCOS */ - - #ifdef MS_WINDOWS #define OS_INIT_DEFINED diff --git a/Modules/timemodule.c b/Modules/timemodule.c index c7cd340..4bf3a9c 100644 --- a/Modules/timemodule.c +++ b/Modules/timemodule.c @@ -87,10 +87,6 @@ static long main_thread; #include #endif -#ifdef RISCOS -extern int riscos_sleep(double); -#endif - /* Forward declarations */ static int floatsleep(double); static double floattime(void); @@ -983,14 +979,6 @@ floatsleep(double secs) } Py_END_ALLOW_THREADS } -#elif defined(RISCOS) - if (secs <= 0.0) - return 0; - Py_BEGIN_ALLOW_THREADS - /* This sleep *CAN BE* interrupted. */ - if ( riscos_sleep(secs) ) - return -1; - Py_END_ALLOW_THREADS #elif defined(PLAN9) { double millisecs = secs * 1000.0; diff --git a/Modules/zipimport.c b/Modules/zipimport.c index fc93011..42cb9d0 100644 --- a/Modules/zipimport.c +++ b/Modules/zipimport.c @@ -92,7 +92,6 @@ zipimporter_init(ZipImporter *self, PyObject *args, PyObject *kwds) path = NULL; prefix = NULL; for (;;) { -#ifndef RISCOS struct stat statbuf; int rv; @@ -104,15 +103,6 @@ zipimporter_init(ZipImporter *self, PyObject *args, PyObject *kwds) path = buf; break; } -#else - if (object_exists(buf)) { - /* it exists */ - if (isfile(buf)) - /* it's a file */ - path = buf; - break; - } -#endif /* back up one path element */ p = strrchr(buf, SEP); if (prefix != NULL) diff --git a/Modules/zlib/README b/Modules/zlib/README index 758cc50..02c29d4 100644 --- a/Modules/zlib/README +++ b/Modules/zlib/README @@ -74,7 +74,7 @@ Notes for some targets: - zlib doesn't work on HP-UX 9.05 with some versions of /bin/cc. It works with other compilers. Use "make test" to check your compiler. -- gzdopen is not supported on RISCOS, BEOS and by some Mac compilers. +- gzdopen is not supported on BEOS and by some Mac compilers. - For PalmOs, see http://palmzlib.sourceforge.net/ diff --git a/Modules/zlib/example.c b/Modules/zlib/example.c index 6c8a0ee..52bc261 100644 --- a/Modules/zlib/example.c +++ b/Modules/zlib/example.c @@ -13,7 +13,7 @@ # include #endif -#if defined(VMS) || defined(RISCOS) +#if defined(VMS) # define TESTFILE "foo-gz" #else # define TESTFILE "foo.gz" diff --git a/Modules/zlib/minigzip.c b/Modules/zlib/minigzip.c index 4524b96..7f1de49 100644 --- a/Modules/zlib/minigzip.c +++ b/Modules/zlib/minigzip.c @@ -41,11 +41,6 @@ # define unlink delete # define GZ_SUFFIX "-gz" #endif -#ifdef RISCOS -# define unlink remove -# define GZ_SUFFIX "-gz" -# define fileno(file) file->__file -#endif #if defined(__MWERKS__) && __dest_os != __be_os && __dest_os != __win32_os # include /* for fileno */ #endif diff --git a/Modules/zlib/zutil.h b/Modules/zlib/zutil.h index b7d5eff..34646eb 100644 --- a/Modules/zlib/zutil.h +++ b/Modules/zlib/zutil.h @@ -147,7 +147,7 @@ extern const char * const z_errmsg[10]; /* indexed by 2-zlib_error */ # define OS_CODE 0x0f #endif -#if defined(_BEOS_) || defined(RISCOS) +#if defined(_BEOS_) # define fdopen(fd,mode) NULL /* No fdopen() */ #endif diff --git a/Parser/grammar.c b/Parser/grammar.c index 9e7c49a..fa27300 100644 --- a/Parser/grammar.c +++ b/Parser/grammar.c @@ -9,10 +9,6 @@ #include "token.h" #include "grammar.h" -#ifdef RISCOS -#include -#endif - extern int Py_DebugFlag; grammar * diff --git a/Parser/intrcheck.c b/Parser/intrcheck.c index e0f3252..5285dc5 100644 --- a/Parser/intrcheck.c +++ b/Parser/intrcheck.c @@ -126,11 +126,7 @@ intcatcher(int sig) case 0: break; case 1: -#ifdef RISCOS - fprintf(stderr, message); -#else write(2, message, strlen(message)); -#endif break; case 2: interrupted = 0; diff --git a/Parser/myreadline.c b/Parser/myreadline.c index 32a1088..a144850 100644 --- a/Parser/myreadline.c +++ b/Parser/myreadline.c @@ -29,10 +29,6 @@ static PyThread_type_lock _PyOS_ReadlineLock = NULL; int (*PyOS_InputHook)(void) = NULL; -#ifdef RISCOS -int Py_RISCOSWimpFlag; -#endif - /* This function restarts a fgets() after an EINTR error occurred except if PyOS_InterruptOccurred() returns true. */ @@ -114,17 +110,8 @@ PyOS_StdioReadline(FILE *sys_stdin, FILE *sys_stdout, char *prompt) if ((p = (char *)PyMem_MALLOC(n)) == NULL) return NULL; fflush(sys_stdout); -#ifndef RISCOS if (prompt) fprintf(stderr, "%s", prompt); -#else - if (prompt) { - if(Py_RISCOSWimpFlag) - fprintf(stderr, "\x0cr%s\x0c", prompt); - else - fprintf(stderr, "%s", prompt); - } -#endif fflush(stderr); switch (my_fgets(p, (int)n, sys_stdin)) { case 0: /* Normal case */ diff --git a/Python/bltinmodule.c b/Python/bltinmodule.c index b6a7327..14fb349 100644 --- a/Python/bltinmodule.c +++ b/Python/bltinmodule.c @@ -8,10 +8,6 @@ #include -#ifdef RISCOS -#include "unixstuff.h" -#endif - /* The default encoding used by the platform file system APIs Can remain NULL for all platforms that don't have such a concept */ diff --git a/Python/import.c b/Python/import.c index 7ac9e2a..49a47bb 100644 --- a/Python/import.c +++ b/Python/import.c @@ -94,13 +94,6 @@ struct _inittab *PyImport_Inittab = _PyImport_Inittab; /* these tables define the module suffixes that Python recognizes */ struct filedescr * _PyImport_Filetab = NULL; -#ifdef RISCOS -static const struct filedescr _PyImport_StandardFiletab[] = { - {"/py", "U", PY_SOURCE}, - {"/pyc", "rb", PY_COMPILED}, - {0, 0} -}; -#else static const struct filedescr _PyImport_StandardFiletab[] = { {".py", "U", PY_SOURCE}, #ifdef MS_WINDOWS @@ -109,7 +102,6 @@ static const struct filedescr _PyImport_StandardFiletab[] = { {".pyc", "rb", PY_COMPILED}, {0, 0} }; -#endif static PyTypeObject NullImporterType; /* Forward reference */ @@ -144,13 +136,8 @@ _PyImport_Init(void) if (Py_OptimizeFlag) { /* Replace ".pyc" with ".pyo" in _PyImport_Filetab */ for (; filetab->suffix != NULL; filetab++) { -#ifndef RISCOS if (strcmp(filetab->suffix, ".pyc") == 0) filetab->suffix = ".pyo"; -#else - if (strcmp(filetab->suffix, "/pyc") == 0) - filetab->suffix = "/pyo"; -#endif } } @@ -1131,9 +1118,7 @@ find_module(char *fullname, char *subname, PyObject *path, char *buf, char *filemode; FILE *fp = NULL; PyObject *path_hooks, *path_importer_cache; -#ifndef RISCOS struct stat statbuf; -#endif static struct filedescr fd_frozen = {"", "", PY_FROZEN}; static struct filedescr fd_builtin = {"", "", C_BUILTIN}; static struct filedescr fd_package = {"", "", PKG_DIRECTORY}; @@ -1326,25 +1311,6 @@ find_module(char *fullname, char *subname, PyObject *path, char *buf, } } } -#else - /* XXX How are you going to test for directories? */ -#ifdef RISCOS - if (isdir(buf) && - case_ok(buf, len, namelen, name)) { - if (find_init_module(buf)) { - return &fd_package; - } - else { - char warnstr[MAXPATHLEN+80]; - sprintf(warnstr, "Not importing directory " - "'%.*s': missing __init__.py", - MAXPATHLEN, buf); - if (PyErr_WarnEx(PyExc_ImportWarning, - warnstr, 1)) { - return NULL; - } - } -#endif #endif #if defined(PYOS_OS2) /* take a snapshot of the module spec for restoration @@ -1480,9 +1446,6 @@ PyAPI_FUNC(int) _PyImport_IsScript(struct filedescr * fd) #define INCL_DOSERRORS #define INCL_NOPMAPI #include - -#elif defined(RISCOS) -#include "oslib/osfscontrol.h" #endif static int @@ -1568,31 +1531,6 @@ case_ok(char *buf, Py_ssize_t len, Py_ssize_t namelen, char *name) } return 0 ; /* Not found */ -/* RISC OS */ -#elif defined(RISCOS) - char canon[MAXPATHLEN+1]; /* buffer for the canonical form of the path */ - char buf2[MAXPATHLEN+2]; - char *nameWithExt = buf+len-namelen; - int canonlen; - os_error *e; - - if (Py_GETENV("PYTHONCASEOK") != NULL) - return 1; - - /* workaround: - append wildcard, otherwise case of filename wouldn't be touched */ - strcpy(buf2, buf); - strcat(buf2, "*"); - - e = xosfscontrol_canonicalise_path(buf2,canon,0,0,MAXPATHLEN+1,&canonlen); - canonlen = MAXPATHLEN+1-canonlen; - if (e || canonlen<=0 || canonlen>(MAXPATHLEN+1) ) - return 0; - if (strcmp(nameWithExt, canon+canonlen-strlen(nameWithExt))==0) - return 1; /* match */ - - return 0; - /* OS/2 */ #elif defined(PYOS_OS2) HDIR hdir = 1; @@ -1668,38 +1606,6 @@ find_init_module(char *buf) return 0; } -#else - -#ifdef RISCOS -static int -find_init_module(buf) - char *buf; -{ - int save_len = strlen(buf); - int i = save_len; - - if (save_len + 13 >= MAXPATHLEN) - return 0; - buf[i++] = SEP; - strcpy(buf+i, "__init__/py"); - if (isfile(buf)) { - buf[save_len] = '\0'; - return 1; - } - - if (Py_OptimizeFlag) - strcpy(buf+i, "o"); - else - strcpy(buf+i, "c"); - if (isfile(buf)) { - buf[save_len] = '\0'; - return 1; - } - buf[save_len] = '\0'; - return 0; -} -#endif /*RISCOS*/ - #endif /* HAVE_STAT */ @@ -3007,7 +2913,6 @@ NullImporter_init(NullImporter *self, PyObject *args, PyObject *kwds) PyErr_SetString(PyExc_ImportError, "empty pathname"); return -1; } else { -#ifndef RISCOS struct stat statbuf; int rv; @@ -3021,17 +2926,6 @@ NullImporter_init(NullImporter *self, PyObject *args, PyObject *kwds) return -1; } } -#else - if (object_exists(path)) { - /* it exists */ - if (isdir(path)) { - /* it's a directory */ - PyErr_SetString(PyExc_ImportError, - "existing directory"); - return -1; - } - } -#endif } return 0; } diff --git a/Python/sysmodule.c b/Python/sysmodule.c index 245d22a..542e624 100644 --- a/Python/sysmodule.c +++ b/Python/sysmodule.c @@ -1290,11 +1290,7 @@ PySys_SetArgv(int argc, char **argv) p = strrchr(argv0, SEP); } if (p != NULL) { -#ifndef RISCOS n = p + 1 - argv0; -#else /* don't include trailing separator */ - n = p - argv0; -#endif /* RISCOS */ #if SEP == '/' /* Special case for Unix filename syntax */ if (n > 1) n--; /* Drop trailing separator */ diff --git a/README b/README index ef9f452..0b78129 100644 --- a/README +++ b/README @@ -1248,7 +1248,6 @@ PCbuild/ Build directory for Microsoft Visual C++ Parser/ The parser and tokenizer and their input handling Python/ The byte-compiler and interpreter README The file you're reading now -RISCOS/ Files specific to RISC OS port Tools/ Some useful programs written in Python pyconfig.h.in Source from which pyconfig.h is created (GNU autoheader output) configure Configuration shell script (GNU autoconf output) diff --git a/RISCOS/Makefile b/RISCOS/Makefile deleted file mode 100644 index c0250f5..0000000 --- a/RISCOS/Makefile +++ /dev/null @@ -1,445 +0,0 @@ -# RISC OS Python -LIBSROOT = $.AcornC_C++.Libraries - -# You may need to change some of the following -OSLIB = $(LIBSROOT).OSLib -CLIB = $(LIBSROOT).clib -TCPIPLIB = $(LIBSROOT).TCPIPLibs -DLKLIB = $(LIBSROOT).dlk -ZLIB = $(LIBSROOT).zlib -BZLIB = $(LIBSROOT).bzlib -EXPAT = $(LIBSROOT).expat.lib - -OBJSCAN = $(DLKLIB).objscan -MAKEDLK = $(DLKLIB).makedlk - -# change from time to time (don't forget to change !Boot also) -TARGET=Python23 -BUILD=40 - - -# -# You shouldn't need to change anything below this line -# -DLKFLAG= -DDLK -DLKOBJS = $(DLKLIB).o.dlk_load @.o.linktab - -HEADERS = @,$(TCPIPLIB),@.^.Include,@.^.Modules,@.^.Objects,@.^.Python,$(CLIB),$(OSLIB),$(DLKLIB) - -CFLAGS = -c $(DLKFLAG) -DRISCOS -DHAVE_CONFIG_H -wadP -throwback -APCS 3/32bit/fpe3 - -CC = cc $(CFLAGS) -j$(HEADERS) -CCEXPAT = cc $(CFLAGS) -j$(HEADERS),$(EXPAT) -DHAVE_EXPAT_H - -LINK = link -LINKFLAGS = -aif #-NOUNUSED #-d -LOADLIBS = $(TCPIPLIB).o.unixlib $(TCPIPLIB).o.inetlib $(TCPIPLIB).o.socklib $(CLIB).o.Stubs $(OSLIB).o.OSLib32 $(DLKOBJS) - -LIBFILE = libfile -c - - -.c.o : - $(CC) -o $@ $*.c - -MAIN_PYTHON =\ - @.^.Modules.o.python - -LIB_PYTHON =\ - @.^.LibPython - -# code for main Python binary -MODULES_STATIC =\ - @.^.Modules.o.main\ - @.Modules.o.config\ - @.^.Modules.o.getbuildinfo\ - @.Modules.o.getpath_riscos\ - @.Modules.o.riscosmodule\ - @.^.Modules.o.gcmodule - - -# dynamic Modules -MODULES_DYNAMIC =\ - @.^.Lib.array/pyd\ - @.^.Lib.audioop/pyd\ - @.^.Lib.binascii/pyd\ - @.^.Lib.bz2/pyd\ - @.^.Lib.cmath/pyd\ - @.^.Lib.cPickle/pyd\ - @.^.Lib.cStringIO/pyd\ - @.^.Lib.datetime/pyd\ - @.^.Lib.errno/pyd\ - @.^.Lib.imageop/pyd\ - @.^.Lib.itertools/pyd\ - @.^.Lib.math/pyd\ - @.^.Lib.md5/pyd\ - @.^.Lib.operator/pyd\ - @.^.Lib.parser/pyd\ - @.^.Lib.rgbimg/pyd\ - @.^.Lib.sha/pyd\ - @.^.Lib.signal/pyd\ - @.^.Lib.struct/pyd\ - @.^.Lib.time/pyd\ - @.^.Lib._locale/pyd\ - @.^.Lib.zlib/pyd\ - @.^.Lib.select/pyd\ - @.^.Lib._socket/pyd\ - @.^.Lib._codecs/pyd\ - @.^.Lib._weakref/pyd\ - @.^.Lib._testcapi/pyd\ - @.^.Lib.unicodedata/pyd\ - @.^.Lib.pyexpat/pyd\ - @.^.Lib.plat-riscos.drawf/pyd\ - @.^.Lib.plat-riscos.swi/pyd\ - @.^.Lib._sre/pyd\ - @.^.Lib.xxsubtype/pyd\ - @.^.Lib._symtable/pyd\ - @.^.Lib._random/pyd\ - @.^.Lib.zipimport/pyd\ - @.^.Lib._csv/pyd - - -OBJECTS_PYTHON =\ - @.^.Python.o.traceback\ - @.^.Python.o.sysmodule\ - @.^.Python.o.structmember\ - @.^.Python.o.strdup\ - @.^.Python.o.sigcheck\ - @.^.Python.o.pythonrun\ - @.^.Python.o.pystate\ - @.^.Python.o.pyfpe\ - @.^.Python.o.mystrtoul\ - @.^.Python.o.mysnprintf\ - @.^.Python.o.modsupport\ - @.^.Python.o.marshal\ - @.^.Python.o.importdl\ - @.^.Python.o.import\ - @.^.Python.o.graminit\ - @.^.Python.o.getversion\ - @.^.Python.o.getplatform\ - @.^.Python.o.getopt\ - @.^.Python.o.getcopyright\ - @.^.Python.o.getcompiler\ - @.^.Python.o.getargs\ - @.^.Python.o.frozenmain\ - @.^.Python.o.frozen\ - @.^.Python.o.errors\ - @.^.Python.o.compile\ - @.^.Python.o.ceval\ - @.^.Python.o.bltinmodule\ - @.^.Python.o.exceptions\ - @.^.Python.o.codecs\ - @.^.Python.o.symtable\ - @.^.Python.o.future - - -OBJECTS_RISCOS = \ - @.Python.o.dynload_riscos\ - @.Python.o.getcwd_riscos\ - @.Python.o.getmtime_riscos\ - @.o.unixstuff - - -OBJECTS_OBJECTS =\ - @.^.Objects.o.typeobject\ - @.^.Objects.o.tupleobject\ - @.^.Objects.o.stringobject\ - @.^.Objects.o.sliceobject\ - @.^.Objects.o.rangeobject\ - @.^.Objects.o.object\ - @.^.Objects.o.obmalloc\ - @.^.Objects.o.moduleobject\ - @.^.Objects.o.methodobject\ - @.^.Objects.o.longobject\ - @.^.Objects.o.listobject\ - @.^.Objects.o.boolobject\ - @.^.Objects.o.iterobject\ - @.^.Objects.o.funcobject\ - @.^.Objects.o.frameobject\ - @.^.Objects.o.floatobject\ - @.^.Objects.o.fileobject\ - @.^.Objects.o.enumobject\ - @.^.Objects.o.dictobject\ - @.^.Objects.o.complexobject\ - @.^.Objects.o.cobject\ - @.^.Objects.o.classobject\ - @.^.Objects.o.cellobject\ - @.^.Objects.o.bufferobject\ - @.^.Objects.o.abstract\ - @.^.Objects.o.unicodectype\ - @.^.Objects.o.unicodeobject\ - @.^.Objects.o.descrobject\ - @.^.Objects.o.weakrefobject\ - @.^.Objects.o.structseq - - -OBJECTS_PARSER =\ - @.^.Parser.o.tokenizer\ - @.^.Parser.o.printgrammar\ - @.^.Parser.o.parsetok\ - @.^.Parser.o.parser\ - @.^.Parser.o.node\ - @.^.Parser.o.myreadline\ - @.^.Parser.o.metagrammar\ - @.^.Parser.o.listnode\ - @.^.Parser.o.intrcheck\ - @.^.Parser.o.grammar1\ - @.^.Parser.o.grammar\ - @.^.Parser.o.firstsets\ - @.^.Parser.o.bitset\ - @.^.Parser.o.acceler - -SUPPORT_FILES = @.^.!Boot @.^.!Run @.^.!Sprites @.^.!Sprites22 @.^.AddToPath - -OBJECTS = $(OBJECTS_PYTHON) $(OBJECTS_PARSER) $(MODULES_STATIC) $(OBJECTS_OBJECTS) $(OBJECTS_RISCOS) - - -all: @.^.$(TARGET) $(MODULES_DYNAMIC) $(SUPPORT_FILES) - -@.^.Modules.o.getbuildinfo: @.^.Modules.c.getbuildinfo - $(CC) -DBUILD=$(BUILD) -o @.^.Modules.o.getbuildinfo @.^.Modules.c.getbuildinfo - - -$(LIB_PYTHON): $(OBJECTS) - $(LIBFILE) $(LIB_PYTHON) $(OBJECTS) - -@.^.$(TARGET): o.linktab $(MAIN_PYTHON) $(LIB_PYTHON) - $(LINK) -o @.^.$(TARGET) $(MAIN_PYTHON) @.^.LibPython $(LOADLIBS) - - -######################################################################### -# RISC OS support files -# -@.^.!Boot: support.!Boot - copy support.!Boot @.^.!Boot ~C~VF - settype @.^.!Boot feb -@.^.!Run: support.!Run - copy support.!Run @.^.!Run ~C~VF - settype @.^.!Run feb -@.^.!Sprites: support.!Sprites - copy support.!Sprites @.^.!Sprites ~C~VF - settype @.^.!Sprites ff9 -@.^.!Sprites22: support.!Sprites22 - copy support.!Sprites22 @.^.!Sprites22 ~C~VF - settype @.^.!Sprites22 ff9 -@.^.AddToPath: support.AddToPath - copy support.AddToPath @.^.AddToPath ~C~VF - settype @.^.AddToPath ffc - - -######################################################################### -# Dynamic Modules -# -@.^.Lib.array/pyd: @.^.Modules.o.arraymodule s.linktab - $(MAKEDLK) -d @.^.Lib.array/pyd -s s.linktab -o @.^.Modules.o.arraymodule -e initarray - -@.^.Lib.audioop/pyd: @.^.Modules.o.audioop # s.linktab - $(MAKEDLK) -d @.^.Lib.audioop/pyd -s s.linktab -o @.^.Modules.o.audioop -e initaudioop - -@.^.Lib.binascii/pyd: @.^.Modules.o.binascii s.linktab - $(MAKEDLK) -d @.^.Lib.binascii/pyd -s s.linktab -o @.^.Modules.o.binascii -e initbinascii - -@.^.Lib.cmath/pyd: @.^.Modules.o.cmathmodule s.linktab - $(MAKEDLK) -d @.^.Lib.cmath/pyd -s s.linktab -o @.^.Modules.o.cmathmodule -e initcmath - -@.^.Lib.cPickle/pyd: @.^.Modules.o.cPickle s.linktab - $(MAKEDLK) -d @.^.Lib.cPickle/pyd -s s.linktab -o @.^.Modules.o.cPickle -e initcPickle - -@.^.Lib.cStringIO/pyd: @.^.Modules.o.cStringIO s.linktab - $(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 - $(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 - -@.^.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 - $(MAKEDLK) -d @.^.Lib.errno/pyd -s s.linktab -o @.^.Modules.o.errnomodule -e initerrno - -@.^.Lib.imageop/pyd: @.^.Modules.o.imageop s.linktab - $(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 - $(MAKEDLK) -d @.^.Lib.math/pyd -s s.linktab -o @.^.Modules.o.mathmodule -e initmath - -@.^.Lib.mmap/pyd: @.^.Modules.o.mmapmodule s.linktab - $(MAKEDLK) -d @.^.Lib.mmap/pyd -s s.linktab -o @.^.Modules.o.mmapmodule -e initmmap - -@.^.Lib.md5/pyd: @.^.Modules.o.md5c @.^.Modules.o.md5module s.linktab - $(LINK) -aof -o @.^.Modules.o.md5link @.^.Modules.o.md5c @.^.Modules.o.md5module - $(MAKEDLK) -d @.^.Lib.md5/pyd -s s.linktab -o @.^.Modules.o.md5link -e initmd5 - -@.^.Lib.operator/pyd: @.^.Modules.o.operator s.linktab - $(MAKEDLK) -d @.^.Lib.operator/pyd -s s.linktab -o @.^.Modules.o.operator -e initoperator - -@.^.Lib.parser/pyd: @.^.Modules.o.parsermodule s.linktab - $(MAKEDLK) -d @.^.Lib.parser/pyd -s s.linktab -o @.^.Modules.o.parsermodule -e initparser - -@.^.Lib.rgbimg/pyd: @.^.Modules.o.rgbimgmodule s.linktab - $(MAKEDLK) -d @.^.Lib.rgbimg/pyd -s s.linktab -o @.^.Modules.o.rgbimgmodule -e initrgbimg - -@.^.Lib.sha/pyd: @.^.Modules.o.shamodule s.linktab - $(MAKEDLK) -d @.^.Lib.sha/pyd -s s.linktab -o @.^.Modules.o.shamodule -e initsha - -@.^.Lib.signal/pyd: @.^.Modules.o.signalmodule s.linktab - $(MAKEDLK) -d @.^.Lib.signal/pyd -s s.linktab -o @.^.Modules.o.signalmodule -e initsignal - -@.^.Lib.struct/pyd: @.^.Modules.o.structmodule s.linktab - $(MAKEDLK) -d @.^.Lib.struct/pyd -s s.linktab -o @.^.Modules.o.structmodule -e initstruct - -@.^.Lib.plat-riscos.swi/pyd: Modules.o.swimodule s.linktab - $(LINK) -aof -o Modules.o.swilink Modules.o.swimodule $(OSLIB).o.OSLIB32 - $(MAKEDLK) -d @.^.Lib.plat-riscos.swi/pyd -s s.linktab -o Modules.o.swilink -e initswi - -@.^.Lib._locale/pyd: @.^.Modules.o._localemodule s.linktab - $(MAKEDLK) -d @.^.Lib._locale/pyd -s s.linktab -o @.^.Modules.o._localemodule -e init_locale - -@.^.Lib._sre/pyd: @.^.Modules.o._sre s.linktab - $(MAKEDLK) -d @.^.Lib._sre/pyd -s s.linktab -o @.^.Modules.o._sre -e init_sre - -@.^.Lib._codecs/pyd: @.^.Modules.o._codecsmodule s.linktab - $(MAKEDLK) -d @.^.Lib._codecs/pyd -s s.linktab -o @.^.Modules.o._codecsmodule -e init_codecs - -@.^.Lib._weakref/pyd: @.^.Modules.o._weakref s.linktab - $(MAKEDLK) -d @.^.Lib._weakref/pyd -s s.linktab -o @.^.Modules.o._weakref -e init_weakref - -@.^.Lib._testcapi/pyd: @.^.Modules.o._testcapimodule s.linktab - $(MAKEDLK) -d @.^.Lib._testcapi/pyd -s s.linktab -o @.^.Modules.o._testcapimodule -e init_testcapi - -@.^.Lib.unicodedata/pyd: @.^.Modules.o.unicodedata s.linktab - $(MAKEDLK) -d @.^.Lib.unicodedata/pyd -s s.linktab -o @.^.Modules.o.unicodedata -e initunicodedata - -@.^.Lib.xxsubtype/pyd: @.^.Modules.o.xxsubtype s.linktab - $(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 - $(MAKEDLK) -d @.^.Lib._symtable/pyd -s s.linktab -o @.^.Modules.o.symtablemodule -e init_symtable - - -############################################################################ -# Dynamic Modules with other dependencies -# -@.^.Lib.select/pyd: @.^.Modules.o.selectmodule s.linktab - $(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 - -@.^.Modules.o.selectmodule: @.^.Modules.c.selectmodule - $(CC) -I$(TCPIPLIB).include -o $@ @.^.Modules.c.selectmodule - -@.^.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.socklib5 - $(MAKEDLK) -d @.^.Lib._socket/pyd -s s.linktab -o @.^.Modules.o._socketlink -e init_socket - -@.^.Modules.o.socketmodule: @.^.Modules.c.socketmodule - $(CC) -I$(TCPIPLIB).include -o $@ @.^.Modules.c.socketmodule - - -@.^.Lib.zlib/pyd: @.^.Modules.o.zlibmodule s.linktab - $(LINK) -aof -o @.^.Modules.o.zliblink @.^.Modules.o.zlibmodule $(ZLIB).zlib - $(MAKEDLK) -d @.^.Lib.zlib/pyd -s s.linktab -o @.^.Modules.o.zliblink -e initzlib - -@.^.Modules.o.zlibmodule: @.^.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 - $(LINK) -aof -o @.^.Modules.o.timelink @.^.Modules.o.timemodule @.o.sleep $(OSLIB).o.OSLib32 - $(MAKEDLK) -d @.^.Lib.time/pyd -s s.linktab -o @.^.Modules.o.timelink -e inittime - -#@.^.Lib.time/pyd: @.Modules.o.timemodule s.linktab -# $(LINK) -aof -o @.Modules.o.timelink @.Modules.o.timemodule $(OSLIB).o.OSLib32 -# $(MAKEDLK) -d @.^.Lib.time/pyd -s s.linktab -o @.Modules.o.timelink -e inittime - - -@.^.Lib.pyexpat/pyd: @.^.Modules.o.pyexpat s.linktab - $(LINK) -aof -o @.^.Modules.o.pyexpatlink @.^.Modules.o.pyexpat $(EXPAT).expat_lib - $(MAKEDLK) -d @.^.Lib.pyexpat/pyd -s s.linktab -o @.^.Modules.o.pyexpatlink -e initpyexpat - -@.^.Modules.o.pyexpat: @.^.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 -# -o.linktab: s.linktab - ObjAsm -APCS 3/32bit s.linktab o.linktab - -s.linktab: $(OBJECTS) - $(OBJSCAN) -s s.linktab -o $(OBJECTS) $(clib).o.stubs - -########################################################################## -# special targets -# -libclean: - -wipe @.^.Lib.*/pyc ~C~V - -wipe @.^.Lib.*/pyo ~C~V - -wipe @.^.Lib.plat-riscos.*/pyc ~C~V - -wipe @.^.Lib.plat-riscos.*/pyo ~C~V - -wipe @.^.Lib.test.*/pyc ~C~V - -wipe @.^.Lib.test.*/pyo ~C~V - -wipe @.^.Lib.encodings.*/pyc ~C~V - -wipe @.^.Lib.encodings.*/pyo ~C~V - -wipe @.^.Lib.curses.*/pyc ~C~V - -wipe @.^.Lib.curses.*/pyo ~C~V - -wipe @.^.Lib.xml.*/pyc ~C~V - -wipe @.^.Lib.xml.*/pyo ~C~V - -wipe @.^.Lib.xml.sax.*/pyc ~C~V - -wipe @.^.Lib.xml.sax.*/pyo ~C~V - -wipe @.^.Lib.xml.dom.*/pyc ~C~V - -wipe @.^.Lib.xml.dom.*/pyo ~C~V - -wipe @.^.Lib.xml.parsers.*/pyc ~C~V - -wipe @.^.Lib.xml.parsers.*/pyo ~C~V - -clean: libclean - -wipe @.^.Modules.o.* ~C~V - -wipe @.^.Objects.o.* ~C~V - -wipe @.^.Parser.o.* ~C~V - -wipe @.^.Python.o.* ~C~V - -wipe @.Modules.o.* ~C~V - -wipe @.Python.o.* ~C~V - -wipe @.o.* ~C ~V - -rebuild: clean clean-support - remove @.^.$(TARGET) - -wipe @.^.Lib.*/pyd ~C ~V - -wipe @.^.Lib.plat-riscos.*/pyd ~C~V - remove s.linktab - remove @.^.LibPython - -clean-support: - -wipe @.^.!* ~C~V - remove @.^.AddToPath - -cdirs: - cdir @.Modules.o - cdir @.Python.o - cdir @.s - cdir @.o - cdir @.^.Python.o - cdir @.^.Parser.o - cdir @.^.Objects.o - cdir @.^.Modules.o - - -# Dynamic dependencies: diff --git a/RISCOS/Modules/config.c b/RISCOS/Modules/config.c deleted file mode 100644 index d4ef205..0000000 --- a/RISCOS/Modules/config.c +++ /dev/null @@ -1,72 +0,0 @@ -/* -*- C -*- *********************************************** -Copyright 1991-1995 by Stichting Mathematisch Centrum, Amsterdam, -The Netherlands. - - All Rights Reserved - -Permission to use, copy, modify, and distribute this software and its -documentation for any purpose and without fee is hereby granted, -provided that the above copyright notice appear in all copies and that -both that copyright notice and this permission notice appear in -supporting documentation, and that the names of Stichting Mathematisch -Centrum or CWI or Corporation for National Research Initiatives or -CNRI not be used in advertising or publicity pertaining to -distribution of the software without specific, written prior -permission. - -While CWI is the initial source for this software, a modified version -is made available by the Corporation for National Research Initiatives -(CNRI) at the Internet address ftp://ftp.python.org. - -STICHTING MATHEMATISCH CENTRUM AND CNRI DISCLAIM ALL WARRANTIES WITH -REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL STICHTING MATHEMATISCH -CENTRUM OR CNRI BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL -DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR -PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER -TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR -PERFORMANCE OF THIS SOFTWARE. - -******************************************************************/ - -/* Module configuration */ - -/* !!! !!! !!! This file is edited by the makesetup script !!! !!! !!! */ - -/* This file contains the table of built-in modules. - See init_builtin() in import.c. */ - -#include "Python.h" - - -/* -- ADDMODULE MARKER 1 -- */ - -extern void PyMarshal_Init(void); -extern void initimp(void); -extern void initgc(void); -extern void initriscos(void); -extern void initswi(void); - -struct _inittab _PyImport_Inittab[] = { - - {"riscos", initriscos}, - -/* -- ADDMODULE MARKER 2 -- */ - - /* This module "lives in" with marshal.c */ - {"marshal", PyMarshal_Init}, - - /* This lives it with import.c */ - {"imp", initimp}, - - /* These entries are here for sys.builtin_module_names */ - {"__main__", NULL}, - {"__builtin__", NULL}, - {"sys", NULL}, - - /* This lives in gcmodule.c */ - {"gc", initgc}, - - /* Sentinel */ - {0, 0} -}; diff --git a/RISCOS/Modules/drawfmodule.c b/RISCOS/Modules/drawfmodule.c deleted file mode 100644 index 5f8dc3e..0000000 --- a/RISCOS/Modules/drawfmodule.c +++ /dev/null @@ -1,664 +0,0 @@ -/* drawf DrawFile functions */ - -#include "oslib/os.h" -#include "oslib/osfile.h" -#include "oslib/drawfile.h" -#include "Python.h" - -#include - -#define PyDrawF_Check(op) ((op)->ob_type == &PyDrawFType) -#define HDRSIZE 40 -#define GRPHDRSIZE 36 -#define DRAWTYPE 0xaff -#define NEXT(d) ((drawfile_object*)((char*)(d)+(d)->size)) - -typedef struct -{ PyObject_HEAD - drawfile_diagram *drawf; - int size; /*length in bytes*/ - int nobjs; /* no of objects */ -} PyDrawFObject; - -typedef struct dheader -{ char tag [4]; - int major_version; - int minor_version; - char source [12]; - os_box bbox; -} dheader; - -static PyObject *DrawFError; /* Exception drawf.error */ -static os_error *e; -static PyTypeObject PyDrawFType; - -static dheader header= -{ {'D','r','a','w'}, - 201,0, - {'P','y','t','h','o','n',' ',' ',' ',' ',' ',' '}, - {INT_MAX,INT_MAX,INT_MIN,INT_MIN} -}; - -static PyObject *drawf_oserror(void) -{ PyErr_SetString(DrawFError,e->errmess); - return 0; -} - -static PyObject *drawf_error(char *s) -{ PyErr_SetString(DrawFError,s); - return 0; -} - -/* DrawFile commands */ - -static void countobjs(PyDrawFObject *pd) -{ int k=0,q; - drawfile_diagram *dd=pd->drawf; - drawfile_object *d=dd->objects; - char *end=(char*)dd+pd->size; - pd->nobjs=-1; - while((char*)dsize; - if(q<=0||q&3) return ; - d=NEXT(d); - } - if ((char*)d==end) pd->nobjs=k; -} - -static drawfile_object *findobj(PyDrawFObject *pd,Py_ssize_t n) -{ drawfile_diagram *dd=pd->drawf; - drawfile_object *d=dd->objects; - for(;n>0;n--) d=NEXT(d); - return d; -} - -static PyDrawFObject* new(int size) -{ PyDrawFObject *b=PyObject_NEW(PyDrawFObject,&PyDrawFType); - if(!b) return NULL; - size+=HDRSIZE; - b->drawf=malloc(size); - if(!b->drawf) - { Py_DECREF(b); - return (PyDrawFObject*)PyErr_NoMemory(); - } - b->size=size; - return b; -} - -static void extend(os_box *b,os_box *c) -{ if(b->x0>c->x0) b->x0=c->x0; - if(b->y0>c->y0) b->y0=c->y0; - if(b->x1x1) b->x1=c->x1; - if(b->y1y1) b->y1=c->y1; -} - -static PyObject *DrawF_New(PyObject *self,PyObject *args) -{ PyDrawFObject *b; - if(!PyArg_ParseTuple(args,"")) return NULL; - b=new(0); - if(!b) return NULL; - *((dheader*)b->drawf)=header; - b->nobjs=0; - return (PyObject *)b; -} - -static PyObject *DrawF_Load(PyObject *self,PyObject *args) -{ int size; - char *fname; - PyDrawFObject *b; - fileswitch_object_type ot; - if(!PyArg_ParseTuple(args,"s",&fname)) return NULL; - e=xosfile_read_no_path(fname,&ot,0,0,&size,0); - if(e) return drawf_oserror(); - size-=HDRSIZE; - if(ot!=osfile_IS_FILE||size<0||size&3) return drawf_error("Bad draw file"); - b=new(size); - if(!b) return NULL; - e=xosfile_load_stamped_no_path(fname,(byte*)(b->drawf),0,0,0,0,0); - if(e) - { Py_DECREF(b); - return drawf_oserror(); - } - countobjs(b); - if(b->nobjs>=0) return (PyObject *)b; - Py_DECREF(b); - return drawf_error("Corrupt draw file"); -} - - -static PyObject *DrawF_Save(PyDrawFObject *self,PyObject *arg) -{ char *fname; - if(!PyArg_ParseTuple(arg,"s",&fname)) return NULL; - e=xosfile_save_stamped(fname,DRAWTYPE, - (byte*)(self->drawf),(byte*)(self->drawf)+self->size); - if (e) return drawf_oserror(); - Py_INCREF(Py_None);return Py_None; -} - -static PyObject *DrawF_Render(PyDrawFObject *self,PyObject *arg) -{ int flags,trans,clip,flat; - if(!PyArg_ParseTuple(arg,"iiii",&flags,&trans,&clip,&flat)) return NULL; - e=xdrawfile_render((drawfile_render_flags)flags,self->drawf,self->size, - (os_trfm*)trans,(os_box*)clip,flat); - if(e) return drawf_oserror(); - Py_INCREF(Py_None);return Py_None; -} - -static PyObject *DrawF_Path(PyDrawFObject *self,PyObject *arg) -{ PyObject *pl; - PyObject *dp=0; - os_colour fill; - os_colour outline; - int width,start=0; - drawfile_path_style style; - int size=40; - int n,i,element_count; - drawfile_diagram *diag; - drawfile_object *dobj; - drawfile_path *dpath; - draw_path *thepath; - draw_line_style line_style; - draw_dash_pattern *dash_pattern=0; - os_box *box; - long *pe; - if(!PyArg_ParseTuple(arg,"O!(iiii)|O!i",&PyList_Type,&pl,(int*)&fill, - (int*)&outline,&width,(int*)&style,&PyTuple_Type,&dp,&start)) return NULL; - if(dp) - { element_count=PyTuple_Size(dp); - size+=4*element_count+8; - style.flags|=drawfile_PATH_DASHED; - } - else style.flags&=~drawfile_PATH_DASHED; - n=PyList_Size(pl); - size+=4*n+8; - for(i=0;idrawf,self->size+size); - if(!diag) return PyErr_NoMemory(); - self->drawf=diag; - dobj=(drawfile_object*)((char*)diag+self->size); - dobj->type=drawfile_TYPE_PATH; - dobj->size=size; - dpath=&dobj->data.path; - self->size+=size; - self->nobjs++; - box=&dpath->bbox; - dpath->fill=fill;dpath->outline=outline; - dpath->width=width;dpath->style=style; - pe=(long*)&(dpath->path); - if(dp) - { dash_pattern=&(((drawfile_path_with_pattern*)dpath)->pattern); - dash_pattern->start=start; - dash_pattern->element_count=element_count; - for(i=0;ielements[i]=(int)PyInt_AsLong(PyTuple_GetItem(dp,i)); - } - pe+=element_count+2; - } - thepath=(draw_path*)pe; - *pe++=draw_MOVE_TO; - for(i=0;i>2; - line_style.start_cap_style=(style.flags&3)>>4; - line_style.reserved=0; - line_style.mitre_limit=10; - line_style.start_cap_width=style.cap_width; - line_style.end_cap_width=style.cap_width; - line_style.start_cap_length=style.cap_length; - line_style.end_cap_length=style.cap_length; - e=xdraw_process_path(thepath,0x70000000,0,0,width,&line_style,dash_pattern, - (draw_output_path)((char*)box+0x80000000),0); - if(e) return drawf_oserror(); - - /* draw_process_path seems to have a bug: - If the bounding box size is zero, it returns 0x7FFFFFFF, ..., 0x80000000 instead of the - correct size. */ - if (box->x0==0x7FFFFFFF) - { - /* path has zero extension, so forget it; it would be invisible anyway */ - self->size-=size; - self->nobjs--; - diag=realloc(self->drawf,self->size); - if(!diag) return PyErr_NoMemory(); - self->drawf=diag; - } - else - extend(&(diag->bbox),box); - Py_INCREF(Py_None);return Py_None; -} - -static PyObject *DrawF_Text(PyDrawFObject *self,PyObject *arg) -{ os_colour fill,bg_hint; - drawfile_text_style style; - int xsize,ysize,x,y; - int size,len; - char *text; - drawfile_diagram *diag; - drawfile_object *dobj; - drawfile_text *dtext; - os_box *box; - if(!PyArg_ParseTuple(arg,"(ii)s(iiiii)",&x,&y,&text, - (int*)&fill,(int*)&bg_hint,(int*)&style,&xsize,&ysize)) return NULL; - len=strlen(text); - size=((len+4)&(~3))+52; - diag=realloc(self->drawf,self->size+size); - if(!diag) return PyErr_NoMemory(); - self->drawf=diag; - dobj=(drawfile_object*)((char*)diag+self->size); - dobj->type=drawfile_TYPE_TEXT; - dobj->size=size; - dtext=&dobj->data.text; - self->size+=size; - self->nobjs++; - dtext->fill=fill; - dtext->bg_hint=bg_hint; - dtext->style=style; - dtext->xsize=xsize; - dtext->ysize=ysize; - dtext->base.x=x; - dtext->base.y=y; - memset(dtext->text,0,(len+4)&(~3)); - sprintf(dtext->text,"%s",text); - box=&(dtext->bbox); - box->x0=x;box->y0=y;box->x1=x+len*xsize;box->y1=y+ysize; - extend(&(diag->bbox),box); - Py_INCREF(Py_None);return Py_None; -} - -static PyObject *DrawF_TText(PyDrawFObject *self,PyObject *arg) -{ os_colour fill,bg_hint; - drawfile_text_style style; - int xsize,ysize,x,y; - int t1,t2,t3,t4,t5,t6; - int size,len; - char *text; - drawfile_diagram *diag; - drawfile_object *dobj; - drawfile_trfm_text *dtext; - os_box *box; - t1=1<<16;t2=0; - t3=0;t4=1<<16; - t5=t6=0; - if(!PyArg_ParseTuple(arg,"(ii)s(iiiii)|(iiiiii)",&x,&y,&text, - (int*)&fill,(int*)&bg_hint,(int*)&style,&xsize,&ysize,&t1,&t2,&t3,&t4,&t5,&t6)) return NULL; - len=strlen(text); - size=((len+4)&(~3))+52+28; - diag=realloc(self->drawf,self->size+size); - if(!diag) return PyErr_NoMemory(); - self->drawf=diag; - dobj=(drawfile_object*)((char*)diag+self->size); - dobj->type=drawfile_TYPE_TRFM_TEXT; - dobj->size=size; - dtext=&dobj->data.trfm_text; - self->size+=size; - self->nobjs++; - dtext->trfm.entries[0][0]=t1; - dtext->trfm.entries[0][1]=t2; - dtext->trfm.entries[1][0]=t3; - dtext->trfm.entries[1][1]=t4; - dtext->trfm.entries[2][0]=t5; - dtext->trfm.entries[2][1]=t6; - dtext->flags=0; - dtext->fill=fill; - dtext->bg_hint=bg_hint; - dtext->style=style; - dtext->xsize=xsize; - dtext->ysize=ysize; - dtext->base.x=x; - dtext->base.y=y; - memset(dtext->text,0,(len+4)&(~3)); - sprintf(dtext->text,"%s",text); - box=&(dtext->bbox); - box->x0=x;box->y0=y;box->x1=x+len*xsize;box->y1=y+ysize; - extend(&(diag->bbox),box); - Py_INCREF(Py_None);return Py_None; -} - -static PyObject *DrawF_FontTable(PyDrawFObject *self,PyObject *arg) -{ int size=8,n=0; - PyObject *d,*key,*value; - drawfile_diagram *diag; - drawfile_object *dobj; - char *dtable; - if(!PyArg_ParseTuple(arg,"O!",&PyDict_Type,&d)) return NULL; - while(PyDict_Next(d,&n,&key,&value)) - { int m=PyString_Size(value); - if(m<0||!PyInt_Check(key)) return NULL; - size+=m+2; - } - size=(size+3)&(~3); - diag=realloc(self->drawf,self->size+size); - if(!diag) return PyErr_NoMemory(); - self->drawf=diag; - dobj=(drawfile_object*)((char*)diag+self->size); - dobj->type=drawfile_TYPE_FONT_TABLE; - dobj->size=size; - dtable=(char*)(&dobj->data.font_table); - self->size+=size; - self->nobjs++; - memset(dtable,0,size-8); - n=0; - while(PyDict_Next(d,&n,&key,&value)) - { int m=PyString_Size(value); - *dtable=(char)PyInt_AsLong(key); - strcpy(dtable+1,PyString_AsString(value)); - dtable+=m+2; - } - Py_INCREF(Py_None);return Py_None; -} - -static PyObject *DrawF_Group(PyDrawFObject *self,PyObject *arg) -{ int size,n; - PyDrawFObject *g; - char *name=""; - drawfile_diagram *diag; - drawfile_object *dobj; - drawfile_group *dgroup; - if(!PyArg_ParseTuple(arg,"O!|s",&PyDrawFType,(PyObject*)&g,&name)) - return NULL; - size=g->size-4; - diag=realloc(self->drawf,self->size+size); - if(!diag) return PyErr_NoMemory(); - self->drawf=diag; - self->nobjs++; - dobj=(drawfile_object*)((char*)diag+self->size); - self->size+=size; - dobj->type=drawfile_TYPE_GROUP; - dobj->size=g->size-4; - dgroup=&dobj->data.group; - dgroup->bbox=g->drawf->bbox; - memset(dgroup->name,' ',12); - n=strlen(name); - if(n>12) n=12; - memcpy(dgroup->name,name,n); - memcpy((char*)dgroup->objects,(char*)g->drawf+40,g->size-40); - extend(&(diag->bbox),&(dgroup->bbox)); - Py_INCREF(Py_None);return Py_None; -} - -static PyObject *DrawF_Find(PyDrawFObject *self,PyObject *arg) -{ int x,y,n=0; - int r=-1; - drawfile_object *d; - if(!PyArg_ParseTuple(arg,"ii|i",&x,&y,&n)) return NULL; - if(nnobjs&&n>=0) - { d=findobj(self,n); - while(nnobjs) - { if(x>=d->data.text.bbox.x0&&x<=d->data.text.bbox.x1&& - y>=d->data.text.bbox.y0&&y<=d->data.text.bbox.y1) { r=n;break;} - n++; - d=NEXT(d); - } - } - return PyInt_FromLong(r); -} - - -static PyObject *DrawF_Box(PyDrawFObject *self,PyObject *arg) -{ int n=-1; - os_box *box; - if(!PyArg_ParseTuple(arg,"|i",&n)) return NULL; - if(n>=self->nobjs|n<0) box=&(self->drawf->bbox); - else box=&(findobj(self,n)->data.text.bbox); - return Py_BuildValue("iiii",box->x0,box->y0,box->x1,box->y1); -} - -static void SetBlock(drawfile_object *d,int size,int type,int offset,int value) -{ char *end=(char*)d+size; - printf("s%d t%d o%d v%d\n",size,type,offset,value); - for(;(char*)dtype==type) ((int*)(d))[offset]=value; - else if(d->type==drawfile_TYPE_GROUP) - SetBlock((drawfile_object*)&d->data.group.objects, - d->size,type,offset,value); - printf("SetBlock Done\n"); -} - -static PyObject *SetWord(PyDrawFObject *self,PyObject *arg,int type,int offset) -{ int n=PyTuple_Size(arg); - int m,value,q; - PyObject *par; - drawfile_object *e,*d=self->drawf->objects; - if(n==0) return drawf_error("Value Required"); - par=PyTuple_GetItem(arg,0); - if(!PyInt_Check(par)) - { PyErr_SetString(PyExc_TypeError,"Int Required"); - return 0; - } - value=(int)PyInt_AsLong(par); - if(n==1) SetBlock(d,self->size-HDRSIZE,type,offset,value); - else - { for(m=1;m=self->nobjs) - { PyErr_SetString(PyExc_ValueError,"Object out of range"); - return 0; - } - e=d; - for(;q>0;q--) e=NEXT(e); - if(e->type==type) - { ((int*)(e))[offset]=value; - } - else if(e->type==drawfile_TYPE_GROUP) - SetBlock((drawfile_object*)&e->data.group.objects, - e->size-GRPHDRSIZE,type,offset,value); - } - } - Py_INCREF(Py_None);return Py_None; -} - -static PyObject *DrawF_PathFill(PyDrawFObject *self,PyObject *arg) -{ return SetWord(self,arg,drawfile_TYPE_PATH,6); -} - -static PyObject *DrawF_PathColour(PyDrawFObject *self,PyObject *arg) -{ return SetWord(self,arg,drawfile_TYPE_PATH,7); -} - -static PyObject *DrawF_TextColour(PyDrawFObject *self,PyObject *arg) -{ return SetWord(self,arg,drawfile_TYPE_TEXT,6); -} - -static PyObject *DrawF_TextBackground(PyDrawFObject *self,PyObject *arg) -{ return SetWord(self,arg,drawfile_TYPE_TEXT,7); -} - -static struct PyMethodDef PyDrawF_Methods[]= -{ - { "render",(PyCFunction)DrawF_Render,1}, - { "save",(PyCFunction)DrawF_Save,1}, - { "path",(PyCFunction)DrawF_Path,1}, - { "text",(PyCFunction)DrawF_Text,1}, - { "ttext",(PyCFunction)DrawF_TText,1}, - { "fonttable",(PyCFunction)DrawF_FontTable,1}, - { "group",(PyCFunction)DrawF_Group,1}, - { "find",(PyCFunction)DrawF_Find,1}, - { "box",(PyCFunction)DrawF_Box,1}, - { "pathfill",(PyCFunction)DrawF_PathFill,1}, - { "pathcolour",(PyCFunction)DrawF_PathColour,1}, - { "textcolour",(PyCFunction)DrawF_TextColour,1}, - { "textbackground",(PyCFunction)DrawF_TextBackground,1}, - { NULL,NULL} /* sentinel */ -}; - -static int drawf_len(PyDrawFObject *b) -{ return b->nobjs; -} - -static PyObject *drawf_concat(PyDrawFObject *b,PyDrawFObject *c) -{ int size=b->size+c->size-2*HDRSIZE; - PyDrawFObject *p=new(size); - drawfile_diagram *dd; - drawfile_object *d; - int n; - if(!p) return NULL; - dd=p->drawf; - d=(drawfile_object*)((char*)dd+b->size); - memcpy((char*)dd,(char*)(b->drawf),b->size); - memcpy(d,(char*)(c->drawf)+HDRSIZE,c->size-HDRSIZE); - p->nobjs=b->nobjs+c->nobjs; - for(n=c->nobjs;n>0;n--) - { extend(&(dd->bbox),&(d->data.path.bbox)); - d=NEXT(d); - } - return (PyObject*)p; -} - -static PyObject *drawf_repeat(PyDrawFObject *b,Py_ssize_t i) -{ PyErr_SetString(PyExc_IndexError,"drawf repetition not implemented"); - return NULL; -} - -static PyObject *drawf_item(PyDrawFObject *b,Py_ssize_t i) -{ PyDrawFObject *c; - Py_ssize_t size; - drawfile_diagram *dd; - drawfile_object *d; - if(i<0||i>=b->nobjs) - { PyErr_SetString(PyExc_IndexError,"drawf index out of range"); - return NULL; - } - d=findobj(b,i); - size=(char*)findobj(b,i+1)-(char*)d; - c=new(size); - if(!c) return NULL; - dd=c->drawf; - *((dheader*)dd)=header; - memcpy(dd->objects,d,size); - c->nobjs=1; - extend(&(dd->bbox),&(d->data.path.bbox)); - return (PyObject*)c; -} - -static PyObject *drawf_slice(PyDrawFObject *b,Py_ssize_t i,Py_ssize_t j) -{ PyDrawFObject *c; - Py_ssize_t size,n; - drawfile_diagram *dd; - drawfile_object *d; - if(i<0||j>b->nobjs) - { PyErr_SetString(PyExc_IndexError,"drawf index out of range"); - return NULL; - } - d=findobj(b,i); - size=(char*)findobj(b,j)-(char*)d; - c=new(size); - if(!c) return NULL; - dd=c->drawf; - *((dheader*)dd)=header; - memcpy(dd->objects,d,size); - c->nobjs=j-i; - for(n=j-i;n>0;n--) - { extend(&(dd->bbox),&(d->data.path.bbox)); - d=NEXT(d); - } - return (PyObject*)c; -} - -static int drawf_ass_item(PyDrawFObject *b,Py_ssize_t i,PyObject *v) -{ PyErr_SetString(PyExc_IndexError,"drawf ass not implemented"); - return NULL; -} -/*{ if(i<0||4*i>=b->length) - { PyErr_SetString(PyExc_IndexError,"drawf index out of range"); - return -1; - } - if(!PyInt_Check(v)) - { PyErr_SetString(PyExc_TypeError,"drawf item must be integer"); - return -1; - } - ((long*)(b->drawf))[i]=PyInt_AsLong(v); - return 0; -} -*/ - -static int drawf_ass_slice(PyDrawFObject *b,Py_ssize_t i,Py_ssize_t j,PyObject *v) -{ PyErr_SetString(PyExc_IndexError,"drawf ass_slice not implemented"); - return NULL; -} - -static PySequenceMethods drawf_as_sequence= -{ (inquiry)drawf_len, - (binaryfunc)drawf_concat, - (ssizeargfunc)drawf_repeat, - (ssizeargfunc)drawf_item, - (ssizessizeargfunc)drawf_slice, - (ssizeobjargproc)drawf_ass_item, - (ssizessizeobjargproc)drawf_ass_slice, -}; - -static PyObject *PyDrawF_GetAttr(PyDrawFObject *s,char *name) -{ - if (!strcmp(name, "size")) return PyInt_FromLong((long)s->size); - if (!strcmp(name, "start")) return PyInt_FromLong((long)s->drawf); - if (!strcmp(name, "__members__")) - { PyObject *list = PyList_New(2); - if (list) - { PyList_SetItem(list, 0, PyString_FromString("size")); - PyList_SetItem(list, 1, PyString_FromString("start")); - if (PyErr_Occurred()) { Py_DECREF(list);list = NULL;} - } - return list; - } - return Py_FindMethod(PyDrawF_Methods, (PyObject*) s,name); -} - -static void PyDrawF_Dealloc(PyDrawFObject *b) -{ - if (b->drawf) - ; - else - PyMem_DEL(b->drawf); - PyMem_DEL(b); -} - -static PyTypeObject PyDrawFType= -{ PyObject_HEAD_INIT(&PyType_Type) - 0, /*ob_size*/ - "drawf", /*tp_name*/ - sizeof(PyDrawFObject), /*tp_size*/ - 0, /*tp_itemsize*/ - /* methods */ - (destructor)PyDrawF_Dealloc, /*tp_dealloc*/ - 0, /*tp_print*/ - (getattrfunc)PyDrawF_GetAttr, /*tp_getattr*/ - 0, /*tp_setattr*/ - 0, /*tp_compare*/ - 0, /*tp_repr*/ - 0, /*tp_as_number*/ - &drawf_as_sequence, /*tp_as_sequence*/ - 0, /*tp_as_mapping*/ - 0, /*tp_hash*/ -}; - - - -static PyMethodDef DrawFMethods[]= -{ - { "load",DrawF_Load,1}, - { "new",DrawF_New,1}, - { NULL,NULL} /* Sentinel */ -}; - -void initdrawf() -{ PyObject *m, *d; - m = Py_InitModule("drawf", DrawFMethods); - d = PyModule_GetDict(m); - DrawFError=PyString_FromString("drawf.error"); - PyDict_SetItemString(d,"error",DrawFError); -} diff --git a/RISCOS/Modules/getpath_riscos.c b/RISCOS/Modules/getpath_riscos.c deleted file mode 100644 index ce978c6..0000000 --- a/RISCOS/Modules/getpath_riscos.c +++ /dev/null @@ -1,60 +0,0 @@ -#include "Python.h" -#include "osdefs.h" - -static char *prefix, *exec_prefix, *progpath, *module_search_path=NULL; - -static void -calculate_path() -{ - char *pypath = getenv("Python$Path"); - if (pypath) { - int pathlen = strlen(pypath); - module_search_path = malloc(pathlen + 1); - if (module_search_path) - strncpy(module_search_path, pypath, pathlen + 1); - else { - fprintf(stderr, - "Not enough memory for dynamic PYTHONPATH.\n" - "Using default static PYTHONPATH.\n"); - } - } - if (!module_search_path) - module_search_path = ".Lib"; - prefix = ""; - exec_prefix = prefix; - progpath = Py_GetProgramName(); -} - -/* External interface */ - -char * -Py_GetPath() -{ - if (!module_search_path) - calculate_path(); - return module_search_path; -} - -char * -Py_GetPrefix() -{ - if (!module_search_path) - calculate_path(); - return prefix; -} - -char * -Py_GetExecPrefix() -{ - if (!module_search_path) - calculate_path(); - return exec_prefix; -} - -char * -Py_GetProgramFullPath() -{ - if (!module_search_path) - calculate_path(); - return progpath; -} diff --git a/RISCOS/Modules/riscosmodule.c b/RISCOS/Modules/riscosmodule.c deleted file mode 100644 index 3dabb4d..0000000 --- a/RISCOS/Modules/riscosmodule.c +++ /dev/null @@ -1,603 +0,0 @@ -/* RISCOS module implementation */ - -#include "oslib/osfscontrol.h" -#include "oslib/osgbpb.h" -#include "oslib/os.h" -#include "oslib/osfile.h" -#include "unixstuff.h" - -#include - -#include "Python.h" -#include "structseq.h" - -#include - -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 */ - -static PyObject * -riscos_remove(PyObject *self, PyObject *args) -{ - char *path1; - if (!PyArg_ParseTuple(args, "s:remove", &path1)) return NULL; - if (remove(path1)) return PyErr_SetFromErrno(PyExc_OSError); - Py_INCREF(Py_None); - return Py_None; -} - -static PyObject * -riscos_rename(PyObject *self, PyObject *args) -{ - char *path1, *path2; - if (!PyArg_ParseTuple(args, "ss:rename", &path1, &path2)) - return NULL; - if (rename(path1,path2)) return PyErr_SetFromErrno(PyExc_OSError); - Py_INCREF(Py_None); - return Py_None; -} - -static PyObject * -riscos_system(PyObject *self, PyObject *args) -{ - char *command; - if (!PyArg_ParseTuple(args, "s:system", &command)) return NULL; - return PyInt_FromLong(system(command)); -} - -static PyObject * -riscos_chdir(PyObject *self, PyObject *args) -{ - char *path; - if (!PyArg_ParseTuple(args, "s:chdir", &path)) return NULL; - e=xosfscontrol_dir(path); - if(e) return riscos_oserror(); - Py_INCREF(Py_None); - return Py_None; -} - -static PyObject * -canon(char *path) -{ - int len; - PyObject *obj; - char *buf; - e=xosfscontrol_canonicalise_path(path,0,0,0,0,&len); - if(e) return riscos_oserror(); - obj=PyString_FromStringAndSize(NULL,-len); - if(obj==NULL) return NULL; - buf=PyString_AsString(obj); - e=xosfscontrol_canonicalise_path(path,buf,0,0,1-len,&len); - if(len!=1) return riscos_error("Error expanding path"); - if(!e) return obj; - Py_DECREF(obj); - return riscos_oserror(); -} - -static PyObject * -riscos_getcwd(PyObject *self, PyObject *unused) -{ - return canon("@"); -} - -static PyObject * -riscos_expand(PyObject *self, PyObject *args) -{ - char *path; - if (!PyArg_ParseTuple(args, "s:expand", &path)) return NULL; - return canon(path); -} - -static PyObject * -riscos_mkdir(PyObject *self, PyObject *args) -{ - char *path; - int mode; - if (!PyArg_ParseTuple(args, "s|i:mkdir", &path, &mode)) return NULL; - e=xosfile_create_dir(path,0); - if(e) return riscos_oserror(); - Py_INCREF(Py_None); - return Py_None; -} - -static PyObject * -riscos_listdir(PyObject *self, PyObject *args) -{ - char *path,buf[256]; - PyObject *d, *v; - int c=0,count; - if (!PyArg_ParseTuple(args, "s:listdir", &path)) return NULL; - d=PyList_New(0); - if(!d) return NULL; - for(;;) - { e=xosgbpb_dir_entries(path,(osgbpb_string_list*)buf, - 1,c,256,0,&count,&c); - if(e) - { Py_DECREF(d);return riscos_oserror(); - } - if(count) - { v=PyString_FromString(buf); - if(!v) { Py_DECREF(d);return 0;} - if(PyList_Append(d,v)) {Py_DECREF(d);Py_DECREF(v);return 0;} - } - if(c==-1) break; - } - return d; -} - -PyDoc_STRVAR(stat_result__doc__, -"stat_result: Result from stat or lstat.\n\n\ -This object may be accessed either as a tuple of\n\ - (mode,ino,dev,nlink,uid,gid,size,atime,mtime,ctime)\n\ -or via the attributes st_mode, st_ino, st_dev, st_nlink, st_uid, and so on.\n\ -\n\ -RiscOS: The fields st_ftype, st_attrs, and st_obtype are also available.\n\ -\n\ -See os.stat for more information."); - -static PyStructSequence_Field stat_result_fields[] = { - { "st_mode", "protection bits" }, - { "st_ino", "inode" }, - { "st_dev", "device" }, - { "st_nlink", "number of hard links" }, - { "st_uid", "user ID of owner" }, - { "st_gid", "group ID of owner" }, - { "st_size", "total size, in bytes" }, - { "st_atime", "time of last access" }, - { "st_mtime", "time of last modification" }, - { "st_ctime", "time of last change" }, - { "st_ftype", "file type" }, - { "st_attrs", "attributes" }, - { "st_obtype", "object type" }, - { 0 } -}; - -static PyStructSequence_Desc stat_result_desc = { - "riscos.stat_result", - stat_result__doc__, - stat_result_fields, - 13 -}; - -static PyTypeObject StatResultType; - -static PyObject * -riscos_stat(PyObject *self, PyObject *args) -{ - PyObject *v; - char *path; - int ob,len; - bits t=0; - bits ld,ex,at,ft,mode; - if (!PyArg_ParseTuple(args, "s:stat", &path)) return NULL; - e=xosfile_read_stamped_no_path(path,&ob,&ld,&ex,&len,&at,&ft); - if(e) return riscos_oserror(); - switch (ob) - { case osfile_IS_FILE:mode=0100000;break; /* OCTAL */ - case osfile_IS_DIR:mode=040000;break; - case osfile_IS_IMAGE:mode=0140000;break; - default:return riscos_error("Not found"); - } - if(ft!=-1) t=unixtime(ld,ex); - mode|=(at&7)<<6; - mode|=((at&112)*9)>>4; - - v = PyStructSequence_New(&StatResultType); - - PyStructSequence_SET_ITEM(v, 0, - PyInt_FromLong((long) mode)); /*st_mode*/ - PyStructSequence_SET_ITEM(v, 1, PyInt_FromLong((long) 0)); /*st_ino*/ - PyStructSequence_SET_ITEM(v, 2, PyInt_FromLong((long) 0)); /*st_dev*/ - PyStructSequence_SET_ITEM(v, 3, PyInt_FromLong((long) 0)); /*st_nlink*/ - PyStructSequence_SET_ITEM(v, 4, PyInt_FromLong((long) 0)); /*st_uid*/ - PyStructSequence_SET_ITEM(v, 5, PyInt_FromLong((long) 0)); /*st_gid*/ - PyStructSequence_SET_ITEM(v, 6, - PyInt_FromLong((long) len)); /*st_size*/ - PyStructSequence_SET_ITEM(v, 7, PyInt_FromLong((long) t)); /*st_atime*/ - PyStructSequence_SET_ITEM(v, 8, PyInt_FromLong((long) t)); /*st_mtime*/ - PyStructSequence_SET_ITEM(v, 9, PyInt_FromLong((long) t)); /*st_ctime*/ - PyStructSequence_SET_ITEM(v, 10, - PyInt_FromLong((long) ft)); /*file type*/ - PyStructSequence_SET_ITEM(v, 11, - PyInt_FromLong((long) at)); /*attributes*/ - PyStructSequence_SET_ITEM(v, 12, - PyInt_FromLong((long) ob)); /*object type*/ - - if (PyErr_Occurred()) { - Py_DECREF(v); - return NULL; - } - - return v; -} - -static PyObject * -riscos_chmod(PyObject *self,PyObject *args) -{ - char *path; - bits mode; - bits attr; - attr=(mode&0x700)>>8; - attr|=(mode&7)<<4; - if (!PyArg_ParseTuple(args, "si:chmod", &path,(int*)&mode)) return NULL; - e=xosfile_write_attr(path,attr); - if(e) return riscos_oserror(); - Py_INCREF(Py_None); - return Py_None; -} - - -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; -} - -static PyObject * -riscos_settype(PyObject *self, PyObject *args) -{ - char *path,*name; - int type; - if (!PyArg_ParseTuple(args, "si:settype", &path,&type)) - { - PyErr_Clear(); - if (!PyArg_ParseTuple(args, "ss:settype", &path,&name)) return NULL; - e=xosfscontrol_file_type_from_string(name,(bits*)&type); - if(e) return riscos_oserror(); - } - e=xosfile_set_type(path,type); - if(e) return riscos_oserror(); - Py_INCREF(Py_None); - return Py_None; -} - -static PyObject * -riscos_getenv(PyObject *self, PyObject *args) -{ - char *name,*value; - if(!PyArg_ParseTuple(args,"s:getenv",&name)) return NULL; - value=getenv(name); - if(value) return PyString_FromString(value); - Py_INCREF(Py_None); - return Py_None; -} - -static PyObject * -riscos_putenv(PyObject *self, PyObject *args) -{ - char *name,*value; - int len; - os_var_type type=os_VARTYPE_LITERAL_STRING; - if(!PyArg_ParseTuple(args,"ss|i:putenv",&name,&value,&type)) return NULL; - if(type!=os_VARTYPE_STRING&&type!=os_VARTYPE_MACRO&&type!=os_VARTYPE_EXPANDED - &&type!=os_VARTYPE_LITERAL_STRING) - return riscos_error("Bad putenv type"); - len=strlen(value); - if(type!=os_VARTYPE_LITERAL_STRING) len++; - /* Other types need null terminator! */ - e=xos_set_var_val(name,(byte*)value,len,0,type,0,0); - if(e) return riscos_oserror(); - Py_INCREF(Py_None); - return Py_None; -} - -static PyObject * -riscos_delenv(PyObject *self, PyObject *args) -{ - char *name; - if(!PyArg_ParseTuple(args,"s:delenv",&name)) return NULL; - e=xos_set_var_val(name,NULL,-1,0,0,0,0); - if(e) return riscos_oserror(); - Py_INCREF(Py_None); - return Py_None; -} - -static PyObject * -riscos_getenvdict(PyObject *self, PyObject *args) -{ - PyObject *dict; - char value[257]; - char *which="*"; - int size; - char *context=NULL; - if(!PyArg_ParseTuple(args,"|s:getenvdict",&which)) return NULL; - dict = PyDict_New(); - if (!dict) return NULL; - /* XXX This part ignores errors */ - while(!xos_read_var_val(which,value,sizeof(value)-1,(int)context, - os_VARTYPE_EXPANDED,&size,(int *)&context,0)) - { PyObject *v; - value[size]='\0'; - v = PyString_FromString(value); - if (v == NULL) continue; - PyDict_SetItemString(dict, context, v); - Py_DECREF(v); - } - return dict; -} - -static PyMethodDef riscos_methods[] = { - - {"unlink", riscos_remove, METH_VARARGS}, - {"remove", riscos_remove, METH_VARARGS}, - {"rename", riscos_rename, METH_VARARGS}, - {"system", riscos_system, METH_VARARGS}, - {"rmdir", riscos_remove, METH_VARARGS}, - {"chdir", riscos_chdir, METH_VARARGS}, - {"getcwd", riscos_getcwd, METH_NOARGS}, - {"expand", riscos_expand, METH_VARARGS}, - {"mkdir", riscos_mkdir, METH_VARARGS}, - {"listdir", riscos_listdir, METH_VARARGS}, - {"stat", riscos_stat, METH_VARARGS}, - {"lstat", riscos_stat, METH_VARARGS}, - {"chmod", riscos_chmod, METH_VARARGS}, - {"utime", riscos_utime, METH_VARARGS}, - {"settype", riscos_settype, METH_VARARGS}, - {"getenv", riscos_getenv, METH_VARARGS}, - {"putenv", riscos_putenv, METH_VARARGS}, - {"delenv", riscos_delenv, METH_VARARGS}, - {"getenvdict", riscos_getenvdict, METH_VARARGS}, - {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 -initriscos() -{ - PyObject *m, *d, *stat_m; - - m = Py_InitModule("riscos", riscos_methods); - - if (all_ins(m)) - return; - - d = PyModule_GetDict(m); - - Py_INCREF(PyExc_OSError); - PyModule_AddObject(m, "error", PyExc_OSError); - - PyStructSequence_InitType(&StatResultType, &stat_result_desc); - PyDict_SetItemString(d, "stat_result", (PyObject*) &StatResultType); -} diff --git a/RISCOS/Modules/swimodule.c b/RISCOS/Modules/swimodule.c deleted file mode 100644 index b241276..0000000 --- a/RISCOS/Modules/swimodule.c +++ /dev/null @@ -1,575 +0,0 @@ -/* swi - - RISC OS swi functions - - 1.00 Chris Stretch - - - 1.01 12 May 1999 Laurence Tratt - - * Changed swi.error to be a class based exception rather than string based - * Added swi.ArgError which is generated for errors when the user passes invalid arguments to - functions etc - * 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 -#include "Python.h" - - -#define PyBlock_Check(op) ((op)->ob_type == &PyBlockType) - - -static PyObject *SwiError; /* Exception swi.error */ -static PyObject *ArgError; /* Exception swi.ArgError */ -static os_error *e; - -static PyObject *swi_oserror(void) -{ PyErr_SetString(SwiError,e->errmess); - PyObject_SetAttrString(PyErr_Occurred(), "errnum", PyInt_FromLong(e->errnum)); - return 0; -} - -static PyObject *swi_error(char *s) -{ PyErr_SetString(ArgError,s); - return 0; -} - -typedef struct -{ PyObject_HEAD - void *block; - int length; /*length in bytes*/ - int heap; -} PyBlockObject; - -static PyTypeObject PyBlockType; - -/* block commands */ - -static PyObject *PyBlock_New(PyObject *self,PyObject *args) -{ int size; - PyBlockObject *b; - PyObject *init=0; - if(!PyArg_ParseTuple(args,"i|O",&size,&init)) return NULL; - if(size<1) size=1; - b=PyObject_NEW(PyBlockObject,&PyBlockType); - if(!b) return NULL; - b->block=malloc(4*size); - if(!b->block) - { Py_DECREF(b); - return PyErr_NoMemory(); - } - b->length=4*size; - b->heap=1; - if(init) - { if(PyString_Check(init)) - { int n=PyString_Size(init); - if (n>4*size) n=4*size; - memcpy(b->block,PyString_AsString(init),n); - memset((char*)b->block+n,0,4*size-n); - } - else - { int n,k; - long *p=(long*)b->block; - if(!PyList_Check(init)) goto fail; - n=PyList_Size(init); - if (n>size) n=size; - for(k=0;kblock=(void*)ptr; - b->length=4*size; - b->heap=0; - return (PyObject *)b; -} - -static PyObject *PyBlock_ToString(PyBlockObject *self,PyObject *arg) -{ int s=0,e=self->length; - if(!PyArg_ParseTuple(arg,"|ii",&s,&e)) return NULL; - if(s<0||e>self->length||s>e) - { PyErr_SetString(PyExc_IndexError,"block index out of range"); - return NULL; - } - return PyString_FromStringAndSize((char*)self->block+s,e-s); -} - -static PyObject *PyBlock_NullString(PyBlockObject *self,PyObject *arg) -{ int s=0,e=self->length,i; - char *p=(char*)self->block; - if(!PyArg_ParseTuple(arg,"|ii",&s,&e)) return NULL; - if(s<0||e>self->length||s>e) - { PyErr_SetString(PyExc_IndexError,"block index out of range"); - return NULL; - } - for(i=s;iblock+s,i-s); -} - -static PyObject *PyBlock_CtrlString(PyBlockObject *self,PyObject *arg) -{ int s=0,e=self->length,i; - char *p=(char*)self->block; - if(!PyArg_ParseTuple(arg,"|ii",&s,&e)) return NULL; - if(s<0||e>self->length||s>e) - { PyErr_SetString(PyExc_IndexError,"block index out of range"); - return NULL; - } - for(i=s;iblock+s,i-s); -} - -static PyObject *PyBlock_PadString(PyBlockObject *self,PyObject *arg) -{ int s=0,e=self->length,n,m; - char *str; - char c; - char *p=(char*)self->block; - if(!PyArg_ParseTuple(arg,"s#c|ii",&str,&n,&c,&s,&e)) return NULL; - if(s<0||e>self->length||s>e) - { PyErr_SetString(PyExc_IndexError,"block index out of range"); - return NULL; - } - m=e-s; - if(n>m) n=m; - memcpy(p+s,str,n);memset(p+s+n,c,m-n); - Py_INCREF(Py_None);return Py_None; -} - -static PyObject *PyBlock_BitSet(PyBlockObject *self,PyObject *arg) -{ int i,x,y; - int *p=(int*)self->block; - if(!PyArg_ParseTuple(arg,"iii",&i,&x,&y)) return NULL; - if(i<0||i>=self->length/4) - { PyErr_SetString(PyExc_IndexError,"block index out of range"); - return NULL; - } - p[i]=(p[i]&y)^x; - Py_INCREF(Py_None);return Py_None; -} - -static PyObject *PyBlock_Resize(PyBlockObject *self,PyObject *arg) -{ int n; - if(!PyArg_ParseTuple(arg,"i",&n)) return NULL; - if(n<1) n=1; - if(self->heap) - { void *v=realloc(self->block,4*n); - if (!v) return PyErr_NoMemory(); - self->block=v; - } - self->length=4*n; - Py_INCREF(Py_None);return Py_None; -} - -static PyObject *PyBlock_ToFile(PyBlockObject *self,PyObject *arg) -{ int s=0,e=self->length/4; - PyObject *f; - FILE *fp; - if(!PyArg_ParseTuple(arg,"O|ii",&f,&s,&e)) return NULL; - fp=PyFile_AsFile(f); - if (!fp) - { PyErr_SetString(PyExc_TypeError, "arg must be open file"); - return NULL; - } - fwrite((int*)(self->block)+s,4,e-s,fp); - Py_INCREF(Py_None);return Py_None; -} - -static struct PyMethodDef PyBlock_Methods[]= -{ { "tostring",(PyCFunction)PyBlock_ToString,1}, - { "padstring",(PyCFunction)PyBlock_PadString,1}, - { "nullstring",(PyCFunction)PyBlock_NullString,1}, - { "ctrlstring",(PyCFunction)PyBlock_CtrlString,1}, - { "bitset",(PyCFunction)PyBlock_BitSet,1}, - { "resize",(PyCFunction)PyBlock_Resize,1}, - { "tofile",(PyCFunction)PyBlock_ToFile,1}, - { NULL,NULL} /* sentinel */ -}; - -static int block_len(PyBlockObject *b) -{ return b->length/4; -} - -static PyObject *block_concat(PyBlockObject *b,PyBlockObject *c) -{ PyErr_SetString(PyExc_IndexError,"block concatenation not implemented"); - return NULL; -} - -static PyObject *block_repeat(PyBlockObject *b,Py_ssize_t i) -{ PyErr_SetString(PyExc_IndexError,"block repetition not implemented"); - return NULL; -} - -static PyObject *block_item(PyBlockObject *b,Py_ssize_t i) -{ if(i<0||4*i>=b->length) - { PyErr_SetString(PyExc_IndexError,"block index out of range"); - return NULL; - } - return PyInt_FromLong(((long*)(b->block))[i]); -} - -static PyObject *block_slice(PyBlockObject *b,Py_ssize_t i,Py_ssize_t j) -{ Py_ssize_t n,k; - long *p=b->block; - PyObject *result; - if(j>b->length/4) j=b->length/4; - if(i<0||i>j) - { PyErr_SetString(PyExc_IndexError,"block index out of range"); - return NULL; - } - n=j-i; - result=PyList_New(n); - for(k=0;k=b->length/4) - { PyErr_SetString(PyExc_IndexError,"block index out of range"); - return -1; - } - if(!PyInt_Check(v)) - { PyErr_SetString(PyExc_TypeError,"block item must be integer"); - return -1; - } - ((long*)(b->block))[i]=PyInt_AsLong(v); - return 0; -} - -static int block_ass_slice(PyBlockObject *b,Py_ssize_t i,Py_ssize_t j,PyObject *v) -{ Py_ssize_t n,k; - long *p=b->block; - if(j>b->length/4) j=b->length/4; - if(i<0||i>j) - { PyErr_SetString(PyExc_IndexError,"block index out of range"); - return -1; - } - if(!PyList_Check(v)) goto fail; - n=PyList_Size(v); - if(n>j-i) n=j-i; - for(k=0;klength); - if (!strcmp(name, "start")) return PyInt_FromLong((long)s->block); - if (!strcmp(name,"end")) return PyInt_FromLong(((long)(s->block)+s->length)); - if (!strcmp(name, "__members__")) - { PyObject *list = PyList_New(3); - if (list) - { PyList_SetItem(list, 0, PyString_FromString("length")); - PyList_SetItem(list, 1, PyString_FromString("start")); - PyList_SetItem(list, 2, PyString_FromString("end")); - if (PyErr_Occurred()) { Py_DECREF(list);list = NULL;} - } - return list; - } - return Py_FindMethod(PyBlock_Methods, (PyObject*) s,name); -} - -static void PyBlock_Dealloc(PyBlockObject *b) -{ - if(b->heap) { - if (b->heap) - ; - else - PyMem_DEL(b->block); - } - PyMem_DEL(b); -} - -static PyTypeObject PyBlockType= -{ PyObject_HEAD_INIT(&PyType_Type) - 0, /*ob_size*/ - "block", /*tp_name*/ - sizeof(PyBlockObject), /*tp_size*/ - 0, /*tp_itemsize*/ - /* methods */ - (destructor)PyBlock_Dealloc, /*tp_dealloc*/ - 0, /*tp_print*/ - (getattrfunc)PyBlock_GetAttr, /*tp_getattr*/ - 0, /*tp_setattr*/ - 0, /*tp_compare*/ - 0, /*tp_repr*/ - 0, /*tp_as_number*/ - &block_as_sequence, /*tp_as_sequence*/ - 0, /*tp_as_mapping*/ - 0, /*tp_hash*/ -}; - -/* swi commands */ - -static PyObject *swi_swi(PyObject *self,PyObject *args) -{ PyObject *name,*format,*result,*v; - int swino,carry,rno=0,j,n; - char *swiname,*fmt,*outfmt; - _kernel_swi_regs r; - PyBlockObject *ao; - if(args==NULL||!PyTuple_Check(args)||(n=PyTuple_Size(args))<2) - { PyErr_BadArgument(); return NULL;} - name=PyTuple_GetItem(args,0); - if(!PyArg_Parse(name,"i",&swino)) - { PyErr_Clear(); - if(!PyArg_Parse(name,"s",&swiname)) return NULL; - e=xos_swi_number_from_string(swiname,&swino); - if(e) return swi_oserror(); - } - format=PyTuple_GetItem(args,1); - if(!PyArg_Parse(format,"s",&fmt)) return NULL; - j=2; - for(;;fmt++) - { switch(*fmt) - { case '.': rno++;continue; - case ';':case 0: goto swicall; - case '0':case '1':case '2':case '3':case '4': - case '5':case '6':case '7':case '8':case '9': - r.r[rno++]=*fmt-'0';continue; - case '-':r.r[rno++]=-1;continue; - } - if(j>=n) return swi_error("Too few arguments"); - v=PyTuple_GetItem(args,j++); - switch(*fmt) - { case 'i':if(!PyArg_Parse(v,"i",&r.r[rno])) return NULL; - break; - case 's':if(!PyArg_Parse(v,"s",(char**)(&r.r[rno]))) return NULL; - break; - case 'b':if(!PyArg_Parse(v,"O",(PyObject**)&ao)) return NULL; - if(!PyBlock_Check(v)) return swi_error("Not a block"); - r.r[rno]=(int)(ao->block); - break; - case 'e':if(!PyArg_Parse(v,"O",(PyObject**)&ao)) return NULL; - if(!PyBlock_Check(v)) return swi_error("Not a block"); - r.r[rno]=(int)(ao->block)+ao->length; - break; - default:return swi_error("Odd format character"); - } - rno++; - } - swicall:e=(os_error*)_kernel_swi_c(swino,&r,&r,&carry); - if(e) return swi_oserror(); - if(*fmt==0) { Py_INCREF(Py_None);return Py_None;} - n=0; - for(outfmt=++fmt;*outfmt;outfmt++) switch(*outfmt) - { case 'i':case 's':case '*':n++;break; - case '.':break; - default:return swi_error("Odd format character"); - } - if(n==0) { Py_INCREF(Py_None);return Py_None;} - if(n!=1) - { result=PyTuple_New(n); - if(!result) return NULL; - } - rno=0;j=0; - for(;*fmt;fmt++) - { switch(*fmt) - { case 'i':v=PyInt_FromLong((long)r.r[rno++]); break; - case 's':v=PyString_FromString((char*)(r.r[rno++])); break; - case '.':rno++; continue; - case '*':v=PyInt_FromLong((long)carry); break; - } - if(!v) goto fail; - if(n==1) return v; - PyTuple_SetItem(result,j,v); - j++; - } - return result; - 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 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 tuple\n\ -Read count bytes from given address."; - - -static PyMethodDef SwiMethods[]= -{ { "swi", swi_swi, METH_VARARGS}, - { "block", PyBlock_New, METH_VARARGS}, - { "register", PyRegister, METH_VARARGS}, - { "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() -{ PyObject *m, *d; - m = Py_InitModule("swi", SwiMethods); - d = PyModule_GetDict(m); - SwiError=PyErr_NewException("swi.error", NULL, NULL); - PyDict_SetItemString(d,"error",SwiError); - ArgError=PyErr_NewException("swi.ArgError", NULL, NULL); - PyDict_SetItemString(d,"ArgError",ArgError); -} diff --git a/RISCOS/Python/dynload_riscos.c b/RISCOS/Python/dynload_riscos.c deleted file mode 100644 index 6b87f2d..0000000 --- a/RISCOS/Python/dynload_riscos.c +++ /dev/null @@ -1,63 +0,0 @@ -/*********************************************************** -Copyright 1991-1995 by Stichting Mathematisch Centrum, Amsterdam, -The Netherlands. - - All Rights Reserved - -Permission to use, copy, modify, and distribute this software and its -documentation for any purpose and without fee is hereby granted, -provided that the above copyright notice appear in all copies and that -both that copyright notice and this permission notice appear in -supporting documentation, and that the names of Stichting Mathematisch -Centrum or CWI or Corporation for National Research Initiatives or -CNRI not be used in advertising or publicity pertaining to -distribution of the software without specific, written prior -permission. - -While CWI is the initial source for this software, a modified version -is made available by the Corporation for National Research Initiatives -(CNRI) at the Internet address ftp://ftp.python.org. - -STICHTING MATHEMATISCH CENTRUM AND CNRI DISCLAIM ALL WARRANTIES WITH -REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL STICHTING MATHEMATISCH -CENTRUM OR CNRI BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL -DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR -PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER -TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR -PERFORMANCE OF THIS SOFTWARE. - -******************************************************************/ - -/* This module provides the necessary stubs for when dynamic loading is - not present. */ - -#include "Python.h" -#include "importdl.h" - -#include "dlk.h" - - -const struct filedescr _PyImport_DynLoadFiletab[] = { - {"/pyd", "rb", C_EXTENSION}, - {0, 0} -}; - -void dynload_init_dummy() -{ -} - -dl_funcptr _PyImport_GetDynLoadFunc(const char *fqname, const char *shortname, - char *pathname, FILE *fp) -{ - int err; - char errstr[256]; - void (*init_function)(void); - - err = dlk_load_no_init(pathname, &init_function); - if (err) { - PyOS_snprintf(errstr, sizeof(errstr), "dlk failure %d", err); - PyErr_SetString(PyExc_ImportError, errstr); - } - return init_function; -} diff --git a/RISCOS/Python/getcwd_riscos.c b/RISCOS/Python/getcwd_riscos.c deleted file mode 100644 index 0239e6e..0000000 --- a/RISCOS/Python/getcwd_riscos.c +++ /dev/null @@ -1,5 +0,0 @@ -char *getcwd(char *buf, int size) -{ - buf[0] = '\0'; - return buf; -} diff --git a/RISCOS/Python/getmtime_riscos.c b/RISCOS/Python/getmtime_riscos.c deleted file mode 100644 index 9153638..0000000 --- a/RISCOS/Python/getmtime_riscos.c +++ /dev/null @@ -1,20 +0,0 @@ -#include - -#define __swi -#include "oslib/osfile.h" - -long PyOS_GetLastModificationTime(char *path, FILE *fp) -{ - int obj; - bits load, exec, ftype; - - if (xosfile_read_stamped_no_path(path, &obj, &load, &exec, 0, 0, &ftype)) return -1; - if (obj != osfile_IS_FILE) return -1; - if (ftype == osfile_TYPE_UNTYPED) return -1; - - load &= 0xFF; - load -= 51; - if (exec < 1855548004U) load--; - exec -= 1855548004U; - return exec/100+42949672*load+(95*load)/100; -} diff --git a/RISCOS/README b/RISCOS/README deleted file mode 100644 index 850ff95..0000000 --- a/RISCOS/README +++ /dev/null @@ -1,36 +0,0 @@ -This directory contains files for the RISC OS port of Python. -For more information about RISC OS see http://www.riscos.com/ . - -This port is currently being maintained by Dietmar Schwertberger, -dietmar@schwertberger.de . - -On http://www.schwertberger.de you may find compiled versions and libraries -as well as RISC OS specific documentation and extensions. - - -========================================================================== -Compiling: - -1. Extract Files from archive directory 'Python-...' to a directory named - '!Python'. -2. Use a tool like Rename to change filenames from '*/[ch]' into '[ch].*'. -3. Create missing directories with 'amu cdirs'. -4. Build with 'amu'. - -I've only tested Acorn/Norcroft C/C++ 5.30 and amu. - -Python now uses the 32 bit libraries from Pace as well as the 32 bit -version of OSLib. - -You will also need some additional libraries: - - DLK (patched version) - http://www.schwertberger.de - OSLib - http://www.mk-net.demon.co.uk/oslib - - zlib (optional) - ftp://ftp.freesoftware.com/pub/infozip/zlib/ - expat (optional) - http://sourceforge.net/projects/expat/ - (makefile and config.h available from http://www.schwertberger.de/riscos_expat.zip diff --git a/RISCOS/pyconfig.h b/RISCOS/pyconfig.h deleted file mode 100644 index d9b89cc..0000000 --- a/RISCOS/pyconfig.h +++ /dev/null @@ -1,715 +0,0 @@ -/* RISCOS/pyconfig.h: Python configuration for RISC OS */ - -#ifndef Py_PYCONFIG_H -#define Py_PYCONFIG_H - -/* Define if on AIX 3. - System headers sometimes define this. - We just want to avoid a redefinition error message. */ -#ifndef _ALL_SOURCE -#undef _ALL_SOURCE -#endif - -/* Define if type char is unsigned and you are not using gcc. */ -#ifndef __CHAR_UNSIGNED__ -#undef __CHAR_UNSIGNED__ -#endif - -/* Define to empty if the keyword does not work. */ -#undef const - -/* Define to `int' if doesn't define. */ -#undef gid_t - -/* Define if your struct tm has tm_zone. */ -#undef HAVE_TM_ZONE - -/* Define if you don't have tm_zone but do have the external array - tzname. */ -#undef HAVE_TZNAME - -/* Define to `int' if doesn't define. */ -#undef mode_t - -/* Define to `long' if doesn't define. */ -#undef off_t - -/* Define to `int' if doesn't define. */ -#undef pid_t - -/* Define if the system does not provide POSIX.1 features except - with this defined. */ -#undef _POSIX_1_SOURCE - -/* Define if you need to in order for stat and other things to work. */ -#undef _POSIX_SOURCE - -/* Define as the return type of signal handlers (int or void). */ -#define RETSIGTYPE void - -/* Define to `unsigned' if doesn't define. */ -#undef size_t - -/* Define if you have the ANSI C header files. */ -#define STDC_HEADERS 1 - -/* Define if you can safely include both and . */ -#undef TIME_WITH_SYS_TIME - -/* Define if your declares struct tm. */ -#define TM_IN_SYS_TIME 1 - -/* Define to `int' if doesn't define. */ -#undef uid_t - -/* Define if your processor stores words with the most significant - byte first (like Motorola and SPARC, unlike Intel and VAX). */ -#undef WORDS_BIGENDIAN - -/* Define for AIX if your compiler is a genuine IBM xlC/xlC_r - and you want support for AIX C++ shared extension modules. */ -#undef AIX_GENUINE_CPLUSPLUS - -/* Define if your compiler botches static forward declarations - (as it does on SCI ODT 3.0) */ -#undef BAD_STATIC_FORWARD - -/* Define this if you have BeOS threads */ -#undef BEOS_THREADS - -/* Define if you have the Mach cthreads package */ -#undef C_THREADS - -/* Define to `long' if doesn't define. */ -#undef clock_t - -/* Defined on Solaris to see additional function prototypes. */ -#undef __EXTENSIONS__ - -/* This must be set to 64 on some systems to enable large file support */ -#undef _FILE_OFFSET_BITS - -/* Define if getpgrp() must be called as getpgrp(0). */ -#undef GETPGRP_HAVE_ARG - -/* Define if gettimeofday() does not have second (timezone) argument - This is the case on Motorola V4 (R40V4.2) */ -#undef GETTIMEOFDAY_NO_TZ - -/* Define this if your time.h defines altzone */ -#undef HAVE_ALTZONE - -/* Define if --enable-ipv6 is specified */ -#undef ENABLE_IPV6 - -/* Define if sockaddr has sa_len member */ -#undef HAVE_SOCKADDR_SA_LEN - -/* struct addrinfo (netdb.h) */ -#undef HAVE_ADDRINFO - -/* struct sockaddr_storage (sys/socket.h) */ -#undef HAVE_SOCKADDR_STORAGE - -/* Defined when any dynamic module loading is enabled */ -#define HAVE_DYNAMIC_LOADING 1 - -/* Define this if you have flockfile(), getc_unlocked(), and funlockfile() */ -#undef HAVE_GETC_UNLOCKED - -/* Define this if you have some version of gethostbyname_r() */ -#undef HAVE_GETHOSTBYNAME_R - -/* Define this if you have the 3-arg version of gethostbyname_r() */ -#undef HAVE_GETHOSTBYNAME_R_3_ARG - -/* Define this if you have the 5-arg version of gethostbyname_r() */ -#undef HAVE_GETHOSTBYNAME_R_5_ARG - -/* Define this if you have the 6-arg version of gethostbyname_r() */ -#undef HAVE_GETHOSTBYNAME_R_6_ARG - -/* Defined to enable large file support when an off_t is bigger than a long - and long long is available and at least as big as an off_t. You may need - to add some flags for configuration and compilation to enable this mode. - E.g, for Solaris 2.7: - CFLAGS="-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64" OPT="-O2 $CFLAGS" \ - configure -*/ -#undef HAVE_LARGEFILE_SUPPORT - -/* Define this if you have the type long long */ -#define HAVE_LONG_LONG - -/* Define if your compiler supports function prototypes */ -#define HAVE_PROTOTYPES 1 - -/* Define if you have GNU PTH threads */ -#undef HAVE_PTH - -/* Define if you have readline 4.2 */ -#undef HAVE_RL_COMPLETION_MATCHES - -/* Define if your compiler supports variable length function prototypes - (e.g. void fprintf(FILE *, char *, ...);) *and* */ -#define HAVE_STDARG_PROTOTYPES 1 - -/* Define this if you have the type uintptr_t */ -#undef HAVE_UINTPTR_T - -/* Define if you have a useable wchar_t type defined in wchar.h; useable - means wchar_t must be 16-bit unsigned type. (see - Include/unicodeobject.h). */ -#undef HAVE_USABLE_WCHAR_T - -/* Define if the compiler provides a wchar.h header file. */ -#undef HAVE_WCHAR_H - -/* This must be defined on some systems to enable large file support */ -#undef _LARGEFILE_SOURCE - -/* Define as the integral type used for Unicode representation. */ -#define PY_UNICODE_TYPE unsigned short - -/* Define as the size of the unicode type. */ -#define Py_UNICODE_SIZE 2 - -/* Define if nice() returns success/failure instead of the new priority. */ -#undef HAVE_BROKEN_NICE - -/* Define if you have POSIX threads */ -#undef _POSIX_THREADS - -/* Define if you want to build an interpreter with many run-time checks */ -#undef Py_DEBUG - -/* Define to force use of thread-safe errno, h_errno, and other functions */ -#undef _REENTRANT - -/* Define if setpgrp() must be called as setpgrp(0, 0). */ -#undef SETPGRP_HAVE_ARG - -/* Define to empty if the keyword does not work. */ -#undef signed - -/* Define if i>>j for signed int i does not extend the sign bit - when i < 0 -*/ -#undef SIGNED_RIGHT_SHIFT_ZERO_FILLS - -/* The number of bytes in an off_t. */ -#define SIZEOF_OFF_T 4 - -/* The number of bytes in a time_t. */ -#define SIZEOF_TIME_T 4 - -/* The number of bytes in a pthread_t. */ -#undef SIZEOF_PTHREAD_T - -/* Define to `int' if doesn't define. */ -#define socklen_t int - -/* Define if you can safely include both and - (which you can't on SCO ODT 3.0). */ -#undef SYS_SELECT_WITH_SYS_TIME - -/* Define if a va_list is an array of some kind */ -#define VA_LIST_IS_ARRAY 1 - -/* Define to empty if the keyword does not work. */ -#undef volatile - -/* Define if you want SIGFPE handled (see Include/pyfpe.h). */ -#undef WANT_SIGFPE_HANDLER - -/* Define if you want wctype.h functions to be used instead of the - one supplied by Python itself. (see Include/unicodectype.h). */ -#undef WANT_WCTYPE_FUNCTIONS - -/* Define if you want documentation strings in extension modules */ -#define WITH_DOC_STRINGS 1 - -/* Define if you want to use the new-style (Openstep, Rhapsody, MacOS) - dynamic linker (dyld) instead of the old-style (NextStep) dynamic - linker (rld). Dyld is necessary to support frameworks. */ -#undef WITH_DYLD - -/* Define if you want to compile in Python-specific mallocs */ -#define WITH_PYMALLOC 1 - -/* Define if you want to produce an OpenStep/Rhapsody framework - (shared library plus accessory files). */ -#undef WITH_NEXT_FRAMEWORK - -/* Define if you want to use MacPython modules on MacOSX in unix-Python */ -#undef USE_TOOLBOX_OBJECT_GLUE - -/* Define if you want to compile in rudimentary thread support */ -#undef WITH_THREAD - -/* The number of bytes in a char. */ -#define SIZEOF_CHAR 1 - -/* The number of bytes in a double. */ -#define SIZEOF_DOUBLE 8 - -/* The number of bytes in a float. */ -#define SIZEOF_FLOAT 4 - -/* The number of bytes in a fpos_t. */ -#undef SIZEOF_FPOS_T - -/* The number of bytes in a int. */ -#define SIZEOF_INT 4 - -/* The number of bytes in a long. */ -#define SIZEOF_LONG 4 - -/* The number of bytes in a long long. */ -#define SIZEOF_LONG_LONG 8 - -/* The number of bytes in a short. */ -#define SIZEOF_SHORT 2 - -/* The number of bytes in a uintptr_t. */ -#undef SIZEOF_UINTPTR_T - -/* The number of bytes in a void *. */ -#define SIZEOF_VOID_P 4 - -/* The number of bytes in a wchar_t. */ -#undef SIZEOF_WCHAR_T - -/* Define if you have the _getpty function. */ -#undef HAVE__GETPTY - -/* Define if you have the alarm function. */ -#undef HAVE_ALARM - -/* Define if you have the chown function. */ -#undef HAVE_CHOWN - -/* Define if you have the clock function. */ -#define HAVE_CLOCK 1 - -/* Define if you have the confstr function. */ -#undef HAVE_CONFSTR - -/* Define if you have the ctermid function. */ -#undef HAVE_CTERMID - -/* Define if you have the ctermid_r function. */ -#undef HAVE_CTERMID_R - -/* Define if you have the dlopen function. */ -#undef HAVE_DLOPEN - -/* Define if you have the dup2 function. */ -#undef HAVE_DUP2 - -/* Define if you have the execv function. */ -#undef HAVE_EXECV - -/* Define if you have the fdatasync function. */ -#undef HAVE_FDATASYNC - -/* Define if you have the flock function. */ -#undef HAVE_FLOCK - -/* Define if you have the fork function. */ -#undef HAVE_FORK - -/* Define if you have the forkpty function. */ -#undef HAVE_FORKPTY - -/* Define if you have the fpathconf function. */ -#undef HAVE_FPATHCONF - -/* Define if you have the fseek64 function. */ -#undef HAVE_FSEEK64 - -/* Define if you have the fseeko function. */ -#undef HAVE_FSEEKO - -/* Define if you have the fstatvfs function. */ -#undef HAVE_FSTATVFS - -/* Define if you have the fsync function. */ -#undef HAVE_FSYNC - -/* Define if you have the ftell64 function. */ -#undef HAVE_FTELL64 - -/* Define if you have the ftello function. */ -#undef HAVE_FTELLO - -/* Define if you have the ftime function. */ -#undef HAVE_FTIME - -/* Define if you have the ftruncate function. */ -#undef HAVE_FTRUNCATE - -/* Define if you have the gai_strerror function. */ -#undef HAVE_GAI_STRERROR - -/* Define if you have the getaddrinfo function. */ -#undef HAVE_GETADDRINFO - -/* Define if you have the getcwd function. */ -#undef HAVE_GETCWD - -/* Define if you have the getgroups function. */ -#undef HAVE_GETGROUPS - -/* Define if you have the gethostbyname function. */ -#undef HAVE_GETHOSTBYNAME - -/* Define if you have the getlogin function. */ -#undef HAVE_GETLOGIN - -/* Define if you have the getnameinfo function. */ -#undef HAVE_GETNAMEINFO - -/* Define if you have the getpeername function. */ -#define HAVE_GETPEERNAME - -/* Define if you have the getpgid function. */ -#undef HAVE_GETPGID - -/* Define if you have the getpgrp function. */ -#undef HAVE_GETPGRP - -/* Define if you have the getpid function. */ -#undef HAVE_GETPID - -/* Define if you have the getpriority function. */ -#undef HAVE_GETPRIORITY - -/* Define if you have the getpwent function. */ -#undef HAVE_GETPWENT - -/* Define if you have the gettimeofday function. */ -#undef HAVE_GETTIMEOFDAY - -/* Define if you have the getwd function. */ -#undef HAVE_GETWD - -/* Define if you have the hstrerror function. */ -#undef HAVE_HSTRERROR - -/* Define if you have the hypot function. */ -#define HAVE_HYPOT - -/* Define if you have the inet_pton function. */ -#define HAVE_INET_PTON 1 - -/* Define if you have the kill function. */ -#undef HAVE_KILL - -/* Define if you have the link function. */ -#undef HAVE_LINK - -/* Define if you have the lstat function. */ -#undef HAVE_LSTAT - -/* Define if you have the memmove function. */ -#define HAVE_MEMMOVE 1 - -/* Define if you have the mkfifo function. */ -#undef HAVE_MKFIFO - -/* Define if you have the mktime function. */ -#define HAVE_MKTIME 1 - -/* Define if you have the mremap function. */ -#undef HAVE_MREMAP - -/* Define if you have the nice function. */ -#undef HAVE_NICE - -/* Define if you have the openpty function. */ -#undef HAVE_OPENPTY - -/* Define if you have the pathconf function. */ -#undef HAVE_PATHCONF - -/* Define if you have the pause function. */ -#undef HAVE_PAUSE - -/* Define if you have the plock function. */ -#undef HAVE_PLOCK - -/* Define if you have the poll function. */ -#undef HAVE_POLL - -/* Define if you have the pthread_init function. */ -#undef HAVE_PTHREAD_INIT - -/* Define if you have the putenv function. */ -#undef HAVE_PUTENV - -/* Define if you have the readlink function. */ -#undef HAVE_READLINK - -/* Define if you have the select function. */ -#undef HAVE_SELECT - -/* Define if you have the setegid function. */ -#undef HAVE_SETEGID - -/* Define if you have the seteuid function. */ -#undef HAVE_SETEUID - -/* Define if you have the setgid function. */ -#undef HAVE_SETGID - -/* Define if you have the setlocale function. */ -#define HAVE_SETLOCALE 1 - -/* Define if you have the setpgid function. */ -#undef HAVE_SETPGID - -/* Define if you have the setpgrp function. */ -#undef HAVE_SETPGRP - -/* Define if you have the setregid function. */ -#undef HAVE_SETREGID - -/* Define if you have the setreuid function. */ -#undef HAVE_SETREUID - -/* Define if you have the setsid function. */ -#undef HAVE_SETSID - -/* Define if you have the setuid function. */ -#undef HAVE_SETUID - -/* Define if you have the setvbuf function. */ -#undef HAVE_SETVBUF - -/* Define if you have the sigaction function. */ -#undef HAVE_SIGACTION - -/* Define if you have the siginterrupt function. */ -#undef HAVE_SIGINTERRUPT - -/* Define if you have the sigrelse function. */ -#undef HAVE_SIGRELSE - -/* Define if you have the snprintf function. */ -#undef HAVE_SNPRINTF - -/* Define if you have the statvfs function. */ -#undef HAVE_STATVFS - -/* Define if you have the strdup function. */ -#define HAVE_STRDUP 1 - -/* Define if you have the strerror function. */ -#define HAVE_STRERROR 1 - -/* Define if you have the strftime function. */ -#define HAVE_STRFTIME 1 - -/* Define if you have the symlink function. */ -#undef HAVE_SYMLINK - -/* Define if you have the sysconf function. */ -#undef HAVE_SYSCONF - -/* Define if you have the tcgetpgrp function. */ -#undef HAVE_TCGETPGRP - -/* Define if you have the tcsetpgrp function. */ -#undef HAVE_TCSETPGRP - -/* Define if you have the tempnam function. */ -#undef HAVE_TEMPNAM - -/* Define if you have the timegm function. */ -#undef HAVE_TIMEGM - -/* Define if you have the times function. */ -#undef HAVE_TIMES - -/* Define if you have the tmpfile function. */ -#undef HAVE_TMPFILE - -/* Define if you have the tmpnam function. */ -#undef HAVE_TMPNAM - -/* Define if you have the tmpnam_r function. */ -#undef HAVE_TMPNAM_R - -/* Define if you have the truncate function. */ -#undef HAVE_TRUNCATE - -/* Define if you have the uname function. */ -#undef HAVE_UNAME - -/* Define if you have the waitpid function. */ -#undef HAVE_WAITPID - -/* Define if you have the header file. */ -#undef HAVE_CONIO_H - -/* Define if you have the header file. */ -#undef HAVE_DB_H - -/* Define if you have the header file. */ -#undef HAVE_DB1_NDBM_H - -/* Define if you have the header file. */ -#undef HAVE_DB_185_H - -/* Define if you have the header file. */ -#undef HAVE_DIRECT_H - -/* Define if you have the header file. */ -#undef HAVE_DIRENT_H - -/* Define if you have the header file. */ -#undef HAVE_DLFCN_H - -/* Define if you have the header file. */ -#define HAVE_ERRNO_H 1 - -/* Define if you have the header file. */ -#undef HAVE_FCNTL_H - -/* Define if you have the header file. */ -#undef HAVE_GDBM_NDBM_H - -/* Define if you have the header file. */ -#undef HAVE_IO_H - -/* Define if you have the header file. */ -#undef HAVE_LANGINFO_H - -/* Define if you have the header file. */ -#undef HAVE_LIBUTIL_H - -/* Define if you have the header file. */ -#undef HAVE_NCURSES_H - -/* Define if you have the header file. */ -#undef HAVE_NDBM_H - -/* Define if you have the header file. */ -#undef HAVE_NDIR_H - -/* Define if you have the header file. */ -#undef HAVE_NETPACKET_PACKET_H - -/* Define if you have the header file. */ -#undef HAVE_POLL_H - -/* Define if you have the header file. */ -#undef HAVE_PROCESS_H - -/* Define if you have the header file. */ -#undef HAVE_PTHREAD_H - -/* Define if you have the header file. */ -#undef HAVE_PTY_H - -/* Define if you have the header file. */ -#define HAVE_SIGNAL_H - -/* Define if you have the header file. */ -#undef HAVE_SYS_AUDIOIO_H - -/* Define if you have the header file. */ -#undef HAVE_SYS_DIR_H - -/* Define if you have the header file. */ -#undef HAVE_SYS_FILE_H - -/* Define if you have the header file. */ -#undef HAVE_SYS_LOCK_H - -/* Define if you have the header file. */ -#undef HAVE_SYS_MODEM_H - -/* Define if you have the header file. */ -#undef HAVE_SYS_NDIR_H - -/* Define if you have the header file. */ -#undef HAVE_SYS_PARAM_H - -/* Define if you have the header file. */ -#undef HAVE_SYS_POLL_H - -/* Define if you have the header file. */ -#undef HAVE_SYS_RESOURCE_H - -/* Define if you have the header file. */ -#undef HAVE_SYS_SELECT_H - -/* Define if you have the header file. */ -#undef HAVE_SYS_SOCKET_H - -/* Define if you have the header file. */ -#define HAVE_SYS_STAT_H 1 - -/* Define if you have the header file. */ -#undef HAVE_SYS_TIME_H - -/* Define if you have the header file. */ -#undef HAVE_SYS_TIMES_H - -/* Define if you have the header file. */ -#define HAVE_SYS_TYPES_H 1 - -/* Define if you have the header file. */ -#undef HAVE_SYS_UN_H - -/* Define if you have the header file. */ -#undef HAVE_SYS_UTSNAME_H - -/* Define if you have the header file. */ -#undef HAVE_SYS_WAIT_H - -/* Define if you have the header file. */ -#undef HAVE_TERMIOS_H - -/* Define if you have the header file. */ -#undef HAVE_THREAD_H - -/* Define if you have the header file. */ -#define HAVE_UNISTD_H 1 - -/* Define if you have the header file. */ -#undef HAVE_UTIME_H - -/* Define if you have the dl library (-ldl). */ -#undef HAVE_LIBDL - -/* Define if you have the dld library (-ldld). */ -#undef HAVE_LIBDLD - -/* Define if you have the ieee library (-lieee). */ -#undef HAVE_LIBIEEE - -#ifdef __CYGWIN__ -#ifdef USE_DL_IMPORT -#define DL_IMPORT(RTYPE) __declspec(dllimport) RTYPE -#define DL_EXPORT(RTYPE) __declspec(dllexport) RTYPE -#else -#define DL_IMPORT(RTYPE) __declspec(dllexport) RTYPE -#define DL_EXPORT(RTYPE) __declspec(dllexport) RTYPE -#endif -#endif - -/* Define the macros needed if on a UnixWare 7.x system. */ -#if defined(__USLC__) && defined(__SCO_VERSION__) -#define STRICT_SYSV_CURSES /* Don't use ncurses extensions */ -#endif - - -#define DONT_HAVE_FSTAT 1 -#define DONT_HAVE_STAT 1 - -#define PLATFORM "riscos" - -#endif /* Py_PYCONFIG_H */ diff --git a/RISCOS/sleep.c b/RISCOS/sleep.c deleted file mode 100644 index c85eb86..0000000 --- a/RISCOS/sleep.c +++ /dev/null @@ -1,41 +0,0 @@ -#include "oslib/osmodule.h" -#include -#include "kernel.h" -#include -#include -#include "oslib/taskwindow.h" -#include "Python.h" - - -int riscos_sleep(double delay) -{ - os_t starttime, endtime, time; /* monotonic times (centiseconds) */ - int *pollword, ret; - osbool claimed; - - /* calculate end time */ - starttime = os_read_monotonic_time(); - if (starttime + 100.0*delay >INT_MAX) - endtime = INT_MAX; - else - endtime = (os_t)(starttime + 100.0*delay); - - /* allocate (in RMA) and set pollword for xupcall_sleep */ - pollword = osmodule_alloc(4); - *pollword = 1; - - time = starttime; - ret = 0; - while ( time=starttime ) { - xupcall_sleep (pollword, &claimed); - if (PyErr_CheckSignals()) { - ret = 1; - break; - } - time = os_read_monotonic_time(); - } - - /* deallocate pollword */ - osmodule_free(pollword); - return ret; -} diff --git a/RISCOS/support/!Boot b/RISCOS/support/!Boot deleted file mode 100644 index d3600b8..0000000 --- a/RISCOS/support/!Boot +++ /dev/null @@ -1,22 +0,0 @@ -set Python$Dir -set PythonApp$Path . - -IconSprites .!Sprites - -.AddToPath Python$Path PythonApp:Lib -.AddToPath Python$Path PythonApp:Lib.plat-riscos -.AddToPath Python$Path PythonApp:Lib.site-packages -set Alias$@RunType_ae5 TaskWindow |"python %%*0|" -name |"Python|" -quit -wimpslot 1248k -| -display -set File$Type_ae5 Python - -| 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 .python23 %*0 \ No newline at end of file diff --git a/RISCOS/support/!Run b/RISCOS/support/!Run deleted file mode 100644 index 2964e0a..0000000 --- a/RISCOS/support/!Run +++ /dev/null @@ -1,2 +0,0 @@ -.!Boot -TaskWindow "python" -name "Python" -quit -display -wimpslot 1248k \ No newline at end of file diff --git a/RISCOS/support/!Sprites b/RISCOS/support/!Sprites deleted file mode 100644 index cdf4a65..0000000 Binary files a/RISCOS/support/!Sprites and /dev/null differ diff --git a/RISCOS/support/!Sprites22 b/RISCOS/support/!Sprites22 deleted file mode 100644 index 5ca88f5..0000000 Binary files a/RISCOS/support/!Sprites22 and /dev/null differ diff --git a/RISCOS/support/AddToPath b/RISCOS/support/AddToPath deleted file mode 100644 index a16e3ad..0000000 Binary files a/RISCOS/support/AddToPath and /dev/null differ diff --git a/RISCOS/unixstuff.c b/RISCOS/unixstuff.c deleted file mode 100644 index 83e6212..0000000 --- a/RISCOS/unixstuff.c +++ /dev/null @@ -1,74 +0,0 @@ -/* Fudge unix isatty and fileno for RISCOS */ - -#include "unixstuff.h" -#include -#include -#include "oslib/osfile.h" - -int fileno(FILE *f) -{ return (int)f; -} - -int isatty(int fn) -{ return (fn==fileno(stdin)); -} - -bits unixtime(bits ld,bits ex) -{ ld&=0xFF; - ld-=51; - if(ex<1855547904U) ld--; - ex-=1855548004U; - return ex/100+42949673U*ld-ld/25; -} - - -/* from RISC OS infozip, preserves filetype in ld */ -int acorntime(bits *ex, bits *ld, time_t utime) -{ - unsigned timlo; /* 3 lower bytes of acorn file-time plus carry byte */ - unsigned timhi; /* 2 high bytes of acorn file-time */ - - timlo = ((unsigned)utime & 0x00ffffffU) * 100 + 0x00996a00U; - timhi = ((unsigned)utime >> 24); - timhi = timhi * 100 + 0x0000336eU + (timlo >> 24); - if (timhi & 0xffff0000U) - return 1; /* calculation overflow, do not change time */ - - /* insert the five time bytes into loadaddr and execaddr variables */ - *ex = (timlo & 0x00ffffffU) | ((timhi & 0x000000ffU) << 24); - *ld = (*ld & 0xffffff00U) | ((timhi >> 8) & 0x000000ffU); - - return 0; /* subject to future extension to signal overflow */ -} - - -int isdir(char *fn) -{ int ob; - if(xosfile_read_stamped_no_path(fn,&ob,0,0,0,0,0)) return 0; - switch (ob) - { case osfile_IS_DIR:return 1; - case osfile_IS_IMAGE:return 1; - } - return 0; -} - -int isfile(char *fn) -{ int ob; - if(xosfile_read_stamped_no_path(fn,&ob,0,0,0,0,0)) return 0; - switch (ob) - { case osfile_IS_FILE:return 1; - case osfile_IS_IMAGE:return 1; - } - return 0; -} - -int object_exists(char *fn) -{ int ob; - if(xosfile_read_stamped_no_path(fn,&ob,0,0,0,0,0)) return 0; - switch (ob) - { case osfile_IS_FILE:return 1; - case osfile_IS_DIR:return 1; - case osfile_IS_IMAGE:return 1; - } - return 0; -} diff --git a/RISCOS/unixstuff.h b/RISCOS/unixstuff.h deleted file mode 100644 index 90c732b1..0000000 --- a/RISCOS/unixstuff.h +++ /dev/null @@ -1,14 +0,0 @@ -/* Fudge unix isatty and fileno for RISCOS */ - -#include -#include - -int fileno(FILE *f); -int isatty(int fn); -unsigned int unixtime(unsigned int ld,unsigned int ex); -int acorntime(unsigned int *ex, unsigned int *ld, time_t ut); - -int isdir(char *fn); -int isfile(char *fn); -int object_exists(char *fn); - -- cgit v0.12