mirror of
https://github.com/python/cpython.git
synced 2025-07-24 03:35:53 +00:00
Patches by William Lewis for Nextstep descendants.
This commit is contained in:
parent
b5cebfe164
commit
54ecc3d24f
13 changed files with 688 additions and 327 deletions
|
@ -100,7 +100,7 @@ MAINOBJ= python.o
|
|||
SYSLIBS= $(LIBM) $(LIBC)
|
||||
|
||||
LIBRARY= ../libpython$(VERSION).a
|
||||
REALLIBRARY= ../@REALLIBRARY@
|
||||
LDLIBRARY= ../@LDLIBRARY@
|
||||
|
||||
# === Rules ===
|
||||
|
||||
|
@ -123,7 +123,7 @@ EXE=
|
|||
# This target is used by the master Makefile to link the final binary.
|
||||
link: $(MAINOBJ)
|
||||
$(LINKCC) $(LDFLAGS) $(LINKFORSHARED) $(MAINOBJ) \
|
||||
$(LIBRARY) $(MODLIBS) $(LIBS) $(SYSLIBS) -o python $(LDLAST)
|
||||
$(LDLIBRARY) $(MODLIBS) $(LIBS) $(SYSLIBS) -o python $(LDLAST)
|
||||
mv python$(EXE) ../python$(EXE)
|
||||
|
||||
clean:
|
||||
|
|
|
@ -30,7 +30,7 @@
|
|||
const char *
|
||||
Py_GetBuildInfo()
|
||||
{
|
||||
static char buildinfo[40];
|
||||
sprintf(buildinfo, "#%d, %.12s, %.8s", BUILD, DATE, TIME);
|
||||
static char buildinfo[50];
|
||||
sprintf(buildinfo, "#%d, %.20s, %.9s", BUILD, DATE, TIME);
|
||||
return buildinfo;
|
||||
}
|
||||
|
|
|
@ -42,6 +42,10 @@ PERFORMANCE OF THIS SOFTWARE.
|
|||
#include <unistd.h>
|
||||
#endif /* HAVE_UNISTD_H */
|
||||
|
||||
#ifdef WITH_NEXT_FRAMEWORK
|
||||
#include <mach-o/dyld.h>
|
||||
#endif
|
||||
|
||||
/* Search in some common locations for the associated Python libraries.
|
||||
*
|
||||
* Two directories must be found, the platform independent directory
|
||||
|
@ -394,7 +398,24 @@ calculate_path()
|
|||
int bufsz;
|
||||
int prefixsz;
|
||||
char *defpath = pythonpath;
|
||||
#ifdef WITH_NEXT_FRAMEWORK
|
||||
NSModule pythonModule;
|
||||
#endif
|
||||
|
||||
#ifdef WITH_NEXT_FRAMEWORK
|
||||
pythonModule = NSModuleForSymbol(NSLookupAndBindSymbol("_Py_Initialize"));
|
||||
/* Use dylib functions to find out where the framework was loaded from */
|
||||
buf = NSLibraryNameForModule(pythonModule);
|
||||
if (buf != NULL) {
|
||||
/* We're in a framework. */
|
||||
strcpy(progpath, buf);
|
||||
|
||||
/* Frameworks have support for versioning */
|
||||
strcpy(lib_python, "lib");
|
||||
} else {
|
||||
/* If we're not in a framework, fall back to the old way (even though NSNameOfModule() probably does the same thing.) */
|
||||
#endif
|
||||
|
||||
/* Initialize this dynamically for K&R C */
|
||||
sprintf(lib_python, "lib/python%s", VERSION);
|
||||
|
||||
|
@ -430,6 +451,9 @@ calculate_path()
|
|||
}
|
||||
else
|
||||
progpath[0] = '\0';
|
||||
#ifdef WITH_NEXT_FRAMEWORK
|
||||
}
|
||||
#endif
|
||||
|
||||
strcpy(argv0_path, progpath);
|
||||
|
||||
|
|
|
@ -146,6 +146,7 @@ corresponding Unix manual entries for more information on calls.";
|
|||
#undef HAVE_UTIME_H
|
||||
#define HAVE_WAITPID
|
||||
/* #undef HAVE_GETCWD */
|
||||
#define UNION_WAIT /* This should really be checked for by autoconf */
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_UNISTD_H
|
||||
|
@ -255,6 +256,23 @@ extern int lstat Py_PROTO((const char *, struct stat *));
|
|||
#include <io.h>
|
||||
#endif /* OS2 */
|
||||
|
||||
#ifdef UNION_WAIT
|
||||
/* Emulate some macros on systems that have a union instead of macros */
|
||||
|
||||
#ifndef WIFEXITED
|
||||
#define WIFEXITED(u_wait) (!(u_wait).w_termsig && !(u_wait).w_coredump)
|
||||
#endif
|
||||
|
||||
#ifndef WEXITSTATUS
|
||||
#define WEXITSTATUS(u_wait) (WIFEXITED(u_wait)?((u_wait).w_retcode):-1)
|
||||
#endif
|
||||
|
||||
#ifndef WTERMSIG
|
||||
#define WTERMSIG(u_wait) ((u_wait).w_termsig)
|
||||
#endif
|
||||
|
||||
#endif /* UNION_WAIT */
|
||||
|
||||
/* Return a dictionary corresponding to the POSIX environment table */
|
||||
|
||||
#if !defined(_MSC_VER) && ( !defined(__WATCOMC__) || defined(__QNX__) )
|
||||
|
@ -1986,20 +2004,25 @@ posix_waitpid(self, args)
|
|||
PyObject *self;
|
||||
PyObject *args;
|
||||
{
|
||||
int pid, options, sts = 0;
|
||||
int pid, options;
|
||||
#ifdef UNION_WAIT
|
||||
union wait status;
|
||||
#define status_i (status.w_status)
|
||||
#else
|
||||
int status;
|
||||
#define status_i status
|
||||
#endif
|
||||
status_i = 0;
|
||||
|
||||
if (!PyArg_Parse(args, "(ii)", &pid, &options))
|
||||
return NULL;
|
||||
Py_BEGIN_ALLOW_THREADS
|
||||
#ifdef NeXT
|
||||
pid = wait4(pid, (union wait *)&sts, options, NULL);
|
||||
#else
|
||||
pid = waitpid(pid, &sts, options);
|
||||
#endif
|
||||
pid = wait4(pid, &status, options, NULL);
|
||||
Py_END_ALLOW_THREADS
|
||||
if (pid == -1)
|
||||
return posix_error();
|
||||
else
|
||||
return Py_BuildValue("ii", pid, sts);
|
||||
return Py_BuildValue("ii", pid, status_i);
|
||||
}
|
||||
#endif /* HAVE_WAITPID */
|
||||
|
||||
|
@ -2015,17 +2038,21 @@ posix_wait(self, args)
|
|||
PyObject *args;
|
||||
{
|
||||
int pid, sts;
|
||||
Py_BEGIN_ALLOW_THREADS
|
||||
#ifdef NeXT
|
||||
pid = wait((union wait *)&sts);
|
||||
#ifdef UNION_WAIT
|
||||
union wait status;
|
||||
#define status_i (status.w_status)
|
||||
#else
|
||||
pid = wait(&sts);
|
||||
int status;
|
||||
#define status_i status
|
||||
#endif
|
||||
status_i = 0;
|
||||
Py_BEGIN_ALLOW_THREADS
|
||||
pid = wait(&status);
|
||||
Py_END_ALLOW_THREADS
|
||||
if (pid == -1)
|
||||
return posix_error();
|
||||
else
|
||||
return Py_BuildValue("ii", pid, sts);
|
||||
return Py_BuildValue("ii", pid, status_i);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -2821,9 +2848,16 @@ posix_WIFSTOPPED(self, args)
|
|||
PyObject *self;
|
||||
PyObject *args;
|
||||
{
|
||||
int status = 0;
|
||||
#ifdef UNION_WAIT
|
||||
union wait status;
|
||||
#define status_i (status.w_status)
|
||||
#else
|
||||
int status;
|
||||
#define status_i status
|
||||
#endif
|
||||
status_i = 0;
|
||||
|
||||
if (!PyArg_Parse(args, "i", &status))
|
||||
if (!PyArg_Parse(args, "i", &status_i))
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
@ -2842,9 +2876,16 @@ posix_WIFSIGNALED(self, args)
|
|||
PyObject *self;
|
||||
PyObject *args;
|
||||
{
|
||||
int status = 0;
|
||||
#ifdef UNION_WAIT
|
||||
union wait status;
|
||||
#define status_i (status.w_status)
|
||||
#else
|
||||
int status;
|
||||
#define status_i status
|
||||
#endif
|
||||
status_i = 0;
|
||||
|
||||
if (!PyArg_Parse(args, "i", &status))
|
||||
if (!PyArg_Parse(args, "i", &status_i))
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
@ -2863,9 +2904,16 @@ posix_WIFEXITED(self, args)
|
|||
PyObject *self;
|
||||
PyObject *args;
|
||||
{
|
||||
int status = 0;
|
||||
#ifdef UNION_WAIT
|
||||
union wait status;
|
||||
#define status_i (status.w_status)
|
||||
#else
|
||||
int status;
|
||||
#define status_i status
|
||||
#endif
|
||||
status_i = 0;
|
||||
|
||||
if (!PyArg_Parse(args, "i", &status))
|
||||
if (!PyArg_Parse(args, "i", &status_i))
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
@ -2874,7 +2922,7 @@ posix_WIFEXITED(self, args)
|
|||
}
|
||||
#endif /* WIFEXITED */
|
||||
|
||||
#ifdef WIFSTOPPED
|
||||
#ifdef WEXITSTATUS
|
||||
static char posix_WEXITSTATUS__doc__[] =
|
||||
"WEXITSTATUS(status) -> integer\n\
|
||||
See Unix documentation.";
|
||||
|
@ -2884,9 +2932,16 @@ posix_WEXITSTATUS(self, args)
|
|||
PyObject *self;
|
||||
PyObject *args;
|
||||
{
|
||||
int status = 0;
|
||||
#ifdef UNION_WAIT
|
||||
union wait status;
|
||||
#define status_i (status.w_status)
|
||||
#else
|
||||
int status;
|
||||
#define status_i status
|
||||
#endif
|
||||
status_i = 0;
|
||||
|
||||
if (!PyArg_Parse(args, "i", &status))
|
||||
if (!PyArg_Parse(args, "i", &status_i))
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
@ -2905,9 +2960,16 @@ posix_WTERMSIG(self, args)
|
|||
PyObject *self;
|
||||
PyObject *args;
|
||||
{
|
||||
int status = 0;
|
||||
#ifdef UNION_WAIT
|
||||
union wait status;
|
||||
#define status_i (status.w_status)
|
||||
#else
|
||||
int status;
|
||||
#define status_i status
|
||||
#endif
|
||||
status_i = 0;
|
||||
|
||||
if (!PyArg_Parse(args, "i", &status))
|
||||
if (!PyArg_Parse(args, "i", &status_i))
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
@ -2926,9 +2988,16 @@ posix_WSTOPSIG(self, args)
|
|||
PyObject *self;
|
||||
PyObject *args;
|
||||
{
|
||||
int status = 0;
|
||||
#ifdef UNION_WAIT
|
||||
union wait status;
|
||||
#define status_i (status.w_status)
|
||||
#else
|
||||
int status;
|
||||
#define status_i status
|
||||
#endif
|
||||
status_i = 0;
|
||||
|
||||
if (!PyArg_Parse(args, "i", &status))
|
||||
if (!PyArg_Parse(args, "i", &status_i))
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
|
|
@ -34,6 +34,7 @@ extern int rl_bind_key();
|
|||
extern int rl_bind_key_in_map();
|
||||
extern int rl_initialize();
|
||||
extern int add_history();
|
||||
extern Function *rl_event_hook;
|
||||
#endif
|
||||
|
||||
/* Pointers needed from outside (but not declared in a header file). */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue