Got rid of ifdefs for long-obsolete GUSI versions.
This commit is contained in:
parent
9b745f6665
commit
8ab04b4d65
|
@ -117,13 +117,6 @@ typedef LONG_LONG Py_intptr_t;
|
||||||
|
|
||||||
#include <sys/select.h>
|
#include <sys/select.h>
|
||||||
|
|
||||||
#else /* !HAVE_SYS_SELECT_H */
|
|
||||||
|
|
||||||
#ifdef USE_GUSI1
|
|
||||||
/* If we don't have sys/select the definition may be in unistd.h */
|
|
||||||
#include <GUSI.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif /* !HAVE_SYS_SELECT_H */
|
#endif /* !HAVE_SYS_SELECT_H */
|
||||||
|
|
||||||
/*******************************
|
/*******************************
|
||||||
|
|
|
@ -36,7 +36,7 @@ OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||||
#define macintosh
|
#define macintosh
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(USE_GUSI1) || defined(USE_GUSI2)
|
#if defined(USE_GUSI2)
|
||||||
#define USE_GUSI
|
#define USE_GUSI
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -46,9 +46,6 @@ OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||||
#undef S_IWRITE
|
#undef S_IWRITE
|
||||||
#undef S_IEXEC
|
#undef S_IEXEC
|
||||||
|
|
||||||
#ifdef USE_GUSI1
|
|
||||||
#include <GUSI.h>
|
|
||||||
#endif /* USE_GUSI1 */
|
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#else /* USE_GUSI */
|
#else /* USE_GUSI */
|
||||||
|
@ -181,17 +178,7 @@ mac_chdir(self, args)
|
||||||
PyObject *self;
|
PyObject *self;
|
||||||
PyObject *args;
|
PyObject *args;
|
||||||
{
|
{
|
||||||
#ifdef USE_GUSI1
|
|
||||||
PyObject *rv;
|
|
||||||
|
|
||||||
/* Change MacOS's idea of wd too */
|
|
||||||
rv = mac_1str(args, chdir);
|
|
||||||
PyMac_FixGUSIcd();
|
|
||||||
return rv;
|
|
||||||
#else
|
|
||||||
return mac_1str(args, chdir);
|
return mac_1str(args, chdir);
|
||||||
#endif
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
|
@ -205,11 +192,8 @@ mac_close(self, args)
|
||||||
Py_BEGIN_ALLOW_THREADS
|
Py_BEGIN_ALLOW_THREADS
|
||||||
res = close(fd);
|
res = close(fd);
|
||||||
Py_END_ALLOW_THREADS
|
Py_END_ALLOW_THREADS
|
||||||
#ifndef USE_GUSI1
|
|
||||||
/* GUSI gives surious errors here? */
|
|
||||||
if (res < 0)
|
if (res < 0)
|
||||||
return mac_error();
|
return mac_error();
|
||||||
#endif
|
|
||||||
Py_INCREF(Py_None);
|
Py_INCREF(Py_None);
|
||||||
return Py_None;
|
return Py_None;
|
||||||
}
|
}
|
||||||
|
@ -385,11 +369,7 @@ mac_mkdir(self, args)
|
||||||
if (!PyArg_ParseTuple(args, "s|i", &path, &mode))
|
if (!PyArg_ParseTuple(args, "s|i", &path, &mode))
|
||||||
return NULL;
|
return NULL;
|
||||||
Py_BEGIN_ALLOW_THREADS
|
Py_BEGIN_ALLOW_THREADS
|
||||||
#ifdef USE_GUSI1
|
|
||||||
res = mkdir(path);
|
|
||||||
#else
|
|
||||||
res = mkdir(path, mode);
|
res = mkdir(path, mode);
|
||||||
#endif
|
|
||||||
Py_END_ALLOW_THREADS
|
Py_END_ALLOW_THREADS
|
||||||
if (res < 0)
|
if (res < 0)
|
||||||
return mac_error();
|
return mac_error();
|
||||||
|
|
|
@ -35,15 +35,11 @@ PERFORMANCE OF THIS SOFTWARE.
|
||||||
#include "Python.h"
|
#include "Python.h"
|
||||||
|
|
||||||
#ifdef __MWERKS__
|
#ifdef __MWERKS__
|
||||||
#ifdef USE_GUSI1
|
|
||||||
#define HASGUSI " GUSI1"
|
|
||||||
#else
|
|
||||||
#ifdef USE_GUSI2
|
#ifdef USE_GUSI2
|
||||||
#define HASGUSI " GUSI2"
|
#define HASGUSI " GUSI2"
|
||||||
#else
|
#else
|
||||||
#define HASGUSI ""
|
#define HASGUSI ""
|
||||||
#endif
|
#endif
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef WITH_THREAD
|
#ifdef WITH_THREAD
|
||||||
#define HASTHREAD " THREADS"
|
#define HASTHREAD " THREADS"
|
||||||
|
|
|
@ -149,9 +149,7 @@ Socket methods:
|
||||||
# include <netdb.h>
|
# include <netdb.h>
|
||||||
typedef size_t socklen_t;
|
typedef size_t socklen_t;
|
||||||
# else
|
# else
|
||||||
# ifndef USE_GUSI1
|
|
||||||
# include <arpa/inet.h>
|
# include <arpa/inet.h>
|
||||||
# endif
|
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
# ifndef RISCOS
|
# ifndef RISCOS
|
||||||
|
@ -181,11 +179,6 @@ int h_errno; /* not used */
|
||||||
# define O_NDELAY O_NONBLOCK /* For QNX only? */
|
# define O_NDELAY O_NONBLOCK /* For QNX only? */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef USE_GUSI1
|
|
||||||
/* fdopen() isn't declared in stdio.h (sigh) */
|
|
||||||
# include <GUSI.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "addrinfo.h"
|
#include "addrinfo.h"
|
||||||
|
|
||||||
#ifndef HAVE_INET_PTON
|
#ifndef HAVE_INET_PTON
|
||||||
|
@ -2332,11 +2325,7 @@ PySocket_inet_aton(PyObject *self, PyObject *args)
|
||||||
if (!PyArg_ParseTuple(args, "s:inet_aton", &ip_addr)) {
|
if (!PyArg_ParseTuple(args, "s:inet_aton", &ip_addr)) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
#ifdef USE_GUSI1
|
|
||||||
packed_addr = inet_addr(ip_addr).s_addr;
|
|
||||||
#else
|
|
||||||
packed_addr = inet_addr(ip_addr);
|
packed_addr = inet_addr(ip_addr);
|
||||||
#endif
|
|
||||||
|
|
||||||
if (packed_addr == INADDR_NONE) { /* invalid address */
|
if (packed_addr == INADDR_NONE) { /* invalid address */
|
||||||
PyErr_SetString(PySocket_Error,
|
PyErr_SetString(PySocket_Error,
|
||||||
|
@ -3331,11 +3320,7 @@ inet_pton (int af, const char *src, void *dst)
|
||||||
{
|
{
|
||||||
if(af == AF_INET){
|
if(af == AF_INET){
|
||||||
long packed_addr;
|
long packed_addr;
|
||||||
#ifdef USE_GUSI1
|
|
||||||
packed_addr = (long)inet_addr(src).s_addr;
|
|
||||||
#else
|
|
||||||
packed_addr = inet_addr(src);
|
packed_addr = inet_addr(src);
|
||||||
#endif
|
|
||||||
if (packed_addr == INADDR_NONE)
|
if (packed_addr == INADDR_NONE)
|
||||||
return 0;
|
return 0;
|
||||||
memcpy(dst, &packed_addr, 4);
|
memcpy(dst, &packed_addr, 4);
|
||||||
|
|
|
@ -9,13 +9,6 @@
|
||||||
#ifdef macintosh
|
#ifdef macintosh
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
#include <OSUtils.h>
|
#include <OSUtils.h>
|
||||||
#ifdef USE_GUSI211
|
|
||||||
/* GUSI, the I/O library which has the time() function and such uses the
|
|
||||||
** Mac epoch of 1904. MSL, the C library which has localtime() and so uses
|
|
||||||
** the ANSI epoch of 1900.
|
|
||||||
*/
|
|
||||||
#define GUSI_TO_MSL_EPOCH (4*365*24*60*60)
|
|
||||||
#endif /* USE_GUSI2 */
|
|
||||||
#else
|
#else
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#endif
|
#endif
|
||||||
|
@ -259,9 +252,6 @@ time_convert(time_t when, struct tm * (*function)(const time_t *))
|
||||||
{
|
{
|
||||||
struct tm *p;
|
struct tm *p;
|
||||||
errno = 0;
|
errno = 0;
|
||||||
#if defined(macintosh) && defined(USE_GUSI204)
|
|
||||||
when = when + GUSI_TO_MSL_EPOCH;
|
|
||||||
#endif
|
|
||||||
p = function(&when);
|
p = function(&when);
|
||||||
if (p == NULL) {
|
if (p == NULL) {
|
||||||
#ifdef EINVAL
|
#ifdef EINVAL
|
||||||
|
@ -487,9 +477,6 @@ time_ctime(PyObject *self, PyObject *args)
|
||||||
return NULL;
|
return NULL;
|
||||||
tt = (time_t)dt;
|
tt = (time_t)dt;
|
||||||
}
|
}
|
||||||
#if defined(macintosh) && defined(USE_GUSI204)
|
|
||||||
tt = tt + GUSI_TO_MSL_EPOCH;
|
|
||||||
#endif
|
|
||||||
p = ctime(&tt);
|
p = ctime(&tt);
|
||||||
if (p == NULL) {
|
if (p == NULL) {
|
||||||
PyErr_SetString(PyExc_ValueError, "unconvertible time");
|
PyErr_SetString(PyExc_ValueError, "unconvertible time");
|
||||||
|
@ -526,9 +513,6 @@ time_mktime(PyObject *self, PyObject *args)
|
||||||
"mktime argument out of range");
|
"mktime argument out of range");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
#if defined(macintosh) && defined(USE_GUSI211)
|
|
||||||
tt = tt - GUSI_TO_MSL_EPOCH;
|
|
||||||
#endif
|
|
||||||
return PyFloat_FromDouble((double)tt);
|
return PyFloat_FromDouble((double)tt);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1139,9 +1139,6 @@ find_module(char *realname, PyObject *path, char *buf, size_t buflen,
|
||||||
|
|
||||||
#elif defined(macintosh)
|
#elif defined(macintosh)
|
||||||
#include <TextUtils.h>
|
#include <TextUtils.h>
|
||||||
#ifdef USE_GUSI1
|
|
||||||
#include "TFileSpec.h" /* for Path2FSSpec() */
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#elif defined(__MACH__) && defined(__APPLE__) && defined(HAVE_DIRENT_H)
|
#elif defined(__MACH__) && defined(__APPLE__) && defined(HAVE_DIRENT_H)
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
|
@ -1215,25 +1212,7 @@ case_ok(char *buf, int len, int namelen, char *name)
|
||||||
if (Py_GETENV("PYTHONCASEOK") != NULL)
|
if (Py_GETENV("PYTHONCASEOK") != NULL)
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
#ifndef USE_GUSI1
|
|
||||||
err = FSMakeFSSpec(0, 0, Pstring(buf), &fss);
|
err = FSMakeFSSpec(0, 0, Pstring(buf), &fss);
|
||||||
#else
|
|
||||||
/* GUSI's Path2FSSpec() resolves all possible aliases nicely on
|
|
||||||
the way, which is fine for all directories, but here we need
|
|
||||||
the original name of the alias file (say, Dlg.ppc.slb, not
|
|
||||||
toolboxmodules.ppc.slb). */
|
|
||||||
char *colon;
|
|
||||||
err = Path2FSSpec(buf, &fss);
|
|
||||||
if (err == noErr) {
|
|
||||||
colon = strrchr(buf, ':'); /* find filename */
|
|
||||||
if (colon != NULL)
|
|
||||||
err = FSMakeFSSpec(fss.vRefNum, fss.parID,
|
|
||||||
Pstring(colon+1), &fss);
|
|
||||||
else
|
|
||||||
err = FSMakeFSSpec(fss.vRefNum, fss.parID,
|
|
||||||
fss.name, &fss);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
if (err) {
|
if (err) {
|
||||||
PyErr_Format(PyExc_NameError,
|
PyErr_Format(PyExc_NameError,
|
||||||
"Can't find file for module %.100s\n(filename %.300s)",
|
"Can't find file for module %.100s\n(filename %.300s)",
|
||||||
|
|
Loading…
Reference in New Issue