]> granicus.if.org Git - python/commitdiff
OS/2 EMX port changes (Modules part of patch #450267):
authorAndrew MacIntyre <andymac@bullseye.apana.org.au>
Sun, 3 Mar 2002 02:59:16 +0000 (02:59 +0000)
committerAndrew MacIntyre <andymac@bullseye.apana.org.au>
Sun, 3 Mar 2002 02:59:16 +0000 (02:59 +0000)
  Modules/
    _hotshot.c
    dbmmodule.c
    fcntlmodule.c
    main.c
    pwdmodule.c
    readline.c
    selectmodule.c
    signalmodule.c
    termios.c
    timemodule.c
    unicodedata.c

Modules/_hotshot.c
Modules/dbmmodule.c
Modules/fcntlmodule.c
Modules/main.c
Modules/pwdmodule.c
Modules/readline.c
Modules/selectmodule.c
Modules/signalmodule.c
Modules/termios.c
Modules/timemodule.c
Modules/unicodedata.c

index 1eecc7efcc07c8f40c7a2ae2a12dee0d0a78a5b8..97037ac4ed81732238c133379659f29ba7fdd976 100644 (file)
@@ -26,7 +26,7 @@ typedef __int64 hs_time;
 #ifndef HAVE_GETTIMEOFDAY
 #error "This module requires gettimeofday() on non-Windows platforms!"
 #endif
-#ifdef macintosh
+#if defined(macintosh) || (defined(PYOS_OS2) && defined(PYCC_GCC))
 #include <sys/time.h>
 #else
 #include <sys/resource.h>
@@ -51,6 +51,10 @@ typedef struct timeval hs_time;
 #define PATH_MAX 254
 #endif
 
+#if defined(PYOS_OS2) && defined(PYCC_GCC)
+#define PATH_MAX 260
+#endif
+
 #ifndef PATH_MAX
 #   ifdef MAX_PATH
 #       define PATH_MAX MAX_PATH
@@ -987,7 +991,7 @@ calibrate(void)
         }
 #endif
     }
-#if defined(MS_WIN32) || defined(macintosh)
+#if defined(MS_WIN32) || defined(macintosh) || defined(PYOS_OS2)
     rusage_diff = -1;
 #else
     {
index 233487d6122462669997fa8b7da97b98f270777e..056af4986b289ceae4e5b394d38f48fa11e263dd 100644 (file)
  */
 #if defined(HAVE_NDBM_H)
 #include <ndbm.h>
+#if defined(PYOS_OS2) && !defined(PYCC_GCC)
 static char *which_dbm = "ndbm";
+#else
+static char *which_dbm = "GNU gdbm";  /* EMX port of GDBM */
+#endif
 #elif defined(HAVE_DB1_NDBM_H)
 #include <db1/ndbm.h>
 static char *which_dbm = "BSD db";
index 9f84a2c1432140d06d01dc8f053d58b277b21b8e..13cd0f76e4ca7bbe78954003d0ca80ba11c343f1 100644 (file)
@@ -222,12 +222,17 @@ fcntl_lockf(PyObject *self, PyObject *args)
                              &lenobj, &startobj, &whence))
            return NULL;
 
+#if defined(PYOS_OS2) && defined(PYCC_GCC)
+       PyErr_SetString(PyExc_NotImplementedError,
+                       "lockf not supported on OS/2 (EMX)");
+       return NULL;
+#else
 #ifndef LOCK_SH
 #define LOCK_SH                1       /* shared lock */
 #define LOCK_EX                2       /* exclusive lock */
 #define LOCK_NB                4       /* don't block when locking */
 #define LOCK_UN                8       /* unlock */
-#endif
+#endif  /* LOCK_SH */
        {
                struct flock l;
                if (code == LOCK_UN)
@@ -275,6 +280,7 @@ fcntl_lockf(PyObject *self, PyObject *args)
        }
        Py_INCREF(Py_None);
        return Py_None;
+#endif  /* defined(PYOS_OS2) && defined(PYCC_GCC) */
 }
 
 static char lockf_doc [] =
index b36714c14d91ef8a4aa5799c58b2fcbc803c9480..9ce8bef79fa34c49645f57aa3f051620c8a45de4 100644 (file)
@@ -8,11 +8,15 @@
 #include <fcntl.h>
 #endif
 
-#if defined(PYOS_OS2) || defined(MS_WINDOWS)
+#if (defined(PYOS_OS2) && !defined(PYCC_GCC)) || defined(MS_WINDOWS)
 #define PYTHONHOMEHELP "<prefix>\\lib"
 #else
+#if defined(PYOS_OS2) && defined(PYCC_GCC)
+#define PYTHONHOMEHELP "<prefix>/Lib"
+#else
 #define PYTHONHOMEHELP "<prefix>/pythonX.X"
 #endif
+#endif
 
 #include "pygetopt.h"
 
index 35afc4ef28a2c2759de7080f5219242d1cae344c..91989b710eaaf20bf5cadfcd15a7e695fd231bb7 100644 (file)
@@ -128,8 +128,12 @@ pwd_getpwall(PyObject *self, PyObject *args)
                return NULL;
        if ((d = PyList_New(0)) == NULL)
                return NULL;
+#if defined(PYOS_OS2) && defined(PYCC_GCC)
+       if ((p = getpwuid(0)) != NULL) {
+#else
        setpwent();
        while ((p = getpwent()) != NULL) {
+#endif
                PyObject *v = mkpwent(p);
                if (v == NULL || PyList_Append(d, v) != 0) {
                        Py_XDECREF(v);
index 9b4d9522b0ea02357a8bbf4e7919012a96cd3392..94aa1dbcabc8d1e1070b7fa59bcf6c93a2944d59 100644 (file)
@@ -507,6 +507,10 @@ static void
 setup_readline(void)
 {
        rl_readline_name = "python";
+#if defined(PYOS_OS2) && defined(PYCC_GCC)
+       /* Allow $if term= in .inputrc to work */
+       rl_terminal_name = getenv("TERM");
+#endif
        /* Force rebind of TAB to insert-tab */
        rl_bind_key('\t', rl_insert);
        /* Bind both ESC-TAB and ESC-ESC to the completion function */
index ceaf3fa92d20c286907088f7059dd496eb610a7b..0a29f2efd5ce5c80e1055d80aabd230d078971c1 100644 (file)
@@ -33,7 +33,7 @@ extern void bzero(void *, int);
 #include <sys/types.h>
 #endif
 
-#if defined(PYOS_OS2)
+#if defined(PYOS_OS2) && !defined(PYCC_GCC)
 #include <sys/time.h>
 #include <utils.h>
 #endif
index e34f051398c5082b4d73bc8daea63049bf4c3a1c..b27c4b74a79539358d087c05726ed972b25bc10d 100644 (file)
@@ -16,7 +16,7 @@
 #define SIG_ERR ((PyOS_sighandler_t)(-1))
 #endif
 
-#if defined(PYOS_OS2)
+#if defined(PYOS_OS2) && !defined(PYCC_GCC)
 #define NSIG 12
 #include <process.h>
 #endif
index aaabe6034f96c722a38c8c27b831eedb73cc4ba4..0c5697f2851048c8b81d5a110dbe17246c0af888 100644 (file)
@@ -384,7 +384,9 @@ static struct constant {
 #ifdef OLCUC
        {"OLCUC", OLCUC},
 #endif
+#ifdef ONLCR
        {"ONLCR", ONLCR},
+#endif
 #ifdef OCRNL
        {"OCRNL", OCRNL},
 #endif
@@ -552,7 +554,9 @@ static struct constant {
 #ifdef VLNEXT
        {"VLNEXT", VLNEXT},
 #endif
+#ifdef VEOL2
        {"VEOL2", VEOL2},
+#endif
 
 
 #ifdef B460800
index 6647ecc86909ff887a3d7037646dca6d12378ab8..5d7fa51e998c427a19575a9bf68ae5eaf17d6e8d 100644 (file)
@@ -54,6 +54,12 @@ extern int ftime(struct timeb *);
 #undef HAVE_CLOCK /* We have our own version down below */
 #endif /* MS_WIN32 && !MS_WIN64 */
 
+#if defined(PYOS_OS2)
+#define INCL_DOS
+#define INCL_ERRORS
+#include <os2.h>
+#endif
+
 #if defined(PYCC_VACPP)
 #include <sys/time.h>
 #endif
@@ -752,7 +758,7 @@ static int
 floatsleep(double secs)
 {
 /* XXX Should test for MS_WIN32 first! */
-#if defined(HAVE_SELECT) && !defined(__BEOS__)
+#if defined(HAVE_SELECT) && !defined(__BEOS__) && !defined(__EMX__)
        struct timeval t;
        double frac;
        frac = fmod(secs, 1.0);
index 36c96e4a633849acfb44f26c270fbdc0d00c4440..20b53a7cc4d74606f74a46f01253fe9c5385b916 100644 (file)
@@ -277,7 +277,7 @@ _gethash(const char *s, int len, int scale)
 }
 
 static int
-_getname(Py_UCS4 code, char* buffer, int buflen)
+_Py_getname(Py_UCS4 code, char* buffer, int buflen)
 {
     int offset;
     int i;
@@ -334,7 +334,7 @@ _cmpname(int code, const char* name, int namelen)
     /* check if code corresponds to the given name */
     int i;
     char buffer[NAME_MAXLEN];
-    if (!_getname(code, buffer, sizeof(buffer)))
+    if (!_Py_getname(code, buffer, sizeof(buffer)))
         return 0;
     for (i = 0; i < namelen; i++) {
         if (toupper(name[i]) != buffer[i])
@@ -384,7 +384,7 @@ _getcode(const char* name, int namelen, Py_UCS4* code)
 static const _PyUnicode_Name_CAPI hashAPI = 
 {
     sizeof(_PyUnicode_Name_CAPI),
-    _getname,
+    _Py_getname,
     _getcode
 };
 
@@ -407,7 +407,7 @@ unicodedata_name(PyObject* self, PyObject* args)
        return NULL;
     }
 
-    if (!_getname((Py_UCS4) *PyUnicode_AS_UNICODE(v),
+    if (!_Py_getname((Py_UCS4) *PyUnicode_AS_UNICODE(v),
                              name, sizeof(name))) {
        if (defobj == NULL) {
            PyErr_SetString(PyExc_ValueError, "no such name");